예제 #1
0
        public static bool IsEnemy(Mobile from, Mobile to)
        {
            if (!Enabled || from == to)
            {
                return(false);
            }

            if (from is BaseCreature && ((BaseCreature)from).GetMaster() is PlayerMobile)
            {
                from = ((BaseCreature)from).GetMaster();
            }

            if (to is BaseCreature && ((BaseCreature)to).GetMaster() is PlayerMobile)
            {
                to = ((BaseCreature)to).GetMaster();
            }

            if (from == to || IsVvVCombatant(to) || IsVvVCombatant(from))
            {
                return(false);
            }

            VvVPlayerEntry fromentry = Instance.GetPlayerEntry <VvVPlayerEntry>(from);
            VvVPlayerEntry toentry   = Instance.GetPlayerEntry <VvVPlayerEntry>(to);

            Guild fromguild = from.Guild as Guild;
            Guild toguild   = to.Guild as Guild;

            if (fromentry == null || toentry == null || !fromentry.Active || !toentry.Active)
            {
                if (TempParticipants != null)
                {
                    CheckTempParticipants();

                    if ((fromentry != null && toentry == null || (fromentry == null && toentry != null)) &&
                        (TempParticipants.ContainsKey(from) || TempParticipants.ContainsKey(to)) &&
                        ((fromguild == null && toguild == null) || fromguild != toguild)) // one is vvv and the other isnt, seperate guilds
                    {
                        return(true);
                    }

                    if (fromentry == null && toentry == null &&
                        ((fromguild == null && toguild == null) || fromguild != toguild) &&
                        TempParticipants.ContainsKey(from) &&
                        TempParticipants.ContainsKey(to)) // neither are vvv, seperate guilds
                    {
                        return(true);
                    }
                }

                return(false);
            }

            if (toguild == null || fromguild == null)
            {
                return(true);
            }

            return(fromguild != toguild && !fromguild.IsAlly(toguild));
        }
예제 #2
0
        public static void RemoveTempParticipant(Mobile m)
        {
            if (TempParticipants == null)
            {
                return;
            }

            if (TempParticipants.ContainsKey(m))
            {
                TempParticipants.Remove(m);
                m.Delta(MobileDelta.Noto);
            }
        }
예제 #3
0
 public static bool IsVvVCombatant(Mobile mobile)
 {
     return(IsVvV(mobile) || (TempParticipants != null && TempParticipants.ContainsKey(mobile)));
 }