Fixed some opcodes

This commit is contained in:
tomrus88 2009-02-27 19:25:11 +03:00
parent 42a8ae3752
commit ffca6c8c57
9 changed files with 74 additions and 62 deletions

View file

@ -1028,6 +1028,7 @@ void ChatHandler::FillMessageData( WorldPacket *data, WorldSession* session, uin
case CHAT_MSG_MONSTER_EMOTE: case CHAT_MSG_MONSTER_EMOTE:
case CHAT_MSG_RAID_BOSS_WHISPER: case CHAT_MSG_RAID_BOSS_WHISPER:
case CHAT_MSG_RAID_BOSS_EMOTE: case CHAT_MSG_RAID_BOSS_EMOTE:
case CHAT_MSG_BN:
{ {
*data << uint64(speaker->GetGUID()); *data << uint64(speaker->GetGUID());
*data << uint32(0); // 2.1.0 *data << uint32(0); // 2.1.0

View file

@ -355,7 +355,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
} }
data << pProto->ScalingStatDistribution; // scaling stats distribution data << pProto->ScalingStatDistribution; // scaling stats distribution
data << pProto->ScalingStatValue; // some kind of flags used to determine stat values column data << pProto->ScalingStatValue; // some kind of flags used to determine stat values column
for(int i = 0; i < 5; ++i) for(int i = 0; i < 2; ++i)
{ {
data << pProto->Damage[i].DamageMin; data << pProto->Damage[i].DamageMin;
data << pProto->Damage[i].DamageMax; data << pProto->Damage[i].DamageMax;
@ -440,6 +440,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
data << pProto->ArmorDamageModifier; data << pProto->ArmorDamageModifier;
data << pProto->Duration; // added in 2.4.2.8209, duration (seconds) data << pProto->Duration; // added in 2.4.2.8209, duration (seconds)
data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory
data << uint32(0); // Holiday.dbc?
SendPacket( &data ); SendPacket( &data );
} }
else else

View file

@ -523,7 +523,7 @@ struct ItemPrototype
_ItemStat ItemStat[10]; _ItemStat ItemStat[10];
uint32 ScalingStatDistribution; // id from ScalingStatDistribution.dbc uint32 ScalingStatDistribution; // id from ScalingStatDistribution.dbc
uint32 ScalingStatValue; // mask for selecting column in ScalingStatValues.dbc uint32 ScalingStatValue; // mask for selecting column in ScalingStatValues.dbc
_Damage Damage[5]; _Damage Damage[2];
uint32 Armor; uint32 Armor;
uint32 HolyRes; uint32 HolyRes;
uint32 FireRes; uint32 FireRes;
@ -634,8 +634,8 @@ struct ItemPrototype
if (Delay == 0) if (Delay == 0)
return 0; return 0;
float temp = 0; float temp = 0;
for (int i=0;i<5;++i) for (int i = 0; i < 2; ++i)
temp+=Damage[i].DamageMin + Damage[i].DamageMax; temp += Damage[i].DamageMin + Damage[i].DamageMax;
return temp*500/Delay; return temp*500/Delay;
} }

View file

@ -1163,9 +1163,10 @@ void WorldSession::HandlePlayedTime(WorldPacket& /*recv_data*/)
uint32 TotalTimePlayed = GetPlayer()->GetTotalPlayedTime(); uint32 TotalTimePlayed = GetPlayer()->GetTotalPlayedTime();
uint32 LevelPlayedTime = GetPlayer()->GetLevelPlayedTime(); uint32 LevelPlayedTime = GetPlayer()->GetLevelPlayedTime();
WorldPacket data(SMSG_PLAYED_TIME, 8); WorldPacket data(SMSG_PLAYED_TIME, 9);
data << TotalTimePlayed; data << TotalTimePlayed;
data << LevelPlayedTime; data << LevelPlayedTime;
data << uint8(0);
SendPacket(&data); SendPacket(&data);
} }

View file

@ -1545,7 +1545,7 @@ void ObjectMgr::LoadItemPrototypes()
} }
} }
for (int j = 0; j < 5; j++) for (int j = 0; j < 2; j++)
{ {
if(proto->Damage[j].DamageType >= MAX_SPELL_SCHOOL) if(proto->Damage[j].DamageType >= MAX_SPELL_SCHOOL)
{ {

View file

@ -2417,7 +2417,7 @@ void Player::SendInitialSpells()
if(!itr->second->active || itr->second->disabled) if(!itr->second->active || itr->second->disabled)
continue; continue;
data << uint16(itr->first); data << uint32(itr->first);
data << uint16(0); // it's not slot id data << uint16(0); // it's not slot id
spellCount +=1; spellCount +=1;
@ -2433,7 +2433,7 @@ void Player::SendInitialSpells()
if(!sEntry) if(!sEntry)
continue; continue;
data << uint16(itr->first); data << uint32(itr->first);
time_t cooldown = 0; time_t cooldown = 0;
time_t curTime = time(NULL); time_t curTime = time(NULL);
@ -2626,14 +2626,14 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{ {
// update spell ranks in spellbook and action bar // update spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
data << uint16(spell_id); data << uint32(spell_id);
data << uint16(next_active_spell_id); data << uint32(next_active_spell_id);
GetSession()->SendPacket( &data ); GetSession()->SendPacket( &data );
} }
else else
{ {
WorldPacket data(SMSG_REMOVED_SPELL, 4); WorldPacket data(SMSG_REMOVED_SPELL, 4);
data << uint16(spell_id); data << uint32(spell_id);
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }
} }
@ -2725,8 +2725,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if(IsInWorld()) // not send spell (re-/over-)learn packets at loading if(IsInWorld()) // not send spell (re-/over-)learn packets at loading
{ {
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
data << uint16(itr->first); data << uint32(itr->first);
data << uint16(spell_id); data << uint32(spell_id);
GetSession()->SendPacket( &data ); GetSession()->SendPacket( &data );
} }
@ -2741,8 +2741,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if(IsInWorld()) // not send spell (re-/over-)learn packets at loading if(IsInWorld()) // not send spell (re-/over-)learn packets at loading
{ {
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
data << uint16(spell_id); data << uint32(spell_id);
data << uint16(itr->first); data << uint32(itr->first);
GetSession()->SendPacket( &data ); GetSession()->SendPacket( &data );
} }
@ -3093,8 +3093,8 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
{ {
// downgrade spell ranks in spellbook and action bar // downgrade spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
data << uint16(spell_id); data << uint32(spell_id);
data << uint16(prev_id); data << uint32(prev_id);
GetSession()->SendPacket( &data ); GetSession()->SendPacket( &data );
prev_activate = true; prev_activate = true;
} }
@ -3108,7 +3108,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
if(!prev_activate) if(!prev_activate)
{ {
WorldPacket data(SMSG_REMOVED_SPELL, 4); WorldPacket data(SMSG_REMOVED_SPELL, 4);
data << uint16(spell_id); data << uint32(spell_id);
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }
} }
@ -3131,7 +3131,7 @@ void Player::RemoveArenaSpellCooldowns()
// notify player // notify player
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
data << uint32(itr->first); data << uint32(itr->first);
data << GetGUID(); data << uint64(GetGUID());
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
// remove cooldown // remove cooldown
m_spellCooldowns.erase(itr); m_spellCooldowns.erase(itr);
@ -5251,7 +5251,8 @@ void Player::SendInitialActionButtons()
{ {
sLog.outDetail( "Initializing Action Buttons for '%u'", GetGUIDLow() ); sLog.outDetail( "Initializing Action Buttons for '%u'", GetGUIDLow() );
WorldPacket data(SMSG_ACTION_BUTTONS, (MAX_ACTION_BUTTONS*4)); WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4));
data << uint8(0); // can be 0, 1, 2
for(int button = 0; button < MAX_ACTION_BUTTONS; ++button) for(int button = 0; button < MAX_ACTION_BUTTONS; ++button)
{ {
ActionButtonList::const_iterator itr = m_actionButtons.find(button); ActionButtonList::const_iterator itr = m_actionButtons.find(button);
@ -16469,7 +16470,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
if(pet->isControlled()) if(pet->isControlled())
{ {
WorldPacket data(SMSG_PET_SPELLS, 8); WorldPacket data(SMSG_PET_SPELLS, 8+4);
data << uint64(0); data << uint64(0);
data << uint32(0); data << uint32(0);
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
@ -16657,7 +16658,7 @@ void Player::PetSpellInitialize()
if(itr->second > curTime) if(itr->second > curTime)
cooldown = (itr->second - curTime) * 1000; cooldown = (itr->second - curTime) * 1000;
data << uint16(itr->first); // spellid data << uint32(itr->first); // spellid
data << uint16(0); // spell category? data << uint16(0); // spell category?
data << uint32(itr->second); // cooldown data << uint32(itr->second); // cooldown
data << uint32(0); // category cooldown data << uint32(0); // category cooldown
@ -16670,7 +16671,7 @@ void Player::PetSpellInitialize()
if(itr->second > curTime) if(itr->second > curTime)
cooldown = (itr->second - curTime) * 1000; cooldown = (itr->second - curTime) * 1000;
data << uint16(itr->first); // spellid data << uint32(itr->first); // spellid
data << uint16(0); // spell category? data << uint16(0); // spell category?
data << uint32(0); // cooldown data << uint32(0); // cooldown
data << uint32(itr->second); // category cooldown data << uint32(itr->second); // category cooldown
@ -16701,7 +16702,7 @@ void Player::PossessSpellInitialize()
data << uint64(charm->GetGUID()); data << uint64(charm->GetGUID());
data << uint32(0x00000000); data << uint32(0x00000000);
data << uint32(0); data << uint32(0);
data << uint8(0) << uint8(0) << uint16(0); data << uint32(0);
for(uint32 i = 0; i < 10; i++) //40 for(uint32 i = 0; i < 10; i++) //40
{ {

View file

@ -39,13 +39,14 @@ void WorldSession::SendNameQueryOpcode(Player *p)
return; return;
// guess size // guess size
WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+4+4+4+10) ); WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10) );
data << p->GetGUID(); data << uint64(p->GetGUID()); // player guid
data << p->GetName(); data << uint8(0); // added in 3.1
data << p->GetName(); // played name
data << uint8(0); // realm name for cross realm BG usage data << uint8(0); // realm name for cross realm BG usage
data << uint32(p->getRace()); data << uint8(p->getRace());
data << uint32(p->getGender()); data << uint8(p->getGender());
data << uint32(p->getClass()); data << uint8(p->getClass());
if(DeclinedName const* names = p->GetDeclinedNames()) if(DeclinedName const* names = p->GetDeclinedNames())
{ {
data << uint8(1); // is declined data << uint8(1); // is declined
@ -98,23 +99,24 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32
field = fields[2].GetUInt32(); field = fields[2].GetUInt32();
// guess size // guess size
WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+4+4+4+10) ); WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10) );
data << MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER); data << uint64(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
data << uint8(0); // added in 3.1
data << name; data << name;
data << (uint8)0; data << uint8(0);
data << (uint32)(field & 0xFF); data << uint8(field & 0xFF);
data << (uint32)((field >> 16) & 0xFF); data << uint8((field >> 16) & 0xFF);
data << (uint32)((field >> 8) & 0xFF); data << uint8((field >> 8) & 0xFF);
// if the first declined name field (3) is empty, the rest must be too // if the first declined name field (3) is empty, the rest must be too
if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[3].GetCppString() != "") if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[3].GetCppString() != "")
{ {
data << (uint8)1; // is declined data << uint8(1); // is declined
for(int i = 3; i < MAX_DECLINED_NAME_CASES+3; ++i) for(int i = 3; i < MAX_DECLINED_NAME_CASES+3; ++i)
data << fields[i].GetCppString(); data << fields[i].GetCppString();
} }
else else
data << (uint8)0; // is declined data << uint8(0); // is declined
session->SendPacket( &data ); session->SendPacket( &data );
delete result; delete result;
@ -122,7 +124,7 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32
void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data ) void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,8); CHECK_PACKET_SIZE(recv_data, 8);
uint64 guid; uint64 guid;
@ -175,23 +177,27 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
sLog.outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name, entry); sLog.outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name, entry);
// guess size // guess size
WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 100 ); WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 100 );
data << (uint32)entry; // creature entry data << uint32(entry); // creature entry
data << Name; data << Name;
data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty
data << SubName; data << SubName;
data << ci->IconName; // "Directions" for guard, string for Icons 2.3.0 data << ci->IconName; // "Directions" for guard, string for Icons 2.3.0
data << (uint32)ci->type_flags; // flags wdbFeild7=wad flags1 data << uint32(ci->type_flags); // flags wdbFeild7=wad flags1
data << (uint32)ci->type; data << uint32(ci->type);
data << (uint32)ci->family; // family wdbFeild9 data << uint32(ci->family); // family wdbFeild9
data << (uint32)ci->rank; // rank wdbFeild10 data << uint32(ci->rank); // rank wdbFeild10
data << (uint32)ci->PetSpellDataId; // Id from CreatureSpellData.dbc wdbField12 data << uint32(ci->PetSpellDataId); // Id from CreatureSpellData.dbc wdbField12
data << (uint32)ci->DisplayID_A; // modelid_male1 data << uint32(ci->DisplayID_A); // modelid_male1
data << (uint32)ci->DisplayID_H; // modelid_female1 ? data << uint32(ci->DisplayID_H); // modelid_female1 ?
data << (uint32)ci->DisplayID_A2; // modelid_male2 ? data << uint32(ci->DisplayID_A2); // modelid_male2 ?
data << (uint32)ci->DisplayID_H2; // modelid_femmale2 ? data << uint32(ci->DisplayID_H2); // modelid_femmale2 ?
data << (float)1.0f; // unk data << uint32(0); // new in 3.1
data << (float)1.0f; // unk data << float(1.0f); // unk
data << (uint8)ci->RacialLeader; data << float(1.0f); // unk
data << uint8(ci->RacialLeader);
for(uint32 i = 0; i < 4; ++i)
data << uint32(0); // added in 3.1
data << uint32(0); // added in 3.1
SendPacket( &data ); SendPacket( &data );
sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " );
} }
@ -241,16 +247,18 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data )
} }
sLog.outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name, entryID); sLog.outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name, entryID);
WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 150 ); WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 150 );
data << entryID; data << uint32(entryID);
data << (uint32)info->type; data << uint32(info->type);
data << (uint32)info->displayId; data << uint32(info->displayId);
data << Name; data << Name;
data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4 data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4
data << uint8(0); // 2.0.3, string data << uint8(0); // 2.0.3, string
data << CastBarCaption; // 2.0.3, string. Text will appear in Cast Bar when using GO (ex: "Collecting") data << CastBarCaption; // 2.0.3, string. Text will appear in Cast Bar when using GO (ex: "Collecting")
data << uint8(0); // 2.0.3, probably string data << uint8(0); // 2.0.3, string
data.append(info->raw.data,24); data.append(info->raw.data, 24);
data << float(info->size); // go size data << float(info->size); // go size
for(uint32 i = 0; i < 4; ++i)
data << uint32(0); // added in 3.1
SendPacket( &data ); SendPacket( &data );
sLog.outDebug( "WORLD: Sent CMSG_GAMEOBJECT_QUERY " ); sLog.outDebug( "WORLD: Sent CMSG_GAMEOBJECT_QUERY " );
} }

View file

@ -3042,7 +3042,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
if(caster->GetTypeId() == TYPEID_PLAYER) if(caster->GetTypeId() == TYPEID_PLAYER)
{ {
WorldPacket data(SMSG_PET_SPELLS, 8); WorldPacket data(SMSG_PET_SPELLS, 8+4);
data << uint64(0); data << uint64(0);
data << uint32(0); data << uint32(0);
((Player*)caster)->GetSession()->SendPacket(&data); ((Player*)caster)->GetSession()->SendPacket(&data);
@ -3198,7 +3198,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
if(caster->GetTypeId() == TYPEID_PLAYER) if(caster->GetTypeId() == TYPEID_PLAYER)
{ {
WorldPacket data(SMSG_PET_SPELLS, 8); WorldPacket data(SMSG_PET_SPELLS, 8+4);
data << uint64(0); data << uint64(0);
data << uint32(0); data << uint32(0);
((Player*)caster)->GetSession()->SendPacket(&data); ((Player*)caster)->GetSession()->SendPacket(&data);

View file

@ -33,8 +33,8 @@ const char CreatureInfoAddonInfofmt[]="iiiiiiis";
const char EquipmentInfofmt[]="iiii"; const char EquipmentInfofmt[]="iiii";
const char GameObjectInfosrcfmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiis"; const char GameObjectInfosrcfmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiis";
const char GameObjectInfodstfmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiii"; const char GameObjectInfodstfmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiii";
const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiisiiii"; const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiisiiii";
const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiii"; const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiii";
const char PageTextfmt[]="isi"; const char PageTextfmt[]="isi";
const char SpellThreatfmt[]="ii"; const char SpellThreatfmt[]="ii";
const char InstanceTemplatesrcfmt[]="iiiiiiiffffs"; const char InstanceTemplatesrcfmt[]="iiiiiiiffffs";