Core/Items

* Updated ItemTemplate structure to 4.x
* Calculate armor, damage and disenchant loot from dbc files

TODO: Use dbc disenchant ids in disenchant_loot_template
This commit is contained in:
Shauren
2011-11-25 23:24:40 +01:00
parent 8d3bc5e8b9
commit e8c3a3ac9c
24 changed files with 788 additions and 807 deletions

View File

@@ -0,0 +1,17 @@
DROP TABLE IF EXISTS `item_script_names`;
CREATE TABLE `item_script_names` (
`Id` int(10) unsigned not null,
`ScriptName` varchar(64) not null,
PRIMARY KEY(`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
INSERT INTO `item_script_names`
SELECT
`item_template`.`entry` AS `Id`,
`item_template`.`ScriptName` AS `ScriptName`
FROM
`item_template`
WHERE
length(`item_template`.`ScriptName`)>0;
ALTER TABLE `item_template` DROP `ScriptName`;

View File

@@ -0,0 +1,48 @@
ALTER TABLE `item_template`
ADD `stat_unk1_1` int(11) not null default 0 AFTER `stat_value1`,
ADD `stat_unk2_1` int(11) not null default 0 AFTER `stat_unk1_1`,
ADD `stat_unk1_2` int(11) not null default 0 AFTER `stat_value2`,
ADD `stat_unk2_2` int(11) not null default 0 AFTER `stat_unk1_2`,
ADD `stat_unk1_3` int(11) not null default 0 AFTER `stat_value3`,
ADD `stat_unk2_3` int(11) not null default 0 AFTER `stat_unk1_3`,
ADD `stat_unk1_4` int(11) not null default 0 AFTER `stat_value4`,
ADD `stat_unk2_4` int(11) not null default 0 AFTER `stat_unk1_4`,
ADD `stat_unk1_5` int(11) not null default 0 AFTER `stat_value5`,
ADD `stat_unk2_5` int(11) not null default 0 AFTER `stat_unk1_5`,
ADD `stat_unk1_6` int(11) not null default 0 AFTER `stat_value6`,
ADD `stat_unk2_6` int(11) not null default 0 AFTER `stat_unk1_6`,
ADD `stat_unk1_7` int(11) not null default 0 AFTER `stat_value7`,
ADD `stat_unk2_7` int(11) not null default 0 AFTER `stat_unk1_7`,
ADD `stat_unk1_8` int(11) not null default 0 AFTER `stat_value8`,
ADD `stat_unk2_8` int(11) not null default 0 AFTER `stat_unk1_8`,
ADD `stat_unk1_9` int(11) not null default 0 AFTER `stat_value9`,
ADD `stat_unk2_9` int(11) not null default 0 AFTER `stat_unk1_9`,
ADD `stat_unk1_10` int(11) not null default 0 AFTER `stat_value10`,
ADD `stat_unk2_10` int(11) not null default 0 AFTER `stat_unk1_10`,
DROP `StatsCount`,
DROP `ScalingStatValue`,
CHANGE `dmg_type1` `DamageType` tinyint(3) unsigned not null default 0 AFTER `ScalingStatDistribution`,
DROP `dmg_min1`,
DROP `dmg_max1`,
DROP `dmg_min2`,
DROP `dmg_max2`,
DROP `dmg_type2`,
DROP `armor`,
DROP `holy_res`,
DROP `fire_res`,
DROP `nature_res`,
DROP `frost_res`,
DROP `shadow_res`,
DROP `arcane_res`,
DROP `ammo_type`,
DROP `spellppmRate_1`,
DROP `spellppmRate_2`,
DROP `spellppmRate_3`,
DROP `spellppmRate_4`,
DROP `spellppmRate_5`,
DROP `block`,
DROP `RequiredDisenchantSkill`,
DROP `DisenchantId`,
ADD `StatScalingFactor` float not null default 0 AFTER `HolidayId`,
ADD `Field130` int(11) not null default 0 AFTER `StatScalingFactor`,
ADD `Field131` int(11) not null default 0 AFTER `Field130`;

View File

@@ -0,0 +1,38 @@
DROP TABLE IF EXISTS `item_template_addon`;
CREATE TABLE `item_template_addon` (
`Id` int(10) unsigned not null,
`BuyCount` tinyint(3) unsigned not null default 1,
`FoodType` tinyint(3) unsigned not null default 0,
`MinMoneyLoot` int(10) unsigned not null default 0,
`MaxMoneyLoot` int(10) unsigned not null default 0,
`SpellPPMChance` float unsigned not null default 0,
PRIMARY KEY(`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
INSERT INTO `item_template_addon`
SELECT
`item_template`.`entry` AS `Id`,
`item_template`.`BuyCount` AS `BuyCount`,
`item_template`.`FoodType` AS `FoodType`,
`item_template`.`minMoneyLoot` AS `MinMoneyLoot`,
`item_template`.`maxMoneyLoot` AS `MaxMoneyLoot`,
ABS(IF(`item_template`.`spelltrigger_1`=2, `item_template`.`spellppmRate_1`,
IF (`item_template`.`spelltrigger_2`=2, `item_template`.`spellppmRate_2`,
IF (`item_template`.`spelltrigger_3`=2, `item_template`.`spellppmRate_3`,
IF (`item_template`.`spelltrigger_4`=2, `item_template`.`spellppmRate_4`,
IF (`item_template`.`spelltrigger_5`=2, `item_template`.`spellppmRate_5`, 0))))))
AS `SpellPPMChance`
FROM
`item_template`
HAVING -- need to use having due to `SpellPPMChance` usage which is not an actual field in table
`item_template`.`BuyCount`!=1 OR
`item_template`.`FoodType`!=0 OR
(`item_template`.`minMoneyLoot`!=0 AND
`item_template`.`maxMoneyLoot`!=0) OR
`SpellPPMChance`!=0;
ALTER TABLE `item_template`
DROP `BuyCount`,
DROP `FoodType`,
DROP `minMoneyLoot`,
DROP `maxMoneyLoot`;