From b91a88635468a5bf206629e300a288b8c956775e Mon Sep 17 00:00:00 2001 From: hater Date: Wed, 21 Feb 2024 12:05:18 -0500 Subject: [PATCH] fix item query --- src/server/game/Handlers/ItemHandler.cpp | 140 +---------------------- 1 file changed, 1 insertion(+), 139 deletions(-) diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 0d8f461c8defef..e8f3f290f972a2 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -574,145 +574,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData) ItemTemplate* pProto = sObjectMgr->GetItemTemplateMutable(item); if (pProto) { - /*std::string Name = pProto->Name1; - std::string Description = pProto->Description; - - int loc_idx = GetSessionDbLocaleIndex(); - if (loc_idx >= 0) - { - if (ItemLocale const* il = sObjectMgr->GetItemLocale(pProto->ItemId)) - { - ObjectMgr::GetLocaleString(il->Name, loc_idx, Name); - ObjectMgr::GetLocaleString(il->Description, loc_idx, Description); - } - } - // guess size - WorldPacket queryData(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600); - queryData << pProto->ItemId; - queryData << pProto->Class; - queryData << pProto->SubClass; - queryData << pProto->SoundOverrideSubclass; - queryData << Name; - queryData << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name... - queryData << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00); - queryData << uint8(0x00); //pProto->Name4; // blizz not send name there, just uint8(0x00); - queryData << pProto->DisplayInfoID; - queryData << pProto->Quality; - queryData << pProto->Flags; - queryData << pProto->Flags2; - queryData << pProto->BuyPrice; - queryData << pProto->SellPrice; - queryData << pProto->InventoryType; - queryData << pProto->AllowableClass; - queryData << pProto->AllowableRace; - queryData << pProto->ItemLevel; - queryData << pProto->RequiredLevel; - queryData << pProto->RequiredSkill; - queryData << pProto->RequiredSkillRank; - queryData << pProto->RequiredSpell; - queryData << pProto->RequiredHonorRank; - queryData << pProto->RequiredCityRank; - queryData << pProto->RequiredReputationFaction; - queryData << pProto->RequiredReputationRank; - queryData << int32(pProto->MaxCount); - queryData << int32(pProto->Stackable); - queryData << pProto->ContainerSlots; - queryData << pProto->StatsCount; // item stats count - for (uint32 i = 0; i < pProto->StatsCount; ++i) - { - queryData << pProto->ItemStat[i].ItemStatType; - queryData << pProto->ItemStat[i].ItemStatValue; - } - queryData << pProto->ScalingStatDistribution; // scaling stats distribution - queryData << pProto->ScalingStatValue; // some kind of flags used to determine stat values column - for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) - { - queryData << pProto->Damage[i].DamageMin; - queryData << pProto->Damage[i].DamageMax; - queryData << pProto->Damage[i].DamageType; - } - - // resistances (7) - queryData << pProto->Armor; - queryData << pProto->HolyRes; - queryData << pProto->FireRes; - queryData << pProto->NatureRes; - queryData << pProto->FrostRes; - queryData << pProto->ShadowRes; - queryData << pProto->ArcaneRes; - - queryData << pProto->Delay; - queryData << pProto->AmmoType; - queryData << pProto->RangedModRange; - - for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) - { - // send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown - // use `item_template` or if not set then only use spell cooldowns - SpellInfo const* spell = sSpellMgr->GetSpellInfo(pProto->Spells[s].SpellId); - if (spell) - { - bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0; - - queryData << pProto->Spells[s].SpellId; - queryData << pProto->Spells[s].SpellTrigger; - queryData << int32(pProto->Spells[s].SpellCharges); - - if (db_data) - { - queryData << uint32(pProto->Spells[s].SpellCooldown); - queryData << uint32(pProto->Spells[s].SpellCategory); - queryData << uint32(pProto->Spells[s].SpellCategoryCooldown); - } - else - { - queryData << uint32(spell->RecoveryTime); - queryData << uint32(spell->GetCategory()); - queryData << uint32(spell->CategoryRecoveryTime); - } - } - else - { - queryData << uint32(0); - queryData << uint32(0); - queryData << uint32(0); - queryData << uint32(-1); - queryData << uint32(0); - queryData << uint32(-1); - } - } - queryData << pProto->Bonding; - queryData << Description; - queryData << pProto->PageText; - queryData << pProto->LanguageID; - queryData << pProto->PageMaterial; - queryData << pProto->StartQuest; - queryData << pProto->LockID; - queryData << int32(pProto->Material); - queryData << pProto->Sheath; - queryData << pProto->RandomProperty; - queryData << pProto->RandomSuffix; - queryData << pProto->Block; - queryData << pProto->ItemSet; - queryData << pProto->MaxDurability; - queryData << pProto->Area; - queryData << pProto->Map; // Added in 1.12.x & 2.0.1 client branch - queryData << pProto->BagFamily; - queryData << pProto->TotemCategory; - for (int s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s) - { - queryData << pProto->Socket[s].Color; - queryData << pProto->Socket[s].Content; - } - queryData << pProto->socketBonus; - queryData << pProto->GemProperties; - queryData << pProto->RequiredDisenchantSkill; - queryData << pProto->ArmorDamageModifier; - queryData << pProto->Duration; // added in 2.4.2.8209, duration (seconds) - queryData << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory - queryData << pProto->HolidayId; // Holiday.dbc? - SendPacket(&queryData); - */ + pProto->InitializeQueryData(); SendPacket(pProto->GetQueryData()); } else