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:  * Guides compiled by Plugsz (RK1)
 10:  *
 11:  * @Instance
 12:  *
 13:  * Commands this controller contains:
 14:  *  @DefineCommand(
 15:  *      command     = 'guides', 
 16:  *      accessLevel = 'all', 
 17:  *      description = 'Guides for AO', 
 18:  *      help        = 'guides.txt'
 19:  *  )
 20:  */
 21: class GuideController {
 22: 
 23:     /**
 24:      * Name of the module.
 25:      * Set automatically by module loader.
 26:      */
 27:     public $moduleName;
 28: 
 29:     /** @Inject */
 30:     public $text;
 31:     
 32:     /** @Inject */
 33:     public $util;
 34:     
 35:     /** @Inject */
 36:     public $commandAlias;
 37:     
 38:     private $path;
 39:     private $fileExt = ".txt";
 40:     
 41:     /**
 42:      * This handler is called on bot startup.
 43:      * @Setup
 44:      */
 45:     public function setup() {
 46:         $this->commandAlias->register($this->moduleName, "guides breed", "breed");
 47:         $this->commandAlias->register($this->moduleName, "guides healdelta", "healdelta");
 48:         $this->commandAlias->register($this->moduleName, "guides lag", "lag");
 49:         $this->commandAlias->register($this->moduleName, "guides nanodelta", "nanodelta");
 50:         $this->commandAlias->register($this->moduleName, "guides stats", "stats");
 51:         $this->commandAlias->register($this->moduleName, "aou 11", "title");
 52:         $this->commandAlias->register($this->moduleName, "guides doja", "doja");
 53:         $this->commandAlias->register($this->moduleName, "guides adminhelp", "adminhelp");
 54:         $this->commandAlias->register($this->moduleName, "guides light", "light");
 55: 
 56:         $this->path = getcwd() . "/modules/" . $this->moduleName . "/guides/";
 57:     }
 58:     
 59:     /**
 60:      * @HandlesCommand("guides")
 61:      * @Matches("/^guides$/i")
 62:      */
 63:     public function guidesListCommand($message, $channel, $sender, $sendto, $args) {
 64:         if ($handle = opendir($this->path)) {
 65:             $topicList = array();
 66: 
 67:             /* This is the correct way to loop over the directory. */
 68:             while (false !== ($fileName = readdir($handle))) {
 69:                 // if file has the correct extension, it's a topic file
 70:                 if ($this->util->endsWith($fileName, $this->fileExt)) {
 71:                     $topicList[] =  str_replace($this->fileExt, '', $fileName);
 72:                 }
 73:             }
 74: 
 75:             closedir($handle);
 76: 
 77:             sort($topicList);
 78: 
 79:             $linkContents = '';
 80:             forEach ($topicList as $topic) {
 81:                 $linkContents .= $this->text->makeChatcmd($topic, "/tell <myname> guides $topic") . "\n";
 82:             }
 83: 
 84:             if ($linkContents) {
 85:                 $msg = $this->text->makeBlob('Topics (' . count($topicList) . ')', $linkContents);
 86:             } else {
 87:                 $msg = "No topics available.";
 88:             }
 89:         } else {
 90:             $msg = "Error reading topics.";
 91:         }
 92:         $sendto->reply($msg);
 93:     }
 94:     
 95:     /**
 96:      * @HandlesCommand("guides")
 97:      * @Matches("/^guides ([a-z0-9_-]+)$/i")
 98:      */
 99:     public function guidesShowCommand($message, $channel, $sender, $sendto, $args) {
100:         // get the filename and read in the file
101:         $fileName = strtolower($args[1]);
102:         $info = $this->getTopicContents($fileName);
103: 
104:         if (!$info) {
105:             $msg = "No guide named <highlight>$fileName<end> was found.";
106:         } else {
107:             $msg = $this->text->makeLegacyBlob(ucfirst($fileName), $info);
108:         }
109:         $sendto->reply($msg);
110:     }
111: 
112:     public function getTopicContents($fileName) {
113:         // get the filename and read in the file
114:         $file = $this->path . $fileName . $this->fileExt;
115:         return file_get_contents($file);
116:     }
117: }
118: 
Budabot 4 Docs API documentation generated by ApiGen