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:  *  - Neksus (RK2)
  9:  *  - Mdkdoc420 (RK2)
 10:  *
 11:  * @Instance
 12:  *
 13:  * Commands this controller contains:
 14:  *  @DefineCommand(
 15:  *      command     = 'dyna', 
 16:  *      accessLevel = 'all', 
 17:  *      description = 'Search for RK Dynabosses', 
 18:  *      help        = 'dyna.txt'
 19:  *  )
 20:  *  @DefineCommand(
 21:  *      command     = 'oe', 
 22:  *      accessLevel = 'all', 
 23:  *      description = 'Over-equipped calculation', 
 24:  *      help        = 'oe.txt'
 25:  *  )
 26:  *  @DefineCommand(
 27:  *      command     = 'calc', 
 28:  *      accessLevel = 'all', 
 29:  *      description = 'Calculator', 
 30:  *      help        = 'calculator.txt'
 31:  *  )
 32:  */
 33: class HelpbotController {
 34: 
 35:     /**
 36:      * Name of the module.
 37:      * Set automatically by module loader.
 38:      */
 39:     public $moduleName;
 40:     
 41:     /** @Inject */
 42:     public $db;
 43:     
 44:     /** @Inject */
 45:     public $text;
 46:     
 47:     /** @Inject */
 48:     public $util;
 49:     
 50:     /**
 51:      * This handler is called on bot startup.
 52:      * @Setup
 53:      */
 54:     public function setup() {
 55:         $this->db->loadSQLFile($this->moduleName, 'dyna');
 56:     }
 57:     
 58:     /**
 59:      * @HandlesCommand("dyna")
 60:      * @Matches("/^dyna ([0-9]+)$/i")
 61:      */
 62:     public function dynaLevelCommand($message, $channel, $sender, $sendto, $args) {
 63:         $search = $args[1];
 64:         $range1 = $search - 25;
 65:         $range2 = $search + 25;
 66:         $data = $this->db->query("SELECT * FROM dynadb d JOIN playfields p ON d.playfield_id = p.id WHERE minQl > ? AND minQl < ? ORDER BY `minQl`", $range1, $range2);
 67:         $count = count($data);
 68: 
 69:         $blob = "Results of Dynacamp Search for '$search'\n\n";
 70: 
 71:         $blob .= $this->formatResults($data);
 72:         
 73:         $blob .= "Dyna camp information taken from CSP help files: http://creativestudent.com/ao/files-helpfiles.html";
 74: 
 75:         $msg = $this->text->makeBlob("Dynacamps ($count)", $blob);
 76:         $sendto->reply($msg);
 77:     }
 78:     
 79:     /**
 80:      * @HandlesCommand("dyna")
 81:      * @Matches("/^dyna (.+)$/i")
 82:      */
 83:     public function dynaNameCommand($message, $channel, $sender, $sendto, $args) {
 84:         $search = str_replace(" ", "%", $args[1]);
 85:         $data = $this->db->query("SELECT * FROM dynadb d JOIN playfields p ON d.playfield_id = p.id WHERE long_name LIKE ? OR short_name LIKE ? OR mob LIKE ? ORDER BY `minQl`", "%{$search}%", "%{$search}%", "%{$search}%");
 86:         $count = count($data);
 87: 
 88:         $blob = "Results of Dynacamp Search for '$search'\n\n";
 89: 
 90:         $blob .= $this->formatResults($data);
 91:         
 92:         $blob .= "Dyna camp information taken from CSP help files: http://creativestudent.com/ao/files-helpfiles.html";
 93: 
 94:         $msg = $this->text->makeBlob("Dynacamps ($count)", $blob);
 95:         $sendto->reply($msg);
 96:     }
 97:     
 98:     private function formatResults($data) {
 99:         $blob = '';
100:         forEach($data as $row) {
101:             $coordLink = $this->text->makeChatcmd("{$row->long_name} {$row->cX}x{$row->cY}", "/waypoint $row->cX $row->cY $row->playfield_id");
102:             $blob .="<pagebreak>$coordLink\n";
103:             $blob .="$row->mob - Level <highlight>{$row->minQl}-{$row->maxQl}<end>\n\n";
104:         }
105:         return $blob;
106:     }
107:     
108:     /**
109:      * @HandlesCommand("oe")
110:      * @Matches("/^oe ([0-9]+)$/i")
111:      */
112:     public function oeCommand($message, $channel, $sender, $sendto, $args) {
113:         $oe = $args[1];
114:         $oe100 = (int)floor($oe / 0.8);
115:         $lowoe100 = (int)floor($oe * 0.8);
116:         $oe75 = (int)floor($oe / 0.6);
117:         $lowoe75 = (int)floor($oe * 0.6);
118:         $oe50 = (int)floor($oe / 0.4);
119:         $lowoe50 = (int)floor($oe * 0.4);
120:         $oe25 = (int)floor($oe / 0.2);
121:         $lowoe25 = (int)floor($oe * 0.2);
122: 
123:         $blob = "With a skill requirement of <highlight>$oe<end>, you will be\n".
124:             "Out of OE: <highlight>$lowoe100<end> or higher\n".
125:             "75%: <highlight>$lowoe75<end> - <highlight>" .($lowoe100 - 1). "<end>\n".
126:             "50%: <highlight>" .($lowoe50 + 1). "<end> - <highlight>" .($lowoe75 - 1). "<end>\n".
127:             "25%: <highlight>" .($lowoe25 + 1). "<end> - <highlight>$lowoe50<end>\n".
128:             "0%: <highlight>$lowoe25<end> or lower\n\n".
129:             "With a personal skill of <highlight>$oe<end>, you can use up to and be\n".
130:             "Out of OE: <highlight>$oe100<end> or lower\n".
131:             "75%: <highlight>" .($oe100 + 1). "<end> - <highlight>$oe75<end>\n".
132:             "50%: <highlight>" .($oe75 + 1). "<end> - <highlight>" .($oe50 - 1). "<end>\n".
133:             "25%: <highlight>$oe50<end> - <highlight>" .($oe25 - 1). "<end>\n".
134:             "0%: <highlight>$oe25<end> or higher\n\n".
135:             "WARNING: May be plus/minus 1 point!";
136: 
137:         $msg = "<highlight>{$lowoe100}<end> - {$oe} - <highlight>{$oe100}<end> " . $this->text->makeBlob('More info', $blob, 'Over-equipped Calculation');
138: 
139:         $sendto->reply($msg);
140:     }
141:     
142:     /**
143:      * @HandlesCommand("calc")
144:      * @Matches("/^calc (.+)$/i")
145:      */
146:     public function calcCommand($message, $channel, $sender, $sendto, $args) {
147:         $calc = strtolower($args[1]);
148: 
149:         // check if the calc string includes not allowed chars
150:         $calc_check = strspn($calc, "0123456789.,+-*x%()/\\ ");
151: 
152:         // if no wrong char found
153:         if ($calc_check == strlen($calc)) {
154:             $result = "";
155:             // do the calculations
156:             $calc = "\$result = ".$calc.";";
157:             eval($calc);
158:             // if calculation is succesful
159:             if (is_numeric($result)) {
160:                 $result = round($result, 4);
161:                 $msg = $args[1]." = <highlight>".$result."<end>";
162:                 $sendto->reply($msg);
163:             } else {
164:                 return false;
165:             }
166:         } else {
167:             return false;
168:         }
169:     }
170: }
171: 
Budabot 4 Docs API documentation generated by ApiGen