public ListTestGump() : base(0,0)
		{
			SkillSettings.DoTell("Setting up new ListTestGump.");
			BaseSkin skin = SkinHelper.getSkin( SkillSettings.ControlSkinName );
			this.AddBackground( 0, 0, 500, 500, 9270 );
			GumpList list = new GumpList(this, "details", skin );
			SkillSettings.DoTell("List Created.");
			GumpListEntry e1 = new GumpListEntry(0, 0, list, skin.EntryDefaultWidth, skin.EntryDefaultHeight);
			e1.AddColumn("This is a column.");
			e1.AddColumn("This is a 2nd column.");
			e1.AddColumn("This is the 3rd column.");
			SkillSettings.DoTell("Entry 1 Created.");
			GumpListEntry e2 = new GumpListEntry(0, 0, list, skin.EntryDefaultWidth, skin.EntryDefaultHeight);
			e2.AddColumn("This is r2 c1.");
			e2.AddColumn("this is r2 c2.");
			e2.AddColumn("this is r2 c3.");
			SkillSettings.DoTell("Entry 2 Created.");
			list.Add( e1 );
			list.Add( e2 );
			SkillSettings.DoTell("Entries added to list.");
			list.AddColumn( "1st column." );
			list.AddColumn( "2nd column." );
			list.AddColumn( "3rd column." );
			SkillSettings.DoTell("List columns added.");
			list.columns = 3;
			list.CommitList();
		}
Exemple #2
0
 //par has skin and location info. Also contains column count info.
 //style is "details" or "icons".
 /// <summary>
 /// Creates a new Gump List Entry.
 /// </summary>
 /// <param name="x">X location within the GumpList object.</param>
 /// <param name="y">Y location within the GumpList object.</param>
 /// <param name="par">Parent GumpList object.</param>
 /// <param name="width">Full width of GLE</param>
 /// <param name="height">Full height of GLE</param>
 /// <param name="iconID">ID of icon in icons mode.</param>
 public GumpListEntry(int x, int y, GumpList par, int width, int height, int iconID)
 {
     skin         = par.sk;
     m_X          = x;
     m_Y          = y;
     m_Width      = width;
     m_Height     = height;
     m_ParentList = par;
     m_Dividers   = par.ShowDividers;
     m_Tooltip    = false;
     m_TooltipID  = 0;
     m_Background = par.ShowBackground;
     if (m_Background)
     {
         m_BackgroundID = par.GetBackground();
     }
     else
     {
         m_BackgroundID = 0;
     }
     m_Style = par.style;
 }
		public void GetGumpCode(TMQueryPage page)
		{
			page.BaseSkinByType(this);
			int i = 0;
			GumpList gl = new GumpList(this, "details", page.Skin);
			gl.X = page.Skin.SelectStartX;
			gl.Y = page.Skin.SelectStartY;
			gl.AddColumn("Skins Available");
						
			gl.SetColumnCount( 2 );
			gl.columnWidths[0] = page.Skin.ListWidth-100;
			gl.columnWidths[1] = 100;

			while (i < skinnames.Count)
			{
				if (SkinHelper.skList[skinnames[i]] is TMSS4Skin)
				{
					GumpListEntry gle = new GumpListEntry(0, 0, gl, 250, 20);
					gle.AddColumn("Set " + skinnames[i] + " on item");
					gle.AddColumn(new GumpButton(0, 0, page.Skin.SelectDn, page.Skin.SelectUp, i + 1, GumpButtonType.Reply, 0));
					GumpListEntry gl2 = new GumpListEntry(0, 0, gl, 250, 20);
					gl2.AddColumn("Set " + skinnames[i] + " as default");
					gl2.AddColumn(new GumpButton(0, 0, page.Skin.SelectDn, page.Skin.SelectUp, (i + 1) * -1, GumpButtonType.Reply, 0));
					gl.Add(gle);
					gl.Add(gl2);
				}
				i++;
			}
			gl.CommitList();

			page.Mobile.SendGump(this);
		}
		public void GetGumpCode(TMQueryPage page)
		{
			page.BaseSkinByType( this );
			int i = 0;
			GumpList gl = new GumpList( this, "details", page.Skin );
			gl.X = page.Skin.SelectStartX;
			gl.Y = page.Skin.SelectStartY;
			gl.AddColumn( "Super Profiles Available" );
			gl.AddColumn( "Item Profile Setter" );
			gl.AddColumn( "Set As Default" );
			gl.columns = 3;

			while (i < profilenames.Count)
			{ 
				GumpListEntry gle = new GumpListEntry( 0, 0, gl, 250, 20 );
				gle.AddColumn( "Set " + profilenames[i] + " on an item" );
				gle.AddColumn( new GumpButton( 0, 0, page.Skin.SelectDn, page.Skin.SelectUp, i+1, GumpButtonType.Reply, 0 ) );
				//gle.AddColumn(new GumpButton(0, 0, page.Skin.SelectDn, page.Skin.SelectUp, (i + 1)*-1, GumpButtonType.Reply, 0));
				GumpListEntry gl2 = new GumpListEntry(0, 0, gl, 250, 20);
				gl2.AddColumn("Set " + profilenames[i] + " as default");
				gl2.AddColumn(new GumpButton(0, 0, page.Skin.SelectDn, page.Skin.SelectUp, (i + 1) * -1, GumpButtonType.Reply, 0));
				gl.Add(gle);
				gl.Add(gl2);
				i++;
			}
			gl.CommitList();

			
			page.Mobile.SendGump( this );
		}
		public void GetGumpCode(TMQueryPage page)
		{
			Page = page;
			SkillSettings.DoTell("GetGumpCode, Skill Gump.");
			if (Profile == null)
			{
				try
				{
					Dictionary<string, object> h = (Dictionary<string, object>)Page.GetValueSet();
					Profile = (SkillProfile)h["Profile"];
					Skin = (TMSS4Skin)h["Skin"];
					Session = (TMSkillSession)h["Session"];
				}
				catch (Exception e)
				{
					SkillSettings.DoTell("Error when generating skill gump: " + e);
					return;
				}
			}
			if (Profile == null)
			{ SkillSettings.DoTell("Profile is still null. Cannot continue."); return; }
			if( !Profile.SkillEnable )
			{
				SkillSettings.DoTell("Skills not enabled on this profile.");
				return;
			}
			this.Dragable = false;
			Page.BaseSkinByType(this);
			Page.AddTitle( "Skill Gump for "+Profile.ProfileName+": ", "Control",this);
			if (Profile.IconID > 0)
			{ 
				SkillSettings.DoTell("Adding Icon: "+Profile.IconID);
				Page.AddIcon(Profile.IconID, "Control", this); 
			}
			this.AddLabel(35, Skin.GetCoord("Control", "H") - 40, Skin.HighlightText, "Profile Maximum: " + Profile.SkillPoints + " pts");
			ButtonInfo inf2 = Skin.ButtonInfo["SessionAddButton"];
			SkillSettings.DoTell("Inf2: X: "+inf2.X+" Y: "+inf2.Y+" W: "+inf2.W+" H: " +inf2.H+" BG: "+inf2.bgID+ " TX: "+inf2.text);
			Page.AddSuperButton(inf2.X, Page.Y+inf2.Y, inf2.H, inf2.W, inf2.bgID, Skin.ListUnderButtonN, Skin.ListUnderButtonP, Skin.AddLabel, GumpButtonType.Reply, 1, 0,this);
			IEnumerator ie = Profile.MasterHash.GetEnumerator();
			GumpList l = new GumpList(this, "details", this.Skin);
			l.numperpage=8;
			l.AddColumn("Skill Name");
			l.AddColumn("Skill Value");
			l.AddColumn("Weight");
			l.AddColumn("Select");
			l.SetColumnCount(4);
			l.ChangeColumnWidth(0, 200);
			l.X = Skin.SelectStartX;
			l.Y = Skin.SelectStartY;
			l.ShowDividers = true;
			int colcount = 3; // at least columns for title, value, and checkbox.
			if (Profile.CapEnable)
				colcount++;
			if (Profile.WeightEnable)
				colcount++;
			l.SetColumnCount(colcount);
			int checkID = 0;
			if (!Profile.Manual)
				checkID = 1000;
			else
				checkID = 3000;
			Dictionary<string,TMUsedInfo> selitem = Session.HasSelectedItems( Profile.ProfileName );
			SkillSettings.DoTell(" Selitem debug: "+selitem.Count+" Profile: "+Profile.ProfileName+" TSP: "+Session.totalSelectedPoints);
			IEnumerator selitemie = selitem.GetEnumerator();
			while (selitemie.MoveNext())
			{
				SkillSettings.DoTell(" - " + ((KeyValuePair<string, TMUsedInfo>)selitemie.Current).Value.SkillName + " Value: " + ((KeyValuePair<string, TMUsedInfo>)selitemie.Current).Value.SkillValue);
			}
			while (ie.MoveNext())
			{
				TMSkillInfo inf = (TMSkillInfo)((KeyValuePair<string,TMSkillInfo>)ie.Current).Value;
				/*
				if (y % sk.NumPerPage == 0)
				{Page.SetupPage(thisProfile.ProfileName, y == 0, thisProfile.MasterHash.Count - y < sk.NumPerPage ? true : false, page); page++;}
				Page.AddEntryCheck( 0, y%sk.NumPerPage, sk.SelectUp, sk.SelectDn, false, (1000 * page) + (y % sk.NumPerPage), ""+inf.SkillName, ""+inf.SkillWeight, ""+inf.SkillValue );
				y++;*/
				GumpListEntry e = new GumpListEntry(0, 0, l, Skin.EntryDefaultWidth, Skin.EntryDefaultHeight);

				e.AddColumn(inf.SkillName);
				e.AddColumn("" + inf.SkillValue);
				if (Profile.CapEnable)
					e.AddColumn("" + inf.SkillCap);
				if (Profile.WeightEnable)
					e.AddColumn("" + inf.SkillWeight);
				if (!Profile.Manual)
					e.AddColumn(new GumpCheck(-2, 0, Skin.EntryDefaultCheckUp, Skin.EntryDefaultCheckDn, selitem.ContainsKey(inf.SkillName), checkID));
				else
					e.AddColumn(new GumpTextEntry(0, 0, 30, Skin.EntryDefaultHeight, Skin.NormalText, checkID, ""));

				checkID++;
				l.Add(e);
			}
			l.CommitList();	
			Session.Mobile.SendGump(this);
		}
		public void GetGumpCode(TMQueryPage page)
		{			
			Page = page;
			this.Dragable =false;
			object o = page.GetValueSet();
			if (o is TMSkillSession)
				Session = (TMSkillSession)o;
			else
			{ SkillSettings.SystemWrite("Error. No valid Session."); return; }
			if( !Session.Profile.StatEnable )
				return;
			Page.BaseSkinByType(this);
			Page.AddTitle("Stats: ", "Control",this);
			if( !Session.Profile.StatForce )
				this.AddLabel(50, 70, Session.Skin.HighlightText, "Overall Max: "+Session.Profile.StatSum+" pts");
			else
				this.AddLabel(50, 70, Session.Skin.HighlightText, "Overall Requirement: " + Session.Profile.StatSum + " pts");
			ButtonInfo inf2 = Session.Skin.ButtonInfo["StatAddButton"];
			Page.AddSuperButton(inf2.X, Page.Y + inf2.Y, inf2.H, inf2.W, inf2.bgID, Session.Skin.ListUnderButtonN, Session.Skin.ListUnderButtonP, Session.Skin.AddLabel, GumpButtonType.Reply, 1, 0,this);
			Dictionary<string,int> statvals = Session.Stats;
			GumpList g = new GumpList(this, "details", Session.Skin );
			g.SetColumnCount( 3 );
			g.AddColumn( "Stat:" );
			g.AddColumn( "Max Value: ");
			g.AddColumn( "Enter Value: ");
			GumpListEntry str = new GumpListEntry( 0, 0, g, Session.Skin.EntryDefaultWidth, Session.Skin.EntryDefaultHeight );
			str.AddColumn( "Strength" );
			str.AddColumn( "Max: "+Session.Profile.StrVal );
			str.AddColumn( new GumpTextEntry( 0, 0, 25, Session.Skin.EntryDefaultHeight, Session.Skin.NormalText, 1000, statvals.ContainsKey("Strength") ? ""+statvals["Strength"]:"" ) );
			GumpListEntry dex = new GumpListEntry( 0, 0, g, Session.Skin.EntryDefaultWidth, Session.Skin.EntryDefaultHeight );
			dex.AddColumn("Dexterity");
			dex.AddColumn("Max: " + Session.Profile.DexVal);
			dex.AddColumn(new GumpTextEntry(0, 0, 25, Session.Skin.EntryDefaultHeight, Session.Skin.NormalText, 2000, statvals.ContainsKey("Dexterity") ? "" + statvals["Dexterity"] : ""));
			GumpListEntry intel = new GumpListEntry(0, 0, g, Session.Skin.EntryDefaultWidth, Session.Skin.EntryDefaultHeight);
			intel.AddColumn("Intelligence");
			intel.AddColumn("Max: " + Session.Profile.IntVal);
			intel.AddColumn(new GumpTextEntry(0, 0, 25, Session.Skin.EntryDefaultHeight, Session.Skin.NormalText, 3000, statvals.ContainsKey("Intelligence") ? "" + statvals["Intelligence"] : ""));
			g.Add(str);
			g.Add(dex);
			g.Add(intel);
			g.ShowDividers = true;
			g.X = Session.Skin.SelectStartX;
			g.Y = Session.Skin.SelectStartY;
			g.CommitList();
			Session.Mobile.SendGump(this);
		}
		private void addEntry( GumpList l, Skill sk, int i, int j )
		{
			WindowInfo info = skin.WindowInfo["SkillWindow"];
			GumpListEntry gle = new GumpListEntry(0, 0, l, info.W - 12, 18);
			int lockbuttonup = 0;
			int lockbuttondn = 0;

			switch (sk.Lock)
			{
				case SkillLock.Down:
				lockbuttonup = skin.ButtonInfo["DownButton"].up;
					lockbuttondn = skin.ButtonInfo["DownButton"].down;
					break;
				case SkillLock.Locked:
					lockbuttonup = skin.ButtonInfo["LockButton"].up;
					lockbuttondn = skin.ButtonInfo["LockButton"].down;
					break;
				case SkillLock.Up:
					lockbuttonup = skin.ButtonInfo["UpButton"].up;
					lockbuttondn = skin.ButtonInfo["UpButton"].down;
					break;
			}
			ButtonInfo select = skin.ButtonInfo["UseButton"];
			SkillSettings.DoTell2("AE i: " + i + " lock button: " +(1000+(100*j)+i));
			if( sk.Info.Callback != null )
				gle.AddColumn(new GumpButton(0, 3, select.up, select.down, 1000 + i, GumpButtonType.Reply, 0));
			else
				gle.AddColumn("");
			gle.AddColumn("   "+ sk.Name);
			gle.AddColumn(" " + (checkdouble(sk.Value) ? " " + sk.Value + ".0" : " " + sk.Value) );
			gle.AddColumn(new GumpButton(0, 3, lockbuttonup, lockbuttondn, 10000 + i, GumpButtonType.Reply, 0));
			l.Add( gle );
		}
		public void GetGumpCode(  ) 
		{
			WindowInfo info = new WindowInfo();
			try
			{
				info = skin.WindowInfo["SkillWindow"];
			}
			catch { return; }

			this.X = info.X;
			this.Y = info.Y;
			this.AddButton( 170, 0, 2093, 2093, -100, GumpButtonType.Reply, 0 );
			
			this.AddBackground(0, 15, info.W, info.H, info.bgID);
			this.AddImage( 145, 30, 2100 );
			this.AddImage( 22, 355, 2102 );
			this.AddImage(60, 54, 2091);
			this.AddImage(60, 333, 2091);
			Mobile m = Mobile;
			Skills s = m.Skills;

			this.AddLabel(270, 354, skin.BlueTextHue, "" + (checkdouble(s.Total / 10) ? " " + (s.Total / 10) + ".0" : " " + (s.Total / 10)));

			GumpList l = new GumpList(this, "details", skin);
			l.columns = 5;
			l.ShowDividers = false;
			l.ShowBackground = false;
			l.columnWidths[0] = 15;
			l.columnWidths[1] = 200;
			l.numperpage = 14;

			l.X = 20;
			l.Y = 51;
			
			ButtonInfo ecg = skin.ButtonInfo["ExpandContractGroup"];
			GumpListEntry miscentry = new GumpListEntry(0, 0, l, info.W - 10, 20);
			miscentry.AddColumn(new GumpButton(0, 0, !showing.Contains(1) ? ecg.up : ecg.down, !showing.Contains(1) ? ecg.up : ecg.down, 1, GumpButtonType.Reply, 0));
			miscentry.AddColumn("<basefont size=5 face = 1 color= #330066> Miscellaneous</basefont>");

			GumpListEntry combentry = new GumpListEntry(0, 0, l, info.W - 10, 20);
			combentry.AddColumn(new GumpButton(0, 0, !showing.Contains(2) ? ecg.up : ecg.down, !showing.Contains(2) ? ecg.up : ecg.down, 2, GumpButtonType.Reply, 0));
			combentry.AddColumn("<basefont size=5 face = 1 color= #330066> Combat Ratings</basefont>");

			GumpListEntry actientry = new GumpListEntry(0, 0, l, info.W - 10, 20);
			actientry.AddColumn(new GumpButton(0, 0, !showing.Contains(3) ? ecg.up : ecg.down, !showing.Contains(3) ? ecg.up : ecg.down, 3, GumpButtonType.Reply, 0));
			actientry.AddColumn("<basefont size=5 face = 1 color= #330066> Actions</basefont>");

			GumpListEntry loreentry = new GumpListEntry(0, 0, l, info.W - 10, 20);
			loreentry.AddColumn(new GumpButton(0, 0, !showing.Contains(4) ? ecg.up : ecg.down, !showing.Contains(4) ? ecg.up : ecg.down, 4, GumpButtonType.Reply, 0));
			loreentry.AddColumn("<basefont size=5 face = 1 color= #330066> Lore & Knowledge</basefont>");

			GumpListEntry customentry = new GumpListEntry(0, 0, l, info.W - 10, 20);
			customentry.AddColumn(new GumpButton(0, 0, !showing.Contains(5) ? ecg.up : ecg.down, !showing.Contains(5) ? ecg.up : ecg.down, 5, GumpButtonType.Reply, 0));
			customentry.AddColumn("<basefont size=5 face = 1 color= #330066> Custom Skills</basefont>");
			
			ButtonInfo select = skin.ButtonInfo["UseButton"];
			IEnumerator ie = null;
			int i = 1;

			for ( int k = 0; k < s.Length; k++ )
			{
				if (ParallelSkills.actisearch.Contains(s[k].Name))
					actiinfos.Add(s[k]);
				else if (ParallelSkills.combsearch.Contains(s[k].Name))
					combinfos.Add(s[k]);
				else if (ParallelSkills.miscsearch.Contains(s[k].Name))
					miscinfos.Add(s[k]);
				else if (ParallelSkills.loresearch.Contains(s[k].Name))
					loreinfos.Add(s[k]);
				else
					custom.Add(s[k]);
			}
			actiinfos.Sort(CompareSkillNames);
			combinfos.Sort(CompareSkillNames);
			miscinfos.Sort(CompareSkillNames);
			loreinfos.Sort(CompareSkillNames);
			custom.Sort(CompareSkillNames);

			l.Add(miscentry);
			if (showing.Contains(1))
			{
				ie = miscinfos.GetEnumerator();
				while (ie.MoveNext())
				{
					SkillSettings.DoTell2("Misc i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
					addEntry(l, (Skill)ie.Current, i, 1);
					i++;
				}
			}
			else
				i += miscinfos.Count;

			l.Add( combentry );
			if (showing.Contains(2))
			{
				//i = 1;
				ie = combinfos.GetEnumerator();
				while (ie.MoveNext())
				{
					SkillSettings.DoTell2("Co i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
					addEntry(l, (Skill)ie.Current, i, 2);
					i++;
				}

			}
			else
				i += combinfos.Count;

			l.Add(actientry);
			if (showing.Contains(3))
			{				
				//i = 1;
				ie = actiinfos.GetEnumerator();
				while (ie.MoveNext())
				{
					SkillSettings.DoTell2("A i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
					addEntry(l, (Skill)ie.Current, i, 3);
					i++;
				}
			}
			else
				i += actiinfos.Count;

			l.Add(loreentry);
			if (showing.Contains(4))
			{
				//i = 1;
				ie = loreinfos.GetEnumerator();
				while (ie.MoveNext())
				{
					SkillSettings.DoTell2("L i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
					addEntry(l, (Skill)ie.Current, i, 4);
					i++;
				}
			}
			else
				i += loreinfos.Count;

			l.Add(customentry);
			if (showing.Contains(5))
			{
				//i = 1;
				ie = custom.GetEnumerator();
				while (ie.MoveNext())
				{
					SkillSettings.DoTell2("Cu i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
					addEntry(l, (Skill)ie.Current, i, 5);
					i++;
				}
			}

			l.CommitList();
		}
		//par has skin and location info. Also contains column count info.
		//style is "details" or "icons".
		/// <summary>
		/// Creates a new Gump List Entry.
		/// </summary>
		/// <param name="x">X location within the GumpList object.</param>
		/// <param name="y">Y location within the GumpList object.</param>
		/// <param name="par">Parent GumpList object.</param>
		/// <param name="width">Full width of GLE</param>
		/// <param name="height">Full height of GLE</param>
		/// <param name="iconID">ID of icon in icons mode.</param>
		public GumpListEntry(int x, int y, GumpList par, int width, int height, int iconID)
		{
			skin = par.sk;
			m_X = x;
			m_Y = y;
			m_Width = width;
			m_Height = height;
			m_ParentList = par;
			m_Dividers = par.ShowDividers;
			m_Tooltip = false;
			m_TooltipID = 0;
			m_Background = par.ShowBackground;
			if (m_Background)
				m_BackgroundID = par.GetBackground();
			else
				m_BackgroundID = 0;
			m_Style = par.style;
		}