Exemplo n.º 1
0
    public bool IsDungeonUsingFieldInstance(FieldManager fieldManager, Player player) //alternatively this could be: IsFieldInstanceUsed in FieldManagerFactory
    {
        // fieldManager.MapId: left map that is to be destroyed
        // player.MapId: travel destination of the player
        DungeonSession currentDungeonSession = GetDungeonSessionBySessionId(player.DungeonSessionId);

        if (currentDungeonSession == null) // is not null after entering dungeon via directory
        {
            return(false);                 // no dungeon session -> the map is unused by dungeon
        }

        // check map that is left:
        if (!currentDungeonSession.IsDungeonSessionMap(fieldManager.MapId)) // left map is not dungeon map e.g. tria
        {
            return(false);
        }

        // travel destination is a dungeon map: lobby to dungeon or dungeon to lobby
        if (!currentDungeonSession.IsDungeonSessionMap(player.MapId))
        {
            return(false);
        }

        // if travel destination is a dungeon it has to be the same instance or it does not pertain to the same DungeonSession.
        return(player.InstanceId == currentDungeonSession.DungeonInstanceId);
    }
Exemplo n.º 2
0
        public void EnterField(Player player)
        {
            // If moving maps, need to get the FieldManager for new map
            if (player.MapId != FieldManager.MapId || player.InstanceId != FieldManager.InstanceId)
            {
                FieldManager.RemovePlayer(this, FieldPlayer); // Leave previous field

                if (FieldManagerFactory.Release(FieldManager.MapId, FieldManager.InstanceId, player))
                {
                    //If instance is destroyed, reset dungeonSession
                    DungeonSession dungeonSession = GameServer.DungeonManager.GetDungeonSessionByInstanceId(FieldManager.InstanceId);
                    //check if the destroyed map was a dungeon map
                    if (dungeonSession != null && FieldManager.InstanceId == dungeonSession.DungeonInstanceId &&
                        dungeonSession.IsDungeonSessionMap(FieldManager.MapId))
                    {
                        GameServer.DungeonManager.ResetDungeonSession(player, dungeonSession);
                    }
                }

                // Initialize for new Map
                FieldManager = FieldManagerFactory.GetManager(player);
                FieldPlayer  = FieldManager.RequestFieldObject(Player);
            }

            FieldManager.AddPlayer(this, FieldPlayer); // Add player
        }
Exemplo n.º 3
0
    public static void HandleEnterDungeonButton(GameSession session)
    {
        Party          party          = session.Player.Party;
        DungeonSession dungeonSession = GameServer.DungeonManager.GetDungeonSessionBySessionId(party.DungeonSessionId);

        if (dungeonSession == null) //Can be removed when enter dungeon button is removed on dungeonsession deletion.
        {
            return;
        }
        if (dungeonSession.IsDungeonSessionMap(session.Player.MapId))
        {
            session.SendNotice("You are already in a dungeon");
            return;
        }
        session.Player.Warp(dungeonSession.DungeonLobbyId, instanceId: dungeonSession.DungeonInstanceId);
    }