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:  *  - Derroylo (RK2)
  9:  *  - Legendadv (RK2)
 10:  *
 11:  * @Instance
 12:  *
 13:  * Commands this controller contains:
 14:  *  @DefineCommand(
 15:  *      command     = 'level', 
 16:  *      accessLevel = 'all', 
 17:  *      description = 'Show level ranges', 
 18:  *      help        = 'level.txt'
 19:  *  )
 20:  *  @DefineCommand(
 21:  *      command     = 'missions', 
 22:  *      accessLevel = 'all', 
 23:  *      description = 'Shows what ql missions a character can roll', 
 24:  *      help        = 'missions.txt',
 25:  *      alias       = 'mission'
 26:  *  )
 27:  *  @DefineCommand(
 28:  *      command     = 'xp', 
 29:  *      accessLevel = 'all', 
 30:  *      description = 'Show xp/sk needed for specified level(s)', 
 31:  *      help        = 'xp.txt',
 32:  *      alias       = 'sk'
 33:  *  )
 34:  */
 35: class LevelController {
 36: 
 37:     /**
 38:      * Name of the module.
 39:      * Set automatically by module loader.
 40:      */
 41:     public $moduleName;
 42: 
 43:     /** @Inject */
 44:     public $db;
 45:     
 46:     /** @Inject */
 47:     public $commandAlias;
 48:     
 49:     /**
 50:      * This handler is called on bot startup.
 51:      * @Setup
 52:      */
 53:     public function setup() {
 54:         $this->db->loadSQLFile($this->moduleName, 'levels');
 55:         
 56:         $this->commandAlias->register($this->moduleName, "level", "pvp");
 57:         $this->commandAlias->register($this->moduleName, "level", "lvl");
 58:     }
 59: 
 60:     /**
 61:      * @HandlesCommand("level")
 62:      * @Matches("/^level ([0-9]+)$/i")
 63:      */
 64:     public function levelCommand($message, $channel, $sender, $sendto, $args) {
 65:         $level = $args[1];
 66:         if (($row = $this->getLevelInfo($level)) != false) {
 67:             $msg = "<white>L $row->level: Team {$row->teamMin}-{$row->teamMax}<end><highlight> | <end><cyan>PvP {$row->pvpMin}-{$row->pvpMax}<end><highlight> | <end><orange>Missions {$row->missions}<end><highlight> | <end><blue>{$row->tokens} token(s)<end>";
 68:         } else {
 69:             $msg = "Level must be between <highlight>1<end> and <highlight>220<end>.";
 70:         }
 71: 
 72:         $sendto->reply($msg);
 73:     }
 74:     
 75:     /**
 76:      * @HandlesCommand("missions")
 77:      * @Matches("/^missions ([0-9]+)$/i")
 78:      */
 79:     public function missionsCommand($message, $channel, $sender, $sendto, $args) {
 80:         $missionQl = $args[1];
 81: 
 82:         if ($missionQl > 0 && $missionQl <= 250) {
 83:             $msg = "QL{$missionQl} missions can be rolled from these levels:";
 84: 
 85:             forEach ($this->findAllLevels() as $row) {
 86:                 $array = explode(",", $row->missions);
 87:                 if (in_array($missionQl, $array)) {
 88:                     $msg .= " " . $row->level;
 89:                 }
 90:             }
 91:         } else {
 92:             $msg = "Missions are only available between QL1 and QL250.";
 93:         }
 94: 
 95:         $sendto->reply($msg);
 96:     }
 97:     
 98:     /**
 99:      * @HandlesCommand("xp")
100:      * @Matches("/^xp ([0-9]+)$/i")
101:      */
102:     public function xpSingleCommand($message, $channel, $sender, $sendto, $args) {
103:         $level = $args[1];
104:         if (($row = $this->getLevelInfo($level)) != false) {
105:             if ($level >= 200) {
106:                 $msg = "At level <highlight>{$row->level}<end> you need <highlight>".number_format($row->xpsk)."<end> SK to level up.";
107:             } else {
108:                 $msg = "At level <highlight>{$row->level}<end> you need <highlight>".number_format($row->xpsk)."<end> XP to level up.";
109:             }
110:         } else {
111:             $msg = "Level must be between 1 and 219.";
112:         }
113: 
114:         $sendto->reply($msg);
115:     }
116:     
117:     /**
118:      * @HandlesCommand("xp")
119:      * @Matches("/^xp ([0-9]+) ([0-9]+)$/i")
120:      */
121:     public function xpDoubleCommand($message, $channel, $sender, $sendto, $args) {
122:         $minLevel = $args[1];
123:         $maxLevel = $args[2];
124:         if ($minLevel >= 1 && $minLevel <= 220 && $maxLevel >= 1 && $maxLevel <= 220) {
125:             if ($minLevel < $maxLevel) {
126:                 $data = $this->db->query("SELECT * FROM levels WHERE level >= ? AND level < ?", $minLevel, $maxLevel);
127:                 $xp = 0;
128:                 $sk = 0;
129:                 forEach ($data as $row) {
130:                     if ($row->level < 200) {
131:                         $xp += $row->xpsk;
132:                     } else {
133:                         $sk += $row->xpsk;
134:                     }
135:                 }
136:                 if ($sk > 0 && $xp > 0) {
137:                     $msg = "From the beginning of level <highlight>$minLevel<end> you need <highlight>".number_format($xp)."<end> XP and <highlight>".number_format($sk)."<end> SK to reach level <highlight>$maxLevel<end>.";
138:                 } else if ($sk > 0) {
139:                     $msg = "From the beginning of level <highlight>$minLevel<end> you need <highlight>".number_format($sk)."<end> SK to reach level <highlight>$maxLevel<end>.";
140:                 } else if ($xp > 0) {
141:                     $msg = "From the beginning of level <highlight>$minLevel<end> you need <highlight>".number_format($xp)."<end> XP to reach level <highlight>$maxLevel<end>.";
142:                 }
143:             } else {
144:                 $msg = "The start level cannot be higher than the end level.";
145:             }
146:         } else {
147:             $msg = "Level must be between 1 and 220.";
148:         }
149: 
150:         $sendto->reply($msg);
151:     }
152: 
153:     public function getLevelInfo($level) {
154:         $sql = "SELECT * FROM levels WHERE level = ?";
155:         return $this->db->queryRow($sql, $level);
156:     }
157: 
158:     public function findAllLevels() {
159:         $sql = "SELECT * FROM levels ORDER BY level";
160:         return $this->db->query($sql);
161:     }
162: }
163: 
Budabot 4 Docs API documentation generated by ApiGen