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     = 'playfields', 
 14:  *      accessLevel = 'all', 
 15:  *      description = 'Show playfield ids, long names, and short names', 
 16:  *      help        = 'waypoint.txt'
 17:  *  )
 18:  *  @DefineCommand(
 19:  *      command     = 'waypoint', 
 20:  *      accessLevel = 'all', 
 21:  *      description = 'Create a waypoint link', 
 22:  *      help        = 'waypoint.txt'
 23:  *  )
 24:  */
 25: class PlayfieldController {
 26: 
 27:     /**
 28:      * Name of the module.
 29:      * Set automatically by module loader.
 30:      */
 31:     public $moduleName;
 32:     
 33:     /** @Inject */
 34:     public $db;
 35:     
 36:     /** @Inject */
 37:     public $commandAlias;
 38: 
 39:     /** @Inject */
 40:     public $text;
 41:     
 42:     /** @Inject */
 43:     public $util;
 44:     
 45:     /**
 46:      * This handler is called on bot startup.
 47:      * @Setup
 48:      */
 49:     public function setup() {
 50:         $this->db->loadSQLFile($this->moduleName, 'playfields');
 51:         
 52:         $this->commandAlias->register($this->moduleName, "playfields", "playfield");
 53:     }
 54: 
 55:     /**
 56:      * @HandlesCommand("playfields")
 57:      * @Matches("/^playfields$/i")
 58:      */
 59:     public function playfieldListCommand($message, $channel, $sender, $sendto, $args) {
 60:         $blob = '';
 61: 
 62:         $sql = "SELECT * FROM playfields ORDER BY long_name";
 63:         $data = $this->db->query($sql);
 64:         forEach ($data as $row) {
 65:             $blob .= "[<highlight>{$row->id}<end>] {$row->long_name} ({$row->short_name})\n";
 66:         }
 67: 
 68:         $msg = $this->text->makeBlob("Playfields", $blob);
 69:         $sendto->reply($msg);
 70:     }
 71:     
 72:     /**
 73:      * @HandlesCommand("playfields")
 74:      * @Matches("/^playfields (.+)$/i")
 75:      */
 76:     public function playfieldShowCommand($message, $channel, $sender, $sendto, $args) {
 77:         $search = strtolower(trim($args[1]));
 78:         
 79:         list($longQuery, $longParams) = $this->util->generateQueryFromParams(explode(' ', $search), 'long_name');
 80:         list($shortQuery, $shortParams) = $this->util->generateQueryFromParams(explode(' ', $search), 'short_name');
 81:         
 82:         $params = array_merge($longParams, $shortParams);
 83:         
 84:         $data = $this->db->query("SELECT * FROM playfields WHERE ($longQuery) OR ($shortQuery)", $params);
 85: 
 86:         $count = count($data);
 87: 
 88:         if ($count > 1) {
 89:             $blob = "Result of Playfield Search for '$search'\n\n";
 90:             forEach ($data as $row) {
 91:                 $blob .= "[<highlight>$row->id<end>] $row->long_name\n\n";
 92:             }
 93: 
 94:             $msg = $this->text->makeBlob("Playfields ($count)", $blob);
 95:         } else if ($count == 1) {
 96:             $row = $data[0];
 97:             $msg = "[<highlight>$row->id<end>] $row->long_name";
 98:         } else {
 99:             $msg = "There were no matches for your search.";
100:         }
101:         $sendto->reply($msg);
102:     }
103: 
104:     /**
105:      * @HandlesCommand("waypoint")
106:      * @Matches("/^waypoint Pos: ([0-9\\.]+), ([0-9\\.]+), ([0-9\\.]+), Area: ([a-zA-Z ]+)/i")
107:      */
108:     public function waypoint1Command($message, $channel, $sender, $sendto, $args) {
109:         //Pos: ([0-9\\.]+), ([0-9\\.]+), ([0-9\\.]+), Area: (.+)
110:         $xCoords = $args[1];
111:         $yCoords = $args[2];
112:         
113:         $playfieldName = $args[4];
114:         
115:         $playfield = $this->getPlayfieldByName($playfieldName);
116:         $sendto->reply($this->processWaypointCommand($xCoords, $yCoords, $playfield->short_name, $playfield->id));
117:     }
118:     
119:     /**
120:      * @HandlesCommand("waypoint")
121:      * @Matches("/^waypoint \(?([0-9.]+) ([0-9.]+) y ([0-9.]+) ([0-9]+)\)?$/i")
122:      */
123:     public function waypoint2Command($message, $channel, $sender, $sendto, $args) {
124:         $xCoords = $args[1];
125:         $yCoords = $args[2];
126:         $playfieldId = $args[4];
127: 
128:         $playfield = $this->getPlayfieldById($playfieldId);
129:         if ($playfield === null) {
130:             $playfieldName = $playfieldId;
131:         } else {
132:             $playfieldName = $playfield->short_name;
133:         }
134:         
135:         $sendto->reply($this->processWaypointCommand($xCoords, $yCoords, $playfieldName, $playfieldId));
136:     }
137:     
138:     /**
139:      * @HandlesCommand("waypoint")
140:      * @Matches("/^waypoint ([0-9.]+)([x,. ]+)([0-9.]+)([x,. ]+)([0-9]+)$/i")
141:      */
142:     public function waypoint3Command($message, $channel, $sender, $sendto, $args) {
143:         $xCoords = $args[1];
144:         $yCoords = $args[3];
145:         $playfieldId = $args[5];
146: 
147:         $playfield = $this->getPlayfieldById($playfieldId);
148:         if ($playfield === null) {
149:             $playfieldName = $playfieldId;
150:         } else {
151:             $playfieldName = $playfield->short_name;
152:         }
153:         
154:         $sendto->reply($this->processWaypointCommand($xCoords, $yCoords, $playfieldName, $playfieldId));
155:     }
156:     
157:     /**
158:      * @HandlesCommand("waypoint")
159:      * @Matches("/^waypoint ([0-9\\.]+)([x,. ]+)([0-9\\.]+)([x,. ]+)(.+)$/i")
160:      */
161:     public function waypoint4Command($message, $channel, $sender, $sendto, $args) {
162:         $xCoords = $args[1];
163:         $yCoords = $args[3];
164:         $playfieldName = $args[5];
165: 
166:         $playfield = $this->getPlayfieldByName($playfieldName);
167:         if ($playfield === null) {
168:             $sendto->reply("Could not find playfield '$playfieldName'.");
169:         } else {
170:             $playfieldId = $playfield->id;
171:             $playfieldName = $playfield->short_name;
172:             $sendto->reply($this->processWaypointCommand($xCoords, $yCoords, $playfieldName, $playfieldId));
173:         }
174:     }
175:     
176:     private function processWaypointCommand($xCoords, $yCoords, $playfieldName, $playfieldId) {
177:         $link = $this->text->makeChatcmd("waypoint: {$xCoords}x{$yCoords} {$playfieldName}", "/waypoint {$xCoords} {$yCoords} {$playfieldId}");
178:         $blob = "Click here to use waypoint: $link";
179:         return $this->text->makeBlob("waypoint: {$xCoords}x{$yCoords} {$playfieldName}", $blob);
180:     }
181:     
182:     public function getPlayfieldByName($playfieldName) {
183:         $sql = "SELECT * FROM playfields WHERE `long_name` LIKE ? OR `short_name` LIKE ? LIMIT 1";
184: 
185:         return $this->db->queryRow($sql, $playfieldName, $playfieldName);
186:     }
187: 
188:     public function getPlayfieldById($playfieldId) {
189:         $sql = "SELECT * FROM playfields WHERE `id` = ?";
190: 
191:         return $this->db->queryRow($sql, $playfieldId);
192:     }
193: }
194: 
Budabot 4 Docs API documentation generated by ApiGen