public static void AddToRespawnEntries( MegaSpawner megaSpawner, object o ) { bool success = false; for ( int i = 0; i < megaSpawner.OverrideRespawnEntryList.Count; i++ ) { int randomDespawnTime = Utility.Random( megaSpawner.OverrideMinDespawn, megaSpawner.OverrideMaxDespawn - megaSpawner.OverrideMinDespawn ); if ( megaSpawner.OverrideRespawnEntryList[i] is string ) { object respawnEntry = o; if ( o is Item ) respawnEntry = (Item) o; else if ( o is Mobile ) respawnEntry = (Mobile) o; if ( (string) megaSpawner.OverrideRespawnEntryList[i] == "" && ( (int) megaSpawner.OverrideRespawnTimeList[i] <= MegaSpawner.tickOffset || megaSpawner.OverrideGroupSpawn ) ) { success = true; megaSpawner.OverrideRespawnEntryList[i] = respawnEntry; megaSpawner.OverrideDespawnTimeList[i] = randomDespawnTime; break; } } } if ( !success ) MC.DeleteObject( o ); }
public static void CheckEntries( MegaSpawner megaSpawner ) { for ( int i = 0; i < megaSpawner.OverrideSpawnedEntries.Count; i++ ) { object o = megaSpawner.OverrideSpawnedEntries[i]; if ( o is Item ) { Item item = (Item) o; if ( megaSpawner.OverrideLastMovedList[i] is int ) megaSpawner.OverrideLastMovedList[i] = item.LastMoved; DateTime lastMoved = (DateTime) megaSpawner.OverrideLastMovedList[i]; if ( item.RootParent != null && item.RootParent == (object) megaSpawner.ContainerSpawn && lastMoved != item.LastMoved ) { lastMoved = item.LastMoved; megaSpawner.OverrideLastMovedList[i] = item.LastMoved; } if ( item.Deleted || ( item.RootParent != null && megaSpawner.ContainerSpawn != null && item.RootParent != (object) megaSpawner.ContainerSpawn ) || ( item.RootParent != null && megaSpawner.RootParent != null && item.RootParent != megaSpawner.RootParent ) || lastMoved != item.LastMoved ) { megaSpawner.OverrideSpawnedEntries.RemoveAt( i ); megaSpawner.OverrideLastMovedList.RemoveAt( i ); SpawnCounter( megaSpawner, o ); i--; } } else if ( o is Mobile ) { Mobile mob = (Mobile) o; if ( mob.Deleted || ( mob is BaseCreature && ( ( (BaseCreature) mob ).Controlled || ( (BaseCreature) mob ).IsStabled ) ) ) { megaSpawner.OverrideSpawnedEntries.RemoveAt( i ); megaSpawner.OverrideLastMovedList.RemoveAt( i ); SpawnCounter( megaSpawner, o ); i--; } } else { megaSpawner.OverrideSpawnedEntries.RemoveAt( i ); megaSpawner.OverrideLastMovedList.RemoveAt( i ); SpawnCounter( megaSpawner, o ); i--; } } }
public static void BringToHome( MegaSpawner megaSpawner ) { for ( int i = 0; i < megaSpawner.OverrideSpawnedEntries.Count; i++ ) { object o = megaSpawner.OverrideSpawnedEntries[i]; if ( o is Mobile ) ( (Mobile) o ).Location = megaSpawner.Location; } }
public static int CountEntries( MegaSpawner megaSpawner, int index ) { int entryCount = 0; for ( int i = 0; i < megaSpawner.OverrideSpawnedEntries.Count; i++ ) { object o = megaSpawner.OverrideSpawnedEntries[i]; string entryType = (string) megaSpawner.EntryList[index]; if ( o.GetType().Name.ToLower() == entryType.ToLower() ) entryCount++; } return entryCount; }
public static void BringToHome( MegaSpawner megaSpawner, int index ) { string entryType = (string) megaSpawner.EntryList[index]; for ( int i = 0; i < megaSpawner.OverrideSpawnedEntries.Count; i++ ) { object o = megaSpawner.OverrideSpawnedEntries[i]; if ( o is Mobile ) { if ( o.GetType().Name.ToLower() == entryType.ToLower() ) ( (Mobile) o ).Location = megaSpawner.Location; } } }
public static void AddSpawnCount( MegaSpawner megaSpawner, int index ) { int randomDelay = Utility.Random( megaSpawner.OverrideMinDelay, megaSpawner.OverrideMaxDelay - megaSpawner.OverrideMinDelay ); if ( megaSpawner.OverrideGroupSpawn ) { for ( int i = 0; i < megaSpawner.OverrideRespawnEntryList.Count; i++ ) { if ( (string) megaSpawner.OverrideRespawnEntryList[i] == "" ) { megaSpawner.OverrideRespawnTimeList[i] = randomDelay + MegaSpawner.tickOffset; megaSpawner.OverrideSpawnCounterList[i] = DateTime.Now; megaSpawner.OverrideSpawnTimeList[i] = randomDelay; } } } else { megaSpawner.OverrideRespawnTimeList[index] = randomDelay + MegaSpawner.tickOffset; megaSpawner.OverrideSpawnCounterList[index] = DateTime.Now; megaSpawner.OverrideSpawnTimeList[index] = randomDelay; } }
public static bool Deserialize( GenericReader reader ) { bool success = false; Map map = null; Point3D location = new Point3D(); MegaSpawner megaSpawner = new MegaSpawner( true ); try { int version = reader.ReadInt(); if ( version >= 1 ) { location = reader.ReadPoint3D(); map = reader.ReadMap(); megaSpawner.Active = reader.ReadBool(); megaSpawner.Imported = reader.ReadString(); megaSpawner.ImportVersion = reader.ReadString(); megaSpawner.ContainerSpawn = (Container) reader.ReadItem(); megaSpawner.Workspace = reader.ReadBool(); int count = reader.ReadInt(); for ( int i = 0; i < count; i++ ) megaSpawner.EntryList.Add( reader.ReadString() ); for ( int i = 0; i < count; i++ ) megaSpawner.SpawnRangeList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.WalkRangeList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) { int amount = reader.ReadInt(); if ( amount == 0 ) amount = 1; megaSpawner.AmountList.Add( amount ); } for ( int i = 0; i < count; i++ ) megaSpawner.MinDelayList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.MaxDelayList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.SpawnTypeList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.ActivatedList.Add( reader.ReadBool() ); for ( int i = 0; i < count; i++ ) megaSpawner.EventRangeList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.EventKeywordList.Add( reader.ReadString() ); for ( int i = 0; i < count; i++ ) megaSpawner.KeywordCaseSensitiveList.Add( reader.ReadBool() ); for ( int i = 0; i < count; i++ ) megaSpawner.TriggerEventNowList.Add( reader.ReadBool() ); for ( int i = 0; i < count; i++ ) megaSpawner.EventAmbushList.Add( reader.ReadBool() ); for ( int i = 0; i < count; i++ ) megaSpawner.BeginTimeBasedList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.EndTimeBasedList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.GroupSpawnList.Add( reader.ReadBool() ); for ( int i = 0; i < count; i++ ) megaSpawner.MinStackAmountList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.MaxStackAmountList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.MovableList.Add( reader.ReadBool() ); if ( version >= 2 ) { for ( int i = 0; i < count; i++ ) megaSpawner.MinDespawnList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.MaxDespawnList.Add( reader.ReadInt() ); for ( int i = 0; i < count; i++ ) megaSpawner.DespawnList.Add( reader.ReadBool() ); for ( int i = 0; i < count; i++ ) megaSpawner.DespawnGroupList.Add( reader.ReadBool() ); for ( int i = 0; i < count; i++ ) megaSpawner.DespawnTimeExpireList.Add( reader.ReadBool() ); } else { for ( int i = 0; i < count; i++ ) megaSpawner.MinDespawnList.Add( 1800 ); for ( int i = 0; i < count; i++ ) megaSpawner.MaxDespawnList.Add( 3600 ); for ( int i = 0; i < count; i++ ) megaSpawner.DespawnList.Add( (bool) false ); for ( int i = 0; i < count; i++ ) megaSpawner.DespawnGroupList.Add( (bool) false ); for ( int i = 0; i < count; i++ ) megaSpawner.DespawnTimeExpireList.Add( (bool) true ); } int settingsCount = reader.ReadInt(); if ( version >= 3 ) { for ( int i = 0; i < settingsCount; i++ ) { ArrayList List = new ArrayList(); Setting setting = (Setting) reader.ReadInt(); List.Add( setting ); switch ( setting ) { case Setting.OverrideIndividualEntries: { List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadBool() ); List.Add( reader.ReadBool() ); List.Add( (SpawnType) reader.ReadInt() ); List.Add( reader.ReadString() ); List.Add( reader.ReadBool() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadBool() ); List.Add( reader.ReadBool() ); List.Add( reader.ReadBool() ); break; } case Setting.AddItem: { List.Add( reader.ReadString() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadString() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); break; } case Setting.AddContainer: { List.Add( reader.ReadString() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadString() ); List.Add( reader.ReadInt() ); List.Add( reader.ReadInt() ); int settingCount = reader.ReadInt(); for ( int j = 6; j < settingCount; j++ ) { ArrayList ItemsList = new ArrayList(); ItemsList.Add( reader.ReadString() ); ItemsList.Add( reader.ReadInt() ); ItemsList.Add( reader.ReadInt() ); List.Add( ItemsList ); } break; } } megaSpawner.SettingsList.Add( List ); } } else { for ( int i = 0; i < settingsCount; i++ ) megaSpawner.SettingsList.Add( reader.ReadString() ); megaSpawner.ConvertOldSettings(); } } if ( megaSpawner.Workspace ) { megaSpawner.Delete(); } else { megaSpawner.MoveToWorld( location, map ); megaSpawner.Start(); if ( megaSpawner.Imported != "" ) MC.FileImportAdd( megaSpawner.Imported, megaSpawner.ImportVersion ); megaSpawner.CompileSettings(); megaSpawner.CheckEntryErrors(); megaSpawner.SettingsList.Sort( new MC.SettingsSorter() ); if ( megaSpawner.OverrideIndividualEntries ) { for ( int i = 0; i < megaSpawner.OverrideAmount; i++ ) { megaSpawner.OverrideRespawnEntryList.Add( "" ); megaSpawner.OverrideRespawnTimeList.Add( 0 ); megaSpawner.OverrideSpawnCounterList.Add( DateTime.Now ); megaSpawner.OverrideSpawnTimeList.Add( 0 ); megaSpawner.OverrideDespawnTimeList.Add( 0 ); } } else { for ( int i = 0; i < megaSpawner.EntryList.Count; i++ ) { ArrayList respawnEntryList = new ArrayList(); ArrayList respawnTimeList = new ArrayList(); ArrayList spawnCounterList = new ArrayList(); ArrayList spawnTimeList = new ArrayList(); ArrayList respawnOnSaveList = new ArrayList(); ArrayList despawnTimeList = new ArrayList(); for ( int j = 0; j < (int) megaSpawner.AmountList[i]; j++ ) { respawnEntryList.Add( (string) megaSpawner.EntryList[i] ); respawnTimeList.Add( 0 ); spawnCounterList.Add( DateTime.Now ); spawnTimeList.Add( 0 ); respawnOnSaveList.Add( (bool) false ); despawnTimeList.Add( 0 ); } megaSpawner.RespawnEntryList.Add( respawnEntryList ); megaSpawner.RespawnTimeList.Add( respawnTimeList ); megaSpawner.SpawnCounterList.Add( spawnCounterList ); megaSpawner.SpawnTimeList.Add( spawnTimeList ); megaSpawner.RespawnOnSaveList.Add( respawnOnSaveList ); megaSpawner.DespawnTimeList.Add( despawnTimeList ); megaSpawner.SpawnedEntries.Add( new ArrayList() ); megaSpawner.LastMovedList.Add( new ArrayList() ); } } megaSpawner.Respawn(); } success = true; } catch { if ( megaSpawner != null ) megaSpawner.Delete(); } return success; }
private void GetArgsList() { MessagesTitle = (string) ArgsList[2]; Messages = (string) ArgsList[4]; HideSpawnerList = (ArrayList) ArgsList[6]; MSGCheckBoxesList = (ArrayList) ArgsList[13]; megaSpawner = (MegaSpawner) ArgsList[19]; fromSpawnerList = (bool) ArgsList[20]; PersonalConfigList = (ArrayList) ArgsList[28]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; }
public static void RemoveEditor( Mobile mobile, MegaSpawner megaSpawner ) { for ( int i = 0; i < MSUsers.Count; i++ ) { Mobile MSUser = (Mobile) MSUsers[i]; if ( mobile == MSUser ) MSEdit[i] = null; } }
public static void AddToWorkspace( Mobile mobile, MegaSpawner megaSpawner ) { for ( int i = 0; i < MSUsers.Count; i++ ) { Mobile MSUser = (Mobile) MSUsers[i]; if ( mobile == MSUser ) { ArrayList Workspace = (ArrayList) MSWorkspace[i]; Workspace.Add( megaSpawner ); MSWorkspace[i] = Workspace; } } }
private static int LocationSorter( bool descOrder, SortSearchType sortType, MegaSpawner a, MegaSpawner b ) { int aX, bX, aY, bY, aZ, bZ, sort=0; if ( a.Parent != null ) { aX = ( (Item) a.Parent ).Location.X; aY = ( (Item) a.Parent ).Location.Y; aZ = ( (Item) a.Parent ).Location.Z; } else { aX = a.X; aY = a.Y; aZ = a.Z; } if ( b.Parent != null ) { bX = ( (Item) b.Parent ).Location.X; bY = ( (Item) b.Parent ).Location.Y; bZ = ( (Item) b.Parent ).Location.Z; } else { bX = b.X; bY = b.Y; bZ = b.Z; } switch ( sortType ) { case SortSearchType.LocationX: { if ( aX < bX ) { sort = -1; } else if ( aX > bX ) { sort = 1; } else // if ( aX == bX ) { if ( aY < bY ) { if ( descOrder ) sort = 1; else sort = -1; } else if ( aY > bY ) { if ( descOrder ) sort = -1; else sort = 1; } else // if ( aY == bY ) { if ( aZ < bZ ) sort = -1; else if ( aZ > bZ ) sort = 1; else // if ( aZ == bZ ) sort = 0; if ( descOrder ) sort = -sort; } } break; } case SortSearchType.LocationY: { if ( aY < bY ) { sort = -1; } else if ( aY > bY ) { sort = 1; } else // if ( aY == bY ) { if ( aX < bX ) { if ( descOrder ) sort = 1; else sort = -1; } else if ( aX > bX ) { if ( descOrder ) sort = -1; else sort = 1; } else // if ( aX == bX ) { if ( aZ < bZ ) sort = -1; else if ( aZ > bZ ) sort = 1; else // if ( aZ == bZ ) sort = 0; if ( descOrder ) sort = -sort; } } break; } case SortSearchType.LocationZ: { if ( aZ < bZ ) { sort = -1; } else if ( aZ > bZ ) { sort = 1; } else // if ( aZ == bZ ) { if ( aX < bX ) { if ( descOrder ) sort = 1; else sort = -1; } else if ( aX > bX ) { if ( descOrder ) sort = -1; else sort = 1; } else // if ( aX == bX ) { if ( aY < bY ) sort = -1; else if ( aY > bY ) sort = 1; else // if ( aY == bY ) sort = 0; if ( descOrder ) sort = -sort; } } break; } } if ( descOrder ) return -sort; else return sort; }
public static int SpawnerCompare( MegaSpawner fromCompare, MegaSpawner toCompare, bool delete ) { if ( !ListCompare( fromCompare.EntryList, toCompare.EntryList ) ) return 0; if ( !ListCompare( fromCompare.SpawnRangeList, toCompare.SpawnRangeList ) ) return 0; if ( !ListCompare( fromCompare.WalkRangeList, toCompare.WalkRangeList ) ) return 0; if ( !ListCompare( fromCompare.AmountList, toCompare.AmountList ) ) return 0; if ( !ListCompare( fromCompare.MinDelayList, toCompare.MinDelayList ) ) return 0; if ( !ListCompare( fromCompare.MaxDelayList, toCompare.MaxDelayList ) ) return 0; if ( !ListCompare( fromCompare.SpawnTypeList, toCompare.SpawnTypeList ) ) return 0; if ( !ListCompare( fromCompare.ActivatedList, toCompare.ActivatedList ) ) return 0; if ( !ListCompare( fromCompare.EventRangeList, toCompare.EventRangeList ) ) return 0; if ( !ListCompare( fromCompare.EventKeywordList, toCompare.EventKeywordList ) ) return 0; if ( !ListCompare( fromCompare.KeywordCaseSensitiveList, toCompare.KeywordCaseSensitiveList ) ) return 0; if ( !ListCompare( fromCompare.EventAmbushList, toCompare.EventAmbushList ) ) return 0; if ( !ListCompare( fromCompare.BeginTimeBasedList, toCompare.BeginTimeBasedList ) ) return 0; if ( !ListCompare( fromCompare.EndTimeBasedList, toCompare.EndTimeBasedList ) ) return 0; if ( !ListCompare( fromCompare.GroupSpawnList, toCompare.GroupSpawnList ) ) return 0; if ( !ListCompare( fromCompare.MinStackAmountList, toCompare.MinStackAmountList ) ) return 0; if ( !ListCompare( fromCompare.MaxStackAmountList, toCompare.MaxStackAmountList ) ) return 0; if ( !ListCompare( fromCompare.MovableList, toCompare.MovableList ) ) return 0; if ( !ListCompare( fromCompare.MinDespawnList, toCompare.MinDespawnList ) ) return 0; if ( !ListCompare( fromCompare.MaxDespawnList, toCompare.MaxDespawnList ) ) return 0; if ( !ListCompare( fromCompare.DespawnList, toCompare.DespawnList ) ) return 0; if ( !ListCompare( fromCompare.DespawnGroupList, toCompare.DespawnGroupList ) ) return 0; if ( !ListCompare( fromCompare.DespawnTimeExpireList, toCompare.DespawnTimeExpireList ) ) return 0; if ( !ListCompare( fromCompare.SettingsList, toCompare.SettingsList ) ) return 0; if ( delete ) toCompare.Delete(); return 1; }
private void GetArgsList() { Help = (bool) ArgsList[0]; DisplayMessages = (bool) ArgsList[1]; MessagesTitle = (string) ArgsList[2]; OldMessagesTitle = (string) ArgsList[3]; Messages = (string) ArgsList[4]; OldMessages = (string) ArgsList[5]; PageInfoList = (ArrayList) ArgsList[12]; SettingsCheckBoxesList = (ArrayList) ArgsList[17]; megaSpawner = (MegaSpawner) ArgsList[19]; AVSArgsList = (ArrayList) ArgsList[22]; AVSSetList = (ArrayList) ArgsList[23]; PersonalConfigList = (ArrayList) ArgsList[28]; cpg = (int) PageInfoList[12]; pg = (int) PageInfoList[13]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; MessagesTextColor = (TextColor) PersonalConfigList[6]; CommandButtonsTextColor = (TextColor) PersonalConfigList[7]; PageNumberTextColor = (int) PersonalConfigList[8]; FlagTextColor = (TextColor) PersonalConfigList[14]; }
public static void DeleteEntries( MegaSpawner megaSpawner ) { for ( int i = 0; i < megaSpawner.OverrideSpawnedEntries.Count; i++ ) { object o = megaSpawner.OverrideSpawnedEntries[i]; MC.DeleteObject( o ); if ( megaSpawner.OverrideRespawnEntryList.Count == megaSpawner.OverrideSpawnedEntries.Count ) megaSpawner.OverrideRespawnEntryList[i] = ""; } megaSpawner.OverrideSpawnedEntries.Clear(); megaSpawner.OverrideLastMovedList.Clear(); }
public static void OnSpeech( MegaSpawner megaSpawner, SpeechEventArgs e ) { Mobile mobile = e.Mobile; if ( EventSpawnAttempt( megaSpawner, SpawnType.Speech ) ) { if ( Utility.InRange( megaSpawner.Location, mobile.Location, megaSpawner.OverrideEventRange ) ) { int entryCount = CountEntries( megaSpawner ); if ( megaSpawner.OverrideCaseSensitive && megaSpawner.OverrideEventKeyword != e.Speech ) return; else if ( megaSpawner.OverrideEventKeyword.ToLower() != e.Speech.ToLower() ) return; if ( megaSpawner.OverrideGroupSpawn && entryCount != 0 ) return; if ( ( megaSpawner.OverrideGroupSpawn && entryCount == 0 ) || CheckEventAmbush( megaSpawner ) ) FullSpawn( megaSpawner ); else SingleSpawn( megaSpawner ); } megaSpawner.OverrideTriggerEventNow = false; } }
public static string GetSettingInfo( MegaSpawner megaSpawner, ArrayList setting ) { bool AddItem=false, ContainerItems=false; string entryName=null, addItem=null, entryType=null; int entryIndex=0, minStackAmount=0, maxStackAmount=0; try { switch( (Setting) setting[0] ) { case Setting.OverrideIndividualEntries:{ return "Override Individual Entries"; } case Setting.AddItem: { AddItem = true; entryName = (string) setting[1]; entryIndex = (int) setting[2]; addItem = (string) setting[3]; minStackAmount = (int) setting[4]; maxStackAmount = (int) setting[5]; if ( megaSpawner != null ) entryType = (string) megaSpawner.EntryList[entryIndex]; else entryType = entryName; break; } case Setting.AddContainer: { AddItem = true; ContainerItems = true; entryName = (string) setting[1]; entryIndex = (int) setting[2]; addItem = (string) setting[3]; minStackAmount = (int) setting[4]; maxStackAmount = (int) setting[5]; if ( megaSpawner != null ) entryType = (string) megaSpawner.EntryList[entryIndex]; else entryType = entryName; break; } default:{ return "Unknown Error"; } } if ( AddItem ) { if ( megaSpawner != null && entryName != entryType ) return String.Format( "Entry #{0}: Add Item To Spawn Entry [Discrepancy Error]", entryIndex ); else if ( IsStackable( addItem ) ) return String.Format( "Entry #{0}: Add Random {1} To {2} \"{3}\" To \"{4}\"", entryIndex, minStackAmount, maxStackAmount, addItem, entryType ); else return String.Format( "Entry #{0}: Add \"{1}\"{2} To \"{3}\"", entryIndex, addItem, ContainerItems ? " With Items" : "", entryType ); } } catch{} return "Error reading setting info. Possible missing or corrupt data."; }
public static ArrayList CompileSameLocationList( MegaSpawner fromCompare ) { CheckSpawners(); ArrayList List = new ArrayList(); foreach ( MegaSpawner toCompare in SpawnerList ) if ( fromCompare != toCompare ) if ( fromCompare.Location == toCompare.Location && fromCompare.Map == toCompare.Map ) List.Add( toCompare ); return List; }
private void GetArgsList() { MessagesTitle = (string) ArgsList[2]; Messages = (string) ArgsList[4]; megaSpawner = (MegaSpawner) ArgsList[19]; PersonalConfigList = (ArrayList) ArgsList[28]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; ActiveTEBGTypeConfig = (BackgroundType) PersonalConfigList[2]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; ActiveTextEntryTextColor = (int) PersonalConfigList[9]; }
public static int GetDelay( MegaSpawner megaSpawner ) { switch ( TimerTypeConfig ) { case TimerType.Master:{ return ( Delay ); } case TimerType.Personal:{ return ( Delay + AddRandom ); } case TimerType.RandomEntryDelay: { int entryCount = megaSpawner.EntryList.Count - 1; if ( entryCount < 0 ) return Delay + AddRandom; int randomEntry = Utility.Random( 0, entryCount ); return Utility.Random( (int) megaSpawner.MinDelayList[randomEntry], ( (int) megaSpawner.MaxDelayList[randomEntry] - (int) megaSpawner.MinDelayList[randomEntry] ) ); } } return 1; }
private void GetArgsList() { Help = (bool) ArgsList[0]; DisplayMessages = (bool) ArgsList[1]; MessagesTitle = (string) ArgsList[2]; OldMessagesTitle = (string) ArgsList[3]; Messages = (string) ArgsList[4]; OldMessages = (string) ArgsList[5]; PageInfoList = (ArrayList) ArgsList[12]; MSEGCheckBoxesList = (ArrayList) ArgsList[14]; megaSpawner = (MegaSpawner) ArgsList[19]; ESGArgsList = (ArrayList) ArgsList[21]; PersonalConfigList = (ArrayList) ArgsList[28]; SEGArgsList = (ArrayList) ArgsList[32]; cpg = (int) PageInfoList[4]; pg = (int) PageInfoList[5]; AddToSpawner = (bool) ESGArgsList[0]; index = (int) ESGArgsList[1]; activatedSwitch = (bool) ESGArgsList[2]; spawnGroupSwitch = (bool) ESGArgsList[3]; eventAmbushSwitch = (bool) ESGArgsList[4]; spawnTypeSwitch = (SpawnType) ESGArgsList[5]; if ( !bEntryType ) entryType = (string) ESGArgsList[6]; if ( !bSpawnRange ) spawnRange = (int) ESGArgsList[7]; if ( !bWalkRange ) walkRange = (int) ESGArgsList[8]; if ( !bAmount ) amount = (int) ESGArgsList[9]; if ( !bMinDelayHour ) minDelayHour = (int) ESGArgsList[10]; if ( !bMinDelayMin ) minDelayMin = (int) ESGArgsList[11]; if ( !bMinDelaySec ) minDelaySec = (int) ESGArgsList[12]; if ( !bMaxDelayHour ) maxDelayHour = (int) ESGArgsList[13]; if ( !bMaxDelayMin ) maxDelayMin = (int) ESGArgsList[14]; if ( !bMaxDelaySec ) maxDelaySec = (int) ESGArgsList[15]; if ( !bEventRange ) eventRange = (int) ESGArgsList[16]; if ( !bBeginTimeBased ) { beginTimeBasedHour = (int) ESGArgsList[17]; beginTimeBasedMinute = (int) ESGArgsList[18]; } if ( !bEndTimeBased ) { endTimeBasedHour = (int) ESGArgsList[19]; endTimeBasedMinute = (int) ESGArgsList[20]; } keyword = (string) ESGArgsList[21]; caseSensitiveSwitch = (bool) ESGArgsList[22]; if ( !bMinStackAmount ) minStackAmount = (int) ESGArgsList[23]; if ( !bMaxStackAmount ) maxStackAmount = (int) ESGArgsList[24]; movableSwitch = (bool) ESGArgsList[25]; if ( !bMinDespawnHour ) minDespawnHour = (int) ESGArgsList[26]; if ( !bMinDespawnMin ) minDespawnMin = (int) ESGArgsList[27]; if ( !bMinDespawnSec ) minDespawnSec = (int) ESGArgsList[28]; if ( !bMaxDespawnHour ) maxDespawnHour = (int) ESGArgsList[29]; if ( !bMaxDespawnMin ) maxDespawnMin = (int) ESGArgsList[30]; if ( !bMaxDespawnSec ) maxDespawnSec = (int) ESGArgsList[31]; despawnSwitch = (bool) ESGArgsList[32]; despawnGroupSwitch = (bool) ESGArgsList[33]; despawnTimeExpireSwitch = (bool) ESGArgsList[34]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; ActiveTEBGTypeConfig = (BackgroundType) PersonalConfigList[2]; InactiveTEBGTypeConfig = (BackgroundType) PersonalConfigList[3]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; MessagesTextColor = (TextColor) PersonalConfigList[6]; CommandButtonsTextColor = (TextColor) PersonalConfigList[7]; PageNumberTextColor = (int) PersonalConfigList[8]; ActiveTextEntryTextColor = (int) PersonalConfigList[9]; InactiveTextEntryTextColor = (int) PersonalConfigList[10]; FlagTextColor = (TextColor) PersonalConfigList[14]; }
protected override void OnTick() { if ( TimerTypeConfig != TimerType.Master ) { Stop(); return; } for ( int i = 0; i < SpawnerList.Count; i++ ) { megaSpawner = (MegaSpawner) SpawnerList[i]; if ( megaSpawner != null || megaSpawner.Active || !megaSpawner.Deleted || megaSpawner.Map != null || megaSpawner.Map != Map.Internal || !megaSpawner.Workspace ) megaSpawner.TimerTick( delay ); } }
private Point3D GetLocation( MegaSpawner megaSpawner, Point3D loc ) { return new Point3D( megaSpawner.X, megaSpawner.Y, megaSpawner.Map.GetAverageZ( megaSpawner.X, megaSpawner.Y ) ); }
public static void AddToFileEdit( Mobile mobile, MegaSpawner megaSpawner ) { for ( int i = 0; i < MSUsers.Count; i++ ) { Mobile MSUser = (Mobile) MSUsers[i]; if ( mobile == MSUser ) { ArrayList FileEdit = (ArrayList) MSFileEdit[i]; FileEdit.Add( megaSpawner ); MSFileEdit[i] = FileEdit; } } }
private void ImportMegaSpawner( XmlNode node, string fileName ) { int errors = 0; amountOfSpawners++; Map map = null; Point3D location = new Point3D(); MegaSpawner megaSpawner = new MegaSpawner(); megaSpawner.Imported = MC.CropDirectory( fileName.ToLower() ); megaSpawner.ImportVersion = version; megaSpawner.Editor = null; megaSpawner.Workspace = false; double ver; try{ ver = Convert.ToDouble( version ); } catch{ ver = 0.0; } try{ megaSpawner.Name = GetInnerText( node["Name"] ); } catch{ errors++; totalErrors++; } try{ megaSpawner.Active = bool.Parse( GetInnerText( node["Active"] ) ); } catch{ errors++; totalErrors++; } try{ map = Map.Parse( GetInnerText( node["Map"] ) ); } catch{ errors++; totalErrors++; } try{ location = Point3D.Parse( GetInnerText( node["Location"] ) ); } catch{ errors++; totalErrors++; } XmlElement entryLists = null; try{ entryLists = node["EntryLists"]; } catch{ errors++; totalErrors++; } if ( entryLists != null ) { int cnt = 0; try { foreach ( XmlElement entry in entryLists.GetElementsByTagName( "EntryList" ) ) { string entryCompare = null; try{ entryCompare = GetInnerText( entry["EntryType"] ); } catch{ errors++; totalErrors++; } int entryCount = 0; for ( int i = 0; i < megaSpawner.EntryList.Count; i++ ) { string entryType = (string) megaSpawner.EntryList[i]; if ( entryType.ToLower() == entryCompare.ToLower() ) entryCount++; } if ( entryCount == 0 ) megaSpawner.EntryList.Add( entryCompare ); try{ megaSpawner.SpawnRangeList.Add( int.Parse( GetInnerText( entry["SpawnRange"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.WalkRangeList.Add( int.Parse( GetInnerText( entry["WalkRange"] ) ) ); } catch{ errors++; totalErrors++; } try { int amount = int.Parse( GetInnerText( entry["Amount"] ) ); if ( amount == 0 ) amount = 1; megaSpawner.AmountList.Add( amount ); } catch{ errors++; totalErrors++; } try{ megaSpawner.MinDelayList.Add( int.Parse( GetInnerText( entry["MinDelay"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.MaxDelayList.Add( int.Parse( GetInnerText( entry["MaxDelay"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.SpawnTypeList.Add( int.Parse( GetInnerText( entry["SpawnType"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.ActivatedList.Add( bool.Parse( GetInnerText( entry["Activated"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.EventRangeList.Add( int.Parse( GetInnerText( entry["EventRange"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.EventKeywordList.Add( GetInnerText( entry["EventKeyword"] ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.KeywordCaseSensitiveList.Add( bool.Parse( GetInnerText( entry["KeywordCaseSensitive"] ) ) ); } catch{ megaSpawner.KeywordCaseSensitiveList.Add( (bool) false ); exceptions++; } megaSpawner.TriggerEventNowList.Add( (bool) true ); try{ megaSpawner.EventAmbushList.Add( bool.Parse( GetInnerText( entry["EventAmbush"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.BeginTimeBasedList.Add( int.Parse( GetInnerText( entry["BeginTimeBased"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.EndTimeBasedList.Add( int.Parse( GetInnerText( entry["EndTimeBased"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.GroupSpawnList.Add( bool.Parse( GetInnerText( entry["GroupSpawn"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.MinStackAmountList.Add( int.Parse( GetInnerText( entry["MinStackAmount"] ) ) ); } catch{ megaSpawner.MinStackAmountList.Add( 1 ); exceptions++; } try{ megaSpawner.MaxStackAmountList.Add( int.Parse( GetInnerText( entry["MaxStackAmount"] ) ) ); } catch{ megaSpawner.MaxStackAmountList.Add( 1 ); exceptions++; } if ( ver < 3.2 ) { try{ megaSpawner.MovableList.Add( bool.Parse( GetInnerText( entry["ItemMovable"] ) ) ); } catch{ megaSpawner.MovableList.Add( (bool) true ); exceptions++; } } else { try{ megaSpawner.MovableList.Add( bool.Parse( GetInnerText( entry["Movable"] ) ) ); } catch{ megaSpawner.MovableList.Add( (bool) true ); exceptions++; } } if ( ver >= 3.5 ) { try{ megaSpawner.MinDespawnList.Add( int.Parse( GetInnerText( entry["MinDespawn"] ) ) ); } catch{ errors++; totalErrors++;} try{ megaSpawner.MaxDespawnList.Add( int.Parse( GetInnerText( entry["MaxDespawn"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.DespawnList.Add( bool.Parse( GetInnerText( entry["Despawn"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.DespawnGroupList.Add( bool.Parse( GetInnerText( entry["DespawnGroup"] ) ) ); } catch{ errors++; totalErrors++; } try{ megaSpawner.DespawnTimeExpireList.Add( bool.Parse( GetInnerText( entry["DespawnTimeExpire"] ) ) ); } catch{ errors++; totalErrors++; } } else { megaSpawner.MinDespawnList.Add( 1800 ); megaSpawner.MaxDespawnList.Add( 3600 ); megaSpawner.DespawnList.Add( (bool) false ); megaSpawner.DespawnGroupList.Add( (bool) false ); megaSpawner.DespawnTimeExpireList.Add( (bool) true ); } cnt++; } } catch{ errors++; totalErrors++; } } XmlElement settingsList = null; try{ settingsList = node["SettingsList"]; } catch{ errors++; totalErrors++; } if ( settingsList != null ) { if ( ver >= 3.6 ) { try { foreach ( XmlElement setting in settingsList.GetElementsByTagName( "OverrideIndividualEntries" ) ) { int err = errors; ArrayList List = new ArrayList(); List.Add( Setting.OverrideIndividualEntries ); try{ List.Add( int.Parse( GetInnerText( setting["SpawnRange"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["WalkRange"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["Amount"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["MinDelay"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["MaxDelay"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( bool.Parse( GetInnerText( setting["GroupSpawn"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( bool.Parse( GetInnerText( setting["EventAmbush"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( (SpawnType) int.Parse( GetInnerText( setting["SpawnType"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( GetInnerText( setting["EventKeyword"] ) ); } catch{ errors++; totalErrors++; } try{ List.Add( bool.Parse( GetInnerText( setting["CaseSensitive"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["EventRange"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["BeginTimeBasedHour"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["BeginTimeBasedMinute"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["EndTimeBasedHour"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["EndTimeBasedMinute"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["MinDespawn"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["MaxDespawn"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( bool.Parse( GetInnerText( setting["Despawn"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( bool.Parse( GetInnerText( setting["DespawnGroup"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( bool.Parse( GetInnerText( setting["DespawnTimeExpire"] ) ) ); } catch{ errors++; totalErrors++; } if ( err == errors ) megaSpawner.SettingsList.Add( List ); } } catch{} try { foreach ( XmlElement setting in settingsList.GetElementsByTagName( "AddItemSetting" ) ) { int err = errors; ArrayList List = new ArrayList(); List.Add( Setting.AddItem ); try{ List.Add( GetInnerText( setting["EntryName"] ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["EntryIndex"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( GetInnerText( setting["AddItem"] ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["MinStackAmount"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["MaxStackAmount"] ) ) ); } catch{ errors++; totalErrors++; } if ( err == errors ) megaSpawner.SettingsList.Add( List ); } } catch{} try { foreach ( XmlElement setting in settingsList.GetElementsByTagName( "AddContainerSetting" ) ) { int err = errors; ArrayList List = new ArrayList(); List.Add( Setting.AddContainer ); try{ List.Add( GetInnerText( setting["EntryName"] ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["EntryIndex"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( GetInnerText( setting["AddItem"] ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["MinStackAmount"] ) ) ); } catch{ errors++; totalErrors++; } try{ List.Add( int.Parse( GetInnerText( setting["MaxStackAmount"] ) ) ); } catch{ errors++; totalErrors++; } XmlElement contList = null; try{ contList = setting["ContainerItems"]; } catch{ errors++; totalErrors++; } try { foreach ( XmlElement contItem in contList.GetElementsByTagName( "ContainerItem" ) ) { ArrayList ItemsList = new ArrayList(); try{ ItemsList.Add( GetInnerText( contItem["AddItem"] ) ); } catch{ errors++; totalErrors++; } try{ ItemsList.Add( int.Parse( GetInnerText( contItem["MinStackAmount"] ) ) ); } catch{ errors++; totalErrors++; } try{ ItemsList.Add( int.Parse( GetInnerText( contItem["MaxStackAmount"] ) ) ); } catch{ errors++; totalErrors++; } List.Add( ItemsList ); } } catch{} if ( err == errors ) megaSpawner.SettingsList.Add( List ); } } catch{} } else { foreach ( XmlElement setting in settingsList.GetElementsByTagName( "Setting" ) ) { try{ megaSpawner.SettingsList.Add( setting.InnerText ); } catch{ errors++; totalErrors++; } } megaSpawner.ConvertOldSettings(); } } if ( errors > 0 ) { megaSpawner.Delete(); amountOfSpawners--; } else { megaSpawner.MoveToWorld( location, map ); if ( location.Z == -999 ) megaSpawner.Location = GetLocation( megaSpawner, location ); if ( megaSpawner.Location.Z == -999 ) { megaSpawner.Delete(); amountOfSpawners--; autoFailures++; return; } megaSpawner.CheckDupedSettings(); megaSpawner.CompileSettings(); megaSpawner.SettingsList.Sort( new MC.SettingsSorter() ); if ( megaSpawner.OverrideIndividualEntries ) { for ( int i = 0; i < megaSpawner.OverrideAmount; i++ ) { megaSpawner.OverrideRespawnEntryList.Add( "" ); megaSpawner.OverrideRespawnTimeList.Add( 0 ); megaSpawner.OverrideSpawnCounterList.Add( DateTime.Now ); megaSpawner.OverrideSpawnTimeList.Add( 0 ); megaSpawner.OverrideDespawnTimeList.Add( 0 ); } } else { for ( int i = 0; i < megaSpawner.EntryList.Count; i++ ) { ArrayList respawnEntryList = new ArrayList(); ArrayList respawnTimeList = new ArrayList(); ArrayList spawnCounterList = new ArrayList(); ArrayList spawnTimeList = new ArrayList(); ArrayList respawnOnSaveList = new ArrayList(); ArrayList despawnTimeList = new ArrayList(); for ( int j = 0; j < (int) megaSpawner.AmountList[i]; j++ ) { respawnEntryList.Add( (string) megaSpawner.EntryList[i] ); respawnTimeList.Add( 0 ); spawnCounterList.Add( DateTime.Now ); spawnTimeList.Add( 0 ); respawnOnSaveList.Add( (bool) false ); despawnTimeList.Add( 0 ); } megaSpawner.RespawnEntryList.Add( respawnEntryList ); megaSpawner.RespawnTimeList.Add( respawnTimeList ); megaSpawner.SpawnCounterList.Add( spawnCounterList ); megaSpawner.SpawnTimeList.Add( spawnTimeList ); megaSpawner.RespawnOnSaveList.Add( respawnOnSaveList ); megaSpawner.DespawnTimeList.Add( despawnTimeList ); megaSpawner.SpawnedEntries.Add( new ArrayList() ); megaSpawner.LastMovedList.Add( new ArrayList() ); } } SpawnerList.Add( megaSpawner ); if ( megaSpawner.Active ) { megaSpawner.Respawn(); } HideSpawnerList.Add( (bool) false ); MSGCheckBoxesList.Add( (bool) false ); MC.FileImportAdd( megaSpawner.Imported, megaSpawner.ImportVersion ); } }
public static MegaSpawner DupeSpawner( MegaSpawner fromDupe, MegaSpawner toDupe ) { toDupe.EntryList = DupeList( fromDupe.EntryList ); toDupe.SpawnRangeList = DupeList( fromDupe.SpawnRangeList ); toDupe.WalkRangeList = DupeList( fromDupe.WalkRangeList ); toDupe.AmountList = DupeList( fromDupe.AmountList ); toDupe.MinDelayList = DupeList( fromDupe.MinDelayList ); toDupe.MaxDelayList = DupeList( fromDupe.MaxDelayList ); toDupe.SpawnTypeList = DupeList( fromDupe.SpawnTypeList ); toDupe.ActivatedList = DupeList( fromDupe.ActivatedList ); toDupe.EventRangeList = DupeList( fromDupe.EventRangeList ); toDupe.EventKeywordList = DupeList( fromDupe.EventKeywordList ); toDupe.KeywordCaseSensitiveList = DupeList( fromDupe.KeywordCaseSensitiveList ); toDupe.TriggerEventNowList = DupeList( fromDupe.TriggerEventNowList ); toDupe.EventAmbushList = DupeList( fromDupe.EventAmbushList ); toDupe.BeginTimeBasedList = DupeList( fromDupe.BeginTimeBasedList ); toDupe.EndTimeBasedList = DupeList( fromDupe.EndTimeBasedList ); toDupe.GroupSpawnList = DupeList( fromDupe.GroupSpawnList ); toDupe.MinStackAmountList = DupeList( fromDupe.MinStackAmountList ); toDupe.MaxStackAmountList = DupeList( fromDupe.MaxStackAmountList ); toDupe.MovableList = DupeList( fromDupe.MovableList ); toDupe.MinDespawnList = DupeList( fromDupe.MinDespawnList ); toDupe.MaxDespawnList = DupeList( fromDupe.MaxDespawnList ); toDupe.DespawnList = DupeList( fromDupe.DespawnList ); toDupe.DespawnGroupList = DupeList( fromDupe.DespawnGroupList ); toDupe.DespawnTimeExpireList = DupeList( fromDupe.DespawnTimeExpireList ); toDupe.SettingsList = DupeList( fromDupe.SettingsList ); toDupe.RespawnEntryList = new ArrayList(); toDupe.RespawnTimeList = new ArrayList(); toDupe.SpawnCounterList = new ArrayList(); toDupe.SpawnTimeList = new ArrayList(); toDupe.RespawnOnSaveList = new ArrayList(); toDupe.DespawnTimeList = new ArrayList(); toDupe.OverrideRespawnEntryList = new ArrayList(); toDupe.OverrideRespawnTimeList = new ArrayList(); toDupe.OverrideSpawnCounterList = new ArrayList(); toDupe.OverrideSpawnTimeList = new ArrayList(); toDupe.OverrideDespawnTimeList = new ArrayList(); toDupe.SpawnedEntries = new ArrayList(); toDupe.LastMovedList = new ArrayList(); toDupe.OverrideSpawnedEntries = new ArrayList(); toDupe.OverrideLastMovedList = new ArrayList(); toDupe.Name = fromDupe.Name; toDupe.Active = fromDupe.Active; toDupe.NoProximityType = fromDupe.NoProximityType; toDupe.NoSpeechType = fromDupe.NoSpeechType; toDupe.ContainerSpawn = fromDupe.ContainerSpawn; toDupe.OverrideRespawnOnSave = fromDupe.OverrideRespawnOnSave; toDupe.CompileSettings(); for( int i = 0; i < toDupe.EntryList.Count; i++ ) { string entryType = (string) toDupe.EntryList[i]; int amount = (int) toDupe.AmountList[i]; toDupe.SpawnedEntries.Add( new ArrayList() ); toDupe.LastMovedList.Add( new ArrayList() ); ArrayList respawnEntryList = new ArrayList(); ArrayList respawnTimeList = new ArrayList(); ArrayList spawnCounterList = new ArrayList(); ArrayList spawnTimeList = new ArrayList(); ArrayList respawnOnSaveList = new ArrayList(); ArrayList despawnTimeList = new ArrayList(); for( int j = 0; j < amount; j++ ) { respawnEntryList.Add( entryType ); respawnTimeList.Add( 0 ); spawnCounterList.Add( DateTime.Now ); spawnTimeList.Add( 0 ); respawnOnSaveList.Add( (bool) false ); despawnTimeList.Add( 0 ); } toDupe.RespawnEntryList.Add( respawnEntryList ); toDupe.RespawnTimeList.Add( respawnTimeList ); toDupe.SpawnCounterList.Add( spawnCounterList ); toDupe.SpawnTimeList.Add( spawnTimeList ); toDupe.RespawnOnSaveList.Add( respawnOnSaveList ); toDupe.DespawnTimeList.Add( despawnTimeList ); } for( int i = 0; i < toDupe.OverrideAmount; i++ ) { toDupe.OverrideRespawnEntryList.Add( "" ); toDupe.OverrideRespawnTimeList.Add( 0 ); toDupe.OverrideSpawnCounterList.Add( DateTime.Now ); toDupe.OverrideSpawnTimeList.Add( 0 ); toDupe.OverrideDespawnTimeList.Add( 0 ); } return toDupe; }
public static void Importv1( Mobile mobile, string fileName, StreamReader r, ArrayList ArgsList ) { ArrayList SpawnerList = new ArrayList(); int totalErrors = 0; string MessagesTitle = (string) ArgsList[2]; string Messages = (string) ArgsList[4]; ArrayList HideSpawnerList = (ArrayList) ArgsList[6]; ArrayList MSGCheckBoxesList = (ArrayList) ArgsList[13]; mobile.SendMessage( "Importing spawners..." ); DateTime beginTime = DateTime.Now; int amountOfSpawners=0, amountOfEntries=0, locX=0, locY=0, locZ=0; string map = null; Map spawnerMap = null; try{ amountOfSpawners = Convert.ToInt32( r.ReadLine() ); } catch{ totalErrors++; } for ( int i = 0; i < amountOfSpawners; i++ ) { int errors = 0; MegaSpawner megaSpawner = new MegaSpawner(); megaSpawner.Imported = CropDirectory( fileName.ToLower() ); megaSpawner.ImportVersion = "1"; megaSpawner.Editor = null; megaSpawner.Workspace = false; try{ map = r.ReadLine().ToLower(); } catch{ errors++; totalErrors++; } if ( map == "felucca" ) spawnerMap = Map.Felucca; if ( map == "trammel" ) spawnerMap = Map.Trammel; if ( map == "ilshenar" ) spawnerMap = Map.Ilshenar; if ( map == "malas" ) spawnerMap = Map.Malas; try{ locX = Convert.ToInt32( r.ReadLine() ); } catch{ errors++; totalErrors++; } try{ locY = Convert.ToInt32( r.ReadLine() ); } catch{ errors++; totalErrors++; } try{ locZ = Convert.ToInt32( r.ReadLine() ); } catch{ errors++; totalErrors++; } try{ amountOfEntries = Convert.ToInt32( r.ReadLine() ); } catch{ errors++; totalErrors++; } for ( int cnt = 0; cnt < amountOfEntries; cnt++ ) { try{ megaSpawner.EntryList.Add( r.ReadLine() ); } // Entry List catch{ errors++; totalErrors++; } try{ megaSpawner.SpawnRangeList.Add( Convert.ToInt32( r.ReadLine() ) ); } // Spawn Range List catch{ errors++; totalErrors++; } try{ megaSpawner.WalkRangeList.Add( Convert.ToInt32( r.ReadLine() ) ); } // Walk Range List catch{ errors++; totalErrors++; } try{ megaSpawner.AmountList.Add( Convert.ToInt32( r.ReadLine() ) ); } // Amount List catch{ errors++; totalErrors++; } try{ megaSpawner.MinDelayList.Add( Convert.ToInt32( r.ReadLine() ) ); } // Min Delay List catch{ errors++; totalErrors++; } try{ megaSpawner.MaxDelayList.Add( Convert.ToInt32( r.ReadLine() ) ); } // Max Delay List catch{ errors++; totalErrors++; } megaSpawner.SpawnTypeList.Add( SpawnType.Regular ); // Spawn Type List megaSpawner.ActivatedList.Add( (bool) true ); // Activated List megaSpawner.EventRangeList.Add( 10 ); // EVent Range List megaSpawner.EventKeywordList.Add( "" ); // EVent Keyword List megaSpawner.KeywordCaseSensitiveList.Add( (bool) false ); megaSpawner.TriggerEventNowList.Add( (bool) true ); // Trigger Event Now List megaSpawner.EventAmbushList.Add( (bool) true ); // Event Ambush List megaSpawner.BeginTimeBasedList.Add( 0 ); // Begin Time Based List megaSpawner.EndTimeBasedList.Add( 0 ); // End Time Based List megaSpawner.GroupSpawnList.Add( (bool) false ); // Group Spawn List megaSpawner.MinStackAmountList.Add( 0 ); megaSpawner.MaxStackAmountList.Add( 0 ); megaSpawner.MovableList.Add( (bool) true ); megaSpawner.MinDespawnList.Add( 1800 ); megaSpawner.MaxDespawnList.Add( 3600 ); megaSpawner.DespawnList.Add( (bool) false ); megaSpawner.DespawnGroupList.Add( (bool) false ); megaSpawner.DespawnTimeExpireList.Add( (bool) true ); ArrayList respawnEntryList = new ArrayList(); ArrayList respawnTimeList = new ArrayList(); ArrayList spawnCounterList = new ArrayList(); ArrayList spawnTimeList = new ArrayList(); ArrayList respawnOnSaveList = new ArrayList(); ArrayList despawnTimeList = new ArrayList(); for ( int j = 0; j < (int) megaSpawner.AmountList[cnt]; j++ ) { respawnEntryList.Add( (string) megaSpawner.EntryList[cnt] ); respawnTimeList.Add( 0 ); spawnCounterList.Add( DateTime.Now ); spawnTimeList.Add( 0 ); respawnOnSaveList.Add( (bool) false ); despawnTimeList.Add( 0 ); } megaSpawner.RespawnEntryList.Add( respawnEntryList ); megaSpawner.RespawnTimeList.Add( respawnTimeList ); megaSpawner.SpawnCounterList.Add( spawnCounterList ); megaSpawner.SpawnTimeList.Add( spawnTimeList ); megaSpawner.RespawnOnSaveList.Add( respawnOnSaveList ); megaSpawner.DespawnTimeList.Add( despawnTimeList ); megaSpawner.SpawnedEntries.Add( new ArrayList() ); megaSpawner.LastMovedList.Add( new ArrayList() ); } if ( errors > 0 ) { megaSpawner.Delete(); amountOfSpawners--; } else { SpawnerList.Add( megaSpawner ); megaSpawner.MoveToWorld( new Point3D( locX, locY, locZ ), spawnerMap ); if ( megaSpawner.Active ) { megaSpawner.Start(); megaSpawner.Respawn(); } HideSpawnerList.Add( (bool) false ); MSGCheckBoxesList.Add( (bool) false ); MC.FileImportAdd( megaSpawner.Imported, megaSpawner.ImportVersion ); } } r.Close(); TimeSpan finishTime = DateTime.Now - beginTime; MessagesTitle = "Import Spawners"; if ( amountOfSpawners > 0 ) { Messages = String.Format( "File type identified as a Mega Spawner v1 file. {0} Mega Spawner{1} imported. The process took {2} second{3}.", amountOfSpawners, amountOfSpawners == 1 ? "" : "s", (int) finishTime.TotalSeconds, (int) finishTime.TotalSeconds == 1 ? "" : "s" ); } else { Messages = String.Format( "File type identified as a Mega Spawner v1 file. No Mega Spawners were imported due to errors in the file. The process took {0} second{1}.", (int) finishTime.TotalSeconds, (int) finishTime.TotalSeconds == 1 ? "" : "s" ); MC.FileImportRemove( CropDirectory( fileName ) ); } DateTime beginDupeTime = DateTime.Now; Messages = DupeSpawnerCheck( SpawnerList, Messages ); TimeSpan finishDupeTime = DateTime.Now - beginDupeTime; Messages = String.Format( "{0} The duped spawner check process took {1} second{2}.", Messages, (int) finishDupeTime.TotalSeconds, (int) finishDupeTime.TotalSeconds == 1 ? "" : "s" ); if ( totalErrors > 0 ) Messages = String.Format( "{0} {1} error{2} been detected.", Messages, totalErrors, totalErrors == 1 ? " has" : "s have" ); MC.CheckFileImportList( fileName ); ArgsList[2] = MessagesTitle; ArgsList[4] = Messages; ArgsList[6] = HideSpawnerList; ArgsList[13] = MSGCheckBoxesList; mobile.CloseGump( typeof ( LoadFileGump ) ); mobile.SendGump( new FileMenuGump( mobile, ArgsList ) ); }
public MegaSpawnerTimer( MegaSpawner megaspawner, int timerdelay ) : base(TimeSpan.FromSeconds( timerdelay )) { Priority = TimerPriority.OneSecond; megaSpawner = megaspawner; delay = timerdelay; }
protected override void OnTarget( Mobile mobile, object o ) { IPoint3D target = (IPoint3D) o; Point3D point3D; if ( target != null ) { megaSpawner = new MegaSpawner(); if ( target is Container ) megaSpawner.ContainerSpawn = (Container) target; if ( target is Item ) target = ( (Item) target ).GetWorldTop(); else if ( target is Mobile ) target = ( (Mobile) target ).Location; point3D = new Point3D( target.X, target.Y, target.Z ); megaSpawner.MoveToWorld( point3D, mobile.Map ); } }
public static void Serialize( MegaSpawner megaSpawner, GenericWriter writer ) { writer.Write( (int) 3 ); // version writer.Write( megaSpawner.Location ); writer.Write( megaSpawner.Map ); writer.Write( megaSpawner.Active ); writer.Write( megaSpawner.Imported ); writer.Write( megaSpawner.ImportVersion ); writer.Write( megaSpawner.ContainerSpawn ); writer.Write( megaSpawner.Workspace ); writer.Write( megaSpawner.EntryList.Count ); for ( int i = 0; i < megaSpawner.EntryList.Count; i++ ) writer.Write( (string) megaSpawner.EntryList[i] ); for ( int i = 0; i < megaSpawner.SpawnRangeList.Count; i++ ) writer.Write( (int) megaSpawner.SpawnRangeList[i] ); for ( int i = 0; i < megaSpawner.WalkRangeList.Count; i++ ) writer.Write( (int) megaSpawner.WalkRangeList[i] ); for ( int i = 0; i < megaSpawner.AmountList.Count; i++ ) writer.Write( (int) megaSpawner.AmountList[i] ); for ( int i = 0; i < megaSpawner.MinDelayList.Count; i++ ) writer.Write( (int) megaSpawner.MinDelayList[i] ); for ( int i = 0; i < megaSpawner.MaxDelayList.Count; i++ ) writer.Write( (int) megaSpawner.MaxDelayList[i] ); for ( int i = 0; i < megaSpawner.SpawnTypeList.Count; i++ ) writer.Write( (int) megaSpawner.SpawnTypeList[i] ); for ( int i = 0; i < megaSpawner.ActivatedList.Count; i++ ) writer.Write( (bool) megaSpawner.ActivatedList[i] ); for ( int i = 0; i < megaSpawner.EventRangeList.Count; i++ ) writer.Write( (int) megaSpawner.EventRangeList[i] ); for ( int i = 0; i < megaSpawner.EventKeywordList.Count; i++ ) writer.Write( (string) megaSpawner.EventKeywordList[i] ); for ( int i = 0; i < megaSpawner.KeywordCaseSensitiveList.Count; i++ ) writer.Write( (bool) megaSpawner.KeywordCaseSensitiveList[i] ); for ( int i = 0; i < megaSpawner.TriggerEventNowList.Count; i++ ) writer.Write( (bool) megaSpawner.TriggerEventNowList[i] ); for ( int i = 0; i < megaSpawner.EventAmbushList.Count; i++ ) writer.Write( (bool) megaSpawner.EventAmbushList[i] ); for ( int i = 0; i < megaSpawner.BeginTimeBasedList.Count; i++ ) writer.Write( (int) megaSpawner.BeginTimeBasedList[i] ); for ( int i = 0; i < megaSpawner.EndTimeBasedList.Count; i++ ) writer.Write( (int) megaSpawner.EndTimeBasedList[i] ); for ( int i = 0; i < megaSpawner.GroupSpawnList.Count; i++ ) writer.Write( (bool) megaSpawner.GroupSpawnList[i] ); for ( int i = 0; i < megaSpawner.MinStackAmountList.Count; i++ ) writer.Write( (int) megaSpawner.MinStackAmountList[i] ); for ( int i = 0; i < megaSpawner.MaxStackAmountList.Count; i++ ) writer.Write( (int) megaSpawner.MaxStackAmountList[i] ); for ( int i = 0; i < megaSpawner.MovableList.Count; i++ ) writer.Write( (bool) megaSpawner.MovableList[i] ); for ( int i = 0; i < megaSpawner.MinDespawnList.Count; i++ ) writer.Write( (int) megaSpawner.MinDespawnList[i] ); for ( int i = 0; i < megaSpawner.MaxDespawnList.Count; i++ ) writer.Write( (int) megaSpawner.MaxDespawnList[i] ); for ( int i = 0; i < megaSpawner.DespawnList.Count; i++ ) writer.Write( (bool) megaSpawner.DespawnList[i] ); for ( int i = 0; i < megaSpawner.DespawnGroupList.Count; i++ ) writer.Write( (bool) megaSpawner.DespawnGroupList[i] ); for ( int i = 0; i < megaSpawner.DespawnTimeExpireList.Count; i++ ) writer.Write( (bool) megaSpawner.DespawnTimeExpireList[i] ); writer.Write( megaSpawner.SettingsList.Count ); for ( int i = 0; i < megaSpawner.SettingsList.Count; i++ ) { ArrayList setting = (ArrayList) megaSpawner.SettingsList[i]; writer.Write( (int) setting[0] ); switch( (Setting) setting[0] ) { case Setting.OverrideIndividualEntries: { writer.Write( (int) setting[1] ); writer.Write( (int) setting[2] ); writer.Write( (int) setting[3] ); writer.Write( (int) setting[4] ); writer.Write( (int) setting[5] ); writer.Write( (bool) setting[6] ); writer.Write( (bool) setting[7] ); writer.Write( (int) setting[8] ); writer.Write( (string) setting[9] ); writer.Write( (bool) setting[10] ); writer.Write( (int) setting[11] ); writer.Write( (int) setting[12] ); writer.Write( (int) setting[13] ); writer.Write( (int) setting[14] ); writer.Write( (int) setting[15] ); writer.Write( (int) setting[16] ); writer.Write( (int) setting[17] ); writer.Write( (bool) setting[18] ); writer.Write( (bool) setting[19] ); writer.Write( (bool) setting[20] ); break; } case Setting.AddItem: { writer.Write( (string) setting[1] ); writer.Write( (int) setting[2] ); writer.Write( (string) setting[3] ); writer.Write( (int) setting[4] ); writer.Write( (int) setting[5] ); break; } case Setting.AddContainer: { writer.Write( (string) setting[1] ); writer.Write( (int) setting[2] ); writer.Write( (string) setting[3] ); writer.Write( (int) setting[4] ); writer.Write( (int) setting[5] ); writer.Write( setting.Count ); for ( int j = 6; j < setting.Count; j++ ) { ArrayList ItemsList = (ArrayList) setting[j]; writer.Write( (string) ItemsList[0] ); writer.Write( (int) ItemsList[1] ); writer.Write( (int) ItemsList[2] ); } break; } } } }
private void GetArgsList() { MessagesTitle = (string) ArgsList[2]; Messages = (string) ArgsList[4]; MSEGCheckBoxesList = (ArrayList) ArgsList[14]; megaSpawner = (MegaSpawner) ArgsList[19]; ESGArgsList = (ArrayList) ArgsList[21]; PersonalConfigList = (ArrayList) ArgsList[28]; index = (int) ESGArgsList[1]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; }