Formatting FIxes (#58)

This commit is contained in:
Kamron Batman 2019-10-04 23:08:13 -07:00 committed by GitHub
parent 57fb9fb525
commit 096d39609e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1318 changed files with 11633 additions and 22129 deletions

View file

@ -203,10 +203,7 @@ namespace Server.Gumps
private class TypeNameComparer : IComparer<Type>
{
public int Compare(Type x, Type y)
{
return x.Name.CompareTo(y.Name);
}
public int Compare(Type x, Type y) => x.Name.CompareTo(y.Name);
}
public class InternalTarget : Target

View file

@ -11,7 +11,6 @@ using Server.Misc;
using Server.Multis;
using Server.Network;
using Server.Prompts;
using Server.RemoteAdmin;
namespace Server.Gumps
{
@ -417,8 +416,7 @@ namespace Server.Gumps
int offset = 140 + i * 20;
if (m == null)
AddLabelCropped(12, offset, 81, 20, LabelHue,
AdminNetwork.IsAuth(ns) ? "(remote admin)" : "(logging in)");
AddLabelCropped(12, offset, 81, 20, LabelHue, "(logging in)");
else
AddLabelCropped(12, offset, 81, 20, GetHueFor(m), m.Name);
AddLabelCropped(95, offset, 81, 20, LabelHue, a == null ? "(no account)" : a.Username);
@ -1162,15 +1160,9 @@ namespace Server.Gumps
AddHtml(x + 35, y, 240, 20, Color(text, LabelColor32));
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddBlackAlpha(int x, int y, int width, int height)
{
@ -1178,15 +1170,9 @@ namespace Server.Gumps
AddAlphaRegion(x, y, width, height);
}
public int GetButtonID(int type, int index)
{
return 1 + index * 11 + type;
}
public int GetButtonID(int type, int index) => 1 + index * 11 + type;
public static string FormatTimeSpan(TimeSpan ts)
{
return $"{ts.Days:D2}:{ts.Hours % 24:D2}:{ts.Minutes % 60:D2}:{ts.Seconds % 60:D2}";
}
public static string FormatTimeSpan(TimeSpan ts) => $"{ts.Days:D2}:{ts.Hours % 24:D2}:{ts.Minutes % 60:D2}:{ts.Seconds % 60:D2}";
public static string FormatByteAmount(long totalBytes)
{
@ -3013,20 +2999,14 @@ namespace Server.Gumps
{
public static readonly IComparer<KeyValuePair<IPAddress, List<Account>>> Instance = new SharedAccountComparer();
public int Compare(KeyValuePair<IPAddress, List<Account>> x, KeyValuePair<IPAddress, List<Account>> y)
{
return x.Value.Count - y.Value.Count;
}
public int Compare(KeyValuePair<IPAddress, List<Account>> x, KeyValuePair<IPAddress, List<Account>> y) => x.Value.Count - y.Value.Count;
}
private class AddCommentPrompt : Prompt
{
private Account m_Account;
public AddCommentPrompt(Account acct)
{
m_Account = acct;
}
public AddCommentPrompt(Account acct) => m_Account = acct;
public override void OnCancel(Mobile from)
{
@ -3049,10 +3029,7 @@ namespace Server.Gumps
{
private Account m_Account;
public AddTagNamePrompt(Account acct)
{
m_Account = acct;
}
public AddTagNamePrompt(Account acct) => m_Account = acct;
public override void OnCancel(Mobile from)
{

View file

@ -37,20 +37,11 @@ namespace Server.Gumps
public virtual int TextHue => 0;
public virtual int TextOffsetX => 2;
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public int GetButtonID(int typeCount, int type, int index)
{
return 1 + index * typeCount + type;
}
public int GetButtonID(int typeCount, int type, int index) => 1 + index * typeCount + type;
public bool SplitButtonID(int buttonID, int typeCount, out int type, out int index)
{

View file

@ -292,14 +292,8 @@ namespace Server.Gumps
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
}

View file

@ -92,10 +92,7 @@ namespace Server.Gumps
{
private Account m_Acct;
public CommentPrompt(Account acct)
{
m_Acct = acct;
}
public CommentPrompt(Account acct) => m_Acct = acct;
public override void OnCancel(Mobile from)
{

View file

@ -7,10 +7,7 @@ namespace Server.Gumps
{
private BaseImprisonedMobile m_Item;
public ConfirmBreakCrystalGump(BaseImprisonedMobile item)
{
m_Item = item;
}
public ConfirmBreakCrystalGump(BaseImprisonedMobile item) => m_Item = item;
public override int LabelNumber =>
1075084; // This statuette will be destroyed when its trapped creature is summoned. The creature will be bonded to you but will disappear if released. <br><br>Do you wish to proceed?

View file

@ -31,8 +31,9 @@ namespace Server.Gumps
public override void OnResponse(NetState sender, RelayInfo info)
{
if (info.ButtonID != 2 || m_Pet.Deleted || !(m_Pet.Controlled && m_From == m_Pet.ControlMaster &&
m_From.CheckAlive() && m_Pet.Map == m_From.Map && m_Pet.InRange(m_From, 14)))
if (info.ButtonID != 2 || m_Pet.Deleted ||
!(m_Pet.Controlled && m_From == m_Pet.ControlMaster &&
m_From.CheckAlive() && m_Pet.Map == m_From.Map && m_Pet.InRange(m_From, 14)))
return;
m_Pet.ControlTarget = null;
m_Pet.ControlOrder = OrderType.Release;

View file

@ -65,17 +65,13 @@ namespace Server.Guilds
}
}
public static bool IsLeader(Mobile m, Guild g)
{
return !(m.Deleted || g.Disbanded || !(m is PlayerMobile) ||
m.AccessLevel < AccessLevel.GameMaster && g.Leader != m);
}
public static bool IsLeader(Mobile m, Guild g) =>
!(m.Deleted || g.Disbanded || !(m is PlayerMobile) ||
m.AccessLevel < AccessLevel.GameMaster && g.Leader != m);
public static bool IsMember(Mobile m, Guild g)
{
return !(m.Deleted || g.Disbanded || !(m is PlayerMobile) ||
m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m));
}
public static bool IsMember(Mobile m, Guild g) =>
!(m.Deleted || g.Disbanded || !(m is PlayerMobile) ||
m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m));
public static bool CheckProfanity(string s, int maxLength = 50)
{
@ -123,9 +119,6 @@ namespace Server.Guilds
AddHtml(x, y, width, height, text.String, back, scroll);
}
public static string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
}

View file

@ -103,10 +103,7 @@ namespace Server.Guilds
{
}
public virtual bool HasRelationship(T o)
{
return false;
}
public virtual bool HasRelationship(T o) => false;
public virtual void DrawEntry(T o, int index, int itemNumber)
{

View file

@ -179,10 +179,8 @@ namespace Server.Guilds
public override Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<Guild> comparer, bool ascending,
string filter, int startNumber)
{
return new GuildDiplomacyGump(pm, g, comparer, ascending, filter, startNumber, m_Display);
}
string filter, int startNumber) =>
new GuildDiplomacyGump(pm, g, comparer, ascending, filter, startNumber, m_Display);
public override Gump GetObjectInfoGump(PlayerMobile pm, Guild g, Guild o)
{
@ -232,10 +230,7 @@ namespace Server.Guilds
{
private Guild m_Guild;
public StatusComparer(Guild g)
{
m_Guild = g;
}
public StatusComparer(Guild g) => m_Guild = g;
public int Compare(Guild x, Guild y)
{

View file

@ -73,15 +73,10 @@ namespace Server.Guilds
}
public override Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<PlayerMobile> comparer, bool ascending,
string filter, int startNumber)
{
return new GuildRosterGump(pm, g, comparer, ascending, filter, startNumber);
}
string filter, int startNumber) =>
new GuildRosterGump(pm, g, comparer, ascending, filter, startNumber);
public override Gump GetObjectInfoGump(PlayerMobile pm, Guild g, PlayerMobile o)
{
return new GuildMemberInfoGump(pm, g, o, false, false);
}
public override Gump GetObjectInfoGump(PlayerMobile pm, Guild g, PlayerMobile o) => new GuildMemberInfoGump(pm, g, o, false, false);
public override void OnResponse(NetState sender, RelayInfo info)
{

View file

@ -13,8 +13,7 @@ namespace Server.Gumps
AddBackground(0, 0, 245, 145, 9250);
AddButton(157, 101, 247, 248, 1);
AddButton(81, 100, 241, 248, 0);
AddHtml(21, 20, 203, 70, @"Are you sure you want to use
honor points on yourself?", true);
AddHtml(21, 20, 203, 70, "Are you sure you want to use honor points on yourself?", true);
}
public override void OnResponse(NetState sender, RelayInfo info)

View file

@ -721,10 +721,7 @@ namespace Server.Prompts
{
private BaseHouse m_House;
public RenamePrompt(BaseHouse house)
{
m_House = house;
}
public RenamePrompt(BaseHouse house) => m_House = house;
public override void OnResponse(Mobile from, string text)
{

View file

@ -487,10 +487,7 @@ namespace Server.Gumps
return String.IsNullOrWhiteSpace(m.Name) ? "(no name)" : m.Name.Trim();
}
private string GetDateTime(DateTime val)
{
return val == DateTime.MinValue ? "" : val.ToString("yyyy'-'MM'-'dd HH':'mm':'ss");
}
private string GetDateTime(DateTime val) => val == DateTime.MinValue ? "" : val.ToString("yyyy'-'MM'-'dd HH':'mm':'ss");
public void AddPageButton(int x, int y, int buttonID, int number, HouseGumpPageAOS page)
{
@ -576,10 +573,7 @@ namespace Server.Gumps
}
}
public int GetButtonID(int type, int index)
{
return 1 + index * 15 + type;
}
public int GetButtonID(int type, int index) => 1 + index * 15 + type;
public static void PublicPrivateNotice_Callback(Mobile from, BaseHouse house)
{

View file

@ -416,10 +416,7 @@ namespace Server.Gumps
return list;
}
private static bool IsCustomEnum(Type type)
{
return type.IsDefined(typeofCustomEnum, false);
}
private static bool IsCustomEnum(Type type) => type.IsDefined(typeofCustomEnum, false);
public static void OnValueChanged(object obj, PropertyInfo prop, Stack<StackEntry> stack)
{
@ -448,15 +445,9 @@ namespace Server.Gumps
return ce.Names;
}
private static bool HasAttribute(Type type, Type check, bool inherit)
{
return type.GetCustomAttributes(check, inherit).Length > 0;
}
private static bool HasAttribute(Type type, Type check, bool inherit) => type.GetCustomAttributes(check, inherit).Length > 0;
private static bool IsType(Type type, Type check)
{
return type == check || type.IsSubclassOf(check);
}
private static bool IsType(Type type, Type check) => type == check || type.IsSubclassOf(check);
private static bool IsType(Type type, Type[] check)
{
@ -467,10 +458,7 @@ namespace Server.Gumps
return false;
}
private string ValueToString(PropertyInfo prop)
{
return ValueToString(m_Object, prop);
}
private string ValueToString(PropertyInfo prop) => ValueToString(m_Object, prop);
public static string ValueToString(object obj, PropertyInfo prop)
{
@ -666,15 +654,9 @@ namespace Server.Gumps
{
private Type m_Start;
public GroupComparer(Type start)
{
m_Start = start;
}
public GroupComparer(Type start) => m_Start = start;
public int Compare(KeyValuePair<Type, List<PropertyInfo>> x, KeyValuePair<Type, List<PropertyInfo>> y)
{
return GetDistance(x.Key).CompareTo(GetDistance(y.Key));
}
public int Compare(KeyValuePair<Type, List<PropertyInfo>> x, KeyValuePair<Type, List<PropertyInfo>> y) => GetDistance(x.Key).CompareTo(GetDistance(y.Key));
private int GetDistance(Type type)
{

View file

@ -96,15 +96,9 @@ namespace Server.Gumps
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddTypeButton(int x, int y, int buttonID, string text, ModelBodyType type)
{

View file

@ -11,10 +11,8 @@ namespace Server.Gumps
private string[] m_Names;
public SetCustomEnumGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int propspage,
List<object> list, string[] names) : base(prop, mobile, o, stack, propspage, list, names, null)
{
List<object> list, string[] names) : base(prop, mobile, o, stack, propspage, list, names, null) =>
m_Names = names;
}
public override void OnResponse(NetState sender, RelayInfo relayInfo)
{

View file

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

View file

@ -5,122 +5,122 @@ using Server.Mobiles;
namespace Server.Gumps
{
public enum ResurrectMessage
{
ChaosShrine = 0,
VirtueShrine = 1,
Healer = 2,
Generic = 3
}
public enum ResurrectMessage
{
ChaosShrine = 0,
VirtueShrine = 1,
Healer = 2,
Generic = 3
}
public class ResurrectGump : Gump
{
private Mobile m_Healer;
private int m_Price;
private bool m_FromSacrifice;
private double m_HitsScalar;
public class ResurrectGump : Gump
{
private Mobile m_Healer;
private int m_Price;
private bool m_FromSacrifice;
private double m_HitsScalar;
public ResurrectGump(Mobile owner, double hitsScalar)
: this(owner, owner, ResurrectMessage.Generic, false, hitsScalar)
{
}
public ResurrectGump(Mobile owner, double hitsScalar)
: this(owner, owner, ResurrectMessage.Generic, false, hitsScalar)
{
}
public ResurrectGump(Mobile owner, ResurrectMessage msg) : this(owner, owner, msg)
{
}
public ResurrectGump(Mobile owner, ResurrectMessage msg) : this(owner, owner, msg)
{
}
public ResurrectGump(Mobile owner, bool fromSacrifice = false)
: this(owner, owner, ResurrectMessage.Generic, fromSacrifice)
{
}
public ResurrectGump(Mobile owner, bool fromSacrifice = false)
: this(owner, owner, ResurrectMessage.Generic, fromSacrifice)
{
}
public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg = ResurrectMessage.Generic,
bool fromSacrifice = false, double hitsScalar = 0.0)
: base( 100, 0 )
{
m_Healer = healer;
m_FromSacrifice = fromSacrifice;
m_HitsScalar = hitsScalar;
public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg = ResurrectMessage.Generic,
bool fromSacrifice = false, double hitsScalar = 0.0)
: base( 100, 0 )
{
m_Healer = healer;
m_FromSacrifice = fromSacrifice;
m_HitsScalar = hitsScalar;
AddPage( 0 );
AddPage( 0 );
AddBackground( 0, 0, 400, 350, 2600 );
AddBackground( 0, 0, 400, 350, 2600 );
AddHtmlLocalized( 0, 20, 400, 35, 1011022 ); // <center>Resurrection</center>
AddHtmlLocalized( 0, 20, 400, 35, 1011022 ); // <center>Resurrection</center>
AddHtmlLocalized( 50, 55, 300, 140, 1011023 + (int)msg, true, true ); /* It is possible for you to be resurrected here by this healer. Do you wish to try?<br>
AddHtmlLocalized( 50, 55, 300, 140, 1011023 + (int)msg, true, true ); /* It is possible for you to be resurrected here by this healer. Do you wish to try?<br>
* CONTINUE - You chose to try to come back to life now.<br>
* CANCEL - You prefer to remain a ghost for now.
*/
AddButton( 200, 227, 4005, 4007, 0);
AddHtmlLocalized( 235, 230, 110, 35, 1011012 ); // CANCEL
AddButton( 200, 227, 4005, 4007, 0);
AddHtmlLocalized( 235, 230, 110, 35, 1011012 ); // CANCEL
AddButton( 65, 227, 4005, 4007, 1);
AddHtmlLocalized( 100, 230, 110, 35, 1011011 ); // CONTINUE
}
AddButton( 65, 227, 4005, 4007, 1);
AddHtmlLocalized( 100, 230, 110, 35, 1011011 ); // CONTINUE
}
public ResurrectGump( Mobile owner, Mobile healer, int price )
: base( 150, 50 )
{
m_Healer = healer;
m_Price = price;
public ResurrectGump( Mobile owner, Mobile healer, int price )
: base( 150, 50 )
{
m_Healer = healer;
m_Price = price;
Closable = false;
Closable = false;
AddPage( 0 );
AddPage( 0 );
AddImage( 0, 0, 3600 );
AddImage( 0, 0, 3600 );
AddImageTiled( 0, 14, 15, 200, 3603 );
AddImageTiled( 380, 14, 14, 200, 3605 );
AddImageTiled( 0, 14, 15, 200, 3603 );
AddImageTiled( 380, 14, 14, 200, 3605 );
AddImage( 0, 201, 3606 );
AddImage( 0, 201, 3606 );
AddImageTiled( 15, 201, 370, 16, 3607 );
AddImageTiled( 15, 0, 370, 16, 3601 );
AddImageTiled( 15, 201, 370, 16, 3607 );
AddImageTiled( 15, 0, 370, 16, 3601 );
AddImage( 380, 0, 3602 );
AddImage( 380, 0, 3602 );
AddImage( 380, 201, 3608 );
AddImage( 380, 201, 3608 );
AddImageTiled( 15, 15, 365, 190, 2624 );
AddImageTiled( 15, 15, 365, 190, 2624 );
AddRadio( 30, 140, 9727, 9730, true, 1 );
AddHtmlLocalized( 65, 145, 300, 25, 1060015, 0x7FFF ); // Grudgingly pay the money
AddRadio( 30, 140, 9727, 9730, true, 1 );
AddHtmlLocalized( 65, 145, 300, 25, 1060015, 0x7FFF ); // Grudgingly pay the money
AddRadio( 30, 175, 9727, 9730, false, 0 );
AddHtmlLocalized( 65, 178, 300, 25, 1060016, 0x7FFF ); // I'd rather stay dead, you scoundrel!!!
AddRadio( 30, 175, 9727, 9730, false, 0 );
AddHtmlLocalized( 65, 178, 300, 25, 1060016, 0x7FFF ); // I'd rather stay dead, you scoundrel!!!
AddHtmlLocalized( 30, 20, 360, 35, 1060017, 0x7FFF ); // Wishing to rejoin the living, are you? I can restore your body... for a price of course...
AddHtmlLocalized( 30, 20, 360, 35, 1060017, 0x7FFF ); // Wishing to rejoin the living, are you? I can restore your body... for a price of course...
AddHtmlLocalized( 30, 105, 345, 40, 1060018, 0x5B2D ); // Do you accept the fee, which will be withdrawn from your bank?
AddHtmlLocalized( 30, 105, 345, 40, 1060018, 0x5B2D ); // Do you accept the fee, which will be withdrawn from your bank?
AddImage( 65, 72, 5605 );
AddImage( 65, 72, 5605 );
AddImageTiled( 80, 90, 200, 1, 9107 );
AddImageTiled( 95, 92, 200, 1, 9157 );
AddImageTiled( 80, 90, 200, 1, 9107 );
AddImageTiled( 95, 92, 200, 1, 9157 );
AddLabel( 90, 70, 1645, price.ToString() );
AddHtmlLocalized( 140, 70, 100, 25, 1023823, 0x7FFF ); // gold coins
AddLabel( 90, 70, 1645, price.ToString() );
AddHtmlLocalized( 140, 70, 100, 25, 1023823, 0x7FFF ); // gold coins
AddButton( 290, 175, 247, 248, 2 );
AddButton( 290, 175, 247, 248, 2 );
AddImageTiled( 15, 14, 365, 1, 9107 );
AddImageTiled( 380, 14, 1, 190, 9105 );
AddImageTiled( 15, 205, 365, 1, 9107 );
AddImageTiled( 15, 14, 1, 190, 9105 );
AddImageTiled( 0, 0, 395, 1, 9157 );
AddImageTiled( 394, 0, 1, 217, 9155 );
AddImageTiled( 0, 216, 395, 1, 9157 );
AddImageTiled( 0, 0, 1, 217, 9155 );
}
AddImageTiled( 15, 14, 365, 1, 9107 );
AddImageTiled( 380, 14, 1, 190, 9105 );
AddImageTiled( 15, 205, 365, 1, 9107 );
AddImageTiled( 15, 14, 1, 190, 9105 );
AddImageTiled( 0, 0, 395, 1, 9157 );
AddImageTiled( 394, 0, 1, 217, 9155 );
AddImageTiled( 0, 216, 395, 1, 9157 );
AddImageTiled( 0, 0, 1, 217, 9155 );
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
from.CloseGump<ResurrectGump>();
from.CloseGump<ResurrectGump>();
if (info.ButtonID != 1 && info.ButtonID != 2)
return;
@ -224,5 +224,5 @@ namespace Server.Gumps
if ( from.Alive && m_HitsScalar > 0 )
from.Hits = (int)(from.HitsMax * m_HitsScalar);
}
}
}
}

View file

@ -201,10 +201,7 @@ namespace Server.Gumps
AddLabelCropped(145 + half * 160, 60, 115, 17, hue, desc);
}
public static bool HasSpell(Mobile from, int spellID)
{
return Spellbook.Find(from, spellID)?.HasSpell(spellID) == true;
}
public static bool HasSpell(Mobile from, int spellID) => Spellbook.Find(from, spellID)?.HasSpell(spellID) == true;
public override void OnResponse(NetState state, RelayInfo info)
{
@ -410,10 +407,7 @@ namespace Server.Gumps
{
private Runebook m_Book;
public InternalPrompt(Runebook book)
{
m_Book = book;
}
public InternalPrompt(Runebook book) => m_Book = book;
public override void OnResponse(Mobile from, string text)
{

View file

@ -56,15 +56,9 @@ namespace Server.Gumps
AddHtmlLocalized(45, 130 + offset, 150, 20, 1061626, GetColor(SecureLevel.Anyone)); // Anyone
}
public int GetColor(SecureLevel level)
{
return m_Info.Level == level ? 0x7F18 : 0x7FFF;
}
public int GetColor(SecureLevel level) => m_Info.Level == level ? 0x7F18 : 0x7FFF;
public int GetFirstID(SecureLevel level)
{
return m_Info.Level == level ? 4006 : 4005;
}
public int GetFirstID(SecureLevel level) => m_Info.Level == level ? 4006 : 4005;
public override void OnResponse(NetState state, RelayInfo info)
{

View file

@ -439,10 +439,7 @@ namespace Server.Gumps
}
}
public int GetButtonID(int type, int index)
{
return 1 + index * 3 + type;
}
public int GetButtonID(int type, int index) => 1 + index * 3 + type;
}
public class SkillsGumpGroup

File diff suppressed because it is too large Load diff

View file

@ -255,20 +255,11 @@ namespace Server.Gumps
return house.GetType().Name;
}
public string Right(string text)
{
return $"<div align=right>{text}</div>";
}
public string Right(string text) => $"<div align=right>{text}</div>";
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddBlackAlpha(int x, int y, int width, int height)
{
@ -280,10 +271,7 @@ namespace Server.Gumps
{
public static readonly IComparer<BaseHouse> Instance = new HouseComparer();
public int Compare(BaseHouse x, BaseHouse y)
{
return x.BuiltOn.CompareTo(y.BuiltOn);
}
public int Compare(BaseHouse x, BaseHouse y) => x.BuiltOn.CompareTo(y.BuiltOn);
}
}
}

View file

@ -1,55 +1,55 @@
namespace Server.Gumps
{
public delegate void WarningGumpCallback( bool okay );
public delegate void WarningGumpCallback( bool okay );
public class WarningGump : Gump
{
private WarningGumpCallback m_Callback;
public class WarningGump : Gump
{
private WarningGumpCallback m_Callback;
public WarningGump( int header, int headerColor, object content, int contentColor, int width, int height, WarningGumpCallback callback = null, bool cancelButton = true) : base( (640 - width) / 2, (480 - height) / 2 )
{
m_Callback = callback;
public WarningGump( int header, int headerColor, object content, int contentColor, int width, int height, WarningGumpCallback callback = null, bool cancelButton = true) : base( (640 - width) / 2, (480 - height) / 2 )
{
m_Callback = callback;
Closable = false;
Closable = false;
AddPage( 0 );
AddPage( 0 );
AddBackground( 0, 0, width, height, 5054 );
AddBackground( 0, 0, width, height, 5054 );
AddImageTiled( 10, 10, width - 20, 20, 2624 );
AddAlphaRegion( 10, 10, width - 20, 20 );
AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor );
AddImageTiled( 10, 10, width - 20, 20, 2624 );
AddAlphaRegion( 10, 10, width - 20, 20 );
AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor );
AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
AddAlphaRegion( 10, 40, width - 20, height - 80 );
AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
AddAlphaRegion( 10, 40, width - 20, height - 80 );
if ( content is int i )
AddHtmlLocalized( 10, 40, width - 20, height - 80, i, contentColor, false, true );
else if ( content is string )
AddHtml( 10, 40, width - 20, height - 80, $"<BASEFONT COLOR=#{contentColor:X6}>{content}</BASEFONT>", false, true );
if ( content is int i )
AddHtmlLocalized( 10, 40, width - 20, height - 80, i, contentColor, false, true );
else if ( content is string )
AddHtml( 10, 40, width - 20, height - 80, $"<BASEFONT COLOR=#{contentColor:X6}>{content}</BASEFONT>", false, true );
AddImageTiled( 10, height - 30, width - 20, 20, 2624 );
AddAlphaRegion( 10, height - 30, width - 20, 20 );
AddImageTiled( 10, height - 30, width - 20, 20, 2624 );
AddAlphaRegion( 10, height - 30, width - 20, 20 );
AddButton( 10, height - 30, 4005, 4007, 1 );
AddHtmlLocalized( 40, height - 30, 170, 20, 1011036, 32767 ); // OKAY
AddButton( 10, height - 30, 4005, 4007, 1 );
AddHtmlLocalized( 40, height - 30, 170, 20, 1011036, 32767 ); // OKAY
if ( cancelButton )
{
AddButton( 10 + ((width - 20) / 2), height - 30, 4005, 4007, 0 );
AddHtmlLocalized( 40 + ((width - 20) / 2), height - 30, 170, 20, 1011012, 32767 ); // CANCEL
}
}
if ( cancelButton )
{
AddButton( 10 + ((width - 20) / 2), height - 30, 4005, 4007, 0 );
AddHtmlLocalized( 40 + ((width - 20) / 2), height - 30, 170, 20, 1011012, 32767 ); // CANCEL
}
}
public override void OnResponse( Network.NetState sender, RelayInfo info )
{
if (m_Callback == null)
return;
public override void OnResponse( Network.NetState sender, RelayInfo info )
{
if (m_Callback == null)
return;
if ( info.ButtonID == 1)
m_Callback( true );
else
m_Callback.Invoke( false );
}
}
if ( info.ButtonID == 1)
m_Callback( true );
else
m_Callback.Invoke( false );
}
}
}

View file

@ -6,287 +6,287 @@ using Server.Network;
namespace Server.Gumps
{
public class WhoGump : Gump
{
public static void Initialize()
{
CommandSystem.Register( "Who", AccessLevel.Counselor, WhoList_OnCommand );
CommandSystem.Register( "WhoList", AccessLevel.Counselor, WhoList_OnCommand );
}
public class WhoGump : Gump
{
public static void Initialize()
{
CommandSystem.Register( "Who", AccessLevel.Counselor, WhoList_OnCommand );
CommandSystem.Register( "WhoList", AccessLevel.Counselor, WhoList_OnCommand );
}
[Usage( "WhoList [filter]" )]
[Aliases( "Who" )]
[Description( "Lists all connected clients. Optionally filters results by name." )]
private static void WhoList_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new WhoGump( e.Mobile, e.ArgString ) );
}
[Usage( "WhoList [filter]" )]
[Aliases( "Who" )]
[Description( "Lists all connected clients. Optionally filters results by name." )]
private static void WhoList_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new WhoGump( e.Mobile, e.ArgString ) );
}
public static bool OldStyle = PropsConfig.OldStyle;
public static bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static bool PrevLabel = false, NextLabel = false;
private static bool PrevLabel = false, NextLabel = false;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private static readonly int EntryWidth = 180;
private static readonly int EntryCount = 15;
private static readonly int EntryWidth = 180;
private static readonly int EntryCount = 15;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 1));
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 1));
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private Mobile m_Owner;
private List<Mobile> m_Mobiles;
private int m_Page;
private Mobile m_Owner;
private List<Mobile> m_Mobiles;
private int m_Page;
private class InternalComparer : IComparer<Mobile>
{
public static readonly IComparer<Mobile> Instance = new InternalComparer();
private class InternalComparer : IComparer<Mobile>
{
public static readonly IComparer<Mobile> Instance = new InternalComparer();
public InternalComparer()
{
}
public InternalComparer()
{
}
public int Compare( Mobile x, Mobile y )
{
if ( x == null || y == null )
throw new ArgumentException();
public int Compare( Mobile x, Mobile y )
{
if ( x == null || y == null )
throw new ArgumentException();
if ( x.AccessLevel > y.AccessLevel )
return -1;
if ( x.AccessLevel < y.AccessLevel )
return 1;
return Insensitive.Compare( x.Name, y.Name );
}
}
if ( x.AccessLevel > y.AccessLevel )
return -1;
if ( x.AccessLevel < y.AccessLevel )
return 1;
return Insensitive.Compare( x.Name, y.Name );
}
}
public WhoGump(Mobile owner, string filter) : this(owner, BuildList( owner, filter ))
{
}
public WhoGump(Mobile owner, string filter) : this(owner, BuildList( owner, filter ))
{
}
public WhoGump(Mobile owner, List<Mobile> list, int page = 0) : base(GumpOffsetX, GumpOffsetY)
{
owner.CloseGump<WhoGump>();
public WhoGump(Mobile owner, List<Mobile> list, int page = 0) : base(GumpOffsetX, GumpOffsetY)
{
owner.CloseGump<WhoGump>();
m_Owner = owner;
m_Mobiles = list;
m_Owner = owner;
m_Mobiles = list;
Initialize( page );
}
Initialize( page );
}
public static List<Mobile> BuildList(Mobile owner, string rawFilter)
{
string filter = String.IsNullOrWhiteSpace(rawFilter) ? null : rawFilter.Trim().ToLower();
public static List<Mobile> BuildList(Mobile owner, string rawFilter)
{
string filter = String.IsNullOrWhiteSpace(rawFilter) ? null : rawFilter.Trim().ToLower();
List<Mobile> list = new List<Mobile>();
List<NetState> states = NetState.Instances;
List<Mobile> list = new List<Mobile>();
List<NetState> states = NetState.Instances;
for ( int i = 0; i < states.Count; ++i )
{
Mobile m = states[i].Mobile;
for ( int i = 0; i < states.Count; ++i )
{
Mobile m = states[i].Mobile;
if ( m != null && (m == owner || !m.Hidden || owner.AccessLevel >= m.AccessLevel || m is PlayerMobile mobile && mobile.VisibilityList.Contains( owner ) ) )
{
if ( filter != null && !(m.Name?.ToLower().IndexOf(filter) >= 0) )
continue;
if ( m != null && (m == owner || !m.Hidden || owner.AccessLevel >= m.AccessLevel || m is PlayerMobile mobile && mobile.VisibilityList.Contains( owner ) ) )
{
if ( filter != null && !(m.Name?.ToLower().IndexOf(filter) >= 0) )
continue;
list.Add( m );
}
}
list.Add( m );
}
}
list.Sort( InternalComparer.Instance );
list.Sort( InternalComparer.Instance );
return list;
}
return list;
}
public void Initialize( int page )
{
m_Page = page;
public void Initialize( int page )
{
m_Page = page;
int count = m_Mobiles.Count - page * EntryCount;
int count = m_Mobiles.Count - page * EntryCount;
if ( count < 0 )
count = 0;
else if ( count > EntryCount )
count = EntryCount;
if ( count < 0 )
count = 0;
else if ( count > EntryCount )
count = EntryCount;
int totalHeight = OffsetSize + (EntryHeight + OffsetSize) * (count + 1);
int totalHeight = OffsetSize + (EntryHeight + OffsetSize) * (count + 1);
AddPage( 0 );
AddPage( 0 );
AddBackground( 0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID );
AddImageTiled( BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight, OffsetGumpID );
AddBackground( 0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID );
AddImageTiled( BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight, OffsetGumpID );
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4) - (OldStyle ? SetWidth + OffsetSize : 0);
int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4) - (OldStyle ? SetWidth + OffsetSize : 0);
if ( !OldStyle )
AddImageTiled( x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID );
if ( !OldStyle )
AddImageTiled( x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID );
AddLabel( x + TextOffsetX, y, TextHue,
$"Page {page + 1} of {(m_Mobiles.Count + EntryCount - 1) / EntryCount} ({m_Mobiles.Count})");
AddLabel( x + TextOffsetX, y, TextHue,
$"Page {page + 1} of {(m_Mobiles.Count + EntryCount - 1) / EntryCount} ({m_Mobiles.Count})");
x += emptyWidth + OffsetSize;
x += emptyWidth + OffsetSize;
if ( OldStyle )
AddImageTiled( x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID );
else
AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );
if ( OldStyle )
AddImageTiled( x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID );
else
AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );
if ( page > 0 )
{
AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1 );
if ( page > 0 )
{
AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1 );
if ( PrevLabel )
AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous" );
}
if ( PrevLabel )
AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous" );
}
x += PrevWidth + OffsetSize;
x += PrevWidth + OffsetSize;
if ( !OldStyle )
AddImageTiled( x, y, NextWidth, EntryHeight, HeaderGumpID );
if ( !OldStyle )
AddImageTiled( x, y, NextWidth, EntryHeight, HeaderGumpID );
if ( (page + 1) * EntryCount < m_Mobiles.Count )
{
AddButton( x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1 );
if ( (page + 1) * EntryCount < m_Mobiles.Count )
{
AddButton( x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1 );
if ( NextLabel )
AddLabel( x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next" );
}
if ( NextLabel )
AddLabel( x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next" );
}
for ( int i = 0, index = page * EntryCount; i < EntryCount && index < m_Mobiles.Count; ++i, ++index )
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
for ( int i = 0, index = page * EntryCount; i < EntryCount && index < m_Mobiles.Count; ++i, ++index )
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
Mobile m = m_Mobiles[index];
Mobile m = m_Mobiles[index];
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, GetHueFor( m ), m.Deleted ? "(deleted)" : m.Name );
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, GetHueFor( m ), m.Deleted ? "(deleted)" : m.Name );
x += EntryWidth + OffsetSize;
x += EntryWidth + OffsetSize;
if ( SetGumpID != 0 )
AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );
if ( SetGumpID != 0 )
AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );
if ( m.NetState != null && !m.Deleted )
AddButton( x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 3 );
}
}
if ( m.NetState != null && !m.Deleted )
AddButton( x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 3 );
}
}
private static int GetHueFor( Mobile m )
{
switch ( m.AccessLevel )
{
case AccessLevel.Owner:
case AccessLevel.Developer:
case AccessLevel.Administrator: return 0x516;
case AccessLevel.Seer: return 0x144;
case AccessLevel.GameMaster: return 0x21;
case AccessLevel.Counselor: return 0x2;
default:
{
return m.Kills >= 5 ? 0x21 : m.Criminal ? 0x3B1 : 0x58;
}
}
}
private static int GetHueFor( Mobile m )
{
switch ( m.AccessLevel )
{
case AccessLevel.Owner:
case AccessLevel.Developer:
case AccessLevel.Administrator: return 0x516;
case AccessLevel.Seer: return 0x144;
case AccessLevel.GameMaster: return 0x21;
case AccessLevel.Counselor: return 0x2;
default:
{
return m.Kills >= 5 ? 0x21 : m.Criminal ? 0x3B1 : 0x58;
}
}
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
switch ( info.ButtonID )
{
case 0: // Closed
{
return;
}
case 1: // Previous
{
if ( m_Page > 0 )
from.SendGump( new WhoGump( from, m_Mobiles, m_Page - 1 ) );
switch ( info.ButtonID )
{
case 0: // Closed
{
return;
}
case 1: // Previous
{
if ( m_Page > 0 )
from.SendGump( new WhoGump( from, m_Mobiles, m_Page - 1 ) );
break;
}
case 2: // Next
{
if ( (m_Page + 1) * EntryCount < m_Mobiles.Count )
from.SendGump( new WhoGump( from, m_Mobiles, m_Page + 1 ) );
break;
}
case 2: // Next
{
if ( (m_Page + 1) * EntryCount < m_Mobiles.Count )
from.SendGump( new WhoGump( from, m_Mobiles, m_Page + 1 ) );
break;
}
default:
{
int index = m_Page * EntryCount + (info.ButtonID - 3);
break;
}
default:
{
int index = m_Page * EntryCount + (info.ButtonID - 3);
if ( index >= 0 && index < m_Mobiles.Count )
{
Mobile m = m_Mobiles[index];
if ( index >= 0 && index < m_Mobiles.Count )
{
Mobile m = m_Mobiles[index];
if ( m.Deleted )
{
from.SendMessage( "That player has deleted their character." );
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
}
else if ( m.NetState == null )
{
from.SendMessage( "That player is no longer online." );
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
}
else if ( m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || m is PlayerMobile mobile && mobile.VisibilityList.Contains( from ))
{
from.SendGump( new ClientGump( from, m.NetState ) );
}
else
{
from.SendMessage( "You cannot see them." );
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
}
}
if ( m.Deleted )
{
from.SendMessage( "That player has deleted their character." );
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
}
else if ( m.NetState == null )
{
from.SendMessage( "That player is no longer online." );
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
}
else if ( m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || m is PlayerMobile mobile && mobile.VisibilityList.Contains( from ))
{
from.SendGump( new ClientGump( from, m.NetState ) );
}
else
{
from.SendMessage( "You cannot see them." );
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
}
}
break;
}
}
}
}
break;
}
}
}
}
}

View file

@ -3,91 +3,91 @@ using Server.Accounting;
namespace Server.Gumps
{
public class YoungDungeonWarning : Gump
{
public YoungDungeonWarning() : base( 150, 200 )
{
AddBackground( 0, 0, 250, 170, 0xA28 );
public class YoungDungeonWarning : Gump
{
public YoungDungeonWarning() : base( 150, 200 )
{
AddBackground( 0, 0, 250, 170, 0xA28 );
AddHtmlLocalized( 20, 43, 215, 70, 1018030, true, true ); // Warning: monsters may attack you on site down here in the dungeons!
AddHtmlLocalized( 20, 43, 215, 70, 1018030, true, true ); // Warning: monsters may attack you on site down here in the dungeons!
AddButton( 70, 123, 0xFA5, 0xFA7, 0);
AddHtmlLocalized( 105, 125, 100, 35, 1011036 ); // OKAY
}
}
AddButton( 70, 123, 0xFA5, 0xFA7, 0);
AddHtmlLocalized( 105, 125, 100, 35, 1011036 ); // OKAY
}
}
public class YoungDeathNotice : Gump
{
public YoungDeathNotice() : base( 100, 15 )
{
Closable = false;
public class YoungDeathNotice : Gump
{
public YoungDeathNotice() : base( 100, 15 )
{
Closable = false;
AddBackground( 25, 10, 425, 444, 0x13BE );
AddBackground( 25, 10, 425, 444, 0x13BE );
AddImageTiled( 33, 20, 407, 425, 0xA40 );
AddAlphaRegion( 33, 20, 407, 425 );
AddImageTiled( 33, 20, 407, 425, 0xA40 );
AddAlphaRegion( 33, 20, 407, 425 );
AddHtmlLocalized( 190, 24, 120, 20, 1046287, 0x7D00 ); // You have died.
AddHtmlLocalized( 190, 24, 120, 20, 1046287, 0x7D00 ); // You have died.
// As a ghost you cannot interact with the world. You cannot touch items nor can you use them.
AddHtmlLocalized( 50, 50, 380, 40, 1046288, 0xFFFFFF );
// You can pass through doors as though they do not exist. However, you cannot pass through walls.
AddHtmlLocalized( 50, 100, 380, 45, 1046289, 0xFFFFFF );
// Since you are a new player, any items you had on your person at the time of your death will be in your backpack upon resurrection.
AddHtmlLocalized( 50, 140, 380, 60, 1046291, 0xFFFFFF );
// To be resurrected you must find a healer in town or wandering in the wilderness. Some powerful players may also be able to resurrect you.
AddHtmlLocalized( 50, 204, 380, 65, 1046292, 0xFFFFFF );
// While you are still in young status, you will be transported to the nearest healer (along with your items) at the time of your death.
AddHtmlLocalized( 50, 269, 380, 65, 1046293, 0xFFFFFF );
// To rejoin the world of the living simply walk near one of the NPC healers, and they will resurrect you as long as you are not marked as a criminal.
AddHtmlLocalized( 50, 334, 380, 70, 1046294, 0xFFFFFF );
// As a ghost you cannot interact with the world. You cannot touch items nor can you use them.
AddHtmlLocalized( 50, 50, 380, 40, 1046288, 0xFFFFFF );
// You can pass through doors as though they do not exist. However, you cannot pass through walls.
AddHtmlLocalized( 50, 100, 380, 45, 1046289, 0xFFFFFF );
// Since you are a new player, any items you had on your person at the time of your death will be in your backpack upon resurrection.
AddHtmlLocalized( 50, 140, 380, 60, 1046291, 0xFFFFFF );
// To be resurrected you must find a healer in town or wandering in the wilderness. Some powerful players may also be able to resurrect you.
AddHtmlLocalized( 50, 204, 380, 65, 1046292, 0xFFFFFF );
// While you are still in young status, you will be transported to the nearest healer (along with your items) at the time of your death.
AddHtmlLocalized( 50, 269, 380, 65, 1046293, 0xFFFFFF );
// To rejoin the world of the living simply walk near one of the NPC healers, and they will resurrect you as long as you are not marked as a criminal.
AddHtmlLocalized( 50, 334, 380, 70, 1046294, 0xFFFFFF );
AddButton( 195, 410, 0xF8, 0xF9, 0);
}
}
AddButton( 195, 410, 0xF8, 0xF9, 0);
}
}
public class RenounceYoungGump : Gump
{
public RenounceYoungGump() : base( 150, 50 )
{
AddBackground( 0, 0, 450, 400, 0xA28 );
public class RenounceYoungGump : Gump
{
public RenounceYoungGump() : base( 150, 50 )
{
AddBackground( 0, 0, 450, 400, 0xA28 );
AddHtmlLocalized( 0, 30, 450, 35, 1013004 ); // <center> Renouncing 'Young Player' Status</center>
AddHtmlLocalized( 0, 30, 450, 35, 1013004 ); // <center> Renouncing 'Young Player' Status</center>
/* As a 'Young' player, you are currently under a system of protection that prevents
* you from being attacked by other players and certain monsters.<br><br>
*
* If you choose to renounce your status as a 'Young' player, you will lose this protection.
* You will become vulnerable to other players, and many monsters that had only glared
* at you menacingly before will now attack you on sight!<br><br>
*
* Select OKAY now if you wish to renounce your status as a 'Young' player, otherwise
* press CANCEL.
*/
AddHtmlLocalized( 30, 70, 390, 210, 1013005, true, true );
/* As a 'Young' player, you are currently under a system of protection that prevents
* you from being attacked by other players and certain monsters.<br><br>
*
* If you choose to renounce your status as a 'Young' player, you will lose this protection.
* You will become vulnerable to other players, and many monsters that had only glared
* at you menacingly before will now attack you on sight!<br><br>
*
* Select OKAY now if you wish to renounce your status as a 'Young' player, otherwise
* press CANCEL.
*/
AddHtmlLocalized( 30, 70, 390, 210, 1013005, true, true );
AddButton( 45, 298, 0xFA5, 0xFA7, 1);
AddHtmlLocalized( 78, 300, 100, 35, 1011036 ); // OKAY
AddButton( 45, 298, 0xFA5, 0xFA7, 1);
AddHtmlLocalized( 78, 300, 100, 35, 1011036 ); // OKAY
AddButton( 178, 298, 0xFA5, 0xFA7, 0);
AddHtmlLocalized( 211, 300, 100, 35, 1011012 ); // CANCEL
}
AddButton( 178, 298, 0xFA5, 0xFA7, 0);
AddHtmlLocalized( 211, 300, 100, 35, 1011012 ); // CANCEL
}
public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
if ( info.ButtonID == 1 )
{
if ( from.Account is Account acc )
{
acc.RemoveYoungStatus( 502085 ); // You have chosen to renounce your `Young' player status.
}
}
else
{
from.SendLocalizedMessage( 502086 ); // You have chosen not to renounce your `Young' player status.
}
}
}
if ( info.ButtonID == 1 )
{
if ( from.Account is Account acc )
{
acc.RemoveYoungStatus( 502085 ); // You have chosen to renounce your `Young' player status.
}
}
else
{
from.SendLocalizedMessage( 502086 ); // You have chosen not to renounce your `Young' player status.
}
}
}
}