Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
121
Projects/Scripts/Gumps/AddDoorGump.cs
Normal file
121
Projects/Scripts/Gumps/AddDoorGump.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
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(typeof(MetalDoor), 0x675),
|
||||
new DoorInfo(typeof(RattanDoor), 0x695),
|
||||
new DoorInfo(typeof(DarkWoodDoor), 0x6A5),
|
||||
new DoorInfo(typeof(LightWoodDoor), 0x6D5),
|
||||
new DoorInfo(typeof(StrongWoodDoor), 0x6E5)
|
||||
};
|
||||
|
||||
private int m_Type;
|
||||
|
||||
public AddDoorGump(int type = -1) : 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);
|
||||
|
||||
AddItem(47, 45, baseID + 2);
|
||||
AddButton(43, 57, 0x5783, 0x5783, 2);
|
||||
|
||||
AddItem(87, 22, baseID + 10);
|
||||
AddButton(116, 35, 0x5785, 0x5785, 6);
|
||||
|
||||
AddItem(65, 45, baseID + 8);
|
||||
AddButton(96, 55, 0x5784, 0x5784, 5);
|
||||
|
||||
AddButton(73, 36, 0x2716, 0x2716, 9);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddBlueBack(265, 145);
|
||||
|
||||
for (int i = 0; i < m_Types.Length; ++i)
|
||||
{
|
||||
AddButton(30 + i * 49, 13, 0x2624, 0x2625, i + 1);
|
||||
AddItem(22 + i * 49, 20, m_Types[i].m_BaseID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
$"{CommandSystem.Prefix}Add {m_Types[m_Type].m_Type.Name} {(DoorFacing)button}");
|
||||
}
|
||||
else if (button == 8)
|
||||
{
|
||||
from.SendGump(new AddDoorGump(m_Type));
|
||||
CommandSystem.Handle(from, $"{CommandSystem.Prefix}Link");
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump(new AddDoorGump());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("AddDoor", AccessLevel.GameMaster, 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 class DoorInfo
|
||||
{
|
||||
public int m_BaseID;
|
||||
public Type m_Type;
|
||||
|
||||
public DoorInfo(Type type, int baseID)
|
||||
{
|
||||
m_Type = type;
|
||||
m_BaseID = baseID;
|
||||
}
|
||||
}
|
||||
}
|
||||
250
Projects/Scripts/Gumps/AddGump.cs
Normal file
250
Projects/Scripts/Gumps/AddGump.cs
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
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 Type typeofItem = typeof(Item), typeofMobile = typeof(Mobile);
|
||||
private int m_Page;
|
||||
private Type[] m_SearchResults;
|
||||
private string m_SearchString;
|
||||
|
||||
public AddGump(Mobile from, string searchString, int page, Type[] searchResults, bool explicitSearch) : base(50, 50)
|
||||
{
|
||||
m_SearchString = searchString;
|
||||
m_SearchResults = searchResults;
|
||||
m_Page = page;
|
||||
|
||||
from.CloseGump<AddGump>();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 420, 280, 5054);
|
||||
|
||||
AddImageTiled(10, 10, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 10, 400, 20);
|
||||
AddImageTiled(41, 11, 184, 18, 0xBBC);
|
||||
AddImageTiled(42, 12, 182, 16, 2624);
|
||||
AddAlphaRegion(42, 12, 182, 16);
|
||||
|
||||
AddButton(10, 9, 4011, 4013, 1);
|
||||
AddTextEntry(44, 10, 180, 20, 0x480, 0, searchString);
|
||||
|
||||
AddHtmlLocalized(230, 10, 100, 20, 3010005, 0x7FFF);
|
||||
|
||||
AddImageTiled(10, 40, 400, 200, 2624);
|
||||
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;
|
||||
|
||||
AddLabel(44, 39 + index * 20, 0x480, searchResults[i].Name);
|
||||
AddButton(10, 39 + index * 20, 4023, 4025, 4 + i);
|
||||
}
|
||||
else
|
||||
AddLabel(15, 44, 0x480, explicitSearch ? "Nothing matched your search terms." : "No results to display.");
|
||||
|
||||
AddImageTiled(10, 250, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 250, 400, 20);
|
||||
|
||||
if (m_Page > 0)
|
||||
AddButton(10, 249, 4014, 4016, 2);
|
||||
else
|
||||
AddImage(10, 249, 4014);
|
||||
|
||||
AddHtmlLocalized(44, 250, 170, 20, 1061028, m_Page > 0 ? 0x7FFF : 0x5EF7); // Previous page
|
||||
|
||||
if ((m_Page + 1) * 10 < searchResults.Length)
|
||||
AddButton(210, 249, 4005, 4007, 3);
|
||||
else
|
||||
AddImage(210, 249, 4005);
|
||||
|
||||
AddHtmlLocalized(244, 250, 170, 20, 1061027, (m_Page + 1) * 10 < searchResults.Length ? 0x7FFF : 0x5EF7); // Next page
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("AddMenu", AccessLevel.GameMaster, AddMenu_OnCommand);
|
||||
}
|
||||
|
||||
[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)) &&
|
||||
t.Name.ToLower().IndexOf(match) >= 0 && !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(ConstructibleAttribute), false))
|
||||
{
|
||||
results.Add(t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.Sort(new TypeNameComparer());
|
||||
|
||||
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, m_Page, m_SearchResults, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump(new AddGump(from, match, 0, Match(match).ToArray(), true));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Previous page
|
||||
{
|
||||
if (m_Page > 0)
|
||||
from.SendGump(new AddGump(from, m_SearchString, m_Page - 1, m_SearchResults, true));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Next page
|
||||
{
|
||||
if ((m_Page + 1) * 10 < m_SearchResults.Length)
|
||||
from.SendGump(new AddGump(from, m_SearchString, m_Page + 1, m_SearchResults, true));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int index = info.ButtonID - 4;
|
||||
|
||||
if (index >= 0 && index < m_SearchResults.Length)
|
||||
{
|
||||
from.SendMessage("Where do you wish to place this object? <ESC> to cancel.");
|
||||
from.Target = new InternalTarget(m_SearchResults[index], m_SearchResults, m_SearchString, m_Page);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TypeNameComparer : IComparer<Type>
|
||||
{
|
||||
public int Compare(Type x, Type y)
|
||||
{
|
||||
return x.Name.CompareTo(y.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private int m_Page;
|
||||
private Type[] m_SearchResults;
|
||||
private string m_SearchString;
|
||||
private Type m_Type;
|
||||
|
||||
public InternalTarget(Type type, Type[] searchResults, string searchString, int page) : base(-1, true,
|
||||
TargetFlags.None)
|
||||
{
|
||||
m_Type = type;
|
||||
m_SearchResults = searchResults;
|
||||
m_SearchString = searchString;
|
||||
m_Page = page;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IPoint3D p)
|
||||
{
|
||||
if (p is Item item)
|
||||
p = item.GetWorldTop();
|
||||
else if (p is Mobile m)
|
||||
p = m.Location;
|
||||
|
||||
Commands.Add.Invoke(from, new Point3D(p), new Point3D(p), new[] { m_Type.Name });
|
||||
|
||||
from.Target = new InternalTarget(m_Type, m_SearchResults, m_SearchString, m_Page);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
|
||||
{
|
||||
if (cancelType == TargetCancelType.Canceled)
|
||||
from.SendGump(new AddGump(from, m_SearchString, m_Page, m_SearchResults, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3154
Projects/Scripts/Gumps/AdminGump.cs
Normal file
3154
Projects/Scripts/Gumps/AdminGump.cs
Normal file
File diff suppressed because it is too large
Load diff
243
Projects/Scripts/Gumps/BanDurationGump.cs
Normal file
243
Projects/Scripts/Gumps/BanDurationGump.cs
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class BanDurationGump : Gump
|
||||
{
|
||||
private List<Account> m_List;
|
||||
|
||||
public BanDurationGump(Account a) : this(new List<Account>{ a })
|
||||
{
|
||||
}
|
||||
|
||||
public BanDurationGump(List<Account> list) : base((640 - 500) / 2, (480 - 305) / 2)
|
||||
{
|
||||
m_List = list;
|
||||
|
||||
int width = 500;
|
||||
int height = 305;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, width, height, 5054);
|
||||
|
||||
//AddImageTiled( 10, 10, width - 20, 20, 2624 );
|
||||
//AddAlphaRegion( 10, 10, width - 20, 20 );
|
||||
AddHtml(10, 10, width - 20, 20, "<CENTER>Ban Duration</CENTER>");
|
||||
|
||||
//AddImageTiled( 10, 40, width - 20, height - 50, 2624 );
|
||||
//AddAlphaRegion( 10, 40, width - 20, height - 50 );
|
||||
|
||||
AddButtonLabeled(15, 45, 1, "Infinite");
|
||||
AddButtonLabeled(15, 65, 2, "From D:H:M:S");
|
||||
|
||||
AddInput(3, 0, "Days");
|
||||
AddInput(4, 1, "Hours");
|
||||
AddInput(5, 2, "Minutes");
|
||||
AddInput(6, 3, "Seconds");
|
||||
|
||||
AddHtml(170, 45, 240, 20, "Comments:");
|
||||
AddTextField(170, 65, 315, height - 80, 10);
|
||||
}
|
||||
|
||||
public void AddButtonLabeled(int x, int y, int buttonID, string text)
|
||||
{
|
||||
AddButton(x, y - 1, 4005, 4007, buttonID);
|
||||
AddHtml(x + 35, y, 240, 20, text);
|
||||
}
|
||||
|
||||
public void AddTextField(int x, int y, int width, int height, int index)
|
||||
{
|
||||
AddBackground(x - 2, y - 2, width + 4, height + 4, 0x2486);
|
||||
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;
|
||||
|
||||
AddButtonLabeled(x, y, bid, name);
|
||||
AddTextField(x + 35, y + 20, 100, 20, idx);
|
||||
}
|
||||
|
||||
public override void OnResponse(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;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
for (int i = 0; i < m_List.Count; ++i)
|
||||
{
|
||||
Account a = 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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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 < m_List.Count; ++i)
|
||||
{
|
||||
Account a = m_List[i];
|
||||
|
||||
a.SetBanTags(from, DateTime.UtcNow, duration);
|
||||
|
||||
if (comment != null)
|
||||
a.Comments.Add(new AccountComment(from.RawName,
|
||||
$"Duration: {(duration == TimeSpan.MaxValue ? "Infinite" : duration.ToString())}, Comment: {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(m_List));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
79
Projects/Scripts/Gumps/BaseConfirmGump.cs
Normal file
79
Projects/Scripts/Gumps/BaseConfirmGump.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class BaseConfirmGump : Gump
|
||||
{
|
||||
public BaseConfirmGump() : base(120, 50)
|
||||
{
|
||||
Closable = false;
|
||||
Disposable = true;
|
||||
Draggable = true;
|
||||
Resizable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
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, 230, 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(315, 248, 0x2716);
|
||||
AddImage(2, 248, 0x2716);
|
||||
AddImage(2, 2, 0x2716);
|
||||
AddHtmlLocalized(25, 25, 200, 20, TitleNumber, 0x7D00);
|
||||
AddImage(25, 40, 0xBBF);
|
||||
AddHtmlLocalized(25, 55, 300, 120, LabelNumber, 0xFFFFFF);
|
||||
|
||||
AddRadio(25, 175, 0x25F8, 0x25FB, true, (int)Buttons.Break);
|
||||
AddRadio(25, 210, 0x25F8, 0x25FB, false, (int)Buttons.Close);
|
||||
|
||||
AddHtmlLocalized(60, 180, 280, 20, 1074976, 0xFFFFFF);
|
||||
AddHtmlLocalized(60, 215, 280, 20, 1074977, 0xFFFFFF);
|
||||
|
||||
AddButton(265, 220, 0xF7, 0xF8, (int)Buttons.Confirm);
|
||||
}
|
||||
|
||||
public virtual int TitleNumber // <center>Warning!</center>
|
||||
=> 1075083;
|
||||
|
||||
public virtual int LabelNumber // Are you sure you wish to select this?
|
||||
=> 1074975;
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == (int)Buttons.Confirm)
|
||||
{
|
||||
if (info.IsSwitched((int)Buttons.Break))
|
||||
Confirm(state.Mobile);
|
||||
else
|
||||
Refuse(state.Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Confirm(Mobile from)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Refuse(Mobile from)
|
||||
{
|
||||
}
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Close,
|
||||
Break,
|
||||
Confirm
|
||||
}
|
||||
}
|
||||
}
|
||||
188
Projects/Scripts/Gumps/BaseGridGump.cs
Normal file
188
Projects/Scripts/Gumps/BaseGridGump.cs
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
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;
|
||||
|
||||
public BaseGridGump(int x, int y) : base(x, y)
|
||||
{
|
||||
}
|
||||
|
||||
public int CurrentPage{ get; private set; }
|
||||
|
||||
public int CurrentX{ get; private set; }
|
||||
|
||||
public int CurrentY{ get; private set; }
|
||||
|
||||
public virtual int BorderSize => 10;
|
||||
public virtual int OffsetSize => 1;
|
||||
|
||||
public virtual int EntryHeight => 20;
|
||||
|
||||
public virtual int OffsetGumpID => 0x0A40;
|
||||
public virtual int HeaderGumpID => 0x0E14;
|
||||
public virtual int EntryGumpID => 0x0BBC;
|
||||
public virtual int BackGumpID => 0x13BE;
|
||||
|
||||
public virtual int TextHue => 0;
|
||||
public virtual int TextOffsetX => 2;
|
||||
|
||||
public string Center(string text)
|
||||
{
|
||||
return $"<CENTER>{text}</CENTER>";
|
||||
}
|
||||
|
||||
public string Color(string text, int color)
|
||||
{
|
||||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
|
||||
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 (m_Background != null)
|
||||
m_Background.Height = CurrentY + EntryHeight + OffsetSize + BorderSize;
|
||||
|
||||
if (m_Offset != null)
|
||||
m_Offset.Height = CurrentY + EntryHeight + OffsetSize - BorderSize;
|
||||
}
|
||||
|
||||
public void AddNewPage()
|
||||
{
|
||||
FinishPage();
|
||||
|
||||
CurrentX = BorderSize + OffsetSize;
|
||||
CurrentY = BorderSize + OffsetSize;
|
||||
|
||||
AddPage(++CurrentPage);
|
||||
|
||||
m_Background = new GumpBackground(0, 0, 100, 100, BackGumpID);
|
||||
Add(m_Background);
|
||||
|
||||
m_Offset = new GumpImageTiled(BorderSize, BorderSize, 100, 100, OffsetGumpID);
|
||||
Add(m_Offset);
|
||||
}
|
||||
|
||||
public void AddNewLine()
|
||||
{
|
||||
CurrentY += EntryHeight + OffsetSize;
|
||||
CurrentX = BorderSize + OffsetSize;
|
||||
}
|
||||
|
||||
public void IncreaseX(int width)
|
||||
{
|
||||
CurrentX += width + OffsetSize;
|
||||
|
||||
width = CurrentX + BorderSize;
|
||||
|
||||
if (m_Background != null && width > m_Background.Width)
|
||||
m_Background.Width = width;
|
||||
|
||||
width = CurrentX - BorderSize;
|
||||
|
||||
if (m_Offset != null && width > m_Offset.Width)
|
||||
m_Offset.Width = width;
|
||||
}
|
||||
|
||||
public void AddEntryLabel(int width, string text)
|
||||
{
|
||||
AddImageTiled(CurrentX, CurrentY, width, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(CurrentX + TextOffsetX, CurrentY, width - TextOffsetX, EntryHeight, TextHue, text);
|
||||
|
||||
IncreaseX(width);
|
||||
}
|
||||
|
||||
public void AddEntryHtml(int width, string text)
|
||||
{
|
||||
AddImageTiled(CurrentX, CurrentY, width, EntryHeight, EntryGumpID);
|
||||
AddHtml(CurrentX + TextOffsetX, CurrentY, width - TextOffsetX, EntryHeight, text);
|
||||
|
||||
IncreaseX(width);
|
||||
}
|
||||
|
||||
public void AddEntryHeader(int width)
|
||||
{
|
||||
AddEntryHeader(width, 1);
|
||||
}
|
||||
|
||||
public void AddEntryHeader(int width, int spannedEntries)
|
||||
{
|
||||
AddImageTiled(CurrentX, CurrentY, width, EntryHeight * spannedEntries + OffsetSize * (spannedEntries - 1),
|
||||
HeaderGumpID);
|
||||
IncreaseX(width);
|
||||
}
|
||||
|
||||
public void AddBlankLine()
|
||||
{
|
||||
if (m_Offset != null)
|
||||
AddImageTiled(m_Offset.X, CurrentY, m_Offset.Width, EntryHeight, BackGumpID + 4);
|
||||
|
||||
AddNewLine();
|
||||
}
|
||||
|
||||
public void AddEntryButton(int width, int normalID, int pressedID, int buttonID, int buttonWidth, int buttonHeight)
|
||||
{
|
||||
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)
|
||||
{
|
||||
AddImageTiled(CurrentX, CurrentY, width, EntryHeight * spannedEntries + OffsetSize * (spannedEntries - 1),
|
||||
HeaderGumpID);
|
||||
AddButton(CurrentX + (width - buttonWidth) / 2,
|
||||
CurrentY + (EntryHeight * spannedEntries + OffsetSize * (spannedEntries - 1) - buttonHeight) / 2, normalID,
|
||||
pressedID, buttonID);
|
||||
|
||||
IncreaseX(width);
|
||||
}
|
||||
|
||||
public void AddEntryPageButton(int width, int normalID, int pressedID, int page, int buttonWidth, int buttonHeight)
|
||||
{
|
||||
AddImageTiled(CurrentX, CurrentY, width, EntryHeight, HeaderGumpID);
|
||||
AddButton(CurrentX + (width - buttonWidth) / 2, CurrentY + (EntryHeight - buttonHeight) / 2, normalID, pressedID,
|
||||
0, GumpButtonType.Page, page);
|
||||
|
||||
IncreaseX(width);
|
||||
}
|
||||
|
||||
public void AddEntryText(int width, int entryID, string initialText)
|
||||
{
|
||||
AddImageTiled(CurrentX, CurrentY, width, EntryHeight, EntryGumpID);
|
||||
AddTextEntry(CurrentX + TextOffsetX, CurrentY, width - TextOffsetX, EntryHeight, TextHue, entryID, initialText);
|
||||
|
||||
IncreaseX(width);
|
||||
}
|
||||
}
|
||||
}
|
||||
127
Projects/Scripts/Gumps/BaseImageTileButtonsGump.cs
Normal file
127
Projects/Scripts/Gumps/BaseImageTileButtonsGump.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ImageTileButtonInfo
|
||||
{
|
||||
private int m_Hue;
|
||||
private int m_ItemID;
|
||||
|
||||
private TextDefinition m_Label;
|
||||
private int m_LocalizedTooltip;
|
||||
|
||||
public ImageTileButtonInfo(int itemID, int hue, TextDefinition label, int localizedTooltip = -1)
|
||||
{
|
||||
m_Hue = hue;
|
||||
m_ItemID = itemID;
|
||||
m_Label = label;
|
||||
m_LocalizedTooltip = localizedTooltip;
|
||||
}
|
||||
|
||||
public virtual int ItemID
|
||||
{
|
||||
get => m_ItemID;
|
||||
set => m_ItemID = value;
|
||||
}
|
||||
|
||||
public virtual int Hue
|
||||
{
|
||||
get => m_Hue;
|
||||
set => m_Hue = value;
|
||||
}
|
||||
|
||||
public virtual int LocalizedTooltip
|
||||
{
|
||||
get => m_LocalizedTooltip;
|
||||
set => m_LocalizedTooltip = value;
|
||||
}
|
||||
|
||||
public virtual TextDefinition Label
|
||||
{
|
||||
get => m_Label;
|
||||
set => m_Label = value;
|
||||
}
|
||||
}
|
||||
|
||||
public class BaseImageTileButtonsGump : Gump
|
||||
{
|
||||
public BaseImageTileButtonsGump(TextDefinition header, List<ImageTileButtonInfo> buttons) :
|
||||
this(header, buttons.ToArray())
|
||||
{
|
||||
}
|
||||
|
||||
public BaseImageTileButtonsGump(TextDefinition header, ImageTileButtonInfo[] buttons) : base(10, 10) //Coords are 0, o on OSI, intentional difference
|
||||
{
|
||||
Buttons = buttons;
|
||||
AddPage(0);
|
||||
|
||||
int x = XItems * 250;
|
||||
int y = YItems * 64;
|
||||
|
||||
AddBackground(0, 0, x + 20, y + 84, 0x13BE);
|
||||
AddImageTiled(10, 10, x, 20, 0xA40);
|
||||
AddImageTiled(10, 40, x, y + 4, 0xA40);
|
||||
AddImageTiled(10, y + 54, x, 20, 0xA40);
|
||||
AddAlphaRegion(10, 10, x, y + 64);
|
||||
|
||||
AddButton(10, y + 54, 0xFB1, 0xFB2, 0); //Cancel Button
|
||||
AddHtmlLocalized(45, y + 56, x - 50, 20, 1060051, 0x7FFF); // CANCEL
|
||||
TextDefinition.AddHtmlText(this, 14, 12, x, 20, header, false, false, 0x7FFF, 0xFFFFFF);
|
||||
|
||||
AddPage(1);
|
||||
|
||||
int itemsPerPage = XItems * YItems;
|
||||
|
||||
for (int i = 0; i < buttons.Length; i++)
|
||||
{
|
||||
int position = i % itemsPerPage;
|
||||
|
||||
int innerX = position % XItems * 250 + 14;
|
||||
int innerY = position / XItems * 64 + 44;
|
||||
|
||||
int pageNum = i / itemsPerPage + 1;
|
||||
|
||||
if (position == 0 && i != 0)
|
||||
{
|
||||
AddButton(x - 100, y + 54, 0xFA5, 0xFA7, 0, GumpButtonType.Page, pageNum);
|
||||
AddHtmlLocalized(x - 60, y + 56, 60, 20, 1043353, 0x7FFF); // Next
|
||||
|
||||
AddPage(pageNum);
|
||||
|
||||
AddButton(x - 200, y + 54, 0xFAE, 0xFB0, 0, GumpButtonType.Page, pageNum - 1);
|
||||
AddHtmlLocalized(x - 160, y + 56, 60, 20, 1011393, 0x7FFF); // Back
|
||||
}
|
||||
|
||||
ImageTileButtonInfo b = buttons[i];
|
||||
|
||||
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; }
|
||||
|
||||
protected virtual int XItems => 2;
|
||||
protected virtual int YItems => 5;
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
int adjustedID = info.ButtonID - 100;
|
||||
|
||||
if (adjustedID >= 0 && adjustedID < Buttons.Length)
|
||||
HandleButtonResponse(sender, adjustedID, Buttons[adjustedID]);
|
||||
else
|
||||
HandleCancel(sender);
|
||||
}
|
||||
|
||||
public virtual void HandleButtonResponse(NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void HandleCancel(NetState sender)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
387
Projects/Scripts/Gumps/CategorizedAddGump.cs
Normal file
387
Projects/Scripts/Gumps/CategorizedAddGump.cs
Normal file
|
|
@ -0,0 +1,387 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
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
|
||||
{
|
||||
public CAGObject(CAGCategory parent, XmlTextReader xml)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
if (xml.MoveToAttribute("type"))
|
||||
Type = ScriptCompiler.FindTypeByFullName(xml.Value, false);
|
||||
|
||||
if (xml.MoveToAttribute("gfx"))
|
||||
ItemID = XmlConvert.ToInt32(xml.Value);
|
||||
|
||||
if (xml.MoveToAttribute("hue"))
|
||||
Hue = XmlConvert.ToInt32(xml.Value);
|
||||
}
|
||||
|
||||
public Type Type{ get; }
|
||||
|
||||
public int ItemID{ get; }
|
||||
|
||||
public int Hue{ get; }
|
||||
|
||||
public CAGCategory Parent{ get; }
|
||||
|
||||
public override string Caption => Type == null ? "bad type" : Type.Name;
|
||||
|
||||
public override void OnClick(Mobile from, int page)
|
||||
{
|
||||
if (Type == null)
|
||||
{
|
||||
from.SendMessage("That is an invalid type name.");
|
||||
}
|
||||
else
|
||||
{
|
||||
CommandSystem.Handle(from, $"{CommandSystem.Prefix}Add {Type.Name}");
|
||||
|
||||
from.SendGump(new CategorizedAddGump(from, Parent, page));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CAGCategory : CAGNode
|
||||
{
|
||||
private static CAGCategory m_Root;
|
||||
|
||||
private CAGCategory()
|
||||
{
|
||||
Title = "no data";
|
||||
Nodes = new CAGNode[0];
|
||||
}
|
||||
|
||||
public CAGCategory(CAGCategory parent, XmlTextReader xml)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
if (xml.MoveToAttribute("title"))
|
||||
Title = xml.Value;
|
||||
else
|
||||
Title = "empty";
|
||||
|
||||
if (Title == "Docked")
|
||||
Title = "Docked 2";
|
||||
|
||||
if (xml.IsEmptyElement)
|
||||
{
|
||||
Nodes = new CAGNode[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
List<CAGNode> nodes = new List<CAGNode>();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
Nodes = nodes.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public string Title{ get; }
|
||||
|
||||
public CAGNode[] Nodes{ get; }
|
||||
|
||||
public CAGCategory Parent{ get; }
|
||||
|
||||
public override string Caption => Title;
|
||||
|
||||
public static CAGCategory Root => m_Root ?? (m_Root = Load("Data/objects.xml"));
|
||||
|
||||
public override void OnClick(Mobile from, int page)
|
||||
{
|
||||
from.SendGump(new CategorizedAddGump(from, this));
|
||||
}
|
||||
|
||||
public static CAGCategory Load(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
XmlTextReader xml = new XmlTextReader(path) { 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 class CategorizedAddGump : Gump
|
||||
{
|
||||
public static bool OldStyle = PropsConfig.OldStyle;
|
||||
|
||||
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;
|
||||
|
||||
private static bool PrevLabel = false, 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 CAGCategory m_Category;
|
||||
|
||||
private Mobile m_Owner;
|
||||
private int m_Page;
|
||||
|
||||
public CategorizedAddGump(Mobile owner) : this(owner, CAGCategory.Root)
|
||||
{
|
||||
}
|
||||
|
||||
public CategorizedAddGump(Mobile owner, CAGCategory category, int page = 0) : base(GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
owner.CloseGump<WhoGump>();
|
||||
|
||||
m_Owner = owner;
|
||||
m_Category = category;
|
||||
|
||||
Initialize(page);
|
||||
}
|
||||
|
||||
public void Initialize(int page)
|
||||
{
|
||||
m_Page = page;
|
||||
|
||||
CAGNode[] nodes = 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);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
|
||||
AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight,
|
||||
OffsetGumpID);
|
||||
|
||||
int x = BorderSize + OffsetSize;
|
||||
int y = BorderSize + OffsetSize;
|
||||
|
||||
if (OldStyle)
|
||||
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
||||
else
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (m_Category.Parent != null)
|
||||
{
|
||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
|
||||
|
||||
if (PrevLabel)
|
||||
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
||||
}
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
int emptyWidth = TotalWidth - PrevWidth * 2 - NextWidth - OffsetSize * 5 -
|
||||
(OldStyle ? SetWidth + OffsetSize : 0);
|
||||
|
||||
if (!OldStyle)
|
||||
AddImageTiled(x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight,
|
||||
EntryGumpID);
|
||||
|
||||
AddHtml(x + TextOffsetX, y + (EntryHeight - 20) / 2, emptyWidth - TextOffsetX, EntryHeight,
|
||||
$"<center>{m_Category.Caption}</center>");
|
||||
|
||||
x += emptyWidth + OffsetSize;
|
||||
|
||||
if (OldStyle)
|
||||
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
||||
else
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2);
|
||||
|
||||
if (PrevLabel)
|
||||
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
||||
}
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
if (!OldStyle)
|
||||
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if ((page + 1) * EntryCount < nodes.Length)
|
||||
{
|
||||
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1);
|
||||
|
||||
if (NextLabel)
|
||||
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];
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y + (EntryHeight - 20) / 2, EntryWidth - TextOffsetX, EntryHeight, TextHue,
|
||||
node.Caption);
|
||||
|
||||
x += EntryWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
|
||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 4);
|
||||
|
||||
if (node is CAGObject obj)
|
||||
{
|
||||
int itemID = obj.ItemID;
|
||||
|
||||
Rectangle2D bounds = ItemBounds.Table[itemID];
|
||||
|
||||
if (itemID != 1 && bounds.Height < EntryHeight * 2)
|
||||
{
|
||||
if (bounds.Height < EntryHeight)
|
||||
AddItem(x - OffsetSize - 22 - i % 2 * 44 - bounds.Width / 2 - bounds.X,
|
||||
y + EntryHeight / 2 - bounds.Height / 2 - bounds.Y, itemID);
|
||||
else
|
||||
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 = m_Owner;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: // Closed
|
||||
{
|
||||
return;
|
||||
}
|
||||
case 1: // Up
|
||||
{
|
||||
if (m_Category.Parent != null)
|
||||
{
|
||||
int index = Array.IndexOf(m_Category.Parent.Nodes, m_Category) / EntryCount;
|
||||
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
|
||||
from.SendGump(new CategorizedAddGump(from, m_Category.Parent, index));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Previous
|
||||
{
|
||||
if (m_Page > 0)
|
||||
from.SendGump(new CategorizedAddGump(from, m_Category, m_Page - 1));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Next
|
||||
{
|
||||
if ((m_Page + 1) * EntryCount < m_Category.Nodes.Length)
|
||||
from.SendGump(new CategorizedAddGump(from, m_Category, m_Page + 1));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int index = m_Page * EntryCount + (info.ButtonID - 4);
|
||||
|
||||
if (index >= 0 && index < m_Category.Nodes.Length)
|
||||
m_Category.Nodes[index].OnClick(from, m_Page);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
305
Projects/Scripts/Gumps/ClientGump.cs
Normal file
305
Projects/Scripts/Gumps/ClientGump.cs
Normal file
|
|
@ -0,0 +1,305 @@
|
|||
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 NetState m_State;
|
||||
|
||||
public ClientGump(Mobile from, NetState state, string initialText = "") : base(30, 20)
|
||||
{
|
||||
if (state == null)
|
||||
return;
|
||||
|
||||
m_State = state;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 400, 274, 5054);
|
||||
|
||||
AddImageTiled(10, 10, 380, 19, 0xA40);
|
||||
AddAlphaRegion(10, 10, 380, 19);
|
||||
|
||||
AddImageTiled(10, 32, 380, 232, 0xA40);
|
||||
AddAlphaRegion(10, 32, 380, 232);
|
||||
|
||||
AddHtml(10, 10, 380, 20, Color(Center("User Information"), LabelColor32));
|
||||
|
||||
int line = 0;
|
||||
|
||||
AddHtml(14, 36 + line * 20, 200, 20, Color("Address:", LabelColor32));
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20, Color(state.ToString(), LabelColor32));
|
||||
|
||||
AddHtml(14, 36 + line * 20, 200, 20, Color("Client:", LabelColor32));
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20,
|
||||
Color(state.Version == null ? "(null)" : state.Version.ToString(), LabelColor32));
|
||||
|
||||
AddHtml(14, 36 + line * 20, 200, 20, Color("Version:", LabelColor32));
|
||||
|
||||
ExpansionInfo info = state.ExpansionInfo;
|
||||
string expansionName = info.Name;
|
||||
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20, Color(expansionName, LabelColor32));
|
||||
|
||||
Account a = state.Account as Account;
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if (from.AccessLevel >= AccessLevel.GameMaster && a != null)
|
||||
{
|
||||
AddHtml(14, 36 + line * 20, 200, 20, Color("Account:", LabelColor32));
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20, Color(a.Username, LabelColor32));
|
||||
}
|
||||
|
||||
if (m != null)
|
||||
{
|
||||
AddHtml(14, 36 + line * 20, 200, 20, Color("Mobile:", LabelColor32));
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20, Color($"{m.Name} (0x{m.Serial.Value:X})", LabelColor32));
|
||||
|
||||
AddHtml(14, 36 + line * 20, 200, 20, Color("Location:", LabelColor32));
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20, Color($"{m.Location} [{m.Map}]", LabelColor32));
|
||||
|
||||
AddButton(13, 157, 0xFAB, 0xFAD, 1);
|
||||
AddHtml(48, 158, 200, 20, Color("Send Message", LabelColor32));
|
||||
|
||||
AddImageTiled(12, 182, 376, 80, 0xA40);
|
||||
AddImageTiled(13, 183, 374, 78, 0xBBC);
|
||||
AddTextEntry(15, 183, 372, 78, 0x480, 0, "");
|
||||
|
||||
AddImageTiled(245, 35, 142, 144, 5058);
|
||||
|
||||
AddImageTiled(246, 36, 140, 142, 0xA40);
|
||||
AddAlphaRegion(246, 36, 140, 142);
|
||||
|
||||
line = 0;
|
||||
|
||||
if (BaseCommand.IsAccessible(from, m))
|
||||
{
|
||||
AddButton(246, 36 + line * 20, 0xFA5, 0xFA7, 4);
|
||||
AddHtml(280, 38 + line++ * 20, 100, 20, Color("Properties", LabelColor32));
|
||||
}
|
||||
|
||||
if (from != m)
|
||||
{
|
||||
AddButton(246, 36 + line * 20, 0xFA5, 0xFA7, 5);
|
||||
AddHtml(280, 38 + line++ * 20, 100, 20, Color("Go to them", LabelColor32));
|
||||
|
||||
AddButton(246, 36 + line * 20, 0xFA5, 0xFA7, 6);
|
||||
AddHtml(280, 38 + line++ * 20, 100, 20, Color("Bring them here", LabelColor32));
|
||||
}
|
||||
|
||||
AddButton(246, 36 + line * 20, 0xFA5, 0xFA7, 7);
|
||||
AddHtml(280, 38 + line++ * 20, 100, 20, Color("Move to target", LabelColor32));
|
||||
|
||||
if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > m.AccessLevel)
|
||||
{
|
||||
AddButton(246, 36 + line * 20, 0xFA5, 0xFA7, 8);
|
||||
AddHtml(280, 38 + line++ * 20, 100, 20, Color("Disconnect", LabelColor32));
|
||||
|
||||
if (m.Alive)
|
||||
{
|
||||
AddButton(246, 36 + line * 20, 0xFA5, 0xFA7, 9);
|
||||
AddHtml(280, 38 + line++ * 20, 100, 20, Color("Kill", LabelColor32));
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(246, 36 + line * 20, 0xFA5, 0xFA7, 10);
|
||||
AddHtml(280, 38 + line++ * 20, 100, 20, Color("Resurrect", LabelColor32));
|
||||
}
|
||||
}
|
||||
|
||||
if (from.AccessLevel >= AccessLevel.Counselor && from.AccessLevel > m.AccessLevel)
|
||||
{
|
||||
AddButton(246, 36 + line * 20, 0xFA5, 0xFA7, 11);
|
||||
AddHtml(280, 38 + line++ * 20, 100, 20, Color("Skills browser", LabelColor32));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Resend(Mobile to, RelayInfo info)
|
||||
{
|
||||
TextRelay te = info.GetTextEntry(0);
|
||||
|
||||
to.SendGump(new ClientGump(to, m_State, te == null ? "" : te.Text));
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (m_State == null)
|
||||
return;
|
||||
|
||||
Mobile focus = m_State.Mobile;
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if (focus == null)
|
||||
{
|
||||
from.SendMessage("That character is no longer online.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (focus.Deleted)
|
||||
{
|
||||
from.SendMessage("That character no longer exists.");
|
||||
return;
|
||||
}
|
||||
|
||||
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, m_State));
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Props
|
||||
{
|
||||
Resend(from, info);
|
||||
|
||||
if (!BaseCommand.IsAccessible(from, focus))
|
||||
{
|
||||
from.SendLocalizedMessage(500447); // 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);
|
||||
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);
|
||||
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);
|
||||
Resend(from, info);
|
||||
|
||||
break;
|
||||
}
|
||||
case 8: // Kick
|
||||
{
|
||||
if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
|
||||
{
|
||||
focus.Say("I've been kicked!");
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
Resend(from, info);
|
||||
|
||||
break;
|
||||
}
|
||||
case 11: // Skills
|
||||
{
|
||||
Resend(from, info);
|
||||
|
||||
if (from.AccessLevel > focus.AccessLevel)
|
||||
{
|
||||
from.SendGump(new SkillsGump(from, 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 $"<CENTER>{text}</CENTER>";
|
||||
}
|
||||
|
||||
public string Color(string text, int color)
|
||||
{
|
||||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
}
|
||||
}
|
||||
118
Projects/Scripts/Gumps/CommentsGump.cs
Normal file
118
Projects/Scripts/Gumps/CommentsGump.cs
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Accounting;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class CommentsGump : Gump
|
||||
{
|
||||
private Account m_Acct;
|
||||
|
||||
public CommentsGump(Account acct) : base(30, 30)
|
||||
{
|
||||
m_Acct = acct;
|
||||
|
||||
AddPage(0);
|
||||
AddImageTiled(0, 0, 410, 448, 0xA40);
|
||||
AddAlphaRegion(1, 1, 408, 446);
|
||||
|
||||
string title = $"Comments for '{acct.Username}'";
|
||||
int x = 205 - title.Length / 2 * 7;
|
||||
if (x < 120)
|
||||
x = 120;
|
||||
AddLabel(x, 12, 2100, title);
|
||||
|
||||
AddPage(1);
|
||||
AddButton(12, 12, 0xFA8, 0xFAA, 0x7F);
|
||||
AddLabel(48, 12, 2100, "Add Comment");
|
||||
|
||||
List<AccountComment> list = acct.Comments;
|
||||
if (list.Count > 0)
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
AccountComment comment = list[i];
|
||||
|
||||
if (i >= 5 && i % 5 == 0)
|
||||
{
|
||||
AddButton(368, 12, 0xFA5, 0xFA7, 0, GumpButtonType.Page, i / 5 + 1);
|
||||
AddLabel(298, 12, 2100, "Next Page");
|
||||
AddPage(i / 5 + 1);
|
||||
AddButton(12, 12, 0xFAE, 0xFB0, 0, GumpButtonType.Page, i / 5);
|
||||
AddLabel(48, 12, 2100, "Prev Page");
|
||||
}
|
||||
|
||||
string html =
|
||||
$"[Added By: {comment.AddedBy} on {comment.LastModified.ToString("H:mm M/d/yy")}]<br>{comment.Content}";
|
||||
AddHtml(12, 44 + i % 5 * 80, 386, 70, html, true, true);
|
||||
}
|
||||
else
|
||||
AddLabel(12, 44, 2100, "There are no comments for this account.");
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("Comments", AccessLevel.Counselor, Comments_OnCommand);
|
||||
}
|
||||
|
||||
[Usage("Comments")]
|
||||
[Description("View/Modify/Add account comments.")]
|
||||
private static void Comments_OnCommand(CommandEventArgs args)
|
||||
{
|
||||
args.Mobile.SendMessage("Select the player to view account comments.");
|
||||
args.Mobile.BeginTarget(-1, false, TargetFlags.None, OnTarget);
|
||||
}
|
||||
|
||||
private static void OnTarget(Mobile from, object target)
|
||||
{
|
||||
if (!(target is Mobile m) || !m.Player)
|
||||
{
|
||||
from.SendMessage("You must target a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (m.Account == null)
|
||||
from.SendMessage("That player doesn't have an account loaded... weird.");
|
||||
else
|
||||
from.SendGump(new CommentsGump((Account)m.Account));
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 0x7F)
|
||||
{
|
||||
state.Mobile.SendMessage("Enter the text for the account comment (or press [Esc] to cancel):");
|
||||
state.Mobile.Prompt = new CommentPrompt(m_Acct);
|
||||
}
|
||||
}
|
||||
|
||||
public class CommentPrompt : Prompt
|
||||
{
|
||||
private Account m_Acct;
|
||||
|
||||
public CommentPrompt(Account acct)
|
||||
{
|
||||
m_Acct = acct;
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
from.CloseGump<CommentsGump>();
|
||||
from.SendGump(new CommentsGump(m_Acct));
|
||||
base.OnCancel(from);
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
base.OnResponse(from, text);
|
||||
from.SendMessage("Comment added.");
|
||||
//m_Acct.AddComment( from.Name, text );
|
||||
m_Acct.Comments.Add(new AccountComment(from.Name, text));
|
||||
from.CloseGump<CommentsGump>();
|
||||
from.SendGump(new CommentsGump(m_Acct));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
53
Projects/Scripts/Gumps/ConfirmBreakCrystalGump.cs
Normal file
53
Projects/Scripts/Gumps/ConfirmBreakCrystalGump.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ConfirmBreakCrystalGump : BaseConfirmGump
|
||||
{
|
||||
private BaseImprisonedMobile m_Item;
|
||||
|
||||
public ConfirmBreakCrystalGump(BaseImprisonedMobile item)
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
public override int LabelNumber =>
|
||||
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?.Deleted != false)
|
||||
return;
|
||||
|
||||
BaseCreature summon = m_Item.Summon;
|
||||
|
||||
if (summon == null)
|
||||
return;
|
||||
|
||||
if (!summon.SetControlMaster(from))
|
||||
{
|
||||
summon.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
|
||||
|
||||
summon.MoveToWorld(from.Location, from.Map);
|
||||
summon.IsBonded = true;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
73
Projects/Scripts/Gumps/ConfirmHeritageGump.cs
Normal file
73
Projects/Scripts/Gumps/ConfirmHeritageGump.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ConfirmHeritageGump : Gump
|
||||
{
|
||||
private Type[] m_Selected;
|
||||
private HeritageToken m_Token;
|
||||
|
||||
public ConfirmHeritageGump(HeritageToken token, Type[] selected, int cliloc) : base(60, 36)
|
||||
{
|
||||
m_Token = token;
|
||||
m_Selected = selected;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 291, 99, 0x13BE);
|
||||
AddImageTiled(5, 6, 280, 20, 0xA40);
|
||||
AddHtmlLocalized(9, 8, 280, 20, 1070972, 0x7FFF); // Click "OKAY" to redeem the following promotional item:
|
||||
AddImageTiled(5, 31, 280, 40, 0xA40);
|
||||
AddHtmlLocalized(9, 35, 272, 40, cliloc, 0x7FFF);
|
||||
AddButton(180, 73, 0xFB7, 0xFB8, (int)Buttons.Okay);
|
||||
AddHtmlLocalized(215, 75, 100, 20, 1011036, 0x7FFF); // OKAY
|
||||
AddButton(5, 73, 0xFB1, 0xFB2, (int)Buttons.Cancel);
|
||||
AddHtmlLocalized(40, 75, 100, 20, 1060051, 0x7FFF); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Token?.Deleted != false)
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case (int)Buttons.Okay:
|
||||
|
||||
Item item = null;
|
||||
|
||||
foreach (Type type in m_Selected)
|
||||
{
|
||||
try
|
||||
{
|
||||
item = Activator.CreateInstance(type) as Item;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
m_Token.Delete();
|
||||
sender.Mobile.AddToBackpack(item);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case (int)Buttons.Cancel:
|
||||
sender.Mobile.SendGump(new HeritageTokenGump(m_Token));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
Okay
|
||||
}
|
||||
}
|
||||
}
|
||||
158
Projects/Scripts/Gumps/ConfirmHouseResize.cs
Normal file
158
Projects/Scripts/Gumps/ConfirmHouseResize.cs
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
using Server.Guilds;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ConfirmHouseResize : Gump
|
||||
{
|
||||
private BaseHouse m_House;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public ConfirmHouseResize(Mobile mobile, BaseHouse house) : base(110, 100)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_House = house;
|
||||
|
||||
mobile.CloseGump<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); // <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);
|
||||
AddButton(210, 250, 0xFA5, 0xFA7, 0);
|
||||
AddHtmlLocalized(40, 250, 170, 20, 1011036, 0x7FFF); // OKAY
|
||||
AddHtmlLocalized(240, 250, 170, 20, 1011012, 0x7FFF); // 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;
|
||||
}
|
||||
|
||||
if (!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;
|
||||
}*/
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
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 (toGive != null)
|
||||
{
|
||||
BankBox box = m_Mobile.BankBox;
|
||||
|
||||
if (box.TryDropItem(m_Mobile, toGive, false))
|
||||
{
|
||||
if (toGive is BankCheck check)
|
||||
m_Mobile.SendLocalizedMessage(1060397,
|
||||
check.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 this.
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 0)
|
||||
{
|
||||
m_Mobile.CloseGump<ConfirmHouseResize>();
|
||||
m_Mobile.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Customize, m_Mobile, m_House));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Projects/Scripts/Gumps/ConfirmReleaseGump.cs
Normal file
41
Projects/Scripts/Gumps/ConfirmReleaseGump.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ConfirmReleaseGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private BaseCreature m_Pet;
|
||||
|
||||
public ConfirmReleaseGump(Mobile from, BaseCreature pet) : base(50, 50)
|
||||
{
|
||||
m_From = from;
|
||||
m_Pet = pet;
|
||||
|
||||
m_From.CloseGump<ConfirmReleaseGump>();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
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?
|
||||
|
||||
AddButton(20, 80, 4005, 4007, 2);
|
||||
AddHtmlLocalized(55, 80, 75, 20, 1011011); // CONTINUE
|
||||
|
||||
AddButton(135, 80, 4005, 4007, 1);
|
||||
AddHtmlLocalized(170, 80, 75, 20, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID != 2 || m_Pet.Deleted || !(m_Pet.Controlled && m_From == m_Pet.ControlMaster &&
|
||||
m_From.CheckAlive() && m_Pet.Map == m_From.Map && m_Pet.InRange(m_From, 14)))
|
||||
return;
|
||||
m_Pet.ControlTarget = null;
|
||||
m_Pet.ControlOrder = OrderType.Release;
|
||||
}
|
||||
}
|
||||
}
|
||||
86
Projects/Scripts/Gumps/DawnsMusicBoxGump.cs
Normal file
86
Projects/Scripts/Gumps/DawnsMusicBoxGump.cs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class DawnsMusicBoxGump : Gump
|
||||
{
|
||||
private 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);
|
||||
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
|
||||
AddHtmlLocalized(14, 12, 273, 20, 1075130, 0x7FFF); // 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);
|
||||
AddHtmlLocalized(44, y - 2, 213, 20, info.Name, 0x7FFF);
|
||||
}
|
||||
|
||||
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);
|
||||
AddHtmlLocalized(44, y - 2, 213, 20, 1075207, 0x7FFF); // Stop Song
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Box?.Deleted != false)
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
Projects/Scripts/Gumps/Go/ChildNode.cs
Normal file
38
Projects/Scripts/Gumps/Go/ChildNode.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using System.Xml;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ChildNode : IGoNode
|
||||
{
|
||||
public ChildNode(XmlTextReader xml, ParentNode parent)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
Parse(xml);
|
||||
}
|
||||
|
||||
public ParentNode Parent{ get; }
|
||||
|
||||
public string Name{ get; private set; }
|
||||
|
||||
public Point3D Location{ get; private set; }
|
||||
|
||||
private void Parse(XmlTextReader xml)
|
||||
{
|
||||
Name = xml.MoveToAttribute("name") ? xml.Value : "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);
|
||||
|
||||
Location = new Point3D(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
236
Projects/Scripts/Gumps/Go/GoGump.cs
Normal file
236
Projects/Scripts/Gumps/Go/GoGump.cs
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
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);
|
||||
|
||||
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 bool PrevLabel = false, 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 ParentNode m_Node;
|
||||
private int m_Page;
|
||||
|
||||
private LocationTree m_Tree;
|
||||
|
||||
private GoGump(int page, Mobile from, LocationTree tree, ParentNode node) : base(50, 50)
|
||||
{
|
||||
from.CloseGump<GoGump>();
|
||||
|
||||
tree.LastBranch[from] = node;
|
||||
|
||||
m_Page = page;
|
||||
m_Tree = tree;
|
||||
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);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
|
||||
AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight,
|
||||
OffsetGumpID);
|
||||
|
||||
if (OldStyle)
|
||||
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
||||
else
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (node.Parent != null)
|
||||
{
|
||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
|
||||
|
||||
if (PrevLabel)
|
||||
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
||||
}
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
int emptyWidth = TotalWidth - PrevWidth * 2 - NextWidth - OffsetSize * 5 -
|
||||
(OldStyle ? SetWidth + OffsetSize : 0);
|
||||
|
||||
if (!OldStyle)
|
||||
AddImageTiled(x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight,
|
||||
EntryGumpID);
|
||||
|
||||
AddHtml(x + TextOffsetX, y, emptyWidth - TextOffsetX, EntryHeight, $"<center>{node.Name}</center>");
|
||||
|
||||
x += emptyWidth + OffsetSize;
|
||||
|
||||
if (OldStyle)
|
||||
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
||||
else
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2);
|
||||
|
||||
if (PrevLabel)
|
||||
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
||||
}
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
if (!OldStyle)
|
||||
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if ((page + 1) * EntryCount < node.Children.Length)
|
||||
{
|
||||
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1);
|
||||
|
||||
if (NextLabel)
|
||||
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;
|
||||
|
||||
IGoNode child = node.Children[index];
|
||||
string name = child.Name;
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, name);
|
||||
|
||||
x += EntryWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
|
||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, index + 4);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
else
|
||||
tree = Tokuno;
|
||||
|
||||
if (!tree.LastBranch.TryGetValue(from, out ParentNode branch))
|
||||
branch = tree.Root;
|
||||
|
||||
if (branch != null)
|
||||
from.SendGump(new GoGump(0, from, tree, branch));
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if (m_Node.Parent != null)
|
||||
from.SendGump(new GoGump(0, from, m_Tree, m_Node.Parent));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (m_Page > 0)
|
||||
from.SendGump(new GoGump(m_Page - 1, from, m_Tree, m_Node));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
if ((m_Page + 1) * EntryCount < m_Node.Children.Length)
|
||||
from.SendGump(new GoGump(m_Page + 1, from, m_Tree, m_Node));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int index = info.ButtonID - 4;
|
||||
|
||||
if (index >= 0 && index < m_Node.Children.Length)
|
||||
{
|
||||
IGoNode o = m_Node.Children[index];
|
||||
|
||||
if (o is ParentNode node)
|
||||
from.SendGump(new GoGump(0, from, m_Tree, node));
|
||||
else
|
||||
from.MoveToWorld(((ChildNode)o).Location, m_Tree.Map);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Projects/Scripts/Gumps/Go/LocationTree.cs
Normal file
41
Projects/Scripts/Gumps/Go/LocationTree.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class LocationTree
|
||||
{
|
||||
public LocationTree(string fileName, Map map)
|
||||
{
|
||||
LastBranch = new Dictionary<Mobile, ParentNode>();
|
||||
Map = map;
|
||||
|
||||
string path = Path.Combine("Data/Locations/", fileName);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
XmlTextReader xml = new XmlTextReader(new StreamReader(path)) { WhitespaceHandling = WhitespaceHandling.None };
|
||||
|
||||
Root = Parse(xml);
|
||||
|
||||
xml.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<Mobile, ParentNode> LastBranch{ get; }
|
||||
|
||||
public Map Map{ get; }
|
||||
|
||||
public ParentNode Root{ get; }
|
||||
|
||||
private ParentNode Parse(XmlTextReader xml)
|
||||
{
|
||||
xml.Read();
|
||||
xml.Read();
|
||||
xml.Read();
|
||||
|
||||
return new ParentNode(xml, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Projects/Scripts/Gumps/Go/ParentNode.cs
Normal file
52
Projects/Scripts/Gumps/Go/ParentNode.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public interface IGoNode
|
||||
{
|
||||
ParentNode Parent{ get; }
|
||||
string Name{ get; }
|
||||
}
|
||||
|
||||
public class ParentNode : IGoNode
|
||||
{
|
||||
public ParentNode(XmlTextReader xml, ParentNode parent)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
Parse(xml);
|
||||
}
|
||||
|
||||
public ParentNode Parent{ get; }
|
||||
|
||||
public IGoNode[] Children{ get; private set; }
|
||||
|
||||
public string Name{ get; private set; }
|
||||
|
||||
private void Parse(XmlTextReader xml)
|
||||
{
|
||||
Name = xml.MoveToAttribute("name") ? xml.Value : "empty";
|
||||
|
||||
if (xml.IsEmptyElement)
|
||||
Children = new IGoNode[0];
|
||||
else
|
||||
{
|
||||
List<IGoNode> children = new List<IGoNode>();
|
||||
|
||||
while (xml.Read() && (xml.NodeType == XmlNodeType.Element || xml.NodeType == XmlNodeType.Comment))
|
||||
{
|
||||
if (xml.NodeType == XmlNodeType.Comment)
|
||||
continue;
|
||||
|
||||
if (xml.Name == "child")
|
||||
children.Add(new ChildNode(xml, this));
|
||||
else
|
||||
children.Add(new ParentNode(xml, this));
|
||||
}
|
||||
|
||||
Children = children.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Projects/Scripts/Gumps/Guilds/DeclareFealtyGump.cs
Normal file
50
Projects/Scripts/Gumps/Guilds/DeclareFealtyGump.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011097); // Declare your fealty
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 250, 35, 1011098); // I have selected my new lord.
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if (m?.Deleted == false)
|
||||
state.Mobile.GuildFealty = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
55
Projects/Scripts/Gumps/Guilds/GrantGuildTitleGump.cs
Normal file
55
Projects/Scripts/Gumps/Guilds/GrantGuildTitleGump.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011118); // Grant a title to another member.
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011127); // I dub thee...
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if (m?.Deleted == false)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1013074); // New title (20 characters max):
|
||||
m_Mobile.Prompt = new GuildTitlePrompt(m_Mobile, m, m_Guild);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
53
Projects/Scripts/Gumps/Guilds/GuildAbbrvPrompt.cs
Normal file
53
Projects/Scripts/Gumps/Guilds/GuildAbbrvPrompt.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using Server.Guilds;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildAbbrvPrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildAbbrvPrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if (text.Length > 3)
|
||||
text = text.Substring(0, 3);
|
||||
|
||||
if (text.Length > 0)
|
||||
{
|
||||
if (BaseGuild.FindByAbbrev(text) != null)
|
||||
{
|
||||
m_Mobile.SendMessage("{0} conflicts with the abbreviation of an existing guild.", text);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Abbreviation = text;
|
||||
m_Guild.GuildMessage(1018025, true, text); // Your guild abbreviation has changed:
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Projects/Scripts/Gumps/Guilds/GuildAcceptWarGump.cs
Normal file
65
Projects/Scripts/Gumps/Guilds/GuildAcceptWarGump.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011147); // Select the guild to accept the invitations:
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011100); // Accept war invitations.
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if (g != null)
|
||||
{
|
||||
m_Guild.WarInvitations.Remove(g);
|
||||
g.WarDeclarations.Remove(m_Guild);
|
||||
|
||||
m_Guild.AddEnemy(g);
|
||||
m_Guild.GuildMessage(1018020, true, "{0} ({1})", g.Name, g.Abbreviation);
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if (m_Guild.WarInvitations.Count > 0)
|
||||
m_Mobile.SendGump(new GuildAcceptWarGump(m_Mobile, m_Guild));
|
||||
else
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
131
Projects/Scripts/Gumps/Guilds/GuildAdminCandidatesGump.cs
Normal file
131
Projects/Scripts/Gumps/Guilds/GuildAdminCandidatesGump.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
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()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1013075); // Accept or Refuse candidates for membership
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1013076); // Accept
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1013077); // Refuse
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Accept
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if (m?.Deleted == false)
|
||||
{
|
||||
#region Factions
|
||||
|
||||
PlayerState guildState = PlayerState.Find(m_Guild.Leader);
|
||||
PlayerState targetState = PlayerState.Find(m);
|
||||
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
|
||||
if (guildFaction != targetFaction)
|
||||
{
|
||||
if (guildFaction == null)
|
||||
m_Mobile.SendLocalizedMessage(
|
||||
1013027); // That player cannot join a non-faction guild.
|
||||
else if (targetFaction == null)
|
||||
m_Mobile.SendLocalizedMessage(
|
||||
1013026); // That player must be in a faction before joining this guild.
|
||||
else
|
||||
m_Mobile.SendLocalizedMessage(
|
||||
1013028); // That person has a different faction affiliation.
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetState?.IsLeaving == true)
|
||||
{
|
||||
// OSI does this quite strangely, so we'll just do it this way
|
||||
m_Mobile.SendMessage(
|
||||
"That person is quitting their faction and so you may not recruit them.");
|
||||
break;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
m_Guild.Candidates.Remove(m);
|
||||
m_Guild.Accepted.Add(m);
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if (m_Guild.Candidates.Count > 0)
|
||||
m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild));
|
||||
else
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Refuse
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if (m?.Deleted == false)
|
||||
{
|
||||
m_Guild.Candidates.Remove(m);
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if (m_Guild.Candidates.Count > 0)
|
||||
m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild));
|
||||
else
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Projects/Scripts/Gumps/Guilds/GuildCandidatesGump.cs
Normal file
32
Projects/Scripts/Gumps/Guilds/GuildCandidatesGump.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 500, 35, 1013030); // <center> Candidates </center>
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
100
Projects/Scripts/Gumps/Guilds/GuildChangeTypeGump.cs
Normal file
100
Projects/Scripts/Gumps/Guilds/GuildChangeTypeGump.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using Server.Factions;
|
||||
using Server.Guilds;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildChangeTypeGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildChangeTypeGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Draggable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 400, 5054);
|
||||
AddBackground(10, 10, 530, 380, 3000);
|
||||
|
||||
AddHtmlLocalized(20, 15, 510, 30, 1013062); // <center>Change Guild Type Menu</center>
|
||||
|
||||
AddHtmlLocalized(50, 50, 450, 30, 1013066); // Please select the type of guild you would like to change to
|
||||
|
||||
AddButton(20, 100, 4005, 4007, 1);
|
||||
AddHtmlLocalized(85, 100, 300, 30, 1013063); // Standard guild
|
||||
|
||||
AddButton(20, 150, 4005, 4007, 2);
|
||||
AddItem(50, 143, 7109);
|
||||
AddHtmlLocalized(85, 150, 300, 300, 1013064); // Order guild
|
||||
|
||||
AddButton(20, 200, 4005, 4007, 3);
|
||||
AddItem(45, 200, 7107);
|
||||
AddHtmlLocalized(85, 200, 300, 300, 1013065); // Chaos guild
|
||||
|
||||
AddButton(300, 360, 4005, 4007, 4);
|
||||
AddHtmlLocalized(335, 360, 150, 30, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (Guild.NewGuildSystem && !BaseGuildGump.IsLeader(m_Mobile, m_Guild) ||
|
||||
!Guild.NewGuildSystem && GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildType newType;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
default:
|
||||
newType = m_Guild.Type;
|
||||
break;
|
||||
case 1:
|
||||
newType = GuildType.Regular;
|
||||
break;
|
||||
case 2:
|
||||
newType = GuildType.Order;
|
||||
break;
|
||||
case 3:
|
||||
newType = GuildType.Chaos;
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_Guild.Type != newType)
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(m_Mobile);
|
||||
|
||||
if (pl != null)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1010405); // You cannot change guild types while in a Faction!
|
||||
}
|
||||
else if (m_Guild.TypeLastChange.AddDays(7) > DateTime.UtcNow)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1011142); // You have already changed your guild type recently.
|
||||
// TODO: Clilocs 1011142-1011145 suggest a timer for pending changes
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Type = newType;
|
||||
m_Guild.GuildMessage(1018022, true, newType.ToString()); // Guild Message: Your guild type has changed:
|
||||
}
|
||||
}
|
||||
|
||||
if (Guild.NewGuildSystem)
|
||||
{
|
||||
if (m_Mobile is PlayerMobile mobile)
|
||||
mobile.SendGump(new GuildInfoGump(mobile, m_Guild));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
69
Projects/Scripts/Gumps/Guilds/GuildCharterGump.cs
Normal file
69
Projects/Scripts/Gumps/Guilds/GuildCharterGump.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildCharterGump : Gump
|
||||
{
|
||||
private const string DefaultWebsite = "https://github.com/runuo/";
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildCharterGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Draggable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 400, 5054);
|
||||
AddBackground(10, 10, 530, 380, 3000);
|
||||
|
||||
AddButton(20, 360, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 360, 300, 35, 1011120); // Return to the main menu.
|
||||
|
||||
string charter;
|
||||
|
||||
if ((charter = guild.Charter) == null || (charter = charter.Trim()).Length <= 0)
|
||||
AddHtmlLocalized(20, 20, 400, 35, 1013032); // No charter has been defined.
|
||||
else
|
||||
AddHtml(20, 20, 510, 75, charter, true, true);
|
||||
|
||||
AddButton(20, 200, 4005, 4007, 2);
|
||||
AddHtmlLocalized(55, 200, 300, 20, 1011122); // Visit the guild website :
|
||||
|
||||
string website;
|
||||
|
||||
if ((website = guild.Website) == null || (website = website.Trim()).Length <= 0)
|
||||
website = DefaultWebsite;
|
||||
|
||||
AddHtml(55, 220, 300, 20, website);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: return; // Close
|
||||
case 1: break; // Return to main menu
|
||||
case 2:
|
||||
{
|
||||
string website;
|
||||
|
||||
if ((website = m_Guild.Website) == null || (website = website.Trim()).Length <= 0)
|
||||
website = DefaultWebsite;
|
||||
|
||||
m_Mobile.LaunchBrowser(website);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
46
Projects/Scripts/Gumps/Guilds/GuildCharterPrompt.cs
Normal file
46
Projects/Scripts/Gumps/Guilds/GuildCharterPrompt.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using Server.Guilds;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildCharterPrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildCharterPrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if (text.Length > 50)
|
||||
text = text.Substring(0, 50);
|
||||
|
||||
if (text.Length > 0)
|
||||
m_Guild.Charter = text;
|
||||
|
||||
m_Mobile.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
|
||||
m_Mobile.Prompt = new GuildWebsitePrompt(m_Mobile, m_Guild);
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Projects/Scripts/Gumps/Guilds/GuildDeclarePeaceGump.cs
Normal file
63
Projects/Scripts/Gumps/Guilds/GuildDeclarePeaceGump.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011137); // Select the guild you wish to declare peace with.
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011138); // Send the olive branch.
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if (g != null)
|
||||
{
|
||||
m_Guild.RemoveEnemy(g);
|
||||
m_Guild.GuildMessage(1018018, true, "{0} ({1})", g.Name,
|
||||
g.Abbreviation); // Guild Message: You are now at peace with this guild:
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if (m_Guild.Enemies.Count > 0)
|
||||
m_Mobile.SendGump(new GuildDeclarePeaceGump(m_Mobile, m_Guild));
|
||||
else
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
89
Projects/Scripts/Gumps/Guilds/GuildDeclareWarGump.cs
Normal file
89
Projects/Scripts/Gumps/Guilds/GuildDeclareWarGump.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011065); // Select the guild you wish to declare war on.
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011068); // Send the challenge!
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if (g != null)
|
||||
{
|
||||
if (g == m_Guild)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501184); // You cannot declare war against yourself!
|
||||
}
|
||||
else if (g.WarInvitations.Contains(m_Guild) && m_Guild.WarDeclarations.Contains(g) ||
|
||||
m_Guild.IsWar(g))
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501183); // You are already at war with that guild.
|
||||
}
|
||||
else if (Faction.Find(m_Guild.Leader) != null)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1005288); // You cannot declare war while you are in a faction
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_Guild.WarDeclarations.Contains(g))
|
||||
{
|
||||
m_Guild.WarDeclarations.Add(g);
|
||||
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(m_Guild))
|
||||
{
|
||||
g.WarInvitations.Add(m_Guild);
|
||||
g.GuildMessage(1018021, true, "{0} ({1})", m_Guild.Name,
|
||||
m_Guild
|
||||
.Abbreviation); // Guild Message: Your guild has received an invitation to war:
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
56
Projects/Scripts/Gumps/Guilds/GuildDeclareWarPrompt.cs
Normal file
56
Projects/Scripts/Gumps/Guilds/GuildDeclareWarPrompt.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildDeclareWarPrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildDeclareWarPrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if (text.Length >= 3)
|
||||
{
|
||||
List<Guild> guilds = Utility.CastListCovariant<BaseGuild, Guild>(BaseGuild.Search(text));
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if (guilds.Count > 0)
|
||||
{
|
||||
m_Mobile.SendGump(new GuildDeclareWarGump(m_Mobile, m_Guild, guilds));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
||||
m_Mobile.SendLocalizedMessage(1018003); // No guilds found matching - try another name in the search
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.SendMessage("Search string must be at least three letters in length.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Projects/Scripts/Gumps/Guilds/GuildDismissGump.cs
Normal file
60
Projects/Scripts/Gumps/Guilds/GuildDismissGump.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011124); // Whom do you wish to dismiss?
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011125); // Kick them out!
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if (m?.Deleted == false)
|
||||
{
|
||||
m_Guild.RemoveMember(m);
|
||||
|
||||
if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Mobile == m_Guild.Leader)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2 && (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Mobile == m_Guild.Leader))
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
220
Projects/Scripts/Gumps/Guilds/GuildGump.cs
Normal file
220
Projects/Scripts/Gumps/Guilds/GuildGump.cs
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildGump(Mobile beholder, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = beholder;
|
||||
m_Guild = guild;
|
||||
|
||||
Draggable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 400, 5054);
|
||||
AddBackground(10, 10, 530, 380, 3000);
|
||||
|
||||
AddHtml(20, 15, 200, 35, guild.Name);
|
||||
|
||||
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)";
|
||||
|
||||
AddHtml(220, 15, 250, 35, leadTitle + leadName);
|
||||
}
|
||||
|
||||
AddButton(20, 50, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 50, 100, 20, 1013022); // Loyal to
|
||||
|
||||
Mobile fealty = beholder.GuildFealty;
|
||||
|
||||
if (fealty == null || !guild.IsMember(fealty))
|
||||
fealty = leader;
|
||||
|
||||
if (fealty == null)
|
||||
fealty = beholder;
|
||||
|
||||
string fealtyName;
|
||||
|
||||
if ((fealtyName = fealty.Name) == null || (fealtyName = fealtyName.Trim()).Length <= 0)
|
||||
fealtyName = "(empty)";
|
||||
|
||||
if (beholder == fealty)
|
||||
AddHtmlLocalized(55, 70, 470, 20, 1018002); // yourself
|
||||
else
|
||||
AddHtml(55, 70, 470, 20, fealtyName);
|
||||
|
||||
AddButton(215, 50, 4005, 4007, 2);
|
||||
AddHtmlLocalized(250, 50, 170, 20, 1013023); // Display guild abbreviation
|
||||
AddHtmlLocalized(250, 70, 50, 20, beholder.DisplayGuildTitle ? 1011262 : 1011263); // on/off
|
||||
|
||||
AddButton(20, 100, 4005, 4007, 3);
|
||||
AddHtmlLocalized(55, 100, 470, 30, 1011086); // View the current roster.
|
||||
|
||||
AddButton(20, 130, 4005, 4007, 4);
|
||||
AddHtmlLocalized(55, 130, 470, 30, 1011085); // Recruit someone into the guild.
|
||||
|
||||
if (guild.Candidates.Count > 0)
|
||||
{
|
||||
AddButton(20, 160, 4005, 4007, 5);
|
||||
AddHtmlLocalized(55, 160, 470, 30, 1011093); // View list of candidates who have been sponsored to the guild.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage(20, 160, 4020);
|
||||
AddHtmlLocalized(55, 160, 470, 30, 1013031); // There are currently no candidates for membership.
|
||||
}
|
||||
|
||||
AddButton(20, 220, 4005, 4007, 6);
|
||||
AddHtmlLocalized(55, 220, 470, 30, 1011087); // View the guild's charter.
|
||||
|
||||
AddButton(20, 250, 4005, 4007, 7);
|
||||
AddHtmlLocalized(55, 250, 470, 30, 1011092); // Resign from the guild.
|
||||
|
||||
AddButton(20, 280, 4005, 4007, 8);
|
||||
AddHtmlLocalized(55, 280, 470, 30, 1011095); // View list of guilds you are at war with.
|
||||
|
||||
if (beholder.AccessLevel >= AccessLevel.GameMaster || beholder == leader)
|
||||
{
|
||||
AddButton(20, 310, 4005, 4007, 9);
|
||||
AddHtmlLocalized(55, 310, 470, 30, 1011094); // Access guildmaster functions.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage(20, 310, 4020);
|
||||
AddHtmlLocalized(55, 310, 470, 30, 1018013); // Reserved for guildmaster
|
||||
}
|
||||
|
||||
AddButton(20, 360, 4005, 4007, 0);
|
||||
AddHtmlLocalized(55, 360, 470, 30, 1011441); // EXIT
|
||||
}
|
||||
|
||||
public static void EnsureClosed(Mobile m)
|
||||
{
|
||||
m.CloseGump<DeclareFealtyGump>();
|
||||
m.CloseGump<GrantGuildTitleGump>();
|
||||
m.CloseGump<GuildAdminCandidatesGump>();
|
||||
m.CloseGump<GuildCandidatesGump>();
|
||||
m.CloseGump<GuildChangeTypeGump>();
|
||||
m.CloseGump<GuildCharterGump>();
|
||||
m.CloseGump<GuildDismissGump>();
|
||||
m.CloseGump<GuildGump>();
|
||||
m.CloseGump<GuildmasterGump>();
|
||||
m.CloseGump<GuildRosterGump>();
|
||||
m.CloseGump<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?.Deleted != false || !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?.Deleted != false || !m.InRange(stone.GetWorldLocation(), 2);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Loyalty
|
||||
{
|
||||
EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new DeclareFealtyGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Toggle display abbreviation
|
||||
{
|
||||
m_Mobile.DisplayGuildTitle = !m_Mobile.DisplayGuildTitle;
|
||||
|
||||
EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // View the current roster
|
||||
{
|
||||
EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildRosterGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Recruit
|
||||
{
|
||||
m_Mobile.Target = new GuildRecruitTarget(m_Mobile, m_Guild);
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: // Membership candidates
|
||||
{
|
||||
EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildCandidatesGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: // View charter
|
||||
{
|
||||
EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildCharterGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 7: // Resign
|
||||
{
|
||||
m_Guild.RemoveMember(m_Mobile);
|
||||
|
||||
break;
|
||||
}
|
||||
case 8: // View wars
|
||||
{
|
||||
EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildWarGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 9: // Guildmaster functions
|
||||
{
|
||||
if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Guild.Leader == m_Mobile)
|
||||
{
|
||||
EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
64
Projects/Scripts/Gumps/Guilds/GuildListGump.cs
Normal file
64
Projects/Scripts/Gumps/Guilds/GuildListGump.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public abstract class GuildListGump : Gump
|
||||
{
|
||||
protected Guild m_Guild;
|
||||
protected List<Guild> m_List;
|
||||
protected Mobile m_Mobile;
|
||||
|
||||
public GuildListGump(Mobile from, Guild guild, bool radio, List<Guild> list) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Draggable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
Design();
|
||||
|
||||
m_List = new List<Guild>(list);
|
||||
|
||||
for (int i = 0; i < m_List.Count; ++i)
|
||||
{
|
||||
if (i % 11 == 0)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
||||
AddHtmlLocalized(335, 370, 300, 35, 1011066); // Next page
|
||||
}
|
||||
|
||||
AddPage(i / 11 + 1);
|
||||
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
||||
AddHtmlLocalized(55, 370, 300, 35, 1011067); // Previous page
|
||||
}
|
||||
}
|
||||
|
||||
if (radio)
|
||||
AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
||||
|
||||
Guild g = m_List[i];
|
||||
|
||||
string name;
|
||||
|
||||
if ((name = g.Name) != null && (name = name.Trim()).Length <= 0)
|
||||
name = "(empty)";
|
||||
|
||||
AddLabel(radio ? 55 : 20, 35 + i % 11 * 30, 0, name);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Design()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Projects/Scripts/Gumps/Guilds/GuildMobileListGump.cs
Normal file
65
Projects/Scripts/Gumps/Guilds/GuildMobileListGump.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public abstract class GuildMobileListGump : Gump
|
||||
{
|
||||
protected Guild m_Guild;
|
||||
protected List<Mobile> m_List;
|
||||
protected Mobile m_Mobile;
|
||||
|
||||
public GuildMobileListGump(Mobile from, Guild guild, bool radio, List<Mobile> list)
|
||||
: base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Draggable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
Design();
|
||||
|
||||
m_List = new List<Mobile>(list);
|
||||
|
||||
for (int i = 0; i < m_List.Count; ++i)
|
||||
{
|
||||
if (i % 11 == 0)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
||||
AddHtmlLocalized(335, 370, 300, 35, 1011066); // Next page
|
||||
}
|
||||
|
||||
AddPage(i / 11 + 1);
|
||||
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
||||
AddHtmlLocalized(55, 370, 300, 35, 1011067); // Previous page
|
||||
}
|
||||
}
|
||||
|
||||
if (radio)
|
||||
AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
||||
|
||||
Mobile m = m_List[i];
|
||||
|
||||
string name;
|
||||
|
||||
if ((name = m.Name) != null && (name = name.Trim()).Length <= 0)
|
||||
name = "(empty)";
|
||||
|
||||
AddLabel(radio ? 55 : 20, 35 + i % 11 * 30, 0, name);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Design()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
53
Projects/Scripts/Gumps/Guilds/GuildNamePrompt.cs
Normal file
53
Projects/Scripts/Gumps/Guilds/GuildNamePrompt.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using Server.Guilds;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildNamePrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildNamePrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if (text.Length > 40)
|
||||
text = text.Substring(0, 40);
|
||||
|
||||
if (text.Length > 0)
|
||||
{
|
||||
if (BaseGuild.FindByName(text) != null)
|
||||
{
|
||||
m_Mobile.SendMessage("{0} conflicts with the name of an existing guild.", text);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Name = text;
|
||||
m_Guild.GuildMessage(1018024, true, text); // The name of your guild has changed:
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
62
Projects/Scripts/Gumps/Guilds/GuildRejectWarGump.cs
Normal file
62
Projects/Scripts/Gumps/Guilds/GuildRejectWarGump.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011148); // Select the guild to reject their invitations:
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011101); // Reject war invitations.
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if (g != null)
|
||||
{
|
||||
m_Guild.WarInvitations.Remove(g);
|
||||
g.WarDeclarations.Remove(m_Guild);
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if (m_Guild.WarInvitations.Count > 0)
|
||||
m_Mobile.SendGump(new GuildRejectWarGump(m_Mobile, m_Guild));
|
||||
else
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
62
Projects/Scripts/Gumps/Guilds/GuildRescindDeclarationGump.cs
Normal file
62
Projects/Scripts/Gumps/Guilds/GuildRescindDeclarationGump.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011150); // Select the guild to rescind our invitations:
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011102); // Rescind your war declarations.
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if (g != null)
|
||||
{
|
||||
m_Guild.WarDeclarations.Remove(g);
|
||||
g.WarInvitations.Remove(m_Guild);
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if (m_Guild.WarDeclarations.Count > 0)
|
||||
m_Mobile.SendGump(new GuildRescindDeclarationGump(m_Mobile, m_Guild));
|
||||
else
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Projects/Scripts/Gumps/Guilds/GuildRosterGump.cs
Normal file
32
Projects/Scripts/Gumps/Guilds/GuildRosterGump.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtml(20, 10, 500, 35, $"<center>{m_Guild.Name}</center>");
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
Projects/Scripts/Gumps/Guilds/GuildTitlePrompt.cs
Normal file
48
Projects/Scripts/Gumps/Guilds/GuildTitlePrompt.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
using Server.Guilds;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildTitlePrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Leader, m_Target;
|
||||
|
||||
public GuildTitlePrompt(Mobile leader, Mobile target, Guild g)
|
||||
{
|
||||
m_Leader = leader;
|
||||
m_Target = target;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Leader, m_Guild))
|
||||
return;
|
||||
if (m_Target.Deleted || !m_Guild.IsMember(m_Target))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Leader);
|
||||
m_Leader.SendGump(new GuildmasterGump(m_Leader, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Leader, m_Guild))
|
||||
return;
|
||||
if (m_Target.Deleted || !m_Guild.IsMember(m_Target))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if (text.Length > 20)
|
||||
text = text.Substring(0, 20);
|
||||
|
||||
if (text.Length > 0)
|
||||
m_Target.GuildTitle = text;
|
||||
|
||||
GuildGump.EnsureClosed(m_Leader);
|
||||
m_Leader.SendGump(new GuildmasterGump(m_Leader, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
118
Projects/Scripts/Gumps/Guilds/GuildWarAdminGump.cs
Normal file
118
Projects/Scripts/Gumps/Guilds/GuildWarAdminGump.cs
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildWarAdminGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildWarAdminGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Draggable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
AddHtmlLocalized(20, 10, 510, 35, 1011105); // <center>WAR FUNCTIONS</center>
|
||||
|
||||
AddButton(20, 40, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 40, 400, 30, 1011099); // Declare war through guild name search.
|
||||
|
||||
int count = 0;
|
||||
|
||||
if (guild.Enemies.Count > 0)
|
||||
{
|
||||
AddButton(20, 160 + count * 30, 4005, 4007, 2);
|
||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011103); // Declare peace.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1013033); // No current wars
|
||||
}
|
||||
|
||||
if (guild.WarInvitations.Count > 0)
|
||||
{
|
||||
AddButton(20, 160 + count * 30, 4005, 4007, 3);
|
||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011100); // Accept war invitations.
|
||||
|
||||
AddButton(20, 160 + count * 30, 4005, 4007, 4);
|
||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011101); // Reject war invitations.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1018012); // No current invitations received for war.
|
||||
}
|
||||
|
||||
if (guild.WarDeclarations.Count > 0)
|
||||
{
|
||||
AddButton(20, 160 + count * 30, 4005, 4007, 5);
|
||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011102); // Rescind your war declarations.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1013055); // No current war declarations
|
||||
}
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 6);
|
||||
AddHtmlLocalized(55, 400, 400, 35, 1011104); // Return to the previous menu.
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Declare war
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1018001); // Declare war through search - Enter Guild Name:
|
||||
m_Mobile.Prompt = new GuildDeclareWarPrompt(m_Mobile, m_Guild);
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Declare peace
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildDeclarePeaceGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Accept war
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildAcceptWarGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Reject war
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildRejectWarGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: // Rescind declarations
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildRescindDeclarationGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: // Return
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
101
Projects/Scripts/Gumps/Guilds/GuildWarGump.cs
Normal file
101
Projects/Scripts/Gumps/Guilds/GuildWarGump.cs
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildWarGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildWarGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Draggable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
AddHtmlLocalized(20, 10, 500, 35, 1011133); // <center>WARFARE STATUS</center>
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
||||
|
||||
AddPage(1);
|
||||
|
||||
AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 2);
|
||||
AddHtmlLocalized(410, 373, 100, 25, 1011066); // Next page
|
||||
|
||||
AddHtmlLocalized(20, 45, 400, 20, 1011134); // We are at war with:
|
||||
|
||||
List<Guild> enemies = guild.Enemies;
|
||||
|
||||
if (enemies.Count == 0)
|
||||
AddHtmlLocalized(20, 65, 400, 20, 1013033); // No current wars
|
||||
else
|
||||
for (int i = 0; i < enemies.Count; ++i)
|
||||
{
|
||||
Guild g = enemies[i];
|
||||
|
||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name);
|
||||
}
|
||||
|
||||
AddPage(2);
|
||||
|
||||
AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 3);
|
||||
AddHtmlLocalized(410, 373, 100, 25, 1011066); // Next page
|
||||
|
||||
AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 1);
|
||||
AddHtmlLocalized(65, 373, 150, 25, 1011067); // Previous page
|
||||
|
||||
AddHtmlLocalized(20, 45, 400, 20, 1011136); // Guilds that we have declared war on:
|
||||
|
||||
List<Guild> declared = guild.WarDeclarations;
|
||||
|
||||
if (declared.Count == 0)
|
||||
AddHtmlLocalized(20, 65, 400, 20, 1018012); // No current invitations received for war.
|
||||
else
|
||||
for (int i = 0; i < declared.Count; ++i)
|
||||
{
|
||||
Guild g = declared[i];
|
||||
|
||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name);
|
||||
}
|
||||
|
||||
AddPage(3);
|
||||
|
||||
AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 2);
|
||||
AddHtmlLocalized(65, 373, 150, 25, 1011067); // Previous page
|
||||
|
||||
AddHtmlLocalized(20, 45, 400, 20, 1011135); // Guilds that have declared war on us:
|
||||
|
||||
List<Guild> invites = guild.WarInvitations;
|
||||
|
||||
if (invites.Count == 0)
|
||||
AddHtmlLocalized(20, 65, 400, 20, 1013055); // No current war declarations
|
||||
else
|
||||
for (int i = 0; i < invites.Count; ++i)
|
||||
{
|
||||
Guild g = invites[i];
|
||||
|
||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
43
Projects/Scripts/Gumps/Guilds/GuildWebsitePrompt.cs
Normal file
43
Projects/Scripts/Gumps/Guilds/GuildWebsitePrompt.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using Server.Guilds;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildWebsitePrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildWebsitePrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if (text.Length > 50)
|
||||
text = text.Substring(0, 50);
|
||||
|
||||
if (text.Length > 0)
|
||||
m_Guild.Website = text;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
188
Projects/Scripts/Gumps/Guilds/GuildmasterGump.cs
Normal file
188
Projects/Scripts/Gumps/Guilds/GuildmasterGump.cs
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
using Server.Guilds;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildmasterGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildmasterGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Draggable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 400, 5054);
|
||||
AddBackground(10, 10, 530, 380, 3000);
|
||||
|
||||
AddHtmlLocalized(20, 15, 510, 35, 1011121); // <center>GUILDMASTER FUNCTIONS</center>
|
||||
|
||||
AddButton(20, 40, 4005, 4007, 2);
|
||||
AddHtmlLocalized(55, 40, 470, 30, 1011107); // Set the guild name.
|
||||
|
||||
AddButton(20, 70, 4005, 4007, 3);
|
||||
AddHtmlLocalized(55, 70, 470, 30, 1011109); // Set the guild's abbreviation.
|
||||
|
||||
if (Guild.OrderChaos)
|
||||
{
|
||||
AddButton(20, 100, 4005, 4007, 4);
|
||||
|
||||
switch (m_Guild.Type)
|
||||
{
|
||||
case GuildType.Regular:
|
||||
AddHtmlLocalized(55, 100, 470, 30, 1013059); // Change guild type: Currently Standard
|
||||
break;
|
||||
case GuildType.Order:
|
||||
AddHtmlLocalized(55, 100, 470, 30, 1013057); // Change guild type: Currently Order
|
||||
break;
|
||||
case GuildType.Chaos:
|
||||
AddHtmlLocalized(55, 100, 470, 30, 1013058); // Change guild type: Currently Chaos
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(20, 130, 4005, 4007, 5);
|
||||
AddHtmlLocalized(55, 130, 470, 30, 1011112); // Set the guild's charter.
|
||||
|
||||
AddButton(20, 160, 4005, 4007, 6);
|
||||
AddHtmlLocalized(55, 160, 470, 30, 1011113); // Dismiss a member.
|
||||
|
||||
AddButton(20, 190, 4005, 4007, 7);
|
||||
AddHtmlLocalized(55, 190, 470, 30, 1011114); // Go to the WAR menu.
|
||||
|
||||
if (m_Guild.Candidates.Count > 0)
|
||||
{
|
||||
AddButton(20, 220, 4005, 4007, 8);
|
||||
AddHtmlLocalized(55, 220, 470, 30, 1013056); // Administer the list of candidates
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage(20, 220, 4020);
|
||||
AddHtmlLocalized(55, 220, 470, 30, 1013031); // There are currently no candidates for membership.
|
||||
}
|
||||
|
||||
AddButton(20, 250, 4005, 4007, 9);
|
||||
AddHtmlLocalized(55, 250, 470, 30, 1011117); // Set the guildmaster's title.
|
||||
|
||||
AddButton(20, 280, 4005, 4007, 10);
|
||||
AddHtmlLocalized(55, 280, 470, 30, 1011118); // Grant a title to another member.
|
||||
|
||||
AddButton(20, 310, 4005, 4007, 11);
|
||||
AddHtmlLocalized(55, 310, 470, 30, 1011119); // Move this guildstone.
|
||||
|
||||
AddButton(20, 360, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 360, 245, 30, 1011120); // Return to the main menu.
|
||||
|
||||
AddButton(300, 360, 4005, 4007, 0);
|
||||
AddHtmlLocalized(335, 360, 100, 30, 1011441); // EXIT
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Main menu
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Set guild name
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1013060); // Enter new guild name (40 characters max):
|
||||
m_Mobile.Prompt = new GuildNamePrompt(m_Mobile, m_Guild);
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Set guild abbreviation
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1013061); // Enter new guild abbreviation (3 characters max):
|
||||
m_Mobile.Prompt = new GuildAbbrvPrompt(m_Mobile, m_Guild);
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Change guild type
|
||||
{
|
||||
if (!Guild.OrderChaos)
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildChangeTypeGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: // Set charter
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
|
||||
m_Mobile.Prompt = new GuildCharterPrompt(m_Mobile, m_Guild);
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: // Dismiss member
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildDismissGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 7: // War menu
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 8: // Administer candidates
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 9: // Set guildmaster's title
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1013073); // Enter new guildmaster title (20 characters max):
|
||||
m_Mobile.Prompt = new GuildTitlePrompt(m_Mobile, m_Mobile, m_Guild);
|
||||
|
||||
break;
|
||||
}
|
||||
case 10: // Grant title
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GrantGuildTitleGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
case 11: // Move guildstone
|
||||
{
|
||||
if (m_Guild.Guildstone != null)
|
||||
{
|
||||
GuildTeleporter item = new GuildTeleporter(m_Guild.Guildstone);
|
||||
|
||||
m_Guild.Teleporter?.Delete();
|
||||
|
||||
m_Mobile.SendLocalizedMessage(
|
||||
501133); // Use the teleporting object placed in your backpack to move this guildstone.
|
||||
|
||||
m_Mobile.AddToBackpack(item);
|
||||
m_Guild.Teleporter = item;
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public delegate void SearchSelectionCallback(GuildDisplayType display);
|
||||
|
||||
public class GuildAdvancedSearchGump : BaseGuildGump
|
||||
{
|
||||
private SearchSelectionCallback m_Callback;
|
||||
private GuildDisplayType m_Display;
|
||||
|
||||
public GuildAdvancedSearchGump(PlayerMobile pm, Guild g, GuildDisplayType display, SearchSelectionCallback callback)
|
||||
: base(pm, g)
|
||||
{
|
||||
m_Callback = callback;
|
||||
m_Display = display;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
|
||||
AddHtmlLocalized(431, 43, 110, 26, 1062978, 0xF); // Diplomacy
|
||||
|
||||
AddHtmlLocalized(65, 80, 480, 26, 1063124, 0xF, true); // <i>Advanced Search Options</i>
|
||||
|
||||
AddHtmlLocalized(65, 110, 480, 26, 1063136 + (int)m_Display, 0xF); // Showing All Guilds/w/Relation/Waiting Relation
|
||||
|
||||
AddGroup(1);
|
||||
AddRadio(75, 140, 0xD2, 0xD3, false, 2);
|
||||
AddHtmlLocalized(105, 140, 200, 26, 1063006, 0x0); // Show Guilds with Relationship
|
||||
AddRadio(75, 170, 0xD2, 0xD3, false, 1);
|
||||
AddHtmlLocalized(105, 170, 200, 26, 1063005, 0x0); // Show Guilds Awaiting Action
|
||||
AddRadio(75, 200, 0xD2, 0xD3, false, 0);
|
||||
AddHtmlLocalized(105, 200, 200, 26, 1063007, 0x0); // Show All Guilds
|
||||
|
||||
AddBackground(450, 370, 100, 26, 0x2486);
|
||||
AddButton(455, 375, 0x845, 0x846, 5);
|
||||
AddHtmlLocalized(480, 373, 60, 26, 1006044, 0x0); // OK
|
||||
AddBackground(340, 370, 100, 26, 0x2486);
|
||||
AddButton(345, 375, 0x845, 0x846, 0);
|
||||
AddHtmlLocalized(370, 373, 60, 26, 1006045, 0x0); // Cancel
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
GuildDisplayType display = m_Display;
|
||||
|
||||
if (info.ButtonID == 5)
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (info.IsSwitched(i))
|
||||
{
|
||||
display = (GuildDisplayType)i;
|
||||
m_Callback(display);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
131
Projects/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs
Normal file
131
Projects/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
using Server.Gumps;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public abstract class BaseGuildGump : Gump
|
||||
{
|
||||
public BaseGuildGump(PlayerMobile pm, Guild g, int x = 10, int y = 10) : base(x, y)
|
||||
{
|
||||
guild = g;
|
||||
player = pm;
|
||||
|
||||
pm.CloseGump<BaseGuildGump>();
|
||||
}
|
||||
|
||||
protected Guild guild{ get; }
|
||||
|
||||
protected PlayerMobile player{ get; }
|
||||
|
||||
//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()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 600, 440, 0x24AE);
|
||||
AddBackground(66, 40, 150, 26, 0x2486);
|
||||
AddButton(71, 45, 0x845, 0x846, 1);
|
||||
AddHtmlLocalized(96, 43, 110, 26, 1063014, 0x0); // My Guild
|
||||
AddBackground(236, 40, 150, 26, 0x2486);
|
||||
AddButton(241, 45, 0x845, 0x846, 2);
|
||||
AddHtmlLocalized(266, 43, 110, 26, 1062974, 0x0); // Guild Roster
|
||||
AddBackground(401, 40, 150, 26, 0x2486);
|
||||
AddButton(406, 45, 0x845, 0x846, 3);
|
||||
AddHtmlLocalized(431, 43, 110, 26, 1062978, 0x0); // Diplomacy
|
||||
AddPage(1);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if (!IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
pm.SendGump(new GuildInfoGump(pm, guild));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
pm.SendGump(new GuildRosterGump(pm, guild));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
pm.SendGump(new GuildDiplomacyGump(pm, guild));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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, int maxLength = 50)
|
||||
{
|
||||
//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 void AddHtmlText(int x, int y, int width, int height, TextDefinition text, bool back, bool scroll)
|
||||
{
|
||||
if (text?.Number > 0)
|
||||
AddHtmlLocalized(x, y, width, height, text.Number, back, scroll);
|
||||
else if (text?.String != null)
|
||||
AddHtml(x, y, width, height, text.String, back, scroll);
|
||||
}
|
||||
|
||||
public static string Color(string text, int color)
|
||||
{
|
||||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public abstract class BaseGuildListGump<T> : BaseGuildGump
|
||||
{
|
||||
private const int itemsPerPage = 8;
|
||||
private bool m_Ascending;
|
||||
private IComparer<T> m_Comparer;
|
||||
private InfoField<T>[] m_Fields;
|
||||
private string m_Filter;
|
||||
private List<T> m_List;
|
||||
private 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)
|
||||
{
|
||||
m_Filter = filter.Trim();
|
||||
|
||||
m_Comparer = currentComparer;
|
||||
m_Fields = fields;
|
||||
m_Ascending = ascending;
|
||||
m_StartNumber = startNumber;
|
||||
m_List = list;
|
||||
}
|
||||
|
||||
public virtual bool WillFilter => m_Filter.Length >= 0;
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
|
||||
List<T> list = m_List;
|
||||
if (WillFilter)
|
||||
{
|
||||
m_List = new List<T>();
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
if (!IsFiltered(list[i], m_Filter))
|
||||
m_List.Add(list[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_List = new List<T>(list);
|
||||
}
|
||||
|
||||
m_List.Sort(m_Comparer);
|
||||
m_StartNumber = Math.Max(Math.Min(m_StartNumber, m_List.Count - 1), 0);
|
||||
|
||||
|
||||
AddBackground(130, 75, 385, 30, 0xBB8);
|
||||
AddTextEntry(135, 80, 375, 30, 0x481, 1, m_Filter);
|
||||
AddButton(520, 75, 0x867, 0x868, 5); //Filter Button
|
||||
|
||||
int width = 0;
|
||||
for (int i = 0; i < m_Fields.Length; i++)
|
||||
{
|
||||
InfoField<T> f = m_Fields[i];
|
||||
|
||||
AddImageTiled(65 + width, 110, f.Width + 10, 26, 0xA40);
|
||||
AddImageTiled(67 + width, 112, f.Width + 6, 22, 0xBBC);
|
||||
AddHtmlText(70 + width, 113, f.Width, 20, f.Name, false, false);
|
||||
|
||||
bool isComparer = m_Fields[i].Comparer.GetType() == m_Comparer.GetType();
|
||||
|
||||
int ButtonID = isComparer ? m_Ascending ? 0x983 : 0x985 : 0x2716;
|
||||
|
||||
AddButton(59 + width + f.Width, 117, ButtonID, ButtonID + (isComparer ? 1 : 0), 100 + i);
|
||||
|
||||
width += f.Width + 12;
|
||||
}
|
||||
|
||||
if (m_StartNumber <= 0)
|
||||
AddButton(65, 80, 0x15E3, 0x15E7, 0, GumpButtonType.Page);
|
||||
else
|
||||
AddButton(65, 80, 0x15E3, 0x15E7, 6); // Back
|
||||
|
||||
if (m_StartNumber + itemsPerPage > m_List.Count)
|
||||
AddButton(95, 80, 0x15E1, 0x15E5, 0, GumpButtonType.Page);
|
||||
else
|
||||
AddButton(95, 80, 0x15E1, 0x15E5, 7); // Forward
|
||||
|
||||
|
||||
int itemNumber = 0;
|
||||
|
||||
if (m_Ascending)
|
||||
for (int i = m_StartNumber; i < m_StartNumber + itemsPerPage && i < m_List.Count; i++)
|
||||
DrawEntry(m_List[i], i, itemNumber++);
|
||||
else //descending, go from bottom of list to the top
|
||||
for (int i = m_List.Count - 1 - m_StartNumber;
|
||||
i >= 0 && i >= m_List.Count - itemsPerPage - m_StartNumber;
|
||||
i--)
|
||||
DrawEntry(m_List[i], i, itemNumber++);
|
||||
|
||||
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 < m_Fields.Length; j++)
|
||||
{
|
||||
InfoField<T> f = m_Fields[j];
|
||||
|
||||
AddImageTiled(65 + width, 138 + itemNumber * 28, f.Width + 10, 26, 0xA40);
|
||||
AddImageTiled(67 + width, 140 + itemNumber * 28, f.Width + 6, 22, 0xBBC);
|
||||
AddHtmlText(70 + width, 141 + itemNumber * 28, f.Width, 20, GetValuesFor(o, m_Fields.Length)[j], false,
|
||||
false);
|
||||
|
||||
width += f.Width + 12;
|
||||
}
|
||||
|
||||
if (HasRelationship(o))
|
||||
AddButton(40, 143 + itemNumber * 28, 0x8AF, 0x8AF, 200 + index); //Info Button
|
||||
else
|
||||
AddButton(40, 143 + itemNumber * 28, 0x4B9, 0x4BA, 200 + index); //Info Button
|
||||
}
|
||||
|
||||
protected abstract TextDefinition[] GetValuesFor(T o, int aryLength);
|
||||
protected abstract bool IsFiltered(T o, string filter);
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
int id = info.ButtonID;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 5: //Filter
|
||||
{
|
||||
TextRelay t = info.GetTextEntry(1);
|
||||
pm.SendGump(GetResentGump(player, guild, m_Comparer, m_Ascending, t == null ? "" : t.Text, 0));
|
||||
break;
|
||||
}
|
||||
case 6: //Back
|
||||
{
|
||||
pm.SendGump(
|
||||
GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber - itemsPerPage));
|
||||
break;
|
||||
}
|
||||
case 7: //Forward
|
||||
{
|
||||
pm.SendGump(
|
||||
GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber + itemsPerPage));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (id >= 100 && id < 100 + m_Fields.Length)
|
||||
{
|
||||
IComparer<T> comparer = m_Fields[id - 100].Comparer;
|
||||
|
||||
if (m_Comparer.GetType() == comparer.GetType())
|
||||
m_Ascending = !m_Ascending;
|
||||
|
||||
pm.SendGump(GetResentGump(player, guild, comparer, m_Ascending, m_Filter, 0));
|
||||
}
|
||||
else if (id >= 200 && id < 200 + m_List.Count)
|
||||
{
|
||||
pm.SendGump(GetObjectInfoGump(player, guild, 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()
|
||||
{
|
||||
player.SendGump(GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber));
|
||||
}
|
||||
}
|
||||
|
||||
public struct InfoField<T>
|
||||
{
|
||||
public TextDefinition Name{ get; }
|
||||
|
||||
public int Width{ get; }
|
||||
|
||||
public IComparer<T> Comparer{ get; }
|
||||
|
||||
public InfoField(TextDefinition name, int width, IComparer<T> comparer)
|
||||
{
|
||||
Name = name;
|
||||
Width = width;
|
||||
Comparer = comparer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class CreateGuildGump : Gump
|
||||
{
|
||||
public CreateGuildGump(PlayerMobile pm, string guildName = "Guild Name", string guildAbbrev = "") : base(10, 10)
|
||||
{
|
||||
pm.CloseGump<CreateGuildGump>();
|
||||
pm.CloseGump<BaseGuildGump>();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 500, 300, 0x2422);
|
||||
AddHtmlLocalized(25, 20, 450, 25, 1062939, 0x0, true); // <center>GUILD MENU</center>
|
||||
AddHtmlLocalized(25, 60, 450, 60, 1062940, 0x0); // 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.
|
||||
AddHtmlLocalized(25, 135, 120, 25, 1062941, 0x0); // Registration Fee:
|
||||
AddLabel(155, 135, 0x481, Guild.RegistrationFee.ToString());
|
||||
AddHtmlLocalized(25, 165, 120, 25, 1011140, 0x0); // Enter Guild Name:
|
||||
AddBackground(155, 160, 320, 26, 0xBB8);
|
||||
AddTextEntry(160, 163, 315, 21, 0x481, 5, guildName);
|
||||
AddHtmlLocalized(25, 191, 120, 26, 1063035, 0x0); // Abbreviation:
|
||||
AddBackground(155, 186, 320, 26, 0xBB8);
|
||||
AddTextEntry(160, 189, 315, 21, 0x481, 6, guildAbbrev);
|
||||
AddButton(415, 217, 0xF7, 0xF8, 1);
|
||||
AddButton(345, 217, 0xF2, 0xF1, 0);
|
||||
|
||||
if (pm.AcceptGuildInvites)
|
||||
AddButton(20, 260, 0xD2, 0xD3, 2);
|
||||
else
|
||||
AddButton(20, 260, 0xD3, 0xD2, 2);
|
||||
|
||||
AddHtmlLocalized(45, 260, 200, 30, 1062943, 0x0); // <i>Ignore Guild Invites</i>
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (!(sender.Mobile is PlayerMobile pm) || 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 (BaseGuild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev))
|
||||
{
|
||||
pm.SendLocalizedMessage(501153); // That abbreviation is not available.
|
||||
}
|
||||
else if (BaseGuild.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
293
Projects/Scripts/Gumps/Guilds/New Guild System/DiplomacyGump.cs
Normal file
293
Projects/Scripts/Gumps/Guilds/New Guild System/DiplomacyGump.cs
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
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>
|
||||
{
|
||||
private GuildDisplayType m_Display;
|
||||
private TextDefinition m_LowerText;
|
||||
|
||||
public GuildDiplomacyGump(PlayerMobile pm, Guild g)
|
||||
: this(pm, g, NameComparer.Instance, true, "", 0, GuildDisplayType.All,
|
||||
Utility.CastListCovariant<BaseGuild, Guild>(new List<BaseGuild>(BaseGuild.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.CastListCovariant<BaseGuild, Guild>(new List<BaseGuild>(BaseGuild.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, 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[]
|
||||
{
|
||||
new InfoField<Guild>(1062954, 280, NameComparer.Instance), //Guild Name
|
||||
new InfoField<Guild>(1062957, 50, AbbrevComparer.Instance), //Abbrev
|
||||
new InfoField<Guild>(1062958, 120, new StatusComparer(g)) //Guild Title
|
||||
})
|
||||
{
|
||||
m_Display = display;
|
||||
m_LowerText = lowerText;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
protected virtual bool AllowAdvancedSearch => true;
|
||||
|
||||
public override bool WillFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Display == GuildDisplayType.All)
|
||||
return base.WillFilter;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
|
||||
AddHtmlLocalized(431, 43, 110, 26, 1062978, 0xF); // Diplomacy
|
||||
}
|
||||
|
||||
protected override TextDefinition[] GetValuesFor(Guild g, int aryLength)
|
||||
{
|
||||
TextDefinition[] defs = new TextDefinition[aryLength];
|
||||
|
||||
defs[0] = g == guild ? Color(g.Name, 0x006600) : g.Name;
|
||||
defs[1] = g.Abbreviation;
|
||||
|
||||
defs[2] = 3000085; //Peace
|
||||
|
||||
|
||||
if (guild.IsAlly(g))
|
||||
{
|
||||
if (guild.Alliance.Leader == g)
|
||||
defs[2] = 1063237; // Alliance Leader
|
||||
else
|
||||
defs[2] = 1062964; // Ally
|
||||
}
|
||||
else if (guild.IsWar(g))
|
||||
{
|
||||
defs[2] = 3000086; // War
|
||||
}
|
||||
|
||||
return defs;
|
||||
}
|
||||
|
||||
public override bool HasRelationship(Guild g)
|
||||
{
|
||||
if (g == guild)
|
||||
return false;
|
||||
|
||||
if (guild.FindPendingWar(g) != null)
|
||||
return true;
|
||||
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
|
||||
if (alliance != null)
|
||||
{
|
||||
Guild leader = alliance.Leader;
|
||||
|
||||
if (leader != null)
|
||||
{
|
||||
if (guild == leader && alliance.IsPendingMember(g) || g == leader && alliance.IsPendingMember(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 (m_LowerText?.Number > 0)
|
||||
AddHtmlLocalized(66, 153 + itemNumber * 28, 280, 26, m_LowerText.Number, 0xF);
|
||||
else if (m_LowerText?.String != null)
|
||||
AddHtml(66, 153 + itemNumber * 28, 280, 26, Color(m_LowerText.String, 0x99));
|
||||
|
||||
if (AllowAdvancedSearch)
|
||||
{
|
||||
AddBackground(350, 148 + itemNumber * 28, 200, 26, 0x2486);
|
||||
AddButton(355, 153 + itemNumber * 28, 0x845, 0x846, 8);
|
||||
AddHtmlLocalized(380, 151 + itemNumber * 28, 160, 26, 1063083, 0x0); // Advanced Search
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override bool IsFiltered(Guild g, string filter)
|
||||
{
|
||||
if (g == null)
|
||||
return true;
|
||||
|
||||
switch (m_Display)
|
||||
{
|
||||
case GuildDisplayType.Relations:
|
||||
{
|
||||
//if ( !( guild.IsWar( g ) || guild.IsAlly( g ) ) )
|
||||
|
||||
if (!(guild.FindActiveWar(g) != null || 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 !HasRelationship(g);
|
||||
}
|
||||
}
|
||||
|
||||
return !(Insensitive.Contains(g.Name, filter) || Insensitive.Contains(g.Abbreviation, filter));
|
||||
}
|
||||
|
||||
|
||||
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, m_Display);
|
||||
}
|
||||
|
||||
public override Gump GetObjectInfoGump(PlayerMobile pm, Guild g, Guild o)
|
||||
{
|
||||
if (guild == o)
|
||||
return new GuildInfoGump(pm, g);
|
||||
|
||||
return new OtherGuildInfo(pm, g, o);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
if (AllowAdvancedSearch && info.ButtonID == 8)
|
||||
pm.SendGump(new GuildAdvancedSearchGump(pm, guild, m_Display, AdvancedSearch_Callback));
|
||||
}
|
||||
|
||||
public void AdvancedSearch_Callback(GuildDisplayType display)
|
||||
{
|
||||
m_Display = display;
|
||||
ResendGump();
|
||||
}
|
||||
|
||||
#region Comparers
|
||||
|
||||
private class NameComparer : IComparer<Guild>
|
||||
{
|
||||
public static readonly IComparer<Guild> Instance = new NameComparer();
|
||||
|
||||
public int Compare(Guild x, Guild y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
return Insensitive.Compare(x.Name, y.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private class StatusComparer : IComparer<Guild>
|
||||
{
|
||||
private Guild m_Guild;
|
||||
|
||||
public StatusComparer(Guild g)
|
||||
{
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public int Compare(Guild x, Guild y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
GuildCompareStatus aStatus = GuildCompareStatus.Peace;
|
||||
GuildCompareStatus bStatus = GuildCompareStatus.Peace;
|
||||
|
||||
if (m_Guild.IsAlly(x))
|
||||
aStatus = GuildCompareStatus.Ally;
|
||||
else if (m_Guild.IsWar(x))
|
||||
aStatus = GuildCompareStatus.War;
|
||||
|
||||
|
||||
if (m_Guild.IsAlly(y))
|
||||
bStatus = GuildCompareStatus.Ally;
|
||||
else if (m_Guild.IsWar(y))
|
||||
bStatus = GuildCompareStatus.War;
|
||||
|
||||
return ((int)aStatus).CompareTo((int)bStatus);
|
||||
}
|
||||
|
||||
private enum GuildCompareStatus
|
||||
{
|
||||
Peace,
|
||||
Ally,
|
||||
War
|
||||
}
|
||||
}
|
||||
|
||||
private class AbbrevComparer : IComparer<Guild>
|
||||
{
|
||||
public static readonly IComparer<Guild> Instance = new AbbrevComparer();
|
||||
|
||||
public int Compare(Guild x, Guild y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
return Insensitive.Compare(x.Abbreviation, y.Abbreviation);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
192
Projects/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs
Normal file
192
Projects/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class GuildInfoGump : BaseGuildGump
|
||||
{
|
||||
private bool m_IsResigning;
|
||||
|
||||
public GuildInfoGump(PlayerMobile pm, Guild g, bool isResigning = false) : base(pm, g)
|
||||
{
|
||||
m_IsResigning = isResigning;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
bool isLeader = IsLeader(player, guild);
|
||||
base.PopulateGump();
|
||||
|
||||
AddHtmlLocalized(96, 43, 110, 26, 1063014, 0xF); // My Guild
|
||||
|
||||
AddImageTiled(65, 80, 160, 26, 0xA40);
|
||||
AddImageTiled(67, 82, 156, 22, 0xBBC);
|
||||
AddHtmlLocalized(70, 83, 150, 20, 1062954, 0x0); // <i>Guild Name</i>
|
||||
AddHtml(233, 84, 320, 26, guild.Name);
|
||||
|
||||
AddImageTiled(65, 114, 160, 26, 0xA40);
|
||||
AddImageTiled(67, 116, 156, 22, 0xBBC);
|
||||
AddHtmlLocalized(70, 117, 150, 20, 1063025, 0x0); // <i>Alliance</i>
|
||||
|
||||
if (guild.Alliance != null && guild.Alliance.IsMember(guild))
|
||||
{
|
||||
AddHtml(233, 118, 320, 26, guild.Alliance.Name);
|
||||
AddButton(40, 120, 0x4B9, 0x4BA, 6); //Alliance Roster
|
||||
}
|
||||
|
||||
if (Guild.OrderChaos && isLeader)
|
||||
AddButton(40, 154, 0x4B9, 0x4BA, 100); // Guild Faction
|
||||
|
||||
AddImageTiled(65, 148, 160, 26, 0xA40);
|
||||
AddImageTiled(67, 150, 156, 22, 0xBBC);
|
||||
AddHtmlLocalized(70, 151, 150, 20, 1063084, 0x0); // <i>Guild Faction</i>
|
||||
|
||||
GuildType gt;
|
||||
Faction f;
|
||||
|
||||
if ((gt = guild.Type) != GuildType.Regular)
|
||||
AddHtml(233, 152, 320, 26, gt.ToString());
|
||||
else if ((f = Faction.Find(guild.Leader)) != null)
|
||||
AddHtml(233, 152, 320, 26, f.ToString());
|
||||
|
||||
AddImageTiled(65, 196, 480, 4, 0x238D);
|
||||
|
||||
|
||||
string s = guild.Charter;
|
||||
if (string.IsNullOrEmpty(s))
|
||||
s = "The guild leader has not yet set the guild charter.";
|
||||
|
||||
AddHtml(65, 216, 480, 80, s, true, true);
|
||||
if (isLeader)
|
||||
AddButton(40, 251, 0x4B9, 0x4BA, 4); //Charter Edit button
|
||||
|
||||
s = guild.Website;
|
||||
if (string.IsNullOrEmpty(s))
|
||||
s = "Guild website not yet set.";
|
||||
AddHtml(65, 306, 480, 30, s, true);
|
||||
if (isLeader)
|
||||
AddButton(40, 313, 0x4B9, 0x4BA, 5); //Website Edit button
|
||||
|
||||
AddCheck(65, 370, 0xD2, 0xD3, player.DisplayGuildTitle, 0);
|
||||
AddHtmlLocalized(95, 370, 150, 26, 1063085, 0x0); // Show Guild Title
|
||||
AddBackground(450, 370, 100, 26, 0x2486);
|
||||
|
||||
AddButton(455, 375, 0x845, 0x846, 7);
|
||||
AddHtmlLocalized(480, 373, 60, 26, 3006115, m_IsResigning ? 0x5000 : 0); // Resign
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if (!IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
|
||||
pm.DisplayGuildTitle = info.IsSwitched(0);
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
//1-3 handled by base.OnResponse
|
||||
case 4:
|
||||
{
|
||||
if (IsLeader(pm, guild))
|
||||
{
|
||||
pm.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
|
||||
|
||||
pm.BeginPrompt(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, guild))
|
||||
{
|
||||
pm.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
|
||||
pm.BeginPrompt(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 (guild.Alliance != null && guild.Alliance.IsMember(guild))
|
||||
pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, guild.Alliance));
|
||||
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
//Resign
|
||||
if (!m_IsResigning)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063332); // Are you sure you wish to resign from your guild?
|
||||
pm.SendGump(new GuildInfoGump(pm, guild, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.RemoveMember(pm, 1063411); // You resign from your guild.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 100: // Custom code to support Order/Chaos in the new guild system
|
||||
{
|
||||
// Guild Faction
|
||||
if (Guild.OrderChaos && IsLeader(pm, guild))
|
||||
{
|
||||
pm.CloseGump<GuildChangeTypeGump>();
|
||||
pm.SendGump(new GuildChangeTypeGump(pm, guild));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCharter_Callback(Mobile from, string text)
|
||||
{
|
||||
if (!IsLeader(from, 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
|
||||
{
|
||||
guild.Charter = charter;
|
||||
from.SendLocalizedMessage(1070775); // You submit a new guild charter.
|
||||
}
|
||||
}
|
||||
|
||||
public void SetWebsite_Callback(Mobile from, string text)
|
||||
{
|
||||
if (!IsLeader(from, 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
|
||||
{
|
||||
guild.Website = site;
|
||||
from.SendLocalizedMessage(1070778); // You submit a new guild website.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class GuildInvitationRequest : BaseGuildGump
|
||||
{
|
||||
private PlayerMobile m_Inviter;
|
||||
|
||||
public GuildInvitationRequest(PlayerMobile pm, Guild g, PlayerMobile inviter) : base(pm, g)
|
||||
{
|
||||
m_Inviter = inviter;
|
||||
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 350, 170, 0x2422);
|
||||
AddHtmlLocalized(25, 20, 300, 45, 1062946, 0x0, true); // <center>You have been invited to join a guild! (Warning: Accepting will make you attackable!)</center>
|
||||
AddHtml(25, 75, 300, 25, $"<center>{guild.Name}</center>", true);
|
||||
AddButton(265, 130, 0xF7, 0xF8, 1);
|
||||
AddButton(195, 130, 0xF2, 0xF1, 0);
|
||||
AddButton(20, 130, 0xD2, 0xD3, 2);
|
||||
AddHtmlLocalized(45, 130, 150, 30, 1062943, 0x0); // <i>Ignore Guild Invites</i>
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (guild.Disbanded || player.Guild != null)
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Inviter.SendLocalizedMessage(1063250,
|
||||
$"{player.Name}\t{guild.Name}"); // ~1_val~ has declined your invitation to join ~2_val~.
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
guild.AddMember(player);
|
||||
player.SendLocalizedMessage(1063056, guild.Name); // You have joined ~1_val~.
|
||||
m_Inviter.SendLocalizedMessage(1063249,
|
||||
$"{player.Name}\t{guild.Name}"); // ~1_val~ has accepted your invitation to join ~2_val~.
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
player.AcceptGuildInvites = false;
|
||||
player.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,253 @@
|
|||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class GuildMemberInfoGump : BaseGuildGump
|
||||
{
|
||||
private PlayerMobile m_Member;
|
||||
private bool m_ToLeader, m_toKick;
|
||||
|
||||
public GuildMemberInfoGump(PlayerMobile pm, Guild g, PlayerMobile member, bool toKick, bool toPromoteToLeader) :
|
||||
base(pm, g, 10, 40)
|
||||
{
|
||||
m_ToLeader = toPromoteToLeader;
|
||||
m_toKick = toKick;
|
||||
m_Member = member;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 350, 255, 0x242C);
|
||||
AddHtmlLocalized(20, 15, 310, 26, 1063018, 0x0); // <div align=center><i>Guild Member Information</i></div>
|
||||
AddImageTiled(20, 40, 310, 2, 0x2711);
|
||||
|
||||
AddHtmlLocalized(20, 50, 150, 26, 1062955, 0x0, true); // <i>Name</i>
|
||||
AddHtml(180, 53, 150, 26, m_Member.Name);
|
||||
|
||||
AddHtmlLocalized(20, 80, 150, 26, 1062956, 0x0, true); // <i>Rank</i>
|
||||
AddHtmlLocalized(180, 83, 150, 26, m_Member.GuildRank.Name, 0x0);
|
||||
|
||||
AddHtmlLocalized(20, 110, 150, 26, 1062953, 0x0, true); // <i>Guild Title</i>
|
||||
AddHtml(180, 113, 150, 26, m_Member.GuildTitle);
|
||||
AddImageTiled(20, 142, 310, 2, 0x2711);
|
||||
|
||||
AddBackground(20, 150, 310, 26, 0x2486);
|
||||
AddButton(25, 155, 0x845, 0x846, 4);
|
||||
AddHtmlLocalized(50, 153, 270, 26,
|
||||
m_Member == player.GuildFealty && guild.Leader != m_Member ? 1063082 : 1062996, 0x0); // Clear/Cast Vote For This Member
|
||||
|
||||
AddBackground(20, 180, 150, 26, 0x2486);
|
||||
AddButton(25, 185, 0x845, 0x846, 1);
|
||||
AddHtmlLocalized(50, 183, 110, 26, 1062993, m_ToLeader ? 0x990000 : 0); // Promote
|
||||
|
||||
AddBackground(180, 180, 150, 26, 0x2486);
|
||||
AddButton(185, 185, 0x845, 0x846, 3);
|
||||
AddHtmlLocalized(210, 183, 110, 26, 1062995, 0x0); // Set Guild Title
|
||||
|
||||
AddBackground(20, 210, 150, 26, 0x2486);
|
||||
AddButton(25, 215, 0x845, 0x846, 2);
|
||||
AddHtmlLocalized(50, 213, 110, 26, 1062994, 0x0); // Demote
|
||||
|
||||
AddBackground(180, 210, 150, 26, 0x2486);
|
||||
AddButton(185, 215, 0x845, 0x846, 5);
|
||||
AddHtmlLocalized(210, 213, 110, 26, 1062997, m_toKick ? 0x5000 : 0); // Kick
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild) || !IsMember(m_Member, guild))
|
||||
return;
|
||||
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
RankDefinition targetRank = 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 (m_ToLeader)
|
||||
{
|
||||
m_Member.GuildRank = targetRank;
|
||||
pm.SendLocalizedMessage(1063156,
|
||||
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.
|
||||
guild.Leader = m_Member;
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(
|
||||
1063144); // Are you sure you wish to make this member the new guild leader?
|
||||
pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, false, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Member.GuildRank = targetRank;
|
||||
pm.SendLocalizedMessage(1063156,
|
||||
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
|
||||
{
|
||||
m_Member.GuildRank = RankDefinition.Ranks[targetRank.Rank - 1];
|
||||
pm.SendLocalizedMessage(1063156,
|
||||
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 || m_Member == player))
|
||||
{
|
||||
pm.SendLocalizedMessage(
|
||||
1011128); // Enter the new title for this guild member or 'none' to remove a title:
|
||||
|
||||
pm.BeginPrompt(SetTitle_Callback);
|
||||
}
|
||||
else if (m_Member.GuildTitle == null || 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 (m_Member == pm.GuildFealty && guild.Leader != m_Member)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063158); // You have cleared your vote for guild leader.
|
||||
}
|
||||
else if (guild.CanVote(m_Member)) //( playerRank.GetFlag( RankFlags.CanVote ) )
|
||||
{
|
||||
if (m_Member == guild.Leader)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063424); // You can't vote for the current guild leader.
|
||||
}
|
||||
else if (!guild.CanBeVotedFor(m_Member))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063425); // You can't vote for an inactive guild member.
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.GuildFealty = m_Member;
|
||||
pm.SendLocalizedMessage(1063159,
|
||||
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 (m_toKick)
|
||||
{
|
||||
guild.RemoveMember(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(player, guild, 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)
|
||||
{
|
||||
if (!(from is PlayerMobile pm) || m_Member == null)
|
||||
return;
|
||||
|
||||
if (!(m_Member.Guild is Guild g) || !IsMember(pm, g) ||
|
||||
!(pm.GuildRank.GetFlag(RankFlags.CanSetGuildTitle) &&
|
||||
(pm.GuildRank.Rank > m_Member.GuildRank.Rank || pm == m_Member)))
|
||||
{
|
||||
if (m_Member.GuildTitle == null || 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 (!CheckProfanity(title))
|
||||
{
|
||||
from.SendLocalizedMessage(501179); // That title is disallowed.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Insensitive.Equals(title, "none"))
|
||||
m_Member.GuildTitle = null;
|
||||
else
|
||||
m_Member.GuildTitle = title;
|
||||
|
||||
pm.SendLocalizedMessage(1063156, m_Member.Name); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,255 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class GuildRosterGump : BaseGuildListGump<PlayerMobile>
|
||||
{
|
||||
private static InfoField<PlayerMobile>[] m_Fields =
|
||||
{
|
||||
new InfoField<PlayerMobile>(1062955, 130, NameComparer.Instance), //Name
|
||||
new InfoField<PlayerMobile>(1062956, 80, RankComparer.Instance), //Rank
|
||||
new InfoField<PlayerMobile>(1062952, 80, LastOnComparer.Instance), //Last On
|
||||
new InfoField<PlayerMobile>(1062953, 150, TitleComparer.Instance) //Guild Title
|
||||
};
|
||||
|
||||
public GuildRosterGump(PlayerMobile pm, Guild g) : this(pm, g, LastOnComparer.Instance)
|
||||
{
|
||||
}
|
||||
|
||||
public GuildRosterGump(PlayerMobile pm, Guild g, IComparer<PlayerMobile> currentComparer, bool ascending = false,
|
||||
string filter = "", int startNumber = 0)
|
||||
: 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); // Guild Roster
|
||||
}
|
||||
|
||||
public override void DrawEndingEntry(int itemNumber)
|
||||
{
|
||||
AddBackground(225, 148 + itemNumber * 28, 150, 26, 0x2486);
|
||||
AddButton(230, 153 + itemNumber * 28, 0x845, 0x846, 8);
|
||||
AddHtmlLocalized(255, 151 + itemNumber * 28, 110, 26, 1062992, 0x0); // Invite Player
|
||||
}
|
||||
|
||||
protected override TextDefinition[] GetValuesFor(PlayerMobile pm, int aryLength)
|
||||
{
|
||||
TextDefinition[] defs = new TextDefinition[aryLength];
|
||||
|
||||
string name = $"{pm.Name}{(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 ?? "";
|
||||
|
||||
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);
|
||||
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !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, TargetFlags.None, InvitePlayer_Callback, guild);
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(503301); // You don't have permission to do that.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void InvitePlayer_Callback(Mobile from, object targeted, Guild g)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
PlayerMobile targ = targeted as PlayerMobile;
|
||||
|
||||
PlayerState guildState = PlayerState.Find(g.Leader);
|
||||
PlayerState targetState = PlayerState.Find(targ);
|
||||
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = 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<BaseGuildGump>() || targ.HasGump<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?.IsLeaving == true)
|
||||
{
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
|
||||
#region Comparers
|
||||
|
||||
private class NameComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new NameComparer();
|
||||
|
||||
public int Compare(PlayerMobile x, PlayerMobile y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
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 int Compare(PlayerMobile x, PlayerMobile y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
NetState aState = x.NetState;
|
||||
NetState bState = y.NetState;
|
||||
|
||||
if (aState == null && bState == null)
|
||||
return x.LastOnline.CompareTo(y.LastOnline);
|
||||
if (aState == null)
|
||||
return -1;
|
||||
if (bState == null)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private class TitleComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new TitleComparer();
|
||||
|
||||
public int Compare(PlayerMobile x, PlayerMobile y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
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 int Compare(PlayerMobile x, PlayerMobile y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
return x.GuildRank.Rank.CompareTo(y.GuildRank.Rank);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
702
Projects/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs
Normal file
702
Projects/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs
Normal file
|
|
@ -0,0 +1,702 @@
|
|||
using System;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class OtherGuildInfo : BaseGuildGump
|
||||
{
|
||||
private Guild m_Other;
|
||||
|
||||
public OtherGuildInfo(PlayerMobile pm, Guild g, Guild otherGuild) : base(pm, g, 10, 40)
|
||||
{
|
||||
m_Other = otherGuild;
|
||||
|
||||
g.CheckExpiredWars();
|
||||
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public void AddButtonAndBackground(int x, int y, int buttonID, int locNum)
|
||||
{
|
||||
AddBackground(x, y, 225, 26, 0x2486);
|
||||
AddButton(x + 5, y + 5, 0x845, 0x846, buttonID);
|
||||
AddHtmlLocalized(x + 30, y + 3, 185, 26, locNum, 0x0);
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
Guild g = Guild.GetAllianceLeader(guild);
|
||||
Guild other = Guild.GetAllianceLeader(m_Other);
|
||||
|
||||
WarDeclaration war = g.FindPendingWar(other);
|
||||
WarDeclaration activeWar = g.FindActiveWar(other);
|
||||
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
AllianceInfo otherAlliance = m_Other.Alliance;
|
||||
//NOTE TO SELF: Only only alliance leader can see pending guild alliance statuses
|
||||
|
||||
bool PendingWar = war != null;
|
||||
bool ActiveWar = activeWar != null;
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 520, 335, 0x242C);
|
||||
AddHtmlLocalized(20, 15, 480, 26, 1062975, 0x0); // <div align=center><i>Guild Relationship</i></div>
|
||||
AddImageTiled(20, 40, 480, 2, 0x2711);
|
||||
AddHtmlLocalized(20, 50, 120, 26, 1062954, 0x0, true); // <i>Guild Name</i>
|
||||
AddHtml(150, 53, 360, 26, m_Other.Name);
|
||||
|
||||
AddHtmlLocalized(20, 80, 120, 26, 1063025, 0x0, true); // <i>Alliance</i>
|
||||
|
||||
if (otherAlliance != null)
|
||||
if (otherAlliance.IsMember(m_Other))
|
||||
AddHtml(150, 83, 360, 26, otherAlliance.Name);
|
||||
|
||||
AddHtmlLocalized(20, 110, 120, 26, 1063139, 0x0, true); // <i>Abbreviation</i>
|
||||
AddHtml(150, 113, 120, 26, m_Other.Abbreviation);
|
||||
|
||||
|
||||
string kills = "0/0";
|
||||
string time = "00:00";
|
||||
string otherKills = "0/0";
|
||||
|
||||
WarDeclaration otherWar;
|
||||
|
||||
if (ActiveWar)
|
||||
{
|
||||
kills = $"{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 = $"{timeRemaining.Hours:D2}:{DateTime.MinValue + timeRemaining:mm}";
|
||||
|
||||
otherWar = m_Other.FindActiveWar(guild);
|
||||
if (otherWar != null)
|
||||
otherKills = $"{otherWar.Kills}/{otherWar.MaxKills}";
|
||||
}
|
||||
else if (PendingWar)
|
||||
{
|
||||
kills = Color($"{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($"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}", 0x990000);
|
||||
|
||||
otherWar = m_Other.FindPendingWar(guild);
|
||||
if (otherWar != null)
|
||||
otherKills = Color($"{otherWar.Kills}/{otherWar.MaxKills}", 0x990000);
|
||||
}
|
||||
|
||||
AddHtmlLocalized(280, 110, 120, 26, 1062966, 0x0, true); // <i>Your Kills</i>
|
||||
AddHtml(410, 113, 120, 26, kills);
|
||||
|
||||
AddHtmlLocalized(20, 140, 120, 26, 1062968, 0x0, true); // <i>Time Remaining</i>
|
||||
AddHtml(150, 143, 120, 26, time);
|
||||
|
||||
AddHtmlLocalized(280, 140, 120, 26, 1062967, 0x0, true); // <i>Their Kills</i>
|
||||
AddHtml(410, 143, 120, 26, otherKills);
|
||||
|
||||
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>
|
||||
|
||||
AddButtonAndBackground(20, 260, 5, 1062981); // Accept Challenge
|
||||
AddButtonAndBackground(275, 260, 6, 1062983); //Modify Terms
|
||||
}
|
||||
|
||||
AddButtonAndBackground(20, 290, 7, 1062982); // Dismiss Challenge
|
||||
}
|
||||
else if (ActiveWar)
|
||||
{
|
||||
number = 1062965; // <div align=center>You are at war with this guild!</div>
|
||||
AddButtonAndBackground(20, 290, 8, 1062980); // Surrender
|
||||
}
|
||||
else if (alliance != null && alliance == otherAlliance) //alliance, Same Alliance
|
||||
{
|
||||
if (alliance.IsMember(guild) && alliance.IsMember(m_Other)) //Both in Same alliance, full members
|
||||
{
|
||||
number = 1062970; // <div align=center>You are allied with this guild.</div>
|
||||
|
||||
if (alliance.Leader == guild)
|
||||
{
|
||||
AddButtonAndBackground(20, 260, 12, 1062984); // Remove Guild from Alliance
|
||||
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
|
||||
AddButtonAndBackground(148, 215, 10, 1063164); //Show Alliance Roster
|
||||
//Leave Alliance
|
||||
AddButtonAndBackground(20, 290, 11, 1062985); // Leave Alliance
|
||||
}
|
||||
else if (alliance.Leader == guild && alliance.IsPendingMember(m_Other))
|
||||
{
|
||||
number = 1062971; // <div align=center>You have requested an alliance with this guild.</div>
|
||||
|
||||
//Show Alliance Roster, Centered, down.
|
||||
AddButtonAndBackground(148, 245, 10, 1063164); //Show Alliance Roster
|
||||
//Withdraw Request
|
||||
AddButtonAndBackground(20, 290, 14, 1062986); // Withdraw Request
|
||||
|
||||
AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99));
|
||||
}
|
||||
else if (alliance.Leader == m_Other && alliance.IsPendingMember(guild))
|
||||
{
|
||||
number = 1062972; // <div align=center>This guild has requested an alliance.</div>
|
||||
|
||||
//Show alliance Roster, top
|
||||
AddButtonAndBackground(148, 215, 10, 1063164); //Show Alliance Roster
|
||||
//Deny Request
|
||||
//Accept Request
|
||||
AddButtonAndBackground(20, 260, 15, 1062988); // Deny Request
|
||||
AddButtonAndBackground(20, 290, 16, 1062987); // Accept Request
|
||||
|
||||
AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButtonAndBackground(20, 260, 2, 1062990); // Request Alliance
|
||||
AddButtonAndBackground(20, 290, 1, 1062989); // Declare War!
|
||||
}
|
||||
|
||||
AddButtonAndBackground(275, 290, 0, 3000091); //Cancel
|
||||
|
||||
AddHtmlLocalized(20, 180, 480, 30, number, 0x0, true);
|
||||
AddImageTiled(20, 245, 480, 2, 0x2711);
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if (!IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
|
||||
Guild guildLeader = Guild.GetAllianceLeader(guild);
|
||||
Guild otherGuild = Guild.GetAllianceLeader(m_Other);
|
||||
|
||||
WarDeclaration war = guildLeader.FindPendingWar(otherGuild);
|
||||
WarDeclaration activeWar = guildLeader.FindActiveWar(otherGuild);
|
||||
WarDeclaration otherWar = otherGuild.FindPendingWar(guildLeader);
|
||||
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
AllianceInfo otherAlliance = otherGuild.Alliance;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
#region War
|
||||
|
||||
case 5: //Accept the war
|
||||
{
|
||||
if (war?.WarRequester == false && activeWar == null)
|
||||
{
|
||||
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
|
||||
}
|
||||
else if (alliance != null && alliance.Leader != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{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
|
||||
guild.PendingWars.Remove(war);
|
||||
war.WarBeginning = DateTime.UtcNow;
|
||||
guild.AcceptedWars.Add(war);
|
||||
|
||||
if (alliance?.IsMember(guild) == true)
|
||||
{
|
||||
alliance.AllianceMessage(1070769,
|
||||
otherAlliance != null
|
||||
? otherAlliance.Name
|
||||
: otherGuild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
|
||||
alliance.InvalidateMemberProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.GuildMessage(1070769,
|
||||
otherAlliance != null
|
||||
? otherAlliance.Name
|
||||
: otherGuild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
|
||||
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 && m_Other.Alliance.IsMember(m_Other))
|
||||
{
|
||||
otherAlliance.AllianceMessage(1070769,
|
||||
alliance != null
|
||||
? alliance.Name
|
||||
: guild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
|
||||
otherAlliance.InvalidateMemberProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
otherGuild.GuildMessage(1070769,
|
||||
alliance != null
|
||||
? alliance.Name
|
||||
: guild.Name); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
|
||||
otherGuild.InvalidateMemberProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: //Modify war terms
|
||||
{
|
||||
if (war?.WarRequester == false && activeWar == null)
|
||||
{
|
||||
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
|
||||
}
|
||||
else if (alliance != null && alliance.Leader != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{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, 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 != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{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
|
||||
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 != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{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?.IsMember(guild) == true)
|
||||
{
|
||||
alliance.AllianceMessage(1070740,
|
||||
otherAlliance != null
|
||||
? otherAlliance.Name
|
||||
: otherGuild.Name); // You have lost the war with ~1_val~.
|
||||
alliance.InvalidateMemberProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.GuildMessage(1070740,
|
||||
otherAlliance != null
|
||||
? otherAlliance.Name
|
||||
: otherGuild.Name); // You have lost the war with ~1_val~.
|
||||
guild.InvalidateMemberProperties();
|
||||
}
|
||||
|
||||
guild.AcceptedWars.Remove(activeWar);
|
||||
|
||||
if (otherAlliance != null && otherAlliance.IsMember(otherGuild))
|
||||
{
|
||||
otherAlliance.AllianceMessage(1070739,
|
||||
guild.Alliance != null
|
||||
? guild.Alliance.Name
|
||||
: guild.Name); // You have won the war against ~1_val~!
|
||||
otherAlliance.InvalidateMemberProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
otherGuild.GuildMessage(1070739,
|
||||
guild.Alliance != null
|
||||
? guild.Alliance.Name
|
||||
: guild.Name); // You have won the war against ~1_val~!
|
||||
otherGuild.InvalidateMemberProperties();
|
||||
}
|
||||
|
||||
otherGuild.AcceptedWars.Remove(otherGuild.FindActiveWar(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 != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{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 != m_Other)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{m_Other.Name}\t{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, guild, 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(guild.Leader) != Faction.Find(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(m_Other))
|
||||
pm.SendLocalizedMessage(1063416,
|
||||
m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
|
||||
else
|
||||
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
|
||||
}
|
||||
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
|
||||
}
|
||||
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1063439); // Enter a name for the new alliance:
|
||||
pm.BeginPrompt(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 != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
|
||||
}
|
||||
else if (otherAlliance != null)
|
||||
{
|
||||
if (otherAlliance.IsPendingMember(m_Other))
|
||||
pm.SendLocalizedMessage(1063416,
|
||||
m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
|
||||
else
|
||||
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
|
||||
}
|
||||
else if (alliance.IsPendingMember(guild))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063416,
|
||||
guild.Name); // ~1_val~ is currently considering another alliance proposal.
|
||||
}
|
||||
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
|
||||
}
|
||||
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
|
||||
}
|
||||
else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
|
||||
{
|
||||
pm.SendLocalizedMessage(
|
||||
1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1070750,
|
||||
m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~.
|
||||
|
||||
m_Other.GuildMessage(1070780, guild.Name); // ~1_val~ has proposed an alliance.
|
||||
|
||||
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, 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?.IsMember(guild) == true)
|
||||
{
|
||||
guild.Alliance = null; //Calls alliance.Removeguild
|
||||
// alliance.RemoveGuild( guild );
|
||||
|
||||
m_Other.InvalidateWarNotoriety();
|
||||
|
||||
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 != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
|
||||
}
|
||||
else if (alliance?.IsMember(guild) == true && alliance.IsMember(m_Other))
|
||||
{
|
||||
m_Other.Alliance = null;
|
||||
|
||||
m_Other.InvalidateMemberNotoriety();
|
||||
|
||||
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 != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
|
||||
}
|
||||
else if (alliance?.IsMember(guild) == true && alliance.IsMember(m_Other))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063434,
|
||||
$"{m_Other.Name}\t{alliance.Name}"); // ~1_val~ is now the leader of ~2_val~.
|
||||
|
||||
alliance.Leader = 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 == guild && alliance.IsPendingMember(m_Other))
|
||||
{
|
||||
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 == m_Other &&
|
||||
otherAlliance.IsPendingMember(guild))
|
||||
{
|
||||
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
|
||||
//m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal. //Per OSI commented out.
|
||||
|
||||
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 == m_Other &&
|
||||
otherAlliance.IsPendingMember(guild))
|
||||
{
|
||||
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
|
||||
|
||||
otherAlliance
|
||||
.TurnToMember(
|
||||
m_Other); //No need to verify it's in the guild or already a member, the function does this
|
||||
|
||||
otherAlliance.TurnToMember(guild);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateAlliance_Callback(Mobile from, string text)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
AllianceInfo otherAlliance = m_Other.Alliance;
|
||||
|
||||
if (!IsMember(from, 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(guild.Leader) != Faction.Find(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(m_Other))
|
||||
pm.SendLocalizedMessage(1063416,
|
||||
m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
|
||||
else
|
||||
pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance.
|
||||
}
|
||||
else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
|
||||
}
|
||||
else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
|
||||
}
|
||||
else
|
||||
{
|
||||
string name = Utility.FixHtml(text.Trim());
|
||||
|
||||
if (!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,
|
||||
m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~.
|
||||
|
||||
m_Other.GuildMessage(1070780, guild.Name); // ~1_val~ has proposed an alliance.
|
||||
|
||||
new AllianceInfo(guild, name, m_Other);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class WarDeclarationGump : BaseGuildGump
|
||||
{
|
||||
private Guild m_Other;
|
||||
|
||||
public WarDeclarationGump(PlayerMobile pm, Guild g, Guild otherGuild) : base(pm, g)
|
||||
{
|
||||
m_Other = otherGuild;
|
||||
WarDeclaration war = g.FindPendingWar(otherGuild);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 500, 340, 0x24AE);
|
||||
AddBackground(65, 50, 370, 30, 0x2486);
|
||||
AddHtmlLocalized(75, 55, 370, 26, 1062979, 0x3C00); // <div align=center><i>Declaration of War</i></div>
|
||||
AddImage(410, 45, 0x232C);
|
||||
AddHtmlLocalized(65, 95, 200, 20, 1063009, 0x14AF); // <i>Duration of War</i>
|
||||
AddHtmlLocalized(65, 120, 400, 20, 1063010, 0x0); // Enter the number of hours the war will last.
|
||||
AddBackground(65, 150, 40, 30, 0x2486);
|
||||
AddTextEntry(70, 154, 50, 30, 0x481, 10, war != null ? war.WarLength.Hours.ToString() : "0");
|
||||
AddHtmlLocalized(65, 195, 200, 20, 1063011, 0x14AF); // <i>Victory Condition</i>
|
||||
AddHtmlLocalized(65, 220, 400, 20, 1063012, 0x0); // Enter the winning number of kills.
|
||||
AddBackground(65, 250, 40, 30, 0x2486);
|
||||
AddTextEntry(70, 254, 50, 30, 0x481, 11, war != null ? war.MaxKills.ToString() : "0");
|
||||
AddBackground(190, 270, 130, 26, 0x2486);
|
||||
AddButton(195, 275, 0x845, 0x846, 0);
|
||||
AddHtmlLocalized(220, 273, 90, 26, 1006045, 0x0); // Cancel
|
||||
AddBackground(330, 270, 130, 26, 0x2486);
|
||||
AddButton(335, 275, 0x845, 0x846, 1);
|
||||
AddHtmlLocalized(360, 273, 90, 26, 1062989, 0x5000); // Declare War!
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if (!IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
AllianceInfo otherAlliance = 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 != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{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 != m_Other)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{m_Other.Name}\t{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 = guild.FindActiveWar(m_Other);
|
||||
|
||||
if (activeWar == null)
|
||||
{
|
||||
WarDeclaration war = guild.FindPendingWar(m_Other);
|
||||
WarDeclaration otherWar = m_Other.FindPendingWar(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
|
||||
{
|
||||
guild.PendingWars.Add(new WarDeclaration(guild, m_Other, maxKills, warLength, true));
|
||||
}
|
||||
|
||||
if (otherWar != null)
|
||||
{
|
||||
otherWar.MaxKills = maxKills;
|
||||
otherWar.WarLength = warLength;
|
||||
otherWar.WarRequester = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Other.PendingWars.Add(new WarDeclaration(m_Other, guild, maxKills, warLength, false));
|
||||
}
|
||||
|
||||
if (war != null)
|
||||
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
|
||||
else
|
||||
m_Other.GuildMessage(1070781,
|
||||
guild.Alliance != null
|
||||
? guild.Alliance.Name
|
||||
: guild.Name); // ~1_val~ has proposed a war.
|
||||
|
||||
pm.SendLocalizedMessage(1070751,
|
||||
m_Other.Alliance != null
|
||||
? m_Other.Alliance.Name
|
||||
: m_Other.Name); // War proposal has been sent to ~1_val~.
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pm.SendGump(new OtherGuildInfo(pm, guild, m_Other));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
97
Projects/Scripts/Gumps/Guilds/RecruitTarget.cs
Normal file
97
Projects/Scripts/Gumps/Guilds/RecruitTarget.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
using Server.Factions;
|
||||
using Server.Guilds;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildRecruitTarget : Target
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildRecruitTarget(Mobile m, Guild guild) : base(10, false, TargetFlags.None)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = guild;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if (targeted is Mobile m)
|
||||
{
|
||||
PlayerState guildState = PlayerState.Find(m_Guild.Leader);
|
||||
PlayerState targetState = PlayerState.Find(m);
|
||||
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
|
||||
if (!m.Player)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501161); // You may only recruit players into the guild.
|
||||
}
|
||||
else if (!m.Alive)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501162); // Only the living may be recruited.
|
||||
}
|
||||
else if (m_Guild.IsMember(m))
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501163); // They are already a guildmember!
|
||||
}
|
||||
else if (m_Guild.Candidates.Contains(m))
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501164); // They are already a candidate.
|
||||
}
|
||||
else if (m_Guild.Accepted.Contains(m))
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
m_Mobile.SendLocalizedMessage(1013027); // That player cannot join a non-faction guild.
|
||||
else if (targetFaction == null)
|
||||
m_Mobile.SendLocalizedMessage(
|
||||
1013026); // That player must be in a faction before joining this guild.
|
||||
else
|
||||
m_Mobile.SendLocalizedMessage(1013028); // That person has a different faction affiliation.
|
||||
}
|
||||
else if (targetState?.IsLeaving == true)
|
||||
{
|
||||
// OSI does this quite strangely, so we'll just do it this way
|
||||
m_Mobile.SendMessage("That person is quitting their faction and so you may not recruit them.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
else if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Guild.Leader == m_Mobile)
|
||||
{
|
||||
m_Guild.Accepted.Add(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Candidates.Add(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
578
Projects/Scripts/Gumps/HeritageTokenGump.cs
Normal file
578
Projects/Scripts/Gumps/HeritageTokenGump.cs
Normal file
|
|
@ -0,0 +1,578 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class HeritageTokenGump : Gump
|
||||
{
|
||||
private HeritageToken m_Token;
|
||||
|
||||
public HeritageTokenGump(HeritageToken token) : base(60, 36)
|
||||
{
|
||||
m_Token = token;
|
||||
|
||||
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);
|
||||
AddHtmlLocalized(45, 376, 450, 20, 1060051, 0x7FFF); // CANCEL
|
||||
AddHtmlLocalized(14, 12, 500, 20, 1075576, 0x7FFF); // 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); // 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); // 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); // Shamino’s Best Crossbow
|
||||
AddImageTiledButton(264, 108, 0x918, 0x919, 0x67, GumpButtonType.Reply, 0, 0x3F1D, 0x0, 18, 8);
|
||||
AddTooltip(1062918);
|
||||
AddHtmlLocalized(348, 108, 250, 60, 1062917, 0x7FFF); // 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); // 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); // 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); // 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); // 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); // 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); // Dupre’s Shield
|
||||
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 2);
|
||||
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next
|
||||
|
||||
AddPage(2);
|
||||
|
||||
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
|
||||
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back
|
||||
AddImageTiledButton(14, 44, 0x918, 0x919, 0x6E, GumpButtonType.Reply, 0, 0x2AC6, 0x0, 29, 0);
|
||||
AddTooltip(1075226);
|
||||
AddHtmlLocalized(98, 44, 250, 60, 1075197, 0x7FFF); // 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); // Dawn’s Music Box
|
||||
AddImageTiledButton(14, 108, 0x918, 0x919, 0x70, GumpButtonType.Reply, 0, 0x2253, 0x0, 18, 12);
|
||||
AddTooltip(1075228);
|
||||
AddHtmlLocalized(98, 108, 250, 60, 1078148, 0x7FFF); // Ossian Grimoire
|
||||
AddImageTiledButton(264, 108, 0x918, 0x919, 0x71, GumpButtonType.Reply, 0, 0x2D98, 0x0, 19, 13);
|
||||
AddTooltip(1078527);
|
||||
AddHtmlLocalized(348, 108, 250, 60, 1078142, 0x7FFF); // 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); // 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); // 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); // 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); // 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); // 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); // Creepy Portraits
|
||||
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 3);
|
||||
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next
|
||||
|
||||
AddPage(3);
|
||||
|
||||
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 2);
|
||||
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back
|
||||
AddImageTiledButton(14, 44, 0x918, 0x919, 0x78, GumpButtonType.Reply, 0, 0x2A71, 0x0, 13, 5);
|
||||
AddTooltip(1075988);
|
||||
AddHtmlLocalized(98, 44, 250, 60, 1074799, 0x7FFF); // 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); // Haunted Mirror
|
||||
AddImageTiledButton(14, 108, 0x918, 0x919, 0x7A, GumpButtonType.Reply, 0, 0x2A92, 0x0, 18, 1);
|
||||
AddTooltip(1075989);
|
||||
AddHtmlLocalized(98, 108, 250, 60, 1074801, 0x7FFF); // 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); // Sacrificial Altar
|
||||
AddImageTiledButton(14, 172, 0x918, 0x919, 0x7C, GumpButtonType.Reply, 0, 0x3F26, 0x0, 18, 8);
|
||||
AddTooltip(1076610);
|
||||
AddHtmlLocalized(98, 172, 250, 60, 1076257, 0x7FFF); // 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); // Broken Bookcase
|
||||
AddImageTiledButton(14, 236, 0x918, 0x919, 0x7E, GumpButtonType.Reply, 0, 0x3F24, 0x0, 18, 8);
|
||||
AddTooltip(1076610);
|
||||
AddHtmlLocalized(98, 236, 250, 60, 1076259, 0x7FFF); // 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); // Broken Vanity
|
||||
AddImageTiledButton(14, 300, 0x918, 0x919, 0x80, GumpButtonType.Reply, 0, 0x3F23, 0x0, 18, 8);
|
||||
AddTooltip(1076610);
|
||||
AddHtmlLocalized(98, 300, 250, 60, 1076261, 0x7FFF); // 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); // Broken Armoire
|
||||
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 4);
|
||||
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next
|
||||
|
||||
AddPage(4);
|
||||
|
||||
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 3);
|
||||
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back
|
||||
AddImageTiledButton(14, 44, 0x918, 0x919, 0x82, GumpButtonType.Reply, 0, 0x3F0B, 0x0, 18, 8);
|
||||
AddTooltip(1076610);
|
||||
AddHtmlLocalized(98, 44, 250, 60, 1076263, 0x7FFF); // Broken Bed
|
||||
AddImageTiledButton(264, 44, 0x918, 0x919, 0x83, GumpButtonType.Reply, 0, 0xC19, 0x0, 13, 8);
|
||||
AddTooltip(1076610);
|
||||
AddHtmlLocalized(348, 44, 250, 60, 1076264, 0x7FFF); // 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); // 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); // 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); // Boiling Cauldron
|
||||
AddImageTiledButton(264, 172, 0x918, 0x919, 0x87, GumpButtonType.Reply, 0, 0x3F27, 0x0, 18, 8);
|
||||
AddTooltip(1076614);
|
||||
AddHtmlLocalized(348, 172, 250, 60, 1024656, 0x7FFF); // Guillotine
|
||||
AddImageTiledButton(14, 236, 0x918, 0x919, 0x88, GumpButtonType.Reply, 0, 0x3F0C, 0x0, 18, 8);
|
||||
AddTooltip(1076615);
|
||||
AddHtmlLocalized(98, 236, 250, 60, 1076268, 0x7FFF); // 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); // Apple Tree
|
||||
AddImageTiledButton(14, 300, 0x918, 0x919, 0x8A, GumpButtonType.Reply, 0, 0x3F16, 0x0, 18, 8);
|
||||
AddTooltip(1076617);
|
||||
AddHtmlLocalized(98, 300, 250, 60, 1076270, 0x7FFF); // Peach Tree
|
||||
AddImageTiledButton(264, 300, 0x918, 0x919, 0x8B, GumpButtonType.Reply, 0, 0x3F12, 0x0, 18, 8);
|
||||
AddTooltip(1076618);
|
||||
AddHtmlLocalized(348, 300, 250, 60, 1076271, 0x7FFF); // Hanging Axes
|
||||
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 5);
|
||||
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next
|
||||
|
||||
AddPage(5);
|
||||
|
||||
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 4);
|
||||
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back
|
||||
AddImageTiledButton(14, 44, 0x918, 0x919, 0x8C, GumpButtonType.Reply, 0, 0x3F13, 0x0, 18, 8);
|
||||
AddTooltip(1076619);
|
||||
AddHtmlLocalized(98, 44, 250, 60, 1076272, 0x7FFF); // Hanging Swords
|
||||
AddImageTiledButton(264, 44, 0x918, 0x919, 0x8D, GumpButtonType.Reply, 0, 0x3F09, 0x0, 18, 8);
|
||||
AddTooltip(1076620);
|
||||
AddHtmlLocalized(348, 44, 250, 60, 1076273, 0x7FFF); // 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); // Coffin
|
||||
AddImageTiledButton(264, 108, 0x918, 0x919, 0x8F, GumpButtonType.Reply, 0, 0x3F1F, 0x0, 18, 8);
|
||||
AddTooltip(1076623);
|
||||
AddHtmlLocalized(348, 108, 250, 60, 1074027, 0x7FFF); // Vanity
|
||||
AddImageTiledButton(14, 172, 0x918, 0x919, 0x90, GumpButtonType.Reply, 0, 0x118B, 0x0, -4, -9);
|
||||
AddTooltip(1076624);
|
||||
AddHtmlLocalized(98, 172, 250, 60, 1076635, 0x7FFF); // 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); // 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); // 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); // 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); // Unmade Bed
|
||||
AddImageTiledButton(264, 300, 0x918, 0x919, 0x95, GumpButtonType.Reply, 0, 0x3F0F, 0x0, 18, 8);
|
||||
AddTooltip(1076626);
|
||||
AddHtmlLocalized(348, 300, 250, 60, 1076280, 0x7FFF); // Curtains
|
||||
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 6);
|
||||
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next
|
||||
|
||||
AddPage(6);
|
||||
|
||||
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 5);
|
||||
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back
|
||||
AddImageTiledButton(14, 44, 0x918, 0x919, 0x96, GumpButtonType.Reply, 0, 0x1E34, 0x0, 18, -17);
|
||||
AddTooltip(1076627);
|
||||
AddHtmlLocalized(98, 44, 250, 60, 1076281, 0x7FFF); // Scarecrow
|
||||
AddImageTiledButton(264, 44, 0x918, 0x919, 0x97, GumpButtonType.Reply, 0, 0xA0C, 0x0, 18, 8);
|
||||
AddTooltip(1076628);
|
||||
AddHtmlLocalized(348, 44, 250, 60, 1076282, 0x7FFF); // Wall Torch
|
||||
AddImageTiledButton(14, 108, 0x918, 0x919, 0x98, GumpButtonType.Reply, 0, 0x3F10, 0x0, 18, 9);
|
||||
AddTooltip(1076629);
|
||||
AddHtmlLocalized(98, 108, 250, 60, 1076283, 0x7FFF); // Fountain
|
||||
AddImageTiledButton(264, 108, 0x918, 0x919, 0x99, GumpButtonType.Reply, 0, 0x3F19, 0x0, 18, 8);
|
||||
AddTooltip(1076630);
|
||||
AddHtmlLocalized(348, 108, 250, 60, 1076284, 0x7FFF); // Statue
|
||||
AddImageTiledButton(14, 172, 0x918, 0x919, 0x9A, GumpButtonType.Reply, 0, 0x1EA5, 0x0, 5, -25);
|
||||
AddTooltip(1076631);
|
||||
AddHtmlLocalized(98, 172, 250, 60, 1076285, 0x7FFF); // 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); // 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); // Ladder
|
||||
AddImageTiledButton(264, 236, 0x918, 0x919, 0x9D, GumpButtonType.Reply, 0, 0x3F15, 0x0, 18, 8);
|
||||
AddTooltip(1076622);
|
||||
AddHtmlLocalized(348, 236, 250, 60, 1076288, 0x7FFF); // Iron Maiden
|
||||
AddImageTiledButton(14, 300, 0x918, 0x919, 0x9E, GumpButtonType.Reply, 0, 0x3F0A, 0x0, 18, 8);
|
||||
AddTooltip(1076620);
|
||||
AddHtmlLocalized(98, 300, 250, 60, 1076585, 0x7FFF); // 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); // Golden decorative rug
|
||||
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 7);
|
||||
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next
|
||||
|
||||
AddPage(7);
|
||||
|
||||
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 6);
|
||||
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back
|
||||
AddImageTiledButton(14, 44, 0x918, 0x919, 0xA0, GumpButtonType.Reply, 0, 0x3F0D, 0x0, 18, 8);
|
||||
AddTooltip(1076620);
|
||||
AddHtmlLocalized(98, 44, 250, 60, 1076587, 0x7FFF); // 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); // 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); // 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); // 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); // 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); // Apple Trunk
|
||||
AddImageTiledButton(14, 236, 0x918, 0x919, 0xA6, GumpButtonType.Reply, 0, 0x3129, 0x0, 18, 8);
|
||||
AddTooltip(1076617);
|
||||
AddHtmlLocalized(98, 236, 250, 60, 1076786, 0x7FFF); // Peach Trunk
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Token?.Deleted != false || info.ButtonID == 0)
|
||||
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;
|
||||
|
||||
// 8th anniversary
|
||||
/*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(HaunterMirrorDeed));
|
||||
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<ConfirmHeritageGump>();
|
||||
sender.Mobile.SendGump(new ConfirmHeritageGump(m_Token, types.ToArray(), cliloc));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.Mobile
|
||||
.SendLocalizedMessage(
|
||||
501311); // This option is currently disabled, while we evaluate it for game balance.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Projects/Scripts/Gumps/HonorSelf.cs
Normal file
25
Projects/Scripts/Gumps/HonorSelf.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class HonorSelf : Gump
|
||||
{
|
||||
private PlayerMobile m_from;
|
||||
|
||||
public HonorSelf(PlayerMobile from) : base(150, 50)
|
||||
{
|
||||
m_from = from;
|
||||
AddBackground(0, 0, 245, 145, 9250);
|
||||
AddButton(157, 101, 247, 248, 1);
|
||||
AddButton(81, 100, 241, 248, 0);
|
||||
AddHtml(21, 20, 203, 70, @"Are you sure you want to use
|
||||
honor points on yourself?", true);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1) HonorVirtue.ActivateEmbrace(m_from);
|
||||
}
|
||||
}
|
||||
}
|
||||
170
Projects/Scripts/Gumps/HouseDemolishGump.cs
Normal file
170
Projects/Scripts/Gumps/HouseDemolishGump.cs
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
using Server.Accounting;
|
||||
using Server.Guilds;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class HouseDemolishGump : Gump
|
||||
{
|
||||
private BaseHouse m_House;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public HouseDemolishGump(Mobile mobile, BaseHouse house) : base(110, 100)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_House = house;
|
||||
|
||||
mobile.CloseGump<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); // <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);
|
||||
AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767); // OKAY
|
||||
|
||||
AddButton(210, 250, 4005, 4007, 0);
|
||||
AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767); // 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;
|
||||
}
|
||||
|
||||
/*else 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;
|
||||
}
|
||||
|
||||
|
||||
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 = null;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
BankCheck check = toGive as BankCheck;
|
||||
|
||||
if (AccountGold.Enabled && check != null)
|
||||
{
|
||||
int worth = check.Worth;
|
||||
|
||||
if (m_Mobile.Account != null && m_Mobile.Account.DepositGold(worth))
|
||||
{
|
||||
check.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)
|
||||
{
|
||||
BankBox box = m_Mobile.BankBox;
|
||||
|
||||
if (box.TryDropItem(m_Mobile, toGive, false))
|
||||
{
|
||||
if (check != null)
|
||||
m_Mobile.SendLocalizedMessage(1060397,
|
||||
check.Worth.ToString()); // ~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.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
740
Projects/Scripts/Gumps/HouseGump.cs
Normal file
740
Projects/Scripts/Gumps/HouseGump.cs
Normal file
|
|
@ -0,0 +1,740 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class HouseListGump : Gump
|
||||
{
|
||||
private 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);
|
||||
AddHtmlLocalized(55, 388, 300, 20, 1011104); // Return to previous menu
|
||||
|
||||
AddHtmlLocalized(20, 20, 350, 20, number);
|
||||
|
||||
if (list == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
if (i != 0) AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, i / 16 + 1);
|
||||
|
||||
AddPage(i / 16 + 1);
|
||||
|
||||
if (i != 0) 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
|
||||
? $"Account of {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 bool m_AccountOf;
|
||||
private BaseHouse m_House;
|
||||
private List<Mobile> m_List, m_Copy;
|
||||
private int m_Number;
|
||||
|
||||
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);
|
||||
AddHtmlLocalized(55, 388, 300, 20, 1011104); // Return to previous menu
|
||||
|
||||
AddButton(20, 365, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 365, 300, 20, 1011270); // Remove now!
|
||||
|
||||
AddHtmlLocalized(20, 20, 350, 20, number);
|
||||
|
||||
if (list == null)
|
||||
return;
|
||||
|
||||
m_Copy = new List<Mobile>(list);
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
if (i % 15 == 0)
|
||||
{
|
||||
if (i != 0) AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, i / 15 + 1);
|
||||
|
||||
AddPage(i / 15 + 1);
|
||||
|
||||
if (i != 0) 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
|
||||
? $"Account of {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<HouseGump>();
|
||||
from.CloseGump<HouseListGump>();
|
||||
from.CloseGump<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 BaseHouse m_House;
|
||||
|
||||
public HouseGump(Mobile from, BaseHouse house) : base(20, 30)
|
||||
{
|
||||
if (house.Deleted)
|
||||
return;
|
||||
|
||||
m_House = house;
|
||||
|
||||
from.CloseGump<HouseGump>();
|
||||
from.CloseGump<HouseListGump>();
|
||||
from.CloseGump<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)
|
||||
{
|
||||
List<string> lines = Wrap(m_House.Sign.GetName());
|
||||
|
||||
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); // INFO
|
||||
AddButton(20, 103, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
AddHtmlLocalized(170, 103, 75, 20, 1011234); // FRIENDS
|
||||
AddButton(135, 103, 4005, 4007, 0, GumpButtonType.Page, 2);
|
||||
|
||||
AddHtmlLocalized(295, 103, 75, 20, 1011235); // OPTIONS
|
||||
AddButton(260, 103, 4005, 4007, 0, GumpButtonType.Page, 3);
|
||||
|
||||
AddHtmlLocalized(295, 390, 75, 20, 1011441); // EXIT
|
||||
AddButton(260, 390, 4005, 4007, 0);
|
||||
|
||||
AddHtmlLocalized(55, 390, 200, 20, 1011236); // Change this house's name!
|
||||
AddButton(20, 390, 4005, 4007, 1);
|
||||
|
||||
// Info page
|
||||
AddPage(1);
|
||||
|
||||
AddHtmlLocalized(20, 135, 100, 20, 1011242); // Owned by:
|
||||
AddHtml(120, 135, 100, 20, GetOwnerName());
|
||||
|
||||
AddHtmlLocalized(20, 170, 275, 20, 1011237); // Number of locked down items:
|
||||
AddHtml(320, 170, 50, 20, m_House.LockDownCount.ToString());
|
||||
|
||||
AddHtmlLocalized(20, 190, 275, 20, 1011238); // Maximum locked down items:
|
||||
AddHtml(320, 190, 50, 20, m_House.MaxLockDowns.ToString());
|
||||
|
||||
AddHtmlLocalized(20, 210, 275, 20, 1011239); // Number of secure containers:
|
||||
AddHtml(320, 210, 50, 20, m_House.SecureCount.ToString());
|
||||
|
||||
AddHtmlLocalized(20, 230, 275, 20, 1011240); // Maximum number of secure containers:
|
||||
AddHtml(320, 230, 50, 20, m_House.MaxSecures.ToString());
|
||||
|
||||
AddHtmlLocalized(20, 260, 400, 20, 1018032); // This house is properly placed.
|
||||
AddHtmlLocalized(20, 280, 400, 20, 1018035); // This house is of modern design.
|
||||
|
||||
if (m_House.Public)
|
||||
{
|
||||
// TODO: Validate exact placement
|
||||
AddHtmlLocalized(20, 305, 275, 20, 1011241); // Number of visits this building has had
|
||||
AddHtml(320, 305, 50, 20, m_House.Visits.ToString());
|
||||
}
|
||||
|
||||
// Friends page
|
||||
AddPage(2);
|
||||
|
||||
AddHtmlLocalized(45, 130, 150, 20, 1011266); // List of co-owners
|
||||
AddButton(20, 130, 2714, 2715, 2);
|
||||
|
||||
AddHtmlLocalized(45, 150, 150, 20, 1011267); // Add a co-owner
|
||||
AddButton(20, 150, 2714, 2715, 3);
|
||||
|
||||
AddHtmlLocalized(45, 170, 150, 20, 1018036); // Remove a co-owner
|
||||
AddButton(20, 170, 2714, 2715, 4);
|
||||
|
||||
AddHtmlLocalized(45, 190, 150, 20, 1011268); // Clear co-owner list
|
||||
AddButton(20, 190, 2714, 2715, 5);
|
||||
|
||||
AddHtmlLocalized(225, 130, 155, 20, 1011243); // List of Friends
|
||||
AddButton(200, 130, 2714, 2715, 6);
|
||||
|
||||
AddHtmlLocalized(225, 150, 155, 20, 1011244); // Add a Friend
|
||||
AddButton(200, 150, 2714, 2715, 7);
|
||||
|
||||
AddHtmlLocalized(225, 170, 155, 20, 1018037); // Remove a Friend
|
||||
AddButton(200, 170, 2714, 2715, 8);
|
||||
|
||||
AddHtmlLocalized(225, 190, 155, 20, 1011245); // Clear Friends list
|
||||
AddButton(200, 190, 2714, 2715, 9);
|
||||
|
||||
AddHtmlLocalized(120, 215, 280, 20, 1011258); // Ban someone from the house
|
||||
AddButton(95, 215, 2714, 2715, 10);
|
||||
|
||||
AddHtmlLocalized(120, 235, 280, 20, 1011259); // Eject someone from the house
|
||||
AddButton(95, 235, 2714, 2715, 11);
|
||||
|
||||
AddHtmlLocalized(120, 255, 280, 20, 1011260); // View a list of banned people
|
||||
AddButton(95, 255, 2714, 2715, 12);
|
||||
|
||||
AddHtmlLocalized(120, 275, 280, 20, 1011261); // Lift a ban
|
||||
AddButton(95, 275, 2714, 2715, 13);
|
||||
|
||||
// Options page
|
||||
AddPage(3);
|
||||
|
||||
AddHtmlLocalized(45, 150, 355, 30, 1011248); // Transfer ownership of the house
|
||||
AddButton(20, 150, 2714, 2715, 14);
|
||||
|
||||
AddHtmlLocalized(45, 180, 355, 30, 1011249); // Demolish house and get deed back
|
||||
AddButton(20, 180, 2714, 2715, 15);
|
||||
|
||||
if (!m_House.Public)
|
||||
{
|
||||
AddHtmlLocalized(45, 210, 355, 30, 1011247); // Change the house locks
|
||||
AddButton(20, 210, 2714, 2715, 16);
|
||||
|
||||
AddHtmlLocalized(45, 240, 350, 90, 1011253); // Declare this building to be public. This will make your front door unlockable.
|
||||
AddButton(20, 240, 2714, 2715, 17);
|
||||
}
|
||||
else
|
||||
{
|
||||
//AddHtmlLocalized( 45, 280, 350, 30, 1011250, false, false ); // Change the sign type
|
||||
AddHtmlLocalized(45, 210, 350, 30, 1011250); // Change the sign type
|
||||
AddButton(20, 210, 2714, 2715, 0, GumpButtonType.Page, 4);
|
||||
|
||||
AddHtmlLocalized(45, 240, 350, 30, 1011252); // Declare this building to be private.
|
||||
AddButton(20, 240, 2714, 2715, 17);
|
||||
|
||||
// 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); // Guild sign choices
|
||||
AddButton(350, 305, 252, 253, 0, GumpButtonType.Page, 5);
|
||||
|
||||
AddHtmlLocalized(200, 340, 355, 30, 1011277); // Okay that is fine.
|
||||
AddButton(350, 340, 4005, 4007, 18);
|
||||
|
||||
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); // Shop sign choices
|
||||
AddButton(350, 305, 250, 251, 0, GumpButtonType.Page, 4);
|
||||
|
||||
AddHtmlLocalized(200, 340, 355, 30, 1011277); // Okay that is fine.
|
||||
AddButton(350, 340, 4005, 4007, 18);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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<HouseGump>();
|
||||
from.CloseGump<HouseListGump>();
|
||||
from.CloseGump<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<HouseGump>();
|
||||
from.CloseGump<HouseListGump>();
|
||||
from.CloseGump<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)
|
||||
{
|
||||
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<HouseGump>();
|
||||
from.CloseGump<HouseListGump>();
|
||||
from.CloseGump<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<HouseGump>();
|
||||
from.CloseGump<HouseListGump>();
|
||||
from.CloseGump<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)
|
||||
{
|
||||
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<HouseGump>();
|
||||
from.CloseGump<HouseListGump>();
|
||||
from.CloseGump<HouseRemoveGump>();
|
||||
from.SendGump(new HouseListGump(1011271, m_House.Bans, m_House, true));
|
||||
|
||||
break;
|
||||
}
|
||||
case 13: // Remove ban
|
||||
{
|
||||
from.CloseGump<HouseGump>();
|
||||
from.CloseGump<HouseListGump>();
|
||||
from.CloseGump<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 this.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 15: // Demolish house
|
||||
{
|
||||
if (isOwner)
|
||||
{
|
||||
if (!Guild.NewGuildSystem && m_House.FindGuildstone() != null)
|
||||
{
|
||||
from.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.CloseGump<HouseDemolishGump>();
|
||||
from.SendGump(new HouseDemolishGump(from, m_House));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(501320); // Only the house owner may do this.
|
||||
}
|
||||
|
||||
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 this.
|
||||
}
|
||||
|
||||
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 this.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Server.Prompts
|
||||
{
|
||||
public class RenamePrompt : Prompt
|
||||
{
|
||||
private 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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1459
Projects/Scripts/Gumps/HouseGumpAOS.cs
Normal file
1459
Projects/Scripts/Gumps/HouseGumpAOS.cs
Normal file
File diff suppressed because it is too large
Load diff
62
Projects/Scripts/Gumps/HouseTransferGump.cs
Normal file
62
Projects/Scripts/Gumps/HouseTransferGump.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class HouseTransferGump : Gump
|
||||
{
|
||||
private Mobile m_From, m_To;
|
||||
private BaseHouse m_House;
|
||||
|
||||
public HouseTransferGump(Mobile from, Mobile to, BaseHouse house) : base(110, 100)
|
||||
{
|
||||
m_From = from;
|
||||
m_To = to;
|
||||
m_House = house;
|
||||
|
||||
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); // <CENTER>WARNING</CENTER>
|
||||
|
||||
AddImageTiled(10, 40, 400, 200, 2624);
|
||||
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.
|
||||
*/
|
||||
AddHtmlLocalized(10, 40, 400, 200, 1062086, 32512, false, true);
|
||||
|
||||
AddImageTiled(10, 250, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 250, 400, 20);
|
||||
|
||||
AddButton(10, 250, 4005, 4007, 1);
|
||||
AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767); // OKAY
|
||||
|
||||
AddButton(210, 250, 4005, 4007, 0);
|
||||
AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && !m_House.Deleted)
|
||||
m_House.EndConfirmTransfer(m_From, m_To);
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Projects/Scripts/Gumps/NoticeGump.cs
Normal file
47
Projects/Scripts/Gumps/NoticeGump.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public delegate void NoticeGumpCallback();
|
||||
|
||||
public class NoticeGump : Gump
|
||||
{
|
||||
private NoticeGumpCallback m_Callback;
|
||||
|
||||
public NoticeGump(int header, int headerColor, object content, int contentColor, int width, int height,
|
||||
NoticeGumpCallback callback = null) : base((640 - width) / 2, (480 - height) / 2)
|
||||
{
|
||||
m_Callback = callback;
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, width, height, 5054);
|
||||
|
||||
AddImageTiled(10, 10, width - 20, 20, 2624);
|
||||
AddAlphaRegion(10, 10, width - 20, 20);
|
||||
AddHtmlLocalized(10, 10, width - 20, 20, header, headerColor);
|
||||
|
||||
AddImageTiled(10, 40, width - 20, height - 80, 2624);
|
||||
AddAlphaRegion(10, 40, width - 20, height - 80);
|
||||
|
||||
if (content is int i)
|
||||
AddHtmlLocalized(10, 40, width - 20, height - 80, i, contentColor, false, true);
|
||||
else if (content is string)
|
||||
AddHtml(10, 40, width - 20, height - 80, $"<BASEFONT COLOR=#{contentColor:X6}>{content}</BASEFONT>", false,
|
||||
true);
|
||||
|
||||
AddImageTiled(10, height - 30, width - 20, 20, 2624);
|
||||
AddAlphaRegion(10, height - 30, width - 20, 20);
|
||||
AddButton(10, height - 30, 4005, 4007, 1);
|
||||
AddHtmlLocalized(40, height - 30, 120, 20, 1011036, 32767); // OKAY
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1)
|
||||
m_Callback?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
77
Projects/Scripts/Gumps/PetResurrectGump.cs
Normal file
77
Projects/Scripts/Gumps/PetResurrectGump.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class PetResurrectGump : Gump
|
||||
{
|
||||
private double m_HitsScalar;
|
||||
private BaseCreature m_Pet;
|
||||
|
||||
public PetResurrectGump(Mobile from, BaseCreature pet, double hitsScalar = 0.0) : base(50, 50)
|
||||
{
|
||||
from.CloseGump<PetResurrectGump>();
|
||||
|
||||
m_Pet = pet;
|
||||
m_HitsScalar = hitsScalar;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(10, 10, 265, 140, 0x242C);
|
||||
|
||||
AddItem(205, 40, 0x4);
|
||||
AddItem(227, 40, 0x5);
|
||||
|
||||
AddItem(180, 78, 0xCAE);
|
||||
AddItem(195, 90, 0xCAD);
|
||||
AddItem(218, 95, 0xCB0);
|
||||
|
||||
AddHtmlLocalized(30, 30, 150, 75, 1049665); // <div align=center>Wilt thou sanctify the resurrection of:</div>
|
||||
AddHtml(30, 70, 150, 25, $"<div align=CENTER>{pet.Name}</div>", true);
|
||||
|
||||
AddButton(40, 105, 0x81A, 0x81B, 0x1); // Okay
|
||||
AddButton(110, 105, 0x819, 0x818, 0x2); // Cancel
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (m_Pet.Deleted || !m_Pet.IsBonded || !m_Pet.IsDeadPet)
|
||||
return;
|
||||
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
if (m_Pet.Map == null || !m_Pet.Map.CanFit(m_Pet.Location, 16, false, false))
|
||||
{
|
||||
from.SendLocalizedMessage(503256); // You fail to resurrect the creature.
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_Pet.Region?.IsPartOf("Khaldun") == true) //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;
|
||||
}
|
||||
|
||||
m_Pet.PlaySound(0x214);
|
||||
m_Pet.FixedEffect(0x376A, 10, 16);
|
||||
m_Pet.ResurrectPet();
|
||||
|
||||
double decreaseAmount;
|
||||
|
||||
if (from == m_Pet.ControlMaster)
|
||||
decreaseAmount = 0.1;
|
||||
else
|
||||
decreaseAmount = 0.2;
|
||||
|
||||
for (int i = 0; i < m_Pet.Skills.Length; ++i) //Decrease all skills on pet.
|
||||
m_Pet.Skills[i].Base -= decreaseAmount;
|
||||
|
||||
if (!m_Pet.IsDeadPet && m_HitsScalar > 0)
|
||||
m_Pet.Hits = (int)(m_Pet.HitsMax * m_HitsScalar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1043
Projects/Scripts/Gumps/PlayerVendorGumps.cs
Normal file
1043
Projects/Scripts/Gumps/PlayerVendorGumps.cs
Normal file
File diff suppressed because it is too large
Load diff
242
Projects/Scripts/Gumps/PolymorphGump.cs
Normal file
242
Projects/Scripts/Gumps/PolymorphGump.cs
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
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 PolymorphEntry(int Art, int Body, int LocNum, int X, int Y)
|
||||
{
|
||||
ArtID = Art;
|
||||
BodyID = Body;
|
||||
LocNumber = LocNum;
|
||||
this.X = X;
|
||||
this.Y = Y;
|
||||
}
|
||||
|
||||
public int ArtID{ get; }
|
||||
|
||||
public int BodyID{ get; }
|
||||
|
||||
public int LocNumber{ get; }
|
||||
|
||||
public int X{ get; }
|
||||
|
||||
public int Y{ get; }
|
||||
}
|
||||
|
||||
|
||||
public class PolymorphGump : Gump
|
||||
{
|
||||
private static PolymorphCategory[] Categories =
|
||||
{
|
||||
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 Mobile m_Caster;
|
||||
private Item m_Scroll;
|
||||
|
||||
public PolymorphGump(Mobile caster, Item scroll) : base(50, 50)
|
||||
{
|
||||
m_Caster = caster;
|
||||
m_Scroll = scroll;
|
||||
|
||||
int x, y;
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 585, 393, 5054);
|
||||
AddBackground(195, 36, 387, 275, 3000);
|
||||
AddHtmlLocalized(0, 0, 510, 18, 1015234); // <center>Polymorph Selection Menu</center>
|
||||
AddHtmlLocalized(60, 355, 150, 18, 1011036); // OKAY
|
||||
AddButton(25, 355, 4005, 4007, 1, GumpButtonType.Reply, 1);
|
||||
AddHtmlLocalized(320, 355, 150, 18, 1011012); // CANCEL
|
||||
AddButton(285, 355, 4005, 4007, 0, GumpButtonType.Reply, 2);
|
||||
|
||||
y = 35;
|
||||
for (int i = 0; i < Categories.Length; i++)
|
||||
{
|
||||
PolymorphCategory cat = Categories[i];
|
||||
AddHtmlLocalized(5, y, 150, 25, cat.LocNumber, true);
|
||||
AddButton(155, y, 4005, 4007, 0, GumpButtonType.Page, i + 1);
|
||||
y += 25;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Categories.Length; i++)
|
||||
{
|
||||
PolymorphCategory cat = Categories[i];
|
||||
AddPage(i + 1);
|
||||
|
||||
for (int c = 0; c < cat.Entries.Length; c++)
|
||||
{
|
||||
PolymorphEntry entry = cat.Entries[c];
|
||||
x = 198 + c % 3 * 129;
|
||||
y = 38 + c / 3 * 67;
|
||||
|
||||
AddHtmlLocalized(x, y, 100, 18, entry.LocNumber);
|
||||
AddItem(x + 20, y + 25, entry.ArtID);
|
||||
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(m_Caster, m_Scroll, Categories[cat].Entries[ent].BodyID);
|
||||
spell.Cast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PolymorphCategory
|
||||
{
|
||||
public PolymorphCategory(int num, params PolymorphEntry[] entries)
|
||||
{
|
||||
LocNumber = num;
|
||||
Entries = entries;
|
||||
}
|
||||
|
||||
public PolymorphEntry[] Entries{ get; }
|
||||
|
||||
public int LocNumber{ get; }
|
||||
}
|
||||
}
|
||||
|
||||
public class NewPolymorphGump : Gump
|
||||
{
|
||||
private static readonly PolymorphEntry[] m_Entries =
|
||||
{
|
||||
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 Mobile m_Caster;
|
||||
private Item m_Scroll;
|
||||
|
||||
public NewPolymorphGump(Mobile caster, Item scroll) : base(0, 0)
|
||||
{
|
||||
m_Caster = caster;
|
||||
m_Scroll = scroll;
|
||||
|
||||
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);
|
||||
|
||||
AddHtmlLocalized(14, 12, 500, 20, 1015234, 0x7FFF); // <center>Polymorph Selection Menu</center>
|
||||
|
||||
AddButton(10, 374, 0xFB1, 0xFB2, 0);
|
||||
AddHtmlLocalized(45, 376, 450, 20, 1060051, 0x7FFF); // 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)
|
||||
{
|
||||
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, page);
|
||||
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next
|
||||
}
|
||||
|
||||
AddPage(page);
|
||||
|
||||
if (page > 1)
|
||||
{
|
||||
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
|
||||
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back
|
||||
}
|
||||
}
|
||||
|
||||
int x = pos % 2 == 0 ? 14 : 264;
|
||||
int y = pos / 2 * 64 + 44;
|
||||
|
||||
AddImageTiledButton(x, y, 0x918, 0x919, i + 1, GumpButtonType.Reply, 0, entry.ArtID, 0x0, entry.X, entry.Y);
|
||||
AddHtmlLocalized(x + 84, y, 250, 60, entry.LocNumber, 0x7FFF);
|
||||
}
|
||||
}
|
||||
|
||||
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(m_Caster, m_Scroll, m_Entries[idx].BodyID);
|
||||
spell.Cast();
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Projects/Scripts/Gumps/Props/PropsConfig.cs
Normal file
42
Projects/Scripts/Gumps/Props/PropsConfig.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
namespace Server.Gumps
|
||||
{
|
||||
public class PropsConfig
|
||||
{
|
||||
public static readonly bool OldStyle = false;
|
||||
|
||||
public static readonly int GumpOffsetX = 30;
|
||||
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
|
||||
|
||||
public static readonly int
|
||||
HeaderGumpID = OldStyle ? 0x0BBC : 0x0E14; // Light offwhite, textured : Dark navy blue, textured
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
692
Projects/Scripts/Gumps/Props/PropsGump.cs
Normal file
692
Projects/Scripts/Gumps/Props/PropsGump.cs
Normal file
|
|
@ -0,0 +1,692 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Network;
|
||||
using CPA = Server.CommandPropertyAttribute;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class StackEntry
|
||||
{
|
||||
public object m_Object;
|
||||
public PropertyInfo m_Property;
|
||||
|
||||
public StackEntry(object obj, PropertyInfo prop)
|
||||
{
|
||||
m_Object = obj;
|
||||
m_Property = prop;
|
||||
}
|
||||
}
|
||||
|
||||
public class PropertiesGump : 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 bool PrevLabel = OldStyle, NextLabel = OldStyle;
|
||||
private static bool TypeLabel = !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;
|
||||
|
||||
public static string[] m_BoolNames = { "True", "False" };
|
||||
public static object[] m_BoolValues = { true, false };
|
||||
|
||||
public static string[] m_PoisonNames = { "None", "Lesser", "Regular", "Greater", "Deadly", "Lethal" };
|
||||
|
||||
public static object[] m_PoisonValues =
|
||||
{ null, Poison.Lesser, Poison.Regular, Poison.Greater, Poison.Deadly, Poison.Lethal };
|
||||
|
||||
private static Type typeofMobile = typeof(Mobile);
|
||||
private static Type typeofItem = typeof(Item);
|
||||
private static Type typeofType = typeof(Type);
|
||||
private static Type typeofPoint3D = typeof(Point3D);
|
||||
private static Type typeofPoint2D = typeof(Point2D);
|
||||
private static Type typeofTimeSpan = typeof(TimeSpan);
|
||||
private static Type typeofCustomEnum = typeof(CustomEnumAttribute);
|
||||
private static Type typeofEnum = typeof(Enum);
|
||||
private static Type typeofBool = typeof(bool);
|
||||
private static Type typeofString = typeof(string);
|
||||
private static Type typeofText = typeof(TextDefinition);
|
||||
private static Type typeofPoison = typeof(Poison);
|
||||
private static Type typeofMap = typeof(Map);
|
||||
private static Type typeofSkills = typeof(Skills);
|
||||
private static Type typeofPropertyObject = typeof(PropertyObjectAttribute);
|
||||
private static Type typeofNoSort = typeof(NoSortAttribute);
|
||||
|
||||
private static Type[] typeofReal =
|
||||
{
|
||||
typeof(float),
|
||||
typeof(double)
|
||||
};
|
||||
|
||||
private static Type[] typeofNumeric =
|
||||
{
|
||||
typeof(byte),
|
||||
typeof(short),
|
||||
typeof(int),
|
||||
typeof(long),
|
||||
typeof(sbyte),
|
||||
typeof(ushort),
|
||||
typeof(uint),
|
||||
typeof(ulong)
|
||||
};
|
||||
|
||||
private static Type typeofCPA = typeof(CPA);
|
||||
private static Type typeofObject = typeof(object);
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private Type m_Type;
|
||||
|
||||
public PropertiesGump(Mobile mobile, object o) : base(GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Object = o;
|
||||
m_Type = o.GetType();
|
||||
m_List = BuildList();
|
||||
|
||||
Initialize(0);
|
||||
}
|
||||
|
||||
public PropertiesGump(Mobile mobile, object o, Stack<StackEntry> stack, StackEntry parent) : base(GumpOffsetX,
|
||||
GumpOffsetY)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Object = o;
|
||||
m_Type = o.GetType();
|
||||
m_Stack = stack;
|
||||
m_List = BuildList();
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
if (m_Stack == null)
|
||||
m_Stack = new Stack<StackEntry>();
|
||||
|
||||
m_Stack.Push(parent);
|
||||
}
|
||||
|
||||
Initialize(0);
|
||||
}
|
||||
|
||||
public PropertiesGump(Mobile mobile, object o, Stack<StackEntry> stack, List<object> list, int page) : base(GumpOffsetX,
|
||||
GumpOffsetY)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Object = o;
|
||||
|
||||
if (o != null)
|
||||
m_Type = o.GetType();
|
||||
|
||||
m_List = list;
|
||||
m_Stack = stack;
|
||||
|
||||
Initialize(page);
|
||||
}
|
||||
|
||||
private void Initialize(int page)
|
||||
{
|
||||
m_Page = page;
|
||||
|
||||
int count = m_List.Count - page * EntryCount;
|
||||
|
||||
if (count < 0)
|
||||
count = 0;
|
||||
else if (count > EntryCount)
|
||||
count = EntryCount;
|
||||
|
||||
int lastIndex = page * EntryCount + count - 1;
|
||||
|
||||
if (lastIndex >= 0 && lastIndex < m_List.Count && m_List[lastIndex] == null)
|
||||
--count;
|
||||
|
||||
int totalHeight = OffsetSize + (EntryHeight + OffsetSize) * (count + 1);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
|
||||
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)
|
||||
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
||||
else
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
|
||||
|
||||
if (PrevLabel)
|
||||
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
||||
}
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
if (!OldStyle)
|
||||
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (TypeLabel && m_Type != null)
|
||||
AddHtml(x, y, emptyWidth, EntryHeight,
|
||||
$"<BASEFONT COLOR=#FAFAFA><CENTER>{m_Type.Name}</CENTER></BASEFONT>");
|
||||
|
||||
x += emptyWidth + OffsetSize;
|
||||
|
||||
if (!OldStyle)
|
||||
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if ((page + 1) * EntryCount < m_List.Count)
|
||||
{
|
||||
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1);
|
||||
|
||||
if (NextLabel)
|
||||
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
|
||||
}
|
||||
|
||||
for (int i = 0, index = page * EntryCount; i < count && index < m_List.Count; ++i, ++index)
|
||||
{
|
||||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
object o = m_List[index];
|
||||
|
||||
if (o == null)
|
||||
{
|
||||
AddImageTiled(x - OffsetSize, y, TotalWidth, EntryHeight, BackGumpID + 4);
|
||||
}
|
||||
else if (o is Type type)
|
||||
{
|
||||
AddImageTiled(x, y, TypeWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, TypeWidth - TextOffsetX, EntryHeight, TextHue, type.Name);
|
||||
x += TypeWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
}
|
||||
else if (o is PropertyInfo prop)
|
||||
{
|
||||
AddImageTiled(x, y, NameWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, NameWidth - TextOffsetX, EntryHeight, TextHue, prop.Name);
|
||||
x += NameWidth + OffsetSize;
|
||||
AddImageTiled(x, y, ValueWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, ValueWidth - TextOffsetX, EntryHeight, TextHue, ValueToString(prop));
|
||||
x += ValueWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
|
||||
CPA cpa = GetCPA(prop);
|
||||
|
||||
if (prop.CanWrite && cpa != null && m_Mobile.AccessLevel >= cpa.WriteLevel && !cpa.ReadOnly)
|
||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if (!BaseCommand.IsAccessible(from, m_Object))
|
||||
{
|
||||
from.SendMessage("You may no longer access their properties.");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: // Closed
|
||||
{
|
||||
if (m_Stack?.Count > 0)
|
||||
{
|
||||
StackEntry entry = m_Stack.Pop();
|
||||
from.SendGump(new PropertiesGump(from, entry.m_Object, m_Stack, null));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Previous
|
||||
{
|
||||
if (m_Page > 0)
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Next
|
||||
{
|
||||
if ((m_Page + 1) * EntryCount < m_List.Count)
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int index = m_Page * EntryCount + (info.ButtonID - 3);
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
PropertyInfo prop = m_List[index] as PropertyInfo;
|
||||
|
||||
if (prop == null)
|
||||
return;
|
||||
|
||||
CPA attr = GetCPA(prop);
|
||||
|
||||
if (!prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel || attr.ReadOnly)
|
||||
return;
|
||||
|
||||
Type type = prop.PropertyType;
|
||||
|
||||
if (IsType(type, typeofMobile) || IsType(type, typeofItem))
|
||||
{
|
||||
from.SendGump(new SetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofType))
|
||||
{
|
||||
from.Target = new SetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List);
|
||||
}
|
||||
else if (IsType(type, typeofPoint3D))
|
||||
{
|
||||
from.SendGump(new SetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofPoint2D))
|
||||
{
|
||||
from.SendGump(new SetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofTimeSpan))
|
||||
{
|
||||
from.SendGump(new SetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsCustomEnum(type))
|
||||
{
|
||||
from.SendGump(new SetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
GetCustomEnumNames(type)));
|
||||
}
|
||||
else if (IsType(type, typeofEnum))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
Enum.GetNames(type), GetObjects(Enum.GetValues(type))));
|
||||
}
|
||||
else if (IsType(type, typeofBool))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames,
|
||||
m_BoolValues));
|
||||
}
|
||||
else if (IsType(type, typeofString) || IsType(type, typeofReal) || IsType(type, typeofNumeric) ||
|
||||
IsType(type, typeofText))
|
||||
{
|
||||
from.SendGump(new SetGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofPoison))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames,
|
||||
m_PoisonValues));
|
||||
}
|
||||
else if (IsType(type, typeofMap))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
Map.GetMapNames(), Map.GetMapValues().ToArray<object>()));
|
||||
}
|
||||
else if (IsType(type, typeofSkills) && m_Object is Mobile mobile)
|
||||
{
|
||||
from.SendGump(new PropertiesGump(from, mobile, m_Stack, m_List, m_Page));
|
||||
from.SendGump(new SkillsGump(from, mobile));
|
||||
}
|
||||
else if (HasAttribute(type, typeofPropertyObject, true))
|
||||
{
|
||||
object obj = prop.GetValue(m_Object, null);
|
||||
|
||||
if (obj != null)
|
||||
from.SendGump(new PropertiesGump(from, obj, m_Stack, new StackEntry(m_Object, prop)));
|
||||
else
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static object[] GetObjects(Array a)
|
||||
{
|
||||
object[] list = new object[a.Length];
|
||||
|
||||
for (int i = 0; i < list.Length; ++i)
|
||||
list[i] = a.GetValue(i);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static bool IsCustomEnum(Type type)
|
||||
{
|
||||
return type.IsDefined(typeofCustomEnum, false);
|
||||
}
|
||||
|
||||
public static void OnValueChanged(object obj, PropertyInfo prop, Stack<StackEntry> stack)
|
||||
{
|
||||
if (stack == null || stack.Count == 0)
|
||||
return;
|
||||
|
||||
if (!prop.PropertyType.IsValueType)
|
||||
return;
|
||||
|
||||
StackEntry peek = stack.Peek();
|
||||
|
||||
if (peek.m_Property.CanWrite)
|
||||
peek.m_Property.SetValue(peek.m_Object, obj, null);
|
||||
}
|
||||
|
||||
private static string[] GetCustomEnumNames(Type type)
|
||||
{
|
||||
object[] attrs = type.GetCustomAttributes(typeofCustomEnum, false);
|
||||
|
||||
if (attrs.Length == 0)
|
||||
return new string[0];
|
||||
|
||||
if (!(attrs[0] is CustomEnumAttribute ce))
|
||||
return new string[0];
|
||||
|
||||
return ce.Names;
|
||||
}
|
||||
|
||||
private static bool HasAttribute(Type type, Type check, bool inherit)
|
||||
{
|
||||
return type.GetCustomAttributes(check, inherit).Length > 0;
|
||||
}
|
||||
|
||||
private static bool IsType(Type type, Type check)
|
||||
{
|
||||
return type == check || type.IsSubclassOf(check);
|
||||
}
|
||||
|
||||
private static bool IsType(Type type, Type[] check)
|
||||
{
|
||||
for (int i = 0; i < check.Length; ++i)
|
||||
if (IsType(type, check[i]))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private string ValueToString(PropertyInfo prop)
|
||||
{
|
||||
return ValueToString(m_Object, prop);
|
||||
}
|
||||
|
||||
public static string ValueToString(object obj, PropertyInfo prop)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ValueToString(prop.GetValue(obj, null));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return $"!{e.GetType()}!";
|
||||
}
|
||||
}
|
||||
|
||||
public static string ValueToString(object o)
|
||||
{
|
||||
if (o == null) return "-null-";
|
||||
if (o is string s) return $"\"{s}\"";
|
||||
if (o is bool) return o.ToString();
|
||||
if (o is char c) return $"0x{(int)c:X} '{c}'";
|
||||
if (o is Serial serial)
|
||||
{
|
||||
if (serial.IsValid)
|
||||
{
|
||||
if (serial.IsItem) return $"(I) 0x{serial.Value:X}";
|
||||
if (serial.IsMobile) return $"(M) 0x{serial.Value:X}";
|
||||
}
|
||||
|
||||
return $"(?) 0x{serial.Value:X}";
|
||||
}
|
||||
|
||||
if (o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong)
|
||||
return $"{o} (0x{o:X})";
|
||||
if (o is Mobile mobile) return $"(M) 0x{mobile.Serial.Value:X} \"{mobile.Name}\"";
|
||||
if (o is Item item) return $"(I) 0x{item.Serial.Value:X}";
|
||||
if (o is Type type) return type.Name;
|
||||
if (o is TextDefinition definition) return definition.Format(true);
|
||||
|
||||
return o.ToString();
|
||||
}
|
||||
|
||||
private List<object> BuildList()
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
|
||||
if (m_Type == null)
|
||||
return list;
|
||||
|
||||
PropertyInfo[] props = m_Type.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
|
||||
|
||||
List<KeyValuePair<Type, List<PropertyInfo>>> groups = GetGroups(m_Type, props);
|
||||
|
||||
for (int i = 0; i < groups.Count; ++i)
|
||||
{
|
||||
KeyValuePair<Type, List<PropertyInfo>> kvp = groups[i];
|
||||
|
||||
if (!HasAttribute(kvp.Key, typeofNoSort, false))
|
||||
kvp.Value.Sort(PropertySorter.Instance);
|
||||
|
||||
if (i != 0)
|
||||
list.Add(null);
|
||||
|
||||
list.Add(kvp.Key);
|
||||
list.AddRange(kvp.Value);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static CPA GetCPA(PropertyInfo prop)
|
||||
{
|
||||
object[] attrs = prop.GetCustomAttributes(typeofCPA, false);
|
||||
|
||||
if (attrs.Length > 0)
|
||||
return attrs[0] as CPA;
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<KeyValuePair<Type, List<PropertyInfo>>> GetGroups(Type objectType, PropertyInfo[] props)
|
||||
{
|
||||
Dictionary<Type, List<PropertyInfo>> groups = new Dictionary<Type, List<PropertyInfo>>();
|
||||
|
||||
for (int i = 0; i < props.Length; ++i)
|
||||
{
|
||||
PropertyInfo prop = props[i];
|
||||
|
||||
if (prop.CanRead)
|
||||
{
|
||||
CPA attr = GetCPA(prop);
|
||||
|
||||
if (attr != null && m_Mobile.AccessLevel >= attr.ReadLevel)
|
||||
{
|
||||
Type type = prop.DeclaringType;
|
||||
|
||||
while (true)
|
||||
{
|
||||
Type baseType = type?.BaseType;
|
||||
|
||||
if (baseType == typeofObject || baseType?.GetProperty(prop.Name, prop.PropertyType) == null)
|
||||
break;
|
||||
|
||||
type = baseType;
|
||||
}
|
||||
|
||||
if (type != null && !groups.ContainsKey(type))
|
||||
groups[type] = new List<PropertyInfo>{ prop };
|
||||
else
|
||||
groups[type].Add(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<KeyValuePair<Type, List<PropertyInfo>>> list = groups.ToList();
|
||||
list.Sort(new GroupComparer(objectType));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static object GetObjectFromString(Type t, string s)
|
||||
{
|
||||
if (t == typeof(string)) return s;
|
||||
|
||||
if (t == typeof(byte) || t == typeof(sbyte) || t == typeof(short) || t == typeof(ushort) || t == typeof(int) ||
|
||||
t == typeof(uint) || t == typeof(long) || t == typeof(ulong))
|
||||
{
|
||||
if (s.StartsWith("0x"))
|
||||
{
|
||||
if (t == typeof(ulong) || t == typeof(uint) || t == typeof(ushort) || t == typeof(byte))
|
||||
return Convert.ChangeType(Convert.ToUInt64(s.Substring(2), 16), t);
|
||||
|
||||
return Convert.ChangeType(Convert.ToInt64(s.Substring(2), 16), t);
|
||||
}
|
||||
|
||||
return Convert.ChangeType(s, t);
|
||||
}
|
||||
|
||||
if (t == typeof(double) || t == typeof(float)) return Convert.ChangeType(s, t);
|
||||
if (t.IsDefined(typeof(ParsableAttribute), false))
|
||||
{
|
||||
MethodInfo parseMethod = t.GetMethod("Parse", new[] { typeof(string) });
|
||||
|
||||
return parseMethod.Invoke(null, new object[] { s });
|
||||
}
|
||||
|
||||
throw new Exception("bad");
|
||||
}
|
||||
|
||||
private static string GetStringFromObject(object o)
|
||||
{
|
||||
if (o == null) return "-null-";
|
||||
if (o is string s) return $"\"{s}\"";
|
||||
if (o is bool) return o.ToString();
|
||||
if (o is char c) return $"0x{(int)c:X} '{c}'";
|
||||
if (o is Serial serial)
|
||||
{
|
||||
if (serial.IsValid)
|
||||
{
|
||||
if (serial.IsItem) return $"(I) 0x{serial.Value:X}";
|
||||
if (serial.IsMobile) return $"(M) 0x{serial.Value:X}";
|
||||
}
|
||||
|
||||
return $"(?) 0x{serial.Value:X}";
|
||||
}
|
||||
|
||||
if (o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong)
|
||||
return $"{o} (0x{o:X})";
|
||||
if (o is Mobile mobile) return $"(M) 0x{mobile.Serial.Value:X} \"{mobile.Name}\"";
|
||||
if (o is Item item) return $"(I) 0x{item.Serial.Value:X}";
|
||||
if (o is Type type) return type.Name;
|
||||
|
||||
return o.ToString();
|
||||
}
|
||||
|
||||
private class PropertySorter : IComparer<PropertyInfo>
|
||||
{
|
||||
public static readonly PropertySorter Instance = new PropertySorter();
|
||||
|
||||
private PropertySorter()
|
||||
{
|
||||
}
|
||||
|
||||
public int Compare(PropertyInfo x, PropertyInfo y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
|
||||
return y == null ? 1 : x.Name.CompareTo(x.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private class GroupComparer : IComparer<KeyValuePair<Type, List<PropertyInfo>>>
|
||||
{
|
||||
private Type m_Start;
|
||||
|
||||
public GroupComparer(Type start)
|
||||
{
|
||||
m_Start = start;
|
||||
}
|
||||
|
||||
public int Compare(KeyValuePair<Type, List<PropertyInfo>> x, KeyValuePair<Type, List<PropertyInfo>> y)
|
||||
{
|
||||
return GetDistance(x.Key).CompareTo(GetDistance(y.Key));
|
||||
}
|
||||
|
||||
private int GetDistance(Type type)
|
||||
{
|
||||
Type current = m_Start;
|
||||
|
||||
int dist;
|
||||
|
||||
for (dist = 0; current != null && current != typeofObject && current != type; ++dist)
|
||||
current = current.BaseType;
|
||||
|
||||
return dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
302
Projects/Scripts/Gumps/Props/SetBodyGump.cs
Normal file
302
Projects/Scripts/Gumps/Props/SetBodyGump.cs
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class SetBodyGump : Gump
|
||||
{
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private const int SelectedColor32 = 0x8080FF;
|
||||
private const int TextColor32 = 0xFFFFFF;
|
||||
|
||||
private static List<InternalEntry> m_Monster, m_Animal, m_Sea, m_Human;
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private List<InternalEntry> m_OurList;
|
||||
private int m_OurPage;
|
||||
private ModelBodyType m_OurType;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetBodyGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list,
|
||||
int ourPage = 0, List<InternalEntry> ourList = null, ModelBodyType ourType = ModelBodyType.Invalid)
|
||||
: 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)
|
||||
{
|
||||
InternalEntry entry = ourList[index];
|
||||
int itemID = entry.ItemID;
|
||||
|
||||
Rectangle2D bounds = ItemBounds.Table[itemID & 0x3FFF];
|
||||
|
||||
int x = 15 + i % 4 * 125;
|
||||
int 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);
|
||||
|
||||
x += 6;
|
||||
y += 67;
|
||||
|
||||
AddHtml(x + 0, y - 1, 108, 21, Center(entry.DisplayName));
|
||||
AddHtml(x + 0, y + 1, 108, 21, Center(entry.DisplayName));
|
||||
AddHtml(x - 1, y + 0, 108, 21, Center(entry.DisplayName));
|
||||
AddHtml(x + 1, y + 0, 108, 21, Center(entry.DisplayName));
|
||||
AddHtml(x + 0, y + 0, 108, 21, Color(Center(entry.DisplayName), TextColor32));
|
||||
}
|
||||
|
||||
if (ourPage > 0)
|
||||
AddButton(480, 12, 0x15E3, 0x15E7, 5);
|
||||
|
||||
if ((ourPage + 1) * 12 < ourList.Count)
|
||||
AddButton(497, 12, 0x15E1, 0x15E5, 6);
|
||||
}
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
{
|
||||
return $"<CENTER>{text}</CENTER>";
|
||||
}
|
||||
|
||||
public string Color(string text, int color)
|
||||
{
|
||||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
|
||||
public void AddTypeButton(int x, int y, int buttonID, string text, ModelBodyType type)
|
||||
{
|
||||
bool isSelection = m_OurType == type;
|
||||
|
||||
AddButton(x, y - 1, isSelection ? 4006 : 4005, 4007, buttonID);
|
||||
AddHtml(x + 35, y, 200, 20, Color(text, isSelection ? SelectedColor32 : LabelColor32));
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
int 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;
|
||||
List<InternalEntry> 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
|
||||
{
|
||||
InternalEntry entry = 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 List<InternalEntry>();
|
||||
m_Animal = new List<InternalEntry>();
|
||||
m_Sea = new List<InternalEntry>();
|
||||
m_Human = new List<InternalEntry>();
|
||||
|
||||
List<BodyEntry> entries = Docs.LoadBodies();
|
||||
|
||||
for (int i = 0; i < entries.Count; ++i)
|
||||
{
|
||||
BodyEntry oldEntry = entries[i];
|
||||
int bodyID = oldEntry.Body.BodyID;
|
||||
|
||||
if (((Body)bodyID).IsEmpty)
|
||||
continue;
|
||||
|
||||
List<InternalEntry> list;
|
||||
|
||||
switch (oldEntry.BodyType)
|
||||
{
|
||||
default: continue;
|
||||
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;
|
||||
}
|
||||
|
||||
int 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();
|
||||
}
|
||||
|
||||
public class InternalEntry : IComparable<InternalEntry>
|
||||
{
|
||||
private static 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_"
|
||||
};
|
||||
|
||||
public InternalEntry(int body, int itemID, string name)
|
||||
{
|
||||
Body = body;
|
||||
ItemID = itemID;
|
||||
Name = name;
|
||||
|
||||
DisplayName = name.ToLower();
|
||||
|
||||
for (int i = 0; i < m_GroupNames.Length; ++i)
|
||||
if (DisplayName.StartsWith(m_GroupNames[i]))
|
||||
{
|
||||
DisplayName = DisplayName.Substring(m_GroupNames[i].Length);
|
||||
break;
|
||||
}
|
||||
|
||||
DisplayName = DisplayName.Replace('_', ' ');
|
||||
}
|
||||
|
||||
public int Body{ get; }
|
||||
|
||||
public int ItemID{ get; }
|
||||
|
||||
public string Name{ get; }
|
||||
|
||||
public string DisplayName{ get; }
|
||||
|
||||
public int CompareTo(InternalEntry comp)
|
||||
{
|
||||
int v = Name.CompareTo(comp.Name);
|
||||
|
||||
if (v == 0)
|
||||
Body.CompareTo(comp.Body);
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Projects/Scripts/Gumps/Props/SetCustomEnumGump.cs
Normal file
52
Projects/Scripts/Gumps/Props/SetCustomEnumGump.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class SetCustomEnumGump : SetListOptionGump
|
||||
{
|
||||
private string[] m_Names;
|
||||
|
||||
public SetCustomEnumGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int propspage,
|
||||
List<object> list, string[] names) : base(prop, mobile, o, stack, propspage, list, names, null)
|
||||
{
|
||||
m_Names = names;
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo relayInfo)
|
||||
{
|
||||
int index = relayInfo.ButtonID - 1;
|
||||
|
||||
if (index >= 0 && index < m_Names.Length)
|
||||
try
|
||||
{
|
||||
MethodInfo info = m_Property.PropertyType.GetMethod("Parse", new[] { typeof(string) });
|
||||
|
||||
string result;
|
||||
|
||||
if (info != null)
|
||||
result = Properties.SetDirect(m_Mobile, m_Object, m_Object, m_Property, m_Property.Name,
|
||||
info.Invoke(null, new object[] { m_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, m_Names[index], false), true);
|
||||
else
|
||||
result = "";
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
283
Projects/Scripts/Gumps/Props/SetGump.cs
Normal file
283
Projects/Scripts/Gumps/Props/SetGump.cs
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.HuePickers;
|
||||
using Server.Network;
|
||||
|
||||
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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list) : base(
|
||||
GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
m_Property = prop;
|
||||
m_Mobile = mobile;
|
||||
m_Object = o;
|
||||
m_Stack = stack;
|
||||
m_Page = page;
|
||||
m_List = list;
|
||||
|
||||
bool canNull = !prop.PropertyType.IsValueType;
|
||||
bool canDye = prop.IsDefined(typeof(HueAttribute), false);
|
||||
bool isBody = prop.IsDefined(typeof(BodyAttribute), false);
|
||||
|
||||
object val = prop.GetValue(m_Object, null);
|
||||
string initialText;
|
||||
|
||||
if (val == null)
|
||||
initialText = "";
|
||||
else if (val is TextDefinition definition)
|
||||
initialText = definition.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);
|
||||
|
||||
int x = BorderSize + OffsetSize;
|
||||
int 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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
object toSet;
|
||||
bool shouldSet, shouldSend = true;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
TextRelay 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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
|
||||
public InternalPicker(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page,
|
||||
List<object> 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
187
Projects/Scripts/Gumps/Props/SetListOptionGump.cs
Normal file
187
Projects/Scripts/Gumps/Props/SetListOptionGump.cs
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
|
||||
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 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;
|
||||
protected List<object> m_List;
|
||||
protected Mobile m_Mobile;
|
||||
protected object m_Object;
|
||||
protected int m_Page;
|
||||
protected PropertyInfo m_Property;
|
||||
protected Stack<StackEntry> m_Stack;
|
||||
|
||||
private object[] m_Values;
|
||||
|
||||
public SetListOptionGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int propspage,
|
||||
List<object> 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;
|
||||
|
||||
int pages = (names.Length + EntryCount - 1) / EntryCount;
|
||||
int index = 0;
|
||||
|
||||
for (int page = 1; page <= pages; ++page)
|
||||
{
|
||||
AddPage(page);
|
||||
|
||||
int start = (page - 1) * EntryCount;
|
||||
int count = names.Length - start;
|
||||
|
||||
if (count > EntryCount)
|
||||
count = EntryCount;
|
||||
|
||||
int totalHeight = OffsetSize + (count + 2) * (EntryHeight + OffsetSize);
|
||||
int backHeight = BorderSize + totalHeight + BorderSize;
|
||||
|
||||
AddBackground(0, 0, BackWidth, backHeight, BackGumpID);
|
||||
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);
|
||||
|
||||
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 (int i = 0; i < count; ++i)
|
||||
AddRect(i + 1, names[index], ++index);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddRect(int index, string str, int button)
|
||||
{
|
||||
int x = BorderSize + OffsetSize;
|
||||
int 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);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
int index = info.ButtonID - 1;
|
||||
|
||||
if (index >= 0 && index < m_Values.Length)
|
||||
try
|
||||
{
|
||||
object toSet = m_Values[index];
|
||||
|
||||
string 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
272
Projects/Scripts/Gumps/Props/SetObjectGump.cs
Normal file
272
Projects/Scripts/Gumps/Props/SetObjectGump.cs
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
|
||||
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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private Type m_Type;
|
||||
|
||||
public SetObjectGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, Type type, int page,
|
||||
List<object> 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;
|
||||
|
||||
string initialText = PropertiesGump.ValueToString(o, prop);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
|
||||
AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), TotalHeight,
|
||||
OffsetGumpID);
|
||||
|
||||
int x = BorderSize + OffsetSize;
|
||||
int 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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
bool 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));
|
||||
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);
|
||||
shouldSend = false;
|
||||
break;
|
||||
}
|
||||
case 2: // Change by Serial
|
||||
{
|
||||
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
|
||||
{
|
||||
try
|
||||
{
|
||||
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, "(null)");
|
||||
m_Property.SetValue(m_Object, null, null);
|
||||
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: // View Properties
|
||||
{
|
||||
object 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;
|
||||
}
|
||||
}
|
||||
|
||||
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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private Type m_Type;
|
||||
|
||||
public InternalPrompt(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, Type type, int page,
|
||||
List<object> 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)
|
||||
{
|
||||
try
|
||||
{
|
||||
uint serial = Utility.ToUInt32(text);
|
||||
|
||||
IEntity toSet = World.FindEntity(serial);
|
||||
|
||||
if (toSet == null)
|
||||
{
|
||||
m_Mobile.SendMessage("No object with that serial was found.");
|
||||
}
|
||||
else if (!m_Type.IsInstanceOfType(toSet))
|
||||
{
|
||||
m_Mobile.SendMessage("The object with that serial could not be assigned to a property of type : {0}",
|
||||
m_Type.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_Mobile.SendMessage("Bad format");
|
||||
}
|
||||
|
||||
m_Mobile.SendGump(new SetObjectGump(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
67
Projects/Scripts/Gumps/Props/SetObjectTarget.cs
Normal file
67
Projects/Scripts/Gumps/Props/SetObjectTarget.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class SetObjectTarget : Target
|
||||
{
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private Type m_Type;
|
||||
|
||||
public SetObjectTarget(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, Type type, int page,
|
||||
List<object> 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 addonComponent)
|
||||
targeted = addonComponent.Addon;
|
||||
|
||||
if (m_Type.IsInstanceOfType(targeted))
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
231
Projects/Scripts/Gumps/Props/SetPoint2DGump.cs
Normal file
231
Projects/Scripts/Gumps/Props/SetPoint2DGump.cs
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetPoint2DGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list)
|
||||
: base(GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
m_Property = prop;
|
||||
m_Mobile = mobile;
|
||||
m_Object = o;
|
||||
m_Stack = stack;
|
||||
m_Page = page;
|
||||
m_List = list;
|
||||
|
||||
Point2D p = (Point2D)prop.GetValue(o, null);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
|
||||
AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), TotalHeight,
|
||||
OffsetGumpID);
|
||||
|
||||
int x = BorderSize + OffsetSize;
|
||||
int 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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
TextRelay x = info.GetTextEntry(0);
|
||||
TextRelay 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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
|
||||
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page,
|
||||
List<object> 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)
|
||||
{
|
||||
if (targeted is IPoint3D p)
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
238
Projects/Scripts/Gumps/Props/SetPoint3DGump.cs
Normal file
238
Projects/Scripts/Gumps/Props/SetPoint3DGump.cs
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetPoint3DGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list)
|
||||
: base(GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
m_Property = prop;
|
||||
m_Mobile = mobile;
|
||||
m_Object = o;
|
||||
m_Stack = stack;
|
||||
m_Page = page;
|
||||
m_List = list;
|
||||
|
||||
Point3D p = (Point3D)prop.GetValue(o, null);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
|
||||
AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), TotalHeight,
|
||||
OffsetGumpID);
|
||||
|
||||
int x = BorderSize + OffsetSize;
|
||||
int 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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
TextRelay x = info.GetTextEntry(0);
|
||||
TextRelay y = info.GetTextEntry(1);
|
||||
TextRelay 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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
|
||||
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page,
|
||||
List<object> 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)
|
||||
{
|
||||
if (targeted is IPoint3D p)
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
229
Projects/Scripts/Gumps/Props/SetTimeSpanGump.cs
Normal file
229
Projects/Scripts/Gumps/Props/SetTimeSpanGump.cs
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
|
||||
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 List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetTimeSpanGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list)
|
||||
: base(GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
m_Property = prop;
|
||||
m_Mobile = mobile;
|
||||
m_Object = o;
|
||||
m_Stack = stack;
|
||||
m_Page = page;
|
||||
m_List = list;
|
||||
|
||||
TimeSpan 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);
|
||||
}
|
||||
|
||||
private void AddRect(int index, string str, int button, int text)
|
||||
{
|
||||
int x = BorderSize + OffsetSize;
|
||||
int 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);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
TimeSpan toSet;
|
||||
bool shouldSet, shouldSend;
|
||||
|
||||
TextRelay h = info.GetTextEntry(0);
|
||||
TextRelay m = info.GetTextEntry(1);
|
||||
TextRelay s = info.GetTextEntry(2);
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Zero
|
||||
{
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // From H:M:S
|
||||
{
|
||||
bool 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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
78
Projects/Scripts/Gumps/ReclaimVendorGump.cs
Normal file
78
Projects/Scripts/Gumps/ReclaimVendorGump.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ReclaimVendorGump : Gump
|
||||
{
|
||||
private BaseHouse m_House;
|
||||
private List<Mobile> m_Vendors;
|
||||
|
||||
public ReclaimVendorGump(BaseHouse house) : base(50, 50)
|
||||
{
|
||||
m_House = house;
|
||||
m_Vendors = house.InternalizedVendors.ToList();
|
||||
|
||||
AddBackground(0, 0, 170, 50 + m_Vendors.Count * 20, 0x13BE);
|
||||
|
||||
AddImageTiled(10, 10, 150, 20, 0xA40);
|
||||
AddHtmlLocalized(10, 10, 150, 20, 1061827, 0x7FFF); // <CENTER>Reclaim Vendor</CENTER>
|
||||
|
||||
AddImageTiled(10, 40, 150, m_Vendors.Count * 20, 0xA40);
|
||||
|
||||
for (int i = 0; i < m_Vendors.Count; i++)
|
||||
{
|
||||
Mobile m = m_Vendors[i];
|
||||
|
||||
int y = 40 + i * 20;
|
||||
|
||||
AddButton(10, y, 0xFA5, 0xFA7, i + 1);
|
||||
AddLabel(45, y, 0x481, m.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if (info.ButtonID == 0 || !m_House.IsActive || !m_House.IsInside(from) || !m_House.IsOwner(from) ||
|
||||
!from.CheckAlive())
|
||||
return;
|
||||
|
||||
int index = info.ButtonID - 1;
|
||||
|
||||
if (index < 0 || index >= m_Vendors.Count)
|
||||
return;
|
||||
|
||||
Mobile mob = m_Vendors[index];
|
||||
|
||||
if (!m_House.InternalizedVendors.Contains(mob))
|
||||
return;
|
||||
|
||||
if (mob.Deleted)
|
||||
{
|
||||
m_House.InternalizedVendors.Remove(mob);
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseHouse.IsThereVendor(from.Location, from.Map, out bool vendor, out bool 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
|
||||
{
|
||||
m_House.InternalizedVendors.Remove(mob);
|
||||
mob.MoveToWorld(from.Location, from.Map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
184
Projects/Scripts/Gumps/ReportMurderer.cs
Normal file
184
Projects/Scripts/Gumps/ReportMurderer.cs
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Misc;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ReportMurdererGump : Gump
|
||||
{
|
||||
private int m_Idx;
|
||||
private List<Mobile> m_Killers;
|
||||
private Mobile m_Victum;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
EventSink.PlayerDeath += 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))
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
if ( m is PlayerMobile mobile && mobile.NpcGuild == NpcGuild.ThievesGuild )
|
||||
return;
|
||||
|
||||
if ( killers.Count > 0 )
|
||||
new GumpTimer( m, killers ).Start();
|
||||
}
|
||||
|
||||
private class GumpTimer : Timer
|
||||
{
|
||||
private Mobile m_Victim;
|
||||
private 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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
private ReportMurdererGump(Mobile victum, List<Mobile> killers, int idx = 0) : base( 0, 0 )
|
||||
{
|
||||
m_Killers = killers;
|
||||
m_Victum = victum;
|
||||
m_Idx = idx;
|
||||
BuildGump();
|
||||
}
|
||||
|
||||
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, m_Killers[m_Idx].Name ); // Player's Name
|
||||
AddHtmlLocalized( 260, 254, 300, 140, 1049066 ); // Would you like to report...
|
||||
|
||||
AddButton( 260, 300, 0xFA5, 0xFA7, 1 );
|
||||
AddHtmlLocalized( 300, 300, 300, 50, 1046362 ); // Yes
|
||||
|
||||
AddButton( 360, 300, 0xFA5, 0xFA7, 2 );
|
||||
AddHtmlLocalized( 400, 300, 300, 50, 1046363 ); // No
|
||||
}
|
||||
|
||||
public static void ReportedListExpiry_Callback( PlayerMobile from, Mobile killer )
|
||||
{
|
||||
if (from.RecentlyReported.Contains(killer))
|
||||
from.RecentlyReported.Remove(killer);
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
PlayerMobile from = (PlayerMobile)state.Mobile;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Mobile killer = m_Killers[m_Idx];
|
||||
if (killer?.Deleted == false)
|
||||
{
|
||||
killer.Kills++;
|
||||
killer.ShortTermMurders++;
|
||||
|
||||
if (Core.SE)
|
||||
{
|
||||
from.RecentlyReported.Add(killer);
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(10), () => ReportedListExpiry_Callback(from, killer));
|
||||
}
|
||||
|
||||
if (killer is PlayerMobile pk)
|
||||
{
|
||||
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!
|
||||
}
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
228
Projects/Scripts/Gumps/ResurrectGump.cs
Normal file
228
Projects/Scripts/Gumps/ResurrectGump.cs
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public enum ResurrectMessage
|
||||
{
|
||||
ChaosShrine = 0,
|
||||
VirtueShrine = 1,
|
||||
Healer = 2,
|
||||
Generic = 3
|
||||
}
|
||||
|
||||
public class ResurrectGump : Gump
|
||||
{
|
||||
private Mobile m_Healer;
|
||||
private int m_Price;
|
||||
private bool m_FromSacrifice;
|
||||
private double m_HitsScalar;
|
||||
|
||||
public ResurrectGump(Mobile owner, double hitsScalar)
|
||||
: this(owner, owner, ResurrectMessage.Generic, false, hitsScalar)
|
||||
{
|
||||
}
|
||||
|
||||
public ResurrectGump(Mobile owner, ResurrectMessage msg) : this(owner, owner, msg)
|
||||
{
|
||||
}
|
||||
|
||||
public ResurrectGump(Mobile owner, bool fromSacrifice = false)
|
||||
: this(owner, owner, ResurrectMessage.Generic, fromSacrifice)
|
||||
{
|
||||
}
|
||||
|
||||
public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg = ResurrectMessage.Generic,
|
||||
bool fromSacrifice = false, double hitsScalar = 0.0)
|
||||
: base( 100, 0 )
|
||||
{
|
||||
m_Healer = healer;
|
||||
m_FromSacrifice = fromSacrifice;
|
||||
m_HitsScalar = hitsScalar;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 400, 350, 2600 );
|
||||
|
||||
AddHtmlLocalized( 0, 20, 400, 35, 1011022 ); // <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.
|
||||
*/
|
||||
|
||||
AddButton( 200, 227, 4005, 4007, 0);
|
||||
AddHtmlLocalized( 235, 230, 110, 35, 1011012 ); // CANCEL
|
||||
|
||||
AddButton( 65, 227, 4005, 4007, 1);
|
||||
AddHtmlLocalized( 100, 230, 110, 35, 1011011 ); // 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 ); // Grudgingly pay the money
|
||||
|
||||
AddRadio( 30, 175, 9727, 9730, false, 0 );
|
||||
AddHtmlLocalized( 65, 178, 300, 25, 1060016, 0x7FFF ); // I'd rather stay dead, you scoundrel!!!
|
||||
|
||||
AddHtmlLocalized( 30, 20, 360, 35, 1060017, 0x7FFF ); // Wishing to rejoin the living, are you? I can restore your body... for a price of course...
|
||||
|
||||
AddHtmlLocalized( 30, 105, 345, 40, 1060018, 0x5B2D ); // 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 ); // gold coins
|
||||
|
||||
AddButton( 290, 175, 247, 248, 2 );
|
||||
|
||||
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<ResurrectGump>();
|
||||
|
||||
if (info.ButtonID != 1 && info.ButtonID != 2)
|
||||
return;
|
||||
|
||||
if (from.Map?.CanFit( from.Location, 16, false, false ) != true)
|
||||
{
|
||||
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 mobile )
|
||||
{
|
||||
mobile.AvailableResurrects -= 1;
|
||||
|
||||
Container pack = mobile.Backpack;
|
||||
Container corpse = mobile.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 ( 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
187
Projects/Scripts/Gumps/RewardGump.cs
Normal file
187
Projects/Scripts/Gumps/RewardGump.cs
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
/*
|
||||
* A generic version of the EA Clean Up Britannia reward gump.
|
||||
*/
|
||||
|
||||
public interface IRewardEntry
|
||||
{
|
||||
int Price{ get; }
|
||||
int ItemID{ get; }
|
||||
int Hue{ get; }
|
||||
int Tooltip{ get; }
|
||||
TextDefinition Description{ get; }
|
||||
}
|
||||
|
||||
public delegate void RewardPickedHandler(Mobile from, int index);
|
||||
|
||||
public class RewardGump : Gump
|
||||
{
|
||||
public RewardGump(TextDefinition title, IRewardEntry[] rewards, int points, RewardPickedHandler onPicked)
|
||||
: base(250, 50)
|
||||
{
|
||||
Title = title;
|
||||
Rewards = rewards;
|
||||
Points = points;
|
||||
OnPicked = onPicked;
|
||||
|
||||
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);
|
||||
|
||||
if (Title.String != null)
|
||||
AddHtml(70, 35, 270, 20, Title.String);
|
||||
else if (Title.Number != 0)
|
||||
AddHtmlLocalized(70, 35, 270, 20, Title.Number, 1);
|
||||
|
||||
AddHtmlLocalized(50, 65, 150, 20, 1072843, 1); // Your Reward Points:
|
||||
AddLabel(230, 65, 0x64, Points.ToString());
|
||||
AddImageTiled(35, 85, 270, 2, 0x23C5);
|
||||
AddHtmlLocalized(35, 90, 270, 20, 1072844, 1); // Please Choose a Reward:
|
||||
|
||||
AddPage(1);
|
||||
|
||||
int offset = 110;
|
||||
int page = 1;
|
||||
|
||||
for (int i = 0; i < Rewards.Length; ++i)
|
||||
{
|
||||
IRewardEntry entry = Rewards[i];
|
||||
|
||||
Rectangle2D bounds = ItemBounds.Table[entry.ItemID];
|
||||
int height = Math.Max(36, bounds.Height);
|
||||
|
||||
if (offset + height > 320)
|
||||
{
|
||||
AddHtmlLocalized(240, 335, 60, 20, 1072854, 1); // <div align=right>Next</div>
|
||||
AddButton(300, 335, 0x15E1, 0x15E5, 51, GumpButtonType.Page, page + 1);
|
||||
|
||||
AddPage(++page);
|
||||
|
||||
AddButton(150, 335, 0x15E3, 0x15E7, 52, GumpButtonType.Page, page - 1);
|
||||
AddHtmlLocalized(170, 335, 60, 20, 1074880, 1); // Previous
|
||||
|
||||
offset = 110;
|
||||
}
|
||||
|
||||
bool available = entry.Price <= Points;
|
||||
int half = offset + height / 2;
|
||||
|
||||
if (available)
|
||||
AddButton(35, half - 6, 0x837, 0x838, 100 + i);
|
||||
|
||||
AddItem(83 - bounds.Width / 2 - bounds.X, half - bounds.Height / 2 - bounds.Y, entry.ItemID,
|
||||
available ? entry.Hue : 995);
|
||||
|
||||
if (entry.Tooltip != 0)
|
||||
AddTooltip(entry.Tooltip);
|
||||
|
||||
AddLabel(133, half - 10, available ? 0x64 : 0x21, entry.Price.ToString());
|
||||
|
||||
if (entry.Description != null)
|
||||
{
|
||||
if (entry.Description.String != null)
|
||||
AddHtml(190, offset, 114, height, entry.Description.String);
|
||||
else if (entry.Description.Number != 0)
|
||||
AddHtmlLocalized(190, offset, 114, height, entry.Description.Number, 1);
|
||||
}
|
||||
|
||||
offset += height + 10;
|
||||
}
|
||||
}
|
||||
|
||||
public TextDefinition Title{ get; }
|
||||
|
||||
public IRewardEntry[] Rewards{ get; }
|
||||
|
||||
public int Points{ get; }
|
||||
|
||||
public RewardPickedHandler OnPicked{ get; }
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
int choice = info.ButtonID;
|
||||
|
||||
if (choice == 0)
|
||||
return; // Close
|
||||
|
||||
choice -= 100;
|
||||
|
||||
if (choice >= 0 && choice < Rewards.Length)
|
||||
{
|
||||
IRewardEntry entry = Rewards[choice];
|
||||
|
||||
if (entry.Price <= Points)
|
||||
sender.Mobile.SendGump(new RewardConfirmGump(this, choice, entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class RewardConfirmGump : Gump
|
||||
{
|
||||
private int m_Index;
|
||||
private RewardGump m_Parent;
|
||||
|
||||
public RewardConfirmGump(RewardGump parent, int index, IRewardEntry entry)
|
||||
: base(120, 50)
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_Index = index;
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
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);
|
||||
|
||||
AddItem(140, 120, entry.ItemID, entry.Hue);
|
||||
|
||||
if (entry.Tooltip != 0)
|
||||
AddTooltip(entry.Tooltip);
|
||||
|
||||
AddHtmlLocalized(25, 22, 200, 20, 1074974, 0x7D00); // Confirm Selection
|
||||
AddImage(25, 40, 0xBBF);
|
||||
AddHtmlLocalized(25, 55, 300, 120, 1074975, 0xFFFFFF); // Are you sure you wish to select this?
|
||||
AddRadio(25, 175, 0x25F8, 0x25FB, true, 1);
|
||||
AddRadio(25, 210, 0x25F8, 0x25FB, false, 0);
|
||||
AddHtmlLocalized(60, 180, 280, 20, 1074976, 0xFFFFFF); // Yes
|
||||
AddHtmlLocalized(60, 215, 280, 20, 1074977, 0xFFFFFF); // No
|
||||
AddButton(265, 220, 0xF7, 0xF8, 7);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 7 && info.IsSwitched(1))
|
||||
m_Parent.OnPicked(sender.Mobile, m_Index);
|
||||
else
|
||||
sender.Mobile.SendGump(new RewardGump(m_Parent.Title, m_Parent.Rewards, m_Parent.Points, m_Parent.OnPicked));
|
||||
}
|
||||
}
|
||||
}
|
||||
452
Projects/Scripts/Gumps/RunebookGump.cs
Normal file
452
Projects/Scripts/Gumps/RunebookGump.cs
Normal file
|
|
@ -0,0 +1,452 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
using Server.Spells.Chivalry;
|
||||
using Server.Spells.Fourth;
|
||||
using Server.Spells.Seventh;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class RunebookGump : Gump
|
||||
{
|
||||
public RunebookGump(Mobile from, Runebook book) : base(150, 200)
|
||||
{
|
||||
Book = book;
|
||||
|
||||
AddBackground();
|
||||
AddIndex();
|
||||
|
||||
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 Runebook Book{ get; }
|
||||
|
||||
public int GetMapHue(Map map)
|
||||
{
|
||||
if (map == Map.Trammel)
|
||||
return 10;
|
||||
if (map == Map.Felucca)
|
||||
return 81;
|
||||
if (map == Map.Ilshenar)
|
||||
return 1102;
|
||||
if (map == Map.Malas)
|
||||
return 1102;
|
||||
if (map == Map.Tokuno)
|
||||
return 1154;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public string GetName(string name)
|
||||
{
|
||||
if (name == null || (name = name.Trim()).Length <= 0)
|
||||
return "(indescript)";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
private void AddBackground()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
// Background image
|
||||
AddImage(100, 10, 2200);
|
||||
|
||||
// Two separators
|
||||
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
|
||||
AddHtmlLocalized(140, 40, 80, 18, 1011296); // Charges:
|
||||
AddHtml(220, 40, 30, 18, Book.CurCharges.ToString());
|
||||
|
||||
// Max charges
|
||||
AddHtmlLocalized(300, 40, 100, 18, 1011297); // Max Charges:
|
||||
AddHtml(400, 40, 30, 18, Book.MaxCharges.ToString());
|
||||
}
|
||||
|
||||
private void AddIndex()
|
||||
{
|
||||
// Index
|
||||
AddPage(1);
|
||||
|
||||
// Rename button
|
||||
AddButton(125, 15, 2472, 2473, 1);
|
||||
AddHtmlLocalized(158, 22, 100, 18, 1011299); // Rename book
|
||||
|
||||
// List of entries
|
||||
List<RunebookEntry> entries = Book.Entries;
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
string desc;
|
||||
int hue;
|
||||
|
||||
if (i < entries.Count)
|
||||
{
|
||||
desc = GetName(entries[i].Description);
|
||||
hue = GetMapHue(entries[i].Map);
|
||||
}
|
||||
else
|
||||
{
|
||||
desc = "Empty";
|
||||
hue = 0;
|
||||
}
|
||||
|
||||
// Use charge button
|
||||
AddButton(130 + i / 8 * 160, 65 + i % 8 * 15, 2103, 2104, 2 + i * 6 + 0);
|
||||
|
||||
// Description label
|
||||
AddLabelCropped(145 + i / 8 * 160, 60 + i % 8 * 15, 115, 17, hue, desc);
|
||||
}
|
||||
|
||||
// Turn page button
|
||||
AddButton(393, 14, 2206, 2206, 0, GumpButtonType.Page, 2);
|
||||
}
|
||||
|
||||
private void AddDetails(int index, int half)
|
||||
{
|
||||
// Use charge button
|
||||
AddButton(130 + half * 160, 65, 2103, 2104, 2 + index * 6 + 0);
|
||||
|
||||
string desc;
|
||||
int hue;
|
||||
|
||||
if (index < Book.Entries.Count)
|
||||
{
|
||||
RunebookEntry e = Book.Entries[index];
|
||||
|
||||
desc = GetName(e.Description);
|
||||
hue = GetMapHue(e.Map);
|
||||
|
||||
// Location labels
|
||||
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))
|
||||
{
|
||||
AddLabel(135 + half * 160, 80, 0, $"{yLat}<7D> {yMins}'{(ySouth ? "S" : "N")}");
|
||||
AddLabel(135 + half * 160, 95, 0, $"{xLong}<7D> {xMins}'{(xEast ? "E" : "W")}");
|
||||
}
|
||||
|
||||
// Drop rune button
|
||||
AddButton(135 + half * 160, 115, 2437, 2438, 2 + index * 6 + 1);
|
||||
AddHtmlLocalized(150 + half * 160, 115, 100, 18, 1011298); // Drop rune
|
||||
|
||||
// Set as default button
|
||||
int defButtonID = e != Book.Default ? 2361 : 2360;
|
||||
|
||||
AddButton(160 + half * 140, 20, defButtonID, defButtonID, 2 + index * 6 + 2);
|
||||
AddHtmlLocalized(175 + half * 140, 15, 100, 18, 1011300); // Set default
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
AddButton(135 + half * 160, 140, 2103, 2104, 2 + index * 6 + 3);
|
||||
AddHtmlLocalized(150 + half * 160, 136, 110, 20, 1062722); // Recall
|
||||
|
||||
AddButton(135 + half * 160, 158, 2103, 2104, 2 + index * 6 + 4);
|
||||
AddHtmlLocalized(150 + half * 160, 154, 110, 20, 1062723); // Gate Travel
|
||||
|
||||
AddButton(135 + half * 160, 176, 2103, 2104, 2 + index * 6 + 5);
|
||||
AddHtmlLocalized(150 + half * 160, 172, 110, 20, 1062724); // Sacred Journey
|
||||
}
|
||||
else
|
||||
{
|
||||
// Recall button
|
||||
AddButton(135 + half * 160, 140, 2271, 2271, 2 + index * 6 + 3);
|
||||
|
||||
// Gate button
|
||||
AddButton(205 + half * 160, 140, 2291, 2291, 2 + index * 6 + 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
desc = "Empty";
|
||||
hue = 0;
|
||||
}
|
||||
|
||||
// Description label
|
||||
AddLabelCropped(145 + half * 160, 60, 115, 17, hue, desc);
|
||||
}
|
||||
|
||||
public static bool HasSpell(Mobile from, int spellID)
|
||||
{
|
||||
return Spellbook.Find(from, spellID)?.HasSpell(spellID) == true;
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if (Book.Deleted || !from.InRange(Book.GetWorldLocation(), Core.ML ? 3 : 1) || !DesignContext.Check(from))
|
||||
{
|
||||
Book.Openers.Remove(from);
|
||||
return;
|
||||
}
|
||||
|
||||
int buttonID = info.ButtonID;
|
||||
|
||||
if (buttonID == 1) // Rename book
|
||||
{
|
||||
if (!Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
from.SendLocalizedMessage(502414); // Please enter a title for the runebook:
|
||||
from.Prompt = new InternalPrompt(Book);
|
||||
}
|
||||
else
|
||||
{
|
||||
Book.Openers.Remove(from);
|
||||
|
||||
from.SendLocalizedMessage(502413, null, 0x35); // That cannot be done while the book is locked down.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonID -= 2;
|
||||
|
||||
int index = buttonID / 6;
|
||||
int type = buttonID % 6;
|
||||
|
||||
if (index >= 0 && index < Book.Entries.Count)
|
||||
{
|
||||
RunebookEntry e = Book.Entries[index];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0: // Use charges
|
||||
{
|
||||
if (Book.CurCharges <= 0)
|
||||
{
|
||||
from.CloseGump<RunebookGump>();
|
||||
from.SendGump(new RunebookGump(from, Book));
|
||||
|
||||
from.SendLocalizedMessage(502412); // There are no charges left on that item.
|
||||
}
|
||||
else
|
||||
{
|
||||
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))
|
||||
{
|
||||
string location =
|
||||
$"{yLat}<7D> {yMins}'{(ySouth ? "S" : "N")}, {xLong}<7D> {xMins}'{(xEast ? "E" : "W")}";
|
||||
from.SendMessage(location);
|
||||
}
|
||||
|
||||
Book.OnTravel();
|
||||
new RecallSpell(from, e, Book, Book).Cast();
|
||||
|
||||
Book.Openers.Remove(from);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Drop rune
|
||||
{
|
||||
if (!Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
Book.DropRune(from, e, index);
|
||||
|
||||
from.CloseGump<RunebookGump>();
|
||||
if (!Core.ML)
|
||||
from.SendGump(new RunebookGump(from, Book));
|
||||
}
|
||||
else
|
||||
{
|
||||
Book.Openers.Remove(from);
|
||||
|
||||
from.SendLocalizedMessage(502413, null,
|
||||
0x35); // That cannot be done while the book is locked down.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Set default
|
||||
{
|
||||
if (Book.CheckAccess(from))
|
||||
{
|
||||
Book.Default = e;
|
||||
|
||||
from.CloseGump<RunebookGump>();
|
||||
from.SendGump(new RunebookGump(from, Book));
|
||||
|
||||
from.SendLocalizedMessage(502417); // New default location set.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Recall
|
||||
{
|
||||
if (HasSpell(from, 31))
|
||||
{
|
||||
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))
|
||||
{
|
||||
string location =
|
||||
$"{yLat}<7D> {yMins}'{(ySouth ? "S" : "N")}, {xLong}<7D> {xMins}'{(xEast ? "E" : "W")}";
|
||||
from.SendMessage(location);
|
||||
}
|
||||
|
||||
Book.OnTravel();
|
||||
new RecallSpell(from, e).Cast();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500015); // You do not have that spell!
|
||||
}
|
||||
|
||||
Book.Openers.Remove(from);
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Gate
|
||||
{
|
||||
if (HasSpell(from, 51))
|
||||
{
|
||||
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))
|
||||
{
|
||||
string location =
|
||||
$"{yLat}<7D> {yMins}'{(ySouth ? "S" : "N")}, {xLong}<7D> {xMins}'{(xEast ? "E" : "W")}";
|
||||
from.SendMessage(location);
|
||||
}
|
||||
|
||||
Book.OnTravel();
|
||||
new GateTravelSpell(from, e).Cast();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500015); // You do not have that spell!
|
||||
}
|
||||
|
||||
Book.Openers.Remove(from);
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: // Sacred Journey
|
||||
{
|
||||
if (Core.AOS)
|
||||
{
|
||||
if (HasSpell(from, 209))
|
||||
{
|
||||
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))
|
||||
{
|
||||
string location =
|
||||
$"{yLat}<7D> {yMins}'{(ySouth ? "S" : "N")}, {xLong}<7D> {xMins}'{(xEast ? "E" : "W")}";
|
||||
from.SendMessage(location);
|
||||
}
|
||||
|
||||
Book.OnTravel();
|
||||
new SacredJourneySpell(from, e).Cast();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500015); // You do not have that spell!
|
||||
}
|
||||
}
|
||||
|
||||
Book.Openers.Remove(from);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Book.Openers.Remove(from);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalPrompt : Prompt
|
||||
{
|
||||
private Runebook m_Book;
|
||||
|
||||
public InternalPrompt(Runebook 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<RunebookGump>();
|
||||
from.SendGump(new RunebookGump(from, m_Book));
|
||||
|
||||
from.SendMessage("The book's title has been changed.");
|
||||
}
|
||||
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<RunebookGump>();
|
||||
from.SendGump(new RunebookGump(from, m_Book));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Projects/Scripts/Gumps/SetSecureLevelGump.cs
Normal file
103
Projects/Scripts/Gumps/SetSecureLevelGump.cs
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
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 owner, ISecurable info, BaseHouse house) : base(50, 50)
|
||||
{
|
||||
m_Info = info;
|
||||
|
||||
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);
|
||||
|
||||
AddHtmlLocalized(10, 10, 200, 20, 1061276, 32767); // <CENTER>SET ACCESS</CENTER>
|
||||
AddHtmlLocalized(10, 40, 100, 20, 1041474, 32767); // Owner:
|
||||
|
||||
AddLabel(110, 40, 1152, owner == null ? "" : owner.Name);
|
||||
|
||||
AddButton(10, 70, GetFirstID(SecureLevel.Owner), 4007, 1);
|
||||
AddHtmlLocalized(45, 70, 150, 20, 1061277, GetColor(SecureLevel.Owner)); // Owner Only
|
||||
|
||||
AddButton(10, 90, GetFirstID(SecureLevel.CoOwners), 4007, 2);
|
||||
AddHtmlLocalized(45, 90, 150, 20, 1061278, GetColor(SecureLevel.CoOwners)); // Co-Owners
|
||||
|
||||
AddButton(10, 110, GetFirstID(SecureLevel.Friends), 4007, 3);
|
||||
AddHtmlLocalized(45, 110, 150, 20, 1061279, GetColor(SecureLevel.Friends)); // Friends
|
||||
|
||||
Mobile houseOwner = house.Owner;
|
||||
if (Guild.NewGuildSystem && houseOwner?.Guild != null &&
|
||||
((Guild)houseOwner.Guild).Leader == houseOwner
|
||||
) //Only the actual House owner AND guild master can set guild secures
|
||||
{
|
||||
AddButton(10, 130, GetFirstID(SecureLevel.Guild), 4007, 5);
|
||||
AddHtmlLocalized(45, 130, 150, 20, 1063455, GetColor(SecureLevel.Guild)); // Guild Members
|
||||
}
|
||||
|
||||
AddButton(10, 130 + offset, GetFirstID(SecureLevel.Anyone), 4007, 4);
|
||||
AddHtmlLocalized(45, 130 + offset, 150, 20, 1061626, GetColor(SecureLevel.Anyone)); // 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.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
556
Projects/Scripts/Gumps/SkillsGump.cs
Normal file
556
Projects/Scripts/Gumps/SkillsGump.cs
Normal file
|
|
@ -0,0 +1,556 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
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 Mobile m_From;
|
||||
|
||||
private SkillsGumpGroup m_Selected;
|
||||
private Skill m_Skill;
|
||||
private Mobile m_Target;
|
||||
|
||||
public EditSkillGump(Mobile from, Mobile target, Skill skill, SkillsGumpGroup selected) : base(GumpOffsetX,
|
||||
GumpOffsetY)
|
||||
{
|
||||
m_From = from;
|
||||
m_Target = target;
|
||||
m_Skill = skill;
|
||||
m_Selected = selected;
|
||||
|
||||
string initialText = m_Skill.Base.ToString("F1");
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
|
||||
AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), TotalHeight,
|
||||
OffsetGumpID);
|
||||
|
||||
int x = BorderSize + OffsetSize;
|
||||
int y = BorderSize + OffsetSize;
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, skill.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);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1)
|
||||
try
|
||||
{
|
||||
if (m_From.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
TextRelay text = info.GetTextEntry(0);
|
||||
|
||||
if (text != null)
|
||||
{
|
||||
m_Skill.Base = Convert.ToDouble(text.Text);
|
||||
CommandLogging.LogChangeProperty(m_From, m_Target, $"{m_Skill}.Base", m_Skill.Base.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage("You may not change that.");
|
||||
}
|
||||
|
||||
m_From.SendGump(new SkillsGump(m_From, m_Target, m_Selected));
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_From.SendMessage("Bad format. ###.# expected.");
|
||||
m_From.SendGump(new EditSkillGump(m_From, m_Target, m_Skill, m_Selected));
|
||||
}
|
||||
else
|
||||
m_From.SendGump(new SkillsGump(m_From, m_Target, m_Selected));
|
||||
}
|
||||
}
|
||||
|
||||
public class SkillsGump : Gump
|
||||
{
|
||||
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 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 Mobile m_From;
|
||||
|
||||
private SkillsGumpGroup[] m_Groups;
|
||||
private SkillsGumpGroup m_Selected;
|
||||
private Mobile m_Target;
|
||||
|
||||
public SkillsGump(Mobile from, Mobile target, SkillsGumpGroup selected = null) : base(GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
m_From = from;
|
||||
m_Target = target;
|
||||
|
||||
m_Groups = SkillsGumpGroup.Groups;
|
||||
m_Selected = selected;
|
||||
|
||||
int count = m_Groups.Length;
|
||||
|
||||
if (selected != null)
|
||||
count += selected.Skills.Length;
|
||||
|
||||
int totalHeight = OffsetSize + (EntryHeight + OffsetSize) * (count + 1);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
|
||||
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)
|
||||
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
||||
else
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
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);
|
||||
|
||||
for (int i = 0; i < m_Groups.Length; ++i)
|
||||
{
|
||||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
SkillsGumpGroup group = m_Groups[i];
|
||||
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (group == selected)
|
||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E2, 0x15E6, GetButtonID(0, i));
|
||||
else
|
||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E1, 0x15E5, GetButtonID(0, i));
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
x -= OldStyle ? OffsetSize : 0;
|
||||
|
||||
AddImageTiled(x, y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID);
|
||||
AddLabel(x + TextOffsetX, y, TextHue, group.Name);
|
||||
|
||||
x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0);
|
||||
x += OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
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;
|
||||
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E1, 0x15E5, GetButtonID(1, j));
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
x -= OldStyle ? OffsetSize : 0;
|
||||
|
||||
AddImageTiled(x, y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0) - OffsetSize - IndentWidth,
|
||||
EntryHeight, EntryGumpID);
|
||||
AddLabel(x + TextOffsetX, y, TextHue, sk == null ? "(null)" : sk.Name);
|
||||
|
||||
x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0) - OffsetSize - IndentWidth;
|
||||
x += OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
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;
|
||||
}
|
||||
|
||||
AddButton(x + xOffset, y + yOffset, buttonID1, buttonID2, GetButtonID(2, j));
|
||||
|
||||
y += 1;
|
||||
x -= OffsetSize;
|
||||
x -= 1;
|
||||
x -= 50;
|
||||
|
||||
AddImageTiled(x, y, 50, EntryHeight - 2, OffsetGumpID);
|
||||
|
||||
x += 1;
|
||||
y += 1;
|
||||
|
||||
AddImageTiled(x, y, 48, EntryHeight - 4, EntryGumpID);
|
||||
|
||||
AddLabelCropped(x + TextOffsetX, y - 1, 48 - TextOffsetX, EntryHeight - 3, TextHue,
|
||||
sk.Base.ToString("F1"));
|
||||
|
||||
y -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
AddImageTiled(indentMaskX, indentMaskY, IndentWidth + OffsetSize,
|
||||
group.Skills.Length * (EntryHeight + OffsetSize) - (i < 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 < m_Groups.Length)
|
||||
{
|
||||
SkillsGumpGroup newSelection = m_Groups[index];
|
||||
|
||||
if (m_Selected != newSelection)
|
||||
m_From.SendGump(new SkillsGump(m_From, m_Target, newSelection));
|
||||
else
|
||||
m_From.SendGump(new SkillsGump(m_From, m_Target));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (m_Selected != null && index >= 0 && index < m_Selected.Skills.Length)
|
||||
{
|
||||
Skill sk = m_Target.Skills[m_Selected.Skills[index]];
|
||||
|
||||
if (sk != null)
|
||||
{
|
||||
if (m_From.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
m_From.SendGump(new EditSkillGump(m_From, m_Target, sk, m_Selected));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage("You may not change that.");
|
||||
m_From.SendGump(new SkillsGump(m_From, m_Target, m_Selected));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendGump(new SkillsGump(m_From, m_Target, m_Selected));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (m_Selected != null && index >= 0 && index < m_Selected.Skills.Length)
|
||||
{
|
||||
Skill sk = m_Target.Skills[m_Selected.Skills[index]];
|
||||
|
||||
if (sk != null)
|
||||
{
|
||||
if (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
|
||||
m_From.SendMessage("You may not change that.");
|
||||
|
||||
m_From.SendGump(new SkillsGump(m_From, m_Target, m_Selected));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetButtonID(int type, int index)
|
||||
{
|
||||
return 1 + index * 3 + type;
|
||||
}
|
||||
}
|
||||
|
||||
public class SkillsGumpGroup
|
||||
{
|
||||
public SkillsGumpGroup(string name, SkillName[] skills)
|
||||
{
|
||||
Name = name;
|
||||
Skills = skills;
|
||||
|
||||
Array.Sort(Skills, new SkillNameComparer());
|
||||
}
|
||||
|
||||
public string Name{ get; }
|
||||
|
||||
public SkillName[] Skills{ get; }
|
||||
|
||||
public static SkillsGumpGroup[] Groups{ get; } =
|
||||
{
|
||||
new SkillsGumpGroup("Crafting", new[]
|
||||
{
|
||||
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.Discordance,
|
||||
SkillName.Musicianship,
|
||||
SkillName.Peacemaking,
|
||||
SkillName.Provocation
|
||||
}),
|
||||
new SkillsGumpGroup("Magical", new[]
|
||||
{
|
||||
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.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.Archery,
|
||||
SkillName.Fencing,
|
||||
SkillName.Macing,
|
||||
SkillName.Parry,
|
||||
SkillName.Swords,
|
||||
SkillName.Tactics,
|
||||
SkillName.Wrestling,
|
||||
SkillName.Throwing
|
||||
}),
|
||||
new SkillsGumpGroup("Actions", new[]
|
||||
{
|
||||
SkillName.AnimalTaming,
|
||||
SkillName.Begging,
|
||||
SkillName.DetectHidden,
|
||||
SkillName.Hiding,
|
||||
SkillName.RemoveTrap,
|
||||
SkillName.Poisoning,
|
||||
SkillName.Stealing,
|
||||
SkillName.Stealth,
|
||||
SkillName.Tracking
|
||||
}),
|
||||
new SkillsGumpGroup("Lore & Knowledge", new[]
|
||||
{
|
||||
SkillName.Anatomy,
|
||||
SkillName.AnimalLore,
|
||||
SkillName.ArmsLore,
|
||||
SkillName.Forensics,
|
||||
SkillName.ItemID,
|
||||
SkillName.TasteID
|
||||
})
|
||||
};
|
||||
|
||||
private class SkillNameComparer : IComparer<SkillName>
|
||||
{
|
||||
public int Compare(SkillName a, SkillName b)
|
||||
{
|
||||
string aName = SkillInfo.Table[(int)a].Name;
|
||||
string bName = SkillInfo.Table[(int)b].Name;
|
||||
|
||||
return aName.CompareTo(bName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
131
Projects/Scripts/Gumps/TithingGump.cs
Normal file
131
Projects/Scripts/Gumps/TithingGump.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class TithingGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private int m_Offer;
|
||||
|
||||
public TithingGump(Mobile from, int offer) : base(160, 40)
|
||||
{
|
||||
int totalGold = from.TotalGold;
|
||||
|
||||
if (offer > totalGold)
|
||||
offer = totalGold;
|
||||
else if (offer < 0)
|
||||
offer = 0;
|
||||
|
||||
m_From = from;
|
||||
m_Offer = offer;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddImage(30, 30, 102);
|
||||
|
||||
AddHtmlLocalized(95, 100, 120, 100, 1060198, 0); // May your wealth bring blessings to those in need, if tithed upon this most sacred site.
|
||||
|
||||
AddLabel(57, 274, 0, "Gold:");
|
||||
AddLabel(87, 274, 53, (totalGold - offer).ToString());
|
||||
|
||||
AddLabel(137, 274, 0, "Tithe:");
|
||||
AddLabel(172, 274, 53, offer.ToString());
|
||||
|
||||
AddButton(105, 230, 5220, 5220, 2);
|
||||
AddButton(113, 230, 5222, 5222, 2);
|
||||
AddLabel(108, 228, 0, "<");
|
||||
AddLabel(112, 228, 0, "<");
|
||||
|
||||
AddButton(127, 230, 5223, 5223, 1);
|
||||
AddLabel(131, 228, 0, "<");
|
||||
|
||||
AddButton(147, 230, 5224, 5224, 3);
|
||||
AddLabel(153, 228, 0, ">");
|
||||
|
||||
AddButton(168, 230, 5220, 5220, 4);
|
||||
AddButton(176, 230, 5222, 5222, 4);
|
||||
AddLabel(172, 228, 0, ">");
|
||||
AddLabel(176, 228, 0, ">");
|
||||
|
||||
AddButton(217, 272, 4023, 4024, 5);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
// You have decided to tithe no gold to the shrine.
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
int offer = 0;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
offer = m_Offer - 100;
|
||||
break;
|
||||
case 2:
|
||||
offer = 0;
|
||||
break;
|
||||
case 3:
|
||||
offer = m_Offer + 100;
|
||||
break;
|
||||
case 4:
|
||||
offer = m_From.TotalGold;
|
||||
break;
|
||||
}
|
||||
|
||||
m_From.SendGump(new TithingGump(m_From, offer));
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
int totalGold = m_From.TotalGold;
|
||||
|
||||
if (m_Offer > totalGold)
|
||||
m_Offer = totalGold;
|
||||
else if (m_Offer < 0)
|
||||
m_Offer = 0;
|
||||
|
||||
if (m_From.TithingPoints + m_Offer > 100000) // TODO: What's the maximum?
|
||||
m_Offer = 100000 - m_From.TithingPoints;
|
||||
|
||||
if (m_Offer <= 0)
|
||||
{
|
||||
// You have decided to tithe no gold to the shrine.
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
|
||||
break;
|
||||
}
|
||||
|
||||
Container pack = m_From.Backpack;
|
||||
|
||||
if (pack?.ConsumeTotal(typeof(Gold), m_Offer) == true)
|
||||
{
|
||||
// You tithe gold to the shrine as a sign of devotion.
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060195);
|
||||
m_From.TithingPoints += m_Offer;
|
||||
|
||||
m_From.PlaySound(0x243);
|
||||
m_From.PlaySound(0x2E6);
|
||||
}
|
||||
else
|
||||
{
|
||||
// You do not have enough gold to tithe that amount!
|
||||
m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060194);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
135
Projects/Scripts/Gumps/ToTAdminGump.cs
Normal file
135
Projects/Scripts/Gumps/ToTAdminGump.cs
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
using System;
|
||||
using Server.Commands;
|
||||
using Server.Misc;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ToTAdminGump : Gump
|
||||
{
|
||||
private static string[] m_ToTInfo =
|
||||
{
|
||||
//Opening Message
|
||||
"<center>Treasures of Tokuno Admin</center><br>" +
|
||||
"-Use the gems to switch eras<br>" +
|
||||
"-Drop era and Reward era can be changed seperately<br>" +
|
||||
"-Drop era can be deactivated, Reward era is always activated",
|
||||
//Treasures of Tokuno 1 message
|
||||
"<center>Treasures of Tokuno 1</center><br>" +
|
||||
"-10 charge Bleach Pigment can drop as a Lesser Artifact<br>" +
|
||||
"-50 charge Neon Pigments available as a reward<br>",
|
||||
//Treasures of Tokuno 2 message
|
||||
"<center>Treasures of Tokuno 2</center><br>" +
|
||||
"-30 types of 1 charge Metallic Pigments drop as Lesser Artifacts<br>" +
|
||||
"-1 charge Bleach Pigment can drop as a Lesser Artifact<br>" +
|
||||
"-10 charge Greater Metallic Pigments available as a reward",
|
||||
//Treasures of Tokuno 3 message
|
||||
"<center>Treasures of Tokuno 3</center><br>" +
|
||||
"-10 types of 1 charge Fresh Pigments drop as Lesser Artifacts<br>" +
|
||||
"-1 charge Bleach Pigment can drop as a Lesser Artifact<br>" +
|
||||
"-Leurocian's Mempo Of Fortune can drop as a Lesser Artifact"
|
||||
};
|
||||
|
||||
private int m_ToTEras;
|
||||
|
||||
public ToTAdminGump() : base(30, 50)
|
||||
{
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Draggable = true;
|
||||
Resizable = false;
|
||||
|
||||
m_ToTEras = Enum.GetValues(typeof(TreasuresOfTokunoEra)).Length - 1;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 320, 75 + m_ToTEras * 25, 9200);
|
||||
AddImageTiled(25, 18, 270, 10, 9267);
|
||||
AddLabel(75, 5, 54, "Treasures of Tokuno Admin");
|
||||
AddLabel(10, 25, 54, "ToT Era");
|
||||
AddLabel(90, 25, 54, "Drop Era");
|
||||
AddLabel(195, 25, 54, "Reward Era");
|
||||
AddLabel(287, 25, 54, "Info");
|
||||
|
||||
AddBackground(320, 0, 200, 150, 9200);
|
||||
AddImageTiled(325, 5, 190, 140, 2624);
|
||||
AddAlphaRegion(325, 5, 190, 140);
|
||||
|
||||
SetupToTEras();
|
||||
}
|
||||
|
||||
public void SetupToTEras()
|
||||
{
|
||||
bool isActivated = TreasuresOfTokuno.DropEra != TreasuresOfTokunoEra.None;
|
||||
AddButton(75, 50, isActivated ? 2361 : 2360, isActivated ? 2361 : 2360, 1);
|
||||
AddLabel(90, 45, isActivated ? 167 : 137, isActivated ? "Activated" : "Deactivated");
|
||||
|
||||
for (int i = 0; i < m_ToTEras; i++)
|
||||
{
|
||||
int yoffset = i * 25;
|
||||
|
||||
bool isThisDropEra = (int)TreasuresOfTokuno.DropEra - 1 == i;
|
||||
bool isThisRewardEra = (int)TreasuresOfTokuno.RewardEra - 1 == i;
|
||||
int dropButtonID = isThisDropEra ? 2361 : 2360;
|
||||
int rewardButtonID = isThisRewardEra ? 2361 : 2360;
|
||||
|
||||
AddLabel(10, 70 + yoffset, 2100, "ToT " + (i + 1));
|
||||
AddButton(75, 75 + yoffset, dropButtonID, dropButtonID, 2 + i * 2);
|
||||
AddLabel(90, 70 + yoffset, isThisDropEra ? 167 : 137, isThisDropEra ? "Active" : "Inactive");
|
||||
AddButton(180, 75 + yoffset, rewardButtonID, rewardButtonID, 2 + i * 2 + 1);
|
||||
AddLabel(195, 70 + yoffset, isThisRewardEra ? 167 : 137, isThisRewardEra ? "Active" : "Inactive");
|
||||
|
||||
AddButton(285, 70 + yoffset, 4005, 4006, i, GumpButtonType.Page, 2 + i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_ToTInfo.Length; i++)
|
||||
{
|
||||
AddPage(1 + i);
|
||||
AddHtml(330, 10, 180, 130, m_ToTInfo[i], false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
int button = info.ButtonID;
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if (button == 1)
|
||||
{
|
||||
TreasuresOfTokuno.DropEra = TreasuresOfTokunoEra.None;
|
||||
from.SendMessage("Treasures of Tokuno Drops have been deactivated");
|
||||
}
|
||||
else if (button >= 2)
|
||||
{
|
||||
int selectedToT;
|
||||
if (button % 2 == 0)
|
||||
{
|
||||
selectedToT = button / 2;
|
||||
TreasuresOfTokuno.DropEra = (TreasuresOfTokunoEra)selectedToT;
|
||||
from.SendMessage("Treasures of Tokuno " + selectedToT + " Drops have been enabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedToT = (button - 1) / 2;
|
||||
TreasuresOfTokuno.RewardEra = (TreasuresOfTokunoEra)selectedToT;
|
||||
from.SendMessage("Treasures of Tokuno " + selectedToT + " Rewards have been enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("ToTAdmin", AccessLevel.Administrator, ToTAdmin_OnCommand);
|
||||
}
|
||||
|
||||
[Usage("ToTAdmin")]
|
||||
[Description("Displays a menu to configure Treasures of Tokuno.")]
|
||||
public static void ToTAdmin_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
ToTAdminGump tg;
|
||||
|
||||
tg = new ToTAdminGump();
|
||||
e.Mobile.CloseGump<ToTAdminGump>();
|
||||
e.Mobile.SendGump(tg);
|
||||
}
|
||||
}
|
||||
}
|
||||
125
Projects/Scripts/Gumps/VendorInventoryGump.cs
Normal file
125
Projects/Scripts/Gumps/VendorInventoryGump.cs
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class VendorInventoryGump : Gump
|
||||
{
|
||||
private BaseHouse m_House;
|
||||
private List<VendorInventory> m_Inventories;
|
||||
|
||||
public VendorInventoryGump(BaseHouse house, Mobile from) : base(50, 50)
|
||||
{
|
||||
m_House = house;
|
||||
m_Inventories = house.VendorInventories.ToList();
|
||||
|
||||
AddBackground(0, 0, 420, 50 + 20 * m_Inventories.Count, 0x13BE);
|
||||
|
||||
AddImageTiled(10, 10, 400, 20, 0xA40);
|
||||
AddHtmlLocalized(15, 10, 200, 20, 1062435, 0x7FFF); // Reclaim Vendor Inventory
|
||||
AddHtmlLocalized(330, 10, 50, 20, 1062465, 0x7FFF); // Expires
|
||||
|
||||
AddImageTiled(10, 40, 400, 20 * m_Inventories.Count, 0xA40);
|
||||
|
||||
for (int i = 0; i < m_Inventories.Count; i++)
|
||||
{
|
||||
VendorInventory inventory = m_Inventories[i];
|
||||
|
||||
int y = 40 + 20 * i;
|
||||
|
||||
if (inventory.Owner == from)
|
||||
AddButton(10, y, 0xFA5, 0xFA7, i + 1);
|
||||
|
||||
AddLabel(45, y, 0x481, $"{inventory.ShopName} ({inventory.VendorName})");
|
||||
|
||||
TimeSpan expire = inventory.ExpireTime - DateTime.UtcNow;
|
||||
int hours = (int)expire.TotalHours;
|
||||
|
||||
AddLabel(320, y, 0x481, hours.ToString());
|
||||
AddHtmlLocalized(350, y, 50, 20, 1062466, 0x7FFF); // hour(s)
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 0)
|
||||
return;
|
||||
|
||||
Mobile from = sender.Mobile;
|
||||
HouseSign sign = m_House.Sign;
|
||||
|
||||
if (m_House.Deleted || sign?.Deleted != false || !from.CheckAlive())
|
||||
return;
|
||||
|
||||
if (from.Map != sign.Map || !from.InRange(sign, 5))
|
||||
{
|
||||
from.SendLocalizedMessage(1062429); // You must be within five paces of the house sign to use this option.
|
||||
return;
|
||||
}
|
||||
|
||||
int index = info.ButtonID - 1;
|
||||
if (index < 0 || index >= m_Inventories.Count)
|
||||
return;
|
||||
|
||||
VendorInventory inventory = m_Inventories[index];
|
||||
|
||||
if (inventory.Owner != from || !m_House.VendorInventories.Contains(inventory))
|
||||
return;
|
||||
|
||||
int totalItems = 0;
|
||||
int givenToBackpack = 0;
|
||||
int givenToBankBox = 0;
|
||||
for (int i = inventory.Items.Count - 1; i >= 0; i--)
|
||||
{
|
||||
Item item = inventory.Items[i];
|
||||
|
||||
if (item.Deleted)
|
||||
{
|
||||
inventory.Items.RemoveAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
totalItems += 1 + item.TotalItems;
|
||||
|
||||
if (from.PlaceInBackpack(item))
|
||||
{
|
||||
inventory.Items.RemoveAt(i);
|
||||
givenToBackpack += 1 + item.TotalItems;
|
||||
}
|
||||
else if (from.BankBox.TryDropItem(from, item, false))
|
||||
{
|
||||
inventory.Items.RemoveAt(i);
|
||||
givenToBankBox += 1 + item.TotalItems;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1062436,
|
||||
totalItems + "\t" +
|
||||
inventory.Gold); // The vendor you selected had ~1_COUNT~ items in its inventory, and ~2_AMOUNT~ gold in its account.
|
||||
|
||||
int givenGold = Banker.DepositUpTo(from, inventory.Gold);
|
||||
inventory.Gold -= givenGold;
|
||||
|
||||
from.SendLocalizedMessage(1060397,
|
||||
givenGold.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
from.SendLocalizedMessage(1062437,
|
||||
givenToBackpack + "\t" +
|
||||
givenToBankBox); // ~1_COUNT~ items have been removed from the shop inventory and placed in your backpack. ~2_BANKCOUNT~ items were removed from the shop inventory and placed in your bank box.
|
||||
|
||||
if (inventory.Gold > 0 || inventory.Items.Count > 0)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1062440); // Some of the shop inventory would not fit in your backpack or bank box. Please free up some room and try again.
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory.Delete();
|
||||
from.SendLocalizedMessage(1062438); // The shop is now empty of inventory and funds, so it has been deleted.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
608
Projects/Scripts/Gumps/VendorRentalGumps.cs
Normal file
608
Projects/Scripts/Gumps/VendorRentalGumps.cs
Normal file
|
|
@ -0,0 +1,608 @@
|
|||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public abstract class BaseVendorRentalGump : Gump
|
||||
{
|
||||
protected enum GumpType
|
||||
{
|
||||
UnlockedContract,
|
||||
LockedContract,
|
||||
Offer,
|
||||
VendorLandlord,
|
||||
VendorRenter
|
||||
}
|
||||
|
||||
protected BaseVendorRentalGump( GumpType type, VendorRentalDuration duration, int price, int renewalPrice,
|
||||
Mobile landlord, Mobile renter, bool landlordRenew, bool renterRenew, bool renew ) : base( 100, 100 )
|
||||
{
|
||||
if ( type == GumpType.Offer )
|
||||
Closable = 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 );
|
||||
|
||||
AddImageTiled( 70, 55, 230, 2, 0x23C5 );
|
||||
|
||||
AddImage( 32, 33, 0x2635 );
|
||||
AddHtmlLocalized( 70, 35, 270, 20, 1062353, 0x1 ); // Vendor Rental Contract
|
||||
|
||||
|
||||
AddPage( 1 );
|
||||
|
||||
if ( type != GumpType.UnlockedContract )
|
||||
{
|
||||
AddImage( 65, 60, 0x827 );
|
||||
AddHtmlLocalized( 79, 58, 270, 20, 1062370, 0x1 ); // Landlord:
|
||||
AddLabel( 150, 58, 0x64, landlord != null ? landlord.Name : "" );
|
||||
|
||||
AddImageTiled( 70, 80, 230, 2, 0x23C5 );
|
||||
}
|
||||
|
||||
if ( type == GumpType.UnlockedContract || type == GumpType.LockedContract )
|
||||
AddButton( 30, 96, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 2 );
|
||||
AddHtmlLocalized( 50, 95, 150, 20, 1062354, 0x1 ); // Contract Length
|
||||
AddHtmlLocalized( 230, 95, 270, 20, duration.Name, 0x1 );
|
||||
|
||||
if ( type == GumpType.UnlockedContract || type == GumpType.LockedContract )
|
||||
AddButton( 30, 116, 0x15E1, 0x15E5, 1);
|
||||
AddHtmlLocalized( 50, 115, 150, 20, 1062356, 0x1 ); // Price Per Rental
|
||||
AddLabel( 230, 115, 0x64, price > 0 ? price.ToString() : "FREE" );
|
||||
|
||||
AddImageTiled( 50, 160, 250, 2, 0x23BF );
|
||||
|
||||
if ( type == GumpType.Offer )
|
||||
{
|
||||
AddButton( 67, 180, 0x482, 0x483, 2);
|
||||
AddHtmlLocalized( 100, 180, 270, 20, 1049011, 0x28 ); // I accept!
|
||||
|
||||
AddButton( 67, 210, 0x47F, 0x480, 0);
|
||||
AddHtmlLocalized( 100, 210, 270, 20, 1049012, 0x28 ); // No thanks, I decline.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage( 49, 170, 0x61 );
|
||||
AddHtmlLocalized( 60, 170, 250, 20, 1062355, 0x1 ); // Renew On Expiration?
|
||||
|
||||
if ( type == GumpType.LockedContract || type == GumpType.UnlockedContract || type == GumpType.VendorLandlord )
|
||||
AddButton( 30, 192, 0x15E1, 0x15E5, 3);
|
||||
AddHtmlLocalized( 85, 190, 250, 20, 1062359, 0x1 ); // Landlord:
|
||||
AddHtmlLocalized( 230, 190, 270, 20, landlordRenew ? 1049717 : 1049718, 0x1 ); // YES / NO
|
||||
|
||||
if ( type == GumpType.VendorRenter )
|
||||
AddButton( 30, 212, 0x15E1, 0x15E5, 4);
|
||||
AddHtmlLocalized( 85, 210, 250, 20, 1062360, 0x1 ); // Renter:
|
||||
AddHtmlLocalized( 230, 210, 270, 20, renterRenew ? 1049717 : 1049718, 0x1 ); // YES / NO
|
||||
|
||||
if ( renew )
|
||||
{
|
||||
AddImage( 49, 233, 0x939 );
|
||||
AddHtmlLocalized( 70, 230, 250, 20, 1062482, 0x1 ); // Contract WILL renew
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage( 49, 233, 0x938 );
|
||||
AddHtmlLocalized( 70, 230, 250, 20, 1062483, 0x1 ); // Contract WILL NOT renew
|
||||
}
|
||||
}
|
||||
|
||||
AddImageTiled( 30, 283, 257, 30, 0x5D );
|
||||
AddImage( 285, 283, 0x5E );
|
||||
AddImage( 20, 288, 0x232C );
|
||||
|
||||
if ( type == GumpType.LockedContract )
|
||||
{
|
||||
AddButton( 67, 295, 0x15E1, 0x15E5, 5);
|
||||
AddHtmlLocalized( 85, 294, 270, 20, 1062358, 0x28 ); // Offer Contract To Someone
|
||||
}
|
||||
else if ( type == GumpType.VendorLandlord || type == GumpType.VendorRenter )
|
||||
{
|
||||
if ( type == GumpType.VendorLandlord )
|
||||
AddButton( 30, 250, 0x15E1, 0x15E1, 6);
|
||||
AddHtmlLocalized( 85, 250, 250, 20, 1062499, 0x1 ); // Renewal Price
|
||||
AddLabel( 230, 250, 0x64, renewalPrice.ToString() );
|
||||
|
||||
AddHtmlLocalized( 60, 294, 270, 20, 1062369, 0x1 ); // Renter:
|
||||
AddLabel( 120, 293, 0x64, renter != null ? renter.Name : "" );
|
||||
}
|
||||
|
||||
|
||||
if ( type == GumpType.UnlockedContract || type == GumpType.LockedContract )
|
||||
{
|
||||
AddPage( 2 );
|
||||
|
||||
for ( int i = 0; i < VendorRentalDuration.Instances.Length; i++ )
|
||||
{
|
||||
VendorRentalDuration durationItem = VendorRentalDuration.Instances[i];
|
||||
|
||||
AddButton( 30, 76 + i * 20, 0x15E1, 0x15E5, 0x10 | i, GumpButtonType.Reply, 1 );
|
||||
AddHtmlLocalized( 50, 75 + i * 20, 150, 20, durationItem.Name, 0x1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if ( !IsValidResponse( from ) )
|
||||
return;
|
||||
|
||||
if ( (info.ButtonID & 0x10) != 0 ) // Contract duration
|
||||
{
|
||||
int index = info.ButtonID & 0xF;
|
||||
|
||||
if ( index < VendorRentalDuration.Instances.Length )
|
||||
{
|
||||
SetContractDuration( from, VendorRentalDuration.Instances[index] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 1: // Price Per Rental
|
||||
SetPricePerRental( from );
|
||||
break;
|
||||
|
||||
case 2: // Accept offer
|
||||
AcceptOffer( from );
|
||||
break;
|
||||
|
||||
case 3: // Renew on expiration - landlord
|
||||
LandlordRenewOnExpiration( from );
|
||||
break;
|
||||
|
||||
case 4: // Renew on expiration - renter
|
||||
RenterRenewOnExpiration( from );
|
||||
break;
|
||||
|
||||
case 5: // Offer Contract To Someone
|
||||
OfferContract( from );
|
||||
break;
|
||||
|
||||
case 6: // Renewal price
|
||||
SetRenewalPrice( from );
|
||||
break;
|
||||
|
||||
default:
|
||||
Cancel( from );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract bool IsValidResponse( Mobile from );
|
||||
|
||||
protected virtual void SetContractDuration( Mobile from, VendorRentalDuration duration )
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void SetPricePerRental( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void AcceptOffer( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void LandlordRenewOnExpiration( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void RenterRenewOnExpiration( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OfferContract( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void SetRenewalPrice( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void Cancel( Mobile from )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class VendorRentalContractGump : BaseVendorRentalGump
|
||||
{
|
||||
private VendorRentalContract m_Contract;
|
||||
|
||||
public VendorRentalContractGump( VendorRentalContract contract, Mobile from ) : base(
|
||||
contract.IsLockedDown ? GumpType.LockedContract : GumpType.UnlockedContract, contract.Duration,
|
||||
contract.Price, contract.Price, from, null, contract.LandlordRenew, false, false )
|
||||
{
|
||||
m_Contract = contract;
|
||||
}
|
||||
|
||||
protected override bool IsValidResponse( Mobile from )
|
||||
{
|
||||
return m_Contract.IsUsableBy( from, true, true, true, true );
|
||||
}
|
||||
|
||||
protected override void SetContractDuration( Mobile from, VendorRentalDuration duration )
|
||||
{
|
||||
m_Contract.Duration = duration;
|
||||
|
||||
from.SendGump( new VendorRentalContractGump( m_Contract, from ) );
|
||||
}
|
||||
|
||||
protected override void SetPricePerRental( Mobile from )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062365 ); // Please enter the amount of gold that should be charged for this contract (ESC to cancel):
|
||||
from.Prompt = new PricePerRentalPrompt( m_Contract );
|
||||
}
|
||||
|
||||
protected override void LandlordRenewOnExpiration( Mobile from )
|
||||
{
|
||||
m_Contract.LandlordRenew = !m_Contract.LandlordRenew;
|
||||
|
||||
from.SendGump( new VendorRentalContractGump( m_Contract, from ) );
|
||||
}
|
||||
|
||||
protected override void OfferContract( Mobile from )
|
||||
{
|
||||
if ( m_Contract.IsLandlord( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062371 ); // Please target the person you wish to offer this contract to.
|
||||
from.Target = new OfferContractTarget( m_Contract );
|
||||
}
|
||||
}
|
||||
|
||||
private class PricePerRentalPrompt : Prompt
|
||||
{
|
||||
private VendorRentalContract m_Contract;
|
||||
|
||||
public PricePerRentalPrompt( VendorRentalContract contract )
|
||||
{
|
||||
m_Contract = contract;
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( !m_Contract.IsUsableBy( from, true, true, true, true ) )
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if ( !int.TryParse( text, out int price ) )
|
||||
price = -1;
|
||||
|
||||
if ( price < 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062485 ); // Invalid entry. Rental fee set to 0.
|
||||
m_Contract.Price = 0;
|
||||
}
|
||||
else if ( price > 5000000 )
|
||||
{
|
||||
m_Contract.Price = 5000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Contract.Price = price;
|
||||
}
|
||||
|
||||
from.SendGump( new VendorRentalContractGump( m_Contract, from ) );
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
if ( m_Contract.IsUsableBy( from, true, true, true, true ) )
|
||||
from.SendGump( new VendorRentalContractGump( m_Contract, from ) );
|
||||
}
|
||||
}
|
||||
|
||||
private class OfferContractTarget : Target
|
||||
{
|
||||
private VendorRentalContract m_Contract;
|
||||
|
||||
public OfferContractTarget( VendorRentalContract contract ) : base( -1, false, TargetFlags.None )
|
||||
{
|
||||
m_Contract = contract;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( !m_Contract.IsUsableBy( from, true, false, true, true ) )
|
||||
return;
|
||||
|
||||
if ( !(targeted is Mobile mob) || !mob.Player || !mob.Alive || mob == from )
|
||||
{
|
||||
from.SendLocalizedMessage(1071984); //That is not a valid target for a rental contract!
|
||||
}
|
||||
else if ( !mob.InRange( m_Contract, 5 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501853 ); // Target is too far away.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1062372 ); // Please wait while that person considers your offer.
|
||||
|
||||
mob.SendLocalizedMessage( 1062373, from.Name ); // ~1_NAME~ is offering you a vendor rental. If you choose to accept this offer, you have 30 seconds to do so.
|
||||
mob.SendGump( new VendorRentalOfferGump( m_Contract, from ) );
|
||||
|
||||
m_Contract.Offeree = mob;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062380 ); // You decide against offering the contract to anyone.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VendorRentalOfferGump : BaseVendorRentalGump
|
||||
{
|
||||
private VendorRentalContract m_Contract;
|
||||
private Mobile m_Landlord;
|
||||
|
||||
public VendorRentalOfferGump( VendorRentalContract contract, Mobile landlord ) : base(
|
||||
GumpType.Offer, contract.Duration, contract.Price, contract.Price,
|
||||
landlord, null, contract.LandlordRenew, false, false )
|
||||
{
|
||||
m_Contract = contract;
|
||||
m_Landlord = landlord;
|
||||
}
|
||||
|
||||
protected override bool IsValidResponse( Mobile from )
|
||||
{
|
||||
return m_Contract.IsUsableBy( m_Landlord, true, false, false, false ) && from.CheckAlive() && m_Contract.Offeree == from;
|
||||
}
|
||||
|
||||
protected override void AcceptOffer( Mobile from )
|
||||
{
|
||||
m_Contract.Offeree = null;
|
||||
|
||||
if ( !m_Contract.Map.CanFit( m_Contract.Location, 16, false, false ) )
|
||||
{
|
||||
m_Landlord.SendLocalizedMessage( 1062486 ); // A vendor cannot exist at that location. Please try again.
|
||||
return;
|
||||
}
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( m_Contract );
|
||||
if ( house == null )
|
||||
return;
|
||||
|
||||
int price = m_Contract.Price;
|
||||
int goldToGive;
|
||||
|
||||
if ( price > 0 )
|
||||
{
|
||||
if ( Banker.Withdraw( from, price ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1060398, price.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
|
||||
|
||||
int depositedGold = Banker.DepositUpTo( m_Landlord, price );
|
||||
goldToGive = price - depositedGold;
|
||||
|
||||
if ( depositedGold > 0 )
|
||||
m_Landlord.SendLocalizedMessage( 1060397, price.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
||||
if ( goldToGive > 0 )
|
||||
m_Landlord.SendLocalizedMessage( 500390 ); // Your bank box is full.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1062378 ); // You do not have enough gold in your bank account to cover the cost of the contract.
|
||||
m_Landlord.SendLocalizedMessage( 1062374, from.Name ); // ~1_NAME~ has declined your vendor rental offer.
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goldToGive = 0;
|
||||
}
|
||||
|
||||
PlayerVendor vendor = new RentedVendor( from, house, m_Contract.Duration, price, m_Contract.LandlordRenew, goldToGive );
|
||||
vendor.MoveToWorld( m_Contract.Location, m_Contract.Map );
|
||||
|
||||
m_Contract.Delete();
|
||||
|
||||
from.SendLocalizedMessage( 1062377 ); // You have accepted the offer and now own a vendor in this house. Rental contract options and details may be viewed on this vendor via the 'Contract Options' context menu.
|
||||
m_Landlord.SendLocalizedMessage( 1062376, from.Name ); // ~1_NAME~ has accepted your vendor rental offer. Rental contract details and options may be viewed on this vendor via the 'Contract Options' context menu.
|
||||
}
|
||||
|
||||
protected override void Cancel( Mobile from )
|
||||
{
|
||||
m_Contract.Offeree = null;
|
||||
|
||||
from.SendLocalizedMessage( 1062375 ); // You decline the offer for a vendor space rental.
|
||||
m_Landlord.SendLocalizedMessage( 1062374, from.Name ); // ~1_NAME~ has declined your vendor rental offer.
|
||||
}
|
||||
}
|
||||
|
||||
public class RenterVendorRentalGump : BaseVendorRentalGump
|
||||
{
|
||||
private RentedVendor m_Vendor;
|
||||
|
||||
public RenterVendorRentalGump( RentedVendor vendor ) : base(
|
||||
GumpType.VendorRenter, vendor.RentalDuration, vendor.RentalPrice, vendor.RenewalPrice,
|
||||
vendor.Landlord, vendor.Owner, vendor.LandlordRenew, vendor.RenterRenew, vendor.Renew )
|
||||
{
|
||||
m_Vendor = vendor;
|
||||
}
|
||||
|
||||
protected override bool IsValidResponse( Mobile from )
|
||||
{
|
||||
return m_Vendor.CanInteractWith( from, true );
|
||||
}
|
||||
|
||||
protected override void RenterRenewOnExpiration( Mobile from )
|
||||
{
|
||||
m_Vendor.RenterRenew = !m_Vendor.RenterRenew;
|
||||
|
||||
from.SendGump( new RenterVendorRentalGump( m_Vendor ) );
|
||||
}
|
||||
}
|
||||
|
||||
public class LandlordVendorRentalGump : BaseVendorRentalGump
|
||||
{
|
||||
private RentedVendor m_Vendor;
|
||||
|
||||
public LandlordVendorRentalGump( RentedVendor vendor ) : base(
|
||||
GumpType.VendorLandlord, vendor.RentalDuration, vendor.RentalPrice, vendor.RenewalPrice,
|
||||
vendor.Landlord, vendor.Owner, vendor.LandlordRenew, vendor.RenterRenew, vendor.Renew )
|
||||
{
|
||||
m_Vendor = vendor;
|
||||
}
|
||||
|
||||
protected override bool IsValidResponse( Mobile from )
|
||||
{
|
||||
return m_Vendor.CanInteractWith( from, false ) && m_Vendor.IsLandlord( from );
|
||||
}
|
||||
|
||||
protected override void LandlordRenewOnExpiration( Mobile from )
|
||||
{
|
||||
m_Vendor.LandlordRenew = !m_Vendor.LandlordRenew;
|
||||
|
||||
from.SendGump( new LandlordVendorRentalGump( m_Vendor ) );
|
||||
}
|
||||
|
||||
protected override void SetRenewalPrice( Mobile from )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062500 ); // Enter contract renewal price:
|
||||
|
||||
from.Prompt = new ContractRenewalPricePrompt( m_Vendor );
|
||||
}
|
||||
|
||||
private class ContractRenewalPricePrompt : Prompt
|
||||
{
|
||||
private RentedVendor m_Vendor;
|
||||
|
||||
public ContractRenewalPricePrompt( RentedVendor vendor )
|
||||
{
|
||||
m_Vendor = vendor;
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( !m_Vendor.CanInteractWith( from, false ) || !m_Vendor.IsLandlord( from ) )
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if ( !int.TryParse( text, out int price ) )
|
||||
price = -1;
|
||||
|
||||
if ( price < 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062485 ); // Invalid entry. Rental fee set to 0.
|
||||
m_Vendor.RenewalPrice = 0;
|
||||
}
|
||||
else if ( price > 5000000 )
|
||||
{
|
||||
m_Vendor.RenewalPrice = 5000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Vendor.RenewalPrice = price;
|
||||
}
|
||||
|
||||
m_Vendor.RenterRenew = false;
|
||||
|
||||
from.SendGump( new LandlordVendorRentalGump( m_Vendor ) );
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
if ( m_Vendor.CanInteractWith( from, false ) && m_Vendor.IsLandlord( from ) )
|
||||
from.SendGump( new LandlordVendorRentalGump( m_Vendor ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VendorRentalRefundGump : Gump
|
||||
{
|
||||
private RentedVendor m_Vendor;
|
||||
private Mobile m_Landlord;
|
||||
private int m_RefundAmount;
|
||||
|
||||
public VendorRentalRefundGump( RentedVendor vendor, Mobile landlord, int refundAmount ) : base( 50, 50 )
|
||||
{
|
||||
m_Vendor = vendor;
|
||||
m_Landlord = landlord;
|
||||
m_RefundAmount = refundAmount;
|
||||
|
||||
AddBackground( 0, 0, 420, 320, 0x13BE );
|
||||
|
||||
AddImageTiled( 10, 10, 400, 300, 0xA40 );
|
||||
AddAlphaRegion( 10, 10, 400, 300 );
|
||||
|
||||
/* The landlord for this vendor is offering you a partial refund of your rental fee
|
||||
* in exchange for immediate termination of your rental contract.<BR><BR>
|
||||
*
|
||||
* If you accept this offer, the vendor will be immediately dismissed. You will then
|
||||
* be able to claim the inventory and any funds the vendor may be holding for you via
|
||||
* a context menu on the house sign for this house.
|
||||
*/
|
||||
AddHtmlLocalized( 10, 10, 400, 150, 1062501, 0x7FFF, false, true );
|
||||
|
||||
AddHtmlLocalized( 10, 180, 150, 20, 1062508, 0x7FFF ); // Vendor Name:
|
||||
AddLabel( 160, 180, 0x480, vendor.Name );
|
||||
|
||||
AddHtmlLocalized( 10, 200, 150, 20, 1062509, 0x7FFF ); // Shop Name:
|
||||
AddLabel( 160, 200, 0x480, vendor.ShopName );
|
||||
|
||||
AddHtmlLocalized( 10, 220, 150, 20, 1062510, 0x7FFF ); // Refund Amount:
|
||||
AddLabel( 160, 220, 0x480, refundAmount.ToString() );
|
||||
|
||||
AddButton( 10, 268, 0xFA5, 0xFA7, 1);
|
||||
AddHtmlLocalized( 45, 268, 350, 20, 1062511, 0x7FFF ); // Agree, and <strong>dismiss vendor</strong>
|
||||
|
||||
AddButton( 10, 288, 0xFA5, 0xFA7, 0);
|
||||
AddHtmlLocalized( 45, 288, 350, 20, 1062512, 0x7FFF ); // No, I want to <strong>keep my vendor</strong>
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if ( !m_Vendor.CanInteractWith( from, true ) || !m_Vendor.CanInteractWith( m_Landlord, false ) || !m_Vendor.IsLandlord( m_Landlord ) )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
if ( Banker.Withdraw( m_Landlord, m_RefundAmount ) )
|
||||
{
|
||||
m_Landlord.SendLocalizedMessage( 1060398, m_RefundAmount.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
|
||||
|
||||
int depositedGold = Banker.DepositUpTo( from, m_RefundAmount );
|
||||
|
||||
if ( depositedGold > 0 )
|
||||
from.SendLocalizedMessage( 1060397, depositedGold.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
||||
m_Vendor.HoldGold += m_RefundAmount - depositedGold;
|
||||
|
||||
m_Vendor.Destroy( false );
|
||||
|
||||
from.SendLocalizedMessage(1071990); //Remember to claim your vendor's belongings from the house sign!
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Landlord.SendLocalizedMessage( 1062507 ); // You do not have that much money in your bank account.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Landlord.SendLocalizedMessage( 1062513 ); // The renter declined your offer.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
289
Projects/Scripts/Gumps/ViewHousesGump.cs
Normal file
289
Projects/Scripts/Gumps/ViewHousesGump.cs
Normal file
|
|
@ -0,0 +1,289 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Accounting;
|
||||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ViewHousesGump : Gump
|
||||
{
|
||||
private const int White16 = 0x7FFF;
|
||||
private const int White = 0xFFFFFF;
|
||||
|
||||
private Mobile m_From;
|
||||
private List<BaseHouse> m_List;
|
||||
private BaseHouse m_Selection;
|
||||
|
||||
public ViewHousesGump(Mobile from, List<BaseHouse> list, BaseHouse sel) : base(50, 40)
|
||||
{
|
||||
m_From = from;
|
||||
m_List = list;
|
||||
m_Selection = sel;
|
||||
|
||||
from.CloseGump<ViewHousesGump>();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 240, 360, 5054);
|
||||
AddBlackAlpha(10, 10, 220, 340);
|
||||
|
||||
if (sel?.Deleted != false)
|
||||
{
|
||||
m_Selection = null;
|
||||
|
||||
AddHtml(35, 15, 120, 20, Color("House Type", White));
|
||||
|
||||
if (list.Count == 0)
|
||||
AddHtml(35, 40, 160, 40, Color("There were no houses found for that player.", White));
|
||||
|
||||
AddImage(190, 17, 0x25EA);
|
||||
AddImage(207, 17, 0x25E6);
|
||||
|
||||
int page = 0;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
if (i % 15 == 0)
|
||||
{
|
||||
if (page > 0)
|
||||
AddButton(207, 17, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1);
|
||||
|
||||
AddPage(++page);
|
||||
|
||||
if (page > 1)
|
||||
AddButton(190, 17, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1);
|
||||
}
|
||||
|
||||
object name = FindHouseName(list[i]);
|
||||
|
||||
AddHtml(15, 40 + i % 15 * 20, 20, 20, Color($"{i + 1}.", White));
|
||||
|
||||
if (name is int nameInt)
|
||||
AddHtmlLocalized(35, 40 + i % 15 * 20, 160, 20, nameInt, White16);
|
||||
else
|
||||
AddHtml(35, 40 + i % 15 * 20, 160, 20, Color(name.ToString(), White));
|
||||
|
||||
AddButton(198, 39 + i % 15 * 20, 4005, 4007, i + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string location;
|
||||
Map map = sel.Map;
|
||||
|
||||
string houseName = sel.Sign == null ? "An Unnamed House" : sel.Sign.GetName();
|
||||
string owner = sel.Owner == null ? "nobody" : sel.Owner.Name;
|
||||
|
||||
int xLong = 0, yLat = 0, xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
|
||||
bool valid = Sextant.Format(sel.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast,
|
||||
ref ySouth);
|
||||
|
||||
if (valid)
|
||||
location = $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}° {xMins}'{(xEast ? "E" : "W")}";
|
||||
else
|
||||
location = "unknown";
|
||||
|
||||
AddHtml(10, 15, 220, 20, Color(Center("House Properties"), White));
|
||||
|
||||
AddHtml(15, 40, 210, 20, Color("Facet:", White));
|
||||
AddHtml(15, 40, 210, 20, Color(Right(map == null ? "(null)" : map.Name), White));
|
||||
|
||||
AddHtml(15, 60, 210, 20, Color("Location:", White));
|
||||
AddHtml(15, 60, 210, 20, Color(Right(sel.Location.ToString()), White));
|
||||
|
||||
AddHtml(15, 80, 210, 20, Color("Sextant:", White));
|
||||
AddHtml(15, 80, 210, 20, Color(Right(location), White));
|
||||
|
||||
AddHtml(15, 100, 210, 20, Color("Owner:", White));
|
||||
AddHtml(15, 100, 210, 20, Color(Right(owner), White));
|
||||
|
||||
AddHtml(15, 120, 210, 20, Color("Name:", White));
|
||||
AddHtml(15, 120, 210, 20, Color(Right(houseName), White));
|
||||
|
||||
AddHtml(15, 140, 210, 20, Color("Friends:", White));
|
||||
AddHtml(15, 140, 210, 20, Color(Right(sel.Friends.Count.ToString()), White));
|
||||
|
||||
AddHtml(15, 160, 210, 20, Color("Co-Owners:", White));
|
||||
AddHtml(15, 160, 210, 20, Color(Right(sel.CoOwners.Count.ToString()), White));
|
||||
|
||||
AddHtml(15, 180, 210, 20, Color("Bans:", White));
|
||||
AddHtml(15, 180, 210, 20, Color(Right(sel.Bans.Count.ToString()), White));
|
||||
|
||||
AddHtml(15, 200, 210, 20, Color("Decays:", White));
|
||||
AddHtml(15, 200, 210, 20, Color(Right(sel.CanDecay ? "Yes" : "No"), White));
|
||||
|
||||
AddHtml(15, 220, 210, 20, Color("Decay Level:", White));
|
||||
AddHtml(15, 220, 210, 20, Color(Right(sel.DecayLevel.ToString()), White));
|
||||
|
||||
AddButton(15, 245, 4005, 4007, 1);
|
||||
AddHtml(50, 245, 120, 20, Color("Go to house", White));
|
||||
|
||||
AddButton(15, 265, 4005, 4007, 2);
|
||||
AddHtml(50, 265, 120, 20, Color("Open house menu", White));
|
||||
|
||||
AddButton(15, 285, 4005, 4007, 3);
|
||||
AddHtml(50, 285, 120, 20, Color("Demolish house", White));
|
||||
|
||||
AddButton(15, 305, 4005, 4007, 4);
|
||||
AddHtml(50, 305, 120, 20, Color("Refresh house", White));
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("ViewHouses", AccessLevel.GameMaster, ViewHouses_OnCommand);
|
||||
}
|
||||
|
||||
[Usage("ViewHouses")]
|
||||
[Description(
|
||||
"Displays a menu listing all houses of a targeted player. The menu also contains specific house details, and options to: go to house, open house menu, and demolish house.")]
|
||||
public static void ViewHouses_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
e.Mobile.BeginTarget(-1, false, TargetFlags.None, ViewHouses_OnTarget);
|
||||
}
|
||||
|
||||
public static void ViewHouses_OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is Mobile mobile)
|
||||
from.SendGump(new ViewHousesGump(from, GetHouses(mobile), null));
|
||||
}
|
||||
|
||||
public static List<BaseHouse> GetHouses(Mobile owner)
|
||||
{
|
||||
List<BaseHouse> list = new List<BaseHouse>();
|
||||
|
||||
if (!(owner.Account is Account acct))
|
||||
list.AddRange(BaseHouse.GetHouses(owner));
|
||||
else
|
||||
for (int i = 0; i < acct.Length; ++i)
|
||||
{
|
||||
Mobile mob = acct[i];
|
||||
|
||||
if (mob != null)
|
||||
list.AddRange(BaseHouse.GetHouses(mob));
|
||||
}
|
||||
|
||||
list.Sort(HouseComparer.Instance);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Selection == null)
|
||||
{
|
||||
int v = info.ButtonID - 1;
|
||||
|
||||
if (v >= 0 && v < m_List.Count)
|
||||
m_From.SendGump(new ViewHousesGump(m_From, m_List, m_List[v]));
|
||||
}
|
||||
else if (!m_Selection.Deleted)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_From.SendGump(new ViewHousesGump(m_From, m_List, null));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
Map map = m_Selection.Map;
|
||||
|
||||
if (map != null && map != Map.Internal)
|
||||
m_From.MoveToWorld(m_Selection.BanLocation, map);
|
||||
|
||||
m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection));
|
||||
|
||||
HouseSign sign = m_Selection.Sign;
|
||||
|
||||
if (sign?.Deleted == false)
|
||||
sign.OnDoubleClick(m_From);
|
||||
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection));
|
||||
m_From.SendGump(new HouseDemolishGump(m_From, m_Selection));
|
||||
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
m_Selection.RefreshDecay();
|
||||
m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object FindHouseName(BaseHouse house)
|
||||
{
|
||||
int multiID = house.ItemID;
|
||||
HousePlacementEntry[] entries = HousePlacementEntry.ClassicHouses;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
if (entries[i].MultiID == multiID)
|
||||
return entries[i].Description;
|
||||
|
||||
entries = HousePlacementEntry.TwoStoryFoundations;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
if (entries[i].MultiID == multiID)
|
||||
return entries[i].Description;
|
||||
|
||||
entries = HousePlacementEntry.ThreeStoryFoundations;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
if (entries[i].MultiID == multiID)
|
||||
return entries[i].Description;
|
||||
|
||||
return house.GetType().Name;
|
||||
}
|
||||
|
||||
public string Right(string text)
|
||||
{
|
||||
return $"<div align=right>{text}</div>";
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
{
|
||||
return $"<CENTER>{text}</CENTER>";
|
||||
}
|
||||
|
||||
public string Color(string text, int color)
|
||||
{
|
||||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
|
||||
public void AddBlackAlpha(int x, int y, int width, int height)
|
||||
{
|
||||
AddImageTiled(x, y, width, height, 2624);
|
||||
AddAlphaRegion(x, y, width, height);
|
||||
}
|
||||
|
||||
private class HouseComparer : IComparer<BaseHouse>
|
||||
{
|
||||
public static readonly IComparer<BaseHouse> Instance = new HouseComparer();
|
||||
|
||||
public int Compare(BaseHouse x, BaseHouse y)
|
||||
{
|
||||
return x.BuiltOn.CompareTo(y.BuiltOn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
Projects/Scripts/Gumps/WarningGump.cs
Normal file
55
Projects/Scripts/Gumps/WarningGump.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
namespace Server.Gumps
|
||||
{
|
||||
public delegate void WarningGumpCallback( bool okay );
|
||||
|
||||
public class WarningGump : Gump
|
||||
{
|
||||
private WarningGumpCallback m_Callback;
|
||||
|
||||
public WarningGump( int header, int headerColor, object content, int contentColor, int width, int height, WarningGumpCallback callback = null, bool cancelButton = true) : base( (640 - width) / 2, (480 - height) / 2 )
|
||||
{
|
||||
m_Callback = callback;
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, width, height, 5054 );
|
||||
|
||||
AddImageTiled( 10, 10, width - 20, 20, 2624 );
|
||||
AddAlphaRegion( 10, 10, width - 20, 20 );
|
||||
AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor );
|
||||
|
||||
AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
|
||||
if ( content is int i )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, i, contentColor, false, true );
|
||||
else if ( content is string )
|
||||
AddHtml( 10, 40, width - 20, height - 80, $"<BASEFONT COLOR=#{contentColor:X6}>{content}</BASEFONT>", false, true );
|
||||
|
||||
AddImageTiled( 10, height - 30, width - 20, 20, 2624 );
|
||||
AddAlphaRegion( 10, height - 30, width - 20, 20 );
|
||||
|
||||
AddButton( 10, height - 30, 4005, 4007, 1 );
|
||||
AddHtmlLocalized( 40, height - 30, 170, 20, 1011036, 32767 ); // OKAY
|
||||
|
||||
if ( cancelButton )
|
||||
{
|
||||
AddButton( 10 + ((width - 20) / 2), height - 30, 4005, 4007, 0 );
|
||||
AddHtmlLocalized( 40 + ((width - 20) / 2), height - 30, 170, 20, 1011012, 32767 ); // CANCEL
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if (m_Callback == null)
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1)
|
||||
m_Callback( true );
|
||||
else
|
||||
m_Callback.Invoke( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
292
Projects/Scripts/Gumps/WhoGump.cs
Normal file
292
Projects/Scripts/Gumps/WhoGump.cs
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class WhoGump : Gump
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "Who", AccessLevel.Counselor, WhoList_OnCommand );
|
||||
CommandSystem.Register( "WhoList", AccessLevel.Counselor, WhoList_OnCommand );
|
||||
}
|
||||
|
||||
[Usage( "WhoList [filter]" )]
|
||||
[Aliases( "Who" )]
|
||||
[Description( "Lists all connected clients. Optionally filters results by name." )]
|
||||
private static void WhoList_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.SendGump( new WhoGump( e.Mobile, e.ArgString ) );
|
||||
}
|
||||
|
||||
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 bool PrevLabel = false, 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 Mobile m_Owner;
|
||||
private List<Mobile> m_Mobiles;
|
||||
private int m_Page;
|
||||
|
||||
private class InternalComparer : IComparer<Mobile>
|
||||
{
|
||||
public static readonly IComparer<Mobile> Instance = new InternalComparer();
|
||||
|
||||
public InternalComparer()
|
||||
{
|
||||
}
|
||||
|
||||
public int Compare( Mobile x, Mobile y )
|
||||
{
|
||||
if ( x == null || y == null )
|
||||
throw new ArgumentException();
|
||||
|
||||
if ( x.AccessLevel > y.AccessLevel )
|
||||
return -1;
|
||||
if ( x.AccessLevel < y.AccessLevel )
|
||||
return 1;
|
||||
return Insensitive.Compare( x.Name, y.Name );
|
||||
}
|
||||
}
|
||||
|
||||
public WhoGump(Mobile owner, string filter) : this(owner, BuildList( owner, filter ))
|
||||
{
|
||||
}
|
||||
|
||||
public WhoGump(Mobile owner, List<Mobile> list, int page = 0) : base(GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
owner.CloseGump<WhoGump>();
|
||||
|
||||
m_Owner = owner;
|
||||
m_Mobiles = list;
|
||||
|
||||
Initialize( page );
|
||||
}
|
||||
|
||||
public static List<Mobile> BuildList(Mobile owner, string rawFilter)
|
||||
{
|
||||
string filter = String.IsNullOrWhiteSpace(rawFilter) ? null : rawFilter.Trim().ToLower();
|
||||
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
List<NetState> states = NetState.Instances;
|
||||
|
||||
for ( int i = 0; i < states.Count; ++i )
|
||||
{
|
||||
Mobile m = states[i].Mobile;
|
||||
|
||||
if ( m != null && (m == owner || !m.Hidden || owner.AccessLevel >= m.AccessLevel || m is PlayerMobile mobile && mobile.VisibilityList.Contains( owner ) ) )
|
||||
{
|
||||
if ( filter != null && !(m.Name?.ToLower().IndexOf(filter) >= 0) )
|
||||
continue;
|
||||
|
||||
list.Add( m );
|
||||
}
|
||||
}
|
||||
|
||||
list.Sort( InternalComparer.Instance );
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void Initialize( int page )
|
||||
{
|
||||
m_Page = page;
|
||||
|
||||
int count = m_Mobiles.Count - page * EntryCount;
|
||||
|
||||
if ( count < 0 )
|
||||
count = 0;
|
||||
else if ( count > EntryCount )
|
||||
count = EntryCount;
|
||||
|
||||
int totalHeight = OffsetSize + (EntryHeight + OffsetSize) * (count + 1);
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID );
|
||||
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 )
|
||||
AddImageTiled( x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID );
|
||||
|
||||
AddLabel( x + TextOffsetX, y, TextHue,
|
||||
$"Page {page + 1} of {(m_Mobiles.Count + EntryCount - 1) / EntryCount} ({m_Mobiles.Count})");
|
||||
|
||||
x += emptyWidth + OffsetSize;
|
||||
|
||||
if ( OldStyle )
|
||||
AddImageTiled( x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID );
|
||||
else
|
||||
AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );
|
||||
|
||||
if ( page > 0 )
|
||||
{
|
||||
AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1 );
|
||||
|
||||
if ( PrevLabel )
|
||||
AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous" );
|
||||
}
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
if ( !OldStyle )
|
||||
AddImageTiled( x, y, NextWidth, EntryHeight, HeaderGumpID );
|
||||
|
||||
if ( (page + 1) * EntryCount < m_Mobiles.Count )
|
||||
{
|
||||
AddButton( x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1 );
|
||||
|
||||
if ( NextLabel )
|
||||
AddLabel( x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next" );
|
||||
}
|
||||
|
||||
for ( int i = 0, index = page * EntryCount; i < EntryCount && index < m_Mobiles.Count; ++i, ++index )
|
||||
{
|
||||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
Mobile m = m_Mobiles[index];
|
||||
|
||||
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
|
||||
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, GetHueFor( m ), m.Deleted ? "(deleted)" : m.Name );
|
||||
|
||||
x += EntryWidth + OffsetSize;
|
||||
|
||||
if ( SetGumpID != 0 )
|
||||
AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );
|
||||
|
||||
if ( m.NetState != null && !m.Deleted )
|
||||
AddButton( x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 3 );
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetHueFor( Mobile m )
|
||||
{
|
||||
switch ( m.AccessLevel )
|
||||
{
|
||||
case AccessLevel.Owner:
|
||||
case AccessLevel.Developer:
|
||||
case AccessLevel.Administrator: return 0x516;
|
||||
case AccessLevel.Seer: return 0x144;
|
||||
case AccessLevel.GameMaster: return 0x21;
|
||||
case AccessLevel.Counselor: return 0x2;
|
||||
default:
|
||||
{
|
||||
return m.Kills >= 5 ? 0x21 : m.Criminal ? 0x3B1 : 0x58;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // Closed
|
||||
{
|
||||
return;
|
||||
}
|
||||
case 1: // Previous
|
||||
{
|
||||
if ( m_Page > 0 )
|
||||
from.SendGump( new WhoGump( from, m_Mobiles, m_Page - 1 ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Next
|
||||
{
|
||||
if ( (m_Page + 1) * EntryCount < m_Mobiles.Count )
|
||||
from.SendGump( new WhoGump( from, m_Mobiles, m_Page + 1 ) );
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int index = m_Page * EntryCount + (info.ButtonID - 3);
|
||||
|
||||
if ( index >= 0 && index < m_Mobiles.Count )
|
||||
{
|
||||
Mobile m = m_Mobiles[index];
|
||||
|
||||
if ( m.Deleted )
|
||||
{
|
||||
from.SendMessage( "That player has deleted their character." );
|
||||
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
|
||||
}
|
||||
else if ( m.NetState == null )
|
||||
{
|
||||
from.SendMessage( "That player is no longer online." );
|
||||
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
|
||||
}
|
||||
else if ( m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || m is PlayerMobile mobile && mobile.VisibilityList.Contains( from ))
|
||||
{
|
||||
from.SendGump( new ClientGump( from, m.NetState ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You cannot see them." );
|
||||
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
93
Projects/Scripts/Gumps/YoungGumps.cs
Normal file
93
Projects/Scripts/Gumps/YoungGumps.cs
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
using Server.Network;
|
||||
using Server.Accounting;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class YoungDungeonWarning : Gump
|
||||
{
|
||||
public YoungDungeonWarning() : base( 150, 200 )
|
||||
{
|
||||
AddBackground( 0, 0, 250, 170, 0xA28 );
|
||||
|
||||
AddHtmlLocalized( 20, 43, 215, 70, 1018030, true, true ); // Warning: monsters may attack you on site down here in the dungeons!
|
||||
|
||||
AddButton( 70, 123, 0xFA5, 0xFA7, 0);
|
||||
AddHtmlLocalized( 105, 125, 100, 35, 1011036 ); // OKAY
|
||||
}
|
||||
}
|
||||
|
||||
public class YoungDeathNotice : Gump
|
||||
{
|
||||
public YoungDeathNotice() : base( 100, 15 )
|
||||
{
|
||||
Closable = false;
|
||||
|
||||
AddBackground( 25, 10, 425, 444, 0x13BE );
|
||||
|
||||
AddImageTiled( 33, 20, 407, 425, 0xA40 );
|
||||
AddAlphaRegion( 33, 20, 407, 425 );
|
||||
|
||||
AddHtmlLocalized( 190, 24, 120, 20, 1046287, 0x7D00 ); // You have died.
|
||||
|
||||
// As a ghost you cannot interact with the world. You cannot touch items nor can you use them.
|
||||
AddHtmlLocalized( 50, 50, 380, 40, 1046288, 0xFFFFFF );
|
||||
// You can pass through doors as though they do not exist. However, you cannot pass through walls.
|
||||
AddHtmlLocalized( 50, 100, 380, 45, 1046289, 0xFFFFFF );
|
||||
// Since you are a new player, any items you had on your person at the time of your death will be in your backpack upon resurrection.
|
||||
AddHtmlLocalized( 50, 140, 380, 60, 1046291, 0xFFFFFF );
|
||||
// To be resurrected you must find a healer in town or wandering in the wilderness. Some powerful players may also be able to resurrect you.
|
||||
AddHtmlLocalized( 50, 204, 380, 65, 1046292, 0xFFFFFF );
|
||||
// While you are still in young status, you will be transported to the nearest healer (along with your items) at the time of your death.
|
||||
AddHtmlLocalized( 50, 269, 380, 65, 1046293, 0xFFFFFF );
|
||||
// To rejoin the world of the living simply walk near one of the NPC healers, and they will resurrect you as long as you are not marked as a criminal.
|
||||
AddHtmlLocalized( 50, 334, 380, 70, 1046294, 0xFFFFFF );
|
||||
|
||||
AddButton( 195, 410, 0xF8, 0xF9, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public class RenounceYoungGump : Gump
|
||||
{
|
||||
public RenounceYoungGump() : base( 150, 50 )
|
||||
{
|
||||
AddBackground( 0, 0, 450, 400, 0xA28 );
|
||||
|
||||
AddHtmlLocalized( 0, 30, 450, 35, 1013004 ); // <center> Renouncing 'Young Player' Status</center>
|
||||
|
||||
/* As a 'Young' player, you are currently under a system of protection that prevents
|
||||
* you from being attacked by other players and certain monsters.<br><br>
|
||||
*
|
||||
* If you choose to renounce your status as a 'Young' player, you will lose this protection.
|
||||
* You will become vulnerable to other players, and many monsters that had only glared
|
||||
* at you menacingly before will now attack you on sight!<br><br>
|
||||
*
|
||||
* Select OKAY now if you wish to renounce your status as a 'Young' player, otherwise
|
||||
* press CANCEL.
|
||||
*/
|
||||
AddHtmlLocalized( 30, 70, 390, 210, 1013005, true, true );
|
||||
|
||||
AddButton( 45, 298, 0xFA5, 0xFA7, 1);
|
||||
AddHtmlLocalized( 78, 300, 100, 35, 1011036 ); // OKAY
|
||||
|
||||
AddButton( 178, 298, 0xFA5, 0xFA7, 0);
|
||||
AddHtmlLocalized( 211, 300, 100, 35, 1011012 ); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
if ( from.Account is Account acc )
|
||||
{
|
||||
acc.RemoveYoungStatus( 502085 ); // You have chosen to renounce your `Young' player status.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502086 ); // You have chosen not to renounce your `Young' player status.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue