use GameModeID instead of other consts

This commit is contained in:
鱼鱼 2020-05-17 21:46:03 +08:00
parent 1ed95c737e
commit 01cf85c9ad

View file

@ -36,6 +36,7 @@ using Microsoft.Xna.Framework;
using OTAPI.Tile; using OTAPI.Tile;
using TShockAPI.Localization; using TShockAPI.Localization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Terraria.DataStructures;
namespace TShockAPI namespace TShockAPI
{ {
@ -2144,12 +2145,10 @@ namespace TShockAPI
private static void ToggleExpert(CommandArgs args) private static void ToggleExpert(CommandArgs args)
{ {
const int NormalMode = 0; if (Main.GameMode != GameModeID.Expert)
const int ExpertMode = 1; Main.GameMode = GameModeID.Expert;
if (Main.GameMode != ExpertMode) else if (Main.GameMode == GameModeID.Expert)
Main.GameMode = ExpertMode; Main.GameMode = GameModeID.Normal;
else if (Main.GameMode == ExpertMode)
Main.GameMode = NormalMode;
TSPlayer.All.SendData(PacketTypes.WorldInfo); TSPlayer.All.SendData(PacketTypes.WorldInfo);
args.Player.SendSuccessMessage("Expert mode is now {0}.", Main.expertMode ? "on" : "off"); args.Player.SendSuccessMessage("Expert mode is now {0}.", Main.expertMode ? "on" : "off");
} }