perf: Migrate Old Guild System gumps to DynamicGump (#2420)
## Summary Migrates the Old Guild System (pre-AOS guild stones) gumps from the legacy `Gump` class to `DynamicGump`, following the same pattern used for the Quest gump migration in #2416. All concrete gumps now have private constructors gated by static `DisplayTo` entry points (empty-gump rule), and `Singleton => true` is set across the board so reopening a sibling dialog automatically closes the previous one. **Migrated gumps:** - `GuildGump` - main guild dialog - `GuildmasterGump` - guildmaster functions - `GuildCharterGump` - charter and website display - `GuildWarGump` - warfare status (kept as player-facing) - `GuildWarAdminGump` - war menu (retained as player-facing - reachable from `GuildmasterGump`'s WAR button by guildmasters) - `GuildChangeTypeGump` - Standard/Order/Chaos selection **Abstract bases:** `GuildListGump` and `GuildMobileListGump` keep their shared list-rendering chrome inside a single concrete `BuildLayout` on the abstract class and expose a `protected abstract void BuildHeader(ref DynamicGumpBuilder builder)` hook for subclasses (replacing the old `Design()` override). This mirrors the abstract-base treatment used for the ML quest base in the quest-gump migration PR. **Concrete subclasses migrated alongside the abstract bases:** - `GuildListGump` subclasses: `GuildAcceptWarGump`, `GuildDeclarePeaceGump`, `GuildDeclareWarGump`, `GuildRejectWarGump`, `GuildRescindDeclarationGump` - `GuildMobileListGump` subclasses: `DeclareFealtyGump`, `GrantGuildTitleGump`, `GuildAdminCandidatesGump`, `GuildCandidatesGump`, `GuildDismissGump`, `GuildRosterGump` **Cliloc rule:** Every gump bakes per-instance dynamic content (guild names, member names, war declarations, candidate lists), which would defeat `StaticGump<T>` caching. Per the cliloc rule, all are `DynamicGump`. **External callers updated:** the prompt files (`GuildAbbrvPrompt`, `GuildCharterPrompt`, `GuildDeclareWarPrompt`, `GuildNamePrompt`, `GuildTitlePrompt`, `GuildWebsitePrompt`), `RecruitTarget`, the `Guildstone` item, and the New Guild System `GuildInfoGump`'s Order/Chaos handler all now go through static `DisplayTo` entry points instead of `new XGump(...)`.
This commit is contained in:
parent
70a69d3efe
commit
15e506ffc2
33 changed files with 848 additions and 761 deletions
|
|
@ -352,62 +352,62 @@ public ref struct SpanWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteLittleUni(string value) => Write(value, TextEncoding.UnicodeLE);
|
public void WriteLittleUni(ReadOnlySpan<char> value) => Write(value, TextEncoding.UnicodeLE);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteLittleUniNull(string value)
|
public void WriteLittleUniNull(ReadOnlySpan<char> value)
|
||||||
{
|
{
|
||||||
Write(value, TextEncoding.UnicodeLE);
|
Write(value, TextEncoding.UnicodeLE);
|
||||||
Write((ushort)0);
|
Write((ushort)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteLittleUni(string value, int fixedLength) => Write(value, TextEncoding.UnicodeLE, fixedLength);
|
public void WriteLittleUni(ReadOnlySpan<char> value, int fixedLength) => Write(value, TextEncoding.UnicodeLE, fixedLength);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteBigUni(string value) => Write(value, TextEncoding.Unicode);
|
public void WriteBigUni(ReadOnlySpan<char> value) => Write(value, TextEncoding.Unicode);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteBigUniNull(string value)
|
public void WriteBigUniNull(ReadOnlySpan<char> value)
|
||||||
{
|
{
|
||||||
Write(value, TextEncoding.Unicode);
|
Write(value, TextEncoding.Unicode);
|
||||||
Write((ushort)0); // '\0'
|
Write((ushort)0); // '\0'
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteBigUni(string value, int fixedLength) => Write(value, TextEncoding.Unicode, fixedLength);
|
public void WriteBigUni(ReadOnlySpan<char> value, int fixedLength) => Write(value, TextEncoding.Unicode, fixedLength);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteUTF8(string value) => Write(value, TextEncoding.UTF8);
|
public void WriteUTF8(ReadOnlySpan<char> value) => Write(value, TextEncoding.UTF8);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteUTF8Null(string value)
|
public void WriteUTF8Null(ReadOnlySpan<char> value)
|
||||||
{
|
{
|
||||||
Write(value, TextEncoding.UTF8);
|
Write(value, TextEncoding.UTF8);
|
||||||
Write((byte)0); // '\0'
|
Write((byte)0); // '\0'
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteAscii(string value) => Write(value, Encoding.ASCII);
|
public void WriteAscii(ReadOnlySpan<char> value) => Write(value, Encoding.ASCII);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteAsciiNull(string value)
|
public void WriteAsciiNull(ReadOnlySpan<char> value)
|
||||||
{
|
{
|
||||||
Write(value, Encoding.ASCII);
|
Write(value, Encoding.ASCII);
|
||||||
Write((byte)0); // '\0'
|
Write((byte)0); // '\0'
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteAscii(string value, int fixedLength) => Write(value, Encoding.ASCII, fixedLength);
|
public void WriteAscii(ReadOnlySpan<char> value, int fixedLength) => Write(value, Encoding.ASCII, fixedLength);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteLatin1(string value) => Write(value, Encoding.Latin1);
|
public void WriteLatin1(ReadOnlySpan<char> value) => Write(value, Encoding.Latin1);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteLatin1(string value, int fixedLength) => Write(value, Encoding.Latin1, fixedLength);
|
public void WriteLatin1(ReadOnlySpan<char> value, int fixedLength) => Write(value, Encoding.Latin1, fixedLength);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void WriteLatin1Null(string value)
|
public void WriteLatin1Null(ReadOnlySpan<char> value)
|
||||||
{
|
{
|
||||||
Write(value, Encoding.Latin1);
|
Write(value, Encoding.Latin1);
|
||||||
Write((byte)0); // '\0'
|
Write((byte)0); // '\0'
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public abstract class BaseGuild : ISerializable
|
||||||
|
|
||||||
public abstract void OnDelete(Mobile mob);
|
public abstract void OnDelete(Mobile mob);
|
||||||
|
|
||||||
public static BaseGuild FindByName(string name)
|
public static BaseGuild FindByName(ReadOnlySpan<char> name)
|
||||||
{
|
{
|
||||||
foreach (var g in World.Guilds.Values)
|
foreach (var g in World.Guilds.Values)
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +75,7 @@ public abstract class BaseGuild : ISerializable
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BaseGuild FindByAbbrev(string abbr)
|
public static BaseGuild FindByAbbrev(ReadOnlySpan<char> abbr)
|
||||||
{
|
{
|
||||||
foreach (var g in World.Guilds.Values)
|
foreach (var g in World.Guilds.Values)
|
||||||
{
|
{
|
||||||
|
|
@ -88,19 +88,29 @@ public abstract class BaseGuild : ISerializable
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashSet<BaseGuild> Search(string find)
|
public static HashSet<BaseGuild> Search(ReadOnlySpan<char> find)
|
||||||
{
|
{
|
||||||
var words = find.ToLower().Split(' ');
|
|
||||||
var results = new HashSet<BaseGuild>();
|
var results = new HashSet<BaseGuild>();
|
||||||
|
find = find.Trim();
|
||||||
|
if (find.IsEmpty)
|
||||||
|
{
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var g in World.Guilds.Values)
|
foreach (var g in World.Guilds.Values)
|
||||||
{
|
{
|
||||||
var name = g.Name;
|
var name = g.Name.AsSpan();
|
||||||
|
|
||||||
var all = true;
|
var all = true;
|
||||||
foreach (var t in words)
|
foreach (var wordRange in find.Split(' '))
|
||||||
{
|
{
|
||||||
if (name.InsensitiveIndexOf(t) == -1)
|
var word = find[wordRange];
|
||||||
|
if (word.IsEmpty)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.InsensitiveContains(word))
|
||||||
{
|
{
|
||||||
all = false;
|
all = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -7809,10 +7809,7 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LaunchBrowser(string url)
|
public void LaunchBrowser(ReadOnlySpan<char> url) => m_NetState?.LaunchBrowser(url);
|
||||||
{
|
|
||||||
m_NetState?.LaunchBrowser(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InitStats(int str, int dex, int intel)
|
public void InitStats(int str, int dex, int intel)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ public partial class NetState : IComparable<NetState>, IValueLinkListNode<NetSta
|
||||||
HuePickers?.Clear();
|
HuePickers?.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LaunchBrowser(string url)
|
public void LaunchBrowser(ReadOnlySpan<char> url)
|
||||||
{
|
{
|
||||||
this.SendMessageLocalized(Serial.MinusOne, -1, MessageType.Label, 0x35, 3, 501231);
|
this.SendMessageLocalized(Serial.MinusOne, -1, MessageType.Label, 0x35, 3, 501231);
|
||||||
this.SendLaunchBrowser(url);
|
this.SendLaunchBrowser(url);
|
||||||
|
|
|
||||||
|
|
@ -175,15 +175,13 @@ public static class OutgoingPlayerPackets
|
||||||
ns.Send(writer.Span);
|
ns.Send(writer.Span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendLaunchBrowser(this NetState ns, string uri)
|
public static void SendLaunchBrowser(this NetState ns, ReadOnlySpan<char> uri)
|
||||||
{
|
{
|
||||||
if (ns.CannotSendPackets())
|
if (ns.CannotSendPackets())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uri ??= "";
|
|
||||||
|
|
||||||
var length = 4 + uri.Length;
|
var length = 4 + uri.Length;
|
||||||
var writer = new SpanWriter(stackalloc byte[length]);
|
var writer = new SpanWriter(stackalloc byte[length]);
|
||||||
writer.Write((byte)0xA5); // Packet ID
|
writer.Write((byte)0xA5); // Packet ID
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class DeclareFealtyGump : GuildMobileListGump
|
public class DeclareFealtyGump : GuildMobileListGump
|
||||||
{
|
{
|
||||||
public DeclareFealtyGump(Mobile from, Guild guild) : base(from, guild, true, guild.Members)
|
private DeclareFealtyGump(Guild guild) : base(guild, true, guild.Members)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1011097); // Declare your fealty
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 250, 35, 1011098); // I have selected my new lord.
|
from.SendGump(new DeclareFealtyGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 0);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011097); // Declare your fealty
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 250, 35, 1011098); // I have selected my new lord.
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 0);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (info.ButtonID == 0 || GuildGump.BadMember(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -35,9 +47,9 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var m = m_List[index];
|
var m = _list[index];
|
||||||
|
|
||||||
if (m?.Deleted == false)
|
if (m?.Deleted == false)
|
||||||
{
|
{
|
||||||
|
|
@ -47,8 +59,7 @@ namespace Server.Gumps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GrantGuildTitleGump : GuildMobileListGump
|
public class GrantGuildTitleGump : GuildMobileListGump
|
||||||
{
|
{
|
||||||
public GrantGuildTitleGump(Mobile from, Guild guild) : base(from, guild, true, guild.Members)
|
private GrantGuildTitleGump(Guild guild) : base(guild, true, guild.Members)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1011118); // Grant a title to another member.
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 245, 30, 1011127); // I dub thee...
|
from.SendGump(new GrantGuildTitleGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 2);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011118); // Grant a title to another member.
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1011127); // I dub thee...
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (info.ButtonID == 0 || GuildGump.BadMember(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -35,22 +47,21 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var m = m_List[index];
|
var m = _list[index];
|
||||||
|
|
||||||
if (m?.Deleted == false)
|
if (m?.Deleted == false)
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1013074); // New title (20 characters max):
|
from.SendLocalizedMessage(1013074); // New title (20 characters max):
|
||||||
m_Mobile.Prompt = new GuildTitlePrompt(m_Mobile, m, m_Guild);
|
from.Prompt = new GuildTitlePrompt(m, _guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info.ButtonID == 2)
|
else if (info.ButtonID == 2)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
using Server.Prompts;
|
using Server.Prompts;
|
||||||
|
|
||||||
|
|
@ -5,55 +6,49 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildAbbrvPrompt : Prompt
|
public class GuildAbbrvPrompt : Prompt
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildAbbrvPrompt(Mobile m, Guild g)
|
public GuildAbbrvPrompt(Guild g) => _guild = g;
|
||||||
{
|
|
||||||
m_Mobile = m;
|
|
||||||
m_Guild = g;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnCancel(Mobile from)
|
public override void OnCancel(Mobile from)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = text.Trim();
|
var textSpan = text.AsSpan().Trim();
|
||||||
|
|
||||||
if (text.Length > 3)
|
if (textSpan.Length > 3)
|
||||||
{
|
{
|
||||||
text = text[..3];
|
textSpan = textSpan[..3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.Length > 0)
|
if (textSpan.Length > 0)
|
||||||
{
|
{
|
||||||
if (BaseGuild.FindByAbbrev(text) != null)
|
if (BaseGuild.FindByAbbrev(textSpan) != null)
|
||||||
{
|
{
|
||||||
m_Mobile.SendMessage($"{text} conflicts with the abbreviation of an existing guild.");
|
from.SendMessage($"{textSpan} conflicts with the abbreviation of an existing guild.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Guild.Abbreviation = text;
|
text = textSpan.ToString();
|
||||||
m_Guild.GuildMessage(1018025, true, text); // Your guild abbreviation has changed:
|
_guild.Abbreviation = text;
|
||||||
|
_guild.GuildMessage(1018025, true, text); // Your guild abbreviation has changed:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildAcceptWarGump : GuildListGump
|
public class GuildAcceptWarGump : GuildListGump
|
||||||
{
|
{
|
||||||
public GuildAcceptWarGump(Mobile from, Guild guild) : base(from, guild, true, guild.WarInvitations)
|
private GuildAcceptWarGump(Guild guild) : base(guild, true, guild.WarInvitations)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1011147); // Select the guild to accept the invitations:
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 245, 30, 1011100); // Accept war invitations.
|
from.SendGump(new GuildAcceptWarGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 2);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011147); // Select the guild to accept the invitations:
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1011100); // Accept war invitations.
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -35,27 +47,25 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var g = m_List[index];
|
var g = _list[index];
|
||||||
|
|
||||||
if (g != null)
|
if (g != null)
|
||||||
{
|
{
|
||||||
m_Guild.WarInvitations.Remove(g);
|
_guild.WarInvitations.Remove(g);
|
||||||
g.WarDeclarations.Remove(m_Guild);
|
g.WarDeclarations.Remove(_guild);
|
||||||
|
|
||||||
m_Guild.AddEnemy(g);
|
_guild.AddEnemy(g);
|
||||||
m_Guild.GuildMessage(1018020, true, $"{g.Name} ({g.Abbreviation})");
|
_guild.GuildMessage(1018020, true, $"{g.Name} ({g.Abbreviation})");
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
if (_guild.WarInvitations.Count > 0)
|
||||||
|
|
||||||
if (m_Guild.WarInvitations.Count > 0)
|
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildAcceptWarGump(m_Mobile, m_Guild));
|
DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,8 +73,7 @@ namespace Server.Gumps
|
||||||
}
|
}
|
||||||
else if (info.ButtonID == 2)
|
else if (info.ButtonID == 2)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,24 +6,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildAdminCandidatesGump : GuildMobileListGump
|
public class GuildAdminCandidatesGump : GuildMobileListGump
|
||||||
{
|
{
|
||||||
public GuildAdminCandidatesGump(Mobile from, Guild guild) : base(from, guild, true, guild.Candidates)
|
private GuildAdminCandidatesGump(Guild guild) : base(guild, true, guild.Candidates)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1013075); // Accept or Refuse candidates for membership
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 245, 30, 1013076); // Accept
|
from.SendGump(new GuildAdminCandidatesGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 2);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1013077); // Refuse
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1013075); // Accept or Refuse candidates for membership
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1013076); // Accept
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1013077); // Refuse
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -32,9 +44,7 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: // Accept
|
case 1: // Accept
|
||||||
|
|
@ -45,13 +55,13 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var m = m_List[index];
|
var m = _list[index];
|
||||||
|
|
||||||
if (m?.Deleted == false)
|
if (m?.Deleted == false)
|
||||||
{
|
{
|
||||||
var guildState = PlayerState.Find(m_Guild.Leader);
|
var guildState = PlayerState.Find(_guild.Leader);
|
||||||
var targetState = PlayerState.Find(m);
|
var targetState = PlayerState.Find(m);
|
||||||
|
|
||||||
var guildFaction = guildState?.Faction;
|
var guildFaction = guildState?.Faction;
|
||||||
|
|
@ -61,21 +71,18 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
if (guildFaction == null)
|
if (guildFaction == null)
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(
|
// That player cannot join a non-faction guild.
|
||||||
1013027
|
from.SendLocalizedMessage(1013027);
|
||||||
); // That player cannot join a non-faction guild.
|
|
||||||
}
|
}
|
||||||
else if (targetFaction == null)
|
else if (targetFaction == null)
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(
|
// That player must be in a faction before joining this guild.
|
||||||
1013026
|
from.SendLocalizedMessage(1013026);
|
||||||
); // That player must be in a faction before joining this guild.
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(
|
// That person has a different faction affiliation.
|
||||||
1013028
|
from.SendLocalizedMessage(1013028);
|
||||||
); // That person has a different faction affiliation.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -84,24 +91,22 @@ namespace Server.Gumps
|
||||||
if (targetState?.IsLeaving == true)
|
if (targetState?.IsLeaving == true)
|
||||||
{
|
{
|
||||||
// OSI does this quite strangely, so we'll just do it this way
|
// OSI does this quite strangely, so we'll just do it this way
|
||||||
m_Mobile.SendMessage(
|
from.SendMessage(
|
||||||
"That person is quitting their faction and so you may not recruit them."
|
"That person is quitting their faction and so you may not recruit them."
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Guild.Candidates.Remove(m);
|
_guild.Candidates.Remove(m);
|
||||||
m_Guild.Accepted.Add(m);
|
_guild.Accepted.Add(m);
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
if (_guild.Candidates.Count > 0)
|
||||||
|
|
||||||
if (m_Guild.Candidates.Count > 0)
|
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild));
|
DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,23 +122,21 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var m = m_List[index];
|
var m = _list[index];
|
||||||
|
|
||||||
if (m?.Deleted == false)
|
if (m?.Deleted == false)
|
||||||
{
|
{
|
||||||
m_Guild.Candidates.Remove(m);
|
_guild.Candidates.Remove(m);
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
if (_guild.Candidates.Count > 0)
|
||||||
|
|
||||||
if (m_Guild.Candidates.Count > 0)
|
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild));
|
DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,29 +5,40 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildCandidatesGump : GuildMobileListGump
|
public class GuildCandidatesGump : GuildMobileListGump
|
||||||
{
|
{
|
||||||
public GuildCandidatesGump(Mobile from, Guild guild) : base(from, guild, false, guild.Candidates)
|
private GuildCandidatesGump(Guild guild) : base(guild, false, guild.Candidates)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 500, 35, 1013030); // <center> Candidates </center>
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
from.SendGump(new GuildCandidatesGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 500, 35, 1013030); // <center> Candidates </center>
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadMember(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.ButtonID == 1)
|
if (info.ButtonID == 1)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,45 +5,57 @@ using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildChangeTypeGump : Gump
|
public class GuildChangeTypeGump : StaticGump<GuildChangeTypeGump>
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildChangeTypeGump(Mobile from, Guild guild) : base(20, 30)
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
private GuildChangeTypeGump(Guild guild) : base(20, 30) => _guild = guild;
|
||||||
|
|
||||||
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
m_Mobile = from;
|
if (from?.NetState == null || guild == null)
|
||||||
m_Guild = guild;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Draggable = false;
|
GuildGump.EnsureClosed(from);
|
||||||
|
from.SendGump(new GuildChangeTypeGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddPage(0);
|
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||||
AddBackground(0, 0, 550, 400, 5054);
|
{
|
||||||
AddBackground(10, 10, 530, 380, 3000);
|
builder.SetNoMove();
|
||||||
|
|
||||||
AddHtmlLocalized(20, 15, 510, 30, 1013062); // <center>Change Guild Type Menu</center>
|
builder.AddPage();
|
||||||
|
builder.AddBackground(0, 0, 550, 400, 5054);
|
||||||
|
builder.AddBackground(10, 10, 530, 380, 3000);
|
||||||
|
|
||||||
AddHtmlLocalized(50, 50, 450, 30, 1013066); // Please select the type of guild you would like to change to
|
builder.AddHtmlLocalized(20, 15, 510, 30, 1013062); // <center>Change Guild Type Menu</center>
|
||||||
|
|
||||||
AddButton(20, 100, 4005, 4007, 1);
|
builder.AddHtmlLocalized(50, 50, 450, 30, 1013066); // Please select the type of guild you would like to change to
|
||||||
AddHtmlLocalized(85, 100, 300, 30, 1013063); // Standard guild
|
|
||||||
|
|
||||||
AddButton(20, 150, 4005, 4007, 2);
|
builder.AddButton(20, 100, 4005, 4007, 1);
|
||||||
AddItem(50, 143, 7109);
|
builder.AddHtmlLocalized(85, 100, 300, 30, 1013063); // Standard guild
|
||||||
AddHtmlLocalized(85, 150, 300, 300, 1013064); // Order guild
|
|
||||||
|
|
||||||
AddButton(20, 200, 4005, 4007, 3);
|
builder.AddButton(20, 150, 4005, 4007, 2);
|
||||||
AddItem(45, 200, 7107);
|
builder.AddItem(50, 143, 7109);
|
||||||
AddHtmlLocalized(85, 200, 300, 300, 1013065); // Chaos guild
|
builder.AddHtmlLocalized(85, 150, 300, 300, 1013064); // Order guild
|
||||||
|
|
||||||
AddButton(300, 360, 4005, 4007, 4);
|
builder.AddButton(20, 200, 4005, 4007, 3);
|
||||||
AddHtmlLocalized(335, 360, 150, 30, 1011012); // CANCEL
|
builder.AddItem(45, 200, 7107);
|
||||||
|
builder.AddHtmlLocalized(85, 200, 300, 300, 1013065); // Chaos guild
|
||||||
|
|
||||||
|
builder.AddButton(300, 360, 4005, 4007, 4);
|
||||||
|
builder.AddHtmlLocalized(335, 360, 150, 30, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (Guild.NewGuildSystem && !BaseGuildGump.IsLeader(m_Mobile, m_Guild) ||
|
var from = state.Mobile;
|
||||||
!Guild.NewGuildSystem && GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (Guild.NewGuildSystem && !BaseGuildGump.IsLeader(from, _guild) ||
|
||||||
|
!Guild.NewGuildSystem && GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -53,41 +65,40 @@ namespace Server.Gumps
|
||||||
1 => GuildType.Regular,
|
1 => GuildType.Regular,
|
||||||
2 => GuildType.Order,
|
2 => GuildType.Order,
|
||||||
3 => GuildType.Chaos,
|
3 => GuildType.Chaos,
|
||||||
_ => m_Guild.Type
|
_ => _guild.Type
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m_Guild.Type != newType)
|
if (_guild.Type != newType)
|
||||||
{
|
{
|
||||||
var pl = PlayerState.Find(m_Mobile);
|
var pl = PlayerState.Find(from);
|
||||||
|
|
||||||
if (pl != null)
|
if (pl != null)
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1010405); // You cannot change guild types while in a Faction!
|
from.SendLocalizedMessage(1010405); // You cannot change guild types while in a Faction!
|
||||||
}
|
}
|
||||||
else if (m_Guild.TypeLastChange.AddDays(7) > Core.Now)
|
else if (_guild.TypeLastChange.AddDays(7) > Core.Now)
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1011142); // You have already changed your guild type recently.
|
from.SendLocalizedMessage(1011142); // You have already changed your guild type recently.
|
||||||
// TODO: Clilocs 1011142-1011145 suggest a timer for pending changes
|
// TODO: Clilocs 1011142-1011145 suggest a timer for pending changes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Guild.Type = newType;
|
_guild.Type = newType;
|
||||||
m_Guild.GuildMessage(1018022, true, newType.ToString()); // Guild Message: Your guild type has changed:
|
_guild.GuildMessage(1018022, true, newType.ToString()); // Guild Message: Your guild type has changed:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Guild.NewGuildSystem)
|
if (Guild.NewGuildSystem)
|
||||||
{
|
{
|
||||||
if (m_Mobile is PlayerMobile mobile)
|
if (from is PlayerMobile mobile)
|
||||||
{
|
{
|
||||||
mobile.SendGump(new GuildInfoGump(mobile, m_Guild));
|
mobile.SendGump(new GuildInfoGump(mobile, _guild));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,85 +1,83 @@
|
||||||
|
using System;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildCharterGump : Gump
|
public class GuildCharterGump : DynamicGump
|
||||||
{
|
{
|
||||||
private const string DefaultWebsite = "https://www.modernuo.com";
|
private const string DefaultWebsite = "https://www.modernuo.com";
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildCharterGump(Mobile from, Guild guild) : base(20, 30)
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
private GuildCharterGump(Guild guild) : base(20, 30) => _guild = guild;
|
||||||
|
|
||||||
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
m_Mobile = from;
|
if (from?.NetState == null || guild == null)
|
||||||
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, in RelayInfo info)
|
|
||||||
{
|
|
||||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (info.ButtonID)
|
GuildGump.EnsureClosed(from);
|
||||||
|
from.SendGump(new GuildCharterGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||||
|
{
|
||||||
|
builder.SetNoMove();
|
||||||
|
|
||||||
|
builder.AddPage();
|
||||||
|
builder.AddBackground(0, 0, 550, 400, 5054);
|
||||||
|
builder.AddBackground(10, 10, 530, 380, 3000);
|
||||||
|
|
||||||
|
builder.AddButton(20, 360, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 360, 300, 35, 1011120); // Return to the main menu.
|
||||||
|
|
||||||
|
string charter;
|
||||||
|
|
||||||
|
if ((charter = _guild.Charter) == null || (charter = charter.Trim()).Length <= 0)
|
||||||
{
|
{
|
||||||
case 0:
|
builder.AddHtmlLocalized(20, 20, 400, 35, 1013032); // No charter has been defined.
|
||||||
{
|
}
|
||||||
return; // Close
|
else
|
||||||
}
|
{
|
||||||
case 1:
|
builder.AddHtml(20, 20, 510, 75, charter, background: true, scrollbar: true);
|
||||||
{
|
|
||||||
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);
|
builder.AddButton(20, 200, 4005, 4007, 2);
|
||||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
builder.AddHtmlLocalized(55, 200, 300, 20, 1011122); // Visit the guild website :
|
||||||
|
|
||||||
|
var website = _guild.Website != null ? _guild.Website.AsSpan().Trim() : "";
|
||||||
|
if (website.Length <= 0)
|
||||||
|
{
|
||||||
|
website = DefaultWebsite;
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.AddHtml(55, 220, 300, 20, website);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
|
{
|
||||||
|
var from = state.Mobile;
|
||||||
|
if (info.ButtonID == 0 || GuildGump.BadMember(from, _guild))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.ButtonID == 2)
|
||||||
|
{
|
||||||
|
var website = _guild.Website != null ? _guild.Website.AsSpan().Trim() : "";
|
||||||
|
if (website.Length <= 0)
|
||||||
|
{
|
||||||
|
website = DefaultWebsite;
|
||||||
|
}
|
||||||
|
|
||||||
|
from.LaunchBrowser(website);
|
||||||
|
}
|
||||||
|
|
||||||
|
GuildGump.DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
using Server.Prompts;
|
using Server.Prompts;
|
||||||
|
|
||||||
|
|
@ -5,50 +6,43 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildCharterPrompt : Prompt
|
public class GuildCharterPrompt : Prompt
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildCharterPrompt(Mobile m, Guild g)
|
public GuildCharterPrompt(Guild g) => _guild = g;
|
||||||
{
|
|
||||||
m_Mobile = m;
|
|
||||||
m_Guild = g;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnCancel(Mobile from)
|
public override void OnCancel(Mobile from)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = text.Trim();
|
var textSpan = text.AsSpan().Trim();
|
||||||
|
|
||||||
if (text.Length > 50)
|
if (textSpan.Length > 50)
|
||||||
{
|
{
|
||||||
text = text[..50];
|
textSpan = textSpan[..50];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.Length > 0)
|
if (textSpan.Length > 0)
|
||||||
{
|
{
|
||||||
m_Guild.Charter = text;
|
_guild.Charter = textSpan.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Mobile.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
|
from.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
|
||||||
m_Mobile.Prompt = new GuildWebsitePrompt(m_Mobile, m_Guild);
|
from.Prompt = new GuildWebsitePrompt(from, _guild);
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildDeclarePeaceGump : GuildListGump
|
public class GuildDeclarePeaceGump : GuildListGump
|
||||||
{
|
{
|
||||||
public GuildDeclarePeaceGump(Mobile from, Guild guild) : base(from, guild, true, guild.Enemies)
|
private GuildDeclarePeaceGump(Guild guild) : base(guild, true, guild.Enemies)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1011137); // Select the guild you wish to declare peace with.
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 245, 30, 1011138); // Send the olive branch.
|
from.SendGump(new GuildDeclarePeaceGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 2);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011137); // Select the guild you wish to declare peace with.
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1011138); // Send the olive branch.
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -35,25 +47,23 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var g = m_List[index];
|
var g = _list[index];
|
||||||
|
|
||||||
if (g != null)
|
if (g != null)
|
||||||
{
|
{
|
||||||
m_Guild.RemoveEnemy(g);
|
_guild.RemoveEnemy(g);
|
||||||
// Guild Message: You are now at peace with this guild:
|
// Guild Message: You are now at peace with this guild:
|
||||||
m_Guild.GuildMessage(1018018, true, $"{g.Name} ({g.Abbreviation})");
|
_guild.GuildMessage(1018018, true, $"{g.Name} ({g.Abbreviation})");
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
if (_guild.Enemies.Count > 0)
|
||||||
|
|
||||||
if (m_Guild.Enemies.Count > 0)
|
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildDeclarePeaceGump(m_Mobile, m_Guild));
|
DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -61,8 +71,7 @@ namespace Server.Gumps
|
||||||
}
|
}
|
||||||
else if (info.ButtonID == 2)
|
else if (info.ButtonID == 2)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,25 +7,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildDeclareWarGump : GuildListGump
|
public class GuildDeclareWarGump : GuildListGump
|
||||||
{
|
{
|
||||||
public GuildDeclareWarGump(Mobile from, Guild guild, List<Guild> list)
|
private GuildDeclareWarGump(Guild guild, List<Guild> list) : base(guild, true, list)
|
||||||
: base(from, guild, true, list)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild, List<Guild> list)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1011065); // Select the guild you wish to declare war on.
|
if (from?.NetState == null || guild == null || list == null || list.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 245, 30, 1011068); // Send the challenge!
|
from.SendGump(new GuildDeclareWarGump(guild, list));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 2);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011065); // Select the guild you wish to declare war on.
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1011068); // Send the challenge!
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -38,52 +49,50 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var g = m_List[index];
|
var g = _list[index];
|
||||||
|
|
||||||
if (g != null)
|
if (g != null)
|
||||||
{
|
{
|
||||||
if (g == m_Guild)
|
if (g == _guild)
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(501184); // You cannot declare war against yourself!
|
from.SendLocalizedMessage(501184); // You cannot declare war against yourself!
|
||||||
}
|
}
|
||||||
else if (g.WarInvitations.Contains(m_Guild) && m_Guild.WarDeclarations.Contains(g) ||
|
else if (g.WarInvitations.Contains(_guild) && _guild.WarDeclarations.Contains(g) ||
|
||||||
m_Guild.IsWar(g))
|
_guild.IsWar(g))
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(501183); // You are already at war with that guild.
|
from.SendLocalizedMessage(501183); // You are already at war with that guild.
|
||||||
}
|
}
|
||||||
else if (Faction.Find(m_Guild.Leader) != null)
|
else if (Faction.Find(_guild.Leader) != null)
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1005288); // You cannot declare war while you are in a faction
|
from.SendLocalizedMessage(1005288); // You cannot declare war while you are in a faction
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!m_Guild.WarDeclarations.Contains(g))
|
if (!_guild.WarDeclarations.Contains(g))
|
||||||
{
|
{
|
||||||
m_Guild.WarDeclarations.Add(g);
|
_guild.WarDeclarations.Add(g);
|
||||||
// Guild Message: Your guild has sent an invitation for war:
|
// Guild Message: Your guild has sent an invitation for war:
|
||||||
m_Guild.GuildMessage(1018019, true, $"{g.Name} ({g.Abbreviation})");
|
_guild.GuildMessage(1018019, true, $"{g.Name} ({g.Abbreviation})");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g.WarInvitations.Contains(m_Guild))
|
if (!g.WarInvitations.Contains(_guild))
|
||||||
{
|
{
|
||||||
g.WarInvitations.Add(m_Guild);
|
g.WarInvitations.Add(_guild);
|
||||||
// Guild Message: Your guild has received an invitation to war:
|
// Guild Message: Your guild has received an invitation to war:
|
||||||
g.GuildMessage(1018021, true, $"{m_Guild.Name} ({m_Guild.Abbreviation})");
|
g.GuildMessage(1018021, true, $"{_guild.Name} ({_guild.Abbreviation})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildWarAdminGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info.ButtonID == 2)
|
else if (info.ButtonID == 2)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,54 +5,46 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildDeclareWarPrompt : Prompt
|
public class GuildDeclareWarPrompt : Prompt
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildDeclareWarPrompt(Mobile m, Guild g)
|
public GuildDeclareWarPrompt(Guild g) => _guild = g;
|
||||||
{
|
|
||||||
m_Mobile = m;
|
|
||||||
m_Guild = g;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnCancel(Mobile from)
|
public override void OnCancel(Mobile from)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildWarAdminGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = text.Trim();
|
var textSpan = text.Trim();
|
||||||
|
|
||||||
if (text.Length >= 3)
|
if (textSpan.Length >= 3)
|
||||||
{
|
{
|
||||||
var guilds = BaseGuild.Search(text).SafeConvertList<BaseGuild, Guild>();
|
var guilds = BaseGuild.Search(textSpan).SafeConvertList<BaseGuild, Guild>();
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
|
||||||
|
|
||||||
if (guilds.Count > 0)
|
if (guilds.Count > 0)
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildDeclareWarGump(m_Mobile, m_Guild, guilds));
|
GuildDeclareWarGump.DisplayTo(from, _guild, guilds);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
GuildWarAdminGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendLocalizedMessage(1018003); // No guilds found matching - try another name in the search
|
from.SendLocalizedMessage(1018003); // No guilds found matching - try another name in the search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendMessage("Search string must be at least three letters in length.");
|
from.SendMessage("Search string must be at least three letters in length.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildDismissGump : GuildMobileListGump
|
public class GuildDismissGump : GuildMobileListGump
|
||||||
{
|
{
|
||||||
public GuildDismissGump(Mobile from, Guild guild) : base(from, guild, true, guild.Members)
|
private GuildDismissGump(Guild guild) : base(guild, true, guild.Members)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1011124); // Whom do you wish to dismiss?
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 245, 30, 1011125); // Kick them out!
|
from.SendGump(new GuildDismissGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 2);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011124); // Whom do you wish to dismiss?
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1011125); // Kick them out!
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -35,27 +47,25 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var m = m_List[index];
|
var m = _list[index];
|
||||||
|
|
||||||
if (m?.Deleted == false)
|
if (m?.Deleted == false)
|
||||||
{
|
{
|
||||||
m_Guild.RemoveMember(m);
|
_guild.RemoveMember(m);
|
||||||
|
|
||||||
if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Mobile == m_Guild.Leader)
|
if (from.AccessLevel >= AccessLevel.GameMaster || from == _guild.Leader)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info.ButtonID == 2 && (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Mobile == m_Guild.Leader))
|
else if (info.ButtonID == 2 && (from.AccessLevel >= AccessLevel.GameMaster || from == _guild.Leader))
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,103 +1,120 @@
|
||||||
|
using System;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildGump : Gump
|
public class GuildGump : DynamicGump
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
private readonly Mobile _mobile;
|
||||||
|
|
||||||
public GuildGump(Mobile beholder, Guild guild) : base(20, 30)
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
private GuildGump(Mobile beholder, Guild guild) : base(20, 30)
|
||||||
{
|
{
|
||||||
m_Mobile = beholder;
|
_mobile = beholder;
|
||||||
m_Guild = guild;
|
_guild = guild;
|
||||||
|
}
|
||||||
|
|
||||||
Draggable = false;
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
|
{
|
||||||
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddPage(0);
|
EnsureClosed(from);
|
||||||
AddBackground(0, 0, 550, 400, 5054);
|
from.SendGump(new GuildGump(from, guild));
|
||||||
AddBackground(10, 10, 530, 380, 3000);
|
}
|
||||||
|
|
||||||
AddHtml(20, 15, 200, 35, guild.Name);
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||||
|
{
|
||||||
|
builder.SetNoMove();
|
||||||
|
|
||||||
var leader = guild.Leader;
|
builder.AddPage();
|
||||||
|
builder.AddBackground(0, 0, 550, 400, 5054);
|
||||||
|
builder.AddBackground(10, 10, 530, 380, 3000);
|
||||||
|
|
||||||
|
builder.AddHtml(20, 15, 200, 35, _guild.Name);
|
||||||
|
|
||||||
|
var leader = _guild.Leader;
|
||||||
|
|
||||||
if (leader != null)
|
if (leader != null)
|
||||||
{
|
{
|
||||||
var leadTitle = leader.GuildTitle?.Trim();
|
var leadTitle = leader.GuildTitle != null ? leader.GuildTitle.AsSpan().Trim() : ReadOnlySpan<char>.Empty;
|
||||||
var leadName = (leader.Name?.Trim()).DefaultIfNullOrEmpty("(empty)");
|
var leadName = leader.Name;
|
||||||
var text = leadTitle?.Length > 0 ? $"{leadTitle}: {leadName}" : leadName;
|
var leadNameSpan = leadName != null ? leadName.AsSpan().Trim() : ReadOnlySpan<char>.Empty;
|
||||||
|
var text = leadTitle.Length > 0 ? $"{leadTitle}: {leadNameSpan}" : leadNameSpan;
|
||||||
|
|
||||||
AddHtml(220, 15, 250, 35, text);
|
builder.AddHtml(220, 15, 250, 35, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddButton(20, 50, 4005, 4007, 1);
|
builder.AddButton(20, 50, 4005, 4007, 1);
|
||||||
AddHtmlLocalized(55, 50, 100, 20, 1013022); // Loyal to
|
builder.AddHtmlLocalized(55, 50, 100, 20, 1013022); // Loyal to
|
||||||
|
|
||||||
var fealty = beholder.GuildFealty;
|
var fealty = _mobile.GuildFealty;
|
||||||
|
|
||||||
if (fealty == null || !guild.IsMember(fealty))
|
if (fealty == null || !_guild.IsMember(fealty))
|
||||||
{
|
{
|
||||||
fealty = leader;
|
fealty = leader;
|
||||||
}
|
}
|
||||||
|
|
||||||
fealty ??= beholder;
|
fealty ??= _mobile;
|
||||||
|
|
||||||
var fealtyName = (fealty.Name?.Trim()).DefaultIfNullOrEmpty("(empty)");
|
if (_mobile == fealty)
|
||||||
|
|
||||||
if (beholder == fealty)
|
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(55, 70, 470, 20, 1018002); // yourself
|
builder.AddHtmlLocalized(55, 70, 470, 20, 1018002); // yourself
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddHtml(55, 70, 470, 20, fealtyName);
|
var fealtyName = fealty.Name;
|
||||||
|
builder.AddHtml(55, 70, 470, 20, fealtyName != null ? fealtyName.AsSpan().Trim() : "(empty)");
|
||||||
}
|
}
|
||||||
|
|
||||||
AddButton(215, 50, 4005, 4007, 2);
|
builder.AddButton(215, 50, 4005, 4007, 2);
|
||||||
AddHtmlLocalized(250, 50, 170, 20, 1013023); // Display guild abbreviation
|
builder.AddHtmlLocalized(250, 50, 170, 20, 1013023); // Display guild abbreviation
|
||||||
AddHtmlLocalized(250, 70, 50, 20, beholder.DisplayGuildTitle ? 1011262 : 1011263); // on/off
|
builder.AddHtmlLocalized(250, 70, 50, 20, _mobile.DisplayGuildTitle ? 1011262 : 1011263); // on/off
|
||||||
|
|
||||||
AddButton(20, 100, 4005, 4007, 3);
|
builder.AddButton(20, 100, 4005, 4007, 3);
|
||||||
AddHtmlLocalized(55, 100, 470, 30, 1011086); // View the current roster.
|
builder.AddHtmlLocalized(55, 100, 470, 30, 1011086); // View the current roster.
|
||||||
|
|
||||||
AddButton(20, 130, 4005, 4007, 4);
|
builder.AddButton(20, 130, 4005, 4007, 4);
|
||||||
AddHtmlLocalized(55, 130, 470, 30, 1011085); // Recruit someone into the guild.
|
builder.AddHtmlLocalized(55, 130, 470, 30, 1011085); // Recruit someone into the guild.
|
||||||
|
|
||||||
if (guild.Candidates.Count > 0)
|
if (_guild.Candidates.Count > 0)
|
||||||
{
|
{
|
||||||
AddButton(20, 160, 4005, 4007, 5);
|
builder.AddButton(20, 160, 4005, 4007, 5);
|
||||||
AddHtmlLocalized(55, 160, 470, 30, 1011093); // View list of candidates who have been sponsored to the guild.
|
builder.AddHtmlLocalized(55, 160, 470, 30, 1011093); // View list of candidates who have been sponsored to the guild.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddImage(20, 160, 4020);
|
builder.AddImage(20, 160, 4020);
|
||||||
AddHtmlLocalized(55, 160, 470, 30, 1013031); // There are currently no candidates for membership.
|
builder.AddHtmlLocalized(55, 160, 470, 30, 1013031); // There are currently no candidates for membership.
|
||||||
}
|
}
|
||||||
|
|
||||||
AddButton(20, 220, 4005, 4007, 6);
|
builder.AddButton(20, 220, 4005, 4007, 6);
|
||||||
AddHtmlLocalized(55, 220, 470, 30, 1011087); // View the guild's charter.
|
builder.AddHtmlLocalized(55, 220, 470, 30, 1011087); // View the guild's charter.
|
||||||
|
|
||||||
AddButton(20, 250, 4005, 4007, 7);
|
builder.AddButton(20, 250, 4005, 4007, 7);
|
||||||
AddHtmlLocalized(55, 250, 470, 30, 1011092); // Resign from the guild.
|
builder.AddHtmlLocalized(55, 250, 470, 30, 1011092); // Resign from the guild.
|
||||||
|
|
||||||
AddButton(20, 280, 4005, 4007, 8);
|
builder.AddButton(20, 280, 4005, 4007, 8);
|
||||||
AddHtmlLocalized(55, 280, 470, 30, 1011095); // View list of guilds you are at war with.
|
builder.AddHtmlLocalized(55, 280, 470, 30, 1011095); // View list of guilds you are at war with.
|
||||||
|
|
||||||
if (beholder.AccessLevel >= AccessLevel.GameMaster || beholder == leader)
|
if (_mobile.AccessLevel >= AccessLevel.GameMaster || _mobile == leader)
|
||||||
{
|
{
|
||||||
AddButton(20, 310, 4005, 4007, 9);
|
builder.AddButton(20, 310, 4005, 4007, 9);
|
||||||
AddHtmlLocalized(55, 310, 470, 30, 1011094); // Access guildmaster functions.
|
builder.AddHtmlLocalized(55, 310, 470, 30, 1011094); // Access guildmaster functions.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddImage(20, 310, 4020);
|
builder.AddImage(20, 310, 4020);
|
||||||
AddHtmlLocalized(55, 310, 470, 30, 1018013); // Reserved for guildmaster
|
builder.AddHtmlLocalized(55, 310, 470, 30, 1018013); // Reserved for guildmaster
|
||||||
}
|
}
|
||||||
|
|
||||||
AddButton(20, 360, 4005, 4007, 0);
|
builder.AddButton(20, 360, 4005, 4007, 0);
|
||||||
AddHtmlLocalized(55, 360, 470, 30, 1011441); // EXIT
|
builder.AddHtmlLocalized(55, 360, 470, 30, 1011441); // EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnsureClosed(Mobile m)
|
public static void EnsureClosed(Mobile m)
|
||||||
|
|
@ -143,7 +160,7 @@ namespace Server.Gumps
|
||||||
|
|
||||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (BadMember(m_Mobile, m_Guild))
|
if (BadMember(_mobile, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -152,66 +169,50 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
case 1: // Loyalty
|
case 1: // Loyalty
|
||||||
{
|
{
|
||||||
EnsureClosed(m_Mobile);
|
DeclareFealtyGump.DisplayTo(_mobile, _guild);
|
||||||
m_Mobile.SendGump(new DeclareFealtyGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: // Toggle display abbreviation
|
case 2: // Toggle display abbreviation
|
||||||
{
|
{
|
||||||
m_Mobile.DisplayGuildTitle = !m_Mobile.DisplayGuildTitle;
|
_mobile.DisplayGuildTitle = !_mobile.DisplayGuildTitle;
|
||||||
|
DisplayTo(_mobile, _guild);
|
||||||
EnsureClosed(m_Mobile);
|
|
||||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: // View the current roster
|
case 3: // View the current roster
|
||||||
{
|
{
|
||||||
EnsureClosed(m_Mobile);
|
GuildRosterGump.DisplayTo(_mobile, _guild);
|
||||||
m_Mobile.SendGump(new GuildRosterGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: // Recruit
|
case 4: // Recruit
|
||||||
{
|
{
|
||||||
m_Mobile.Target = new GuildRecruitTarget(m_Mobile, m_Guild);
|
_mobile.Target = new GuildRecruitTarget(_mobile, _guild);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5: // Membership candidates
|
case 5: // Membership candidates
|
||||||
{
|
{
|
||||||
EnsureClosed(m_Mobile);
|
GuildCandidatesGump.DisplayTo(_mobile, _guild);
|
||||||
m_Mobile.SendGump(new GuildCandidatesGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: // View charter
|
case 6: // View charter
|
||||||
{
|
{
|
||||||
EnsureClosed(m_Mobile);
|
GuildCharterGump.DisplayTo(_mobile, _guild);
|
||||||
m_Mobile.SendGump(new GuildCharterGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: // Resign
|
case 7: // Resign
|
||||||
{
|
{
|
||||||
m_Guild.RemoveMember(m_Mobile);
|
_guild.RemoveMember(_mobile);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: // View wars
|
case 8: // View wars
|
||||||
{
|
{
|
||||||
EnsureClosed(m_Mobile);
|
GuildWarGump.DisplayTo(_mobile, _guild);
|
||||||
m_Mobile.SendGump(new GuildWarGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: // Guildmaster functions
|
case 9: // Guildmaster functions
|
||||||
{
|
{
|
||||||
if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Guild.Leader == m_Mobile)
|
if (_mobile.AccessLevel >= AccessLevel.GameMaster || _guild.Leader == _mobile)
|
||||||
{
|
{
|
||||||
EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(_mobile, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,62 +1,65 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public abstract class GuildListGump : Gump
|
public abstract class GuildListGump : DynamicGump
|
||||||
{
|
{
|
||||||
protected Guild m_Guild;
|
protected Guild _guild;
|
||||||
protected List<Guild> m_List;
|
protected List<Guild> _list;
|
||||||
protected Mobile m_Mobile;
|
private readonly bool _radio;
|
||||||
|
|
||||||
public GuildListGump(Mobile from, Guild guild, bool radio, List<Guild> list) : base(20, 30)
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
protected GuildListGump(Guild guild, bool radio, List<Guild> list) : base(20, 30)
|
||||||
{
|
{
|
||||||
m_Mobile = from;
|
_guild = guild;
|
||||||
m_Guild = guild;
|
_radio = radio;
|
||||||
|
_list = list;
|
||||||
|
}
|
||||||
|
|
||||||
Draggable = false;
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||||
|
{
|
||||||
|
builder.SetNoMove();
|
||||||
|
|
||||||
AddPage(0);
|
builder.AddPage();
|
||||||
AddBackground(0, 0, 550, 440, 5054);
|
builder.AddBackground(0, 0, 550, 440, 5054);
|
||||||
AddBackground(10, 10, 530, 420, 3000);
|
builder.AddBackground(10, 10, 530, 420, 3000);
|
||||||
|
|
||||||
Design();
|
BuildHeader(ref builder);
|
||||||
|
|
||||||
m_List = list;
|
for (var i = 0; i < _list.Count; ++i)
|
||||||
|
|
||||||
for (var i = 0; i < m_List.Count; ++i)
|
|
||||||
{
|
{
|
||||||
if (i % 11 == 0)
|
if (i % 11 == 0)
|
||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
builder.AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
||||||
AddHtmlLocalized(335, 370, 300, 35, 1011066); // Next page
|
builder.AddHtmlLocalized(335, 370, 300, 35, 1011066); // Next page
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPage(i / 11 + 1);
|
builder.AddPage(i / 11 + 1);
|
||||||
|
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
builder.AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
||||||
AddHtmlLocalized(55, 370, 300, 35, 1011067); // Previous page
|
builder.AddHtmlLocalized(55, 370, 300, 35, 1011067); // Previous page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radio)
|
if (_radio)
|
||||||
{
|
{
|
||||||
AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
builder.AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
var g = m_List[i];
|
var g = _list[i];
|
||||||
|
|
||||||
var name = g.Name?.Trim().DefaultIfNullOrEmpty("(empty)");
|
var name = g.Name;
|
||||||
AddLabel(radio ? 55 : 20, 35 + i % 11 * 30, 0, name);
|
builder.AddLabel(_radio ? 55 : 20, 35 + i % 11 * 30, 0, name != null ? name.AsSpan().Trim() : "(empty)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Design()
|
protected abstract void BuildHeader(ref DynamicGumpBuilder builder);
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,63 +1,65 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public abstract class GuildMobileListGump : Gump
|
public abstract class GuildMobileListGump : DynamicGump
|
||||||
{
|
{
|
||||||
protected Guild m_Guild;
|
protected Guild _guild;
|
||||||
protected List<Mobile> m_List;
|
protected List<Mobile> _list;
|
||||||
protected Mobile m_Mobile;
|
private readonly bool _radio;
|
||||||
|
|
||||||
public GuildMobileListGump(Mobile from, Guild guild, bool radio, List<Mobile> list)
|
public override bool Singleton => true;
|
||||||
: base(20, 30)
|
|
||||||
|
protected GuildMobileListGump(Guild guild, bool radio, List<Mobile> list) : base(20, 30)
|
||||||
{
|
{
|
||||||
m_Mobile = from;
|
_guild = guild;
|
||||||
m_Guild = guild;
|
_radio = radio;
|
||||||
|
_list = new List<Mobile>(list);
|
||||||
|
}
|
||||||
|
|
||||||
Draggable = false;
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||||
|
{
|
||||||
|
builder.SetNoMove();
|
||||||
|
|
||||||
AddPage(0);
|
builder.AddPage();
|
||||||
AddBackground(0, 0, 550, 440, 5054);
|
builder.AddBackground(0, 0, 550, 440, 5054);
|
||||||
AddBackground(10, 10, 530, 420, 3000);
|
builder.AddBackground(10, 10, 530, 420, 3000);
|
||||||
|
|
||||||
Design();
|
BuildHeader(ref builder);
|
||||||
|
|
||||||
m_List = new List<Mobile>(list);
|
for (var i = 0; i < _list.Count; ++i)
|
||||||
|
|
||||||
for (var i = 0; i < m_List.Count; ++i)
|
|
||||||
{
|
{
|
||||||
if (i % 11 == 0)
|
if (i % 11 == 0)
|
||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
builder.AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
||||||
AddHtmlLocalized(335, 370, 300, 35, 1011066); // Next page
|
builder.AddHtmlLocalized(335, 370, 300, 35, 1011066); // Next page
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPage(i / 11 + 1);
|
builder.AddPage(i / 11 + 1);
|
||||||
|
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
builder.AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
||||||
AddHtmlLocalized(55, 370, 300, 35, 1011067); // Previous page
|
builder.AddHtmlLocalized(55, 370, 300, 35, 1011067); // Previous page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radio)
|
if (_radio)
|
||||||
{
|
{
|
||||||
AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
builder.AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
var m = m_List[i];
|
var m = _list[i];
|
||||||
|
|
||||||
var name = m.Name?.Trim().DefaultIfNullOrEmpty("(empty)");
|
var name = m.Name;
|
||||||
AddLabel(radio ? 55 : 20, 35 + i % 11 * 30, 0, name);
|
builder.AddLabel(_radio ? 55 : 20, 35 + i % 11 * 30, 0, name != null ? name.AsSpan().Trim() : "(empty)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Design()
|
protected abstract void BuildHeader(ref DynamicGumpBuilder builder);
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
using Server.Prompts;
|
using Server.Prompts;
|
||||||
|
|
||||||
|
|
@ -5,55 +6,49 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildNamePrompt : Prompt
|
public class GuildNamePrompt : Prompt
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildNamePrompt(Mobile m, Guild g)
|
public GuildNamePrompt(Mobile m, Guild g) => _guild = g;
|
||||||
{
|
|
||||||
m_Mobile = m;
|
|
||||||
m_Guild = g;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnCancel(Mobile from)
|
public override void OnCancel(Mobile from)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = text.Trim();
|
var textSpan = text.AsSpan().Trim();
|
||||||
|
|
||||||
if (text.Length > 40)
|
if (textSpan.Length > 40)
|
||||||
{
|
{
|
||||||
text = text[..40];
|
textSpan = textSpan[..40];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.Length > 0)
|
if (textSpan.Length > 0)
|
||||||
{
|
{
|
||||||
if (BaseGuild.FindByName(text) != null)
|
if (BaseGuild.FindByName(textSpan) != null)
|
||||||
{
|
{
|
||||||
m_Mobile.SendMessage($"{text} conflicts with the name of an existing guild.");
|
from.SendMessage($"{textSpan} conflicts with the name of an existing guild.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Guild.Name = text;
|
text = textSpan.ToString();
|
||||||
m_Guild.GuildMessage(1018024, true, text); // The name of your guild has changed:
|
_guild.Name = text;
|
||||||
|
_guild.GuildMessage(1018024, true, text); // The name of your guild has changed:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildRejectWarGump : GuildListGump
|
public class GuildRejectWarGump : GuildListGump
|
||||||
{
|
{
|
||||||
public GuildRejectWarGump(Mobile from, Guild guild) : base(from, guild, true, guild.WarInvitations)
|
private GuildRejectWarGump(Guild guild) : base(guild, true, guild.WarInvitations)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1011148); // Select the guild to reject their invitations:
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 245, 30, 1011101); // Reject war invitations.
|
from.SendGump(new GuildRejectWarGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 2);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011148); // Select the guild to reject their invitations:
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1011101); // Reject war invitations.
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -35,24 +47,22 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var g = m_List[index];
|
var g = _list[index];
|
||||||
|
|
||||||
if (g != null)
|
if (g != null)
|
||||||
{
|
{
|
||||||
m_Guild.WarInvitations.Remove(g);
|
_guild.WarInvitations.Remove(g);
|
||||||
g.WarDeclarations.Remove(m_Guild);
|
g.WarDeclarations.Remove(_guild);
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
if (_guild.WarInvitations.Count > 0)
|
||||||
|
|
||||||
if (m_Guild.WarInvitations.Count > 0)
|
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildRejectWarGump(m_Mobile, m_Guild));
|
DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,8 +70,7 @@ namespace Server.Gumps
|
||||||
}
|
}
|
||||||
else if (info.ButtonID == 2)
|
else if (info.ButtonID == 2)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,36 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildRescindDeclarationGump : GuildListGump
|
public class GuildRescindDeclarationGump : GuildListGump
|
||||||
{
|
{
|
||||||
public GuildRescindDeclarationGump(Mobile from, Guild guild) : base(from, guild, true, guild.WarDeclarations)
|
private GuildRescindDeclarationGump(Guild guild) : base(guild, true, guild.WarDeclarations)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 10, 400, 35, 1011150); // Select the guild to rescind our invitations:
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 245, 30, 1011102); // Rescind your war declarations.
|
from.SendGump(new GuildRescindDeclarationGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(300, 400, 4005, 4007, 2);
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
{
|
||||||
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011150); // Select the guild to rescind our invitations:
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1011102); // Rescind your war declarations.
|
||||||
|
|
||||||
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -35,24 +47,22 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var index = switches[0];
|
var index = switches[0];
|
||||||
|
|
||||||
if (index >= 0 && index < m_List.Count)
|
if (index >= 0 && index < _list.Count)
|
||||||
{
|
{
|
||||||
var g = m_List[index];
|
var g = _list[index];
|
||||||
|
|
||||||
if (g != null)
|
if (g != null)
|
||||||
{
|
{
|
||||||
m_Guild.WarDeclarations.Remove(g);
|
_guild.WarDeclarations.Remove(g);
|
||||||
g.WarInvitations.Remove(m_Guild);
|
g.WarInvitations.Remove(_guild);
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
if (_guild.WarDeclarations.Count > 0)
|
||||||
|
|
||||||
if (m_Guild.WarDeclarations.Count > 0)
|
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildRescindDeclarationGump(m_Mobile, m_Guild));
|
DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,8 +70,7 @@ namespace Server.Gumps
|
||||||
}
|
}
|
||||||
else if (info.ButtonID == 2)
|
else if (info.ButtonID == 2)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,29 +5,40 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildRosterGump : GuildMobileListGump
|
public class GuildRosterGump : GuildMobileListGump
|
||||||
{
|
{
|
||||||
public GuildRosterGump(Mobile from, Guild guild) : base(from, guild, false, guild.Members)
|
private GuildRosterGump(Guild guild) : base(guild, false, guild.Members)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Design()
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
AddHtml(20, 10, 500, 35, $"<center>{m_Guild.Name}</center>");
|
if (from?.NetState == null || guild == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
GuildGump.EnsureClosed(from);
|
||||||
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
from.SendGump(new GuildRosterGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||||
|
{
|
||||||
|
builder.AddHtml(20, 10, 500, 35, $"<center>{_guild.Name}</center>");
|
||||||
|
|
||||||
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadMember(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.ButtonID == 1)
|
if (info.ButtonID == 1)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using Server.Guilds;
|
using Server.Guilds;
|
||||||
using Server.Prompts;
|
using Server.Prompts;
|
||||||
|
|
||||||
|
|
@ -6,19 +7,17 @@ namespace Server.Gumps
|
||||||
public class GuildTitlePrompt : Prompt
|
public class GuildTitlePrompt : Prompt
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild m_Guild;
|
||||||
private readonly Mobile m_Leader;
|
|
||||||
private readonly Mobile m_Target;
|
private readonly Mobile m_Target;
|
||||||
|
|
||||||
public GuildTitlePrompt(Mobile leader, Mobile target, Guild g)
|
public GuildTitlePrompt(Mobile target, Guild g)
|
||||||
{
|
{
|
||||||
m_Leader = leader;
|
|
||||||
m_Target = target;
|
m_Target = target;
|
||||||
m_Guild = g;
|
m_Guild = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnCancel(Mobile from)
|
public override void OnCancel(Mobile from)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Leader, m_Guild))
|
if (GuildGump.BadLeader(from, m_Guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -28,13 +27,12 @@ namespace Server.Gumps
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Leader);
|
GuildmasterGump.DisplayTo(from, m_Guild);
|
||||||
m_Leader.SendGump(new GuildmasterGump(m_Leader, m_Guild));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Leader, m_Guild))
|
if (GuildGump.BadLeader(from, m_Guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -44,20 +42,19 @@ namespace Server.Gumps
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = text.Trim();
|
var textSpan = text.AsSpan().Trim();
|
||||||
|
|
||||||
if (text.Length > 20)
|
if (textSpan.Length > 20)
|
||||||
{
|
{
|
||||||
text = text[..20];
|
textSpan = textSpan[..20];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.Length > 0)
|
if (textSpan.Length > 0)
|
||||||
{
|
{
|
||||||
m_Target.GuildTitle = text;
|
m_Target.GuildTitle = textSpan.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Leader);
|
GuildmasterGump.DisplayTo(from, m_Guild);
|
||||||
m_Leader.SendGump(new GuildmasterGump(m_Leader, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,69 +3,79 @@ using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildWarAdminGump : Gump
|
public class GuildWarAdminGump : DynamicGump
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildWarAdminGump(Mobile from, Guild guild) : base(20, 30)
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
private GuildWarAdminGump(Guild guild) : base(20, 30) => _guild = guild;
|
||||||
|
|
||||||
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
m_Mobile = from;
|
if (from?.NetState == null || guild == null)
|
||||||
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.
|
|
||||||
|
|
||||||
var count = 0;
|
|
||||||
|
|
||||||
if (guild.Enemies.Count > 0)
|
|
||||||
{
|
{
|
||||||
AddButton(20, 160 + count * 30, 4005, 4007, 2);
|
return;
|
||||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011103); // Declare peace.
|
}
|
||||||
|
|
||||||
|
GuildGump.EnsureClosed(from);
|
||||||
|
from.SendGump(new GuildWarAdminGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||||
|
{
|
||||||
|
builder.SetNoMove();
|
||||||
|
|
||||||
|
builder.AddPage();
|
||||||
|
builder.AddBackground(0, 0, 550, 440, 5054);
|
||||||
|
builder.AddBackground(10, 10, 530, 420, 3000);
|
||||||
|
|
||||||
|
builder.AddHtmlLocalized(20, 10, 510, 35, 1011105); // <center>WAR FUNCTIONS</center>
|
||||||
|
|
||||||
|
builder.AddButton(20, 40, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 40, 400, 30, 1011099); // Declare war through guild name search.
|
||||||
|
|
||||||
|
if (_guild.Enemies.Count > 0)
|
||||||
|
{
|
||||||
|
builder.AddButton(20, 160 + 30, 4005, 4007, 2);
|
||||||
|
builder.AddHtmlLocalized(55, 160, 400, 30, 1011103); // Declare peace.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1013033); // No current wars
|
builder.AddHtmlLocalized(20, 160, 400, 30, 1013033); // No current wars
|
||||||
}
|
}
|
||||||
|
|
||||||
if (guild.WarInvitations.Count > 0)
|
if (_guild.WarInvitations.Count > 0)
|
||||||
{
|
{
|
||||||
AddButton(20, 160 + count * 30, 4005, 4007, 3);
|
builder.AddButton(20, 190, 4005, 4007, 3);
|
||||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011100); // Accept war invitations.
|
builder.AddHtmlLocalized(55, 190, 400, 30, 1011100); // Accept war invitations.
|
||||||
|
|
||||||
AddButton(20, 160 + count * 30, 4005, 4007, 4);
|
builder.AddButton(20, 190, 4005, 4007, 4);
|
||||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011101); // Reject war invitations.
|
builder.AddHtmlLocalized(55, 190, 400, 30, 1011101); // Reject war invitations.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1018012); // No current invitations received for war.
|
builder.AddHtmlLocalized(20, 190, 400, 30, 1018012); // No current invitations received for war.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (guild.WarDeclarations.Count > 0)
|
if (_guild.WarDeclarations.Count > 0)
|
||||||
{
|
{
|
||||||
AddButton(20, 160 + count * 30, 4005, 4007, 5);
|
builder.AddButton(20, 220, 4005, 4007, 5);
|
||||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011102); // Rescind your war declarations.
|
builder.AddHtmlLocalized(55, 220, 400, 30, 1011102); // Rescind your war declarations.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1013055); // No current war declarations
|
builder.AddHtmlLocalized(20, 220, 400, 30, 1013055); // No current war declarations
|
||||||
}
|
}
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 6);
|
builder.AddButton(20, 400, 4005, 4007, 6);
|
||||||
AddHtmlLocalized(55, 400, 400, 35, 1011104); // Return to the previous menu.
|
builder.AddHtmlLocalized(55, 400, 400, 35, 1011104); // Return to the previous menu.
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -74,44 +84,33 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
case 1: // Declare war
|
case 1: // Declare war
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1018001); // Declare war through search - Enter Guild Name:
|
from.SendLocalizedMessage(1018001); // Declare war through search - Enter Guild Name:
|
||||||
m_Mobile.Prompt = new GuildDeclareWarPrompt(m_Mobile, m_Guild);
|
from.Prompt = new GuildDeclareWarPrompt(_guild);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: // Declare peace
|
case 2: // Declare peace
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildDeclarePeaceGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildDeclarePeaceGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: // Accept war
|
case 3: // Accept war
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildAcceptWarGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildAcceptWarGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: // Reject war
|
case 4: // Reject war
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildRejectWarGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildRejectWarGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5: // Rescind declarations
|
case 5: // Rescind declarations
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildRescindDeclarationGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildRescindDeclarationGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: // Return
|
case 6: // Return
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,111 +3,116 @@ using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildWarGump : Gump
|
public class GuildWarGump : DynamicGump
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildWarGump(Mobile from, Guild guild) : base(20, 30)
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
private GuildWarGump(Guild guild) : base(20, 30) => _guild = guild;
|
||||||
|
|
||||||
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
m_Mobile = from;
|
if (from?.NetState == null || guild == null)
|
||||||
m_Guild = guild;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Draggable = false;
|
GuildGump.EnsureClosed(from);
|
||||||
|
from.SendGump(new GuildWarGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddPage(0);
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||||
AddBackground(0, 0, 550, 440, 5054);
|
{
|
||||||
AddBackground(10, 10, 530, 420, 3000);
|
builder.SetNoMove();
|
||||||
|
|
||||||
AddHtmlLocalized(20, 10, 500, 35, 1011133); // <center>WARFARE STATUS</center>
|
builder.AddPage();
|
||||||
|
builder.AddBackground(0, 0, 550, 440, 5054);
|
||||||
|
builder.AddBackground(10, 10, 530, 420, 3000);
|
||||||
|
|
||||||
AddButton(20, 400, 4005, 4007, 1);
|
builder.AddHtmlLocalized(20, 10, 500, 35, 1011133); // <center>WARFARE STATUS</center>
|
||||||
AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
|
||||||
|
|
||||||
AddPage(1);
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(55, 400, 300, 35, 1011120); // Return to the main menu.
|
||||||
|
|
||||||
AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 2);
|
builder.AddPage(1);
|
||||||
AddHtmlLocalized(410, 373, 100, 25, 1011066); // Next page
|
|
||||||
|
|
||||||
AddHtmlLocalized(20, 45, 400, 20, 1011134); // We are at war with:
|
builder.AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 2);
|
||||||
|
builder.AddHtmlLocalized(410, 373, 100, 25, 1011066); // Next page
|
||||||
|
|
||||||
var enemies = guild.Enemies;
|
builder.AddHtmlLocalized(20, 45, 400, 20, 1011134); // We are at war with:
|
||||||
|
|
||||||
|
var enemies = _guild.Enemies;
|
||||||
|
|
||||||
if (enemies.Count == 0)
|
if (enemies.Count == 0)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 65, 400, 20, 1013033); // No current wars
|
builder.AddHtmlLocalized(20, 65, 400, 20, 1013033); // No current wars
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (var i = 0; i < enemies.Count; ++i)
|
for (var i = 0; i < enemies.Count; ++i)
|
||||||
{
|
{
|
||||||
var g = enemies[i];
|
builder.AddHtml(20, 65 + i * 20, 300, 20, enemies[i].Name);
|
||||||
|
|
||||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPage(2);
|
builder.AddPage(2);
|
||||||
|
|
||||||
AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 3);
|
builder.AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 3);
|
||||||
AddHtmlLocalized(410, 373, 100, 25, 1011066); // Next page
|
builder.AddHtmlLocalized(410, 373, 100, 25, 1011066); // Next page
|
||||||
|
|
||||||
AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 1);
|
builder.AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 1);
|
||||||
AddHtmlLocalized(65, 373, 150, 25, 1011067); // Previous page
|
builder.AddHtmlLocalized(65, 373, 150, 25, 1011067); // Previous page
|
||||||
|
|
||||||
AddHtmlLocalized(20, 45, 400, 20, 1011136); // Guilds that we have declared war on:
|
builder.AddHtmlLocalized(20, 45, 400, 20, 1011136); // Guilds that we have declared war on:
|
||||||
|
|
||||||
var declared = guild.WarDeclarations;
|
var declared = _guild.WarDeclarations;
|
||||||
|
|
||||||
if (declared.Count == 0)
|
if (declared.Count == 0)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 65, 400, 20, 1018012); // No current invitations received for war.
|
builder.AddHtmlLocalized(20, 65, 400, 20, 1018012); // No current invitations received for war.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (var i = 0; i < declared.Count; ++i)
|
for (var i = 0; i < declared.Count; ++i)
|
||||||
{
|
{
|
||||||
var g = declared[i];
|
builder.AddHtml(20, 65 + i * 20, 300, 20, declared[i].Name);
|
||||||
|
|
||||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPage(3);
|
builder.AddPage(3);
|
||||||
|
|
||||||
AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 2);
|
builder.AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 2);
|
||||||
AddHtmlLocalized(65, 373, 150, 25, 1011067); // Previous page
|
builder.AddHtmlLocalized(65, 373, 150, 25, 1011067); // Previous page
|
||||||
|
|
||||||
AddHtmlLocalized(20, 45, 400, 20, 1011135); // Guilds that have declared war on us:
|
builder.AddHtmlLocalized(20, 45, 400, 20, 1011135); // Guilds that have declared war on us:
|
||||||
|
|
||||||
var invites = guild.WarInvitations;
|
var invites = _guild.WarInvitations;
|
||||||
|
|
||||||
if (invites.Count == 0)
|
if (invites.Count == 0)
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(20, 65, 400, 20, 1013055); // No current war declarations
|
builder.AddHtmlLocalized(20, 65, 400, 20, 1013055); // No current war declarations
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (var i = 0; i < invites.Count; ++i)
|
for (var i = 0; i < invites.Count; ++i)
|
||||||
{
|
{
|
||||||
var g = invites[i];
|
builder.AddHtml(20, 65 + i * 20, 300, 20, invites[i].Name);
|
||||||
|
|
||||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadMember(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.ButtonID == 1)
|
if (info.ButtonID == 1)
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@ namespace Server.Gumps
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(m_Mobile, m_Guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
|
|
@ -44,8 +43,7 @@ namespace Server.Gumps
|
||||||
m_Guild.Website = text;
|
m_Guild.Website = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildmasterGump.DisplayTo(m_Mobile, m_Guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,93 +4,105 @@ using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class GuildmasterGump : Gump
|
public class GuildmasterGump : DynamicGump
|
||||||
{
|
{
|
||||||
private readonly Guild m_Guild;
|
private readonly Guild _guild;
|
||||||
private readonly Mobile m_Mobile;
|
|
||||||
|
|
||||||
public GuildmasterGump(Mobile from, Guild guild) : base(20, 30)
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
private GuildmasterGump(Guild guild) : base(20, 30) => _guild = guild;
|
||||||
|
|
||||||
|
public static void DisplayTo(Mobile from, Guild guild)
|
||||||
{
|
{
|
||||||
m_Mobile = from;
|
if (from?.NetState == null || guild == null)
|
||||||
m_Guild = guild;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Draggable = false;
|
GuildGump.EnsureClosed(from);
|
||||||
|
from.SendGump(new GuildmasterGump(guild));
|
||||||
|
}
|
||||||
|
|
||||||
AddPage(0);
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||||
AddBackground(0, 0, 550, 400, 5054);
|
{
|
||||||
AddBackground(10, 10, 530, 380, 3000);
|
builder.SetNoMove();
|
||||||
|
|
||||||
AddHtmlLocalized(20, 15, 510, 35, 1011121); // <center>GUILDMASTER FUNCTIONS</center>
|
builder.AddPage();
|
||||||
|
builder.AddBackground(0, 0, 550, 400, 5054);
|
||||||
|
builder.AddBackground(10, 10, 530, 380, 3000);
|
||||||
|
|
||||||
AddButton(20, 40, 4005, 4007, 2);
|
builder.AddHtmlLocalized(20, 15, 510, 35, 1011121); // <center>GUILDMASTER FUNCTIONS</center>
|
||||||
AddHtmlLocalized(55, 40, 470, 30, 1011107); // Set the guild name.
|
|
||||||
|
|
||||||
AddButton(20, 70, 4005, 4007, 3);
|
builder.AddButton(20, 40, 4005, 4007, 2);
|
||||||
AddHtmlLocalized(55, 70, 470, 30, 1011109); // Set the guild's abbreviation.
|
builder.AddHtmlLocalized(55, 40, 470, 30, 1011107); // Set the guild name.
|
||||||
|
|
||||||
|
builder.AddButton(20, 70, 4005, 4007, 3);
|
||||||
|
builder.AddHtmlLocalized(55, 70, 470, 30, 1011109); // Set the guild's abbreviation.
|
||||||
|
|
||||||
if (Guild.OrderChaos)
|
if (Guild.OrderChaos)
|
||||||
{
|
{
|
||||||
AddButton(20, 100, 4005, 4007, 4);
|
builder.AddButton(20, 100, 4005, 4007, 4);
|
||||||
|
|
||||||
switch (m_Guild.Type)
|
switch (_guild.Type)
|
||||||
{
|
{
|
||||||
case GuildType.Regular:
|
case GuildType.Regular:
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(55, 100, 470, 30, 1013059); // Change guild type: Currently Standard
|
builder.AddHtmlLocalized(55, 100, 470, 30, 1013059); // Change guild type: Currently Standard
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GuildType.Order:
|
case GuildType.Order:
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(55, 100, 470, 30, 1013057); // Change guild type: Currently Order
|
builder.AddHtmlLocalized(55, 100, 470, 30, 1013057); // Change guild type: Currently Order
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GuildType.Chaos:
|
case GuildType.Chaos:
|
||||||
{
|
{
|
||||||
AddHtmlLocalized(55, 100, 470, 30, 1013058); // Change guild type: Currently Chaos
|
builder.AddHtmlLocalized(55, 100, 470, 30, 1013058); // Change guild type: Currently Chaos
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddButton(20, 130, 4005, 4007, 5);
|
builder.AddButton(20, 130, 4005, 4007, 5);
|
||||||
AddHtmlLocalized(55, 130, 470, 30, 1011112); // Set the guild's charter.
|
builder.AddHtmlLocalized(55, 130, 470, 30, 1011112); // Set the guild's charter.
|
||||||
|
|
||||||
AddButton(20, 160, 4005, 4007, 6);
|
builder.AddButton(20, 160, 4005, 4007, 6);
|
||||||
AddHtmlLocalized(55, 160, 470, 30, 1011113); // Dismiss a member.
|
builder.AddHtmlLocalized(55, 160, 470, 30, 1011113); // Dismiss a member.
|
||||||
|
|
||||||
AddButton(20, 190, 4005, 4007, 7);
|
builder.AddButton(20, 190, 4005, 4007, 7);
|
||||||
AddHtmlLocalized(55, 190, 470, 30, 1011114); // Go to the WAR menu.
|
builder.AddHtmlLocalized(55, 190, 470, 30, 1011114); // Go to the WAR menu.
|
||||||
|
|
||||||
if (m_Guild.Candidates.Count > 0)
|
if (_guild.Candidates.Count > 0)
|
||||||
{
|
{
|
||||||
AddButton(20, 220, 4005, 4007, 8);
|
builder.AddButton(20, 220, 4005, 4007, 8);
|
||||||
AddHtmlLocalized(55, 220, 470, 30, 1013056); // Administer the list of candidates
|
builder.AddHtmlLocalized(55, 220, 470, 30, 1013056); // Administer the list of candidates
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddImage(20, 220, 4020);
|
builder.AddImage(20, 220, 4020);
|
||||||
AddHtmlLocalized(55, 220, 470, 30, 1013031); // There are currently no candidates for membership.
|
builder.AddHtmlLocalized(55, 220, 470, 30, 1013031); // There are currently no candidates for membership.
|
||||||
}
|
}
|
||||||
|
|
||||||
AddButton(20, 250, 4005, 4007, 9);
|
builder.AddButton(20, 250, 4005, 4007, 9);
|
||||||
AddHtmlLocalized(55, 250, 470, 30, 1011117); // Set the guildmaster's title.
|
builder.AddHtmlLocalized(55, 250, 470, 30, 1011117); // Set the guildmaster's title.
|
||||||
|
|
||||||
AddButton(20, 280, 4005, 4007, 10);
|
builder.AddButton(20, 280, 4005, 4007, 10);
|
||||||
AddHtmlLocalized(55, 280, 470, 30, 1011118); // Grant a title to another member.
|
builder.AddHtmlLocalized(55, 280, 470, 30, 1011118); // Grant a title to another member.
|
||||||
|
|
||||||
AddButton(20, 310, 4005, 4007, 11);
|
builder.AddButton(20, 310, 4005, 4007, 11);
|
||||||
AddHtmlLocalized(55, 310, 470, 30, 1011119); // Move this guildstone.
|
builder.AddHtmlLocalized(55, 310, 470, 30, 1011119); // Move this guildstone.
|
||||||
|
|
||||||
AddButton(20, 360, 4005, 4007, 1);
|
builder.AddButton(20, 360, 4005, 4007, 1);
|
||||||
AddHtmlLocalized(55, 360, 245, 30, 1011120); // Return to the main menu.
|
builder.AddHtmlLocalized(55, 360, 245, 30, 1011120); // Return to the main menu.
|
||||||
|
|
||||||
AddButton(300, 360, 4005, 4007, 0);
|
builder.AddButton(300, 360, 4005, 4007, 0);
|
||||||
AddHtmlLocalized(335, 360, 100, 30, 1011441); // EXIT
|
builder.AddHtmlLocalized(335, 360, 100, 30, 1011441); // EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState state, in RelayInfo info)
|
public override void OnResponse(NetState state, in RelayInfo info)
|
||||||
{
|
{
|
||||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
var from = state.Mobile;
|
||||||
|
if (GuildGump.BadLeader(from, _guild))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -99,23 +111,19 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
case 1: // Main menu
|
case 1: // Main menu
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: // Set guild name
|
case 2: // Set guild name
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1013060); // Enter new guild name (40 characters max):
|
from.SendLocalizedMessage(1013060); // Enter new guild name (40 characters max):
|
||||||
m_Mobile.Prompt = new GuildNamePrompt(m_Mobile, m_Guild);
|
from.Prompt = new GuildNamePrompt(from, _guild);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: // Set guild abbreviation
|
case 3: // Set guild abbreviation
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1013061); // Enter new guild abbreviation (3 characters max):
|
from.SendLocalizedMessage(1013061); // Enter new guild abbreviation (3 characters max):
|
||||||
m_Mobile.Prompt = new GuildAbbrvPrompt(m_Mobile, m_Guild);
|
from.Prompt = new GuildAbbrvPrompt(_guild);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: // Change guild type
|
case 4: // Change guild type
|
||||||
|
|
@ -125,72 +133,57 @@ namespace Server.Gumps
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildChangeTypeGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildChangeTypeGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5: // Set charter
|
case 5: // Set charter
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
|
from.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
|
||||||
m_Mobile.Prompt = new GuildCharterPrompt(m_Mobile, m_Guild);
|
from.Prompt = new GuildCharterPrompt(_guild);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: // Dismiss member
|
case 6: // Dismiss member
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildDismissGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildDismissGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: // War menu
|
case 7: // War menu
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildWarAdminGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: // Administer candidates
|
case 8: // Administer candidates
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildAdminCandidatesGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: // Set guildmaster's title
|
case 9: // Set guildmaster's title
|
||||||
{
|
{
|
||||||
m_Mobile.SendLocalizedMessage(1013073); // Enter new guildmaster title (20 characters max):
|
from.SendLocalizedMessage(1013073); // Enter new guildmaster title (20 characters max):
|
||||||
m_Mobile.Prompt = new GuildTitlePrompt(m_Mobile, m_Mobile, m_Guild);
|
from.Prompt = new GuildTitlePrompt(from, _guild);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 10: // Grant title
|
case 10: // Grant title
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GrantGuildTitleGump.DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GrantGuildTitleGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 11: // Move guildstone
|
case 11: // Move guildstone
|
||||||
{
|
{
|
||||||
if (m_Guild.Guildstone != null)
|
if (_guild.Guildstone != null)
|
||||||
{
|
{
|
||||||
var item = new GuildTeleporter(m_Guild.Guildstone);
|
var item = new GuildTeleporter(_guild.Guildstone);
|
||||||
|
|
||||||
m_Guild.Teleporter?.Delete();
|
_guild.Teleporter?.Delete();
|
||||||
|
|
||||||
m_Mobile.SendLocalizedMessage(
|
// Use the teleporting object placed in your backpack to move this guildstone.
|
||||||
501133
|
from.SendLocalizedMessage(501133);
|
||||||
); // Use the teleporting object placed in your backpack to move this guildstone.
|
|
||||||
|
|
||||||
m_Mobile.AddToBackpack(item);
|
from.AddToBackpack(item);
|
||||||
m_Guild.Teleporter = item;
|
_guild.Teleporter = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
DisplayTo(from, _guild);
|
||||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ namespace Server.Guilds
|
||||||
// Guild Faction
|
// Guild Faction
|
||||||
if (Guild.OrderChaos && IsLeader(pm, guild))
|
if (Guild.OrderChaos && IsLeader(pm, guild))
|
||||||
{
|
{
|
||||||
pm.SendGump(new GuildChangeTypeGump(pm, guild), true);
|
GuildChangeTypeGump.DisplayTo(pm, guild);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,7 @@ namespace Server.Gumps
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildGump.EnsureClosed(m_Mobile);
|
GuildGump.DisplayTo(m_Mobile, m_Guild);
|
||||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,7 @@ public partial class Guildstone : Item, IAddon, IChoppable
|
||||||
_guild.Accepted.Remove(from);
|
_guild.Accepted.Remove(from);
|
||||||
_guild.AddMember(from);
|
_guild.AddMember(from);
|
||||||
|
|
||||||
GuildGump.EnsureClosed(from);
|
GuildGump.DisplayTo(from, Guild);
|
||||||
from.SendGump(new GuildGump(from, Guild));
|
|
||||||
}
|
}
|
||||||
else if (from.AccessLevel < AccessLevel.GameMaster && !_guild.IsMember(from))
|
else if (from.AccessLevel < AccessLevel.GameMaster && !_guild.IsMember(from))
|
||||||
{
|
{
|
||||||
|
|
@ -197,8 +196,7 @@ public partial class Guildstone : Item, IAddon, IChoppable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GuildGump.EnsureClosed(from);
|
GuildGump.DisplayTo(from, _guild);
|
||||||
from.SendGump(new GuildGump(from, _guild));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue