コード例 #1
0
ファイル: Preferences.cs プロジェクト: greeduomacro/last-wish
		public PreferencesController() : base( 0x1B7A )
		{
			Visible = false;
			Movable = false;

			m_Preferences = new Preferences();

			if ( Preferences.Instance == null )
				Preferences.Instance = m_Preferences;
			else
				Delete();
		}
コード例 #2
0
ファイル: Preferences.cs プロジェクト: Crome696/ServUO
        public PreferencesController()
            : base(0x1B7A)
        {
            this.Visible = false;
            this.Movable = false;

            this.m_Preferences = new Preferences();

            if (Preferences.Instance == null)
                Preferences.Instance = this.m_Preferences;
            else
                this.Delete();
        }
コード例 #3
0
ファイル: Preferences.cs プロジェクト: greeduomacro/last-wish
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Preferences = new Preferences( reader );
					Preferences.Instance = m_Preferences;
					break;
				}
			}
		}
コード例 #4
0
ファイル: Preferences.cs プロジェクト: greeduomacro/last-wish
		public PreferencesGump( Mobile from, Preferences prefs ) : base( 50, 50 )
		{
			m_From = from;
			m_Entry = prefs.Find( from );

			if ( m_Entry == null )
				return;

			List<Arena> arenas = Arena.Arenas;

			AddPage( 0 );

			int height = 12 + 20 + (arenas.Count * 31) + 24 + 12;

			AddBackground( 0, 0, 499+40-365, height, 0x2436 );

			for ( int i = 1; i < arenas.Count; i += 2 )
				AddImageTiled( 12, 32 + (i * 31), 475+40-365, 30, 0x2430 );

			AddAlphaRegion( 10, 10, 479+40-365, height - 20 );

			AddColumnHeader(  35, null );
			AddColumnHeader( 115, "Arena" );

			AddButton( 499+40-365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0 );
			AddButton( 499+40-365 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0 );

			for ( int i = 0; i < arenas.Count; ++i )
			{
				Arena ar = arenas[i];

				string name = ar.Name;

				if ( name == null )
					name = "(no name)";

				int x = 12;
				int y = 32 + (i * 31);

				int color = 0xCCFFCC;

				AddCheck( x + 3, y + 1, 9730, 9727, m_Entry.Disliked.Contains(name), i );
				x += 35;

				AddBorderedText( x + 5, y + 5, 115 - 5, name, color, 0 );
				x += 115;
			}
		}
コード例 #5
0
ファイル: Preferences.cs プロジェクト: greeduomacro/last-wish
		public PreferencesEntry( GenericReader reader, Preferences prefs, int version )
		{
			m_Preferences = prefs;

			switch ( version )
			{
				case 0:
				{
					m_Mobile = reader.ReadMobile();

					int count = reader.ReadEncodedInt();

					m_Disliked = new ArrayList( count );

					for ( int i = 0; i < count; ++i )
						m_Disliked.Add( reader.ReadString() );

					break;
				}
			}
		}
コード例 #6
0
ファイル: Preferences.cs プロジェクト: greeduomacro/last-wish
		public PreferencesEntry( Mobile mob, Preferences prefs )
		{
			m_Preferences = prefs;
			m_Mobile = mob;
			m_Disliked = new ArrayList();
		}
コード例 #7
0
ファイル: Arena.cs プロジェクト: nydehi/divinity
        public static Arena FindArena(ArrayList players)
        {
            Preferences prefs = Preferences.Instance;

            if (prefs == null)
            {
                return(FindArena());
            }

            if (m_Arenas.Count == 0)
            {
                return(null);
            }

            if (players.Count > 0)
            {
                Mobile first = (Mobile)players[0];

                ArrayList allControllers = ArenaController.Instances;

                for (int i = 0; i < allControllers.Count; ++i)
                {
                    ArenaController controller = (ArenaController)allControllers[i];

                    if (controller != null && !controller.Deleted && controller.Arena != null && controller.IsPrivate && controller.Map == first.Map && first.InRange(controller, 24))
                    {
                        Multis.BaseHouse house   = Multis.BaseHouse.FindHouseAt(controller);
                        bool             allNear = true;

                        for (int j = 0; j < players.Count; ++j)
                        {
                            Mobile check = (Mobile)players[j];
                            bool   isNear;

                            if (house == null)
                            {
                                isNear = (controller.Map == check.Map && check.InRange(controller, 24));
                            }
                            else
                            {
                                isNear = (Multis.BaseHouse.FindHouseAt(check) == house);
                            }

                            if (!isNear)
                            {
                                allNear = false;
                                break;
                            }
                        }

                        if (allNear)
                        {
                            return(controller.Arena);
                        }
                    }
                }
            }

            ArrayList arenas = new ArrayList();

            for (int i = 0; i < m_Arenas.Count; ++i)
            {
                Arena arena = (Arena)m_Arenas[i];

                if (!arena.IsOccupied)
                {
                    arenas.Add(new ArenaEntry(arena));
                }
            }

            if (arenas.Count == 0)
            {
                return((Arena)m_Arenas[0]);
            }

            int tc = 0;

            for (int i = 0; i < arenas.Count; ++i)
            {
                ArenaEntry ae = (ArenaEntry)arenas[i];

                for (int j = 0; j < players.Count; ++j)
                {
                    PreferencesEntry pe = prefs.Find((Mobile)players[j]);

                    if (pe.Disliked.Contains(ae.m_Arena.Name))
                    {
                        ++ae.m_VotesAgainst;
                    }
                    else
                    {
                        ++ae.m_VotesFor;
                    }
                }

                tc += ae.Value;
            }

            int rn = Utility.Random(tc);

            for (int i = 0; i < arenas.Count; ++i)
            {
                ArenaEntry ae = (ArenaEntry)arenas[i];

                if (rn < ae.Value)
                {
                    return(ae.m_Arena);
                }

                rn -= ae.Value;
            }

            return(((ArenaEntry)arenas[Utility.Random(arenas.Count)]).m_Arena);
        }
コード例 #8
0
		public PreferencesEntry( Mobile mob, Preferences prefs )
		{
			m_Preferences = prefs;
			m_Mobile = mob;
			m_Disliked = new List<string>();
		}
コード例 #9
0
 public PreferencesEntry(Mobile mob, Preferences prefs)
 {
     m_Preferences = prefs;
     m_Mobile      = mob;
     m_Disliked    = new ArrayList();
 }