void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const { ByteBuffer buf(500); buf << (uint8) UPDATETYPE_VALUES; // update type == creation buf << GetGUID() ; // object GUID UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetUpdateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); }
void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const { ByteBuffer buf(500); buf << (uint8) UPDATETYPE_VALUES; buf << (uint8) 0xFF; // must be packed GUID ? buf << GetGUID(); UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetUpdateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); }
void Group::UpdateAllOutOfRangePlayersFor(Player * pPlayer) { WorldPacket data(150); WorldPacket data2(150); if(m_SubGroupCount>8) return; /* tell the other players about us */ UpdateOutOfRangePlayer(pPlayer, GROUP_UPDATE_TYPE_FULL_CREATE, true, &data2); /* tell us any other players we don't know about */ Player * plr; bool u1, u2; UpdateMask myMask; myMask.SetCount(PLAYER_END); UpdateMask hisMask; hisMask.SetCount(PLAYER_END); m_groupLock.Acquire(); for(uint32 i = 0; i < m_SubGroupCount; ++i) { if(m_SubGroups[i]== NULL) continue; for(GroupMembersSet::iterator itr = m_SubGroups[i]->GetGroupMembersBegin(); itr != m_SubGroups[i]->GetGroupMembersEnd(); ++itr) { plr = (*itr)->m_loggedInPlayer; if(!plr || plr == pPlayer) continue; if(!plr->IsVisible(pPlayer->GetGUID())) { UpdateOutOfRangePlayer(plr, GROUP_UPDATE_TYPE_FULL_CREATE, false, &data); pPlayer->GetSession()->SendPacket(&data); } else { if(pPlayer->GetSubGroup() == plr->GetSubGroup()) { /* distribute quest fields to other players */ hisMask.Clear(); myMask.Clear(); u1 = u2 = false; for(uint32 j = PLAYER_QUEST_LOG_1_1; j <= PLAYER_QUEST_LOG_25_5; ++j) { if(plr->GetUInt32Value(j)) { hisMask.SetBit(j); u1 = true; } if(pPlayer->GetUInt32Value(j)) { u2 = true; myMask.SetBit(j); } } if(u1) { data.clear(); plr->BuildValuesUpdateBlockForPlayer(&data, &hisMask); pPlayer->PushUpdateData(&data, 1); } if(u2) { data.clear(); pPlayer->BuildValuesUpdateBlockForPlayer(&data, &myMask); plr->PushUpdateData(&data, 1); } } } } } m_groupLock.Release(); }
void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const { if(!target) return; ByteBuffer buf(500); buf << uint8( UPDATETYPE_CREATE_OBJECT ); buf << uint8( 0xFF ); buf << GetGUID() ; buf << m_objectTypeId; switch(m_objectTypeId) { case TYPEID_OBJECT: //do nothing break; case TYPEID_ITEM: case TYPEID_CONTAINER: _BuildMovementUpdate( &buf, 0x10, 0x0 ); break; case TYPEID_UNIT: _BuildMovementUpdate( &buf, 0x70, 0x800000 ); break; case TYPEID_PLAYER: { if( target == this ) //build for self { buf.clear(); buf << uint8( UPDATETYPE_CREATE_OBJECT2 ); buf << uint8( 0xFF ); // must be packet GUID ? buf << GetGUID() ; buf << m_objectTypeId; _BuildMovementUpdate( &buf, 0x71, 0x2000 ); } //build for other player else { _BuildMovementUpdate( &buf, 0x70, 0x0 ); } }break; case TYPEID_CORPSE: case TYPEID_GAMEOBJECT: case TYPEID_DYNAMICOBJECT: { if ((GUID_HIPART(GetGUID())==HIGHGUID_PLAYER_CORPSE) || (GUID_HIPART(GetGUID()) == HIGHGUID_TRANSPORT)) _BuildMovementUpdate( &buf, 0x52, 0x0 ); else _BuildMovementUpdate( &buf, 0x50, 0x0 ); }break; //case TYPEID_AIGROUP: //case TYPEID_AREATRIGGER: //break; default: //know type sLog.outDetail("Unknown Object Type %u Create Update Block.\n", m_objectTypeId); break; } UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); }
void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const { //they can see ANYONE or ANYTHING in a 30f radius from their corpse//FIX ME #ifndef ENABLE_GRID_SYSTEM Creature *creat = objmgr.GetObject<Creature>(GetGUID()); #else const Creature *creat = dynamic_cast<const Creature *>(this); #endif if(target->isAlive()) { //if creature exists and its spirit healer return if (creat && creat->GetUInt32Value(UNIT_FIELD_DISPLAYID) == 5233) { return; } if (creat) //if creature exists and isnt spririt healer update { ByteBuffer buf(500); // update type == creation buf << uint8( UPDATETYPE_CREATE_OBJECT ); buf << GetGUID() ; // object GUID buf << GetTypeId(); // object type // build and add the movement update portion of the packet _BuildMovementUpdate( &buf, 0x00000000, 0x00000000 ); // 4 byte flags, 1 == active player buf << uint32( target == this ? 1 : 0 ); buf << uint32( 0 ); // uint32 attack cycle buf << uint32( 0 ); // uint32 timer id buf << uint64( 0 ); // GUID victim UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); } else if(!creat) //if there isnt any creature { #ifndef ENABLE_GRID_SYSTEM Player *plyr = objmgr.GetObject<Player>(GetGUID()); #else Player *plyr = ObjectAccessor::Instance().FindPlayer(GetGUID()); #endif // if player exists and player and target is in group and player is dead if(plyr && plyr!=target && plyr->IsInGroup() && target->IsInGroup() && plyr->isDead()) { if(plyr->IsGroupMember(target)) //if its group member of target update { ByteBuffer buf(500); // update type == creation buf << uint8( UPDATETYPE_CREATE_OBJECT ); buf << GetGUID() ; // object GUID buf << GetTypeId(); // object type // build and add the movement update portion of the packet _BuildMovementUpdate( &buf, 0x00000000, 0x00000000 ); // 4 byte flags, 1 == active player buf << uint32( target == this ? 1 : 0 ); buf << uint32( 0 ); // uint32 attack cycle buf << uint32( 0 ); // uint32 timer id buf << uint64( 0 ); // GUID victim UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); } else //if isnt party member and dead return { return; } } else if(plyr && plyr->isDead()) //if player isnt in a group and dead return { return; } // player end else //self update { ByteBuffer buf(500); // update type == creation buf << uint8( UPDATETYPE_CREATE_OBJECT ); buf << GetGUID() ; // object GUID buf << GetTypeId(); // object type // build and add the movement update portion of the packet _BuildMovementUpdate( &buf, 0x00000000, 0x00000000 ); // 4 byte flags, 1 == active player buf << uint32( target == this ? 1 : 0 ); buf << uint32( 0 ); // uint32 attack cycle buf << uint32( 0 ); // uint32 timer id buf << uint64( 0 ); // GUID victim UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); } } /* else //is it needed { ByteBuffer buf(500); buf << uint8( UPDATETYPE_CREATE_OBJECT );// update type == creation buf << GetGUID() ; // object GUID buf << GetTypeId(); // object type // build and add the movement update portion of the packet _BuildMovementUpdate( &buf, 0x00000000, 0x00000000 ); buf << uint32( target == this ? 1 : 0 ); // 4 byte flags, 1 == active player buf << uint32( 0 ); // uint32 attack cycle buf << uint32( 0 ); // uint32 timer id buf << uint64( 0 ); // GUID victim UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); } */ } if(target->isDead()) { if(!creat) { #ifndef ENABLE_GRID_SYSTEM Player *plyr = objmgr.GetObject<Player>(GetGUID()); #else Player *plyr = ObjectAccessor::Instance().FindPlayer(GetGUID()); #endif // if player and player is in group of target update if(plyr && plyr->IsGroupMember(target)) { ByteBuffer buf(500); // update type == creation buf << uint8( UPDATETYPE_CREATE_OBJECT ); buf << GetGUID() ; // object GUID buf << GetTypeId(); // object type // build and add the movement update portion of the packet _BuildMovementUpdate( &buf, 0x00000000, 0x00000000 ); // 4 byte flags, 1 == active player buf << uint32( target == this ? 1 : 0 ); buf << uint32( 0 ); // uint32 attack cycle buf << uint32( 0 ); // uint32 timer id buf << uint64( 0 ); // GUID victim UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); } else if(plyr && plyr->isAlive()) //if player is alive and they are in different groups return { return; } else //if player and target is dead update or self update { ByteBuffer buf(500); // update type == creation buf << uint8( UPDATETYPE_CREATE_OBJECT ); buf << GetGUID() ; // object GUID buf << GetTypeId(); // object type // build and add the movement update portion of the packet _BuildMovementUpdate( &buf, 0x00000000, 0x00000000 ); // 4 byte flags, 1 == active player buf << uint32( target == this ? 1 : 0 ); buf << uint32( 0 ); // uint32 attack cycle buf << uint32( 0 ); // uint32 timer id buf << uint64( 0 ); // GUID victim UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); } } // if creature exists and its spirit healer update else if(creat && creat->GetUInt32Value(UNIT_FIELD_DISPLAYID) == 5233) { ByteBuffer buf(500); // update type == creation buf << uint8( UPDATETYPE_CREATE_OBJECT ); buf << GetGUID() ; // object GUID buf << GetTypeId(); // object type // build and add the movement update portion of the packet _BuildMovementUpdate( &buf, 0x00000000, 0x00000000 ); // 4 byte flags, 1 == active player buf << uint32( target == this ? 1 : 0 ); buf << uint32( 0 ); // uint32 attack cycle buf << uint32( 0 ); // uint32 timer id buf << uint64( 0 ); // GUID victim UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); } else if(creat) //if creature exists and its not spirit healer reaturn { return; } else //Does it needed?Want to know test it then. { ByteBuffer buf(500); // update type == creation buf << uint8( UPDATETYPE_CREATE_OBJECT ); buf << GetGUID() ; // object GUID buf << GetTypeId(); // object type // build and add the movement update portion of the packet _BuildMovementUpdate( &buf, 0x00000000, 0x00000000 ); // 4 byte flags, 1 == active player buf << uint32( target == this ? 1 : 0 ); buf << uint32( 0 ); // uint32 attack cycle buf << uint32( 0 ); // uint32 timer id buf << uint64( 0 ); // GUID victim UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); data->AddUpdateBlock(buf); } } }