private function loadTickets() { $query = Emulator::getDatabase()->query("SELECT S.username as sender_username, R.username AS reported_username, M.username as mod_username, support_tickets.* FROM support_tickets INNER JOIN users as S ON S.id = sender_id INNER JOIN users AS R ON R.id = reported_id INNER JOIN users AS M ON M.id = mod_id WHERE state != 0;"); foreach ($query as $ticket) { $this->tickets[(int) $ticket->id] = new ModToolIssue($ticket); } }
public function reload() { if (!Emulator::getConfig()->getBoolean("hotel.wordfilter.enabled")) { return; } unset($this->autoReportWords); unset($this->hideMessageWords); unset($this->words); $this->autoReportWords = array(); $this->hideMessageWords = array(); $this->words = array(); $query = Emulator::getDatabase()->query("SELECT * FROM wordfilter;"); foreach ($query as $word) { $word = new WordFilterWord($word); if ($word->isAutoReport()) { $this->autoReportWords[] = $word; continue; } if ($word->isHideMessage()) { $this->hideMessageWords[] = $word; continue; } $this->words[] = $word; } }
private function loadPublicRooms() { $query = Emulator::getDatabase()->query("SELECT * FROM rooms WHERE is_public = ? OR is_staff_picked = ? ORDER BY id DESC;", array("1", "1")); foreach ($query as $public) { $this->activeRooms[(int) $public->id] = new Room($public); } }
public function loadSoundTracks() { unset($this->soundTracks); $query = Emulator::getDatabase()->query("SELECT * FROM soundtracks;"); foreach ($query as $soundtrack) { $this->soundTracks[$soundtrack->code] = new SoundTrack($soundtrack); } }
private function loadEnables() { unset($this->enables); $this->enables = array(); $query = Emulator::getDatabase()->query("SELECT * FROM special_enables;"); foreach ($query as $enable) { $this->enables[(int) $enable->effect_id] = (int) $enable->min_rank; } }
public function __construct($gameEnvironment) { $bench = new Ubench(); $bench->start(); $this->gameEnvironment = $gameEnvironment; $this->onlineHabbos = array(); $bench->end(); Emulator::getLogging()->logStart("Habbo Manager -> Loaded! (" . $bench->getTime() . ")"); }
public function __construct() { $bench = new Ubench(); $bench->start(); $this->hallOfFame = new HallOfFame(); $this->newsList = new NewsList(); $bench->end(); Emulator::getLogging()->logStart("Hotelview Manager -> Loaded! (" . $bench->getTime() . ")"); }
public function reload() { unset($this->newsWidgets); $this->newsWidgets = array(); $query = Emulator::getDatabase()->query("SELECT * FROM hotelview_news ORDER BY id DESC LIMIT 10;"); foreach ($query as $news) { $this->newsWidgets[] = new NewsWidget($news); } }
public function getInt(string $key, int $defaultValue = 0) { if (!isset($this->texts[$key])) { Emulator::getLogging()->logErrorLine("[[TEXTS] Text key not found: " . $key); return $defaultValue; } else { return (int) $this->texts[$key]; } }
public function reload() { unset($this->winners); $this->winners = array(); $query = Emulator::getDatabase()->query("SELECT users.look, users.username, users.id, users_settings.hof_points FROM users_settings INNER JOIN users ON users_settings.user_id = users.id WHERE hof_points > 0 ORDER BY hof_points DESC, users.id ASC LIMIT 10;"); foreach ($query as $winner) { $winner = new HallOfFameWinner($winner); $this->winners[$winner->getId()] = $winner; } }
public function __construct() { $bench = new Ubench(); $bench->start(); $this->botDefenitions = array(); $this->botDefenitions["generic"] = Bot::class; $this->reload(); $bench->end(); Emulator::getLogging()->logStart("Bot Manager -> Loaded! (" . $bench->getTime() . ")"); }
public function loadGuildParts() { unset($this->guildParts); foreach (GuildPartType::values() as $t) { $this->guildParts[$t] = array(); } $query = Emulator::getDatabase()->query("SELECT * FROM guilds_elements;"); foreach ($query as $elem) { $this->guildParts[strtoupper($elem->type)][$elem->id] = new GuildPart($elem); } }
private function loadPetCommands() { $commandsList = array(); $query = Emulator::getDatabase()->query("SELECT * FROM pet_commands_data;"); foreach ($query as $command) { $commandsList[(int) $command->command_id] = new PetCommand($command); } $query = Emulator::getDatabase()->query("SELECT * FROM pet_commands ORDER BY pet_id ASC;"); foreach ($query as $command) { $this->petData[(int) $command->pet_id]->petCommands[] = $commandsList[(int) $command->command_id]; } }
public function getConnection() { return new PDO('mysql:host=' . $this->configurationManager->getValue("db.hostname") . ';dbname=' . $this->configurationManager->getValue("db.database"), $this->configurationManager->getValue("db.username"), $this->configurationManager->getValue("db.password"), array(PDO::ATTR_PERSISTENT => true)); if (!isset(DatabasePool::$pool)) { try { DatabasePool::$pool = new PDO('mysql:host=' . $this->configurationManager->getValue("db.hostname") . ';dbname=' . $this->configurationManager->getValue("db.database"), $this->configurationManager->getValue("db.username"), $this->configurationManager->getValue("db.password"), array(PDO::ATTR_PERSISTENT => true)); } catch (PDOException $e) { Emulator::getLogging()->logErrorLine("[DATABASE] " . $e->getMessage()); die; } } else { return DatabasePool::$pool; } }
public function load($database) { Emulator::getLogging()->logStart("GameEnvironment -> Loading..."); $this->database = $database; $this->habboManager = new HabboManager($this); $this->hotelViewManager = new HotelViewManager(); $this->guildManager = new GuildManager(); $this->itemManager = new ItemManager(); $this->itemManager->load(); $this->catalogManager = new CatalogManager(); $this->roomManager = new RoomManager(); $this->permissionsManager = new PermissionsManager(); $this->botManager = new BotManager(); $this->modToolManager = new ModToolManager(); $this->petManager = new PetManager(); $this->achievementManager = new AchievementManager(); $this->guideManager = new GuideManager(); $this->wordFilter = new WordFilter(); Emulator::getLogging()->logStart("GameEnvironment -> Loaded!"); }
public function load($set) { $this->id = (int) $set->id; $this->spriteId = (int) $set->sprite_id; $this->name = $set->item_name; $this->type = $set->type; $this->width = (int) $set->width; $this->length = (int) $set->length; $this->height = (double) $set->stack_height; $this->allowStack = (bool) $set->allow_stack == 1; $this->allowWalk = (bool) $set->allow_walk == 1; $this->allowSit = (bool) $set->allow_sit == 1; $this->allowLay = (bool) $set->allow_lay == 1; $this->allowRecyle = (bool) $set->allow_recycle == 1; $this->allowMarketplace = (bool) $set->allow_marketplace_sell == 1; $this->allowGift = (bool) $set->allow_gift == 1; $this->allowInventoryStack = (bool) $set->allow_inventory_stack == 1; $this->interactionType = Emulator::getGameEnvironment()->getItemManager()->getItemInteraction(strtolower($set->interaction_type)); $this->stateCount = (int) $set->interaction_modes_count; $this->effectM = (int) $set->effect_id_male; $this->effectF = (int) $set->effect_id_female; if ($this->interactionType->getType() == null) { //null will be InteractionVendingMachine::class $this->vendingItems = array(); foreach (explode(",", str_replace(";", ",", $set->vending_ids)) as $s) { $this->vendingItems[] = (int) str_replace(" ", "", $s); } } if ($this->interactionType->getType() == null) { //null will be InteractionMultiHeight::class $this->multiHeights = array(); if (strpos($set->multiheight, ";") !== false) { foreach (explode(",", str_replace(";", ",", $set->multiheight)) as $s) { $this->multiHeights[] = (double) str_replace(" ", "", $s); } } } }
private function loadGiftWrappers() { unset($this->giftWrappers); $this->giftWrappers = array(); $query = Emulator::getDatabase()->query("SELECT * FROM gift_wrappers WHERE type = ? ORDER BY sprite_id DESC;", array("wrapper")); foreach ($query as $gift) { $this->giftWrappers[(int) $gift->sprite_id] = (int) $gift->item_id; } unset($this->giftFurnis); $this->giftFurnis = array(); $query = Emulator::getDatabase()->query("SELECT * FROM gift_wrappers WHERE type = ? ORDER BY sprite_id DESC;", array("gift")); foreach ($query as $gift) { $this->giftFurnis[(int) $gift->sprite_id] = (int) $gift->item_id; } }
public function __construct(int $size) { $this->threadPool = new Pool($size, Worker::class, array()); Emulator::getLogging()->logStart("Thread Pool -> Loaded!"); $this->canAdd = true; }
public function databaseCleanup() { Emulator::getDatabase()->exec("UPDATE users SET online = ?;", array("0")); Emulator::getLogging()->logStart("Database -> Cleaned!"); }
<?php error_reporting(E_ALL); ini_set('display_errors', 1); if (!gc_enabled()) { gc_enable(); } if (!extension_loaded("pthreads")) { die("Please install pthreads extension !"); } if (file_exists('vendor/autoload.php')) { require 'vendor/autoload.php'; } else { die("Please install composer and run 'composer install' !" . PHP_EOL); } use Emulator\Emulator; Emulator::start();