using System; using System.Text; using System.Data; using System.Linq; using System.Reflection; using System.ServiceProcess; using System.Collections.Generic; using System.Collections.Concurrent; using FilterAPI; using FilterAPI.Portals; using FilterAPI.Networking; using FilterAPI.ItemExchange; using FilterAPI.CustomCurrency; using FilterZone.LocalHandlers; using FilterZone.LocalNetworking; using FilterZone.ZoneHandlers; using FilterZone.ZoneNetworking; using CS; using SHN; using TXT; namespace FilterZone { internal class Program { public static String ZoneID; public static Authentication Auth; public static Database SQL; public static TokenLoader Tokens; public static CurrencyLoader Currencies; public static PortalLoader Portals; public static Item ItemCreator; public static SHNFile ItemInfo; public static SHNFile MobInfo; public static SHNFile MapInfo; public static SHNFile QuestData; public static SHNFile QuestDialog; public static SHNFile ActiveSkill; public static SHNFile AbStateView; public static SHNFile Riding; public static SHNFile Produce; public static SHNFile AntiDrop; public static SHNFile AntiSkill; public static SHNFile LevelUpMobSpawns; public static SHNFile LevelUpItemSpawns; public static SHNFile LevelUpAbstates; public static SHNFile PickupAnnouncements; public static SHNFile CustomVendorAreas; public static SHNFile CustomTradeAreas; public static SHNFile CharacterCreate; public static SHNFile WelcomeGuide; public static SHNFile SlanderFilter; public static SHNFile AutoAttackAbstates; public static SHNFile SkillAbstates; public static SHNFile MountAbstates; public static SHNFile CustomAbstateAreas; public static SHNFile CustomMobAreas; public static SHNFile VaultReplacer; public static SHNFile MobCurrencies; public static SHNFile HidePlayerMaps; public static SHNFile RemoveAdminLevel; public static SHNFile StatReroll; public static SHNFile PortalNPC; public static SHNFile PortableNPCs; public static SHNFile MobDeathSpawn; public static SHNFile MapMaximum; public static SHNFile ItemUseEffect; public static ShineTable Field; public static Dictionary AntiDropMapIndexs = new Dictionary(); public static Dictionary AntiSkillMapIndexs = new Dictionary(); public static Dictionary RemoveALMapIndexs = new Dictionary(); public static LocalClient LocalClient; public static LocalHandlerLoader LocalHandlers; public static ZoneHandlerLoader ZoneHandlers; public static ConcurrentDictionary ZoneClients = new ConcurrentDictionary(); public static Byte R = 255; public static Byte G = 255; public static Byte B = 255; private static void Main() { if(Environment.UserInteractive) { Service s = new Service(); s.Init(true); // Init() is pretty much any code you would have in OnStart(). } else { ServiceBase[] ServicesToRun = new ServiceBase[] { new Service() }; ServiceBase.Run(ServicesToRun); } } public static void LoadSHNs() { AntiDropMapIndexs.Clear(); AntiSkillMapIndexs.Clear(); RemoveALMapIndexs.Clear(); MethodInfo CryptoMethod = CSFile.LoadCode(Auth.ConfigValues["SHNCryptoFile"], "SHN.SHNCrypto", Auth.ConfigValues["SHNCryptoName"]); ItemInfo = new SHNFile(String.Format("{0}ItemInfo.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (ItemInfo.Type == SHNType.TextData) { ItemInfo.SHNEncoding = Encoding.ASCII; } else { ItemInfo.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (ItemInfo.Type != SHNType.QuestData) { ItemInfo.Read(); } else { ItemInfo.ReadQuest(); } ItemInfo.DisallowRowChanges(); MobInfo = new SHNFile(String.Format("{0}MobInfo.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (MobInfo.Type == SHNType.TextData) { MobInfo.SHNEncoding = Encoding.ASCII; } else { MobInfo.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (MobInfo.Type != SHNType.QuestData) { MobInfo.Read(); } else { MobInfo.ReadQuest(); } MobInfo.DisallowRowChanges(); MapInfo = new SHNFile(String.Format("{0}MapInfo.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (MapInfo.Type == SHNType.TextData) { MapInfo.SHNEncoding = Encoding.ASCII; } else { MapInfo.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (MapInfo.Type != SHNType.QuestData) { MapInfo.Read(); } else { MapInfo.ReadQuest(); } MapInfo.DisallowRowChanges(); QuestData = new SHNFile(String.Format("{0}QuestData.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (QuestData.Type == SHNType.TextData) { QuestData.SHNEncoding = Encoding.ASCII; } else { QuestData.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (QuestData.Type != SHNType.QuestData) { QuestData.Read(); } else { QuestData.ReadQuest(); } QuestData.DisallowRowChanges(); QuestDialog = new SHNFile(String.Format("{0}QuestDialog.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (QuestDialog.Type == SHNType.TextData) { QuestDialog.SHNEncoding = Encoding.ASCII; } else { QuestDialog.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (QuestDialog.Type != SHNType.QuestData) { QuestDialog.Read(); } else { QuestDialog.ReadQuest(); } QuestDialog.DisallowRowChanges(); ActiveSkill = new SHNFile(String.Format("{0}ActiveSkill.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (ActiveSkill.Type == SHNType.TextData) { ActiveSkill.SHNEncoding = Encoding.ASCII; } else { ActiveSkill.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (ActiveSkill.Type != SHNType.QuestData) { ActiveSkill.Read(); } else { ActiveSkill.ReadQuest(); } ActiveSkill.DisallowRowChanges(); AbStateView = new SHNFile(String.Format("{0}AbStateView.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (AbStateView.Type == SHNType.TextData) { AbStateView.SHNEncoding = Encoding.ASCII; } else { AbStateView.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (AbStateView.Type != SHNType.QuestData) { AbStateView.Read(); } else { AbStateView.ReadQuest(); } AbStateView.DisallowRowChanges(); Riding = new SHNFile(String.Format("{0}Riding.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (Riding.Type == SHNType.TextData) { Riding.SHNEncoding = Encoding.ASCII; } else { Riding.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (Riding.Type != SHNType.QuestData) { Riding.Read(); } else { Riding.ReadQuest(); } Riding.DisallowRowChanges(); Produce = new SHNFile(String.Format("{0}Produce.shn", Auth.ConfigValues["ServerSHNPath"]), CryptoMethod); if (Produce.Type == SHNType.TextData) { Produce.SHNEncoding = Encoding.ASCII; } else { Produce.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (Produce.Type != SHNType.QuestData) { Produce.Read(); } else { Produce.ReadQuest(); } Produce.DisallowRowChanges(); AntiDrop = new SHNFile(String.Format("{0}AntiDrop.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (AntiDrop.Type == SHNType.TextData) { AntiDrop.SHNEncoding = Encoding.ASCII; } else { AntiDrop.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (AntiDrop.Type != SHNType.QuestData) { AntiDrop.Read(); } else { AntiDrop.ReadQuest(); } AntiDrop.DisallowRowChanges(); AntiSkill = new SHNFile(String.Format("{0}AntiSkill.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (AntiSkill.Type == SHNType.TextData) { AntiSkill.SHNEncoding = Encoding.ASCII; } else { AntiSkill.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (AntiSkill.Type != SHNType.QuestData) { AntiSkill.Read(); } else { AntiSkill.ReadQuest(); } AntiSkill.DisallowRowChanges(); LevelUpMobSpawns = new SHNFile(String.Format("{0}LevelUpMobSpawns.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (LevelUpMobSpawns.Type == SHNType.TextData) { LevelUpMobSpawns.SHNEncoding = Encoding.ASCII; } else { LevelUpMobSpawns.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (LevelUpMobSpawns.Type != SHNType.QuestData) { LevelUpMobSpawns.Read(); } else { LevelUpMobSpawns.ReadQuest(); } LevelUpMobSpawns.DisallowRowChanges(); LevelUpItemSpawns = new SHNFile(String.Format("{0}LevelUpItemSpawns.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (LevelUpItemSpawns.Type == SHNType.TextData) { LevelUpItemSpawns.SHNEncoding = Encoding.ASCII; } else { LevelUpItemSpawns.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (LevelUpItemSpawns.Type != SHNType.QuestData) { LevelUpItemSpawns.Read(); } else { LevelUpItemSpawns.ReadQuest(); } LevelUpItemSpawns.DisallowRowChanges(); LevelUpAbstates = new SHNFile(String.Format("{0}LevelUpAbstates.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (LevelUpAbstates.Type == SHNType.TextData) { LevelUpAbstates.SHNEncoding = Encoding.ASCII; } else { LevelUpAbstates.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (LevelUpAbstates.Type != SHNType.QuestData) { LevelUpAbstates.Read(); } else { LevelUpAbstates.ReadQuest(); } LevelUpAbstates.DisallowRowChanges(); PickupAnnouncements = new SHNFile(String.Format("{0}PickupAnnouncements.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (PickupAnnouncements.Type == SHNType.TextData) { PickupAnnouncements.SHNEncoding = Encoding.ASCII; } else { PickupAnnouncements.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (PickupAnnouncements.Type != SHNType.QuestData) { PickupAnnouncements.Read(); } else { PickupAnnouncements.ReadQuest(); } PickupAnnouncements.DisallowRowChanges(); CustomVendorAreas = new SHNFile(String.Format("{0}CustomVendorAreas.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (CustomVendorAreas.Type == SHNType.TextData) { CustomVendorAreas.SHNEncoding = Encoding.ASCII; } else { CustomVendorAreas.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (CustomVendorAreas.Type != SHNType.QuestData) { CustomVendorAreas.Read(); } else { CustomVendorAreas.ReadQuest(); } CustomVendorAreas.DisallowRowChanges(); CustomTradeAreas = new SHNFile(String.Format("{0}CustomTradeAreas.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (CustomTradeAreas.Type == SHNType.TextData) { CustomTradeAreas.SHNEncoding = Encoding.ASCII; } else { CustomTradeAreas.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (CustomTradeAreas.Type != SHNType.QuestData) { CustomTradeAreas.Read(); } else { CustomTradeAreas.ReadQuest(); } CustomTradeAreas.DisallowRowChanges(); CharacterCreate = new SHNFile(String.Format("{0}CharacterCreate.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (CharacterCreate.Type == SHNType.TextData) { CharacterCreate.SHNEncoding = Encoding.ASCII; } else { CharacterCreate.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (CharacterCreate.Type != SHNType.QuestData) { CharacterCreate.Read(); } else { CharacterCreate.ReadQuest(); } CharacterCreate.DisallowRowChanges(); WelcomeGuide = new SHNFile(String.Format("{0}WelcomeGuide.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (WelcomeGuide.Type == SHNType.TextData) { WelcomeGuide.SHNEncoding = Encoding.ASCII; } else { WelcomeGuide.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (WelcomeGuide.Type != SHNType.QuestData) { WelcomeGuide.Read(); } else { WelcomeGuide.ReadQuest(); } WelcomeGuide.DisallowRowChanges(); SlanderFilter = new SHNFile(String.Format("{0}SlanderFilter.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (SlanderFilter.Type == SHNType.TextData) { SlanderFilter.SHNEncoding = Encoding.ASCII; } else { SlanderFilter.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (SlanderFilter.Type != SHNType.QuestData) { SlanderFilter.Read(); } else { SlanderFilter.ReadQuest(); } SlanderFilter.DisallowRowChanges(); AutoAttackAbstates = new SHNFile(String.Format("{0}AutoAttackAbstates.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (AutoAttackAbstates.Type == SHNType.TextData) { AutoAttackAbstates.SHNEncoding = Encoding.ASCII; } else { AutoAttackAbstates.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (AutoAttackAbstates.Type != SHNType.QuestData) { AutoAttackAbstates.Read(); } else { AutoAttackAbstates.ReadQuest(); } AutoAttackAbstates.DisallowRowChanges(); SkillAbstates = new SHNFile(String.Format("{0}SkillAbstates.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (SkillAbstates.Type == SHNType.TextData) { SkillAbstates.SHNEncoding = Encoding.ASCII; } else { SkillAbstates.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (SkillAbstates.Type != SHNType.QuestData) { SkillAbstates.Read(); } else { SkillAbstates.ReadQuest(); } SkillAbstates.DisallowRowChanges(); MountAbstates = new SHNFile(String.Format("{0}MountAbstates.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (MountAbstates.Type == SHNType.TextData) { MountAbstates.SHNEncoding = Encoding.ASCII; } else { MountAbstates.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (MountAbstates.Type != SHNType.QuestData) { MountAbstates.Read(); } else { MountAbstates.ReadQuest(); } MountAbstates.DisallowRowChanges(); CustomAbstateAreas = new SHNFile(String.Format("{0}CustomAbstateAreas.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (CustomAbstateAreas.Type == SHNType.TextData) { CustomAbstateAreas.SHNEncoding = Encoding.ASCII; } else { CustomAbstateAreas.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (CustomAbstateAreas.Type != SHNType.QuestData) { CustomAbstateAreas.Read(); } else { CustomAbstateAreas.ReadQuest(); } CustomAbstateAreas.DisallowRowChanges(); VaultReplacer = new SHNFile(String.Format("{0}VaultReplacer.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (VaultReplacer.Type == SHNType.TextData) { VaultReplacer.SHNEncoding = Encoding.ASCII; } else { VaultReplacer.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (VaultReplacer.Type != SHNType.QuestData) { VaultReplacer.Read(); } else { VaultReplacer.ReadQuest(); } VaultReplacer.DisallowRowChanges(); CustomMobAreas = new SHNFile(String.Format("{0}CustomMobAreas.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (CustomMobAreas.Type == SHNType.TextData) { CustomMobAreas.SHNEncoding = Encoding.ASCII; } else { CustomMobAreas.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (CustomMobAreas.Type != SHNType.QuestData) { CustomMobAreas.Read(); } else { CustomMobAreas.ReadQuest(); } CustomMobAreas.DisallowRowChanges(); MobCurrencies = new SHNFile(String.Format("{0}MobCurrencies.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (MobCurrencies.Type == SHNType.TextData) { MobCurrencies.SHNEncoding = Encoding.ASCII; } else { MobCurrencies.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (MobCurrencies.Type != SHNType.QuestData) { MobCurrencies.Read(); } else { MobCurrencies.ReadQuest(); } MobCurrencies.DisallowRowChanges(); HidePlayerMaps = new SHNFile(String.Format("{0}HidePlayerMaps.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (HidePlayerMaps.Type == SHNType.TextData) { HidePlayerMaps.SHNEncoding = Encoding.ASCII; } else { HidePlayerMaps.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (HidePlayerMaps.Type != SHNType.QuestData) { HidePlayerMaps.Read(); } else { HidePlayerMaps.ReadQuest(); } HidePlayerMaps.DisallowRowChanges(); RemoveAdminLevel = new SHNFile(String.Format("{0}RemoveAdminLevel.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (RemoveAdminLevel.Type == SHNType.TextData) { RemoveAdminLevel.SHNEncoding = Encoding.ASCII; } else { RemoveAdminLevel.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (RemoveAdminLevel.Type != SHNType.QuestData) { RemoveAdminLevel.Read(); } else { RemoveAdminLevel.ReadQuest(); } RemoveAdminLevel.DisallowRowChanges(); StatReroll = new SHNFile(String.Format("{0}StatReroll.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (StatReroll.Type == SHNType.TextData) { StatReroll.SHNEncoding = Encoding.ASCII; } else { StatReroll.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (StatReroll.Type != SHNType.QuestData) { StatReroll.Read(); } else { StatReroll.ReadQuest(); } StatReroll.DisallowRowChanges(); PortalNPC = new SHNFile(String.Format("{0}PortalNPC.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (PortalNPC.Type == SHNType.TextData) { PortalNPC.SHNEncoding = Encoding.ASCII; } else { PortalNPC.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (PortalNPC.Type != SHNType.QuestData) { PortalNPC.Read(); } else { PortalNPC.ReadQuest(); } PortalNPC.DisallowRowChanges(); PortableNPCs = new SHNFile(String.Format("{0}PortableNPCs.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (PortableNPCs.Type == SHNType.TextData) { PortableNPCs.SHNEncoding = Encoding.ASCII; } else { PortableNPCs.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (PortableNPCs.Type != SHNType.QuestData) { PortableNPCs.Read(); } else { PortableNPCs.ReadQuest(); } PortableNPCs.DisallowRowChanges(); MobDeathSpawn = new SHNFile(String.Format("{0}MobDeathSpawn.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (MobDeathSpawn.Type == SHNType.TextData) { MobDeathSpawn.SHNEncoding = Encoding.ASCII; } else { MobDeathSpawn.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (MobDeathSpawn.Type != SHNType.QuestData) { MobDeathSpawn.Read(); } else { MobDeathSpawn.ReadQuest(); } MobDeathSpawn.DisallowRowChanges(); MapMaximum = new SHNFile(String.Format("{0}MapMaximum.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (MapMaximum.Type == SHNType.TextData) { MapMaximum.SHNEncoding = Encoding.ASCII; } else { MapMaximum.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (MapMaximum.Type != SHNType.QuestData) { MapMaximum.Read(); } else { MapMaximum.ReadQuest(); } MapMaximum.DisallowRowChanges(); ItemUseEffect = new SHNFile(String.Format("{0}ItemUseEffect.shn", Auth.ConfigValues["FilterSHNPath"]), CryptoMethod); if (ItemUseEffect.Type == SHNType.TextData) { ItemUseEffect.SHNEncoding = Encoding.ASCII; } else { ItemUseEffect.SHNEncoding = Encoding.GetEncoding("ISO-8859-1"); } if (ItemUseEffect.Type != SHNType.QuestData) { ItemUseEffect.Read(); } else { ItemUseEffect.ReadQuest(); } ItemUseEffect.DisallowRowChanges(); Field = new ShineTable(String.Format("{0}Field.txt", Auth.ConfigValues["ServerShinePath"])); Field.Read(); foreach (DataRow Row in AntiDrop.Table.Rows) { foreach (DataRow FieldRow in Field.Tables[0].Source.Rows.Cast().Where(ItemArray => ItemArray.ItemArray[0].ToString() == Convert.ToString(Row.ItemArray[0])).ToList()) { String MapName = Convert.ToString(MapInfo.Table.Rows.Cast().Where(ItemArray => Convert.ToString(ItemArray.ItemArray[1]) == Convert.ToString(Row.ItemArray[0])).FirstOrDefault().ItemArray[2]); if (Convert.ToString(FieldRow.ItemArray[1]) == "-") { AntiDropMapIndexs.Add(Convert.ToString(Row.ItemArray[0]), MapName); } else { String StringLength = String.Empty; for (Int32 Counter = 0; Counter < Convert.ToString(FieldRow.ItemArray[1]).Length; Counter++) { StringLength += "0"; } for (Int32 Counter = Convert.ToInt32(FieldRow.ItemArray[1]); Counter < Convert.ToInt32(FieldRow.ItemArray[2]) + 1; Counter++) { AntiDropMapIndexs.Add(String.Concat(Row.ItemArray[0], Counter.ToString(StringLength)), MapName); } } } } foreach (DataRow Row in AntiSkill.Table.Rows) { foreach (DataRow FieldRow in Field.Tables[0].Source.Rows.Cast().Where(ItemArray => ItemArray.ItemArray[0].ToString() == Convert.ToString(Row.ItemArray[0])).ToList()) { String MapName = Convert.ToString(MapInfo.Table.Rows.Cast().Where(ItemArray => Convert.ToString(ItemArray.ItemArray[1]) == Convert.ToString(Row.ItemArray[0])).FirstOrDefault().ItemArray[2]); if (Convert.ToString(FieldRow.ItemArray[1]) == "-") { AntiSkillMapIndexs.Add(Convert.ToString(Row.ItemArray[0]), MapName); } else { String StringLength = String.Empty; for (Int32 Counter = 0; Counter < Convert.ToString(FieldRow.ItemArray[1]).Length; Counter++) { StringLength += "0"; } for (Int32 Counter = Convert.ToInt32(FieldRow.ItemArray[1]); Counter < Convert.ToInt32(FieldRow.ItemArray[2]) + 1; Counter++) { AntiSkillMapIndexs.Add(String.Concat(Row.ItemArray[0], Counter.ToString(StringLength)), MapName); } } } } foreach (DataRow Row in RemoveAdminLevel.Table.Rows) { foreach (DataRow FieldRow in Field.Tables[0].Source.Rows.Cast().Where(ItemArray => ItemArray.ItemArray[0].ToString() == Convert.ToString(Row.ItemArray[0])).ToList()) { String MapName = Convert.ToString(MapInfo.Table.Rows.Cast().Where(ItemArray => Convert.ToString(ItemArray.ItemArray[1]) == Convert.ToString(Row.ItemArray[0])).FirstOrDefault().ItemArray[2]); if (Convert.ToString(FieldRow.ItemArray[1]) == "-") { RemoveALMapIndexs.Add(Convert.ToString(Row.ItemArray[0]), MapName); } else { String StringLength = String.Empty; for (Int32 Counter = 0; Counter < Convert.ToString(FieldRow.ItemArray[1]).Length; Counter++) { StringLength += "0"; } for (Int32 Counter = Convert.ToInt32(FieldRow.ItemArray[1]); Counter < Convert.ToInt32(FieldRow.ItemArray[2]) + 1; Counter++) { RemoveALMapIndexs.Add(String.Concat(Row.ItemArray[0], Counter.ToString(StringLength)), MapName); } } } } } public static void SendConsoleText(ConsoleColor WriteColor, String Text, params Object[] Args) { String FormattedText = String.Format(Text, Args); using (var ClientPacket = new Packet(2, 3)) { ClientPacket.PacketWriter.Write(ConsoleColorConverter.ConsoleColorToID(WriteColor)); ClientPacket.PacketWriter.Write(String.Format("Zone{0}", ZoneID)); ClientPacket.PacketWriter.Write(FormattedText); if (LocalClient != null) { LocalClient.SendPacket(ClientPacket); } } } } }