diff --git a/includes/class.item.php b/includes/class.item.php index c65651d1..b6168f08 100644 --- a/includes/class.item.php +++ b/includes/class.item.php @@ -3,55 +3,21 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); - -/* --- JOIN -?_item_template_addon - id // item Id - icon - subClass // custom of certain categories - itemMods // space separated; parsed - map // manually filled..? :( - cuFlags -*/ - -class Item +class Item extends BaseType { - public $Id = 0; - public $name = ''; - public $tooltip = ''; - public $template = array(); - public $json = array(); - public $itemMods = array(); - private $ssd = null; + public $name = ''; + public $tooltip = ''; + public $json = []; + public $itemMods = []; + private $ssd = null; + + protected $setupQuery = 'SELECT * FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE i.entry = ?d'; public function __construct($data) { - if (is_array($data)) - $this->template = $data; - else - $this->template = DB::Aowow()->selectRow(' - SELECT - * - FROM - item_template i, - ?_item_template_addon iX, - locales_item l - WHERE - i.entry = iX.id - AND i.entry = l.entry - AND i.entry = ?d - ', - intVal($data) - ); + parent::__construct($data); - if (!$this->template) // invalid Id/data passed - return false; - - if (!$this->template['entry']) // may happen if item_locales is empty and overvwrites entry with NULL - $this->template['entry'] = intval($data); - - $this->Id = $this->template['entry']; // easier reference + // post processing $this->name = Util::localizedString($this->template, 'name'); // item is scaling; overwrite other values @@ -148,8 +114,6 @@ class Item if ($this->json['classs'] == ITEM_CLASS_WEAPON && in_array($this->json['subclass'], [5, 6, 10]) && $this->json['dps'] > 54.8) $this->json['feratkpwr'] = max(0, round((($this->json['dmgmin1'] + $this->json['dmgmax1']) / (2 * $this->template['delay'] / 1000) - 54.8) * 14, 0)); } - - return true; } // use if you JUST need the name @@ -195,15 +159,6 @@ class Item ); } - public function getDetailedData() - { - return array( - 'id' => $this->Id, - 'name' => $this->name, - 'iconname' => $this->template['icon'], - ); - } - public function addSelfToJScript(&$gItems) { $gItems[$this->Id] = array( @@ -612,10 +567,10 @@ class Item if ($craftSpell->template["reagent".$i]) $reagentItems[$craftSpell->template["reagent".$i]] = $craftSpell->template["reagentCount".$i]; - $reagents = new ItemList(array(array('i.entry', 'IN', array_keys($reagentItems)))); + $reagents = new ItemList(array(['i.entry', array_keys($reagentItems)])); $reqReag = array(); - foreach ($reagents->itemList as $r) + foreach ($reagents->container as $r) $reqReag[] = ''.$r->name.' ('.$reagentItems[$r->Id].')'; $x .= ''.Lang::$item['trigger'][0].' '.Util::localizedString($this->template, 'description').''; @@ -970,10 +925,11 @@ class Item } } -class ItemList + + +class ItemList extends BaseTypeList { - public $itemList = array(); - public $filter = NULL; + protected $setupQuery = 'SELECT *, i.entry AS ARRAY_KEY FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE [filter] [cond] GROUP BY i.entry ORDER BY i.Quality DESC'; public function __construct($conditions) { @@ -982,45 +938,10 @@ class ItemList { $this->filter = new ItemFilter(); if (($fiData = $this->filter->init()) === false) - return false; + return; } - $sql = array(); - foreach ($conditions as $c) - { - if (!$c || empty($c)) - continue; - - if ($c[1] == 'IN' && is_array($c[2])) - $sql[] = Util::sqlEscape($c[0]).' IN ('.implode(',', Util::sqlEscape($c[2])).')'; - else - $sql[] = Util::sqlEscape($c[0]).' '.Util::sqlEscape($c[1]).(is_string($c[2]) ? ' "'.Util::sqlEscape($c[2]).'"' : ' '.intval($c[2])); - } - - // todo: add strings propperly without them being escaped by simpleDB..? - $filterQuery = $this->filter && $this->filter->buildFilterQuery() ? ' AND '.$this->filter->query : NULL; - - $rows = DB::Aowow()->select(' - SELECT - *, - l.* - FROM - item_template i, ?_item_template_addon iX , locales_item l - WHERE - i.entry = iX.id - AND i.entry = l.entry - '.$filterQuery.' - '.(!empty($sql) ? 'AND ('.implode(" AND ", $sql).')' : null).' - GROUP BY - i.entry - ORDER BY - i.Quality DESC' - ); - - foreach ($rows as $row) - $this->itemList[] = new Item($row); - - return true; + parent::__construct($conditions); } } diff --git a/includes/class.spell.php b/includes/class.spell.php index b2bfe22f..96520016 100644 --- a/includes/class.spell.php +++ b/includes/class.spell.php @@ -3,532 +3,17 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); - -class Spell +class Spell extends BaseType { + public $tooltip = ''; + public $buff = ''; - public $effectNames = array( - 0 => 'None', - 1 => 'Instakill', - 2 => 'School Damage', - 3 => 'Dummy', - 4 => 'Portal Teleport', - 5 => 'Teleport Units', - 6 => 'Apply Aura', - 7 => 'Environmental Damage', - 8 => 'Power Drain', - 9 => 'Health Leech', - 10 => 'Heal', - 11 => 'Bind', - 12 => 'Portal', - 13 => 'Ritual Base', - 14 => 'Ritual Specialize', - 15 => 'Ritual Activate Portal', - 16 => 'Quest Complete', - 17 => 'Weapon Damage NoSchool', - 18 => 'Resurrect', - 19 => 'Add Extra Attacks', - 20 => 'Dodge', - 21 => 'Evade', - 22 => 'Parry', - 23 => 'Block', - 24 => 'Create Item', - 25 => 'Weapon', - 26 => 'Defense', - 27 => 'Persistent Area Aura', - 28 => 'Summon', - 29 => 'Leap', - 30 => 'Energize', - 31 => 'Weapon Percent Damage', - 32 => 'Trigger Missile', - 33 => 'Open Lock', - 34 => 'Summon Change Item', - 35 => 'Apply Area Aura Party', - 36 => 'Learn Spell', - 37 => 'Spell Defense', - 38 => 'Dispel', - 39 => 'Language', - 40 => 'Dual Wield', - 41 => 'Jump', - 42 => 'Jump Dest', - 43 => 'Teleport Units Face Caster', - 44 => 'Skill Step', - 45 => 'Add Honor', - 46 => 'Spawn', - 47 => 'Trade Skill', - 48 => 'Stealth', - 49 => 'Detect', - 50 => 'Trans Door', - 51 => 'Force Critical Hit', - 52 => 'Guarantee Hit', - 53 => 'Enchant Item Permanent', - 54 => 'Enchant Item Temporary', - 55 => 'Tame Creature', - 56 => 'Summon Pet', - 57 => 'Learn Pet Spell', - 58 => 'Weapon Damage', - 59 => 'Create Random Item', - 60 => 'Proficiency', - 61 => 'Send Event', - 62 => 'Power Burn', - 63 => 'Threat', - 64 => 'Trigger Spell', - 65 => 'Apply Area Aura Raid', - 66 => 'Create Mana Gem', - 67 => 'Heal Max Health', - 68 => 'Interrupt Cast', - 69 => 'Distract', - 70 => 'Pull', - 71 => 'Pickpocket', - 72 => 'Add Farsight', - 73 => 'Untrain Talents', - 74 => 'Apply Glyph', - 75 => 'Heal Mechanical', - 76 => 'Summon Object Wild', - 77 => 'Script Effect', - 78 => 'Attack', - 79 => 'Sanctuary', - 80 => 'Add Combo Points', - 81 => 'Create House', - 82 => 'Bind Sight', - 83 => 'Duel', - 84 => 'Stuck', - 85 => 'Summon Player', - 86 => 'Activate Object', - 87 => 'WMO Damage', - 88 => 'WMO Repair', - 89 => 'WMO Change', - 90 => 'Kill Credit', - 91 => 'Threat All', - 92 => 'Enchant Held Item', - 93 => 'Force Deselect', - 94 => 'Self Resurrect', - 95 => 'Skinning', - 96 => 'Charge', - 97 => 'Cast Button', - 98 => 'Knock Back', - 99 => 'Disenchant', - 100 => 'Inebriate', - 101 => 'Feed Pet', - 102 => 'Dismiss Pet', - 103 => 'Reputation', - 104 => 'Summon Object Slot1', - 105 => 'Summon Object Slot2', - 106 => 'Summon Object Slot3', - 107 => 'Summon Object Slot4', - 108 => 'Dispel Mechanic', - 109 => 'Summon Dead Pet', - 110 => 'Destroy All Totems', - 111 => 'Durability Damage', - 112 => 'Summon Demon', - 113 => 'Resurrect New', - 114 => 'Attack Me', - 115 => 'Durability Damage Percent', - 116 => 'Skin Player Corpse', - 117 => 'Spirit Heal', - 118 => 'Skill', - 119 => 'Apply Area Aura Pet', - 120 => 'Teleport Graveyard', - 121 => 'Normalized Weapon Dmg', - 122 => 'Unknown Effect', - 123 => 'Send Taxi', - 124 => 'Pull Towards', - 125 => 'Modify Threat Percent', - 126 => 'Steal Beneficial Buff', - 127 => 'Prospecting', - 128 => 'Apply Area Aura Friend', - 129 => 'Apply Area Aura Enemy', - 130 => 'Redirect Threat', - 131 => 'Unknown Effect', - 132 => 'Play Music', - 133 => 'Unlearn Specialization', - 134 => 'Kill Credit2', - 135 => 'Call Pet', - 136 => 'Heal Percent', - 137 => 'Energize Percent', - 138 => 'Leap Back', - 139 => 'Clear Quest', - 140 => 'Force Cast', - 141 => 'Force Cast With Value', - 142 => 'Trigger Spell With Value', - 143 => 'Apply Area Aura Owner', - 144 => 'Knock Back Dest', - 145 => 'Pull Towards Dest', - 146 => 'Activate Rune', - 147 => 'Quest Fail', - 148 => 'Unknown Effect', - 149 => 'Charge Dest', - 150 => 'Quest Start', - 151 => 'Trigger Spell 2', - 152 => 'Unknown Effect', - 153 => 'Create Tamed Pet', - 154 => 'Discover Taxi', - 155 => 'Titan Grip', - 156 => 'Enchant Item Prismatic', - 157 => 'Create Item 2', - 158 => 'Milling', - 159 => 'Allow Rename Pet', - 160 => 'Unknown Effect', - 161 => 'Talent Spec Count', - 162 => 'Talent Spec Select', - 163 => 'Unknown Effect', - 164 => 'Remove Aura' - ); - - public $auraNames = array( - 0 => 'None', - 1 => 'Bind Sight', - 2 => 'Mod Possess', - 3 => 'Periodic Damage', - 4 => 'Dummy', - 5 => 'Mod Confuse', - 6 => 'Mod Charm', - 7 => 'Mod Fear', - 8 => 'Periodic Heal', - 9 => 'Mod Attack Speed', - 10 => 'Mod Threat', - 11 => 'Taunt', - 12 => 'Stun', - 13 => 'Mod Damage Done', - 14 => 'Mod Damage Taken', - 15 => 'Damage Shield', - 16 => 'Mod Stealth', - 17 => 'Mod Stealth Detection', - 18 => 'Mod Invisibility', - 19 => 'Mod Invisibility Detection', - 20 => 'Obsolete Mod Health', - 21 => 'Obsolete Mod Power', - 22 => 'Mod Resistance', - 23 => 'Periodic Trigger Spell', - 24 => 'Periodic Energize', - 25 => 'Pacify', - 26 => 'Root', - 27 => 'Silence', - 28 => 'Reflect Spells', - 29 => 'Mod Stat', - 30 => 'Mod Skill', - 31 => 'Mod Increase Speed', - 32 => 'Mod Increase Mounted Speed', - 33 => 'Mod Decrease Speed', - 34 => 'Mod Increase Health', - 35 => 'Mod Increase Energy', - 36 => 'Shapeshift', - 37 => 'Effect Immunity', - 38 => 'State Immunity', - 39 => 'School Immunity', - 40 => 'Damage Immunity', - 41 => 'Dispel Immunity', - 42 => 'Proc Trigger Spell', - 43 => 'Proc Trigger Damage', - 44 => 'Track Creatures', - 45 => 'Track Resources', - 46 => 'Mod Parry Skill', - 47 => 'Mod Parry Percent', - 48 => 'Mod Dodge Skill', - 49 => 'Mod Dodge Percent', - 50 => 'Mod Critical Healing Amount', - 51 => 'Mod Block Percent', - 52 => 'Mod Weapon Crit Percent', - 53 => 'Periodic Leech', - 54 => 'Mod Hit Chance', - 55 => 'Mod Spell Hit Chance', - 56 => 'Transform', - 57 => 'Mod Spell Crit Chance', - 58 => 'Mod Increase Swim Speed', - 59 => 'Mod Damage Done Creature', - 60 => 'Pacify Silence', - 61 => 'Mod Scale', - 62 => 'Periodic Health Funnel', - 63 => 'Periodic Mana Funnel', - 64 => 'Periodic Mana Leech', - 65 => 'Mod Casting Speed (not stacking)', - 66 => 'Feign Death', - 67 => 'Disarm', - 68 => 'Stalked', - 69 => 'School Absorb', - 70 => 'Extra Attacks', - 71 => 'Mod Spell Crit Chance School', - 72 => 'Mod Power Cost School Percent', - 73 => 'Mod Power Cost School', - 74 => 'Reflect Spells School', - 75 => 'Language', - 76 => 'Far Sight', - 77 => 'Mechanic Immunity', - 78 => 'Mounted', - 79 => 'Mod Damage Percent Done', - 80 => 'Mod Percent Stat', - 81 => 'Split Damage Percent', - 82 => 'Water Breathing', - 83 => 'Mod Base Resistance', - 84 => 'Mod Health Regeneration', - 85 => 'Mod Power Regeneration', - 86 => 'Channel Death Item', - 87 => 'Mod Damage Percent Taken', - 88 => 'Mod Health Regeneration Percent', - 89 => 'Periodic Damage Percent', - 90 => 'Mod Resist Chance', - 91 => 'Mod Detect Range', - 92 => 'Prevent Fleeing', - 93 => 'Unattackable', - 94 => 'Interrupt Regeneration', - 95 => 'Ghost', - 96 => 'Spell Magnet', - 97 => 'Mana Shield', - 98 => 'Mod Skill Talent', - 99 => 'Mod Attack Power', - 100 => 'Auras Visible', - 101 => 'Mod Resistance Percent', - 102 => 'Mod Melee Attack Power Versus', - 103 => 'Mod Total Threat', - 104 => 'Water Walk', - 105 => 'Feather Fall', - 106 => 'Hover', - 107 => 'Add Flat Modifier', - 108 => 'Add Percent Modifier', - 109 => 'Add Target Trigger', - 110 => 'Mod Power Regeneration Percent', - 111 => 'Add Caster Hit Trigger', - 112 => 'Override Class Scripts', - 113 => 'Mod Ranged Damage Taken', - 114 => 'Mod Ranged Damage Taken Percent', - 115 => 'Mod Healing', - 116 => 'Mod Regeneration During Combat', - 117 => 'Mod Mechanic Resistance', - 118 => 'Mod Healing Percent', - 119 => 'Share Pet Tracking', - 120 => 'Untrackable', - 121 => 'Empathy', - 122 => 'Mod Offhand Damage Percent', - 123 => 'Mod Target Resistance', - 124 => 'Mod Ranged Attack Power', - 125 => 'Mod Melee Damage Taken', - 126 => 'Mod Melee Damage Taken Percent', - 127 => 'Ranged Attack Power Attacker Bonus', - 128 => 'Possess Pet', - 129 => 'Mod Speed Always', - 130 => 'Mod Mounted Speed Always', - 131 => 'Mod Ranged Attack Power Versus', - 132 => 'Mod Increase Energy Percent', - 133 => 'Mod Increase Health Percent', - 134 => 'Mod Mana Regeneration Interrupt', - 135 => 'Mod Healing Done', - 136 => 'Mod Healing Done Percent', - 137 => 'Mod Total Stat Percentage', - 138 => 'Mod Melee Haste', - 139 => 'Force Reaction', - 140 => 'Mod Ranged Haste', - 141 => 'Mod Ranged Ammo Haste', - 142 => 'Mod Base Resistance Percent', - 143 => 'Mod Resistance Exclusive', - 144 => 'Safe Fall', - 145 => 'Mod Pet Talent Points', - 146 => 'Allow Tame Pet Type', - 147 => 'Mechanic Immunity Mask', - 148 => 'Retain Combo Points', - 149 => 'Reduce Pushback', - 150 => 'Mod Shield Blockvalue Percent', - 151 => 'Track Stealthed', - 152 => 'Mod Detected Range', - 153 => 'Split Damage Flat', - 154 => 'Mod Stealth Level', - 155 => 'Mod Water Breathing', - 156 => 'Mod Reputation Gain', - 157 => 'Pet Damage Multi', - 158 => 'Mod Shield Blockvalue', - 159 => 'No PvP Credit', - 160 => 'Mod AoE Avoidance', - 161 => 'Mod Health Regeneration In Combat', - 162 => 'Power Burn Mana', - 163 => 'Mod Crit Damage Bonus', - 164 => 'Unknown Aura', - 165 => 'Melee Attack Power Attacker Bonus', - 166 => 'Mod Attack Power Percent', - 167 => 'Mod Ranged Attack Power Percent', - 168 => 'Mod Damage Done Versus', - 169 => 'Mod Crit Percent Versus', - 170 => 'Detect Amore', - 171 => 'Mod Speed (not stacking)', - 172 => 'Mod Mounted Speed (not stacking)', - 173 => 'Unknown Aura', - 174 => 'Mod Spell Damage Of Stat Percent', - 175 => 'Mod Spell Healing Of Stat Percent', - 176 => 'Spirit Of Redemption', - 177 => 'AoE Charm', - 178 => 'Mod Debuff Resistance', - 179 => 'Mod Attacker Spell Crit Chance', - 180 => 'Mod Flat Spell Damage Versus', - 181 => 'Unknown Aura', - 182 => 'Mod Resistance Of Stat Percent', - 183 => 'Mod Critical Threat', - 184 => 'Mod Attacker Melee Hit Chance', - 185 => 'Mod Attacker Ranged Hit Chance', - 186 => 'Mod Attacker Spell Hit Chance', - 187 => 'Mod Attacker Melee Crit Chance', - 188 => 'Mod Attacker Ranged Crit Chance', - 189 => 'Mod Rating', - 190 => 'Mod Faction Reputation Gain', - 191 => 'Use Normal Movement Speed', - 192 => 'Mod Melee Ranged Haste', - 193 => 'Melee Slow', - 194 => 'Mod Target Absorb School', - 195 => 'Mod Target Ability Absorb School', - 196 => 'Mod Cooldown', - 197 => 'Mod Attacker Spell And Weapon Crit Chance', - 198 => 'Unknown Aura', - 199 => 'Mod Increases Spell Percent to Hit', - 200 => 'Mod XP Percent', - 201 => 'Fly', - 202 => 'Ignore Combat Result', - 203 => 'Mod Attacker Melee Crit Damage', - 204 => 'Mod Attacker Ranged Crit Damage', - 205 => 'Mod School Crit Dmg Taken', - 206 => 'Mod Increase Vehicle Flight Speed', - 207 => 'Mod Increase Mounted Flight Speed', - 208 => 'Mod Increase Flight Speed', - 209 => 'Mod Mounted Flight Speed Always', - 210 => 'Mod Vehicle Speed Always', - 211 => 'Mod Flight Speed (not stacking)', - 212 => 'Mod Ranged Attack Power Of Stat Percent', - 213 => 'Mod Rage from Damage Dealt', - 214 => 'Unknown Aura', - 215 => 'Arena Preparation', - 216 => 'Haste Spells', - 217 => 'Unknown Aura', - 218 => 'Haste Ranged', - 219 => 'Mod Mana Regeneration from Stat', - 220 => 'Mod Rating from Stat', - 221 => 'Detaunt', - 222 => 'Unknown Aura', - 223 => 'Raid Proc from Charge', - 224 => 'Unknown Aura', - 225 => 'Raid Proc from Charge With Value', - 226 => 'Periodic Dummy', - 227 => 'Periodic Trigger Spell With Value', - 228 => 'Detect Stealth', - 229 => 'Mod AoE Damage Avoidance', - 230 => 'Unknown Aura', - 231 => 'Proc Trigger Spell With Value', - 232 => 'Mechanic Duration Mod', - 233 => 'Unknown Aura', - 234 => 'Mechanic Duration Mod (not stacking)', - 235 => 'Mod Dispel Resist', - 236 => 'Control Vehicle', - 237 => 'Mod Spell Damage Of Attack Power', - 238 => 'Mod Spell Healing Of Attack Power', - 239 => 'Mod Scale 2', - 240 => 'Mod Expertise', - 241 => 'Force Move Forward', - 242 => 'Mod Spell Damage from Healing', - 243 => 'Mod Faction', - 244 => 'Comprehend Language', - 245 => 'Mod Aura Duration By Dispel', - 246 => 'Mod Aura Duration By Dispel (not stacking)', - 247 => 'Clone Caster', - 248 => 'Mod Combat Result Chance', - 249 => 'Convert Rune', - 250 => 'Mod Increase Health 2', - 251 => 'Mod Enemy Dodge', - 252 => 'Mod Speed Slow All', - 253 => 'Mod Block Crit Chance', - 254 => 'Mod Disarm Offhand', - 255 => 'Mod Mechanic Damage Taken Percent', - 256 => 'No Reagent Use', - 257 => 'Mod Target Resist By Spell Class', - 258 => 'Unknown Aura', - 259 => 'Mod HoT Percent', - 260 => 'Screen Effect', - 261 => 'Phase', - 262 => 'Ability Ignore Aurastate', - 263 => 'Allow Only Ability', - 264 => 'Unknown Aura', - 265 => 'Unknown Aura', - 266 => 'Unknown Aura', - 267 => 'Mod Immune Aura Apply School', - 268 => 'Mod Attack Power Of Stat Percent', - 269 => 'Mod Ignore Target Resist', - 270 => 'Mod Ability Ignore Target Resist', - 271 => 'Mod Damage from Caster', - 272 => 'Ignore Melee Reset', - 273 => 'X Ray', - 274 => 'Ability Consume No Ammo', - 275 => 'Mod Ignore Shapeshift', - 276 => 'Unknown Aura', - 277 => 'Mod Max Affected Targets', - 278 => 'Mod Disarm Ranged', - 279 => 'Initialize Images', - 280 => 'Mod Armor Penetration Percent', - 281 => 'Mod Honor Gain Percent', - 282 => 'Mod Base Health Percent', - 283 => 'Mod Healing Received', - 284 => 'Linked', - 285 => 'Mod Attack Power Of Armor', - 286 => 'Ability Periodic Crit', - 287 => 'Deflect Spells', - 288 => 'Ignore Hit Direction', - 289 => 'Unknown Aura', - 290 => 'Mod Crit Percent', - 291 => 'Mod XP Quest Percent', - 292 => 'Open Stable', - 293 => 'Override Spells', - 294 => 'Prevent Power Regeneration', - 295 => 'Unknown Aura', - 296 => 'Set Vehicle Id', - 297 => 'Block Spell Family', - 298 => 'Strangulate', - 299 => 'Unknown Aura', - 300 => 'Share Damage Percent', - 301 => 'School Heal Absorb', - 302 => 'Unknown Aura', - 303 => 'Mod Damage Done Versus Aurastate', - 304 => 'Mod Fake Inebriate', - 305 => 'Mod Minimum Speed', - 306 => 'Unknown Aura', - 307 => 'Heal Absorb Test', - 308 => 'Unknown Aura', - 309 => 'Unknown Aura', - 310 => 'Mod Creature AoE Damage Avoidance', - 311 => 'Unknown Aura', - 312 => 'Unknown Aura', - 313 => 'Unknown Aura', - 314 => 'Prevent Ressurection', - 315 => 'Underwater Walking', - 316 => 'Periodic Haste' - ); - - public $template = array(); - public $tooltip = ''; - public $buff = ''; - public $Id = 0; - - public function __construct($data) - { - if (is_array($data)) - $this->template = $data; - else - $this->template = DB::Aowow()->SelectRow("SELECT * FROM ?_spell WHERE `id` = ?", intval($data)); - - if (!$this->template) - return false; - - $this->Id = $this->template['Id']; - } + protected $setupQuery = 'SELECT * FROM ?_spell WHERE Id = ?d'; // use if you JUST need the name public static function getName($id) { - $n = DB::Aowow()->SelectRow(' - SELECT - name_loc0, - name_loc2, - name_loc3, - name_loc6, - name_loc8 - FROM - ?_spell - WHERE - id = ?d', - $id - ); + $n = DB::Aowow()->SelectRow('SELECT * FROM ?_spell WHERE id = ?d', $id ); return Util::localizedString($n, 'name'); } // end static use @@ -1138,7 +623,7 @@ class Spell { // doesn't have a buff if (!Util::localizedString($this->template, 'buff')) - return false; + return ''; $x = ''; @@ -1164,7 +649,7 @@ class Spell $this->buff = $x; - return true; + return $this->buff; } public function getTooltip() @@ -1204,7 +689,7 @@ class Spell // get description $desc = $this->parseText('description'); - $reqWrapper = $this->template['rangeMaxHostile'] && ($this->template['powerCost'] > 0 || $this->template['powerCostPercent'] > 0); + $reqWrapper = $this->template['rangeMaxHostile'] && ($this->template['powerCost'] > 0 || $this->template['powerCostPercent'] > 0); $reqWrapper2 = $reagents ||$tools || $desc; $x = ''; @@ -1346,7 +831,7 @@ class Spell $this->tooltip = $x; - return true; // todo: false if error + return $this->tooltip; } public function getTalentHead() @@ -1371,7 +856,6 @@ class Spell if ($this->template['powerCostPerLevel'] > 0) $cost .= sprintf(Lang::$spell['costPerLevel'], $this->template['powerCostPerLevel']); - // ranges $range = ''; @@ -1436,7 +920,6 @@ class Spell return $x; } - public function getListviewData() { return array( @@ -1445,29 +928,19 @@ class Spell ); } - public function getDetailedData() - { - return array( - 'id' => $this->Id, - 'name' => Util::localizedString($this->template, 'name'), - 'iconname' => $this->template['iconString'], - ); - } - public function addSelfToJScript(&$gSpells) { - // todo: if the spell creates an item use the itemIcon instead - // ... - // FU! + // if the spell creates an item use the itemIcon instead if ($this->template['effect1CreateItemId']) - $iconString = DB::Aowow()->SelectCell('SELECT icon FROM ?_icons, item_template WHERE id = displayid AND entry = ?d LIMIT 1', - $this->template['effect1CreateItemId'] - ); + { + $item = new Item($this->template['effect1CreateItemId']); + $iconString = $item->template['icon']; + } else $iconString = $this->template['iconString']; $gSpells[$this->Id] = array( - 'icon' => $iconString, // should be: $this->template['icon'], + 'icon' => $iconString, 'name' => Util::localizedString($this->template, 'name'), ); } @@ -1475,11 +948,9 @@ class Spell -class SpellList +class SpellList extends BaseTypeList { - - public $spellList = array(); - public $filter = NULL; + protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_spell WHERE [filter] [cond] GROUP BY id'; public function __construct($conditions) { @@ -1491,42 +962,7 @@ class SpellList return; } - $cnd = array(); - foreach ($conditions as $cond) - { - if ($cond[1] == 'IN' && is_array($cond[2])) - $cnd[] = Util::sqlEscape($cond[0]).' IN ('.implode(',', Util::sqlEscape($cond[2])).')'; - else - $cnd[] = Util::sqlEscape($cond[0]).' '.Util::sqlEscape($cond[1]).(is_string($cond[2]) ? ' "'.Util::sqlEscape($cond[2]).'"' : ' '.intval($cond[2])); - } - $filterQuery = $this->filter ? $this->filter->buildFilterQuery() : NULL; // todo: add strings propperly without them being escaped by simpleDB..? - $rows = DB::Aowow()->Select('SELECT * FROM ?_spell WHERE '.($filterQuery ? $filterQuery.' AND' : NULL).' '.(!empty($cnd) ? '('.implode(' AND ', $cnd).')' : '1').' - GROUP BY id' - //$this->filter->buildFilterQuery() ? $this->filter->query : DBSIMPLE_SKIP - ); - - foreach ($rows as $row) - { - $spl = new Spell($row); - $this->spellList[] = $spl; - } - } - - public function getListviewData() - { - $tmp = array(); - // no extra queries required, just call recursively - foreach ($this->spellList as $spl) - $tmp[] = $spl->getListviewData(); - - return $tmp; - } - - public function addSelfToJScript(&$gAchievements) - { - // no extra queries required, just call recursively - foreach ($this->spellList as $spl) - $spl->addSelfToJScript($gAchievements); + parent::__construct($conditions); } } diff --git a/includes/utilities.php b/includes/utilities.php index 7e84c1f4..968eee8f 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -3,6 +3,159 @@ if (!defined('AOWOW_REVISION')) die('invalid access'); +class BaseType +{ + public $template = null; + public $Id = 0; + + protected $setupQuery = ''; + + public function __construct($data) + { + if (!$this->setupQuery) + return false; + + if (is_array($data)) + $this->template = $data; + else + $this->template = DB::Aowow()->SelectRow($this->setupQuery, intVal($data)); + + if (empty($this->template)) + { + $this->template = null; + return false; + } + + $this->Id = isset($this->template['Id']) ? (int)$this->template['Id'] : (int)$this->template['entry']; + } + + // should return data required to display a listview of any kind + public function getListviewData() { } + + // should return data to extend global js variables for a certain type (e.g. g_items) + public function addSelfToJScript(&$ref) { } + + // should return data to extend global js variables for the rewards provided by this type (e.g. g_titles) + public function addRewardsToJscript(&$ref1, &$ref2 = null, &$ref3 = null) { } +} + +class BaseTypeList +{ + public $container = []; + public $filter = null; + + protected $setupQuery = ''; + + /* + * condition as array [field, value, operator] + * field: must match fieldname; 1: select everything + * value: str - operator defaults to: LIKE %% + * int - operator defaults to: = + * array - operator defaults to: IN () + * operator: modifies/overrides default + * ! - negated default value (NOT LIKE; <>; NOT IN) + * condition as str + * defines linking (AND || OR) + * + * example: + * array(['id', 45], ['name', 'test', '!'], 'OR') + * results in + * WHERE id = 45 OR name NOT LIKE %test%; + */ + public function __construct($conditions) + { + if (!$this->setupQuery) + return false; + + $sql = []; + $linking = ' AND '; + + foreach ($conditions as $c) + { + $field = ''; + $op = ''; + $val = ''; + + if (is_array($c)) + { + if ($c[0] == '1') + { + $sql[] = '1'; + continue; + } + else if ($c[0]) + { + $field = '`'.implode('`.`', explode('.', Util::sqlEscape($c[0]))).'`'; + } + else + continue; + + if (is_array($c[1])) + { + $op = (isset($c[2]) && $c[2] == '!') ? 'NOT IN' : 'IN'; + $val = '('.implode(',', Util::sqlEscape($c[1])).')'; + } + else if (is_string($c[1])) + { + $op = (isset($c[2]) && $c[2] == '!') ? 'NOT LIKE' : 'LIKE'; + $val = '"%'.Util::sqlEscape($c[1]).'%"'; + + } + else if (is_int($c[1])) + { + $op = (isset($c[2]) && $c[2] == '!') ? '<>' : '='; + $val = Util::sqlEscape($c[1]); + } + else + continue; + + if (isset($c[2]) && $c[2] != '!') + $op = $c[2]; + + $sql[] = $field.' '.$op.' '.$val; + } + else if (is_string($c)) + $linking = $c == 'OR' ? ' OR ' : ' AND '; + else + continue; // ignore other possibilities + + } + + // todo: add strings propperly without them being escaped by simpleDB..? + $this->setupQuery = str_replace('[filter]', $this->filter && $this->filter->buildFilterQuery() ? $this->filter->query.' AND ' : NULL, $this->setupQuery); + $this->setupQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->setupQuery); + + $rows = DB::Aowow()->Select($this->setupQuery); + $className = str_replace('List', '', get_class($this)); + + foreach ($rows as $k => $row) + $this->container[$k] = new $className($row); // free dirty mindfuck galore here... + } + + public function getListviewData() + { + $data = array(); + // no extra queries required, just call recursively + foreach ($this->container as $type) + $data[] = $type->getListviewData(); + + return $data; + } + + public function addSelfToJScript(&$ref) + { + // no extra queries required, just call recursively + foreach ($this->container as $type) + $type->addSelfToJScript($ref); + } + + public function addRewardsToJScript(&$ref1, &$ref2 = null, &$ref3 = null) + { + // no extra queries required, just call recursively + foreach ($this->container as $type) + $type->addRewardsToJScript($ref1, $ref2, $ref3); + } +} class Lang { @@ -20,6 +173,7 @@ class Lang public static $spell; public static $talent; public static $zone; + public static $title; public static function load($loc) { @@ -139,15 +293,18 @@ class Lang $i = 1; if (!$raceMask) - return array('side' => 3, 'name' => self::$game['ra'][3]); + return array('side' => 3, 'name' => self::$game['ra'][0]); - if ($ra = Util::factionByRaceMask($raceMask)) - return array('side' => $ra, 'name' => self::$game['ra'][-$ra]); + if ($raceMask == RACE_MASK_HORDE) + return array('side' => 2, 'name' => self::$game['ra'][-2]); - if ($raceMask & (RACE_ORC | RACE_UNDEAD | RACE_TAUREN | RACE_TROLL | RACE_BLOODELF)) + if ($raceMask == RACE_MASK_ALLIANCE) + return array('side' => 1, 'name' => self::$game['ra'][-1]); + + if ($raceMask & RACE_MASK_HORDE) $side |= 2; - if ($raceMask & (RACE_HUMAN | RACE_DWARF | RACE_NIGHTELF | RACE_GNOME | RACE_DRAENEI)) + if ($raceMask & RACE_MASK_ALLIANCE) $side |= 1; while ($raceMask) @@ -200,6 +357,21 @@ class Util ITEM_MOD_HEALTH_REGEN, ITEM_MOD_SPELL_PENETRATION, ITEM_MOD_BLOCK_VALUE ); + public static $questClasses = array( // taken from old aowow: 0,1,2,3,8,10 may point to pointless mini-areas + -2 => [ 0], + 0 => [ 1, 3, 4, 8, 10, 11, 12, 25, 28, 33, 36, 38, 40, 41, 44, 45, 46, 47, 51, 85, 130, 139, 267, 279, 1497, 1519, 1537, 2257, 3430, 3433, 3487, 4080], + 1 => [ 14, 15, 16, 17, 141, 148, 215, 331, 357, 361, 400, 405, 406, 440, 490, 493, 618, 1216, 1377, 1637, 1638, 1657, 3524, 3525, 3557], + 2 => [ 133, 206, 209, 491, 717, 718, 719, 722, 796, 978, 1196, 1337, 1417, 1581, 1583, 1584, 1941, 2017, 2057, 2100, 2366, 2367, 2437, 2557, 3477, 3562, 3713, 3714, 3715, 3716, 3717, 3789, 3790, 3791, 3792, 3845, 3846, 3847, 3849, 3905, 4095, 4100, 4120, 4196, 4228, 4264, 4272, 4375, 4415, 4494, 4723], + 3 => [ 19, 2159, 2562, 2677, 2717, 3428, 3429, 3456, 3606, 3805, 3836, 3840, 3842, 4273, 4500, 4722, 4812], + 4 => [ -372, -263, -262, -261, -162, -161, -141, -82, -81, -61], + 5 => [ -373, -371, -324, -304, -264, -201, -182, -181, -121, -101, -24], + 6 => [ -25, 2597, 3277, 3358, 3820, 4384, 4710], + 7 => [ -368, -367, -365, -344, -241, -1], + 8 => [ 3483, 3518, 3519, 3520, 3521, 3522, 3523, 3679, 3703], + 9 => [-1008, -1007, -1006, -1005, -1004, -1003, -1002, -1001, -375, -374, -370, -369, -366, -364, -284, -41, -22], + 10 => [ 65, 66, 67, 210, 394, 495, 3537, 3711, 4024, 4197, 4395] + ); + public static $sockets = array( // jsStyle Strings 'meta', 'red', 'yellow', 'blue' ); @@ -227,6 +399,501 @@ class Util public static $changeLevelString = '%s'; + public static $filterResultString = 'sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'\', \'\')'; + + + public static $expansionString = array( // 3 & 4 unused .. obviously + null, 'bc', 'wotlk', 'cata', 'mop' + ); + + public static $spellEffectStrings = array( + 0 => 'None', + 1 => 'Instakill', + 2 => 'School Damage', + 3 => 'Dummy', + 4 => 'Portal Teleport', + 5 => 'Teleport Units', + 6 => 'Apply Aura', + 7 => 'Environmental Damage', + 8 => 'Power Drain', + 9 => 'Health Leech', + 10 => 'Heal', + 11 => 'Bind', + 12 => 'Portal', + 13 => 'Ritual Base', + 14 => 'Ritual Specialize', + 15 => 'Ritual Activate Portal', + 16 => 'Quest Complete', + 17 => 'Weapon Damage NoSchool', + 18 => 'Resurrect', + 19 => 'Add Extra Attacks', + 20 => 'Dodge', + 21 => 'Evade', + 22 => 'Parry', + 23 => 'Block', + 24 => 'Create Item', + 25 => 'Weapon', + 26 => 'Defense', + 27 => 'Persistent Area Aura', + 28 => 'Summon', + 29 => 'Leap', + 30 => 'Energize', + 31 => 'Weapon Percent Damage', + 32 => 'Trigger Missile', + 33 => 'Open Lock', + 34 => 'Summon Change Item', + 35 => 'Apply Area Aura Party', + 36 => 'Learn Spell', + 37 => 'Spell Defense', + 38 => 'Dispel', + 39 => 'Language', + 40 => 'Dual Wield', + 41 => 'Jump', + 42 => 'Jump Dest', + 43 => 'Teleport Units Face Caster', + 44 => 'Skill Step', + 45 => 'Add Honor', + 46 => 'Spawn', + 47 => 'Trade Skill', + 48 => 'Stealth', + 49 => 'Detect', + 50 => 'Trans Door', + 51 => 'Force Critical Hit', + 52 => 'Guarantee Hit', + 53 => 'Enchant Item Permanent', + 54 => 'Enchant Item Temporary', + 55 => 'Tame Creature', + 56 => 'Summon Pet', + 57 => 'Learn Pet Spell', + 58 => 'Weapon Damage', + 59 => 'Create Random Item', + 60 => 'Proficiency', + 61 => 'Send Event', + 62 => 'Power Burn', + 63 => 'Threat', + 64 => 'Trigger Spell', + 65 => 'Apply Area Aura Raid', + 66 => 'Create Mana Gem', + 67 => 'Heal Max Health', + 68 => 'Interrupt Cast', + 69 => 'Distract', + 70 => 'Pull', + 71 => 'Pickpocket', + 72 => 'Add Farsight', + 73 => 'Untrain Talents', + 74 => 'Apply Glyph', + 75 => 'Heal Mechanical', + 76 => 'Summon Object Wild', + 77 => 'Script Effect', + 78 => 'Attack', + 79 => 'Sanctuary', + 80 => 'Add Combo Points', + 81 => 'Create House', + 82 => 'Bind Sight', + 83 => 'Duel', + 84 => 'Stuck', + 85 => 'Summon Player', + 86 => 'Activate Object', + 87 => 'WMO Damage', + 88 => 'WMO Repair', + 89 => 'WMO Change', + 90 => 'Kill Credit', + 91 => 'Threat All', + 92 => 'Enchant Held Item', + 93 => 'Force Deselect', + 94 => 'Self Resurrect', + 95 => 'Skinning', + 96 => 'Charge', + 97 => 'Cast Button', + 98 => 'Knock Back', + 99 => 'Disenchant', + 100 => 'Inebriate', + 101 => 'Feed Pet', + 102 => 'Dismiss Pet', + 103 => 'Reputation', + 104 => 'Summon Object Slot1', + 105 => 'Summon Object Slot2', + 106 => 'Summon Object Slot3', + 107 => 'Summon Object Slot4', + 108 => 'Dispel Mechanic', + 109 => 'Summon Dead Pet', + 110 => 'Destroy All Totems', + 111 => 'Durability Damage', + 112 => 'Summon Demon', + 113 => 'Resurrect New', + 114 => 'Attack Me', + 115 => 'Durability Damage Percent', + 116 => 'Skin Player Corpse', + 117 => 'Spirit Heal', + 118 => 'Skill', + 119 => 'Apply Area Aura Pet', + 120 => 'Teleport Graveyard', + 121 => 'Normalized Weapon Dmg', + 122 => 'Unknown Effect', + 123 => 'Send Taxi', + 124 => 'Pull Towards', + 125 => 'Modify Threat Percent', + 126 => 'Steal Beneficial Buff', + 127 => 'Prospecting', + 128 => 'Apply Area Aura Friend', + 129 => 'Apply Area Aura Enemy', + 130 => 'Redirect Threat', + 131 => 'Unknown Effect', + 132 => 'Play Music', + 133 => 'Unlearn Specialization', + 134 => 'Kill Credit2', + 135 => 'Call Pet', + 136 => 'Heal Percent', + 137 => 'Energize Percent', + 138 => 'Leap Back', + 139 => 'Clear Quest', + 140 => 'Force Cast', + 141 => 'Force Cast With Value', + 142 => 'Trigger Spell With Value', + 143 => 'Apply Area Aura Owner', + 144 => 'Knock Back Dest', + 145 => 'Pull Towards Dest', + 146 => 'Activate Rune', + 147 => 'Quest Fail', + 148 => 'Unknown Effect', + 149 => 'Charge Dest', + 150 => 'Quest Start', + 151 => 'Trigger Spell 2', + 152 => 'Unknown Effect', + 153 => 'Create Tamed Pet', + 154 => 'Discover Taxi', + 155 => 'Titan Grip', + 156 => 'Enchant Item Prismatic', + 157 => 'Create Item 2', + 158 => 'Milling', + 159 => 'Allow Rename Pet', + 160 => 'Unknown Effect', + 161 => 'Talent Spec Count', + 162 => 'Talent Spec Select', + 163 => 'Unknown Effect', + 164 => 'Remove Aura' + ); + + public static $spellAuraStrings = array( + 0 => 'None', + 1 => 'Bind Sight', + 2 => 'Mod Possess', + 3 => 'Periodic Damage', + 4 => 'Dummy', + 5 => 'Mod Confuse', + 6 => 'Mod Charm', + 7 => 'Mod Fear', + 8 => 'Periodic Heal', + 9 => 'Mod Attack Speed', + 10 => 'Mod Threat', + 11 => 'Taunt', + 12 => 'Stun', + 13 => 'Mod Damage Done', + 14 => 'Mod Damage Taken', + 15 => 'Damage Shield', + 16 => 'Mod Stealth', + 17 => 'Mod Stealth Detection', + 18 => 'Mod Invisibility', + 19 => 'Mod Invisibility Detection', + 20 => 'Obsolete Mod Health', + 21 => 'Obsolete Mod Power', + 22 => 'Mod Resistance', + 23 => 'Periodic Trigger Spell', + 24 => 'Periodic Energize', + 25 => 'Pacify', + 26 => 'Root', + 27 => 'Silence', + 28 => 'Reflect Spells', + 29 => 'Mod Stat', + 30 => 'Mod Skill', + 31 => 'Mod Increase Speed', + 32 => 'Mod Increase Mounted Speed', + 33 => 'Mod Decrease Speed', + 34 => 'Mod Increase Health', + 35 => 'Mod Increase Energy', + 36 => 'Shapeshift', + 37 => 'Effect Immunity', + 38 => 'State Immunity', + 39 => 'School Immunity', + 40 => 'Damage Immunity', + 41 => 'Dispel Immunity', + 42 => 'Proc Trigger Spell', + 43 => 'Proc Trigger Damage', + 44 => 'Track Creatures', + 45 => 'Track Resources', + 46 => 'Mod Parry Skill', + 47 => 'Mod Parry Percent', + 48 => 'Mod Dodge Skill', + 49 => 'Mod Dodge Percent', + 50 => 'Mod Critical Healing Amount', + 51 => 'Mod Block Percent', + 52 => 'Mod Weapon Crit Percent', + 53 => 'Periodic Leech', + 54 => 'Mod Hit Chance', + 55 => 'Mod Spell Hit Chance', + 56 => 'Transform', + 57 => 'Mod Spell Crit Chance', + 58 => 'Mod Increase Swim Speed', + 59 => 'Mod Damage Done Creature', + 60 => 'Pacify Silence', + 61 => 'Mod Scale', + 62 => 'Periodic Health Funnel', + 63 => 'Periodic Mana Funnel', + 64 => 'Periodic Mana Leech', + 65 => 'Mod Casting Speed (not stacking)', + 66 => 'Feign Death', + 67 => 'Disarm', + 68 => 'Stalked', + 69 => 'School Absorb', + 70 => 'Extra Attacks', + 71 => 'Mod Spell Crit Chance School', + 72 => 'Mod Power Cost School Percent', + 73 => 'Mod Power Cost School', + 74 => 'Reflect Spells School', + 75 => 'Language', + 76 => 'Far Sight', + 77 => 'Mechanic Immunity', + 78 => 'Mounted', + 79 => 'Mod Damage Percent Done', + 80 => 'Mod Percent Stat', + 81 => 'Split Damage Percent', + 82 => 'Water Breathing', + 83 => 'Mod Base Resistance', + 84 => 'Mod Health Regeneration', + 85 => 'Mod Power Regeneration', + 86 => 'Channel Death Item', + 87 => 'Mod Damage Percent Taken', + 88 => 'Mod Health Regeneration Percent', + 89 => 'Periodic Damage Percent', + 90 => 'Mod Resist Chance', + 91 => 'Mod Detect Range', + 92 => 'Prevent Fleeing', + 93 => 'Unattackable', + 94 => 'Interrupt Regeneration', + 95 => 'Ghost', + 96 => 'Spell Magnet', + 97 => 'Mana Shield', + 98 => 'Mod Skill Talent', + 99 => 'Mod Attack Power', + 100 => 'Auras Visible', + 101 => 'Mod Resistance Percent', + 102 => 'Mod Melee Attack Power Versus', + 103 => 'Mod Total Threat', + 104 => 'Water Walk', + 105 => 'Feather Fall', + 106 => 'Hover', + 107 => 'Add Flat Modifier', + 108 => 'Add Percent Modifier', + 109 => 'Add Target Trigger', + 110 => 'Mod Power Regeneration Percent', + 111 => 'Add Caster Hit Trigger', + 112 => 'Override Class Scripts', + 113 => 'Mod Ranged Damage Taken', + 114 => 'Mod Ranged Damage Taken Percent', + 115 => 'Mod Healing', + 116 => 'Mod Regeneration During Combat', + 117 => 'Mod Mechanic Resistance', + 118 => 'Mod Healing Percent', + 119 => 'Share Pet Tracking', + 120 => 'Untrackable', + 121 => 'Empathy', + 122 => 'Mod Offhand Damage Percent', + 123 => 'Mod Target Resistance', + 124 => 'Mod Ranged Attack Power', + 125 => 'Mod Melee Damage Taken', + 126 => 'Mod Melee Damage Taken Percent', + 127 => 'Ranged Attack Power Attacker Bonus', + 128 => 'Possess Pet', + 129 => 'Mod Speed Always', + 130 => 'Mod Mounted Speed Always', + 131 => 'Mod Ranged Attack Power Versus', + 132 => 'Mod Increase Energy Percent', + 133 => 'Mod Increase Health Percent', + 134 => 'Mod Mana Regeneration Interrupt', + 135 => 'Mod Healing Done', + 136 => 'Mod Healing Done Percent', + 137 => 'Mod Total Stat Percentage', + 138 => 'Mod Melee Haste', + 139 => 'Force Reaction', + 140 => 'Mod Ranged Haste', + 141 => 'Mod Ranged Ammo Haste', + 142 => 'Mod Base Resistance Percent', + 143 => 'Mod Resistance Exclusive', + 144 => 'Safe Fall', + 145 => 'Mod Pet Talent Points', + 146 => 'Allow Tame Pet Type', + 147 => 'Mechanic Immunity Mask', + 148 => 'Retain Combo Points', + 149 => 'Reduce Pushback', + 150 => 'Mod Shield Blockvalue Percent', + 151 => 'Track Stealthed', + 152 => 'Mod Detected Range', + 153 => 'Split Damage Flat', + 154 => 'Mod Stealth Level', + 155 => 'Mod Water Breathing', + 156 => 'Mod Reputation Gain', + 157 => 'Pet Damage Multi', + 158 => 'Mod Shield Blockvalue', + 159 => 'No PvP Credit', + 160 => 'Mod AoE Avoidance', + 161 => 'Mod Health Regeneration In Combat', + 162 => 'Power Burn Mana', + 163 => 'Mod Crit Damage Bonus', + 164 => 'Unknown Aura', + 165 => 'Melee Attack Power Attacker Bonus', + 166 => 'Mod Attack Power Percent', + 167 => 'Mod Ranged Attack Power Percent', + 168 => 'Mod Damage Done Versus', + 169 => 'Mod Crit Percent Versus', + 170 => 'Detect Amore', + 171 => 'Mod Speed (not stacking)', + 172 => 'Mod Mounted Speed (not stacking)', + 173 => 'Unknown Aura', + 174 => 'Mod Spell Damage Of Stat Percent', + 175 => 'Mod Spell Healing Of Stat Percent', + 176 => 'Spirit Of Redemption', + 177 => 'AoE Charm', + 178 => 'Mod Debuff Resistance', + 179 => 'Mod Attacker Spell Crit Chance', + 180 => 'Mod Flat Spell Damage Versus', + 181 => 'Unknown Aura', + 182 => 'Mod Resistance Of Stat Percent', + 183 => 'Mod Critical Threat', + 184 => 'Mod Attacker Melee Hit Chance', + 185 => 'Mod Attacker Ranged Hit Chance', + 186 => 'Mod Attacker Spell Hit Chance', + 187 => 'Mod Attacker Melee Crit Chance', + 188 => 'Mod Attacker Ranged Crit Chance', + 189 => 'Mod Rating', + 190 => 'Mod Faction Reputation Gain', + 191 => 'Use Normal Movement Speed', + 192 => 'Mod Melee Ranged Haste', + 193 => 'Melee Slow', + 194 => 'Mod Target Absorb School', + 195 => 'Mod Target Ability Absorb School', + 196 => 'Mod Cooldown', + 197 => 'Mod Attacker Spell And Weapon Crit Chance', + 198 => 'Unknown Aura', + 199 => 'Mod Increases Spell Percent to Hit', + 200 => 'Mod XP Percent', + 201 => 'Fly', + 202 => 'Ignore Combat Result', + 203 => 'Mod Attacker Melee Crit Damage', + 204 => 'Mod Attacker Ranged Crit Damage', + 205 => 'Mod School Crit Dmg Taken', + 206 => 'Mod Increase Vehicle Flight Speed', + 207 => 'Mod Increase Mounted Flight Speed', + 208 => 'Mod Increase Flight Speed', + 209 => 'Mod Mounted Flight Speed Always', + 210 => 'Mod Vehicle Speed Always', + 211 => 'Mod Flight Speed (not stacking)', + 212 => 'Mod Ranged Attack Power Of Stat Percent', + 213 => 'Mod Rage from Damage Dealt', + 214 => 'Unknown Aura', + 215 => 'Arena Preparation', + 216 => 'Haste Spells', + 217 => 'Unknown Aura', + 218 => 'Haste Ranged', + 219 => 'Mod Mana Regeneration from Stat', + 220 => 'Mod Rating from Stat', + 221 => 'Detaunt', + 222 => 'Unknown Aura', + 223 => 'Raid Proc from Charge', + 224 => 'Unknown Aura', + 225 => 'Raid Proc from Charge With Value', + 226 => 'Periodic Dummy', + 227 => 'Periodic Trigger Spell With Value', + 228 => 'Detect Stealth', + 229 => 'Mod AoE Damage Avoidance', + 230 => 'Unknown Aura', + 231 => 'Proc Trigger Spell With Value', + 232 => 'Mechanic Duration Mod', + 233 => 'Unknown Aura', + 234 => 'Mechanic Duration Mod (not stacking)', + 235 => 'Mod Dispel Resist', + 236 => 'Control Vehicle', + 237 => 'Mod Spell Damage Of Attack Power', + 238 => 'Mod Spell Healing Of Attack Power', + 239 => 'Mod Scale 2', + 240 => 'Mod Expertise', + 241 => 'Force Move Forward', + 242 => 'Mod Spell Damage from Healing', + 243 => 'Mod Faction', + 244 => 'Comprehend Language', + 245 => 'Mod Aura Duration By Dispel', + 246 => 'Mod Aura Duration By Dispel (not stacking)', + 247 => 'Clone Caster', + 248 => 'Mod Combat Result Chance', + 249 => 'Convert Rune', + 250 => 'Mod Increase Health 2', + 251 => 'Mod Enemy Dodge', + 252 => 'Mod Speed Slow All', + 253 => 'Mod Block Crit Chance', + 254 => 'Mod Disarm Offhand', + 255 => 'Mod Mechanic Damage Taken Percent', + 256 => 'No Reagent Use', + 257 => 'Mod Target Resist By Spell Class', + 258 => 'Unknown Aura', + 259 => 'Mod HoT Percent', + 260 => 'Screen Effect', + 261 => 'Phase', + 262 => 'Ability Ignore Aurastate', + 263 => 'Allow Only Ability', + 264 => 'Unknown Aura', + 265 => 'Unknown Aura', + 266 => 'Unknown Aura', + 267 => 'Mod Immune Aura Apply School', + 268 => 'Mod Attack Power Of Stat Percent', + 269 => 'Mod Ignore Target Resist', + 270 => 'Mod Ability Ignore Target Resist', + 271 => 'Mod Damage from Caster', + 272 => 'Ignore Melee Reset', + 273 => 'X Ray', + 274 => 'Ability Consume No Ammo', + 275 => 'Mod Ignore Shapeshift', + 276 => 'Unknown Aura', + 277 => 'Mod Max Affected Targets', + 278 => 'Mod Disarm Ranged', + 279 => 'Initialize Images', + 280 => 'Mod Armor Penetration Percent', + 281 => 'Mod Honor Gain Percent', + 282 => 'Mod Base Health Percent', + 283 => 'Mod Healing Received', + 284 => 'Linked', + 285 => 'Mod Attack Power Of Armor', + 286 => 'Ability Periodic Crit', + 287 => 'Deflect Spells', + 288 => 'Ignore Hit Direction', + 289 => 'Unknown Aura', + 290 => 'Mod Crit Percent', + 291 => 'Mod XP Quest Percent', + 292 => 'Open Stable', + 293 => 'Override Spells', + 294 => 'Prevent Power Regeneration', + 295 => 'Unknown Aura', + 296 => 'Set Vehicle Id', + 297 => 'Block Spell Family', + 298 => 'Strangulate', + 299 => 'Unknown Aura', + 300 => 'Share Damage Percent', + 301 => 'School Heal Absorb', + 302 => 'Unknown Aura', + 303 => 'Mod Damage Done Versus Aurastate', + 304 => 'Mod Fake Inebriate', + 305 => 'Mod Minimum Speed', + 306 => 'Unknown Aura', + 307 => 'Heal Absorb Test', + 308 => 'Unknown Aura', + 309 => 'Unknown Aura', + 310 => 'Mod Creature AoE Damage Avoidance', + 311 => 'Unknown Aura', + 312 => 'Unknown Aura', + 313 => 'Unknown Aura', + 314 => 'Prevent Ressurection', + 315 => 'Underwater Walking', + 316 => 'Periodic Haste' + ); + public static $bgImagePath = array ( 'tiny' => 'style="background-image: url(/images/icons/tiny/%s.gif)"', 'small' => 'style="background-image: url(/images/icons/small/%s.jpg)"', @@ -244,6 +911,9 @@ class Util return; } + if (!self::$execTime) + return; + $newTime = microTime(true); $tDiff = $newTime - self::$execTime; self::$execTime = $newTime; @@ -352,16 +1022,18 @@ class Util return implode(' ', $fmt); } - public static function factionByRaceMask($race) + public static function sideByRaceMask($race) { - switch ($race) - { - case '0': return 3; // Any - case '1791': return 3; // Any - case '690': return 2; // Horde - case '1101': return 1; // Alliance - default: return 0; - } + if (!$race || $race == RACE_MASK_ALL) // Any + return 3; + + if ($race & RACE_MASK_HORDE) // Horde + return 2; + + if ($race & RACE_MASK_ALLIANCE) // Alliance + return 1; + + return 0; } private static function db_conform_array_callback(&$item, $key) diff --git a/pages/compare.php b/pages/compare.php index 2868df5d..98a20177 100644 --- a/pages/compare.php +++ b/pages/compare.php @@ -49,8 +49,8 @@ if ($compareString) } $doneSummary = implode(',', $outSet); - $iList = new ItemList(array(array('i.entry', 'IN', $items))); - foreach ($iList->itemList as $item) + $iList = new ItemList(array(['i.entry', $items])); + foreach ($iList->container as $item) { $item->getJsonStats(); $stats = array(); diff --git a/pages/item.php b/pages/item.php index 1c38e7d1..82f9ef95 100644 --- a/pages/item.php +++ b/pages/item.php @@ -17,7 +17,7 @@ require_once('includes/class.faction.php'); $id = intVal($pageParam); $item = new Item($id); -$cacheKeyPage = implode(':', [TYPEID_ITEM, CACHETYPE_PAGE, $id, -1, User::$localeId]); +$cacheKeyPage = implode(':', [CACHETYPE_PAGE, TYPEID_ITEM, $id, -1, User::$localeId]); if (isset($_GET['xml'])) { @@ -54,7 +54,7 @@ else if (isset($_GET['power'])) $itemString .= 's'; } - $cacheKeyTooltip = implode(':', [TYPEID_ITEM, CACHETYPE_TOOLTIP, $itemString, -1, User::$localeId]); + $cacheKeyTooltip = implode(':', [CACHETYPE_TOOLTIP, TYPEID_ITEM, $itemString, -1, User::$localeId]); // output json for tooltips if (!$smarty->loadCache($cacheKeyTooltip, $x)) diff --git a/pages/spell.php b/pages/spell.php index 04cca918..64f9322b 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -14,8 +14,8 @@ require_once('includes/class.item.php'); $id = intVal($pageParam); $spell = new Spell($id); -$cacheKeyPage = implode(':', [TYPEID_SPELL, CACHETYPE_PAGE, $id, -1, User::$localeId]); -$cacheKeyTooltip = implode(':', [TYPEID_SPELL, CACHETYPE_TOOLTIP, $id, -1, User::$localeId]); +$cacheKeyPage = implode(':', [CACHETYPE_PAGE, TYPEID_SPELL, $id, -1, User::$localeId]); +$cacheKeyTooltip = implode(':', [CACHETYPE_TOOLTIP, TYPEID_SPELL, $id, -1, User::$localeId]); if (isset($_GET['power'])) { @@ -156,7 +156,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if($row['effect'.$j.'Id'] > 0) { // Название эффекта - $spell['effect'][$i]['name'] = '('.$row['effect'.$j.'Id'].') '.$spellObj->effectNames[$row['effect'.$j.'Id']]; + $spell['effect'][$i]['name'] = '('.$row['effect'.$j.'Id'].') '.Util::$spellEffectStrings[$row['effect'.$j.'Id']]; // Доп информация в имени if($row['effect'.$j.'MiscValue']) { diff --git a/setup/tools/dataset-assembler/enchants.php b/setup/tools/dataset-assembler/enchants.php index 6cfdfd16..c74f1f05 100644 --- a/setup/tools/dataset-assembler/enchants.php +++ b/setup/tools/dataset-assembler/enchants.php @@ -147,7 +147,7 @@ if (!defined('AOWOW_REVISION')) if (!isset($castItems[$spl->Id])) $castItems[$spl->Id] = new ItemList([['spellid_1', '=', $spl->Id], ['name', 'NOT LIKE', 'Scroll of Enchant%']]); // do not reuse enchantment scrolls - foreach ($castItems[$spl->Id]->itemList as $item) + foreach ($castItems[$spl->Id]->container as $item) { $ench['name'][] = Util::jsEscape(Util::localizedString($item->template, 'name')); $ench['source'][] = -$item->Id;