Example #1
0
 public void UsePortal(RealmTime time, UsePortalPacket pkt)
 {
     Entity entity = Owner.GetEntity(pkt.ObjectId);
     if (entity == null) return;
     try
     {
         var eport = (Portal)entity;
         if (!eport.Usable) return;
     }
     catch
     {
         //the only error occurs when the player enters the guild hall: it's a static object
     }
     Portal portal = null;
     World world = null;
     if (entity is Portal)
     {
         portal = entity as Portal;
         world = portal.WorldInstance;
     }
     if (world == null)
     {
         if (portal != null)
         {
             switch (entity.ObjectType)
             {
                 case 0x0712:
                 case 0x071d:
                     world = RealmManager.GetWorld(World.NEXUS_ID); break;
                 case 0x071c:
                     world = RealmManager.Monitor.GetRandomRealm(); break;
                 case 0x0720:
                     world = RealmManager.GetWorld(World.VAULT_ID); break;
                 case 0x071e:
                     world = RealmManager.AddWorld(new Kitchen()); break;
                 case 0x233D:
                     world = RealmManager.AddWorld(new Banana()); break;
                 case 0x2553:
                     world = RealmManager.AddWorld(new Gee()); break; //map creating tutorial world
                 case 0x0721:
                     world = RealmManager.AddWorld(new WineCellar()); break;
                 case 0x0742:
                     world = RealmManager.AddWorld(new Beachzone()); break;
             }
             portal.WorldInstance = world;
         }
         else
         {
             switch (entity.ObjectType)
             {
                 case 0x072f:
                     world = RealmManager.GHall(Guild); break;
                 default:
                     world = null;
                     break;
             }
         }
     }
     psr.Reconnect(new ReconnectPacket()
     {
         Host = "",
         Port = 2050,
         GameId = world.Id,
         Name = world.Name,
         Key = Empty<byte>.Array,
     });
 }
Example #2
0
        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,
            });
        }
Example #3
0
 public void UsePortal(RealmTime time, UsePortalPacket pkt)
 {
     Portal entity = Owner.GetEntity(pkt.ObjectId) as Portal;
     if (entity == null || !entity.Usable) return;
     World world = entity.WorldInstance;
     if (world == null)
     {
         switch (entity.ObjectType)
         {
             case 0x0712:
             case 0x071d:
                 world = RealmManager.GetWorld(World.NEXUS_ID); break;
             case 0x071c:
                 world = RealmManager.Monitor.GetRandomRealm(); break;
             case 0x0720:
                 world = RealmManager.GetWorld(World.VAULT_ID); break;
             case 0x071e:
                 world = RealmManager.AddWorld(new Kitchen()); break;
             case 0x233D:
                 world = RealmManager.AddWorld(new Banana()); break;
             case 0x2553:
                 world = RealmManager.AddWorld(new Gee()); break; //map creating tutorial world
             case 0x0721:
                 world = RealmManager.AddWorld(new WineCellar()); break;
             case 0x0742:
                 world = RealmManager.AddWorld(new Beachzone()); break;
         }
         entity.WorldInstance = world;
     }
     psr.Reconnect(new ReconnectPacket()
     {
         Host = "",
         Port = 2050,
         GameId = world.Id,
         Name = world.Name,
         Key = Empty<byte>.Array,
     });
 }
Example #4
0
        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,
            });
        }
Example #5
0
        public void UsePortal(RealmTime time, UsePortalPacket pkt)
        {
            Portal entity = Owner.GetEntity(pkt.ObjectId) as Portal;
            if (entity == null || !entity.Usable) return;
            World world = entity.WorldInstance;
            if (world == null)
            {
                switch (entity.ObjectType) //handling default case for not found. Add more as implemented
                {
                    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
                                world = RealmManager.GetWorld(World.NEXUS_ID);
                        } break;
                    case 0x0712:
                        world = RealmManager.GetWorld(World.VAULT_ID); break;
                    case 0x071d:
                        world = RealmManager.GetWorld(World.NEXUS_ID); break;
                    case 0x071c:
                        world = RealmManager.Monitor.GetRandomRealm(); break;
                    case 0x0720:
                        world = RealmManager.GetWorld(World.VAULT_ID); break;
                    case 0x071e:
                        world = RealmManager.AddWorld(new Kitchen()); break;
                    case 0x071f: //these need to match IDs
                        //world = RealmManager.GetWorld(World.GauntletMap); break; //this creates a singleton dungeon
                        world = RealmManager.AddWorld(new GauntletMap()); break; //this allows each dungeon to be unique
                    default: psr.SendPacket(new TextPacket
                    {
                        BubbleTime = 0,
                        Stars = -1,
                        Name = "",
                        Text = "Portal Not Implemented!"
                    }); break;
                    //case 1795
                    /*case 0x0712:
                        world = RealmManager.GetWorld(World.NEXUS_ID); break;*/
                }

                entity.WorldInstance = world;
            }

            //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,
            });
        }