Esempio n. 1
0
		public XmlAddGump( Mobile from, Point3D startloc, Map startmap, bool firststart, bool extension, int gumpx, int gumpy) : base( gumpx,gumpy )
		{
			if(from == null || from.Deleted) return;

			int y;
			int yinc;


			defs = null;

				m_From = from;

				// read the text entries for default values
				Account acct = from.Account as Account;
				if(acct != null)
					defs = XmlSpawnerDefaults.GetDefaults(acct.ToString(), from.Name);

			if(defs == null) return;

			if (firststart)
			{
				defs.StartingMap = from.Map;
				defs.StartingLoc = from.Location;
			}
			else
			{
				defs.StartingMap = startmap;
				defs.StartingLoc = startloc;
			}

			defs.IgnoreUpdate = false;
			defs.ShowExtension = extension;

			if(defs.SelectionList == null)
			{
				defs.SelectionList = new bool[MaxEntries];
			}
			if(defs.NameList == null)
				defs.NameList = new string[MaxEntries];


			// prepare the page

			AddPage( 0 );
			if(defs.ShowExtension)
			{
				AddBackground( 0, 0, 520, 500, 5054 );
				AddAlphaRegion( 0, 0, 520, 500 );
			} 
			else 
			{
				AddBackground( 0, 0, 200, 500, 5054 );
				AddAlphaRegion( 0, 0, 200, 500 );
			}

			y = 3;
			yinc = 20;
			// add the min/maxdelay entries
			AddImageTiled( 5, y, 40, 19, 0xBBC );
			AddTextEntry( 5, y, 40, 19, 0, 100, defs.MinDelay.TotalMinutes.ToString() );
			AddLabel( 45, y, 0x384, "MinDelay(m)" );

			AddImageTiled( 105, y, 40, 19, 0xBBC );
			AddTextEntry( 105, y, 40, 19, 0, 101, defs.MaxDelay.TotalMinutes.ToString() );
			AddLabel( 145, y, 0x384, "MaxDelay(m)" );

			y += yinc;
			AddImageTiled( 5, y, 40, 19, 0xBBC );
			AddTextEntry( 5, y, 40, 19, 0, 107, defs.HomeRange.ToString() );
			AddLabel( 45, y, 0x384, "HomeRng" );

			AddImageTiled( 105, y, 40, 19, 0xBBC );
			AddTextEntry( 105, y, 40, 19, 0, 108, defs.SpawnRange.ToString() );
			AddLabel( 145, y, 0x384, "SpawnRng" );

			y += yinc;
			AddImageTiled( 5, y, 40, 19, 0xBBC );
			AddTextEntry( 5, y, 40, 19, 0, 109, defs.ProximityRange.ToString() );
			AddLabel( 45, y, 0x384, "ProxRng" );

			AddImageTiled( 105, y, 40, 19, 0xBBC );
			AddTextEntry( 105, y, 40, 19, 0, 110, defs.Team.ToString() );
			AddLabel( 145, y, 0x384, "Team" );

			y += yinc;
			AddImageTiled( 5, y, 40, 19, 0xBBC );
			AddTextEntry( 5, y, 40, 19, 0, 113, defs.KillReset.ToString() );
			AddLabel( 45, y, 0x384, "KillReset" );

			AddImageTiled( 105, y, 40, 19, 0xBBC );
			AddTextEntry( 105, y, 40, 19, 0, 121, defs.TriggerProbability.ToString() );
			AddLabel( 145, y, 0x384, "TrigProb" );

			y += yinc;
			AddImageTiled( 5, y, 40, 19, 0xBBC );
			AddTextEntry( 5, y, 40, 19, 0, 111, defs.Duration.TotalMinutes.ToString() );
			AddLabel( 45, y, 0x384, "Duration(m)" );

			AddImageTiled( 105, y, 40, 19, 0xBBC );
			AddTextEntry( 105, y, 40, 19, 0, 112, defs.ProximitySound.ToString() );
			AddLabel( 145, y, 0x384, "ProxSnd" );

			y += yinc;
			AddImageTiled( 5, y, 40, 19, 0xBBC );
			AddTextEntry( 5, y, 40, 19, 0, 102, defs.RefractMin.TotalMinutes.ToString() );
			AddLabel( 45, y, 0x384, "MinRefr(m)" );

			AddImageTiled( 105, y, 40, 19, 0xBBC );
			AddTextEntry( 105, y, 40, 19, 0, 103, defs.RefractMax.TotalMinutes.ToString() );
			AddLabel( 145, y, 0x384, "MaxRefr(m)" );

			y += yinc;
			AddImageTiled( 5, y, 40, 19, 0xBBC );
			AddTextEntry( 5, y, 40, 19, 0, 104, defs.TODStart.TotalHours.ToString() );
			AddLabel( 45, y, 0x384, "TODStart(h)" );

			AddImageTiled( 105, y, 40, 19, 0xBBC );
			AddTextEntry( 105, y, 40, 19, 0, 105, defs.TODEnd.TotalHours.ToString() );
			AddLabel( 145, y, 0x384, "TODEnd(h)" );
            
			y += yinc;
			AddImageTiled( 5, y, 40, 19, 0xBBC );
			AddTextEntry( 5, y, 40, 19, 0, 123, defs.DespawnTime.TotalHours.ToString() );
			AddLabel( 45, y, 0x384, "Despawn(h)" );


			// AllowNPC
			AddLabel(125, y, 0x384, "AllowNPC");
			AddCheck(105, y, 0xD2, 0xD3, defs.AllowNPCTrig, 312);

			//y = 164;
			yinc = 21;
			y += yinc;
			// TOD
			if(defs.TODMode == XmlSpawner.TODModeType.Gametime)
				AddLabel( 25, y, 0x384, "GameTOD" );
			else
				if(defs.TODMode == XmlSpawner.TODModeType.Realtime)
				AddLabel( 25, y, 0x384, "RealTOD" );
			AddButton( 5, y, 0xD3, 0xD3, 306, GumpButtonType.Reply, 0);


			// Sequentialspawn
			AddLabel( 125, y, 0x384, "SeqSpawn" );
			AddCheck( 105, y, 0xD2, 0xD3, (defs.SequentialSpawn==0), 307);

			y += yinc;
			// IsGroup
			AddLabel( 25, y, 0x384, "Group" );
			AddCheck( 5, y, 0xD2, 0xD3, defs.Group, 304);

			// HomeRangeRelative
			AddLabel( 125, y, 0x384, "HomeRngRel" );
			AddCheck( 105, y, 0xD2, 0xD3,defs.HomeRangeIsRelative, 305);

			y += yinc;
			// smart spawning
			AddLabel( 25, y, 0x384, "SmartSpawn" );
			AddCheck( 5, y, 0xD2, 0xD3, defs.SmartSpawning, 310);

			// AllowGhost
			AddLabel( 125, y, 0x384, "AllowGhost" );
			AddCheck( 105, y, 0xD2, 0xD3, defs.AllowGhostTrig, 309);

			y += yinc;
			// ExtTrig
			AddLabel( 25, y, 0x384, "ExtTrig" );
			AddCheck( 5, y, 0xD2, 0xD3, defs.ExternalTriggering, 308);

			// SpawnOnTrig
			AddLabel( 125, y, 0x384, "SpawnOnTrig" );
			AddCheck( 105, y, 0xD2, 0xD3, defs.SpawnOnTrigger, 311);

			y += yinc;
			// AutoNumber
			AddLabel( 25, y, 0x384, "AutoNumber" );
			AddCheck( 5, y, 0xD2, 0xD3, defs.AutoNumber, 306);
			AddImageTiled( 105, y, 80, 19, 0xBBC );
			AddTextEntry( 105, y, 80, 19, 0, 125, defs.AutoNumberValue.ToString() );

			//y = 270;
			yinc = 20;
			y += yinc;
			// Name
			AddImageTiled( 5, y, 95, 19, 0xBBC );
			AddTextEntry( 5, y, 85, 19, 0, 114, defs.SpawnerName );
			AddLabel( 105, y, 0x384, "SpawnerName" );

			y += yinc;
			// speech trigger
			AddLabel( 105, y, 0x384, "SpeechTrigger" );
			AddImageTiled( 5, y, 95, 19, 0xBBC );
			AddTextEntry( 5, y, 85, 19, 0, 106, defs.SpeechTrigger );

			y += yinc;
			// skill trigger
			AddLabel( 105, y, 0x384, "SkillTrigger" );
			AddImageTiled( 5, y, 95, 19, 0xBBC );
			AddTextEntry( 5, y, 85, 19, 0, 124, defs.SkillTrigger );

			y += yinc;
			AddImageTiled( 5, y, 95, 19, 0xBBC );
			AddTextEntry( 5, y, 85, 19, 0, 117, defs.TriggerOnCarried );
			AddLabel( 105, y, 0x384, "TrigOnCarried" );

			y += yinc;
			AddImageTiled( 5, y, 95, 19, 0xBBC );
			AddTextEntry( 5, y, 85, 19, 0, 118, defs.NoTriggerOnCarried );
			AddLabel( 105, y, 0x384, "NoTrigOnCarried" );

			y += yinc;
			AddImageTiled( 5, y, 95, 19, 0xBBC );
			AddTextEntry( 5, y, 85, 19, 0, 119, defs.ProximityMsg );
			AddLabel( 105, y, 0x384, "ProximityMsg" );

			y += yinc;
			AddImageTiled( 5, y, 95, 19, 0xBBC );
			AddTextEntry( 5, y, 85, 19, 0, 120, defs.PlayerTriggerProp );
			AddLabel( 105, y, 0x384, "PlayerTrigProp" );

			y += yinc;
			AddImageTiled( 5, y, 95, 19, 0xBBC );
			AddTextEntry( 5, y, 85, 19, 0, 122, defs.TriggerObjectProp );
			AddLabel( 105, y, 0x384, "TrigObjectProp" );

			//y = 429;
			yinc = 23;
			y += yinc;
			// add the RestoreDefs button
			AddButton( 5, y, 0xFAE, 0xFAF, 117, GumpButtonType.Reply, 0 );
			AddLabel( 35, y, 0x384, "Restore Defs" );

			// add the RestoreDefs button
			AddButton( 125, y, 0xFAE, 0xFAF, 180, GumpButtonType.Reply, 0 );
			AddLabel( 155, y, 0x384, "Options" );

			y += yinc;
			// add the SaveDefs button
			AddButton( 5, y, 0xFAE, 0xFAF, 115, GumpButtonType.Reply, 0 );
			AddLabel( 35, y, 0x384, "Save" );

			// add the LoadDefs button
			AddButton( 65, y, 0xFAE, 0xFAF, 116, GumpButtonType.Reply, 0 );
			AddLabel( 95, y, 0x384, "Load" );

			// add the DefsExt entry
			AddImageTiled( 127, y, 68, 21, 0xBBC );
			AddTextEntry( 129, y, 64, 21, 0, 115, defs.DefsExt );

			y += yinc;
			// add the Add button
			AddButton( 5, y, 0xFAE, 0xFAF, 100, GumpButtonType.Reply, 0 );
			AddLabel( 35, y, 0x384, "Add" );

			// add the Goto button
			AddButton( 64, y, 0xFAE, 0xFAF, 1000, GumpButtonType.Reply, 0 );
			AddLabel( 94, y, 0x384, "Goto" );

			// add the Delete button
			AddButton( 125, y, 0xFAE, 0xFAF, 156, GumpButtonType.Reply, 0 );
			AddLabel( 155, y, 0x384, "Del" );

			// add the Edit button
			// add the Find button

			// add gump extension button
			if(defs.ShowExtension)
			{
				AddButton( 480, y+5, 0x15E3, 0x15E7, 200, GumpButtonType.Reply, 0 );
			} 
			else 
			{
				AddButton( 180, y+5, 0x15E1, 0x15E5, 200, GumpButtonType.Reply, 0 );
			}

			if(defs.ShowExtension)
			{
				AddLabel( 300, 5, 0x384, "Spawn Entries" );
				// display the clear all toggle
				AddButton( 475, 5, 0xD2, 0xD3, 3999, GumpButtonType.Reply, 0 );
				// display the selection entries
				for ( int i = 0;  i < MaxEntries; i++ )
				{
					int xpos = (int)(i / MaxEntriesPerColumn)*155;
					int ypos = (i % MaxEntriesPerColumn)*22 + 30;
                    

					// background for search results area
					AddImageTiled( xpos + 205, ypos, 116, 23, 0x52 );

					// has this been selected for category info specification?
					if(i == defs.CategorySelectionIndex)
					{
						AddImageTiled( xpos + 206, ypos+1, 114, 21, 0x1436 );
					} 
					else
						AddImageTiled( xpos + 206, ypos+1, 114, 21, 0xBBC );

					bool sel=false;
					if(defs.SelectionList != null && i < defs.SelectionList.Length)
					{
						sel = defs.SelectionList[i];
					}
					int texthue = 0;
					if(sel) texthue = 68;
					string namestr = null;
					if(defs.NameList != null && i < defs.NameList.Length)
						namestr = defs.NameList[i];

					// display the name
					//AddLabel( 280, 22 * i + 31, texthue, namestr );

					AddTextEntry( xpos + 208, ypos+1, 110, 21, texthue, 1000+i, namestr );
					// display the selection button
					AddButton( xpos + 320, ypos+2, (sel? 0xD3:0xD2), (sel? 0xD2:0xD3), 4000+i, GumpButtonType.Reply, 0 );
					// display the info button
					//AddButton( xpos + 340, ypos+2, 0x5689, 0x568A, 5000+i, GumpButtonType.Reply, 0);
					AddButton( xpos + 340, ypos+2, 0x15E1, 0x15E5, 5000+i, GumpButtonType.Reply, 0);
				}
			}
		}
Esempio n. 2
0
		public static void XmlAdd_OnCommand( CommandEventArgs e )
		{
			Account acct = e.Mobile.Account as Account;
			int x = 440;
			int y = 0;
			XmlSpawnerDefaults.DefaultEntry defs = null;
			if(acct != null)
				defs = XmlSpawnerDefaults.GetDefaults(acct.ToString(), e.Mobile.Name);
			if(defs != null)
			{
				x = defs.AddGumpX;
				y = defs.AddGumpY;
			}
			// Check if there is an argument provided (load criteria)
			try
			{
				// Check if there is an argument provided (load criteria)
				for(int nxtarg = 0;nxtarg<e.Arguments.Length;nxtarg++)
				{
					// is it a defaults option?
					if(e.Arguments[nxtarg].ToLower() == "-defaults")
					{
						XmlSpawnerDefaults.RestoreDefs(defs);
						if(defs != null)
						{
							x = defs.AddGumpX;
							y = defs.AddGumpY;
						}
					}
				}
			} 
			catch{}

			e.Mobile.SendGump( new XmlAddGump(e.Mobile, e.Mobile.Location, e.Mobile.Map, true, false,x,y));

		}
Esempio n. 3
0
			public PlaceSpawnerTarget(NetState state) :  base ( 30, true, TargetFlags.None )
			{
				if (state == null || state.Mobile == null) return;

				// read the text entries for default values
				defs = null;

				Account acct = state.Mobile.Account as Account;
				if (acct != null)
					defs = XmlSpawnerDefaults.GetDefaults(acct.ToString(), state.Mobile.Name);

				if (defs == null) return;

				m_state = state;
			}
Esempio n. 4
0
		public static void Refresh(Mobile from, bool ignoreupdate)
		{
			if(from == null) return;

			// read the text entries for default values
			XmlSpawnerDefaults.DefaultEntry defs = null;

			Account acct = from.Account as Account;
			if (acct != null)
				defs = XmlSpawnerDefaults.GetDefaults(acct.ToString(), from.Name);

			if (defs == null) return;

			int x = defs.AddGumpX;
			int y = defs.AddGumpY;
			if (defs.ShowExtension)
			{
				// shift the starting point
				x = defs.AddGumpX - 140;
			}

			defs.IgnoreUpdate = ignoreupdate;

			from.CloseGump(typeof(XmlAddGump));

			defs.IgnoreUpdate = false;
			from.SendGump(new XmlAddGump(from, defs.StartingLoc, defs.StartingMap, false, defs.ShowExtension, x, y));
		}
Esempio n. 5
0
		private void Initialize(int page)
		{
			m_Page = page;

			int count = m_List.Count - (page * EntryCount);

			if (count < 0)
			{
				count = 0;
			}
			else if (count > EntryCount)
			{
				count = EntryCount;
			}

			int lastIndex = (page * EntryCount) + count - 1;

			if (lastIndex >= 0 && lastIndex < m_List.Count && m_List[lastIndex] == null)
			{
				--count;
			}

			int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (ColumnEntryCount + 1));

			AddPage(0);

			AddBackground(0, 0, TotalWidth * 3 + BorderSize * 2, BorderSize + totalHeight + BorderSize, BackGumpID);
			AddImageTiled(
				BorderSize,
				BorderSize + EntryHeight,
				(TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0)) * 3,
				totalHeight - EntryHeight,
				OffsetGumpID);

			int x = BorderSize + OffsetSize;
			int y = BorderSize /*+ OffsetSize*/;

			int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4) - (OldStyle ? SetWidth + OffsetSize : 0);

			if (m_Object is Item)
			{
				AddLabelCropped(x + TextOffsetX, y, TypeWidth - TextOffsetX, EntryHeight, TextHue, ((Item)m_Object).Name);
			}
			int propcount = 0;
			for (int i = 0, index = page * EntryCount; i < count && index < m_List.Count; ++i, ++index)
			{
				// do the multi column display
				int column = propcount / ColumnEntryCount;
				if (propcount % ColumnEntryCount == 0)
				{
					y = BorderSize;
				}
				x = BorderSize + OffsetSize + column * (ValueWidth + NameWidth + OffsetSize * 2 + SetOffsetX + SetWidth);
				y += EntryHeight + OffsetSize;

				object o = m_List[index];

				if (o == null)
				{
					AddImageTiled(x - OffsetSize, y, TotalWidth, EntryHeight, BackGumpID + 4);
					propcount++;
				}
				else
					/*if ( o is Type )
				{
					Type type = (Type)o;

					AddImageTiled( x, y, TypeWidth, EntryHeight, EntryGumpID );
					AddLabelCropped( x + TextOffsetX, y, TypeWidth - TextOffsetX, EntryHeight, TextHue, type.Name );
					x += TypeWidth + OffsetSize;

					if ( SetGumpID != 0 )
						AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );
				}
				else
                */ if (o is PropertyInfo)
					{
						propcount++;

						PropertyInfo prop = (PropertyInfo)o;

						// look for the default value of the equivalent property in the XmlSpawnerDefaults.DefaultEntry class

						int huemodifier = TextHue;
						FieldInfo finfo = null;
						XmlSpawnerDefaults.DefaultEntry de = new XmlSpawnerDefaults.DefaultEntry();
						Type ftype = de.GetType();
						if (ftype != null)
						{
							finfo = ftype.GetField(prop.Name);
						}
						// is there an equivalent default field?
						if (finfo != null)
						{
							// see if the value is different from the default
							if (ValueToString(finfo.GetValue(de)) != ValueToString(prop))
							{
								huemodifier = 68;
							}
						}

						AddImageTiled(x, y, NameWidth, EntryHeight, EntryGumpID);
						AddLabelCropped(x + TextOffsetX, y, NameWidth - TextOffsetX, EntryHeight, huemodifier, prop.Name);
						x += NameWidth + OffsetSize;
						AddImageTiled(x, y, ValueWidth, EntryHeight, EntryGumpID);
						AddLabelCropped(x + TextOffsetX, y, ValueWidth - TextOffsetX, EntryHeight, huemodifier, ValueToString(prop));
						x += ValueWidth + OffsetSize;

						if (SetGumpID != 0)
						{
							AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
						}

						CPA cpa = GetCPA(prop);

						if (prop.CanWrite && cpa != null && m_Mobile.AccessLevel >= cpa.WriteLevel)
						{
							AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 3, GumpButtonType.Reply, 0);
						}
					}
			}
		}
Esempio n. 6
0
 public PlaceSpawnerTarget(XmlAddGump addgump, NetState state)
     : base(30, true, TargetFlags.None)
 {
     m_addgump = addgump;
     defs = m_addgump.defs;
     m_state = state;
 }