Skip to content
Permalink
Browse files

Less goto usage

  • Loading branch information...
UnknownShadow200 committed Jun 30, 2017
1 parent 5f1f8e1 commit 15ea4031e28a49c8070259a9f85067d4c772221e
Showing with 23 additions and 20 deletions.
  1. +16 −11 fCraft/Commands/CpeCommands.cs
  2. +7 −9 fCraft/Player/Chat.cs
@@ -2109,39 +2109,44 @@ static class CpeCommands {
player.Message(" Flying: &a{0} &S--> &a{1}", target.AllowFlying, !target.AllowFlying);
target.AllowFlying = !target.AllowFlying;
hackStr = "flying";
goto sendPacket;
break;

case "noclip":
case "clip":
case "nc":
player.Message("Hacks for {0}", target.ClassyName);
player.Message(" NoClip: &a{0} &S--> &a{1}", target.AllowNoClip, !target.AllowNoClip);
target.AllowNoClip = !target.AllowNoClip;
hackStr = "noclip";
goto sendPacket;
break;

case "speedhack":
case "speed":
case "sh":
player.Message("Hacks for {0}", target.ClassyName);
player.Message(" SpeedHack: &a{0} &S--> &a{1}", target.AllowSpeedhack, !target.AllowSpeedhack);
target.AllowSpeedhack = !target.AllowSpeedhack;
hackStr = "speedhack";
goto sendPacket;
break;

case "respawn":
case "spawn":
case "rs":
player.Message("Hacks for {0}", target.ClassyName);
player.Message(" Respawn: &a{0} &S--> &a{1}", target.AllowRespawn, !target.AllowRespawn);
target.AllowRespawn = !target.AllowRespawn;
hackStr = "respawn";
goto sendPacket;
break;

case "thirdperson":
case "third":
case "tp":
player.Message("Hacks for {0}", target.ClassyName);
player.Message(" ThirdPerson: &a{0} &S--> &a{1}", target.AllowThirdPerson, !target.AllowThirdPerson);
target.AllowThirdPerson = !target.AllowThirdPerson;
hackStr = "thirdperson";
goto sendPacket;
break;

case "jumpheight":
case "jump":
case "height":
@@ -2153,16 +2158,16 @@ static class CpeCommands {
player.Message(" JumpHeight: &a{0} &S--> &a{1}", target.JumpHeight, height);
target.JumpHeight = height;
hackStr = "jumpheight";
goto sendPacket;
} else player.Message("Error: Could not parse \"&a{0}&S\" as a short. Try something between &a0&S and &a32767", third);
} else {
player.Message("Error: Could not parse \"&a{0}&S\" as a short. Try something between &a0&S and &a32767", third);
return;
}
break;
default:
player.Message(CdHackControl.Help);
break;
return;
}
return;

sendPacket:

if (player != targetPlayer) {
targetPlayer.Message("{0} has changed your {1} ability, use &H/Hacks &Sto check them out.", player.Info.Name, hackStr);
}
@@ -191,17 +191,15 @@ public static class Chat
}
if (LDistance(rawMessage.ToLower(), "what is my next rank?") <= 0.25 ||
LDistance(rawMessage.ToLower(), "what rank is after this one?") <= 0.25) {
Rank meh = player.Info.Rank.NextRankUp;
if (BotTime > 5 && player.Info.Rank != RankManager.HighestRank) {
tryagain:
if (meh.IsDonor) {
meh = meh.NextRankUp;
goto tryagain;
}
Server.BotMessage("Your next rank is: " + meh.ClassyName);
Rank next = player.Info.Rank.NextRankUp;
// donor ranks are skipped from being able to be promoted to
while (next != null && next.IsDonor) next = next.NextRankUp;

if (BotTime > 5 && next != null) {
Server.BotMessage("Your next rank is: " + next.ClassyName);
player.LastServerMessageDate = DateTime.UtcNow;
player.Info.TimesUsedBot++;
} else if (player.Info.Rank == RankManager.HighestRank) {
} else {
Server.BotMessage("You are already the highest rank.");
player.LastServerMessageDate = DateTime.UtcNow;
player.Info.TimesUsedBot++;

0 comments on commit 15ea403

Please sign in to comment.
You can’t perform that action at this time.