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     = "orghistory", 
 14:  *      accessLevel = "guild", 
 15:  *      description = "Shows the org history (invites and kicks and leaves) for a character", 
 16:  *      help        = "orghistory.txt"
 17:  *  )
 18:  */
 19: class OrgHistoryController {
 20: 
 21:     /**
 22:      * Name of the module.
 23:      * Set automatically by module loader.
 24:      */
 25:     public $moduleName;
 26:     
 27:     /** @Inject */
 28:     public $db;
 29:     
 30:     /** @Inject */
 31:     public $text;
 32:     
 33:     /** @Inject */
 34:     public $util;
 35:     
 36:     /**
 37:      * @Setup
 38:      */
 39:     public function setup() {
 40:         $this->db->loadSQLFile($this->moduleName, "org_history");
 41:     }
 42: 
 43:     /**
 44:      * @HandlesCommand("orghistory")
 45:      * @Matches("/^orghistory$/i")
 46:      * @Matches("/^orghistory ([0-9]+)$/i")
 47:      */
 48:     public function orghistoryCommand($message, $channel, $sender, $sendto, $args) {
 49:         $pageSize = 40;
 50:         $page = 1;
 51:         if (count($args) == 2) {
 52:             $page = $args[1];
 53:         }
 54: 
 55:         $startingRecord = ($page - 1) * $pageSize;
 56: 
 57:         $blob = '';
 58: 
 59:         $sql = "SELECT actor, actee, action, organization, time FROM `org_history` ORDER BY time DESC LIMIT ?, ?";
 60:         $data = $this->db->query($sql, intval($startingRecord), intval($pageSize));
 61:         if (count($data) != 0) {
 62:             forEach ($data as $row) {
 63:                 $blob .= $this->formatOrgAction($row);
 64:             }
 65: 
 66:             $msg = $this->text->makeBlob('Org History', $blob);
 67:         } else {
 68:             $msg = "No org history has been recorded.";
 69:         }
 70: 
 71:         $sendto->reply($msg);
 72:     }
 73:     
 74:     /**
 75:      * @HandlesCommand("orghistory")
 76:      * @Matches("/^orghistory (.+)$/i")
 77:      */
 78:     public function orghistoryPlayerCommand($message, $channel, $sender, $sendto, $args) {
 79:         $player = ucfirst(strtolower($args[1]));
 80: 
 81:         $blob = '';
 82: 
 83:         $sql = "SELECT actor, actee, action, organization, time FROM `org_history` WHERE actee LIKE ? ORDER BY time DESC";
 84:         $data = $this->db->query($sql, $player);
 85:         $count = count($data);
 86:         $blob .= "\n<header2>Actions on $player ($count)<end>\n";
 87:         forEach ($data as $row) {
 88:             $blob .= $this->formatOrgAction($row);
 89:         }
 90: 
 91:         $sql = "SELECT actor, actee, action, organization, time FROM `org_history` WHERE actor LIKE ? ORDER BY time DESC";
 92:         $data = $this->db->query($sql, $player);
 93:         $count = count($data);
 94:         $blob .= "\n<header2>Actions by $player ($count)<end>\n";
 95:         forEach ($data as $row) {
 96:             $blob .= $this->formatOrgAction($row);
 97:         }
 98: 
 99:         $msg = $this->text->makeBlob("Org History for $player", $blob);
100: 
101:         $sendto->reply($msg);
102:     }
103:     
104:     public function formatOrgAction($row) {
105:         switch ($row->action) {
106:             case 'left':
107:                 return "<highlight>$row->actor<end> $row->action. [$row->organization] " . $this->util->date($row->time) . "\n";
108:             default:
109:                 return"<highlight>$row->actor<end> $row->action <highlight>$row->actee<end>. [$row->organization] " . $this->util->date($row->time) . "\n";
110:         }
111:     }
112: 
113:     /**
114:      * @Event("orgmsg")
115:      * @Description("Capture Org Invite/Kick/Leave messages for orghistory")
116:      */
117:     public function captureOrgMessagesEvent($eventObj) {
118:         $message = $eventObj->message;
119:         if (preg_match("/^(.+) just left your organization.$/", $message, $arr)) {
120:             $actor = $arr[1];
121:             $actee = "";
122:             $action = "left";
123:             $time = time();
124: 
125:             $sql = "INSERT INTO `org_history` (actor, actee, action, organization, time) VALUES (?, ?, ?, '<myguild>', ?) ";
126:             $this->db->exec($sql, $actor, $actee, $action, $time);
127:         } else if (preg_match("/^(.+) kicked (.+) from your organization.$/", $message, $arr)) {
128:             $actor = $arr[1];
129:             $actee = $arr[2];
130:             $action = "kicked";
131:             $time = time();
132: 
133:             $sql = "INSERT INTO `org_history` (actor, actee, action, organization, time) VALUES (?, ?, ?, '<myguild>', ?) ";
134:             $this->db->exec($sql, $actor, $actee, $action, $time);
135:         } else if (preg_match("/^(.+) invited (.+) to your organization.$/", $message, $arr)) {
136:             $actor = $arr[1];
137:             $actee = $arr[2];
138:             $action = "invited";
139:             $time = time();
140: 
141:             $sql = "INSERT INTO `org_history` (actor, actee, action, organization, time) VALUES (?, ?, ?, '<myguild>', ?) ";
142:             $this->db->exec($sql, $actor, $actee, $action, $time);
143:         } else if (preg_match("/^(.+) removed inactive character (.+) from your organization.$/", $message, $arr)) {
144:             $actor = $arr[1];
145:             $actee = $arr[2];
146:             $action = "removed";
147:             $time = time();
148: 
149:             $sql = "INSERT INTO `org_history` (actor, actee, action, organization, time) VALUES (?, ?, ?, '<myguild>', ?) ";
150:             $this->db->exec($sql, $actor, $actee, $action, $time);
151:         }
152:     }
153: }
154: 
155: 
Budabot 4 Docs API documentation generated by ApiGen