//public List<Player> GuildMembersOf(string guild) //{ // return (from i in Worlds where i.Key != 0 from e in i.Value.Players where String.Equals(e.Value.Guild, guild, StringComparison.CurrentCultureIgnoreCase) select e.Value).ToList(); //} public void Initialize() { log.Info("Initializing Realm Manager..."); GameData = new XmlData(); Behaviors = new BehaviorDb(this); GeneratorCache.Init(); MerchantLists.InitMerchatLists(GameData); AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus()); AddWorld(World.MARKET, new ClothBazaar()); AddWorld(World.TEST_ID, new Test()); AddWorld(World.TUT_ID, new Tutorial(true)); AddWorld(World.DAILY_QUEST_ID, new DailyQuestRoom()); Monitor = new RealmPortalMonitor(this); Task.Factory.StartNew(() => GameWorld.AutoName(1, true)).ContinueWith(_ => AddWorld(_.Result), TaskScheduler.Default); CommandHandler = new CommandHandler(); CommandHandler.LoadCommands(); Chat = new ChatManager(this); log.Info("Realm Manager initialized."); }
public void Initialize() { log.Info("Initializing Realm Manager..."); GameData = new XmlData(); Behaviors = new BehaviorDb(this); MerchantLists.InitMerchantLists(GameData); AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus()); Monitor = new RealmPortalMonitor(this); AddWorld(World.TUT_ID, new Tutorial(true)); AddWorld(World.NEXUS_LIMBO, new NexusLimbo()); AddWorld(World.VAULT_ID, new Vault(true)); AddWorld(World.TEST_ID, new Test()); AddWorld(World.RAND_REALM, new RandomRealm()); AddWorld(World.GAUNTLET, new GauntletMap()); //AddWorld(new GameWorld(1, "Medusa", true)); InterServer = new ISManager(this); Chat = new ChatManager(this); Commands = new CommandManager(this); log.Info("Realm Manager initialized."); }
static RealmManager() { Worlds[World.TUT_ID] = new Tutorial(false); Worlds[World.NEXUS_ID] = Worlds[0] = new Nexus(); Worlds[World.NEXUS_LIMBO] = new NexusLimbo(); Worlds[World.VAULT_ID] = new Vault(true); Worlds[World.TEST_ID] = new Test(); Worlds[World.RAND_REALM] = new RandomRealm(); Worlds[World.GAUNTLET] = new GauntletMap(); Worlds[World.WC] = new WineCellarMap(); Worlds[World.ARENA] = new ArenaMap(); Worlds[World.SHOP] = new ShopMap("Default"); Worlds[World.MARKET] = new MarketMap(); Monitor = new RealmPortalMonitor(Worlds[World.NEXUS_ID] as Nexus); AddWorld(GameWorld.AutoName(1, true)); MerchantLists.GetKeys(); MerchantLists.AddPetShop(); MerchantLists.AddCustomShops(); foreach (var i in MerchantLists.shopLists) { ShopWorlds.TryAdd(i.Key, AddWorld(new ShopMap(i.Key))); } }
//public List<Player> GuildMembersOf(string guild) //{ // return (from i in Worlds where i.Key != 0 from e in i.Value.Players where String.Equals(e.Value.Guild, guild, StringComparison.CurrentCultureIgnoreCase) select e.Value).ToList(); //} public void Initialize() { log.Info("Initializing Realm Manager..."); GameData = new XmlData(); Behaviors = new BehaviorDb(this); GeneratorCache.Init(); MerchantLists.InitMerchatLists(GameData); AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus()); AddWorld(World.MARKET, new ClothBazaar()); AddWorld(World.TEST_ID, new Test()); AddWorld(World.TUT_ID, new Tutorial(true)); AddWorld(World.DAILY_QUEST_ID, new DailyQuestRoom()); AddWorld(World.ELDER_MONTAINS, new ElderMountains()); AddWorld(World.ELDER_MONTAINS_SV1, new ElderMountainsSv1()); AddWorld(World.ELDER_MONTAINS_SV2, new ElderMountainsSv2()); AddWorld(World.ELDER_MONTAINS_SV3, new ElderMountainsSv3()); //AddWorld(World.CRAWLING_DEPTHS, new CDepths()); //AddWorld(World.ORYX_CHAMBER, new OryxChamber()); //AddWorld(World.IVORY_WYVERN, new Ivory()); Monitor = new RealmPortalMonitor(this); Task.Factory.StartNew(() => GameWorld.AutoName(1, true)).ContinueWith(_ => AddWorld(_.Result), TaskScheduler.Default); Chat = new ChatManager(this); Commands = new CommandManager(this); log.Info("Realm Manager initialized."); }
public void Initialize() { log.Info("Initializing Realm Manager..."); GameData = new XmlData(); Behaviors = new BehaviorDb(this); GeneratorCache.Init(); MerchantLists.InitMerchantLists(GameData); AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus()); Monitor = new RealmPortalMonitor(this); AddWorld(World.TUT_ID, new Tutorial(true)); AddWorld(World.NEXUS_LIMBO, new NexusLimbo()); AddWorld(World.VAULT_ID, new Vault(true)); AddWorld(World.TEST_ID, new Test()); AddWorld(World.RAND_REALM, new RandomRealm()); AddWorld(World.SHOP_ID, new Shop()); if (Program.Settings.GetValue <bool>("hasRealm")) { AddWorld(GameWorld.AutoName(1, true)); } Chat = new ChatManager(this); Commands = new CommandManager(); ChatBotCommands = new ChatBotCommandManager(); UnusualEffects.Init(); log.Info("Realm Manager initialized."); }
static RealmManager() { Worlds[World.TUT_ID] = new Tutorial(true); Worlds[World.NEXUS_ID] = Worlds[0] = new Nexus(); Worlds[World.NEXUS_LIMBO] = new NexusLimbo(); Worlds[World.VAULT_ID] = new Vault(true); Worlds[World.TEST_ID] = new Test(); //Worlds[World.PETYARD] = new PetYard(true); Worlds[World.RAND_REALM] = new RandomRealm(); Worlds[World.NEXUS_VIP] = new NexusVIP(); //custom nexus by luke Worlds[World.WINELER] = new Wineler(); Worlds[World.TOURNAMENT_ID] = new Tournament(); Monitor = new RealmPortalMonitor(Worlds[World.NEXUS_ID] as Nexus); AddWorld(GameWorld.AutoName(1, true)); MerchantLists.GetKeys(); MerchantLists.AddPetShop(); MerchantLists.AddCustomShops(); foreach (var i in MerchantLists.shopLists) { ShopWorlds.TryAdd(i.Key, AddWorld(new ShopMap(i.Key))); } }
protected override bool Process(Player player, RealmTime time, string[] args) { using (var db = new Database()) { if (args.Length < 2) { player.SendError("Usage: /sell <slot> <price>"); return(false); } if (Convert.ToInt32(args[0]) > 8 || Convert.ToInt32(args[0]) < 1) { player.SendError("Slot Number Invalid, please only choose items in slot 1-8"); return(false); } if (Convert.ToInt32(args[1]) < 0) { player.SendError("Fame must be more than 0"); return(false); } int slot = Convert.ToInt32(args[0]) + 3; Item item = player.Inventory[slot]; if (Merchant.checkItem(player.Inventory[slot])) { MySqlCommand cmd = db.CreateQuery(); cmd.CommandText = "INSERT INTO market(itemID, fame, playerid) VALUES(@itemID, @fame, @playerID)"; cmd.Parameters.AddWithValue("@itemID", Convert.ToInt32(item.ObjectType)); cmd.Parameters.AddWithValue("@fame", args[1]); var plr = player.Manager.FindPlayer(player.Name); cmd.Parameters.AddWithValue("@playerID", plr.AccountId); try { cmd.ExecuteNonQuery(); player.Inventory[slot] = null; player.Client.Save(); player.UpdateCount++; MerchantLists.AddItem(item, Convert.ToInt32(args[1])); } catch (Exception e) { Console.WriteLine("[" + DateTime.Now.ToString("h:mm:ss tt") + "] " + e); } return(true); } } player.SendError("You cannot sell this item!"); return(false); }
public RealmManager(Resources resources, Database db, ServerConfig config) { Log.Info("Initalizing Realm Manager..."); Resources = resources; Database = db; Config = config; TPS = config.serverSettings.tps; InstanceId = config.serverInfo.instanceId; // all these deal with db pub/sub... probably should put more thought into their structure... InterServer = new ISManager(Database, config); ISControl = new ISControl(this); Chat = new ChatManager(this); DbServerController = new DbServerManager(this); // probably could integrate this with ChatManager and rename... DbEvents = new DbEvents(this); // basic server necessities ConMan = new ConnectManager(this, config.serverSettings.maxPlayers, config.serverSettings.maxPlayersWithPriority); Behaviors = new BehaviorDb(this); Commands = new CommandManager(this); // some necessities that shouldn't be (will work this out later) MerchantLists.Init(this); InitializeNexusHub(); AddWorld("Realm"); // add portal monitor to nexus and initialize worlds if (Worlds.ContainsKey(World.Nexus)) { Monitor = new PortalMonitor(this, Worlds[World.Nexus]); } foreach (var world in Worlds.Values) { OnWorldAdded(world); } _initialized = true; Log.Info("Realm Manager initialized."); }
protected override Tuple <bool, string> Process(Player player, RealmTime time, string[] args) { using (var db = new Database()) { if (args.Length < 2) { return(Tuple.Create(false, "Usage: /sell <slot> <price>")); } int slot = Convert.ToInt32(args[0]) + 3; if (slot > 11 || slot < 4) { return(Tuple.Create(false, "Slot Number Invalid, please only choose items in slot 1-8")); } if (Convert.ToInt32(args[1]) < 0) { return(Tuple.Create(false, "Selling price must be a positive integer")); } Item item = player.Inventory[slot]; if (item.Secret || item.Soulbound) { return(Tuple.Create(false, $"Cannot Sell {item.ObjectId} because it is soulbound or secret")); } if (Merchant.checkItem(player.SerialConvert(player.Inventory[slot]))) { MySqlCommand cmd = db.CreateQuery(); cmd.CommandText = "INSERT INTO market(itemID, fame, serialid) VALUES(@itemID, @fame, @serialid)"; cmd.Parameters.AddWithValue("@itemID", Convert.ToInt32(item.ObjectType)); cmd.Parameters.AddWithValue("@fame", args[1]); cmd.Parameters.AddWithValue("@serialid", item.serialId); cmd.ExecuteNonQuery(); player.Inventory[slot] = null; player.Client.Save(); player.UpdateCount++; MerchantLists.AddItem(item, Convert.ToInt32(args[1])); //Adds to runtime return(Tuple.Create(true, "Success")); } return(Tuple.Create(false, $"Cannot Sell {item.ObjectId}")); } }
static RealmManager() { Worlds[World.TUT_ID] = new Tutorial(true); Worlds[World.NEXUS_ID] = Worlds[0] = new Nexus(); Worlds[World.NEXUS_LIMBO] = new NexusLimbo(); Worlds[World.VAULT_ID] = new Vault(true); Worlds[World.TEST_ID] = new Test(); Worlds[World.RAND_REALM] = new RandomRealm(); Monitor = new RealmPortalMonitor(Worlds[World.NEXUS_ID] as Nexus); AddWorld(GameWorld.AutoName(1, true)); MerchantLists.AddCustomShops(); foreach (var i in MerchantLists.shopLists) { ShopWorlds.TryAdd(i.Key, AddWorld(new ShopMap(i.Key))); } }
public void Initialize() { if (CheckConfig.IsDebugOn()) { Console.WriteLine("Initializing Realm Manager..."); } GameData = new XmlData(); Behaviors = new BehaviorDb(this); GeneratorCache.Init(); MerchantLists.InitMerchatLists(GameData); AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus()); AddWorld(World.MARKET, new ClothBazaar()); AddWorld(World.TUT_ID, new Tutorial(true)); AddWorld(World.FMARKET, new Market()); Monitor = new RealmPortalMonitor(this); Task.Factory.StartNew(() => GameWorld.AutoName(1, true)) .ContinueWith(_ => AddWorld(_.Result), TaskScheduler.Default); Chat = new ChatManager(this); Commands = new CommandManager(this); if (CheckConfig.IsDebugOn()) { Console.WriteLine("Realm Manager initialized."); } }
public RealmManager(Resources resources, Database db, ServerConfig config) { InstanceId = Guid.NewGuid().ToString(); Database = db; Resources = resources; Config = config; Config.serverInfo.instanceId = InstanceId; TPS = config.serverSettings.tps; // all these deal with db pub/sub... probably should put more thought into their structure... InterServer = new ISManager(Database, config); ISControl = new ISControl(this); Chat = new ChatManager(this); DbServerController = new DbServerManager(this); // probably could integrate this with ChatManager and rename... DbEvents = new DbEvents(this); // basic server necessities ConMan = new ConnectManager(this, config.serverSettings.maxPlayers, config.serverSettings.maxPlayersWithPriority); Behaviors = new BehaviorDb(this); Commands = new CommandManager(this); // some necessities that shouldn't be (will work this out later) MerchantLists.Init(this); Tinker = new DbTinker(db.Conn); if (Config.serverSettings.enableMarket) { Market = new Market(this); } var serverMode = config.serverSettings.mode; switch (serverMode) { case ServerMode.Single: InitializeNexusHub(); AddWorld("Realm"); break; case ServerMode.Nexus: InitializeNexusHub(); break; case ServerMode.Realm: AddWorld("Realm"); break; case ServerMode.Marketplace: AddWorld("Marketplace", true); AddWorld("Vault"); AddWorld("ClothBazaar"); break; } // add portal monitor to nexus and initialize worlds if (Worlds.ContainsKey(World.Nexus)) { Monitor = new PortalMonitor(this, Worlds[World.Nexus]); } foreach (var world in Worlds.Values) { OnWorldAdded(world); } _initialized = true; }
static RealmManager() { Worlds[World.TUT_ID] = new Tutorial(true); Worlds[World.NEXUS_ID] = Worlds[0] = new Nexus(); Worlds[World.NEXUS_LIMBO] = new NexusLimbo(); Worlds[World.VAULT_ID] = new Vault(true); Worlds[World.TEST_ID] = new Test(); Worlds[World.RAND_REALM] = new RandomRealm(); Worlds[World.GAUNTLET] = new GauntletMap(); Worlds[World.WC] = new WineCellarMap(); Worlds[World.ARENA] = new ArenaMap(); Worlds[World.SHOP] = new ShopMap("Default"); Worlds[World.MARKET] = new MarketMap(); Worlds[World.ARENA_FREE] = new BattleArenaMap2(); Worlds[World.ARENA_PAID] = new BattleArenaMap(); Worlds[World.OCEAN] = new OceanTrench(); Worlds[World.TOMBANCIENTS] = new TombMap(); Worlds[World.SPRITEWORLD] = new SpriteWorld(); Worlds[World.ZOMBIEARENA] = new ZombieMap(); Worlds[World.UNDEADLAIR] = new UndeadLair(); Worlds[World.KITCHEN] = new Kitchen(); Worlds[World.ISLAND] = new Island(); Worlds[World.PIRATECAVE] = new PirateCave(); Worlds[World.VOIDWORLD] = new VoidWorld(); Worlds[World.BEACHZONE] = new BeachZone(); Worlds[World.SNAKEPIT] = new SnakePit(); Worlds[World.MANOR] = new Manor(); Worlds[World.SPIDERDEN] = new SpiderDen(); Worlds[World.DAVYJ] = new Davy(); Worlds[World.DRAGONLORDS] = new Dragonlord(); Worlds[World.DOOMCRYSTAL] = new DoomCrystal(); Worlds[World.DOOMCELLAR] = new Dcellar(); Worlds[World.FJUNGLE] = new Jungle(); Worlds[World.DRACONIS] = new Draconis(); Worlds[World.OCASTLE] = new OryxsCastle(); Worlds[World.OCHAMBER] = new OryxsChamber(); Worlds[World.CHOCHAMBER] = new ChristmasOryxsChamber(); Worlds[World.ELDERPCAVE] = new ElderPirateCave(); Worlds[World.ELDERSDEN] = new ElderSpiderDen(); Worlds[World.ELDERSPIT] = new ElderSnakePit(); Worlds[World.ELDERSPRITE] = new ElderSpriteWorld(); Worlds[World.ELDERUNDEAD] = new ElderUndeadL(); Worlds[World.ELDERABYSS] = new ElderAbyss(); Worlds[World.ELDERDRACONIS] = new ElderDraconis(); Worlds[World.ELDERTOMB] = new ElderTombMap(); Worlds[World.NEXUSDEF] = new NexusDefense(); // Worlds[World.SHATTERS] = new Shatters(); Worlds[World.EC] = new EC(); Worlds[World.ADM_ID] = new Admin(); Monitor = new RealmPortalMonitor(Worlds[World.NEXUS_ID] as Nexus); AddWorld(GameWorld.AutoName(1, true)); MerchantLists.GetKeys(); MerchantLists.AddPetShop(); MerchantLists.AddCustomShops(); foreach (var i in MerchantLists.shopLists) { ShopWorlds.TryAdd(i.Key, AddWorld(new ShopMap(i.Key))); } }