Ejemplo n.º 1
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 (Manager.PlayerWorldMapping.ContainsKey(this.AccountId))  //may not be valid, realm recycled?
                                world = Manager.PlayerWorldMapping[this.AccountId];  //also reconnecting to vault is a little unexpected
                            else
                                world = Manager.GetWorld(World.NEXUS_ID);
                        } break;
                    case 0x0712:
                        world = Manager.GetWorld(World.VAULT_ID); break;
                    case 0x071d:
                        world = Manager.GetWorld(World.NEXUS_ID); break;
                    case 0x071c:
                        world = Manager.Monitor.GetRandomRealm(); break;
                    case 0x0720:
                        world = Manager.GetWorld(World.VAULT_ID); break;
                    case 0x071e:
                        world = Manager.AddWorld(new Kitchen()); break;
                    case 0x071f: //these need to match IDs
                        //world = RealmManager.GetWorld(World.GauntletMap); break; //this creates a singleton dungeon
                        world = Manager.AddWorld(new GauntletMap()); break; //this allows each dungeon to be unique
                    default: SendError("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 (Manager.PlayerWorldMapping.ContainsKey(this.AccountId))
            {
                World tempWorld;
                Manager.PlayerWorldMapping.TryRemove(this.AccountId, out tempWorld);
            }
            Manager.PlayerWorldMapping.TryAdd(this.AccountId, Owner);
            client.Reconnect(new ReconnectPacket()
            {
                Host = "",
                Port = 2050,
                GameId = world.Id,
                Name = world.Name,
                Key = Empty<byte>.Array,
            });
        }
Ejemplo n.º 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);
                                }
                                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(client);
                                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:
                            client.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);
            client.Reconnect(new ReconnectPacket()
            {
                Host = "",
                Port = 2050,
                GameId = world.Id,
                Name = world.Name,
                Key = Empty<byte>.Array,
            });
        }