Esempio n. 1
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
        }
Esempio n. 2
0
 // Called first time when starting a new session
 public void InitPlayer(Player player)
 {
     Debug.Assert(FieldPlayer == null, "Not allowed to reinitialize player.");
     FieldManager = FieldManagerFactory.GetManager(player.MapId);
     FieldPlayer  = FieldManager.RequestFieldObject(player);
     GameServer.Storage.AddPlayer(player);
 }
Esempio n. 3
0
        // Called first time when starting a new session
        public void InitPlayer(Player player)
        {
            Debug.Assert(FieldPlayer == null, "Not allowed to reinitialize player.");
            FieldManager = FieldManagerFactory.GetManager(player);
            FieldPlayer  = FieldManager.RequestFieldObject(player);
            GameServer.Storage.AddPlayer(player);
            GameServer.BuddyManager.SetFriendSessions(player);

            Party party = GameServer.PartyManager.GetPartyByMember(player.CharacterId);

            if (party != null)
            {
                party.BroadcastPacketParty(PartyPacket.LoginNotice(player), this);
            }

            player.BuddyList.ForEach(buddy =>
            {
                if (buddy.Friend?.Session?.Connected() ?? false)
                {
                    Buddy myBuddy = GameServer.BuddyManager.GetBuddyByPlayerAndId(buddy.Friend, buddy.SharedId);
                    buddy.Friend.Session.Send(BuddyPacket.LoginLogoutNotification(myBuddy));
                    buddy.Friend.Session.Send(BuddyPacket.UpdateBuddy(myBuddy));
                }
            });
        }
Esempio n. 4
0
        public void EnterField(int newMapId)
        {
            // If moving maps, need to get the FieldManager for new map
            if (newMapId != FieldManager.MapId)
            {
                FieldManager.RemovePlayer(this, FieldPlayer); // Leave previous field
                FieldManagerFactory.Release(FieldManager.MapId);

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

            FieldManager.AddPlayer(this, FieldPlayer); // Add player
        }