diff options
| author | Shauren <shauren.trinity@gmail.com> | 2012-07-14 19:03:03 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2012-07-14 19:03:03 +0200 |
| commit | a9d394073830c9c381f2267ccf8426974c53fa19 (patch) | |
| tree | b2f2c0e3aa56830127e2a2ab316e08ee2c426ac3 /src/server/game/Globals/ObjectMgr.cpp | |
| parent | 37c32c4c07ae8c172b9e983793b317799c051677 (diff) | |
| parent | 5485f92c5fa0f372a1a4622d96a8b1b74285fd74 (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
| -rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 177 |
1 files changed, 91 insertions, 86 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 71ce341185e..44be40401fd 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2196,7 +2196,7 @@ uint32 FillMaxDurability(uint32 itemClass, uint32 itemSubClass, uint32 inventory float levelPenalty = 1.0f; if (itemLevel <= 28) - levelPenalty = 0.966f - float(28u - itemLevel) * 1.0f / 54.0f; + levelPenalty = 0.966f - float(28u - itemLevel) / 54.0f; if (itemClass == ITEM_CLASS_ARMOR) { @@ -2273,6 +2273,8 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.Quality = sparse->Quality; itemTemplate.Flags = sparse->Flags; itemTemplate.Flags2 = sparse->Flags2; + itemTemplate.Unk430_1 = sparse->Unk430_1; + itemTemplate.Unk430_2 = sparse->Unk430_2; itemTemplate.BuyCount = std::max(sparse->BuyCount, 1u); itemTemplate.BuyPrice = sparse->BuyPrice; itemTemplate.SellPrice = sparse->SellPrice; @@ -2333,7 +2335,7 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.RandomProperty = sparse->RandomProperty; itemTemplate.RandomSuffix = sparse->RandomSuffix; itemTemplate.ItemSet = sparse->ItemSet; - itemTemplate.MaxDurability = FillMaxDurability(db2Data->Class, db2Data->SubClass, sparse->Quality, sparse->InventoryType, sparse->ItemLevel); + itemTemplate.MaxDurability = FillMaxDurability(db2Data->Class, db2Data->SubClass, sparse->InventoryType, sparse->Quality, sparse->ItemLevel); itemTemplate.Area = sparse->Area; itemTemplate.Map = sparse->Map; itemTemplate.BagFamily = sparse->BagFamily; @@ -2363,41 +2365,41 @@ void ObjectMgr::LoadItemTemplates() } // Load missing items from item_template AND overwrite data from Item-sparse.db2 (item_template is supposed to contain Item-sparse.adb data) - // 0 1 2 3 4 5 6 7 8 9 10 11 - QueryResult result = WorldDatabase.Query("SELECT entry, Class, SubClass, Unk0, Name, DisplayId, Quality, Flags, FlagsExtra, BuyPrice, SellPrice, InventoryType, " - // 12 13 14 15 16 17 18 19 - "AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, RequiredSpell, RequiredHonorRank, " - // 20 21 22 23 24 25 - "RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, MaxCount, Stackable, ContainerSlots, " - // 26 27 28 29 30 31 32 33 + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 + QueryResult result = WorldDatabase.Query("SELECT entry, Class, SubClass, Unk0, Name, DisplayId, Quality, Flags, FlagsExtra, Unk430_1, Unk430_2, BuyCount, BuyPrice, SellPrice, " + // 14 15 16 17 18 19 20 21 + "InventoryType, AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, RequiredSpell, " + // 22 23 24 25 26 27 28 + "RequiredHonorRank, RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, MaxCount, Stackable, ContainerSlots, " + // 29 30 31 32 33 34 35 36 "stat_type1, stat_value1, stat_unk1_1, stat_unk2_1, stat_type2, stat_value2, stat_unk1_2, stat_unk2_2, " - // 34 35 36 37 38 39 40 41 + // 37 38 39 40 41 42 43 44 "stat_type3, stat_value3, stat_unk1_3, stat_unk2_3, stat_type4, stat_value4, stat_unk1_4, stat_unk2_4, " - // 42 43 44 45 46 47 48 49 + // 45 46 47 48 49 50 51 52 "stat_type5, stat_value5, stat_unk1_5, stat_unk2_5, stat_type6, stat_value6, stat_unk1_6, stat_unk2_6, " - // 50 51 52 53 54 55 56 57 + // 53 54 55 56 57 58 59 60 "stat_type7, stat_value7, stat_unk1_7, stat_unk2_7, stat_type8, stat_value8, stat_unk1_8, stat_unk2_8, " - // 58 59 60 61 62 63 64 65 + // 61 62 63 64 65 66 67 68 "stat_type9, stat_value9, stat_unk1_9, stat_unk2_9, stat_type10, stat_value10, stat_unk1_10, stat_unk2_10, " - // 66 67 68 69 + // 69 70 71 72 "ScalingStatDistribution, DamageType, Delay, RangedModRange, " - // 70 71 72 73 74 75 + // 73 74 75 76 77 78 "spellid_1, spelltrigger_1, spellcharges_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, " - // 76 77 78 79 80 81 + // 79 80 81 82 83 84 "spellid_2, spelltrigger_2, spellcharges_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, " - // 82 83 84 85 86 87 + // 85 86 87 88 89 90 "spellid_3, spelltrigger_3, spellcharges_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, " - // 88 89 90 91 92 93 + // 91 92 93 94 95 96 "spellid_4, spelltrigger_4, spellcharges_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, " - // 94 95 96 97 98 99 + // 97 98 99 100 101 102 "spellid_5, spelltrigger_5, spellcharges_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, " - // 100 101 102 103 104 105 106 107 + // 103 104 105 106 107 108 109 110 "Bonding, Description, PageText, LanguageID, PageMaterial, StartQuest, LockID, Material, " - // 108 109 110 111 112 113 114 115 116 - "Sheath, RandomProperty, RandomSuffix, ItemSet, MaxDurability, Area, Map, BagFamily, TotemCategory, " - // 117 118 119 120 121 122 123 + // 111 112 113 114 115 116 117 118 + "Sheath, RandomProperty, RandomSuffix, ItemSet, Area, Map, BagFamily, TotemCategory, " + // 119 120 121 122 123 124 125 "SocketColor_1, SocketContent_1, SocketColor_2, SocketContent_2, SocketColor_3, SocketContent_3, SocketBonus, " - // 124 125 126 127 128 129 130 131 + // 126 127 128 129 130 131 132 133 "GemProperties, ArmorDamageModifier, Duration, ItemLimitCategory, HolidayId, StatScalingFactor, Field130, Field131 " "FROM item_template"); @@ -2421,93 +2423,96 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.Quality = uint32(fields[6].GetUInt8()); itemTemplate.Flags = uint32(fields[7].GetInt64()); itemTemplate.Flags2 = fields[8].GetUInt32(); - itemTemplate.BuyCount = 1; - itemTemplate.BuyPrice = fields[9].GetInt64(); - itemTemplate.SellPrice = fields[10].GetUInt32(); - itemTemplate.InventoryType = fields[11].GetUInt32(); - itemTemplate.AllowableClass = fields[12].GetUInt32(); - itemTemplate.AllowableRace = fields[13].GetUInt32(); - itemTemplate.ItemLevel = fields[14].GetUInt32(); - itemTemplate.RequiredLevel = fields[15].GetUInt32(); - itemTemplate.RequiredSkill = fields[16].GetUInt32(); - itemTemplate.RequiredSkillRank = fields[17].GetUInt32(); - itemTemplate.RequiredSpell = fields[18].GetUInt32(); - itemTemplate.RequiredHonorRank = fields[19].GetUInt32(); - itemTemplate.RequiredCityRank = fields[20].GetUInt32(); - itemTemplate.RequiredReputationFaction = fields[21].GetUInt32(); - itemTemplate.RequiredReputationRank = fields[22].GetUInt32(); - itemTemplate.MaxCount = fields[23].GetInt32(); - itemTemplate.Stackable = fields[24].GetInt32(); - itemTemplate.ContainerSlots = fields[25].GetUInt32(); + itemTemplate.Unk430_1 = fields[9].GetFloat(); + itemTemplate.Unk430_2 = fields[10].GetFloat(); + itemTemplate.BuyCount = uint32(fields[11].GetUInt8()); + itemTemplate.BuyPrice = int32(fields[12].GetInt64()); + itemTemplate.SellPrice = fields[13].GetUInt32(); + + itemTemplate.InventoryType = uint32(fields[14].GetUInt8()); + itemTemplate.AllowableClass = fields[15].GetInt32(); + itemTemplate.AllowableRace = fields[16].GetInt32(); + itemTemplate.ItemLevel = uint32(fields[17].GetUInt16()); + itemTemplate.RequiredLevel = uint32(fields[18].GetUInt8()); + itemTemplate.RequiredSkill = uint32(fields[19].GetUInt16()); + itemTemplate.RequiredSkillRank = uint32(fields[20].GetUInt16()); + itemTemplate.RequiredSpell = fields[21].GetUInt32(); + itemTemplate.RequiredHonorRank = fields[22].GetUInt32(); + itemTemplate.RequiredCityRank = fields[23].GetUInt32(); + itemTemplate.RequiredReputationFaction = uint32(fields[24].GetUInt16()); + itemTemplate.RequiredReputationRank = uint32(fields[25].GetUInt16()); + itemTemplate.MaxCount = fields[26].GetInt32(); + itemTemplate.Stackable = fields[27].GetInt32(); + itemTemplate.ContainerSlots = uint32(fields[28].GetUInt8()); for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i) { - itemTemplate.ItemStat[i].ItemStatType = fields[26 + i * 4].GetUInt8(); - itemTemplate.ItemStat[i].ItemStatValue = fields[26 + i * 4 + 1].GetInt16(); - itemTemplate.ItemStat[i].ItemStatUnk1 = fields[26 + i * 4 + 2].GetInt32(); - itemTemplate.ItemStat[i].ItemStatUnk2 = fields[26 + i * 4 + 3].GetInt32(); + itemTemplate.ItemStat[i].ItemStatType = uint32(fields[28 + i * 4 + 0].GetUInt8()); + itemTemplate.ItemStat[i].ItemStatValue = int32(fields[28 + i * 4 + 1].GetInt16()); + itemTemplate.ItemStat[i].ItemStatUnk1 = fields[28 + i * 4 + 2].GetInt32(); + itemTemplate.ItemStat[i].ItemStatUnk2 = fields[28 + i * 4 + 3].GetInt32(); } - itemTemplate.ScalingStatDistribution = fields[66].GetUInt32(); + itemTemplate.ScalingStatDistribution = uint32(fields[69].GetUInt16()); // cache item damage FillItemDamageFields(&itemTemplate.DamageMin, &itemTemplate.DamageMax, &itemTemplate.DPS, itemTemplate.ItemLevel, - itemTemplate.Class, itemTemplate.SubClass, itemTemplate.Quality, fields[68].GetUInt32(), - fields[129].GetFloat(), itemTemplate.InventoryType, itemTemplate.Flags2); + itemTemplate.Class, itemTemplate.SubClass, itemTemplate.Quality, fields[71].GetUInt32(), + fields[131].GetFloat(), itemTemplate.InventoryType, itemTemplate.Flags2); - itemTemplate.DamageType = fields[67].GetUInt32(); + itemTemplate.DamageType = fields[70].GetUInt32(); itemTemplate.Armor = FillItemArmor(itemTemplate.ItemLevel, itemTemplate.Class, itemTemplate.SubClass, itemTemplate.Quality, itemTemplate.InventoryType); - itemTemplate.Delay = fields[68].GetUInt32(); - itemTemplate.RangedModRange = fields[69].GetFloat(); + itemTemplate.Delay = fields[71].GetUInt32(); + itemTemplate.RangedModRange = fields[72].GetFloat(); for (uint32 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { - itemTemplate.Spells[i].SpellId = fields[70 + 6 * i].GetInt32(); - itemTemplate.Spells[i].SpellTrigger = fields[70 + 6 * i + 1].GetUInt32(); - itemTemplate.Spells[i].SpellCharges = fields[70 + 6 * i + 2].GetInt32(); - itemTemplate.Spells[i].SpellCooldown = fields[70 + 6 * i + 3].GetInt32(); - itemTemplate.Spells[i].SpellCategory = fields[70 + 6 * i + 4].GetUInt32(); - itemTemplate.Spells[i].SpellCategoryCooldown = fields[70 + 6 * i + 5].GetInt32(); + itemTemplate.Spells[i].SpellId = fields[73 + 6 * i + 0].GetInt32(); + itemTemplate.Spells[i].SpellTrigger = uint32(fields[73 + 6 * i + 1].GetUInt8()); + itemTemplate.Spells[i].SpellCharges = int32(fields[73 + 6 * i + 2].GetInt16()); + itemTemplate.Spells[i].SpellCooldown = fields[73 + 6 * i + 3].GetInt32(); + itemTemplate.Spells[i].SpellCategory = uint32(fields[73 + 6 * i + 4].GetUInt16()); + itemTemplate.Spells[i].SpellCategoryCooldown = fields[73 + 6 * i + 5].GetInt32(); } itemTemplate.SpellPPMRate = 0.0f; - itemTemplate.Bonding = fields[100].GetUInt32(); - itemTemplate.Description = fields[101].GetString(); - itemTemplate.PageText = fields[102].GetUInt32(); - itemTemplate.LanguageID = fields[103].GetUInt32(); - itemTemplate.PageMaterial = fields[104].GetUInt32(); - itemTemplate.StartQuest = fields[105].GetUInt32(); - itemTemplate.LockID = fields[106].GetUInt32(); - itemTemplate.Material = fields[107].GetInt32(); - itemTemplate.Sheath = fields[108].GetUInt32(); - itemTemplate.RandomProperty = fields[109].GetInt32(); - itemTemplate.RandomSuffix = fields[110].GetInt32(); - itemTemplate.ItemSet = fields[111].GetUInt32(); + itemTemplate.Bonding = uint32(fields[103].GetUInt8()); + itemTemplate.Description = fields[104].GetString(); + itemTemplate.PageText = fields[105].GetUInt32(); + itemTemplate.LanguageID = uint32(fields[106].GetUInt8()); + itemTemplate.PageMaterial = uint32(fields[107].GetUInt8()); + itemTemplate.StartQuest = fields[108].GetUInt32(); + itemTemplate.LockID = fields[109].GetUInt32(); + itemTemplate.Material = int32(fields[110].GetInt8()); + itemTemplate.Sheath = uint32(fields[111].GetUInt8()); + itemTemplate.RandomProperty = fields[112].GetUInt32(); + itemTemplate.RandomSuffix = fields[113].GetInt32(); + itemTemplate.ItemSet = fields[114].GetUInt32(); itemTemplate.MaxDurability = FillMaxDurability(itemTemplate.Class, itemTemplate.SubClass, - itemTemplate.Quality, itemTemplate.InventoryType, itemTemplate.ItemLevel); + itemTemplate.InventoryType, itemTemplate.Quality, itemTemplate.ItemLevel); - itemTemplate.Area = fields[113].GetUInt32(); - itemTemplate.Map = fields[114].GetUInt32(); - itemTemplate.BagFamily = fields[115].GetUInt32(); - itemTemplate.TotemCategory = fields[116].GetUInt32(); + itemTemplate.Area = fields[115].GetUInt32(); + itemTemplate.Map = uint32(fields[116].GetUInt16()); + itemTemplate.BagFamily = fields[117].GetUInt32(); + itemTemplate.TotemCategory = fields[118].GetUInt32(); for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i) { - itemTemplate.Socket[i].Color = fields[117 + i * 2].GetUInt32(); - itemTemplate.Socket[i].Content = fields[117 + i * 2 + 1].GetUInt32(); + itemTemplate.Socket[i].Color = uint32(fields[119 + i*2].GetUInt8()); + itemTemplate.Socket[i].Content = fields[119 + i * 2 + 1].GetUInt32(); } - itemTemplate.socketBonus = fields[123].GetUInt32(); - itemTemplate.GemProperties = fields[124].GetUInt32(); + itemTemplate.socketBonus = fields[125].GetUInt32(); + itemTemplate.GemProperties = fields[126].GetUInt32(); FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, itemTemplate); - itemTemplate.ArmorDamageModifier = fields[125].GetFloat(); - itemTemplate.Duration = fields[126].GetUInt32(); - itemTemplate.ItemLimitCategory = fields[127].GetUInt32(); - itemTemplate.HolidayId = fields[128].GetUInt32(); - itemTemplate.StatScalingFactor = fields[129].GetFloat(); - itemTemplate.Field130 = fields[130].GetInt32(); - itemTemplate.Field131 = fields[131].GetInt32(); + itemTemplate.ArmorDamageModifier = fields[127].GetFloat(); + itemTemplate.Duration = fields[128].GetUInt32(); + itemTemplate.ItemLimitCategory = uint32(fields[129].GetInt16()); + itemTemplate.HolidayId = fields[130].GetUInt32(); + itemTemplate.StatScalingFactor = fields[131].GetFloat(); + itemTemplate.Field130 = fields[132].GetInt32(); + itemTemplate.Field131 = fields[133].GetInt32(); itemTemplate.ScriptId = 0; itemTemplate.FoodType = 0; itemTemplate.MinMoneyLoot = 0; |
