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     = 'kos', 
 14:  *      accessLevel = 'guild', 
 15:  *      description = 'Shows the kill-on-sight list', 
 16:  *      help        = 'kos.txt'
 17:  *  )
 18:  *  @DefineCommand(
 19:  *      command     = 'kos add .+', 
 20:  *      accessLevel = 'guild', 
 21:  *      description = 'Adds a character to the kill-on-sight list', 
 22:  *      help        = 'kos.txt'
 23:  *  )
 24:  *  @DefineCommand(
 25:  *      command     = 'kos rem .+', 
 26:  *      accessLevel = 'mod', 
 27:  *      description = 'Removes a character from the kill-on-sight list', 
 28:  *      help        = 'kos.txt'
 29:  *  )
 30:  */
 31: class KillOnSightController {
 32: 
 33:     /**
 34:      * Name of the module.
 35:      * Set automatically by module loader.
 36:      */
 37:     public $moduleName;
 38:     
 39:     /** @Inject */
 40:     public $db;
 41:     
 42:     /** @Inject */
 43:     public $chatBot;
 44: 
 45:     /** @Inject */
 46:     public $text;
 47:     
 48:     /** @Inject */
 49:     public $util;
 50:     
 51:     /**
 52:      * @Setup
 53:      */
 54:     public function setup() {
 55:         $this->db->loadSQLFile($this->moduleName, 'kos');
 56:     }
 57: 
 58:     /**
 59:      * @HandlesCommand("kos")
 60:      * @Matches("/^kos$/i")
 61:      */
 62:     public function kosListCommand($message, $channel, $sender, $sendto, $args) {
 63:         $sql = "SELECT * FROM kos";
 64: 
 65:         $data = $this->db->query($sql);
 66:         $count = count($data);
 67: 
 68:         if ($count == 0) {
 69:             $msg = "There are no characters on the KOS list.";
 70:         } else {
 71:             $blob = '';
 72:             forEach ($data as $row) {
 73:                 $comment = "";
 74:                 if (!empty($row->comment)) {
 75:                     $comment = " - $row->comment";
 76:                 }
 77:                 
 78:                 $blob .= "<highlight>$row->name<end>$comment (added by $row->submitter <highlight>" . $this->util->unixtimeToReadable(time() - $row->dt) . "<end> ago)\n";
 79:             }
 80:             $msg = $this->text->makeBlob("Kill-On-Sight List ($count)", $blob);
 81:         }
 82:         $sendto->reply($msg);
 83:     }
 84:     
 85:     /**
 86:      * @HandlesCommand("kos add .+")
 87:      * @Matches("/^kos add ([a-z0-9-]+)$/i")
 88:      * @Matches("/^kos add ([a-z0-9-]+) (.+)$/i")
 89:      */
 90:     public function kosAddCommand($message, $channel, $sender, $sendto, $args) {
 91:         $name = ucfirst(strtolower($args[1]));
 92:         $charid = $this->chatBot->get_uid($name);
 93:         
 94:         if ($charid == false) {
 95:             $sendto->reply("Character <highlight>$name<end> does not exist.");
 96:             return;
 97:         }
 98: 
 99:         $sql = "SELECT * FROM kos WHERE name = ?";
100:         $row = $this->db->queryRow($sql, $name);
101: 
102:         if ($row !== null) {
103:             $msg = "Character <highlight>$name<end> is already on the Kill-On-Sight list.";
104:         } else {
105:             $comment = "";
106:             if (isset($args[2])) {
107:                 $comment = trim($args[2]);
108:             }
109:             
110:             $sql = "INSERT INTO kos (name, comment, submitter, dt) VALUES (?, ?, ?, ?)";
111:             $this->db->exec($sql, $name, $comment, $sender, time());
112:             $msg = "Character <highlight>$name<end> has been added to the Kill-On-Sight list.";
113:         }
114:         $sendto->reply($msg);
115:     }
116:     
117:     /**
118:      * @HandlesCommand("kos rem .+")
119:      * @Matches("/^kos rem (.+)$/i")
120:      */
121:     public function kosRemCommand($message, $channel, $sender, $sendto, $args) {
122:         $name = ucfirst(strtolower($args[1]));
123:         $sql = "SELECT * FROM kos WHERE name = ?";
124: 
125:         $row = $this->db->queryRow($sql, $name);
126: 
127:         if ($row === null) {
128:             $msg = "Character <highlight>$name<end> is not on the Kill-On-Sight list.";
129:         } else {
130:             $sql = "DELETE FROM kos WHERE name = ?";
131:             $this->db->exec($sql, $name);
132:             $msg = "Character <highlight>$name<end> has been removed from the Kill-On-Sight list.";
133:         }
134:         $sendto->reply($msg);
135:     }
136: }
Budabot 4 Docs API documentation generated by ApiGen