From 158429d306718d388915ebb98095bf27c55df3a9 Mon Sep 17 00:00:00 2001
From: Li
Date: Sun, 8 May 2022 17:02:48 +1200
Subject: [PATCH] Remove goto
---
HorseIsleServer/LibHISP/Game/Chat/Command.cs | 243 ++++++++++---------
HorseIsleServer/LibHISP/Player/User.cs | 1 -
2 files changed, 124 insertions(+), 120 deletions(-)
diff --git a/HorseIsleServer/LibHISP/Game/Chat/Command.cs b/HorseIsleServer/LibHISP/Game/Chat/Command.cs
index 9591963..10f1c2b 100644
--- a/HorseIsleServer/LibHISP/Game/Chat/Command.cs
+++ b/HorseIsleServer/LibHISP/Game/Chat/Command.cs
@@ -893,64 +893,70 @@ namespace HISP.Game.Chat
if (args.Length <= 0)
{
formattedmessage += Messages.MuteHelp;
- goto leave;
}
-
- string muteType = args[0];
-
- if (muteType.ToUpper() == "GLOBAL")
- {
- user.MuteGlobal = true;
- } else if (muteType.ToUpper() == "ISLAND")
- {
- user.MuteIsland = true;
- } else if (muteType.ToUpper() == "NEAR")
- {
- user.MuteNear = true;
- } else if (muteType.ToUpper() == "HERE")
- {
- user.MuteHere = true;
- } else if (muteType.ToUpper() == "BUDDY")
- {
- user.MuteBuddy = true;
- } else if (muteType.ToUpper() == "SOCIALS")
- {
- user.MuteSocials = true;
+ else
+ {
+
+ string muteType = args[0];
+
+ if (muteType.ToUpper() == "GLOBAL")
+ {
+ user.MuteGlobal = true;
+ }
+ else if (muteType.ToUpper() == "ISLAND")
+ {
+ user.MuteIsland = true;
+ }
+ else if (muteType.ToUpper() == "NEAR")
+ {
+ user.MuteNear = true;
+ }
+ else if (muteType.ToUpper() == "HERE")
+ {
+ user.MuteHere = true;
+ }
+ else if (muteType.ToUpper() == "BUDDY")
+ {
+ user.MuteBuddy = true;
+ }
+ else if (muteType.ToUpper() == "SOCIALS")
+ {
+ user.MuteSocials = true;
+ }
+ else if (muteType.ToUpper() == "PM")
+ {
+ user.MutePrivateMessage = true;
+ }
+ else if (muteType.ToUpper() == "BR")
+ {
+ user.MuteBuddyRequests = true;
+ }
+ else if (muteType.ToUpper() == "LOGINS")
+ {
+ user.MuteLogins = true;
+ }
+ else if (muteType.ToUpper() == "ADS")
+ {
+ user.MuteAds = true;
+ }
+ else if (muteType.ToUpper() == "ALL")
+ {
+ user.MuteAll = true;
+ user.MuteGlobal = true;
+ user.MuteIsland = true;
+ user.MuteNear = true;
+ user.MuteHere = true;
+ user.MuteBuddy = true;
+ user.MuteSocials = true;
+ user.MutePrivateMessage = true;
+ user.MuteBuddyRequests = true;
+ user.MuteLogins = true;
+ }
+ else
+ {
+ formattedmessage += Messages.MuteHelp;
+ }
}
- else if (muteType.ToUpper() == "PM")
- {
- user.MutePrivateMessage = true;
- }
- else if (muteType.ToUpper() == "BR")
- {
- user.MuteBuddyRequests = true;
- }
- else if (muteType.ToUpper() == "LOGINS")
- {
- user.MuteLogins = true;
- }
- else if (muteType.ToUpper() == "ADS")
- {
- user.MuteAds = true;
- }
- else if (muteType.ToUpper() == "ALL")
- {
- user.MuteAll = true;
- user.MuteGlobal = true;
- user.MuteIsland = true;
- user.MuteNear = true;
- user.MuteHere = true;
- user.MuteBuddy = true;
- user.MuteSocials = true;
- user.MutePrivateMessage = true;
- user.MuteBuddyRequests = true;
- user.MuteLogins = true;
- }
- else
- {
- formattedmessage += Messages.MuteHelp;
- }
-
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
@@ -965,71 +971,70 @@ namespace HISP.Game.Chat
if (args.Length <= 0)
{
formattedmessage += Messages.UnMuteHelp;
- goto leave;
+ }
+ else
+ {
+ string muteType = args[0];
+
+ if (muteType.ToUpper() == "GLOBAL")
+ {
+ user.MuteGlobal = false;
+ }
+ else if (muteType.ToUpper() == "ISLAND")
+ {
+ user.MuteIsland = false;
+ }
+ else if (muteType.ToUpper() == "ADS")
+ {
+ user.MuteAds = false;
+ }
+ else if (muteType.ToUpper() == "NEAR")
+ {
+ user.MuteNear = false;
+ }
+ else if (muteType.ToUpper() == "HERE")
+ {
+ user.MuteHere = false;
+ }
+ else if (muteType.ToUpper() == "BUDDY")
+ {
+ user.MuteBuddy = false;
+ }
+ else if (muteType.ToUpper() == "SOCIALS")
+ {
+ user.MuteSocials = false;
+ }
+ else if (muteType.ToUpper() == "PM")
+ {
+ user.MutePrivateMessage = false;
+ }
+ else if (muteType.ToUpper() == "BR")
+ {
+ user.MuteBuddyRequests = false;
+ }
+ else if (muteType.ToUpper() == "LOGINS")
+ {
+ user.MuteLogins = false;
+ }
+ else if (muteType.ToUpper() == "ALL")
+ {
+ user.MuteAll = false;
+ user.MuteGlobal = false;
+ user.MuteIsland = false;
+ user.MuteNear = false;
+ user.MuteHere = false;
+ user.MuteBuddy = false;
+ user.MuteSocials = false;
+ user.MutePrivateMessage = false;
+ user.MuteBuddyRequests = false;
+ user.MuteLogins = false;
+ }
+ else
+ {
+ formattedmessage += Messages.UnMuteHelp;
+ }
}
- string muteType = args[0];
-
- if (muteType.ToUpper() == "GLOBAL")
- {
- user.MuteGlobal = false;
- }
- else if (muteType.ToUpper() == "ISLAND")
- {
- user.MuteIsland = false;
- }
- else if (muteType.ToUpper() == "ADS")
- {
- user.MuteAds = false;
- }
- else if (muteType.ToUpper() == "NEAR")
- {
- user.MuteNear = false;
- }
- else if (muteType.ToUpper() == "HERE")
- {
- user.MuteHere = false;
- }
- else if (muteType.ToUpper() == "BUDDY")
- {
- user.MuteBuddy = false;
- }
- else if (muteType.ToUpper() == "SOCIALS")
- {
- user.MuteSocials = false;
- }
- else if (muteType.ToUpper() == "PM")
- {
- user.MutePrivateMessage = false;
- }
- else if (muteType.ToUpper() == "BR")
- {
- user.MuteBuddyRequests = false;
- }
- else if (muteType.ToUpper() == "LOGINS")
- {
- user.MuteLogins = false;
- }
- else if (muteType.ToUpper() == "ALL")
- {
- user.MuteAll = false;
- user.MuteGlobal = false;
- user.MuteIsland = false;
- user.MuteNear = false;
- user.MuteHere = false;
- user.MuteBuddy = false;
- user.MuteSocials = false;
- user.MutePrivateMessage = false;
- user.MuteBuddyRequests = false;
- user.MuteLogins = false;
- }
- else
- {
- formattedmessage += Messages.UnMuteHelp;
- goto leave;
- }
-
- leave:;
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
diff --git a/HorseIsleServer/LibHISP/Player/User.cs b/HorseIsleServer/LibHISP/Player/User.cs
index c4547e6..f5baf00 100644
--- a/HorseIsleServer/LibHISP/Player/User.cs
+++ b/HorseIsleServer/LibHISP/Player/User.cs
@@ -17,7 +17,6 @@ namespace HISP.Player
private List bids = new List();
private List beingSocializedBy = new List();
-
private int chatViolations;
private int charId;
private int subscribedUntil;