diff options
author | megamage <none@none> | 2009-01-16 14:32:47 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-01-16 14:32:47 -0600 |
commit | 80263de422ad4e1cdb103eaec3a2acf74631f884 (patch) | |
tree | b4da0d56676c397cd0ef5a83039e458f67ddd411 /src/game/Object.cpp | |
parent | 40a1154c5befcfde3d584c71aa1d9a8b6cb1b638 (diff) | |
parent | a8e7fb16493c05a25044c01c5b58ea08e485a97a (diff) |
Update to Trinity 863.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 226129c392d..50ed59d2486 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -653,6 +653,38 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask else *data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_OTHER_TAGGER); } + // FG: pretend that OTHER players in own group are friendly ("blue") + else if(index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE) + { + bool ch = false; + if(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER && target != this) + { + if(target->IsInSameGroupWith((Player*)this) || target->IsInSameRaidWith((Player*)this)) + { + if(index == UNIT_FIELD_BYTES_2) + { + 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 << 8) ); // this flag is at uint8 offset 1 !! + ch = true; + } + else if(index == UNIT_FIELD_FACTIONTEMPLATE) + { + FactionTemplateEntry const *ft1, *ft2; + ft1 = ((Player*)this)->getFactionTemplateEntry(); + ft2 = ((Player*)target)->getFactionTemplateEntry(); + if(ft1 && ft2 && !ft1->IsFriendlyTo(*ft2)) + { + uint32 faction = ((Player*)target)->getFaction(); // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work) + DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (faction %u)", target->GetName(), ((Player*)this)->GetName(), faction); + *data << uint32(faction); + ch = true; + } + } + } + } + if(!ch) + *data << m_uint32Values[ index ]; + } else { // send in current format (float as float, uint32 as uint32) @@ -1324,6 +1356,19 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf) SendMessageToSet( &data, true ); // ToSelf ignored in this case } +void Object::ForceValuesUpdateAtIndex(uint32 i) +{ + m_uint32Values_mirror[i] = GetUInt32Value(i) + 1; // makes server think the field changed + if(m_inWorld) + { + if(!m_objectUpdated) + { + ObjectAccessor::Instance().AddUpdateObject(this); + m_objectUpdated = true; + } + } +} + namespace Trinity { class MessageChatLocaleCacheDo |