2 //===========================================================================
3 // Вспомогательные функции
4 //===========================================================================
6 define('PET_BONUS_RAP_TO_AP',0);
7 define('PET_BONUS_RAP_TO_SPELLDMG',1);
8 define('PET_BONUS_STAM',2);
9 define('PET_BONUS_RES',3);
10 define('PET_BONUS_ARMOR',4);
11 define('PET_BONUS_SPELLDMG_TO_SPELLDMG',5);
12 define('PET_BONUS_SPELLDMG_TO_AP',6);
13 define('PET_BONUS_INT',7);
14 // Получаем бонус для пета от статов игрока
15 function ComputePetBonus($stat, $value, $unitClass)
17 $HUNTER_PET_BONUS =array(0.22,0.1287,0.3,0.4,0.35,0.0,0.0,0.0);
18 $WARLOCK_PET_BONUS=array(0.0,0.0,0.3,0.4,0.35,0.15,0.57,0.3);
19 if($unitClass == CLASS_WARLOCK
)
21 if($WARLOCK_PET_BONUS[$stat]) return $value * $WARLOCK_PET_BONUS[$stat];
24 elseif($unitClass == CLASS_HUNTER
)
26 if($HUNTER_PET_BONUS[$stat]) return $value * $HUNTER_PET_BONUS[$stat];
32 // Вспомогательные функции получения данных
33 function getFloatValue($value,$num)
35 $txt = unpack("f", pack("L",$value));
36 return round($txt[1],$num);
38 // Получаем класс игрока
39 function getClassId($char)
41 return $char['class'];
43 // Игрок использует ману
44 function isManaUser($char_data)
46 switch ($char_data['class'])
54 case 11: $powerType = 0; break;
55 default: $powerType = 1;
58 if ($powerType==0) return true;
61 // Получаем скилл игрока
62 function getSkill($id, $char_data)
64 $skillInfo = array(0,0,0,0,0,0);
65 for ($i=0;$i<128;$i++
)
66 if (($char_data[PLAYER_SKILL_INFO_1_1 +
$i*3] & 0x0000FFFF) == $id)
68 $data0 = $char_data[PLAYER_SKILL_INFO_1_1 +
$i*3];
69 $data1 = $char_data[PLAYER_SKILL_INFO_1_1 +
$i*3 +
1];
70 $data2 = $char_data[PLAYER_SKILL_INFO_1_1 +
$i*3 +
2];
72 $skillInfo[0]=$data0&0x0000FFFF; // skill id
73 $skillInfo[1]=$data0>>16; // skill flag
74 $skillInfo[2]=$data1&0x0000FFFF; // skill
75 $skillInfo[3]=$data1>>16; // max skill
76 $skillInfo[4]=$data2&0x0000FFFF; // pos buff
77 $skillInfo[5]=$data2>>16; // neg buff
82 // Получаем скилл для вещи (оружия)
83 function getSkillFromItemID($id)
85 if ($id==0) return SKILL_UNARMED
;
87 if ($item == 0) return SKILL_UNARMED
;
88 if ($item['class']!=2) return SKILL_UNARMED
;
89 switch ($item['subclass'])
91 case 0: return SKILL_AXES
;
92 case 1: return SKILL_TWO_HANDED_AXE
;
93 case 2: return SKILL_BOWS
;
94 case 3: return SKILL_GUNS
;
95 case 4: return SKILL_MACES
;
96 case 5: return SKILL_TWO_HANDED_MACES
;
97 case 6: return SKILL_POLEARMS
;
98 case 7: return SKILL_SWORDS
;
99 case 8: return SKILL_TWO_HANDED_SWORDS
;
100 case 10: return SKILL_STAVES
;
101 // case 11: return ;//One-Handed Exotics
102 // case 12: return ;//Two-Handed Exotics
103 case 13: return SKILL_FIST_WEAPONS
;
104 // case 14: return ;//Miscellaneous
105 case 15: return SKILL_DAGGERS
;
106 case 16: return SKILL_THROWN
;
107 // case 17: return ;//Spears
108 case 18: return SKILL_CROSSBOWS
;
109 case 19: return SKILL_WANDS
;
110 // case 20: return ;//Fishing Pole
112 return SKILL_UNARMED
;
116 function GetCritChanceFromAgility($rating, $char_data)
118 $base = Array(3.1891, 3.2685, -1.532, -0.295, 3.1765, 3.1890, 2.922, 3.454, 2.6222, 20, 7.4755);
119 $ratingkey = array_keys($rating);
120 $class = getClassId($char_data);
121 $char_stat = getCharacterStats($char_data['guid']);
122 $agi = $char_stat['agility'];
123 return $base[$class-1] +
$agi*$rating[$ratingkey[$class]]*100;
125 function GetSpellCritChanceFromIntellect($rating, $char_data)
127 $base = Array(0, 3.3355, 3.602, 0, 1.2375, 0, 2.201, 0.9075, 1.7, 20, 1.8515);
128 $ratingkey = array_keys($rating);
129 $class = getClassId($char_data);
130 $char_stat = getCharacterStats($char_data['guid']);
131 $int = $char_stat['intellect'];
132 return $base[$class-1] +
$int*$rating[$ratingkey[11+
$class]]*100;
134 function GetAttackPowerForStat($statIndex, $effectiveStat, $class)
137 if ($statIndex==STAT_STRENGTH
)
143 case CLASS_DEATH_KNIGHT
:
145 $baseStr=min($effectiveStat,20);
146 $moreStr=$effectiveStat-$baseStr;
147 $ap=$baseStr +
2*$moreStr;
150 $ap=$effectiveStat - 10;
154 else if ($statIndex==STAT_AGILITY
)
161 $ap=$effectiveStat - 10;
167 function GetRatingCoefficient($rating, $id)
169 $ratingkey = array_keys($rating);
170 $c = $rating[$ratingkey[44+
$id]];if ($c==0) $c=1;
173 function GetHRCoefficient($rating, $class)
175 $ratingkey = array_keys($rating);
176 $c = $rating[$ratingkey[22+
$class]];if ($c==0) $c=1;
179 function GetMRCoefficient($rating, $class)
181 $ratingkey = array_keys($rating);
182 $c = $rating[$ratingkey[33+
$class]];if ($c==0) $c=1;
185 // Функции генерации таблиц оболочек
186 function createTopTable()
189 echo "<TABLE class=chartt cellSpacing=0>";
191 function createEndTable($valueClass, $value)
194 $data = ob_get_contents();
196 echo '<td '.addTooltip($data, 'WIDTH, 400, OFFSETX, 30, OFFSETY, 20, STICKY, false').' class='.$valueClass.'>'.$value.'</td>';
198 function createHeader($name,$base,$valueClass)
201 echo "<TR><TD class=head>$name <span class=$valueClass>$base</span>";
205 //=========================================
206 // Создаём тултип по одному из статов:
207 // 0 - Броня, 1-9 ... Resistance
208 function renderResist($statIndex, $stat, $char_data)
219 $class = $char_data['class'];
221 $valueClass = "normStat";
223 createHeader(getResistance($statIndex),$stat,$valueClass);
225 if ($statIndex==SCHOOL_ARMOR
)
227 $levelModifier = $char_data['level'];
228 if ($levelModifier > 59 ) $levelModifier = $levelModifier +
(4.5 * ($levelModifier-59));
229 $armorReduction = 0.1*$stat/(8.5*$levelModifier +
40);
230 $armorReduction = $armorReduction/(1+
$armorReduction)*100;
231 if ($armorReduction > 75) $armorReduction = 75;
232 if ($armorReduction < 0) $armorReduction = 0;
233 printf("Reduces Physical Damage taken by %0.2f%%",$armorReduction);
234 $petBonus = ComputePetBonus(PET_BONUS_ARMOR
, $stat, $class);
236 printf("<br>Increases your pet`s Armor by %d", $petBonus);
238 createEndTable($valueClass, $stat);
242 $unitLevel = max($char_data['level'],20);
243 $magicResistanceNumber = $stat/$unitLevel;
244 if ($magicResistanceNumber > 5 ) $resistanceLevel = "Excellent";
245 elseif ($magicResistanceNumber > 3.75) $resistanceLevel = "Very Good";
246 elseif ($magicResistanceNumber > 2.5 ) $resistanceLevel = "Good";
247 elseif ($magicResistanceNumber > 1.25) $resistanceLevel = "Fair";
248 elseif ($magicResistanceNumber > 0 ) $resistanceLevel = "Poor";
249 else $resistanceLevel = "None";
250 printf("Increases the ability to resist %s-based attacks, spells and abilities.<br />",getSchool($statIndex));
251 printf("Resistance against level %d: %s",$unitLevel,$resistanceLevel);
252 $petBonus = ComputePetBonus(PET_BONUS_RES
,$stat,$class);
254 printf("<br>Increases your pet`s Resistance by %d",$petBonus);
256 createEndTable($ResistType[$statIndex], $stat) ;
260 //=========================================
262 // Создаём тултип по одному из статов:
263 function renderStatRow($statIndex, $char_data, $stat)
265 $rating = getRating($char_data['level']);
266 $StatText = getStatTypeName($statIndex);
267 $class = $char_data['class'];
268 $effectiveStat = $stat;
269 createHeader($StatText,$effectiveStat,"normStat");
271 if ($statIndex==STAT_STRENGTH
)
273 $attpower = GetAttackPowerForStat(STAT_STRENGTH
, $effectiveStat, $class);
274 printf("Increases Attack Power by %d",$attpower);
275 if ($class==CLASS_WARRIOR
OR $class==CLASS_PALADIN
OR $class==CLASS_SHAMAN
)
277 $block = max(0, $effectiveStat*BLOCK_PER_STRENGTH
- 10);
278 printf("<br>Increases Block by %d",$block);
281 else if ($statIndex==STAT_AGILITY
)
283 $crit = GetCritChanceFromAgility($rating,$char_data);
284 $attackPower = GetAttackPowerForStat(STAT_AGILITY
, $effectiveStat, $class);
285 $armor = $effectiveStat * ARMOR_PER_AGILITY
;
286 if ($attackPower > 0 ) printf("Increases Attack Power by %d<br>", $attackPower);
287 printf("Increases Critical Hit chance by %.2f%%<br>Increases Armor by %d",$crit,$armor);
289 else if ($statIndex==STAT_STAMINA
)
291 $baseStam = min(20, $effectiveStat);
292 $moreStam = $effectiveStat - $baseStam;
293 $health = $baseStam +
($moreStam*HEALTH_PER_STAMINA
);
294 printf("Increases Health by %d",$health);
295 $petStam = ComputePetBonus(PET_BONUS_STAM
, $effectiveStat, $class);
297 printf("<br />Increases your pet`s Stamina by %d",$petStam);
300 else if ($statIndex==STAT_INTELLECT
)
302 $baseInt = min(20, $effectiveStat);
303 $moreInt = $effectiveStat - $baseInt;
304 $mana = $baseInt +
$moreInt*MANA_PER_INTELLECT
;
305 $spellcrit = GetSpellCritChanceFromIntellect($rating, $char_data);
306 if (isManaUser($char_data))
307 printf("Increases Mana by %d<br>Increases Spell Critical Hit by %.2f%%",$mana,$spellcrit);
308 $petInt = ComputePetBonus(PET_BONUS_INT
, $effectiveStat, $class);
310 printf("<br />Increases your pet`s Intellect by %d", $petInt);
312 else if ($statIndex==STAT_SPIRIT
)
314 $baseRatio = array(0, 0.625, 0.2631, 0.2, 0.3571, 0.1923, 0.625, 0.1724, 0.1212, 0.1282, 1, 0.1389);
315 $regen = $effectiveStat * GetHRCoefficient($rating, $class);
316 $baseSpirit = $effectiveStat;
317 if ($baseSpirit>50) $baseSpirit = 50;
318 $moreSpirit = $effectiveStat - $baseSpirit;
319 $regen = $baseSpirit * $baseRatio[$class] +
$moreSpirit * GetHRCoefficient($rating, $class);
321 printf("Increases Health Regeneration by %d Per Second while not in combat", $regen);
322 if (isManaUser($char_data))
324 $int = $char_data[UNIT_FIELD_STAT0 + STAT_INTELLECT
];
325 $regen = sqrt($int) * $effectiveStat * GetMRCoefficient($rating, $class);
326 $regen = floor($regen*5);
327 printf("<br />Increases Mana Regeneration by %d Per 5 Seconds while not casting", $regen);
331 $valueClass = "normStat";
332 createEndTable($valueClass, $effectiveStat);
334 //=========================================
336 // Создаём тултип по спелл урону:
337 function GetSpellBonusDamage($School,$char_data)
339 $bonus = $char_data[PLAYER_FIELD_MOD_DAMAGE_DONE_POS+
$School] +
$char_data[PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+
$School];
340 $bonus = $bonus*getFloatValue($char_data[PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+
$School],5);
343 function renderSpellDamage($char_data)
346 $minModifier = GetSpellBonusDamage($holySchool,$char_data);
349 for ($i=$holySchool;$i<7;$i++
)
351 $bonusDamage = GetSpellBonusDamage($i, $char_data);
352 $minModifier = min($minModifier, $bonusDamage);
353 $text =$text."<TR valign=center><TD width=1px><img src=images/player_info/characterframe/SpellSchoolIcon$i.gif></TD><TD> ".getSchool($i)."</TD><TD align=right>$bonusDamage</TD></TR>";
355 echo "<TR><TD class=head colSpan=3>Bonus Damage $minModifier</TD></TR>";
357 $class = getClassId($char_data);
358 if ($class==CLASS_WARLOCK
OR $class==CLASS_HUNTER
)
360 $shadow = GetSpellBonusDamage(SCHOOL_SHADOW
, $char_data);
361 $fire = GetSpellBonusDamage(SCHOOL_FIRE
, $char_data);
362 $petBonusAP = ComputePetBonus(PET_BONUS_SPELLDMG_TO_AP
, max($shadow,$fire),$class);
363 $petBonusDmg = ComputePetBonus(PET_BONUS_SPELLDMG_TO_SPELLDMG
, max($shadow,$fire),$class);
364 if ($petBonusAP OR $petBonusDmg)
367 printf("<TR><TD colSpan=3>Your Shadow Damage increases your pet`s Attack Power by %d and Spell Damage by %d</TD></TR>",$petBonusAP,$petBonusDmg);
369 printf("<TR><TD colSpan=3>Your Fire Damage increases your pet`s<br>Attack Power by %d and<br>Spell Damage by %d</TD></TR>",$petBonusAP,$petBonusDmg);
372 createEndTable("normStat", $minModifier);
374 //=========================================
375 // Создаём тултип по спелл хилу:
376 function renderSpellHeal($char_data)
378 $bonus = $char_data[PLAYER_FIELD_MOD_HEALING_DONE_POS
];
380 printf("<TR><TD class=head>Bonus Healing</TD></TR>");
381 printf("<TR><TD>Increases your healing by up to %d</TD></TR>",$bonus);
382 createEndTable("normStat", $bonus);
385 function renderSpellHit($char_data)
387 $rating = getRating($char_data['level']);
388 $valueRating = $char_data[PLAYER_FIELD_SPELL_HIT_RATING
];
389 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_HIT_SPELL
);
391 printf ("<TR><TD class=head>Hit Rating %d</TD></TR>", $valueRating);
392 printf ("<TR><TD>Increases your spell chance to hit a target of level %d by %.2f%%</TD></TR>", $char_data['level'], $RatingPct);
393 $penetration = $char_data[PLAYER_FIELD_MOD_TARGET_RESISTANCE
];
394 printf ("<TR><TD><br>Spell penetration %d (Reduces enemy resistances by %d)</TD></TR>", $penetration, -$penetration);
395 createEndTable("normStat", $valueRating);
397 //=========================================
398 // Создаём тултип по спелл криту:
399 function renderSpellCrit($char_data)
401 $rating = getRating($char_data['level']);
402 $spellCritRating = $char_data[PLAYER_FIELD_SPELL_CRIT_RATING
];
403 $minCrit = getFloatValue($char_data[PLAYER_SPELL_CRIT_PERCENTAGE+
1],2);
404 $critRatingPct = $spellCritRating/GetRatingCoefficient($rating, CR_CRIT_SPELL
);
406 printf ("<TR><TD class=head colSpan=3>Crit Rating %d (%.2f%%)</TD></TR>",$spellCritRating, $critRatingPct);
409 $crit = getFloatValue($char_data[PLAYER_SPELL_CRIT_PERCENTAGE+
$i],2);
410 $minCrit=min($minCrit,$crit);
411 echo "<TR valign=center><TD width=1px><img src=images/player_info/characterframe/SpellSchoolIcon$i.gif></TD>";
412 echo "<TD> ".getSchool($i)."</TD><TD align=right width=80px>$crit%</TD></TR>";
414 createEndTable("normStat", $minCrit."%");
417 function renderSpellHaste($char_data)
419 $rating = getRating($char_data['level']);
420 $valueRating = $char_data[PLAYER_FIELD_SPELL_HASTE_RATING
];
421 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_HASTE_SPELL
);
423 printf ("<TR><TD class=head>Haste rating %d</TD></TR>", $valueRating);
424 printf ("<TR><TD>Increases the speed that you spell cast by %.2f%%</TD></TR>", $RatingPct);
425 createEndTable("normStat", $valueRating);
428 function renderManaRegen($char_data)
430 $value = getFloatValue($char_data[UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER
],2)*5;
431 $valueI = getFloatValue($char_data[UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER
],2)*5;
433 printf ("<TR><TD class=head>Mana Regen</TD></TR>");
434 printf ("<TR><TD>%d mana regenerated every 5 seconds while not casting<br>%d mana regenerated every 5 seconds while casting</TD></TR>", $value, $valueI);
435 createEndTable("normStat", $value);
438 // Render melee panel
439 function renderMeleeSkill($char_data)
441 $rating = getRating($char_data['level']);
442 $skillID = getSkillFromItemID($char_data[PLAYER_VISIBLE_ITEM_MAIN_HAND
]);
443 $skill = getSkill($skillID,$char_data);
444 $defRating = $char_data[PLAYER_FIELD_MELEE_WEAPON_SKILL_RATING
];
445 $RatingAdd = $defRating/GetRatingCoefficient($rating, CR_DEFENSE_SKILL
);
446 $Buff = $skill[4]+
$skill[5]+
intval($RatingAdd);
447 $effectiveStat = $skill[2]+
$Buff;
449 printf("<TR><TD class=head>Main hand %d</TD></TR>", $effectiveStat);
450 printf("<TR><TD>Skill Rating %d (+%d Skill)</TD></TR>", $defRating, $RatingAdd);
451 $valueClass = "normStat";
452 if ($Buff<0) $valueClass = "negStat";
453 else if ($Buff>0) $valueClass = "posStat";
454 createEndTable($valueClass, $effectiveStat);
457 function renderMeleeDamage($char_data)
459 $minDamage = getFloatValue($char_data[UNIT_FIELD_MINDAMAGE
],0);
460 $maxDamage = getFloatValue($char_data[UNIT_FIELD_MAXDAMAGE
],0);
461 $speed = getFloatValue($char_data[UNIT_FIELD_BASEATTACKTIME
],2)/1000;
462 $Damage = ($minDamage +
$maxDamage) * 0.5;
463 if ($speed < 0.1) $speed = 0.1;
464 $damagePerSecond = (max($Damage,1) / $speed);
466 echo "<TR><TD class=head>Main Hand</TD></TR>";
467 printf ("<TR><TD>Attack Speed (seconds):</TD><TD align=right>%.2f</TD></TR>", $speed);
468 printf ("<TR><TD>Damage:</TD><TD align=right>%d - %d</TD></TR>", $minDamage, $maxDamage);
469 printf ("<TR><TD>Damage per Second:</TD><TD align=right>%.2f</TD></TR>", $damagePerSecond);
470 $skillID = getSkillFromItemID($char_data[PLAYER_VISIBLE_ITEM_OFF_HAND
]);
471 if ($skillID!=SKILL_UNARMED
)
473 $minOffHandDamage = getFloatValue($char_data[UNIT_FIELD_MINOFFHANDDAMAGE
],0);
474 $maxOffHandDamage = getFloatValue($char_data[UNIT_FIELD_MAXOFFHANDDAMAGE
],0);
475 $offhand_speed = getFloatValue($char_data[UNIT_FIELD_OFFHANDATTACKTIME
],2)/1000;
476 $Damage = ($minOffHandDamage +
$maxOffHandDamage) * 0.5;
477 $offdamagePerSecond = (max($Damage,1) / $speed);
478 echo "<TR><TD class=head>Off Hand</TD></TR>";
479 printf ("<TR><TD>Attack Speed (seconds):</TD><TD align=right>%.2f</TD></TR>", $offhand_speed);
480 printf ("<TR><TD>Damage:</TD><TD align=right>%d - %d</TD></TR>", $minOffHandDamage, $maxOffHandDamage);
481 printf ("<TR><TD>Damage per Second:</TD><TD align=right>%.2f</TD></TR>", $offdamagePerSecond);
483 createEndTable("normStat", $minDamage." - ".$maxDamage);
486 function renderMeleeSpeed($char_data)
488 $rating = getRating($char_data['level']);
489 $main_speed = getFloatValue($char_data[UNIT_FIELD_BASEATTACKTIME
],2)/1000;
490 $offhand_speed = getFloatValue($char_data[UNIT_FIELD_OFFHANDATTACKTIME
],2)/1000;
491 $speed = round($main_speed,2);
492 $skillID = getSkillFromItemID($char_data[PLAYER_VISIBLE_ITEM_OFF_HAND
]);
493 if ($skillID!=SKILL_UNARMED
)
494 $speed = $speed." / ". round($offhand_speed,2);
495 $valueRating = $char_data[PLAYER_FIELD_MELEE_HASTE_RATING
] ;
496 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_HASTE_RANGED
);
499 echo "<TR><TD class=head>Attack Speed $speed</TD></TR>";
500 printf ("<TR><TD>Haste rating %d (%.2f%% haste)</TD></TR>", $valueRating, $RatingPct);
501 createEndTable("normStat", $speed);
504 function renderMeleeAP($char_data)
506 $multipler = getFloatValue($char_data[UNIT_FIELD_ATTACK_POWER_MULTIPLIER
], 8);
507 if ($multipler<0) $multipler = 0;
509 $effectiveStat = $char_data[UNIT_FIELD_ATTACK_POWER
]*$multipler;
510 $Buff = $char_data[UNIT_FIELD_ATTACK_POWER_MODS
]*$multipler;
513 $valueClass = "normStat";
514 if ($Buff>0) {$posBuff=$Buff;$valueClass = "posStat";}
515 else if ($Buff<0) {$negBuff=$Buff;$valueClass = "negStat";}
516 $stat = $effectiveStat+
$Buff;
517 createHeader("Attack Power",$stat,"normStat");
518 printf ("<TR><TD>Increases damage with melee weapons by %.1f damage per second.</TD></TR>",max($stat, 0)/ATTACK_POWER_MAGIC_NUMBER
);
519 createEndTable($valueClass, $stat);
522 function renderMeleeHit($char_data)
524 $rating = getRating($char_data['level']);
525 $valueRating = $char_data[PLAYER_FIELD_MELEE_HIT_RATING
];
526 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_HIT_MELEE
);
528 printf ("<TR><TD class=head>Hit Rating %d</TD></TR>", $valueRating);
529 printf ("<TR><TD>Increases your melee chance to hit a target of level %d by %.2f%%</TD></TR>", $char_data['level'], $RatingPct);
530 $penetration = $char_data[PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
];
531 printf ("<TR><TD><br>Enemy Armor reduced by %d</TD></TR>", $penetration);
532 createEndTable("normStat", $valueRating);
535 function renderMeleeCrit($char_data)
537 $rating = getRating($char_data['level']);
538 $meleeCrit = getFloatValue($char_data[PLAYER_CRIT_PERCENTAGE
],2);
539 $meleeCritRating = $char_data[PLAYER_FIELD_MELEE_CRIT_RATING
];
540 $critRatingPct = $meleeCritRating/GetRatingCoefficient($rating, CR_CRIT_MELEE
);
542 printf ("<TR><TD class=head>Crit Chance %.2f%%</TD></TR>",$meleeCrit);
543 printf ("<TR><TD>Crit Rating %d (%.2f%% crit chance)</TD></TR>", $meleeCritRating, $critRatingPct);
544 createEndTable("normStat", $meleeCrit."%");
546 // =================================
547 // Render ranged panel
548 function renderRangedSkill($char_data)
550 $rating = getRating($char_data['level']);
551 $skillID = getSkillFromItemID($char_data[PLAYER_VISIBLE_ITEM_RANGED
]);
552 if ($skillID==SKILL_UNARMED
)
555 printf("<TR><TD class=head>Ranged N/A</TD></TR>");
556 createEndTable("normStat", "N/A");
559 $skill = getSkill($skillID,$char_data);
560 $defRating = $char_data[PLAYER_FIELD_MELEE_WEAPON_SKILL_RATING
];
561 $RatingAdd = $defRating/GetRatingCoefficient($rating, CR_DEFENSE_SKILL
);
562 $Buff = $skill[4]+
$skill[5]+
intval($RatingAdd);
563 $effectiveStat = $skill[2]+
$Buff;
565 printf("<TR><TD class=head>Main hand %d</TD></TR>", $effectiveStat);
566 printf("<TR><TD>Skill Rating %d (+%d Skill)</TD></TR>", $defRating, $RatingAdd);
567 $valueClass = "normStat";
568 if ($Buff<0) $valueClass = "negStat";
569 else if ($Buff>0) $valueClass = "posStat";
570 createEndTable($valueClass, $effectiveStat);
572 function renderRangedDamage($char_data)
575 $skillID = getSkillFromItemID($char_data[PLAYER_VISIBLE_ITEM_RANGED
]);
576 if ($skillID==SKILL_UNARMED
)
578 echo "<TR><TD class=head>Ranged N/A</TD></TR>";
579 createEndTable("normStat", "N/A");
583 $minDamage = getFloatValue($char_data[UNIT_FIELD_MINRANGEDDAMAGE
],0);
584 $maxDamage = getFloatValue($char_data[UNIT_FIELD_MAXRANGEDDAMAGE
],0);
585 $speed = getFloatValue($char_data[UNIT_FIELD_RANGEDATTACKTIME
],2)/1000;
586 $Damage = ($minDamage +
$maxDamage) * 0.5;
587 if ($speed < 0.1) $speed = 0.1;
588 $damagePerSecond = (max($Damage,1) / $speed);
589 echo "<TR><TD class=head>Ranged</TD></TR>";
590 printf ("<TR><TD>Attack Speed (seconds):</TD><TD align=right>%.2f</TD></TR>", $speed);
591 printf ("<TR><TD>Damage:</TD><TD align=right>%d - %d</TD></TR>", $minDamage, $maxDamage);
592 printf ("<TR><TD>Damage per Second:</TD><TD align=right>%.2f</TD></TR>", $damagePerSecond);
593 createEndTable("normStat", $minDamage." - ".$maxDamage);
596 function renderRangedSpeed($char_data)
598 $rating = getRating($char_data['level']);
599 $skillID = getSkillFromItemID($char_data[PLAYER_VISIBLE_ITEM_RANGED
]);
600 if ($skillID==SKILL_UNARMED
)
603 printf("<TR><TD class=head>Attack Speed N/A</TD></TR>");
604 createEndTable("normStat", "N/A");
607 $range_speed = getFloatValue($char_data[UNIT_FIELD_RANGEDATTACKTIME
],2)/1000;
608 $valueRating = $char_data[PLAYER_FIELD_RANGED_HASTE_RATING
] ;
609 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_HASTE_RANGED
);
611 printf ("<TR><TD class=head>Attack Speed %.2f</TD></TR>", $range_speed);
612 printf ("<TR><TD>Haste rating %d (%.2f%% haste)</TD></TR>", $valueRating, $RatingPct);
613 createEndTable("normStat", $range_speed);
616 function renderRangedAP($char_data)
618 $class = getClassId($char_data);
619 $multipler = getFloatValue($char_data[UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
], 8);
620 if ($multipler<0) $multipler = 0;
622 $effectiveStat = $char_data[UNIT_FIELD_RANGED_ATTACK_POWER
]*$multipler;
623 $Buff = $char_data[UNIT_FIELD_RANGED_ATTACK_POWER_MODS
]*$multipler;
625 $multiple = getFloatValue($char_data[UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
],2);
628 $valueClass = "normStat";
629 if ($Buff>0) {$posBuff=$Buff;$valueClass = "posStat";}
630 else if ($Buff<0) {$negBuff=$Buff;$valueClass = "negStat";}
631 $stat = $effectiveStat+
$Buff;
632 createHeader("Attack Power",$stat,"normStat");
633 printf ("<TR><TD>Increases damage with ranged weapons by %.1f damage per second.</TD></TR>",max($stat, 0)/ATTACK_POWER_MAGIC_NUMBER
);
635 if ($petAp = ComputePetBonus(PET_BONUS_RAP_TO_AP
, $stat, $class))
636 printf ("<TR><TD>Increases your pet`s Attack Power by %d</TD></TR>", $petAp);
637 if ($penSpellDamage = ComputePetBonus(PET_BONUS_RAP_TO_SPELLDMG
, $stat, $class))
638 printf ("<TR><TD>Increases your pet`s Spell Damage by %d</TD></TR>", $penSpellDamage);
640 createEndTable($valueClass, $stat);
643 function renderRangedHit($char_data)
645 $rating = getRating($char_data['level']);
646 $valueRating = $char_data[PLAYER_FIELD_RANGED_HIT_RATING
];
647 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_HIT_RANGED
);
649 printf ("<TR><TD class=head>Hit Rating %d</TD></TR>", $valueRating);
650 printf ("<TR><TD>Increases your ranged chance to hit a target of level %d by %.2f%%</TD></TR>", $char_data['level'], $RatingPct);
651 $penetration = $char_data[PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
];
652 printf ("<TR><TD><br>Enemy Armor reduced by %d</TD></TR>", $penetration);
653 createEndTable("normStat", $valueRating);
656 function renderRangedCrit($char_data)
658 $rating = getRating($char_data['level']);
659 $rangedCrit = getFloatValue($char_data[PLAYER_RANGED_CRIT_PERCENTAGE
],2);
660 $rangedCritRating = $char_data[PLAYER_FIELD_RANGED_CRIT_RATING
];
661 $critRatingPct = $rangedCritRating/GetRatingCoefficient($rating, CR_CRIT_RANGED
);
663 printf ("<TR><TD class=head>Crit Chance %.2f%%</TD></TR>",$rangedCrit);
664 printf ("<TR><TD>Crit Rating %d (%.2f%% crit chance)</TD></TR>", $rangedCritRating, $critRatingPct);
665 createEndTable("normStat", $rangedCrit."%");
667 // ================================================
670 function renderDefence($char_data)
672 $rating = getRating($char_data['level']);
673 $skill = getSkill(SKILL_DEFENCE
,$char_data);
675 $defRating = $char_data[PLAYER_FIELD_DEFENCE_RATING
];
676 $RatingAdd = $defRating/GetRatingCoefficient($rating, CR_DEFENSE_SKILL
);
677 $Buff = $skill[4]+
$skill[5]+
intval($RatingAdd);
678 $effectiveStat = $skill[2]+
$Buff;
680 $defensePercent = DODGE_PARRY_BLOCK_PERCENT_PER_DEFENSE
* ($effectiveStat - $char_data['level']*5);
681 $defensePercent = max($defensePercent, 0);
683 printf("<TR><TD class=head>Defense %d</TD></TR>", $effectiveStat);
684 printf("<TR><TD>Defense Rating %d (+%d Defense)<br>", $defRating, $RatingAdd);
685 printf("Increases chance to Dodge, Block and Parry by %.2f%%<br>",$defensePercent);
686 printf("Decreases chance to be hit and critically hit by %.2f%%</TD></TR>",$defensePercent);
687 $valueClass = "normStat";
688 if ($Buff<0) $valueClass = "negStat";
689 else if ($Buff>0) $valueClass = "posStat";
690 createEndTable($valueClass, $effectiveStat);
693 function renderDodge($char_data)
695 $rating = getRating($char_data['level']);
696 $value = getFloatValue($char_data[PLAYER_DODGE_PERCENTAGE
],2);
697 $valueRating = $char_data[PLAYER_FIELD_DODGE_RATING
];
698 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_DODGE
);
700 printf ("<TR><TD class=head>Dodge Chance %.2f%%</TD></TR>", $value);
701 printf ("<TR><TD>Dodge rating of %d adds %.2f%% Dodge</TD></TR>",$valueRating, $RatingPct);
702 createEndTable("normStat", $value."%");
705 function renderParry($char_data)
707 $rating = getRating($char_data['level']);
708 $value = getFloatValue($char_data[PLAYER_PARRY_PERCENTAGE
],2);
709 $valueRating = $char_data[PLAYER_FIELD_PARRY_RATING
];
710 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_PARRY
);
712 printf ("<TR><TD class=head>Parry Chance %.2f%%</TD></TR>", $value);
713 printf ("<TR><TD>Parry rating of %d adds %.2f%% Parry</TD></TR>", $valueRating, $RatingPct);
714 createEndTable("normStat", $value."%");
717 function renderBlock($char_data)
719 $rating = getRating($char_data['level']);
720 $value = getFloatValue($char_data[PLAYER_BLOCK_PERCENTAGE
],2);
721 $valueRating = $char_data[PLAYER_FIELD_BLOCK_RATING
];
722 $RatingPct = $valueRating/GetRatingCoefficient($rating, CR_BLOCK
);
723 $block_damage = $char_data[PLAYER_SHIELD_BLOCK
];
725 printf ("<TR><TD class=head>Block Chance %.2f%%</TD></TR>", $value);
726 printf ("<TR><TD>Block rating of %d adds Block</TD></TR>", $valueRating, $RatingPct);
727 printf ("<TR><TD>You block stops %d damage</TD></TR>", $block_damage);
728 createEndTable("normStat", $value."%");
731 function renderRecilence($char_data)
733 $rating = getRating($char_data['level']);
734 $melee = $char_data[PLAYER_FIELD_CRIT_TAKEN_MELEE_RATING
];
735 $ranged = $char_data[PLAYER_FIELD_CRIT_TAKEN_RANGED_RATING
];
736 $spell = $char_data[PLAYER_FIELD_CRIT_TAKEN_SPELL_RATING
];
737 $minResilience = min($melee, $ranged, $spell);
739 printf("<TR><TD class=head>Resilience %d</TD></TR>", $minResilience);
740 printf("<TR><TD>Melee Resilience %d (%.2f%%)</TD></TR>", $melee, $melee/GetRatingCoefficient($rating,CR_CRIT_TAKEN_MELEE
));
741 printf("<TR><TD>Ranged Resilience %d (%.2f%%)</TD></TR>", $ranged, $ranged/GetRatingCoefficient($rating,CR_CRIT_TAKEN_RANGED
));
742 printf("<TR><TD>Spell Resilience %d (%.2f%%)</TD></TR>", $spell, $spell/GetRatingCoefficient($rating,CR_CRIT_TAKEN_SPELL
));
743 createEndTable("normStat", $minResilience);
746 // Данная функция показывает ауры из базы
747 function show_player_auras_from_db($guid)
750 $buffs = $cDB->selectCol("SELECT `spell` FROM `character_aura` WHERE `guid` = ?d GROUP BY `spell`", $guid);
751 foreach ($buffs as $aura)
754 show_spell($aura, 0, 'aura');