public static bool TryConnect(ClientProcessor psr) { var acc = psr.Account; if (psr.ConnectedBuild != psr.clientVer) { psr.SendPacket(new svrPackets.TextPacket() { Name = "", BubbleTime = 0, Stars = -1, Text = "You are running an outdated client version." }); return(false); } if (acc.Banned) { return(false); } if (Clients.Count >= MAX_CLIENT) { return(false); } else { return(Clients.TryAdd(psr.Account.AccountId, psr)); } }
public static bool TryConnect(ClientProcessor psr) { var acc = psr.Account; if (psr.ConnectedBuild != psr.clientVer) { psr.SendPacket(new svrPackets.TextPacket() { Name = "", BubbleTime = 0, Stars = -1, Text = "Obtain an updated client from zeroeh.github.io" }); return(false); } if (acc.Banned) { return(false); } if (Clients.Count >= MAX_CLIENT) { return(false); } else { return(Clients.TryAdd(psr.Account.AccountId, psr)); } }
bool CheckResurrection() { for (int i = 0; i < 4; i++) { Item item = Inventory[i]; if (item == null || !item.Resurrects) { continue; } HP = Stats[0] + Stats[0]; MP = Stats[1] + Stats[1]; Inventory[i] = null; psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = string.Format("{0}'s {1} breaks and he disappears", Name, item.ObjectId) }); psr.Reconnect(new ReconnectPacket() { Host = "", Port = 2050, GameId = World.NEXUS_ID, Name = "Nexus", Key = Empty <byte> .Array, }); resurrecting = true; return(true); } return(false); }
public override void Init(World owner) { var rand = new Random(); int x, y; do { x = rand.Next(0, owner.Map.Width); y = rand.Next(0, owner.Map.Height); } while (owner.Map[x, y].Region != TileRegion.Spawn); Move(x + 0.5f, y + 0.5f); tiles = new byte[owner.Map.Width, owner.Map.Height]; fames = new FameCounter(this); SetNewbiePeriod(); if (!psr.CheckAccountInUse(AccountId)) { base.Init(owner); } else { psr.Disconnect(); } if (psr.Character.Pet >= 0) { GivePet((short)psr.Character.Pet); } try { SendAccountList(Locked, LOCKED_LIST_ID); } catch { } try { SendAccountList(Ignored, IGNORED_LIST_ID); } catch { } if (!psr.ConnectedBuild.StartsWith(psr.clientVer)) { psr.SendPacket(new TextBoxPacket { Title = "Outdated Client!", Message = "You are running an outdated client version.\nGet or play the latest one on the\nup-to-date <u><a href='http://forum.zerorealms.com'>web client</a></u>.", Button1 = "Okay" }); psr.Disconnect(); } }
public static bool TryConnect(ClientProcessor psr) { var acc = psr.Account; if (psr.ConnectedBuild != psr.clientVer) { psr.SendPacket(new svrPackets.TextPacket() { Name = "", BubbleTime = 0, Stars = -1, Text = "Obtain an updated client from zeroeh.github.io" }); return false; } if (acc.Banned) return false; if (Clients.Count >= MAX_CLIENT) return false; else return Clients.TryAdd(psr.Account.AccountId, psr); }
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); } } 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; 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 static bool TryConnect(ClientProcessor psr) { var acc = psr.Account; if (psr.ConnectedBuild != psr.clientVer) { psr.SendPacket(new svrPackets.TextPacket() { Name = "", BubbleTime = 0, Stars = -1, Text = "You are running an outdated client version." }); return false; } if (acc.Banned) return false; if (Clients.Count >= MAX_CLIENT) return false; else return Clients.TryAdd(psr.Account.AccountId, psr); }