Overview

Namespaces

  • Budabot
    • Core
      • Modules
    • User
      • Modules
  • None
  • Tyrence
    • Modules

Classes

  • AccessLevel
  • Budabot\Core\AccessManager
  • Budabot\Core\AdminManager
  • Budabot\Core\AOChat
  • Budabot\Core\AOChatPacket
  • Budabot\Core\AOChatQueue
  • Budabot\Core\AOExtMsg
  • Budabot\Core\AsyncHttp
  • Budabot\Core\AutoInject
  • Budabot\Core\BotRunner
  • Budabot\Core\Budabot
  • Budabot\Core\BuddylistManager
  • Budabot\Core\CacheManager
  • Budabot\Core\CacheResult
  • Budabot\Core\ClassLoader
  • Budabot\Core\ColorSettingHandler
  • Budabot\Core\CommandAlias
  • Budabot\Core\CommandManager
  • Budabot\Core\ConfigFile
  • Budabot\Core\DB
  • Budabot\Core\DBRow
  • Budabot\Core\EventLoop
  • Budabot\Core\EventManager
  • Budabot\Core\GuildChannelCommandReply
  • Budabot\Core\GuildManager
  • Budabot\Core\HelpManager
  • Budabot\Core\Http
  • Budabot\Core\HttpRequest
  • Budabot\Core\LegacyLogger
  • Budabot\Core\LimitsController
  • Budabot\Core\LoggerWrapper
  • Budabot\Core\MMDBParser
  • Budabot\Core\Modules\AdminController
  • Budabot\Core\Modules\AliasController
  • Budabot\Core\Modules\AltInfo
  • Budabot\Core\Modules\AltsController
  • Budabot\Core\Modules\BanController
  • Budabot\Core\Modules\BuddylistController
  • Budabot\Core\Modules\ColorsController
  • Budabot\Core\Modules\CommandlistController
  • Budabot\Core\Modules\CommandSearchController
  • Budabot\Core\Modules\ConfigController
  • Budabot\Core\Modules\EventlistController
  • Budabot\Core\Modules\HelpController
  • Budabot\Core\Modules\LogsController
  • Budabot\Core\Modules\PlayerLookupController
  • Budabot\Core\Modules\ProfileCommandReply
  • Budabot\Core\Modules\ProfileController
  • Budabot\Core\Modules\SettingsController
  • Budabot\Core\Modules\SQLController
  • Budabot\Core\Modules\SystemController
  • Budabot\Core\Modules\UsageController
  • Budabot\Core\Modules\WhitelistController
  • Budabot\Core\NumberSettingHandler
  • Budabot\Core\OptionsSettingHandler
  • Budabot\Core\PlayerHistory
  • Budabot\Core\PlayerHistoryManager
  • Budabot\Core\PlayerManager
  • Budabot\Core\Preferences
  • Budabot\Core\PrivateChannelCommandReply
  • Budabot\Core\PrivateMessageCommandReply
  • Budabot\Core\Registry
  • Budabot\Core\SettingHandler
  • Budabot\Core\SettingManager
  • Budabot\Core\SettingObject
  • Budabot\Core\SocketManager
  • Budabot\Core\SocketNotifier
  • Budabot\Core\SubcommandManager
  • Budabot\Core\Text
  • Budabot\Core\TextSettingHandler
  • Budabot\Core\Timer
  • Budabot\Core\TimerEvent
  • Budabot\Core\TimeSettingHandler
  • Budabot\Core\Util
  • Budabot\Core\xml
  • Budabot\User\Modules\AlienArmorController
  • Budabot\User\Modules\AlienBioController
  • Budabot\User\Modules\AlienMiscController
  • Budabot\User\Modules\AOSpeakController
  • Budabot\User\Modules\AOUController
  • Budabot\User\Modules\AXPController
  • Budabot\User\Modules\BankController
  • Budabot\User\Modules\BosslootController
  • Budabot\User\Modules\BroadcastController
  • Budabot\User\Modules\BuffPerksController
  • Budabot\User\Modules\CacheController
  • Budabot\User\Modules\ChatAssistController
  • Budabot\User\Modules\ChatCheckController
  • Budabot\User\Modules\ChatLeaderController
  • Budabot\User\Modules\ChatRallyController
  • Budabot\User\Modules\ChatSayController
  • Budabot\User\Modules\ChatTopicController
  • Budabot\User\Modules\CityWaveController
  • Budabot\User\Modules\CloakController
  • Budabot\User\Modules\ClusterController
  • Budabot\User\Modules\CountdownController
  • Budabot\User\Modules\DevController
  • Budabot\User\Modules\DingController
  • Budabot\User\Modules\EventsController
  • Budabot\User\Modules\FightController
  • Budabot\User\Modules\FindOrgController
  • Budabot\User\Modules\FindPlayerController
  • Budabot\User\Modules\FunController
  • Budabot\User\Modules\GitController
  • Budabot\User\Modules\GuideController
  • Budabot\User\Modules\GuildController
  • Budabot\User\Modules\HelpbotController
  • Budabot\User\Modules\HtmlDecodeController
  • Budabot\User\Modules\ImplantController
  • Budabot\User\Modules\ImplantDesignerController
  • Budabot\User\Modules\InactiveMemberController
  • Budabot\User\Modules\ItemsController
  • Budabot\User\Modules\KillOnSightController
  • Budabot\User\Modules\LevelController
  • Budabot\User\Modules\LinksController
  • Budabot\User\Modules\LootListsController
  • Budabot\User\Modules\MdbController
  • Budabot\User\Modules\MessageInfoCommandReply
  • Budabot\User\Modules\MockCommandReply
  • Budabot\User\Modules\NanoController
  • Budabot\User\Modules\NewsController
  • Budabot\User\Modules\NotesController
  • Budabot\User\Modules\OnlineController
  • Budabot\User\Modules\OrgHistoryController
  • Budabot\User\Modules\OrglistController
  • Budabot\User\Modules\OrgMembersController
  • Budabot\User\Modules\OSController
  • Budabot\User\Modules\PlayerHistoryController
  • Budabot\User\Modules\PlayfieldController
  • Budabot\User\Modules\PocketbossController
  • Budabot\User\Modules\PremadeImplantController
  • Budabot\User\Modules\PrivateChannelController
  • Budabot\User\Modules\QuoteController
  • Budabot\User\Modules\RaffleController
  • Budabot\User\Modules\RaidController
  • Budabot\User\Modules\RandomController
  • Budabot\User\Modules\RecipeController
  • Budabot\User\Modules\RelayController
  • Budabot\User\Modules\ReputationController
  • Budabot\User\Modules\ResearchController
  • Budabot\User\Modules\RunAsController
  • Budabot\User\Modules\SendTellController
  • Budabot\User\Modules\ShoppingController
  • Budabot\User\Modules\SilenceController
  • Budabot\User\Modules\SkillsController
  • Budabot\User\Modules\SpiritsController
  • Budabot\User\Modules\StopwatchController
  • Budabot\User\Modules\Teamspeak3
  • Budabot\User\Modules\TeamspeakController
  • Budabot\User\Modules\TestController
  • Budabot\User\Modules\TimeController
  • Budabot\User\Modules\TimerController
  • Budabot\User\Modules\TimezoneController
  • Budabot\User\Modules\TowerController
  • Budabot\User\Modules\TrackerController
  • Budabot\User\Modules\TrickleController
  • Budabot\User\Modules\UnixtimeController
  • Budabot\User\Modules\VoteController
  • Budabot\User\Modules\WeatherController
  • Budabot\User\Modules\WhatBuffsController
  • Budabot\User\Modules\WhereisController
  • Budabot\User\Modules\WhoisController
  • Budabot\User\Modules\WhoisOrgController
  • Budabot\User\Modules\WhompahController
  • Command
  • DefaultStatus
  • DefineCommand
  • Description
  • Event
  • HandlesCommand
  • Help
  • Inject
  • Instance
  • Intoptions
  • Matches
  • Options
  • Setting
  • Setup
  • Type
  • Tyrence\Modules\DemoResponseCommandReply
  • Tyrence\Modules\SameChannelResponseController
  • Visibility

Interfaces

  • Budabot\Core\CommandReply

Exceptions

  • Budabot\Core\InvalidHttpRequest
  • Budabot\Core\SQLException
  • Budabot\Core\StopExecutionException

Functions

  • Budabot\Core\isWindows
  • Budabot\Core\Modules\read_input
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: namespace Budabot\User\Modules;
  4: 
  5: /**
  6:  * Authors: 
  7:  *  - Tyrence (RK2)
  8:  *
  9:  * @Instance
 10:  *
 11:  * Commands this controller contains:
 12:  *  @DefineCommand(
 13:  *      command     = 'pocketboss',
 14:  *      accessLevel = 'all',
 15:  *      description = 'Shows what symbiants a pocketboss drops',
 16:  *      help        = 'pocketboss.txt',
 17:  *      alias       = 'pb'
 18:  *  )
 19:  *  @DefineCommand(
 20:  *      command     = 'symbiant',
 21:  *      accessLevel = 'all',
 22:  *      description = 'Shows which pocketbosses drop a symbiant',
 23:  *      help        = 'symbiant.txt',
 24:  *      alias       = 'symb'
 25:  *  )
 26:  */
 27: class PocketbossController {
 28: 
 29:     /**
 30:      * Name of the module.
 31:      * Set automatically by module loader.
 32:      */
 33:     public $moduleName;
 34: 
 35:     /** @Inject */
 36:     public $text;
 37:     
 38:     /** @Inject */
 39:     public $util;
 40:     
 41:     /** @Inject */
 42:     public $db;
 43:     
 44:     /**
 45:      * This handler is called on bot startup.
 46:      * @Setup
 47:      */
 48:     public function setup() {
 49:         $this->db->loadSQLFile($this->moduleName, "pocketboss");
 50:     }
 51:     
 52:     /**
 53:      * @HandlesCommand("pocketboss")
 54:      * @Matches("/^pocketboss (.+)$/i")
 55:      */
 56:     public function pocketbossCommand($message, $channel, $sender, $sendto, $args) {
 57:         $search = $args[1];
 58:         $data = $this->pbSearchResults($search);
 59:         $numrows = count($data);
 60:         if ($numrows == 0) {
 61:             $msg = "Could not find any pocket bosses that matched your search criteria.";
 62:         } else if ($numrows == 1) {
 63:             $name = $data[0]->pb;
 64:             $blob .= $this->singlePbBlob($name);
 65:             $msg = $this->text->makeBlob("Remains of $name", $blob);
 66:         } else {
 67:             $blob = '';
 68:             forEach ($data as $row) {
 69:                 $pbLink = $this->text->makeChatcmd($row->pb, "/tell <myname> pocketboss $row->pb");
 70:                 $blob .= $pbLink . "\n";
 71:             }
 72:             $msg = $this->text->makeBlob("Search results for $search ($numrows)", $blob);
 73:         }
 74:         $sendto->reply($msg);
 75:     }
 76:     
 77:     public function singlePbBlob($name) {
 78:         $data = $this->db->query("SELECT * FROM pocketboss WHERE pb = ? ORDER BY ql", $name);
 79:         $symbs = '';
 80:         forEach ($data as $symb) {
 81:             $name = "$symb->line $symb->slot Symbiant, $symb->type Unit Aban";
 82:             $symbs .= $this->text->makeItem($symb->itemid, $symb->itemid, $symb->ql, $name) . " ($symb->ql)\n";
 83:         }
 84:         
 85:         $blob = "Location: <highlight>$symb->pb_location, $symb->bp_location<end>\n";
 86:         $blob .= "Found on: <highlight>$symb->bp_mob, Level $symb->bp_lvl<end>\n\n";
 87:         $blob .= $symbs;
 88: 
 89:         return $blob;
 90:     }
 91:     
 92:     public function pbSearchResults($search) {
 93:         $row = $this->db->queryRow("SELECT pb FROM pocketboss WHERE pb LIKE ? GROUP BY `pb` ORDER BY `pb`", $search);
 94:         if ($row !== null) {
 95:             return array($row);
 96:         }
 97:         
 98:         $tmp = explode(" ", $search);
 99:         list($query, $params) = $this->util->generateQueryFromParams($tmp, '`pb`');
100: 
101:         return $this->db->query("SELECT DISTINCT pb FROM pocketboss WHERE $query GROUP BY `pb` ORDER BY `pb`", $params);
102:     }
103:     
104:     /**
105:      * @HandlesCommand("symbiant")
106:      * @Matches("/^symbiant ([a-z]+)$/i")
107:      * @Matches("/^symbiant ([a-z]+) ([a-z]+)$/i")
108:      * @Matches("/^symbiant ([a-z]+) ([a-z]+) ([a-z]+)$/i")
109:      */
110:     public function symbiantCommand($message, $channel, $sender, $sendto, $args) {
111:         $paramCount = count($args) - 1;
112: 
113:         $slot = '%';
114:         $symbtype = '%';
115:         $line = '%';
116:         
117:         $lines = $this->db->query("SELECT DISTINCT line FROM pocketboss");
118: 
119:         for ($i = 1; $i <= $paramCount; $i++) {
120:             switch (strtolower($args[$i])) {
121:                 case "eye":
122:                 case "ocular":
123:                     $impDesignSlot = 'eye';
124:                     $slot = "Ocular";
125:                     break;
126:                 case "brain":
127:                 case "head":
128:                     $impDesignSlot = 'head';
129:                     $slot = "Brain";
130:                     break;
131:                 case "ear":
132:                     $impDesignSlot = 'ear';
133:                     $slot = "Ear";
134:                     break;
135:                 case "rarm":
136:                     $impDesignSlot = 'rarm';
137:                     $slot = "Right Arm";
138:                     break;
139:                 case "chest":
140:                     $impDesignSlot = 'chest';
141:                     $slot = "Chest";
142:                     break;
143:                 case "larm":
144:                     $impDesignSlot = 'larm';
145:                     $slot = "Left Arm";
146:                     break;
147:                 case "rwrist":
148:                     $impDesignSlot = 'rwrist';
149:                     $slot = "Right Wrist";
150:                     break;
151:                 case "waist":
152:                     $impDesignSlot = 'waist';
153:                     $slot = "Waist";
154:                     break;
155:                 case "lwrist":
156:                     $impDesignSlot = 'lwrist';
157:                     $slot = "Left Wrist";
158:                     break;
159:                 case "rhand":
160:                     $impDesignSlot = 'rhand';
161:                     $slot = "Right Hand";
162:                     break;
163:                 case "leg":
164:                 case "legs":
165:                 case "thigh":
166:                     $impDesignSlot = 'legs';
167:                     $slot = "Thigh";
168:                     break;
169:                 case "lhand":
170:                     $impDesignSlot = 'lhand';
171:                     $slot = "Left Hand";
172:                     break;
173:                 case "feet":
174:                     $impDesignSlot = 'feet';
175:                     $slot = "Feet";
176:                     break;
177:                 default:
178:                     // check if it's a line
179:                     forEach ($lines as $l) {
180:                         if (strtolower($l->line) == strtolower($args[$i])) {
181:                             $line = $l->line;
182:                             break 2;
183:                         }
184:                     }
185: 
186:                     // check if it's a type
187:                     if (preg_match("/^art/i", $args[$i])) {
188:                         $symbtype = "Artillery";
189:                     } else if (preg_match("/^sup/i", $args[$i])) {
190:                         $symbtype = "Support";
191:                     } else if (preg_match("/^inf/i", $args[$i])) {
192:                         $symbtype = "Infantry";
193:                     } else if (preg_match("/^ext/i", $args[$i])) {
194:                         $symbtype = "Extermination";
195:                     } else if (preg_match("/^control/i", $args[$i])) {
196:                         $symbtype = "Control";
197:                     } else {
198:                         return false;
199:                     }
200:             }
201:         }
202: 
203:         $data = $this->db->query("SELECT * FROM pocketboss WHERE `slot` LIKE ? AND `type` LIKE ? AND `line` LIKE ? ORDER BY `ql` DESC, `type` ASC", $slot, $symbtype, $line);
204:         $numrows = count($data);
205:         if ($numrows != 0) {
206:             $implantDesignerLink = $this->text->makeChatcmd("implant designer", "/tell <myname> implantdesigner");
207:             $blob = "Click 'Add' to add symbiant to $implantDesignerLink.\n\n";
208:             forEach ($data as $row) {
209:                 $name = "$row->line $row->slot Symbiant, $row->type Unit Aban";
210:                 $impDesignerAddLink = $this->text->makeChatcmd("Add", "/tell <myname> implantdesigner $impDesignSlot symb $name");
211:                 $blob .= "<pagebreak>" . $this->text->makeItem($row->itemid, $row->itemid, $row->ql, $name)." ($row->ql) $impDesignerAddLink\n";
212:                 $blob .= "Found on " . $this->text->makeChatcmd($row->pb, "/tell <myname> pb $row->pb");
213:                 $blob .= "\n\n";
214:             }
215:             $msg = $this->text->makeBlob("Symbiant Search Results ($numrows)", $blob);
216:         } else {
217:             $msg = "Could not find any symbiants that matched your search criteria.";
218:         }
219: 
220:         $sendto->reply($msg);
221:     }
222: }
223: 
Budabot 4 Docs API documentation generated by ApiGen