예제 #1
0
 internal void EnterZone(Character chr, Zone oldZone)
 {
     if (oldZone != null)
     {
         oldZone.LeaveZone(chr);
     }
     Template.OnPlayerEntered(chr, oldZone);
 }
예제 #2
0
파일: Zone.cs 프로젝트: NecroSharper/WCell
        internal void EnterZone(Character chr, Zone oldZone)
        {
            UpdateChannels(chr, oldZone);
            WorldStateHandler.SendInitWorldStates(chr, WorldStates, this);

            if (oldZone != null)
            {
                oldZone.LeaveZone(chr);
            }

            // update PvPState
            var isBg = Map.IsBattleground;

            if (RealmServerConfiguration.ServerType.HasAnyFlag(RealmServerType.PVP | RealmServerType.RPPVP) || isBg)
            {
                if (isBg || Template.IsHostileTo(chr))
                {
                    chr.UpdatePvPState(true, true);
                    chr.PlayerFlags |= PlayerFlags.PVP;
                    chr.PlayerFlags &= ~(PlayerFlags.InPvPSanctuary | PlayerFlags.FreeForAllPVP);
                }
                else if (Template.IsSanctuary)
                {
                    chr.PvPState     = PvPState.InPvPSanctuary;
                    chr.PlayerFlags |= PlayerFlags.InPvPSanctuary;
                    chr.PlayerFlags &= ~(PlayerFlags.PVP | PlayerFlags.FreeForAllPVP);
                }
                else
                {
                    chr.UpdatePvPState(false);
                    chr.PlayerFlags &= ~(PlayerFlags.PVP | PlayerFlags.InPvPSanctuary | PlayerFlags.FreeForAllPVP);
                }

                if (Template.IsArena)
                {
                    chr.PvPState     = PvPState.FFAPVP;
                    chr.PlayerFlags |= PlayerFlags.FreeForAllPVP;
                    chr.PlayerFlags &= ~(PlayerFlags.InPvPSanctuary);
                }
            }

            Template.OnPlayerEntered(chr, oldZone);
        }