Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -13,7 +13,7 @@ namespace Server.Engines.Help
{
public class ContainedMenu : QuestionMenu
{
private Mobile m_From;
private readonly Mobile m_From;
public ContainedMenu(Mobile from) : base(
"You already have an open help request. We will have someone assist you as soon as possible. What would you like to do?",
@ -141,50 +141,54 @@ namespace Server.Engines.Help
AddPage(3);
AddButton(80, 90, 5540, 5541, 7);
/* <U><CENTER>Another player is harassing me (or Exploiting).</CENTER></U><BR>
* VERBAL HARASSMENT<BR>
* Use this option when another player is verbally harassing your character.
* Verbal harassment behaviors include but are not limited to, using bad language, threats etc..
* Before you submit a complaint be sure you understand what constitutes harassment
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=40"><EFBFBD> what is verbal harassment? -</A>
* and that you have followed these steps:<BR>
* 1. You have asked the player to stop and they have continued.<BR>
* 2. You have tried to remove yourself from the situation.<BR>
* 3. You have done nothing to instigate or further encourage the harassment.<BR>
* 4. You have added the player to your ignore list.
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=138">- How do I ignore a player?</A><BR>
* 5. You have read and understand Origin<EFBFBD>s definition of harassment.<BR>
* 6. Your account information is up to date. (Including a current email address)<BR>
* *If these steps have not been taken, GMs may be unable to take action against the offending player.<BR>
* **A chat log will be review by a GM to assess the validity of this complaint.
* Abuse of this system is a violation of the Rules of Conduct.<BR>
* EXPLOITING<BR>
* Use this option to report someone who may be exploiting or cheating.
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=41"><EFBFBD> What constitutes an exploit?</a>
*/
AddHtmlLocalized(110, 90, 450, 145, 1062572, true,
true); /* <U><CENTER>Another player is harassing me (or Exploiting).</CENTER></U><BR>
* VERBAL HARASSMENT<BR>
* Use this option when another player is verbally harassing your character.
* Verbal harassment behaviors include but are not limited to, using bad language, threats etc..
* Before you submit a complaint be sure you understand what constitutes harassment
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=40"><EFBFBD> what is verbal harassment? -</A>
* and that you have followed these steps:<BR>
* 1. You have asked the player to stop and they have continued.<BR>
* 2. You have tried to remove yourself from the situation.<BR>
* 3. You have done nothing to instigate or further encourage the harassment.<BR>
* 4. You have added the player to your ignore list.
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=138">- How do I ignore a player?</A><BR>
* 5. You have read and understand Origin<EFBFBD>s definition of harassment.<BR>
* 6. Your account information is up to date. (Including a current email address)<BR>
* *If these steps have not been taken, GMs may be unable to take action against the offending player.<BR>
* **A chat log will be review by a GM to assess the validity of this complaint.
* Abuse of this system is a violation of the Rules of Conduct.<BR>
* EXPLOITING<BR>
* Use this option to report someone who may be exploiting or cheating.
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=41"><EFBFBD> What constitutes an exploit?</a>
*/
true);
AddButton(80, 240, 5540, 5541, 8);
/* <U><CENTER>Another player is harassing me using game mechanics.</CENTER></U><BR>
* <BR>
* PHYSICAL HARASSMENT<BR>
* Use this option when another player is harassing your character using game mechanics.
* Physical harassment includes but is not limited to luring, Kill Stealing, and any act that causes a players death in Trammel.
* Before you submit a complaint be sure you understand what constitutes harassment
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=59"> <EFBFBD> what is physical harassment?</A>
* and that you have followed these steps:<BR>
* 1. You have asked the player to stop and they have continued.<BR>
* 2. You have tried to remove yourself from the situation.<BR>
* 3. You have done nothing to instigate or further encourage the harassment.<BR>
* 4. You have added the player to your ignore list.
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=138"> - how do I ignore a player?</A><BR>
* 5. You have read and understand Origin<EFBFBD>s definition of harassment.<BR>
* 6. Your account information is up to date. (Including a current email address)<BR>
* *If these steps have not been taken, GMs may be unable to take action against the offending player.<BR>
* **This issue will be reviewed by a GM to assess the validity of this complaint.
* Abuse of this system is a violation of the Rules of Conduct.
*/
AddHtmlLocalized(110, 240, 450, 145, 1062573, true,
true); /* <U><CENTER>Another player is harassing me using game mechanics.</CENTER></U><BR>
* <BR>
* PHYSICAL HARASSMENT<BR>
* Use this option when another player is harassing your character using game mechanics.
* Physical harassment includes but is not limited to luring, Kill Stealing, and any act that causes a players death in Trammel.
* Before you submit a complaint be sure you understand what constitutes harassment
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=59"> <EFBFBD> what is physical harassment?</A>
* and that you have followed these steps:<BR>
* 1. You have asked the player to stop and they have continued.<BR>
* 2. You have tried to remove yourself from the situation.<BR>
* 3. You have done nothing to instigate or further encourage the harassment.<BR>
* 4. You have added the player to your ignore list.
* <A HREF="http://uo.custhelp.com/cgi-bin/uo.cfg/php/enduser/std_adp.php?p_faqid=138"> - how do I ignore a player?</A><BR>
* 5. You have read and understand Origin<EFBFBD>s definition of harassment.<BR>
* 6. Your account information is up to date. (Including a current email address)<BR>
* *If these steps have not been taken, GMs may be unable to take action against the offending player.<BR>
* **This issue will be reviewed by a GM to assess the validity of this complaint.
* Abuse of this system is a violation of the Rules of Conduct.
*/
true);
AddButton(150, 390, 5540, 5541, 0, GumpButtonType.Page, 1);
AddHtmlLocalized(180, 390, 335, 40, 1001015); // NO - I meant to ask for help with another matter.
@ -232,93 +236,93 @@ namespace Server.Engines.Help
switch (info.ButtonID)
{
case 0: // Close/Cancel
{
from.SendLocalizedMessage(501235, "", 0x35); // Help request aborted.
{
from.SendLocalizedMessage(501235, "", 0x35); // Help request aborted.
break;
}
break;
}
case 1: // General question
{
type = PageType.Question;
break;
}
{
type = PageType.Question;
break;
}
case 2: // Stuck
{
BaseHouse house = BaseHouse.FindHouseAt(from);
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house?.IsAosRules == true && !from.Region.IsPartOf<SafeZone>()) // Dueling
{
from.Location = house.BanLocation;
}
else if (from.Region.IsPartOf<Jail>())
{
from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
}
else if (Sigil.ExistsOn(from))
{
from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (from is PlayerMobile mobile && mobile.CanUseStuckMenu() &&
mobile.Region.CanUseStuckMenu(mobile) && !CheckCombat(mobile) && !mobile.Frozen &&
!mobile.Criminal && (Core.AOS || mobile.Kills < 5))
{
StuckMenu menu = new StuckMenu(mobile, mobile, true);
menu.BeginClose();
mobile.SendGump(menu);
}
else
{
type = PageType.Stuck;
}
break;
}
case 3: // Report bug or contact Origin
{
type = PageType.Bug;
break;
}
case 4: // Game suggestion
{
type = PageType.Suggestion;
break;
}
case 5: // Account management
{
type = PageType.Account;
break;
}
case 6: // Other
{
type = PageType.Other;
break;
}
case 7: // Harassment: verbal/exploit
{
type = PageType.VerbalHarassment;
break;
}
case 8: // Harassment: physical
{
type = PageType.PhysicalHarassment;
break;
}
case 9: // Young player transport
{
if (IsYoung(from))
{
if (from.Region.IsPartOf<Jail>())
if (house?.IsAosRules == true && !from.Region.IsPartOf<SafeZone>()) // Dueling
{
from.Location = house.BanLocation;
}
else if (from.Region.IsPartOf<Jail>())
{
from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
else if (from.Region.IsPartOf("Haven Island"))
from.SendLocalizedMessage(1041529); // You're already in Haven
else
from.MoveToWorld(new Point3D(3503, 2574, 14), Map.Trammel);
}
}
else if (Sigil.ExistsOn(from))
{
from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (from is PlayerMobile mobile && mobile.CanUseStuckMenu() &&
mobile.Region.CanUseStuckMenu(mobile) && !CheckCombat(mobile) && !mobile.Frozen &&
!mobile.Criminal && (Core.AOS || mobile.Kills < 5))
{
StuckMenu menu = new StuckMenu(mobile, mobile, true);
break;
}
menu.BeginClose();
mobile.SendGump(menu);
}
else
{
type = PageType.Stuck;
}
break;
}
case 3: // Report bug or contact Origin
{
type = PageType.Bug;
break;
}
case 4: // Game suggestion
{
type = PageType.Suggestion;
break;
}
case 5: // Account management
{
type = PageType.Account;
break;
}
case 6: // Other
{
type = PageType.Other;
break;
}
case 7: // Harassment: verbal/exploit
{
type = PageType.VerbalHarassment;
break;
}
case 8: // Harassment: physical
{
type = PageType.PhysicalHarassment;
break;
}
case 9: // Young player transport
{
if (IsYoung(from))
{
if (from.Region.IsPartOf<Jail>())
from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
else if (from.Region.IsPartOf("Haven Island"))
from.SendLocalizedMessage(1041529); // You're already in Haven
else
from.MoveToWorld(new Point3D(3503, 2574, 14), Map.Trammel);
}
break;
}
}
if (type != (PageType)(-1) && PageQueue.CheckAllowedToPage(from))

View file

@ -4,7 +4,7 @@ namespace Server.Engines.Help
{
public class PagePrompt : Prompt
{
private PageType m_Type;
private readonly PageType m_Type;
public PagePrompt(PageType type) => m_Type = type;
@ -15,12 +15,12 @@ namespace Server.Engines.Help
public override void OnResponse(Mobile from, string text)
{
from.SendLocalizedMessage(501234, "",
0x35); /* The next available Counselor/Game Master will respond as soon as possible.
* Please check your Journal for messages every few minutes.
*/
/* The next available Counselor/Game Master will respond as soon as possible.
* Please check your Journal for messages every few minutes.
*/
from.SendLocalizedMessage(501234, "", 0x35);
PageQueue.Enqueue(new PageEntry(from, text, m_Type));
}
}
}
}

View file

@ -5,8 +5,8 @@ namespace Server.Engines.Help
{
public class PagePromptGump : Gump
{
private Mobile m_From;
private PageType m_Type;
private readonly Mobile m_From;
private readonly PageType m_Type;
public PagePromptGump(Mobile from, PageType type) : base(0, 0)
{
@ -47,10 +47,10 @@ namespace Server.Engines.Help
}
else
{
m_From.SendLocalizedMessage(501234, "",
0x35); /* The next available Counselor/Game Master will respond as soon as possible.
* Please check your Journal for messages every few minutes.
*/
/* The next available Counselor/Game Master will respond as soon as possible.
* Please check your Journal for messages every few minutes.
*/
m_From.SendLocalizedMessage(501234, "", 0x35);
PageQueue.Enqueue(new PageEntry(m_From, text, m_Type));
}

View file

@ -79,9 +79,9 @@ namespace Server.Engines.Help
private class InternalTimer : Timer
{
private static TimeSpan StatusDelay = TimeSpan.FromMinutes(2.0);
private static readonly TimeSpan StatusDelay = TimeSpan.FromMinutes(2.0);
private PageEntry m_Entry;
private readonly PageEntry m_Entry;
public InternalTimer(PageEntry entry) : base(TimeSpan.FromSeconds(1.0), StatusDelay) => m_Entry = entry;
@ -112,8 +112,8 @@ namespace Server.Engines.Help
public class PageQueue
{
private static Dictionary<Mobile, PageEntry> m_KeyedByHandler = new Dictionary<Mobile, PageEntry>();
private static Dictionary<Mobile, PageEntry> m_KeyedBySender = new Dictionary<Mobile, PageEntry>();
private static readonly Dictionary<Mobile, PageEntry> m_KeyedByHandler = new Dictionary<Mobile, PageEntry>();
private static readonly Dictionary<Mobile, PageEntry> m_KeyedBySender = new Dictionary<Mobile, PageEntry>();
public static List<PageEntry> List { get; } = new List<PageEntry>();
@ -204,7 +204,6 @@ namespace Server.Engines.Help
Remove(GetEntry(sender));
}
public static void Enqueue(PageEntry entry)
{
List.Add(entry);
@ -231,6 +230,5 @@ namespace Server.Engines.Help
if (Email.FROM_ADDRESS != null && Email.SPEECH_LOG_PAGE_ADDRESS != null && entry.SpeechLog != null)
Email.SendQueueEmail(entry, GetPageTypeName(entry.Type));
}
}
}

View file

@ -8,8 +8,9 @@ namespace Server.Engines.Help
{
public class MessageSentGump : Gump
{
private Mobile m_Mobile;
private string m_Name, m_Text;
private readonly Mobile m_Mobile;
private readonly string m_Name;
private readonly string m_Text;
public MessageSentGump(Mobile mobile, string name, string text) : base(30, 30)
{
@ -36,19 +37,19 @@ namespace Server.Engines.Help
{
m_Mobile.SendGump(new PageResponseGump(m_Mobile, m_Name, m_Text));
//m_Mobile.SendMessage( 0x482, "{0} tells you:", m_Name );
//m_Mobile.SendMessage( 0x482, m_Text );
// m_Mobile.SendMessage( 0x482, "{0} tells you:", m_Name );
// m_Mobile.SendMessage( 0x482, m_Text );
}
}
public class PageQueueGump : Gump
{
private PageEntry[] m_List;
private readonly PageEntry[] m_List;
public PageQueueGump() : base(30, 30)
{
Add(new GumpPage(0));
//Add( new GumpBackground( 0, 0, 410, 448, 9200 ) );
// Add( new GumpBackground( 0, 0, 410, 448, 9200 ) );
Add(new GumpImageTiled(0, 0, 410, 448, 0xA40));
Add(new GumpAlphaRegion(1, 1, 408, 446));
@ -56,7 +57,7 @@ namespace Server.Engines.Help
List<PageEntry> list = PageQueue.List;
for (int i = 0;i < list.Count;)
for (int i = 0; i < list.Count;)
{
PageEntry e = list[i];
@ -127,11 +128,11 @@ namespace Server.Engines.Help
Message = message;
}
public string Title{ get; set; }
public string Title { get; set; }
public string Message{ get; set; }
public string Message { get; set; }
public static List<PredefinedResponse> List{ get; private set; } = Load();
public static List<PredefinedResponse> List { get; private set; } = Load();
public static PredefinedResponse Add(string title, string message)
{
@ -203,8 +204,8 @@ namespace Server.Engines.Help
{
private const int LabelColor32 = 0xFFFFFF;
private Mobile m_From;
private PredefinedResponse m_Response;
private readonly Mobile m_From;
private readonly PredefinedResponse m_Response;
public PredefGump(Mobile from, PredefinedResponse response) : base(30, 30)
{
@ -343,36 +344,36 @@ namespace Server.Engines.Help
switch (type)
{
case 0: // edit
{
m_From.SendGump(new PredefGump(m_From, resp));
break;
}
{
m_From.SendGump(new PredefGump(m_From, resp));
break;
}
case 1: // move up
{
if (index > 0)
{
list.RemoveAt(index);
list.Insert(index - 1, resp);
if (index > 0)
{
list.RemoveAt(index);
list.Insert(index - 1, resp);
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, null));
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, null));
}
break;
}
break;
}
case 2: // move down
{
if (index < list.Count - 1)
{
list.RemoveAt(index);
list.Insert(index + 1, resp);
if (index < list.Count - 1)
{
list.RemoveAt(index);
list.Insert(index + 1, resp);
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, null));
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, null));
}
break;
}
break;
}
}
}
}
@ -384,37 +385,37 @@ namespace Server.Engines.Help
switch (info.ButtonID)
{
case 1:
{
list.Remove(m_Response);
{
list.Remove(m_Response);
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, null));
break;
}
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, null));
break;
}
case 2:
{
TextRelay te = info.GetTextEntry(0);
{
TextRelay te = info.GetTextEntry(0);
if (te != null)
m_Response.Title = te.Text;
if (te != null)
m_Response.Title = te.Text;
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, m_Response));
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, m_Response));
break;
}
break;
}
case 3:
{
TextRelay te = info.GetTextEntry(1);
{
TextRelay te = info.GetTextEntry(1);
if (te != null)
m_Response.Message = te.Text;
if (te != null)
m_Response.Message = te.Text;
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, m_Response));
PredefinedResponse.Save();
m_From.SendGump(new PredefGump(m_From, m_Response));
break;
}
break;
}
}
}
}
@ -422,7 +423,7 @@ namespace Server.Engines.Help
public class PageEntryGump : Gump
{
private static int[] m_AccessLevelHues =
private static readonly int[] m_AccessLevelHues =
{
2100,
2122,
@ -433,8 +434,8 @@ namespace Server.Engines.Help
2415
};
private PageEntry m_Entry;
private Mobile m_Mobile;
private readonly PageEntry m_Entry;
private readonly Mobile m_Mobile;
public PageEntryGump(Mobile m, PageEntry entry) : base(30, 30)
{
@ -564,217 +565,217 @@ namespace Server.Engines.Help
switch (info.ButtonID)
{
case 0: // close
{
if (m_Entry.Handler != state.Mobile)
{
PageQueueGump g = new PageQueueGump();
if (m_Entry.Handler != state.Mobile)
{
PageQueueGump g = new PageQueueGump();
g.SendTo(state);
g.SendTo(state);
}
break;
}
break;
}
case 1: // go to sender
{
Mobile m = state.Mobile;
if (m_Entry.Sender.Deleted)
{
m.SendMessage("That character no longer exists.");
}
else if (m_Entry.Sender.Map == null || m_Entry.Sender.Map == Map.Internal)
{
m.SendMessage("That character is not in the world.");
}
else
{
// m_Entry.AddResponse(state.Mobile, "[Go Sender]");
m.MoveToWorld(m_Entry.Sender.Location, m_Entry.Sender.Map);
Mobile m = state.Mobile;
m.SendMessage("You have been teleported to that page's sender.");
Resend(state);
}
break;
}
case 2: // go to handler
{
Mobile m = state.Mobile;
Mobile h = m_Entry.Handler;
if (h != null)
{
if (h.Deleted)
if (m_Entry.Sender.Deleted)
{
m.SendMessage("That character no longer exists.");
}
else if (h.Map == null || h.Map == Map.Internal)
else if (m_Entry.Sender.Map == null || m_Entry.Sender.Map == Map.Internal)
{
m.SendMessage("That character is not in the world.");
}
else
{
// m_Entry.AddResponse(state.Mobile, "[Go Handler]");
m.MoveToWorld(h.Location, h.Map);
// m_Entry.AddResponse(state.Mobile, "[Go Sender]");
m.MoveToWorld(m_Entry.Sender.Location, m_Entry.Sender.Map);
m.SendMessage("You have been teleported to that page's sender.");
m.SendMessage("You have been teleported to that page's handler.");
Resend(state);
}
}
else
{
m.SendMessage("Nobody is handling that page.");
Resend(state);
}
break;
}
break;
}
case 2: // go to handler
{
Mobile m = state.Mobile;
Mobile h = m_Entry.Handler;
if (h != null)
{
if (h.Deleted)
{
m.SendMessage("That character no longer exists.");
}
else if (h.Map == null || h.Map == Map.Internal)
{
m.SendMessage("That character is not in the world.");
}
else
{
// m_Entry.AddResponse(state.Mobile, "[Go Handler]");
m.MoveToWorld(h.Location, h.Map);
m.SendMessage("You have been teleported to that page's handler.");
Resend(state);
}
}
else
{
m.SendMessage("Nobody is handling that page.");
Resend(state);
}
break;
}
case 3: // go to page location
{
Mobile m = state.Mobile;
if (m_Entry.PageMap == null || m_Entry.PageMap == Map.Internal)
{
m.SendMessage("That location is not in the world.");
Mobile m = state.Mobile;
if (m_Entry.PageMap == null || m_Entry.PageMap == Map.Internal)
{
m.SendMessage("That location is not in the world.");
}
else
{
// m_Entry.AddResponse(state.Mobile, "[Go PageLoc]");
m.MoveToWorld(m_Entry.PageLocation, m_Entry.PageMap);
state.Mobile.SendMessage("You have been teleported to the original page location.");
Resend(state);
}
break;
}
else
{
// m_Entry.AddResponse(state.Mobile, "[Go PageLoc]");
m.MoveToWorld(m_Entry.PageLocation, m_Entry.PageMap);
state.Mobile.SendMessage("You have been teleported to the original page location.");
Resend(state);
}
break;
}
case 4: // handle page
{
if (m_Entry.Handler == null)
{
// m_Entry.AddResponse(state.Mobile, "[Handling]");
m_Entry.Handler = state.Mobile;
if (m_Entry.Handler == null)
{
// m_Entry.AddResponse(state.Mobile, "[Handling]");
m_Entry.Handler = state.Mobile;
state.Mobile.SendMessage("You are now handling the page.");
state.Mobile.SendMessage("You are now handling the page.");
}
else
{
state.Mobile.SendMessage("Someone is already handling that page.");
}
Resend(state);
break;
}
else
{
state.Mobile.SendMessage("Someone is already handling that page.");
}
Resend(state);
break;
}
case 5: // delete page
{
if (m_Entry.Handler == null)
{
// m_Entry.AddResponse(state.Mobile, "[Deleting]");
PageQueue.Remove(m_Entry);
if (m_Entry.Handler == null)
{
// m_Entry.AddResponse(state.Mobile, "[Deleting]");
PageQueue.Remove(m_Entry);
state.Mobile.SendMessage("You delete the page.");
state.Mobile.SendMessage("You delete the page.");
PageQueueGump g = new PageQueueGump();
PageQueueGump g = new PageQueueGump();
g.SendTo(state);
g.SendTo(state);
}
else
{
state.Mobile.SendMessage("Someone is handling that page, it can not be deleted.");
Resend(state);
}
break;
}
else
{
state.Mobile.SendMessage("Someone is handling that page, it can not be deleted.");
Resend(state);
}
break;
}
case 6: // abandon page
{
if (m_Entry.Handler == state.Mobile)
{
// m_Entry.AddResponse(state.Mobile, "[Abandoning]");
state.Mobile.SendMessage("You abandon the page.");
if (m_Entry.Handler == state.Mobile)
{
// m_Entry.AddResponse(state.Mobile, "[Abandoning]");
state.Mobile.SendMessage("You abandon the page.");
m_Entry.Handler = null;
}
else
{
state.Mobile.SendMessage("You are not handling that page.");
}
Resend(state);
break;
}
case 7: // page handled
{
if (m_Entry.Handler == state.Mobile)
{
// m_Entry.AddResponse(state.Mobile, "[Handled]");
PageQueue.Remove(m_Entry);
m_Entry.Handler = null;
state.Mobile.SendMessage("You mark the page as handled, and remove it from the queue.");
PageQueueGump g = new PageQueueGump();
g.SendTo(state);
}
else
{
state.Mobile.SendMessage("You are not handling that page.");
m_Entry.Handler = null;
}
else
{
state.Mobile.SendMessage("You are not handling that page.");
}
Resend(state);
break;
}
case 7: // page handled
{
if (m_Entry.Handler == state.Mobile)
{
// m_Entry.AddResponse(state.Mobile, "[Handled]");
PageQueue.Remove(m_Entry);
break;
}
m_Entry.Handler = null;
state.Mobile.SendMessage("You mark the page as handled, and remove it from the queue.");
PageQueueGump g = new PageQueueGump();
g.SendTo(state);
}
else
{
state.Mobile.SendMessage("You are not handling that page.");
Resend(state);
}
break;
}
case 8: // Send message
{
TextRelay text = info.GetTextEntry(0);
{
TextRelay text = info.GetTextEntry(0);
if (text != null)
// m_Entry.AddResponse(state.Mobile, "[Response] " + text.Text);
m_Entry.Sender.SendGump(new MessageSentGump(m_Entry.Sender, state.Mobile.Name, text.Text));
//m_Entry.Sender.SendMessage( 0x482, "{0} tells you:", state.Mobile.Name );
//m_Entry.Sender.SendMessage( 0x482, text.Text );
if (text != null)
// m_Entry.AddResponse(state.Mobile, "[Response] " + text.Text);
m_Entry.Sender.SendGump(new MessageSentGump(m_Entry.Sender, state.Mobile.Name, text.Text));
// m_Entry.Sender.SendMessage( 0x482, "{0} tells you:", state.Mobile.Name );
// m_Entry.Sender.SendMessage( 0x482, text.Text );
Resend(state);
Resend(state);
break;
}
break;
}
case 9: // predef overview
{
Resend(state);
state.Mobile.SendGump(new PredefGump(state.Mobile, null));
{
Resend(state);
state.Mobile.SendGump(new PredefGump(state.Mobile, null));
break;
}
break;
}
case 10: // View Speech Log
{
Resend(state);
{
Resend(state);
if (m_Entry.SpeechLog != null) state.Mobile.SendGump(new SpeechLogGump(m_Entry.Sender, m_Entry.SpeechLog));
if (m_Entry.SpeechLog != null) state.Mobile.SendGump(new SpeechLogGump(m_Entry.Sender, m_Entry.SpeechLog));
break;
}
break;
}
default:
{
int index = info.ButtonID - 100;
List<PredefinedResponse> preresp = PredefinedResponse.List;
{
int index = info.ButtonID - 100;
List<PredefinedResponse> preresp = PredefinedResponse.List;
if (index >= 0 && index < preresp.Count)
// m_Entry.AddResponse(state.Mobile, "[PreDef] " + preresp[index].Title);
m_Entry.Sender.SendGump(new MessageSentGump(m_Entry.Sender, state.Mobile.Name,
preresp[index].Message));
if (index >= 0 && index < preresp.Count)
// m_Entry.AddResponse(state.Mobile, "[PreDef] " + preresp[index].Title);
m_Entry.Sender.SendGump(new MessageSentGump(m_Entry.Sender, state.Mobile.Name,
preresp[index].Message));
Resend(state);
Resend(state);
break;
}
break;
}
}
}
}

View file

@ -5,8 +5,9 @@ namespace Server.Engines.Help
{
public class PageResponseGump : Gump
{
private Mobile m_From;
private string m_Name, m_Text;
private readonly Mobile m_From;
private readonly string m_Name;
private readonly string m_Text;
public PageResponseGump(Mobile from, string name, string text) : base(0, 0)
{

View file

@ -19,24 +19,16 @@ namespace Server.Engines.Help
// What is the maximum number of entries a log can contain? (0 -> no limit)
public static readonly int MaxLength = 0;
private Queue<SpeechLogEntry> m_Queue;
private readonly Queue<SpeechLogEntry> m_Queue;
public SpeechLog() => m_Queue = new Queue<SpeechLogEntry>();
public int Count => m_Queue.Count;
#region IEnumerable<SpeechLogEntry> Members
IEnumerator<SpeechLogEntry> IEnumerable<SpeechLogEntry>.GetEnumerator() => m_Queue.GetEnumerator();
#endregion
#region IEnumerable Members
IEnumerator IEnumerable.GetEnumerator() => m_Queue.GetEnumerator();
#endregion
public static void Initialize()
{
CommandSystem.Register("SpeechLog", AccessLevel.Counselor, SpeechLog_OnCommand);
@ -127,10 +119,10 @@ namespace Server.Engines.Help
Created = DateTime.UtcNow;
}
public Mobile From{ get; }
public Mobile From { get; }
public string Speech{ get; }
public string Speech { get; }
public DateTime Created{ get; }
public DateTime Created { get; }
}
}

View file

@ -10,10 +10,10 @@ namespace Server.Engines.Help
public class SpeechLogGump : Gump
{
public static readonly int MaxEntriesPerPage = 30;
private List<SpeechLogEntry> m_Log;
private int m_Page;
private readonly List<SpeechLogEntry> m_Log;
private readonly int m_Page;
private Mobile m_Player;
private readonly Mobile m_Player;
public SpeechLogGump(Mobile player, SpeechLog log)
: this(player, new List<SpeechLogEntry>(log))
@ -94,19 +94,19 @@ namespace Server.Engines.Help
switch (info.ButtonID)
{
case 1: // Previous page
{
if (m_Page - 1 >= 0)
from.SendGump(new SpeechLogGump(m_Player, m_Log, m_Page - 1));
{
if (m_Page - 1 >= 0)
from.SendGump(new SpeechLogGump(m_Player, m_Log, m_Page - 1));
break;
}
break;
}
case 2: // Next page
{
if ((m_Page + 1) * MaxEntriesPerPage < m_Log.Count)
from.SendGump(new SpeechLogGump(m_Player, m_Log, m_Page + 1));
{
if ((m_Page + 1) * MaxEntriesPerPage < m_Log.Count)
from.SendGump(new SpeechLogGump(m_Player, m_Log, m_Page + 1));
break;
}
break;
}
}
}
}

View file

@ -14,14 +14,14 @@ namespace Server.Menus.Questions
Locations = locations;
}
public int Name{ get; }
public int Name { get; }
public Point3D[] Locations{ get; }
public Point3D[] Locations { get; }
}
public class StuckMenu : Gump
{
private static StuckMenuEntry[] m_Entries =
private static readonly StuckMenuEntry[] m_Entries =
{
// Britain
new StuckMenuEntry(1011028, new[]
@ -84,7 +84,7 @@ namespace Server.Menus.Questions
})
};
private static StuckMenuEntry[] m_T2AEntries =
private static readonly StuckMenuEntry[] m_T2AEntries =
{
// Papua
new StuckMenuEntry(1011057, new[]
@ -107,9 +107,10 @@ namespace Server.Menus.Questions
})
};
private bool m_MarkUse;
private readonly bool m_MarkUse;
private Mobile m_Mobile, m_Sender;
private readonly Mobile m_Mobile;
private readonly Mobile m_Sender;
private Timer m_Timer;
@ -143,7 +144,7 @@ namespace Server.Menus.Questions
private static bool IsInSecondAgeArea(Mobile m) =>
(m.Map == Map.Trammel || m.Map == Map.Felucca) &&
(m.X >= 5120 && m.Y >= 2304 || m.Region.IsPartOf("Terathan Keep"));
((m.X >= 5120 && m.Y >= 2304) || m.Region.IsPartOf("Terathan Keep"));
public void BeginClose()
{
@ -204,8 +205,8 @@ namespace Server.Menus.Questions
private class CloseTimer : Timer
{
private DateTime m_End;
private Mobile m_Mobile;
private readonly DateTime m_End;
private readonly Mobile m_Mobile;
public CloseTimer(Mobile m) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
{
@ -231,9 +232,9 @@ namespace Server.Menus.Questions
private class TeleportTimer : Timer
{
private StuckMenuEntry m_Destination;
private DateTime m_End;
private Mobile m_Mobile;
private readonly StuckMenuEntry m_Destination;
private readonly DateTime m_End;
private readonly Mobile m_Mobile;
public TeleportTimer(Mobile mobile, StuckMenuEntry destination, TimeSpan delay) : base(TimeSpan.Zero,
TimeSpan.FromSeconds(1.0))