1: <?php
2:
3: namespace Budabot\User\Modules;
4:
5: 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: class AlienBioController {
31:
32: 33: 34: 35:
36: public $moduleName;
37:
38:
39: public $db;
40:
41:
42: public $text;
43:
44:
45: public $itemsController;
46:
47:
48: public $logger;
49:
50: private $leArmorTypes = array('64', '295', '468', '935');
51: private $leWeaponTypes = array('18', '34', '687', '812');
52: private $aiArmorTypes = array('mutated', 'pristine');
53: private $aiWeaponTypes = array('1', '2', '3', '4', '5', '12', '13', '48', '76', '112', '240', '880', '992');
54:
55: 56: 57: 58:
59: public function setup() {
60:
61: $this->db->loadSQLFile($this->moduleName, 'alienweapons');
62: }
63:
64: 65: 66: 67: 68: 69:
70: public function bioCommand($message, $channel, $sender, $sendto, $args) {
71: $bio_regex = "<a href=\"itemref://(\\d+)/(\\d+)/(\\d+)\">Solid Clump of Kyr\'Ozch Bio-Material</a>";
72:
73: if (!preg_match("|^(( *${bio_regex})+)$|i", $args[1], $arr)) {
74: return false;
75: }
76:
77: $bios = explode("*", preg_replace("/> *</", ">*<", $arr[1]));
78: $blob = '';
79: forEach ($bios as $bio) {
80: preg_match("|^${bio_regex}$|i", trim($bio), $arr2);
81: $highid = $arr2[2];
82: $ql = $arr2[3];
83: switch ($highid) {
84: case 247707:
85: case 247708:
86: $bioinfo = "1";
87: $name = "Kyr'Ozch Bio-Material - Type 1";
88: break;
89: case 247709:
90: case 247710:
91: $bioinfo = "2";
92: $name = "Kyr'Ozch Bio-Material - Type 2";
93: break;
94: case 247717:
95: case 247718:
96: $bioinfo = "3";
97: $name = "Kyr'Ozch Bio-Material - Type 3 ";
98: break;
99: case 247711:
100: case 247712:
101: $bioinfo = "4";
102: $name = "Kyr'Ozch Bio-Material - Type 4";
103: break;
104: case 247713:
105: case 247714:
106: $bioinfo = "5";
107: $name = "Kyr'Ozch Bio-Material - Type 5";
108: break;
109: case 247715:
110: case 247716:
111: $bioinfo = "12";
112: $name = "Kyr'Ozch Bio-Material - Type 12 ";
113: break;
114: case 247719:
115: case 247720:
116: $bioinfo = "13";
117: $name = "Kyr'Ozch Bio-Material - Type 13";
118: break;
119: case 288699:
120: case 288700:
121: $bioinfo = "48";
122: $name = "Kyr'Ozch Bio-Material - Type 48";
123: break;
124: case 247697:
125: case 247698:
126: $bioinfo = "76";
127: $name = "Kyr'Ozch Bio-Material - Type 76";
128: break;
129: case 247699:
130: case 247700:
131: $bioinfo = "112";
132: $name = "Kyr'Ozch Bio-Material - Type 112";
133: break;
134: case 247701:
135: case 247702:
136: $bioinfo = "240";
137: $name = "Kyr'Ozch Bio-Material - Type 240";
138: break;
139: case 247703:
140: case 247704:
141: $bioinfo = "880";
142: $name = "Kyr'Ozch Bio-Material - Type 880";
143: break;
144: case 247705:
145: case 247706:
146: $bioinfo = "992";
147: $name = "Kyr'Ozch Bio-Material - Type 992";
148: break;
149: case 247102:
150: case 247103:
151: $bioinfo = "pristine";
152: $name = "Pristine Kyr'Ozch Bio-Material";
153: break;
154: case 247104:
155: case 247105:
156: $bioinfo = "mutated";
157: $name = "Mutated Kyr'Ozch Bio-Material";
158: break;
159: case 247764:
160: case 254804:
161: $bioinfo = "serum";
162: $name = "Kyr'Ozch Viral Serum";
163: break;
164: default:
165: $bioinfo = "";
166: $name = "Unknown Bio-Material";
167: continue;
168: }
169:
170: $biotypeLink = $this->text->makeChatcmd($name, "/tell <myname> bioinfo $bioinfo $ql");
171: $blob .= $biotypeLink . "\n\n";
172: }
173:
174: if (count($bios) == 1) {
175:
176: $this->bioinfoCommand("", $channel, $sender, $sendto, array("bioinfo $bioinfo $ql", $bioinfo, $ql));
177: } else {
178: $msg = $this->text->makeBlob("Identified Bio-Materials", $blob);
179: $sendto->reply($msg);
180: }
181: }
182:
183: 184: 185: 186:
187: public function bioinfoListCommand($message, $channel, $sender, $sendto, $args) {
188: $blob .= "<header2>OFAB Armor Types<end>\n";
189: $blob .= $this->getTypeBlob($this->leArmorTypes);
190:
191: $blob .= "\n<header2>OFAB Weapon Types<end>\n";
192: $blob .= $this->getTypeBlob($this->leWeaponTypes);
193:
194: $blob .= "\n<header2>AI Armor Types<end>\n";
195: $blob .= $this->getTypeBlob($this->aiArmorTypes);
196:
197: $blob .= "\n<header2>AI Weapon Types<end>\n";
198: $blob .= $this->getTypeBlob($this->aiWeaponTypes);
199:
200: $msg = $this->text->makeBlob("Bio-Material Types", $blob);
201: $sendto->reply($msg);
202: }
203:
204: public function getTypeBlob($types) {
205: $blob = '';
206: forEach ($types as $type) {
207: $blob .= $this->text->makeChatcmd($type, "/tell <myname> bioinfo $type") . "\n";
208: }
209: return $blob;
210: }
211:
212: 213: 214: 215: 216: 217:
218: public function bioinfoCommand($message, $channel, $sender, $sendto, $args) {
219: $bio = strtolower($args[1]);
220: $ql = 300;
221: if ($args[2]) {
222: $ql = $args[2];
223: }
224: if ($ql < 1) {
225: $ql = 1;
226: } else if ($ql > 300) {
227: $ql = 300;
228: }
229:
230: if (in_array($bio, $this->leArmorTypes)) {
231: $msg = $this->ofabArmorBio($ql, $bio);
232: } else if (in_array($bio, $this->leWeaponTypes)) {
233: $msg = $this->ofabWeaponBio($ql, $bio);
234: } else if (in_array($bio, $this->aiArmorTypes)) {
235: $msg = $this->alienArmorBio($ql, $bio);
236: } else if (in_array($bio, $this->aiWeaponTypes)) {
237: $msg = $this->alienWeaponBio($ql, $bio);
238: } else if ($bio == 'serum') {
239: $msg = $this->serumBio($ql, $bio);
240: } else {
241: $msg = "Unknown Bio-Material";
242: }
243:
244: $sendto->reply($msg);
245: }
246:
247: 248: 249: 250:
251: private function getWeaponInfo($ql) {
252: $ts_wep = floor($ql * 6);
253: $text .= "\n\n<highlight>QL $ql<end> is the highest weapon this type will combine into.";
254: if ($ql != 300) {
255: $text .= "\nNote: <highlight>The weapon can bump several QL's.<end>";
256: }
257: $text .= "\n\nIt will take <highlight>$ts_wep<end> ME & WS (<highlight>6 * QL<end>) to combine with a <highlight>QL $ql<end> Kyr'ozch Weapon.";
258:
259: return $text;
260: }
261:
262: 263: 264: 265:
266: private function ofabArmorBio($ql, $type) {
267: $name = "Kyr'Ozch Bio-Material - Type $type";
268: $item = $this->itemsController->getItem($name, $ql);
269:
270: $data = $this->db->query("SELECT * FROM ofabarmortype WHERE type = ?", $type);
271:
272: $blob = $item . "\n\n";
273: $blob .= "<highlight>Upgrades Ofab armor for:<end>\n";
274: forEach ($data as $row) {
275: $blob .= $this->text->makeChatcmd($row->profession, "/tell <myname> ofabarmor {$row->profession}") . "\n";
276: }
277:
278: return $this->text->makeBlob("$name (QL $ql)", $blob);
279: }
280:
281: 282: 283: 284:
285: private function ofabWeaponBio($ql, $type) {
286: $name = "Kyr'Ozch Bio-Material - Type $type";
287: $item = $this->itemsController->getItem($name, $ql);
288:
289: $data = $this->db->query("SELECT * FROM ofabweapons WHERE type = ?", $type);
290:
291: $blob = $item . "\n\n";
292: $blob .= "<highlight>Upgrades Ofab weapons:<end>\n";
293: forEach ($data as $row) {
294: $blob .= $this->text->makeChatcmd("Ofab {$row->name} Mk 1", "/tell <myname> ofabweapons {$row->name}") . "\n";
295: }
296:
297: return $this->text->makeBlob("$name (QL $ql)", $blob);
298: }
299:
300: 301: 302: 303: 304:
305: private function alienWeaponBio($ql, $type) {
306: $name = "Kyr'Ozch Bio-Material - Type $type";
307: $item = $this->itemsController->getItem($name, $ql);
308:
309:
310: $maxaitype = floor($ql / 0.9);
311: if ($maxaitype > 300 || $maxaitype < 1) {
312: $maxaitype = 300;
313: }
314:
315: $ts_bio = floor($ql * 4.5);
316:
317: $row = $this->db->queryRow("SELECT specials FROM alienweaponspecials WHERE type = ?", $type);
318: $specials = $row->specials;
319:
320: $data = $this->db->query("SELECT * FROM alienweapons WHERE type = ?", $type);
321:
322: $blob = $item . "\n\n";
323: $blob .= "It will take <highlight>$ts_bio<end> EE & CL (<highlight>4.5 * QL<end>) to analyze the Bio-Material.\n\n";
324:
325: $blob .= "<highlight>Adds {$specials} to:<end>\n";
326: forEach ($data as $row) {
327: $blob .= $this->itemsController->getItem($row->name, $maxaitype) . "\n";
328: }
329:
330: $blob .= $this->getWeaponInfo($maxaitype);
331: $blob .= "\n\n<yellow>Tradeskilling info added by Mdkdoc420 (RK2)<end>";
332:
333: return $this->text->makeBlob("$name (QL $ql)", $blob);
334: }
335:
336: 337: 338: 339:
340: private function alienArmorBio($ql, $type) {
341:
342: $min_ql = floor($ql * 0.8);
343: if ($min_ql < 1) {
344: $min_ql = 1;
345: }
346: if ($ql >= 1 && $ql <= 240) {
347: $max_ql = floor($ql / 0.8);
348: } else {
349: $max_ql = 300;
350: }
351:
352: $cl = floor($min_ql * 4.5);
353: $pharma = floor($ql * 6);
354: $np = floor($min_ql * 6);
355: $psyco = floor($ql * 6);
356: $max_psyco = floor($max_ql * 6);
357: $ts_bio = floor($ql * 4.5);
358: if (strtolower($type) == "mutated") {
359: $name = "Mutated Kyr'Ozch Bio-Material";
360: $chem = floor($ql * 7);
361: $chem_msg = "7 * QL";
362: } else if (strtolower($type) == "pristine") {
363: $name = "Pristine Kyr'Ozch Bio-Material";
364: $chem = floor($ql * 4.5);
365: $chem_msg = "4.5 * QL";
366: $extraInfo = "(<highlight>less tradeskill requirements then mutated.<end>)";
367: } else {
368: $name = "UNKNOWN";
369: }
370:
371:
372: $item = $this->itemsController->getItem($name, $ql);
373:
374: $blob = $item . "\n\n";
375: $blob .= "It will take <highlight>$ts_bio<end> EE & CL (<highlight>4.5 * QL<end>) to analyze the Bio-Material.\n\n";
376:
377: $blob .= "Used to build Alien Armor $extraInfo\n\n" .
378: "<highlight>The following tradeskill amounts are required to make<end> QL $ql<highlight>\n" .
379: "strong/arithmetic/enduring/spiritual/supple/observant armor:<end>\n\n" .
380: "Computer Literacy - <highlight>$cl<end> (<highlight>4.5 * QL<end>)\n" .
381: "Chemistry - <highlight>$chem<end> (<highlight>$chem_msg<end>)\n" .
382: "Nano Programming - <highlight>$np<end> (<highlight>6 * QL<end>)\n" .
383: "Pharma Tech - <highlight>$pharma<end> (<highlight>6 * QL<end>)\n" .
384: "Psychology - <highlight>$psyco<end> (<highlight>6 * QL<end>)\n\n" .
385: "Note:<highlight> Tradeskill requirements are based off the lowest QL items needed throughout the entire process.<end>";
386:
387: $blob .= "\n\nFor Supple, Arithmetic, or Enduring:\n\n" .
388: "<highlight>When completed, the armor piece can have as low as<end> QL $min_ql <highlight>combined into it, depending on available tradeskill options.\n\n" .
389: "Does not change QL's, therefore takes<end> $psyco <highlight>Psychology for available combinations.<end>\n\n" .
390: "For Spiritual, Strong, or Observant:\n\n" .
391: "<highlight>When completed, the armor piece can combine upto<end> QL $max_ql<highlight>, depending on available tradeskill options.\n\n" .
392: "Changes QL depending on targets QL. The max combination is: (<end>QL $max_ql<highlight>) (<end>$max_psyco Psychology required for this combination<highlight>)<end>";
393:
394: $blob .= "\n\n<yellow>Tradeskilling info added by Mdkdoc420 (RK2)<end>";
395:
396: return $this->text->makeBlob("$name (QL $ql)", $blob);
397: }
398:
399: 400: 401: 402:
403: private function serumBio($ql, $type) {
404: $name = "Kyr'Ozch Viral Serum";
405: $item = $this->itemsController->getItem($name, $ql);
406:
407: $pharma_ts = floor($ql * 3.5);
408: $chem_me_ts = floor($ql * 4);
409: $ee_ts = floor($ql * 4.5);
410: $cl_ts = floor($ql * 5);
411: $ts_bio = floor($ql * 4.5);
412:
413: $blob = $item . "\n\n";
414: $blob .= "It will take <highlight>$ts_bio<end> EE & CL (<highlight>4.5 * QL<end>) to analyze the Bio-Material.\n\n";
415:
416: $blob .= "<highlight>Used to build city buildings<end>\n\n" .
417: "<highlight>The following are the required skills throughout the process of making a building:<end>\n\n" .
418: "Quantum FT - <highlight>400<end> (<highlight>Static<end>)\nPharma Tech - ";
419:
420:
421: if ($pharma_ts < 400) {
422: $blob .= "<highlight>400<end>";
423: } else {
424: $blob .= "<highlight>$pharma_ts<end>";
425: }
426:
427: $blob .= " (<highlight>3.5 * QL<end>) 400 is minimum requirement\nChemistry - ";
428:
429: if ($chem_me_ts < 400) {
430: $blob .= "<highlight>400<end>";
431: } else {
432: $blob .= "<highlight>$chem_me_ts<end>";
433: }
434:
435: $blob .= " (<highlight>4 * QL<end>) 400 is minimum requirement\n" .
436: "Mechanical Engineering - <highlight>$chem_me_ts<end> (<highlight>4 * QL<end>)\n" .
437: "Electrical Engineering - <highlight>$ee_ts<end> (<highlight>4.5 * QL<end>)\n" .
438: "Comp Liter - <highlight>$cl_ts<end> (<highlight>5 * QL<end>)";
439:
440: $blob .= "\n\n<yellow>Tradeskilling info added by Mdkdoc420 (RK2)<end>";
441:
442: return $this->text->makeBlob("$name (QL $ql)", $blob);
443: }
444: }
445: