Compare commits
1 Commits
Templates
...
custom-sys
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cfde37097 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -41,3 +41,7 @@
|
|||||||
|
|
||||||
!/Data/*
|
!/Data/*
|
||||||
!/bin/rosyln/*
|
!/bin/rosyln/*
|
||||||
|
*.zip
|
||||||
|
*.csproj
|
||||||
|
*.csproj
|
||||||
|
Scripts/Scripts.csproj
|
||||||
|
|||||||
@@ -0,0 +1,204 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Server;
|
||||||
|
|
||||||
|
namespace KCS
|
||||||
|
{
|
||||||
|
|
||||||
|
public partial class KCS
|
||||||
|
{
|
||||||
|
public static void Initialize()
|
||||||
|
{
|
||||||
|
EventSink.WorldSave += new WorldSaveEventHandler(Save);
|
||||||
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static Dictionary<string, bool> mRegSyst = new Dictionary<string, bool>();
|
||||||
|
public static Dictionary<string, bool> RegisteredSystem { get { return mRegSyst; } }
|
||||||
|
|
||||||
|
public static void RegisterSystem(string system)
|
||||||
|
{
|
||||||
|
if (mRegSyst.ContainsKey(system))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Type type = Type.GetType(system);
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Unauthorized Addon Detected: " + system);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
KCSSystem mSyst = (KCSSystem)Activator.CreateInstance(type);
|
||||||
|
if (mSyst != null)
|
||||||
|
{
|
||||||
|
mRegSyst.Add(system, true);
|
||||||
|
Console.WriteLine("Kitsunic System Registered:" + system);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool SystEnabled(string system)
|
||||||
|
{
|
||||||
|
return mRegSyst.ContainsKey(system) && (bool)mRegSyst[system];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SystDisabled(string system)
|
||||||
|
{
|
||||||
|
if (mRegSyst.ContainsKey(system))
|
||||||
|
{
|
||||||
|
Type type = ScriptCompiler.FindTypeByFullName(system);
|
||||||
|
if (type != null)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists("Kitsunic"))
|
||||||
|
Directory.CreateDirectory("Kitsunic");
|
||||||
|
|
||||||
|
KCSSystem Syst = (KCSSystem)Activator.CreateInstance(type);
|
||||||
|
if (Syst != null)
|
||||||
|
{
|
||||||
|
Syst.StartSave("Kitsunic/");
|
||||||
|
Syst.Disable();
|
||||||
|
}
|
||||||
|
mRegSyst[system] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Console.WriteLine("Unauthorized System - {0} - Disabling is Impossible" + system);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void EnableSystem(string system)
|
||||||
|
{
|
||||||
|
if (mRegSyst.ContainsKey(system))
|
||||||
|
{
|
||||||
|
Type type = ScriptCompiler.FindTypeByFullName(system);
|
||||||
|
if (type != null)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists("Kitsunic"))
|
||||||
|
Directory.CreateDirectory("Kitsunic");
|
||||||
|
|
||||||
|
KCSSystem Syst = (KCSSystem)Activator.CreateInstance(type);
|
||||||
|
if (Syst != null)
|
||||||
|
{
|
||||||
|
Syst.StartLoad("Kitsunic/");
|
||||||
|
Syst.Enable();
|
||||||
|
}
|
||||||
|
mRegSyst[system] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Console.WriteLine("Unauthorized System - {0} - Enabling is Impossible" + system);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Save(WorldSaveEventArgs mArgs)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists("Saves/Kitsunic"))
|
||||||
|
Directory.CreateDirectory("Saves/Kitsunic");
|
||||||
|
|
||||||
|
string filename = "Kitsunic.sav";
|
||||||
|
string path = @"Saves/Kitsunic/";
|
||||||
|
string pfilename = path + filename;
|
||||||
|
DateTime start = DateTime.Now;
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine(". . . . . . . . .");
|
||||||
|
Console.WriteLine("Brewing Kitsunic Potions. . .");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (FileStream mFileStream = new FileStream(pfilename, FileMode.OpenOrCreate, FileAccess.Write))
|
||||||
|
{
|
||||||
|
BinaryFileWriter writer = new BinaryFileWriter(mFileStream, true);
|
||||||
|
|
||||||
|
writer.Write((int)mRegSyst.Count);
|
||||||
|
foreach ( KeyValuePair<string,bool> keyValuePair in mRegSyst )
|
||||||
|
{
|
||||||
|
Type type = ScriptCompiler.FindTypeByFullName(keyValuePair.Key);
|
||||||
|
if(type != null)
|
||||||
|
{
|
||||||
|
writer.Write(keyValuePair.Key);
|
||||||
|
writer.Write(keyValuePair.Value);
|
||||||
|
|
||||||
|
if(keyValuePair.Value)
|
||||||
|
{
|
||||||
|
KCSSystem system = (KCSSystem)Activator.CreateInstance(type);
|
||||||
|
if (system != null)
|
||||||
|
system.StartSave(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.Close();
|
||||||
|
mFileStream.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Completing in {0:F1} Seconds.", (DateTime.Now - start).TotalSeconds);
|
||||||
|
Console.WriteLine(". . . . . . .");
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
catch (Exception err)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Saving Failed. Reason:" + err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Load()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists("Saves/Kitsunic"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
string filename = "Kitsunic.sav";
|
||||||
|
string path = @"Saves/Kitsunic/";
|
||||||
|
string pfilename = path + filename;
|
||||||
|
DateTime start = DateTime.Now;
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine(". . . . . . . . .");
|
||||||
|
Console.WriteLine("Brewing Kitsunic Toxins. . .");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (FileStream mFileStream = new FileStream(pfilename, FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
|
BinaryReader mBinaryReader = new BinaryReader(mFileStream);
|
||||||
|
BinaryFileReader reader = new BinaryFileReader(mBinaryReader);
|
||||||
|
|
||||||
|
if (mRegSyst == null)
|
||||||
|
mRegSyst = new Dictionary<string, bool>();
|
||||||
|
|
||||||
|
int Count = reader.ReadInt();
|
||||||
|
for(int i = 0; i < Count; i++)
|
||||||
|
{
|
||||||
|
string system = reader.ReadString();
|
||||||
|
Type type = ScriptCompiler.FindTypeByFullName(system);
|
||||||
|
bool enabled = reader.ReadBool();
|
||||||
|
|
||||||
|
if( type != null )
|
||||||
|
{
|
||||||
|
mRegSyst[system] = enabled;
|
||||||
|
|
||||||
|
if (mRegSyst[system])
|
||||||
|
{
|
||||||
|
KCSSystem mSyst = (KCSSystem)Activator.CreateInstance(type);
|
||||||
|
if (mSyst != null)
|
||||||
|
mSyst.StartLoad(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
mFileStream.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Completed in {0:F1} seconds.", (DateTime.Now - start).TotalSeconds);
|
||||||
|
Console.WriteLine(". . . . . . . . .");
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
catch(Exception err )
|
||||||
|
{
|
||||||
|
Console.WriteLine("Loading Failed. Reason:" + err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
|
||||||
|
namespace KCS
|
||||||
|
{
|
||||||
|
public class KCSParams
|
||||||
|
{
|
||||||
|
public KCSParams()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Server;
|
||||||
|
using Server.Gumps;
|
||||||
|
using Server.Network;
|
||||||
|
|
||||||
|
namespace KCS
|
||||||
|
{
|
||||||
|
public abstract class KCSSystem
|
||||||
|
{
|
||||||
|
public abstract string Name();
|
||||||
|
|
||||||
|
public abstract void Enable();
|
||||||
|
public abstract void Disable();
|
||||||
|
|
||||||
|
public abstract void Save(GenericWriter kcs, GenericWriter kitsunic, GenericWriter writer);
|
||||||
|
public abstract void Load(BinaryReader kcs, BinaryReader kitsunic, BinaryReader reader);
|
||||||
|
|
||||||
|
public abstract void Gump(Mobile from, Gump gump, KCSParams subParams);
|
||||||
|
|
||||||
|
public abstract void Help(Mobile from, Gump gump);
|
||||||
|
|
||||||
|
public abstract void OnResponse(NetState state, RelayInfo info, KCSParams subParams);
|
||||||
|
|
||||||
|
public bool Enabled { get { return KCS.SystEnabled(this.ToString()); } }
|
||||||
|
|
||||||
|
public void StartSave(string path)
|
||||||
|
{
|
||||||
|
path += Name() + "/";
|
||||||
|
|
||||||
|
if(!Directory.Exists(path))
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GenericWriter kcs = new BinaryFileWriter(path + Name() + ".kcs", false);
|
||||||
|
GenericWriter kitsunic = new BinaryFileWriter(path + Name() + ".sunic", false);
|
||||||
|
GenericWriter bin = new BinaryFileWriter(path + Name() + ".bin", true);
|
||||||
|
|
||||||
|
Console.Write("Brewing {0}...", Name());
|
||||||
|
Save(kcs, kitsunic, bin);
|
||||||
|
|
||||||
|
kcs.Close();
|
||||||
|
kitsunic.Close();
|
||||||
|
bin.Close();
|
||||||
|
|
||||||
|
Console.WriteLine("Brewing Complete");
|
||||||
|
}
|
||||||
|
catch(Exception exception)
|
||||||
|
{
|
||||||
|
Console.WriteLine(exception.Message);
|
||||||
|
}
|
||||||
|
}//StartSave
|
||||||
|
|
||||||
|
public void StartLoad(string path)
|
||||||
|
{
|
||||||
|
path += Name() + "/";
|
||||||
|
|
||||||
|
string kcsPath = path + Name() + ".kcs";
|
||||||
|
string kitsunicPath = path + Name() + ".kitsunic";
|
||||||
|
string binPath = path + Name() + ".bin";
|
||||||
|
|
||||||
|
if(!Directory.Exists(path))
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
if(File.Exists(kcsPath)&&File.Exists(kitsunicPath)&&File.Exists(binPath))
|
||||||
|
{
|
||||||
|
using (FileStream kcs = new FileStream(kcsPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
|
{
|
||||||
|
using(FileStream kitsunic = new FileStream(kitsunicPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
|
{
|
||||||
|
using(FileStream bin = new FileStream(binPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
|
{
|
||||||
|
BinaryReader binReader = new BinaryReader(bin);
|
||||||
|
BinaryReader kitsunicReader = new BinaryReader(kitsunic);
|
||||||
|
BinaryReader kcsReader = new BinaryReader(kcs);
|
||||||
|
|
||||||
|
Console.Write("Pouring {0}", Name());
|
||||||
|
Load(kcsReader, kitsunicReader, binReader);
|
||||||
|
|
||||||
|
kcsReader.Close();
|
||||||
|
kitsunicReader.Close();
|
||||||
|
binReader.Close();
|
||||||
|
|
||||||
|
kcs.Close();
|
||||||
|
kitsunic.Close();
|
||||||
|
bin.Close();
|
||||||
|
|
||||||
|
Console.WriteLine("Pouring Complete");
|
||||||
|
}//bin
|
||||||
|
}//kitsunic
|
||||||
|
}//kcs
|
||||||
|
}//threePaths
|
||||||
|
}//StartLoad
|
||||||
|
}//KCSSystem
|
||||||
|
} //KCS
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Server;
|
||||||
|
using Server.Commands;
|
||||||
|
using Server.Gumps;
|
||||||
|
using Server.Network;
|
||||||
|
|
||||||
|
namespace KCS
|
||||||
|
{
|
||||||
|
public class KCSGump : Gump
|
||||||
|
{
|
||||||
|
public static void Initialize()
|
||||||
|
{
|
||||||
|
CommandSystem.Register("KCS", Permissions.GlobalAccessLevel, new CommandEventHandler(OnCommand));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Usage("KSC")]
|
||||||
|
[Aliases("kcs")]
|
||||||
|
[Description( "Sends the KCS Gump" )]
|
||||||
|
private static void OnCommand( CommandEventArgs e )
|
||||||
|
{
|
||||||
|
e.Mobile.SendGump(new KCSGump(e.Mobile, null, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> mList;
|
||||||
|
private string mSystString;
|
||||||
|
private KCSSystem mSyst;
|
||||||
|
private KCSParams mSubp;
|
||||||
|
|
||||||
|
|
||||||
|
public KCSGump( Mobile from, string system, KCSParams subParams ) : base( 0,0 )
|
||||||
|
{
|
||||||
|
if (from.AccessLevel < Permissions.GlobalAccessLevel)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mList = new List<string>();
|
||||||
|
mSystString = system;
|
||||||
|
//mSubp = subParams;
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, bool> keyValuePair in KCS.RegisteredSystem)
|
||||||
|
{
|
||||||
|
mList.Add( keyValuePair.Key );
|
||||||
|
}
|
||||||
|
|
||||||
|
Closable = true;
|
||||||
|
Disposable = true;
|
||||||
|
Dragable = true;
|
||||||
|
Resizable = true;
|
||||||
|
|
||||||
|
AddPage(0);
|
||||||
|
|
||||||
|
AddBackground(0, 0, 630, 360, 5120); //Top BackGround
|
||||||
|
AddBackground(0, 360, 630, 113, 5120); //Bottom Background
|
||||||
|
AddImageTiled(0, 446, 620, 50, 10452); //Bottom
|
||||||
|
|
||||||
|
if( system == null )
|
||||||
|
{
|
||||||
|
AddHtml(175, 40, 375, 30, "<basefont size=7 color=#33CC33><center>Kitsunic Custom System </center></basefont>", false, false);
|
||||||
|
AddHtml(175, 80, 420, 256, "<basefont size=4 color=white>Thank you for Choosing to Test Kitsunic Custom System</basefont>", false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = 0; i < mList.Count; i++ )
|
||||||
|
{
|
||||||
|
Type type = Type.GetType(mList[i]);
|
||||||
|
if (type == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
KCSSystem mSystem = (KCSSystem)Activator.CreateInstance ( type );
|
||||||
|
if ( mSystem == null )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
AddButton(i < 3 ? 35 : (i < 6 ? 255 : 415), (i % 3 == 0 ? 372 : (i % 3 == 1 ? 397 : 442)), 1122, 1124, i + 1, GumpButtonType.Reply, 0);
|
||||||
|
AddHtml((i < 3 ? 35 : (i < 6 ? 255 : 415)), (i % 3 == 0 ? 370 : (i % 3 == 1 ?395:420)), 184, 20, String.Format("<basefont color=white><center>{0}</center></basefont>", mSystem.Name()), false, false);
|
||||||
|
|
||||||
|
if (system != mList[i])
|
||||||
|
mSyst = mSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( mSyst != null )
|
||||||
|
{
|
||||||
|
AddButton(560, 0, 1417, 1417, 10, GumpButtonType.Reply, 0);
|
||||||
|
if (mSyst.Enabled)
|
||||||
|
AddLabel(592, 45, 66, "On");
|
||||||
|
else
|
||||||
|
AddLabel(588, 45, 36, "Off");
|
||||||
|
|
||||||
|
AddButton(15,340,22153,22155,11,GumpButtonType.Reply, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddImage(0, 0, 9002);
|
||||||
|
AddImage(580, 350, 10410);
|
||||||
|
|
||||||
|
if(mSyst != null)
|
||||||
|
{
|
||||||
|
AddPage(1);
|
||||||
|
mSyst.Gump(from, this, subParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnResponse(NetState sender, RelayInfo info)
|
||||||
|
{
|
||||||
|
if (info.ButtonID == 0 || sender.Mobile.AccessLevel < Permissions.GlobalAccessLevel)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(info.ButtonID >= 1 && info.ButtonID < 10)
|
||||||
|
{
|
||||||
|
int page = info.ButtonID - 1;
|
||||||
|
if (mSystString == mList[page])
|
||||||
|
sender.Mobile.SendGump(new KCSGump(sender.Mobile, null, null));
|
||||||
|
else if(page >= 0 && page <= mList.Count)
|
||||||
|
sender.Mobile.SendGump(new KCSGump(sender.Mobile, mList[page], null));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(info.ButtonID == 10 && mSyst != null)
|
||||||
|
{
|
||||||
|
sender.Mobile.SendMessage("{0} {1}", (mSyst.Enabled ? "Disabling" : "Enabling"), mSyst.Name());
|
||||||
|
if(mSyst.Enabled)
|
||||||
|
KCS.SystDisabled(mSyst.ToString() );
|
||||||
|
else
|
||||||
|
KCS.EnableSystem(mSyst.ToString() );
|
||||||
|
|
||||||
|
sender.Mobile.SendGump(new KCSGump(sender.Mobile, mSystString, mSubp));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(info.ButtonID == 11 && mSyst != null)
|
||||||
|
{
|
||||||
|
//mSyst.Help(sender, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mSyst != null)
|
||||||
|
mSyst.OnResponse(sender, info, mSubp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Server;
|
||||||
|
|
||||||
|
namespace KCS
|
||||||
|
{
|
||||||
|
internal class Permissions
|
||||||
|
{
|
||||||
|
public static AccessLevel GlobalAccessLevel = AccessLevel.Administrator;
|
||||||
|
public static AccessLevel SupporterAccessLevel = AccessLevel.VIP;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using Server;
|
||||||
|
using Server.Gumps;
|
||||||
|
using Server.Network;
|
||||||
|
|
||||||
|
|
||||||
|
namespace KCS.Cortex
|
||||||
|
{
|
||||||
|
public enum Pages
|
||||||
|
{
|
||||||
|
Home,
|
||||||
|
Mobiles,
|
||||||
|
Items,
|
||||||
|
Modules
|
||||||
|
};
|
||||||
|
|
||||||
|
public class CortexParams : KCSParams
|
||||||
|
{
|
||||||
|
public Pages PageName;
|
||||||
|
public Serial serial;
|
||||||
|
public int PageIndex;
|
||||||
|
|
||||||
|
public CortexParams()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class Cortexual : KCSSystem
|
||||||
|
{
|
||||||
|
internal static List<Type> mType = new List<Type>();
|
||||||
|
private static Dictionary<serial, mList> mDictionary = new Dictionary<serial, mList>();
|
||||||
|
public static Dictionary<serial, mList> GetDictionary
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return mDictionary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Configure()
|
||||||
|
{
|
||||||
|
KCS.RegisterSystem("KCS.Cortex")
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool Running
|
||||||
|
{
|
||||||
|
get { return KCS.SystEnabled("KCS.Cortex"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Name()
|
||||||
|
{
|
||||||
|
return "Cortex";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Enable()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Brewing {0}...", Name());
|
||||||
|
Console.WriteLine("..............", Name());
|
||||||
|
Console.WriteLine("....Brewed {0}", Name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Disable()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Pouring {0}...", Name());
|
||||||
|
Console.WriteLine("..............", Name());
|
||||||
|
Console.WriteLine("....Poured {0}", Name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Flush()
|
||||||
|
{
|
||||||
|
List<serial> RList = new List<serial>();
|
||||||
|
|
||||||
|
foreach (Serial serial in mDictionary.Keys)
|
||||||
|
{
|
||||||
|
if(serial.IsItem)
|
||||||
|
{
|
||||||
|
Item item = World.FindItem(serial);
|
||||||
|
if(item != null||item.Deleted)
|
||||||
|
RemoveList.Add(serial);
|
||||||
|
}
|
||||||
|
else if (serial.IsMobile)
|
||||||
|
{
|
||||||
|
Mobile mobile = World.FindMobile(serial);
|
||||||
|
if (mobile != null || mobile.Deleted)
|
||||||
|
RemoveList.Add(serial);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mDictionary[serial].Count == 0)
|
||||||
|
RemoveList.Add(serial);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(Serial serial in RemoveList)
|
||||||
|
{
|
||||||
|
Remove(serial);
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveList.Clear();
|
||||||
|
Console.Write("Flitered & Flushed")
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool Contains(Serial serial)
|
||||||
|
{
|
||||||
|
return mDictionary.ContainsKey(serial);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool ContainsModule(Serial serial, Type type)
|
||||||
|
{
|
||||||
|
if (Contains(serial))
|
||||||
|
{
|
||||||
|
if(mDictionary.ContainsKey[serial] != null)
|
||||||
|
return mDictionary[serial].Contains(type);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Add(Serial serial)
|
||||||
|
{
|
||||||
|
if (Contains(serial))
|
||||||
|
return;
|
||||||
|
mDictionary.Add(serial, new ModuleList(serial);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Add(Serial serial, ModuleList moduleList)
|
||||||
|
{
|
||||||
|
mDictionary[serial] = moduleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddModule(Module module)
|
||||||
|
{
|
||||||
|
if (!mDictionary.ContainsKey(module.Owner))
|
||||||
|
Add(module.Owner);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}//Cortexual
|
||||||
|
}//Cortex
|
||||||
Reference in New Issue
Block a user