From 73ec9c2ce466f97fbc53755dd4df7d8da09ca7b1 Mon Sep 17 00:00:00 2001 From: Salja Date: Fri, 17 Aug 2012 02:22:22 +0200 Subject: [PATCH] [0114] Updated "item_template" Thanks Fabi Fix some DBC problems, some clean. Signed-off-by: Salja --- sql/mangos.sql | 52 +++-- .../0114_xxxxx_01_mangos_item_template.sql | 49 +++++ src/game/ItemHandler.cpp | 191 ------------------ src/game/ItemPrototype.h | 29 +-- src/game/ObjectMgr.cpp | 139 ++++++------- src/game/Opcodes.cpp | 4 +- src/game/Opcodes.h | 4 +- src/game/Player.cpp | 36 +--- src/game/SQLStorages.cpp | 4 +- src/game/Spell.cpp | 2 +- src/game/Unit.cpp | 2 +- src/game/WorldSession.h | 2 - src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 14 files changed, 170 insertions(+), 348 deletions(-) create mode 100644 sql/updates/0114_xxxxx_01_mangos_item_template.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 5e4318e89..b77f601a1 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -2456,6 +2456,9 @@ CREATE TABLE `item_template` ( `Quality` tinyint(3) unsigned NOT NULL default '0', `Flags` int(10) unsigned NOT NULL default '0', `Flags2` int(10) unsigned NOT NULL default '0', + `Unknown` float NOT NULL, + `Unknown1` float NOT NULL, + `Unknown2` int(10) NOT NULL, `BuyCount` tinyint(3) unsigned NOT NULL default '1', `BuyPrice` int(10) unsigned NOT NULL default '0', `SellPrice` int(10) unsigned NOT NULL default '0', @@ -2474,44 +2477,49 @@ CREATE TABLE `item_template` ( `maxcount` smallint(5) NOT NULL default '-1', `stackable` smallint(5) NOT NULL default '1', `ContainerSlots` tinyint(3) unsigned NOT NULL default '0', - `StatsCount` tinyint(3) unsigned NOT NULL default '0', `stat_type1` tinyint(3) unsigned NOT NULL default '0', `stat_value1` smallint(6) NOT NULL default '0', + `stat_unk1_1` int(10) NOT NULL default '0', + `stat_unk2_1` int(10) NOT NULL default '0', `stat_type2` tinyint(3) unsigned NOT NULL default '0', `stat_value2` smallint(6) NOT NULL default '0', + `stat_unk1_2` int(10) NOT NULL default '0', + `stat_unk2_2` int(10) NOT NULL default '0', `stat_type3` tinyint(3) unsigned NOT NULL default '0', `stat_value3` smallint(6) NOT NULL default '0', + `stat_unk1_3` int(10) NOT NULL default '0', + `stat_unk2_3` int(10) NOT NULL default '0', `stat_type4` tinyint(3) unsigned NOT NULL default '0', `stat_value4` smallint(6) NOT NULL default '0', + `stat_unk1_4` int(10) NOT NULL default '0', + `stat_unk2_4` int(10) NOT NULL default '0', `stat_type5` tinyint(3) unsigned NOT NULL default '0', `stat_value5` smallint(6) NOT NULL default '0', + `stat_unk1_5` int(10) NOT NULL default '0', + `stat_unk2_5` int(10) NOT NULL default '0', `stat_type6` tinyint(3) unsigned NOT NULL default '0', `stat_value6` smallint(6) NOT NULL default '0', + `stat_unk1_6` int(10) NOT NULL default '0', + `stat_unk2_6` int(10) NOT NULL default '0', `stat_type7` tinyint(3) unsigned NOT NULL default '0', `stat_value7` smallint(6) NOT NULL default '0', + `stat_unk1_7` int(10) NOT NULL default '0', + `stat_unk2_7` int(10) NOT NULL default '0', `stat_type8` tinyint(3) unsigned NOT NULL default '0', `stat_value8` smallint(6) NOT NULL default '0', + `stat_unk1_8` int(10) NOT NULL default '0', + `stat_unk2_8` int(10) NOT NULL default '0', `stat_type9` tinyint(3) unsigned NOT NULL default '0', `stat_value9` smallint(6) NOT NULL default '0', + `stat_unk1_9` int(10) NOT NULL default '0', + `stat_unk2_9` int(10) NOT NULL default '0', `stat_type10` tinyint(3) unsigned NOT NULL default '0', `stat_value10` smallint(6) NOT NULL default '0', + `stat_unk1_10` int(10) NOT NULL default '0', + `stat_unk2_10` int(10) NOT NULL default '0', `ScalingStatDistribution` smallint(6) NOT NULL default '0', - `ScalingStatValue` int(6) unsigned NOT NULL default '0', - `dmg_min1` float NOT NULL default '0', - `dmg_max1` float NOT NULL default '0', - `dmg_type1` tinyint(3) unsigned NOT NULL default '0', - `dmg_min2` float NOT NULL default '0', - `dmg_max2` float NOT NULL default '0', - `dmg_type2` tinyint(3) unsigned NOT NULL default '0', - `armor` smallint(5) unsigned NOT NULL default '0', - `holy_res` tinyint(3) unsigned NOT NULL default '0', - `fire_res` tinyint(3) unsigned NOT NULL default '0', - `nature_res` tinyint(3) unsigned NOT NULL default '0', - `frost_res` tinyint(3) unsigned NOT NULL default '0', - `shadow_res` tinyint(3) unsigned NOT NULL default '0', - `arcane_res` tinyint(3) unsigned NOT NULL default '0', - `delay` smallint(5) unsigned NOT NULL default '1000', - `ammo_type` tinyint(3) unsigned NOT NULL default '0', + `delay` int(10) NOT NULL, + `DamageType` tinyint(3) unsigned NOT NULL default '0', `RangedModRange` float NOT NULL default '0', `spellid_1` mediumint(8) unsigned NOT NULL default '0', `spelltrigger_1` tinyint(3) unsigned NOT NULL default '0', @@ -2559,7 +2567,6 @@ CREATE TABLE `item_template` ( `sheath` tinyint(3) unsigned NOT NULL default '0', `RandomProperty` mediumint(8) unsigned NOT NULL default '0', `RandomSuffix` mediumint(8) unsigned NOT NULL default '0', - `block` mediumint(8) unsigned NOT NULL default '0', `itemset` mediumint(8) unsigned NOT NULL default '0', `MaxDurability` smallint(5) unsigned NOT NULL default '0', `area` mediumint(8) unsigned NOT NULL default '0', @@ -2576,15 +2583,18 @@ CREATE TABLE `item_template` ( `GemProperties` mediumint(9) NOT NULL default '0', `RequiredDisenchantSkill` smallint(6) NOT NULL default '-1', `ArmorDamageModifier` float NOT NULL default '0', - `Duration` int(11) UNSIGNED DEFAULT '0' NOT NULL COMMENT 'Duration in seconds.', + `Duration` int(11) unsigned NOT NULL default '0', `ItemLimitCategory` smallint(6) NOT NULL default '0', - `HolidayId` int(11) UNSIGNED DEFAULT '0' NOT NULL, + `HolidayId` int(11) unsigned NOT NULL default '0', `ScriptName` varchar(64) NOT NULL default '', `DisenchantID` mediumint(8) unsigned NOT NULL default '0', `FoodType` tinyint(3) unsigned NOT NULL default '0', + `StatScalingFactor` float NOT NULL, + `Unknown400_1` int(10) unsigned NOT NULL default '0', + `Unknown400_2` int(10) unsigned NOT NULL default '0', `minMoneyLoot` int(10) unsigned NOT NULL default '0', `maxMoneyLoot` int(10) unsigned NOT NULL default '0', - `ExtraFlags` tinyint(1) UNSIGNED NOT NULL default '0', + `ExtraFlags` tinyint(1) unsigned NOT NULL default '0', PRIMARY KEY (`entry`), KEY `items_index` (`class`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Item System'; diff --git a/sql/updates/0114_xxxxx_01_mangos_item_template.sql b/sql/updates/0114_xxxxx_01_mangos_item_template.sql new file mode 100644 index 000000000..577510c50 --- /dev/null +++ b/sql/updates/0114_xxxxx_01_mangos_item_template.sql @@ -0,0 +1,49 @@ +ALTER TABLE db_version CHANGE COLUMN required_0083_12090_01_mangos_spell_template required_0114_xxxxx_01_mangos_item_template bit; + +ALTER TABLE `item_template` ADD COLUMN `Unknown` float NOT NULL AFTER `Flags2`; +ALTER TABLE `item_template` ADD COLUMN `Unknown1` float NOT NULL AFTER `Unknown`; +ALTER TABLE `item_template` ADD COLUMN `Unknown2` int(10) NOT NULL AFTER `Unknown1`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_1` int(10) NOT NULL DEFAULT '0' AFTER `stat_value1`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_1` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_1`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_2` int(10) NOT NULL DEFAULT '0' AFTER `stat_value2`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_2` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_2`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_3` int(10) NOT NULL DEFAULT '0' AFTER `stat_value3`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_3` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_3`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_4` int(10) NOT NULL DEFAULT '0' AFTER `stat_value4`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_4` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_4`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_5` int(10) NOT NULL DEFAULT '0' AFTER `stat_value5`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_5` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_5`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_6` int(10) NOT NULL DEFAULT '0' AFTER `stat_value6`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_6` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_6`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_7` int(10) NOT NULL DEFAULT '0' AFTER `stat_value7`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_7` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_7`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_8` int(10) NOT NULL DEFAULT '0' AFTER `stat_value8`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_8` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_8`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_9` int(10) NOT NULL DEFAULT '0' AFTER `stat_value9`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_9` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_9`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk1_10` int(10) NOT NULL DEFAULT '0' AFTER `stat_value10`; +ALTER TABLE `item_template` ADD COLUMN `stat_unk2_10` int(10) NOT NULL DEFAULT '0' AFTER `stat_unk1_10`; +ALTER TABLE `item_template` ADD COLUMN `DamageType` tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER `ammo_type`; +ALTER TABLE `item_template` ADD COLUMN `StatScalingFactor` float NOT NULL AFTER `FoodType`; +ALTER TABLE `item_template` ADD COLUMN `Unknown400_1` int(10) unsigned NOT NULL DEFAULT '0' AFTER `StatScalingFactor`; +ALTER TABLE `item_template` ADD COLUMN `Unknown400_2` int(10) unsigned NOT NULL DEFAULT '0' AFTER `Unknown400_1`; + +ALTER TABLE `item_template` CHANGE COLUMN `delay` `delay` int(10) NOT NULL; + +ALTER TABLE `item_template` DROP `StatsCount`; +ALTER TABLE `item_template` DROP `ScalingStatValue`; +ALTER TABLE `item_template` DROP `dmg_min1`; +ALTER TABLE `item_template` DROP `dmg_max1`; +ALTER TABLE `item_template` DROP `dmg_type1`; +ALTER TABLE `item_template` DROP `dmg_min2`; +ALTER TABLE `item_template` DROP `dmg_max2`; +ALTER TABLE `item_template` DROP `dmg_type2`; +ALTER TABLE `item_template` DROP `armor`; +ALTER TABLE `item_template` DROP `holy_res`; +ALTER TABLE `item_template` DROP `fire_res`; +ALTER TABLE `item_template` DROP `nature_res`; +ALTER TABLE `item_template` DROP `frost_res`; +ALTER TABLE `item_template` DROP `shadow_res`; +ALTER TABLE `item_template` DROP `arcane_res`; +ALTER TABLE `item_template` DROP `ammo_type`; +ALTER TABLE `item_template` DROP `block`; \ No newline at end of file diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index dc6a42be9..ea5e4066d 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -277,166 +277,6 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket& recv_data) _player->DestroyItem(bag, slot, true); } -// Only _static_ data send in this packet !!! -void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recv_data) -{ - // DEBUG_LOG("WORLD: CMSG_ITEM_QUERY_SINGLE"); - uint32 item; - recv_data >> item; - - DETAIL_LOG("STORAGE: Item Query = %u", item); - - ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item); - if (pProto) - { - int loc_idx = GetSessionDbLocaleIndex(); - - std::string name = pProto->Name1; - std::string description = pProto->Description; - sObjectMgr.GetItemLocaleStrings(pProto->ItemId, loc_idx, &name, &description); - - // guess size - WorldPacket data(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600); - data << pProto->ItemId; - data << pProto->Class; - data << pProto->SubClass; - data << int32(pProto->Unk0); // new 2.0.3, not exist in wdb cache? - data << name; - data << uint8(0x00); // pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name... - data << uint8(0x00); // pProto->Name3; // blizz not send name there, just uint8(0x00); - data << uint8(0x00); // pProto->Name4; // blizz not send name there, just uint8(0x00); - data << pProto->DisplayInfoID; - data << pProto->Quality; - data << pProto->Flags; - data << pProto->Flags2; // new in 3.2 - data << pProto->BuyPrice; - data << pProto->SellPrice; - data << pProto->InventoryType; - data << pProto->AllowableClass; - data << pProto->AllowableRace; - data << pProto->ItemLevel; - data << pProto->RequiredLevel; - data << pProto->RequiredSkill; - data << pProto->RequiredSkillRank; - data << pProto->RequiredSpell; - data << pProto->RequiredHonorRank; - data << pProto->RequiredCityRank; - data << pProto->RequiredReputationFaction; - data << pProto->RequiredReputationRank; - data << int32(pProto->MaxCount); - data << int32(pProto->Stackable); - data << pProto->ContainerSlots; - data << pProto->StatsCount; // item stats count - for (uint32 i = 0; i < pProto->StatsCount; ++i) - { - data << pProto->ItemStat[i].ItemStatType; - data << pProto->ItemStat[i].ItemStatValue; - data << uint32(0); // 4.0.0 - data << uint32(0); // 4.0.0 - } - data << pProto->ScalingStatDistribution; // scaling stats distribution - data << pProto->ScalingStatValue; // some kind of flags used to determine stat values column - //for(int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) - //{ - // data << pProto->Damage[i].DamageMin; - // data << pProto->Damage[i].DamageMax; - // data << pProto->Damage[i].DamageType; - //} - - // resistances (7) - //data << pProto->Armor; - //data << pProto->HolyRes; - //data << pProto->FireRes; - //data << pProto->NatureRes; - //data << pProto->FrostRes; - //data << pProto->ShadowRes; - //data << pProto->ArcaneRes; - - data << uint32(0); // DamageType - //data << pProto->AmmoType; - data << pProto->Delay; - data << 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 - SpellEntry const* spell = sSpellStore.LookupEntry(pProto->Spells[s].SpellId); - if (spell) - { - bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0; - - data << pProto->Spells[s].SpellId; - data << pProto->Spells[s].SpellTrigger; - data << uint32(-abs(pProto->Spells[s].SpellCharges)); - - if (db_data) - { - data << uint32(pProto->Spells[s].SpellCooldown); - data << uint32(pProto->Spells[s].SpellCategory); - data << uint32(pProto->Spells[s].SpellCategoryCooldown); - } - else - { - data << uint32(spell->GetRecoveryTime()); - data << uint32(spell->GetCategory()); - data << uint32(spell->GetCategoryRecoveryTime()); - } - } - else - { - data << uint32(0); - data << uint32(0); - data << uint32(0); - data << uint32(-1); - data << uint32(0); - data << uint32(-1); - } - } - data << pProto->Bonding; - data << description; - data << pProto->PageText; - data << pProto->LanguageID; - data << pProto->PageMaterial; - data << pProto->StartQuest; - data << pProto->LockID; - data << int32(pProto->Material); - data << pProto->Sheath; - data << pProto->RandomProperty; - data << pProto->RandomSuffix; - data << pProto->Block; - data << pProto->ItemSet; - data << pProto->MaxDurability; - data << pProto->Area; - data << pProto->Map; // Added in 1.12.x & 2.0.1 client branch - data << pProto->BagFamily; - data << pProto->TotemCategory; - for (int s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s) - { - data << pProto->Socket[s].Color; - data << pProto->Socket[s].Content; - } - data << uint32(pProto->socketBonus); - data << uint32(pProto->GemProperties); - data << int32(pProto->RequiredDisenchantSkill); - data << float(pProto->ArmorDamageModifier); - data << uint32(pProto->Duration); // added in 2.4.2.8209, duration (seconds) - data << uint32(pProto->ItemLimitCategory); // WotLK, ItemLimitCategory - data << uint32(pProto->HolidayId); // Holiday.dbc? - data << float(0); // damage/armor scaling factor - data << uint32(0); // 4.0.0 - data << uint32(0); // 4.0.0 - SendPacket( &data ); - } - else - { - DEBUG_LOG("WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item); - WorldPacket data(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); - data << uint32(item | 0x80000000); - SendPacket(&data); - } -} - void WorldSession::HandleReadItemOpcode(WorldPacket& recv_data) { // DEBUG_LOG( "WORLD: CMSG_READ_ITEM"); @@ -1072,37 +912,6 @@ void WorldSession::SendItemEnchantTimeUpdate(ObjectGuid playerGuid, ObjectGuid i SendPacket(&data); } -void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recv_data) -{ - uint32 itemid; - recv_data >> itemid; - recv_data.read_skip(); // guid - - DEBUG_LOG("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); - if (ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid)) - { - int loc_idx = GetSessionDbLocaleIndex(); - - std::string name = pProto->Name1; - sObjectMgr.GetItemLocaleStrings(pProto->ItemId, loc_idx, &name); - // guess size - WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4 + 10)); - data << uint32(pProto->ItemId); - data << name; - data << uint32(pProto->InventoryType); - SendPacket(&data); - return; - } - else - { - // listed in dbc or not expected to exist unknown item - if(true/*sItemStore.LookupEntry(itemid)*/) - sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid); - else - sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid); - } -} - void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) { DEBUG_LOG("Received opcode CMSG_WRAP_ITEM"); diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index cfeaa4b15..367ef17f1 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -519,17 +519,12 @@ enum ItemExtraFlags #pragma pack(push,1) #endif -struct _Damage -{ - float DamageMin; - float DamageMax; - uint32 DamageType; // id from Resistances.dbc -}; - struct _ItemStat { uint32 ItemStatType; int32 ItemStatValue; + uint32 ItemStatType2; + int32 ItemStatValue2; }; struct _Spell { @@ -548,7 +543,6 @@ struct _Socket uint32 Content; }; -#define MAX_ITEM_PROTO_DAMAGES 2 // changed in 3.1.0 #define MAX_ITEM_PROTO_SOCKETS 3 #define MAX_ITEM_PROTO_SPELLS 5 #define MAX_ITEM_PROTO_STATS 10 @@ -564,6 +558,9 @@ struct ItemPrototype uint32 Quality; uint32 Flags; uint32 Flags2; + float Unknown; + float Unknown1; + uint32 Unknown2; uint32 BuyCount; uint32 BuyPrice; uint32 SellPrice; @@ -582,20 +579,10 @@ struct ItemPrototype int32 MaxCount; // <=0: no limit int32 Stackable; // 0: not allowed, -1: put in player coin info tab and don't limit stacking (so 1 slot) uint32 ContainerSlots; - uint32 StatsCount; _ItemStat ItemStat[MAX_ITEM_PROTO_STATS]; uint32 ScalingStatDistribution; // id from ScalingStatDistribution.dbc - uint32 ScalingStatValue; // mask for selecting column in ScalingStatValues.dbc - _Damage Damage[MAX_ITEM_PROTO_DAMAGES]; // TODO: remove it - uint32 Armor; // TODO: remove it - uint32 HolyRes; // TODO: remove it - uint32 FireRes; // TODO: remove it - uint32 NatureRes; // TODO: remove it - uint32 FrostRes; // TODO: remove it - uint32 ShadowRes; // TODO: remove it - uint32 ArcaneRes; // TODO: remove it + uint32 DamageType; uint32 Delay; - uint32 AmmoType; // TODO: remove it float RangedModRange; _Spell Spells[MAX_ITEM_PROTO_SPELLS]; uint32 Bonding; @@ -609,7 +596,6 @@ struct ItemPrototype uint32 Sheath; uint32 RandomProperty; // id from ItemRandomProperties.dbc uint32 RandomSuffix; // id from ItemRandomSuffix.dbc - uint32 Block; uint32 ItemSet; // id from ItemSet.dbc uint32 MaxDurability; uint32 Area; // id from AreaTable.dbc @@ -627,6 +613,9 @@ struct ItemPrototype uint32 ScriptId; uint32 DisenchantID; uint32 FoodType; + float StatScalingFactor; + uint32 Unknown400_1; + uint32 Unknown400_2; uint32 MinMoneyLoot; uint32 MaxMoneyLoot; uint32 ExtraFlags; // see ItemExtraFlags diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index b7fd11715..3dd0f5071 100755 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -844,29 +844,29 @@ void ObjectMgr::LoadEquipmentTemplates() if (!eqInfo->equipentry[j]) continue; - //ItemEntry const *dbcitem = sItemStore.LookupEntry(eqInfo->equipentry[j]); + ItemEntry const *dbcitem = sItemStore.LookupEntry(eqInfo->equipentry[j]); - //if (!dbcitem) - //{ - // sLog.outErrorDb("Unknown item (entry=%u) in creature_equip_template.equipentry%u for entry = %u, forced to 0.", eqInfo->equipentry[j], j+1, i); - // const_cast(eqInfo)->equipentry[j] = 0; - // continue; - //} + if (!dbcitem) + { + sLog.outErrorDb("Unknown item (entry=%u) in creature_equip_template.equipentry%u for entry = %u, forced to 0.", eqInfo->equipentry[j], j+1, i); + const_cast(eqInfo)->equipentry[j] = 0; + continue; + } - //if (dbcitem->InventoryType != INVTYPE_WEAPON && - // dbcitem->InventoryType != INVTYPE_SHIELD && - // dbcitem->InventoryType != INVTYPE_RANGED && - // dbcitem->InventoryType != INVTYPE_2HWEAPON && - // dbcitem->InventoryType != INVTYPE_WEAPONMAINHAND && - // dbcitem->InventoryType != INVTYPE_WEAPONOFFHAND && - // dbcitem->InventoryType != INVTYPE_HOLDABLE && - // dbcitem->InventoryType != INVTYPE_THROWN && - // dbcitem->InventoryType != INVTYPE_RANGEDRIGHT && - // dbcitem->InventoryType != INVTYPE_RELIC) - //{ - // sLog.outErrorDb("Item (entry=%u) in creature_equip_template.equipentry%u for entry = %u is not equipable in a hand, forced to 0.", eqInfo->equipentry[j], j+1, i); - // const_cast(eqInfo)->equipentry[j] = 0; - //} + if (dbcitem->InventoryType != INVTYPE_WEAPON && + dbcitem->InventoryType != INVTYPE_SHIELD && + dbcitem->InventoryType != INVTYPE_RANGED && + dbcitem->InventoryType != INVTYPE_2HWEAPON && + dbcitem->InventoryType != INVTYPE_WEAPONMAINHAND && + dbcitem->InventoryType != INVTYPE_WEAPONOFFHAND && + dbcitem->InventoryType != INVTYPE_HOLDABLE && + dbcitem->InventoryType != INVTYPE_THROWN && + dbcitem->InventoryType != INVTYPE_RANGEDRIGHT && + dbcitem->InventoryType != INVTYPE_RELIC) + { + sLog.outErrorDb("Item (entry=%u) in creature_equip_template.equipentry%u for entry = %u is not equipable in a hand, forced to 0.", eqInfo->equipentry[j], j+1, i); + const_cast(eqInfo)->equipentry[j] = 0; + } } } @@ -1795,7 +1795,7 @@ void ObjectMgr::LoadItemPrototypes() for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i) { ItemPrototype const* proto = sItemStorage.LookupEntry(i); - //ItemEntry const *dbcitem = sItemStore.LookupEntry(i); + ItemEntry const *dbcitem = sItemStore.LookupEntry(i); if(!proto) { /* to many errors, and possible not all items really used in game @@ -1805,13 +1805,13 @@ void ObjectMgr::LoadItemPrototypes() continue; } - if(true/*dbcitem*/) + if (dbcitem) { - //if(proto->Class != dbcitem->Class) - //{ - // sLog.outErrorDb("Item (Entry: %u) not correct class %u, must be %u (still using DB value).",i,proto->Class,dbcitem->Class); - // // It safe let use Class from DB - //} + if(proto->Class != dbcitem->Class) + { + sLog.outErrorDb("Item (Entry: %u) not correct class %u, must be %u (still using DB value).",i,proto->Class,dbcitem->Class); + // It safe let use Class from DB + } /* disabled: have some strange wrong cases for Subclass values. for enable also uncomment Subclass field in ItemEntry structure and in Itemfmt[] if(proto->SubClass != dbcitem->SubClass) @@ -1821,34 +1821,34 @@ void ObjectMgr::LoadItemPrototypes() } */ - //if(proto->Unk0 != dbcitem->Unk0) - //{ - // sLog.outErrorDb("Item (Entry: %u) not correct %i Unk0, must be %i (still using DB value).",i,proto->Unk0,dbcitem->Unk0); - // // It safe let use Unk0 from DB - //} + if(proto->Unk0 != dbcitem->Unk0) + { + sLog.outErrorDb("Item (Entry: %u) not correct %i Unk0, must be %i (still using DB value).",i,proto->Unk0,dbcitem->Unk0); + // It safe let use Unk0 from DB + } - //if(proto->Material != dbcitem->Material) - //{ - // sLog.outErrorDb("Item (Entry: %u) not correct %i material, must be %i (still using DB value).",i,proto->Material,dbcitem->Material); - // // It safe let use Material from DB - //} + if(proto->Material != dbcitem->Material) + { + sLog.outErrorDb("Item (Entry: %u) not correct %i material, must be %i (still using DB value).",i,proto->Material,dbcitem->Material); + // It safe let use Material from DB + } - //if(proto->InventoryType != dbcitem->InventoryType) - //{ - // sLog.outErrorDb("Item (Entry: %u) not correct %u inventory type, must be %u (still using DB value).",i,proto->InventoryType,dbcitem->InventoryType); - // // It safe let use InventoryType from DB - //} + if(proto->InventoryType != dbcitem->InventoryType) + { + sLog.outErrorDb("Item (Entry: %u) not correct %u inventory type, must be %u (still using DB value).",i,proto->InventoryType,dbcitem->InventoryType); + // It safe let use InventoryType from DB + } - //if(proto->DisplayInfoID != dbcitem->DisplayId) - //{ - // sLog.outErrorDb("Item (Entry: %u) not correct %u display id, must be %u (using it).",i,proto->DisplayInfoID,dbcitem->DisplayId); - // const_cast(proto)->DisplayInfoID = dbcitem->DisplayId; - //} - //if(proto->Sheath != dbcitem->Sheath) - //{ - // sLog.outErrorDb("Item (Entry: %u) not correct %u sheath, must be %u (using it).",i,proto->Sheath,dbcitem->Sheath); - // const_cast(proto)->Sheath = dbcitem->Sheath; - //} + if(proto->DisplayInfoID != dbcitem->DisplayId) + { + sLog.outErrorDb("Item (Entry: %u) not correct %u display id, must be %u (using it).",i,proto->DisplayInfoID,dbcitem->DisplayId); + const_cast(proto)->DisplayInfoID = dbcitem->DisplayId; + } + if(proto->Sheath != dbcitem->Sheath) + { + sLog.outErrorDb("Item (Entry: %u) not correct %u sheath, must be %u (using it).",i,proto->Sheath,dbcitem->Sheath); + const_cast(proto)->Sheath = dbcitem->Sheath; + } } else { @@ -2018,12 +2018,6 @@ void ObjectMgr::LoadItemPrototypes() } } - if (proto->StatsCount > MAX_ITEM_PROTO_STATS) - { - sLog.outErrorDb("Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", i, proto->StatsCount, MAX_ITEM_PROTO_STATS); - const_cast(proto)->StatsCount = MAX_ITEM_PROTO_STATS; - } - for (int j = 0; j < MAX_ITEM_PROTO_STATS; ++j) { // for ItemStatValue != 0 @@ -2044,13 +2038,10 @@ void ObjectMgr::LoadItemPrototypes() } } - for (int j = 0; j < MAX_ITEM_PROTO_DAMAGES; ++j) + if (proto->DamageType >= MAX_SPELL_SCHOOL) { - if (proto->Damage[j].DamageType >= MAX_SPELL_SCHOOL) - { - sLog.outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", i, j + 1, proto->Damage[j].DamageType); - const_cast(proto)->Damage[j].DamageType = 0; - } + sLog.outErrorDb("Item (Entry: %u) has wrong damagetype (%u)", i, proto->DamageType); + const_cast(proto)->DamageType = 0; } // special format @@ -2219,15 +2210,15 @@ void ObjectMgr::LoadItemPrototypes() continue; } - //if(BAG_FAMILY_MASK_CURRENCY_TOKENS & mask) - //{ - // CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(proto->ItemId); - // if(!ctEntry) - // { - // sLog.outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit",i); - // const_cast(proto)->BagFamily &= ~mask; - // } - //} + /*if(BAG_FAMILY_MASK_CURRENCY_TOKENS & mask) + { + CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(proto->ItemId); + if(!ctEntry) + { + sLog.outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit",i); + const_cast(proto)->BagFamily &= ~mask; + } + }*/ } } diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 3cef1649e..52a4ba338 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -451,8 +451,8 @@ void InitializeOpcodes() //OPCODE(SMSG_PET_NAME_INVALID, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); OPCODE(SMSG_PET_SPELLS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //OPCODE(SMSG_PET_MODE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); - //OPCODE(CMSG_GOSSIP_HELLO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGossipHelloOpcode ); - //OPCODE(CMSG_GOSSIP_SELECT_OPTION, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGossipSelectOptionOpcode ); + OPCODE(CMSG_GOSSIP_HELLO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGossipHelloOpcode ); + OPCODE(CMSG_GOSSIP_SELECT_OPTION, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGossipSelectOptionOpcode ); OPCODE(SMSG_GOSSIP_MESSAGE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); OPCODE(SMSG_GOSSIP_COMPLETE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); OPCODE(CMSG_NPC_TEXT_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleNpcTextQueryOpcode ); diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 704a8238e..af62661e0 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -436,8 +436,8 @@ enum Opcodes SMSG_PET_NAME_INVALID = 0x1179, SMSG_PET_SPELLS = 0x4114, // 4.3.4 15595 SMSG_PET_MODE = 0x117B, - CMSG_GOSSIP_HELLO = 0x117C, - CMSG_GOSSIP_SELECT_OPTION = 0x117D, + CMSG_GOSSIP_HELLO = 0x4525, // 4.3.4 15595 + CMSG_GOSSIP_SELECT_OPTION = 0x0216, // 4.3.4 15595 SMSG_GOSSIP_MESSAGE = 0x2035, // 4.3.4 15595 SMSG_GOSSIP_COMPLETE = 0x0806, // 4.3.4 15595 CMSG_NPC_TEXT_QUERY = 0x4E24, // 4.3.4 15595 diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 4d27f7f99..2b997299b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7122,7 +7122,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl if (ssd && ssd_level > ssd->MaxLevel) ssd_level = ssd->MaxLevel; - ScalingStatValuesEntry const* ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : NULL; + ScalingStatValuesEntry const* ssv = proto->StatScalingFactor ? sScalingStatValuesStore.LookupEntry(ssd_level) : NULL; if (only_level_scale && !ssv) return; @@ -7136,12 +7136,10 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl if (ssd->StatMod[i] < 0) continue; statType = ssd->StatMod[i]; - val = (ssv->getssdMultiplier(proto->ScalingStatValue) * ssd->Modifier[i]) / 10000; + val = (ssv->getssdMultiplier(proto->StatScalingFactor) * ssd->Modifier[i]) / 10000; } else { - if (i >= proto->StatsCount) - continue; statType = proto->ItemStat[i].ItemStatType; val = proto->ItemStat[i].ItemStatValue; } @@ -7301,7 +7299,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl // Apply Spell Power from ScalingStatValue if set if (ssv) { - if (int32 spellbonus = ssv->getSpellBonus(proto->ScalingStatValue)) + if (int32 spellbonus = ssv->getSpellBonus(proto->StatScalingFactor)) ApplySpellPowerBonus(spellbonus, apply); } @@ -7309,7 +7307,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl uint32 armor = proto->GetArmor(); if (ssv) { - if (uint32 ssvarmor = ssv->getArmorMod(proto->ScalingStatValue)) + if (uint32 ssvarmor = ssv->getArmorMod(proto->StatScalingFactor)) armor = ssvarmor; } // Add armor bonus from ArmorDamageModifier if > 0 @@ -7332,27 +7330,6 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl } } - if (proto->Block) - HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(proto->Block), apply); - - if (proto->HolyRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(proto->HolyRes), apply); - - if (proto->FireRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(proto->FireRes), apply); - - if (proto->NatureRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(proto->NatureRes), apply); - - if (proto->FrostRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(proto->FrostRes), apply); - - if (proto->ShadowRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(proto->ShadowRes), apply); - - if (proto->ArcaneRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(proto->ArcaneRes), apply); - WeaponAttackType attType = BASE_ATTACK; float damage = 0.0f; @@ -7373,7 +7350,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl // If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage if (ssv) { - if ((extraDPS = ssv->getDPSMod(proto->ScalingStatValue))) + if ((extraDPS = ssv->getDPSMod(proto->StatScalingFactor))) { float average = extraDPS * proto->Delay / 1000.0f; minDamage = 0.7f * average; @@ -7396,7 +7373,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl // Apply feral bonus from ScalingStatValue if set if (ssv) { - if (int32 feral_bonus = ssv->getFeralBonus(proto->ScalingStatValue)) + if (int32 feral_bonus = ssv->getFeralBonus(proto->StatScalingFactor)) ApplyFeralAPBonus(feral_bonus, apply); } // Druids get feral AP bonus from weapon dps (also use DPS from ScalingStatValue) @@ -19738,7 +19715,6 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it // some special item spells without correct cooldown in SpellInfo // cooldown information stored in item prototype - // This used in same way in WorldSession::HandleItemQuerySingleOpcode data sending to client. if (itemId) { diff --git a/src/game/SQLStorages.cpp b/src/game/SQLStorages.cpp index 7017541b1..66ffaf202 100644 --- a/src/game/SQLStorages.cpp +++ b/src/game/SQLStorages.cpp @@ -27,8 +27,8 @@ const char GameObjectInfoAddonInfofmt[] = "iffff"; const char EquipmentInfofmt[] = "iiii"; const char GameObjectInfosrcfmt[] = "iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis"; const char GameObjectInfodstfmt[] = "iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; -const char ItemPrototypesrcfmt[] = "iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiisiiiii"; -const char ItemPrototypedstfmt[] = "iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiii"; +const char ItemPrototypesrcfmt[]= "iiiisiiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiifiiisiifiiiii"; +const char ItemPrototypedstfmt[]= "iiiisiiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiifiiiiiifiiiii"; const char PageTextfmt[] = "isi"; const char InstanceTemplatesrcfmt[] = "iiiis"; const char InstanceTemplatedstfmt[] = "iiiii"; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index e6abac51f..d490c83f2 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -394,7 +394,7 @@ Spell::Spell(Unit* caster, SpellEntry const* info, bool triggered, ObjectGuid or if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER) { if (Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK)) - m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType); + m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->DamageType); } } // Set health leech amount to zero diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1157f30b7..58a5c8738 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3661,7 +3661,7 @@ float Unit::GetUnitBlockChance() const if (player->CanBlock() && player->CanUseEquippedWeapon(OFF_ATTACK)) { Item* tmpitem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); - if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block) + if (tmpitem && !tmpitem->IsBroken()) return GetFloatValue(PLAYER_BLOCK_PERCENTAGE); } // is player but has no block ability or no not broken shield equipped diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index affae3648..baf847fca 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -485,7 +485,6 @@ class MANGOS_DLL_SPEC WorldSession void HandleSetContactNotesOpcode(WorldPacket& recvPacket); void HandleBugOpcode(WorldPacket& recvPacket); void HandleSetAmmoOpcode(WorldPacket& recvPacket); - void HandleItemNameQueryOpcode(WorldPacket& recvPacket); void HandleAreaTriggerOpcode(WorldPacket& recvPacket); @@ -638,7 +637,6 @@ class MANGOS_DLL_SPEC WorldSession void HandleSwapInvItemOpcode(WorldPacket& recvPacket); void HandleDestroyItemOpcode(WorldPacket& recvPacket); void HandleAutoEquipItemOpcode(WorldPacket& recvPacket); - void HandleItemQuerySingleOpcode(WorldPacket& recvPacket); void HandleSellItemOpcode(WorldPacket& recvPacket); void HandleBuyItemInSlotOpcode(WorldPacket& recvPacket); void HandleBuyItemOpcode(WorldPacket& recvPacket); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e12dc9b9e..fbeaac42a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "0113" + #define REVISION_NR "0114" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 210a4e167..933631a00 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_0099_xxxxx_01_characters_character_phase_data" - #define REVISION_DB_MANGOS "required_0083_12090_01_mangos_spell_template" + #define REVISION_DB_MANGOS "required_0114_xxxxx_01_mangos_item_template" #define REVISION_DB_REALMD "required_0014_xxxxx_01_realmd_account_access" #endif // __REVISION_SQL_H__