source: aowow/includes/allspells.php

Last change on this file was 170, checked in by maron, 15 years ago
  • Property svn:executable set to *
File size: 27.5 KB
Line 
1<?php
2
3require_once 'includes/allitems.php';
4
5// Названия аур
6$spell_aura_names = array(
7 0 => 'None',
8 1 => 'Bind Sight',
9 2 => 'Mod Possess',
10 3 => 'Periodic Damage',
11 4 => 'Dummy',
12 5 => 'Mod Confuse',
13 6 => 'Mod Charm',
14 7 => 'Mod Fear',
15 8 => 'Periodic Heal',
16 9 => 'Mod Attack Speed',
17 10 => 'Mod Threat',
18 11 => 'Taunt',
19 12 => 'Stun',
20 13 => 'Mod Damage Done',
21 14 => 'Mod Damage Taken',
22 15 => 'Damage Shield',
23 16 => 'Mod Stealth',
24 17 => 'Mod Detect',
25 18 => 'Mod Invisibility',
26 19 => 'Mod Invisibility Detection',
27 20 => 'OBS Mod Intellect',
28 21 => 'OBS Mod Spirit',
29 22 => 'Mod Resistance',
30 23 => 'Periodic Trigger',
31 24 => 'Periodic Energize',
32 25 => 'Pacify',
33 26 => 'Root',
34 27 => 'Silence',
35 28 => 'Reflect Spells %',
36 29 => 'Mod Stat',
37 30 => 'Mod Skill',
38 31 => 'Mod Speed',
39 32 => 'Mod Speed Mounted',
40 33 => 'Mod Speed Slow',
41 34 => 'Mod Increase Health',
42 35 => 'Mod Increase Energy',
43 36 => 'Shapeshift',
44 37 => 'Immune Effect',
45 38 => 'Immune State',
46 39 => 'Immune School',
47 40 => 'Immune Damage',
48 41 => 'Immune Dispel Type',
49 42 => 'Proc Trigger Spell',
50 43 => 'Proc Trigger Damage',
51 44 => 'Track Creatures',
52 45 => 'Track Resources',
53 46 => 'Mod Parry Skill',
54 47 => 'Mod Parry Percent',
55 48 => 'Mod Dodge Skill',
56 49 => 'Mod Dodge Percent',
57 50 => 'Mod Block Skill',
58 51 => 'Mod Block Percent',
59 52 => 'Mod Crit Percent',
60 53 => 'Periodic Leech',
61 54 => 'Mod Hit Chance',
62 55 => 'Mod Spell Hit Chance',
63 56 => 'Transform',
64 57 => 'Mod Spell Crit Chance',
65 58 => 'Mod Speed Swim',
66 59 => 'Mod Creature Dmg Done',
67 60 => 'Pacify & Silence',
68 61 => 'Mod Scale',
69 62 => 'Periodic Health Funnel',
70 63 => 'Periodic Mana Funnel',
71 64 => 'Periodic Mana Leech',
72 65 => 'Haste - Spells',
73 66 => 'Feign Death',
74 67 => 'Disarm',
75 68 => 'Mod Stalked',
76 69 => 'School Absorb',
77 70 => 'Extra Attacks',
78 71 => 'Mod School Spell Crit Chance',
79 72 => 'Mod Power Cost',
80 73 => 'Mod School Power Cost',
81 74 => 'Reflect School Spells %',
82 75 => 'Mod Language',
83 76 => 'Far Sight',
84 77 => 'Immune Mechanic',
85 78 => 'Mounted',
86 79 => 'Mod Dmg %',
87 80 => 'Mod Stat %',
88 81 => 'Split Damage',
89 82 => 'Water Breathing',
90 83 => 'Mod Base Resistance',
91 84 => 'Mod Health Regen',
92 85 => 'Mod Power Regen',
93 86 => 'Create Death Item',
94 87 => 'Mod Dmg % Taken',
95 88 => 'Mod Health Regen Percent',
96 89 => 'Periodic Damage Percent',
97 90 => 'Mod Resist Chance',
98 91 => 'Mod Detect Range',
99 92 => 'Prevent Fleeing',
100 93 => 'Mod Uninteractible',
101 94 => 'Interrupt Regen',
102 95 => 'Ghost',
103 96 => 'Spell Magnet',
104 97 => 'Mana Shield',
105 98 => 'Mod Skill Talent',
106 99 => 'Mod Attack Power',
107 100 => 'Auras Visible',
108 101 => 'Mod Resistance %',
109 102 => 'Mod Creature Attack Power',
110 103 => 'Mod Total Threat (Fade)',
111 104 => 'Water Walk',
112 105 => 'Feather Fall',
113 106 => 'Hover',
114 107 => 'Add Flat Modifier',
115 108 => 'Add % Modifier',
116 109 => 'Add Class Target Trigger',
117 110 => 'Mod Power Regen %',
118 111 => 'Add Class Caster Hit Trigger',
119 112 => 'Override Class Scripts',
120 113 => 'Mod Ranged Dmg Taken',
121 114 => 'Mod Ranged % Dmg Taken',
122 115 => 'Mod Healing',
123 116 => 'Regen During Combat',
124 117 => 'Mod Mechanic Resistance',
125 118 => 'Mod Healing %',
126 119 => 'Share Pet Tracking',
127 120 => 'Untrackable',
128 121 => 'Empathy (Lore, whatever)',
129 122 => 'Mod Offhand Dmg %',
130 123 => 'Mod Power Cost %',
131 124 => 'Mod Ranged Attack Power',
132 125 => 'Mod Melee Dmg Taken',
133 126 => 'Mod Melee % Dmg Taken',
134 127 => 'Rngd Atk Pwr Attckr Bonus',
135 128 => 'Mod Possess Pet',
136 129 => 'Mod Speed Always',
137 130 => 'Mod Mounted Speed Always',
138 131 => 'Mod Creature Ranged Attack Power',
139 132 => 'Mod Increase Energy %',
140 133 => 'Mod Max Health %',
141 134 => 'Mod Interrupted Mana Regen',
142 135 => 'Mod Healing Done',
143 136 => 'Mod Healing Done %',
144 137 => 'Mod Total Stat %',
145 138 => 'Haste - Melee',
146 139 => 'Force Reaction',
147 140 => 'Haste - Ranged',
148 141 => 'Haste - Ranged (Ammo Only)',
149 142 => 'Mod Base Resistance %',
150 143 => 'Mod Resistance Exclusive',
151 144 => 'Safe Fall',
152 145 => 'Charisma',
153 146 => 'Persuaded',
154 147 => 'Add Creature Immunity',
155 148 => 'Retain Combo Points',
156 186 => 'Mod Attacker Spell Hit Chance',
157 199 => 'Mod Spell Hit Chance'
158);
159
160// Названия эффектов спеллов
161$spell_effect_names = array(
162 0 => 'None',
163 1 => 'Instakill',
164 2 => 'School Damage',
165 3 => 'Dummy',
166 4 => 'Portal Teleport',
167 5 => 'Teleport Units',
168 6 => 'Apply Aura',
169 7 => 'Environmental Damage',
170 8 => 'Power Drain',
171 9 => 'Health Leech',
172 10 => 'Heal',
173 11 => 'Bind',
174 12 => 'Portal',
175 13 => 'Ritual Base',
176 14 => 'Ritual Specialize',
177 15 => 'Ritual Activate Portal',
178 16 => 'Quest Complete',
179 17 => 'Weapon Damage + (noschool)',
180 18 => 'Resurrect',
181 19 => 'Extra Attacks',
182 20 => 'Dodge',
183 21 => 'Evade',
184 22 => 'Parry',
185 23 => 'Block',
186 24 => 'Create Item',
187 25 => 'Weapon',
188 26 => 'Defense',
189 27 =>'Persistent Area Aura',
190 28 => 'Summon',
191 29 => 'Leap',
192 30 => 'Energize',
193 31 => 'Weapon % Dmg',
194 32 => 'Trigger Missile',
195 33 => 'Open Lock',
196 34 => 'Transform Item',
197 35 => 'Apply Area Aura',
198 36 => 'Learn Spell',
199 37 => 'Spell Defense',
200 38 => 'Dispel',
201 39 => 'Language',
202 40 => 'Dual Wield',
203 41 => 'Summon Wild',
204 42 => 'Summon Guardian',
205 43 => 'Summon Enemy Player',
206 44 => 'Skill Step',
207 45 => 'Add Honor',
208 46 => 'Spawn',
209 47 => 'Spell Cast UI',
210 48 => 'Stealth',
211 49 => 'Detect',
212 50 => 'Summon Object',
213 51 => 'Force Critical Hit',
214 52 => 'Guarantee Hit',
215 53 => 'Enchant Item Permanent',
216 54 => 'Enchant Item Temporary',
217 55 => 'Tame Creature',
218 56 => 'Summon Pet',
219 57 => 'Learn Pet Spell',
220 58 => 'Weapon Damage +',
221 59 => 'Open Lock (Item)',
222 60 => 'Proficiency',
223 61 => 'Send Event',
224 62 => 'Power Burn',
225 63 => 'Threat',
226 64 => 'Trigger Spell',
227 65 => 'Health Funnel',
228 66 => 'Power Funnel',
229 67 => 'Heal Max Health',
230 68 => 'Interrupt Cast',
231 69 => 'Distract',
232 70 => 'Pull',
233 71 => 'Pickpocket',
234 72 => 'Add Farsight',
235 73 => 'Summon Possessed',
236 74 => 'Summon Totem',
237 75 => 'Heal Mechanical',
238 76 => 'Summon Object (Wild)',
239 77 => 'Script Effect',
240 78 => 'Attack',
241 79 => 'Sanctuary',
242 80 => 'Add Combo Points',
243 81 => 'Create House',
244 82 => 'Bind Sight',
245 83 => 'Duel',
246 84 => 'Stuck',
247 85 => 'Summon Player',
248 86 => 'Activate Object',
249 87 => 'Summon Totem (slot 1)',
250 88 => 'Summon Totem (slot 2)',
251 89 => 'Summon Totem (slot 3)',
252 90 => 'Summon Totem (slot 4)',
253 91 => 'Threat (All)',
254 92 => 'Enchant Held Item',
255 93 => 'Summon Phantasm',
256 94 => 'Self Resurrect',
257 95 => 'Skinning',
258 96 => 'Charge',
259 97 => 'Summon Critter',
260 98 => 'Knock Back',
261 99 => 'Disenchant',
262 100 => 'Inebriate',
263 101 => 'Feed Pet',
264 102 => 'Dismiss Pet',
265 103 => 'Reputation',
266 104 => 'Summon Object (slot 1)',
267 105 => 'Summon Object (slot 2)',
268 106 => 'Summon Object (slot 3)',
269 107 => 'Summon Object (slot 4)',
270 108 => 'Dispel Mechanic',
271 109 => 'Summon Dead Pet',
272 110 => 'Destroy All Totems',
273 111 => 'Durability Damage',
274 112 => 'Summon Demon',
275 113 => 'Resurrect (Flat)',
276 114 => 'Taunt',
277 115 => 'Durability Damage',
278 116 => 'Remove Insignia',
279 117 => 'Spirit Heal',
280 118 => 'Require Skill',
281 119 => 'Apply Pet Aura',
282 120 => 'Graveyard Teleport',
283 121 => 'Normalized Weapon Damage +',
284
285 123 => 'Scripted Event',
286 124 => 'Player Pull',
287 125 => 'Reduce Threat (%)',
288 126 => 'Steal Beneficial Buff (Magic)',
289 127 => 'Require Ore',
290 128 => 'Apply Stat Aura',
291 129 => 'Apply Stat Aura (%)',
292 130 => 'Unknown130',
293 131 => 'Unknown131',
294
295 133 => 'Unlearn Profession Specialization',
296 134 => 'Unknown134',
297 135 => 'Unknown135',
298 136 => 'Unknown136',
299 137 => 'Unknown137',
300 138 => 'Unknown138',
301
302 140 => 'Unknown140',
303 141 => 'Unknown141',
304 142 => 'Unknown142',
305 143 => 'Unknown143',
306
307 149 => 'Unknown149',
308);
309
310$spell_cols[0] = array('spellID', 'iconname', 'effect1itemtype', 'effect1Aura');
311$spell_cols[1] = array('spellID', 'iconname', 'durationID', 'tooltip', 'spellname', 'rank', 'rangeID', 'manacost', 'manacostpercent', 'spellcasttimesID', 'cooldown', 'tool1', 'tool2', 'reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8', 'effect1BasePoints', 'effect2BasePoints', 'effect3BasePoints', 'effect1Amplitude', 'effect2Amplitude', 'effect3Amplitude', 'effect1DieSides', 'effect2DieSides', 'effect3DieSides', 'effect1ChainTarget', 'effect2ChainTarget', 'effect3ChainTarget', 'reagentcount1', 'reagentcount2', 'reagentcount3', 'reagentcount4', 'reagentcount5', 'reagentcount6', 'reagentcount7', 'reagentcount8', 'effect1radius', 'effect2radius', 'effect3radius', 'effect1MiscValue', 'effect2MiscValue', 'effect3MiscValue', 'ChannelInterruptFlags', 'procChance', 'procCharges', 'effect_1_proc_chance', 'effect_2_proc_chance', 'effect_3_proc_chance', 'effect1itemtype', 'effect1Aura', 'spellTargets', 'dmg_multiplier1');
312$spell_cols[2] = array('spellname', 'rank', 'levelspell', 'resistancesID', 'effect1itemtype', 'effect2itemtype', 'effect3itemtype', 'effect1BasePoints', 'effect2BasePoints', 'effect3BasePoints', 'reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8', 'reagentcount1', 'reagentcount2', 'reagentcount3', 'reagentcount4', 'reagentcount5', 'reagentcount6', 'reagentcount7', 'reagentcount8', 'iconname', 'effect1Aura', 'effect2Aura', 'effect3Aura');
313
314function spell_duration($base)
315{
316 return round($base/1000).' sec';
317}
318
319function spell_desc($spellid, $type='tooltip')
320{
321 global $DB;
322 global $spell_cols;
323 $spellRow = $DB->selectRow('
324 SELECT ?#
325 FROM ?_spell, ?_spellicons
326 WHERE
327 spellID=?
328 AND id=spellicon
329 LIMIT 1
330 ',
331 $spell_cols[1],
332 $spellid
333 );
334 return spell_desc2($spellRow, $type);
335}
336
337function spell_desc2($spellRow, $type='tooltip')
338{
339 global $DB;
340
341// $spellRow = $DB->selectRow('SELECT s.*, i.iconname FROM ?_spell s, ?_spellicons i WHERE s.spellID=? AND i.id=s.spellicon LIMIT 1', $spellID);
342
343 allspellsinfo2($spellRow);
344
345 if (!IsSet($spellRow['duration_base']))
346 $lastduration = $DB->selectRow('SELECT * FROM ?_spellduration` WHERE durationID=? LIMIT 1', $spellRow['durationID']);
347
348 $signs = array('+', '-', '/', '*', '%', '^');
349
350 $data = $spellRow[$type];
351
352 if ((!$data) and $type='tooltip')
353 return '_empty_';
354
355 $pos = 0;
356 $str = '';
357 while (false!==($npos=strpos($data, '$', $pos)))
358 {
359 if ($npos!=$pos)
360 $str .= substr($data, $pos, $npos-$pos);
361 $pos = $npos+1;
362
363 if ('$' == substr($data, $pos, 1))
364 {
365 $str .= '$';
366 $pos++;
367 continue;
368 }
369
370 if (!preg_match('/^((([+\-\/*])(\d+);)?(\d*)(?:([lg].*?:.*?);|(\w\d*)))/', substr($data, $pos), $result))
371 continue;
372
373 if (empty($exprData[0]))
374 $exprData[0] = 1;
375
376 $op = $result[3];
377 $oparg = $result[4];
378 $lookup = $result[5];
379 $var = $result[6] ? $result[6] : $result[7];
380 $pos += strlen($result[0]);
381
382 if (!$var)
383 continue;
384
385 $exprType = strtolower(substr($var, 0, 1));
386 $exprData = explode(':', substr($var, 1));
387 switch ($exprType)
388 {
389 case 'r':
390 if (!IsSet($spellRow['rangeMax']))
391 $spellRow = array_merge($spellRow, $DB->selectRow('SELECT * FROM ?_spellrange WHERE rangeID=? LIMIT 1', $spellRow['rangeID']));
392
393 $base = $spellRow['rangeMax'];
394
395 if ($op && is_numeric($oparg) && is_numeric($base))
396 {
397 $equation = $base.$op.$oparg;
398 eval('$base = $equation;');
399 }
400 $str .= $base;
401 break;
402 case 'z':
403 $str .= '<Home>';
404 break;
405 case 'c':
406 if ($lookup > 0)
407 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
408 else
409 $spell = $spellRow;
410
411 $base = $spell['effect'.$exprData[0].'BasePoints']+1;
412
413 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
414 {
415 $equation = $base.$op.$oparg;
416 eval('$base = $equation;');
417 }
418
419 $str .= $base;
420 $lastvalue = $base;
421 break;
422 case 's':
423 if ($lookup > 0)
424 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
425 else
426 $spell = $spellRow;
427
428 if (!$exprData[0]) $exprData[0]=1;
429 @$base = $spell['effect'.$exprData[0].'BasePoints']+1;
430
431 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
432 {
433 $equation = $base.$op.$oparg;
434 eval('$base = $equation;');
435 }
436
437 @$str .= abs($base).($spell['effect'.$exprData[0].'DieSides'] > 1 ? ' to '.abs(($base+$spell['effect'.$exprData[0].'DieSides'])) : '');
438 $lastvalue = $base;
439 break;
440 case 'o':
441 if ($lookup > 0)
442 {
443 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
444 $lastduration = $DB->selectRow('SELECT * FROM ?_spellduration WHERE durationID=? LIMIT 1', $spell['durationID']);
445 }
446 else
447 $spell = $spellRow;
448
449 if (!$exprData[0]) $exprData[0] = 1;
450 $base = $spell['effect'.$exprData[0].'BasePoints']+1;
451
452 if ($spell['effect'.$exprData[0].'Amplitude'] <= 0) $spell['effect'.$exprData[0].'Amplitude'] = 5000;
453
454 $str .= (($lastduration['durationBase'] / $spell['effect'.$exprData[0].'Amplitude']) * abs($base).($spell['effect'.$exprData[0].'DieSides'] > 1 ? '-'.abs(($base+$spell['effect'.$exprData[0].'DieSides'])) : ''));
455 break;
456 case 't':
457 if ($lookup > 0)
458 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
459 else
460 $spell = $spellRow;
461
462 if (!$exprData[0]) $exprData[0]=1;
463 $base = $spell['effect'.$exprData[0].'Amplitude']/1000;
464
465 // TODO!!
466 if ($base==0) $base=1;
467 // !!TODO
468
469 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
470 {
471 $equation = $base.$op.$oparg;
472 eval('$base = $equation;');
473 }
474 $str .= abs($base);
475 $lastvalue = $base;
476 break;
477 case 'm':
478 if ($lookup > 0)
479 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
480 else
481 $spell = $spellRow;
482
483 // TODO!!
484 if (!$exprData[0]) $exprData[0] = 1;
485
486 $base = $spell['effect'.$exprData[0].'BasePoints']+1;
487
488 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
489 {
490 $equation = $base.$op.$oparg;
491 eval('$base = $equation;');
492 }
493 $str .= abs($base);
494 $lastvalue = $base;
495 break;
496 case 'x':
497 if ($lookup > 0)
498 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
499 else
500 $spell = $spellRow;
501
502 $base = $spell['effect'.$exprData[0].'ChainTarget'];
503
504 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
505 {
506 $equation = $base.$op.$oparg;
507 eval('$base = $equation;');
508 }
509 $str .= abs($base);
510 $lastvalue = $base;
511 break;
512 case 'q':
513 if ($lookup > 0)
514 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1',$lookup);
515 else
516 $spell = $spellRow;
517
518 if (!($exprData[0]))
519 $exprData[0]=1;
520 $base = $spell['effect'.$exprData[0].'MiscValue'];
521
522 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
523 {
524 $equation = $base.$op.$oparg;
525 eval('$base = $equation;');
526 }
527 $str .= abs($base);
528 $lastvalue = $base;
529 break;
530 case 'a':
531 if ($lookup > 0)
532 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
533 else
534 $spell = $spellRow;
535
536 $exprData[0] = 1; // TODO
537 $radius = $DB->selectCell('SELECT radiusBase FROM ?_spellradius WHERE radiusID=? LIMIT 1', $spell['effect'.$exprData[0].'radius']);
538 $base = $radius;
539
540 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
541 {
542 $equation = $base.$op.$oparg;
543 eval('$base = $equation;');
544 }
545 $str .= abs($base);
546 break;
547 case 'h':
548 if ($lookup > 0)
549 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
550 else
551 $spell = $spellRow;
552
553 $base = $spell['procChance'];
554
555 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
556 {
557 $equation = $base.$op.$oparg;
558 eval('$base = $equation;');
559 }
560 $str .= abs($base);
561 break;
562 case 'f':
563 if ($lookup > 0)
564 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
565 else
566 $spell = $spellRow;
567
568 $base = $spell['dmg_multiplier'.$exprData[0]];
569
570 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
571 {
572 $equation = $base.$op.$oparg;
573 eval('$base = $equation;');
574 }
575 $str .= abs($base);
576 break;
577 case 'n':
578 if ($lookup > 0)
579 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
580 else
581 $spell = $spellRow;
582
583 $base = $spell['procCharges'];
584
585 if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
586 {
587 $equation = $base.$op.$oparg;
588 eval('$base = $equation;');
589 }
590 $str .= abs($base);
591 break;
592 case 'd':
593 if ($lookup > 0)
594 {
595 $spell = $DB->selectRow('SELECT durationBase FROM ?_spell a, ?_spellduration b WHERE a.durationID = b.durationID AND a.spellID=? LIMIT 1', $lookup);
596 @$base = ($spell['durationBase'] > 0 ? $spell['durationBase'] + 1 : 0);
597 }
598 else
599 $base = ($lastduration['durationBase'] > 0 ? $lastduration['durationBase'] + 1 : 0);
600
601 if ($op && is_numeric($oparg) && is_numeric($base))
602 {
603 $equation = $base.$op.$oparg;
604 eval('$base = $equation;');
605 }
606 $str .= spell_duration($base);
607 break;
608 case 'i':
609 $base = $spellRow['spellTargets'];
610
611 if ($op && is_numeric($oparg) && is_numeric($base))
612 {
613 $equation = $base.$op.$oparg;
614 eval('$base = $equation;');
615 }
616 $str .= $base;
617 break;
618 case 'e':
619 if ($lookup > 0)
620 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
621 else
622 $spell = $spellRow;
623
624 $base = $spell['effect_'.$exprData[0].'_proc_value'];
625
626 if(in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
627 {
628 $equation = $base.$op.$oparg;
629 eval('$base = $equation;');
630 }
631
632 $str .= $base;
633 $lastvalue = $base;
634 break;
635 case 'v':
636 $base = $spell['affected_target_level'];
637
638 if ($op && $oparg > 0 && $base > 0)
639 {
640 $equation = $base.$op.$oparg;
641 eval('$base = $equation;');
642 }
643 $str .= $base;
644 break;
645 case 'u':
646 if ($lookup > 0)
647 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=?d LIMIT 1', $lookup);
648 else
649 $spell = $spellRow;
650
651// $base = $spell['effect_'.$exprData[0].'_misc_value'];
652 if (isset($spell['effect'.$exprData[0].'MiscValue']))
653 $base = $spell['effect'.$exprData[0].'MiscValue'];
654
655 if(in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
656 {
657 $equation = $base.$op.$oparg;
658 eval('$base = $equation;');
659 }
660 $str .= abs($base);
661 $lastvalue = $base;
662 break;
663 case 'b': // only used at one spell (14179) should be 20, column 110/111/112?)
664 if ($lookup > 0)
665 $spell = $DB->selectRow('SELECT * FROM ?_spell WHERE spellID=? LIMIT 1', $lookup);
666 else
667 $spell = $spellRow;
668
669 $base = $spell['effect_'.$exprData[0].'_proc_chance'];
670
671 if(in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
672 {
673 $equation = $base.$op.$oparg;
674 eval('$base = $equation;');
675 }
676 $str .= abs($base);
677 $lastvalue = $base;
678 break;
679 case 'l':
680 if ($lastvalue > 1)
681 $str .= $exprData[1];
682 else
683 $str .= $exprData[0];
684 break;
685 case 'g':
686 $str .= $exprData[0];
687 break;
688 default:
689 $str .= "[{$var} ($op::$oparg::$lookup::$exprData[0])]";
690 }
691 }
692 $str .= substr($data, $pos);
693
694 $str = @preg_replace_callback("|\{([^\}]+)\}|", create_function('$matches', 'return eval("return abs(".$matches[1].");");'), $str);
695
696 return($str);
697}
698
699function render_spell_tooltip(&$row)
700{
701 // БД
702 global $DB;
703
704 // Время каста
705 if ($row['spellcasttimesID'] > 1)
706 $casttime = ($DB->selectCell('SELECT base from ?_spellcasttimes where id=? limit 1', $row['spellcasttimesID']))/1000;
707 // Дальность действия
708 $range = $DB->selectCell('SELECT rangeMax from ?_spellrange where rangeID=? limit 1', $row['rangeID']);
709
710 // Реагенты
711 $reagents = array();
712 $i=0;
713 for ($j=1;$j<=8;$j++)
714 {
715 if ($row['reagent'.$j])
716 {
717 $reagents[$i] = array();
718 // Имя реагента
719 $reagents[$i]['name'] = $DB->selectCell("SELECT name from item_template where entry=? limit 1", $row['reagent'.$j]);
720 // Количество реагентов
721 $reagents[$i]['count'] = $row['reagentcount'.$j];
722 $i++;
723 }
724 }
725
726 // Инструменты
727 $tools = array();
728 $i=0;
729 for ($j=1;$j<=2;$j++)
730 {
731 if ($row['tool'.$j])
732 {
733 $tools[$i] = array();
734 // Имя инструмента
735 $tools[$i]['name'] = $DB->selectCell("SELECT name from item_template where entry=? limit 1", $row['tool'.$j]);
736 $i++;
737 }
738 }
739
740 // До подсказка о спелле
741 $desc = spell_desc2($row);
742
743 $x = '';
744 $x .= '<table><tr><td>';
745
746 if ($row['rank'])
747 $x .= '<table width="100%"><tr><td>';
748
749 $x .= '<b>'.$row['spellname'].'</b><br />';
750
751 if ($row['rank'])
752 $x .= '</td><th><b class="q0">'.$row['rank'].'</b></th></tr></table>';
753
754 if (($range) and (($row['manacost'] >0) or ($row['manacostpercent']>0)))
755 $x .= '<table width="100%"><tr><td>';
756
757 if ($row['manacost'] >0)
758 $x .= $row['manacost'].' mana<br />';
759
760 if ($row['manacostpercent']>0)
761 $x .= $row['manacostpercent']."% of base mana<br />";
762
763 if (($range) and (($row['manacost'] >0) or ($row['manacostpercent']>0)))
764 $x .= '</td><th>';
765
766 if ($range)
767 $x .= $range.' yd range<br />';
768
769 if (($range) and (($row['manacost'] >0) or ($row['manacostpercent']>0)))
770 $x .= '</th></tr></table>';
771
772 if ((($row['ChannelInterruptFlags']) or (isset($casttime)) or ($row['spellcasttimesID']==1)) and ($row['cooldown']))
773 $x .= '<table width="100%"><tr><td>';
774
775 if ($row['ChannelInterruptFlags'])
776 $x .= 'Channeled';
777 elseif (isset($casttime))
778 $x .= $casttime.' sec cast';
779 elseif ($row['spellcasttimesID']==1)
780 $x .= 'Instant';
781
782 if ((($row['ChannelInterruptFlags']) or (isset($casttime)) or ($row['spellcasttimesID']==1)) and ($row['cooldown']))
783 $x .= '</td><th>';
784
785 if ($row['cooldown'])
786 $x.= ($row['cooldown']/1000).' sec cooldown';
787
788 if ((($row['ChannelInterruptFlags']) or (isset($casttime)) or ($row['spellcasttimesID']==1)) and ($row['cooldown']))
789 $x .= '</th></tr></table>';
790
791 $x .= '</td></tr></table>';
792
793 if ($reagents)
794 {
795 $x .= '<table><tr><td>';
796 $x .= 'Reagents: ';
797 foreach($reagents as $i => $reagent)
798 {
799 $x .= $reagent['name'];
800 if ($reagent['count']>1)
801 $x .= ' ('.$reagents[$i]['count'].')';
802 if (!($i>=(count($reagents)-1)))
803 $x .= ', ';
804 else
805 $x .= '<br>';
806 }
807 $x .= '</td></tr></table>';
808 }
809
810 if ($tools)
811 {
812 $x .= '<table><tr><td>';
813 $x .= 'Tools: ';
814 foreach($tools as $i => $tool)
815 {
816 $x .= $tool['name'];
817 if (!($i>=(count($tools)-1)))
818 $x .= ', ';
819 else
820 $x .= '<br>';
821 }
822 $x .= '</td></tr></table>';
823 }
824
825 if (($desc) and ($desc!='_empty_'))
826 $x .= '<table><tr><td><span class="q">'.$desc.'</span></td></tr></table>';
827
828 return $x;
829}
830
831function allspellsinfo2(&$row, $level=0)
832{
833
834 global $DB;
835
836 if (!($row['spellID']))
837 return;
838 global $allspells;
839 $num = $row['spellID'];
840 if (isset($allitems[$num]))
841 return $allitems[$num];
842
843 // Номер спелла
844 $allspells[$num]['entry'] = $row['spellID'];
845
846 // Имя иконки спелла
847 if (($row['effect1itemtype']) and (!($row['effect1Aura'])))
848 {
849 if (IsSet($allitems[$row['effect1itemtype']]['icon']))
850 $allspells[$num]['icon'] = $allitems[$row['effect1itemtype']]['icon'];
851 else
852 $allspells[$num]['icon'] = $DB->selectCell('SELECT iconname from ?_icons WHERE id=(SELECT displayid FROM item_template WHERE entry=?d LIMIT 1) LIMIT 1',$row['effect1itemtype']);
853 } else {
854 $allspells[$num]['icon'] = $row['iconname'];
855 }
856
857 // Тултип спелла
858 if ($level>0)
859 {
860 $allspells[$num]['name'] = $row['spellname'];
861 $allspells[$num]['info'] = render_spell_tooltip($row);
862 }
863
864 if ($level==1)
865 return $allspells[$num];
866 elseif ($level==2)
867 return $allspells[$num]['info'];
868 else
869 return;
870}
871
872function spell_buff_render($row)
873{
874 global $DB;
875
876 $x = '<table><tr>';
877
878 // Имя баффа
879 $x .= '<td><b class="q">'.$row['spellname'].'</b></td>';
880
881 // Тип диспела
882 if ($row['dispeltypeID'])
883 {
884 $dispel = $DB->selectCell('SELECT name FROM ?_spelldispeltype WHERE id=? LIMIT 1', $row['dispeltypeID']);
885 $x .= '<th><b class="q">'.$dispel.'</b></th>';
886 }
887
888 $x .= '</tr></table>';
889
890 // Подсказка для баффа
891 $x .= '<table><tr><td>';
892
893 $x .= spell_desc2($row, 'buff').'<br>';
894
895 // Длительность баффа
896 $duration = $DB->selectCell("SELECT durationBase from ?_spellduration where durationID=? limit 1", $row['durationID']);
897 if ($duration>0)
898 $x .= '<span class="q">'.($duration/1000).' seconds remaining</span>';
899
900 $x .= '</td></tr></table>';
901
902 return $x;
903}
904
905function allspellsinfo($id, $level=0)
906{
907 global $DB;
908 global $allspells;
909 global $spell_cols;
910 if (isset($allitems[$id]))
911 return $allitems[$id];
912 $row = $DB->selectRow('
913 SELECT ?#
914 FROM ?_spell s, ?_spellicons i
915 WHERE
916 s.spellID=?
917 AND i.id = s.spellicon
918 LIMIT 1
919 ',
920 $spell_cols[$level],
921 $id
922 );
923
924 if ($row)
925 return allspellsinfo2($row, $level);
926 else
927 return;
928}
929
930// Подробная информация о спеле
931function spellinfo($id)
932{
933 global $DB;
934 $row = $DB->selectRow('
935 SELECT s.*, i.iconname
936 FROM ?_spell s, ?_spellicons i
937 WHERE
938 s.spellID=?
939 AND i.id = s.spellicon
940 LIMIT 1
941 ',
942 $id
943 );
944 return spellinfo2($row);
945}
946
947function spellinfo2(&$row)
948{
949 global $DB;
950 global $item_cols;
951
952 if ($row)
953 {
954 $spell = array();
955 $spell['entry'] = $row['spellID'];
956 $spell['quality'] = '@';
957 $spell['name'] = $row['spellname'];
958 $spell['rank'] = $row['rank'];
959 $spell['level'] = $row['levelspell'];
960 $spell['school'] = $row['resistancesID'];
961 // TODO: Что за cat?
962 $spell['cat'] = 0;
963 // Скилл
964// if (!(isset($row['skillID'])))
965// $skillrow = list($row['skillID'],$row['req_skill_value'],$row['min_value'],$row['max_value']);//$DB->selectRow('SELECT skillID, req_skill_value, min_value, max_value FROM ?_skill_line_ability WHERE spellID=?d LIMIT 1', $spell['entry']);
966 if (isset($row['skillID']))
967 {
968// if ($skillrow['req_skill_value'] != 1)
969// $spell['learnedat'] = $skillrow['req_skill_value'];
970 // TODO: На каком уровне скилла можно обучиться спеллу (поле learnedat)
971 if ($row['min_value'] and $row['max_value'])
972 {
973 $spell['colors'] = array();
974 $spell['colors'][0] = '';
975 $spell['colors'][1] = $row['min_value'];
976 $spell['colors'][2] = floor(($row['max_value'] + $row['min_value']) / 2);
977 $spell['colors'][3] = $row['max_value'];
978 }
979 $spell['skill'] = $row['skillID'];
980
981 }
982
983 // Реагенты
984 $spell['reagents'] = array();
985 $i=0;
986 global $allitems;
987 for ($j=1;$j<=8;$j++)
988 {
989 if ($row['reagent'.$j])
990 {
991 $spell['reagents'][$i] = array();
992 // ID реагента
993 $spell['reagents'][$i]['entry'] = $row['reagent'.$j];
994 // Доп данные о реагенте
995 // Если данных для этой вещи ещё нет:
996 allitemsinfo($spell['reagents'][$i]['entry'], 0);
997 // Количество реагентов
998 $spell['reagents'][$i]['count'] = $row['reagentcount'.$j];
999 $i++;
1000 }
1001 }
1002
1003 // Создает вещь:
1004 $i=0;
1005 for($j=1;$j<=3;$j++)
1006 if(isset($row['effect'.$j.'id']) && $row['effect'.$j.'id'] == 24)
1007 {
1008 $spell['creates'][$i] = array();
1009 $spell['creates'][$i]['entry'] = $row['effect'.$j.'itemtype'];
1010 $spell['creates'][$i]['count'] = $row['effect'.$j.'BasePoints'] + 1;
1011 if(!(isset($allitems[$spell['creates'][$i]['entry']])))
1012 {
1013 $createrow = $DB->selectRow('
1014 SELECT ?#
1015 FROM item_template, ?_icons
1016 WHERE
1017 entry=?d
1018 AND id=displayid
1019 LIMIT 1',
1020 $item_cols[0],
1021 $spell['creates'][$i]['entry']
1022 );
1023 allitemsinfo2($createrow, 0);
1024 }
1025 if (!(isset($allitems[$spell['creates'][$i]['entry']])))
1026 {
1027 // Если так и не существует - нет соответствующей записи в таблице вещей
1028 $spell['quality'] = 6;
1029 } else {
1030 $spell['quality'] = 6 - $allitems[$spell['creates'][$i]['entry']]['quality'];
1031 }
1032 $i++;
1033 }
1034
1035 allspellsinfo2($row, 0);
1036
1037 return $spell;
1038 } else {
1039 return;
1040 }
1041}
1042?>
Note: See TracBrowser for help on using the repository browser.