*When alliance and horde are in same group, also display pets as friendly.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-24 12:56:09 -05:00
parent a4c88418ea
commit 452bda72a1
+49 -38
View File
@@ -551,72 +551,83 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
*data << uint32(m_floatValues[ index ]); *data << uint32(m_floatValues[ index ]);
} }
// Gamemasters should be always able to select units - remove not selectable flag // Gamemasters should be always able to select units - remove not selectable flag
else if(index == UNIT_FIELD_FLAGS && target->isGameMaster()) else if(index == UNIT_FIELD_FLAGS)
{ {
*data << (m_uint32Values[ index ] & ~UNIT_FLAG_NOT_SELECTABLE); if(target->isGameMaster())
*data << (m_uint32Values[ index ] & ~UNIT_FLAG_NOT_SELECTABLE);
else
*data << m_uint32Values[ index ];
} }
// use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures // use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
else if(index == UNIT_FIELD_DISPLAYID && GetTypeId() == TYPEID_UNIT) else if(index == UNIT_FIELD_DISPLAYID)
{ {
const CreatureInfo* cinfo = ((Creature*)this)->GetCreatureInfo(); if(GetTypeId() == TYPEID_UNIT)
if(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
{ {
if(target->isGameMaster()) const CreatureInfo* cinfo = ((Creature*)this)->GetCreatureInfo();
if(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
{ {
if(cinfo->Modelid_A2) if(target->isGameMaster())
*data << cinfo->Modelid_A1; {
if(cinfo->Modelid_A1)
*data << cinfo->Modelid_A1;
else
*data << 17519; // world invisible trigger's model
}
else else
*data << 17519; // world invisible trigger's model {
if(cinfo->Modelid_A2)
*data << cinfo->Modelid_A2;
else
*data << 11686; // world invisible trigger's model
}
} }
else else
{ *data << m_uint32Values[ index ];
if(cinfo->Modelid_A2)
*data << cinfo->Modelid_A2;
else
*data << 11686; // world invisible trigger's model
}
} }
else else
*data << m_uint32Values[ index ]; *data << m_uint32Values[ index ];
} }
// hide lootable animation for unallowed players // hide lootable animation for unallowed players
else if(index == UNIT_DYNAMIC_FLAGS && GetTypeId() == TYPEID_UNIT) else if(index == UNIT_DYNAMIC_FLAGS)
{ {
if(!target->isAllowedToLoot((Creature*)this)) if(GetTypeId() == TYPEID_UNIT)
*data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_LOOTABLE); {
if(!target->isAllowedToLoot((Creature*)this))
*data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_LOOTABLE);
else
*data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_OTHER_TAGGER);
}
else else
*data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_OTHER_TAGGER); *data << m_uint32Values[ index ];
} }
// FG: pretend that OTHER players in own group are friendly ("blue") // FG: pretend that OTHER players in own group are friendly ("blue")
else if(index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE) else if(index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
{ {
bool ch = false; if(((Unit*)this)->IsControlledByPlayer() && target != this && sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && ((Unit*)this)->IsInRaidWith(target))
if(GetTypeId() == TYPEID_PLAYER && target != this
&& ((Player*)this)->IsInSameRaidWith(target))
{ {
// Allow targetting opposite faction in party when enabled in config FactionTemplateEntry const *ft1, *ft2;
if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && index == UNIT_FIELD_BYTES_2) ft1 = ((Unit*)this)->getFactionTemplateEntry();
ft2 = target->getFactionTemplateEntry();
if(ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
{ {
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (flag)", target->GetName(), ((Player*)this)->GetName()); if(index == UNIT_FIELD_BYTES_2)
*data << ( m_uint32Values[ index ] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8) ); // this flag is at uint8 offset 1 !!
ch = true;
}
else
{
FactionTemplateEntry const *ft1, *ft2;
ft1 = ((Player*)this)->getFactionTemplateEntry();
ft2 = target->getFactionTemplateEntry();
if(ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
{ {
uint32 faction = target->getFaction(); // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work) // Allow targetting opposite faction in party when enabled in config
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (flag)", target->GetName(), ((Player*)this)->GetName());
*data << ( m_uint32Values[ index ] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8) ); // this flag is at uint8 offset 1 !!
}
else
{
// pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
uint32 faction = target->getFaction();
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (faction %u)", target->GetName(), ((Player*)this)->GetName(), faction); DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (faction %u)", target->GetName(), ((Player*)this)->GetName(), faction);
*data << uint32(faction); *data << uint32(faction);
ch = true;
} }
} }
else
*data << m_uint32Values[ index ];
} }
if(!ch) else
*data << m_uint32Values[ index ]; *data << m_uint32Values[ index ];
} }
else else