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\Core\Modules;
  4: 
  5: use Budabot\Core\Registry;
  6: 
  7: class AltInfo {
  8:     public $main; // The main for this character
  9:     public $alts = array(); // The list of alts for this character
 10: 
 11:     public function isValidated($sender) {
 12:         if ($sender == $this->main) {
 13:             return true;
 14:         }
 15: 
 16:         forEach ($this->alts as $alt => $validated) {
 17:             if ($sender == $alt) {
 18:                 return ($validated == 1);
 19:             }
 20:         }
 21: 
 22:         // $sender is not an alt at all, return false
 23:         return false;
 24:     }
 25: 
 26:     public function getAllValidated($sender) {
 27:         if (!$this->isValidated($sender)) {
 28:             return array($sender);
 29:         } else {
 30:             $arr = array($this->main);
 31:             forEach($this->alts as $alt => $validated) {
 32:                 if ($validated) {
 33:                     $arr []= $alt;
 34:                 }
 35:             }
 36:             return $arr;
 37:         }
 38:     }
 39: 
 40:     public function getAltsBlob($showValidateLinks = false, $firstPageOnly = false) {
 41:         $db = Registry::getInstance('db');
 42:         $settingManager = Registry::getInstance('settingManager');
 43:         $playerManager = Registry::getInstance('playerManager');
 44:         $buddylistManager = Registry::getInstance('buddylistManager');
 45:         $text = Registry::getInstance('text');
 46: 
 47:         if (count($this->alts) == 0) {
 48:             return "No registered alts.";
 49:         }
 50:         
 51:         $online = $buddylistManager->isOnline($this->main);
 52:         $blob .= $this->formatCharName($this->main, $online);
 53: 
 54:         $character = $playerManager->getByName($this->main);
 55:         if ($character !== null) {
 56:             $blob .= " ({$character->level}/<green>{$character->ai_level}<end> {$character->profession})";
 57:         }
 58:         $blob .= $this->formatOnlineStatus($online);
 59:         $blob .= "\n";
 60: 
 61:         $sql = "SELECT `alt`, `main`, `validated`, p.* FROM `alts` a LEFT JOIN players p ON (a.alt = p.name AND p.dimension = '<dim>') WHERE `main` LIKE ? ORDER BY level DESC, ai_level DESC, profession ASC, name ASC";
 62:         $data = $db->query($sql, $this->main);
 63:         $count = count($data) + 1;
 64:         forEach ($data as $row) {
 65:             $online = $buddylistManager->isOnline($row->alt);
 66:             $blob .= $this->formatCharName($row->alt, $online);
 67:             if ($row->profession !== null) {
 68:                 $blob .= " ({$row->level}/<green>{$row->ai_level}<end> {$row->profession})";
 69:             }
 70:             $blob .= $this->formatOnlineStatus($online);
 71: 
 72:             if ($showValidateLinks && $row->validated == 0) {
 73:                 $blob .= " [Unvalidated] " . $text->makeChatcmd('Validate', "/tell <myname> <symbol>altvalidate {$row->alt}");
 74:             }
 75: 
 76:             $blob .= "\n";
 77:         }
 78: 
 79:         $msg = $text->makeBlob("Alts of {$this->main} ($count)", $blob);
 80: 
 81:         if ($firstPageOnly && is_array($msg)) {
 82:             return $msg[0];
 83:         } else {
 84:             return $msg;
 85:         }
 86:     }
 87: 
 88:     public function getOnlineAlts() {
 89:         $online_list = array();
 90:         $buddylistManager = Registry::getInstance('buddylistManager');
 91: 
 92:         if ($buddylistManager->isOnline($this->main)) {
 93:             $online_list []= $this->main;
 94:         }
 95: 
 96:         forEach ($this->alts as $name => $validated) {
 97:             if ($buddylistManager->isOnline($name)) {
 98:                 $online_list []= $name;
 99:             }
100:         }
101: 
102:         return $online_list;
103:     }
104: 
105:     public function getAllAlts() {
106:         $online_list = array();
107: 
108:         $online_list []= $this->main;
109: 
110:         forEach ($this->alts as $name => $validated) {
111:             $online_list []= $name;
112:         }
113: 
114:         return $online_list;
115:     }
116: 
117:     public function hasUnvalidatedAlts() {
118:         forEach ($this->getAllAlts() as $alt) {
119:             if (!$this->isValidated($alt)) {
120:                 return true;
121:             }
122:         }
123:         return false;
124:     }
125:     
126:     public function getValidatedMain($sender) {
127:         if ($this->isValidated($sender)) {
128:             return $this->main;
129:         } else {
130:             return $sender;
131:         }
132:     }
133:     
134:     public function formatCharName($name, $online) {
135:         if ($online == 1) {
136:             $text = Registry::getInstance('text');
137:             return $text->makeChatcmd($name, "/tell $name");
138:         } else {
139:             return $name;
140:         }
141:     }
142:     
143:     public function formatOnlineStatus($online) {
144:         if ($online == 1) {
145:             return " - <green>Online<end>";
146:         } else {
147:             return "";
148:         }
149:     }
150: }
151: 
Budabot 4 Docs API documentation generated by ApiGen