1: <?php
2:
3: namespace Budabot\User\Modules;
4:
5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
19: class PlayerHistoryController {
20:
21: 22: 23: 24:
25: public $moduleName;
26:
27:
28: public $chatBot;
29:
30:
31: public $text;
32:
33:
34: public $playerHistoryManager;
35:
36: 37: 38: 39: 40:
41: public function playerHistoryCommand($message, $channel, $sender, $sendto, $args) {
42: $name = ucfirst(strtolower($args[1]));
43: $rk_num = $this->chatBot->vars['dimension'];
44: if (count($args) == 3) {
45: $rk_num = $args[2];
46: }
47:
48: $history = $this->playerHistoryManager->lookup($name, $rk_num);
49: if ($history === null) {
50: $msg = "Could not get History of $name on RK$rk_num.";
51: } else {
52: $blob = "Date Level AI Faction Breed Guild (rank)\n";
53: $blob .= "________________________________________________ \n";
54: forEach ($history->data as $entry) {
55: $date = date("d-M-Y", $entry->last_changed);
56:
57: if ($entry->deleted == 1) {
58: $blob .= "$date | <red>DELETED<end>\n";
59: } else {
60: if ($entry->defender_rank == "") {
61: $ailevel = "<green>0<end>";
62: } else {
63: $ailevel = "<green>$entry->defender_rank<end>";
64: }
65:
66: if ($entry->faction == "Omni") {
67: $faction = "<omni>Omni<end>";
68: } else if ($entry->faction == "Clan") {
69: $faction = "<clan>Clan<end>";
70: } else {
71: $faction = "<neutral>Neutral<end>";
72: }
73:
74: if ($entry->guild_name == "") {
75: $guild = "Not in a guild";
76: } else {
77: $guild = $entry->guild_name . " (" . $entry->guild_rank_name . ")";
78: }
79:
80: $blob .= "$date | $entry->level | $ailevel | $faction | $entry->breed | $guild\n";
81: }
82: }
83: $blob .= "\nHistory provided by Auno.org, Chrisax, and Athen Paladins";
84: $msg = $this->text->makeBlob("History of $name for RK{$rk_num}", $blob);
85: }
86:
87: $sendto->reply($msg);
88: }
89: }
90: