1: <?php
2:
3: namespace Budabot\User\Modules;
4:
5: use DOMDocument;
6:
7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80:
81: class SkillsController {
82:
83: 84: 85: 86:
87: public $moduleName;
88:
89:
90: public $db;
91:
92:
93: public $http;
94:
95:
96: public $text;
97:
98:
99: public $util;
100:
101:
102: public $itemsController;
103:
104:
105: public $commandAlias;
106:
107: 108: 109: 110:
111: public function setup() {
112: $this->db->loadSQLFile($this->moduleName, "weapon_attributes");
113:
114: $this->commandAlias->register($this->moduleName, "weapon", "specials");
115: $this->commandAlias->register($this->moduleName, "weapon", "inits");
116: $this->commandAlias->register($this->moduleName, "aimshot", "as");
117: $this->commandAlias->register($this->moduleName, "aimshot", "aimedshot");
118: }
119:
120: 121: 122: 123:
124: public function aggdefCommand($message, $channel, $sender, $sendto, $args) {
125: $AttTim = $args[1];
126: $RechT = $args[2];
127: $InitS = $args[3];
128:
129: $blob = $this->getAggDefOutput($AttTim, $RechT, $InitS);
130:
131: $msg = $this->text->makeBlob("Agg/Def Results", $blob);
132: $sendto->reply($msg);
133: }
134:
135: public function getAggDefOutput($AttTim, $RechT, $InitS) {
136: if ($InitS < 1200) {
137: $AttCalc = round(((($AttTim - ($InitS / 600)) - 1)/0.02) + 87.5, 0);
138: $RechCalc = round(((($RechT - ($InitS / 300)) - 1)/0.02) + 87.5, 0);
139: } else {
140: $InitSk = $InitS - 1200;
141: $AttCalc = round(((($AttTim - (1200/600) - ($InitSk / 600 / 3)) - 1)/0.02) + 87.5, 0);
142: $RechCalc = round(((($RechT - (1200/300) - ($InitSk / 300 / 3)) - 1)/0.02) + 87.5, 0);
143: }
144:
145: if ($AttCalc < $RechCalc) {
146: $InitResult = $RechCalc;
147: } else {
148: $InitResult = $AttCalc;
149: }
150: if ($InitResult < 0) {
151: $InitResult = 0;
152: } else if ($InitResult > 100 ) {
153: $InitResult = 100;
154: }
155:
156: $initsFullAgg = $this->getInitsNeededFullAgg($AttTim, $RechT);
157: $initsNeutral = $this->getInitsNeededNeutral($AttTim, $RechT);
158: $initsFullDef = $this->getInitsNeededFullDef($AttTim, $RechT);
159:
160: $blob = "Attack:<highlight> ". $AttTim ." <end>second(s)\n";
161: $blob .= "Recharge: <highlight>". $RechT ." <end>second(s)\n";
162: $blob .= "Init Skill: <highlight>". $InitS ."<end>\n";
163: $blob .= "Def/Agg: <highlight>". $InitResult ."%<end>\n";
164: $blob .= "You must set your AGG bar at <highlight>". $InitResult ."% (". round($InitResult*8/100,2) .") <end>to wield your weapon at 1/1.\n\n";
165: $blob .= "Init needed for max speed at Full Agg (100%): <highlight>". $initsFullAgg ." <end>inits\n";
166: $blob .= "Init needed for max speed at Neutral (88%): <highlight>". $initsNeutral ." <end>inits\n";
167: $blob .= "Init needed for max speed at Full Def (0%): <highlight>". $initsFullDef ." <end>inits\n\n";
168: $blob .= "Note that at the neutral position (88%), your attack and recharge time will match that of the weapon you are using.";
169: $blob .= "\n\nBased upon a RINGBOT module made by NoGoal(RK2)\n";
170: $blob .= "Modified for Budabot by Healnjoo(RK2)";
171:
172: return $blob;
173: }
174:
175: public function getInitsNeededFullAgg($AttTim, $RechT) {
176: $Initatta1 = round((((100 - 87.5) * 0.02) + 1 - $AttTim) * (-600), 0);
177: $Initrech1 = round((((100 - 87.5) * 0.02) + 1 - $RechT) * (-300), 0);
178: if ($Initatta1 > 1200) {
179: $Initatta1 = round(((((100 - 87.5) * 0.02) + 1 - $AttTim + 2) * (-1800)) + 1200, 0);
180: }
181: if ($Initrech1 > 1200) {
182: $Initrech1 = round(((((100 - 87.5) * 0.02) + 1 - $AttTim + 4) * (-900)) + 1200, 0);
183: }
184: if ($Initatta1 < $Initrech1) {
185: $Init1 = $Initrech1;
186: } else {
187: $Init1 = $Initatta1;
188: }
189: return $Init1;
190: }
191:
192: public function getInitsNeededNeutral($AttTim, $RechT) {
193: $Initatta2 = round((((87.5 - 87.5) * 0.02) + 1 - $AttTim) * (-600), 0);
194: $Initrech2 = round((((87.5 - 87.5) * 0.02) + 1 - $RechT) * (-300), 0);
195: if ($Initatta2 > 1200) {
196: $Initatta2 = round(((((87.5 - 87.5) * 0.02) + 1 - $AttTim + 2) * (-1800)) + 1200, 0);
197: }
198: if ($Initrech2 > 1200) {
199: $Initrech2 = round(((((87.5 - 87.5) * 0.02) + 1 - $AttTim + 4) * (-900)) + 1200, 0);
200: }
201: if ($Initatta2 < $Initrech2) {
202: $Init2 = $Initrech2;
203: } else {
204: $Init2 = $Initatta2;
205: }
206: return $Init2;
207: }
208:
209: public function getInitsNeededFullDef($AttTim, $RechT) {
210: $Initatta3 = round((((-87.5) * 0.02) + 1 - $AttTim) * (-600), 0);
211: $Initrech3 = round((((-87.5) * 0.02) + 1 - $RechT) * (-300), 0);
212: if ($Initatta3 > 1200) {
213: $Initatta3 = round(((((-87.5) * 0.02) + 1 - $AttTim + 2) * (-1800)) + 1200, 0);
214: }
215: if ($Initrech3 > 1200) {
216: $Initrech3 = round(((((-87.5) * 0.02) + 1 - $AttTim + 4) * (-900)) + 1200, 0);
217: }
218: if ($Initatta3 < $Initrech3) {
219: $Init3 = $Initrech3;
220: } else {
221: $Init3 = $Initatta3;
222: }
223: return $Init3;
224: }
225:
226: 227: 228: 229:
230: public function aimshotCommand($message, $channel, $sender, $sendto, $args) {
231: $AttTim = $args[1];
232: $RechT = $args[2];
233: $InitS = $args[3];
234:
235: list($cap, $ASCap) = $this->capAimedShot($AttTim, $RechT);
236:
237: $ASRech = ceil(($RechT * 40) - ($InitS * 3 / 100) + $AttTim - 1);
238: if ($ASRech < $cap) {
239: $ASRech = $cap;
240: }
241: $MultiP = round($InitS / 95,0);
242:
243: $blob = "Attack: <highlight>". $AttTim ." <end>second(s)\n";
244: $blob .= "Recharge: <highlight>". $RechT ." <end>second(s)\n";
245: $blob .= "Aim Shot Skill: <highlight>". $InitS ."<end>\n\n";
246: $blob .= "Aim Shot Multiplier:<highlight> 1-". $MultiP ."x<end>\n";
247: $blob .= "Aim Shot Recharge: <highlight>". $ASRech ."<end> seconds\n";
248: $blob .= "With your weap, your Aim Shot recharge will cap at <highlight>".$cap."<end>s.\n";
249: $blob .= "You need <highlight>".$ASCap."<end> Aim Shot skill to cap your recharge.";
250:
251: $msg = $this->text->makeBlob("Aim Shot Results", $blob);
252: $sendto->reply($msg);
253: }
254:
255: 256: 257: 258:
259: public function brawlCommand($message, $channel, $sender, $sendto, $args) {
260: $brawl_skill = $args[1];
261:
262: $skill_list = array( 1, 1000, 1001, 2000, 2001, 3000);
263: $min_list = array( 1, 100, 101, 170, 171, 235);
264: $max_list = array( 2, 500, 501, 850, 851, 1145);
265: $crit_list = array( 3, 500, 501, 600, 601, 725);
266:
267: if ($brawl_skill < 1001) {
268: $i = 0;
269: } else if ($brawl_skill < 2001) {
270: $i = 2;
271: } else {
272: $i = 4;
273: }
274:
275: $min = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $min_list[$i], $min_list[($i+1)], $brawl_skill);
276: $max = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $max_list[$i], $max_list[($i+1)], $brawl_skill);
277: $crit = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $crit_list[$i], $crit_list[($i+1)], $brawl_skill);
278: $stunC = (($brawl_skill < 1000) ? "<orange>10<end>%, <font color=#cccccc>will become </font>20<font color=#cccccc>% above </font>1000<font color=#cccccc> brawl skill</font>" : "<orange>20<end>%");
279: $stunD = (($brawl_skill < 2001) ? "<orange>3<end>s, <font color=#cccccc>will become </font>4<font color=#cccccc>s above </font>2001<font color=#cccccc> brawl skill</font>" : "<orange>4<end>s");
280:
281: $blob = "Brawl Skill: <highlight>".$brawl_skill."<end>\n";
282: $blob .= "Brawl recharge: <highlight>15<end> seconds <font color=#ccccc>(constant)</font>\n";
283: $blob .= "Damage: <highlight>".$min."<end>-<highlight>".$max."<end>(<highlight>".$crit."<end>)\n";
284: $blob .= "Stun chance: ".$stunC."\n";
285: $blob .= "Stun duration: ".$stunD."\n";
286: $blob .= "\n\nby Imoutochan, RK1";
287:
288: $msg = $this->text->makeBlob("Brawl Results", $blob);
289: $sendto->reply($msg);
290: }
291:
292: 293: 294: 295:
296: public function burstCommand($message, $channel, $sender, $sendto, $args) {
297: $AttTim = $args[1];
298: $RechT = $args[2];
299: $BurstDelay = $args[3];
300: $BurstSkill = $args[4];
301:
302: list($cap, $burstskillcap) = $this->capBurst($AttTim, $RechT, $BurstDelay);
303:
304: $burstrech = floor(($RechT * 20) + ($BurstDelay / 100) - ($BurstSkill / 25) + $AttTim);
305: if ($burstrech <= $cap) {
306: $burstrech = $cap;
307: }
308:
309: $blob = "Attack: <highlight>". $AttTim ." <end>second(s)\n";
310: $blob .= "Recharge: <highlight>". $RechT ." <end>second(s)\n";
311: $blob .= "Burst Delay: <highlight>". $BurstDelay ."<end>\n";
312: $blob .= "Burst Skill: <highlight>". $BurstSkill ."<end>\n\n";
313: $blob .= "Your Burst Recharge:<highlight> ". $burstrech ."<end>s\n";
314: $blob .= "With your weap, your burst recharge will cap at <highlight>".$cap."<end>s.\n";
315: $blob .= "You need <highlight>".$burstskillcap."<end> Burst Skill to cap your recharge.";
316:
317: $msg = $this->text->makeBlob("Burst Results", $blob);
318: $sendto->reply($msg);
319: }
320:
321: 322: 323: 324:
325: public function dimachCommand($message, $channel, $sender, $sendto, $args) {
326: $dim_skill = $args[1];
327:
328: $skill_list = array( 1, 1000, 1001, 2000, 2001, 3000);
329: $gen_dmg_list = array( 1, 2000, 2001, 2500, 2501, 2850);
330: $MA_rech_list = array(1800, 1800, 1188, 600, 600, 300);
331: $MA_dmg_list = array( 1, 2000, 2001, 2340, 2341, 2550);
332: $shad_rech_list = array( 300, 300, 300, 300, 240, 200);
333: $shad_dmg_list = array( 1, 920, 921, 1872, 1873, 2750);
334: $shad_rec_list = array( 70, 70, 70, 75, 75, 80);
335: $keep_heal_list = array( 1, 3000, 3001,10500,10501,15000);
336:
337: if ($dim_skill < 1001) {
338: $i = 0;
339: } else if ($dim_skill < 2001) {
340: $i = 2;
341: } else {
342: $i = 4;
343: }
344:
345: $blob = "Dimach Skill: <highlight>".$dim_skill."<end>\n\n";
346:
347: $MA_dmg = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $MA_dmg_list[$i], $MA_dmg_list[($i+1)], $dim_skill);
348: $MA_dim_rech = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $MA_rech_list[$i], $MA_rech_list[($i+1)], $dim_skill);
349: $blob .= "Profession: <highlight>Martial Artist<end>\n";
350: $blob .= "Damage: <highlight>".$MA_dmg."<end>-<highlight>".$MA_dmg."<end>(<highlight>1<end>)\n";
351: $blob .= "Recharge ".$this->util->unixtimeToReadable($MA_dim_rech)."\n\n";
352:
353: $keep_heal = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $keep_heal_list[$i],$keep_heal_list[($i+1)], $dim_skill);
354: $blob .= "Profession: <highlight>Keeper<end>\n";
355: $blob .= "Self heal: <font color=#ff9999>".$keep_heal."</font> HP\n";
356: $blob .= "Recharge: <highlight>5<end> minutes <font color=#ccccc>(constant)</font>\n\n";
357:
358: $shad_dmg = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $shad_dmg_list[$i], $shad_dmg_list[($i+1)], $dim_skill);
359: $shad_rec = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $shad_rec_list[$i], $shad_rec_list[($i+1)], $dim_skill);
360: $shad_dim_rech = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $shad_rech_list[$i], $shad_rech_list[($i+1)], $dim_skill);
361: $blob .= "Profession: <highlight>Shade<end>\n";
362: $blob .= "Damage: <highlight>".$shad_dmg."<end>-<highlight>".$shad_dmg."<end>(<highlight>1<end>)\n";
363: $blob .= "HP drain: <font color=#ff9999>".$shad_rec."</font>%\n";
364: $blob .= "Recharge ".$this->util->unixtimeToReadable($shad_dim_rech)."\n\n";
365:
366: $gen_dmg = $this->util->interpolate($skill_list[$i], $skill_list[($i+1)], $gen_dmg_list[$i], $gen_dmg_list[($i+1)], $dim_skill);
367: $blob .= "Profession: <highlight>All professions besides MA, Shade and Keeper<end>\n";
368: $blob .= "Damage: <highlight>".$gen_dmg."<end>-<highlight>".$gen_dmg."<end>(<highlight>1<end>)\n";
369: $blob .= "Recharge: <highlight>30<end> minutes <font color=#ccccc>(constant)</font>\n\n";
370:
371: $blob .= "by Imoutochan, RK1";
372:
373: $msg = $this->text->makeBlob("Dimach Results", $blob);
374: $sendto->reply($msg);
375: }
376:
377: 378: 379: 380:
381: public function fastattackCommand($message, $channel, $sender, $sendto, $args) {
382: $AttTim = $args[1];
383: $fastSkill = $args[2];
384:
385: list($fasthardcap, $fastskillcap) = $this->capFastAttack($AttTim);
386:
387: $fastrech = round(($AttTim * 16) - ($fastSkill / 100));
388:
389: if ($fastrech < $fasthardcap) {
390: $fastrech = $fasthardcap;
391: }
392:
393: $blob = "Attack: <highlight>". $AttTim ." <end>second(s)\n";
394: $blob .= "Fast Attack Skill: <highlight>". $fastSkill ."<end>\n";
395: $blob .= "Fast Attack Recharge: <highlight>". $fastrech ."<end>s\n";
396: $blob .= "You need <highlight>".$fastskillcap."<end> Fast Attack Skill to cap your fast attack at <highlight>".$fasthardcap."<end>s.";
397:
398: $msg = $this->text->makeBlob("Fast Attack Results", $blob);
399: $sendto->reply($msg);
400: }
401:
402: 403: 404: 405:
406: public function flingCommand($message, $channel, $sender, $sendto, $args) {
407: $AttTim = $args[1];
408: $FlingSkill = $args[2];
409:
410: list($flinghardcap, $flingskillcap) = $this->capFlingShot($AttTim);
411:
412: $flingrech = round(($AttTim * 16) - ($FlingSkill / 100));
413:
414: if ($flingrech < $flinghardcap) {
415: $flingrech = $flinghardcap;
416: }
417:
418: $blob = "Attack: <highlight>{$AttTim}<end> second(s)\n";
419: $blob .= "Fling Shot Skill: <highlight>{$FlingSkill}<end>\n";
420: $blob .= "Fling Shot Recharge: <highlight>{$flingrech}<end> second(s)\n";
421: $blob .= "You need <highlight>{$flingskillcap}<end> Fling Shot skill to cap your fling at <highlight>{$flinghardcap}<end> second(s).";
422:
423: $msg = $this->text->makeBlob("Fling Results", $blob);
424: $sendto->reply($msg);
425: }
426:
427: 428: 429: 430:
431: public function fullautoCommand($message, $channel, $sender, $sendto, $args) {
432: $AttTim = $args[1];
433: $RechT = $args[2];
434: $FARecharge = $args[3];
435: $FullAutoSkill = $args[4];
436:
437: list($FACap, $FA_Skill_Cap) = $this->capFullAuto($AttTim, $RechT, $FARecharge);
438:
439: $FA_Recharge = round(($RechT * 40) + ($FARecharge / 100) - ($FullAutoSkill / 25) + round($AttTim - 1));
440: if ($FA_Recharge < $FACap) {
441: $FA_Recharge = $FACap;
442: }
443:
444: $MaxBullets = 5 + floor($FullAutoSkill / 100);
445:
446: $blob = "Weapon Attack: <highlight>". $AttTim ."<end>s\n";
447: $blob .= "Weapon Recharge: <highlight>". $RechT ."<end>s\n";
448: $blob .= "Full Auto Recharge value: <highlight>". $FARecharge ."<end>\n";
449: $blob .= "FA Skill: <highlight>". $FullAutoSkill ."<end>\n\n";
450: $blob .= "Your Full Auto recharge:<highlight> ". $FA_Recharge ."s<end>\n";
451: $blob .= "Your Full Auto can fire a maximum of <highlight>".$MaxBullets." bullets<end>.\n";
452: $blob .= "Full Auto recharge always caps at <highlight>".$FACap."<end>s.\n";
453: $blob .= "You will need at least <highlight>".$FA_Skill_Cap."<end> Full Auto skill to cap your recharge.\n\n";
454: $blob .= "From <highlight>0 to 10K<end> damage, the bullet damage is unchanged.\n";
455: $blob .= "From <highlight>10K to 11.5K<end> damage, each bullet damage is halved.\n";
456: $blob .= "From <highlight>11K to 15K<end> damage, each bullet damage is halved again.\n";
457: $blob .= "<highlight>15K<end> is the damage cap.";
458:
459: $msg = $this->text->makeBlob("Full Auto Results", $blob);
460: $sendto->reply($msg);
461: }
462:
463: 464: 465: 466:
467: public function mafistCommand($message, $channel, $sender, $sendto, $args) {
468: $MaSkill = $args[1];
469:
470:
471: $skill_list = array(1,200,1000,1001,2000,2001,3000);
472:
473: $MA_min_list = array(4,45,125,130,220,225, 450);
474: $MA_max_list = array(8,75,400,405,830,831,1300);
475: $MA_crit_list = array(3,50,500,501,560,561,800);
476: $MA_fist_speed = array(1.15,1.25,1.25,1.30,1.35,1.45,1.50);
477:
478: $shade_min_list = array(3,25, 55, 56,130,131,280);
479: $shade_max_list = array(5,60,258,259,682,683,890);
480: $shade_crit_list = array(3,50,250,251,275,276,300);
481:
482: $gen_min_list = array(3,25, 65, 66,140,204,300);
483: $gen_max_list = array(5,60,280,281,715,831,990);
484: $gen_crit_list = array(3,50,500,501,605,605,630);
485:
486: if ($MaSkill < 200) {
487: $i = 0;
488: } else if ($MaSkill < 1001) {
489: $i = 1;
490: } else if ($MaSkill < 2001) {
491: $i = 3;
492: } else {
493: $i = 5;
494: }
495:
496: $fistql = round($MaSkill / 2, 0);
497: if ($fistql <= 200) {
498: $speed = 1.25;
499: } else if ($fistql <= 500) {
500: $speed = 1.25 + (0.2 * (($fistql - 200) / 300));
501: } else if ($fistql <= 1000) {
502: $speed = 1.45 + (0.2 * (($fistql - 500) / 500));
503: } else if ($fistql <= 1500) {
504: $speed = 1.65 + (0.2 * (($fistql - 1000) / 500));
505: }
506: $speed = round($speed,2);
507:
508: $blob = "MA Skill: <highlight>". $MaSkill ."<end>\n\n";
509:
510: $min = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $MA_min_list[$i], $MA_min_list[($i + 1)], $MaSkill);
511: $max = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $MA_max_list[$i], $MA_max_list[($i + 1)], $MaSkill);
512: $crit = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $MA_crit_list[$i], $MA_crit_list[($i + 1)], $MaSkill);
513:
514: $ma_spd = (($maskill - $skill_list[$i]) * ($MA_fist_speed[($i + 1)] - $MA_fist_speed[$i])) / ($skill_list[($i + 1)] - $skill_list[$i]) + $MA_fist_speed[$i];
515: $ma_speed = round($ma_spd, 2);
516: $dmg = "<highlight>".$min."<end>-<highlight>".$max."<end>(<highlight>".$crit."<end>)";
517: $blob .= "Profession: <highlight>Martial Artist<end>\n";
518: $blob .= "Fist speed: <highlight>".$ma_speed."<end>s/<highlight>".$ma_speed."<end>s\n";
519: $blob .= "Fist damage: ".$dmg."\n\n\n";
520:
521: $min = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $shade_min_list[$i], $shade_min_list[($i + 1)], $MaSkill);
522: $max = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $shade_max_list[$i], $shade_max_list[($i + 1)], $MaSkill);
523: $crit = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $shade_crit_list[$i], $shade_crit_list[($i + 1)], $MaSkill);
524: $dmg = "<highlight>".$min."<end>-<highlight>".$max."<end>(<highlight>".$crit."<end>)";
525: $blob .= "Profession: <highlight>Shade<end>\n";
526: $blob .= "Fist speed: <highlight>".$speed."<end>s/<highlight>".$speed."<end>s\n";
527: $blob .= "Fist damage: ".$dmg."\n\n";
528:
529: $min = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $gen_min_list[$i], $gen_min_list[($i + 1)], $MaSkill);
530: $max = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $gen_max_list[$i], $gen_max_list[($i + 1)], $MaSkill);
531: $crit = $this->util->interpolate($skill_list[$i], $skill_list[($i + 1)], $gen_crit_list[$i], $gen_crit_list[($i + 1)], $MaSkill);
532: $dmg = "<highlight>".$min."<end>-<highlight>".$max."<end>(<highlight>".$crit."<end>)";
533: $blob .= "Profession: <highlight>All professions besides MA and Shade<end>\n";
534: $blob .= "Fist speed: <highlight>".$speed."<end>s/<highlight>".$speed."<end>s\n";
535: $blob .= "Fist damage: ".$dmg."\n\n";
536:
537: $msg = $this->text->makeBlob("Martial Arts Results", $blob);
538: $sendto->reply($msg);
539: }
540:
541: 542: 543: 544:
545: public function nanoinitCommand($message, $channel, $sender, $sendto, $args) {
546: $attack_time = $args[1];
547: $init_skill = $args[2];
548:
549: $attack_time_reduction = $this->calcAttackTimeReduction($init_skill);
550: $effective_attack_time = $attack_time - $attack_time_reduction;
551:
552: $bar_setting = $this->calcBarSetting($effective_attack_time);
553: if ($bar_setting < 0) {
554: $bar_setting = 0;
555: }
556: if ($bar_setting > 100) {
557: $bar_setting = 100;
558: }
559:
560: $Init1 = $this->calcInits($attack_time - 1);
561: $Init2 = $this->calcInits($attack_time);
562: $Init3 = $this->calcInits($attack_time + 1);
563:
564: $blob = "Attack: <highlight>". $attack_time ." <end>second(s)\n";
565: $blob .= "Init Skill: <highlight>". $init_skill ."<end>\n";
566: $blob .= "Def/Agg: <highlight>". $bar_setting ."%<end>\n";
567: $blob .= "You must set your AGG bar at <highlight>". $bar_setting ."% (". round($bar_setting * 8 / 100,2) .") <end>to instacast your nano.\n\n";
568: $blob .= "NanoC. Init needed to instacast at Full Agg (100%):<highlight> ". $Init1 ." <end>inits\n";
569: $blob .= "NanoC. Init needed to instacast at Neutral (88%):<highlight> ". $Init2 ." <end>inits\n";
570: $blob .= "NanoC. Init needed to instacast at Full Def (0%):<highlight> ". $Init3 ." <end>inits";
571:
572: $msg = $this->text->makeBlob("Nano Init Results", $blob);
573: $sendto->reply($msg);
574: }
575:
576: 577: 578: 579: 580:
581: public function weaponCommand($message, $channel, $sender, $sendto, $args) {
582: if (count($args) == 4) {
583: $highid = $args[2];
584: $ql = $args[3];
585: } else {
586: $highid = $args[1];
587: $ql = $args[2];
588: }
589:
590:
591:
592: $sql = "SELECT *, 1 AS order_col FROM aodb WHERE highid = ? AND lowql <= ? AND highql >= ?
593: UNION
594: SELECT *, 2 AS order_col FROM aodb WHERE lowid = ? AND lowql <= ? AND highql >= ?
595: ORDER BY order_col ASC";
596: $row = $this->db->queryRow($sql, $highid, $ql, $ql, $highid, $ql, $ql);
597:
598: if ($row === null) {
599: $msg = "Item does not exist in the items database.";
600: $sendto->reply($msg);
601: return;
602: }
603:
604: $lowAttributes = $this->db->queryRow("SELECT * FROM weapon_attributes WHERE id = ?", $row->lowid);
605: $highAttributes = $this->db->queryRow("SELECT * FROM weapon_attributes WHERE id = ?", $row->highid);
606:
607: if ($lowAttributes === null || $highAttributes === null) {
608: $msg = "Could not find any weapon info for this item.";
609: $sendto->reply($msg);
610: return;
611: }
612:
613: $name = $row->name;
614: $attack_time = $this->util->interpolate($row->lowql, $row->highql, $lowAttributes->attack_time, $highAttributes->attack_time, $ql);
615: $recharge_time = $this->util->interpolate($row->lowql, $row->highql, $lowAttributes->recharge_time, $highAttributes->recharge_time, $ql);
616: $recharge_time /= 100;
617: $attack_time /= 100;
618:
619: $blob = '';
620:
621: $blob .= "Attack: <highlight>$attack_time<end>\n";
622: $blob .= "Recharge: <highlight>$recharge_time<end>\n\n";
623:
624:
625: $blob .= $this->getInitDisplay($attack_time, $recharge_time);
626: $blob .= "\n\n";
627:
628: if ($highAttributes->full_auto !== null) {
629: $full_auto_recharge = $this->util->interpolate($row->lowql, $row->highql, $lowAttributes->full_auto, $highAttributes->full_auto, $ql);
630: list($hard_cap, $skill_cap) = $this->capFullAuto($attack_time, $recharge_time, $full_auto_recharge);
631: $blob .= "FullAutoRecharge: $full_auto_recharge -- You need <highlight>".$skill_cap."<end> Full Auto skill to cap your recharge at <highlight>".$hard_cap."<end>s.\n\n";
632: $found = true;
633: }
634: if ($highAttributes->burst !== null) {
635: $burst_recharge = $this->util->interpolate($row->lowql, $row->highql, $lowAttributes->burst, $highAttributes->burst, $ql);
636: list($hard_cap, $skill_cap) = $this->capBurst($attack_time, $recharge_time, $burst_recharge);
637: $blob .= "BurstRecharge: $burst_recharge -- You need <highlight>".$skill_cap."<end> Burst skill to cap your recharge at <highlight>".$hard_cap."<end>s.\n\n";
638: $found = true;
639: }
640: if ($highAttributes->fling_shot == 1) {
641: list($hard_cap, $skill_cap) = $this->capFlingShot($attack_time);
642: $blob .= "FlingRecharge: You need <highlight>".$skill_cap."<end> Fling Shot skill to cap your recharge at <highlight>".$hard_cap."<end>s.\n\n";
643: $found = true;
644: }
645: if ($highAttributes->fast_attack == 1) {
646: list($hard_cap, $skill_cap) = $this->capFastAttack($attack_time);
647: $blob .= "FastAttackRecharge: You need <highlight>".$skill_cap."<end> Fast Attack skill to cap your recharge at <highlight>".$hard_cap."<end>s.\n\n";
648: $found = true;
649: }
650: if ($highAttributes->aimed_shot == 1) {
651: list($hard_cap, $skill_cap) = $this->capAimedShot($attack_time, $recharge_time);
652: $blob .= "AimedShotRecharge: You need <highlight>".$skill_cap."<end> Aimed Shot skill to cap your recharge at <highlight>".$hard_cap."<end>s.\n\n";
653: $found = true;
654: }
655:
656:
657:
658:
659: if (!$found) {
660: $blob .= "There are no specials on this weapon that could be calculated.\n\n";
661: }
662:
663: $blob .= "Written by Tyrence (RK2)\n";
664: $msg = $this->text->makeBlob("Weapon Info for $name", $blob);
665:
666: $sendto->reply($msg);
667: }
668:
669: public function calcAttackTimeReduction($init_skill) {
670: if ($init_skill > 1200) {
671: $RechTk = $init_skill - 1200;
672: $attack_time_reduction = ($RechTk / 600) + 6;
673: } else {
674: $attack_time_reduction = ($init_skill / 200);
675: }
676:
677: return $attack_time_reduction;
678: }
679:
680: public function calcBarSetting($effective_attack_time) {
681: if ($effective_attack_time < 0) {
682: return 88 + (88 * $effective_attack_time);
683: } else if ($effective_attack_time > 0) {
684: return 88 + (12 * $effective_attack_time);
685: } else {
686: return 88;
687: }
688: }
689:
690: public function calcInits($attack_time) {
691: if ($attack_time < 0) {
692: return 0;
693: } else if ($attack_time < 6) {
694: return round($attack_time * 200, 2);
695: } else {
696: return round(1200 + ($attack_time - 6) * 600, 2);
697: }
698: }
699:
700: public function capFullAuto($attack_time, $recharge_time, $full_auto_recharge) {
701: $hard_cap = floor(10 + $attack_time);
702: $skill_cap = ((40 * $recharge_time) + ($full_auto_recharge / 100) - 11) * 25;
703:
704: return array($hard_cap, $skill_cap);
705: }
706:
707: public function capBurst($attack_time, $recharge_time, $burst_recharge) {
708: $hard_cap = round($attack_time + 8,0);
709: $skill_cap = floor((($recharge_time * 20) + ($burst_recharge / 100) - 8) * 25);
710:
711: return array($hard_cap, $skill_cap);
712: }
713:
714: public function capFlingShot($attack_time) {
715: $hard_cap = 5 + $attack_time;
716: $skill_cap = (($attack_time * 16) - $hard_cap) * 100;
717:
718: return array($hard_cap, $skill_cap);
719: }
720:
721: public function capFastAttack($attack_time) {
722: $hard_cap = 5 + $attack_time;
723: $skill_cap = (($attack_time * 16) - $hard_cap) * 100;
724:
725: return array($hard_cap, $skill_cap);
726: }
727:
728: public function capAimedShot($attack_time, $recharge_time) {
729: $hard_cap = floor($attack_time + 10);
730: $skill_cap = ceil((4000 * $recharge_time - 1100) / 3);
731:
732:
733:
734: return array($hard_cap, $skill_cap);
735: }
736:
737: public function fireinit($n) {
738: if ($n < 0) {
739: return 1;
740: } else {
741: return round($n * 600);
742: }
743: }
744:
745: public function rechargeinit($n) {
746: if ($n < 0) {
747: return 1;
748: } else {
749: return round($n * 300);
750: }
751: }
752:
753:
754: public function getInitDisplay($attack, $recharge) {
755:
756: $blob = '';
757: for ($i = 11; $i > -1; $i--) {
758: $perc = floor((100 / 11) * $i);
759: $diminish = 1 / 3;
760: $scale = 2 / 12;
761: $factor = -1.25 + ($scale * (12 - $i));
762: $init = max($this->fireinit($attack + $factor), $this->rechargeinit($recharge + $factor));
763: if ($init > 1200) {
764: $init = 1200 + (($init - 1200) / $diminish);
765: }
766: $init = ceil($init);
767:
768: $blob .= "DEF>";
769: for ($x = 0; $x < $i; $x++) {
770: $blob .= "=";
771: }
772: $blob .= "][";
773: for ($x = 12; $x > ($i + 1); $x--) {
774: $blob .= "=";
775: }
776: $blob .= "<AGG";
777: $blob .= " $init ($perc%)\n";
778: }
779: return $blob;
780: }
781: }
782: