Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
96
Scripts/Scripts-master/Commands/Toolbar/Core/ToolbarCore.cs
Normal file
96
Scripts/Scripts-master/Commands/Toolbar/Core/ToolbarCore.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
#region References
|
||||
using System;
|
||||
|
||||
using CustomsFramework;
|
||||
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
using Server.Gumps;
|
||||
|
||||
using Services.Toolbar.Gumps;
|
||||
#endregion
|
||||
|
||||
namespace Services.Toolbar.Core
|
||||
{
|
||||
public class ToolbarCore : BaseCore
|
||||
{
|
||||
public const string SystemVersion = "2.3";
|
||||
public const string ReleaseDate = "October 28, 2013";
|
||||
|
||||
public static ToolbarCore Instance { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Instance = World.GetCore(typeof(ToolbarCore)) as ToolbarCore ?? new ToolbarCore();
|
||||
|
||||
CommandHandlers.Register("Toolbar", AccessLevel.VIP, Toolbar_OnCommand);
|
||||
|
||||
EventSink.Login += OnLogin;
|
||||
EventSink.PlayerDeath += OnPlayerDeath;
|
||||
}
|
||||
|
||||
private static void OnLogin(LoginEventArgs e)
|
||||
{
|
||||
if (e.Mobile.AccessLevel >= AccessLevel.VIP)
|
||||
{
|
||||
SendToolbar(e.Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnPlayerDeath(PlayerDeathEventArgs e)
|
||||
{
|
||||
if (e.Mobile.AccessLevel < AccessLevel.VIP || e.Mobile.NetState == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
e.Mobile.CloseGump(typeof(ToolbarGump));
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(2.0), SendToolbar, e.Mobile);
|
||||
}
|
||||
|
||||
[Usage("Toolbar")]
|
||||
public static void Toolbar_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
SendToolbar(e.Mobile);
|
||||
}
|
||||
|
||||
public static void SendToolbar(Mobile m)
|
||||
{
|
||||
ToolbarModule module = m.GetModule(typeof(ToolbarModule)) as ToolbarModule ?? new ToolbarModule(m);
|
||||
|
||||
m.CloseGump(typeof(ToolbarGump));
|
||||
m.SendGump(new ToolbarGump(module.ToolbarInfo, m));
|
||||
}
|
||||
|
||||
public ToolbarCore()
|
||||
{
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
public ToolbarCore(CustomSerial serial)
|
||||
: base(serial)
|
||||
{ }
|
||||
|
||||
public override string Name { get { return @"Toolbar Core"; } }
|
||||
public override string Description { get { return @"Core that maintains the [Toolbar system."; } }
|
||||
public override string Version { get { return SystemVersion; } }
|
||||
public override AccessLevel EditLevel { get { return AccessLevel.Developer; } }
|
||||
public override Gump SettingsGump { get { return null; } }
|
||||
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteVersion(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
296
Scripts/Scripts-master/Commands/Toolbar/Core/ToolbarInfo.cs
Normal file
296
Scripts/Scripts-master/Commands/Toolbar/Core/ToolbarInfo.cs
Normal file
@@ -0,0 +1,296 @@
|
||||
#region References
|
||||
using System.Collections.Generic;
|
||||
|
||||
using CustomsFramework;
|
||||
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
#endregion
|
||||
|
||||
namespace Services.Toolbar.Core
|
||||
{
|
||||
public class ToolbarInfo
|
||||
{
|
||||
private int _Font, _Skin;
|
||||
private bool _Phantom, _Stealth, _Reverse, _Lock;
|
||||
private Point2D _Dimensions;
|
||||
private List<string> _Entries = new List<string>();
|
||||
private List<Point3D> _Points = new List<Point3D>();
|
||||
|
||||
public ToolbarInfo(
|
||||
Point2D dimensions, List<string> entries, int skin, List<Point3D> points, int font, bool[] switches)
|
||||
{
|
||||
_Dimensions = dimensions;
|
||||
_Entries = entries;
|
||||
_Skin = skin;
|
||||
_Points = points;
|
||||
_Font = font;
|
||||
_Phantom = switches[0];
|
||||
_Stealth = switches[1];
|
||||
_Reverse = switches[2];
|
||||
_Lock = switches[3];
|
||||
}
|
||||
|
||||
public int Font { get { return _Font; } set { _Font = value; } }
|
||||
public int Skin { get { return _Skin; } set { _Skin = value; } }
|
||||
public bool Phantom { get { return _Phantom; } set { _Phantom = value; } }
|
||||
public bool Stealth { get { return _Stealth; } set { _Stealth = value; } }
|
||||
public bool Reverse { get { return _Reverse; } set { _Reverse = value; } }
|
||||
public bool Lock { get { return _Lock; } set { _Lock = value; } }
|
||||
public int Rows { get { return _Dimensions.X; } set { _Dimensions.X = value; } }
|
||||
public int Collumns { get { return _Dimensions.Y; } set { _Dimensions.Y = value; } }
|
||||
public List<string> Entries { get { return _Entries; } set { _Entries = value; } }
|
||||
public List<Point3D> Points { get { return _Points; } set { _Points = value; } }
|
||||
|
||||
public static ToolbarInfo CreateNew(Mobile from)
|
||||
{
|
||||
Point2D dimensions = DefaultDimensions(from.AccessLevel);
|
||||
var entries = DefaultEntries(from.AccessLevel);
|
||||
var points = new List<Point3D>();
|
||||
|
||||
for (int i = entries.Count; i <= 135; i++)
|
||||
{
|
||||
entries.Add("-*UNUSED*-");
|
||||
}
|
||||
|
||||
return new ToolbarInfo(dimensions, entries, 0, points, 0, new[] {true, false, false, true});
|
||||
}
|
||||
|
||||
public static List<string> DefaultEntries(AccessLevel level)
|
||||
{
|
||||
var entries = new List<string>();
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case AccessLevel.Player:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case AccessLevel.VIP:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case AccessLevel.Counselor:
|
||||
{
|
||||
entries.Add(CommandSystem.Prefix + "GMBody");
|
||||
entries.Add(CommandSystem.Prefix + "StaffRunebook");
|
||||
entries.Add(CommandSystem.Prefix + "SpeedBoost");
|
||||
entries.Add(CommandSystem.Prefix + "M Tele");
|
||||
entries.Add(CommandSystem.Prefix + "Where");
|
||||
entries.Add(CommandSystem.Prefix + "Who");
|
||||
|
||||
break;
|
||||
}
|
||||
case AccessLevel.Decorator:
|
||||
{
|
||||
entries.Add(CommandSystem.Prefix + "GMBody");
|
||||
entries.Add(CommandSystem.Prefix + "StaffRunebook");
|
||||
entries.Add(CommandSystem.Prefix + "SpeedBoost");
|
||||
entries.Add(CommandSystem.Prefix + "M Tele");
|
||||
entries.Add(CommandSystem.Prefix + "Where");
|
||||
entries.Add(CommandSystem.Prefix + "Who");
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
entries.Add("-*UNUSED*-");
|
||||
}
|
||||
|
||||
entries.Add(CommandSystem.Prefix + "Add");
|
||||
entries.Add(CommandSystem.Prefix + "Remove");
|
||||
entries.Add(CommandSystem.Prefix + "Move");
|
||||
entries.Add(CommandSystem.Prefix + "ShowArt");
|
||||
entries.Add(CommandSystem.Prefix + "Get ItemID");
|
||||
entries.Add(CommandSystem.Prefix + "Get Hue");
|
||||
|
||||
break;
|
||||
}
|
||||
case AccessLevel.Spawner:
|
||||
{
|
||||
entries.Add(CommandSystem.Prefix + "GMBody");
|
||||
entries.Add(CommandSystem.Prefix + "StaffRunebook");
|
||||
entries.Add(CommandSystem.Prefix + "SpeedBoost");
|
||||
entries.Add(CommandSystem.Prefix + "M Tele");
|
||||
entries.Add(CommandSystem.Prefix + "Where");
|
||||
entries.Add(CommandSystem.Prefix + "Who");
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
entries.Add("-*UNUSED*-");
|
||||
}
|
||||
|
||||
entries.Add(CommandSystem.Prefix + "Add");
|
||||
entries.Add(CommandSystem.Prefix + "Remove");
|
||||
entries.Add(CommandSystem.Prefix + "XmlAdd");
|
||||
entries.Add(CommandSystem.Prefix + "XmlFind");
|
||||
entries.Add(CommandSystem.Prefix + "XmlShow");
|
||||
entries.Add(CommandSystem.Prefix + "XmlHide");
|
||||
|
||||
break;
|
||||
}
|
||||
case AccessLevel.Seer:
|
||||
case AccessLevel.GameMaster:
|
||||
{
|
||||
entries.Add(CommandSystem.Prefix + "GMBody");
|
||||
entries.Add(CommandSystem.Prefix + "StaffRunebook");
|
||||
entries.Add(CommandSystem.Prefix + "SpeedBoost");
|
||||
entries.Add(CommandSystem.Prefix + "M Tele");
|
||||
entries.Add(CommandSystem.Prefix + "Where");
|
||||
entries.Add(CommandSystem.Prefix + "Who");
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
entries.Add("-*UNUSED*-");
|
||||
}
|
||||
|
||||
entries.Add(CommandSystem.Prefix + "Add");
|
||||
entries.Add(CommandSystem.Prefix + "Remove");
|
||||
entries.Add(CommandSystem.Prefix + "Props");
|
||||
entries.Add(CommandSystem.Prefix + "Move");
|
||||
entries.Add(CommandSystem.Prefix + "Kill");
|
||||
entries.Add(CommandSystem.Prefix + "Follow");
|
||||
|
||||
break;
|
||||
}
|
||||
case AccessLevel.Administrator:
|
||||
case AccessLevel.Developer:
|
||||
case AccessLevel.CoOwner:
|
||||
case AccessLevel.Owner:
|
||||
{
|
||||
entries.Add(CommandSystem.Prefix + "Admin");
|
||||
entries.Add(CommandSystem.Prefix + "StaffRunebook");
|
||||
entries.Add(CommandSystem.Prefix + "SpeedBoost");
|
||||
entries.Add(CommandSystem.Prefix + "M Tele");
|
||||
entries.Add(CommandSystem.Prefix + "Where");
|
||||
entries.Add(CommandSystem.Prefix + "Who");
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
entries.Add("-*UNUSED*-");
|
||||
}
|
||||
|
||||
entries.Add(CommandSystem.Prefix + "Props");
|
||||
entries.Add(CommandSystem.Prefix + "Move");
|
||||
entries.Add(CommandSystem.Prefix + "Add");
|
||||
entries.Add(CommandSystem.Prefix + "Remove");
|
||||
entries.Add(CommandSystem.Prefix + "ViewEquip");
|
||||
entries.Add(CommandSystem.Prefix + "Kill");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static Point2D DefaultDimensions(AccessLevel level)
|
||||
{
|
||||
Point2D dimensions = new Point2D();
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case AccessLevel.Player:
|
||||
case AccessLevel.VIP:
|
||||
{
|
||||
dimensions.X = 0;
|
||||
dimensions.Y = 0;
|
||||
break;
|
||||
}
|
||||
case AccessLevel.Counselor:
|
||||
{
|
||||
dimensions.X = 6;
|
||||
dimensions.Y = 1;
|
||||
break;
|
||||
}
|
||||
case AccessLevel.Decorator:
|
||||
case AccessLevel.Spawner:
|
||||
case AccessLevel.GameMaster:
|
||||
case AccessLevel.Seer:
|
||||
case AccessLevel.Administrator:
|
||||
case AccessLevel.Developer:
|
||||
case AccessLevel.CoOwner:
|
||||
case AccessLevel.Owner:
|
||||
{
|
||||
dimensions.X = 6;
|
||||
dimensions.Y = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
public ToolbarInfo(GenericReader reader)
|
||||
{
|
||||
Deserialize(reader);
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteVersion(0);
|
||||
|
||||
writer.Write(_Font);
|
||||
writer.Write(_Phantom);
|
||||
writer.Write(_Stealth);
|
||||
writer.Write(_Reverse);
|
||||
writer.Write(_Lock);
|
||||
|
||||
writer.Write(_Dimensions);
|
||||
|
||||
writer.Write(_Entries.Count);
|
||||
|
||||
foreach (string t in _Entries)
|
||||
{
|
||||
writer.Write(t);
|
||||
}
|
||||
|
||||
writer.Write(_Skin);
|
||||
|
||||
writer.Write(_Points.Count);
|
||||
|
||||
foreach (Point3D t in _Points)
|
||||
{
|
||||
writer.Write(t);
|
||||
}
|
||||
}
|
||||
|
||||
private void Deserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_Dimensions = new Point2D();
|
||||
_Entries = new List<string>();
|
||||
_Points = new List<Point3D>();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_Font = reader.ReadInt();
|
||||
_Phantom = reader.ReadBool();
|
||||
_Stealth = reader.ReadBool();
|
||||
_Reverse = reader.ReadBool();
|
||||
_Lock = reader.ReadBool();
|
||||
|
||||
_Dimensions = reader.ReadPoint2D();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_Entries.Add(reader.ReadString());
|
||||
}
|
||||
|
||||
_Skin = reader.ReadInt();
|
||||
|
||||
count = reader.ReadInt();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_Points.Add(reader.ReadPoint3D());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
#region References
|
||||
using System;
|
||||
|
||||
using CustomsFramework;
|
||||
|
||||
using Server;
|
||||
|
||||
using Services.Toolbar.Core;
|
||||
#endregion
|
||||
|
||||
namespace Services.Toolbar
|
||||
{
|
||||
public class ToolbarModule : BaseModule
|
||||
{
|
||||
private ToolbarInfo _ToolbarInfo;
|
||||
|
||||
public ToolbarModule(Mobile from)
|
||||
: base(from)
|
||||
{
|
||||
_ToolbarInfo = ToolbarInfo.CreateNew(from);
|
||||
}
|
||||
|
||||
public ToolbarModule(CustomSerial serial)
|
||||
: base(serial)
|
||||
{ }
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return LinkedMobile != null ? String.Format(@"Toolbar Module - {0}", LinkedMobile.Name) : @"Unlinked Toolbar Module"; }
|
||||
}
|
||||
|
||||
public override string Version { get { return ToolbarCore.SystemVersion; } }
|
||||
|
||||
public override AccessLevel EditLevel { get { return AccessLevel.Developer; } }
|
||||
|
||||
[CommandProperty(AccessLevel.Developer)]
|
||||
public ToolbarInfo ToolbarInfo { get { return _ToolbarInfo; } set { _ToolbarInfo = value; } }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteVersion(0);
|
||||
|
||||
// Version 0
|
||||
_ToolbarInfo.Serialize(writer);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_ToolbarInfo = new ToolbarInfo(reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
61
Scripts/Scripts-master/Commands/Toolbar/Gumps/GumpIDs.cs
Normal file
61
Scripts/Scripts-master/Commands/Toolbar/Gumps/GumpIDs.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
namespace Services.Toolbar.Gumps
|
||||
{
|
||||
public class GumpIDs
|
||||
{
|
||||
public enum MiscIDs
|
||||
{
|
||||
Background = 0,
|
||||
Color = 1,
|
||||
Buttonground = 2,
|
||||
ButtonOffset = 3,
|
||||
}
|
||||
|
||||
public enum ButtonIDs
|
||||
{
|
||||
Minimize = 0,
|
||||
Maximize = 1,
|
||||
Customize = 2,
|
||||
SpecialCommand = 3,
|
||||
|
||||
Send = 4,
|
||||
Teleport = 5,
|
||||
Gate = 6,
|
||||
}
|
||||
|
||||
public static int Skins = 2;
|
||||
|
||||
public static string[] Fonts = new[]
|
||||
{
|
||||
"", "<b>", "<i>", "<b><i>", "<small>", "<b><small>", "<i><small>", "<b><i><small>", "<big>", "<b><big>", "<i><big>",
|
||||
"<b><i><big>"
|
||||
};
|
||||
|
||||
public static GumpIDs[] Misc = new[]
|
||||
{
|
||||
new GumpIDs(0, "Background", new[,] {{9200}, {9270}}), new GumpIDs(1, "Color", new[,] {{0}, {0}}),
|
||||
new GumpIDs(2, "Buttonground", new[,] {{9200}, {9350}}), new GumpIDs(3, "ButtonOffset", new[,] {{5}, {7}})
|
||||
};
|
||||
|
||||
public static GumpIDs[] Buttons = new[]
|
||||
{
|
||||
new GumpIDs(0, "Minimize", new[,] {{5603, 5607, 16, 16}, {5537, 5539, 19, 21}}),
|
||||
new GumpIDs(1, "Maximize", new[,] {{5601, 5605, 16, 16}, {5540, 5542, 19, 21}}),
|
||||
new GumpIDs(2, "Customize", new[,] {{22153, 22155, 16, 16}, {5525, 5527, 62, 24}}),
|
||||
new GumpIDs(3, "SpecialCommand", new[,] {{2117, 2118, 15, 15}, {9720, 9722, 29, 29}}),
|
||||
new GumpIDs(4, "Send", new[,] {{2360, 2360, 11, 11}, {2360, 2360, 11, 11}}),
|
||||
new GumpIDs(5, "Teleport", new[,] {{2361, 2361, 11, 11}, {2361, 2361, 11, 11}}),
|
||||
new GumpIDs(6, "Gate", new[,] {{2362, 2362, 11, 11}, {2361, 2361, 11, 11}})
|
||||
};
|
||||
|
||||
public int ID { get; set; }
|
||||
public int[,] Content { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public GumpIDs(int iD, string name, int[,] content)
|
||||
{
|
||||
ID = iD;
|
||||
Content = content;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
223
Scripts/Scripts-master/Commands/Toolbar/Gumps/Toolbar.cs
Normal file
223
Scripts/Scripts-master/Commands/Toolbar/Gumps/Toolbar.cs
Normal file
@@ -0,0 +1,223 @@
|
||||
#region References
|
||||
using System;
|
||||
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
using Services.Toolbar.Core;
|
||||
#endregion
|
||||
|
||||
namespace Services.Toolbar.Gumps
|
||||
{
|
||||
public class ToolbarGump : Gump
|
||||
{
|
||||
/*******************
|
||||
* BUTTON ID'S
|
||||
* 0 - Close
|
||||
* 1 - Edit
|
||||
*******************/
|
||||
|
||||
private readonly ToolbarInfo _Info;
|
||||
|
||||
public int InitOptsW, InitOptsH;
|
||||
|
||||
public ToolbarGump(ToolbarInfo info, Mobile m)
|
||||
: base(0, 28)
|
||||
{
|
||||
_Info = info;
|
||||
|
||||
if (_Info.Lock)
|
||||
{
|
||||
Closable = false;
|
||||
Disposable = false;
|
||||
}
|
||||
|
||||
int offset = GumpIDs.Misc[(int)GumpIDs.MiscIDs.ButtonOffset].Content[_Info.Skin, 0];
|
||||
int bx = ((offset * 2) + (_Info.Rows * 110)), by = ((offset * 2) + (_Info.Collumns * 24)), byx = by, cy = 0;
|
||||
|
||||
SetCoords(offset);
|
||||
|
||||
if (_Info.Reverse)
|
||||
{
|
||||
cy = InitOptsH;
|
||||
by = 0;
|
||||
}
|
||||
|
||||
AddPage(0);
|
||||
AddPage(1);
|
||||
|
||||
if (_Info.Stealth)
|
||||
{
|
||||
AddMinimized(by, offset);
|
||||
AddPage(2);
|
||||
}
|
||||
|
||||
AddInitOpts(by, offset);
|
||||
|
||||
AddBackground(0, cy, bx, byx, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Background].Content[_Info.Skin, 0]);
|
||||
|
||||
string font = GumpIDs.Fonts[_Info.Font];
|
||||
|
||||
if (_Info.Phantom)
|
||||
{
|
||||
font += "<BASEFONT COLOR=#FFFFFF>";
|
||||
}
|
||||
|
||||
int temp = 0, x, y;
|
||||
|
||||
NetState ns = m.NetState;
|
||||
|
||||
for (int i = 0; i < _Info.Rows * _Info.Collumns; i++)
|
||||
{
|
||||
x = offset + ((i % _Info.Rows) * 110);
|
||||
y = offset + (int)(Math.Floor((double)(i / _Info.Rows)) * 24) + cy;
|
||||
|
||||
if (ns.IsEnhancedClient)
|
||||
{
|
||||
AddButton(x + 4, y + 5, 2103, 2104, temp + 10, GumpButtonType.Reply, 0);//4005, 4007
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(x + 1, y, 2445, 2445, temp + 10, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
AddBackground(x, y, 110, 24, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Buttonground].Content[_Info.Skin, 0]);
|
||||
|
||||
if (_Info.Phantom)
|
||||
{
|
||||
AddImageTiled(x + 2, y + 2, 106, 20, 2624); // Alpha Area 1_1
|
||||
AddAlphaRegion(x + 2, y + 2, 106, 20); // Alpha Area 1_2
|
||||
}
|
||||
|
||||
if (ns.IsEnhancedClient)
|
||||
{
|
||||
AddHtml(x + 30, y + 3, 100, 20, String.Format("<center>{0}{1}", font, _Info.Entries[temp]), false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml(x + 5, y + 3, 100, 20, String.Format("<center>{0}{1}", font, _Info.Entries[temp]), false, false);
|
||||
}
|
||||
|
||||
if (i % _Info.Rows == _Info.Rows - 1)
|
||||
{
|
||||
temp += 9 - _Info.Rows;
|
||||
}
|
||||
|
||||
++temp;
|
||||
}
|
||||
|
||||
if (_Info.Stealth)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddPage(2);
|
||||
AddMinimized(by, offset);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile mob = sender.Mobile;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: // Close
|
||||
break;
|
||||
case 1: // Edit
|
||||
{
|
||||
mob.SendGump(this);
|
||||
mob.CloseGump(typeof(ToolbarEdit));
|
||||
mob.SendGump(new ToolbarEdit(_Info));
|
||||
}
|
||||
break;
|
||||
default: // Command
|
||||
{
|
||||
mob.SendGump(this);
|
||||
|
||||
int buttonPressedIndex = info.ButtonID - 10;
|
||||
|
||||
if (buttonPressedIndex >= _Info.Entries.Count)
|
||||
return;
|
||||
|
||||
String buttonText = _Info.Entries[buttonPressedIndex];
|
||||
|
||||
if (buttonText.StartsWith(CommandSystem.Prefix))
|
||||
{
|
||||
mob.SendMessage(buttonText);
|
||||
CommandSystem.Handle(mob, buttonText);
|
||||
}
|
||||
else
|
||||
{
|
||||
mob.DoSpeech(buttonText, new int[0], MessageType.Regular, mob.SpeechHue);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets coordinates and sizes.
|
||||
/// </summary>
|
||||
public void SetCoords(int offset)
|
||||
{
|
||||
InitOptsW = 50 + (offset * 2) + GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 2] + 5 +
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 2];
|
||||
InitOptsH = (offset * 2) + GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 3];
|
||||
|
||||
if (GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 3] + (offset * 2) > InitOptsH)
|
||||
{
|
||||
InitOptsH = GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 3] + (offset * 2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds initial options.
|
||||
/// </summary>
|
||||
public void AddInitOpts(int y, int offset)
|
||||
{
|
||||
AddBackground(0, y, InitOptsW, InitOptsH, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Background].Content[_Info.Skin, 0]);
|
||||
AddButton(
|
||||
offset,
|
||||
y + offset,
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 0],
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 1],
|
||||
0,
|
||||
GumpButtonType.Page,
|
||||
_Info.Stealth ? 1 : 2);
|
||||
AddButton(
|
||||
offset + GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 2] + 5,
|
||||
y + offset,
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 0],
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 1],
|
||||
1,
|
||||
GumpButtonType.Reply,
|
||||
0); // 1 Edit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds minimized page.
|
||||
/// </summary>
|
||||
public void AddMinimized(int y, int offset)
|
||||
{
|
||||
AddBackground(0, y, InitOptsW, InitOptsH, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Background].Content[_Info.Skin, 0]);
|
||||
AddButton(
|
||||
offset,
|
||||
y + offset,
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Maximize].Content[_Info.Skin, 0],
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Maximize].Content[_Info.Skin, 1],
|
||||
0,
|
||||
GumpButtonType.Page,
|
||||
_Info.Stealth ? 2 : 1);
|
||||
AddButton(
|
||||
offset + GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 2] + 5,
|
||||
y + offset,
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 0],
|
||||
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 1],
|
||||
1,
|
||||
GumpButtonType.Reply,
|
||||
0); // 1 Edit
|
||||
}
|
||||
}
|
||||
}
|
||||
577
Scripts/Scripts-master/Commands/Toolbar/Gumps/ToolbarEdit.cs
Normal file
577
Scripts/Scripts-master/Commands/Toolbar/Gumps/ToolbarEdit.cs
Normal file
@@ -0,0 +1,577 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
using Services.Toolbar.Core;
|
||||
#endregion
|
||||
|
||||
namespace Services.Toolbar.Gumps
|
||||
{
|
||||
public class ToolbarEdit : Gump
|
||||
{
|
||||
public static string HTML =
|
||||
String.Format(
|
||||
"<center><u>Command Toolbar v{0}</u><br>Made by Joeku AKA Demortris<br>{1}<br>- Customized for ServUO -</center><br> This toolbar is extremely versatile. You can switch skins and increase or decrease columns or rows. The toolbar operates like a spreadsheet; you can use the navigation menu to scroll through different commands and bind them. Enjoy!<br><p>If you have questions, concerns, or bug reports, please <A HREF=\"mailto:demortris@adelphia.net\">e-mail me</A>.",
|
||||
ToolbarCore.SystemVersion,
|
||||
ToolbarCore.ReleaseDate);
|
||||
|
||||
private readonly bool _Expanded;
|
||||
private readonly int _ExpandedInt;
|
||||
|
||||
private readonly ToolbarInfo _Info;
|
||||
private List<TextRelay> _TextRelays;
|
||||
|
||||
public ToolbarEdit(ToolbarInfo info)
|
||||
: this(info, false)
|
||||
{ }
|
||||
|
||||
public ToolbarEdit(ToolbarInfo info, bool expanded)
|
||||
: base(0, 28)
|
||||
{
|
||||
_Info = info;
|
||||
|
||||
_Expanded = expanded;
|
||||
_ExpandedInt = expanded ? 2 : 1;
|
||||
|
||||
AddInit();
|
||||
AddControls();
|
||||
AddNavigation();
|
||||
AddResponses();
|
||||
AddEntries();
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile m = sender.Mobile;
|
||||
_TextRelays = CreateList(info.TextEntries);
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
_Info.Skin++;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
_Info.Skin--;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
_Info.Rows++;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
_Info.Rows--;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
_Info.Collumns++;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
_Info.Collumns--;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 9: // Default
|
||||
{
|
||||
var toolbarinfo = ToolbarInfo.DefaultEntries(m.AccessLevel);
|
||||
CombineEntries(toolbarinfo);
|
||||
toolbarinfo.AddRange(AnalyzeEntries(toolbarinfo.Count));
|
||||
_Info.Entries = toolbarinfo;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 10: // Okay
|
||||
goto case 12;
|
||||
case 11: // Cancel
|
||||
goto case 0;
|
||||
case 12: // Apply
|
||||
{
|
||||
ToolbarModule module = m.GetModule(typeof(ToolbarModule)) as ToolbarModule ?? new ToolbarModule(m);
|
||||
|
||||
module.ToolbarInfo.Entries = AnalyzeEntries();
|
||||
|
||||
module.ToolbarInfo.Phantom = info.IsSwitched(21);
|
||||
module.ToolbarInfo.Stealth = info.IsSwitched(23);
|
||||
module.ToolbarInfo.Reverse = info.IsSwitched(25);
|
||||
module.ToolbarInfo.Lock = info.IsSwitched(27);
|
||||
|
||||
if (info.ButtonID == 12)
|
||||
{
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
}
|
||||
|
||||
m.CloseGump(typeof(ToolbarGump));
|
||||
m.SendGump(new ToolbarGump(module.ToolbarInfo, m));
|
||||
|
||||
break;
|
||||
}
|
||||
case 18:
|
||||
{
|
||||
_Info.Font++;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 19:
|
||||
{
|
||||
_Info.Font--;
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
break;
|
||||
}
|
||||
case 20:
|
||||
{
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
m.SendMessage(2101, "Phantom mode turns the toolbar semi-transparent.");
|
||||
break;
|
||||
}
|
||||
case 22:
|
||||
{
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
m.SendMessage(2101, "Stealth mode makes the toolbar automatically minimize when you click a button.");
|
||||
break;
|
||||
}
|
||||
case 24:
|
||||
{
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
m.SendMessage(2101, "Reverse mode puts the minimize bar above the toolbar instead of below.");
|
||||
break;
|
||||
}
|
||||
case 26:
|
||||
{
|
||||
m.SendGump(new ToolbarEdit(_Info, _Expanded));
|
||||
m.SendMessage(2101, "Lock mode disables closing the toolbar with right-click.");
|
||||
break;
|
||||
}
|
||||
case 28: // Expand
|
||||
{
|
||||
m.SendGump(new ToolbarEdit(_Info, !_Expanded));
|
||||
m.SendMessage(2101, "Expanded view {0}activated.", _Expanded ? "de" : "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes the gump relay entries and converts them from an Array into a List.
|
||||
/// </summary>
|
||||
public static List<TextRelay> CreateList(TextRelay[] entries)
|
||||
{
|
||||
return entries.ToList();
|
||||
}
|
||||
|
||||
public void CombineEntries(List<string> list)
|
||||
{
|
||||
string temp;
|
||||
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i] == "-*UNUSED*-" && (temp = GetEntry(i + 13, this).Text) != "")
|
||||
{
|
||||
list[i] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> AnalyzeEntries()
|
||||
{
|
||||
return AnalyzeEntries(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Organizes the gump relay entries into a usable collection.
|
||||
/// </summary>
|
||||
public List<string> AnalyzeEntries(int i)
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
string temp;
|
||||
|
||||
for (int j = i; j < 135; j++)
|
||||
{
|
||||
list.Add((temp = GetEntry(j + 13, this).Text) == "" ? "-*UNUSED*-" : temp);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets entry # in the gump relay.
|
||||
/// </summary>
|
||||
public static TextRelay GetEntry(int entryID, ToolbarEdit gump)
|
||||
{
|
||||
int temp = 0;
|
||||
TextRelay relay = null;
|
||||
|
||||
for (int i = 0; i < gump._TextRelays.Count; i++)
|
||||
{
|
||||
if (gump._TextRelays[i].EntryID != entryID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
temp = i;
|
||||
relay = gump._TextRelays[i];
|
||||
}
|
||||
|
||||
gump._TextRelays.RemoveAt(temp);
|
||||
|
||||
return relay;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the skeleton gump.
|
||||
/// </summary>
|
||||
public void AddInit()
|
||||
{
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 620, 120, 9200);
|
||||
AddHtml(10, 10, 240, 100, HTML, true, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds other dynamic options.
|
||||
/// </summary>
|
||||
public void AddControls()
|
||||
{
|
||||
AddBackground(260, 0, 240, 120, 9200);
|
||||
AddLabel(274, 11, 0, String.Format("Skin - {0}", _Info.Skin + 1));
|
||||
|
||||
if (_Info.Skin < GumpIDs.Skins - 1)
|
||||
{
|
||||
AddButton(359, 10, 2435, 2436, 1, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
if (_Info.Skin > 0)
|
||||
{
|
||||
AddButton(359, 21, 2437, 2438, 2, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
AddLabel(274, 36, 0, String.Format("Rows - {0}", _Info.Rows));
|
||||
|
||||
if (_Info.Rows < 15)
|
||||
{
|
||||
AddButton(359, 35, 2435, 2436, 3, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
if (_Info.Rows > 1)
|
||||
{
|
||||
AddButton(359, 46, 2437, 2438, 4, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
AddLabel(274, 61, 0, String.Format("Columns - {0}", _Info.Collumns));
|
||||
|
||||
if (_Info.Collumns < 9)
|
||||
{
|
||||
AddButton(359, 60, 2435, 2436, 5, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
if (_Info.Collumns > 1)
|
||||
{
|
||||
AddButton(359, 71, 2437, 2438, 6, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
AddHtml(276, 87, 100, 20, String.Format("{0}Font - {1}", GumpIDs.Fonts[_Info.Font], _Info.Font + 1), false, false);
|
||||
|
||||
if (_Info.Font < GumpIDs.Fonts.Length - 1)
|
||||
{
|
||||
AddButton(359, 85, 2435, 2436, 18, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
if (_Info.Font > 0)
|
||||
{
|
||||
AddButton(359, 96, 2437, 2438, 19, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
AddLabel(389, 11, 0, "Phantom");
|
||||
AddButton(446, 13, 22153, 22155, 20, GumpButtonType.Reply, 0);
|
||||
AddCheck(469, 11, 210, 211, _Info.Phantom, 21);
|
||||
AddLabel(389, 36, 0, "Stealth");
|
||||
AddButton(446, 38, 22153, 22155, 22, GumpButtonType.Reply, 0);
|
||||
AddCheck(469, 36, 210, 211, _Info.Stealth, 23);
|
||||
AddLabel(389, 61, 0, "Reverse");
|
||||
AddButton(446, 63, 22153, 22155, 24, GumpButtonType.Reply, 0);
|
||||
AddCheck(469, 61, 210, 211, _Info.Reverse, 25);
|
||||
AddLabel(389, 86, 0, "Lock");
|
||||
AddButton(446, 88, 22153, 22155, 26, GumpButtonType.Reply, 0);
|
||||
AddCheck(469, 86, 210, 211, _Info.Lock, 27);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the skeleton navigation section.
|
||||
/// </summary>
|
||||
public void AddNavigation()
|
||||
{
|
||||
AddBackground(500, 0, 120, 120, 9200);
|
||||
AddHtml(500, 10, 120, 20, @"<center><u>Navigation</u></center>", false, false);
|
||||
AddLabel(508, 92, 0, "Expanded View");
|
||||
AddButton(595, 95, _Expanded ? 5603 : 5601, _Expanded ? 5607 : 5605, 28, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds response buttons.
|
||||
/// </summary>
|
||||
public void AddResponses()
|
||||
{
|
||||
int temp = 170 + (_ExpandedInt * 100);
|
||||
|
||||
AddBackground(0, temp, 500, 33, 9200);
|
||||
AddButton(50, temp + 5, 246, 244, 9, GumpButtonType.Reply, 0); // Default
|
||||
AddButton(162, temp + 5, 249, 248, 10, GumpButtonType.Reply, 0); // Okay
|
||||
AddButton(275, temp + 5, 243, 241, 11, GumpButtonType.Reply, 0); // Cancel
|
||||
AddButton(387, temp + 5, 239, 240, 12, GumpButtonType.Reply, 0); // Apply
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the actual command/phrase entries.
|
||||
/// </summary>
|
||||
public void AddEntries()
|
||||
{
|
||||
const int buffer = 2;
|
||||
|
||||
// CALC
|
||||
int entryX = _ExpandedInt * 149, entryY = _ExpandedInt * 20;
|
||||
int bgX = 10 + 4 + (buffer * 3) + (entryX * 3), bgY = 10 + 8 + (entryY * 5);
|
||||
int divX = bgX - 10, divY = bgY - 10;
|
||||
// ENDCALC
|
||||
|
||||
AddBackground(0, 120, 33 + bgX, 32 + bgY, 9200);
|
||||
|
||||
AddBackground(33, 152, bgX, bgY, 9200);
|
||||
|
||||
// Add vertical dividers
|
||||
for (int m = 1; m <= 2; m++)
|
||||
{
|
||||
AddImageTiled(38 + (m * entryX) + buffer + ((m - 1) * 4), 157, 2, divY, 10004);
|
||||
}
|
||||
|
||||
// Add horizontal dividers
|
||||
for (int n = 1; n <= 4; n++)
|
||||
{
|
||||
AddImageTiled(38, 155 + (n * (entryY + 2)), divX, 2, 10001);
|
||||
}
|
||||
|
||||
int start = -3, temp;
|
||||
|
||||
for (int i = 1; i <= 9; i++)
|
||||
{
|
||||
start += 3;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 4:
|
||||
start = 45;
|
||||
break;
|
||||
case 7:
|
||||
start = 90;
|
||||
break;
|
||||
}
|
||||
|
||||
temp = start;
|
||||
|
||||
/********
|
||||
* PAGES *
|
||||
*-------*
|
||||
* 1 2 3 *
|
||||
* 4 5 6 *
|
||||
* 7 8 9 *
|
||||
********/
|
||||
|
||||
AddPage(i);
|
||||
CalculatePages(i);
|
||||
|
||||
// Add column identifiers
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
AddHtml(
|
||||
38 + buffer + ((j % 3) * (buffer + entryX + 2)),
|
||||
128,
|
||||
entryX,
|
||||
20,
|
||||
String.Format("<center>Column {0}</center>", (j + 1) + CalculateColumns(i)),
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
AddHtml(2, 128, 30, 20, "<center>Row</center>", false, false);
|
||||
|
||||
int tempInt = 0;
|
||||
|
||||
if (_Expanded)
|
||||
{
|
||||
tempInt = 11;
|
||||
}
|
||||
|
||||
// Add row identifiers
|
||||
for (int k = 0; k < 5; k++)
|
||||
{
|
||||
AddHtml(
|
||||
0,
|
||||
157 + (k * (entryY + 2)) + tempInt,
|
||||
32,
|
||||
20,
|
||||
String.Format("<center>{0}</center>", (k + 1) + CalculateRows(i)),
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
// Add command entries
|
||||
for (int l = 0; l < 15; l++)
|
||||
{
|
||||
AddTextEntry(
|
||||
38 + buffer + ((l % 3) * ((buffer * 2) + entryX)),
|
||||
157 + ((int)Math.Floor((double)l / 3) * (entryY + 2)),
|
||||
entryX - 1,
|
||||
entryY,
|
||||
2101,
|
||||
temp + 13,
|
||||
_Info.Entries[temp] /*,int size*/);
|
||||
|
||||
if (l % 3 == 2)
|
||||
{
|
||||
temp += 6;
|
||||
}
|
||||
|
||||
++temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates what navigation button takes you to what page.
|
||||
/// </summary>
|
||||
public void CalculatePages(int i)
|
||||
{
|
||||
int up = 0, down = 0, left = 0, right = 0;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
down = 4;
|
||||
right = 2;
|
||||
break;
|
||||
case 2:
|
||||
down = 5;
|
||||
left = 1;
|
||||
right = 3;
|
||||
break;
|
||||
case 3:
|
||||
down = 6;
|
||||
left = 2;
|
||||
break;
|
||||
case 4:
|
||||
up = 1;
|
||||
down = 7;
|
||||
right = 5;
|
||||
break;
|
||||
case 5:
|
||||
up = 2;
|
||||
down = 8;
|
||||
left = 4;
|
||||
right = 6;
|
||||
break;
|
||||
case 6:
|
||||
up = 3;
|
||||
down = 9;
|
||||
left = 5;
|
||||
break;
|
||||
case 7:
|
||||
up = 4;
|
||||
right = 8;
|
||||
break;
|
||||
case 8:
|
||||
up = 5;
|
||||
left = 7;
|
||||
right = 9;
|
||||
break;
|
||||
case 9:
|
||||
up = 6;
|
||||
left = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
AddNavigation(up, down, left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds navigation buttons for each page.
|
||||
/// </summary>
|
||||
public void AddNavigation(int up, int down, int left, int right)
|
||||
{
|
||||
if (up > 0)
|
||||
{
|
||||
AddButton(549, 34, 9900, 9902, 0, GumpButtonType.Page, up);
|
||||
}
|
||||
|
||||
if (down > 0)
|
||||
{
|
||||
AddButton(549, 65, 9906, 9908, 0, GumpButtonType.Page, down);
|
||||
}
|
||||
|
||||
if (left > 0)
|
||||
{
|
||||
AddButton(523, 50, 9909, 9911, 0, GumpButtonType.Page, left);
|
||||
}
|
||||
|
||||
if (right > 0)
|
||||
{
|
||||
AddButton(575, 50, 9903, 9905, 0, GumpButtonType.Page, right);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Damn I've forgotten...
|
||||
/// </summary>
|
||||
public static int CalculateColumns(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 7:
|
||||
case 4:
|
||||
case 1:
|
||||
return 0;
|
||||
case 8:
|
||||
case 5:
|
||||
case 2:
|
||||
return 3;
|
||||
default:
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Same as above! =(
|
||||
/// </summary>
|
||||
public static int CalculateRows(int i)
|
||||
{
|
||||
if (i >= 1 && i <= 3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (i >= 4 && i <= 6)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user