public void TextBoxButton(TextBoxButtonPacket pkt) { var type = pkt.Type; if (type == "test") { psr.SendPacket(new TextBoxPacket { Button1 = "Yes", Button2 = "No", Message = "Do you want to enter the testing arena?", Title = "Testing Arena Confirmation", Type = "EnterTestArena" }); } if (type == "NewClient") { psr.Disconnect(); } if (type == "DecideArena") { if (pkt.Button == 1) { psr.SendPacket(new TextBoxPacket { Button1 = "Enter", Button2 = "Cancel", Message = "Host an arena at the price of x fame?", Title = "Arena Host Confirmation", Type = "EnterArena2" }); } else { psr.SendPacket(new TextBoxPacket { Button1 = "Enter", Button2 = "Cancel", Message = "Enter the arena solo at the price of 150 fame?", Title = "Solo Arena Confirmation", Type = "EnterArena1" }); } } if (type == "EnterTestArena") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 150) { /*RealmManager.PlayerWorldMapping.TryAdd(this.AccountId, Owner); * psr.Reconnect(new ReconnectPacket() * { * Host = "", * Port = 2050, * GameId = world.Id, * Name = world.Name, * Key = Empty<byte>.Array, * }); */ } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Cancelled entering arena."); } } if (type == "EnterArena1") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 50) { using (var db = new Database()) { db.UpdateFame(psr.Account, -50); db.Dispose(); } var world = RealmManager.GetWorld(World.NEXUS_ID); var fworld = false; foreach (var i in RealmManager.Worlds) { if (i.Value is BattleArenaMap) { if ((i.Value as BattleArenaMap).Joinable) { world = i.Value; fworld = true; break; } } } if (!fworld) { world = RealmManager.AddWorld(new BattleArenaMap()); } psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Cancelled entering arena."); } } if (type == "EnterArena2") { if (pkt.Button == 1) { var world = RealmManager.GetWorld(World.NEXUS_ID); var fworld = false; foreach (var i in RealmManager.Worlds) { if (i.Value is BattleArenaMap2) { if ((i.Value as BattleArenaMap2).Joinable) { world = i.Value; fworld = true; break; } } } if (!fworld) { world = RealmManager.AddWorld(new BattleArenaMap2()); } psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); } else { SendInfo("Cancelled entering arena."); } } if (type == "SheepHerding") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 50) { using (var db = new Database()) { db.UpdateFame(psr.Account, -50); db.Dispose(); } var world = RealmManager.GetWorld(World.NEXUS_ID); var fworld = false; foreach (var i in RealmManager.Worlds) { if (i.Value is Herding) { if ((i.Value as Herding).Joinable) { world = i.Value; fworld = true; break; } } } if (!fworld) { world = RealmManager.AddWorld(new Herding()); } psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Cancelled entering sheep herding."); } } if (type == "Zombies") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 10) { using (var db = new Database()) { db.UpdateFame(psr.Account, -10); db.Dispose(); } var world = RealmManager.GetWorld(World.NEXUS_ID); var fworld = false; foreach (var i in RealmManager.Worlds) { if (i.Value is ZombieMG) { if ((i.Value as ZombieMG).Joinable) { world = i.Value; fworld = true; break; } } } if (!fworld) { world = RealmManager.AddWorld(new ZombieMG()); } psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Cancelled entering zombies."); } } if (type == "SlotMachine1") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 10) { using (var db = new Database()) { db.UpdateFame(psr.Account, -10); db.Dispose(); } var weaponsT5 = TierLoot.WeaponItems[5].ToList(); var weaponsT6 = TierLoot.WeaponItems[6].ToList(); var weaponsT7 = TierLoot.WeaponItems[7].ToList(); var abilitiesT3 = TierLoot.AbilityItems[2].ToList(); var ringsT3 = TierLoot.RingItems[3].ToList(); var armorT6 = TierLoot.ArmorItems[6].ToList(); var armorT7 = TierLoot.ArmorItems[7].ToList(); var armorT8 = TierLoot.ArmorItems[8].ToList(); var calculator = Random.Next(1, 1000); if (calculator <= 600) { SendHelp("Better luck next time!"); } else if (calculator <= 700 && calculator > 600) { SendHelp("Congratulations! You won a T5 Weapon!"); weaponsT5.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = weaponsT5[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 750 && calculator > 700) { SendHelp("Congratulations! You won a T6 Weapon!"); weaponsT6.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = weaponsT6[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 787.5 && calculator > 775) { SendHelp("Congratulations! You won a T7 Weapon!"); weaponsT7.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = weaponsT7[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 800 && calculator > 787.5) { SendHelp("Congratulations! You won a T3 Ability!"); abilitiesT3.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = abilitiesT3[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 850 && calculator > 800) { SendHelp("Congratulations! You won a T6 Armor!"); armorT6.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = armorT6[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 875 && calculator > 850) { SendHelp("Congratulations! You won a T7 Armor!"); armorT7.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = armorT7[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 887.5 && calculator > 875) { SendHelp("Congratulations! You won a T8 Armor!"); armorT8.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = armorT8[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 900 && calculator > 887.5) { SendHelp("Congratulations! You won a T3 Ring!"); ringsT3.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = ringsT3[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 905 && calculator > 900) { SendHelp("Too bad! You only got 1 fame!"); Client.Database.UpdateFame(Client.Account, 1); Fame += 1; UpdateCount++; } else if (calculator <= 910 && calculator > 905) { SendHelp("Too bad! You only got 5 fame!"); Client.Database.UpdateFame(Client.Account, 5); Fame += 5; UpdateCount++; } else if (calculator <= 940 && calculator > 910) { SendHelp("You won back the fame you paid!"); Client.Database.UpdateFame(Client.Account, 10); Fame += 10; UpdateCount++; } else if (calculator <= 970 && calculator > 940) { SendHelp("Nice! You won 25 fame!"); Client.Database.UpdateFame(Client.Account, 25); Fame += 25; UpdateCount++; } else if (calculator <= 985 && calculator > 970) { SendHelp("Nice! You won 50 fame!"); Client.Database.UpdateFame(Client.Account, 50); Fame += 50; UpdateCount++; } else if (calculator <= 990 && calculator > 985) { SendHelp("Very Nice! You won 100 fame!"); Client.Database.UpdateFame(Client.Account, 100); Fame += 100; UpdateCount++; } else if (calculator <= 994 && calculator > 990) { SendHelp("Awesome! You won 500 fame!"); Client.Database.UpdateFame(Client.Account, 500); Fame += 500; UpdateCount++; } else if (calculator <= 997 && calculator > 994) { SendHelp("Amazing! You won 1000 fame!"); Client.Database.UpdateFame(Client.Account, 1000); Fame += 1000; UpdateCount++; } else if (calculator <= 999 && calculator > 997) { SendHelp("Amazing! You won 5000 fame!"); Client.Database.UpdateFame(Client.Account, 5000); Fame += 5000; UpdateCount++; } else if (calculator <= 1000 && calculator > 999) { SendHelp("Incredible! You won the 10000 fame jackpot!"); foreach (var i in RealmManager.Clients.Values) { i.SendPacket(new TextPacket { BubbleTime = 0, Stars = -1, Name = "#Announcement", Text = Name + " has won the 10000 Fame jackpot on the bronze slot machines!" }); } Client.Database.UpdateFame(Client.Account, 10000); Fame += 10000; UpdateCount++; } psr.SendPacket(new BuyResultPacket { Result = 0 }); } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Canceled"); psr.SendPacket(new BuyResultPacket { Result = 0 }); } } }
public override World GetInstance(Client client) { return(RealmManager.AddWorld(new MadLabMap())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new TurkeyMap())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new XmlWorld(_d))); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new ForbiddenJungle())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new ExportedMap(js, name))); }
public override World GetInstance(Client client) { return(RealmManager.AddWorld(new XMLWorld(d))); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new GuildHall(Guild))); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new PirateCave())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new OryxsCastle())); }
public override World GetInstance(Client client) { return(RealmManager.AddWorld(new Vault(false, client))); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new ShadowWell())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new LairofDraconis())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new NexusDefense())); }
public override World GetInstance(Client client) { return(RealmManager.AddWorld(new SnakePit())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new DoomCrystal())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new ChristmasCellarMap())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new Vault(false, psr))); }
public void UsePortal(RealmTime time, UsePortalPacket pkt) { var entity = Owner.GetEntity(pkt.ObjectId); if (entity == null || !entity.Usable) { return; } World world = null; var player = this; Portal p = null; if (entity is Portal) { p = entity as Portal; world = p.WorldInstance; } if (world == null) { if (p != null) { var setWorldInstance = true; var d = ""; if (XmlDatas.IdToDungeon.TryGetValue(entity.ObjectType, out d)) { world = RealmManager.AddWorld(new XmlWorld(XmlDatas.DungeonDescs[d])); } else { switch (entity.ObjectType) //handling default case for not found. Add more as implemented { case 0x0703: //portal of cowardice { if (RealmManager.PlayerWorldMapping.ContainsKey(AccountId)) { //may not be valid, realm recycled? world = RealmManager.PlayerWorldMapping[AccountId]; } //also reconnecting to vault is a little unexpected else if (world.Id == -5 || world.Id == -11) { world = RealmManager.GetWorld(World.NEXUS_ID); } else { world = RealmManager.GetWorld(World.NEXUS_ID); } } break; case 0x0d40: { if (RealmManager.PlayerWorldMapping.ContainsKey(AccountId)) { //may not be valid, realm recycled? world = RealmManager.PlayerWorldMapping[AccountId]; } //also reconnecting to vault is a little unexpected else if (world.Id == -5 || world.Id == -11) { world = RealmManager.GetWorld(World.NEXUS_ID); } else { world = RealmManager.GetWorld(World.NEXUS_ID); } } break; case 0x0712: world = RealmManager.GetWorld(World.NEXUS_ID); break; case 0x071d: world = RealmManager.GetWorld(World.NEXUS_ID); break; case 0x071c: world = RealmManager.Monitor.GetRandomRealm(); break; case 0x0720: world = RealmManager.PlayerVault(psr); setWorldInstance = false; break; case 0x071e: world = RealmManager.AddWorld(new Kitchen()); break; case 0x0ffa: //these need to match IDs //world = RealmManager.GetWorld(World.GauntletMap); break; //this creates a singleton dungeon world = RealmManager.AddWorld(new Island()); break; //this allows each dungeon to be unique case 0x0ffc: world = RealmManager.AddWorld(new WineCellarMap()); break; case 0x1900: world = RealmManager.AddWorld(new ArenaMap()); break; case 0x0730: world = RealmManager.AddWorld(new OceanTrench()); break; case 0x070c: world = RealmManager.AddWorld(new SpriteWorld()); break; case 0x071b: world = RealmManager.AddWorld(new Abyss()); break; case 0x071a: world = RealmManager.AddWorld(new UndeadLair()); break; case 0x1901: world = RealmManager.AddWorld(new VoidWorld()); break; case 0x072c: world = RealmManager.AddWorld(new TombMap()); break; case 0x1905: { psr.SendPacket(new TextBoxPacket { Button1 = "Enter", Button2 = "Cancel", Message = "Join the arena at the price of 150 fame?", Title = "Arena Confirmation", Type = "EnterArena1" }); } break; case 0x1908: psr.SendPacket(new TextBoxPacket { Button1 = "Enter", Button2 = "Cancel", Message = "Join the free arena?", Title = "Arena Confirmation", Type = "EnterArena2" }); break; case 0x0742: world = RealmManager.AddWorld(new BeachZone()); break; case 0x0718: world = RealmManager.AddWorld(new SnakePit()); break; case 0x0890: world = RealmManager.AddWorld(new MadLabMap()); break; case 0x1919: world = RealmManager.AddWorld(new Secret()); break; case 0x1923: world = RealmManager.AddWorld(new ZombieMap()); break; default: SendError("Portal Not Implemented!"); break; case 0x195d: world = RealmManager.AddWorld(new MarketMap()); break; case 0x070d: world = RealmManager.Monitor.GetRandomRealm(); break; case 0x070e: world = RealmManager.Monitor.GetRandomRealm(); break; case 0x0704: world = RealmManager.Monitor.GetRandomRealm(); break; case 0x753E: world = RealmManager.AddWorld(new LairofDraconis()); break; case 0x7002: world = RealmManager.AddWorld(new PartyCellarMap()); break; case 0x701c: { psr.SendPacket(new TextBoxPacket { Button1 = "Enter", Button2 = "Cancel", Message = "Join sheep herding at the price of 500 fame?", Title = "Sheep Herding", Type = "SheepHerding" }); } break; case 0x7024: { psr.SendPacket(new TextBoxPacket { Button1 = "Yes", Button2 = "Cancel", Message = "Join zombies at the price of 100 fame?", Title = "Zombies", Type = "Zombies" }); } break; case 0x4a2b: { psr.SendPacket(new TextBoxPacket { Button1 = "Yes", Button2 = "Cancel", Message = "Sorry, this isn't quite done yet. Look forward to it, though.", Title = "Nexus Defense", Type = "Nexus Defense" }); } break; case 0x7025: world = RealmManager.AddWorld(new ForestMap()); break; case 0x4a29: world = RealmManager.AddWorld(new ChristmasCellarMap()); break; case 0x4a2a: world = RealmManager.AddWorld(new TurkeyMap()); break; case 0x5050: world = RealmManager.AddWorld(new Shatters()); break; case 0x2fbb: world = RealmManager.AddWorld(new EC()); break; case 0x0d7b: world = RealmManager.AddWorld(new OryxChamberMap()); break; } } if (setWorldInstance) { p.WorldInstance = world; } } else { switch (entity.ObjectType) // Special Portals that cannot be the portal class { case 0x072f: world = RealmManager.GuildHallWorld(Guild); break; default: psr.SendPacket(new TextPacket { BubbleTime = 0, Stars = -1, Name = "", Text = "Semi-Portal Not Implemented!" }); break; } } } //used to match up player to last realm they were in, to return them to it. Sometimes is odd, like from Vault back to Vault... if (RealmManager.PlayerWorldMapping.ContainsKey(AccountId)) { World tempWorld; RealmManager.PlayerWorldMapping.TryRemove(AccountId, out tempWorld); } RealmManager.PlayerWorldMapping.TryAdd(AccountId, Owner); psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new ElderSpiderDen())); }
public override World GetInstance(Client client) { return(RealmManager.AddWorld(new WineCellarMap())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new UndeadLair())); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new Tutorial(false))); }
public void TextBoxButton(TextBoxButtonPacket pkt) { string type = pkt.Type; if (type == "test") { psr.SendPacket(new TextBoxPacket { Button1 = "Yes", Button2 = "No", Message = "Do you want to enter the testing arena?", Title = "Testing Arena Confirmation", Type = "EnterTestArena" }); } if (type == "NewClient") { psr.Disconnect(); } if (type == "DecideArena") { if (pkt.Button == 1) { psr.SendPacket(new TextBoxPacket { Button1 = "Enter", Button2 = "Cancel", Message = "Host an arena at the price of x fame?", Title = "Arena Host Confirmation", Type = "EnterArena2" }); } else { psr.SendPacket(new TextBoxPacket { Button1 = "Enter", Button2 = "Cancel", Message = "Enter the arena solo at the price of 150 fame?", Title = "Solo Arena Confirmation", Type = "EnterArena1" }); } } if (type.Split(':')[0] == "ConfirmBan") { string pName = type.Split(':')[1]; if (pkt.Button == 2) { return; } if (psr.Account.Rank < 2) { SendError("You do not have permission to ban!"); return; } Player target; if ((target = RealmManager.FindPlayer(pName)) != null) { if (target.Client.Account.Rank > psr.Account.Rank) { SendError("You cannot ban someone higher than you!"); return; } MySqlCommand cmd; using (var db = new Database()) cmd = db.CreateQuery(); cmd.CommandText = "UPDATE accounts SET banned=1, rank=0 WHERE name=@name"; cmd.Parameters.AddWithValue("@name", target.Client.Account.Name); if (cmd.ExecuteNonQuery() == 0) { SendError("Ban failed for some reason"); return; } target.Client.Disconnect(); SendInfo(pName + " successfully banned!"); } } if (type.Split(':')[0] == "ConfirmIPBan") { string pName = type.Split(':')[1]; if (pkt.Button == 2) { return; } if (psr.Account.Rank < 2) { SendError("You do not have permission to ban!"); return; } Player target; if ((target = RealmManager.FindPlayer(pName)) != null) { if (target.Client.Account.Rank > psr.Account.Rank) { SendError("You cannot ban someone higher than you!"); return; } string address = target.Client.IP.Address; MySqlCommand cmd; using (var db = new Database()) cmd = db.CreateQuery(); cmd.CommandText = "UPDATE ips SET banned=1 WHERE ip=@Adress"; cmd.Parameters.AddWithValue("Adress", target.Client.IP.Address); if (cmd.ExecuteNonQuery() == 0) { SendInfo("Could not ban"); return; } target.Client.Disconnect(); SendInfo("IP successfully Banned"); } } if (type == "EnterTestArena") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 150) { /*RealmManager.PlayerWorldMapping.TryAdd(this.AccountId, Owner); * psr.Reconnect(new ReconnectPacket() * { * Host = "", * Port = 2050, * GameId = world.Id, * Name = world.Name, * Key = Empty<byte>.Array, * }); */ } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Cancelled entering arena."); } } if (type == "EnterArena1") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 150) { using (var db = new Database()) db.UpdateFame(psr.Account, -150); World world = RealmManager.GetWorld(World.NEXUS_ID); bool fworld = false; foreach (var i in RealmManager.Worlds) { if (i.Value is BattleArenaMap) { if ((i.Value as BattleArenaMap).Joinable) { world = i.Value; fworld = true; break; } } } if (!fworld) { world = RealmManager.AddWorld(new BattleArenaMap()); } psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Cancelled entering arena."); } } if (type == "EnterArena2") { if (pkt.Button == 1) { World world = RealmManager.GetWorld(World.NEXUS_ID); bool fworld = false; foreach (var i in RealmManager.Worlds) { if (i.Value is BattleArenaMap2) { if ((i.Value as BattleArenaMap2).Joinable) { world = i.Value; fworld = true; break; } } } if (!fworld) { world = RealmManager.AddWorld(new BattleArenaMap2()); } psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); } else { SendInfo("Cancelled entering arena."); } } if (type == "SheepHerding") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 500) { using (var db = new Database()) db.UpdateFame(psr.Account, -500); World world = RealmManager.GetWorld(World.NEXUS_ID); bool fworld = false; foreach (var i in RealmManager.Worlds) { if (i.Value is Herding) { if ((i.Value as Herding).Joinable) { world = i.Value; fworld = true; break; } } } if (!fworld) { world = RealmManager.AddWorld(new Herding()); } psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Cancelled entering sheep herding."); } } if (type == "Zombies") { if (pkt.Button == 1) { if (Client.Account.Stats.Fame >= 100) { using (var db = new Database()) db.UpdateFame(psr.Account, -100); World world = RealmManager.GetWorld(World.NEXUS_ID); bool fworld = false; foreach (var i in RealmManager.Worlds) { if (i.Value is ZombieMG) { if ((i.Value as ZombieMG).Joinable) { world = i.Value; fworld = true; break; } } } if (!fworld) { world = RealmManager.AddWorld(new ZombieMG()); } psr.Reconnect(new ReconnectPacket { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); } else { SendHelp("Not Enough Fame"); } } else { SendInfo("Cancelled entering zombies."); } } if (type == "Nexus Defense") { if (pkt.Button == 1) { SendInfo("Cancelled entering Nexus Defense."); } else { SendInfo("Cancelled entering Nexus Defense."); } } if (type == "SlotMachine1") { if (pkt.Button == 1) { List <Item> weaponsT5 = TierLoot.WeaponItems[5].ToList(); List <Item> weaponsT6 = TierLoot.WeaponItems[6].ToList(); List <Item> weaponsT7 = TierLoot.WeaponItems[7].ToList(); List <Item> abilitiesT3 = TierLoot.AbilityItems[2].ToList(); List <Item> ringsT3 = TierLoot.RingItems[3].ToList(); List <Item> armorT6 = TierLoot.ArmorItems[6].ToList(); List <Item> armorT7 = TierLoot.ArmorItems[7].ToList(); List <Item> armorT8 = TierLoot.ArmorItems[8].ToList(); int calculator = Random.Next(1, 1000); if (calculator <= 600) { SendHelp("Better luck next time!"); } else if (calculator <= 700 && calculator > 600) { SendHelp("Congratulations! You won a T5 Weapon!"); weaponsT5.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = weaponsT5[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 750 && calculator > 700) { SendHelp("Congratulations! You won a T6 Weapon!"); weaponsT6.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = weaponsT6[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 787.5 && calculator > 775) { SendHelp("Congratulations! You won a T7 Weapon!"); weaponsT7.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = weaponsT7[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 800 && calculator > 787.5) { SendHelp("Congratulations! You won a T3 Ability!"); abilitiesT3.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = abilitiesT3[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 850 && calculator > 800) { SendHelp("Congratulations! You won a T6 Armor!"); armorT6.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = armorT6[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 875 && calculator > 850) { SendHelp("Congratulations! You won a T7 Armor!"); armorT7.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = armorT7[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 887.5 && calculator > 875) { SendHelp("Congratulations! You won a T8 Armor!"); armorT8.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = armorT8[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 900 && calculator > 887.5) { SendHelp("Congratulations! You won a T3 Ring!"); ringsT3.Shuffle(); var container = new Container(0x0507, 1000 * 60, true) { BagOwner = psr.Account.AccountId }; container.Inventory[0] = ringsT3[0]; container.Move(X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5)); container.Size = 75; Owner.EnterWorld(container); } else if (calculator <= 905 && calculator > 900) { SendHelp("Too bad! You only got 1 fame!"); Client.Database.UpdateFame(Client.Account, 1); Fame += 1; UpdateCount++; } else if (calculator <= 910 && calculator > 905) { SendHelp("Too bad! You only got 5 fame!"); Client.Database.UpdateFame(Client.Account, 5); Fame += 5; UpdateCount++; } else if (calculator <= 940 && calculator > 910) { SendHelp("You won back the fame you paid!"); Client.Database.UpdateFame(Client.Account, 10); Fame += 10; UpdateCount++; } else if (calculator <= 970 && calculator > 940) { SendHelp("Nice! You won 25 fame!"); Client.Database.UpdateFame(Client.Account, 25); Fame += 25; UpdateCount++; } else if (calculator <= 985 && calculator > 970) { SendHelp("Nice! You won 50 fame!"); Client.Database.UpdateFame(Client.Account, 50); Fame += 50; UpdateCount++; } else if (calculator <= 990 && calculator > 985) { SendHelp("Very Nice! You won 100 fame!"); Client.Database.UpdateFame(Client.Account, 100); Fame += 100; UpdateCount++; } else if (calculator <= 994 && calculator > 990) { SendHelp("Awesome! You won 500 fame!"); Client.Database.UpdateFame(Client.Account, 500); Fame += 500; UpdateCount++; } else if (calculator <= 997 && calculator > 994) { SendHelp("Amazing! You won 1000 fame!"); Client.Database.UpdateFame(Client.Account, 1000); Fame += 1000; UpdateCount++; } else if (calculator <= 999 && calculator > 997) { SendHelp("Amazing! You won 5000 fame!"); Client.Database.UpdateFame(Client.Account, 5000); Fame += 5000; UpdateCount++; } else if (calculator <= 1000 && calculator > 999) { SendHelp("Incredible! You won the 10000 fame jackpot!"); foreach (ClientProcessor i in RealmManager.Clients.Values) { i.SendPacket(new TextPacket { BubbleTime = 0, Stars = -1, Name = "#Announcement", Text = Name + " has won the 10000 Fame jackpot on the bronze slot machines!" }); } Client.Database.UpdateFame(Client.Account, 10000); Fame += 10000; UpdateCount++; } psr.SendPacket(new BuyResultPacket { Result = 0 }); } else { SendInfo("Canceled"); psr.SendPacket(new BuyResultPacket { Result = 0 }); } } }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new OceanTrench())); }
public void UsePortal(RealmTime time, UsePortalPacket pkt) { Entity entity = Owner.GetEntity(pkt.ObjectId); if (entity == null || !entity.Usable) { return; } World world = null; Portal p = null; if (entity is Portal) { p = entity as Portal; world = p.WorldInstance; } if (world == null) { if (p != null) { bool setWorldInstance = true; string d = ""; if (XmlDatas.IdToDungeon.TryGetValue(entity.ObjectType, out d)) { world = RealmManager.AddWorld(new XMLWorld(XmlDatas.DungeonDescs[d])); } else { switch (entity.ObjectType) //handling default case for not found. Add more as implemented { case 0x070e: case 0x0703: //portal of cowardice { if (RealmManager.PlayerWorldMapping.ContainsKey(this.AccountId)) //may not be valid, realm recycled? { world = RealmManager.PlayerWorldMapping[this.AccountId]; //also reconnecting to vault is a little unexpected } else if (world.Id == -5 || world.Id == -11) { world = RealmManager.GetWorld(World.NEXUS_ID); } else { world = RealmManager.GetWorld(World.NEXUS_ID); } setWorldInstance = false; } break; case 0x0712: world = RealmManager.GetWorld(World.NEXUS_ID); break; case 0x071d: world = RealmManager.GetWorld(World.NEXUS_ID); break; case 0x071c: world = RealmManager.Monitor.GetRandomRealm(); break; case 0x0720: world = RealmManager.PlayerVault(psr); setWorldInstance = false; break; case 0x071e: world = RealmManager.AddWorld(new Kitchen()); break; case 0x0ffa: //these need to match IDs //world = RealmManager.GetWorld(World.GauntletMap); break; //this creates a singleton dungeon world = RealmManager.AddWorld(new Island()); break; //this allows each dungeon to be unique case 0x0ffc: world = RealmManager.AddWorld(new WineCellarMap()); break; case 0x1900: world = RealmManager.AddWorld(new ArenaMap()); break; case 0x0730: world = RealmManager.AddWorld(new OceanTrench()); break; case 0x070c: world = RealmManager.AddWorld(new SpriteWorld()); break; case 0x071b: world = RealmManager.AddWorld(new Abyss()); break; case 0x071a: world = RealmManager.AddWorld(new UndeadLair()); break; case 0x1901: world = RealmManager.AddWorld(new VoidWorld()); break; case 0x072c: world = RealmManager.AddWorld(new TombMap()); break; case 0x0742: world = RealmManager.AddWorld(new BeachZone()); break; case 0x0718: world = RealmManager.AddWorld(new SnakePit()); break; case 0x0890: world = RealmManager.AddWorld(new MadLabMap()); break; case 0x1905: world = RealmManager.AddWorld(new BattleArenaMap()); setWorldInstance = false; break; case 0x1919: world = RealmManager.AddWorld(new Secret()); break; case 0x1923: world = RealmManager.AddWorld(new ZombieMap()); break; case 0x195d: world = RealmManager.AddWorld(new MarketMap()); break; case 0x195f: world = RealmManager.AddWorld(new Mine()); break; case 0x1972: world = RealmManager.MineWorld((Owner as Mine).Level + 1); break; case 0x1973: world = RealmManager.MineWorld((Owner as Mine).Level - 1); break; default: SendError("Portal Not Implemented!"); break; } } if (setWorldInstance) { p.WorldInstance = world; } } else { switch (entity.ObjectType) // Special Portals that cannot be the portal class { case 0x072f: world = RealmManager.GuildHallWorld(Guild); break; default: psr.SendPacket(new TextPacket { BubbleTime = 0, Stars = -1, Name = "", Text = "Semi-Portal Not Implemented!" }); break; } } } //used to match up player to last realm they were in, to return them to it. Sometimes is odd, like from Vault back to Vault... if (RealmManager.PlayerWorldMapping.ContainsKey(this.AccountId)) { World tempWorld; RealmManager.PlayerWorldMapping.TryRemove(this.AccountId, out tempWorld); } RealmManager.PlayerWorldMapping.TryAdd(this.AccountId, Owner); psr.Reconnect(new ReconnectPacket() { Host = "", Port = 2050, GameId = world.Id, Name = world.Name, Key = Empty <byte> .Array, }); }
public override World GetInstance(ClientProcessor psr) { return(RealmManager.AddWorld(new Mine(Level))); }