using System;
using System.Threading;
using Holo.Managers;
using Ion.Storage;
namespace Holo
{
///
/// Contains settings for the emulator. Config class is being initialized at boot of emulator.
///
public static class Config
{
///
/// Specifies if chat animations should be used at chat.
///
internal static bool enableChatAnims;
///
/// Specifies if the word filter that filters swearwords should be enabled.
///
internal static bool enableWordFilter;
///
/// Specifies if the welcome message should be sent at login.
///
internal static bool enableWelcomeMessage;
///
/// Specifies if trading is enabled.
///
internal static bool enableTrading;
///
/// Specifies if the Recycler is enabled.
///
internal static bool enableRecycler;
///
/// Specifies the amount of sips that a virtual user should take from his drink/item before vanishing it.
///
internal static int Statuses_itemCarrying_SipAmount; // Better, a byte
///
/// Specifies the amount of milliseconds between the sips of the item carrying.
///
internal static int Statuses_itemCarrying_SipInterval;
///
/// Specifies the amount of milliseconds that a sip of a drink takes.
///
internal static int Statuses_itemCarrying_SipDuration;
///
/// Specifies the amount of milliseconds that the waving animation takes.
///
internal static int Statuses_Wave_waveDuration;
///
/// Specifies the amount of minutes until a roomban expires.
///
internal static int Rooms_roomBan_banDuration;
///
/// Specifies the max height of a stack of virtual items. If this height is overidden, then the height won't increase but stick at the max height. (merging virtual items)
///
internal static int Items_Stacking_maxHeight;
///
/// Specifies the max amount of virtual rooms that a virtual user can create.
///
internal static int Navigator_createRoom_maxRooms;
///
/// Specifies the max amount of guestrooms to display at the virtual room search engine in the Navigator.
///
internal static int Navigator_roomSearch_maxResults;
///
/// Specifies the max amount of guestrooms to display at opening a category in the Navigator.
///
internal static int Navigator_openCategory_maxResults;
///
/// Specifies the max amount of virtual rooms that virtual users can have in their 'favorite rooms' list.
///
internal static int Navigator_Favourites_maxRooms;
///
/// The template ID of the disk item to be used when burning a virtual song to disk.
///
internal static int Soundmachine_burnToDisk_diskTemplateID;
///
/// The link to the image that has to show while loading a room. If blank, then no image is shown.
///
internal static string Rooms_LoadAvertisement_img;
///
/// The url that has to be triggered when clicking the room load advertisement.
///
internal static string Rooms_LoadAvertisement_uri;
public static int WS_TICKET_COST = 1;
public static int WS_GAMEMAX_TIME = 100000;
public static int WS_MS_BETWEEN_EACH_HIT_MIN = 300;
public static int WS_BALANCE_POINTS = 35;
public static int WS_HIT_POINTS = 13;
public static int WS_HIT_BALANCE_POINTS = 10;
///
/// The amount of seconds that the 'preparing game...' bar has to display before starting the game.
///
internal static int Game_Countdown_Seconds;
///
/// The amount of seconds that it takes (at score window) before the game restarts for people that wished to replay the game.
///
internal static int Game_scoreWindow_restartGame_Seconds;
///
/// The amount of seconds that a game of 'BattleBall' takes.
///
internal static int Game_BattleBall_gameLength_Seconds;
internal static byte Minimum_CFH_Rank;
///
/// Gets the value from a config entry in system_config table.
///
/// The key of the config entry.
public static string getTableEntry(string Key)
{
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
return dbClient.getString("SELECT sval FROM system_config WHERE skey = '" + Key + "' LIMIT 1");
}
}
///
/// Initializes settings from system_config table for Config class.
///
public static void Init(bool Update)
{
if(getTableEntry("chatanims_enable") == "1")
{
enableChatAnims = true;
Out.WriteLine("Chat animations enabled.");
}
else
Out.WriteLine("Chat animations disabled.");
if(getTableEntry("trading_enable") == "1")
{
enableTrading = true;
Out.WriteLine("Trading enabled.");
}
else
Out.WriteLine("Trading disabled.");
Rooms_LoadAvertisement_img = getTableEntry("rooms_loadadvertisement_img");
if (Rooms_LoadAvertisement_img != "")
{
Rooms_LoadAvertisement_uri = getTableEntry("rooms_loadadvertisement_uri");
if(stringManager.getStringPart(Rooms_LoadAvertisement_uri,0,7) != "http://")
Rooms_LoadAvertisement_uri = "http://wwww.sunnieday.nl";
}
Rooms_roomBan_banDuration = int.Parse(getTableEntry("rooms_roomban_duration"));
Statuses_itemCarrying_SipAmount = int.Parse(getTableEntry("statuses_carryitem_sipamount"));
Statuses_itemCarrying_SipInterval = int.Parse(getTableEntry("statuses_carryitem_sipinterval"));
Statuses_itemCarrying_SipDuration = int.Parse(getTableEntry("statuses_carryitem_sipduration"));
Statuses_Wave_waveDuration = int.Parse(getTableEntry("statuses_wave_duration"));
Items_Stacking_maxHeight = int.Parse(getTableEntry("items_stacking_maxstackheight"));
Navigator_createRoom_maxRooms = int.Parse(getTableEntry("navigator_createroom_maxrooms"));
Navigator_roomSearch_maxResults = int.Parse(getTableEntry("navigator_roomsearch_maxresults"));
Navigator_openCategory_maxResults = int.Parse(getTableEntry("navigator_opencategory_maxresults"));
Navigator_Favourites_maxRooms = int.Parse(getTableEntry("navigator_favourites_maxrooms"));
Soundmachine_burnToDisk_diskTemplateID = int.Parse(getTableEntry("soundmachine_burntodisk_disktid"));
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
Minimum_CFH_Rank = byte.Parse(dbClient.getString("SELECT minrank FROM rank_fuserights WHERE fuseright = 'fuse_receive_calls_for_help'")); // Not Dynamic Fuseright compatible
}
Game_Countdown_Seconds = int.Parse(getTableEntry("game_countdown_seconds"));
Game_scoreWindow_restartGame_Seconds = int.Parse(getTableEntry("game_scorewindow_restartgame_seconds"));
Game_BattleBall_gameLength_Seconds = int.Parse(getTableEntry("game_bb_gamelength_seconds"));
if (Update)
Thread.CurrentThread.Abort();
}
}
}