Init
Base System Files. Missing 2 Module Scripts.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user