Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,142 @@
using System;
using Server;
using Server.Gumps;
using Server.Mobiles;
using Server.ContextMenus;
namespace Server.Items
{
public interface ICustomizableMessageItem
{
string[] Lines { get; set; }
}
public class AddCustomizableMessageGump : BaseGump
{
private ICustomizableMessageItem _MessageItem;
private int TitleCliloc;
private int SubjectCliloc;
public AddCustomizableMessageGump(PlayerMobile pm, ICustomizableMessageItem item, int title = 0, int subject = 0)
: base(pm, 100, 100)
{
_MessageItem = item;
TitleCliloc = title;
SubjectCliloc = subject;
}
public override void AddGumpLayout()
{
string line1 = String.Empty;
string line2 = String.Empty;
string line3 = String.Empty;
if (_MessageItem.Lines != null)
{
if (_MessageItem.Lines.Length > 0)
line1 = _MessageItem.Lines[0];
if (_MessageItem.Lines.Length > 1)
line2 = _MessageItem.Lines[1];
if (_MessageItem.Lines.Length > 2)
line3 = _MessageItem.Lines[2];
}
AddPage(0);
AddBackground(0, 0, 420, 320, 0x2454);
AddHtmlLocalized(10, 10, 400, 18, 1114513, String.Format("#{0}", TitleCliloc == 0 ? 1151680 : TitleCliloc), 0x4000, false, false); // Add Message
AddHtmlLocalized(10, 37, 400, 90, SubjectCliloc == 0 ? 1151681 : SubjectCliloc, 0x14AA, false, false); // Enter up to three lines of personallized text. you may enter up to 25 characters per line.
AddHtmlLocalized(10, 136, 400, 16, 1150296, 0x14AA, false, false); // Line 1:
AddBackground(10, 152, 400, 22, 0x2486);
AddTextEntry(12, 154, 396, 18, 0x9C2, 0, line1, 25);
AddHtmlLocalized(10, 178, 400, 16, 1150297, 0x14AA, false, false); // Line 2:
AddBackground(10, 194, 400, 22, 0x2486);
AddTextEntry(12, 196, 396, 18, 0x9C2, 1, line2, 25);
AddHtmlLocalized(10, 220, 400, 16, 1150298, 0x14AA, false, false); // Line 3:
AddBackground(10, 236, 400, 22, 0x2486);
AddTextEntry(12, 238, 396, 18, 0x9C2, 2, line3, 25);
AddButton(10, 290, 0xFAB, 0xFAC, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 290, 100, 20, 1150299, 0x10, false, false); // ACCEPT
AddButton(380, 290, 0xFB4, 0xFB5, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(270, 290, 100, 20, 1114514, "#1150300 ", 0x10, false, false); // CANCEL
}
public override void OnResponse(RelayInfo info)
{
if (((Item)_MessageItem).Deleted)
return;
if (info.ButtonID == 1)
{
for (int i = 0; i < 3; i++)
{
if (_MessageItem.Lines.Length <= i)
{
break;
}
TextRelay text = info.GetTextEntry(i);
string s = text.Text;
if (s.Length > 25)
s = s.Substring(0, 25);
_MessageItem.Lines[i] = s;
}
if (_MessageItem is BaseAddon)
{
foreach (var comp in ((BaseAddon)_MessageItem).Components)
{
comp.InvalidateProperties();
}
}
else if (_MessageItem is Item)
{
((Item)_MessageItem).InvalidateProperties();
}
}
if (_MessageItem is ValentineBear)
{
((ValentineBear)_MessageItem).EditEnd = DateTime.UtcNow + TimeSpan.FromMinutes(10.0);
}
}
}
public class EditSign : ContextMenuEntry
{
private ICustomizableMessageItem _MessageItem;
private PlayerMobile _From;
public EditSign(ICustomizableMessageItem messageItem, PlayerMobile from)
: base(1151817) // Edit Sign
{
_MessageItem = messageItem;
_From = from;
}
public override void OnClick()
{
if (_MessageItem is Item)
{
if (_MessageItem is BaseAddon || ((Item)_MessageItem).IsChildOf(_From.Backpack))
{
BaseGump.SendGump(new AddCustomizableMessageGump(_From, _MessageItem));
}
else
{
_From.SendLocalizedMessage(1116249); // That must be in your backpack for you to use it.
}
}
}
}
}

View File

@@ -0,0 +1,181 @@
using System;
using Server.Commands;
using Server.Items;
using Server.Network;
namespace Server.Gumps
{
public class AddDoorGump : Gump
{
public static DoorInfo[] m_Types = new DoorInfo[]
{
new DoorInfo(typeof(MetalDoor), 0x675),
new DoorInfo(typeof(RattanDoor), 0x695),
new DoorInfo(typeof(DarkWoodDoor), 0x6A5),
new DoorInfo(typeof(LightWoodDoor), 0x6D5),
new DoorInfo(typeof(StrongWoodDoor), 0x6E5),
new DoorInfo(typeof(BarredMetalDoor2), 0x1FED),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(BarredMetalDoor), 0x685),
new DoorInfo(typeof(MediumWoodDoor), 0x6B5),
new DoorInfo(typeof(MetalDoor2), 0x6C5),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(IronGate), 0x824),
new DoorInfo(typeof(IronGateShort), 0x84C),
new DoorInfo(typeof(LightWoodGate), 0x839),
new DoorInfo(typeof(DarkWoodGate), 0x866),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(MetalDoor), -1),
new DoorInfo(typeof(SecretStoneDoor1), 0xE8),
new DoorInfo(typeof(SecretDungeonDoor), 0x314),
new DoorInfo(typeof(SecretStoneDoor2), 0x324),
new DoorInfo(typeof(SecretWoodenDoor), 0x334),
new DoorInfo(typeof(SecretLightWoodDoor), 0x344),
new DoorInfo(typeof(SecretStoneDoor3), 0x354)
};
private readonly int m_Type;
public AddDoorGump()
: this(-1)
{
}
public AddDoorGump(int type)
: base(50, 40)
{
m_Type = type;
AddPage(0);
if (m_Type >= 0 && m_Type < m_Types.Length)
{
AddBlueBack(155, 174);
int baseID = m_Types[m_Type].m_BaseID;
AddItem(25, 24, baseID);
AddButton(26, 37, 0x5782, 0x5782, 1, GumpButtonType.Reply, 0);
AddItem(47, 45, baseID + 2);
AddButton(43, 57, 0x5783, 0x5783, 2, GumpButtonType.Reply, 0);
AddItem(87, 22, baseID + 10);
AddButton(116, 35, 0x5785, 0x5785, 6, GumpButtonType.Reply, 0);
AddItem(65, 45, baseID + 8);
AddButton(96, 55, 0x5784, 0x5784, 5, GumpButtonType.Reply, 0);
AddButton(73, 36, 0x2716, 0x2716, 9, GumpButtonType.Reply, 0);
}
else
{
AddBlueBack(570, 165);
int pages = m_Types.Length / 10 + 1;
for (int i = 0; i < m_Types.Length; ++i)
{
int page = i / 10 + 1;
int pos = i % 10;
if (pos == 0)
{
AddPage(page);
AddHtmlLocalized(30, 20, 60, 20, 1042971, String.Format("{0}",page), 0x7FFF, false, false); // #
AddHtmlLocalized(30, 45, 60, 20, 1043353, 0x7FFF, false, false); // Next
if (page < pages)
AddButton(30, 60, 0xFA5, 0xFA7, 0, GumpButtonType.Page, page + 1);
else
AddButton(30, 60, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 1);
AddHtmlLocalized(30, 85, 60, 20, 1011393, 0x7FFF, false, false); // Back
if (page > 1)
AddButton(30, 100, 0xFAE, 0xFB0, 0, GumpButtonType.Page, page - 1);
else
AddButton(30, 100, 0xFAE, 0xFB0, 0, GumpButtonType.Page, pages);
}
if (m_Types[i].m_BaseID < 0)
continue;
int x = (pos + 1) * 50;
AddButton(30 + x, 20, 0x2624, 0x2625, i + 1, GumpButtonType.Reply, 0);
AddItem(15 + x, 30, m_Types[i].m_BaseID);
}
}
}
public static void Initialize()
{
CommandSystem.Register("AddDoor", AccessLevel.GameMaster, new CommandEventHandler(AddDoor_OnCommand));
}
[Usage("AddDoor")]
[Description("Displays a menu from which you can interactively add doors.")]
public static void AddDoor_OnCommand(CommandEventArgs e)
{
e.Mobile.SendGump(new AddDoorGump());
}
public void AddBlueBack(int width, int height)
{
AddBackground(0, 0, width - 00, height - 00, 0xE10);
AddBackground(8, 5, width - 16, height - 11, 0x053);
AddImageTiled(15, 14, width - 29, height - 29, 0xE14);
AddAlphaRegion(15, 14, width - 29, height - 29);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
int button = info.ButtonID - 1;
if (m_Type == -1)
{
if (button >= 0 && button < m_Types.Length)
from.SendGump(new AddDoorGump(button));
}
else
{
if (button >= 0 && button < 8)
{
from.SendGump(new AddDoorGump(m_Type));
CommandSystem.Handle(from, String.Format("{0}Add {1} {2}", CommandSystem.Prefix, m_Types[m_Type].m_Type.Name, (DoorFacing)button));
}
else if (button == 8)
{
from.SendGump(new AddDoorGump(m_Type));
CommandSystem.Handle(from, String.Format("{0}Link", CommandSystem.Prefix));
}
else
{
from.SendGump(new AddDoorGump());
}
}
}
}
public class DoorInfo
{
public Type m_Type;
public int m_BaseID;
public DoorInfo(Type type, int baseID)
{
m_Type = type;
m_BaseID = baseID;
}
}
}

252
Scripts/Gumps/AddGump.cs Normal file
View File

@@ -0,0 +1,252 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Server.Commands;
using Server.Network;
using Server.Targeting;
namespace Server.Gumps
{
public class AddGump : Gump
{
private static readonly Type typeofItem = typeof(Item);
private static readonly Type typeofMobile = typeof(Mobile);
private readonly string m_SearchString;
private readonly Type[] m_SearchResults;
private readonly int m_Page;
public AddGump(Mobile from, string searchString, int page, Type[] searchResults, bool explicitSearch)
: base(50, 50)
{
this.m_SearchString = searchString;
this.m_SearchResults = searchResults;
this.m_Page = page;
from.CloseGump(typeof(AddGump));
this.AddPage(0);
this.AddBackground(0, 0, 420, 280, 5054);
this.AddImageTiled(10, 10, 400, 20, 2624);
this.AddAlphaRegion(10, 10, 400, 20);
this.AddImageTiled(41, 11, 184, 18, 0xBBC);
this.AddImageTiled(42, 12, 182, 16, 2624);
this.AddAlphaRegion(42, 12, 182, 16);
this.AddButton(10, 9, 4011, 4013, 1, GumpButtonType.Reply, 0);
this.AddTextEntry(44, 10, 180, 20, 0x480, 0, searchString);
this.AddHtmlLocalized(230, 10, 100, 20, 3010005, 0x7FFF, false, false);
this.AddImageTiled(10, 40, 400, 200, 2624);
this.AddAlphaRegion(10, 40, 400, 200);
if (searchResults.Length > 0)
{
for (int i = (page * 10); i < ((page + 1) * 10) && i < searchResults.Length; ++i)
{
int index = i % 10;
this.AddLabel(44, 39 + (index * 20), 0x480, searchResults[i].Name);
this.AddButton(10, 39 + (index * 20), 4023, 4025, 4 + i, GumpButtonType.Reply, 0);
}
}
else
{
this.AddLabel(15, 44, 0x480, explicitSearch ? "Nothing matched your search terms." : "No results to display.");
}
this.AddImageTiled(10, 250, 400, 20, 2624);
this.AddAlphaRegion(10, 250, 400, 20);
if (this.m_Page > 0)
this.AddButton(10, 249, 4014, 4016, 2, GumpButtonType.Reply, 0);
else
this.AddImage(10, 249, 4014);
this.AddHtmlLocalized(44, 250, 170, 20, 1061028, this.m_Page > 0 ? 0x7FFF : 0x5EF7, false, false); // Previous page
if (((this.m_Page + 1) * 10) < searchResults.Length)
this.AddButton(210, 249, 4005, 4007, 3, GumpButtonType.Reply, 0);
else
this.AddImage(210, 249, 4005);
this.AddHtmlLocalized(244, 250, 170, 20, 1061027, ((this.m_Page + 1) * 10) < searchResults.Length ? 0x7FFF : 0x5EF7, false, false); // Next page
}
public static void Initialize()
{
CommandSystem.Register("AddMenu", AccessLevel.GameMaster, new CommandEventHandler(AddMenu_OnCommand));
}
public static List<Type> Match(string match)
{
List<Type> results = new List<Type>();
Type[] types;
Assembly[] asms = ScriptCompiler.Assemblies;
for (int i = 0; i < asms.Length; ++i)
{
types = ScriptCompiler.GetTypeCache(asms[i]).Types;
Match(match, types, results);
}
types = ScriptCompiler.GetTypeCache(Core.Assembly).Types;
Match(match, types, results);
results.RemoveAll(t => t == null);
if (results.Count > 1)
{
results.Sort((l, r) => Insensitive.Compare(l.Name, r.Name));
}
return results;
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
switch ( info.ButtonID )
{
case 1: // Search
{
TextRelay te = info.GetTextEntry(0);
string match = (te == null ? "" : te.Text.Trim());
if (match.Length < 3)
{
from.SendMessage("Invalid search string.");
from.SendGump(new AddGump(from, match, this.m_Page, this.m_SearchResults, false));
}
else
{
from.SendGump(new AddGump(from, match, 0, Match(match).ToArray(), true));
}
break;
}
case 2: // Previous page
{
if (this.m_Page > 0)
from.SendGump(new AddGump(from, this.m_SearchString, this.m_Page - 1, this.m_SearchResults, true));
break;
}
case 3: // Next page
{
if ((this.m_Page + 1) * 10 < this.m_SearchResults.Length)
from.SendGump(new AddGump(from, this.m_SearchString, this.m_Page + 1, this.m_SearchResults, true));
break;
}
default:
{
int index = info.ButtonID - 4;
if (index >= 0 && index < this.m_SearchResults.Length)
{
from.SendMessage("Where do you wish to place this object? <ESC> to cancel.");
from.Target = new InternalTarget(this.m_SearchResults[index], this.m_SearchResults, this.m_SearchString, this.m_Page);
}
break;
}
}
}
[Usage("AddMenu [searchString]")]
[Description("Opens an add menu, with an optional initial search string. This menu allows you to search for Items or Mobiles and add them interactively.")]
private static void AddMenu_OnCommand(CommandEventArgs e)
{
string val = e.ArgString.Trim();
Type[] types;
bool explicitSearch = false;
if (val.Length == 0)
{
types = Type.EmptyTypes;
}
else if (val.Length < 3)
{
e.Mobile.SendMessage("Invalid search string.");
types = Type.EmptyTypes;
}
else
{
types = Match(val).ToArray();
explicitSearch = true;
}
e.Mobile.SendGump(new AddGump(e.Mobile, val, 0, types, explicitSearch));
}
private static void Match(string match, Type[] types, List<Type> results)
{
if (match.Length == 0)
return;
match = match.ToLower();
for (int i = 0; i < types.Length; ++i)
{
Type t = types[i];
if ((typeofMobile.IsAssignableFrom(t) || typeofItem.IsAssignableFrom(t)) && Insensitive.Contains(t.Name, match) && !results.Contains(t))
{
ConstructorInfo[] ctors = t.GetConstructors();
for (int j = 0; j < ctors.Length; ++j)
{
if (ctors[j].GetParameters().Length == 0 && ctors[j].IsDefined(typeof(ConstructableAttribute), false))
{
results.Add(t);
break;
}
}
}
}
}
public class InternalTarget : Target
{
private readonly Type m_Type;
private readonly Type[] m_SearchResults;
private readonly string m_SearchString;
private readonly int m_Page;
public InternalTarget(Type type, Type[] searchResults, string searchString, int page)
: base(-1, true, TargetFlags.None)
{
this.m_Type = type;
this.m_SearchResults = searchResults;
this.m_SearchString = searchString;
this.m_Page = page;
}
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
{
if (p is Item)
p = ((Item)p).GetWorldTop();
else if (p is Mobile)
p = ((Mobile)p).Location;
Server.Commands.Add.Invoke(from, new Point3D(p), new Point3D(p), new string[] { this.m_Type.Name });
from.Target = new InternalTarget(this.m_Type, this.m_SearchResults, this.m_SearchString, this.m_Page);
}
}
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
{
if (cancelType == TargetCancelType.Canceled)
from.SendGump(new AddGump(from, this.m_SearchString, this.m_Page, this.m_SearchResults, true));
}
}
}
}

View File

@@ -0,0 +1,235 @@
using System;
using Server.Commands;
using Server.Items;
using Server.Network;
namespace Server.Gumps
{
public class AddSignGump : Gump
{
public static SignInfo[] m_Types = new SignInfo[]
{
new SignInfo(0xB95),
new SignInfo(0xB96),
new SignInfo(0xBA3),
new SignInfo(0xBA4),
new SignInfo(0xBA5),
new SignInfo(0xBA6),
new SignInfo(0xBA7),
new SignInfo(0xBA8),
new SignInfo(0xBA9),
new SignInfo(0xBAA),
new SignInfo(0xBAB),
new SignInfo(0xBAC),
new SignInfo(0xBAD),
new SignInfo(0xBAE),
new SignInfo(0xBAF),
new SignInfo(0xBB0),
new SignInfo(0xBB1),
new SignInfo(0xBB2),
new SignInfo(0xBB3),
new SignInfo(0xBB4),
new SignInfo(0xBB5),
new SignInfo(0xBB6),
new SignInfo(0xBB7),
new SignInfo(0xBB8),
new SignInfo(0xBB9),
new SignInfo(0xBBA),
new SignInfo(0xBBB),
new SignInfo(0xBBC),
new SignInfo(0xBBD),
new SignInfo(0xBBE),
new SignInfo(0xBBF),
new SignInfo(0xBC0),
new SignInfo(0xBC1),
new SignInfo(0xBC2),
new SignInfo(0xBC3),
new SignInfo(0xBC4),
new SignInfo(0xBC5),
new SignInfo(0xBC6),
new SignInfo(0xBC7),
new SignInfo(0xBC8),
new SignInfo(0xBC9),
new SignInfo(0xBCA),
new SignInfo(0xBCB),
new SignInfo(0xBCC),
new SignInfo(0xBCD),
new SignInfo(0xBCE),
new SignInfo(0xBCF),
new SignInfo(0xBD0),
new SignInfo(0xBD1),
new SignInfo(0xBD2),
new SignInfo(0xBD3),
new SignInfo(0xBD4),
new SignInfo(0xBD5),
new SignInfo(0xBD6),
new SignInfo(0xBD7),
new SignInfo(0xBD8),
new SignInfo(0xBD9),
new SignInfo(0xBDA),
new SignInfo(0xBDB),
new SignInfo(0xBDC),
new SignInfo(0xBDD),
new SignInfo(0xBDE),
new SignInfo(0xBDF),
new SignInfo(0xBE0),
new SignInfo(0xBE1),
new SignInfo(0xBE2),
new SignInfo(0xBE3),
new SignInfo(0xBE4),
new SignInfo(0xBE5),
new SignInfo(0xBE6),
new SignInfo(0xBE7),
new SignInfo(0xBE8),
new SignInfo(0xBE9),
new SignInfo(0xBEA),
new SignInfo(0xBEB),
new SignInfo(0xBEC),
new SignInfo(0xBED),
new SignInfo(0xBEE),
new SignInfo(0xBEF),
new SignInfo(0xBF0),
new SignInfo(0xBF1),
new SignInfo(0xBF2),
new SignInfo(0xBF3),
new SignInfo(0xBF4),
new SignInfo(0xBF5),
new SignInfo(0xBF6),
new SignInfo(0xBF7),
new SignInfo(0xBF8),
new SignInfo(0xBF9),
new SignInfo(0xBFA),
new SignInfo(0xBFB),
new SignInfo(0xBFC),
new SignInfo(0xBFD),
new SignInfo(0xBFE),
new SignInfo(0xBFF),
new SignInfo(0xC00),
new SignInfo(0xC01),
new SignInfo(0xC02),
new SignInfo(0xC03),
new SignInfo(0xC04),
new SignInfo(0xC05),
new SignInfo(0xC06),
new SignInfo(0xC07),
new SignInfo(0xC08),
new SignInfo(0xC09),
new SignInfo(0xC0A),
new SignInfo(0xC0B),
new SignInfo(0xC0C),
new SignInfo(0xC0D),
new SignInfo(0xC0E),
new SignInfo(0x1297),
new SignInfo(0x1298),
new SignInfo(0x1299),
new SignInfo(0x129A),
new SignInfo(0x129B),
new SignInfo(0x129C),
new SignInfo(0x129D),
new SignInfo(0x129E),
new SignInfo(0x1F28),
new SignInfo(0x1F29),
new SignInfo(0x4B20),
new SignInfo(0x4B21),
new SignInfo(0x9A0C),
new SignInfo(0x9A0D),
new SignInfo(0x9A0E),
new SignInfo(0x9A0F),
new SignInfo(0x9A10),
new SignInfo(0x9A11),
new SignInfo(0x9A12),
new SignInfo(0x9A13)
};
private readonly int m_Type;
public AddSignGump()
: this(-1)
{
}
public AddSignGump(int type)
: base(50, 40)
{
m_Type = type;
AddPage(0);
AddBlueBack(570, 175);
int pages = m_Types.Length / 20 + 1;
for (int i = 0; i < m_Types.Length; ++i)
{
int page = i / 20 + 1;
int xpos = (i / 2) % 10 ;
int ypos = i % 2;
if (xpos == 0 && ypos == 0)
{
AddPage(page);
AddHtmlLocalized(30, 20, 60, 20, 1042971, String.Format("{0}",page), 0x7FFF, false, false); // #
AddHtmlLocalized(30, 45, 60, 20, 1043353, 0x7FFF, false, false); // Next
if (page < pages)
AddButton(30, 60, 0xFA5, 0xFA7, 0, GumpButtonType.Page, page + 1);
else
AddButton(30, 60, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 1);
AddHtmlLocalized(30, 85, 60, 20, 1011393, 0x7FFF, false, false); // Back
if (page > 1)
AddButton(30, 100, 0xFAE, 0xFB0, 0, GumpButtonType.Page, page - 1);
else
AddButton(30, 100, 0xFAE, 0xFB0, 0, GumpButtonType.Page, pages);
}
if (m_Types[i].m_BaseID == 0)
continue;
int x = (xpos + 1) * 50;
int y = (ypos * 75);
AddButton(30 + x, 20 + y, 0x2624, 0x2625, i + 1, GumpButtonType.Reply, m_Types[i].m_BaseID);
AddItem(15 + x, 40 + y, m_Types[i].m_BaseID);
}
}
public static void Initialize()
{
CommandSystem.Register("AddSign", AccessLevel.GameMaster, new CommandEventHandler(AddSign_OnCommand));
}
[Usage("AddSign")]
[Description("Displays a menu from which you can interactively add signs.")]
public static void AddSign_OnCommand(CommandEventArgs e)
{
e.Mobile.SendGump(new AddSignGump());
}
public void AddBlueBack(int width, int height)
{
AddBackground(0, 0, width - 00, height - 00, 0xE10);
AddBackground(8, 5, width - 16, height - 11, 0x053);
AddImageTiled(15, 14, width - 29, height - 29, 0xE14);
AddAlphaRegion(15, 14, width - 29, height - 29);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
int button = info.ButtonID - 1;
if (button < 0)
return;
CommandSystem.Handle(from, String.Format("{0}Add {1} {2}", CommandSystem.Prefix, " Sign ", m_Types[button].m_BaseID));
from.SendGump(new AddSignGump());
}
}
public class SignInfo
{
public int m_BaseID;
public SignInfo(int baseID)
{
m_BaseID = baseID;
}
}
}

3334
Scripts/Gumps/AdminGump.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
using System;
using Server.Mobiles;
using Server.Items;
namespace Server.Gumps
{
public class ApplySkillBonusGump : BaseGump
{
public Item Item { get; set; }
public AosSkillBonuses Bonuses { get; set; }
public SkillName[] Skills { get; set; }
public SkillName Selection { get; set; }
public double Value { get; set; }
public int Index { get; set; }
public ApplySkillBonusGump(PlayerMobile pm, AosSkillBonuses bonuses, SkillName[] skills, double value, int index)
: base(pm, 50, 50)
{
Item = bonuses.Owner;
Bonuses = bonuses;
Skills = skills;
Value = value;
Index = index;
}
public override void AddGumpLayout()
{
AddBackground(0, 0, 400, (Skills.Length * 22) + 65, 83);
AddHtmlLocalized(15, 15, 400, 20, 1155610, 0x7FFF, false, false); // Please Chooose a Skill
int y = 40;
for (int i = 0; i < Skills.Length; i++)
{
var skill = Skills[i];
AddButton(15, y, 4005, 4007, i + 100, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, y, 200, 20, SkillInfo.Table[(int)skill].Localization, 0x7FFF, false, false);
y += 22;
}
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID >= 100)
{
int id = info.ButtonID - 100;
if (id >= 0 && id < Skills.Length)
{
Selection = Skills[id];
TextDefinition text;
if (Item is BaseWeapon)
{
text = 1155611; // Are you sure you wish to apply the selected skill bonus to this weapon?
}
else
{
text = 1155611; // Are you sure you wish to apply the selected skill bonus to this item?
}
BaseGump.SendGump(new GenericConfirmCallbackGump<ApplySkillBonusGump>(User, User.Skills[Selection].Info.Name, text, this, null,
(m, gump) =>
{
if (gump.Item.IsChildOf(gump.User.Backpack) || gump.User.Items.Contains(gump.Item))
{
gump.User.SendLocalizedMessage(1155612); // A skill bonus has been applied to the item!
Bonuses.SetValues(gump.Index, gump.Selection, gump.Value);
gump.Item.InvalidateProperties();
}
},
(m, gump) =>
{
gump.Refresh();
}));
}
}
}
}
}

View File

@@ -0,0 +1,256 @@
using System;
using System.Collections;
using Server.Accounting;
namespace Server.Gumps
{
public class BanDurationGump : Gump
{
private readonly ArrayList m_List;
public BanDurationGump(Account a)
: this(MakeList(a))
{
}
public BanDurationGump(ArrayList list)
: base((640 - 500) / 2, (480 - 305) / 2)
{
this.m_List = list;
int width = 500;
int height = 305;
this.AddPage(0);
this.AddBackground(0, 0, width, height, 5054);
//AddImageTiled( 10, 10, width - 20, 20, 2624 );
//AddAlphaRegion( 10, 10, width - 20, 20 );
this.AddHtml(10, 10, width - 20, 20, "<CENTER>Ban Duration</CENTER>", false, false);
//AddImageTiled( 10, 40, width - 20, height - 50, 2624 );
//AddAlphaRegion( 10, 40, width - 20, height - 50 );
this.AddButtonLabeled(15, 45, 1, "Infinite");
this.AddButtonLabeled(15, 65, 2, "From D:H:M:S");
this.AddInput(3, 0, "Days");
this.AddInput(4, 1, "Hours");
this.AddInput(5, 2, "Minutes");
this.AddInput(6, 3, "Seconds");
this.AddHtml(170, 45, 240, 20, "Comments:", false, false);
this.AddTextField(170, 65, 315, height - 80, 10);
}
public static ArrayList MakeList(object obj)
{
ArrayList list = new ArrayList(1);
list.Add(obj);
return list;
}
public void AddButtonLabeled(int x, int y, int buttonID, string text)
{
this.AddButton(x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0);
this.AddHtml(x + 35, y, 240, 20, text, false, false);
}
public void AddTextField(int x, int y, int width, int height, int index)
{
this.AddBackground(x - 2, y - 2, width + 4, height + 4, 0x2486);
this.AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
}
public void AddInput(int bid, int idx, string name)
{
int x = 15;
int y = 95 + (idx * 50);
this.AddButtonLabeled(x, y, bid, name);
this.AddTextField(x + 35, y + 20, 100, 20, idx);
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
if (from.AccessLevel < AccessLevel.Administrator)
return;
TextRelay d = info.GetTextEntry(0);
TextRelay h = info.GetTextEntry(1);
TextRelay m = info.GetTextEntry(2);
TextRelay s = info.GetTextEntry(3);
TextRelay c = info.GetTextEntry(10);
TimeSpan duration;
bool shouldSet;
string fromString = from.ToString();
switch ( info.ButtonID )
{
case 0:
{
for (int i = 0; i < this.m_List.Count; ++i)
{
Account a = (Account)this.m_List[i];
a.SetUnspecifiedBan(from);
}
from.SendMessage("Duration unspecified.");
return;
}
case 1: // infinite
{
duration = TimeSpan.MaxValue;
shouldSet = true;
break;
}
case 2: // From D:H:M:S
{
if (d != null && h != null && m != null && s != null)
{
try
{
duration = new TimeSpan(Utility.ToInt32(d.Text), Utility.ToInt32(h.Text), Utility.ToInt32(m.Text), Utility.ToInt32(s.Text));
shouldSet = true;
break;
}
catch
{
}
}
duration = TimeSpan.Zero;
shouldSet = false;
break;
}
case 3: // From D
{
if (d != null)
{
try
{
duration = TimeSpan.FromDays(Utility.ToDouble(d.Text));
shouldSet = true;
break;
}
catch
{
}
}
duration = TimeSpan.Zero;
shouldSet = false;
break;
}
case 4: // From H
{
if (h != null)
{
try
{
duration = TimeSpan.FromHours(Utility.ToDouble(h.Text));
shouldSet = true;
break;
}
catch
{
}
}
duration = TimeSpan.Zero;
shouldSet = false;
break;
}
case 5: // From M
{
if (m != null)
{
try
{
duration = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
shouldSet = true;
break;
}
catch
{
}
}
duration = TimeSpan.Zero;
shouldSet = false;
break;
}
case 6: // From S
{
if (s != null)
{
try
{
duration = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
shouldSet = true;
break;
}
catch
{
}
}
duration = TimeSpan.Zero;
shouldSet = false;
break;
}
default:
return;
}
if (shouldSet)
{
string comment = null;
if (c != null)
{
comment = c.Text.Trim();
if (comment.Length == 0)
comment = null;
}
for (int i = 0; i < this.m_List.Count; ++i)
{
Account a = (Account)this.m_List[i];
a.SetBanTags(from, DateTime.UtcNow, duration);
if (comment != null)
a.Comments.Add(new AccountComment(from.RawName, String.Format("Duration: {0}, Comment: {1}", ((duration == TimeSpan.MaxValue) ? "Infinite" : duration.ToString()), comment)));
}
if (duration == TimeSpan.MaxValue)
from.SendMessage("Ban Duration: Infinite");
else
from.SendMessage("Ban Duration: {0}", duration);
}
else
{
from.SendMessage("Time values were improperly formatted.");
from.SendGump(new BanDurationGump(this.m_List));
}
}
}
}

206
Scripts/Gumps/BankerGump.cs Normal file
View File

@@ -0,0 +1,206 @@
using Server;
using System;
using Server.Accounting;
using Server.Mobiles;
using System.Globalization;
using Server.Network;
namespace Server.Gumps
{
public class BankerGump : Gump
{
private int TextColor = 0x000F;
public PlayerMobile User { get; set; }
public BankerGump(PlayerMobile pm)
: base(150, 150)
{
User = pm;
AddGumpLayout();
}
public void AddGumpLayout()
{
AddBackground(0, 0, 420, 344, 9300);
AddHtmlLocalized(0, 10, 420, 16, 1113302, "#1156076", 1, false, false); // Bank Actions
Account acct = User.Account as Account;
AddHtmlLocalized(15, 35, 150, 16, 1156044, false, false); // Total Gold:
AddHtml(130, 35, 200, 16, acct != null ? acct.TotalGold.ToString("N0", CultureInfo.GetCultureInfo("en-US")) : "0", false, false);
AddHtmlLocalized(15, 55, 150, 16, 1156045, false, false); // Total Platinum:
AddHtml(130, 55, 200, 16, acct != null ? acct.TotalPlat.ToString("N0", CultureInfo.GetCultureInfo("en-US")) : "0", false, false);
AddHtmlLocalized(15, 75, 150, 16, 1157003, false, false); // Secure Account:
AddHtml(130, 75, 200, 16, acct != null ? acct.GetSecureAccountAmount(User).ToString("N0", CultureInfo.GetCultureInfo("en-US")) : "0", false, false);
AddHtmlLocalized(15, 95, 150, 16, 1157004, false, false); // Transfer Gold:
AddHtml(130, 95, 200, 16, "0", false, false);
AddHtmlLocalized(15, 115, 150, 16, 1157005, false, false); // Transfer Platinum:
AddHtml(130, 115, 200, 16, "0", false, false);
AddHtmlLocalized(270, 35, 90, 16, 1114514, "Help", 0, false, false);
AddButton(370, 35, 4014, 4015, 7, GumpButtonType.Reply, 0);
AddHtmlLocalized(60, 150, 360, 16, 1156064, TextColor, false, false); // Deposit Gold into Character Transfer Account
AddButton(20, 150, 4005, 4006, 1, GumpButtonType.Reply, 0);
AddTooltip(1156070); // Transfers gold from the bank to the character transfer account; capped at 1 billion gold. Any currency that
// a players wishes to transfer to another shard must be placed in character transfer account. Upon transferring
// the currency will be added to player's account on the shard.
AddHtmlLocalized(60, 180, 300, 16, 1156065, TextColor, false, false); // Deposit Platinum into Character Transfer Account
AddButton(20, 180, 4005, 4006, 2, GumpButtonType.Reply, 0);
AddTooltip(1156071); // Transfers platinum from the bank to the character transfer account; capped at 2 billion platinum. Any currency
// that a players wishes to transfer to another shard must be placed in character transfer account. Upon transferring
// the currency will be added to player's account on the shard.
AddHtmlLocalized(60, 210, 300, 16, 1156066, TextColor, false, false); // Withdraw Gold from Character Transfer Account
AddButton(20, 210, 4005, 4006, 3, GumpButtonType.Reply, 0);
AddTooltip(1156072); // Transfers gold from the character transfer account to the bank; capped at 1 billion gold.
AddHtmlLocalized(60, 240, 300, 16, 1156067, TextColor, false, false); // Withdraw Platinum from Character Transfer Account
AddButton(20, 240, 4005, 4006, 4, GumpButtonType.Reply, 0);
AddTooltip(1156073); // Transfers platinum from the character transfer account to the bank; capped at 2 billion platinum. Really? Who the fuck has this much?
AddHtmlLocalized(60, 270, 300, 16, 1156068, TextColor, false, false); // Deposit Gold into Secure Account
AddButton(20, 270, 4005, 4006, 5, GumpButtonType.Reply, 0);
AddTooltip(1156074); // Transfers gold from the bank to the player's secure account; capped at 100,000,000 gold. Only funds added
// to the secure account can be added to the wall safe account.
AddHtmlLocalized(60, 300, 300, 16, 1156069, TextColor, false, false); // Withdraw Gold from Secure Account
AddButton(20, 300, 4005, 4006, 6, GumpButtonType.Reply, 0);
AddTooltip(1156075); // Transfers gold from the secure account to the bank; capped at 100,0,000 gold.
}
public override void OnResponse(NetState state, RelayInfo info)
{
Account acct = User.Account as Account;
switch (info.ButtonID)
{
case 0: break;
case 1:
case 2:
case 3:
case 4:
User.SendMessage("This feature is currenlty disabled.");
Refresh(false);
break;
case 5:
User.SendLocalizedMessage(1155865); // Enter amount to deposit:
User.BeginPrompt<Account>(
(from, text, account) =>
{
int v = 0;
if (account != null)
{
int canHold = Account.MaxSecureAmount - account.GetSecureAccountAmount(from);
if (text != null && !String.IsNullOrEmpty(text))
{
v = Utility.ToInt32(text);
if (v <= 0 || v > canHold || v > Banker.GetBalance(from))
from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
else if (account != null)
{
if (v > canHold)
v = canHold;
Banker.Withdraw(from, v, true);
account.DepositToSecure(from, v);
from.SendLocalizedMessage(1153188); // Transaction successful:
Timer.DelayCall(TimeSpan.FromSeconds(2), SendGump);
}
}
else
from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
}
},
(from, text, a) =>
{
User.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
User.SendGump(new BankerGump(User));
}, acct);
break;
case 6:
User.SendLocalizedMessage(1155866); // Enter amount to withdraw:
User.BeginPrompt(
(from, text, ac) =>
{
int v = 0;
if (ac != null)
{
if (text != null && !String.IsNullOrEmpty(text))
{
v = Utility.ToInt32(text);
if (ac != null)
{
if (v <= 0 || v > acct.GetSecureAccountAmount(from))
from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
else
{
Banker.Deposit(from, v, true);
ac.WithdrawFromSecure(from, v);
from.SendLocalizedMessage(1153188); // Transaction successful:
}
Timer.DelayCall(TimeSpan.FromSeconds(2), SendGump);
}
}
else
from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
}
},
(from, text, act) =>
{
User.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
User.SendGump(new BankerGump(User));
}, acct);
break;
case 7:
User.CloseGump(typeof (NewCurrencyHelpGump));
User.SendGump(new NewCurrencyHelpGump());
Refresh();
break;
}
}
private void SendGump()
{
User.SendGump(new BankerGump(User));
}
public void Refresh(bool recompile = true)
{
if (recompile)
{
Entries.Clear();
Entries.TrimExcess();
AddGumpLayout();
}
User.CloseGump(this.GetType());
User.SendGump(this, false);
}
}
public class NewCurrencyHelpGump : Gump
{
public NewCurrencyHelpGump() : base(50, 75)
{
AddBackground(0, 0, 875, 480, 5170);
AddHtmlLocalized(50, 40, 775, 440, 1156048, Engines.Quests.BaseQuestGump.C32216(0x6495ED), false, false);
}
}
}

View File

@@ -0,0 +1,100 @@
using System;
namespace Server.Gumps
{
public class BaseConfirmGump : Gump
{
public BaseConfirmGump()
: base(120, 50)
{
this.Closable = false;
this.Disposable = true;
this.Dragable = true;
this.Resizable = false;
this.AddPage(0);
this.AddImageTiled(0, 0, 348, 262, 0xA8E);
this.AddAlphaRegion(0, 0, 348, 262);
this.AddImage(0, 15, 0x27A8);
this.AddImageTiled(0, 30, 17, 200, 0x27A7);
this.AddImage(0, 230, 0x27AA);
this.AddImage(15, 230, 0x280C);
this.AddImageTiled(30, 0, 300, 17, 0x280A);
this.AddImage(315, 0, 0x280E);
this.AddImage(15, 244, 0x280C);
this.AddImageTiled(30, 244, 300, 17, 0x280A);
this.AddImage(315, 244, 0x280E);
this.AddImage(330, 15, 0x27A8);
this.AddImageTiled(330, 30, 17, 200, 0x27A7);
this.AddImage(330, 230, 0x27AA);
this.AddImage(333, 2, 0x2716);
this.AddImage(315, 248, 0x2716);
this.AddImage(2, 248, 0x2716);
this.AddImage(2, 2, 0x2716);
if (TitleString == null)
AddHtmlLocalized(25, 25, 200, 20, TitleNumber, 0x7D00, false, false);
else
AddHtml(25, 25, 200, 20, "<BASEFONT COLOR=#FF0000>" + TitleString + "</BASEFONT>", false, false);
this.AddImage(25, 40, 0xBBF);
if (LabelString == null)
AddHtmlLocalized(25, 55, 300, 120, LabelNumber, 0xFFFFFF, false, false);
else
AddHtml(25, 55, 300, 120, "<BASEFONT COLOR=#FFFFFF>" + LabelString + "</BASEFONT>", false, false);
this.AddRadio(25, 175, 0x25F8, 0x25FB, true, (int)Buttons.Break);
this.AddRadio(25, 210, 0x25F8, 0x25FB, false, (int)Buttons.Close);
this.AddHtmlLocalized(60, 180, 280, 20, 1074976, 0xFFFFFF, false, false);
this.AddHtmlLocalized(60, 215, 280, 20, 1074977, 0xFFFFFF, false, false);
this.AddButton(265, 220, 0xF7, 0xF8, (int)Buttons.Confirm, GumpButtonType.Reply, 0);
}
private enum Buttons
{
Close,
Break,
Confirm
}
public virtual int TitleNumber
{
get
{
return 1075083;
}
}// <center>Warning!</center>
public virtual int LabelNumber
{
get
{
return 1074975;
}
}// Are you sure you wish to select this?
public virtual string TitleString { get { return null; } }
public virtual string LabelString { get { return null; } }
public override void OnResponse(Server.Network.NetState state, RelayInfo info)
{
if (info.ButtonID == (int)Buttons.Confirm)
{
if (info.IsSwitched((int)Buttons.Break))
this.Confirm(state.Mobile);
else
this.Refuse(state.Mobile);
}
}
public virtual void Confirm(Mobile from)
{
}
public virtual void Refuse(Mobile from)
{
}
}
}

View File

@@ -0,0 +1,250 @@
using System;
namespace Server.Gumps
{
public abstract class BaseGridGump : Gump
{
public const int ArrowLeftID1 = 0x15E3;
public const int ArrowLeftID2 = 0x15E7;
public const int ArrowLeftWidth = 16;
public const int ArrowLeftHeight = 16;
public const int ArrowRightID1 = 0x15E1;
public const int ArrowRightID2 = 0x15E5;
public const int ArrowRightWidth = 16;
public const int ArrowRightHeight = 16;
protected GumpBackground m_Background;
protected GumpImageTiled m_Offset;
private int m_CurrentX, m_CurrentY;
private int m_CurrentPage;
public BaseGridGump(int x, int y)
: base(x, y)
{
}
public int CurrentPage
{
get
{
return this.m_CurrentPage;
}
}
public int CurrentX
{
get
{
return this.m_CurrentX;
}
}
public int CurrentY
{
get
{
return this.m_CurrentY;
}
}
public virtual int BorderSize
{
get
{
return 10;
}
}
public virtual int OffsetSize
{
get
{
return 1;
}
}
public virtual int EntryHeight
{
get
{
return 20;
}
}
public virtual int OffsetGumpID
{
get
{
return 0x0A40;
}
}
public virtual int HeaderGumpID
{
get
{
return 0x0E14;
}
}
public virtual int EntryGumpID
{
get
{
return 0x0BBC;
}
}
public virtual int BackGumpID
{
get
{
return 0x13BE;
}
}
public virtual int TextHue
{
get
{
return 0;
}
}
public virtual int TextOffsetX
{
get
{
return 2;
}
}
public string Center(string text)
{
return String.Format("<CENTER>{0}</CENTER>", text);
}
public string Color(string text, int color)
{
return String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text);
}
public int GetButtonID(int typeCount, int type, int index)
{
return 1 + (index * typeCount) + type;
}
public bool SplitButtonID(int buttonID, int typeCount, out int type, out int index)
{
if (buttonID < 1)
{
type = 0;
index = 0;
return false;
}
buttonID -= 1;
type = buttonID % typeCount;
index = buttonID / typeCount;
return true;
}
public void FinishPage()
{
if (this.m_Background != null)
this.m_Background.Height = this.m_CurrentY + this.EntryHeight + this.OffsetSize + this.BorderSize;
if (this.m_Offset != null)
this.m_Offset.Height = this.m_CurrentY + this.EntryHeight + this.OffsetSize - this.BorderSize;
}
public void AddNewPage()
{
this.FinishPage();
this.m_CurrentX = this.BorderSize + this.OffsetSize;
this.m_CurrentY = this.BorderSize + this.OffsetSize;
this.AddPage(++this.m_CurrentPage);
this.m_Background = new GumpBackground(0, 0, 100, 100, this.BackGumpID);
this.Add(this.m_Background);
this.m_Offset = new GumpImageTiled(this.BorderSize, this.BorderSize, 100, 100, this.OffsetGumpID);
this.Add(this.m_Offset);
}
public void AddNewLine()
{
this.m_CurrentY += this.EntryHeight + this.OffsetSize;
this.m_CurrentX = this.BorderSize + this.OffsetSize;
}
public void IncreaseX(int width)
{
this.m_CurrentX += width + this.OffsetSize;
width = this.m_CurrentX + this.BorderSize;
if (this.m_Background != null && width > this.m_Background.Width)
this.m_Background.Width = width;
width = this.m_CurrentX - this.BorderSize;
if (this.m_Offset != null && width > this.m_Offset.Width)
this.m_Offset.Width = width;
}
public void AddEntryLabel(int width, string text)
{
this.AddImageTiled(this.m_CurrentX, this.m_CurrentY, width, this.EntryHeight, this.EntryGumpID);
this.AddLabelCropped(this.m_CurrentX + this.TextOffsetX, this.m_CurrentY, width - this.TextOffsetX, this.EntryHeight, this.TextHue, text);
this.IncreaseX(width);
}
public void AddEntryHtml(int width, string text)
{
this.AddImageTiled(this.m_CurrentX, this.m_CurrentY, width, this.EntryHeight, this.EntryGumpID);
this.AddHtml(this.m_CurrentX + this.TextOffsetX, this.m_CurrentY, width - this.TextOffsetX, this.EntryHeight, text, false, false);
this.IncreaseX(width);
}
public void AddEntryHeader(int width)
{
this.AddEntryHeader(width, 1);
}
public void AddEntryHeader(int width, int spannedEntries)
{
this.AddImageTiled(this.m_CurrentX, this.m_CurrentY, width, (this.EntryHeight * spannedEntries) + (this.OffsetSize * (spannedEntries - 1)), this.HeaderGumpID);
this.IncreaseX(width);
}
public void AddBlankLine()
{
if (this.m_Offset != null)
this.AddImageTiled(this.m_Offset.X, this.m_CurrentY, this.m_Offset.Width, this.EntryHeight, this.BackGumpID + 4);
this.AddNewLine();
}
public void AddEntryButton(int width, int normalID, int pressedID, int buttonID, int buttonWidth, int buttonHeight)
{
this.AddEntryButton(width, normalID, pressedID, buttonID, buttonWidth, buttonHeight, 1);
}
public void AddEntryButton(int width, int normalID, int pressedID, int buttonID, int buttonWidth, int buttonHeight, int spannedEntries)
{
this.AddImageTiled(this.m_CurrentX, this.m_CurrentY, width, (this.EntryHeight * spannedEntries) + (this.OffsetSize * (spannedEntries - 1)), this.HeaderGumpID);
this.AddButton(this.m_CurrentX + ((width - buttonWidth) / 2), this.m_CurrentY + (((this.EntryHeight * spannedEntries) + (this.OffsetSize * (spannedEntries - 1)) - buttonHeight) / 2), normalID, pressedID, buttonID, GumpButtonType.Reply, 0);
this.IncreaseX(width);
}
public void AddEntryPageButton(int width, int normalID, int pressedID, int page, int buttonWidth, int buttonHeight)
{
this.AddImageTiled(this.m_CurrentX, this.m_CurrentY, width, this.EntryHeight, this.HeaderGumpID);
this.AddButton(this.m_CurrentX + ((width - buttonWidth) / 2), this.m_CurrentY + ((this.EntryHeight - buttonHeight) / 2), normalID, pressedID, 0, GumpButtonType.Page, page);
this.IncreaseX(width);
}
public void AddEntryText(int width, int entryID, string initialText)
{
this.AddImageTiled(this.m_CurrentX, this.m_CurrentY, width, this.EntryHeight, this.EntryGumpID);
this.AddTextEntry(this.m_CurrentX + this.TextOffsetX, this.m_CurrentY, width - this.TextOffsetX, this.EntryHeight, this.TextHue, entryID, initialText);
this.IncreaseX(width);
}
}
}

685
Scripts/Gumps/BaseGump.cs Normal file
View File

@@ -0,0 +1,685 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Server;
using Server.Network;
using Server.Mobiles;
namespace Server.Gumps
{
public abstract class BaseGump : Gump, IDisposable
{
public static int CenterLoc = 1154645; // <center>~1_val~</center>
public static int AlignRightLoc = 1114514; // <DIV ALIGN=RIGHT>~1_TOKEN~</DIV>
private Gump _Parent;
public PlayerMobile User { get; private set; }
public bool Open { get; set; }
public virtual bool CloseOnMapChange { get { return false; } }
public Gump Parent
{
get { return _Parent; }
set
{
_Parent = value;
if (_Parent != null)
{
if(_Parent is BaseGump && !((BaseGump)_Parent).Children.Contains(this))
((BaseGump)_Parent).Children.Add(this);
}
else if (_Parent is BaseGump && ((BaseGump)_Parent).Children.Contains(this))
{
((BaseGump)_Parent).Children.Remove(this);
}
}
}
public List<BaseGump> Children { get; set; }
public BaseGump(PlayerMobile user, int x = 50, int y = 50, BaseGump parent = null)
: base(x, y)
{
if (user == null)
return;
Children = new List<BaseGump>();
User = user;
Parent = parent;
}
~BaseGump()
{
Dispose();
}
public static BaseGump SendGump(BaseGump gump)
{
if(gump == null)
return null;
BaseGump g = gump.User.FindGump(gump.GetType()) as BaseGump;
if (g == gump)
gump.Refresh();
else
gump.SendGump();
return gump;
}
public virtual void SendGump()
{
AddGumpLayout();
Open = true;
User.SendGump(this, false);
}
public void Dispose()
{
ColUtility.ForEach(Children.AsEnumerable(), child => Children.Remove(child));
Children = null;
Children = null;
Parent = null;
foreach (var kvp in _TextTooltips)
{
kvp.Value.Free();
}
foreach (var kvp in _ClilocTooltips)
{
kvp.Value.Free();
}
_ClilocTooltips.Clear();
_TextTooltips.Clear();
OnDispose();
}
public virtual void OnDispose()
{
}
public abstract void AddGumpLayout();
public virtual void Refresh(bool recompile = true, bool close = true)
{
OnBeforeRefresh();
if (User == null || User.NetState == null)
return;
if (close)
{
User.NetState.Send(new CloseGump(TypeID, 0));
User.NetState.RemoveGump(this);
}
else
{
User.NetState.RemoveGump(this);
}
if (recompile)
{
Entries.Clear();
AddGumpLayout();
}
/*Children.ForEach(child =>
{
if(child.Open)
child.Refresh(recompile, close);
});*/
User.SendGump(this);
OnAfterRefresh();
}
public void RefreshParent(bool resend = false)
{
if (Parent is BaseGump)
((BaseGump)Parent).Refresh();
if (resend)
Refresh();
}
public virtual void OnBeforeRefresh()
{
}
public virtual void OnAfterRefresh()
{
}
public virtual void OnClosed()
{
Children.ForEach(child => child.Close());
Children.Clear();
Open = false;
if (Parent != null)
{
if(Parent is BaseGump)
((BaseGump)Parent).OnChildClosed(this);
Parent = null;
}
}
public virtual void OnChildClosed(BaseGump gump)
{
}
public override sealed void OnResponse(NetState state, RelayInfo info)
{
OnResponse(info);
if (info.ButtonID == 0)
OnClosed();
}
public virtual void OnResponse(RelayInfo info)
{
}
public virtual void OnServerClosed(NetState state)
{
OnClosed();
}
public virtual void Close()
{
if (User == null || User.NetState == null)
return;
OnServerClose(User.NetState);
User.Send(new CloseGump(TypeID, 0));
User.NetState.RemoveGump(this);
}
public static T GetGump<T>(PlayerMobile pm, Func<T, bool> predicate) where T : Gump
{
return EnumerateGumps<T>(pm).FirstOrDefault(x => predicate == null || predicate(x));
}
public static IEnumerable<T> EnumerateGumps<T>(PlayerMobile pm, Func<T, bool> predicate = null) where T : Gump
{
var ns = pm.NetState;
if (ns == null)
yield break;
foreach (BaseGump gump in ns.Gumps.OfType<BaseGump>().Where(g => g.GetType() == typeof(T) &&
(predicate == null || predicate(g as T))))
{
yield return gump as T;
}
}
public static List<T> GetGumps<T>(PlayerMobile pm) where T : Gump
{
var ns = pm.NetState;
List<T> list = new List<T>();
if (ns == null)
return list;
foreach (BaseGump gump in ns.Gumps.OfType<BaseGump>().Where(g => g.GetType() == typeof(T)))
{
list.Add(gump as T);
}
return list;
}
public static List<BaseGump> GetGumps(PlayerMobile pm, bool checkOpen = false)
{
var ns = pm.NetState;
List<BaseGump> list = new List<BaseGump>();
if (ns == null)
return list;
foreach (BaseGump gump in ns.Gumps.OfType<BaseGump>().Where(g => (!checkOpen || g.Open)))
{
list.Add(gump);
}
return list;
}
public static void CheckCloseGumps(PlayerMobile pm, bool checkOpen = false)
{
var ns = pm.NetState;
if (ns != null)
{
var gumps = GetGumps(pm, checkOpen);
foreach (BaseGump gump in gumps.Where(g => g.CloseOnMapChange))
{
pm.CloseGump(gump.GetType());
}
ColUtility.Free(gumps);
}
}
public new void AddItemProperty(Item item)
{
item.SendPropertiesTo(User);
base.AddItemProperty(item);
}
public void AddMobileProperty(Mobile mob)
{
mob.SendPropertiesTo(User);
base.AddItemProperty(mob.Serial.Value);
}
public void AddProperties(Spoof spoof)
{
User.Send(spoof.PropertyList);
base.AddItemProperty(spoof.Serial.Value);
}
#region Formatting
public static int C16232(int c16)
{
c16 &= 0x7FFF;
int r = (((c16 >> 10) & 0x1F) << 3);
int g = (((c16 >> 05) & 0x1F) << 3);
int b = (((c16 >> 00) & 0x1F) << 3);
return (r << 16) | (g << 8) | (b << 0);
}
public static int C16216(int c16)
{
return c16 & 0x7FFF;
}
public static int C32216(int c32)
{
c32 &= 0xFFFFFF;
int r = (((c32 >> 16) & 0xFF) >> 3);
int g = (((c32 >> 08) & 0xFF) >> 3);
int b = (((c32 >> 00) & 0xFF) >> 3);
return (r << 10) | (g << 5) | (b << 0);
}
protected string Color(string color, string str)
{
return String.Format("<basefont color={0}>{1}", color, str);
}
protected string ColorAndCenter(string color, string str)
{
return String.Format("<center><basefont color={0}>{1}</center>", color, str);
}
protected string ColorAndSize(string color, int size, string str)
{
return String.Format("<basefont color={0} size={1}>{2}", color, size.ToString(), str);
}
protected string ColorAndCenterAndSize(string color, int size, string str)
{
return String.Format("<basefont color={0} size={1}><center>{2}</center>", color, size.ToString(), str);
}
protected string Color(int color, string str)
{
return String.Format("<basefont color=#{0:X6}>{1}", color, str);
}
protected string ColorAndCenter(int color, string str)
{
return String.Format("<basefont color=#{0:X6}><center>{1}</center>", color, str);
}
protected string Center(string str)
{
return String.Format("<CENTER>{0}</CENTER>", str);
}
protected string ColorAndAlignRight(int color, string str)
{
return String.Format("<DIV ALIGN=RIGHT><basefont color=#{0:X6}>{1}</DIV>", color, str);
}
protected string ColorAndAlignRight(string color, string str)
{
return String.Format("<DIV ALIGN=RIGHT><basefont color={0}>{1}</DIV>", color, str);
}
protected string AlignRight(string str)
{
return String.Format("<DIV ALIGN=RIGHT>{0}</DIV>", str);
}
public void AddHtmlLocalizedCentered(int x, int y, int length, int height, int localization, bool background, bool scrollbar)
{
AddHtmlLocalized(x, y, length, height, 1113302, String.Format("#{0}", localization), 0, background, scrollbar);
}
public void AddHtmlLocalizedCentered(int x, int y, int length, int height, int localization, int hue, bool background, bool scrollbar)
{
AddHtmlLocalized(x, y, length, height, 1113302, String.Format("#{0}", localization), hue, background, scrollbar);
}
public void AddHtmlLocalizedAlignRight(int x, int y, int length, int height, int localization, bool background, bool scrollbar)
{
AddHtmlLocalized(x, y, length, height, 1114514, String.Format("#{0}", localization), 0, background, scrollbar);
}
public void AddHtmlLocalizedAlignRight(int x, int y, int length, int height, int localization, int hue, bool background, bool scrollbar)
{
AddHtmlLocalized(x, y, length, height, 1114514, String.Format("#{0}", localization), hue, background, scrollbar);
}
#endregion
#region Tooltips
private Dictionary<string, Spoof> _TextTooltips = new Dictionary<string, Spoof>();
private Dictionary<Dictionary<int, string>, Spoof> _ClilocTooltips = new Dictionary<Dictionary<int, string>, Spoof>();
public void AddTooltip(string text)
{
AddTooltip(text, System.Drawing.Color.Empty);
}
public void AddTooltip(string text, System.Drawing.Color color)
{
AddTooltip(String.Empty, text, System.Drawing.Color.Empty, color);
}
public void AddTooltip(string title, string text)
{
AddTooltip(title, text, System.Drawing.Color.Empty, System.Drawing.Color.Empty);
}
public void AddTooltip(int cliloc, string args)
{
AddTooltip(new int[] { cliloc }, new string[] { args ?? String.Empty });
}
public void AddTooltip(int cliloc, string format, params string[] args)
{
AddTooltip(cliloc, String.Format(format, args));
}
public void AddTooltip(int[] clilocs)
{
AddTooltip(clilocs, new string[clilocs.Length]);
}
public void AddTooltip(string[] args)
{
var clilocs = new int[Math.Min(Spoof.EmptyClilocs.Length, args.Length)];
for (int i = 0; i < args.Length; i++)
{
if (i >= Spoof.EmptyClilocs.Length)
break;
clilocs[i] = Spoof.EmptyClilocs[i];
}
AddTooltip(clilocs, args);
}
public void AddTooltip(int[] clilocs, string[] args)
{
var dictionary = new Dictionary<int, string>();
int emptyIndex = 0;
for(int i = 0; i < clilocs.Length; i++)
{
var str = String.Empty;
if (i < args.Length)
{
str = args[i] ?? String.Empty;
}
var cliloc = clilocs[i];
if (cliloc <= 0)
{
if (emptyIndex <= Spoof.EmptyClilocs.Length)
{
cliloc = Spoof.EmptyClilocs[emptyIndex];
emptyIndex++;
}
}
if (cliloc > 0)
{
dictionary[cliloc] = str;
}
}
Spoof spoof;
if (!_ClilocTooltips.TryGetValue(dictionary, out spoof) || spoof == null || spoof.Deleted)
{
spoof = Spoof.Acquire();
}
spoof.ClilocTable = dictionary;
_ClilocTooltips[dictionary] = spoof;
AddProperties(spoof);
}
public void AddTooltip(string title, string text, System.Drawing.Color titleColor, System.Drawing.Color textColor)
{
title = title ?? String.Empty;
text = text ?? String.Empty;
if (titleColor.IsEmpty || titleColor == System.Drawing.Color.Transparent)
{
titleColor = System.Drawing.Color.White;
}
if (textColor.IsEmpty || textColor == System.Drawing.Color.Transparent)
{
textColor = System.Drawing.Color.White;
}
Spoof spoof;
if (!_TextTooltips.TryGetValue(text, out spoof) || spoof == null || spoof.Deleted)
{
spoof = Spoof.Acquire();
}
if (!String.IsNullOrWhiteSpace(title))
{
spoof.Text = String.Concat(String.Format("<basefont color=#{0:X}>{1}", titleColor.ToArgb(), title),
'\n',
String.Format("<basefont color=#{0:X}>{1}", textColor.ToArgb(), text));
}
else
{
spoof.Text = String.Format("<basefont color=#{0:X}>{1}", textColor.ToArgb(), text); // text.WrapUOHtmlColor(textColor, false);
}
_TextTooltips[text] = spoof;
AddProperties(spoof);
}
public sealed class Spoof : Entity
{
private static readonly char[] _Split = { '\n' };
private static int _UID = -1;
private static int NewUID
{
get
{
if (_UID == Int32.MinValue)
{
_UID = -1;
}
return --_UID;
}
}
public static int[] EmptyClilocs =
{
1042971, 1070722, // ~1_NOTHING~
1114057, 1114778, 1114779, // ~1_val~
1150541, // ~1_TOKEN~
1153153, // ~1_year~
};
private static readonly List<Spoof> _SpoofPool = new List<Spoof>();
public static Spoof Acquire()
{
if (_SpoofPool.Count == 0)
{
return new Spoof();
}
else
{
var spoof = _SpoofPool[0];
_SpoofPool.Remove(spoof);
return spoof;
}
}
public void Free()
{
Packet.Release(ref _PropertyList);
_Text = String.Empty;
_ClilocTable = null;
_SpoofPool.Add(this);
}
public int UID { get { return Serial.Value; } private set { } }
private ObjectPropertyList _PropertyList;
public ObjectPropertyList PropertyList
{
get
{
if (_PropertyList == null)
{
_PropertyList = new ObjectPropertyList(this);
if (!String.IsNullOrEmpty(Text))
{
var text = StripHtmlBreaks(Text, true);
if (text.IndexOf('\n') >= 0)
{
var lines = text.Split(_Split);
foreach (var str in lines)
{
_PropertyList.Add(str);
}
}
else
{
_PropertyList.Add(text);
}
}
else if (_ClilocTable != null)
{
foreach (var kvp in _ClilocTable)
{
var cliloc = kvp.Key;
var args = kvp.Value;
if (cliloc <= 0 && !String.IsNullOrEmpty(args))
{
_PropertyList.Add(args);
}
else if (String.IsNullOrEmpty(args))
{
_PropertyList.Add(cliloc);
}
else
{
_PropertyList.Add(cliloc, args);
}
}
}
_PropertyList.Terminate();
_PropertyList.SetStatic();
}
return _PropertyList;
}
}
private string _Text = String.Empty;
public string Text
{
get { return _Text ?? String.Empty; }
set
{
if (_Text != value)
{
_Text = value;
Packet.Release(ref _PropertyList);
}
}
}
private Dictionary<int, string> _ClilocTable;
public Dictionary<int, string> ClilocTable
{
get { return _ClilocTable; }
set
{
if (_ClilocTable != value)
{
_ClilocTable = value;
Packet.Release(ref _PropertyList);
}
}
}
public Spoof()
: base(NewUID, Point3D.Zero, Map.Internal)
{ }
}
public static string StripHtmlBreaks(string str, bool preserve)
{
return Regex.Replace(str, @"<br[^>]?>", preserve ? "\n" : " ", RegexOptions.IgnoreCase);
}
#endregion
}
}

View File

@@ -0,0 +1,169 @@
using System;
using System.Collections;
using Server.Network;
namespace Server.Gumps
{
public class ImageTileButtonInfo
{
private int m_ItemID;
private int m_Hue;
private int m_LocalizedTooltip;
private TextDefinition m_Label;
public ImageTileButtonInfo(int itemID, int hue, TextDefinition label, int localizedTooltip)
{
this.m_Hue = hue;
this.m_ItemID = itemID;
this.m_Label = label;
this.m_LocalizedTooltip = localizedTooltip;
}
public ImageTileButtonInfo(int itemID, int hue, TextDefinition label)
: this(itemID, hue, label, -1)
{
}
public virtual int ItemID
{
get
{
return this.m_ItemID;
}
set
{
this.m_ItemID = value;
}
}
public virtual int Hue
{
get
{
return this.m_Hue;
}
set
{
this.m_Hue = value;
}
}
public virtual int LocalizedTooltip
{
get
{
return this.m_LocalizedTooltip;
}
set
{
this.m_LocalizedTooltip = value;
}
}
public virtual TextDefinition Label
{
get
{
return this.m_Label;
}
set
{
this.m_Label = value;
}
}
}
public class BaseImageTileButtonsGump : Gump
{
private readonly ImageTileButtonInfo[] m_Buttons;
public BaseImageTileButtonsGump(TextDefinition header, ArrayList buttons)
: this(header, (ImageTileButtonInfo[])buttons.ToArray(typeof(ImageTileButtonInfo)))
{
}
public BaseImageTileButtonsGump(TextDefinition header, ImageTileButtonInfo[] buttons)
: base(10, 10)//Coords are 0, o on OSI, intentional difference
{
this.m_Buttons = buttons;
this.AddPage(0);
int x = this.XItems * 250;
int y = this.YItems * 64;
this.AddBackground(0, 0, x + 20, y + 84, 0x13BE);
this.AddImageTiled(10, 10, x, 20, 0xA40);
this.AddImageTiled(10, 40, x, y + 4, 0xA40);
this.AddImageTiled(10, y + 54, x, 20, 0xA40);
this.AddAlphaRegion(10, 10, x, y + 64);
this.AddButton(10, y + 54, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0); //Cancel Button
this.AddHtmlLocalized(45, y + 56, x - 50, 20, 1060051, 0x7FFF, false, false); // CANCEL
TextDefinition.AddHtmlText(this, 14, 12, x, 20, header, false, false, 0x7FFF, 0xFFFFFF);
this.AddPage(1);
int itemsPerPage = this.XItems * this.YItems;
for (int i = 0; i < buttons.Length; i++)
{
int position = i % itemsPerPage;
int innerX = (position % this.XItems) * 250 + 14;
int innerY = (position / this.XItems) * 64 + 44;
int pageNum = i / itemsPerPage + 1;
if (position == 0 && i != 0)
{
this.AddButton(x - 100, y + 54, 0xFA5, 0xFA7, 0, GumpButtonType.Page, pageNum);
this.AddHtmlLocalized(x - 60, y + 56, 60, 20, 1043353, 0x7FFF, false, false); // Next
this.AddPage(pageNum);
this.AddButton(x - 200, y + 54, 0xFAE, 0xFB0, 0, GumpButtonType.Page, pageNum - 1);
this.AddHtmlLocalized(x - 160, y + 56, 60, 20, 1011393, 0x7FFF, false, false); // Back
}
ImageTileButtonInfo b = buttons[i];
this.AddImageTiledButton(innerX, innerY, 0x918, 0x919, 100 + i, GumpButtonType.Reply, 0, b.ItemID, b.Hue, 15, 10, b.LocalizedTooltip);
TextDefinition.AddHtmlText(this, innerX + 84, innerY, 250, 60, b.Label, false, false, 0x7FFF, 0xFFFFFF);
}
}
protected ImageTileButtonInfo[] Buttons
{
get
{
return this.m_Buttons;
}
}
protected virtual int XItems
{
get
{
return 2;
}
}
protected virtual int YItems
{
get
{
return 5;
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
int adjustedID = info.ButtonID - 100;
if (adjustedID >= 0 && adjustedID < this.Buttons.Length)
this.HandleButtonResponse(sender, adjustedID, this.Buttons[adjustedID]);
else
this.HandleCancel(sender);
}
public virtual void HandleButtonResponse(NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo)
{
}
public virtual void HandleCancel(NetState sender)
{
}
}
}

View File

@@ -0,0 +1,247 @@
using Server;
using System;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Items;
using System.Linq;
namespace Server.Gumps
{
public abstract class BaseRewardGump : Gump
{
public int Index { get; private set; }
public Mobile Owner { get; private set; }
public PlayerMobile User { get; private set; }
public int Page { get; private set; }
public int Title { get; private set; }
public double Points { get; protected set; }
public List<CollectionItem> Collection { get; protected set; }
public virtual int PointsName { get { return 1072843; } } // Your Reward Points:
public virtual int RewardLabel { get { return 1072844; } } // Please Choose a Reward:
public BaseRewardGump(Mobile owner, PlayerMobile user, List<CollectionItem> col, int title, double points = -1.0)
: base(50, 50)
{
user.CloseGump(typeof(BaseRewardGump));
Owner = owner;
User = user;
Collection = col;
Title = title;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage(0);
AddImage(0, 0, 0x1F40);
AddImageTiled(20, 37, 300, 308, 0x1F42);
AddImage(20, 325, 0x1F43);
AddImage(35, 8, 0x39);
AddImageTiled(65, 8, 257, 10, 0x3A);
AddImage(290, 8, 0x3B);
AddImage(32, 33, 0x2635);
AddImageTiled(70, 55, 230, 2, 0x23C5);
Index = 0;
Page = 1;
if (points == -1)
Points = GetPoints(user);
else
Points = points;
AddHtmlLocalized(70, 35, 270, 20, Title, 0x1, false, false);
AddHtmlLocalized(50, 65, 150, 20, PointsName, 0x1, false, false);
AddPoints();
AddImageTiled(35, 85, 270, 2, 0x23C5);
AddHtmlLocalized(35, 90, 270, 20, RewardLabel, 0x1, false, false);
while (Collection != null && Index < Collection.Count)
DisplayRewardPage();
}
public virtual int GetYOffset(int id)
{
return 10;
}
protected virtual void AddPoints()
{
AddLabel(230, 65, 0x64, String.Format(((int)Points).ToString()));
}
public void DisplayRewardPage()
{
AddPage(Page);
int offset = 110;
int next = 0;
int max = GetMax();
while (offset + next < 320 && Index < Collection.Count)
{
CollectionItem item = Collection[Index];
int height = Math.Max(item.Height, 20);
if (Points >= item.Points)
{
AddButton(35, offset + (int)(height / 2) - 5, 0x837, 0x838, 200 + Index, GumpButtonType.Reply, 0);
AddTooltip(item.Tooltip);
}
int y = offset - item.Y;
if (item.Height < 20)
y += (20 - item.Height) / 2;
Item i = null;
if (Owner.Backpack != null && item.Type != null)
i = Owner.Backpack.FindItemByType(item.Type);
int hue = GetItemHue(i, item);
AddItem(55 - item.X + max / 2 - item.Width / 2, y, item.ItemID, hue);
if (i != null)
AddItemProperty(i.Serial);
else if (item.Tooltip > 0)
AddTooltip(item.Tooltip);
AddLabel(80 + max, offset + (int)(height / 2) - 10, Points >= item.Points ? 0x64 : 0x21, item.Points.ToString("N0"));
offset += GetYOffset(item.ItemID) + height;
Index++;
if (Index < Collection.Count)
next = Math.Max(Collection[Index].Height, 20);
else
next = 0;
}
if (Page > 1)
{
AddButton(150, 335, 0x15E3, 0x15E7, 0, GumpButtonType.Page, Page - 1);
AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
}
Page++;
if (Index < Collection.Count)
{
AddButton(300, 335, 0x15E1, 0x15E5, 0, GumpButtonType.Page, Page);
AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
}
}
public override void OnResponse(Server.Network.NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
if(info.ButtonID >= 200 && from is PlayerMobile)
{
CollectionItem item = Collection[info.ButtonID - 200];
double points = GetPoints(from);
if(item != null && item.Points <= points)
{
from.SendGump(new aConfirmRewardGump(Owner, item, info.ButtonID - 200, OnConfirmed));
}
else
from.SendLocalizedMessage(1073122); // You don't have enough points for that!
}
}
public abstract double GetPoints(Mobile m);
public virtual void RemovePoints(double points)
{
}
public virtual void OnConfirmed(CollectionItem citem, int index)
{
Item item = Activator.CreateInstance(citem.Type) as Item;
if (item != null)
{
if (User.Backpack == null || !User.Backpack.TryDropItem(User, item, false))
{
User.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack.
item.Delete();
}
else
{
OnItemCreated(item);
User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
RemovePoints(citem.Points);
User.PlaySound(0x5A7);
}
}
}
public virtual void OnItemCreated(Item item)
{
}
public virtual int GetItemHue(Item i, CollectionItem item)
{
int hue = 0x3E9;
if (Points >= item.Points)
hue = item.Hue;
return hue;
}
public virtual int GetMax()
{
int max = 0;
if (Collection != null)
{
for (int i = 0; i < Collection.Count; i++)
{
if (max < Collection[i].Width)
max = Collection[i].Width;
}
}
return max;
}
}
public class aConfirmRewardGump : BaseConfirmGump
{
public override int TitleNumber { get { return 1074974; } }
public override int LabelNumber { get { return 1074975; } }
public Mobile Owner { get; set; }
public int Index { get; set; }
public CollectionItem Item { get; set; }
public Action<CollectionItem, int> ConfirmCallback { get; set; }
public aConfirmRewardGump(Mobile owner, CollectionItem item, int index, Action<CollectionItem, int> callback)
{
Item = item;
Index = index;
Owner = owner;
ConfirmCallback = callback;
}
public override void Confirm(Mobile from)
{
if (from.InRange(Owner.Location, 5) && Item != null)
{
if (ConfirmCallback != null)
ConfirmCallback(Item, Index);
}
}
}
}

View File

@@ -0,0 +1,92 @@
using Server;
using System;
namespace Server.Gumps
{
public class BasicInfoGump : Gump
{
public BasicInfoGump(TextDefinition body)
: this(body, null)
{
}
public BasicInfoGump(TextDefinition body, TextDefinition title)
: this(body, title, 300, 450)
{
}
public BasicInfoGump(TextDefinition body, TextDefinition title, int length, int height)
: base(20, 20)
{
AddBackground(0, 0, length, height, 9200);
if (title != null)
{
AddImageTiled(10, 10, length - 20, 20, 2702);
AddImageTiled(10, 40, length - 20, height - 50, 2702);
if (title.Number > 0)
AddHtmlLocalized(12, 10, 275, 20, title.Number, 0xFFFFFF, false, false);
else if (title.String != null)
AddHtml(12, 10, 275, 20, String.Format("<BASEFONT COLOR=WHITE>{0}</BASEFONT>", title.String), false, false);
if (body.Number > 0)
AddHtmlLocalized(12, 40, 275, height - 60, body.Number, 0xFFFFFF, false, false);
else if (body.String != null)
AddHtml(12, 40, 275, height - 60, String.Format("<BASEFONT COLOR=WHITE>{0}</BASEFONT>", body.String), false, false);
}
else
{
AddImageTiled(10, 10, length - 20, height - 20, 2702);
if (body.Number > 0)
AddHtmlLocalized(12, 10, 275, height - 25, (int)body, 0xFFFFFF, false, false);
else if (body.String != null)
AddHtml(12, 10, 275, height - 25, String.Format("<BASEFONT COLOR=WHITE>{0}</BASEFONT>", body.String), false, false);
}
}
}
public class BasicConfirmGump<T> : Gump
{
private readonly Action<Mobile, T> m_ConfirmCallback;
private readonly Action<Mobile, T> m_CancelCallback;
private readonly T m_State;
public BasicConfirmGump(TextDefinition warning, Action<Mobile, T> confirmcallback, T state, Action<Mobile, T> cancelcallback = null, int width = 290, int height = 95)
: base(100, 100)
{
m_ConfirmCallback = confirmcallback;
m_CancelCallback = cancelcallback;
m_State = state;
AddBackground(0, 0, width, height, 9200);
AddImageTiled(5, 5, width - 10, height - 30, 2702);
AddHtmlLocalized(40, height - 25, 100, 20, 1011012, 0xFFFF, false, false);
AddButton(5, height - 25, 0xFB1, 0xFB2, 1, GumpButtonType.Reply, 0);
AddHtml(225, height - 25, 100, 20, "<basefont color=#FFFFFF>OK", false, false);
AddButton(190, height - 25, 0xFB1, 0xFB2, 2, GumpButtonType.Reply, 0);
if (warning.Number > 0)
AddHtmlLocalized(10, 10, width - 20, height - 50, warning.Number, 0xFFFF, false, false);
else
AddHtml(10, 10, width - 20, height - 50, String.Format("<BASEFONT COLOR=#FFFFFF>{0}</BASEFONT>", warning.String), false, true);
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
Mobile m = sender.Mobile;
if (info.ButtonID == 1 && m_CancelCallback != null)
{
m_CancelCallback(m, m_State);
}
else if (info.ButtonID == 2 && m_ConfirmCallback != null)
{
m_ConfirmCallback(m, m_State);
}
}
}
}

View File

@@ -0,0 +1,419 @@
using System;
using System.Collections;
using System.IO;
using System.Xml;
using Server.Commands;
using Server.Network;
namespace Server.Gumps
{
public abstract class CAGNode
{
public abstract string Caption { get; }
public abstract void OnClick(Mobile from, int page);
}
public class CAGObject : CAGNode
{
private readonly Type m_Type;
private readonly int m_ItemID;
private readonly int m_Hue;
private readonly CAGCategory m_Parent;
public CAGObject(CAGCategory parent, XmlTextReader xml)
{
this.m_Parent = parent;
if (xml.MoveToAttribute("type"))
this.m_Type = ScriptCompiler.FindTypeByFullName(xml.Value, false);
if (xml.MoveToAttribute("gfx"))
this.m_ItemID = XmlConvert.ToInt32(xml.Value);
if (xml.MoveToAttribute("hue"))
this.m_Hue = XmlConvert.ToInt32(xml.Value);
}
public Type Type
{
get
{
return this.m_Type;
}
}
public int ItemID
{
get
{
return this.m_ItemID;
}
}
public int Hue
{
get
{
return this.m_Hue;
}
}
public CAGCategory Parent
{
get
{
return this.m_Parent;
}
}
public override string Caption
{
get
{
return (this.m_Type == null ? "bad type" : this.m_Type.Name);
}
}
public override void OnClick(Mobile from, int page)
{
if (this.m_Type == null)
{
from.SendMessage("That is an invalid type name.");
}
else
{
CommandSystem.Handle(from, String.Format("{0}Add {1}", CommandSystem.Prefix, this.m_Type.Name));
from.SendGump(new CategorizedAddGump(from, this.m_Parent, page));
}
}
}
public class CAGCategory : CAGNode
{
private static CAGCategory m_Root;
private readonly string m_Title;
private readonly CAGNode[] m_Nodes;
private readonly CAGCategory m_Parent;
public CAGCategory(CAGCategory parent, XmlTextReader xml)
{
this.m_Parent = parent;
if (xml.MoveToAttribute("title"))
this.m_Title = xml.Value;
else
this.m_Title = "empty";
if (this.m_Title == "Docked")
this.m_Title = "Docked 2";
if (xml.IsEmptyElement)
{
this.m_Nodes = new CAGNode[0];
}
else
{
ArrayList nodes = new ArrayList();
while (xml.Read() && xml.NodeType != XmlNodeType.EndElement)
{
if (xml.NodeType == XmlNodeType.Element && xml.Name == "object")
nodes.Add(new CAGObject(this, xml));
else if (xml.NodeType == XmlNodeType.Element && xml.Name == "category")
{
if (!xml.IsEmptyElement)
nodes.Add(new CAGCategory(this, xml));
}
else
xml.Skip();
}
this.m_Nodes = (CAGNode[])nodes.ToArray(typeof(CAGNode));
}
}
private CAGCategory()
{
this.m_Title = "no data";
this.m_Nodes = new CAGNode[0];
}
public static CAGCategory Root
{
get
{
if (m_Root == null)
m_Root = Load("Data/objects.xml");
return m_Root;
}
}
public string Title
{
get
{
return this.m_Title;
}
}
public CAGNode[] Nodes
{
get
{
return this.m_Nodes;
}
}
public CAGCategory Parent
{
get
{
return this.m_Parent;
}
}
public override string Caption
{
get
{
return this.m_Title;
}
}
public static CAGCategory Load(string path)
{
if (File.Exists(path))
{
XmlTextReader xml = new XmlTextReader(path);
xml.WhitespaceHandling = WhitespaceHandling.None;
while (xml.Read())
{
if (xml.Name == "category" && xml.NodeType == XmlNodeType.Element)
{
CAGCategory cat = new CAGCategory(null, xml);
xml.Close();
return cat;
}
}
}
return new CAGCategory();
}
public override void OnClick(Mobile from, int page)
{
from.SendGump(new CategorizedAddGump(from, this, 0));
}
}
public class CategorizedAddGump : Gump
{
public static readonly int EntryHeight = 24;//PropsConfig.EntryHeight;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int BorderSize = PropsConfig.BorderSize;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY + (((EntryHeight - 20) / 2) / 2);
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY + (((EntryHeight - 20) / 2) / 2);
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY + (((EntryHeight - 20) / 2) / 2);
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static bool OldStyle = PropsConfig.OldStyle;
private static readonly bool PrevLabel = false;
private static readonly bool NextLabel = false;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private static readonly int EntryWidth = 180;
private static readonly int EntryCount = 15;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 1));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Owner;
private readonly CAGCategory m_Category;
private int m_Page;
public CategorizedAddGump(Mobile owner)
: this(owner, CAGCategory.Root, 0)
{
}
public CategorizedAddGump(Mobile owner, CAGCategory category, int page)
: base(GumpOffsetX, GumpOffsetY)
{
owner.CloseGump(typeof(WhoGump));
this.m_Owner = owner;
this.m_Category = category;
this.Initialize(page);
}
public void Initialize(int page)
{
this.m_Page = page;
CAGNode[] nodes = this.m_Category.Nodes;
int count = nodes.Length - (page * EntryCount);
if (count < 0)
count = 0;
else if (count > EntryCount)
count = EntryCount;
int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 1));
this.AddPage(0);
this.AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
this.AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight, OffsetGumpID);
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
if (OldStyle)
this.AddImageTiled(x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID);
else
this.AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
if (this.m_Category.Parent != null)
{
this.AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1, GumpButtonType.Reply, 0);
if (PrevLabel)
this.AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
x += PrevWidth + OffsetSize;
int emptyWidth = TotalWidth - (PrevWidth * 2) - NextWidth - (OffsetSize * 5) - (OldStyle ? SetWidth + OffsetSize : 0);
if (!OldStyle)
this.AddImageTiled(x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID);
this.AddHtml(x + TextOffsetX, y + ((EntryHeight - 20) / 2), emptyWidth - TextOffsetX, EntryHeight, String.Format("<center>{0}</center>", this.m_Category.Caption), false, false);
x += emptyWidth + OffsetSize;
if (OldStyle)
this.AddImageTiled(x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID);
else
this.AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
if (page > 0)
{
this.AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2, GumpButtonType.Reply, 0);
if (PrevLabel)
this.AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
this.AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
if ((page + 1) * EntryCount < nodes.Length)
{
this.AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1);
if (NextLabel)
this.AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
for (int i = 0, index = page * EntryCount; i < EntryCount && index < nodes.Length; ++i, ++index)
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
CAGNode node = nodes[index];
this.AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
this.AddLabelCropped(x + TextOffsetX, y + ((EntryHeight - 20) / 2), EntryWidth - TextOffsetX, EntryHeight, TextHue, node.Caption);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
this.AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
this.AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 4, GumpButtonType.Reply, 0);
if (node is CAGObject)
{
CAGObject obj = (CAGObject)node;
int itemID = obj.ItemID;
Rectangle2D bounds = ItemBounds.Table[itemID];
if (itemID != 1 && bounds.Height < (EntryHeight * 2))
{
if (bounds.Height < EntryHeight)
this.AddItem(x - OffsetSize - 22 - ((i % 2) * 44) - (bounds.Width / 2) - bounds.X, y + (EntryHeight / 2) - (bounds.Height / 2) - bounds.Y, itemID);
else
this.AddItem(x - OffsetSize - 22 - ((i % 2) * 44) - (bounds.Width / 2) - bounds.X, y + EntryHeight - 1 - bounds.Height - bounds.Y, itemID);
}
}
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = this.m_Owner;
switch ( info.ButtonID )
{
case 0: // Closed
{
return;
}
case 1: // Up
{
if (this.m_Category.Parent != null)
{
int index = Array.IndexOf(this.m_Category.Parent.Nodes, this.m_Category) / EntryCount;
if (index < 0)
index = 0;
from.SendGump(new CategorizedAddGump(from, this.m_Category.Parent, index));
}
break;
}
case 2: // Previous
{
if (this.m_Page > 0)
from.SendGump(new CategorizedAddGump(from, this.m_Category, this.m_Page - 1));
break;
}
case 3: // Next
{
if ((this.m_Page + 1) * EntryCount < this.m_Category.Nodes.Length)
from.SendGump(new CategorizedAddGump(from, this.m_Category, this.m_Page + 1));
break;
}
default:
{
int index = (this.m_Page * EntryCount) + (info.ButtonID - 4);
if (index >= 0 && index < this.m_Category.Nodes.Length)
this.m_Category.Nodes[index].OnClick(from, this.m_Page);
break;
}
}
}
}
}

297
Scripts/Gumps/ClientGump.cs Normal file
View File

@@ -0,0 +1,297 @@
using System;
using Server.Accounting;
using Server.Commands;
using Server.Commands.Generic;
using Server.Mobiles;
using Server.Network;
using Server.Targets;
namespace Server.Gumps
{
public class ClientGump : Gump
{
private const int LabelColor32 = 0xFFFFFF;
private readonly NetState m_State;
public ClientGump(Mobile from, NetState state)
: this(from, state, "")
{
}
public ClientGump(Mobile from, NetState state, string initialText)
: base(30, 20)
{
if (state == null)
return;
this.m_State = state;
this.AddPage(0);
this.AddBackground(0, 0, 400, 274, 5054);
this.AddImageTiled(10, 10, 380, 19, 0xA40);
this.AddAlphaRegion(10, 10, 380, 19);
this.AddImageTiled(10, 32, 380, 232, 0xA40);
this.AddAlphaRegion(10, 32, 380, 232);
this.AddHtml(10, 10, 380, 20, this.Color(this.Center("User Information"), LabelColor32), false, false);
int line = 0;
this.AddHtml(14, 36 + (line * 20), 200, 20, this.Color("Address:", LabelColor32), false, false);
this.AddHtml(70, 36 + (line++ * 20), 200, 20, this.Color(state.ToString(), LabelColor32), false, false);
this.AddHtml(14, 36 + (line * 20), 200, 20, this.Color("Client:", LabelColor32), false, false);
this.AddHtml(70, 36 + (line++ * 20), 200, 20, this.Color(state.Version == null ? "(null)" : state.Version.ToString(), LabelColor32), false, false);
this.AddHtml(14, 36 + (line * 20), 200, 20, this.Color("Version:", LabelColor32), false, false);
ExpansionInfo info = state.ExpansionInfo;
string expansionName = info.Name;
this.AddHtml(70, 36 + (line++ * 20), 200, 20, this.Color(expansionName, LabelColor32), false, false);
Account a = state.Account as Account;
Mobile m = state.Mobile;
if (from.AccessLevel >= AccessLevel.GameMaster && a != null)
{
this.AddHtml(14, 36 + (line * 20), 200, 20, this.Color("Account:", LabelColor32), false, false);
this.AddHtml(70, 36 + (line++ * 20), 200, 20, this.Color(a.Username, LabelColor32), false, false);
}
if (m != null)
{
this.AddHtml(14, 36 + (line * 20), 200, 20, this.Color("Mobile:", LabelColor32), false, false);
this.AddHtml(70, 36 + (line++ * 20), 200, 20, this.Color(String.Format("{0} (0x{1:X})", m.Name, m.Serial.Value), LabelColor32), false, false);
this.AddHtml(14, 36 + (line * 20), 200, 20, this.Color("Location:", LabelColor32), false, false);
this.AddHtml(70, 36 + (line++ * 20), 200, 20, this.Color(String.Format("{0} [{1}]", m.Location, m.Map), LabelColor32), false, false);
this.AddButton(13, 157, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0);
this.AddHtml(48, 158, 200, 20, this.Color("Send Message", LabelColor32), false, false);
this.AddImageTiled(12, 182, 376, 80, 0xA40);
this.AddImageTiled(13, 183, 374, 78, 0xBBC);
this.AddTextEntry(15, 183, 372, 78, 0x480, 0, "");
this.AddImageTiled(245, 35, 142, 144, 5058);
this.AddImageTiled(246, 36, 140, 142, 0xA40);
this.AddAlphaRegion(246, 36, 140, 142);
line = 0;
if (BaseCommand.IsAccessible(from, m))
{
this.AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
this.AddHtml(280, 38 + (line++ * 20), 100, 20, this.Color("Properties", LabelColor32), false, false);
}
if (from != m)
{
this.AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0);
this.AddHtml(280, 38 + (line++ * 20), 100, 20, this.Color("Go to them", LabelColor32), false, false);
this.AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 6, GumpButtonType.Reply, 0);
this.AddHtml(280, 38 + (line++ * 20), 100, 20, this.Color("Bring them here", LabelColor32), false, false);
}
this.AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 7, GumpButtonType.Reply, 0);
this.AddHtml(280, 38 + (line++ * 20), 100, 20, this.Color("Move to target", LabelColor32), false, false);
if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > m.AccessLevel)
{
this.AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 8, GumpButtonType.Reply, 0);
this.AddHtml(280, 38 + (line++ * 20), 100, 20, this.Color("Disconnect", LabelColor32), false, false);
if (m.Alive)
{
this.AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 9, GumpButtonType.Reply, 0);
this.AddHtml(280, 38 + (line++ * 20), 100, 20, this.Color("Kill", LabelColor32), false, false);
}
else
{
this.AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 10, GumpButtonType.Reply, 0);
this.AddHtml(280, 38 + (line++ * 20), 100, 20, this.Color("Resurrect", LabelColor32), false, false);
}
}
if (from.IsStaff() && from.AccessLevel > m.AccessLevel)
{
this.AddButton(246, 36 + (line * 20), 0xFA5, 0xFA7, 11, GumpButtonType.Reply, 0);
this.AddHtml(280, 38 + (line++ * 20), 100, 20, this.Color("Skills browser", LabelColor32), false, false);
}
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (this.m_State == null)
return;
Mobile focus = this.m_State.Mobile;
Mobile from = state.Mobile;
if (focus == null)
{
from.SendMessage("That character is no longer online.");
return;
}
else if (focus.Deleted)
{
from.SendMessage("That character no longer exists.");
return;
}
else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel && (!(focus is PlayerMobile) || !((PlayerMobile)focus).VisibilityList.Contains(from)))
{
from.SendMessage("That character is no longer visible.");
return;
}
switch ( info.ButtonID )
{
case 1: // Tell
{
TextRelay text = info.GetTextEntry(0);
if (text != null)
{
focus.SendMessage(0x482, "{0} tells you:", from.Name);
focus.SendMessage(0x482, text.Text);
CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
}
from.SendGump(new ClientGump(from, this.m_State));
break;
}
case 4: // Props
{
this.Resend(from, info);
if (!BaseCommand.IsAccessible(from, focus))
from.SendMessage("That is not accessible.");
else
{
from.SendGump(new PropertiesGump(from, focus));
CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
}
break;
}
case 5: // Go to
{
if (focus.Map == null || focus.Map == Map.Internal)
{
from.SendMessage("That character is not in the world.");
}
else
{
from.MoveToWorld(focus.Location, focus.Map);
this.Resend(from, info);
CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map);
}
break;
}
case 6: // Get
{
if (from.Map == null || from.Map == Map.Internal)
{
from.SendMessage("You cannot bring that person here.");
}
else
{
focus.MoveToWorld(from.Location, from.Map);
this.Resend(from, info);
CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map);
}
break;
}
case 7: // Move
{
from.Target = new MoveTarget(focus);
this.Resend(from, info);
break;
}
case 8: // Kick
{
if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
{
focus.Say("I've been kicked!");
this.m_State.Dispose();
CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
}
break;
}
case 9: // Kill
{
if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
{
focus.Kill();
CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
}
this.Resend(from, info);
break;
}
case 10: //Res
{
if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
{
focus.PlaySound(0x214);
focus.FixedEffect(0x376A, 10, 16);
focus.Resurrect();
CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
}
this.Resend(from, info);
break;
}
case 11: // Skills
{
this.Resend(from, info);
if (from.AccessLevel > focus.AccessLevel)
{
from.SendGump(new SkillsGump(from, (Mobile)focus));
CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
}
break;
}
}
}
public string Center(string text)
{
return String.Format("<CENTER>{0}</CENTER>", text);
}
public string Color(string text, int color)
{
return String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text);
}
private void Resend(Mobile to, RelayInfo info)
{
TextRelay te = info.GetTextEntry(0);
to.SendGump(new ClientGump(to, this.m_State, te == null ? "" : te.Text));
}
}
}

View File

@@ -0,0 +1,54 @@
using System;
using Server.Items;
using Server.Mobiles;
using Server.Network;
namespace Server.Gumps
{
public class ConfirmBreakCrystalGump : BaseConfirmGump
{
private readonly BaseImprisonedMobile m_Item;
public ConfirmBreakCrystalGump(BaseImprisonedMobile item)
: base()
{
m_Item = item;
}
public override int LabelNumber { get { return 1075084; } } // This statuette will be destroyed when its trapped creature is summoned. The creature will be bonded to you but will disappear if released. <br><br>Do you wish to proceed?
public override void Confirm(Mobile from)
{
if (m_Item == null || m_Item.Deleted)
return;
BaseCreature summon = m_Item.Summon;
if (summon != null)
{
if (!summon.SetControlMaster(from))
{
summon.Delete();
}
else
{
summon.MoveToWorld(from.Location, from.Map);
summon.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, from.NetState); // It seems to accept you as master.
summon.IsBonded = true;
from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
summon.Skills.Wrestling.Base = 100;
summon.Skills.Tactics.Base = 100;
summon.Skills.MagicResist.Base = 100;
summon.Skills.Anatomy.Base = 100;
Effects.PlaySound(summon.Location, summon.Map, summon.BaseSoundID);
Effects.SendLocationParticles(EffectItem.Create(summon.Location, summon.Map, EffectItem.DefaultDuration), 0x3728, 1, 10, 0x26B6);
m_Item.Release(from, summon);
m_Item.Delete();
}
}
}
}
}

View File

@@ -0,0 +1,251 @@
using System;
using Server;
using Server.Mobiles;
using Server.Items;
using Server.Network;
namespace Server.Gumps
{
public class ConfirmCallbackGump : BaseGump
{
public Action<Mobile, object> ConfirmCallback { get; set; }
public Action<Mobile, object> CloseCallback { get; set; }
public TextDefinition Title { get; set; }
public TextDefinition Body { get; set; }
public object State { get; set; }
public string Arguments { get; set; }
public int ConfirmLocalization { get; private set; }
public int CloseLocalization { get; private set; }
public ConfirmCallbackGump(
PlayerMobile user,
TextDefinition title,
TextDefinition body,
object state,
string args = null,
Action<Mobile, object> confirm = null,
Action<Mobile, object> close = null,
int x = 20,
int y = 20,
int confirmLoc = 1074976,
int closeLoc = 1074977)
: base(user, x, y)
{
Title = title;
Body = body;
State = state;
Arguments = args;
ConfirmCallback = confirm;
CloseCallback = close;
ConfirmLocalization = confirmLoc;
CloseLocalization = closeLoc;
if(!Open)
AddGumpLayout();
}
public override void AddGumpLayout()
{
AddImageTiled( 0, 0, 348, 262, 0xA8E );
AddAlphaRegion( 0, 0, 348, 262 );
AddImage( 0, 15, 0x27A8 );
AddImageTiled( 0, 30, 17, 200, 0x27A7 );
AddImage( 0, 230, 0x27AA );
AddImage( 15, 0, 0x280C );
AddImageTiled( 30, 0, 300, 17, 0x280A );
AddImage( 315, 0, 0x280E );
AddImage( 15, 244, 0x280C );
AddImageTiled( 30, 244, 300, 17, 0x280A );
AddImage( 315, 244, 0x280E );
AddImage( 330, 15, 0x27A8 );
AddImageTiled( 330, 30, 17, 200, 0x27A7 );
AddImage( 330, 230, 0x27AA );
AddImage( 333, 2, 0x2716 );
AddImage( 333, 248, 0x2716 );
AddImage( 2, 248, 0x2716 );
AddImage( 2, 2, 0x2716 );
if (Title != null)
{
if (Title.Number > 0)
{
AddHtmlLocalized(25, 25, 200, 20, Title.Number, 0x7D00, false, false);
}
else if (!String.IsNullOrEmpty(Title.String))
{
AddHtml(25, 25, 200, 20, String.Format("<basefont color=#FF0000>{0}", Title.String), false, false);
}
}
AddImage( 25, 45, 0xBBF );
if (Body.Number > 0)
{
if (Arguments != null)
{
AddHtmlLocalized(25, 55, 300, 120, Body.Number, Arguments, 0xFFFFFF, false, false);
}
else
{
AddHtmlLocalized(25, 55, 300, 120, Body.Number, 0xFFFFFF, false, false);
}
}
else if (!String.IsNullOrEmpty(Body.String))
{
AddHtml(25, 55, 300, 120, String.Format("<BASEFONT COLOR=#FFFFFF>{0}</BASEFONT>", Body.String), false, false);
}
AddRadio( 25, 175, 0x25F8, 0x25FB, true, 1);
AddRadio( 25, 210, 0x25F8, 0x25FB, false, 2);
AddHtmlLocalized(60, 180, 280, 20, ConfirmLocalization, 0xFFFFFF, false, false); // Yes
AddHtmlLocalized(60, 215, 280, 20, CloseLocalization, 0xFFFFFF, false, false); // No
AddButton(265, 220, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID != 1)
return;
bool confirm = info.IsSwitched(1);
if (confirm)
{
if (ConfirmCallback != null)
{
ConfirmCallback(User, State);
}
}
else if (CloseCallback != null)
{
CloseCallback(User, State);
}
}
}
public class GenericConfirmCallbackGump<T> : BaseGump
{
public Action<Mobile, T> ConfirmCallback { get; set; }
public Action<Mobile, T> CloseCallback { get; set; }
public TextDefinition Title { get; set; }
public TextDefinition Body { get; set; }
public T State { get; set; }
public string Arguments { get; set; }
public int ConfirmLocalization { get; private set; }
public int CloseLocalization { get; private set; }
public GenericConfirmCallbackGump(
PlayerMobile user,
TextDefinition title,
TextDefinition body,
T state,
string args = null,
Action<Mobile, T> confirm = null,
Action<Mobile, T> close = null,
int x = 20,
int y = 20,
int confirmLoc = 1074976,
int closeLoc = 1074977)
: base(user, x, y)
{
Title = title;
Body = body;
State = state;
Arguments = args;
ConfirmCallback = confirm;
CloseCallback = close;
ConfirmLocalization = confirmLoc;
CloseLocalization = closeLoc;
if (!Open)
AddGumpLayout();
}
public override void AddGumpLayout()
{
AddImageTiled(0, 0, 348, 262, 0xA8E);
AddAlphaRegion(0, 0, 348, 262);
AddImage(0, 15, 0x27A8);
AddImageTiled(0, 30, 17, 200, 0x27A7);
AddImage(0, 230, 0x27AA);
AddImage(15, 0, 0x280C);
AddImageTiled(30, 0, 300, 17, 0x280A);
AddImage(315, 0, 0x280E);
AddImage(15, 244, 0x280C);
AddImageTiled(30, 244, 300, 17, 0x280A);
AddImage(315, 244, 0x280E);
AddImage(330, 15, 0x27A8);
AddImageTiled(330, 30, 17, 200, 0x27A7);
AddImage(330, 230, 0x27AA);
AddImage(333, 2, 0x2716);
AddImage(333, 248, 0x2716);
AddImage(2, 248, 0x2716);
AddImage(2, 2, 0x2716);
if (Title.Number > 0)
{
AddHtmlLocalized(25, 25, 200, 20, Title.Number, 0x7D00, false, false);
}
else if (!String.IsNullOrEmpty(Title.String))
{
AddHtml(25, 25, 200, 20, String.Format("<basefont color=#FF0000>{0}", Title.String), false, false);
}
AddImage(25, 45, 0xBBF);
if (Body.Number > 0)
{
if (Arguments != null)
{
AddHtmlLocalized(25, 55, 300, 120, Body.Number, Arguments, 0xFFFFFF, false, false);
}
else
{
AddHtmlLocalized(25, 55, 300, 120, Body.Number, 0xFFFFFF, false, false);
}
}
else if (!String.IsNullOrEmpty(Body.String))
{
AddHtml(25, 55, 300, 120, String.Format("<BASEFONT COLOR=#FFFFFF>{0}</BASEFONT>", Body.String), false, false);
}
AddRadio(25, 175, 0x25F8, 0x25FB, true, 1);
AddRadio(25, 210, 0x25F8, 0x25FB, false, 2);
AddHtmlLocalized(60, 180, 280, 20, ConfirmLocalization, 0xFFFFFF, false, false); // Yes
AddHtmlLocalized(60, 215, 280, 20, CloseLocalization, 0xFFFFFF, false, false); // No
AddButton(265, 220, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID != 1)
return;
bool confirm = info.IsSwitched(1);
if (confirm)
{
if (ConfirmCallback != null)
{
ConfirmCallback(User, State);
}
}
else if (CloseCallback != null)
{
CloseCallback(User, State);
}
}
}
}

View File

@@ -0,0 +1,81 @@
using System;
using Server.Items;
using Server.Network;
namespace Server.Gumps
{
public class ConfirmHeritageGump : Gump
{
private readonly HeritageToken m_Token;
private readonly Type[] m_Selected;
private readonly Mobile m_User;
public ConfirmHeritageGump(HeritageToken token, Type[] selected, int cliloc, Mobile from)
: base(60, 36)
{
this.m_Token = token;
this.m_Selected = selected;
this.m_User = from;
this.AddPage(0);
this.AddBackground(0, 0, 291, 99, 0x13BE);
this.AddImageTiled(5, 6, 280, 20, 0xA40);
this.AddHtmlLocalized(9, 8, 280, 20, 1070972, 0x7FFF, false, false); // Click "OKAY" to redeem the following promotional item:
this.AddImageTiled(5, 31, 280, 40, 0xA40);
this.AddHtmlLocalized(9, 35, 272, 40, cliloc, 0x7FFF, false, false);
this.AddButton(180, 73, 0xFB7, 0xFB8, (int)Buttons.Okay, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(215, 75, 100, 20, 1011036, 0x7FFF, false, false); // OKAY
this.AddButton(5, 73, 0xFB1, 0xFB2, (int)Buttons.Cancel, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(40, 75, 100, 20, 1060051, 0x7FFF, false, false); // CANCEL
}
private enum Buttons
{
Cancel,
Okay
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (this.m_Token == null || this.m_Token.Deleted ||
this.m_User == null || this.m_User.Deleted)
return;
if (!this.m_Token.IsChildOf(this.m_User.Backpack))
{
sender.Mobile.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
return;
}
switch ( info.ButtonID )
{
case (int)Buttons.Okay:
Item item = null;
foreach (Type type in this.m_Selected)
{
try
{
item = Activator.CreateInstance(type) as Item;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}
if (item != null)
{
this.m_Token.Delete();
sender.Mobile.AddToBackpack(item);
}
}
break;
case (int)Buttons.Cancel:
sender.Mobile.SendGump(new HeritageTokenGump(this.m_Token, this.m_User));
break;
}
}
}
}

View File

@@ -0,0 +1,166 @@
using System;
using Server.Items;
using Server.Multis;
using Server.Network;
using Server.Mobiles;
namespace Server.Gumps
{
public class ConfirmHouseResize : Gump
{
private readonly Mobile m_Mobile;
private readonly BaseHouse m_House;
public ConfirmHouseResize(Mobile mobile, BaseHouse house)
: base(110, 100)
{
m_Mobile = mobile;
m_House = house;
mobile.CloseGump(typeof(ConfirmHouseResize));
Closable = false;
AddPage(0);
AddBackground(0, 0, 420, 280, 0x13BE);
AddImageTiled(10, 10, 400, 20, 0xA40);
AddAlphaRegion(10, 10, 400, 20);
AddHtmlLocalized(10, 10, 400, 20, 1060635, 0x7800, false, false); // <CENTER>WARNING</CENTER>
AddImageTiled(10, 40, 400, 200, 0xA40);
AddAlphaRegion(10, 40, 400, 200);
/* You are attempting to resize your house. You will be refunded the house's
value directly to your bank box. All items in the house will *remain behind*
and can be *freely picked up by anyone*. Once the house is demolished, however,
only this account will be able to place on the land for one hour. This *will*
circumvent the normal 7-day waiting period (if it applies to you). This action
will not un-condemn any other houses on your account. If you have other,
grandfathered houses, this action *WILL* condemn them. Are you sure you wish
to continue?*/
AddHtmlLocalized(10, 40, 400, 200, 1080196, 0x7F00, false, true);
AddImageTiled(10, 250, 400, 20, 0xA40);
AddAlphaRegion(10, 250, 400, 20);
AddButton(10, 250, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
AddButton(210, 250, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(40, 250, 170, 20, 1011036, 0x7FFF, false, false); // OKAY
AddHtmlLocalized(240, 250, 170, 20, 1011012, 0x7FFF, false, false); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1 && !m_House.Deleted)
{
if (m_House.IsOwner(m_Mobile))
{
if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
{
m_Mobile.SendLocalizedMessage(1080455); // You can not resize your house at this time. Please remove all items fom the moving crate and try again.
return;
}
else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null)
{
m_Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
return;
}
/*else if ( m_House.PlayerVendors.Count > 0 )
{
m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
return;
}*/
else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
{
m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
return;
}
else if (m_House.HasRentedVendors)
{
m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house.
return;
}
else if (m_House.VendorInventories.Count > 0)
{
m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
return;
}
if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
{
m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
m_House.RemoveKeys(m_Mobile);
new TempNoHousingRegion(m_House, m_Mobile);
m_House.Delete();
}
else
{
Item toGive = null;
if (m_House.IsAosRules)
{
if (m_House.Price > 0)
{
if (!Core.TOL)
{
toGive = new BankCheck(m_House.Price);
}
else
{
Banker.Deposit(m_Mobile, m_House.Price, true);
m_House.RemoveKeys(m_Mobile);
new TempNoHousingRegion(m_House, m_Mobile);
m_House.Delete();
return;
}
}
else
{
toGive = m_House.GetDeed();
}
}
else
{
toGive = m_House.GetDeed();
if (toGive == null && m_House.Price > 0)
toGive = new BankCheck(m_House.Price);
}
if (toGive != null)
{
BankBox box = m_Mobile.BankBox;
if (box.TryDropItem(m_Mobile, toGive, false))
{
if (toGive is BankCheck)
m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
m_House.RemoveKeys(m_Mobile);
new TempNoHousingRegion(m_House, m_Mobile);
m_House.Delete();
}
else
{
toGive.Delete();
m_Mobile.SendLocalizedMessage(500390); // Your bank box is full.
}
}
else
{
m_Mobile.SendMessage("Unable to refund house.");
}
}
}
else
{
m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do
}
}
else if (info.ButtonID == 0)
{
m_Mobile.CloseGump(typeof(ConfirmHouseResize));
m_Mobile.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Customize, m_Mobile, m_House));
}
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using Server.Mobiles;
using Server.Network;
namespace Server.Gumps
{
public class ConfirmMountStatuetteGump : BaseConfirmGump
{
private readonly Item m_Item;
public ConfirmMountStatuetteGump(Item item)
: base()
{
m_Item = item;
}
public override int LabelNumber { get { return 1075084; } } // This statuette will be destroyed when its trapped creature is summoned. The creature will be bonded to you but will disappear if released. <br><br>Do you wish to proceed?
public override void Confirm(Mobile from)
{
if (m_Item == null || m_Item.Deleted)
return;
BaseCreature m = null;
if (m_Item is ICreatureStatuette)
{
m = Activator.CreateInstance(((ICreatureStatuette)m_Item).CreatureType) as BaseCreature;
}
if (m != null)
{
if ((from.Followers + m.ControlSlots) > from.FollowersMax)
{
m.Delete();
from.SendLocalizedMessage(1114321); // You have too many followers to control that pet.
}
else
{
m.SetControlMaster(from);
m.IsBonded = true;
m.MoveToWorld(from.Location, from.Map);
m_Item.Delete();
PetTrainingHelper.GetAbilityProfile(m, true).OnTame();
Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
{
m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, from.NetState); // It seems to accept you as master.
from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
});
}
}
}
}
}
namespace Server.Mobiles
{
public interface ICreatureStatuette
{
Type CreatureType { get; }
}
}

View File

@@ -0,0 +1,64 @@
using System;
using Server.Mobiles;
using Server.Network;
namespace Server.Gumps
{
public class ConfirmReleaseGump : Gump
{
private readonly Mobile m_From;
private readonly BaseCreature m_Pet;
public ConfirmReleaseGump(Mobile from, BaseCreature pet)
: base(50, 50)
{
m_From = from;
m_Pet = pet;
m_From.CloseGump(typeof(ConfirmReleaseGump));
AddPage(0);
if (pet.Alive)
{
AddBackground(0, 0, 270, 120, 5054);
AddBackground(10, 10, 250, 100, 3000);
AddHtmlLocalized(20, 15, 230, 60, 1046257, true, true); // Are you sure you want to release your pet? Summoned Pets will vanish permanently!
AddButton(20, 80, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 80, 75, 20, 1011011, false, false); // CONTINUE
AddButton(135, 80, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(170, 80, 75, 20, 1011012, false, false); // CANCEL
}
else
{
AddBackground(0, 0, 270, 120, 0x13BE);
AddHtmlLocalized(10, 10, 250, 75, 1049669, true, false); // <div align=center>Releasing a ghost pet will destroy it, with no chance of recovery. Do you wish to continue?</div>
AddHtmlLocalized(55, 90, 75, 20, 1011011, false, false); // CONTINUE
AddButton(20, 90, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(170, 90, 75, 20, 1011012, false, false); // CANCEL
AddButton(135, 90, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (info.ButtonID == 2)
{
if (!m_Pet.Deleted && m_Pet.Controlled && m_From == m_Pet.ControlMaster && m_From.CheckAlive())
{
if (m_Pet.Map == m_From.Map && m_Pet.InRange(m_From, 14))
{
m_Pet.ControlTarget = null;
m_Pet.ControlOrder = OrderType.Release;
}
}
}
}
}
}

View File

@@ -0,0 +1,99 @@
#region References
using Server.Items;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class DawnsMusicBoxGump : Gump
{
private readonly DawnsMusicBox m_Box;
public DawnsMusicBoxGump(DawnsMusicBox box)
: base(60, 36)
{
m_Box = box;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1075130, 0x7FFF, false, false); // Choose a track to play
int page = 1;
int i, y = 49;
AddPage(page);
for (i = 0; i < m_Box.Tracks.Count; i++, y += 24)
{
DawnsMusicInfo info = DawnsMusicBox.GetInfo(m_Box.Tracks[i]);
if (i > 0 && i % 10 == 0)
{
AddButton(228, 294, 0xFA5, 0xFA6, 0, GumpButtonType.Page, page + 1);
AddPage(page + 1);
y = 49;
AddButton(193, 294, 0xFAE, 0xFAF, 0, GumpButtonType.Page, page);
page++;
}
if (info == null)
{
continue;
}
AddButton(19, y, 0x845, 0x846, 100 + i, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, y - 2, 213, 20, info.Name, 0x7FFF, false, false);
}
if (i % 10 == 0)
{
AddButton(228, 294, 0xFA5, 0xFA6, 0, GumpButtonType.Page, page + 1);
AddPage(page + 1);
y = 49;
AddButton(193, 294, 0xFAE, 0xFAF, 0, GumpButtonType.Page, page);
}
AddButton(19, y, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, y - 2, 213, 20, 1075207, 0x7FFF, false, false); // Stop Song
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Box == null || m_Box.Deleted)
{
return;
}
Mobile m = sender.Mobile;
if (!m_Box.IsChildOf(m.Backpack) && !m_Box.IsLockedDown)
{
m.SendLocalizedMessage(1061856); // You must have the item in your backpack or locked down in order to use it.
}
else if (m_Box.IsLockedDown && !m_Box.HasAccces(m))
{
m.SendLocalizedMessage(502691); // You must be the owner to use this.
}
else if (info.ButtonID == 1)
{
m_Box.EndMusic(m);
}
else if (info.ButtonID >= 100 && info.ButtonID - 100 < m_Box.Tracks.Count)
{
m_Box.PlayMusic(m, m_Box.Tracks[info.ButtonID - 100]);
}
}
}
}

130
Scripts/Gumps/FacetGump.cs Normal file
View File

@@ -0,0 +1,130 @@
using System;
using Server.Network;
namespace Server.Gumps
{
public class FacetGump : Gump
{
private Mobile m_Owner;
public FacetGump(Mobile owner)
: base(10, 10)
{
owner.CloseGump(typeof(FacetGump));
int gumpX = 0;
int gumpY = 0;
// bool initialState = false;
this.m_Owner = owner;
this.Closable = true;
this.Disposable = true;
this.Dragable = true;
this.Resizable = false;
this.AddPage(0);
gumpX = 0;
gumpY = 0;
this.AddBackground(gumpX, gumpY, 150, 150, 0xA3C);
gumpX = 30;
gumpY = 10;
this.AddLabel(gumpX, gumpY, 965, "Felucca");
gumpX = 30;
gumpY = 30;
this.AddLabel(gumpX, gumpY, 965, "Trammel");
gumpX = 30;
gumpY = 50;
this.AddLabel(gumpX, gumpY, 965, "Ilshenar");
gumpX = 30;
gumpY = 70;
this.AddLabel(gumpX, gumpY, 965, "Malas");
gumpX = 30;
gumpY = 90;
this.AddLabel(gumpX, gumpY, 965, "Tokuno");
gumpX = 30;
gumpY = 110;
this.AddLabel(gumpX, gumpY, 965, "TerMur");
gumpX = 10;
gumpY = 10;
this.AddButton(gumpX, gumpY, 0xA9A, 0xA9A, 1, GumpButtonType.Reply, 0);
gumpX = 10;
gumpY = 30;
this.AddButton(gumpX, gumpY, 0xA9A, 0xA9A, 2, GumpButtonType.Reply, 0);
gumpX = 10;
gumpY = 50;
this.AddButton(gumpX, gumpY, 0xA9A, 0xA9A, 3, GumpButtonType.Reply, 0);
gumpX = 10;
gumpY = 70;
this.AddButton(gumpX, gumpY, 0xA9A, 0xA9A, 4, GumpButtonType.Reply, 0);
gumpX = 10;
gumpY = 90;
this.AddButton(gumpX, gumpY, 0xA9A, 0xA9A, 5, GumpButtonType.Reply, 0);
gumpX = 10;
gumpY = 110;
this.AddButton(gumpX, gumpY, 0xA9A, 0xA9A, 6, GumpButtonType.Reply, 0);
}
public Mobile Owner
{
get
{
return this.m_Owner;
}
set
{
this.m_Owner = value;
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
switch( info.ButtonID )
{
case 1:
CityInfo city = new CityInfo("Britain", "Town Center", 1475, 1645, 20);
from.MoveToWorld(city.Location, Map.Felucca);
break;
case 2:
CityInfo city1 = new CityInfo("Britain", "Town Center", 1475, 1645, 20);
from.MoveToWorld(city1.Location, Map.Trammel);
break;
case 3:
CityInfo city2 = new CityInfo("Lakeshire", "Town Center", 1203, 1124, -25);
from.MoveToWorld(city2.Location, Map.Ilshenar);
break;
case 4:
CityInfo city3 = new CityInfo("Luna", "Town Center", 989, 519, -50);
from.MoveToWorld(city3.Location, Map.Malas);
break;
case 5:
CityInfo city4 = new CityInfo("Zento", "Town Center", 735, 1257, 30);
from.MoveToWorld(city4.Location, Map.Tokuno);
break;
case 6:
CityInfo city5 = new CityInfo("Test", "Test", 852, 3526, -43);
from.MoveToWorld(city5.Location, Map.TerMur);
break;
}
}
}
}

View File

@@ -0,0 +1,60 @@
using System;
using System.Xml;
namespace Server.Gumps
{
public class ChildNode
{
private readonly ParentNode m_Parent;
private string m_Name;
private Point3D m_Location;
public ChildNode(XmlTextReader xml, ParentNode parent)
{
this.m_Parent = parent;
this.Parse(xml);
}
public ParentNode Parent
{
get
{
return this.m_Parent;
}
}
public string Name
{
get
{
return this.m_Name;
}
}
public Point3D Location
{
get
{
return this.m_Location;
}
}
private void Parse(XmlTextReader xml)
{
if (xml.MoveToAttribute("name"))
this.m_Name = xml.Value;
else
this.m_Name = "empty";
int x = 0, y = 0, z = 0;
if (xml.MoveToAttribute("x"))
x = Utility.ToInt32(xml.Value);
if (xml.MoveToAttribute("y"))
y = Utility.ToInt32(xml.Value);
if (xml.MoveToAttribute("z"))
z = Utility.ToInt32(xml.Value);
this.m_Location = new Point3D(x, y, z);
}
}
}

258
Scripts/Gumps/Go/GoGump.cs Normal file
View File

@@ -0,0 +1,258 @@
using System;
using Server.Network;
namespace Server.Gumps
{
public class GoGump : Gump
{
public static readonly LocationTree Felucca = new LocationTree("felucca.xml", Map.Felucca);
public static readonly LocationTree Trammel = new LocationTree("trammel.xml", Map.Trammel);
public static readonly LocationTree Ilshenar = new LocationTree("ilshenar.xml", Map.Ilshenar);
public static readonly LocationTree Malas = new LocationTree("malas.xml", Map.Malas);
public static readonly LocationTree Tokuno = new LocationTree("tokuno.xml", Map.Tokuno);
#region SA
public static readonly LocationTree TerMur = new LocationTree("termur.xml", Map.TerMur);
#endregion
public static bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly bool PrevLabel = false;
private static readonly bool NextLabel = false;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private static readonly int EntryWidth = 180;
private static readonly int EntryCount = 15;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 1));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
public static void DisplayTo(Mobile from)
{
LocationTree tree;
if (from.Map == Map.Ilshenar)
tree = Ilshenar;
else if (from.Map == Map.Felucca)
tree = Felucca;
else if (from.Map == Map.Trammel)
tree = Trammel;
else if (from.Map == Map.Malas)
tree = Malas;
#region SA
else if (from.Map == Map.Tokuno)
tree = Tokuno;
else
tree = TerMur;
#endregion
ParentNode branch = null;
tree.LastBranch.TryGetValue(from, out branch);
if (branch == null)
branch = tree.Root;
if (branch != null)
from.SendGump(new GoGump(0, from, tree, branch));
}
private readonly LocationTree m_Tree;
private readonly ParentNode m_Node;
private readonly int m_Page;
private GoGump(int page, Mobile from, LocationTree tree, ParentNode node)
: base(50, 50)
{
from.CloseGump(typeof(GoGump));
tree.LastBranch[from] = node;
this.m_Page = page;
this.m_Tree = tree;
this.m_Node = node;
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
int count = node.Children.Length - (page * EntryCount);
if (count < 0)
count = 0;
else if (count > EntryCount)
count = EntryCount;
int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 1));
this.AddPage(0);
this.AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
this.AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight, OffsetGumpID);
if (OldStyle)
this.AddImageTiled(x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID);
else
this.AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
if (node.Parent != null)
{
this.AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1, GumpButtonType.Reply, 0);
if (PrevLabel)
this.AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
x += PrevWidth + OffsetSize;
int emptyWidth = TotalWidth - (PrevWidth * 2) - NextWidth - (OffsetSize * 5) - (OldStyle ? SetWidth + OffsetSize : 0);
if (!OldStyle)
this.AddImageTiled(x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID);
this.AddHtml(x + TextOffsetX, y, emptyWidth - TextOffsetX, EntryHeight, String.Format("<center>{0}</center>", node.Name), false, false);
x += emptyWidth + OffsetSize;
if (OldStyle)
this.AddImageTiled(x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID);
else
this.AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
if (page > 0)
{
this.AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2, GumpButtonType.Reply, 0);
if (PrevLabel)
this.AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
this.AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
if ((page + 1) * EntryCount < node.Children.Length)
{
this.AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1);
if (NextLabel)
this.AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
for (int i = 0, index = page * EntryCount; i < EntryCount && index < node.Children.Length; ++i, ++index)
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
object child = node.Children[index];
string name = "";
if (child is ParentNode)
name = ((ParentNode)child).Name;
else if (child is ChildNode)
name = ((ChildNode)child).Name;
this.AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
this.AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, name);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
this.AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
this.AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, index + 4, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
switch ( info.ButtonID )
{
case 1:
{
if (this.m_Node.Parent != null)
from.SendGump(new GoGump(0, from, this.m_Tree, this.m_Node.Parent));
break;
}
case 2:
{
if (this.m_Page > 0)
from.SendGump(new GoGump(this.m_Page - 1, from, this.m_Tree, this.m_Node));
break;
}
case 3:
{
if ((this.m_Page + 1) * EntryCount < this.m_Node.Children.Length)
from.SendGump(new GoGump(this.m_Page + 1, from, this.m_Tree, this.m_Node));
break;
}
default:
{
int index = info.ButtonID - 4;
if (index >= 0 && index < this.m_Node.Children.Length)
{
object o = this.m_Node.Children[index];
if (o is ParentNode)
{
from.SendGump(new GoGump(0, from, this.m_Tree, (ParentNode)o));
}
else
{
ChildNode n = (ChildNode)o;
from.MoveToWorld(n.Location, this.m_Tree.Map);
}
}
break;
}
}
}
}
}

View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
namespace Server.Gumps
{
public class LocationTree
{
private readonly Map m_Map;
private readonly ParentNode m_Root;
private readonly Dictionary<Mobile, ParentNode> m_LastBranch;
public LocationTree(string fileName, Map map)
{
this.m_LastBranch = new Dictionary<Mobile, ParentNode>();
this.m_Map = map;
string path = Path.Combine("Data/Locations/", fileName);
if (File.Exists(path))
{
XmlTextReader xml = new XmlTextReader(new StreamReader(path));
xml.WhitespaceHandling = WhitespaceHandling.None;
this.m_Root = this.Parse(xml);
xml.Close();
}
}
public Dictionary<Mobile, ParentNode> LastBranch
{
get
{
return this.m_LastBranch;
}
}
public Map Map
{
get
{
return this.m_Map;
}
}
public ParentNode Root
{
get
{
return this.m_Root;
}
}
private ParentNode Parse(XmlTextReader xml)
{
xml.Read();
xml.Read();
xml.Read();
return new ParentNode(xml, null);
}
}
}

View File

@@ -0,0 +1,76 @@
using System;
using System.Collections;
using System.Xml;
namespace Server.Gumps
{
public class ParentNode
{
private readonly ParentNode m_Parent;
private object[] m_Children;
private string m_Name;
public ParentNode(XmlTextReader xml, ParentNode parent)
{
this.m_Parent = parent;
this.Parse(xml);
}
public ParentNode Parent
{
get
{
return this.m_Parent;
}
}
public object[] Children
{
get
{
return this.m_Children;
}
}
public string Name
{
get
{
return this.m_Name;
}
}
private void Parse(XmlTextReader xml)
{
if (xml.MoveToAttribute("name"))
this.m_Name = xml.Value;
else
this.m_Name = "empty";
if (xml.IsEmptyElement)
{
this.m_Children = new object[0];
}
else
{
ArrayList children = new ArrayList();
while (xml.Read() && (xml.NodeType == XmlNodeType.Element || xml.NodeType == XmlNodeType.Comment))
{
if (xml.NodeType == XmlNodeType.Comment)
continue;
if (xml.Name == "child")
{
ChildNode n = new ChildNode(xml, this);
children.Add(n);
}
else
{
children.Add(new ParentNode(xml, this));
}
}
this.m_Children = children.ToArray();
}
}
}
}

View File

@@ -0,0 +1,54 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class DeclareFealtyGump : GuildMobileListGump
{
public DeclareFealtyGump(Mobile from, Guild guild)
: base(from, guild, true, guild.Members)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Mobile m = (Mobile)this.m_List[index];
if (m != null && !m.Deleted)
{
state.Mobile.GuildFealty = m;
}
}
}
}
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildGump(this.m_Mobile, this.m_Guild));
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1011097, false, false); // Declare your fealty
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 250, 35, 1011098, false, false); // I have selected my new lord.
this.AddButton(300, 400, 4005, 4007, 0, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
}
}
}

View File

@@ -0,0 +1,57 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GrantGuildTitleGump : GuildMobileListGump
{
public GrantGuildTitleGump(Mobile from, Guild guild)
: base(from, guild, true, guild.Members)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Mobile m = (Mobile)this.m_List[index];
if (m != null && !m.Deleted)
{
this.m_Mobile.SendLocalizedMessage(1013074); // New title (20 characters max):
this.m_Mobile.Prompt = new GuildTitlePrompt(this.m_Mobile, m, this.m_Guild);
}
}
}
}
else if (info.ButtonID == 2)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1011118, false, false); // Grant a title to another member.
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 245, 30, 1011127, false, false); // I dub thee...
this.AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
}
}
}

View File

@@ -0,0 +1,54 @@
using System;
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{
public class GuildAbbrvPrompt : Prompt
{
public override int MessageCliloc { get { return 1013061; } }
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildAbbrvPrompt(Mobile m, Guild g)
{
this.m_Mobile = m;
this.m_Guild = g;
}
public override void OnCancel(Mobile from)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
public override void OnResponse(Mobile from, string text)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
text = text.Trim();
if (text.Length > 3)
text = text.Substring(0, 3);
if (text.Length > 0)
{
if (Guild.FindByAbbrev(text) != null)
{
this.m_Mobile.SendMessage("{0} conflicts with the abbreviation of an existing guild.", text);
}
else
{
this.m_Guild.Abbreviation = text;
this.m_Guild.GuildMessage(1018025, true, text); // Your guild abbreviation has changed:
}
}
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}

View File

@@ -0,0 +1,67 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildAcceptWarGump : GuildListGump
{
public GuildAcceptWarGump(Mobile from, Guild guild)
: base(from, guild, true, guild.WarInvitations)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Guild g = (Guild)this.m_List[index];
if (g != null)
{
this.m_Guild.WarInvitations.Remove(g);
g.WarDeclarations.Remove(this.m_Guild);
this.m_Guild.AddEnemy(g);
this.m_Guild.GuildMessage(1018020, true, "{0} ({1})", g.Name, g.Abbreviation);
GuildGump.EnsureClosed(this.m_Mobile);
if (this.m_Guild.WarInvitations.Count > 0)
this.m_Mobile.SendGump(new GuildAcceptWarGump(this.m_Mobile, this.m_Guild));
else
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}
}
else if (info.ButtonID == 2)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1011147, false, false); // Select the guild to accept the invitations:
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 245, 30, 1011100, false, false); // Accept war invitations.
this.AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
}
}
}

View File

@@ -0,0 +1,126 @@
using System;
using Server.Factions;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildAdminCandidatesGump : GuildMobileListGump
{
public GuildAdminCandidatesGump(Mobile from, Guild guild)
: base(from, guild, true, guild.Candidates)
{
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1013075, false, false); // Accept or Refuse candidates for membership
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 245, 30, 1013076, false, false); // Accept
this.AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1013077, false, false); // Refuse
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
switch ( info.ButtonID )
{
case 0:
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
break;
}
case 1: // Accept
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Mobile m = (Mobile)this.m_List[index];
if (m != null && !m.Deleted)
{
#region Factions
PlayerState guildState = PlayerState.Find(this.m_Guild.Leader);
PlayerState targetState = PlayerState.Find(m);
Faction guildFaction = (guildState == null ? null : guildState.Faction);
Faction targetFaction = (targetState == null ? null : targetState.Faction);
if (guildFaction != targetFaction)
{
if (guildFaction == null)
this.m_Mobile.SendLocalizedMessage(1013027); // That player cannot join a non-faction guild.
else if (targetFaction == null)
this.m_Mobile.SendLocalizedMessage(1013026); // That player must be in a faction before joining this guild.
else
this.m_Mobile.SendLocalizedMessage(1013028); // That person has a different faction affiliation.
break;
}
else if (targetState != null && targetState.IsLeaving)
{
// OSI does this quite strangely, so we'll just do it this way
this.m_Mobile.SendMessage("That person is quitting their faction and so you may not recruit them.");
break;
}
#endregion
this.m_Guild.Candidates.Remove(m);
this.m_Guild.Accepted.Add(m);
GuildGump.EnsureClosed(this.m_Mobile);
if (this.m_Guild.Candidates.Count > 0)
this.m_Mobile.SendGump(new GuildAdminCandidatesGump(this.m_Mobile, this.m_Guild));
else
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}
break;
}
case 2: // Refuse
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Mobile m = (Mobile)this.m_List[index];
if (m != null && !m.Deleted)
{
this.m_Guild.Candidates.Remove(m);
GuildGump.EnsureClosed(this.m_Mobile);
if (this.m_Guild.Candidates.Count > 0)
this.m_Mobile.SendGump(new GuildAdminCandidatesGump(this.m_Mobile, this.m_Guild));
else
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}
break;
}
}
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildCandidatesGump : GuildMobileListGump
{
public GuildCandidatesGump(Mobile from, Guild guild)
: base(from, guild, false, guild.Candidates)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 500, 35, 1013030, false, false); // <center> Candidates </center>
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 300, 35, 1011120, false, false); // Return to the main menu.
}
}
}

View File

@@ -0,0 +1,88 @@
using System;
using Server.Factions;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildChangeTypeGump : Gump
{
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildChangeTypeGump(Mobile from, Guild guild)
: base(20, 30)
{
this.m_Mobile = from;
this.m_Guild = guild;
this.Dragable = false;
this.AddPage(0);
this.AddBackground(0, 0, 550, 400, 5054);
this.AddBackground(10, 10, 530, 380, 3000);
this.AddHtmlLocalized(20, 15, 510, 30, 1013062, false, false); // <center>Change Guild Type Menu</center>
this.AddHtmlLocalized(50, 50, 450, 30, 1013066, false, false); // Please select the type of guild you would like to change to
this.AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(85, 100, 300, 30, 1013063, false, false); // Standard guild
this.AddButton(20, 150, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddItem(50, 143, 7109);
this.AddHtmlLocalized(85, 150, 300, 300, 1013064, false, false); // Order guild
this.AddButton(20, 200, 4005, 4007, 3, GumpButtonType.Reply, 0);
this.AddItem(45, 200, 7107);
this.AddHtmlLocalized(85, 200, 300, 300, 1013065, false, false); // Chaos guild
this.AddButton(300, 360, 4005, 4007, 4, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 360, 150, 30, 1011012, false, false); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
PlayerState pl = PlayerState.Find(this.m_Mobile);
if (pl != null)
{
this.m_Mobile.SendLocalizedMessage(1010405); // You cannot change guild types while in a Faction!
}
else if (this.m_Guild.TypeLastChange.AddDays(7) > DateTime.UtcNow)
{
this.m_Mobile.SendLocalizedMessage(1005292); // Your guild type will be changed in one week.
}
else
{
GuildType newType;
switch ( info.ButtonID )
{
default:
return; // Close
case 1:
newType = GuildType.Regular;
break;
case 2:
newType = GuildType.Order;
break;
case 3:
newType = GuildType.Chaos;
break;
}
if (this.m_Guild.Type == newType)
return;
this.m_Guild.Type = newType;
this.m_Guild.GuildMessage(1018022, true, newType.ToString()); // Guild Message: Your guild type has changed:
}
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}

View File

@@ -0,0 +1,72 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildCharterGump : Gump
{
private const string DefaultWebsite = "https://www.servuo.com/";
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildCharterGump(Mobile from, Guild guild)
: base(20, 30)
{
this.m_Mobile = from;
this.m_Guild = guild;
this.Dragable = false;
this.AddPage(0);
this.AddBackground(0, 0, 550, 400, 5054);
this.AddBackground(10, 10, 530, 380, 3000);
this.AddButton(20, 360, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 360, 300, 35, 1011120, false, false); // Return to the main menu.
string charter;
if ((charter = guild.Charter) == null || (charter = charter.Trim()).Length <= 0)
this.AddHtmlLocalized(20, 20, 400, 35, 1013032, false, false); // No charter has been defined.
else
this.AddHtml(20, 20, 510, 75, charter, true, true);
this.AddButton(20, 200, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 200, 300, 20, 1011122, false, false); // Visit the guild website :
string website;
if ((website = guild.Website) == null || (website = website.Trim()).Length <= 0)
website = DefaultWebsite;
this.AddHtml(55, 220, 300, 20, website, false, false);
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(this.m_Mobile, this.m_Guild))
return;
switch ( info.ButtonID )
{
case 0:
return; // Close
case 1:
break; // Return to main menu
case 2:
{
string website;
if ((website = this.m_Guild.Website) == null || (website = website.Trim()).Length <= 0)
website = DefaultWebsite;
this.m_Mobile.LaunchBrowser(website);
break;
}
}
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildGump(this.m_Mobile, this.m_Guild));
}
}
}

View File

@@ -0,0 +1,47 @@
using System;
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{
public class GuildCharterPrompt : Prompt
{
public override int MessageCliloc { get { return 1013071; } }
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildCharterPrompt(Mobile m, Guild g)
{
this.m_Mobile = m;
this.m_Guild = g;
}
public override void OnCancel(Mobile from)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
public override void OnResponse(Mobile from, string text)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
text = text.Trim();
if (text.Length > 50)
text = text.Substring(0, 50);
if (text.Length > 0)
this.m_Guild.Charter = text;
this.m_Mobile.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
this.m_Mobile.Prompt = new GuildWebsitePrompt(this.m_Mobile, this.m_Guild);
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}

View File

@@ -0,0 +1,64 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildDeclarePeaceGump : GuildListGump
{
public GuildDeclarePeaceGump(Mobile from, Guild guild)
: base(from, guild, true, guild.Enemies)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Guild g = (Guild)this.m_List[index];
if (g != null)
{
this.m_Guild.RemoveEnemy(g);
this.m_Guild.GuildMessage(1018018, true, "{0} ({1})", g.Name, g.Abbreviation); // Guild Message: You are now at peace with this guild:
GuildGump.EnsureClosed(this.m_Mobile);
if (this.m_Guild.Enemies.Count > 0)
this.m_Mobile.SendGump(new GuildDeclarePeaceGump(this.m_Mobile, this.m_Guild));
else
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}
}
else if (info.ButtonID == 2)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1011137, false, false); // Select the guild you wish to declare peace with.
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 245, 30, 1011138, false, false); // Send the olive branch.
this.AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
}
}
}

View File

@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using Server.Factions;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildDeclareWarGump : GuildListGump
{
public GuildDeclareWarGump(Mobile from, Guild guild, List<Guild> list)
: base(from, guild, true, list)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Guild g = this.m_List[index];
if (g != null)
{
if (g == this.m_Guild)
{
this.m_Mobile.SendLocalizedMessage(501184); // You cannot declare war against yourself!
}
else if ((g.WarInvitations.Contains(this.m_Guild) && this.m_Guild.WarDeclarations.Contains(g)) || this.m_Guild.IsWar(g))
{
this.m_Mobile.SendLocalizedMessage(501183); // You are already at war with that guild.
}
else if (Faction.Find(this.m_Guild.Leader) != null)
{
this.m_Mobile.SendLocalizedMessage(1005288); // You cannot declare war while you are in a faction
}
else
{
if (!this.m_Guild.WarDeclarations.Contains(g))
{
this.m_Guild.WarDeclarations.Add(g);
this.m_Guild.GuildMessage(1018019, true, "{0} ({1})", g.Name, g.Abbreviation); // Guild Message: Your guild has sent an invitation for war:
}
if (!g.WarInvitations.Contains(this.m_Guild))
{
g.WarInvitations.Add(this.m_Guild);
g.GuildMessage(1018021, true, "{0} ({1})", this.m_Guild.Name, this.m_Guild.Abbreviation); // Guild Message: Your guild has received an invitation to war:
}
}
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildWarAdminGump(this.m_Mobile, this.m_Guild));
}
}
}
}
else if (info.ButtonID == 2)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1011065, false, false); // Select the guild you wish to declare war on.
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 245, 30, 1011068, false, false); // Send the challenge!
this.AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
}
}
}

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{
public class GuildDeclareWarPrompt : Prompt
{
public override int MessageCliloc { get { return 1018001; } }
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildDeclareWarPrompt(Mobile m, Guild g)
{
this.m_Mobile = m;
this.m_Guild = g;
}
public override void OnCancel(Mobile from)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildWarAdminGump(this.m_Mobile, this.m_Guild));
}
public override void OnResponse(Mobile from, string text)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
text = text.Trim();
if (text.Length >= 3)
{
List<Guild> guilds = Utility.CastConvertList<BaseGuild, Guild>(Guild.Search(text));
GuildGump.EnsureClosed(this.m_Mobile);
if (guilds.Count > 0)
{
this.m_Mobile.SendGump(new GuildDeclareWarGump(this.m_Mobile, this.m_Guild, guilds));
}
else
{
this.m_Mobile.SendGump(new GuildWarAdminGump(this.m_Mobile, this.m_Guild));
this.m_Mobile.SendLocalizedMessage(1018003); // No guilds found matching - try another name in the search
}
}
else
{
this.m_Mobile.SendMessage("Search string must be at least three letters in length.");
}
}
}
}

View File

@@ -0,0 +1,62 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildDismissGump : GuildMobileListGump
{
public GuildDismissGump(Mobile from, Guild guild)
: base(from, guild, true, guild.Members)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Mobile m = (Mobile)this.m_List[index];
if (m != null && !m.Deleted)
{
this.m_Guild.RemoveMember(m);
if (this.m_Mobile.AccessLevel >= AccessLevel.GameMaster || this.m_Mobile == this.m_Guild.Leader)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}
}
}
else if (info.ButtonID == 2 && (this.m_Mobile.AccessLevel >= AccessLevel.GameMaster || this.m_Mobile == this.m_Guild.Leader))
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1011124, false, false); // Whom do you wish to dismiss?
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 245, 30, 1011125, false, false); // Kick them out!
this.AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
}
}
}

View File

@@ -0,0 +1,221 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildGump : Gump
{
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildGump(Mobile beholder, Guild guild)
: base(20, 30)
{
this.m_Mobile = beholder;
this.m_Guild = guild;
this.Dragable = false;
this.AddPage(0);
this.AddBackground(0, 0, 550, 400, 5054);
this.AddBackground(10, 10, 530, 380, 3000);
this.AddHtml(20, 15, 200, 35, guild.Name, false, false);
Mobile leader = guild.Leader;
if (leader != null)
{
string leadTitle;
if ((leadTitle = leader.GuildTitle) != null && (leadTitle = leadTitle.Trim()).Length > 0)
leadTitle += ": ";
else
leadTitle = "";
string leadName;
if ((leadName = leader.Name) == null || (leadName = leadName.Trim()).Length <= 0)
leadName = "(empty)";
this.AddHtml(220, 15, 250, 35, leadTitle + leadName, false, false);
}
this.AddButton(20, 50, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 50, 100, 20, 1013022, false, false); // Loyal to
Mobile fealty = beholder.GuildFealty;
if (fealty == null || !guild.IsMember(fealty))
fealty = leader;
if (fealty == null)
fealty = beholder;
string fealtyName;
if (fealty == null || (fealtyName = fealty.Name) == null || (fealtyName = fealtyName.Trim()).Length <= 0)
fealtyName = "(empty)";
if (beholder == fealty)
this.AddHtmlLocalized(55, 70, 470, 20, 1018002, false, false); // yourself
else
this.AddHtml(55, 70, 470, 20, fealtyName, false, false);
this.AddButton(215, 50, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(250, 50, 170, 20, 1013023, false, false); // Display guild abbreviation
this.AddHtmlLocalized(250, 70, 50, 20, beholder.DisplayGuildTitle ? 1011262 : 1011263, false, false); // on/off
this.AddButton(20, 100, 4005, 4007, 3, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 100, 470, 30, 1011086, false, false); // View the current roster.
this.AddButton(20, 130, 4005, 4007, 4, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 130, 470, 30, 1011085, false, false); // Recruit someone into the guild.
if (guild.Candidates.Count > 0)
{
this.AddButton(20, 160, 4005, 4007, 5, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 160, 470, 30, 1011093, false, false); // View list of candidates who have been sponsored to the guild.
}
else
{
this.AddImage(20, 160, 4020);
this.AddHtmlLocalized(55, 160, 470, 30, 1013031, false, false); // There are currently no candidates for membership.
}
this.AddButton(20, 220, 4005, 4007, 6, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 220, 470, 30, 1011087, false, false); // View the guild's charter.
this.AddButton(20, 250, 4005, 4007, 7, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 250, 470, 30, 1011092, false, false); // Resign from the guild.
this.AddButton(20, 280, 4005, 4007, 8, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 280, 470, 30, 1011095, false, false); // View list of guilds you are at war with.
if (beholder.AccessLevel >= AccessLevel.GameMaster || beholder == leader)
{
this.AddButton(20, 310, 4005, 4007, 9, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 310, 470, 30, 1011094, false, false); // Access guildmaster functions.
}
else
{
this.AddImage(20, 310, 4020);
this.AddHtmlLocalized(55, 310, 470, 30, 1018013, false, false); // Reserved for guildmaster
}
this.AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 360, 470, 30, 1011441, false, false); // EXIT
}
public static void EnsureClosed(Mobile m)
{
m.CloseGump(typeof(DeclareFealtyGump));
m.CloseGump(typeof(GrantGuildTitleGump));
m.CloseGump(typeof(GuildAdminCandidatesGump));
m.CloseGump(typeof(GuildCandidatesGump));
m.CloseGump(typeof(GuildChangeTypeGump));
m.CloseGump(typeof(GuildCharterGump));
m.CloseGump(typeof(GuildDismissGump));
m.CloseGump(typeof(GuildGump));
m.CloseGump(typeof(GuildmasterGump));
m.CloseGump(typeof(GuildRosterGump));
m.CloseGump(typeof(GuildWarGump));
}
public static bool BadLeader(Mobile m, Guild g)
{
if (m.Deleted || g.Disbanded || (m.AccessLevel < AccessLevel.GameMaster && g.Leader != m))
return true;
Item stone = g.Guildstone;
return (stone == null || stone.Deleted || !m.InRange(stone.GetWorldLocation(), 2));
}
public static bool BadMember(Mobile m, Guild g)
{
if (m.Deleted || g.Disbanded || (m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m)))
return true;
Item stone = g.Guildstone;
return (stone == null || stone.Deleted || !m.InRange(stone.GetWorldLocation(), 2));
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (BadMember(this.m_Mobile, this.m_Guild))
return;
switch ( info.ButtonID )
{
case 1: // Loyalty
{
EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new DeclareFealtyGump(this.m_Mobile, this.m_Guild));
break;
}
case 2: // Toggle display abbreviation
{
this.m_Mobile.DisplayGuildTitle = !this.m_Mobile.DisplayGuildTitle;
EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildGump(this.m_Mobile, this.m_Guild));
break;
}
case 3: // View the current roster
{
EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildRosterGump(this.m_Mobile, this.m_Guild));
break;
}
case 4: // Recruit
{
this.m_Mobile.Target = new GuildRecruitTarget(this.m_Mobile, this.m_Guild);
break;
}
case 5: // Membership candidates
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildCandidatesGump(this.m_Mobile, this.m_Guild));
break;
}
case 6: // View charter
{
EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildCharterGump(this.m_Mobile, this.m_Guild));
break;
}
case 7: // Resign
{
this.m_Guild.RemoveMember(this.m_Mobile);
break;
}
case 8: // View wars
{
EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildWarGump(this.m_Mobile, this.m_Guild));
break;
}
case 9: // Guildmaster functions
{
if (this.m_Mobile.AccessLevel >= AccessLevel.GameMaster || this.m_Guild.Leader == this.m_Mobile)
{
EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
break;
}
}
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using Server.Guilds;
namespace Server.Gumps
{
public abstract class GuildListGump : Gump
{
protected Mobile m_Mobile;
protected Guild m_Guild;
protected List<Guild> m_List;
public GuildListGump(Mobile from, Guild guild, bool radio, List<Guild> list)
: base(20, 30)
{
this.m_Mobile = from;
this.m_Guild = guild;
this.Dragable = false;
this.AddPage(0);
this.AddBackground(0, 0, 550, 440, 5054);
this.AddBackground(10, 10, 530, 420, 3000);
this.Design();
this.m_List = new List<Guild>(list);
for (int i = 0; i < this.m_List.Count; ++i)
{
if ((i % 11) == 0)
{
if (i != 0)
{
this.AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, (i / 11) + 1);
this.AddHtmlLocalized(335, 370, 300, 35, 1011066, false, false); // Next page
}
this.AddPage((i / 11) + 1);
if (i != 0)
{
this.AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, (i / 11));
this.AddHtmlLocalized(55, 370, 300, 35, 1011067, false, false); // Previous page
}
}
if (radio)
this.AddRadio(20, 35 + ((i % 11) * 30), 208, 209, false, i);
Guild g = this.m_List[i];
string name;
if ((name = g.Name) != null && (name = name.Trim()).Length <= 0)
name = "(empty)";
this.AddLabel((radio ? 55 : 20), 35 + ((i % 11) * 30), 0, name);
}
}
protected virtual void Design()
{
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using Server.Guilds;
namespace Server.Gumps
{
public abstract class GuildMobileListGump : Gump
{
protected Mobile m_Mobile;
protected Guild m_Guild;
protected List<Mobile> m_List;
public GuildMobileListGump(Mobile from, Guild guild, bool radio, List<Mobile> list)
: base(20, 30)
{
this.m_Mobile = from;
this.m_Guild = guild;
this.Dragable = false;
this.AddPage(0);
this.AddBackground(0, 0, 550, 440, 5054);
this.AddBackground(10, 10, 530, 420, 3000);
this.Design();
this.m_List = new List<Mobile>(list);
for (int i = 0; i < this.m_List.Count; ++i)
{
if ((i % 11) == 0)
{
if (i != 0)
{
this.AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, (i / 11) + 1);
this.AddHtmlLocalized(335, 370, 300, 35, 1011066, false, false); // Next page
}
this.AddPage((i / 11) + 1);
if (i != 0)
{
this.AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, (i / 11));
this.AddHtmlLocalized(55, 370, 300, 35, 1011067, false, false); // Previous page
}
}
if (radio)
this.AddRadio(20, 35 + ((i % 11) * 30), 208, 209, false, i);
Mobile m = this.m_List[i];
string name;
if ((name = m.Name) != null && (name = name.Trim()).Length <= 0)
name = "(empty)";
this.AddLabel((radio ? 55 : 20), 35 + ((i % 11) * 30), 0, name);
}
}
protected virtual void Design()
{
}
}
}

View File

@@ -0,0 +1,54 @@
using System;
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{
public class GuildNamePrompt : Prompt
{
public override int MessageCliloc { get { return 1013060; } }
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildNamePrompt(Mobile m, Guild g)
{
this.m_Mobile = m;
this.m_Guild = g;
}
public override void OnCancel(Mobile from)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
public override void OnResponse(Mobile from, string text)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
text = text.Trim();
if (text.Length > 40)
text = text.Substring(0, 40);
if (text.Length > 0)
{
if (Guild.FindByName(text) != null)
{
this.m_Mobile.SendMessage("{0} conflicts with the name of an existing guild.", text);
}
else
{
this.m_Guild.Name = text;
this.m_Guild.GuildMessage(1018024, true, text); // The name of your guild has changed:
}
}
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}

View File

@@ -0,0 +1,64 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildRejectWarGump : GuildListGump
{
public GuildRejectWarGump(Mobile from, Guild guild)
: base(from, guild, true, guild.WarInvitations)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Guild g = (Guild)this.m_List[index];
if (g != null)
{
this.m_Guild.WarInvitations.Remove(g);
g.WarDeclarations.Remove(this.m_Guild);
GuildGump.EnsureClosed(this.m_Mobile);
if (this.m_Guild.WarInvitations.Count > 0)
this.m_Mobile.SendGump(new GuildRejectWarGump(this.m_Mobile, this.m_Guild));
else
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}
}
else if (info.ButtonID == 2)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1011148, false, false); // Select the guild to reject their invitations:
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 245, 30, 1011101, false, false); // Reject war invitations.
this.AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
}
}
}

View File

@@ -0,0 +1,64 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildRescindDeclarationGump : GuildListGump
{
public GuildRescindDeclarationGump(Mobile from, Guild guild)
: base(from, guild, true, guild.WarDeclarations)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < this.m_List.Count)
{
Guild g = (Guild)this.m_List[index];
if (g != null)
{
this.m_Guild.WarDeclarations.Remove(g);
g.WarInvitations.Remove(this.m_Guild);
GuildGump.EnsureClosed(this.m_Mobile);
if (this.m_Guild.WarDeclarations.Count > 0)
this.m_Mobile.SendGump(new GuildRescindDeclarationGump(this.m_Mobile, this.m_Guild));
else
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}
}
else if (info.ButtonID == 2)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtmlLocalized(20, 10, 400, 35, 1011150, false, false); // Select the guild to rescind our invitations:
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 245, 30, 1011102, false, false); // Rescind your war declarations.
this.AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildRosterGump : GuildMobileListGump
{
public GuildRosterGump(Mobile from, Guild guild)
: base(from, guild, false, guild.Members)
{
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildGump(this.m_Mobile, this.m_Guild));
}
}
protected override void Design()
{
this.AddHtml(20, 10, 500, 35, String.Format("<center>{0}</center>", this.m_Guild.Name), false, false);
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 300, 35, 1011120, false, false); // Return to the main menu.
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{
public class GuildTitlePrompt : Prompt
{
public override int MessageCliloc { get { return 1011128; } }
private readonly Mobile m_Leader;
private readonly Mobile m_Target;
private readonly Guild m_Guild;
public GuildTitlePrompt(Mobile leader, Mobile target, Guild g)
{
this.m_Leader = leader;
this.m_Target = target;
this.m_Guild = g;
}
public override void OnCancel(Mobile from)
{
if (GuildGump.BadLeader(this.m_Leader, this.m_Guild))
return;
else if (this.m_Target.Deleted || !this.m_Guild.IsMember(this.m_Target))
return;
GuildGump.EnsureClosed(this.m_Leader);
this.m_Leader.SendGump(new GuildmasterGump(this.m_Leader, this.m_Guild));
}
public override void OnResponse(Mobile from, string text)
{
if (GuildGump.BadLeader(this.m_Leader, this.m_Guild))
return;
else if (this.m_Target.Deleted || !this.m_Guild.IsMember(this.m_Target))
return;
text = text.Trim();
if (text.Length > 20)
text = text.Substring(0, 20);
if (text.Length > 0)
this.m_Target.GuildTitle = text;
GuildGump.EnsureClosed(this.m_Leader);
this.m_Leader.SendGump(new GuildmasterGump(this.m_Leader, this.m_Guild));
}
}
}

View File

@@ -0,0 +1,119 @@
using System;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildWarAdminGump : Gump
{
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildWarAdminGump(Mobile from, Guild guild)
: base(20, 30)
{
this.m_Mobile = from;
this.m_Guild = guild;
this.Dragable = false;
this.AddPage(0);
this.AddBackground(0, 0, 550, 440, 5054);
this.AddBackground(10, 10, 530, 420, 3000);
this.AddHtmlLocalized(20, 10, 510, 35, 1011105, false, false); // <center>WAR FUNCTIONS</center>
this.AddButton(20, 40, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 40, 400, 30, 1011099, false, false); // Declare war through guild name search.
int count = 0;
if (guild.Enemies.Count > 0)
{
this.AddButton(20, 160 + (count * 30), 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 160 + (count++ * 30), 400, 30, 1011103, false, false); // Declare peace.
}
else
{
this.AddHtmlLocalized(20, 160 + (count++ * 30), 400, 30, 1013033, false, false); // No current wars
}
if (guild.WarInvitations.Count > 0)
{
this.AddButton(20, 160 + (count * 30), 4005, 4007, 3, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 160 + (count++ * 30), 400, 30, 1011100, false, false); // Accept war invitations.
this.AddButton(20, 160 + (count * 30), 4005, 4007, 4, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 160 + (count++ * 30), 400, 30, 1011101, false, false); // Reject war invitations.
}
else
{
this.AddHtmlLocalized(20, 160 + (count++ * 30), 400, 30, 1018012, false, false); // No current invitations received for war.
}
if (guild.WarDeclarations.Count > 0)
{
this.AddButton(20, 160 + (count * 30), 4005, 4007, 5, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 160 + (count++ * 30), 400, 30, 1011102, false, false); // Rescind your war declarations.
}
else
{
this.AddHtmlLocalized(20, 160 + (count++ * 30), 400, 30, 1013055, false, false); // No current war declarations
}
this.AddButton(20, 400, 4005, 4007, 6, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 400, 35, 1011104, false, false); // Return to the previous menu.
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
switch ( info.ButtonID )
{
case 1: // Declare war
{
this.m_Mobile.SendLocalizedMessage(1018001); // Declare war through search - Enter Guild Name:
this.m_Mobile.Prompt = new GuildDeclareWarPrompt(this.m_Mobile, this.m_Guild);
break;
}
case 2: // Declare peace
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildDeclarePeaceGump(this.m_Mobile, this.m_Guild));
break;
}
case 3: // Accept war
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildAcceptWarGump(this.m_Mobile, this.m_Guild));
break;
}
case 4: // Reject war
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildRejectWarGump(this.m_Mobile, this.m_Guild));
break;
}
case 5: // Rescind declarations
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildRescindDeclarationGump(this.m_Mobile, this.m_Guild));
break;
}
case 6: // Return
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
break;
}
}
}
}
}

View File

@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using Server.Guilds;
using Server.Network;
namespace Server.Gumps
{
public class GuildWarGump : Gump
{
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildWarGump(Mobile from, Guild guild)
: base(20, 30)
{
this.m_Mobile = from;
this.m_Guild = guild;
this.Dragable = false;
this.AddPage(0);
this.AddBackground(0, 0, 550, 440, 5054);
this.AddBackground(10, 10, 530, 420, 3000);
this.AddHtmlLocalized(20, 10, 500, 35, 1011133, false, false); // <center>WARFARE STATUS</center>
this.AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 400, 300, 35, 1011120, false, false); // Return to the main menu.
this.AddPage(1);
this.AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 2);
this.AddHtmlLocalized(410, 373, 100, 25, 1011066, false, false); // Next page
this.AddHtmlLocalized(20, 45, 400, 20, 1011134, false, false); // We are at war with:
List<Guild> enemies = guild.Enemies;
if (enemies.Count == 0)
{
this.AddHtmlLocalized(20, 65, 400, 20, 1013033, false, false); // No current wars
}
else
{
for (int i = 0; i < enemies.Count; ++i)
{
Guild g = enemies[i];
this.AddHtml(20, 65 + (i * 20), 300, 20, g.Name, false, false);
}
}
this.AddPage(2);
this.AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 3);
this.AddHtmlLocalized(410, 373, 100, 25, 1011066, false, false); // Next page
this.AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 1);
this.AddHtmlLocalized(65, 373, 150, 25, 1011067, false, false); // Previous page
this.AddHtmlLocalized(20, 45, 400, 20, 1011136, false, false); // Guilds that we have declared war on:
List<Guild> declared = guild.WarDeclarations;
if (declared.Count == 0)
{
this.AddHtmlLocalized(20, 65, 400, 20, 1018012, false, false); // No current invitations received for war.
}
else
{
for (int i = 0; i < declared.Count; ++i)
{
Guild g = (Guild)declared[i];
this.AddHtml(20, 65 + (i * 20), 300, 20, g.Name, false, false);
}
}
this.AddPage(3);
this.AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 2);
this.AddHtmlLocalized(65, 373, 150, 25, 1011067, false, false); // Previous page
this.AddHtmlLocalized(20, 45, 400, 20, 1011135, false, false); // Guilds that have declared war on us:
List<Guild> invites = guild.WarInvitations;
if (invites.Count == 0)
{
this.AddHtmlLocalized(20, 65, 400, 20, 1013055, false, false); // No current war declarations
}
else
{
for (int i = 0; i < invites.Count; ++i)
{
Guild g = invites[i];
this.AddHtml(20, 65 + (i * 20), 300, 20, g.Name, false, false);
}
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadMember(this.m_Mobile, this.m_Guild))
return;
if (info.ButtonID == 1)
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildGump(this.m_Mobile, this.m_Guild));
}
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using Server.Guilds;
using Server.Prompts;
namespace Server.Gumps
{
public class GuildWebsitePrompt : Prompt
{
public override int MessageCliloc { get { return 1013072; } }
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildWebsitePrompt(Mobile m, Guild g)
{
this.m_Mobile = m;
this.m_Guild = g;
}
public override void OnCancel(Mobile from)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
public override void OnResponse(Mobile from, string text)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
text = text.Trim();
if (text.Length > 50)
text = text.Substring(0, 50);
if (text.Length > 0)
this.m_Guild.Website = text;
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
}
}
}

View File

@@ -0,0 +1,182 @@
using System;
using Server.Guilds;
using Server.Items;
using Server.Network;
namespace Server.Gumps
{
public class GuildmasterGump : Gump
{
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildmasterGump(Mobile from, Guild guild)
: base(20, 30)
{
this.m_Mobile = from;
this.m_Guild = guild;
this.Dragable = false;
this.AddPage(0);
this.AddBackground(0, 0, 550, 400, 5054);
this.AddBackground(10, 10, 530, 380, 3000);
this.AddHtmlLocalized(20, 15, 510, 35, 1011121, false, false); // <center>GUILDMASTER FUNCTIONS</center>
this.AddButton(20, 40, 4005, 4007, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 40, 470, 30, 1011107, false, false); // Set the guild name.
this.AddButton(20, 70, 4005, 4007, 3, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 70, 470, 30, 1011109, false, false); // Set the guild's abbreviation.
this.AddButton(20, 100, 4005, 4007, 4, GumpButtonType.Reply, 0);
switch ( this.m_Guild.Type )
{
case GuildType.Regular:
this.AddHtmlLocalized(55, 100, 470, 30, 1013059, false, false); // Change guild type: Currently Standard
break;
case GuildType.Order:
this.AddHtmlLocalized(55, 100, 470, 30, 1013057, false, false); // Change guild type: Currently Order
break;
case GuildType.Chaos:
this.AddHtmlLocalized(55, 100, 470, 30, 1013058, false, false); // Change guild type: Currently Chaos
break;
}
this.AddButton(20, 130, 4005, 4007, 5, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 130, 470, 30, 1011112, false, false); // Set the guild's charter.
this.AddButton(20, 160, 4005, 4007, 6, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 160, 470, 30, 1011113, false, false); // Dismiss a member.
this.AddButton(20, 190, 4005, 4007, 7, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 190, 470, 30, 1011114, false, false); // Go to the WAR menu.
if (this.m_Guild.Candidates.Count > 0)
{
this.AddButton(20, 220, 4005, 4007, 8, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 220, 470, 30, 1013056, false, false); // Administer the list of candidates
}
else
{
this.AddImage(20, 220, 4020);
this.AddHtmlLocalized(55, 220, 470, 30, 1013031, false, false); // There are currently no candidates for membership.
}
this.AddButton(20, 250, 4005, 4007, 9, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 250, 470, 30, 1011117, false, false); // Set the guildmaster's title.
this.AddButton(20, 280, 4005, 4007, 10, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 280, 470, 30, 1011118, false, false); // Grant a title to another member.
this.AddButton(20, 310, 4005, 4007, 11, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 310, 470, 30, 1011119, false, false); // Move this guildstone.
this.AddButton(20, 360, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(55, 360, 245, 30, 1011120, false, false); // Return to the main menu.
this.AddButton(300, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(335, 360, 100, 30, 1011441, false, false); // EXIT
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (GuildGump.BadLeader(this.m_Mobile, this.m_Guild))
return;
switch ( info.ButtonID )
{
case 1: // Main menu
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildGump(this.m_Mobile, this.m_Guild));
break;
}
case 2: // Set guild name
{
this.m_Mobile.SendLocalizedMessage(1013060); // Enter new guild name (40 characters max):
this.m_Mobile.Prompt = new GuildNamePrompt(this.m_Mobile, this.m_Guild);
break;
}
case 3: // Set guild abbreviation
{
this.m_Mobile.SendLocalizedMessage(1013061); // Enter new guild abbreviation (3 characters max):
this.m_Mobile.Prompt = new GuildAbbrvPrompt(this.m_Mobile, this.m_Guild);
break;
}
case 4: // Change guild type
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildChangeTypeGump(this.m_Mobile, this.m_Guild));
break;
}
case 5: // Set charter
{
this.m_Mobile.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
this.m_Mobile.Prompt = new GuildCharterPrompt(this.m_Mobile, this.m_Guild);
break;
}
case 6: // Dismiss member
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildDismissGump(this.m_Mobile, this.m_Guild));
break;
}
case 7: // War menu
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildWarAdminGump(this.m_Mobile, this.m_Guild));
break;
}
case 8: // Administer candidates
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildAdminCandidatesGump(this.m_Mobile, this.m_Guild));
break;
}
case 9: // Set guildmaster's title
{
this.m_Mobile.SendLocalizedMessage(1013073); // Enter new guildmaster title (20 characters max):
this.m_Mobile.Prompt = new GuildTitlePrompt(this.m_Mobile, this.m_Mobile, this.m_Guild);
break;
}
case 10: // Grant title
{
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GrantGuildTitleGump(this.m_Mobile, this.m_Guild));
break;
}
case 11: // Move guildstone
{
if (this.m_Guild.Guildstone != null)
{
GuildTeleporter item = new GuildTeleporter(this.m_Guild.Guildstone);
if (this.m_Guild.Teleporter != null)
this.m_Guild.Teleporter.Delete();
this.m_Mobile.SendLocalizedMessage(501133); // Use the teleporting object placed in your backpack to move this guildstone.
this.m_Mobile.AddToBackpack(item);
this.m_Guild.Teleporter = item;
}
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild));
break;
}
}
}
}
}

View File

@@ -0,0 +1,73 @@
using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public delegate void SearchSelectionCallback(GuildDisplayType display);
public class GuildAdvancedSearchGump : BaseGuildGump
{
private readonly GuildDisplayType m_Display;
private readonly SearchSelectionCallback m_Callback;
public GuildAdvancedSearchGump(PlayerMobile pm, Guild g, GuildDisplayType display, SearchSelectionCallback callback)
: base(pm, g)
{
this.m_Callback = callback;
this.m_Display = display;
this.PopulateGump();
}
public override void PopulateGump()
{
base.PopulateGump();
this.AddHtmlLocalized(431, 43, 110, 26, 1062978, 0xF, false, false); // Diplomacy
this.AddHtmlLocalized(65, 80, 480, 26, 1063124, 0xF, true, false); // <i>Advanced Search Options</i>
this.AddHtmlLocalized(65, 110, 480, 26, 1063136 + (int)this.m_Display, 0xF, false, false); // Showing All Guilds/w/Relation/Waiting Relation
this.AddGroup(1);
this.AddRadio(75, 140, 0xD2, 0xD3, false, 2);
this.AddHtmlLocalized(105, 140, 200, 26, 1063006, 0x0, false, false); // Show Guilds with Relationship
this.AddRadio(75, 170, 0xD2, 0xD3, false, 1);
this.AddHtmlLocalized(105, 170, 200, 26, 1063005, 0x0, false, false); // Show Guilds Awaiting Action
this.AddRadio(75, 200, 0xD2, 0xD3, false, 0);
this.AddHtmlLocalized(105, 200, 200, 26, 1063007, 0x0, false, false); // Show All Guilds
this.AddBackground(450, 370, 100, 26, 0x2486);
this.AddButton(455, 375, 0x845, 0x846, 5, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(480, 373, 60, 26, 1006044, 0x0, false, false); // OK
this.AddBackground(340, 370, 100, 26, 0x2486);
this.AddButton(345, 375, 0x845, 0x846, 0, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(370, 373, 60, 26, 1006045, 0x0, false, false); // Cancel
}
public override void OnResponse(NetState sender, RelayInfo info)
{
base.OnResponse(sender, info);
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (pm == null || !IsMember(pm, this.guild))
return;
GuildDisplayType display = this.m_Display;
if (info.ButtonID == 5)
{
for (int i = 0; i < 3; i++)
{
if (info.IsSwitched(i))
{
display = (GuildDisplayType)i;
this.m_Callback(display);
break;
}
}
}
}
}
}

View File

@@ -0,0 +1,153 @@
using System;
using Server.Gumps;
using Server.Misc;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public abstract class BaseGuildGump : Gump
{
private readonly Guild m_Guild;
private readonly PlayerMobile m_Player;
public BaseGuildGump(PlayerMobile pm, Guild g)
: this(pm, g, 10, 10)
{
}
public BaseGuildGump(PlayerMobile pm, Guild g, int x, int y)
: base(x, y)
{
this.m_Guild = g;
this.m_Player = pm;
pm.CloseGump(typeof(BaseGuildGump));
}
protected Guild guild
{
get
{
return this.m_Guild;
}
}
protected PlayerMobile player
{
get
{
return this.m_Player;
}
}
public static bool IsLeader(Mobile m, Guild g)
{
return !(m.Deleted || g.Disbanded || !(m is PlayerMobile) || (m.AccessLevel < AccessLevel.GameMaster && g.Leader != m));
}
public static bool IsMember(Mobile m, Guild g)
{
return !(m.Deleted || g.Disbanded || !(m is PlayerMobile) || (m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m)));
}
public static bool CheckProfanity(string s)
{
return CheckProfanity(s, 50);
}
public static bool CheckProfanity(string s, int maxLength)
{
//return NameVerification.Validate( s, 1, 50, true, true, false, int.MaxValue, ProfanityProtection.Exceptions, ProfanityProtection.Disallowed, ProfanityProtection.StartDisallowed ); //What am I doing wrong, this still allows chars like the <3 symbol... 3 AM. someone change this to use this
//With testing on OSI, Guild stuff seems to follow a 'simpler' method of profanity protection
if (s.Length < 1 || s.Length > maxLength)
return false;
char[] exceptions = ProfanityProtection.Exceptions;
s = s.ToLower();
for (int i = 0; i < s.Length; ++i)
{
char c = s[i];
if ((c < 'a' || c > 'z') && (c < '0' || c > '9'))
{
bool except = false;
for (int j = 0; !except && j < exceptions.Length; j++)
if (c == exceptions[j])
except = true;
if (!except)
return false;
}
}
string[] disallowed = ProfanityProtection.Disallowed;
for (int i = 0; i < disallowed.Length; i++)
{
if (s.IndexOf(disallowed[i]) != -1)
return false;
}
return true;
}
public static string Color(string text, int color)
{
return String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text);
}
//There's prolly a way to have all the vars set of inherited classes before something is called in the Ctor... but... I can't think of it right now, and I can't use Timer.DelayCall here :<
public virtual void PopulateGump()
{
this.AddPage(0);
this.AddBackground(0, 0, 600, 440, 0x24AE);
this.AddBackground(66, 40, 150, 26, 0x2486);
this.AddButton(71, 45, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(96, 43, 110, 26, 1063014, 0x0, false, false); // My Guild
this.AddBackground(236, 40, 150, 26, 0x2486);
this.AddButton(241, 45, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(266, 43, 110, 26, 1062974, 0x0, false, false); // Guild Roster
this.AddBackground(401, 40, 150, 26, 0x2486);
this.AddButton(406, 45, 0x845, 0x846, 3, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(431, 43, 110, 26, 1062978, 0x0, false, false); // Diplomacy
this.AddPage(1);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (!IsMember(pm, this.guild))
return;
switch( info.ButtonID )
{
case 1:
{
pm.SendGump(new GuildInfoGump(pm, this.guild));
break;
}
case 2:
{
pm.SendGump(new GuildRosterGump(pm, this.guild));
break;
}
case 3:
{
pm.SendGump(new GuildDiplomacyGump(pm, this.guild));
break;
}
}
}
public void AddHtmlText(int x, int y, int width, int height, TextDefinition text, bool back, bool scroll)
{
if (text != null && text.Number > 0)
this.AddHtmlLocalized(x, y, width, height, text.Number, back, scroll);
else if (text != null && text.String != null)
this.AddHtml(x, y, width, height, text.String, back, scroll);
}
}
}

View File

@@ -0,0 +1,226 @@
using System;
using System.Collections.Generic;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public struct InfoField<T>
{
private readonly TextDefinition m_Name;
private readonly int m_Width;
private readonly IComparer<T> m_Comparer;
public InfoField(TextDefinition name, int width, IComparer<T> comparer)
{
this.m_Name = name;
this.m_Width = width;
this.m_Comparer = comparer;
}
public TextDefinition Name
{
get
{
return this.m_Name;
}
}
public int Width
{
get
{
return this.m_Width;
}
}
public IComparer<T> Comparer
{
get
{
return this.m_Comparer;
}
}
}
public abstract class BaseGuildListGump<T> : BaseGuildGump
{
private const int itemsPerPage = 8;
readonly IComparer<T> m_Comparer;
readonly InfoField<T>[] m_Fields;
readonly string m_Filter;
List<T> m_List;
bool m_Ascending;
int m_StartNumber;
public BaseGuildListGump(PlayerMobile pm, Guild g, List<T> list, IComparer<T> currentComparer, bool ascending, string filter, int startNumber, InfoField<T>[] fields)
: base(pm, g)
{
this.m_Filter = filter.Trim();
this.m_Comparer = currentComparer;
this.m_Fields = fields;
this.m_Ascending = ascending;
this.m_StartNumber = startNumber;
this.m_List = list;
}
public virtual bool WillFilter
{
get
{
return (this.m_Filter.Length >= 0);
}
}
public override void PopulateGump()
{
base.PopulateGump();
List<T> list = this.m_List;
if (this.WillFilter)
{
this.m_List = new List<T>();
for (int i = 0; i < list.Count; i++)
{
if (!this.IsFiltered(list[i], this.m_Filter))
this.m_List.Add(list[i]);
}
}
else
{
this.m_List = new List<T>(list);
}
this.m_List.Sort(this.m_Comparer);
this.m_StartNumber = Math.Max(Math.Min(this.m_StartNumber, this.m_List.Count - 1), 0);
this.AddBackground(130, 75, 385, 30, 0xBB8);
this.AddTextEntry(135, 80, 375, 30, 0x481, 1, this.m_Filter);
this.AddButton(520, 75, 0x867, 0x868, 5, GumpButtonType.Reply, 0); //Filter Button
int width = 0;
for (int i = 0; i < this.m_Fields.Length; i++)
{
InfoField<T> f = this.m_Fields[i];
this.AddImageTiled(65 + width, 110, f.Width + 10, 26, 0xA40);
this.AddImageTiled(67 + width, 112, f.Width + 6, 22, 0xBBC);
this.AddHtmlText(70 + width, 113, f.Width, 20, f.Name, false, false);
bool isComparer = (this.m_Fields[i].Comparer.GetType() == this.m_Comparer.GetType());
int ButtonID = (isComparer) ? (this.m_Ascending ? 0x983 : 0x985) : 0x2716;
this.AddButton(59 + width + f.Width, 117, ButtonID, ButtonID + (isComparer ? 1 : 0), 100 + i, GumpButtonType.Reply, 0);
width += (f.Width + 12);
}
if (this.m_StartNumber <= 0)
this.AddButton(65, 80, 0x15E3, 0x15E7, 0, GumpButtonType.Page, 0);
else
this.AddButton(65, 80, 0x15E3, 0x15E7, 6, GumpButtonType.Reply, 0); // Back
if (this.m_StartNumber + itemsPerPage > this.m_List.Count)
this.AddButton(95, 80, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 0);
else
this.AddButton(95, 80, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0); // Forward
int itemNumber = 0;
if (this.m_Ascending)
for (int i = this.m_StartNumber; i < this.m_StartNumber + itemsPerPage && i < this.m_List.Count; i++)
this.DrawEntry(this.m_List[i], i, itemNumber++);
else //descending, go from bottom of list to the top
for (int i = this.m_List.Count - 1 - this.m_StartNumber; i >= 0 && i >= (this.m_List.Count - itemsPerPage - this.m_StartNumber); i--)
this.DrawEntry(this.m_List[i], i, itemNumber++);
this.DrawEndingEntry(itemNumber);
}
public virtual void DrawEndingEntry(int itemNumber)
{
}
public virtual bool HasRelationship(T o)
{
return false;
}
public virtual void DrawEntry(T o, int index, int itemNumber)
{
int width = 0;
for (int j = 0; j < this.m_Fields.Length; j++)
{
InfoField<T> f = this.m_Fields[j];
this.AddImageTiled(65 + width, 138 + itemNumber * 28, f.Width + 10, 26, 0xA40);
this.AddImageTiled(67 + width, 140 + itemNumber * 28, f.Width + 6, 22, 0xBBC);
this.AddHtmlText(70 + width, 141 + itemNumber * 28, f.Width, 20, this.GetValuesFor(o, this.m_Fields.Length)[j], false, false);
width += (f.Width + 12);
}
if (this.HasRelationship(o))
this.AddButton(40, 143 + itemNumber * 28, 0x8AF, 0x8AF, 200 + index, GumpButtonType.Reply, 0); //Info Button
else
this.AddButton(40, 143 + itemNumber * 28, 0x4B9, 0x4BA, 200 + index, GumpButtonType.Reply, 0); //Info Button
}
public override void OnResponse(NetState sender, RelayInfo info)
{
base.OnResponse(sender, info);
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (pm == null || !IsMember(pm, this.guild))
return;
int id = info.ButtonID;
switch( id )
{
case 5: //Filter
{
TextRelay t = info.GetTextEntry(1);
pm.SendGump(this.GetResentGump(this.player, this.guild, this.m_Comparer, this.m_Ascending, (t == null) ? "" : t.Text, 0));
break;
}
case 6: //Back
{
pm.SendGump(this.GetResentGump(this.player, this.guild, this.m_Comparer, this.m_Ascending, this.m_Filter, this.m_StartNumber - itemsPerPage));
break;
}
case 7: //Forward
{
pm.SendGump(this.GetResentGump(this.player, this.guild, this.m_Comparer, this.m_Ascending, this.m_Filter, this.m_StartNumber + itemsPerPage));
break;
}
}
if (id >= 100 && id < (100 + this.m_Fields.Length))
{
IComparer<T> comparer = this.m_Fields[id - 100].Comparer;
if (this.m_Comparer.GetType() == comparer.GetType())
this.m_Ascending = !this.m_Ascending;
pm.SendGump(this.GetResentGump(this.player, this.guild, comparer, this.m_Ascending, this.m_Filter, 0));
}
else if (id >= 200 && id < (200 + this.m_List.Count))
{
pm.SendGump(this.GetObjectInfoGump(this.player, this.guild, this.m_List[id - 200]));
}
}
public abstract Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<T> comparer, bool ascending, string filter, int startNumber);
public abstract Gump GetObjectInfoGump(PlayerMobile pm, Guild g, T o);
public void ResendGump()
{
this.player.SendGump(this.GetResentGump(this.player, this.guild, this.m_Comparer, this.m_Ascending, this.m_Filter, this.m_StartNumber));
}
protected abstract TextDefinition[] GetValuesFor(T o, int aryLength);
protected abstract bool IsFiltered(T o, string filter);
}
}

View File

@@ -0,0 +1,102 @@
using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public class CreateGuildGump : Gump
{
public CreateGuildGump(PlayerMobile pm)
: this(pm, "Guild Name", "")
{
}
public CreateGuildGump(PlayerMobile pm, string guildName, string guildAbbrev)
: base(10, 10)
{
pm.CloseGump(typeof(CreateGuildGump));
pm.CloseGump(typeof(BaseGuildGump));
this.AddPage(0);
this.AddBackground(0, 0, 500, 300, 0x2422);
this.AddHtmlLocalized(25, 20, 450, 25, 1062939, 0x0, true, false); // <center>GUILD MENU</center>
this.AddHtmlLocalized(25, 60, 450, 60, 1062940, 0x0, false, false); // As you are not a member of any guild, you can create your own by providing a unique guild name and paying the standard guild registration fee.
this.AddHtmlLocalized(25, 135, 120, 25, 1062941, 0x0, false, false); // Registration Fee:
this.AddLabel(155, 135, 0x481, Guild.RegistrationFee.ToString());
this.AddHtmlLocalized(25, 165, 120, 25, 1011140, 0x0, false, false); // Enter Guild Name:
this.AddBackground(155, 160, 320, 26, 0xBB8);
this.AddTextEntry(160, 163, 315, 21, 0x481, 5, guildName);
this.AddHtmlLocalized(25, 191, 120, 26, 1063035, 0x0, false, false); // Abbreviation:
this.AddBackground(155, 186, 320, 26, 0xBB8);
this.AddTextEntry(160, 189, 315, 21, 0x481, 6, guildAbbrev);
this.AddButton(415, 217, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
this.AddButton(345, 217, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0);
if (pm.AcceptGuildInvites)
this.AddButton(20, 260, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0);
else
this.AddButton(20, 260, 0xD3, 0xD2, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(45, 260, 200, 30, 1062943, 0x0, false, false); // <i>Ignore Guild Invites</i>
}
public override void OnResponse(NetState sender, RelayInfo info)
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (pm == null || pm.Guild != null)
return; //Sanity
switch( info.ButtonID )
{
case 1:
{
TextRelay tName = info.GetTextEntry(5);
TextRelay tAbbrev = info.GetTextEntry(6);
string guildName = (tName == null) ? "" : tName.Text;
string guildAbbrev = (tAbbrev == null) ? "" : tAbbrev.Text;
guildName = Utility.FixHtml(guildName.Trim());
guildAbbrev = Utility.FixHtml(guildAbbrev.Trim());
if (guildName.Length <= 0)
pm.SendLocalizedMessage(1070884); // Guild name cannot be blank.
else if (guildAbbrev.Length <= 0)
pm.SendLocalizedMessage(1070885); // You must provide a guild abbreviation.
else if (guildName.Length > Guild.NameLimit)
pm.SendLocalizedMessage(1063036, Guild.NameLimit.ToString()); // A guild name cannot be more than ~1_val~ characters in length.
else if (guildAbbrev.Length > Guild.AbbrevLimit)
pm.SendLocalizedMessage(1063037, Guild.AbbrevLimit.ToString()); // An abbreviation cannot exceed ~1_val~ characters in length.
else if (Guild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev))
pm.SendLocalizedMessage(501153); // That abbreviation is not available.
else if (Guild.FindByName(guildName) != null || !BaseGuildGump.CheckProfanity(guildName))
pm.SendLocalizedMessage(1063000); // That guild name is not available.
else if (!Banker.Withdraw(pm, Guild.RegistrationFee))
pm.SendLocalizedMessage(1063001, Guild.RegistrationFee.ToString()); // You do not possess the ~1_val~ gold piece fee required to create a guild.
else
{
pm.SendLocalizedMessage(1060398, Guild.RegistrationFee.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
pm.SendLocalizedMessage(1063238); // Your new guild has been founded.
pm.Guild = new Guild(pm, guildName, guildAbbrev);
}
break;
}
case 2:
{
pm.AcceptGuildInvites = !pm.AcceptGuildInvites;
if (pm.AcceptGuildInvites)
pm.SendLocalizedMessage(1070699); // You are now accepting guild invitations.
else
pm.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
break;
}
}
}
}
}

View File

@@ -0,0 +1,288 @@
using System;
using System.Collections.Generic;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public enum GuildDisplayType
{
All,
AwaitingAction,
Relations
}
public class GuildDiplomacyGump : BaseGuildListGump<Guild>
{
protected virtual bool AllowAdvancedSearch
{
get
{
return true;
}
}
#region Comparers
private class NameComparer : IComparer<Guild>
{
public static readonly IComparer<Guild> Instance = new NameComparer();
public NameComparer()
{
}
public int Compare(Guild x, Guild y)
{
if (x == null && y == null)
return 0;
else if (x == null)
return -1;
else if (y == null)
return 1;
return Insensitive.Compare(x.Name, y.Name);
}
}
private class StatusComparer : IComparer<Guild>
{
private enum GuildCompareStatus
{
Peace,
Ally,
War
}
private readonly Guild m_Guild;
public StatusComparer(Guild g)
{
this.m_Guild = g;
}
public int Compare(Guild x, Guild y)
{
if (x == null && y == null)
return 0;
else if (x == null)
return -1;
else if (y == null)
return 1;
GuildCompareStatus aStatus = GuildCompareStatus.Peace;
GuildCompareStatus bStatus = GuildCompareStatus.Peace;
if (this.m_Guild.IsAlly(x))
aStatus = GuildCompareStatus.Ally;
else if (this.m_Guild.IsWar(x))
aStatus = GuildCompareStatus.War;
if (this.m_Guild.IsAlly(y))
bStatus = GuildCompareStatus.Ally;
else if (this.m_Guild.IsWar(y))
bStatus = GuildCompareStatus.War;
return ((int)aStatus).CompareTo((int)bStatus);
}
}
private class AbbrevComparer : IComparer<Guild>
{
public static readonly IComparer<Guild> Instance = new AbbrevComparer();
public AbbrevComparer()
{
}
public int Compare(Guild x, Guild y)
{
if (x == null && y == null)
return 0;
else if (x == null)
return -1;
else if (y == null)
return 1;
return Insensitive.Compare(x.Abbreviation, y.Abbreviation);
}
}
#endregion
GuildDisplayType m_Display;
readonly TextDefinition m_LowerText;
public GuildDiplomacyGump(PlayerMobile pm, Guild g)
: this(pm, g, GuildDiplomacyGump.NameComparer.Instance, true, "", 0, GuildDisplayType.All, Utility.CastConvertList<BaseGuild, Guild>(new List<BaseGuild>(Guild.List.Values)), (1063136 + (int)GuildDisplayType.All))
{
}
public GuildDiplomacyGump(PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter, int startNumber, GuildDisplayType display)
: this(pm, g, currentComparer, ascending, filter, startNumber, display, Utility.CastConvertList<BaseGuild, Guild>(new List<BaseGuild>(Guild.List.Values)), (1063136 + (int)display))
{
}
public GuildDiplomacyGump(PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter, int startNumber, List<Guild> list, TextDefinition lowerText)
: this(pm, g, currentComparer, ascending, filter, startNumber, GuildDisplayType.All, list, lowerText)
{
}
public GuildDiplomacyGump(PlayerMobile pm, Guild g, bool ascending, string filter, int startNumber, List<Guild> list, TextDefinition lowerText)
: this(pm, g, GuildDiplomacyGump.NameComparer.Instance, ascending, filter, startNumber, GuildDisplayType.All, list, lowerText)
{
}
public GuildDiplomacyGump(PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter, int startNumber, GuildDisplayType display, List<Guild> list, TextDefinition lowerText)
: base(pm, g, list, currentComparer, ascending, filter, startNumber,
new InfoField<Guild>[]
{
new InfoField<Guild>(1062954, 280, GuildDiplomacyGump.NameComparer.Instance), //Guild Name
new InfoField<Guild>(1062957, 50, GuildDiplomacyGump.AbbrevComparer.Instance), //Abbrev
new InfoField<Guild>(1062958, 120, new GuildDiplomacyGump.StatusComparer(g))//Guild Title
})
{
this.m_Display = display;
this.m_LowerText = lowerText;
this.PopulateGump();
}
public override void PopulateGump()
{
base.PopulateGump();
this.AddHtmlLocalized(431, 43, 110, 26, 1062978, 0xF, false, false); // Diplomacy
}
protected override TextDefinition[] GetValuesFor(Guild g, int aryLength)
{
TextDefinition[] defs = new TextDefinition[aryLength];
defs[0] = (g == this.guild) ? Color(g.Name, 0x006600) : g.Name;
defs[1] = g.Abbreviation;
defs[2] = 3000085; //Peace
if (this.guild.IsAlly(g))
{
if (this.guild.Alliance.Leader == g)
defs[2] = 1063237; // Alliance Leader
else
defs[2] = 1062964; // Ally
}
else if (this.guild.IsWar(g))
{
defs[2] = 3000086; // War
}
return defs;
}
public override bool HasRelationship(Guild g)
{
if (g == this.guild)
return false;
if (this.guild.FindPendingWar(g) != null)
return true;
AllianceInfo alliance = this.guild.Alliance;
if (alliance != null)
{
Guild leader = alliance.Leader;
if (leader != null)
{
if (this.guild == leader && alliance.IsPendingMember(g) || g == leader && alliance.IsPendingMember(this.guild))
return true;
}
else if (alliance.IsPendingMember(g))
return true;
}
return false;
}
public override void DrawEndingEntry(int itemNumber)
{
//AddHtmlLocalized( 66, 153 + itemNumber * 28, 280, 26, 1063136 + (int)m_Display, 0xF, false, false ); // Showing All Guilds/Awaiting Action/ w/Relation Ship
//AddHtmlText( 66, 153 + itemNumber * 28, 280, 26, m_LowerText, false, false );
if (this.m_LowerText != null && this.m_LowerText.Number > 0)
this.AddHtmlLocalized(66, 153 + itemNumber * 28, 280, 26, this.m_LowerText.Number, 0xF, false, false);
else if (this.m_LowerText != null && this.m_LowerText.String != null)
this.AddHtml(66, 153 + itemNumber * 28, 280, 26, Color(this.m_LowerText.String, 0x99), false, false);
if (this.AllowAdvancedSearch)
{
this.AddBackground(350, 148 + itemNumber * 28, 200, 26, 0x2486);
this.AddButton(355, 153 + itemNumber * 28, 0x845, 0x846, 8, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(380, 151 + itemNumber * 28, 160, 26, 1063083, 0x0, false, false); // Advanced Search
}
}
protected override bool IsFiltered(Guild g, string filter)
{
if (g == null)
return true;
switch( this.m_Display )
{
case GuildDisplayType.Relations:
{
//if( !( guild.IsWar( g ) || guild.IsAlly( g ) ) )
if (!(this.guild.FindActiveWar(g) != null || this.guild.IsAlly(g))) //As per OSI, only the guild leader wars show up under the sorting by relation
return true;
return false;
}
case GuildDisplayType.AwaitingAction:
{
return !this.HasRelationship(g);
}
}
return !(Insensitive.Contains(g.Name, filter) || Insensitive.Contains(g.Abbreviation, filter));
}
public override bool WillFilter
{
get
{
if (this.m_Display == GuildDisplayType.All)
return base.WillFilter;
return true;
}
}
public override Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<Guild> comparer, bool ascending, string filter, int startNumber)
{
return new GuildDiplomacyGump(pm, g, comparer, ascending, filter, startNumber, this.m_Display);
}
public override Gump GetObjectInfoGump(PlayerMobile pm, Guild g, Guild o)
{
if (this.guild == o)
return new GuildInfoGump(pm, g);
return new OtherGuildInfo(pm, g, (Guild)o);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
base.OnResponse(sender, info);
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (pm == null || !IsMember(pm, this.guild))
return;
if (this.AllowAdvancedSearch && info.ButtonID == 8)
pm.SendGump(new GuildAdvancedSearchGump(pm, this.guild, this.m_Display, new SearchSelectionCallback(AdvancedSearch_Callback)));
}
public void AdvancedSearch_Callback(GuildDisplayType display)
{
this.m_Display = display;
this.ResendGump();
}
}
}

View File

@@ -0,0 +1,225 @@
using System;
using Server.Factions;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public class GuildInfoGump : BaseGuildGump
{
private readonly bool m_IsResigning;
private readonly bool m_IsResigningVvV;
public GuildInfoGump(PlayerMobile pm, Guild g)
: this(pm, g, false, false)
{
}
public GuildInfoGump(PlayerMobile pm, Guild g, bool isResigning, bool isResigningVvV)
: base(pm, g)
{
this.m_IsResigning = isResigning;
this.m_IsResigningVvV = isResigningVvV;
this.PopulateGump();
}
public override void PopulateGump()
{
bool isLeader = IsLeader(this.player, this.guild);
base.PopulateGump();
this.AddHtmlLocalized(96, 43, 110, 26, 1063014, 0xF, false, false); // My Guild
this.AddImageTiled(65, 80, 160, 26, 0xA40);
this.AddImageTiled(67, 82, 156, 22, 0xBBC);
this.AddHtmlLocalized(70, 83, 150, 20, 1062954, 0x0, false, false); // <i>Guild Name</i>
this.AddHtml(233, 84, 320, 26, this.guild.Name, false, false);
this.AddImageTiled(65, 114, 160, 26, 0xA40);
this.AddImageTiled(67, 116, 156, 22, 0xBBC);
this.AddHtmlLocalized(70, 117, 150, 20, 1063025, 0x0, false, false); // <i>Alliance</i>
if (this.guild.Alliance != null && this.guild.Alliance.IsMember(this.guild))
{
this.AddHtml(233, 118, 320, 26, this.guild.Alliance.Name, false, false);
this.AddButton(40, 120, 0x4B9, 0x4BA, 6, GumpButtonType.Reply, 0); //Alliance Roster
}
this.AddImageTiled(65, 148, 160, 26, 0xA40);
this.AddImageTiled(67, 150, 156, 22, 0xBBC);
this.AddHtmlLocalized(70, 151, 150, 20, 1063084, 0x0, false, false); // <i>Guild Faction</i>
Faction f = Faction.Find(this.guild.Leader);
if (f != null)
this.AddHtml(233, 152, 320, 26, f.ToString(), false, false);
this.AddImageTiled(65, 196, 480, 4, 0x238D);
string s = this.guild.Charter;
if (String.IsNullOrEmpty(s))
s = "The guild leader has not yet set the guild charter.";
this.AddHtml(65, 216, 480, 80, s, true, true);
if (isLeader)
this.AddButton(40, 251, 0x4B9, 0x4BA, 4, GumpButtonType.Reply, 0); //Charter Edit button
s = this.guild.Website;
if (string.IsNullOrEmpty(s))
s = "Guild website not yet set.";
this.AddHtml(65, 306, 480, 30, s, true, false);
if (isLeader)
this.AddButton(40, 313, 0x4B9, 0x4BA, 5, GumpButtonType.Reply, 0); //Website Edit button
AddBackground(65, 370, 170, 26, 0x2486);
if (Server.Engines.VvV.ViceVsVirtueSystem.Enabled)
{
if (Server.Engines.VvV.ViceVsVirtueSystem.IsVvV(player))
{
AddButton(67, 375, 0x4B9, 0x4BA, 9, GumpButtonType.Reply, 0); // Resign Vice vs Virtue
AddHtmlLocalized(92, 373, 170, 26, 1155557, m_IsResigningVvV ? 0x5000 : 0, false, false);
AddBackground(255, 370, 170, 26, 0x2486);
AddButton(257, 375, 0x4B9, 0x4BA, 10, GumpButtonType.Reply, 0);
AddHtmlLocalized(282, 373, 150, 26, 1114982, false, false); // Leaderboards
}
else
{
AddButton(67, 375, 0x4B9, 0x4BA, 8, GumpButtonType.Reply, 0);
AddHtmlLocalized(92, 373, 170, 26, 1155556, false, false); // Join Vice vs Virtue
}
}
AddBackground(445, 370, 100, 26, 0x2486);
AddButton(447, 375, 0x845, 0x846, 7, GumpButtonType.Reply, 0);
AddHtmlLocalized(472, 373, 60, 26, 3006115, (this.m_IsResigning) ? 0x5000 : 0, false, false); // Resign
}
public override void OnResponse(NetState sender, RelayInfo info)
{
base.OnResponse(sender, info);
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (!IsMember(pm, this.guild))
return;
pm.DisplayGuildTitle = info.IsSwitched(0);
switch (info.ButtonID)
{
//1-3 handled by base.OnResponse
case 4:
{
if (IsLeader(pm, this.guild))
{
pm.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
pm.BeginPrompt(new PromptCallback(SetCharter_Callback), true); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
}
break;
}
case 5:
{
if (IsLeader(pm, this.guild))
{
pm.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
pm.BeginPrompt(new PromptCallback(SetWebsite_Callback), true); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
}
break;
}
case 6:
{
//Alliance Roster
if (this.guild.Alliance != null && this.guild.Alliance.IsMember(this.guild))
pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, this.guild, this.guild.Alliance));
break;
}
case 7:
{
//Resign
if (!this.m_IsResigning)
{
pm.SendLocalizedMessage(1063332); // Are you sure you wish to resign from your guild?
pm.SendGump(new GuildInfoGump(pm, this.guild, true, false));
}
else
{
this.guild.RemoveMember(pm, 1063411); // You resign from your guild.
}
break;
}
case 8:
if (pm.Young)
{
pm.SendLocalizedMessage(1155562); // Young players may not join Vice vs Virtue. Renounce your young player status by saying, "I renounce my young player status" and try again.
}
else
{
pm.SendGump(new Server.Engines.VvV.ConfirmSignupGump(pm));
}
break;
case 9:
if (Server.Engines.Points.PointsSystem.ViceVsVirtue.IsResigning(pm, guild))
{
pm.SendLocalizedMessage(1155560); // You are currently in the process of quitting Vice vs Virtue.
}
else if (m_IsResigningVvV)
{
pm.SendLocalizedMessage(1155559); // You have begun the Vice vs Virtue resignation process. You will be removed from VvV in 3 days.
Server.Engines.Points.PointsSystem.ViceVsVirtue.OnResign(pm);
}
else
{
pm.SendLocalizedMessage(1155558); // Are you sure you wish to resign from Vice vs Virtue? You will not be allowed to rejoin for 3 days.
pm.SendGump(new GuildInfoGump(pm, guild, false, true));
}
break;
case 10:
pm.SendGump(new Server.Engines.VvV.ViceVsVirtueLeaderboardGump(pm));
break;
}
}
public void SetCharter_Callback(Mobile from, string text)
{
if (!IsLeader(from, this.guild))
return;
string charter = Utility.FixHtml(text.Trim());
if (charter.Length > 50)
{
from.SendLocalizedMessage(1070774, "50"); // Your guild charter cannot exceed ~1_val~ characters.
}
else
{
this.guild.Charter = charter;
from.SendLocalizedMessage(1070775); // You submit a new guild charter.
return;
}
}
public void SetWebsite_Callback(Mobile from, string text)
{
if (!IsLeader(from, this.guild))
return;
string site = Utility.FixHtml(text.Trim());
if (site.Length > 50)
from.SendLocalizedMessage(1070777, "50"); // Your guild website cannot exceed ~1_val~ characters.
else
{
this.guild.Website = site;
from.SendLocalizedMessage(1070778); // You submit a new guild website.
return;
}
}
}
}

View File

@@ -0,0 +1,62 @@
using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public class GuildInvitationRequest : BaseGuildGump
{
readonly PlayerMobile m_Inviter;
public GuildInvitationRequest(PlayerMobile pm, Guild g, PlayerMobile inviter)
: base(pm, g)
{
this.m_Inviter = inviter;
this.PopulateGump();
}
public override void PopulateGump()
{
this.AddPage(0);
this.AddBackground(0, 0, 350, 170, 0x2422);
this.AddHtmlLocalized(25, 20, 300, 45, 1062946, 0x0, true, false); // <center>You have been invited to join a guild! (Warning: Accepting will make you attackable!)</center>
this.AddHtml(25, 75, 300, 25, String.Format("<center>{0}</center>", this.guild.Name), true, false);
this.AddButton(265, 130, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
this.AddButton(195, 130, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0);
this.AddButton(20, 130, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(45, 130, 150, 30, 1062943, 0x0, false, false); // <i>Ignore Guild Invites</i>
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (this.guild.Disbanded || this.player.Guild != null)
return;
switch( info.ButtonID )
{
case 0:
{
this.m_Inviter.SendLocalizedMessage(1063250, String.Format("{0}\t{1}", this.player.Name, this.guild.Name)); // ~1_val~ has declined your invitation to join ~2_val~.
break;
}
case 1:
{
this.guild.AddMember(this.player);
this.player.SendLocalizedMessage(1063056, this.guild.Name); // You have joined ~1_val~.
this.m_Inviter.SendLocalizedMessage(1063249, String.Format("{0}\t{1}", this.player.Name, this.guild.Name)); // ~1_val~ has accepted your invitation to join ~2_val~.
break;
}
case 2:
{
this.player.AcceptGuildInvites = false;
this.player.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
break;
}
}
}
}
}

View File

@@ -0,0 +1,227 @@
using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public class GuildMemberInfoGump : BaseGuildGump
{
readonly PlayerMobile m_Member;
readonly bool m_ToLeader;
readonly bool m_toKick;
public GuildMemberInfoGump(PlayerMobile pm, Guild g, PlayerMobile member, bool toKick, bool toPromoteToLeader)
: base(pm, g, 10, 40)
{
this.m_ToLeader = toPromoteToLeader;
this.m_toKick = toKick;
this.m_Member = member;
this.PopulateGump();
}
public override void PopulateGump()
{
this.AddPage(0);
this.AddBackground(0, 0, 350, 255, 0x242C);
this.AddHtmlLocalized(20, 15, 310, 26, 1063018, 0x0, false, false); // <div align=center><i>Guild Member Information</i></div>
this.AddImageTiled(20, 40, 310, 2, 0x2711);
this.AddHtmlLocalized(20, 50, 150, 26, 1062955, 0x0, true, false); // <i>Name</i>
this.AddHtml(180, 53, 150, 26, this.m_Member.Name, false, false);
this.AddHtmlLocalized(20, 80, 150, 26, 1062956, 0x0, true, false); // <i>Rank</i>
this.AddHtmlLocalized(180, 83, 150, 26, this.m_Member.GuildRank.Name, 0x0, false, false);
this.AddHtmlLocalized(20, 110, 150, 26, 1062953, 0x0, true, false); // <i>Guild Title</i>
this.AddHtml(180, 113, 150, 26, this.m_Member.GuildTitle, false, false);
this.AddImageTiled(20, 142, 310, 2, 0x2711);
this.AddBackground(20, 150, 310, 26, 0x2486);
this.AddButton(25, 155, 0x845, 0x846, 4, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(50, 153, 270, 26, (this.m_Member == this.player.GuildFealty && this.guild.Leader != this.m_Member) ? 1063082 : 1062996, 0x0, false, false); // Clear/Cast Vote For This Member
this.AddBackground(20, 180, 150, 26, 0x2486);
this.AddButton(25, 185, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(50, 183, 110, 26, 1062993, (this.m_ToLeader) ? 0x990000 : 0, false, false); // Promote
this.AddBackground(180, 180, 150, 26, 0x2486);
this.AddButton(185, 185, 0x845, 0x846, 3, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(210, 183, 110, 26, 1062995, 0x0, false, false); // Set Guild Title
this.AddBackground(20, 210, 150, 26, 0x2486);
this.AddButton(25, 215, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(50, 213, 110, 26, 1062994, 0x0, false, false); // Demote
this.AddBackground(180, 210, 150, 26, 0x2486);
this.AddButton(185, 215, 0x845, 0x846, 5, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(210, 213, 110, 26, 1062997, (this.m_toKick) ? 0x5000 : 0, false, false); // Kick
}
public override void OnResponse(NetState sender, RelayInfo info)
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (pm == null || !IsMember(pm, this.guild) || !IsMember(this.m_Member, this.guild))
return;
RankDefinition playerRank = pm.GuildRank;
RankDefinition targetRank = this.m_Member.GuildRank;
switch( info.ButtonID )
{
case 1: //Promote
{
if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && ((playerRank.Rank - 1) > targetRank.Rank || (playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank)))
{
targetRank = RankDefinition.Ranks[targetRank.Rank + 1];
if (targetRank == RankDefinition.Leader)
{
if (this.m_ToLeader)
{
this.m_Member.GuildRank = targetRank;
pm.SendLocalizedMessage(1063156, this.m_Member.Name); // The guild information for ~1_val~ has been updated.
pm.SendLocalizedMessage(1063156, pm.Name); // The guild information for ~1_val~ has been updated.
this.guild.Leader = this.m_Member;
}
else
{
pm.SendLocalizedMessage(1063144); // Are you sure you wish to make this member the new guild leader?
pm.SendGump(new GuildMemberInfoGump(this.player, this.guild, this.m_Member, false, true));
}
}
else
{
this.m_Member.GuildRank = targetRank;
pm.SendLocalizedMessage(1063156, this.m_Member.Name); // The guild information for ~1_val~ has been updated.
}
}
else
pm.SendLocalizedMessage(1063143); // You don't have permission to promote this member.
break;
}
case 2: //Demote
{
if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && playerRank.Rank > targetRank.Rank)
{
if (targetRank == RankDefinition.Lowest)
{
if (RankDefinition.Lowest.Name.Number == 1062963)
pm.SendLocalizedMessage(1063333); // You can't demote a ronin.
else
pm.SendMessage("You can't demote a {0}.", RankDefinition.Lowest.Name);
}
else
{
this.m_Member.GuildRank = RankDefinition.Ranks[targetRank.Rank - 1];
pm.SendLocalizedMessage(1063156, this.m_Member.Name); // The guild information for ~1_val~ has been updated.
}
}
else
pm.SendLocalizedMessage(1063146); // You don't have permission to demote this member.
break;
}
case 3: //Set Guild title
{
if (playerRank.GetFlag(RankFlags.CanSetGuildTitle) && (playerRank.Rank > targetRank.Rank || this.m_Member == this.player))
{
pm.SendLocalizedMessage(1011128); // Enter the new title for this guild member or 'none' to remove a title:
pm.BeginPrompt(new PromptCallback(SetTitle_Callback));
}
else if (this.m_Member.GuildTitle == null || this.m_Member.GuildTitle.Length <= 0)
{
pm.SendLocalizedMessage(1070746); // You don't have the permission to set that member's guild title.
}
else
{
pm.SendLocalizedMessage(1063148); // You don't have permission to change this member's guild title.
}
break;
}
case 4: //Vote
{
if (this.m_Member == pm.GuildFealty && this.guild.Leader != this.m_Member)
pm.SendLocalizedMessage(1063158); // You have cleared your vote for guild leader.
else if (this.guild.CanVote(this.m_Member))//( playerRank.GetFlag( RankFlags.CanVote ) )
{
if (this.m_Member == this.guild.Leader)
pm.SendLocalizedMessage(1063424); // You can't vote for the current guild leader.
else if (!this.guild.CanBeVotedFor(this.m_Member))
pm.SendLocalizedMessage(1063425); // You can't vote for an inactive guild member.
else
{
pm.GuildFealty = this.m_Member;
pm.SendLocalizedMessage(1063159, this.m_Member.Name); // You cast your vote for ~1_val~ for guild leader.
}
}
else
pm.SendLocalizedMessage(1063149); // You don't have permission to vote.
break;
}
case 5: //Kick
{
if ((playerRank.GetFlag(RankFlags.RemovePlayers) && playerRank.Rank > targetRank.Rank) || (playerRank.GetFlag(RankFlags.RemoveLowestRank) && targetRank == RankDefinition.Lowest))
{
if (this.m_toKick)
{
this.guild.RemoveMember(this.m_Member);
pm.SendLocalizedMessage(1063157); // The member has been removed from your guild.
}
else
{
pm.SendLocalizedMessage(1063152); // Are you sure you wish to kick this member from the guild?
pm.SendGump(new GuildMemberInfoGump(this.player, this.guild, this.m_Member, true, false));
}
}
else
pm.SendLocalizedMessage(1063151); // You don't have permission to remove this member.
break;
}
}
}
public void SetTitle_Callback(Mobile from, string text)
{
PlayerMobile pm = from as PlayerMobile;
PlayerMobile targ = this.m_Member;
if (pm == null || targ == null)
return;
Guild g = targ.Guild as Guild;
if (g == null || !IsMember(pm, g) || !(pm.GuildRank.GetFlag(RankFlags.CanSetGuildTitle) && (pm.GuildRank.Rank > targ.GuildRank.Rank || pm == targ)))
{
if (this.m_Member.GuildTitle == null || this.m_Member.GuildTitle.Length <= 0)
pm.SendLocalizedMessage(1070746); // You don't have the permission to set that member's guild title.
else
pm.SendLocalizedMessage(1063148); // You don't have permission to change this member's guild title.
return;
}
string title = Utility.FixHtml(text.Trim());
if (title.Length > 20)
from.SendLocalizedMessage(501178); // That title is too long.
else if (!BaseGuildGump.CheckProfanity(title))
from.SendLocalizedMessage(501179); // That title is disallowed.
else
{
if (Insensitive.Equals(title, "none"))
targ.GuildTitle = null;
else
targ.GuildTitle = title;
pm.SendLocalizedMessage(1063156, targ.Name); // The guild information for ~1_val~ has been updated.
}
}
}
}

View File

@@ -0,0 +1,267 @@
using System;
using System.Collections.Generic;
using Server.Factions;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public class GuildRosterGump : BaseGuildListGump<PlayerMobile>
{
#region Comparers
private class NameComparer : IComparer<PlayerMobile>
{
public static readonly IComparer<PlayerMobile> Instance = new NameComparer();
public NameComparer()
{
}
public int Compare(PlayerMobile x, PlayerMobile y)
{
if (x == null && y == null)
return 0;
else if (x == null)
return -1;
else if (y == null)
return 1;
return Insensitive.Compare(x.Name, y.Name);
}
}
private class LastOnComparer : IComparer<PlayerMobile>
{
public static readonly IComparer<PlayerMobile> Instance = new LastOnComparer();
public LastOnComparer()
{
}
public int Compare(PlayerMobile x, PlayerMobile y)
{
if (x == null && y == null)
return 0;
else if (x == null)
return -1;
else if (y == null)
return 1;
NetState aState = x.NetState;
NetState bState = y.NetState;
if (aState == null && bState == null)
return x.LastOnline.CompareTo(y.LastOnline);
else if (aState == null)
return 1;
else if (bState == null)
return -1;
else
return 0;
}
}
private class TitleComparer : IComparer<PlayerMobile>
{
public static readonly IComparer<PlayerMobile> Instance = new TitleComparer();
public TitleComparer()
{
}
public int Compare(PlayerMobile x, PlayerMobile y)
{
if (x == null && y == null)
return 0;
else if (x == null)
return -1;
else if (y == null)
return 1;
return Insensitive.Compare(x.GuildTitle, y.GuildTitle);
}
}
private class RankComparer : IComparer<PlayerMobile>
{
public static readonly IComparer<PlayerMobile> Instance = new RankComparer();
public RankComparer()
{
}
public int Compare(PlayerMobile x, PlayerMobile y)
{
if (x == null && y == null)
return 0;
else if (x == null)
return -1;
else if (y == null)
return 1;
return x.GuildRank.Rank.CompareTo(y.GuildRank.Rank);
}
}
#endregion
private static readonly InfoField<PlayerMobile>[] m_Fields = new InfoField<PlayerMobile>[]
{
new InfoField<PlayerMobile>(1062955, 130, GuildRosterGump.NameComparer.Instance), //Name
new InfoField<PlayerMobile>(1062956, 80, GuildRosterGump.RankComparer.Instance), //Rank
new InfoField<PlayerMobile>(1062952, 80, GuildRosterGump.LastOnComparer.Instance), //Last On
new InfoField<PlayerMobile>(1062953, 150, GuildRosterGump.TitleComparer.Instance)//Guild Title
};
public GuildRosterGump(PlayerMobile pm, Guild g)
: this(pm, g, GuildRosterGump.LastOnComparer.Instance, true, "", 0)
{
}
public GuildRosterGump(PlayerMobile pm, Guild g, IComparer<PlayerMobile> currentComparer, bool ascending, string filter, int startNumber)
: base(pm, g, Utility.SafeConvertList<Mobile, PlayerMobile>(g.Members), currentComparer, ascending, filter, startNumber, m_Fields)
{
PopulateGump();
}
public override void PopulateGump()
{
base.PopulateGump();
AddHtmlLocalized(266, 43, 110, 26, 1062974, 0xF, false, false); // Guild Roster
}
public override void DrawEndingEntry(int itemNumber)
{
AddBackground(225, 148 + itemNumber * 28, 150, 26, 0x2486);
AddButton(230, 153 + itemNumber * 28, 0x845, 0x846, 8, GumpButtonType.Reply, 0);
AddHtmlLocalized(255, 151 + itemNumber * 28, 110, 26, 1062992, 0x0, false, false); // Invite Player
}
protected override TextDefinition[] GetValuesFor(PlayerMobile pm, int aryLength)
{
TextDefinition[] defs = new TextDefinition[aryLength];
string name = String.Format("{0} {1}{2}",
pm.Name,
Engines.VvV.ViceVsVirtueSystem.IsVvV(pm) ? "VvV" : "",
(player.GuildFealty == pm && player.GuildFealty != guild.Leader) ? " *" : "");
if (pm == player)
name = Color(name, 0x006600);
else if (pm.NetState != null)
name = Color(name, 0x000066);
defs[0] = name;
defs[1] = pm.GuildRank.Name;
defs[2] = (pm.NetState != null) ? new TextDefinition(1063015) : new TextDefinition(pm.LastOnline.ToString("yyyy-MM-dd"));
defs[3] = (pm.GuildTitle == null) ? "" : pm.GuildTitle;
return defs;
}
protected override bool IsFiltered(PlayerMobile pm, string filter)
{
if (pm == null)
return true;
return !Insensitive.Contains(pm.Name, filter);
}
public override Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<PlayerMobile> comparer, bool ascending, string filter, int startNumber)
{
return new GuildRosterGump(pm, g, comparer, ascending, filter, startNumber);
}
public override Gump GetObjectInfoGump(PlayerMobile pm, Guild g, PlayerMobile o)
{
return new GuildMemberInfoGump(pm, g, o, false, false);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
base.OnResponse(sender, info);
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (pm == null || !IsMember(pm, guild))
return;
if (info.ButtonID == 8)
{
if (pm.GuildRank.GetFlag(RankFlags.CanInvitePlayer))
{
pm.SendLocalizedMessage(1063048); // Whom do you wish to invite into your guild?
pm.BeginTarget(-1, false, Targeting.TargetFlags.None, new TargetStateCallback(InvitePlayer_Callback), guild);
}
else
pm.SendLocalizedMessage(503301); // You don't have permission to do that.
}
}
public void InvitePlayer_Callback(Mobile from, object targeted, object state)
{
PlayerMobile pm = from as PlayerMobile;
PlayerMobile targ = targeted as PlayerMobile;
Guild g = state as Guild;
PlayerState guildState = PlayerState.Find(g.Leader);
PlayerState targetState = PlayerState.Find(targ);
Faction guildFaction = (guildState == null ? null : guildState.Faction);
Faction targetFaction = (targetState == null ? null : targetState.Faction);
if (pm == null || !IsMember(pm, guild) || !pm.GuildRank.GetFlag(RankFlags.CanInvitePlayer))
{
pm.SendLocalizedMessage(503301); // You don't have permission to do that.
}
else if (targ == null)
{
pm.SendLocalizedMessage(1063334); // That isn't a valid player.
}
else if (!targ.AcceptGuildInvites)
{
pm.SendLocalizedMessage(1063049, targ.Name); // ~1_val~ is not accepting guild invitations.
}
else if (g.IsMember(targ))
{
pm.SendLocalizedMessage(1063050, targ.Name); // ~1_val~ is already a member of your guild!
}
else if (targ.Guild != null)
{
pm.SendLocalizedMessage(1063051, targ.Name); // ~1_val~ is already a member of a guild.
}
else if (targ.HasGump(typeof(BaseGuildGump)) || targ.HasGump(typeof(CreateGuildGump))) //TODO: Check message if CreateGuildGump Open
{
pm.SendLocalizedMessage(1063052, targ.Name); // ~1_val~ is currently considering another guild invitation.
}
#region Factions
else if (targ.Young && guildFaction != null)
{
pm.SendLocalizedMessage(1070766); // You cannot invite a young player to your faction-aligned guild.
}
else if (guildFaction != targetFaction)
{
if (guildFaction == null)
pm.SendLocalizedMessage(1013027); // That player cannot join a non-faction guild.
else if (targetFaction == null)
pm.SendLocalizedMessage(1013026); // That player must be in a faction before joining this guild.
else
pm.SendLocalizedMessage(1013028); // That person has a different faction affiliation.
}
else if (targetState != null && targetState.IsLeaving)
{
// OSI does this quite strangely, so we'll just do it this way
pm.SendMessage("That person is quitting their faction and so you may not recruit them.");
}
#endregion
else
{
pm.SendLocalizedMessage(1063053, targ.Name); // You invite ~1_val~ to join your guild.
targ.SendGump(new GuildInvitationRequest(targ, guild, pm));
}
}
}
}

View File

@@ -0,0 +1,629 @@
using System;
using Server.Factions;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public class OtherGuildInfo : BaseGuildGump
{
private readonly Guild m_Other;
public OtherGuildInfo(PlayerMobile pm, Guild g, Guild otherGuild)
: base(pm, g, 10, 40)
{
this.m_Other = otherGuild;
g.CheckExpiredWars();
this.PopulateGump();
}
public void AddButtonAndBackground(int x, int y, int buttonID, int locNum)
{
this.AddBackground(x, y, 225, 26, 0x2486);
this.AddButton(x + 5, y + 5, 0x845, 0x846, buttonID, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(x + 30, y + 3, 185, 26, locNum, 0x0, false, false);
}
public override void PopulateGump()
{
Guild g = Guild.GetAllianceLeader(this.guild);
Guild other = Guild.GetAllianceLeader(this.m_Other);
WarDeclaration war = g.FindPendingWar(other);
WarDeclaration activeWar = g.FindActiveWar(other);
AllianceInfo alliance = this.guild.Alliance;
AllianceInfo otherAlliance = this.m_Other.Alliance;
//NOTE TO SELF: Only only alliance leader can see pending guild alliance statuses
bool PendingWar = (war != null);
bool ActiveWar = (activeWar != null);
this.AddPage(0);
this.AddBackground(0, 0, 520, 335, 0x242C);
this.AddHtmlLocalized(20, 15, 480, 26, 1062975, 0x0, false, false); // <div align=center><i>Guild Relationship</i></div>
this.AddImageTiled(20, 40, 480, 2, 0x2711);
this.AddHtmlLocalized(20, 50, 120, 26, 1062954, 0x0, true, false); // <i>Guild Name</i>
this.AddHtml(150, 53, 360, 26, this.m_Other.Name, false, false);
this.AddHtmlLocalized(20, 80, 120, 26, 1063025, 0x0, true, false); // <i>Alliance</i>
if (otherAlliance != null)
{
if (otherAlliance.IsMember(this.m_Other))
{
this.AddHtml(150, 83, 360, 26, otherAlliance.Name, false, false);
}
//else if( otherAlliance.Leader == guild && ( otherAlliance.IsPendingMember( m_Other ) || otherAlliance.IsPendingMember( guild ) ) )
/* else if( (otherAlliance.Leader == guild && otherAlliance.IsPendingMember( m_Other ) ) || ( otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) )
{
AddHtml( 150, 83, 360, 26, Color( alliance.Name, 0xF), false, false );
}
//AddHtml( 150, 83, 360, 26, ( alliance.PendingMembers.Contains( guild ) || alliance.PendingMembers.Contains( m_Other ) ) ? String.Format( "<basefont color=#blue>{0}</basefont>", alliance.Name ) : alliance.Name, false, false );
//AddHtml( 150, 83, 360, 26, ( otherAlliance == alliance && otherAlliance.PendingMembers.Contains( guild ) || otherAlliance.PendingMembers.Contains( m_Other ) ) ? String.Format( "<basefont color=#blue>{0}</basefont>", otherAlliance.Name ) : otherAlliance.Name, false, false );
*/
}
this.AddHtmlLocalized(20, 110, 120, 26, 1063139, 0x0, true, false); // <i>Abbreviation</i>
this.AddHtml(150, 113, 120, 26, this.m_Other.Abbreviation, false, false);
string kills = "0/0";
string time = "00:00";
string otherKills = "0/0";
WarDeclaration otherWar;
if (ActiveWar)
{
kills = String.Format("{0}/{1}", activeWar.Kills, activeWar.MaxKills);
TimeSpan timeRemaining = TimeSpan.Zero;
if (activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.UtcNow)
timeRemaining = (activeWar.WarBeginning + activeWar.WarLength) - DateTime.UtcNow;
//time = String.Format( "{0:D2}:{1:D2}", timeRemaining.Hours.ToString(), timeRemaining.Subtract( TimeSpan.FromHours( timeRemaining.Hours ) ).Minutes ); //Is there a formatter for htis? it's 2AM and I'm tired and can't find it
time = String.Format("{0:D2}:{1:mm}", timeRemaining.Hours, DateTime.MinValue + timeRemaining);
otherWar = this.m_Other.FindActiveWar(this.guild);
if (otherWar != null)
otherKills = String.Format("{0}/{1}", otherWar.Kills, otherWar.MaxKills);
}
else if (PendingWar)
{
kills = Color(String.Format("{0}/{1}", war.Kills, war.MaxKills), 0x990000);
//time = Color( String.Format( "{0}:{1}", war.WarLength.Hours, ((TimeSpan)(war.WarLength - TimeSpan.FromHours( war.WarLength.Hours ))).Minutes ), 0xFF0000 );
time = Color(String.Format("{0:D2}:{1:mm}", war.WarLength.Hours, DateTime.MinValue + war.WarLength), 0x990000);
otherWar = this.m_Other.FindPendingWar(this.guild);
if (otherWar != null)
otherKills = Color(String.Format("{0}/{1}", otherWar.Kills, otherWar.MaxKills), 0x990000);
}
this.AddHtmlLocalized(280, 110, 120, 26, 1062966, 0x0, true, false); // <i>Your Kills</i>
this.AddHtml(410, 113, 120, 26, kills, false, false);
this.AddHtmlLocalized(20, 140, 120, 26, 1062968, 0x0, true, false); // <i>Time Remaining</i>
this.AddHtml(150, 143, 120, 26, time, false, false);
this.AddHtmlLocalized(280, 140, 120, 26, 1062967, 0x0, true, false); // <i>Their Kills</i>
this.AddHtml(410, 143, 120, 26, otherKills, false, false);
this.AddImageTiled(20, 172, 480, 2, 0x2711);
int number = 1062973;// <div align=center>You are at peace with this guild.</div>
if (PendingWar)
{
if (war.WarRequester)
{
number = 1063027; // <div align=center>You have challenged this guild to war!</div>
}
else
{
number = 1062969; // <div align=center>This guild has challenged you to war!</div>
this.AddButtonAndBackground(20, 260, 5, 1062981); // Accept Challenge
this.AddButtonAndBackground(275, 260, 6, 1062983); //Modify Terms
}
this.AddButtonAndBackground(20, 290, 7, 1062982); // Dismiss Challenge
}
else if (ActiveWar)
{
number = 1062965; // <div align=center>You are at war with this guild!</div>
this.AddButtonAndBackground(20, 290, 8, 1062980); // Surrender
}
else if (alliance != null && alliance == otherAlliance) //alliance, Same Alliance
{
if (alliance.IsMember(this.guild) && alliance.IsMember(this.m_Other)) //Both in Same alliance, full members
{
number = 1062970; // <div align=center>You are allied with this guild.</div>
if (alliance.Leader == this.guild)
{
this.AddButtonAndBackground(20, 260, 12, 1062984); // Remove Guild from Alliance
this.AddButtonAndBackground(275, 260, 13, 1063433); // Promote to Alliance Leader //Note: No 'confirmation' like the other leader guild promotion things
//Remove guild from alliance //Promote to Alliance Leader
}
//Show roster, Centered, up
this.AddButtonAndBackground(148, 215, 10, 1063164); //Show Alliance Roster
//Leave Alliance
this.AddButtonAndBackground(20, 290, 11, 1062985); // Leave Alliance
}
else if (alliance.Leader == this.guild && alliance.IsPendingMember(this.m_Other))
{
number = 1062971; // <div align=center>You have requested an alliance with this guild.</div>
//Show Alliance Roster, Centered, down.
this.AddButtonAndBackground(148, 245, 10, 1063164); //Show Alliance Roster
//Withdraw Request
this.AddButtonAndBackground(20, 290, 14, 1062986); // Withdraw Request
this.AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99), false, false);
}
else if (alliance.Leader == this.m_Other && alliance.IsPendingMember(this.guild))
{
number = 1062972; // <div align=center>This guild has requested an alliance.</div>
//Show alliance Roster, top
this.AddButtonAndBackground(148, 215, 10, 1063164); //Show Alliance Roster
//Deny Request
//Accept Request
this.AddButtonAndBackground(20, 260, 15, 1062988); // Deny Request
this.AddButtonAndBackground(20, 290, 16, 1062987); // Accept Request
this.AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99), false, false);
}
}
else
{
this.AddButtonAndBackground(20, 260, 2, 1062990); // Request Alliance
this.AddButtonAndBackground(20, 290, 1, 1062989); // Declare War!
}
this.AddButtonAndBackground(275, 290, 0, 3000091); //Cancel
this.AddHtmlLocalized(20, 180, 480, 30, number, 0x0, true, false);
this.AddImageTiled(20, 245, 480, 2, 0x2711);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (!IsMember(pm, this.guild))
return;
RankDefinition playerRank = pm.GuildRank;
Guild guildLeader = Guild.GetAllianceLeader(this.guild);
Guild otherGuild = Guild.GetAllianceLeader(this.m_Other);
WarDeclaration war = guildLeader.FindPendingWar(otherGuild);
WarDeclaration activeWar = guildLeader.FindActiveWar(otherGuild);
WarDeclaration otherWar = otherGuild.FindPendingWar(guildLeader);
AllianceInfo alliance = this.guild.Alliance;
AllianceInfo otherAlliance = otherGuild.Alliance;
switch( info.ButtonID )
{
#region War
case 5: //Accept the war
{
if (war != null && !war.WarRequester && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
//Accept the war
this.guild.PendingWars.Remove(war);
war.WarBeginning = DateTime.UtcNow;
this.guild.AcceptedWars.Add(war);
if (alliance != null && alliance.IsMember(this.guild))
{
alliance.AllianceMessage(1070769, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name)); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
alliance.InvalidateMemberProperties();
}
else
{
this.guild.GuildMessage(1070769, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name)); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
this.guild.InvalidateMemberProperties();
}
//Technically SHOULD say Your guild is now at war w/out any info, intentional diff.
otherGuild.PendingWars.Remove(otherWar);
otherWar.WarBeginning = DateTime.UtcNow;
otherGuild.AcceptedWars.Add(otherWar);
if (otherAlliance != null && this.m_Other.Alliance.IsMember(this.m_Other))
{
otherAlliance.AllianceMessage(1070769, ((alliance != null) ? alliance.Name : this.guild.Name)); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
otherAlliance.InvalidateMemberProperties();
}
else
{
otherGuild.GuildMessage(1070769, ((alliance != null) ? alliance.Name : this.guild.Name)); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
otherGuild.InvalidateMemberProperties();
}
}
}
break;
}
case 6: //Modify war terms
{
if (war != null && !war.WarRequester && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, this.guild, otherGuild));
}
}
break;
}
case 7: //Dismiss war
{
if (war != null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
//Dismiss the war
this.guild.PendingWars.Remove(war);
otherGuild.PendingWars.Remove(otherWar);
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
//Messages to opposing guild? (Testing on OSI says no)
}
}
break;
}
case 8: //Surrender
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
if (activeWar != null)
{
if (alliance != null && alliance.IsMember(this.guild))
{
alliance.AllianceMessage(1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));// You have lost the war with ~1_val~.
alliance.InvalidateMemberProperties();
}
else
{
this.guild.GuildMessage(1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));// You have lost the war with ~1_val~.
this.guild.InvalidateMemberProperties();
}
this.guild.AcceptedWars.Remove(activeWar);
if (otherAlliance != null && otherAlliance.IsMember(otherGuild))
{
otherAlliance.AllianceMessage(1070739, ((this.guild.Alliance != null) ? this.guild.Alliance.Name : this.guild.Name));// You have won the war against ~1_val~!
otherAlliance.InvalidateMemberProperties();
}
else
{
otherGuild.GuildMessage(1070739, ((this.guild.Alliance != null) ? this.guild.Alliance.Name : this.guild.Name));// You have won the war against ~1_val~!
otherGuild.InvalidateMemberProperties();
}
otherGuild.AcceptedWars.Remove(otherGuild.FindActiveWar(this.guild));
}
}
break;
}
case 1: //Declare War
{
if (war == null && activeWar == null)
{
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else if (otherAlliance != null && otherAlliance.Leader != this.m_Other)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.m_Other.Name, otherAlliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
pm.SendGump(new WarDeclarationGump(pm, this.guild, this.m_Other));
}
}
break;
}
#endregion
case 2: //Request Alliance
{
#region New alliance
if (alliance == null)
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance.
}
else if (Faction.Find(this.guild.Leader) != Faction.Find(this.m_Other.Leader))
{
pm.SendLocalizedMessage(1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(this.m_Other))
pm.SendLocalizedMessage(1063416, this.m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
else
pm.SendLocalizedMessage(1063426, this.m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (this.m_Other.AcceptedWars.Count > 0 || this.m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, this.m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (this.guild.AcceptedWars.Count > 0 || this.guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, this.guild.Name); // ~1_val~ is currently involved in a guild war.
}
else
{
pm.SendLocalizedMessage(1063439); // Enter a name for the new alliance:
pm.BeginPrompt(new PromptCallback(CreateAlliance_Callback));
}
}
#endregion
#region Existing Alliance
else
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(this.m_Other))
pm.SendLocalizedMessage(1063416, this.m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
else
pm.SendLocalizedMessage(1063426, this.m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (alliance.IsPendingMember(this.guild))
{
pm.SendLocalizedMessage(1063416, this.guild.Name); // ~1_val~ is currently considering another alliance proposal.
}
else if (this.m_Other.AcceptedWars.Count > 0 || this.m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, this.m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (this.guild.AcceptedWars.Count > 0 || this.guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, this.guild.Name); // ~1_val~ is currently involved in a guild war.
}
else if (Faction.Find(this.guild.Leader) != Faction.Find(this.m_Other.Leader))
{
pm.SendLocalizedMessage(1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else
{
pm.SendLocalizedMessage(1070750, this.m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~.
this.m_Other.GuildMessage(1070780, this.guild.Name); // ~1_val~ has proposed an alliance.
this.m_Other.Alliance = alliance; //Calls addPendingGuild
//alliance.AddPendingGuild( m_Other );
}
}
#endregion
break;
}
case 10: //Show Alliance Roster
{
if (alliance != null && alliance == otherAlliance)
pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, this.guild, alliance));
break;
}
case 11: //Leave Alliance
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.IsMember(this.guild))
{
this.guild.Alliance = null; //Calls alliance.Removeguild
// alliance.RemoveGuild( guild );
this.m_Other.InvalidateWarNotoriety();
this.guild.InvalidateMemberNotoriety();
}
break;
}
case 12: //Remove Guild from alliance
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (alliance != null && alliance.IsMember(this.guild) && alliance.IsMember(this.m_Other))
{
this.m_Other.Alliance = null;
this.m_Other.InvalidateMemberNotoriety();
this.guild.InvalidateWarNotoriety();
}
break;
}
case 13: //Promote to Alliance leader
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if (alliance != null && alliance.IsMember(this.guild) && alliance.IsMember(this.m_Other))
{
pm.SendLocalizedMessage(1063434, String.Format("{0}\t{1}", this.m_Other.Name, alliance.Name)); // ~1_val~ is now the leader of ~2_val~.
alliance.Leader = this.m_Other;
}
break;
}
case 14: //Withdraw Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && alliance.Leader == this.guild && alliance.IsPendingMember(this.m_Other))
{
this.m_Other.Alliance = null;
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
}
break;
}
case 15: //Deny Alliance Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (alliance != null && otherAlliance != null && alliance.Leader == this.m_Other && otherAlliance.IsPendingMember(this.guild))
{
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
//m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal. //Per OSI commented out.
this.guild.Alliance = null;
}
break;
}
case 16: //Accept Alliance Request
{
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance.
}
else if (otherAlliance != null && otherAlliance.Leader == this.m_Other && otherAlliance.IsPendingMember(this.guild))
{
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
otherAlliance.TurnToMember(this.m_Other); //No need to verify it's in the guild or already a member, the function does this
otherAlliance.TurnToMember(this.guild);
}
break;
}
}
}
public void CreateAlliance_Callback(Mobile from, string text)
{
PlayerMobile pm = from as PlayerMobile;
AllianceInfo alliance = this.guild.Alliance;
AllianceInfo otherAlliance = this.m_Other.Alliance;
if (!IsMember(from, this.guild) || alliance != null)
return;
RankDefinition playerRank = pm.GuildRank;
if (!playerRank.GetFlag(RankFlags.AllianceControl))
{
pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance.
}
else if (Faction.Find(this.guild.Leader) != Faction.Find(this.m_Other.Leader))
{
//Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later.
pm.SendLocalizedMessage(1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else if (otherAlliance != null)
{
if (otherAlliance.IsPendingMember(this.m_Other))
pm.SendLocalizedMessage(1063416, this.m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
else
pm.SendLocalizedMessage(1063426, this.m_Other.Name); // ~1_val~ already belongs to an alliance.
}
else if (this.m_Other.AcceptedWars.Count > 0 || this.m_Other.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, this.m_Other.Name); // ~1_val~ is currently involved in a guild war.
}
else if (this.guild.AcceptedWars.Count > 0 || this.guild.PendingWars.Count > 0)
{
pm.SendLocalizedMessage(1063427, this.guild.Name); // ~1_val~ is currently involved in a guild war.
}
else
{
string name = Utility.FixHtml(text.Trim());
if (!BaseGuildGump.CheckProfanity(name))
pm.SendLocalizedMessage(1070886); // That alliance name is not allowed.
else if (name.Length > Guild.NameLimit)
pm.SendLocalizedMessage(1070887, Guild.NameLimit.ToString()); // An alliance name cannot exceed ~1_val~ characters in length.
else if (AllianceInfo.Alliances.ContainsKey(name.ToLower()))
pm.SendLocalizedMessage(1063428); // That alliance name is not available.
else
{
pm.SendLocalizedMessage(1070750, this.m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~.
this.m_Other.GuildMessage(1070780, this.guild.Name); // ~1_val~ has proposed an alliance.
new AllianceInfo(this.guild, name, this.m_Other);
}
}
}
}
}

View File

@@ -0,0 +1,128 @@
using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Guilds
{
public class WarDeclarationGump : BaseGuildGump
{
private readonly Guild m_Other;
public WarDeclarationGump(PlayerMobile pm, Guild g, Guild otherGuild)
: base(pm, g)
{
this.m_Other = otherGuild;
WarDeclaration war = g.FindPendingWar(otherGuild);
this.AddPage(0);
this.AddBackground(0, 0, 500, 340, 0x24AE);
this.AddBackground(65, 50, 370, 30, 0x2486);
this.AddHtmlLocalized(75, 55, 370, 26, 1062979, 0x3C00, false, false); // <div align=center><i>Declaration of War</i></div>
this.AddImage(410, 45, 0x232C);
this.AddHtmlLocalized(65, 95, 200, 20, 1063009, 0x14AF, false, false); // <i>Duration of War</i>
this.AddHtmlLocalized(65, 120, 400, 20, 1063010, 0x0, false, false); // Enter the number of hours the war will last.
this.AddBackground(65, 150, 40, 30, 0x2486);
this.AddTextEntry(70, 154, 50, 30, 0x481, 10, (war != null) ? war.WarLength.Hours.ToString() : "0");
this.AddHtmlLocalized(65, 195, 200, 20, 1063011, 0x14AF, false, false); // <i>Victory Condition</i>
this.AddHtmlLocalized(65, 220, 400, 20, 1063012, 0x0, false, false); // Enter the winning number of kills.
this.AddBackground(65, 250, 40, 30, 0x2486);
this.AddTextEntry(70, 254, 50, 30, 0x481, 11, (war != null) ? war.MaxKills.ToString() : "0");
this.AddBackground(190, 270, 130, 26, 0x2486);
this.AddButton(195, 275, 0x845, 0x846, 0, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(220, 273, 90, 26, 1006045, 0x0, false, false); // Cancel
this.AddBackground(330, 270, 130, 26, 0x2486);
this.AddButton(335, 275, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(360, 273, 90, 26, 1062989, 0x5000, false, false); // Declare War!
}
public override void OnResponse(NetState sender, RelayInfo info)
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if (!IsMember(pm, this.guild))
return;
RankDefinition playerRank = pm.GuildRank;
switch( info.ButtonID )
{
case 1:
{
AllianceInfo alliance = this.guild.Alliance;
AllianceInfo otherAlliance = this.m_Other.Alliance;
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
{
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
}
else if (alliance != null && alliance.Leader != this.guild)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else if (otherAlliance != null && otherAlliance.Leader != this.m_Other)
{
pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", this.m_Other.Name, otherAlliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage(1070707, otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
}
else
{
WarDeclaration activeWar = this.guild.FindActiveWar(this.m_Other);
if (activeWar == null)
{
WarDeclaration war = this.guild.FindPendingWar(this.m_Other);
WarDeclaration otherWar = this.m_Other.FindPendingWar(this.guild);
//Note: OSI differs from what it says on website. unlimited war = 0 kills/ 0 hrs. Not > 999. (sidenote: they both cap at 65535, 7.5 years, but, still.)
TextRelay tKills = info.GetTextEntry(11);
TextRelay tWarLength = info.GetTextEntry(10);
int maxKills = (tKills == null) ? 0 : Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(11).Text), 0xFFFF), 0);
TimeSpan warLength = TimeSpan.FromHours((tWarLength == null) ? 0 : Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(10).Text), 0xFFFF), 0));
if (war != null)
{
war.MaxKills = maxKills;
war.WarLength = warLength;
war.WarRequester = true;
}
else
{
this.guild.PendingWars.Add(new WarDeclaration(this.guild, this.m_Other, maxKills, warLength, true));
}
if (otherWar != null)
{
otherWar.MaxKills = maxKills;
otherWar.WarLength = warLength;
otherWar.WarRequester = false;
}
else
{
this.m_Other.PendingWars.Add(new WarDeclaration(this.m_Other, this.guild, maxKills, warLength, false));
}
if (war != null)
{
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
//m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal.
}
else
this.m_Other.GuildMessage(1070781, ((this.guild.Alliance != null) ? this.guild.Alliance.Name : this.guild.Name)); // ~1_val~ has proposed a war.
pm.SendLocalizedMessage(1070751, ((this.m_Other.Alliance != null) ? this.m_Other.Alliance.Name : this.m_Other.Name)); // War proposal has been sent to ~1_val~.
}
}
break;
}
default:
{
pm.SendGump(new OtherGuildInfo(pm, this.guild, this.m_Other));
break;
}
}
}
}
}

View File

@@ -0,0 +1,95 @@
using System;
using Server.Factions;
using Server.Guilds;
using Server.Targeting;
namespace Server.Gumps
{
public class GuildRecruitTarget : Target
{
private readonly Mobile m_Mobile;
private readonly Guild m_Guild;
public GuildRecruitTarget(Mobile m, Guild guild)
: base(10, false, TargetFlags.None)
{
this.m_Mobile = m;
this.m_Guild = guild;
}
protected override void OnTarget(Mobile from, object targeted)
{
if (GuildGump.BadMember(this.m_Mobile, this.m_Guild))
return;
if (targeted is Mobile)
{
Mobile m = (Mobile)targeted;
PlayerState guildState = PlayerState.Find(this.m_Guild.Leader);
PlayerState targetState = PlayerState.Find(m);
Faction guildFaction = (guildState == null ? null : guildState.Faction);
Faction targetFaction = (targetState == null ? null : targetState.Faction);
if (!m.Player)
{
this.m_Mobile.SendLocalizedMessage(501161); // You may only recruit players into the guild.
}
else if (!m.Alive)
{
this.m_Mobile.SendLocalizedMessage(501162); // Only the living may be recruited.
}
else if (this.m_Guild.IsMember(m))
{
this.m_Mobile.SendLocalizedMessage(501163); // They are already a guildmember!
}
else if (this.m_Guild.Candidates.Contains(m))
{
this.m_Mobile.SendLocalizedMessage(501164); // They are already a candidate.
}
else if (this.m_Guild.Accepted.Contains(m))
{
this.m_Mobile.SendLocalizedMessage(501165); // They have already been accepted for membership, and merely need to use the Guildstone to gain full membership.
}
else if (m.Guild != null)
{
this.m_Mobile.SendLocalizedMessage(501166); // You can only recruit candidates who are not already in a guild.
}
#region Factions
else if (guildFaction != targetFaction)
{
if (guildFaction == null)
this.m_Mobile.SendLocalizedMessage(1013027); // That player cannot join a non-faction guild.
else if (targetFaction == null)
this.m_Mobile.SendLocalizedMessage(1013026); // That player must be in a faction before joining this guild.
else
this.m_Mobile.SendLocalizedMessage(1013028); // That person has a different faction affiliation.
}
else if (targetState != null && targetState.IsLeaving)
{
// OSI does this quite strangely, so we'll just do it this way
this.m_Mobile.SendMessage("That person is quitting their faction and so you may not recruit them.");
}
#endregion
else if (this.m_Mobile.AccessLevel >= AccessLevel.GameMaster || this.m_Guild.Leader == this.m_Mobile)
{
this.m_Guild.Accepted.Add(m);
}
else
{
this.m_Guild.Candidates.Add(m);
}
}
}
protected override void OnTargetFinish(Mobile from)
{
if (GuildGump.BadMember(this.m_Mobile, this.m_Guild))
return;
GuildGump.EnsureClosed(this.m_Mobile);
this.m_Mobile.SendGump(new GuildGump(this.m_Mobile, this.m_Guild));
}
}
}

View File

@@ -0,0 +1,584 @@
using System;
using System.Collections.Generic;
using Server.Items;
using Server.Network;
namespace Server.Gumps
{
public class HeritageTokenGump : Gump
{
private readonly HeritageToken m_Token;
private readonly Mobile m_User;
public HeritageTokenGump(HeritageToken token, Mobile from)
: base(60, 36)
{
m_Token = token;
m_User = from;
AddPage(0);
AddBackground(0, 0, 520, 404, 0x13BE);
AddImageTiled(10, 10, 500, 20, 0xA40);
AddImageTiled(10, 40, 500, 324, 0xA40);
AddImageTiled(10, 374, 500, 20, 0xA40);
AddAlphaRegion(10, 10, 500, 384);
AddButton(10, 374, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 376, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 500, 20, 1075576, 0x7FFF, false, false); // Choose your item from the following pages
AddPage(1);
AddImageTiledButton(14, 44, 0x918, 0x919, 0x64, GumpButtonType.Reply, 0, 0x1411, 0x2C, 18, 8);
AddTooltip(1062912);
AddHtmlLocalized(98, 44, 250, 60, 1078147, 0x7FFF, false, false); // Royal Leggings of Embers
AddImageTiledButton(264, 44, 0x918, 0x919, 0x65, GumpButtonType.Reply, 0, 0x234D, 0x0, 18, 12);
AddTooltip(1062914);
AddHtmlLocalized(348, 44, 250, 60, 1062913, 0x7FFF, false, false); // Rose of Trinsic
AddImageTiledButton(14, 108, 0x918, 0x919, 0x66, GumpButtonType.Reply, 0, 0x26C3, 0x504, 18, 8);
AddTooltip(1062916);
AddHtmlLocalized(98, 108, 250, 60, 1062915, 0x7FFF, false, false); // Shaminos Best Crossbow
AddImageTiledButton(264, 108, 0x918, 0x919, 0x67, GumpButtonType.Reply, 0, 0x3F1D, 0x0, 18, 8);
AddTooltip(1062918);
AddHtmlLocalized(348, 108, 250, 60, 1062917, 0x7FFF, false, false); // The Tapestry of Sosaria
AddImageTiledButton(14, 172, 0x918, 0x919, 0x68, GumpButtonType.Reply, 0, 0x3F14, 0x0, 18, 8);
AddTooltip(1062920);
AddHtmlLocalized(98, 172, 250, 60, 1062919, 0x7FFF, false, false); // Hearth of the Home Fire
AddImageTiledButton(264, 172, 0x918, 0x919, 0x69, GumpButtonType.Reply, 0, 0xF60, 0x482, -1, 10);
AddTooltip(1062922);
AddHtmlLocalized(348, 172, 250, 60, 1062921, 0x7FFF, false, false); // The Holy Sword
AddImageTiledButton(14, 236, 0x918, 0x919, 0x6A, GumpButtonType.Reply, 0, 0x236C, 0x0, 18, 6);
AddTooltip(1062924);
AddHtmlLocalized(98, 236, 250, 60, 1062923, 0x7FFF, false, false); // Ancient Samurai Helm
AddImageTiledButton(264, 236, 0x918, 0x919, 0x6B, GumpButtonType.Reply, 0, 0x2B10, 0x226, 18, 11);
AddTooltip(1075223);
AddHtmlLocalized(348, 236, 250, 60, 1075188, 0x7FFF, false, false); // Helm of Spirituality
AddImageTiledButton(14, 300, 0x918, 0x919, 0x6C, GumpButtonType.Reply, 0, 0x2B0C, 0x226, 18, 15);
AddTooltip(1075224);
AddHtmlLocalized(98, 300, 250, 60, 1075192, 0x7FFF, false, false); // Gauntlets of Valor
AddImageTiledButton(264, 300, 0x918, 0x919, 0x6D, GumpButtonType.Reply, 0, 0x2B01, 0x0, 18, 9);
AddTooltip(1075225);
AddHtmlLocalized(348, 300, 250, 60, 1075196, 0x7FFF, false, false); // Dupres Shield
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next
AddPage(2);
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back
AddImageTiledButton(14, 44, 0x918, 0x919, 0x6E, GumpButtonType.Reply, 0, 0x2AC6, 0x0, 29, 0);
AddTooltip(1075226);
AddHtmlLocalized(98, 44, 250, 60, 1075197, 0x7FFF, false, false); // Fountain of Life
AddImageTiledButton(264, 44, 0x918, 0x919, 0x6F, GumpButtonType.Reply, 0, 0x2AF9, 0x0, -4, -5);
AddTooltip(1075227);
AddHtmlLocalized(348, 44, 250, 60, 1075198, 0x7FFF, false, false); // Dawns Music Box
AddImageTiledButton(14, 108, 0x918, 0x919, 0x70, GumpButtonType.Reply, 0, 0x2253, 0x0, 18, 12);
AddTooltip(1075228);
AddHtmlLocalized(98, 108, 250, 60, 1078148, 0x7FFF, false, false); // Ossian Grimoire
AddImageTiledButton(264, 108, 0x918, 0x919, 0x71, GumpButtonType.Reply, 0, 0x2D98, 0x0, 19, 13);
AddTooltip(1078527);
AddHtmlLocalized(348, 108, 250, 60, 1078142, 0x7FFF, false, false); // Talisman of the Fey:<br>Ferret
AddImageTiledButton(14, 172, 0x918, 0x919, 0x72, GumpButtonType.Reply, 0, 0x2D97, 0x0, 19, 13);
AddTooltip(1078528);
AddHtmlLocalized(98, 172, 250, 60, 1078143, 0x7FFF, false, false); // Talisman of the Fey:<br>Squirrel
AddImageTiledButton(264, 172, 0x918, 0x919, 0x73, GumpButtonType.Reply, 0, 0x2D96, 0x0, 19, 8);
AddTooltip(1078529);
AddHtmlLocalized(348, 172, 250, 60, 1078144, 0x7FFF, false, false); // Talisman of the Fey:<br>Cu Sidhe
AddImageTiledButton(14, 236, 0x918, 0x919, 0x74, GumpButtonType.Reply, 0, 0x2D95, 0x0, -4, 2);
AddTooltip(1078530);
AddHtmlLocalized(98, 236, 250, 60, 1078145, 0x7FFF, false, false); // Talisman of the Fey:<br>Reptalon
AddImageTiledButton(264, 236, 0x918, 0x919, 0x75, GumpButtonType.Reply, 0, 0x2B02, 0x0, -2, 9);
AddTooltip(1078526);
AddHtmlLocalized(348, 236, 250, 60, 1075201, 0x7FFF, false, false); // Quiver of Infinity
AddImageTiledButton(14, 300, 0x918, 0x919, 0x76, GumpButtonType.Reply, 0, 0x2A91, 0x0, 25, 5);
AddTooltip(1075986);
AddHtmlLocalized(98, 300, 250, 60, 1074797, 0x7FFF, false, false); // Bone Throne, Bone Couch<br>and Bone Table
AddImageTiledButton(264, 300, 0x918, 0x919, 0x77, GumpButtonType.Reply, 0, 0x2A99, 0x0, 18, 1);
AddTooltip(1075987);
AddHtmlLocalized(348, 300, 250, 60, 1078146, 0x7FFF, false, false); // Creepy Portraits
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 3);
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next
AddPage(3);
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back
AddImageTiledButton(14, 44, 0x918, 0x919, 0x78, GumpButtonType.Reply, 0, 0x2A71, 0x0, 13, 5);
AddTooltip(1075988);
AddHtmlLocalized(98, 44, 250, 60, 1074799, 0x7FFF, false, false); // Mounted Pixies (5)
AddImageTiledButton(264, 44, 0x918, 0x919, 0x79, GumpButtonType.Reply, 0, 0x2A98, 0x0, 26, 1);
AddTooltip(1075990);
AddHtmlLocalized(348, 44, 250, 60, 1074800, 0x7FFF, false, false); // Haunted Mirror
AddImageTiledButton(14, 108, 0x918, 0x919, 0x7A, GumpButtonType.Reply, 0, 0x2A92, 0x0, 18, 1);
AddTooltip(1075989);
AddHtmlLocalized(98, 108, 250, 60, 1074801, 0x7FFF, false, false); // Bed of Nails
AddImageTiledButton(264, 108, 0x918, 0x919, 0x7B, GumpButtonType.Reply, 0, 0x2AB8, 0x0, 18, 1);
AddTooltip(1075991);
AddHtmlLocalized(348, 108, 250, 60, 1074818, 0x7FFF, false, false); // Sacrificial Altar
AddImageTiledButton(14, 172, 0x918, 0x919, 0x7C, GumpButtonType.Reply, 0, 0x3F26, 0x0, 18, 8);
AddTooltip(1076610);
AddHtmlLocalized(98, 172, 250, 60, 1076257, 0x7FFF, false, false); // Broken Covered Chair
AddImageTiledButton(264, 172, 0x918, 0x919, 0x7D, GumpButtonType.Reply, 0, 0x3F22, 0x0, 18, 8);
AddTooltip(1076610);
AddHtmlLocalized(348, 172, 250, 60, 1076258, 0x7FFF, false, false); // Broken Bookcase
AddImageTiledButton(14, 236, 0x918, 0x919, 0x7E, GumpButtonType.Reply, 0, 0x3F24, 0x0, 18, 8);
AddTooltip(1076610);
AddHtmlLocalized(98, 236, 250, 60, 1076259, 0x7FFF, false, false); // Standing Broken Chair
AddImageTiledButton(264, 236, 0x918, 0x919, 0x7F, GumpButtonType.Reply, 0, 0x3F25, 0x0, 18, 8);
AddTooltip(1076610);
AddHtmlLocalized(348, 236, 250, 60, 1076260, 0x7FFF, false, false); // Broken Vanity
AddImageTiledButton(14, 300, 0x918, 0x919, 0x80, GumpButtonType.Reply, 0, 0x3F23, 0x0, 18, 8);
AddTooltip(1076610);
AddHtmlLocalized(98, 300, 250, 60, 1076261, 0x7FFF, false, false); // Broken Chest of Drawers
AddImageTiledButton(264, 300, 0x918, 0x919, 0x81, GumpButtonType.Reply, 0, 0x3F21, 0x0, 18, 8);
AddTooltip(1076610);
AddHtmlLocalized(348, 300, 250, 60, 1076262, 0x7FFF, false, false); // Broken Armoire
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 4);
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next
AddPage(4);
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 3);
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back
AddImageTiledButton(14, 44, 0x918, 0x919, 0x82, GumpButtonType.Reply, 0, 0x3F0B, 0x0, 18, 8);
AddTooltip(1076610);
AddHtmlLocalized(98, 44, 250, 60, 1076263, 0x7FFF, false, false); // Broken Bed
AddImageTiledButton(264, 44, 0x918, 0x919, 0x83, GumpButtonType.Reply, 0, 0xC19, 0x0, 13, 8);
AddTooltip(1076610);
AddHtmlLocalized(348, 44, 250, 60, 1076264, 0x7FFF, false, false); // Broken Fallen Chair
AddImageTiledButton(14, 108, 0x918, 0x919, 0x84, GumpButtonType.Reply, 0, 0x3DAA, 0x0, 20, -3);
AddTooltip(1076611);
AddHtmlLocalized(98, 108, 250, 60, 1076265, 0x7FFF, false, false); // Suit of Gold Armor
AddImageTiledButton(264, 108, 0x918, 0x919, 0x85, GumpButtonType.Reply, 0, 0x151C, 0x0, -20, -3);
AddTooltip(1076612);
AddHtmlLocalized(348, 108, 250, 60, 1076266, 0x7FFF, false, false); // Suit of Silver Armor
AddImageTiledButton(14, 172, 0x918, 0x919, 0x86, GumpButtonType.Reply, 0, 0x3DB1, 0x0, 18, 8);
AddTooltip(1076613);
AddHtmlLocalized(98, 172, 250, 60, 1076267, 0x7FFF, false, false); // Boiling Cauldron
AddImageTiledButton(264, 172, 0x918, 0x919, 0x87, GumpButtonType.Reply, 0, 0x3F27, 0x0, 18, 8);
AddTooltip(1076614);
AddHtmlLocalized(348, 172, 250, 60, 1024656, 0x7FFF, false, false); // Guillotine
AddImageTiledButton(14, 236, 0x918, 0x919, 0x88, GumpButtonType.Reply, 0, 0x3F0C, 0x0, 18, 8);
AddTooltip(1076615);
AddHtmlLocalized(98, 236, 250, 60, 1076268, 0x7FFF, false, false); // Cherry Blossom Tree
AddImageTiledButton(264, 236, 0x918, 0x919, 0x89, GumpButtonType.Reply, 0, 0x3F07, 0x0, 18, 8);
AddTooltip(1076616);
AddHtmlLocalized(348, 236, 250, 60, 1076269, 0x7FFF, false, false); // Apple Tree
AddImageTiledButton(14, 300, 0x918, 0x919, 0x8A, GumpButtonType.Reply, 0, 0x3F16, 0x0, 18, 8);
AddTooltip(1076617);
AddHtmlLocalized(98, 300, 250, 60, 1076270, 0x7FFF, false, false); // Peach Tree
AddImageTiledButton(264, 300, 0x918, 0x919, 0x8B, GumpButtonType.Reply, 0, 0x3F12, 0x0, 18, 8);
AddTooltip(1076618);
AddHtmlLocalized(348, 300, 250, 60, 1076271, 0x7FFF, false, false); // Hanging Axes
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 5);
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next
AddPage(5);
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 4);
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back
AddImageTiledButton(14, 44, 0x918, 0x919, 0x8C, GumpButtonType.Reply, 0, 0x3F13, 0x0, 18, 8);
AddTooltip(1076619);
AddHtmlLocalized(98, 44, 250, 60, 1076272, 0x7FFF, false, false); // Hanging Swords
AddImageTiledButton(264, 44, 0x918, 0x919, 0x8D, GumpButtonType.Reply, 0, 0x3F09, 0x0, 18, 8);
AddTooltip(1076620);
AddHtmlLocalized(348, 44, 250, 60, 1076273, 0x7FFF, false, false); // Blue fancy rug
AddImageTiledButton(14, 108, 0x918, 0x919, 0x8E, GumpButtonType.Reply, 0, 0x3F0E, 0x0, 18, 8);
AddTooltip(1076621);
AddHtmlLocalized(98, 108, 250, 60, 1076274, 0x7FFF, false, false); // Coffin
AddImageTiledButton(264, 108, 0x918, 0x919, 0x8F, GumpButtonType.Reply, 0, 0x3F1F, 0x0, 18, 8);
AddTooltip(1076623);
AddHtmlLocalized(348, 108, 250, 60, 1074027, 0x7FFF, false, false); // Vanity
AddImageTiledButton(14, 172, 0x918, 0x919, 0x90, GumpButtonType.Reply, 0, 0x118B, 0x0, -4, -9);
AddTooltip(1076624);
AddHtmlLocalized(98, 172, 250, 60, 1076635, 0x7FFF, false, false); // Table With A Purple<br>Tablecloth
AddImageTiledButton(264, 172, 0x918, 0x919, 0x91, GumpButtonType.Reply, 0, 0x118C, 0x0, -4, -9);
AddTooltip(1076624);
AddHtmlLocalized(348, 172, 250, 60, 1076636, 0x7FFF, false, false); // Table With A Blue<br>Tablecloth
AddImageTiledButton(14, 236, 0x918, 0x919, 0x92, GumpButtonType.Reply, 0, 0x118D, 0x0, -4, -9);
AddTooltip(1076624);
AddHtmlLocalized(98, 236, 250, 60, 1076637, 0x7FFF, false, false); // Table With A Red<br>Tablecloth
AddImageTiledButton(264, 236, 0x918, 0x919, 0x93, GumpButtonType.Reply, 0, 0x118E, 0x0, -4, -9);
AddTooltip(1076624);
AddHtmlLocalized(348, 236, 250, 60, 1076638, 0x7FFF, false, false); // Table With An Orange<br>Tablecloth
AddImageTiledButton(14, 300, 0x918, 0x919, 0x94, GumpButtonType.Reply, 0, 0x3F1E, 0x0, 18, 8);
AddTooltip(1076625);
AddHtmlLocalized(98, 300, 250, 60, 1076279, 0x7FFF, false, false); // Unmade Bed
AddImageTiledButton(264, 300, 0x918, 0x919, 0x95, GumpButtonType.Reply, 0, 0x3F0F, 0x0, 18, 8);
AddTooltip(1076626);
AddHtmlLocalized(348, 300, 250, 60, 1076280, 0x7FFF, false, false); // Curtains
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 6);
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next
AddPage(6);
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 5);
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back
AddImageTiledButton(14, 44, 0x918, 0x919, 0x96, GumpButtonType.Reply, 0, 0x1E34, 0x0, 18, -17);
AddTooltip(1076627);
AddHtmlLocalized(98, 44, 250, 60, 1076281, 0x7FFF, false, false); // Scarecrow
AddImageTiledButton(264, 44, 0x918, 0x919, 0x97, GumpButtonType.Reply, 0, 0xA0C, 0x0, 18, 8);
AddTooltip(1076628);
AddHtmlLocalized(348, 44, 250, 60, 1076282, 0x7FFF, false, false); // Wall Torch
AddImageTiledButton(14, 108, 0x918, 0x919, 0x98, GumpButtonType.Reply, 0, 0x3F10, 0x0, 18, 9);
AddTooltip(1076629);
AddHtmlLocalized(98, 108, 250, 60, 1076283, 0x7FFF, false, false); // Fountain
AddImageTiledButton(264, 108, 0x918, 0x919, 0x99, GumpButtonType.Reply, 0, 0x3F19, 0x0, 18, 8);
AddTooltip(1076630);
AddHtmlLocalized(348, 108, 250, 60, 1076284, 0x7FFF, false, false); // Statue
AddImageTiledButton(14, 172, 0x918, 0x919, 0x9A, GumpButtonType.Reply, 0, 0x1EA5, 0x0, 5, -25);
AddTooltip(1076631);
AddHtmlLocalized(98, 172, 250, 60, 1076285, 0x7FFF, false, false); // Large Fish Net
AddImageTiledButton(264, 172, 0x918, 0x919, 0x9B, GumpButtonType.Reply, 0, 0x1EA3, 0x0, 18, -27);
AddTooltip(1076632);
AddHtmlLocalized(348, 172, 250, 60, 1076286, 0x7FFF, false, false); // Small Fish Net
AddImageTiledButton(14, 236, 0x918, 0x919, 0x9C, GumpButtonType.Reply, 0, 0x2FDF, 0x0, 18, -36);
AddTooltip(1076633);
AddHtmlLocalized(98, 236, 250, 60, 1076287, 0x7FFF, false, false); // Ladder
AddImageTiledButton(264, 236, 0x918, 0x919, 0x9D, GumpButtonType.Reply, 0, 0x3F15, 0x0, 18, 8);
AddTooltip(1076622);
AddHtmlLocalized(348, 236, 250, 60, 1076288, 0x7FFF, false, false); // Iron Maiden
AddImageTiledButton(14, 300, 0x918, 0x919, 0x9E, GumpButtonType.Reply, 0, 0x3F0A, 0x0, 18, 8);
AddTooltip(1076620);
AddHtmlLocalized(98, 300, 250, 60, 1076585, 0x7FFF, false, false); // Blue plain rug
AddImageTiledButton(264, 300, 0x918, 0x919, 0x9F, GumpButtonType.Reply, 0, 0x3F11, 0x0, 18, 8);
AddTooltip(1076620);
AddHtmlLocalized(348, 300, 250, 60, 1076586, 0x7FFF, false, false); // Golden decorative rug
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 7);
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next
AddPage(7);
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 6);
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back
AddImageTiledButton(14, 44, 0x918, 0x919, 0xA0, GumpButtonType.Reply, 0, 0x3F0D, 0x0, 18, 8);
AddTooltip(1076620);
AddHtmlLocalized(98, 44, 250, 60, 1076587, 0x7FFF, false, false); // Cinnamon fancy rug
AddImageTiledButton(264, 44, 0x918, 0x919, 0xA1, GumpButtonType.Reply, 0, 0x3F18, 0x0, 18, 8);
AddTooltip(1076620);
AddHtmlLocalized(348, 44, 250, 60, 1076588, 0x7FFF, false, false); // Red plain rug
AddImageTiledButton(14, 108, 0x918, 0x919, 0xA2, GumpButtonType.Reply, 0, 0x3F08, 0x0, 18, 8);
AddTooltip(1076620);
AddHtmlLocalized(98, 108, 250, 60, 1076589, 0x7FFF, false, false); // Blue decorative rug
AddImageTiledButton(264, 108, 0x918, 0x919, 0xA3, GumpButtonType.Reply, 0, 0x3F17, 0x0, 18, 8);
AddTooltip(1076620);
AddHtmlLocalized(348, 108, 250, 60, 1076590, 0x7FFF, false, false); // Pink fancy rug
AddImageTiledButton(14, 172, 0x918, 0x919, 0xA4, GumpButtonType.Reply, 0, 0x312A, 0x0, 18, 8);
AddTooltip(1076615);
AddHtmlLocalized(98, 172, 250, 60, 1076784, 0x7FFF, false, false); // Cherry Blossom Trunk
AddImageTiledButton(264, 172, 0x918, 0x919, 0xA5, GumpButtonType.Reply, 0, 0x3128, 0x0, 18, 8);
AddTooltip(1076616);
AddHtmlLocalized(348, 172, 250, 60, 1076785, 0x7FFF, false, false); // Apple Trunk
AddImageTiledButton(14, 236, 0x918, 0x919, 0xA6, GumpButtonType.Reply, 0, 0x3129, 0x0, 18, 8);
AddTooltip(1076617);
AddHtmlLocalized(98, 236, 250, 60, 1076786, 0x7FFF, false, false); // Peach Trunk
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Token == null || m_Token.Deleted || info.ButtonID == 0 ||
m_User == null || m_User.Deleted)
return;
if (!m_Token.IsChildOf(m_User.Backpack))
{
sender.Mobile.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
return;
}
List<Type> types = new List<Type>();
int cliloc = 0;
switch ( info.ButtonID )
{
// 7th anniversary
case 0x64:
types.Add(typeof(LeggingsOfEmbers));
cliloc = 1078147;
break;
case 0x65:
types.Add(typeof(RoseOfTrinsic));
cliloc = 1062913;
break;
case 0x66:
types.Add(typeof(ShaminoCrossbow));
cliloc = 1062915;
break;
case 0x67:
types.Add(typeof(TapestryOfSosaria));
cliloc = 1062917;
break;
case 0x68:
types.Add(typeof(HearthOfHomeFireDeed));
cliloc = 1062919;
break;
case 0x69:
types.Add(typeof(HolySword));
cliloc = 1062921;
break;
case 0x6A:
types.Add(typeof(SamuraiHelm));
cliloc = 1062923;
break;
case 0x6B:
types.Add( typeof( SpiritualityHelm ) );
cliloc = 1075188;
break;
case 0x6C: types.Add( typeof( ValorGauntlets ) );
cliloc = 1075192;
break;
case 0x6D:
types.Add(typeof(DupresShield));
cliloc = 1075196;
break;
case 0x6E:
types.Add(typeof(FountainOfLifeDeed));
cliloc = 1075197;
break;
case 0x6F:
types.Add(typeof(DawnsMusicBox));
cliloc = 1075198;
break;
case 0x70:
types.Add(typeof(OssianGrimoire));
cliloc = 1078148;
break;
case 0x71:
types.Add(typeof(FerretFormTalisman));
cliloc = 1078142;
break;
case 0x72:
types.Add(typeof(SquirrelFormTalisman));
cliloc = 1078143;
break;
case 0x73:
types.Add(typeof(CuSidheFormTalisman));
cliloc = 1078144;
break;
case 0x74:
types.Add(typeof(ReptalonFormTalisman));
cliloc = 1078145;
break;
case 0x75:
types.Add(typeof(QuiverOfInfinity));
cliloc = 1075201;
break;
// evil home decor
case 0x76:
types.Add(typeof(BoneThroneDeed));
types.Add(typeof(BoneCouchDeed));
types.Add(typeof(BoneTableDeed));
cliloc = 1074797;
break;
case 0x77:
types.Add(typeof(CreepyPortraitDeed));
types.Add(typeof(DisturbingPortraitDeed));
types.Add(typeof(UnsettlingPortraitDeed));
cliloc = 1078146;
break;
case 0x78:
types.Add(typeof(MountedPixieBlueDeed));
types.Add(typeof(MountedPixieGreenDeed));
types.Add(typeof(MountedPixieLimeDeed));
types.Add(typeof(MountedPixieOrangeDeed));
types.Add(typeof(MountedPixieWhiteDeed));
cliloc = 1074799;
break;
case 0x79:
types.Add(typeof(HauntedMirrorDeed));
cliloc = 1074800;
break;
case 0x7A:
types.Add(typeof(BedOfNailsDeed));
cliloc = 1074801;
break;
case 0x7B:
types.Add(typeof(SacrificialAltarDeed));
cliloc = 1074818;
break;
// broken furniture
case 0x7C:
types.Add(typeof(BrokenCoveredChairDeed));
cliloc = 1076257;
break;
case 0x7D:
types.Add(typeof(BrokenBookcaseDeed));
cliloc = 1076258;
break;
case 0x7E:
types.Add(typeof(StandingBrokenChairDeed));
cliloc = 1076259;
break;
case 0x7F:
types.Add(typeof(BrokenVanityDeed));
cliloc = 1076260;
break;
case 0x80:
types.Add(typeof(BrokenChestOfDrawersDeed));
cliloc = 1076261;
break;
case 0x81:
types.Add(typeof(BrokenArmoireDeed));
cliloc = 1076262;
break;
case 0x82:
types.Add(typeof(BrokenBedDeed));
cliloc = 1076263;
break;
case 0x83:
types.Add(typeof(BrokenFallenChairDeed));
cliloc = 1076264;
break;
// other
case 0x84:
types.Add(typeof(SuitOfGoldArmorDeed));
cliloc = 1076265;
break;
case 0x85:
types.Add(typeof(SuitOfSilverArmorDeed));
cliloc = 1076266;
break;
case 0x86:
types.Add(typeof(BoilingCauldronDeed));
cliloc = 1076267;
break;
case 0x87:
types.Add(typeof(GuillotineDeed));
cliloc = 1024656;
break;
case 0x88:
types.Add(typeof(CherryBlossomTreeDeed));
cliloc = 1076268;
break;
case 0x89:
types.Add(typeof(AppleTreeDeed));
cliloc = 1076269;
break;
case 0x8A:
types.Add(typeof(PeachTreeDeed));
cliloc = 1076270;
break;
case 0x8B:
types.Add(typeof(HangingAxesDeed));
cliloc = 1076271;
break;
case 0x8C:
types.Add(typeof(HangingSwordsDeed));
cliloc = 1076272;
break;
case 0x8D:
types.Add(typeof(BlueFancyRugDeed));
cliloc = 1076273;
break;
case 0x8E:
types.Add(typeof(WoodenCoffinDeed));
cliloc = 1076274;
break;
case 0x8F:
types.Add(typeof(VanityDeed));
cliloc = 1074027;
break;
case 0x90:
types.Add(typeof(TableWithPurpleClothDeed));
cliloc = 1076635;
break;
case 0x91:
types.Add(typeof(TableWithBlueClothDeed));
cliloc = 1076636;
break;
case 0x92:
types.Add(typeof(TableWithRedClothDeed));
cliloc = 1076637;
break;
case 0x93:
types.Add(typeof(TableWithOrangeClothDeed));
cliloc = 1076638;
break;
case 0x94:
types.Add(typeof(UnmadeBedDeed));
cliloc = 1076279;
break;
case 0x95:
types.Add(typeof(CurtainsDeed));
cliloc = 1076280;
break;
case 0x96:
types.Add(typeof(ScarecrowDeed));
cliloc = 1076281;
break;
case 0x97:
types.Add(typeof(WallTorchDeed));
cliloc = 1076282;
break;
case 0x98:
types.Add(typeof(FountainDeed));
cliloc = 1076283;
break;
case 0x99:
types.Add(typeof(StoneStatueDeed));
cliloc = 1076284;
break;
case 0x9A:
types.Add(typeof(LargeFishingNetDeed));
cliloc = 1076285;
break;
case 0x9B:
types.Add(typeof(SmallFishingNetDeed));
cliloc = 1076286;
break;
case 0x9C:
types.Add(typeof(HouseLadderDeed));
cliloc = 1076287;
break;
case 0x9D:
types.Add(typeof(IronMaidenDeed));
cliloc = 1076288;
break;
case 0x9E:
types.Add(typeof(BluePlainRugDeed));
cliloc = 1076585;
break;
case 0x9F:
types.Add(typeof(GoldenDecorativeRugDeed));
cliloc = 1076586;
break;
case 0xA0:
types.Add(typeof(CinnamonFancyRugDeed));
cliloc = 1076587;
break;
case 0xA1:
types.Add(typeof(RedPlainRugDeed));
cliloc = 1076588;
break;
case 0xA2:
types.Add(typeof(BlueDecorativeRugDeed));
cliloc = 1076589;
break;
case 0xA3:
types.Add(typeof(PinkFancyRugDeed));
cliloc = 1076590;
break;
case 0xA4:
types.Add(typeof(CherryBlossomTrunkDeed));
cliloc = 1076784;
break;
case 0xA5:
types.Add(typeof(AppleTrunkDeed));
cliloc = 1076785;
break;
case 0xA6:
types.Add(typeof(PeachTrunkDeed));
cliloc = 1076786;
break;
}
if (types.Count > 0 && cliloc > 0)
{
sender.Mobile.CloseGump(typeof(ConfirmHeritageGump));
sender.Mobile.SendGump(new ConfirmHeritageGump(m_Token, types.ToArray(), cliloc, m_User));
}
else
sender.Mobile.SendLocalizedMessage(501311); // This option is currently disabled, while we evaluate it for game balance.
}
}
}

View File

@@ -0,0 +1,33 @@
using System;
using Server.Mobiles;
using Server.Network;
using Server.Services.Virtues;
namespace Server.Gumps
{
public class HonorSelf : Gump
{
readonly PlayerMobile m_from;
public HonorSelf(PlayerMobile from)
: base(150, 50)
{
this.m_from = from;
this.AddBackground(0, 0, 245, 145, 9250);
this.AddButton(157, 101, 247, 248, 1, GumpButtonType.Reply, 0);
this.AddButton(81, 100, 241, 248, 0, GumpButtonType.Reply, 0);
this.AddHtml(21, 20, 203, 70, @"Are you sure you want to use honor points on yourself?", true, false);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (info.ButtonID == 1)
{
HonorVirtue.ActivateEmbrace(this.m_from);
}
else
{
return;
}
}
}
}

View File

@@ -0,0 +1,190 @@
#region References
using Server.Accounting;
using Server.Guilds;
using Server.Items;
using Server.Multis;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class HouseDemolishGump : Gump
{
private readonly BaseHouse m_House;
private readonly Mobile m_Mobile;
public HouseDemolishGump(Mobile mobile, BaseHouse house)
: base(110, 100)
{
m_Mobile = mobile;
m_House = house;
mobile.CloseGump(typeof(HouseDemolishGump));
Closable = false;
AddPage(0);
AddBackground(0, 0, 420, 280, 5054);
AddImageTiled(10, 10, 400, 20, 2624);
AddAlphaRegion(10, 10, 400, 20);
AddHtmlLocalized(10, 10, 400, 20, 1060635, 30720, false, false); // <CENTER>WARNING</CENTER>
AddImageTiled(10, 40, 400, 200, 2624);
AddAlphaRegion(10, 40, 400, 200);
AddHtmlLocalized(10, 40, 400, 200, 1061795, 32512, false, true);
/* You are about to demolish your house.
* You will be refunded the house's value directly to your bank box.
* All items in the house will remain behind and can be freely picked up by anyone.
* Once the house is demolished, anyone can attempt to place a new house on the vacant land.
* This action will not un-condemn any other houses on your account, nor will it end your 7-day waiting period (if it applies to you).
* Are you sure you wish to continue?
*/
AddImageTiled(10, 250, 400, 20, 2624);
AddAlphaRegion(10, 250, 400, 20);
AddButton(10, 250, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767, false, false); // OKAY
AddButton(210, 250, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767, false, false); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1 && !m_House.Deleted)
{
if (m_House.IsOwner(m_Mobile))
{
if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
{
return;
}
if (!Guild.NewGuildSystem && m_House.FindGuildstone() != null)
{
m_Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
return;
}
/*
if (m_House.PlayerVendors.Count > 0)
{
m_Mobile.SendLocalizedMessage(503236); // You need to collect your vendor's belongings before moving.
return;
}
*/
if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
{
m_Mobile.SendLocalizedMessage(1062679);
// You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
return;
}
if (m_House.HasRentedVendors)
{
m_Mobile.SendLocalizedMessage(1062680);
// You cannot do that that while you still have contract vendors in your house.
return;
}
if (m_House.VendorInventories.Count > 0)
{
m_Mobile.SendLocalizedMessage(1062681);
// You cannot do that that while you still have unclaimed contract vendor inventory in your house.
return;
}
else if (m_House.HasActiveAuction)
{
m_Mobile.SendLocalizedMessage(1156453);
// You cannot currently take this action because you have auction safes locked down in your home. You must remove them first.
return;
}
if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
{
m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
m_House.RemoveKeys(m_Mobile);
m_House.Delete();
}
else
{
Item toGive;
if (m_House.IsAosRules)
{
if (m_House.Price > 0)
{
toGive = new BankCheck(m_House.Price);
}
else
{
toGive = m_House.GetDeed();
}
}
else
{
toGive = m_House.GetDeed();
if (toGive == null && m_House.Price > 0)
{
toGive = new BankCheck(m_House.Price);
}
}
if (AccountGold.Enabled && toGive is BankCheck)
{
var worth = ((BankCheck)toGive).Worth;
if (m_Mobile.Account != null && m_Mobile.Account.DepositGold(worth))
{
toGive.Delete();
m_Mobile.SendLocalizedMessage(1060397, worth.ToString("#,0"));
// ~1_AMOUNT~ gold has been deposited into your bank box.
m_House.RemoveKeys(m_Mobile);
m_House.Delete();
return;
}
}
if (toGive != null)
{
var box = m_Mobile.BankBox;
if (box.TryDropItem(m_Mobile, toGive, false))
{
if (toGive is BankCheck)
{
m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString("#,0"));
// ~1_AMOUNT~ gold has been deposited into your bank box.
}
m_House.RemoveKeys(m_Mobile);
m_House.Delete();
}
else
{
toGive.Delete();
m_Mobile.SendLocalizedMessage(500390); // Your bank box is full.
}
}
else
{
m_Mobile.SendMessage("Unable to refund house.");
}
}
}
else
{
m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this.
}
}
}
}
}

753
Scripts/Gumps/HouseGump.cs Normal file
View File

@@ -0,0 +1,753 @@
using System;
using System.Collections.Generic;
using Server.Multis;
using Server.Network;
using Server.Prompts;
namespace Server.Gumps
{
public class HouseListGump : Gump
{
private readonly BaseHouse m_House;
public HouseListGump(int number, List<Mobile> list, BaseHouse house, bool accountOf)
: base(20, 30)
{
if (house.Deleted)
return;
m_House = house;
AddPage(0);
AddBackground(0, 0, 420, 430, 5054);
AddBackground(10, 10, 400, 410, 3000);
AddButton(20, 388, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 388, 300, 20, 1011104, false, false); // Return to previous menu
AddHtmlLocalized(20, 20, 350, 20, number, false, false);
if (list != null)
{
for (int i = 0; i < list.Count; ++i)
{
if ((i % 16) == 0)
{
if (i != 0)
{
// Next button
AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, (i / 16) + 1);
}
AddPage((i / 16) + 1);
if (i != 0)
{
// Previous button
AddButton(340, 20, 4014, 4016, 0, GumpButtonType.Page, i / 16);
}
}
Mobile m = list[i];
string name;
if (m == null || (name = m.Name) == null || (name = name.Trim()).Length <= 0)
continue;
AddLabel(55, 55 + ((i % 16) * 20), 0, accountOf && m.Player && m.Account != null ? String.Format("Account of {0}", name) : name);
}
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_House.Deleted)
return;
Mobile from = state.Mobile;
from.SendGump(new HouseGump(from, m_House));
}
}
public class HouseRemoveGump : Gump
{
private readonly BaseHouse m_House;
private readonly List<Mobile> m_List;
private readonly List<Mobile> m_Copy;
private readonly int m_Number;
private readonly bool m_AccountOf;
public HouseRemoveGump(int number, List<Mobile> list, BaseHouse house, bool accountOf)
: base(20, 30)
{
if (house.Deleted)
return;
m_House = house;
m_List = list;
m_Number = number;
m_AccountOf = accountOf;
AddPage(0);
AddBackground(0, 0, 420, 430, 5054);
AddBackground(10, 10, 400, 410, 3000);
AddButton(20, 388, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 388, 300, 20, 1011104, false, false); // Return to previous menu
AddButton(20, 365, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 365, 300, 20, 1011270, false, false); // Remove now!
AddHtmlLocalized(20, 20, 350, 20, number, false, false);
if (list != null)
{
m_Copy = new List<Mobile>(list);
for (int i = 0; i < list.Count; ++i)
{
if ((i % 15) == 0)
{
if (i != 0)
{
// Next button
AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, (i / 15) + 1);
}
AddPage((i / 15) + 1);
if (i != 0)
{
// Previous button
AddButton(340, 20, 4014, 4016, 0, GumpButtonType.Page, i / 15);
}
}
Mobile m = list[i];
string name;
if (m == null || (name = m.Name) == null || (name = name.Trim()).Length <= 0)
continue;
AddCheck(34, 52 + ((i % 15) * 20), 0xD2, 0xD3, false, i);
AddLabel(55, 52 + ((i % 15) * 20), 0, accountOf && m.Player && m.Account != null ? String.Format("Account of {0}", name) : name);
}
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_House.Deleted)
return;
Mobile from = state.Mobile;
if (m_List != null && info.ButtonID == 1) // Remove now
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
for (int i = 0; i < switches.Length; ++i)
{
int index = switches[i];
if (index >= 0 && index < m_Copy.Count)
m_List.Remove(m_Copy[index]);
}
if (m_List.Count > 0)
{
from.CloseGump(typeof(HouseGump));
from.CloseGump(typeof(HouseListGump));
from.CloseGump(typeof(HouseRemoveGump));
from.SendGump(new HouseRemoveGump(m_Number, m_List, m_House, m_AccountOf));
return;
}
}
}
from.SendGump(new HouseGump(from, m_House));
}
}
public class HouseGump : Gump
{
private readonly BaseHouse m_House;
public HouseGump(Mobile from, BaseHouse house)
: base(20, 30)
{
if (house.Deleted)
return;
m_House = house;
from.CloseGump(typeof(HouseGump));
from.CloseGump(typeof(HouseListGump));
from.CloseGump(typeof(HouseRemoveGump));
bool isCombatRestricted = house.IsCombatRestricted(from);
bool isOwner = m_House.IsOwner(from);
bool isCoOwner = isOwner || m_House.IsCoOwner(from);
bool isFriend = isCoOwner || m_House.IsFriend(from);
if (isCombatRestricted)
isFriend = isCoOwner = isOwner = false;
AddPage(0);
if (isFriend)
{
AddBackground(0, 0, 420, 430, 5054);
AddBackground(10, 10, 400, 410, 3000);
}
AddImage(130, 0, 100);
if (m_House.Sign != null)
{
var lines = Wrap(m_House.Sign.GetName());
if (lines != null)
{
for (int i = 0, y = (101 - (lines.Count * 14)) / 2; i < lines.Count; ++i, y += 14)
{
string s = lines[i];
AddLabel(130 + ((143 - (s.Length * 8)) / 2), y, 0, s);
}
}
}
if (!isFriend)
return;
AddHtmlLocalized(55, 103, 75, 20, 1011233, false, false); // INFO
AddButton(20, 103, 4005, 4007, 0, GumpButtonType.Page, 1);
AddHtmlLocalized(170, 103, 75, 20, 1011234, false, false); // FRIENDS
AddButton(135, 103, 4005, 4007, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(295, 103, 75, 20, 1011235, false, false); // OPTIONS
AddButton(260, 103, 4005, 4007, 0, GumpButtonType.Page, 3);
AddHtmlLocalized(295, 390, 75, 20, 1011441, false, false); // EXIT
AddButton(260, 390, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 390, 200, 20, 1011236, false, false); // Change this house's name!
AddButton(20, 390, 4005, 4007, 1, GumpButtonType.Reply, 0);
// Info page
AddPage(1);
AddHtmlLocalized(20, 135, 100, 20, 1011242, false, false); // Owned by:
AddHtml(120, 135, 100, 20, GetOwnerName(), false, false);
AddHtmlLocalized(20, 170, 275, 20, 1011237, false, false); // Number of locked down items:
AddHtml(320, 170, 50, 20, m_House.LockDownCount.ToString(), false, false);
AddHtmlLocalized(20, 190, 275, 20, 1011238, false, false); // Maximum locked down items:
AddHtml(320, 190, 50, 20, m_House.MaxLockDowns.ToString(), false, false);
AddHtmlLocalized(20, 210, 275, 20, 1011239, false, false); // Number of secure containers:
AddHtml(320, 210, 50, 20, m_House.SecureCount.ToString(), false, false);
AddHtmlLocalized(20, 230, 275, 20, 1011240, false, false); // Maximum number of secure containers:
AddHtml(320, 230, 50, 20, m_House.MaxSecures.ToString(), false, false);
AddHtmlLocalized(20, 260, 400, 20, 1018032, false, false); // This house is properly placed.
AddHtmlLocalized(20, 280, 400, 20, 1018035, false, false); // This house is of modern design.
if (m_House.Public)
{
// TODO: Validate exact placement
AddHtmlLocalized(20, 305, 275, 20, 1011241, false, false); // Number of visits this building has had
AddHtml(320, 305, 50, 20, m_House.TotalVisits.ToString(), false, false);
}
// Friends page
AddPage(2);
AddHtmlLocalized(45, 130, 150, 20, 1011266, false, false); // List of co-owners
AddButton(20, 130, 2714, 2715, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 150, 150, 20, 1011267, false, false); // Add a co-owner
AddButton(20, 150, 2714, 2715, 3, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 170, 150, 20, 1018036, false, false); // Remove a co-owner
AddButton(20, 170, 2714, 2715, 4, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 190, 150, 20, 1011268, false, false); // Clear co-owner list
AddButton(20, 190, 2714, 2715, 5, GumpButtonType.Reply, 0);
AddHtmlLocalized(225, 130, 155, 20, 1011243, false, false); // List of Friends
AddButton(200, 130, 2714, 2715, 6, GumpButtonType.Reply, 0);
AddHtmlLocalized(225, 150, 155, 20, 1011244, false, false); // Add a Friend
AddButton(200, 150, 2714, 2715, 7, GumpButtonType.Reply, 0);
AddHtmlLocalized(225, 170, 155, 20, 1018037, false, false); // Remove a Friend
AddButton(200, 170, 2714, 2715, 8, GumpButtonType.Reply, 0);
AddHtmlLocalized(225, 190, 155, 20, 1011245, false, false); // Clear Friends list
AddButton(200, 190, 2714, 2715, 9, GumpButtonType.Reply, 0);
AddHtmlLocalized(120, 215, 280, 20, 1011258, false, false); // Ban someone from the house
AddButton(95, 215, 2714, 2715, 10, GumpButtonType.Reply, 0);
AddHtmlLocalized(120, 235, 280, 20, 1011259, false, false); // Eject someone from the house
AddButton(95, 235, 2714, 2715, 11, GumpButtonType.Reply, 0);
AddHtmlLocalized(120, 255, 280, 20, 1011260, false, false); // View a list of banned people
AddButton(95, 255, 2714, 2715, 12, GumpButtonType.Reply, 0);
AddHtmlLocalized(120, 275, 280, 20, 1011261, false, false); // Lift a ban
AddButton(95, 275, 2714, 2715, 13, GumpButtonType.Reply, 0);
// Options page
AddPage(3);
AddHtmlLocalized(45, 150, 355, 30, 1011248, false, false); // Transfer ownership of the house
AddButton(20, 150, 2714, 2715, 14, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 180, 355, 30, 1011249, false, false); // Demolish house and get deed back
AddButton(20, 180, 2714, 2715, 15, GumpButtonType.Reply, 0);
if (!m_House.Public)
{
AddHtmlLocalized(45, 210, 355, 30, 1011247, false, false); // Change the house locks
AddButton(20, 210, 2714, 2715, 16, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 240, 350, 90, 1011253, false, false); // Declare this building to be public. This will make your front door unlockable.
AddButton(20, 240, 2714, 2715, 17, GumpButtonType.Reply, 0);
}
else
{
//AddHtmlLocalized( 45, 280, 350, 30, 1011250, false, false ); // Change the sign type
AddHtmlLocalized(45, 210, 350, 30, 1011250, false, false); // Change the sign type
AddButton(20, 210, 2714, 2715, 0, GumpButtonType.Page, 4);
AddHtmlLocalized(45, 240, 350, 30, 1011252, false, false); // Declare this building to be private.
AddButton(20, 240, 2714, 2715, 17, GumpButtonType.Reply, 0);
// Change the sign type
AddPage(4);
for (int i = 0; i < 24; ++i)
{
AddRadio(53 + ((i / 4) * 50), 137 + ((i % 4) * 35), 210, 211, false, i + 1);
AddItem(60 + ((i / 4) * 50), 130 + ((i % 4) * 35), 2980 + (i * 2));
}
AddHtmlLocalized(200, 305, 129, 20, 1011254, false, false); // Guild sign choices
AddButton(350, 305, 252, 253, 0, GumpButtonType.Page, 5);
AddHtmlLocalized(200, 340, 355, 30, 1011277, false, false); // Okay that is fine.
AddButton(350, 340, 4005, 4007, 18, GumpButtonType.Reply, 0);
AddPage(5);
for (int i = 0; i < 29; ++i)
{
AddRadio(53 + ((i / 5) * 50), 137 + ((i % 5) * 35), 210, 211, false, i + 25);
AddItem(60 + ((i / 5) * 50), 130 + ((i % 5) * 35), 3028 + (i * 2));
}
AddHtmlLocalized(200, 305, 129, 20, 1011255, false, false); // Shop sign choices
AddButton(350, 305, 250, 251, 0, GumpButtonType.Page, 4);
AddHtmlLocalized(200, 340, 355, 30, 1011277, false, false); // Okay that is fine.
AddButton(350, 340, 4005, 4007, 18, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_House.Deleted)
return;
Mobile from = sender.Mobile;
bool isCombatRestricted = m_House.IsCombatRestricted(from);
bool isOwner = m_House.IsOwner(from);
bool isCoOwner = isOwner || m_House.IsCoOwner(from);
bool isFriend = isCoOwner || m_House.IsFriend(from);
if (isCombatRestricted)
isFriend = isCoOwner = isOwner = false;
if (!isFriend || !from.Alive)
return;
Item sign = m_House.Sign;
if (sign == null || from.Map != sign.Map || !from.InRange(sign.GetWorldLocation(), 18))
return;
switch ( info.ButtonID )
{
case 1: // Rename sign
{
from.Prompt = new RenamePrompt(m_House);
from.SendLocalizedMessage(501302); // What dost thou wish the sign to say?
break;
}
case 2: // List of co-owners
{
from.CloseGump(typeof(HouseGump));
from.CloseGump(typeof(HouseListGump));
from.CloseGump(typeof(HouseRemoveGump));
from.SendGump(new HouseListGump(1011275, m_House.CoOwners, m_House, false));
break;
}
case 3: // Add co-owner
{
if (isOwner)
{
from.SendLocalizedMessage(501328); // Target the person you wish to name a co-owner of your household.
from.Target = new CoOwnerTarget(true, m_House);
}
else
{
from.SendLocalizedMessage(501327); // Only the house owner may add Co-owners.
}
break;
}
case 4: // Remove co-owner
{
if (isOwner)
{
from.CloseGump(typeof(HouseGump));
from.CloseGump(typeof(HouseListGump));
from.CloseGump(typeof(HouseRemoveGump));
from.SendGump(new HouseRemoveGump(1011274, m_House.CoOwners, m_House, false));
}
else
{
from.SendLocalizedMessage(501329); // Only the house owner may remove co-owners.
}
break;
}
case 5: // Clear co-owners
{
if (isOwner)
{
if (m_House.CoOwners != null)
m_House.CoOwners.Clear();
from.SendLocalizedMessage(501333); // All co-owners have been removed from this house.
}
else
{
from.SendLocalizedMessage(501330); // Only the house owner may remove co-owners.
}
break;
}
case 6: // List friends
{
from.CloseGump(typeof(HouseGump));
from.CloseGump(typeof(HouseListGump));
from.CloseGump(typeof(HouseRemoveGump));
from.SendGump(new HouseListGump(1011273, m_House.Friends, m_House, false));
break;
}
case 7: // Add friend
{
if (isCoOwner)
{
from.SendLocalizedMessage(501317); // Target the person you wish to name a friend of your household.
from.Target = new HouseFriendTarget(true, m_House);
}
else
{
from.SendLocalizedMessage(501316); // Only the house owner may add friends.
}
break;
}
case 8: // Remove friend
{
if (isCoOwner)
{
from.CloseGump(typeof(HouseGump));
from.CloseGump(typeof(HouseListGump));
from.CloseGump(typeof(HouseRemoveGump));
from.SendGump(new HouseRemoveGump(1011272, m_House.Friends, m_House, false));
}
else
{
from.SendLocalizedMessage(501318); // Only the house owner may remove friends.
}
break;
}
case 9: // Clear friends
{
if (isCoOwner)
{
if (m_House.Friends != null)
m_House.Friends.Clear();
from.SendLocalizedMessage(501332); // All friends have been removed from this house.
}
else
{
from.SendLocalizedMessage(501319); // Only the house owner may remove friends.
}
break;
}
case 10: // Ban
{
from.SendLocalizedMessage(501325); // Target the individual to ban from this house.
from.Target = new HouseBanTarget(true, m_House);
break;
}
case 11: // Eject
{
from.SendLocalizedMessage(501326); // Target the individual to eject from this house.
from.Target = new HouseKickTarget(m_House);
break;
}
case 12: // List bans
{
from.CloseGump(typeof(HouseGump));
from.CloseGump(typeof(HouseListGump));
from.CloseGump(typeof(HouseRemoveGump));
from.SendGump(new HouseListGump(1011271, m_House.Bans, m_House, true));
break;
}
case 13: // Remove ban
{
from.CloseGump(typeof(HouseGump));
from.CloseGump(typeof(HouseListGump));
from.CloseGump(typeof(HouseRemoveGump));
from.SendGump(new HouseRemoveGump(1011269, m_House.Bans, m_House, true));
break;
}
case 14: // Transfer ownership
{
if (isOwner)
{
from.SendLocalizedMessage(501309); // Target the person to whom you wish to give this house.
from.Target = new HouseOwnerTarget(m_House);
}
else
{
from.SendLocalizedMessage(501310); // Only the house owner may do
}
break;
}
case 15: // Demolish house
{
if (isOwner)
{
if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null)
{
from.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
}
else
{
from.CloseGump(typeof(HouseDemolishGump));
from.SendGump(new HouseDemolishGump(from, m_House));
}
}
else
{
from.SendLocalizedMessage(501320); // Only the house owner may do
}
break;
}
case 16: // Change locks
{
if (m_House.Public)
{
from.SendLocalizedMessage(501669);// Public houses are always unlocked.
}
else
{
if (isOwner)
{
m_House.RemoveKeys(from);
m_House.ChangeLocks(from);
from.SendLocalizedMessage(501306); // The locks on your front door have been changed, and new master keys have been placed in your bank and your backpack.
}
else
{
from.SendLocalizedMessage(501303); // Only the house owner may change the house locks.
}
}
break;
}
case 17: // Declare public/private
{
if (isOwner)
{
if (m_House.Public && m_House.PlayerVendors.Count > 0)
{
from.SendLocalizedMessage(501887); // You have vendors working out of this building. It cannot be declared private until there are no vendors in place.
break;
}
m_House.Public = !m_House.Public;
if (!m_House.Public)
{
m_House.ChangeLocks(from);
from.SendLocalizedMessage(501888); // This house is now private.
from.SendLocalizedMessage(501306); // The locks on your front door have been changed, and new master keys have been placed in your bank and your backpack.
}
else
{
m_House.RemoveKeys(from);
m_House.RemoveLocks();
from.SendLocalizedMessage(501886);//This house is now public. Friends of the house my now have vendors working out of this building.
}
}
else
{
from.SendLocalizedMessage(501307); // Only the house owner may do
}
break;
}
case 18: // Change type
{
if (isOwner)
{
if (m_House.Public && info.Switches.Length > 0)
{
int index = info.Switches[0] - 1;
if (index >= 0 && index < 53)
m_House.ChangeSignType(2980 + (index * 2));
}
}
else
{
from.SendLocalizedMessage(501307); // Only the house owner may do
}
break;
}
}
}
private List<string> Wrap(string value)
{
if (value == null || (value = value.Trim()).Length <= 0)
return null;
string[] values = value.Split(' ');
List<string> list = new List<string>();
string current = "";
for (int i = 0; i < values.Length; ++i)
{
string val = values[i];
string v = current.Length == 0 ? val : current + ' ' + val;
if (v.Length < 10)
{
current = v;
}
else if (v.Length == 10)
{
list.Add(v);
if (list.Count == 6)
return list;
current = "";
}
else if (val.Length <= 10)
{
list.Add(current);
if (list.Count == 6)
return list;
current = val;
}
else
{
while (v.Length >= 10)
{
list.Add(v.Substring(0, 10));
if (list.Count == 6)
return list;
v = v.Substring(10);
}
current = v;
}
}
if (current.Length > 0)
list.Add(current);
return list;
}
private string GetOwnerName()
{
Mobile m = m_House.Owner;
if (m == null)
return "(unowned)";
string name;
if ((name = m.Name) == null || (name = name.Trim()).Length <= 0)
name = "(no name)";
return name;
}
}
}
namespace Server.Prompts
{
public class RenamePrompt : Prompt
{
public override int MessageCliloc { get { return 501302; } }
private readonly BaseHouse m_House;
public RenamePrompt(BaseHouse house)
{
m_House = house;
}
public override void OnResponse(Mobile from, string text)
{
if (m_House.IsFriend(from))
{
if (m_House.Sign != null)
m_House.Sign.Name = text;
from.SendMessage("Sign changed.");
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,329 @@
using System;
using System.Collections.Generic;
using Server.Accounting;
using Server.Items;
using Server.Network;
namespace Server.Gumps
{
public class HouseRaffleManagementGump : Gump
{
public const int LabelColor = 0xFFFFFF;
public const int HighlightColor = 0x11EE11;
private readonly HouseRaffleStone m_Stone;
private readonly List<RaffleEntry> m_List;
private readonly SortMethod m_Sort;
private int m_Page;
public HouseRaffleManagementGump(HouseRaffleStone stone)
: this(stone, SortMethod.Default, 0)
{
}
public HouseRaffleManagementGump(HouseRaffleStone stone, SortMethod sort, int page)
: base(40, 40)
{
this.m_Stone = stone;
this.m_Page = page;
this.m_List = new List<RaffleEntry>(this.m_Stone.Entries);
this.m_Sort = sort;
switch ( this.m_Sort )
{
case SortMethod.Name:
{
this.m_List.Sort(NameComparer.Instance);
break;
}
case SortMethod.Account:
{
this.m_List.Sort(AccountComparer.Instance);
break;
}
case SortMethod.Address:
{
this.m_List.Sort(AddressComparer.Instance);
break;
}
}
this.AddPage(0);
this.AddBackground(0, 0, 618, 354, 9270);
this.AddAlphaRegion(10, 10, 598, 334);
this.AddHtml(10, 10, 598, 20, this.Color(this.Center("Raffle Management"), LabelColor), false, false);
this.AddHtml(45, 35, 100, 20, this.Color("Location:", LabelColor), false, false);
this.AddHtml(145, 35, 250, 20, this.Color(this.m_Stone.FormatLocation(), LabelColor), false, false);
this.AddHtml(45, 55, 100, 20, this.Color("Ticket Price:", LabelColor), false, false);
this.AddHtml(145, 55, 250, 20, this.Color(this.m_Stone.FormatPrice(), LabelColor), false, false);
this.AddHtml(45, 75, 100, 20, this.Color("Total Entries:", LabelColor), false, false);
this.AddHtml(145, 75, 250, 20, this.Color(this.m_Stone.Entries.Count.ToString(), LabelColor), false, false);
this.AddButton(440, 33, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0);
this.AddHtml(474, 35, 120, 20, this.Color("Sort by name", LabelColor), false, false);
this.AddButton(440, 53, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
this.AddHtml(474, 55, 120, 20, this.Color("Sort by account", LabelColor), false, false);
this.AddButton(440, 73, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0);
this.AddHtml(474, 75, 120, 20, this.Color("Sort by address", LabelColor), false, false);
this.AddImageTiled(13, 99, 592, 242, 9264);
this.AddImageTiled(14, 100, 590, 240, 9274);
this.AddAlphaRegion(14, 100, 590, 240);
this.AddHtml(14, 100, 590, 20, this.Color(this.Center("Entries"), LabelColor), false, false);
if (page > 0)
this.AddButton(567, 104, 0x15E3, 0x15E7, 1, GumpButtonType.Reply, 0);
else
this.AddImage(567, 104, 0x25EA);
if ((page + 1) * 10 < this.m_List.Count)
this.AddButton(584, 104, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
else
this.AddImage(584, 104, 0x25E6);
this.AddHtml(14, 120, 30, 20, this.Color(this.Center("DEL"), LabelColor), false, false);
this.AddHtml(47, 120, 250, 20, this.Color("Name", LabelColor), false, false);
this.AddHtml(295, 120, 100, 20, this.Color(this.Center("Address"), LabelColor), false, false);
this.AddHtml(395, 120, 150, 20, this.Color(this.Center("Date"), LabelColor), false, false);
this.AddHtml(545, 120, 60, 20, this.Color(this.Center("Num"), LabelColor), false, false);
int idx = 0;
Mobile winner = this.m_Stone.Winner;
for (int i = page * 10; i >= 0 && i < this.m_List.Count && i < (page + 1) * 10; ++i, ++idx)
{
RaffleEntry entry = this.m_List[i];
if (entry == null)
continue;
this.AddButton(13, 138 + (idx * 20), 4002, 4004, 6 + i, GumpButtonType.Reply, 0);
int x = 45;
int color = (winner != null && entry.From == winner) ? HighlightColor : LabelColor;
string name = null;
if (entry.From != null)
{
Account acc = entry.From.Account as Account;
if (acc != null)
name = String.Format("{0} ({1})", entry.From.Name, acc);
else
name = entry.From.Name;
}
if (name != null)
this.AddHtml(x + 2, 140 + (idx * 20), 250, 20, this.Color(name, color), false, false);
x += 250;
if (entry.Address != null)
this.AddHtml(x, 140 + (idx * 20), 100, 20, this.Color(this.Center(entry.Address.ToString()), color), false, false);
x += 100;
this.AddHtml(x, 140 + (idx * 20), 150, 20, this.Color(this.Center(entry.Date.ToString()), color), false, false);
x += 150;
this.AddHtml(x, 140 + (idx * 20), 60, 20, this.Color(this.Center("1"), color), false, false);
x += 60;
}
}
public enum SortMethod
{
Default,
Name,
Account,
Address
}
public string Right(string text)
{
return String.Format("<DIV ALIGN=RIGHT>{0}</DIV>", text);
}
public string Center(string text)
{
return String.Format("<CENTER>{0}</CENTER>", text);
}
public string Color(string text, int color)
{
return String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
int buttonId = info.ButtonID;
switch ( buttonId )
{
case 1: // Previous
{
if (this.m_Page > 0)
this.m_Page--;
from.SendGump(new HouseRaffleManagementGump(this.m_Stone, this.m_Sort, this.m_Page));
break;
}
case 2: // Next
{
if ((this.m_Page + 1) * 10 < this.m_Stone.Entries.Count)
this.m_Page++;
from.SendGump(new HouseRaffleManagementGump(this.m_Stone, this.m_Sort, this.m_Page));
break;
}
case 3: // Sort by name
{
from.SendGump(new HouseRaffleManagementGump(this.m_Stone, SortMethod.Name, 0));
break;
}
case 4: // Sort by account
{
from.SendGump(new HouseRaffleManagementGump(this.m_Stone, SortMethod.Account, 0));
break;
}
case 5: // Sort by address
{
from.SendGump(new HouseRaffleManagementGump(this.m_Stone, SortMethod.Address, 0));
break;
}
default: // Delete
{
buttonId -= 6;
if (buttonId >= 0 && buttonId < this.m_List.Count)
{
this.m_Stone.Entries.Remove(this.m_List[buttonId]);
if (this.m_Page > 0 && this.m_Page * 10 >= this.m_List.Count - 1)
this.m_Page--;
from.SendGump(new HouseRaffleManagementGump(this.m_Stone, this.m_Sort, this.m_Page));
}
break;
}
}
}
private class NameComparer : IComparer<RaffleEntry>
{
public static readonly IComparer<RaffleEntry> Instance = new NameComparer();
public NameComparer()
{
}
public int Compare(RaffleEntry x, RaffleEntry y)
{
bool xIsNull = (x == null || x.From == null);
bool yIsNull = (y == null || y.From == null);
if (xIsNull && yIsNull)
return 0;
else if (xIsNull)
return -1;
else if (yIsNull)
return 1;
int result = Insensitive.Compare(x.From.Name, y.From.Name);
if (result == 0)
return x.Date.CompareTo(y.Date);
else
return result;
}
}
private class AccountComparer : IComparer<RaffleEntry>
{
public static readonly IComparer<RaffleEntry> Instance = new AccountComparer();
public AccountComparer()
{
}
public int Compare(RaffleEntry x, RaffleEntry y)
{
bool xIsNull = (x == null || x.From == null);
bool yIsNull = (y == null || y.From == null);
if (xIsNull && yIsNull)
return 0;
else if (xIsNull)
return -1;
else if (yIsNull)
return 1;
Account a = x.From.Account as Account;
Account b = y.From.Account as Account;
if (a == null && b == null)
return 0;
else if (a == null)
return -1;
else if (b == null)
return 1;
int result = Insensitive.Compare(a.Username, b.Username);
if (result == 0)
return x.Date.CompareTo(y.Date);
else
return result;
}
}
private class AddressComparer : IComparer<RaffleEntry>
{
public static readonly IComparer<RaffleEntry> Instance = new AddressComparer();
public AddressComparer()
{
}
public int Compare(RaffleEntry x, RaffleEntry y)
{
bool xIsNull = (x == null || x.Address == null);
bool yIsNull = (y == null || y.Address == null);
if (xIsNull && yIsNull)
return 0;
else if (xIsNull)
return -1;
else if (yIsNull)
return 1;
byte[] a = x.Address.GetAddressBytes();
byte[] b = y.Address.GetAddressBytes();
for (int i = 0; i < a.Length && i < b.Length; i++)
{
int compare = a[i].CompareTo(b[i]);
if (compare != 0)
return compare;
}
return x.Date.CompareTo(y.Date);
}
}
}
}

View File

@@ -0,0 +1,64 @@
using System;
using Server.Multis;
using Server.Network;
namespace Server.Gumps
{
public class HouseTransferGump : Gump
{
private readonly Mobile m_From;
private readonly Mobile m_To;
private readonly BaseHouse m_House;
public HouseTransferGump(Mobile from, Mobile to, BaseHouse house)
: base(110, 100)
{
this.m_From = from;
this.m_To = to;
this.m_House = house;
this.Closable = false;
this.AddPage(0);
this.AddBackground(0, 0, 420, 280, 5054);
this.AddImageTiled(10, 10, 400, 20, 2624);
this.AddAlphaRegion(10, 10, 400, 20);
this.AddHtmlLocalized(10, 10, 400, 20, 1060635, 30720, false, false); // <CENTER>WARNING</CENTER>
this.AddImageTiled(10, 40, 400, 200, 2624);
this.AddAlphaRegion(10, 40, 400, 200);
/* Another player is attempting to initiate a house trade with you.
* In order for you to see this window, both you and the other person are standing within two paces of the house to be traded.
* If you click OKAY below, a house trade scroll will appear in your trade window and you can complete the transaction.
* This scroll is a distinctive blue color and will show the name of the house, the name of the owner of that house, and the sextant coordinates of the center of the house when you hover your mouse over it.
* In order for the transaction to be successful, you both must accept the trade and you both must remain within two paces of the house sign.
* <BR><BR>Accepting this house in trade will <a href = "?ForceTopic97">condemn</a> any and all of your other houses that you may have.
* All of your houses on <U>all shards</U> will be affected.
* <BR><BR>In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.<BR><BR>
* Once you accept these terms, these effects cannot be reversed.
* Re-deeding or transferring your new house will <U>not</U> uncondemn your other house(s) nor will the one week timer be removed.<BR><BR>
* If you are absolutely certain you wish to proceed, click the button next to OKAY below.
* If you do not wish to trade for this house, click CANCEL.
*/
this.AddHtmlLocalized(10, 40, 400, 200, 1062086, 32512, false, true);
this.AddImageTiled(10, 250, 400, 20, 2624);
this.AddAlphaRegion(10, 250, 400, 20);
this.AddButton(10, 250, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767, false, false); // OKAY
this.AddButton(210, 250, 4005, 4007, 0, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767, false, false); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1 && !this.m_House.Deleted)
this.m_House.EndConfirmTransfer(this.m_From, this.m_To);
}
}
}

View File

@@ -0,0 +1,47 @@
using System;
namespace Server.Gumps
{
public delegate void NoticeGumpCallback(Mobile from, object state);
public class NoticeGump : Gump
{
private readonly NoticeGumpCallback m_Callback;
private readonly object m_State;
public NoticeGump(int header, int headerColor, object content, int contentColor, int width, int height, NoticeGumpCallback callback, object state)
: base((640 - width) / 2, (480 - height) / 2)
{
this.m_Callback = callback;
this.m_State = state;
this.Closable = false;
this.AddPage(0);
this.AddBackground(0, 0, width, height, 5054);
this.AddImageTiled(10, 10, width - 20, 20, 2624);
this.AddAlphaRegion(10, 10, width - 20, 20);
this.AddHtmlLocalized(10, 10, width - 20, 20, header, headerColor, false, false);
this.AddImageTiled(10, 40, width - 20, height - 80, 2624);
this.AddAlphaRegion(10, 40, width - 20, height - 80);
if (content is int)
this.AddHtmlLocalized(10, 40, width - 20, height - 80, (int)content, contentColor, false, true);
else if (content is string)
this.AddHtml(10, 40, width - 20, height - 80, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", contentColor, content), false, true);
this.AddImageTiled(10, height - 30, width - 20, 20, 2624);
this.AddAlphaRegion(10, height - 30, width - 20, 20);
this.AddButton(10, height - 30, 4005, 4007, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(40, height - 30, 120, 20, 1011036, 32767, false, false); // OKAY
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
if (info.ButtonID == 1 && this.m_Callback != null)
this.m_Callback(sender.Mobile, this.m_State);
}
}
}

View File

@@ -0,0 +1,81 @@
using System;
using Server.Mobiles;
using Server.Network;
namespace Server.Gumps
{
public class PetResurrectGump : Gump
{
private readonly BaseCreature m_Pet;
private readonly double m_HitsScalar;
public PetResurrectGump(Mobile from, BaseCreature pet)
: this(from, pet, 0.0)
{
}
public PetResurrectGump(Mobile from, BaseCreature pet, double hitsScalar)
: base(50, 50)
{
from.CloseGump(typeof(PetResurrectGump));
this.m_Pet = pet;
this.m_HitsScalar = hitsScalar;
this.AddPage(0);
this.AddBackground(10, 10, 265, 140, 0x242C);
this.AddItem(205, 40, 0x4);
this.AddItem(227, 40, 0x5);
this.AddItem(180, 78, 0xCAE);
this.AddItem(195, 90, 0xCAD);
this.AddItem(218, 95, 0xCB0);
this.AddHtmlLocalized(30, 30, 150, 75, 1049665, false, false); // <div align=center>Wilt thou sanctify the resurrection of:</div>
this.AddHtml(30, 70, 150, 25, String.Format("<div align=CENTER>{0}</div>", pet.Name), true, false);
this.AddButton(40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0); // Okay
this.AddButton(110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0); // Cancel
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (this.m_Pet.Deleted || !this.m_Pet.IsBonded || !this.m_Pet.IsDeadPet)
return;
Mobile from = state.Mobile;
if (info.ButtonID == 1)
{
if (this.m_Pet.Map == null || !this.m_Pet.Map.CanFit(this.m_Pet.Location, 16, false, false))
{
from.SendLocalizedMessage(503256); // You fail to resurrect the creature.
return;
}
else if (this.m_Pet.Region != null && this.m_Pet.Region.IsPartOf("Khaldun")) //TODO: Confirm for pets, as per Bandage's script.
{
from.SendLocalizedMessage(1010395); // The veil of death in this area is too strong and resists thy efforts to restore life.
return;
}
this.m_Pet.PlaySound(0x214);
this.m_Pet.FixedEffect(0x376A, 10, 16);
this.m_Pet.ResurrectPet();
double decreaseAmount;
if (from == this.m_Pet.ControlMaster)
decreaseAmount = 0.1;
else
decreaseAmount = 0.2;
for (int i = 0; i < this.m_Pet.Skills.Length; ++i) //Decrease all skills on pet.
this.m_Pet.Skills[i].Base -= decreaseAmount;
if (!this.m_Pet.IsDeadPet && this.m_HitsScalar > 0)
this.m_Pet.Hits = (int)(this.m_Pet.HitsMax * this.m_HitsScalar);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,282 @@
using System;
using Server.Network;
using Server.Spells;
using Server.Spells.Seventh;
namespace Server.Gumps
{
public class PolymorphEntry
{
public static readonly PolymorphEntry Chicken = new PolymorphEntry(8401, 0xD0, 1015236, 15, 10);
public static readonly PolymorphEntry Dog = new PolymorphEntry(8405, 0xD9, 1015237, 17, 10);
public static readonly PolymorphEntry Wolf = new PolymorphEntry(8426, 0xE1, 1015238, 18, 10);
public static readonly PolymorphEntry Panther = new PolymorphEntry(8473, 0xD6, 1015239, 20, 14);
public static readonly PolymorphEntry Gorilla = new PolymorphEntry(8437, 0x1D, 1015240, 23, 10);
public static readonly PolymorphEntry BlackBear = new PolymorphEntry(8399, 0xD3, 1015241, 22, 10);
public static readonly PolymorphEntry GrizzlyBear = new PolymorphEntry(8411, 0xD4, 1015242, 22, 12);
public static readonly PolymorphEntry PolarBear = new PolymorphEntry(8417, 0xD5, 1015243, 26, 10);
public static readonly PolymorphEntry HumanMale = new PolymorphEntry(8397, 0x190, 1015244, 29, 8);
public static readonly PolymorphEntry HumanFemale = new PolymorphEntry(8398, 0x191, 1015254, 29, 10);
public static readonly PolymorphEntry Slime = new PolymorphEntry(8424, 0x33, 1015246, 5, 10);
public static readonly PolymorphEntry Orc = new PolymorphEntry(8416, 0x11, 1015247, 29, 10);
public static readonly PolymorphEntry LizardMan = new PolymorphEntry(8414, 0x21, 1015248, 26, 10);
public static readonly PolymorphEntry Gargoyle = new PolymorphEntry(8409, 0x04, 1015249, 22, 10);
public static readonly PolymorphEntry Ogre = new PolymorphEntry(8415, 0x01, 1015250, 24, 9);
public static readonly PolymorphEntry Troll = new PolymorphEntry(8425, 0x36, 1015251, 25, 9);
public static readonly PolymorphEntry Ettin = new PolymorphEntry(8408, 0x02, 1015252, 25, 8);
public static readonly PolymorphEntry Daemon = new PolymorphEntry(8403, 0x09, 1015253, 25, 8);
private readonly int m_Art;
private readonly int m_Body;
private readonly int m_Num;
private readonly int m_X;
private readonly int m_Y;
private PolymorphEntry(int Art, int Body, int LocNum, int X, int Y)
{
this.m_Art = Art;
this.m_Body = Body;
this.m_Num = LocNum;
this.m_X = X;
this.m_Y = Y;
}
public int ArtID
{
get
{
return this.m_Art;
}
}
public int BodyID
{
get
{
return this.m_Body;
}
}
public int LocNumber
{
get
{
return this.m_Num;
}
}
public int X
{
get
{
return this.m_X;
}
}
public int Y
{
get
{
return this.m_Y;
}
}
}
public class PolymorphGump : Gump
{
private static readonly PolymorphCategory[] Categories = new PolymorphCategory[]
{
new PolymorphCategory(1015235, // Animals
PolymorphEntry.Chicken,
PolymorphEntry.Dog,
PolymorphEntry.Wolf,
PolymorphEntry.Panther,
PolymorphEntry.Gorilla,
PolymorphEntry.BlackBear,
PolymorphEntry.GrizzlyBear,
PolymorphEntry.PolarBear,
PolymorphEntry.HumanMale),
new PolymorphCategory(1015245, // Monsters
PolymorphEntry.Slime,
PolymorphEntry.Orc,
PolymorphEntry.LizardMan,
PolymorphEntry.Gargoyle,
PolymorphEntry.Ogre,
PolymorphEntry.Troll,
PolymorphEntry.Ettin,
PolymorphEntry.Daemon,
PolymorphEntry.HumanFemale)
};
private readonly Mobile m_Caster;
private readonly Item m_Scroll;
public PolymorphGump(Mobile caster, Item scroll)
: base(50, 50)
{
this.m_Caster = caster;
this.m_Scroll = scroll;
int x,y;
this.AddPage(0);
this.AddBackground(0, 0, 585, 393, 5054);
this.AddBackground(195, 36, 387, 275, 3000);
this.AddHtmlLocalized(0, 0, 510, 18, 1015234, false, false); // <center>Polymorph Selection Menu</center>
this.AddHtmlLocalized(60, 355, 150, 18, 1011036, false, false); // OKAY
this.AddButton(25, 355, 4005, 4007, 1, GumpButtonType.Reply, 1);
this.AddHtmlLocalized(320, 355, 150, 18, 1011012, false, false); // CANCEL
this.AddButton(285, 355, 4005, 4007, 0, GumpButtonType.Reply, 2);
y = 35;
for (int i = 0; i < Categories.Length; i++)
{
PolymorphCategory cat = (PolymorphCategory)Categories[i];
this.AddHtmlLocalized(5, y, 150, 25, cat.LocNumber, true, false);
this.AddButton(155, y, 4005, 4007, 0, GumpButtonType.Page, i + 1);
y += 25;
}
for (int i = 0; i < Categories.Length; i++)
{
PolymorphCategory cat = (PolymorphCategory)Categories[i];
this.AddPage(i + 1);
for (int c = 0; c < cat.Entries.Length; c++)
{
PolymorphEntry entry = (PolymorphEntry)cat.Entries[c];
x = 198 + (c % 3) * 129;
y = 38 + (c / 3) * 67;
this.AddHtmlLocalized(x, y, 100, 18, entry.LocNumber, false, false);
this.AddItem(x + 20, y + 25, entry.ArtID);
this.AddRadio(x, y + 20, 210, 211, false, (c << 8) + i);
}
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1 && info.Switches.Length > 0)
{
int cnum = info.Switches[0];
int cat = cnum % 256;
int ent = cnum >> 8;
if (cat >= 0 && cat < Categories.Length)
{
if (ent >= 0 && ent < Categories[cat].Entries.Length)
{
Spell spell = new PolymorphSpell(this.m_Caster, this.m_Scroll, Categories[cat].Entries[ent].BodyID);
spell.Cast();
}
}
}
}
private class PolymorphCategory
{
private readonly int m_Num;
private readonly PolymorphEntry[] m_Entries;
public PolymorphCategory(int num, params PolymorphEntry[] entries)
{
this.m_Num = num;
this.m_Entries = entries;
}
public PolymorphEntry[] Entries
{
get
{
return this.m_Entries;
}
}
public int LocNumber
{
get
{
return this.m_Num;
}
}
}
}
public class NewPolymorphGump : Gump
{
private static readonly PolymorphEntry[] m_Entries = new PolymorphEntry[]
{
PolymorphEntry.Chicken,
PolymorphEntry.Dog,
PolymorphEntry.Wolf,
PolymorphEntry.Panther,
PolymorphEntry.Gorilla,
PolymorphEntry.BlackBear,
PolymorphEntry.GrizzlyBear,
PolymorphEntry.PolarBear,
PolymorphEntry.HumanMale,
PolymorphEntry.HumanFemale,
PolymorphEntry.Slime,
PolymorphEntry.Orc,
PolymorphEntry.LizardMan,
PolymorphEntry.Gargoyle,
PolymorphEntry.Ogre,
PolymorphEntry.Troll,
PolymorphEntry.Ettin,
PolymorphEntry.Daemon
};
private readonly Mobile m_Caster;
private readonly Item m_Scroll;
public NewPolymorphGump(Mobile caster, Item scroll)
: base(0, 0)
{
this.m_Caster = caster;
this.m_Scroll = scroll;
this.AddPage(0);
this.AddBackground(0, 0, 520, 404, 0x13BE);
this.AddImageTiled(10, 10, 500, 20, 0xA40);
this.AddImageTiled(10, 40, 500, 324, 0xA40);
this.AddImageTiled(10, 374, 500, 20, 0xA40);
this.AddAlphaRegion(10, 10, 500, 384);
this.AddHtmlLocalized(14, 12, 500, 20, 1015234, 0x7FFF, false, false); // <center>Polymorph Selection Menu</center>
this.AddButton(10, 374, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(45, 376, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
for (int i = 0; i < m_Entries.Length; i++)
{
PolymorphEntry entry = m_Entries[i];
int page = i / 10 + 1;
int pos = i % 10;
if (pos == 0)
{
if (page > 1)
{
this.AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, page);
this.AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next
}
this.AddPage(page);
if (page > 1)
{
this.AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
this.AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back
}
}
int x = (pos % 2 == 0) ? 14 : 264;
int y = (pos / 2) * 64 + 44;
this.AddImageTiledButton(x, y, 0x918, 0x919, i + 1, GumpButtonType.Reply, 0, entry.ArtID, 0x0, entry.X, entry.Y);
this.AddHtmlLocalized(x + 84, y, 250, 60, entry.LocNumber, 0x7FFF, false, false);
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
int idx = info.ButtonID - 1;
if (idx < 0 || idx >= m_Entries.Length)
return;
Spell spell = new PolymorphSpell(this.m_Caster, this.m_Scroll, m_Entries[idx].BodyID);
spell.Cast();
}
}
}

View File

@@ -0,0 +1,42 @@
namespace Server.Gumps
{
public class PropsConfig
{
public static readonly bool OldStyle = false;
public static readonly int GumpOffsetX = 100;
public static readonly int GumpOffsetY = 30;
public static readonly int TextHue = 0;
public static readonly int TextOffsetX = 2;
public static readonly int OffsetGumpID = 0x0A40; // Pure black
// Light offwhite, textured : Dark navy blue, textured
public static readonly int HeaderGumpID = OldStyle ? 0x0BBC : 0x0E14;
public static readonly int EntryGumpID = 0x0BBC; // Light offwhite, textured
public static readonly int BackGumpID = 0x13BE; // Gray slate/stoney
public static readonly int SetGumpID = OldStyle ? 0x0000 : 0x0E14; // Empty : Dark navy blue, textured
public static readonly int SetWidth = 20;
public static readonly int SetOffsetX = OldStyle ? 4 : 2, SetOffsetY = 2;
public static readonly int SetButtonID1 = 0x15E1; // Arrow pointing right
public static readonly int SetButtonID2 = 0x15E5; // " pressed
public static readonly int PrevWidth = 20;
public static readonly int PrevOffsetX = 2, PrevOffsetY = 2;
public static readonly int PrevButtonID1 = 0x15E3; // Arrow pointing left
public static readonly int PrevButtonID2 = 0x15E7; // " pressed
public static readonly int NextWidth = 20;
public static readonly int NextOffsetX = 2, NextOffsetY = 2;
public static readonly int NextButtonID1 = 0x15E1; // Arrow pointing right
public static readonly int NextButtonID2 = 0x15E5; // " pressed
public static readonly int OffsetSize = 1;
public static readonly int EntryHeight = 20;
public static readonly int BorderSize = 10;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,316 @@
#region References
using System;
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class SetBodyGump : Gump
{
private static ArrayList m_Monster, m_Animal, m_Sea, m_Human;
private const int LabelColor32 = 0xFFFFFF;
private const int SelectedColor32 = 0x8080FF;
private const int TextColor32 = 0xFFFFFF;
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
private readonly int m_OurPage;
private readonly ArrayList m_OurList;
private readonly ModelBodyType m_OurType;
public SetBodyGump(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: this(prop, mobile, o, stack, page, list, 0, null, ModelBodyType.Invalid)
{ }
public SetBodyGump(
PropertyInfo prop,
Mobile mobile,
object o,
Stack stack,
int page,
ArrayList list,
int ourPage,
ArrayList ourList,
ModelBodyType ourType)
: base(20, 30)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
m_OurPage = ourPage;
m_OurList = ourList;
m_OurType = ourType;
AddPage(0);
AddBackground(0, 0, 525, 328, 5054);
AddImageTiled(10, 10, 505, 20, 0xA40);
AddAlphaRegion(10, 10, 505, 20);
AddImageTiled(10, 35, 505, 283, 0xA40);
AddAlphaRegion(10, 35, 505, 283);
AddTypeButton(10, 10, 1, "Monster", ModelBodyType.Monsters);
AddTypeButton(130, 10, 2, "Animal", ModelBodyType.Animals);
AddTypeButton(250, 10, 3, "Marine", ModelBodyType.Sea);
AddTypeButton(370, 10, 4, "Human", ModelBodyType.Human);
AddImage(480, 12, 0x25EA);
AddImage(497, 12, 0x25E6);
if (ourList == null)
{
AddLabel(15, 40, 0x480, "Choose a body type above.");
}
else if (ourList.Count == 0)
{
AddLabel(15, 40, 0x480, "The server must have UO:3D installed to use this feature.");
}
else
{
for (int i = 0, index = (ourPage * 12); i < 12 && index >= 0 && index < ourList.Count; ++i, ++index)
{
var entry = (InternalEntry)ourList[index];
var itemID = entry.ItemID;
var bounds = ItemBounds.Table[itemID & 0x3FFF];
var x = 15 + ((i % 4) * 125);
var y = 40 + ((i / 4) * 93);
AddItem(x + ((120 - bounds.Width) / 2) - bounds.X, y + ((69 - bounds.Height) / 2) - bounds.Y, itemID);
AddButton(x + 6, y + 66, 0x98D, 0x98D, 7 + index, GumpButtonType.Reply, 0);
x += 6;
y += 67;
AddHtml(x + 0, y - 1, 108, 21, Center(entry.DisplayName), false, false);
AddHtml(x + 0, y + 1, 108, 21, Center(entry.DisplayName), false, false);
AddHtml(x - 1, y + 0, 108, 21, Center(entry.DisplayName), false, false);
AddHtml(x + 1, y + 0, 108, 21, Center(entry.DisplayName), false, false);
AddHtml(x + 0, y + 0, 108, 21, Color(Center(entry.DisplayName), TextColor32), false, false);
}
if (ourPage > 0)
AddButton(480, 12, 0x15E3, 0x15E7, 5, GumpButtonType.Reply, 0);
if ((ourPage + 1) * 12 < ourList.Count)
AddButton(497, 12, 0x15E1, 0x15E5, 6, GumpButtonType.Reply, 0);
}
}
public string Center(string text)
{
return String.Format("<CENTER>{0}</CENTER>", text);
}
public string Color(string text, int color)
{
return String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text);
}
public void AddTypeButton(int x, int y, int buttonID, string text, ModelBodyType type)
{
var isSelection = (m_OurType == type);
AddButton(x, y - 1, isSelection ? 4006 : 4005, 4007, buttonID, GumpButtonType.Reply, 0);
AddHtml(x + 35, y, 200, 20, Color(text, isSelection ? SelectedColor32 : LabelColor32), false, false);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
var index = info.ButtonID - 1;
if (index == -1)
{
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
else if (index >= 0 && index < 4)
{
if (m_Monster == null)
LoadLists();
ModelBodyType type;
ArrayList list;
switch (index)
{
default:
case 0:
type = ModelBodyType.Monsters;
list = m_Monster;
break;
case 1:
type = ModelBodyType.Animals;
list = m_Animal;
break;
case 2:
type = ModelBodyType.Sea;
list = m_Sea;
break;
case 3:
type = ModelBodyType.Human;
list = m_Human;
break;
}
m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, 0, list, type));
}
else if (m_OurList != null)
{
index -= 4;
if (index == 0 && m_OurPage > 0)
{
m_Mobile.SendGump(
new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage - 1, m_OurList, m_OurType));
}
else if (index == 1 && ((m_OurPage + 1) * 12) < m_OurList.Count)
{
m_Mobile.SendGump(
new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage + 1, m_OurList, m_OurType));
}
else
{
index -= 2;
if (index >= 0 && index < m_OurList.Count)
{
try
{
var entry = (InternalEntry)m_OurList[index];
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, entry.Body.ToString());
m_Property.SetValue(m_Object, entry.Body, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
m_Mobile.SendGump(
new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage, m_OurList, m_OurType));
}
}
}
}
private static void LoadLists()
{
m_Monster = new ArrayList();
m_Animal = new ArrayList();
m_Sea = new ArrayList();
m_Human = new ArrayList();
var entries = Docs.LoadBodies();
for (var i = 0; i < entries.Count; ++i)
{
var oldEntry = entries[i];
var bodyID = oldEntry.Body.BodyID;
if (((Body)bodyID).IsEmpty)
continue;
ArrayList list = null;
switch (oldEntry.BodyType)
{
case ModelBodyType.Monsters:
list = m_Monster;
break;
case ModelBodyType.Animals:
list = m_Animal;
break;
case ModelBodyType.Sea:
list = m_Sea;
break;
case ModelBodyType.Human:
list = m_Human;
break;
}
if (list == null)
continue;
var itemID = ShrinkTable.Lookup(bodyID, -1);
if (itemID != -1)
list.Add(new InternalEntry(bodyID, itemID, oldEntry.Name));
}
m_Monster.Sort();
m_Animal.Sort();
m_Sea.Sort();
m_Human.Sort();
}
private class InternalEntry : IComparable
{
private static readonly string[] m_GroupNames =
{
"ogres_", "ettins_", "walking_dead_", "gargoyles_", "orcs_", "flails_", "daemons_", "arachnids_", "dragons_",
"elementals_", "serpents_", "gazers_", "liche_", "spirits_", "harpies_", "headless_", "lizard_race_", "mongbat_",
"rat_race_", "scorpions_", "trolls_", "slimes_", "skeletons_", "ethereals_", "terathan_", "imps_", "cyclops_",
"krakens_", "frogs_", "ophidians_", "centaurs_", "mages_", "fey_race_", "genies_", "paladins_", "shadowlords_",
"succubi_", "lizards_", "rodents_", "birds_", "bovines_", "bruins_", "canines_", "deer_", "equines_", "felines_",
"fowl_", "gorillas_", "kirin_", "llamas_", "ostards_", "porcines_", "ruminants_", "walrus_", "dolphins_",
"sea_horse_", "sea_serpents_", "character_", "h_", "titans_"
};
private readonly int m_Body;
private readonly int m_ItemID;
private readonly string m_Name;
private readonly string m_DisplayName;
public InternalEntry(int body, int itemID, string name)
{
m_Body = body;
m_ItemID = itemID;
m_Name = name;
m_DisplayName = name.ToLower();
for (var i = 0; i < m_GroupNames.Length; ++i)
{
if (m_DisplayName.StartsWith(m_GroupNames[i]))
{
m_DisplayName = m_DisplayName.Substring(m_GroupNames[i].Length);
break;
}
}
m_DisplayName = m_DisplayName.Replace('_', ' ');
}
public int Body { get { return m_Body; } }
public int ItemID { get { return m_ItemID; } }
public string Name { get { return m_Name; } }
public string DisplayName { get { return m_DisplayName; } }
public int CompareTo(object obj)
{
var comp = (InternalEntry)obj;
var v = m_Name.CompareTo(comp.m_Name);
if (v == 0)
m_Body.CompareTo(comp.m_Body);
return v;
}
}
}
}

View File

@@ -0,0 +1,227 @@
#region References
using System;
using System.Collections;
using System.Drawing;
using System.Globalization;
using System.Reflection;
using Server.Commands;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class SetColorGump : Gump
{
private Color m_OldColor;
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + (6 * (EntryHeight + OffsetSize));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
public SetColorGump(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(GumpOffsetX, GumpOffsetY)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
m_OldColor = (Color)prop.GetValue(o, null);
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID);
var name = m_OldColor.IsNamedColor ? m_OldColor.Name : m_OldColor.IsEmpty ? "Empty" : "";
var rgb = "#" + (m_OldColor.ToArgb() & 0x00FFFFFF).ToString("X6");
var val = String.Format("{0} ({1}) ({2},{3},{4})", name, rgb, m_OldColor.R, m_OldColor.G, m_OldColor.B);
AddRect(0, prop.Name, 0, -1);
AddRect(1, val, 0, -1);
AddRect(2, "Name:", 1, 0);
AddRect(3, "RGB:", 2, 1);
AddRect(4, "Hex:", 3, 2);
AddRect(5, "Empty", 4, -1);
}
private void AddRect(int index, string str, int button, int text)
{
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize + (index * (EntryHeight + OffsetSize));
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, str);
if (text != -1)
{
AddTextEntry(x + 40 + TextOffsetX, y, EntryWidth - TextOffsetX - 16, EntryHeight, TextHue, text, "");
}
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
{
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
}
if (button != 0)
{
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, button, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
var toSet = Color.Empty;
var shouldSet = false;
var name = "";
if (info.ButtonID == 1)
{
name = info.GetTextEntry(0).Text;
}
var rgb = "";
if (info.ButtonID == 2)
{
rgb = info.GetTextEntry(1).Text;
}
var hex = "";
if (info.ButtonID == 3)
{
hex = info.GetTextEntry(2).Text;
}
switch (info.ButtonID)
{
case 1: // Name
{
var toapply = name != string.Empty
? name
: m_OldColor.IsNamedColor
? m_OldColor.Name
: m_OldColor.IsEmpty
? "Empty"
: "";
toSet = Color.FromName(toapply);
shouldSet = true;
}
break;
case 2: // RGB
{
var toapply = rgb != string.Empty ? rgb : String.Format("{0},{1},{2}", m_OldColor.R, m_OldColor.G, m_OldColor.B);
var args = toapply.Split(',');
if (args.Length >= 3)
{
byte r, g, b;
if (Byte.TryParse(args[0], out r) && Byte.TryParse(args[1], out g) && Byte.TryParse(args[2], out b))
{
toSet = Color.FromArgb(r, g, b);
shouldSet = true;
}
}
}
break;
case 3: // Hex
{
var toapply = hex != string.Empty ? hex : String.Format("#{0:X6}", m_OldColor.ToArgb() & 0x00FFFFFF);
int val;
if (Int32.TryParse(toapply.TrimStart('#'), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out val))
{
toSet = Color.FromArgb(val);
shouldSet = true;
}
}
break;
case 4: // Empty
{
toSet = Color.Empty;
shouldSet = true;
}
break;
}
if (shouldSet)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
m_Property.SetValue(m_Object, toSet, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
}
}

View File

@@ -0,0 +1,93 @@
#region References
using System;
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class SetCustomEnumGump : SetListOptionGump
{
private static readonly Type typeofIDynamicEnum = typeof(IDynamicEnum);
private readonly string[] _Names;
public SetCustomEnumGump(
PropertyInfo prop,
Mobile mobile,
object o,
Stack stack,
int propspage,
ArrayList list,
string[] names)
: base(prop, mobile, o, stack, propspage, list, names, null)
{
_Names = names;
}
public override void OnResponse(NetState sender, RelayInfo relayInfo)
{
var index = relayInfo.ButtonID - 1;
if (index >= 0 && index < _Names.Length)
{
try
{
var info = m_Property.PropertyType.GetMethod("Parse", new[] {typeof(string)});
var result = "";
if (info != null)
{
result = Properties.SetDirect(
m_Mobile,
m_Object,
m_Object,
m_Property,
m_Property.Name,
info.Invoke(null, new object[] {_Names[index]}),
true);
}
else if (m_Property.PropertyType == typeof(Enum) || m_Property.PropertyType.IsSubclassOf(typeof(Enum)))
{
result = Properties.SetDirect(
m_Mobile,
m_Object,
m_Object,
m_Property,
m_Property.Name,
Enum.Parse(m_Property.PropertyType, _Names[index], false),
true);
}
else if (typeofIDynamicEnum.IsAssignableFrom(m_Property.PropertyType))
{
var ienum = (IDynamicEnum)m_Property.GetValue(m_Object, null);
if (ienum != null)
{
ienum.Value = _Names[index];
}
result = Properties.SetDirect(m_Mobile, m_Object, m_Object, m_Property, m_Property.Name, ienum, true);
}
m_Mobile.SendMessage(result);
if (result == "Property has been set.")
{
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
}
}

View File

@@ -0,0 +1,243 @@
#region References
using System;
using System.Collections;
using System.Globalization;
using System.Reflection;
using Server.Commands;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class SetDateTimeGump : Gump
{
private readonly DateTime m_OldDT;
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + (12 * (EntryHeight + OffsetSize));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
public SetDateTimeGump(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(GumpOffsetX, GumpOffsetY)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
m_OldDT = (DateTime)prop.GetValue(o, null);
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID);
AddRect(0, prop.Name, 0, -1);
AddRect(1, String.Format("{0:u}", m_OldDT), 0, -1);
AddRect(2, "MinValue", 1, -1);
AddRect(3, "From YYYY:MM:DD hh:mm", 2, -1);
AddRect(4, "From YYYY:MM:DD", 3, -1);
AddRect(5, "From hh:mm", 4, -1);
AddRect(6, "Year:", 5, 0);
AddRect(7, "Month:", 6, 1);
AddRect(8, "Day:", 7, 2);
AddRect(9, "Hour:", 8, 3);
AddRect(10, "Minute:", 9, 4);
AddRect(11, "MaxValue", 10, -1);
}
private void AddRect(int index, string str, int button, int text)
{
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize + (index * (EntryHeight + OffsetSize));
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, str);
if (text != -1)
{
AddTextEntry(x + 40 + TextOffsetX, y, EntryWidth - TextOffsetX - 16, EntryHeight, TextHue, text, "");
}
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
{
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
}
if (button != 0)
{
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, button, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
DateTime toSet;
bool shouldSet, shouldSend;
var year = "";
if (info.ButtonID == 2 || info.ButtonID == 3 || info.ButtonID == 5)
{
year = info.GetTextEntry(0).Text;
}
var month = "";
if (info.ButtonID == 2 || info.ButtonID == 3 || info.ButtonID == 6)
{
month = info.GetTextEntry(1).Text;
}
var day = "";
if (info.ButtonID == 2 || info.ButtonID == 3 || info.ButtonID == 7)
{
day = info.GetTextEntry(2).Text;
}
var hour = "";
if (info.ButtonID == 2 || info.ButtonID == 4 || info.ButtonID == 8)
{
hour = info.GetTextEntry(3).Text;
}
var min = "";
if (info.ButtonID == 2 || info.ButtonID == 4 || info.ButtonID == 9)
{
min = info.GetTextEntry(4).Text;
}
switch (info.ButtonID)
{
case 1: // MinValue
{
toSet = DateTime.MinValue;
shouldSet = true;
shouldSend = true;
break;
}
case 2: // From YYYY MM DD H:M
{
var successfulParse = false;
var toapply = String.Format(
"{0}/{1}/{2} {3}:{4}:00",
(year != string.Empty ? year : String.Format("{0:yyyy}", m_OldDT)),
(month != string.Empty ? month : String.Format("{0:MM}", m_OldDT)),
(day != string.Empty ? day : String.Format("{0:dd}", m_OldDT)),
(hour != string.Empty ? hour : String.Format("{0:HH}", m_OldDT)),
(min != string.Empty ? min : String.Format("{0:mm}", m_OldDT)));
successfulParse = DateTime.TryParse(toapply, out toSet);
shouldSet = shouldSend = successfulParse;
break;
}
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
goto case 2;
case 10:
{
toSet = DateTime.MaxValue;
shouldSet = true;
shouldSend = true;
break;
}
default:
{
toSet = DateTime.MinValue;
shouldSet = false;
shouldSend = true;
break;
}
}
if (shouldSet)
{
try
{
CommandLogging.LogChangeProperty(
m_Mobile,
m_Object,
m_Property.Name,
toSet.ToString(CultureInfo.InvariantCulture));
m_Property.SetValue(m_Object, toSet, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
if (shouldSend)
{
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
}
}
}

View File

@@ -0,0 +1,284 @@
#region References
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.HuePickers;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class SetGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + (2 * (EntryHeight + OffsetSize));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public SetGump(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(GumpOffsetX, GumpOffsetY)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
var canNull = !prop.PropertyType.IsValueType;
var canDye = prop.IsDefined(typeof(HueAttribute), false);
var isBody = prop.IsDefined(typeof(BodyAttribute), false);
var val = prop.GetValue(m_Object, null);
string initialText;
if (val == null)
initialText = "";
else if (val is TextDefinition)
initialText = ((TextDefinition)val).GetValue();
else
initialText = val.ToString();
AddPage(0);
AddBackground(
0,
0,
BackWidth,
BackHeight + (canNull ? (EntryHeight + OffsetSize) : 0) + (canDye ? (EntryHeight + OffsetSize) : 0) +
(isBody ? (EntryHeight + OffsetSize) : 0),
BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight + (canNull ? (EntryHeight + OffsetSize) : 0) + (canDye ? (EntryHeight + OffsetSize) : 0) +
(isBody ? (EntryHeight + OffsetSize) : 0),
OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, prop.Name);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddTextEntry(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, 0, initialText);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1, GumpButtonType.Reply, 0);
if (canNull)
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Null");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 2, GumpButtonType.Reply, 0);
}
if (canDye)
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Hue Picker");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 3, GumpButtonType.Reply, 0);
}
if (isBody)
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Body Picker");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 4, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
object toSet;
bool shouldSet, shouldSend = true;
switch (info.ButtonID)
{
case 1:
{
var text = info.GetTextEntry(0);
if (text != null)
{
try
{
toSet = PropertiesGump.GetObjectFromString(m_Property.PropertyType, text.Text);
shouldSet = true;
}
catch
{
toSet = null;
shouldSet = false;
m_Mobile.SendMessage("Bad format");
}
}
else
{
toSet = null;
shouldSet = false;
}
break;
}
case 2: // Null
{
toSet = null;
shouldSet = true;
break;
}
case 3: // Hue Picker
{
toSet = null;
shouldSet = false;
shouldSend = false;
m_Mobile.SendHuePicker(new InternalPicker(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));
break;
}
case 4: // Body Picker
{
toSet = null;
shouldSet = false;
shouldSend = false;
m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));
break;
}
default:
{
toSet = null;
shouldSet = false;
break;
}
}
if (shouldSet)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet == null ? "(null)" : toSet.ToString());
m_Property.SetValue(m_Object, toSet, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
if (shouldSend)
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
private class InternalPicker : HuePicker
{
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public InternalPicker(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(((IHued)o).HuedItemID)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
}
public override void OnResponse(int hue)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, hue.ToString());
m_Property.SetValue(m_Object, hue, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
}
}
}

View File

@@ -0,0 +1,208 @@
#region References
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class SetListOptionGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int EntryCount = 13;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly bool PrevLabel = OldStyle;
private static readonly bool NextLabel = OldStyle;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
protected PropertyInfo m_Property;
protected Mobile m_Mobile;
protected object m_Object;
protected Stack m_Stack;
protected int m_Page;
protected ArrayList m_List;
protected object[] m_Values;
public SetListOptionGump(
PropertyInfo prop,
Mobile mobile,
object o,
Stack stack,
int propspage,
ArrayList list,
string[] names,
object[] values)
: base(GumpOffsetX, GumpOffsetY)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = propspage;
m_List = list;
m_Values = values;
var pages = (names.Length + EntryCount - 1) / EntryCount;
var index = 0;
for (var page = 1; page <= pages; ++page)
{
AddPage(page);
var start = (page - 1) * EntryCount;
var count = names.Length - start;
if (count > EntryCount)
{
count = EntryCount;
}
var totalHeight = OffsetSize + ((count + 2) * (EntryHeight + OffsetSize));
var backHeight = BorderSize + totalHeight + BorderSize;
AddBackground(0, 0, BackWidth, backHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
totalHeight,
OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4) - (OldStyle ? SetWidth + OffsetSize : 0);
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
if (page > 1)
{
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 0, GumpButtonType.Page, page - 1);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(
x - (OldStyle ? OffsetSize : 0),
y,
emptyWidth + (OldStyle ? OffsetSize * 2 : 0),
EntryHeight,
HeaderGumpID);
}
x += emptyWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
if (page < pages)
{
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 0, GumpButtonType.Page, page + 1);
if (NextLabel)
{
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
}
AddRect(0, prop.Name, 0);
for (var i = 0; i < count; ++i)
{
AddRect(i + 1, names[index], ++index);
}
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
var index = info.ButtonID - 1;
if (index >= 0 && index < m_Values.Length)
{
try
{
var toSet = m_Values[index];
var result = Properties.SetDirect(m_Mobile, m_Object, m_Object, m_Property, m_Property.Name, toSet, true);
m_Mobile.SendMessage(result);
if (result == "Property has been set.")
{
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
private void AddRect(int index, string str, int button)
{
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize + ((index + 1) * (EntryHeight + OffsetSize));
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, str);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
{
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
}
if (button != 0)
{
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, button, GumpButtonType.Reply, 0);
}
}
}
}

View File

@@ -0,0 +1,310 @@
#region References
using System;
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.Commands.Generic;
using Server.Network;
using Server.Prompts;
#endregion
namespace Server.Gumps
{
public class SetObjectGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + (5 * (EntryHeight + OffsetSize));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly Type m_Type;
private readonly int m_Page;
private readonly ArrayList m_List;
public SetObjectGump(PropertyInfo prop, Mobile mobile, object o, Stack stack, Type type, int page, ArrayList list)
: base(GumpOffsetX, GumpOffsetY)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Type = type;
m_Page = page;
m_List = list;
var initialText = PropertiesGump.ValueToString(o, prop);
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, prop.Name);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, initialText);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1, GumpButtonType.Reply, 0);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Change by Serial");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 2, GumpButtonType.Reply, 0);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Nullify");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 3, GumpButtonType.Reply, 0);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "View Properties");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 4, GumpButtonType.Reply, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
object toSet;
bool shouldSet, shouldSend = true;
object viewProps = null;
switch (info.ButtonID)
{
case 0: // closed
{
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
toSet = null;
shouldSet = false;
shouldSend = false;
break;
}
case 1: // Change by Target
{
m_Mobile.Target = new SetObjectTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List);
toSet = null;
shouldSet = false;
shouldSend = false;
break;
}
case 2: // Change by Serial
{
toSet = null;
shouldSet = false;
shouldSend = false;
m_Mobile.SendMessage("Enter the serial you wish to find:");
m_Mobile.Prompt = new InternalPrompt(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List);
break;
}
case 3: // Nullify
{
toSet = null;
shouldSet = true;
break;
}
case 4: // View Properties
{
toSet = null;
shouldSet = false;
var obj = m_Property.GetValue(m_Object, null);
if (obj == null)
m_Mobile.SendMessage("The property is null and so you cannot view its properties.");
else if (!BaseCommand.IsAccessible(m_Mobile, obj))
m_Mobile.SendMessage("You may not view their properties.");
else
viewProps = obj;
break;
}
default:
{
toSet = null;
shouldSet = false;
break;
}
}
if (shouldSet)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet == null ? "(null)" : toSet.ToString());
m_Property.SetValue(m_Object, toSet, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
if (shouldSend)
m_Mobile.SendGump(new SetObjectGump(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List));
if (viewProps != null)
m_Mobile.SendGump(new PropertiesGump(m_Mobile, viewProps));
}
private class InternalPrompt : Prompt
{
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly Type m_Type;
private readonly int m_Page;
private readonly ArrayList m_List;
public InternalPrompt(PropertyInfo prop, Mobile mobile, object o, Stack stack, Type type, int page, ArrayList list)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Type = type;
m_Page = page;
m_List = list;
}
public override void OnCancel(Mobile from)
{
m_Mobile.SendGump(new SetObjectGump(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List));
}
public override void OnResponse(Mobile from, string text)
{
object toSet;
bool shouldSet;
try
{
var serial = Utility.ToInt32(text);
toSet = World.FindEntity(serial);
if (toSet == null)
{
shouldSet = false;
m_Mobile.SendMessage("No object with that serial was found.");
}
else if (!m_Type.IsAssignableFrom(toSet.GetType()))
{
toSet = null;
shouldSet = false;
m_Mobile.SendMessage(
"The object with that serial could not be assigned to a property of type : {0}",
m_Type.Name);
}
else
{
shouldSet = true;
}
}
catch
{
toSet = null;
shouldSet = false;
m_Mobile.SendMessage("Bad format");
}
if (shouldSet)
{
try
{
CommandLogging.LogChangeProperty(
m_Mobile,
m_Object,
m_Property.Name,
toSet == null ? "(null)" : toSet.ToString());
m_Property.SetValue(m_Object, toSet, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
m_Mobile.SendGump(new SetObjectGump(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List));
}
}
}
}

View File

@@ -0,0 +1,69 @@
#region References
using System;
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.Items;
using Server.Targeting;
#endregion
namespace Server.Gumps
{
public class SetObjectTarget : Target
{
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly Type m_Type;
private readonly int m_Page;
private readonly ArrayList m_List;
public SetObjectTarget(PropertyInfo prop, Mobile mobile, object o, Stack stack, Type type, int page, ArrayList list)
: base(-1, false, TargetFlags.None)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Type = type;
m_Page = page;
m_List = list;
}
protected override void OnTarget(Mobile from, object targeted)
{
try
{
if (m_Type == typeof(Type))
targeted = targeted.GetType();
else if ((m_Type == typeof(BaseAddon) || m_Type.IsAssignableFrom(typeof(BaseAddon))) && targeted is AddonComponent)
targeted = ((AddonComponent)targeted).Addon;
if (m_Type.IsAssignableFrom(targeted.GetType()))
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, targeted.ToString());
m_Property.SetValue(m_Object, targeted, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
else
{
m_Mobile.SendMessage("That cannot be assigned to a property of type : {0}", m_Type.Name);
}
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
protected override void OnTargetFinish(Mobile from)
{
if (m_Type == typeof(Type))
from.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
else
from.SendGump(new SetObjectGump(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List));
}
}
}

View File

@@ -0,0 +1,233 @@
#region References
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.Network;
using Server.Targeting;
#endregion
namespace Server.Gumps
{
public class SetPoint2DGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int CoordWidth = 105;
private static readonly int EntryWidth = CoordWidth + OffsetSize + CoordWidth;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + (4 * (EntryHeight + OffsetSize));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public SetPoint2DGump(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(GumpOffsetX, GumpOffsetY)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
var p = (Point2D)prop.GetValue(o, null);
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, prop.Name);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Use your location");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1, GumpButtonType.Reply, 0);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Target a location");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 2, GumpButtonType.Reply, 0);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, CoordWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, CoordWidth - TextOffsetX, EntryHeight, TextHue, "X:");
AddTextEntry(x + 16, y, CoordWidth - 16, EntryHeight, TextHue, 0, p.X.ToString());
x += CoordWidth + OffsetSize;
AddImageTiled(x, y, CoordWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, CoordWidth - TextOffsetX, EntryHeight, TextHue, "Y:");
AddTextEntry(x + 16, y, CoordWidth - 16, EntryHeight, TextHue, 1, p.Y.ToString());
x += CoordWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 3, GumpButtonType.Reply, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Point2D toSet;
bool shouldSet, shouldSend;
switch (info.ButtonID)
{
case 1: // Current location
{
toSet = new Point2D(m_Mobile.Location);
shouldSet = true;
shouldSend = true;
break;
}
case 2: // Pick location
{
m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);
toSet = Point2D.Zero;
shouldSet = false;
shouldSend = false;
break;
}
case 3: // Use values
{
var x = info.GetTextEntry(0);
var y = info.GetTextEntry(1);
toSet = new Point2D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text));
shouldSet = true;
shouldSend = true;
break;
}
default:
{
toSet = Point2D.Zero;
shouldSet = false;
shouldSend = true;
break;
}
}
if (shouldSet)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
m_Property.SetValue(m_Object, toSet, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
if (shouldSend)
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
private class InternalTarget : Target
{
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(-1, true, TargetFlags.None)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
}
protected override void OnTarget(Mobile from, object targeted)
{
var p = targeted as IPoint3D;
if (p != null)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, new Point2D(p).ToString());
m_Property.SetValue(m_Object, new Point2D(p), null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
}
}
}

View File

@@ -0,0 +1,242 @@
#region References
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.Network;
using Server.Targeting;
#endregion
namespace Server.Gumps
{
public class SetPoint3DGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int CoordWidth = 70;
private static readonly int EntryWidth = CoordWidth + OffsetSize + CoordWidth + OffsetSize + CoordWidth;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + (4 * (EntryHeight + OffsetSize));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public SetPoint3DGump(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(GumpOffsetX, GumpOffsetY)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
var p = (Point3D)prop.GetValue(o, null);
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, prop.Name);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Use your location");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1, GumpButtonType.Reply, 0);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Target a location");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 2, GumpButtonType.Reply, 0);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled(x, y, CoordWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, CoordWidth - TextOffsetX, EntryHeight, TextHue, "X:");
AddTextEntry(x + 16, y, CoordWidth - 16, EntryHeight, TextHue, 0, p.X.ToString());
x += CoordWidth + OffsetSize;
AddImageTiled(x, y, CoordWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, CoordWidth - TextOffsetX, EntryHeight, TextHue, "Y:");
AddTextEntry(x + 16, y, CoordWidth - 16, EntryHeight, TextHue, 1, p.Y.ToString());
x += CoordWidth + OffsetSize;
AddImageTiled(x, y, CoordWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, CoordWidth - TextOffsetX, EntryHeight, TextHue, "Z:");
AddTextEntry(x + 16, y, CoordWidth - 16, EntryHeight, TextHue, 2, p.Z.ToString());
x += CoordWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 3, GumpButtonType.Reply, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Point3D toSet;
bool shouldSet, shouldSend;
switch (info.ButtonID)
{
case 1: // Current location
{
toSet = m_Mobile.Location;
shouldSet = true;
shouldSend = true;
break;
}
case 2: // Pick location
{
m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);
toSet = Point3D.Zero;
shouldSet = false;
shouldSend = false;
break;
}
case 3: // Use values
{
var x = info.GetTextEntry(0);
var y = info.GetTextEntry(1);
var z = info.GetTextEntry(2);
toSet = new Point3D(
x == null ? 0 : Utility.ToInt32(x.Text),
y == null ? 0 : Utility.ToInt32(y.Text),
z == null ? 0 : Utility.ToInt32(z.Text));
shouldSet = true;
shouldSend = true;
break;
}
default:
{
toSet = Point3D.Zero;
shouldSet = false;
shouldSend = true;
break;
}
}
if (shouldSet)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
m_Property.SetValue(m_Object, toSet, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
if (shouldSend)
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
private class InternalTarget : Target
{
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(-1, true, TargetFlags.None)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
}
protected override void OnTarget(Mobile from, object targeted)
{
var p = targeted as IPoint3D;
if (p != null)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, new Point3D(p).ToString());
m_Property.SetValue(m_Object, new Point3D(p), null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
}
}
}

View File

@@ -0,0 +1,231 @@
#region References
using System;
using System.Collections;
using System.Reflection;
using Server.Commands;
using Server.Network;
#endregion
namespace Server.Gumps
{
public class SetTimeSpanGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + (7 * (EntryHeight + OffsetSize));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly PropertyInfo m_Property;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly Stack m_Stack;
private readonly int m_Page;
private readonly ArrayList m_List;
public SetTimeSpanGump(PropertyInfo prop, Mobile mobile, object o, Stack stack, int page, ArrayList list)
: base(GumpOffsetX, GumpOffsetY)
{
m_Property = prop;
m_Mobile = mobile;
m_Object = o;
m_Stack = stack;
m_Page = page;
m_List = list;
var ts = (TimeSpan)prop.GetValue(o, null);
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID);
AddRect(0, prop.Name, 0, -1);
AddRect(1, ts.ToString(), 0, -1);
AddRect(2, "Zero", 1, -1);
AddRect(3, "From H:M:S", 2, -1);
AddRect(4, "H:", 3, 0);
AddRect(5, "M:", 4, 1);
AddRect(6, "S:", 5, 2);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
TimeSpan toSet;
bool shouldSet, shouldSend;
var h = info.GetTextEntry(0);
var m = info.GetTextEntry(1);
var s = info.GetTextEntry(2);
switch (info.ButtonID)
{
case 1: // Zero
{
toSet = TimeSpan.Zero;
shouldSet = true;
shouldSend = true;
break;
}
case 2: // From H:M:S
{
var successfulParse = false;
if (h != null && m != null && s != null)
{
successfulParse = TimeSpan.TryParse(h.Text + ":" + m.Text + ":" + s.Text, out toSet);
}
else
{
toSet = TimeSpan.Zero;
}
shouldSet = shouldSend = successfulParse;
break;
}
case 3: // From H
{
if (h != null)
{
try
{
toSet = TimeSpan.FromHours(Utility.ToDouble(h.Text));
shouldSet = true;
shouldSend = true;
break;
}
catch
{ }
}
toSet = TimeSpan.Zero;
shouldSet = false;
shouldSend = false;
break;
}
case 4: // From M
{
if (m != null)
{
try
{
toSet = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
shouldSet = true;
shouldSend = true;
break;
}
catch
{ }
}
toSet = TimeSpan.Zero;
shouldSet = false;
shouldSend = false;
break;
}
case 5: // From S
{
if (s != null)
{
try
{
toSet = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
shouldSet = true;
shouldSend = true;
break;
}
catch
{ }
}
toSet = TimeSpan.Zero;
shouldSet = false;
shouldSend = false;
break;
}
default:
{
toSet = TimeSpan.Zero;
shouldSet = false;
shouldSend = true;
break;
}
}
if (shouldSet)
{
try
{
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
m_Property.SetValue(m_Object, toSet, null);
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
}
catch
{
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
}
}
if (shouldSend)
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
}
private void AddRect(int index, string str, int button, int text)
{
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize + (index * (EntryHeight + OffsetSize));
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, str);
if (text != -1)
AddTextEntry(x + 16 + TextOffsetX, y, EntryWidth - TextOffsetX - 16, EntryHeight, TextHue, text, "");
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
if (button != 0)
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, button, GumpButtonType.Reply, 0);
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using Server.Network;
namespace Server.Gumps
{
public class ReLoginClaimGump : Gump
{
public ReLoginClaimGump()
: base(100, 100)
{
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage(0);
AddBackground(19, 14, 404, 105, 9200);
AddImageTiled(26, 23, 389, 63, 2702);
AddButton(28, 91, 4023, 4024, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(32, 30, 375, 46, 1076251, 0xFFFFFF, false, false); // Your pet was unable to join you while you are a ghost.Please re-login once you have ressurected to claim your pets.
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
switch (info.ButtonID)
{
case 0:
break;
}
}
}
}

View File

@@ -0,0 +1,78 @@
using System;
using System.Collections;
using Server.Multis;
using Server.Network;
namespace Server.Gumps
{
public class ReclaimVendorGump : Gump
{
private readonly BaseHouse m_House;
private readonly ArrayList m_Vendors;
public ReclaimVendorGump(BaseHouse house)
: base(50, 50)
{
this.m_House = house;
this.m_Vendors = new ArrayList(house.InternalizedVendors);
this.AddBackground(0, 0, 170, 50 + this.m_Vendors.Count * 20, 0x13BE);
this.AddImageTiled(10, 10, 150, 20, 0xA40);
this.AddHtmlLocalized(10, 10, 150, 20, 1061827, 0x7FFF, false, false); // <CENTER>Reclaim Vendor</CENTER>
this.AddImageTiled(10, 40, 150, this.m_Vendors.Count * 20, 0xA40);
for (int i = 0; i < this.m_Vendors.Count; i++)
{
Mobile m = (Mobile)this.m_Vendors[i];
int y = 40 + i * 20;
this.AddButton(10, y, 0xFA5, 0xFA7, i + 1, GumpButtonType.Reply, 0);
this.AddLabel(45, y, 0x481, m.Name);
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
if (info.ButtonID == 0 || !this.m_House.IsActive || !this.m_House.IsInside(from) || !this.m_House.IsOwner(from) || !from.CheckAlive())
return;
int index = info.ButtonID - 1;
if (index < 0 || index >= this.m_Vendors.Count)
return;
Mobile mob = (Mobile)this.m_Vendors[index];
if (!this.m_House.InternalizedVendors.Contains(mob))
return;
if (mob.Deleted)
{
this.m_House.InternalizedVendors.Remove(mob);
}
else
{
bool vendor, contract;
BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract);
if (vendor)
{
from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location.
}
else if (contract)
{
from.SendLocalizedMessage(1062678); // You cannot place a vendor or barkeep on top of a rental contract!
}
else
{
this.m_House.InternalizedVendors.Remove(mob);
mob.MoveToWorld(from.Location, from.Map);
}
}
}
}
}

View File

@@ -0,0 +1,224 @@
using System;
using System.Collections.Generic;
using Server.Misc;
using Server.Mobiles;
using Server.Network;
using Server.Spells;
namespace Server.Gumps
{
public class ReportMurdererGump : Gump
{
private readonly List<Mobile> m_Killers;
private readonly Mobile m_Victum;
private int m_Idx;
public ReportMurdererGump(Mobile victum, List<Mobile> killers)
: this(victum, killers, 0)
{
}
private ReportMurdererGump(Mobile victum, List<Mobile> killers, int idx)
: base(0, 0)
{
m_Killers = killers;
m_Victum = victum;
m_Idx = idx;
BuildGump();
}
public static void Initialize()
{
EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_PlayerDeath);
}
public static void EventSink_PlayerDeath(PlayerDeathEventArgs e)
{
Mobile m = e.Mobile;
List<Mobile> killers = new List<Mobile>();
List<Mobile> toGive = new List<Mobile>();
foreach (AggressorInfo ai in m.Aggressors)
{
if (ai.Attacker.Player && ai.CanReportMurder && !ai.Reported)
{
if (!Core.SE || !((PlayerMobile)m).RecentlyReported.Contains(ai.Attacker))
{
if (!killers.Contains(ai.Attacker))
{
killers.Add(ai.Attacker);
ai.Reported = true;
ai.CanReportMurder = false;
}
}
}
if (ai.Attacker.Player && (DateTime.UtcNow - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Attacker))
toGive.Add(ai.Attacker);
}
foreach (AggressorInfo ai in m.Aggressed)
{
if (ai.Defender.Player && (DateTime.UtcNow - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Defender))
toGive.Add(ai.Defender);
}
foreach (Mobile g in toGive)
{
int n = Notoriety.Compute(g, m);
int theirKarma = m.Karma, ourKarma = g.Karma;
bool innocent = (n == Notoriety.Innocent);
bool criminal = (n == Notoriety.Criminal || n == Notoriety.Murderer);
int fameAward = m.Fame / 200;
int karmaAward = 0;
if (innocent)
karmaAward = (ourKarma > -2500 ? -850 : -110 - (m.Karma / 100));
else if (criminal)
karmaAward = 50;
Titles.AwardFame(g, fameAward, false);
Titles.AwardKarma(g, karmaAward, true);
Server.Items.XmlQuest.RegisterKill(m, g);
if (killers.Contains(g))
{
EventSink.InvokePlayerMurdered(new PlayerMurderedEventArgs(g, m));
}
}
if (m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild)
return;
if (killers.Count > 0)
new GumpTimer(m, killers).Start();
}
public static void ReportedListExpiry_Callback(object state)
{
object[] states = (object[])state;
PlayerMobile from = (PlayerMobile)states[0];
Mobile killer = (Mobile)states[1];
if (from.RecentlyReported.Contains(killer))
{
from.RecentlyReported.Remove(killer);
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
switch ( info.ButtonID )
{
case 1:
{
Mobile killer = m_Killers[m_Idx];
if (killer != null && !killer.Deleted)
{
killer.Kills++;
killer.ShortTermMurders++;
if (Core.SE)
{
((PlayerMobile)from).RecentlyReported.Add(killer);
Timer.DelayCall(TimeSpan.FromMinutes(10), new TimerStateCallback(ReportedListExpiry_Callback), new object[] { from, killer });
}
if (killer is PlayerMobile)
{
PlayerMobile pk = (PlayerMobile)killer;
pk.ResetKillTime();
pk.SendLocalizedMessage(1049067);//You have been reported for murder!
if (pk.Kills == 5)
{
pk.SendLocalizedMessage(502134);//You are now known as a murderer!
CheckMurderer(pk);
}
else if (SkillHandlers.Stealing.SuspendOnMurder && pk.Kills == 1 && pk.NpcGuild == NpcGuild.ThievesGuild)
{
pk.SendLocalizedMessage(501562); // You have been suspended by the Thieves Guild.
}
}
}
break;
}
case 2:
{
break;
}
}
m_Idx++;
if (m_Idx < m_Killers.Count)
from.SendGump(new ReportMurdererGump(from, m_Killers, m_Idx));
}
public static void CheckMurderer(Mobile m)
{
if (m.AccessLevel == AccessLevel.Player && m.Murderer && SpellHelper.RestrictRedTravel && m.Map != null && m.Map.Rules != MapRules.FeluccaRules)
{
Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
{
if (m.NetState != null)
{
m.MoveToWorld(Map.Felucca.GetSpawnPosition(new Point3D(1458, 844, 5), 5), Map.Felucca);
m.SendLocalizedMessage(1005524, "", 0x22); // Murderers aren't allowed here, you are banished!
}
});
}
}
private void BuildGump()
{
AddBackground(265, 205, 320, 290, 5054);
Closable = false;
Resizable = false;
AddPage(0);
AddImageTiled(225, 175, 50, 45, 0xCE); //Top left corner
AddImageTiled(267, 175, 315, 44, 0xC9); //Top bar
AddImageTiled(582, 175, 43, 45, 0xCF); //Top right corner
AddImageTiled(225, 219, 44, 270, 0xCA); //Left side
AddImageTiled(582, 219, 44, 270, 0xCB); //Right side
AddImageTiled(225, 489, 44, 43, 0xCC); //Lower left corner
AddImageTiled(267, 489, 315, 43, 0xE9); //Lower Bar
AddImageTiled(582, 489, 43, 43, 0xCD); //Lower right corner
AddPage(1);
AddHtml(260, 234, 300, 140, ((Mobile)m_Killers[m_Idx]).Name, false, false); // Player's Name
AddHtmlLocalized(260, 254, 300, 140, 1049066, false, false); // Would you like to report...
AddButton(260, 300, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(300, 300, 300, 50, 1046362, false, false); // Yes
AddButton(360, 300, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(400, 300, 300, 50, 1046363, false, false); // No
}
private class GumpTimer : Timer
{
private readonly Mobile m_Victim;
private readonly List<Mobile> m_Killers;
public GumpTimer(Mobile victim, List<Mobile> killers)
: base(TimeSpan.FromSeconds(4.0))
{
m_Victim = victim;
m_Killers = killers;
}
protected override void OnTick()
{
m_Victim.SendGump(new ReportMurdererGump(m_Victim, m_Killers));
}
}
}
}

View File

@@ -0,0 +1,290 @@
using System;
using System.Collections.Generic;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Services.Virtues;
namespace Server.Gumps
{
public enum ResurrectMessage
{
ChaosShrine = 0,
VirtueShrine = 1,
Healer = 2,
Generic = 3,
SilverSapling = 102034,
GemOfSalvation = 84106,
}
public class ResurrectGump : Gump
{
private readonly Mobile m_Healer;
private readonly int m_Price;
private readonly bool m_FromSacrifice;
private readonly double m_HitsScalar;
private readonly ResurrectMessage m_Msg;
private Action<Mobile> m_Callback;
public ResurrectGump(Mobile owner)
: this(owner, owner, ResurrectMessage.Generic, false)
{
}
public ResurrectGump(Mobile owner, double hitsScalar)
: this(owner, owner, ResurrectMessage.Generic, false, hitsScalar, null)
{
}
public ResurrectGump(Mobile owner, bool fromSacrifice)
: this(owner, owner, ResurrectMessage.Generic, fromSacrifice)
{
}
public ResurrectGump(Mobile owner, Mobile healer)
: this(owner, healer, ResurrectMessage.Generic, false)
{
}
public ResurrectGump(Mobile owner, ResurrectMessage msg)
: this(owner, owner, msg, false)
{
}
public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg)
: this(owner, healer, msg, false)
{
}
public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg, bool fromSacrifice)
: this(owner, healer, msg, fromSacrifice, 0.0, null)
{
}
public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg, bool fromSacrifice, double hitsScalar, Action<Mobile> callback)
: base(100, 0)
{
m_Healer = healer;
m_FromSacrifice = fromSacrifice;
m_HitsScalar = hitsScalar;
m_Msg = msg;
AddPage(0);
AddBackground(0, 0, 400, 350, 2600);
AddHtmlLocalized(0, 20, 400, 35, 1011022, false, false); // <center>Resurrection</center>
AddHtmlLocalized(50, 55, 300, 140, 1011023 + (int)msg, true, true); /* It is possible for you to be resurrected here by this healer. Do you wish to try?<br>
* CONTINUE - You chose to try to come back to life now.<br>
* CANCEL - You prefer to remain a ghost for now.
*/
m_Callback = callback;
AddButton(200, 227, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(235, 230, 110, 35, 1011012, false, false); // CANCEL
AddButton(65, 227, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(100, 230, 110, 35, 1011011, false, false); // CONTINUE
}
public ResurrectGump(Mobile owner, Mobile healer, int price)
: base(150, 50)
{
m_Healer = healer;
m_Price = price;
Closable = false;
AddPage(0);
AddImage(0, 0, 3600);
AddImageTiled(0, 14, 15, 200, 3603);
AddImageTiled(380, 14, 14, 200, 3605);
AddImage(0, 201, 3606);
AddImageTiled(15, 201, 370, 16, 3607);
AddImageTiled(15, 0, 370, 16, 3601);
AddImage(380, 0, 3602);
AddImage(380, 201, 3608);
AddImageTiled(15, 15, 365, 190, 2624);
AddRadio(30, 140, 9727, 9730, true, 1);
AddHtmlLocalized(65, 145, 300, 25, 1060015, 0x7FFF, false, false); // Grudgingly pay the money
AddRadio(30, 175, 9727, 9730, false, 0);
AddHtmlLocalized(65, 178, 300, 25, 1060016, 0x7FFF, false, false); // I'd rather stay dead, you scoundrel!!!
AddHtmlLocalized(30, 20, 360, 35, 1060017, 0x7FFF, false, false); // Wishing to rejoin the living, are you? I can restore your body... for a price of course...
AddHtmlLocalized(30, 105, 345, 40, 1060018, 0x5B2D, false, false); // Do you accept the fee, which will be withdrawn from your bank?
AddImage(65, 72, 5605);
AddImageTiled(80, 90, 200, 1, 9107);
AddImageTiled(95, 92, 200, 1, 9157);
AddLabel(90, 70, 1645, price.ToString());
AddHtmlLocalized(140, 70, 100, 25, 1023823, 0x7FFF, false, false); // gold coins
AddButton(290, 175, 247, 248, 2, GumpButtonType.Reply, 0);
AddImageTiled(15, 14, 365, 1, 9107);
AddImageTiled(380, 14, 1, 190, 9105);
AddImageTiled(15, 205, 365, 1, 9107);
AddImageTiled(15, 14, 1, 190, 9105);
AddImageTiled(0, 0, 395, 1, 9157);
AddImageTiled(394, 0, 1, 217, 9155);
AddImageTiled(0, 216, 395, 1, 9157);
AddImageTiled(0, 0, 1, 217, 9155);
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
from.CloseGump(typeof(ResurrectGump));
if (ResurrectMessage.SilverSapling == m_Msg && 1 == info.ButtonID)
{
PlayerMobile pm = from as PlayerMobile;
if (null != pm && pm.Region.IsPartOf("Abyss"))
{
pm.Location = pm.SSSeedLocation;
pm.Map = pm.SSSeedMap;
if (null != pm.Corpse)
{
pm.Corpse.Location = pm.Location;
pm.Corpse.Map = pm.Map;
}
pm.Resurrect();
}
return;
}
if (info.ButtonID == 1 || info.ButtonID == 2)
{
if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
{
from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
return;
}
if (m_Price > 0)
{
if (info.IsSwitched(1))
{
if (Banker.Withdraw(from, m_Price))
{
from.SendLocalizedMessage(1060398, m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
}
else
{
from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
return;
}
}
else
{
from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
return;
}
}
from.PlaySound(0x214);
from.FixedEffect(0x376A, 10, 16);
from.Resurrect();
if (m_Healer != null && from != m_Healer)
{
VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);
switch( level )
{
case VirtueLevel.Seeker:
from.Hits = AOS.Scale(from.HitsMax, 20);
break;
case VirtueLevel.Follower:
from.Hits = AOS.Scale(from.HitsMax, 40);
break;
case VirtueLevel.Knight:
from.Hits = AOS.Scale(from.HitsMax, 80);
break;
}
}
if (m_FromSacrifice && from is PlayerMobile)
{
((PlayerMobile)from).AvailableResurrects -= 1;
Container pack = from.Backpack;
Container corpse = from.Corpse;
if (pack != null && corpse != null)
{
List<Item> items = new List<Item>(corpse.Items);
for (int i = 0; i < items.Count; ++i)
{
Item item = items[i];
if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
pack.DropItem(item);
}
}
}
if (m_Healer != from && m_Healer is PlayerMobile && from is PlayerMobile)
{
SpiritualityVirtue.OnHeal(m_Healer, 50);
}
if (from.Fame > 0)
{
int amount = from.Fame / 10;
Misc.Titles.AwardFame(from, -amount, true);
}
if (!Core.AOS && from.ShortTermMurders >= 5)
{
double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; // 5 to 15% loss
if (loss < 0.85)
loss = 0.85;
else if (loss > 0.95)
loss = 0.95;
if (from.RawStr * loss > 10)
from.RawStr = (int)(from.RawStr * loss);
if (from.RawInt * loss > 10)
from.RawInt = (int)(from.RawInt * loss);
if (from.RawDex * loss > 10)
from.RawDex = (int)(from.RawDex * loss);
for (int s = 0; s < from.Skills.Length; s++)
{
if (from.Skills[s].Base * loss > 35)
from.Skills[s].Base *= loss;
}
}
if (from.Alive && m_HitsScalar > 0)
from.Hits = (int)(from.HitsMax * m_HitsScalar);
if (m_Callback != null)
m_Callback(from);
}
}
}
}

View File

@@ -0,0 +1,513 @@
using Server;
using System;
using System.Collections.Generic;
using Server.Items;
using Server.Network;
using Server.Spells.Fourth;
using Server.Spells.Seventh;
using Server.Spells.Chivalry;
using Server.Prompts;
using System.Linq;
namespace Server.Gumps
{
public class RunebookGump : Gump
{
public void PrecompileStringTable()
{
Intern("Charges", true); // 0
Intern("Max Charges", true); // 1
// Next 16 entries are Location Values
for (int i = 0; i < 16; ++i)
{
string desc;
if (i < Book.Entries.Count)
desc = GetName(((RunebookEntry)Book.Entries[i]).Description);
else
desc = "Empty";
Intern(desc, false);
}
Intern(Book.CurCharges.ToString(), false);
Intern(Book.MaxCharges.ToString(), false);
Intern("Drop Rune", true);
Intern("Rename Book", true);
Intern("Set Default", true);
for (int i = 0; i < 16; ++i)
{
if (i < Book.Entries.Count)
{
RunebookEntry e = (RunebookEntry)Book.Entries[i];
Intern(GetLocation(e), false);
}
else
{
Intern("Nowhere", false);
}
}
}
public Runebook Book { get; }
public static int GetMapHue(Map map)
{
if (map == Map.Trammel)
return 10;
else if (map == Map.Felucca)
return 81;
else if (map == Map.Ilshenar)
return 1102;
else if (map == Map.Malas)
return 1102;
else if (map == Map.Tokuno)
return 1154;
else if (map == Map.TerMur)
return 1645;
return 0;
}
public static string GetName(string name)
{
if (name == null || (name = name.Trim()).Length <= 0)
return "(indescript)";
return name;
}
public static string GetLocation(RunebookEntry e)
{
string loc;
// Location labels
int xLong = 0, yLat = 0;
int xMins = 0, yMins = 0;
bool xEast = false, ySouth = false;
if (e.Type == RecallRuneType.Ship)
{
loc = string.Format("Aboard {0}", e.Description.Substring(e.Description.IndexOf(",") + 2));
}
else if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
{
loc = string.Format("{0}o {1}'{2}, {3}o {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
}
else
{
loc = "Nowhere";
}
return loc;
}
private void AddBackground()
{
AddPage(0);
// Background image
AddImage(100, 10, 2200);
// Two seperators
for (int i = 0; i < 2; ++i)
{
int xOffset = 125 + (i * 165);
AddImage(xOffset, 50, 57);
xOffset += 20;
for (int j = 0; j < 6; ++j, xOffset += 15)
AddImage(xOffset, 50, 58);
AddImage(xOffset - 5, 50, 59);
}
// First four page buttons
for (int i = 0, xOffset = 130, gumpID = 2225; i < 4; ++i, xOffset += 35, ++gumpID)
AddButton(xOffset, 187, gumpID, gumpID, 0, GumpButtonType.Page, 2 + i);
// Next four page buttons
for (int i = 0, xOffset = 300, gumpID = 2229; i < 4; ++i, xOffset += 35, ++gumpID)
AddButton(xOffset, 187, gumpID, gumpID, 0, GumpButtonType.Page, 6 + i);
// Charges
AddHtmlIntern(140, 40, 80, 18, 0, false, false); // Charges:
AddHtmlIntern(300, 40, 100, 18, 1, false, false); // Max Charges:
AddHtmlIntern(220, 40, 30, 18, 18, false, false); // Charges
AddHtmlIntern(400, 40, 30, 18, 19, false, false); // Max charges
}
private void AddIndex()
{
// Index
AddPage(1);
// Rename button
AddButton(125, 15, 2472, 2473, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(158, 22, 100, 18, 1011299, false, false); // Rename book
// List of entries
List<RunebookEntry> entries = Book.Entries;
for (int i = 0; i < 16; ++i)
{
int hue;
if (i < entries.Count)
{
hue = GetMapHue(((RunebookEntry)entries[i]).Map);
}
else
{
hue = 0;
}
// Use charge button
AddButton(130 + ((i / 8) * 160), 65 + ((i % 8) * 15), 2103, 2104, 10 + i, GumpButtonType.Reply, 0);
// Description label
AddLabelCroppedIntern(145 + ((i / 8) * 160), 60 + ((i % 8) * 15), 115, 17, hue, i + 2);
}
if (entries.Count != 0)
{
// Turn page button
AddButton(393, 14, 2206, 2206, 0, GumpButtonType.Page, 2);
}
}
private void AddDetails(int index, int half)
{
List<RunebookEntry> entries = Book.Entries;
if (entries.Count != 0)
{
// Use charge button
AddButton(130 + (half * 160), 65, 2103, 2104, 10 + index, GumpButtonType.Reply, 0);
if (index < 16)
{
if (Book.Entries.ElementAtOrDefault(index) != null)
{
RunebookEntry e = (RunebookEntry)Book.Entries[index];
// Description label
AddLabelCroppedIntern(145 + (half * 160), 60, 115, 17, GetMapHue(e.Map), index + 2);
// Location label
AddHtmlIntern(135 + (half * 160), 80, 130, 38, index + 23, false, false);
// Drop rune button
AddButton(135 + (half * 160), 115, 2437, 2438, 200 + index, GumpButtonType.Reply, 0);
AddHtmlLocalized(150 + (half * 160), 115, 100, 18, 1011298, false, false); // Drop rune
// Set as default button
int defButtonID = e != Book.Default ? 2361 : 2360;
AddButton(160 + (half * 140), 20, defButtonID, defButtonID, 300 + index, GumpButtonType.Reply, 0);
AddHtmlLocalized(175 + (half * 140), 15, 100, 18, 1011300, false, false); // Set default
}
else
{
AddLabelIntern(145 + (half * 160), 60, 0, index + 2);
}
if (Core.AOS)
{
AddButton(135 + (half * 160), 140, 2103, 2104, 50 + index, GumpButtonType.Reply, 0);
AddHtmlLocalized(150 + (half * 160), 136, 110, 20, 1062722, false, false); // Recall
AddButton(135 + (half * 160), 158, 2103, 2104, 100 + index, GumpButtonType.Reply, 0);
AddHtmlLocalized(150 + (half * 160), 154, 110, 20, 1062723, false, false); // Gate Travel
AddButton(135 + (half * 160), 176, 2103, 2104, 75 + index, GumpButtonType.Reply, 0);
AddHtmlLocalized(150 + (half * 160), 172, 110, 20, 1062724, false, false); // Sacred Journey
}
else
{
AddButton(135 + (half * 160), 140, 2103, 2104, 50 + index, GumpButtonType.Reply, 0);
AddHtmlLocalized(150 + (half * 160), 136, 110, 20, 1062722, false, false); // Recall
AddButton(135 + (half * 160), 158, 2103, 2104, 100 + index, GumpButtonType.Reply, 0);
AddHtmlLocalized(150 + (half * 160), 154, 110, 20, 1062723, false, false); // Gate Travel
}
}
}
}
public RunebookGump(Mobile from, Runebook book)
: base(150, 200)
{
TypeID = 0x59;
Book = book;
PrecompileStringTable();
AddBackground();
AddIndex();
if (Book.Entries.Count != 0)
{
for (int page = 0; page < 8; ++page)
{
AddPage(2 + page);
AddButton(125, 14, 2205, 2205, 0, GumpButtonType.Page, 1 + page);
if (page < 7)
AddButton(393, 14, 2206, 2206, 0, GumpButtonType.Page, 3 + page);
for (int half = 0; half < 2; ++half)
AddDetails((page * 2) + half, half);
}
}
}
public static bool HasSpell(Mobile from, int spellID)
{
Spellbook book = Spellbook.Find(from, spellID);
return (book != null && book.HasSpell(spellID));
}
private class InternalPrompt : Prompt
{
public override int MessageCliloc { get { return 502414; } } // Please enter a title for the runebook:
private readonly Runebook m_Book;
public InternalPrompt(Runebook book)
: base(book)
{
m_Book = book;
}
public override void OnResponse(Mobile from, string text)
{
if (m_Book.Deleted || !from.InRange(m_Book.GetWorldLocation(), (Core.ML ? 3 : 1)))
return;
if (m_Book.CheckAccess(from))
{
m_Book.Description = Utility.FixHtml(text.Trim());
from.CloseGump(typeof(RunebookGump));
from.SendGump(new RunebookGump(from, m_Book));
from.SendLocalizedMessage(1041531); // You have changed the title of the rune book.
}
else
{
m_Book.Openers.Remove(from);
from.SendLocalizedMessage(502416); // That cannot be done while the book is locked down.
}
}
public override void OnCancel(Mobile from)
{
from.SendLocalizedMessage(502415); // Request cancelled.
if (!m_Book.Deleted && from.InRange(m_Book.GetWorldLocation(), (Core.ML ? 3 : 1)))
{
from.CloseGump(typeof(RunebookGump));
from.SendGump(new RunebookGump(from, m_Book));
}
}
}
public void SendLocationMessage(RunebookEntry e, Mobile from)
{
if (e.Type == RecallRuneType.Ship)
return;
int xLong = 0, yLat = 0;
int xMins = 0, yMins = 0;
bool xEast = false, ySouth = false;
if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
{
from.SendAsciiMessage(string.Format("{0}o {1}'{2}, {3}o {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W"));
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
if (Book.Deleted || !from.InRange(Book.GetWorldLocation(), (Core.ML ? 3 : 1)) || !Multis.DesignContext.Check(from))
{
Book.Openers.Remove(from);
return;
}
int buttonID = info.ButtonID;
if (buttonID == 0) // Close
{
Book.Openers.Remove(from);
}
else if (buttonID == 1) // Rename book
{
if (Book.CheckAccess(from) && Book.Movable != false)
{
from.Prompt = new InternalPrompt(Book);
}
else
{
Book.Openers.Remove(from);
from.SendLocalizedMessage(502413); // That cannot be done while the book is locked down.
}
}
else
{
int index = buttonID % 25;
int type = buttonID / 25;
if (type == 0 || type == 1)
index = buttonID - 10;
if (Book.Entries.ElementAtOrDefault(index) != null)
{
if (index >= 0 && index < Book.Entries.Count)
{
RunebookEntry e = (RunebookEntry)Book.Entries[index];
switch (type)
{
case 0:
case 1: // Use charges
{
if (Book.CurCharges <= 0)
{
from.CloseGump(typeof(RunebookGump));
from.SendGump(new RunebookGump(from, Book));
from.SendLocalizedMessage(502412); // There are no charges left on that item.
}
else
{
SendLocationMessage(e, from);
Book.OnTravel();
new RecallSpell(from, Book, e, Book).Cast();
Book.Openers.Remove(from);
}
break;
}
case 8: // Drop rune
{
if (Book.CheckAccess(from) && Book.Movable != false)
{
Book.DropRune(from, e, index);
from.CloseGump(typeof(RunebookGump));
from.SendGump(new RunebookGump(from, Book));
}
else
{
Book.Openers.Remove(from);
from.SendLocalizedMessage(502413); // That cannot be done while the book is locked down.
}
break;
}
case 12: // Set default
{
if (Book.CheckAccess(from))
{
Book.Default = e;
from.CloseGump(typeof(RunebookGump));
from.SendGump(new RunebookGump(from, Book));
from.SendLocalizedMessage(502417, "", 0x35); // New default location set.
Book.Openers.Remove(from);
}
else
{
from.SendLocalizedMessage(502413); // That cannot be done while the book is locked down.
}
break;
}
case 2: // Recall
{
if (HasSpell(from, 31))
{
SendLocationMessage(e, from);
Book.OnTravel();
new RecallSpell(from, null, e, null).Cast();
}
else
{
from.SendLocalizedMessage(500015); // You do not have that spell!
}
Book.Openers.Remove(from);
break;
}
case 4: // Gate
{
if (HasSpell(from, 51))
{
SendLocationMessage(e, from);
Book.OnTravel();
new GateTravelSpell(from, null, e).Cast();
}
else
{
from.SendLocalizedMessage(500015); // You do not have that spell!
}
Book.Openers.Remove(from);
break;
}
case 3: // Sacred Journey
{
if (HasSpell(from, 209))
{
SendLocationMessage(e, from);
Book.OnTravel();
new SacredJourneySpell(from, null, e, null).Cast();
}
else
{
from.SendLocalizedMessage(500015); // You do not have that spell!
}
Book.Openers.Remove(from);
break;
}
default:
break;
}
}
else
{
Book.Openers.Remove(from);
}
}
else
{
from.SendLocalizedMessage(502423); // This place in the book is empty.
Book.Openers.Remove(from);
}
}
}
}
}

View File

@@ -0,0 +1,105 @@
using System;
using Server.Mobiles;
using Server.Guilds;
using Server.Multis;
using Server.Network;
namespace Server.Gumps
{
public interface ISecurable
{
SecureLevel Level { get; set; }
}
public class SetSecureLevelGump : Gump
{
private ISecurable m_Info;
public SetSecureLevelGump(Mobile from, ISecurable info, BaseHouse house)
: base(50, 50)
{
m_Info = info;
Mobile owner = house.Owner;
AddPage(0);
int offset = (Guild.NewGuildSystem) ? 20 : 0;
AddBackground(0, 0, 220, 160 + offset, 5054);
AddImageTiled(10, 10, 200, 20, 5124);
AddImageTiled(10, 40, 200, 20, 5124);
AddImageTiled(10, 70, 200, 80 + offset, 5124);
AddAlphaRegion(10, 10, 200, 140 + offset);
AddHtmlLocalized(10, 10, 200, 20, 1061276, 32767, false, false); // <CENTER>SET ACCESS</CENTER>
AddHtmlLocalized(10, 40, 100, 20, 1041474, 32767, false, false); // Owner:
AddLabel(110, 40, 1152, owner == null ? "" : owner.Name);
AddButton(10, 70, GetFirstID(SecureLevel.Owner), 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 70, 150, 20, 1061277, GetColor(SecureLevel.Owner), false, false); // Owner Only
AddButton(10, 90, GetFirstID(SecureLevel.CoOwners), 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 90, 150, 20, 1061278, GetColor(SecureLevel.CoOwners), false, false); // Co-Owners
AddButton(10, 110, GetFirstID(SecureLevel.Friends), 4007, 3, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 110, 150, 20, 1061279, GetColor(SecureLevel.Friends), false, false); // Friends
if (Guild.NewGuildSystem && owner == from && from.Guild != null && ((PlayerMobile)from).GuildRank.Rank >= 1)
{
AddButton(10, 130, GetFirstID(SecureLevel.Guild), 4007, 5, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 130, 150, 20, 1063455, GetColor(SecureLevel.Guild), false, false); // Guild Members
}
AddButton(10, 130 + offset, GetFirstID(SecureLevel.Anyone), 4007, 4, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 130 + offset, 150, 20, 1061626, GetColor(SecureLevel.Anyone), false, false); // Anyone
}
public int GetColor(SecureLevel level)
{
return (m_Info.Level == level) ? 0x7F18 : 0x7FFF;
}
public int GetFirstID(SecureLevel level)
{
return (m_Info.Level == level) ? 4006 : 4005;
}
public override void OnResponse(NetState state, RelayInfo info)
{
SecureLevel level = m_Info.Level;
switch ( info.ButtonID )
{
case 1:
level = SecureLevel.Owner;
break;
case 2:
level = SecureLevel.CoOwners;
break;
case 3:
level = SecureLevel.Friends;
break;
case 4:
level = SecureLevel.Anyone;
break;
case 5:
level = SecureLevel.Guild;
break;
}
if (m_Info.Level == level)
{
state.Mobile.SendLocalizedMessage(1061281); // Access level unchanged.
}
else
{
m_Info.Level = level;
state.Mobile.SendLocalizedMessage(1061280); // New access level set.
}
}
}
}

555
Scripts/Gumps/SkillsGump.cs Normal file
View File

@@ -0,0 +1,555 @@
using System;
using System.Collections;
using Server.Commands;
using Server.Network;
namespace Server.Gumps
{
public class EditSkillGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 160;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + (2 * (EntryHeight + OffsetSize));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_From;
private readonly Mobile m_Target;
private readonly Skill m_Skill;
private readonly SkillsGumpGroup m_Selected;
public EditSkillGump(Mobile from, Mobile target, Skill skill, SkillsGumpGroup selected)
: base(GumpOffsetX, GumpOffsetY)
{
this.m_From = from;
this.m_Target = target;
this.m_Skill = skill;
this.m_Selected = selected;
string initialText = this.m_Skill.Base.ToString("F1");
this.AddPage(0);
this.AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
this.AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), TotalHeight, OffsetGumpID);
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
this.AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
this.AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, String.Format("{0} [{1}]", skill.Name, skill.Cap));
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
this.AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
this.AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
this.AddTextEntry(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, 0, initialText);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
this.AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
this.AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1, GumpButtonType.Reply, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (info.ButtonID == 1)
{
try
{
if (this.m_From.AccessLevel >= AccessLevel.GameMaster)
{
TextRelay text = info.GetTextEntry(0);
if (text != null)
{
this.m_Skill.Base = Convert.ToDouble(text.Text);
CommandLogging.LogChangeProperty(this.m_From, this.m_Target, String.Format("{0}.Base", this.m_Skill), this.m_Skill.Base.ToString());
}
}
else
{
this.m_From.SendMessage("You may not change that.");
}
this.m_From.SendGump(new SkillsGump(this.m_From, this.m_Target, this.m_Selected));
}
catch
{
this.m_From.SendMessage("Bad format. ###.# expected.");
this.m_From.SendGump(new EditSkillGump(this.m_From, this.m_Target, this.m_Skill, this.m_Selected));
}
}
else
{
this.m_From.SendGump(new SkillsGump(this.m_From, this.m_Target, this.m_Selected));
}
}
}
public class SkillsGump : Gump
{
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
public static bool OldStyle = PropsConfig.OldStyle;
/*
private static bool PrevLabel = OldStyle, NextLabel = OldStyle;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
* */
private static readonly int NameWidth = 107;
private static readonly int ValueWidth = 128;
private static readonly int EntryCount = 15;
private static readonly int TypeWidth = NameWidth + OffsetSize + ValueWidth;
private static readonly int TotalWidth = OffsetSize + NameWidth + OffsetSize + ValueWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 1));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private static readonly int IndentWidth = 12;
private readonly Mobile m_From;
private readonly Mobile m_Target;
private readonly SkillsGumpGroup[] m_Groups;
private readonly SkillsGumpGroup m_Selected;
public SkillsGump(Mobile from, Mobile target)
: this(from, target, null)
{
}
public SkillsGump(Mobile from, Mobile target, SkillsGumpGroup selected)
: base(GumpOffsetX, GumpOffsetY)
{
this.m_From = from;
this.m_Target = target;
this.m_Groups = SkillsGumpGroup.Groups;
this.m_Selected = selected;
int count = this.m_Groups.Length;
if (selected != null)
count += selected.Skills.Length;
int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 1));
this.AddPage(0);
this.AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
this.AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight, OffsetGumpID);
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4) - (OldStyle ? SetWidth + OffsetSize : 0);
if (OldStyle)
this.AddImageTiled(x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID);
else
this.AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
x += PrevWidth + OffsetSize;
if (!OldStyle)
this.AddImageTiled(x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, HeaderGumpID);
x += emptyWidth + OffsetSize;
if (!OldStyle)
this.AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
for (int i = 0; i < this.m_Groups.Length; ++i)
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
SkillsGumpGroup group = this.m_Groups[i];
this.AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
if (group == selected)
this.AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E2, 0x15E6, this.GetButtonID(0, i), GumpButtonType.Reply, 0);
else
this.AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E1, 0x15E5, this.GetButtonID(0, i), GumpButtonType.Reply, 0);
x += PrevWidth + OffsetSize;
x -= (OldStyle ? OffsetSize : 0);
this.AddImageTiled(x, y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID);
this.AddLabel(x + TextOffsetX, y, TextHue, group.Name);
x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0);
x += OffsetSize;
if (SetGumpID != 0)
this.AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
if (group == selected)
{
int indentMaskX = BorderSize;
int indentMaskY = y + EntryHeight + OffsetSize;
for (int j = 0; j < group.Skills.Length; ++j)
{
Skill sk = target.Skills[group.Skills[j]];
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
x += OffsetSize;
x += IndentWidth;
this.AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
this.AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E1, 0x15E5, this.GetButtonID(1, j), GumpButtonType.Reply, 0);
x += PrevWidth + OffsetSize;
x -= (OldStyle ? OffsetSize : 0);
this.AddImageTiled(x, y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0) - OffsetSize - IndentWidth, EntryHeight, EntryGumpID);
this.AddLabel(x + TextOffsetX, y, TextHue, sk == null ? "(null)" : sk.Name);
x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0) - OffsetSize - IndentWidth;
x += OffsetSize;
if (SetGumpID != 0)
this.AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
if (sk != null)
{
int buttonID1, buttonID2;
int xOffset, yOffset;
switch ( sk.Lock )
{
default:
case SkillLock.Up:
buttonID1 = 0x983;
buttonID2 = 0x983;
xOffset = 6;
yOffset = 4;
break;
case SkillLock.Down:
buttonID1 = 0x985;
buttonID2 = 0x985;
xOffset = 6;
yOffset = 4;
break;
case SkillLock.Locked:
buttonID1 = 0x82C;
buttonID2 = 0x82C;
xOffset = 5;
yOffset = 2;
break;
}
this.AddButton(x + xOffset, y + yOffset, buttonID1, buttonID2, this.GetButtonID(2, j), GumpButtonType.Reply, 0);
y += 1;
x -= OffsetSize;
x -= 1;
x -= 50;
this.AddImageTiled(x, y, 50, EntryHeight - 2, OffsetGumpID);
x += 1;
y += 1;
this.AddImageTiled(x, y, 48, EntryHeight - 4, EntryGumpID);
this.AddLabelCropped(x + TextOffsetX, y - 1, 48 - TextOffsetX, EntryHeight - 3, TextHue, sk.Base.ToString("F1"));
y -= 2;
}
}
this.AddImageTiled(indentMaskX, indentMaskY, IndentWidth + OffsetSize, (group.Skills.Length * (EntryHeight + OffsetSize)) - (i < (this.m_Groups.Length - 1) ? OffsetSize : 0), BackGumpID + 4);
}
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
int buttonID = info.ButtonID - 1;
int index = buttonID / 3;
int type = buttonID % 3;
switch ( type )
{
case 0:
{
if (index >= 0 && index < this.m_Groups.Length)
{
SkillsGumpGroup newSelection = this.m_Groups[index];
if (this.m_Selected != newSelection)
this.m_From.SendGump(new SkillsGump(this.m_From, this.m_Target, newSelection));
else
this.m_From.SendGump(new SkillsGump(this.m_From, this.m_Target, null));
}
break;
}
case 1:
{
if (this.m_Selected != null && index >= 0 && index < this.m_Selected.Skills.Length)
{
Skill sk = this.m_Target.Skills[this.m_Selected.Skills[index]];
if (sk != null)
{
if (this.m_From.AccessLevel >= AccessLevel.GameMaster)
{
this.m_From.SendGump(new EditSkillGump(this.m_From, this.m_Target, sk, this.m_Selected));
}
else
{
this.m_From.SendMessage("You may not change that.");
this.m_From.SendGump(new SkillsGump(this.m_From, this.m_Target, this.m_Selected));
}
}
else
{
this.m_From.SendGump(new SkillsGump(this.m_From, this.m_Target, this.m_Selected));
}
}
break;
}
case 2:
{
if (this.m_Selected != null && index >= 0 && index < this.m_Selected.Skills.Length)
{
Skill sk = this.m_Target.Skills[this.m_Selected.Skills[index]];
if (sk != null)
{
if (this.m_From.AccessLevel >= AccessLevel.GameMaster)
{
switch ( sk.Lock )
{
case SkillLock.Up:
sk.SetLockNoRelay(SkillLock.Down);
sk.Update();
break;
case SkillLock.Down:
sk.SetLockNoRelay(SkillLock.Locked);
sk.Update();
break;
case SkillLock.Locked:
sk.SetLockNoRelay(SkillLock.Up);
sk.Update();
break;
}
}
else
{
this.m_From.SendMessage("You may not change that.");
}
this.m_From.SendGump(new SkillsGump(this.m_From, this.m_Target, this.m_Selected));
}
}
break;
}
}
}
public int GetButtonID(int type, int index)
{
return 1 + (index * 3) + type;
}
}
public class SkillsGumpGroup
{
private static readonly SkillsGumpGroup[] m_Groups = new SkillsGumpGroup[]
{
new SkillsGumpGroup("Crafting", new SkillName[]
{
SkillName.Alchemy,
SkillName.Blacksmith,
SkillName.Cartography,
SkillName.Carpentry,
SkillName.Cooking,
SkillName.Fletching,
SkillName.Inscribe,
SkillName.Tailoring,
SkillName.Tinkering,
SkillName.Imbuing
}),
new SkillsGumpGroup("Bardic", new SkillName[]
{
SkillName.Discordance,
SkillName.Musicianship,
SkillName.Peacemaking,
SkillName.Provocation
}),
new SkillsGumpGroup("Magical", new SkillName[]
{
SkillName.Chivalry,
SkillName.EvalInt,
SkillName.Magery,
SkillName.MagicResist,
SkillName.Meditation,
SkillName.Necromancy,
SkillName.SpiritSpeak,
SkillName.Ninjitsu,
SkillName.Bushido,
SkillName.Spellweaving,
SkillName.Mysticism
}),
new SkillsGumpGroup("Miscellaneous", new SkillName[]
{
SkillName.Camping,
SkillName.Fishing,
SkillName.Focus,
SkillName.Healing,
SkillName.Herding,
SkillName.Lockpicking,
SkillName.Lumberjacking,
SkillName.Mining,
SkillName.Snooping,
SkillName.Veterinary
}),
new SkillsGumpGroup("Combat Ratings", new SkillName[]
{
SkillName.Archery,
SkillName.Fencing,
SkillName.Macing,
SkillName.Parry,
SkillName.Swords,
SkillName.Tactics,
SkillName.Wrestling,
SkillName.Throwing
}),
new SkillsGumpGroup("Actions", new SkillName[]
{
SkillName.AnimalTaming,
SkillName.Begging,
SkillName.DetectHidden,
SkillName.Hiding,
SkillName.RemoveTrap,
SkillName.Poisoning,
SkillName.Stealing,
SkillName.Stealth,
SkillName.Tracking
}),
new SkillsGumpGroup("Lore & Knowledge", new SkillName[]
{
SkillName.Anatomy,
SkillName.AnimalLore,
SkillName.ArmsLore,
SkillName.Forensics,
SkillName.ItemID,
SkillName.TasteID
})
};
private readonly string m_Name;
private readonly SkillName[] m_Skills;
public SkillsGumpGroup(string name, SkillName[] skills)
{
this.m_Name = name;
this.m_Skills = skills;
Array.Sort(this.m_Skills, new SkillNameComparer());
}
public static SkillsGumpGroup[] Groups
{
get
{
return m_Groups;
}
}
public string Name
{
get
{
return this.m_Name;
}
}
public SkillName[] Skills
{
get
{
return this.m_Skills;
}
}
private class SkillNameComparer : IComparer
{
public SkillNameComparer()
{
}
public int Compare(object x, object y)
{
SkillName a = (SkillName)x;
SkillName b = (SkillName)y;
string aName = SkillInfo.Table[(int)a].Name;
string bName = SkillInfo.Table[(int)b].Name;
return aName.CompareTo(bName);
}
}
}
}

View File

@@ -0,0 +1,303 @@
using System;
using Server.Commands;
using Server.Network;
namespace Server.Gumps
{
public class StormLevelEntry
{
private readonly int m_Name;
private readonly Point3D[] m_Locations;
public StormLevelEntry(int name, Point3D[] locations)
{
this.m_Name = name;
this.m_Locations = locations;
}
public int Name { get { return this.m_Name; } }
public Point3D[] Locations { get { return this.m_Locations; } }
}
public class StormLevelGump : Gump
{
public static void Initialize()
{
CommandSystem.Register("StormLevelGump", AccessLevel.Administrator, new CommandEventHandler(StormLevel_OnCommand));
}
[Usage("StormLevelGump")]
public static void StormLevel_OnCommand(CommandEventArgs e)
{
Mobile from = e.Mobile;
if (!from.HasGump(typeof(StormLevelGump)))
{
from.SendGump(new StormLevelGump(from));
}
}
private static readonly StormLevelEntry[] m_Entries = new StormLevelEntry[]
{
// Britain
new StormLevelEntry(1011028, new Point3D[]
{
new Point3D(1522, 1757, 28),
new Point3D(1519, 1619, 10),
new Point3D(1457, 1538, 30),
new Point3D(1607, 1568, 20),
new Point3D(1643, 1680, 18)
}),
// Trinsic
new StormLevelEntry(1011029, new Point3D[]
{
new Point3D(2005, 2754, 30),
new Point3D(1993, 2827, 0),
new Point3D(2044, 2883, 0),
new Point3D(1876, 2859, 20),
new Point3D(1865, 2687, 0)
}),
// Vesper
new StormLevelEntry(1011030, new Point3D[]
{
new Point3D(2973, 891, 0),
new Point3D(3003, 776, 0),
new Point3D(2910, 727, 0),
new Point3D(2865, 804, 0),
new Point3D(2832, 927, 0)
}),
// Minoc
new StormLevelEntry(1011031, new Point3D[]
{
new Point3D(2498, 392, 0),
new Point3D(2433, 541, 0),
new Point3D(2445, 501, 15),
new Point3D(2501, 469, 15),
new Point3D(2444, 420, 15)
}),
// Jhelom ==
new StormLevelEntry(1011343, new Point3D[]
{
new Point3D(490, 1166, 0),
new Point3D(652, 1098, 0),
new Point3D(650, 1013, 0),
new Point3D(536, 979, 0),
new Point3D(464, 970, 0)
}),
// Moonglow
new StormLevelEntry(1011344, new Point3D[]
{
new Point3D(4444, 1061, 0),
new Point3D(4443, 1066, 0),
new Point3D(4443, 1050, 0),
new Point3D(4444, 1071, 0),
new Point3D(4444, 1052, 0)
}),
// Yew
new StormLevelEntry(1011032, new Point3D[]
{
new Point3D(490, 1166, 0),
new Point3D(652, 1098, 0),
new Point3D(650, 1013, 0),
new Point3D(536, 979, 0),
new Point3D(464, 970, 0)
}),
// Magincia
new StormLevelEntry(1016172, new Point3D[]
{
new Point3D(3669, 2099, 20),
new Point3D(3689, 2235, 20),
new Point3D(3680, 2067, 5),
new Point3D(3772, 2116, 20),
new Point3D(3660, 2122, 20),
}),
// Cove
new StormLevelEntry(1011033, new Point3D[]
{
new Point3D(2230, 1159, 0),
new Point3D(2218, 1203, 0),
new Point3D(2247, 1194, 0),
new Point3D(2236, 1224, 0),
new Point3D(2273, 1231, 0)
}),
// Papua
new StormLevelEntry(1011057, new Point3D[]
{
new Point3D(5720, 3109, -1),
new Point3D(5677, 3176, -3),
new Point3D(5678, 3227, 0),
new Point3D(5769, 3206, -2),
new Point3D(5777, 3270, -1)
}),
// Delucia
new StormLevelEntry(1011058, new Point3D[]
{
new Point3D(5216, 4033, 37),
new Point3D(5262, 4049, 37),
new Point3D(5284, 4006, 37),
new Point3D(5189, 3971, 39),
new Point3D(5243, 3960, 37)
}),
// Skara Brae
new StormLevelEntry(1011347, new Point3D[]
{
new Point3D(5216, 4033, 37),
new Point3D(5262, 4049, 37),
new Point3D(5284, 4006, 37),
new Point3D(5189, 3971, 39),
new Point3D(5243, 3960, 37)
}),
// Serpent's Hold
new StormLevelEntry(1011348, new Point3D[]
{
new Point3D(5216, 4033, 37),
new Point3D(5262, 4049, 37),
new Point3D(5284, 4006, 37),
new Point3D(5189, 3971, 39),
new Point3D(5243, 3960, 37)
})
};
private readonly Mobile m_Mobile;
private Timer m_Timer;
public StormLevelGump(Mobile m) : base(50, 50)
{
this.m_Mobile = m;
this.Closable = false;
this.Disposable = false;
this.Dragable = true;
AddPage(0);
AddImage(0, 0, 206);
AddImageTiled(44, 0, 292, 44, 201);
AddImageTiled(0, 44, 42, 267, 202);
AddImageTiled(337, 44, 42, 267, 203);
AddImage(336, 0, 207);
AddImage(0, 311, 204);
AddImage(336, 311, 205);
AddImageTiled(44, 311, 292, 44, 233);
AddImageTiled(42, 44, 295, 267, 200);
AddHtmlLocalized(49, 23, 200, 16, 1011043, false, false); // Magic Storm Level 5
AddHtmlLocalized(23, 51, 338, 67, 1011044, true, true); // This area has become unstable and you must leave. If you do not select a town to go to one will be picked at random. Please select a town from the list below:
StormLevelEntry[] entries = m_Entries;
for (int i = 0; i < entries.Length; i++)
{
StormLevelEntry entry = entries[i];
if (i < 8)
{
this.AddButton(34, 125 + 20 * i, 208, 209, i + 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(65, 125 + 20 * i, 335, 40, entry.Name, false, false);
}
else
{
this.AddButton(210, 125 + 20 * (i - 8), 208, 209, i + 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(241, 125 + 20 * (i - 8), 335, 40, entry.Name, false, false);
}
}
}
public void BeginClose()
{
this.StopClose();
this.m_Timer = new CloseTimer(this.m_Mobile);
this.m_Timer.Start();
this.m_Mobile.Frozen = true;
}
public void StopClose()
{
if (this.m_Timer != null)
this.m_Timer.Stop();
this.m_Mobile.Frozen = false;
}
private class CloseTimer : Timer
{
private readonly Mobile m_Mobile;
private readonly DateTime m_End;
public CloseTimer(Mobile m)
: base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
{
this.m_Mobile = m;
this.m_End = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
}
protected override void OnTick()
{
if (this.m_Mobile.NetState == null || DateTime.UtcNow > this.m_End)
{
this.m_Mobile.Frozen = false;
this.m_Mobile.CloseGump(typeof(StormLevelGump));
StormLevelEntry[] entries = m_Entries;
int id = Utility.Random(entries.Length);
int idx = Utility.Random(entries[id].Locations.Length);
Point3D dest = entries[id].Locations[idx];
GoTo(m_Mobile, dest);
this.Stop();
}
else
{
this.m_Mobile.Frozen = true;
}
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
if (info.ButtonID != 0)
{
int index = info.ButtonID - 1;
StormLevelEntry[] entries = m_Entries;
if (index >= 0 && index < entries.Length)
{
Point3D dest = entries[index].Locations[Utility.Random(entries[index].Locations.Length)];
GoTo(from, dest);
this.StopClose();
}
}
}
public static void GoTo(Mobile from, Point3D dest)
{
Map destMap;
if (from.Map == Map.Trammel)
destMap = Map.Trammel;
else if (from.Map == Map.Felucca)
destMap = Map.Felucca;
else if (from.Map == Map.Internal)
destMap = from.LogoutMap == Map.Felucca ? Map.Felucca : Map.Trammel;
else
destMap = from.Kills >= 5 ? Map.Felucca : Map.Trammel;
Mobiles.BaseCreature.TeleportPets(from, dest, destMap);
from.MoveToWorld(dest, destMap);
}
}
}

132
Scripts/Gumps/StoryGump.cs Normal file
View File

@@ -0,0 +1,132 @@
using System;
using Server;
using Server.Gumps;
using Server.Mobiles;
namespace Server.Gumps
{
public class StoryGump : BaseGump
{
public TextDefinition Title { get; set; }
public PageData[] PageEntries { get; set; }
public StoryGump(PlayerMobile pm)
: base(pm, 100, 100)
{
}
public StoryGump(PlayerMobile pm, TextDefinition title, params PageData[] entries)
: base(pm, 100, 100)
{
Title = title;
PageEntries = entries;
}
public override void AddGumpLayout()
{
Closable = false;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage(0);
AddImageTiled(50, 20, 400, 460, 0x1404);
AddImageTiled(50, 29, 30, 450, 0x28DC);
AddImageTiled(34, 140, 17, 339, 0x242F);
AddImage(48, 135, 0x28AB);
AddImage(-16, 285, 0x28A2);
AddImage(0, 10, 0x28B5);
AddImage(25, 0, 0x28B4);
AddImageTiled(83, 15, 350, 15, 0x280A);
AddImage(34, 479, 0x2842);
AddImage(442, 479, 0x2840);
AddImageTiled(51, 479, 392, 17, 0x2775);
AddImageTiled(415, 29, 44, 450, 0xA2D);
AddImageTiled(415, 29, 30, 450, 0x28DC);
AddImage(370, 50, 0x589);
AddImage(379, 60, 0x15A9);
AddImage(425, 0, 0x28C9);
AddImage(90, 33, 0x232D);
AddImageTiled(130, 65, 175, 1, 0x238D);
AddButton(345, 440, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0);//OK
if (Title.Number > 0)
{
AddHtmlLocalized(140, 45, 250, 24, Title.Number, 0x7FFF, false, false);
}
else
{
AddHtml(140, 45, 250, 24, Color("#FFFFFF", Title.String), false, false);
}
for (int i = 0; i < PageEntries.Length; i++)
{
RenderPage(PageEntries[i]);
}
}
public void RenderPage(PageData page)
{
AddPage(page.Page);
var textDef = page.Text;
if (textDef.Number > 0)
{
AddHtmlLocalized(107, 140, 300, 150, textDef.Number, 0x7FFF, false, true);
}
else
{
AddHtml(107, 140, 300, 150, Color("#FFFFFF", textDef.String), false, true);
}
if (page.Selections != null)
{
for (int i = 0; i < page.Selections.Length; i++)
{
int y = 300 + (i * 20);
var entry = page.Selections[i];
AddButton(115, y, 0x26B0, 0x26B1, 0, GumpButtonType.Page, entry.PageTo);
if (entry.Title.Number > 0)
{
AddHtmlLocalized(145, y, 250, 24, entry.Title.Number, 0x7FFF, false, false);
}
else
{
AddHtml(145, y, 250, 24, Color("#FFFFFF", entry.Title.String), false, false);
}
}
}
}
}
public class PageData
{
public int Page { get; set; }
public TextDefinition Text { get; set; }
public SelectionEntry[] Selections { get; set; }
public PageData(int page, TextDefinition text, params SelectionEntry[] selections)
{
Page = page;
Text = text;
Selections = selections;
}
}
public class SelectionEntry
{
public TextDefinition Title { get; set; }
public int PageTo { get; set; }
public SelectionEntry(TextDefinition text, int pageTo)
{
Title = text;
PageTo = pageTo;
}
}
}

View File

@@ -0,0 +1,142 @@
using System;
using Server.Items;
using Server.Network;
using Server.Mobiles;
using System.Globalization;
namespace Server.Gumps
{
public class TithingGump : Gump
{
private int MaxTithing = 100000;
public TithingGump(Mobile from, int offer)
: base(100, 100)
{
int totalGold = Banker.GetBalance(from);
string gold = totalGold >= MaxTithing ? "100,000+" : totalGold.ToString("N0", CultureInfo.GetCultureInfo("en-US"));
AddPage(0);
AddBackground(0, 0, 250, 355, 0x6DB);
AddImage(8, 0, 0x66);
AddHtmlLocalized(73, 65, 100, 150, 1114513, "#1060198", 0xC63, false, false); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
AddHtmlLocalized(85, 245, 50, 18, 3000311, 0xC63, false, false); // Gold:
AddLabel(117, 245, 0x35, gold);
AddHtmlLocalized(43, 275, 200, 18, 1159137, 0x7FFF, false, false); // How much whilst thou tithe?
AddBackground(85, 295, 80, 22, 0x2486);
AddTextEntry(87, 297, 76, 18, 0x0, 1, offer > 0 ? string.Format("{0}", offer) : "", 6);
AddButton(205, 321, 0xFB7, 0xFB8, 2, GumpButtonType.Reply, 0); // OK
AddButton(15, 326, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(35, 323, 200, 18, 1159139, 0x7FFF, false, false); // Tithe Maximum
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
int m_Offer;
switch (info.ButtonID)
{
case 0:
{
// You have decided to tithe no gold to the shrine.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
break;
}
case 1:
{
if (from.TithingPoints >= MaxTithing)
{
from.SendLocalizedMessage(1060840); // You have reached the maximum amount of Tithing Points available.
break;
}
int totalGold = Banker.GetBalance(from);
if (totalGold <= 0)
{
// You have decided to tithe no gold to the shrine.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
break;
}
m_Offer = MaxTithing - from.TithingPoints;
if (m_Offer > totalGold)
m_Offer = totalGold;
from.SendGump(new TithingGump(from, m_Offer));
break;
}
case 2:
{
if (from.TithingPoints >= MaxTithing)
{
from.SendLocalizedMessage(1060840); // You have reached the maximum amount of Tithing Points available.
break;
}
int totalGold = Banker.GetBalance(from);
if (totalGold <= 0)
{
// You have decided to tithe no gold to the shrine.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
break;
}
TextRelay tr = info.GetTextEntry(1);
if (tr != null)
{
string text = tr.Text;
int num = Utility.ToInt32(text);
if (num > 0)
{
if (num > totalGold)
m_Offer = totalGold;
else
m_Offer = num;
if ((from.TithingPoints + m_Offer) > MaxTithing)
m_Offer = MaxTithing - from.TithingPoints;
Container pack = from.Backpack;
if (Banker.Withdraw(from, m_Offer, true))
{
// You tithe gold to the shrine as a sign of devotion.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060195);
from.TithingPoints += m_Offer;
from.PlaySound(0x243);
from.PlaySound(0x2E6);
}
else
{
// You do not have enough gold to tithe that amount!
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060194);
}
}
else
{
from.SendLocalizedMessage(1159140); // You have entered an invalid entry. You must enter a number between 1 and 100,000.
}
}
break;
}
}
}
}
}

1171
Scripts/Gumps/TitlesMenu.cs Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More