示例#1
0
        private static void OnLogin(LoginEventArgs e)
        {
            var pm = e.Mobile as PlayerMobile;
            if (pm == null || !pm.IsYoung() || pm.IsYoung() && pm.Guild != null)
            {
                return;
            }

            if (NewGuildPersistence.Instance == null)
            {
                var NGP = new NewGuildPersistence();
            }

            if (NewGuildPersistence.Instance != null && NewGuildPersistence.JoinedIPs != null)
            {
                var loginIPs = ((Account) e.Mobile.Account).LoginIPs.ToArray();
                if (loginIPs.Any(ip => NewGuildPersistence.JoinedIPs.Contains(ip)))
                {
                    return;
                }
            }

            var g = (Guild) BaseGuild.FindByAbbrev("New");
            if (g != null)
            {
                e.Mobile.SendGump(new NewPlayerGuildJoinGump(g, e.Mobile));
            }
        }
        public NewGuildPersistence()
            : base(1)
        {
            if (_Instance == null || _Instance.Deleted)
                _Instance = this;
            else
                base.Delete();

            Movable = false;
            JoinedIPs = new List<IPAddress>();
        }
        public NewGuildPersistence()
            : base(1)
        {
            if (_Instance == null || _Instance.Deleted)
            {
                _Instance = this;
            }
            else
            {
                base.Delete();
            }

            Movable   = false;
            JoinedIPs = new List <IPAddress>();
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            JoinedIPs = new List<IPAddress>();

            int version = reader.ReadInt();

            int count = reader.ReadInt();
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    var r = reader.ReadIPAddress();
                    JoinedIPs.Add(r);
                }
            }
            _Instance = this;
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            JoinedIPs = new List <IPAddress>();

            int version = reader.ReadInt();

            int count = reader.ReadInt();

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    var r = reader.ReadIPAddress();
                    JoinedIPs.Add(r);
                }
            }
            _Instance = this;
        }
 public NewGuildPersistence(Serial serial)
     : base(serial)
 {
     _Instance = this;
 }
 public NewGuildPersistence(Serial serial)
     : base(serial)
 {
     _Instance = this;
 }