Remove goto

This commit is contained in:
Li 2022-05-08 17:02:48 +12:00
parent 02d32f46a8
commit 158429d306
2 changed files with 124 additions and 120 deletions

View file

@ -893,64 +893,70 @@ namespace HISP.Game.Chat
if (args.Length <= 0) if (args.Length <= 0)
{ {
formattedmessage += Messages.MuteHelp; formattedmessage += Messages.MuteHelp;
goto leave;
} }
else
string muteType = args[0]; {
if (muteType.ToUpper() == "GLOBAL") string muteType = args[0];
{
user.MuteGlobal = true; if (muteType.ToUpper() == "GLOBAL")
} else if (muteType.ToUpper() == "ISLAND") {
{ user.MuteGlobal = true;
user.MuteIsland = true; }
} else if (muteType.ToUpper() == "NEAR") else if (muteType.ToUpper() == "ISLAND")
{ {
user.MuteNear = true; user.MuteIsland = true;
} else if (muteType.ToUpper() == "HERE") }
{ else if (muteType.ToUpper() == "NEAR")
user.MuteHere = true; {
} else if (muteType.ToUpper() == "BUDDY") user.MuteNear = true;
{ }
user.MuteBuddy = true; else if (muteType.ToUpper() == "HERE")
} else if (muteType.ToUpper() == "SOCIALS") {
{ user.MuteHere = true;
user.MuteSocials = 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); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
@ -965,71 +971,70 @@ namespace HISP.Game.Chat
if (args.Length <= 0) if (args.Length <= 0)
{ {
formattedmessage += Messages.UnMuteHelp; 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); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);

View file

@ -17,7 +17,6 @@ namespace HISP.Player
private List<Auction.AuctionBid> bids = new List<Auction.AuctionBid>(); private List<Auction.AuctionBid> bids = new List<Auction.AuctionBid>();
private List<User> beingSocializedBy = new List<User>(); private List<User> beingSocializedBy = new List<User>();
private int chatViolations; private int chatViolations;
private int charId; private int charId;
private int subscribedUntil; private int subscribedUntil;