Full Version : Error with XMPSpawer2.cs
xmlspawner >>Troubleshooting >>Error with XMPSpawer2.cs
<< Prev | Next >>
Zaphkiel- 07-14-2006

CODE
RunUO - [www.runuo.com] Version 2.0, Build 2357.32527 Core: Running on .NET Framework Version 2.0.50727 Scripts: Compiling C# scripts...failed (1 errors, 0 warnings) Errors: + Customs/XML Spawner 2/XmlSpawner2.cs:
CS0029: Line 9207: Cannot implicitly convert type 'System.Collections.ArrayL
ist' to 'System.Collections.Generic.List<Server.Tile>'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

WHat exactly is causing this?
Here is my file for it

CODE
//#define TRACE //#define RUNUO2RC1 using System; using System.Data; using System.IO;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Network;
using Server.Gumps;
using Server.Targeting;
using System.Reflection;
using Server.Commands;
using Server.Commands.Generic;
using CPA = Server.CommandPropertyAttribute;
using System.Xml;
using Server.Spells;
using System.Text;
using Server.Accounting;
using System.Diagnostics;
using Server.Misc;
using Server.Engines.XmlSpawner2;
/*
** XmlSpawner2
** version 3.13
** updated 6/24/05
** ArteGordon
** Modification of the original XmlSpawner written by bobsmart
*/
namespace Server.Mobiles
{
public class XmlSpawner : Item
{
#region Type declarations
public enum TODModeType { Realtime, Gametime }
public enum SpawnPositionType { Random, RowFill, ColFill, Perimeter, Player, Waypoint, RelXY, DeltaLocation, Location }
public class SpawnPositionInfo
{
public SpawnPositionType positionType;
public Mobile trigMob;
public string[] positionArgs;
public SpawnPositionInfo(SpawnPositionType positiontype, Mobile trigmob, string[] positionargs)
{
positionType = positiontype;
trigMob = trigmob;
positionArgs = positionargs;
}
}
public class MovementInfo
{
public Mobile trigMob;
public Point3D trigLocation = Point3D.Zero;
public MovementInfo(Mobile m)
{
trigMob = m;
if(m != null)
trigLocation = m.Location;
}
}
#endregion
#region Constant declarations
public const string Version = "3.13";
private const double SpawnIdleTime = 72.0; // time in hours after which idle spawns will be relocated
private const int ShowBoundsItemId = 14089; // 14089 Fire Column // 3555 Campfire // 8708 Skull Pole
private const string SpawnDataSetName = "Spawns";
private const string SpawnTablePointName = "Points";
private const int SpawnFitSize = 16; // Normal wall/door height for a mobile is 20 to walk through
private const int BaseItemId = 0x1F1C; // Purple Magic Crystal
private const int defaultTriggerSound = 0x1F4; // click and sparkle sound by default (0x1F4) , click sound (0x3A4)
public const string XmlSpawnDir = "Spawns"; // default directory for saving/loading .xml files with [xmlload [xmlsave
private const string XmlConfigsDir = "SpawnerConfigs"; // default directory for loading .xml config files with LoadConfig
private const int MaxSmartSectorListSize = 1024; // maximum sector list size for use in smart spawning. This gives a 512x512 tile range.
private static string defwaypointname = null; // default waypoint name will get assigned in Initialize
private const string XmlTableName = "Properties";
private const string XmlDataSetName = "XmlSpawner";
public const AccessLevel DiskAccessLevel = AccessLevel.Administrator; // minimum access level required by commands that can access the disk such as XmlLoad, XmlSave, and the Save function of XmlEdit
private const int MaxMoveCheck = 10; // limit number of players that can be checked for triggering in a single OnMovement tick
#endregion
#region Static variable declarations
// specifies the level at which smartspawning will be triggered. Players with AccessLevel above this will not trigger smartspawning unless unhidden.
public static AccessLevel SmartSpawnAccessLevel = AccessLevel.Owner;
// define the default values used in making spawners
private static TimeSpan defMinDelay = TimeSpan.FromMinutes(5);
private static TimeSpan defMaxDelay = TimeSpan.FromMinutes(10);
private static TimeSpan defMinRefractory = TimeSpan.FromMinutes(0);
private static TimeSpan defMaxRefractory = TimeSpan.FromMinutes(0);
private static TimeSpan defTODStart = TimeSpan.FromMinutes(0);
private static TimeSpan defTODEnd = TimeSpan.FromMinutes(0);
private static TimeSpan defDuration = TimeSpan.FromMinutes(0);
private static TimeSpan defDespawnTime = TimeSpan.FromHours(0);
private static bool defIsGroup = false;
private static int defTeam = 0;
private static int defProximityTriggerSound = defaultTriggerSound;
private static int defAmount = 1;
private static bool defRelativeHome = true;
private static int defSpawnRange = 5;
private static int defHomeRange = 5;
private static double defTriggerProbability = 1;
private static int defProximityRange = -1;
private static int defKillReset = 1;
private static TODModeType defTODMode = TODModeType.Realtime;
private static Timer m_GlobalSectorTimer;
private static bool SmartSpawningSystemEnabled = false;
private static WarnTimer2 m_WarnTimer;
// hash table for optimizing HoldSmartSpawning method invocation
private static Hashtable holdSmartSpawningHash;
public static int seccount;
// sector hashtable for each map
private static Hashtable[] GlobalSectorTable = new Hashtable[5];
#endregion
#region Variable declarations
private string m_Name = string.Empty;
private string m_UniqueId = string.Empty;
private bool m_PlayerCreated = false;
private bool m_HomeRangeIsRelative = false;
private int m_Team;
private int m_HomeRange;
// added a amount parameter for stacked item spawns
private int m_StackAmount;
// this is actually redundant with the width height spec for spawning area
// just an easier way of specifying it
private int m_SpawnRange;
private int m_Count;
private TimeSpan m_MinDelay;
private TimeSpan m_MaxDelay;
// added a duration parameter for time-limited spawns
private TimeSpan m_Duration;
public ArrayList m_SpawnObjects = new ArrayList(); // List of objects to spawn
private DateTime m_End;
private DateTime m_RefractEnd;
private DateTime m_DurEnd;
private InternalTimer2 m_Timer;
private InternalTimer m_DurTimer;
private InternalTimer3 m_RefractoryTimer;
private bool m_Running;
private bool m_Group;
private int m_X;
private int m_Y;
private int m_Width;
private int m_Height;
private WayPoint m_WayPoint;
private Static m_ShowContainerStatic;
private bool m_proximityActivated;
private bool m_refractActivated;
private bool m_durActivated;
private TimeSpan m_TODStart;
private TimeSpan m_TODEnd;
// time after proximity activation when the spawn cannot be reactivated
private TimeSpan m_MinRefractory;
private TimeSpan m_MaxRefractory;
private string m_ItemTriggerName;
private string m_NoItemTriggerName;
private Item m_ObjectPropertyItem;
private string m_ObjectPropertyName;
public string status_str;
public int m_killcount;
// added proximity range sensor
private int m_ProximityRange;
// sound played when a proximity triggered spawner is tripped by a player
// set this to zero if you dont want to hear anything
private int m_ProximityTriggerSound;
private string m_ProximityTriggerMessage;
private string m_SpeechTrigger;
private bool m_speechTriggerActivated;
private string m_MobPropertyName;
private string m_MobTriggerName;
private string m_PlayerPropertyName;
private double m_TriggerProbability = defTriggerProbability;
private Mobile m_mob_who_triggered;
private Item m_SetPropertyItem;
private bool m_skipped = false;
private int m_KillReset = defKillReset; // number of spawn ticks that pass without kills before killcount gets reset to zero
private int m_spawncheck = 0;
private TODModeType m_TODMode = TODModeType.Realtime;
private string m_GumpState;
private bool m_ExternalTriggering;
private bool m_ExternalTrigger;
private int m_SequentialSpawning = -1; // off by default
private DateTime m_SeqEnd;
private Region m_Region; // 2004.02.08 :: Omega Red
private string m_RegionName = string.Empty; // 2004.02.08 :: Omega Red
private AccessLevel m_TriggerAccessLevel = AccessLevel.Player;
public ArrayList m_TextEntryBook;
private XmlSpawnerGump m_SpawnerGump;
private bool m_AllowGhostTriggering = false;
private bool m_AllowNPCTriggering = false;
private string m_ConfigFile;
private bool m_OnHold = false;
private bool m_HoldSequence = false;
private bool m_SpawnOnTrigger = false;
private DateTime m_FirstModified;
private DateTime m_LastModified;
private ArrayList m_MovementList;
private MovementTimer m_MovementTimer;
internal ArrayList m_KeywordTagList = new ArrayList();
private string m_FirstModifiedBy = null;
private string m_LastModifiedBy = null;
public ArrayList RecentSpawnerSearchList = null;
public ArrayList RecentItemSearchList = null;
public ArrayList RecentMobileSearchList = null;
private TimeSpan m_DespawnTime;
private bool m_regionUpdated = false;
private string m_SkillTrigger;
private bool m_skillTriggerActivated;
private SkillName m_skill_that_triggered;
private bool m_FreeRun = false; // override for all other triggering modes
private SkillName m_SkillTriggerName;
private double m_SkillTriggerMin;
private double m_SkillTriggerMax;
private int m_SkillTriggerSuccess;
private Map currentmap;
public bool m_IsInactivated = false;
private bool m_SmartSpawning = false;
private SectorTimer m_SectorTimer;
private ArrayList m_ShowBoundsItems = new ArrayList();
public ArrayList PropertyInfoList = null; // used to optimize property info lookup used by set and get property methods.
private bool inrespawn = false;
private ArrayList sectorList = null;
private bool m_Debug;
private Point3D mostRecentSpawnPosition = Point3D.Zero;
private int m_MovingPlayerCount = 0;
private int m_FastestPlayerSpeed = 0;
#endregion
#region Property Overrides
public override bool Decays
{
get { return false; }
}
#endregion
#region Properties
public int MovingPlayerCount { get { return m_MovingPlayerCount; } set { m_MovingPlayerCount = value; } }
public int FastestPlayerSpeed { get { return m_FastestPlayerSpeed; } set { m_FastestPlayerSpeed = value; } }
public int NearbyPlayerCount
{
get {
int count = 0;
if (ProximityRange >= 0)
{
foreach (Mobile m in GetMobilesInRange(ProximityRange))
{
if (m != null && m.Player) count++;
}
}
return count;
}
}
public Point3D MostRecentSpawnPosition
{
get { return mostRecentSpawnPosition; }
set { mostRecentSpawnPosition = value; }
}
public TimeSpan GameTOD
{
get
{
int hours;
int minutes;
Server.Items.Clock.GetTime(this.Map, this.Location.X, this.Location.Y, out hours, out minutes);
return (new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hours, minutes, 0).TimeOfDay);
}
}
public TimeSpan RealTOD { get { return DateTime.Now.TimeOfDay; } }
public int RealDay{ get { return DateTime.Now.Day; } }
public int RealMonth { get { return DateTime.Now.Month; } }
public DayOfWeek RealDayOfWeek { get { return DateTime.Now.DayOfWeek; }}
public MoonPhase MoonPhase
{
get
{
return Clock.GetMoonPhase(this.Map, this.Location.X, this.Location.Y);
}
}
public XmlSpawnerGump SpawnerGump
{
get { return m_SpawnerGump; }
set
{
m_SpawnerGump = value; }
}
public bool Debug { get { return m_Debug; } set { m_Debug = value; } }
public bool DoDefrag
{
get { return false; }
set
{
if (value == true)
{
Defrag(true);
}
}
}
private bool sectorIsActive;
private bool UseSectorActivate = false;
public bool SingleSector { get { return UseSectorActivate; } }
/*
public override void OnSectorDeactivate()
{
sectorIsActive = false;
base.OnSectorDeactivate();
}
public override void OnSectorActivate()
{
sectorIsActive = true;
base.OnSectorActivate();
// perform the smart respawning
if(SmartSpawning && IsInactivated && UseSectorActivate)
{
SmartRespawn();
}
}
*/
public bool InActivationRange(Sector s1, Sector s2)
{
// check to see if the sectors are within +- 2 of one another
if (s1 == null || s2 == null) return false;
return (Math.Abs(s1.X - s2.X) < 3 && Math.Abs(s1.Y - s2.Y) < 3);
}
public bool HasDamagedOrDistantSpawns
{
get
{
Sector ssec = Map.GetSector(Location);
// go through the spawn lists
foreach (SpawnObject so in m_SpawnObjects)
{
for (int x = 0; x < so.SpawnedObjects.Count; x++)
{
object o = so.SpawnedObjects[x];
if (o is BaseCreature)
{
BaseCreature b = (BaseCreature)o;
// if the mob is damaged or outside of smartspawning detection range then return true
if ((b.Hits < b.HitsMax) || (b.Map != this.Map))
{
return true;
}
// if the spawn moves into a sector that is not activatable from a sector on the sector list then dont smartspawn
if (b.Map != null && b.Map != Map.Internal)
{
Sector bsec = b.Map.GetSector(b.Location);
if (UseSectorActivate)
{
// is it in activatable range of the sector the spawner is in
if (!InActivationRange(bsec, ssec))
{
return true;
}
}
else
{
bool outofsec = true;
if (sectorList != null)
{
foreach (Sector s in sectorList)
{
// is the creatures sector within activation range of any of the sectors in the list
if (InActivationRange(bsec, s))
{
outofsec = false;
break;
}
}
}
if (outofsec)
{
return true;
}
}
}
}
}
}
return false;
}
}
private static int totalSectorsMonitored = 0;
public bool HasActiveSectors
{
get
{
if (!SmartSpawning || Map == null || Map == Map.Internal) return false;
// is this a region spawner?
if (m_Region != null)
{
List<Mobile> p = m_Region.GetPlayers();
return (p != null && p.Count > 0);
}
// is this a single sector spawner?
if (UseSectorActivate)
{
return sectorIsActive;
}
// if there is no sector list made for this spawner then create one.
if (sectorList == null)
{
Point3D loc = this.Location;
sectorList = new ArrayList();
// is this container held?
if (Parent != null)
{
if (RootParent is Mobile)
loc = ((Mobile)(RootParent)).Location;
else
if (RootParent is Item)
loc = ((Item)(RootParent)).Location;
}
// find the max detection range by examining both spawnrange
// note, sectors will activate when within +-2 sectors
int bufferzone = 2 * Server.Map.SectorSize;
int x1 = m_X - bufferzone;
int width = m_Width + 2 * bufferzone;
int y1 = m_Y - bufferzone;
int height = m_Height + 2 * bufferzone;
// go through all of the sectors within the SpawnRange of the spawner to see if any are active
for (int x = x1; x <= x1 + width; x += Server.Map.SectorSize)
{
for (int y = y1; y <= y1 + height; y += Server.Map.SectorSize)
{
Sector s = Map.GetSector(new Point3D(x, y, loc.Z));
// dont add any redundant sectors
bool duplicate = false;
foreach (Sector olds in sectorList)
{
if (olds == s)
{
duplicate = true;
break;
}
}
if (!duplicate)
{
sectorList.Add(s);
if (GlobalSectorTable[Map.MapID] == null)
{
GlobalSectorTable[Map.MapID] = new Hashtable();
}
// add this sector and the spawner associated with it to the global sector table
if (GlobalSectorTable[Map.MapID].Contains(s))
{
ArrayList spawnerlist = (ArrayList)GlobalSectorTable[Map.MapID][s];
if (spawnerlist == null)
{
//GlobalSectorTable[Map.MapID].Remove(s);
spawnerlist = new ArrayList();
//GlobalSectorTable[Map.MapID].Add(s, spawnerlist);
GlobalSectorTable[Map.MapID][s] = spawnerlist;
}
if (!spawnerlist.Contains(this))
{
spawnerlist.Add(this);
}
}
else
{
ArrayList spawnerlist = new ArrayList();
spawnerlist.Add(this);
// add a new entry to the table
GlobalSectorTable[Map.MapID].Add(s, spawnerlist);
}
totalSectorsMonitored++;
// add some sanity checking here
if (sectorList.Count > MaxSmartSectorListSize)
{
SmartSpawning = false;
// log it
try
{
Console.WriteLine("SmartSpawning disabled at {0} {1} : Range too large.", loc, Map);
using (StreamWriter op = new StreamWriter("badspawn.log", true))
{
op.WriteLine("{0} SmartSpawning disabled at {1} {2} : Range too large.", DateTime.Now, loc, Map);
op.WriteLine();
}
}
catch
{ }
return true;
}
}
}
}
// if the spawner is in a single sector, then we can use the OnSectorActivation method to test for activity
// note, sectors will activate when within +-2 sectors
/*
if((sectorList.Count == 1) && (Location.X >= m_X) && (Location.X <= m_X + m_Width) &&
(Location.Y >= m_Y) && (Location.Y <= m_Y + m_Height))
{
UseSectorActivate = true;
}
else
{
UseSectorActivate = false;
}
*/
UseSectorActivate = false;
}
_TraceStart(2);
// go through the sectorlist and see if any of the sectors are active
foreach (Sector s in sectorList)
{
if (s != null && s.Active && s.Players.Count > 0)
{
// confirm that players with the proper access level are present
foreach (Mobile m in s.Players)
{
if (m.AccessLevel <= SmartSpawnAccessLevel || !m.Hidden)
{
return true;
}
}
_TraceEnd(2);
}
seccount++;
}
_TraceEnd(2);
return false;
}
}
public int SecCount { get { return seccount; } }
public bool IsInactivated
{
get { return m_IsInactivated; }
set
{
m_IsInactivated = value;
}
}
public int ActiveSectorCount
{
get
{
if (sectorList != null) return sectorList.Count;
return 0;
}
}
public DateTime FirstModified
{
get { return m_FirstModified; }
}
public DateTime LastModified
{
get { return m_LastModified; }
}
public bool PlayerCreated
{
get { return m_PlayerCreated; }
set { m_PlayerCreated = value; }
}
public bool OnHold
{
get
{
if (m_OnHold) return true;
// determine whether there are any keywordtags with the hold flag
if (m_KeywordTagList == null || m_KeywordTagList.Count == 0) return false;
foreach (BaseXmlSpawner.KeywordTag sot in m_KeywordTagList)
{
// check for any keyword tag with the holdspawn flag
if (sot != null && !sot.Deleted && ((sot.Flags & BaseXmlSpawner.KeywordFlags.HoldSpawn) != 0))
{
return true;
}
}
// no hold flags were set
return false;
}
set { m_OnHold = value; }
}
public string AddSpawn
{
get { return null; }
set
{
if (value.Length > 0)
{
string str = value.Trim();
string typestr = BaseXmlSpawner.ParseObjectType(str);
Type type = null;
if (typestr != null)
type = SpawnerType.GetType(typestr);
if (type != null)
m_SpawnObjects.Add(new XmlSpawner.SpawnObject(str, 1));
else
{
// check for special keywords
if (typestr != null && (BaseXmlSpawner.IsTypeOrItemKeyword(typestr) || typestr.IndexOf("{") != -1 || typestr.StartsWith("*") || typestr.StartsWith("#")))
{
m_SpawnObjects.Add(new XmlSpawner.SpawnObject(str, 1));
}
else
this.status_str = String.Format("{0} is not a valid type name.", str);
}
InvalidateProperties();
}
}
}
public Skill TriggerSkill
{
get
{
if (TriggerMob != null && (int)m_skill_that_triggered >= 0)
{
return TriggerMob.Skills[m_skill_that_triggered];
}
else
{
return null;
}
}
set
{
if (value != null)
{
m_skill_that_triggered = value.SkillName;
}
else
{
m_skill_that_triggered = XmlSpawnerSkillCheck.RegisteredSkill.Invalid;
}
}
}
public string UniqueId
{
get { return m_UniqueId; }
}
// does not perform a defrag, so less accurate but can be used while looping through world object enums
public int SafeCurrentCount
{
get { return SafeTotalSpawnedObjects; }
}
public bool FreeRun
{
get { return m_FreeRun; }
set { m_FreeRun = value; }
}
public bool CanFreeSpawn
{
get
{
// allow free spawning if proximity sensing is off and if all of the potential free-spawning triggers are disabled
if (Running && m_ProximityRange == -1 &&
(m_ObjectPropertyName == null || m_ObjectPropertyName.Length == 0) &&
(m_MobPropertyName == null || m_MobPropertyName.Length == 0 ||
m_MobTriggerName == null || m_MobTriggerName.Length == 0) &&
!m_ExternalTriggering)
return true;
else
return false;
}
}
public SpawnObject[] SpawnObjects
{
get { return (SpawnObject[])m_SpawnObjects.ToArray(typeof(SpawnObject)); }
set
{
if ((value != null) && (value.Length > 0))
{
foreach (SpawnObject so in value)
{
if (so == null) continue;
bool AlreadyInList = false;
// Check if the new array has an existing spawn object
foreach (SpawnObject TheSpawn in m_SpawnObjects)
{
if (TheSpawn.TypeName.ToUpper() == so.TypeName.ToUpper())
{
AlreadyInList = true;
break;
}
}
// Does this item need to be added
if (AlreadyInList == false)
{
// This is a new spawn object so add it to the array (deep copy)
m_SpawnObjects.Add(new SpawnObject(so.TypeName, so.ActualMaxCount, so.SubGroup, so.SequentialResetTime, so.SequentialResetTo, so.KillsNeeded,
so.RestrictKillsToSubgroup, so.ClearOnAdvance, so.MinDelay, so.MaxDelay, so.SpawnsPerTick, so.PackRange));
}
}
if (SpawnObjects.Length < 1)
Stop();
InvalidateProperties();
}
}
}
public bool HoldSequence
{
get
{
// check to see if any keyword tags have the holdsequence flag set, or whether the spawner holdsequence flag is set
if (m_HoldSequence) return true;
// determine whether there are any keywordtags with the hold flag
if (m_KeywordTagList == null || m_KeywordTagList.Count == 0) return false;
foreach (BaseXmlSpawner.KeywordTag sot in m_KeywordTagList)
{
// check for any keyword tag with the holdsequence flag
if (sot != null && !sot.Deleted && ((sot.Flags & BaseXmlSpawner.KeywordFlags.HoldSequence) != 0))
{
return true;
}
}
// no hold flags were set
return false;
}
set { m_HoldSequence = value; }
}
public bool CanSpawn
{
get
{
if (OnHold) return false;
if (m_Group == true)
{
if (TotalSpawnedObjects <= 0)
return true;
else
return false;
}
else
{
if (IsFull)
return false;
else
return true;
}
}
}
// test for a full spawner
public bool IsFull
{
get
{
int nobj = TotalSpawnedObjects;
return ((nobj >= m_Count) || (nobj >= TotalSpawnObjectCount));
}
}
// this can be used in loops over world objects since it will not defrag and potentially modify the world object lists
public int SafeTotalSpawnedObjects
{
get
{
if (m_SpawnObjects == null) return 0;
int count = 0;
foreach (SpawnObject so in m_SpawnObjects)
count += so.SpawnedObjects.Count;
return count;
}
}
public int TotalSpawnedObjects
{
get
{
if (m_SpawnObjects == null) return 0;
// defrag so that accurately reflects currently active spawns
Defrag(true);
int count = 0;
foreach (SpawnObject so in m_SpawnObjects)
count += so.SpawnedObjects.Count;
return count;
}
}
public int TotalSpawnObjectCount
{
get
{
int count = 0;
foreach (SpawnObject so in m_SpawnObjects)
count += so.MaxCount;
return count;
}
}
#endregion
#region Command Properties
[CommandProperty(AccessLevel.GameMaster)]
public bool GumpReset
{
set {
if (value == true)
{
m_SpawnerGump = null;
}
}
}
// 2004.02.08 :: Omega Red
[CommandProperty(AccessLevel.GameMaster)]
public string RegionName
{
get
{
return m_RegionName;
}
set
{
// force a re-update of the smart spawning sector list the next time it is accessed
ResetSectorList();
m_RegionName = value;
if (value == null || value.Length <= 0)
{
m_Region = null;
return;
}
if (Region.Regions.Count == 0) // after world load, before region load
return;
foreach (Region region in Region.Regions)
{
if (string.Compare(region.Name, m_RegionName, true) == 0)
{
m_Region = region;
m_RegionName = region.Name;
//InvalidateProperties();
return;
}
}
status_str = "invalid region: " + value;
m_Region = null;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Point3D X1_Y1
{
get { return new Point3D(m_X, m_Y, Z); }
set
{
// X1 and Y1 will initiate region specification
m_Width = 0;
m_Height = 0;
m_X = value.X;
m_Y = value.Y;
// reset the sector list
ResetSectorList();
m_SpawnRange = 0;
// Check if the spawner is showing its bounds
if (ShowBounds == true)
{
ShowBounds = false;
ShowBounds = true;
}
}
}
// added the spawnrange property. It sets both the XY and width/height parameters automatically.
// also doesnt mess with homerange like XY does
[CommandProperty(AccessLevel.GameMaster)]
public int SpawnRange
{
get { return (m_SpawnRange); }
set
{
if (value < 0) return;
// reset the sector list
ResetSectorList();
m_SpawnRange = value;
m_Width = m_SpawnRange * 2;
m_Height = m_SpawnRange * 2;
// dont set the bounding box locations if the initial location is 0,0 since this occurs when the item is just being made
// because m_X and m_Y are restored on loading, it creates problems with OnLocationChange which has to avoid applying translational
// adjustments to newly placed spawners (because the actual m_X and m_Y is associated with the original location, not the 0,0 location)
// basically, before placement, dont set m_X or m_Y to anything that needs to be adjusted later on
if (Location.X == 0 && Location.Y == 0) return;
m_X = Location.X - m_SpawnRange;
m_Y = Location.Y - m_SpawnRange;
//InvalidateProperties();
// Check if the spawner is showing its bounds
if (ShowBounds == true)
{
ShowBounds = false;
ShowBounds = true;
}
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool ShowBounds
{
get { return (m_ShowBoundsItems != null && m_ShowBoundsItems.Count > 0); }
set
{
if ((value == true) && (ShowBounds == false))
{
if (m_ShowBoundsItems == null) m_ShowBoundsItems = new ArrayList();
// Boundary lines
int ValidX1 = m_X;
int ValidX2 = m_X + m_Width;
int ValidY1 = m_Y;
int ValidY2 = m_Y + m_Height;
for (int x = 0; x <= m_Width; x++)
{
int NewX = m_X + x;
for (int y = 0; y <= m_Height; y++)
{
int NewY = m_Y + y;
if (NewX == ValidX1 || NewX == ValidX2 || NewX == ValidY1 || NewX == ValidY2 || NewY == ValidX1 || NewY == ValidX2 || NewY == ValidY1 || NewY == ValidY2)
{
// Add an object to show the spawn area
Static s = new Static(ShowBoundsItemId);
s.Visible = false;
s.MoveToWorld(new Point3D(NewX, NewY, Z), this.Map);
m_ShowBoundsItems.Add(s);
}
}
}
}
if (value == false && m_ShowBoundsItems != null)
{
// Remove all of the items from the array
foreach (Static s in m_ShowBoundsItems)
s.Delete();
m_ShowBoundsItems.Clear();
}
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Point3D X2_Y2
{
get { return new Point3D((m_X + m_Width), (m_Y + m_Height), Z); }
set
{
int X2;
int Y2;
int OriginalX2 = m_X + m_Width;
int OriginalY2 = m_Y + m_Height;
// reset the sector list
ResetSectorList();
// now determine based upon the entered coordinate values what the lower left corner is
// lower left will be the min x and min y
// upper right will be max x max y
if (value.X < OriginalX2)
{
// ok, this is the proper x value for the lower left
m_X = value.X;
X2 = OriginalX2;
}
else
{
m_X = OriginalX2;
X2 = value.X;
}
if (value.Y < OriginalY2)
{
// ok, this is the proper y value for the lower left
m_Y = value.Y;
Y2 = OriginalY2;
}
else
{
m_Y = OriginalY2;
Y2 = value.Y;
}
m_Width = X2 - m_X;
m_Height = Y2 - m_Y;
if (m_Width == m_Height)
m_SpawnRange = m_Width / 2;
else
m_SpawnRange = -1;
if (m_HomeRangeIsRelative == false)
{
int NewHomeRange = (m_Width > m_Height ? m_Height : m_Width);
m_HomeRange = (NewHomeRange > 0 ? NewHomeRange : 0);
}
//original test was for less than 1, changed it to less than zero (zero is a valid width, its the default in fact)
// Stop the spawner if the width or height is less than 1
if ((m_Width < 0) || (m_Height < 0))
Running = false;
InvalidateProperties();
// Check if the spawner is showing its bounds
if (ShowBounds == true)
{
ShowBounds = false;
ShowBounds = true;
}
}
}
/*
[CommandProperty(AccessLevel.GameMaster)]
public override string Name
{
get { return m_Name; }
set
{
m_Name = value;
InvalidateProperties();
}
}
*/
[CommandProperty(AccessLevel.GameMaster)]
public int MaxCount
{
get { return m_Count; }
set
{
m_Count = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int CurrentCount
{
get { return TotalSpawnedObjects; }
}
[CommandProperty(AccessLevel.GameMaster)]
public WayPoint WayPoint
{
get { return m_WayPoint; }
set { m_WayPoint = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public bool ExternalTriggering
{
get { return m_ExternalTriggering; }
set { m_ExternalTriggering = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public bool ExtTrigState
{
get { return m_ExternalTrigger; }
set { m_ExternalTrigger = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public bool Running
{
get { return m_Running; }
set
{
// Don't start the spawner unless the height and width are valid
if ((value == true) && (m_Width >= 0) && (m_Height >= 0))
{
Start();
}
else
Stop();
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int HomeRange
{
get { return m_HomeRange; }
set { m_HomeRange = value; InvalidateProperties(); }
}
[CommandProperty(AccessLevel.GameMaster)]
public bool HomeRangeIsRelative
{
get { return m_HomeRangeIsRelative; }
set { m_HomeRangeIsRelative = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int Team
{
get { return m_Team; }
set { m_Team = value; InvalidateProperties(); }
}
[CommandProperty(AccessLevel.GameMaster)]
public int StackAmount
{
get { return m_StackAmount; }
set { m_StackAmount = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan MinDelay
{
get { return m_MinDelay; }
set
{
m_MinDelay = value;
// reset the spawn timer
DoTimer();
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan MaxDelay
{
get { return m_MaxDelay; }
set
{
m_MaxDelay = value;
// reset the spawn timer
DoTimer();
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int KillCount
{
get { return m_killcount; }
set { m_killcount = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int KillReset
{
get { return m_KillReset; }
set { m_KillReset = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public double TriggerProbability
{
get { return m_TriggerProbability; }
set { m_TriggerProbability = value; }
}
//added refractory period support
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan RefractMin
{
get { return m_MinRefractory; }
set { m_MinRefractory = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan RefractMax
{
get { return m_MaxRefractory; }
set { m_MaxRefractory = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan RefractoryOver
{
get
{
if (m_refractActivated)
return m_RefractEnd - DateTime.Now;
else
return TimeSpan.FromSeconds(0);
}
set
{
DoTimer3(value);
}
}
[CommandProperty(AccessLevel.GameMaster)]
public string TriggerOnCarried
{
get { return m_ItemTriggerName; }
set { m_ItemTriggerName = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public string NoTriggerOnCarried
{
get { return m_NoItemTriggerName; }
set { m_NoItemTriggerName = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public string TriggerObjectProp
{
get { return m_ObjectPropertyName; }
set { m_ObjectPropertyName = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public string TriggerObjectName
{
get
{
if (m_ObjectPropertyItem == null || m_ObjectPropertyItem.Deleted) return null;
return m_ObjectPropertyItem.Name;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Item TriggerObject
{
get { return m_ObjectPropertyItem; }
set { m_ObjectPropertyItem = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public string SetItemName
{
get
{
if (m_SetPropertyItem == null || m_SetPropertyItem.Deleted) return null;
return m_SetPropertyItem.Name;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Item SetItem
{
get
{
return m_SetPropertyItem;
}
set { m_SetPropertyItem = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public string MobTriggerProp
{
get { return m_MobPropertyName; }
set { m_MobPropertyName = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public string MobTriggerName
{
get { return m_MobTriggerName; }
set { m_MobTriggerName = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile MobTriggerId
{
get
{
if (m_MobTriggerName == null) return null;
// try to parse out the type information if it has also been saved
string[] typeargs = m_MobTriggerName.Split(",".ToCharArray(), 2);
string typestr = null;
string namestr = m_MobTriggerName;
if (typeargs.Length > 1)
{
namestr = typeargs[0];
typestr = typeargs[1];
}
return BaseXmlSpawner.FindMobileByName(this, namestr, typestr);
}
}
[CommandProperty(AccessLevel.GameMaster)]
public string PlayerTriggerProp
{
get { return m_PlayerPropertyName; }
set { m_PlayerPropertyName = value; }
}
// time of day activation
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan TODStart
{
get { return m_TODStart; }
set { m_TODStart = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan TODEnd
{
get { return m_TODEnd; }
set { m_TODEnd = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan TOD
{
get
{
if (m_TODMode == TODModeType.Gametime)
{
int hours;
int minutes;
Server.Items.Clock.GetTime(this.Map, Location.X, this.Location.Y, out hours, out minutes);
return (new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hours, minutes, 0).TimeOfDay);
}
else
return DateTime.Now.TimeOfDay;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public TODModeType TODMode
{
get { return m_TODMode; }
set { m_TODMode = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public bool TODInRange
{
get
{
if (m_TODStart == m_TODEnd) return true;
DateTime now;
DateTime TOD_start;
DateTime TOD_end;
DateTime day_start;
if (m_TODMode == TODModeType.Gametime)
{
int hours;
int minutes;
Server.Items.Clock.GetTime(this.Map, Location.X, this.Location.Y, out hours, out minutes);
now = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hours, minutes, 0);
}
else
{
// calculate the time window
now = DateTime.Now;
}
day_start = new DateTime(now.Year, now.Month, now.Day);
// calculate the starting TOD window by adding the TODStart to day_start
TOD_start = day_start + m_TODStart;
TOD_end = day_start + m_TODEnd;
// handle the case when TODstart is before midnight and end is after
if (TOD_start > TOD_end)
{
if (now > TOD_start || now < TOD_end)
return true;
else
return false;
}
else
{
if (now > TOD_start && now < TOD_end)
return true;
else
return false;
}
}
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan DespawnTime
{
get { return m_DespawnTime; }
set { m_DespawnTime = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan Duration
{
get { return m_Duration; }
set
{
m_Duration = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan DurationOver
{
get
{
if (m_durActivated)
return m_DurEnd - DateTime.Now;
else
return TimeSpan.FromSeconds(0);
}
set
{
DoTimer2(value);
}
}
// proximity range parameter
[CommandProperty(AccessLevel.GameMaster)]
public int ProximityRange
{
get { return m_ProximityRange; }
set
{
m_ProximityRange = value;
InvalidateProperties();
}
}
// proximity range activated?
[CommandProperty(AccessLevel.GameMaster)]
public bool ProximityActivated
{
get { return m_proximityActivated; }
set
{
if (AllowTriggering)
{
ActivateTrigger();
}
m_proximityActivated = value;
}
}
// proximity trigger sound parameter
[CommandProperty(AccessLevel.GameMaster)]
public int ProximitySound
{
get { return m_ProximityTriggerSound; }
set { m_ProximityTriggerSound = value; }
}
// proximity trigger message parameter
[CommandProperty(AccessLevel.GameMaster)]
public string ProximityMsg
{
get { return m_ProximityTriggerMessage; }
set { m_ProximityTriggerMessage = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public string SpeechTrigger
{
get { return m_SpeechTrigger; }
set { m_SpeechTrigger = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public string SkillTrigger
{
get { return m_SkillTrigger; }
set
{
SkillName news = XmlSpawnerSkillCheck.RegisteredSkill.Invalid;
double minval = -1;
double maxval = -1;
int successval = 3; // either success or failure will trigger
if (value != null)
{
// try parsing the skill trigger string for min and maxval
// the string can take the form "skill,[+/-][,minval,maxval]"
string[] arglist = BaseXmlSpawner.ParseString(value, 4, ",");
if (arglist.Length == 2 || arglist.Length == 4)
{
if (arglist[1] == "+")
{
successval = 1; // trigger on success only
}
else
if (arglist[1] == "-")
{
successval = 2; // trigger on failure only
}
}
if (arglist.Length == 3)
{
successval = 3;
try
{
minval = double.Parse(arglist[1]);
maxval = double.Parse(arglist[2]);
}
catch { }
}
else
if (arglist.Length == 4)
{
try
{
minval = double.Parse(arglist[2]);
maxval = double.Parse(arglist[3]);
}
catch { }
}
try
{
news = (SkillName)Enum.Parse(typeof(SkillName), arglist[0], true);
}
catch { }
}
// unregister the previous skill if it was assigned
if (m_SkillTrigger != null)
{
XmlSpawnerSkillCheck.UnRegisterSkillTrigger(this, m_SkillTriggerName, this.Map, false);
}
// if the skill trigger was valid then register it
if (news != XmlSpawnerSkillCheck.RegisteredSkill.Invalid)
{
XmlSpawnerSkillCheck.RegisterSkillTrigger(this, news, this.Map);
m_SkillTrigger = value;
m_SkillTriggerName = news;
m_SkillTriggerMin = minval;
m_SkillTriggerMax = maxval;
m_SkillTriggerSuccess = successval;
}
else
{
m_SkillTrigger = null;
m_SkillTriggerName = XmlSpawnerSkillCheck.RegisteredSkill.Invalid;
m_SkillTriggerMin = -1;
m_SkillTriggerMax = -1;
}
}
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan NextSpawn
{
get
{
if (m_Running)
return m_End - DateTime.Now;
else
return TimeSpan.FromSeconds(0);
}
set
{
Start();
DoTimer(value);
//InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool SpawnOnTrigger
{
get { return m_SpawnOnTrigger; }
set { m_SpawnOnTrigger = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public bool Group
{
get { return m_Group; }
set { m_Group = value; InvalidateProperties(); }
}
[CommandProperty(AccessLevel.GameMaster)]
public string GumpState
{
get { return m_GumpState; }
set { m_GumpState = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
pu

ArteGordon- 07-15-2006
you just need to uncomment this line at the beginning of the file
//#define RUNUO2RC1
so that it looks like
#define RUNUO2RC1
Theoderic- 07-15-2006

QUOTE (ArteGordon @ July 15, 2006 10:45 am)
you just need to uncomment this line at the beginning of the file //#define RUNUO2RC1 so that it looks like #define RUNUO2RC1

Hi this problem is repaired here:
http://xmlspawner.15.forumer.com/index.php?showtopic=672
Zaphkiel- 07-15-2006
THanks fixed it last night about 10 mins after I posted
zziggy5000- 07-18-2006
Holy hana thats all i have to do thanks a million