internal static void ProcessData(Client client, string[] parse) { //string[] parse = data.Split(TcpPacket.SEP_CHAR); if (client.Player == null) { if (parse[0].ToLower() == "requestnews") { Messenger.SendNews(client); client.InitializeClientSystem(); return; } } if (client.Player == null) { Messenger.PlainMsg(client, "Unable to initialize connection. Please retry.", Enums.PlainMsgType.MainMenu); return; } if (!client.Player.LoggedIn) { #region Not Logged In switch (parse[0].ToLower()) { case "clienterror": { string error = parse[1]; error += "\r\n\r\n------- ERROR REPORT END -------\r\n\r\n"; Logging.Logger.AppendToLog("/Client Error Logs/" + DateTime.Now.ToShortDateString().Replace("/", "-") + "/log.txt", error); } break; case "requestnews": Messenger.SendNews(client); client.InitializeClientSystem(); break; #region Logging In case "login": { if (Globals.ServerClosed) { Messenger.PlainMsg(client, "Server is closed at the moment!", Enums.PlainMsgType.MainMenu); return; } if (ClientManager.CanLogin(parse[1])) { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { // Check if the account exists if (PlayerManager.AccountExists(dbConnection, parse[1]) == false) { Messenger.PlainMsg(client, "This account does not exist.", Enums.PlainMsgType.MainMenu); return; } // Check the client version if (parse[3].ToInt() < Constants.CLIENT_VERSION) { Messenger.PlainMsg(client, "Your client is outdated. Please update your client.", Enums.PlainMsgType.MainMenu); return; } // Verify that the client used is a valid one if (parse[10] != "PMDCPCore") { Messenger.PlainMsg(client, "Bad client version! Did you edit the source code?", Enums.PlainMsgType.MainMenu); return; } #if !DEBUG if (ClientManager.IsMacAddressConnected(parse[11])) { Messenger.PlainMsg(client, "You are already playing on this computer!", Enums.PlainMsgType.MainMenu); return; } #endif string password = Security.Hash.GenerateMD5Hash(parse[2]).Trim(); if (PlayerManager.IsPasswordCorrect(dbConnection, parse[1], password)) { client.SetMacAddress(parse[11]); client.SetBiosIdentification(parse[12]); // Check if they aren't banned if (Bans.IsIPBanned(dbConnection, client) == Enums.BanType.Ban || Bans.IsMacBanned(dbConnection, client) == Enums.BanType.Ban) { Logging.ChatLogger.AppendToChatLog("Staff", "IP: " + client.IP + " Mac: " + client.MacAddress + " attempted to log on, but was banned."); Messenger.PlainMsg(client, "You can't enter this world!", Enums.PlainMsgType.MainMenu); client.SetMacAddress(""); client.SetBiosIdentification(""); return; } client.Player.AccountName = parse[1]; client.Player.SetSystemInfo(parse[8], parse[9], parse[10]); Messenger.SendChars(dbConnection, client); } else { Messenger.PlainMsg(client, "Invalid password.", Enums.PlainMsgType.MainMenu); } } } else { Messenger.PlainMsg(client, "You are already in the Pokémon world!", Enums.PlainMsgType.MainMenu); } } break; case "charlistrequest": { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { Messenger.SendChars(dbConnection, client); } } break; case "usechar": { int charNum = parse[1].ToInt(); if (charNum < 1 || charNum > 3) return; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { if (client.Player.CharacterExists(dbConnection, charNum)) { client.Player.LoadCharacter(dbConnection, parse[1].ToInt(1)); if (Globals.GMOnly) { if (client.Player.Access == Enums.Rank.Normal) { Messenger.PlainMsg(client, "The server is only open to GMs at the moment!", Enums.PlainMsgType.MainMenu); client.CloseConnection(); //PlayerManager.Players.RemovePlayer(client); //PlayerManager.Players.AddPlayer(client); return; } } if (ClientManager.IsCharacterLoggedIn(client.Player.CharID)) { Messenger.PlainMsg(client, "You are already playing on this computer!", Enums.PlainMsgType.MainMenu); return; } if (Bans.IsCharacterBanned(dbConnection, client.Player.CharID) == Enums.BanType.Ban) { Messenger.PlainMsg(client, "This character can't enter the Pokémon world!", Enums.PlainMsgType.MainMenu); client.Player = new Player(client); client.CloseConnection(); return; } client.Player.Statistics.HandleLogin(client.Player.GetOSVersion(), client.Player.GetDotNetVersion(), client.MacAddress, client.IP); Messenger.SendJoinGame(client); //Globals.ServerUI.AddLog(PlayerManager.Players.GetPlayer(client).mLogin + "/" + PlayerManager.Players.GetPlayer(client).mName + " has started playing!"); } else { Messenger.PlainMsg(client, "This character hasn't been sent to the Pokémon world yet!", Enums.PlainMsgType.Chars); return; } } } break; #endregion #region Account Editing case "gatglasses": {//typo? then again, we don't need classes... Messenger.SendNewCharClasses(client); } break; case "createaccount": { if (client.Player.LoggedIn == false) { string name = parse[1]; string password = parse[2]; string email = parse[3]; for (int i = 0; i < name.Length; i++) { int n = (int)Convert.ToChar(name.Substring(i, 1)); if (n == 32 && (i == 0 || i == name.Length - 1)) { Messenger.PlainMsg(client, "Names cannot begin or end with spaces.", Enums.PlainMsgType.NewAccount); return; } if ((n >= 65 & n <= 90) | (n >= 97 & n <= 122) | (n == 95) | (n == 32) | (n >= 48 & n <= 57)) { } else { Messenger.PlainMsg(client, "Invalid name, only letters, numbers, spaces, and _ allowed in names.", Enums.PlainMsgType.NewAccount); return; } } if (name.Length < 3 || name.Length > 24) { Messenger.PlainMsg(client, "Name must be between 3 and 24 letters long.", Enums.PlainMsgType.NewAccount); return; } // TODO: Add email support to account creation [HIGH] //if (Email.Email.IsValidEmail(email) == false) { // Messenger.PlainMsg(client, "Invalid email.", Enums.PlainMsgType.NewAccount); // return; //} using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { int result = PlayerManager.CreateNewAccount(dbConnection, name, password, ""); if (result == -1) { Messenger.PlainMsg(client, "An error occurred while creating your account.", Enums.PlainMsgType.MainMenu); } else if (result == 0) { Messenger.PlainMsg(client, "Your account has been created!", Enums.PlainMsgType.MainMenu); } else if (result == 1) { Messenger.PlainMsg(client, "That account already exists!", Enums.PlainMsgType.MainMenu); } } } } break; case "addchar": { string name = parse[1].Trim(); int sex = parse[2].ToInt(-1); //int CharClass = parse[3].ToInt(-1); ((This should be removed too)) //int CharNum = parse[4].ToInt(-1); int charNum = parse[3].ToInt(-1); for (int i = 0; i < name.Length; i++) { int n = (int)Convert.ToChar(name.Substring(i, 1)); if (n == 32 && (i == 0 || i == name.Length - 1)) { Messenger.PlainMsg(client, "Names cannot begin or end with spaces.", Enums.PlainMsgType.NewChar); return; } if ((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n == 95) || (n == 32) || (n >= 48 && n <= 57)) { } else { //Messenger.SendNewCharClasses(client); ((More classes?)) Messenger.PlainMsg(client, "Invalid name, only letters, numbers, spaces, and _ allowed in names.", Enums.PlainMsgType.NewChar); return; } } if (name.Length < 3 || name.Length > 24) { Messenger.PlainMsg(client, "Name must be between 3 and 24 letters long.", Enums.PlainMsgType.NewChar); return; } if (charNum < 1 || charNum > 3) { Messenger.PlainMsg(client, "Invalid character number", Enums.PlainMsgType.Chars); return; } if ((sex < (int)Enums.Sex.Genderless) || (sex > (int)Enums.Sex.Female)) { Messenger.PlainMsg(client, "Invalid gender", Enums.PlainMsgType.Chars); return; } //if (CharClass < 0 || CharClass > Settings.MaxClasses) { //Messenger.PlainMsg(client, "Invalid class", Enums.PlainMsgType.Chars); //return; //} ((this should be removed. We no longer use classes in the Add Character Window)) using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { if (client.Player.CharacterExists(dbConnection, charNum)) { Messenger.PlainMsg(client, "That character is already in the Pokémon world!", Enums.PlainMsgType.NewChar); return; } if (PlayerManager.CharacterNameExists(dbConnection, name)) { Messenger.PlainMsg(client, "There's already a character with that name!", Enums.PlainMsgType.NewChar); return; } client.Player.CreateCharacter(dbConnection, name, (Enums.Sex)sex, charNum, false); } } break; case "delchar": { int charNum = parse[1].ToInt(-1); if (charNum < 1 || charNum > 3) { Messenger.PlainMsg(client, "Invalid character number", Enums.PlainMsgType.Chars); return; } using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { if (client.Player.CharacterExists(dbConnection, charNum)) { PlayerManager.DeleteCharacter(dbConnection, client.Player.AccountName, charNum); Messenger.SendChars(dbConnection, client); Messenger.PlainMsg(client, "The character has been sent back from the Pokémon world, never to return.", Enums.PlainMsgType.Chars); } else { Messenger.PlainMsg(client, "That character doesn't exist!", Enums.PlainMsgType.Chars); } } } break; case "deleteaccount": { string name = parse[1]; string password = parse[2]; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { if (PlayerManager.AccountExists(dbConnection, name) == false) { Messenger.PlainMsg(client, "That account does not exist", Enums.PlainMsgType.MainMenu); return; } if (PlayerManager.IsPasswordCorrect(dbConnection, name, password) == false) { Messenger.PlainMsg(client, "Incorrect password", Enums.PlainMsgType.MainMenu); return; } PlayerManager.DeleteAccount(dbConnection, name); } Messenger.PlainMsg(client, "Your account has been deleted!", Enums.PlainMsgType.MainMenu); } break; case "passchange": { string name = parse[1]; string oldPass = Security.Hash.GenerateMD5Hash(parse[2]); string newPass = Security.Hash.GenerateMD5Hash(parse[3]); using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { if (PlayerManager.IsPasswordCorrect(dbConnection, name, oldPass)) { PlayerManager.ChangeAccountPassword(dbConnection, name, oldPass, newPass); client.Player = new Player(client); Messenger.PlainMsg(client, "Your password has been changed!", Enums.PlainMsgType.AccountOptions); } else { Messenger.PlainMsg(client, "Unable to change password.", Enums.PlainMsgType.AccountOptions); } } } break; #endregion } #endregion } else { #region Logged In switch (parse[0].ToLower()) { #region Movement case "playermove": { if (client.Player.GettingMap) { return; } int dir = parse[1].ToInt(); int speed = parse[2].ToInt(); if (dir < 0 || dir > 3) { return; } if (speed < 0 || speed > 7) { return; } MovementProcessor.ProcessMovement(client, (Enums.Direction)dir, (Enums.Speed)speed, false); } break; case "critmove": { if (client.Player.GettingMap) { return; } int dir = parse[1].ToInt(); int speed = parse[2].ToInt(); if (dir < 0 || dir > 3) { return; } if (speed < 0 || speed > 7) { return; } MovementProcessor.ProcessMovement(client, (Enums.Direction)dir, (Enums.Speed)speed, true); } break; case "playerdir": { if (client.Player.GettingMap) { return; } int dir = parse[1].ToInt(); if (dir < 0 || dir > 3) { return; } client.Player.Direction = (Enums.Direction)dir; PacketHitList hitlist = null; PacketHitList.MethodStart(ref hitlist); PacketBuilder.AppendPlayerDirExcept(client, hitlist); PacketHitList.MethodEnded(ref hitlist); } break; case "requestnewmap": { //if (client.Player.Map.MapType != Enums.MapType.Instanced) { int dir = parse[1].ToInt(); if (dir < 0 || dir > 3) { return; } if (MovementProcessor.WillWalkOnWarp(client, (Enums.Direction)dir)) { MovementProcessor.ProcessMovement(client, (Enums.Direction)dir, (Enums.Speed)1, true); } else { PacketHitList hitlist = null; PacketHitList.MethodStart(ref hitlist); PacketBuilder.AppendOwnXY(client, hitlist); PacketBuilder.AppendPlayerLock(client, hitlist, false); PacketHitList.MethodEnded(ref hitlist); } } break; case "needmap": { Messenger.NeedMapCheck(client, parse[1].ToBool()); } break; case "needmapseamless": { bool[] results = new bool[parse[1].ToInt()]; int n = 2; for (int i = 0; i < results.Length; i++) { results[i] = parse[n].ToBool(); n += 1; } Messenger.NeedMapCheck(client, results); } break; case "refresh": { Messenger.RefreshMap(client); } break; case "maploaded": { client.Player.Map.ProcessingPaused = true; } break; #endregion #region Attacking case "attack": { if (client.Player.GettingMap) return; client.Player.GetActiveRecruit().UseMove(-1); } break; #endregion #region Attacking - Moves case "forgetspell": { // Spell slot int n = parse[1].ToInt(-1); // Prevent subscript out of range if (n < 0 | n > Constants.MAX_PLAYER_MOVES) { Messenger.HackingAttempt(client, "Invalid Move Slot"); return; } if (client.Player.GetActiveRecruit().Moves[n].MoveNum == 0) { Messenger.PlayerMsg(client, "No move here.", Text.Red); } else { Messenger.PlayerMsg(client, "You have forgotten the move \"" + MoveManager.Moves[client.Player.GetActiveRecruit().Moves[n].MoveNum].Name.Trim() + "\"", Text.Green); client.Player.GetActiveRecruit().Moves[n].MoveNum = 0; client.Player.GetActiveRecruit().Moves[n].CurrentPP = -1; client.Player.GetActiveRecruit().Moves[n].MaxPP = -1; Messenger.SendPlayerMoves(client); } } break; case "swapmoves": { int oldMoveSlot = parse[1].ToInt(-1); int newMoveSlot = parse[2].ToInt(-1); if (oldMoveSlot > -1 && oldMoveSlot < 4 && newMoveSlot > -1 && newMoveSlot < 4) { RecruitMove oldMove = client.Player.GetActiveRecruit().Moves[oldMoveSlot]; RecruitMove newMove = client.Player.GetActiveRecruit().Moves[newMoveSlot]; client.Player.GetActiveRecruit().Moves[oldMoveSlot] = newMove; client.Player.GetActiveRecruit().Moves[newMoveSlot] = oldMove; Messenger.SendPlayerMoves(client); } } break; case "shiftspell": { // Spell slot int n = parse[1].ToInt(-1); // Prevent subscript out of range if (n < 0 | n > Constants.MAX_PLAYER_MOVES) { Messenger.HackingAttempt(client, "Invalid Move Slot"); return; } //if (client.Player.GetActiveRecruit().Moves[n].MoveNum == 0) //~no need to check for blank space; you can move blank spaces //{ //Messenger.PlayerMsg(client, "No move here.", Text.Red); //} //else //{ int movingSpell = client.Player.GetActiveRecruit().Moves[n].MoveNum; int movingSpellCurrentPP = client.Player.GetActiveRecruit().Moves[n].CurrentPP; int movingSpellMaxPP = client.Player.GetActiveRecruit().Moves[n].MaxPP; if (parse[2].ToBool() && n > 0)//shifting up { client.Player.GetActiveRecruit().Moves[n].MoveNum = client.Player.GetActiveRecruit().Moves[n - 1].MoveNum; client.Player.GetActiveRecruit().Moves[n - 1].MoveNum = movingSpell; client.Player.GetActiveRecruit().Moves[n].CurrentPP = client.Player.GetActiveRecruit().Moves[n - 1].CurrentPP; client.Player.GetActiveRecruit().Moves[n - 1].CurrentPP = movingSpellCurrentPP; client.Player.GetActiveRecruit().Moves[n].MaxPP = client.Player.GetActiveRecruit().Moves[n - 1].MaxPP; client.Player.GetActiveRecruit().Moves[n - 1].MaxPP = movingSpellMaxPP; Scripting.ScriptManager.InvokeSub("OnMoveSwapped", client, n, n - 1); } else if (n < 3)//shifting down { client.Player.GetActiveRecruit().Moves[n].MoveNum = client.Player.GetActiveRecruit().Moves[n + 1].MoveNum; client.Player.GetActiveRecruit().Moves[n + 1].MoveNum = movingSpell; client.Player.GetActiveRecruit().Moves[n].CurrentPP = client.Player.GetActiveRecruit().Moves[n + 1].CurrentPP; client.Player.GetActiveRecruit().Moves[n + 1].CurrentPP = movingSpellCurrentPP; client.Player.GetActiveRecruit().Moves[n].MaxPP = client.Player.GetActiveRecruit().Moves[n + 1].MaxPP; client.Player.GetActiveRecruit().Moves[n + 1].MaxPP = movingSpellMaxPP; Scripting.ScriptManager.InvokeSub("OnMoveSwapped", client, n, n + 1); } Messenger.SendPlayerMoves(client); //} } break; case "cast": { if (client.Player.GettingMap) return; client.Player.GetActiveRecruit().UseMove(parse[1].ToInt(-1)); } break; #endregion #region Messages case "broadcastmsg": if (CanSayMsg(client, parse[1])) { Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Global); Logging.ChatLogger.AppendToChatLog("Global", client.Player.Name + ": " + parse[1]); string playerName = client.Player.Name; if (client.Player.Access != Enums.Rank.Normal) { playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]"; } Messenger.GlobalMsg("[Global] " + playerName + ": " + parse[1], Text.DarkGrey); } break; case "saymsg": if (CanSayMsg(client, parse[1])) { Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Map); Logging.ChatLogger.AppendToChatLog("Maps/Map " + client.Player.MapID, client.Player.Name + ": " + parse[1]); string playerName = client.Player.Name; if (client.Player.Access != Enums.Rank.Normal) { playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]"; } PacketHitList hitList = null; PacketHitList.MethodStart(ref hitList); IMap playerMap = client.Player.GetCurrentMap(); hitList.AddPacketToMap(playerMap, PacketBuilder.CreateChatMsg(playerName + ": " + parse[1], Text.White)); hitList.AddPacketToMap(playerMap, PacketBuilder.CreateSpeechBubble(parse[1], client)); PacketHitList.MethodEnded(ref hitList); } break; case "emotemsg": if (CanSayMsg(client, parse[1])) { Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.MeMsg); Logging.ChatLogger.AppendToChatLog("Maps/Map " + client.Player.MapID, "(MeMsg) " + client.Player.Name + " " + parse[1]); string playerName = client.Player.Name; if (client.Player.Access != Enums.Rank.Normal) { playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]"; } Messenger.MapMsg(client.Player.MapID, playerName + " " + parse[1], Text.Blue); } break; case "globalmsg": if (CanSayMsg(client, parse[1])) { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Announcement); Logging.ChatLogger.AppendToChatLog("Global", "(Announcement) " + client.Player.Name + ": " + parse[1]); string playerName = client.Player.Name; if (client.Player.Access != Enums.Rank.Normal) { playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]"; } Messenger.GlobalMsg("(Announcement) " + playerName + ": " + parse[1], Text.Green); } } break; case "adminmsg": if (CanSayMsg(client, parse[1])) { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Staff); Logging.ChatLogger.AppendToChatLog("Staff", client.Player.Name + ": " + parse[1]); string playerName = client.Player.Name; if (client.Player.Access != Enums.Rank.Normal) { playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]"; } Messenger.AdminMsg("[Staff] " + playerName + ": " + parse[1], Text.Cyan); } } break; case "guildmsg": if (CanSayMsg(client, parse[1]) && !string.IsNullOrEmpty(client.Player.GuildName)) { Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Guild); //Messenger.PlayerMsg(client, client.Player[client].mName + " (" + client.Player[client].mGuildName + ") " + parse[1], Text.Green); Logging.ChatLogger.AppendToChatLog("Guild Chat/" + client.Player.GuildName, "(" + client.Player.GuildName + ") " + client.Player.Name + parse[1]); string playerName = client.Player.Name; if (client.Player.Access != Enums.Rank.Normal) { playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]"; } foreach (Client i in ClientManager.GetClients()) { if (i.Player.GuildName == client.Player.GuildName) { Messenger.PlayerMsg(i, "(" + client.Player.GuildName + ") " + playerName + parse[1], Text.Green); } } } break; case "playermsg": { if (CanSayMsg(client, parse[2])) { Client msgto = ClientManager.FindClient(parse[1]); if (msgto == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } else if (msgto == client) { string sexString = ""; if (client.Player.GetActiveRecruit().Sex == Enums.Sex.Genderless) { sexString = "it"; } else if (client.Player.GetActiveRecruit().Sex == Enums.Sex.Male) { sexString = "him"; } else if (client.Player.GetActiveRecruit().Sex == Enums.Sex.Female) { sexString = "her"; } Messenger.MapMsg(client.Player.MapID, client.Player.Name + " begins to mumble to " + sexString + "self, what a wierdo...", Text.White); } else { Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[2], Enums.ChatMessageType.PM); Logging.ChatLogger.AppendToChatLog("PM/" + client.Player.Name, "(" + client.Player.Name + " tells " + msgto.Player.Name + ") " + parse[2]); string playerName = client.Player.Name; if (client.Player.Access != Enums.Rank.Normal) { playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]"; } string playerToName = msgto.Player.Name; if (msgto.Player.Access != Enums.Rank.Normal) { playerToName = "[c][" + Ranks.GetRankColor(msgto.Player.Access).ToArgb() + "]" + msgto.Player.Name + "[/c]"; } Messenger.PlayerMsg(client, "You tell " + playerToName + ", '" + parse[2] + "'", Text.Pink); Messenger.PlayerMsg(msgto, playerName + " tells you, '" + parse[2] + "'", Text.Pink); } } } break; #endregion #region Recruits case "requestactivecharswap": {//perhaps put a time requirement for switching... if (client.Player.GettingMap) return; //if (client.Player.PK == false) { client.Player.SwapActiveRecruit(parse[1].ToInt(1)); //} else { // Messenger.PlayerMsg(client, "An outlaw can't switch Pokémon!", Text.BrightRed); //} } break; case "switchleader": { if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Assembly) { //if (client.Player.PK == false) { client.Player.SwapLeader(parse[1].ToInt(1)); //} else { // Messenger.PlayerMsg(client, "An outlaw can't switch leaders!", Text.BrightRed); //} } else { Messenger.HackingAttempt(client, "Player not in Assembly"); } } break; case "addtoteam": if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Assembly) { int teamSlot = parse[1].ToInt(-1); client.Player.AddToTeam(parse[2].ToInt(-1), teamSlot); if (client.Player.Team[teamSlot] != null && client.Player.Team[teamSlot].Loaded) { client.Player.Team[teamSlot].HP = client.Player.Team[teamSlot].MaxHP; } Messenger.SendActiveTeam(client); Messenger.SendStats(client); Messenger.SendAllRecruits(client); } else { Messenger.SendPlayerData(client); Messenger.HackingAttempt(client, "Player not in Assembly"); } break; case "removefromteam": client.Player.RemoveFromTeam(parse[1].ToInt(-1)); break; case "standby": client.Player.RemoveFromTeam(parse[1].ToInt(-1)); Messenger.SendAllRecruits(client); break; case "releaserecruit": client.Player.RequestedRecruit = new Recruit(client); client.Player.RequestedRecruit.RecruitIndex = parse[1].ToInt(-1); Messenger.AskQuestion(client, "ReleasePokemon", "Are you sure you want to release this recruit?", -1); break; case "changerecruitname": if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Assembly) { if (client.Player.Muted == false) { if (parse[2].Length >= 3 && parse[2].Length <= 24) { client.Player.ChangeRecruitName(parse[1].ToInt(-1), parse[2]); } else { Messenger.PlayerMsg(client, "Name must be between 3 and 24 letters long.", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You cannot change nicknames while muted!", Text.BrightRed); } } else { Messenger.SendPlayerData(client); Messenger.HackingAttempt(client, "Player not in Assembly"); } break; #endregion #region Missions case "acceptmission": { if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe) { int slot = parse[1].ToInt(-1); if (slot > -1 && slot < client.Player.MissionBoard.BoardMissions.Count) { bool taken = client.Player.JobList.AddJob(new WonderMails.WonderMailJob(client.Player.MissionBoard.BoardMissions[slot])); if (taken) { client.Player.MissionBoard.BoardMissions.RemoveAt(slot); Messenger.SendRemovedMission(client, slot); Messenger.SendNewJob(client); } } } else { Messenger.PlayerMsg(client, "You can't accept a job here!", Text.BrightRed); } } break; case "startmission": { if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe) { int slot = parse[1].ToInt(-1); if (slot > -1 && slot < client.Player.JobList.JobList.Count) { client.Player.JobList.JobList[slot].Accepted = Enums.JobStatus.Taken; Messenger.SendJobAccept(client, slot); } } else { Messenger.PlayerMsg(client, "You can't take a job here!", Text.BrightRed); } } break; case "deletejob": { if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe) { int slot = parse[1].ToInt(-1); if (slot > -1 && slot < client.Player.JobList.JobList.Count) { client.Player.JobList.RemoveJob(slot); Messenger.SendDeleteJob(client, slot); } } else { Messenger.PlayerMsg(client, "You can't delete a job here!", Text.BrightRed); } } break; case "sendmission": { if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe) { Client target = ClientManager.FindClient(parse[2]); if (target != null) { if (target != client) { int slot = parse[1].ToInt(-1); if (target.Player.GetDungeonCompletionCount(client.Player.JobList.JobList[slot].Mission.DungeonIndex) > 0) { if (target.Player.JobList.JobList.Count < Constants.MAX_JOB_LIST) { if (Combat.MoveProcessor.IsInAreaRange(1, client.Player.X, client.Player.Y, target.Player.X, target.Player.Y)) { if (slot > -1 && slot < client.Player.JobList.JobList.Count) { client.Player.JobList.JobList[slot].SendsRemaining--; if (client.Player.JobList.JobList[slot].SendsRemaining <= 0) { //send sends remaining Messenger.SendRemainingJobSends(client, slot); } target.Player.JobList.AddJobSimple(new WonderMails.WonderMailJob(client.Player.JobList.JobList[slot])); Messenger.PlayerMsg(client, "A Wonder Mail was sent to " + target.Player.Name + "!", Text.BrightGreen); Messenger.PlayerMsg(target, client.Player.Name + " has sent you a Wonder Mail!", Text.BrightGreen); Messenger.SendNewJob(target); } } else { Messenger.PlayerMsg(client, "You have to stand next to the player to send a Wonder Mail.", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "That player's job list is full.", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "That player has not yet completed the dungeon specified in the Wonder Mail.", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't send a Wonder Mail to yourself!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "There's no one online with that name.", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't send a Wonder Mail here!", Text.BrightRed); } } break; case "canceljob": { if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe) { int slot = parse[1].ToInt(-1); if (slot > -1 && slot < client.Player.JobList.JobList.Count) { client.Player.JobList.JobList[slot].Accepted = Enums.JobStatus.Suspended; Messenger.SendJobAccept(client, slot); } } else { Messenger.PlayerMsg(client, "You can't cancel a job here!", Text.BrightRed); } } break; //case "requestmissioncode": { // int slot = parse[1].ToInt(-1); // if (slot > -1 && slot < client.Player.JobList.JobList.Count) { // if (client.Player.JobList.JobList[slot] != null) { // WonderMails.IssuedWonderMailEntry entry = WonderMails.WonderMailSystem.FindIssuedWonderMailByCode(client.Player.JobList.JobList[slot].Mission.EncryptedCode); // if (entry == null) { // // This code has not yet been issued // } else { // } // Messenger.SendMissionCode(client, client.Player.JobList.JobList[slot].Mission); // } // } // } // break; #endregion #region Misc case "ping": //Messenger.SendDataTo(client, TcpPacket.CreatePacket("ping")); break; case "search": { int X = parse[1].ToInt(-1); int Y = parse[2].ToInt(-1); IMap map = client.Player.GetCurrentMap(); // Prevent subscript out of range if (X < 0 || X > map.MaxX || Y < 0 || Y > map.MaxY) { return; } // Check for a player foreach (Client i in map.GetClients()) { if (i.IsPlaying() && map == i.Player.Map && i.Player.X == X && i.Player.Y == Y) { // Consider the player if (MovementProcessor.CanCharacterSeeCharacter(map, client.Player.GetActiveRecruit(), i.Player.GetActiveRecruit())) { if (MovementProcessor.CanCharacterIdentifyCharacter(map, client.Player.GetActiveRecruit(), i.Player.GetActiveRecruit())) { if (i == client) { Messenger.PlayerMsg(client, "You look upon yourself.", Text.Yellow); } else { Messenger.PlayerMsg(client, "You see " + i.Player.Name + ".", Text.Yellow); if (i.Player.GetActiveRecruit().Level >= client.Player.GetActiveRecruit().Level + 5) { Messenger.PlayerMsg(client, "This Pokémon appears to be much more experienced than you.", Text.BrightRed); } else if (i.Player.GetActiveRecruit().Level > client.Player.GetActiveRecruit().Level) { Messenger.PlayerMsg(client, "This Pokémon appears to be slightly more experienced than you.", Text.Yellow); } else if (i.Player.GetActiveRecruit().Level == client.Player.GetActiveRecruit().Level) { Messenger.PlayerMsg(client, "This Pokémon seems to be about as experienced as you.", Text.White); } else if (client.Player.GetActiveRecruit().Level >= i.Player.GetActiveRecruit().Level + 5) { Messenger.PlayerMsg(client, "This Pokémon appears much less experienced than you.", Text.BrightBlue); } else if (client.Player.GetActiveRecruit().Level > i.Player.GetActiveRecruit().Level) { Messenger.PlayerMsg(client, "This Pokémon appears slightly less experienced than you.", Text.Yellow); } } return; } else { Messenger.PlayerMsg(client, "You see a Pokémon.", Text.Yellow); return; } } } } // Check for an npc for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { if (map.ActiveNpc[i].Num > 0) { if (map.ActiveNpc[i].X == X && map.ActiveNpc[i].Y == Y) { if (MovementProcessor.CanCharacterSeeCharacter(map, client.Player.GetActiveRecruit(), map.ActiveNpc[i])) { if (MovementProcessor.CanCharacterIdentifyCharacter(map, client.Player.GetActiveRecruit(), map.ActiveNpc[i])) { Messenger.PlayerMsg(client, "You see a " + NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + ".", Text.Yellow); if (!map.RecruitEnabled) { Messenger.PlayerMsg(client, NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + " cannot be recruited in this area.", Text.Yellow); } else if (map.ActiveNpc[i].Level >= client.Player.GetActiveRecruit().Level) { Messenger.PlayerMsg(client, NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + "'s level is too high for you to recruit it.", Text.Yellow); } else if (NpcManager.Npcs[map.ActiveNpc[i].Num].RecruitRate != 0) { int recruitRate = NpcManager.Npcs[map.ActiveNpc[i].Num].RecruitRate; //Messenger.PlayerMsg(client, NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + "'s recruit rate is " + NpcManager.Npcs[map.ActiveNpc[i].Num].RecruitRate + " (+" + client.Player.GetRecruitBonus() + ")", Text.Yellow); Messenger.PlayerMsg(client, "You have a " + (recruitRate / 10f) + "% of recruiting " + NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + "!", Text.Yellow); } else { Messenger.PlayerMsg(client, NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + " is not recruitable.", Text.Yellow); } return; } else { Messenger.PlayerMsg(client, "You see a Pokémon.", Text.Yellow); return; } } } } } for (int i = 0; i < Constants.MAX_MAP_ITEMS; i++) { if (map.ActiveItem[i].Num > 0/* && !map.ActiveItem[i].Hidden*/) { if (map.ActiveItem[i].X == X && map.ActiveItem[i].Y == Y) { if (MovementProcessor.CanCharacterSeeDestination(map, client.Player.GetActiveRecruit(), X, Y) && !map.ActiveItem[i].Hidden) { if (MovementProcessor.CanCharacterIdentifyDestination(map, client.Player.GetActiveRecruit(), X, Y) && !map.ActiveItem[i].Hidden) { if (map.ActiveItem[i].Sticky) { Messenger.PlayerMsg(client, "You see a x" + ItemManager.Items[map.ActiveItem[i].Num].Name.Trim() + ".", Text.Yellow); return; } else { Messenger.PlayerMsg(client, "You see a " + ItemManager.Items[map.ActiveItem[i].Num].Name.Trim() + ".", Text.Yellow); return; } } else { Messenger.PlayerMsg(client, "You notice an item.", Text.Yellow); return; } } } } } Scripting.ScriptManager.InvokeSub("OnClick", client, map, X, Y); } break; case "mapgetitem": { // Check for scripted signs if (client.Player.GettingMap) return; IMap map = client.Player.GetCurrentMap(); int newX = client.Player.X; int newY = client.Player.Y; Enums.Direction dir = client.Player.Direction; switch (client.Player.Direction) { case Enums.Direction.Up: newY--; break; case Enums.Direction.Down: newY++; break; case Enums.Direction.Left: newX--; break; case Enums.Direction.Right: newX++; break; } if (newX >= 0 && newX < map.MaxX && newY >= 0 && newY < map.MaxY) { if (map.Tile[newX, newY].Type == Enums.TileType.ScriptedSign) { Scripting.ScriptManager.InvokeSub("ScriptedSign", client, map.Tile[newX, newY].Data1, map.Tile[newX, newY].String1, map.Tile[newX, newY].String2, map.Tile[newX, newY].String3, dir); } else if (map.Tile[newX, newY].Type == Enums.TileType.Key) { bool moveUsed = false; for (int i = 0; i < client.Player.GetActiveRecruit().Moves.Length; i++) { if (client.Player.GetActiveRecruit().Moves[i].MoveNum > -1) { Move move = MoveManager.Moves[client.Player.GetActiveRecruit().Moves[i].MoveNum]; if (move.KeyItem > 0) { if (move.KeyItem == map.Tile[newX, newY].Data1) { Messenger.AskQuestion(client, "UseMoveKeyOnEnter", "Would you like to use " + move.Name + "?", -1, new string[] { "Yes", "No" }); moveUsed = true; break; } } } } if (moveUsed == false) { for (int i = 1; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num == map.Tile[newX, newY].Data1) { if (ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Key) { Messenger.AskQuestion(client, "UseKeyOnEnter", "Would you like to use your " + ItemManager.Items[client.Player.Inventory[i].Num].Name + " to unlock the door?", -1, new string[] { "Yes", "No" }); break; } } } } } } client.Player.PickupItem(); } break; case "mapdropitem": { if (client.Player.GettingMap) return; int invNum = parse[1].ToInt(); int amount = parse[2].ToInt(); // Prevent hacking if (invNum < 1 || invNum > client.Player.MaxInv || client.Player.Inventory[invNum].Num <= 0) { Messenger.HackingAttempt(client, "Invalid InvNum: " + invNum); return; } // Prevent hacking if (ItemManager.Items[client.Player.Inventory[invNum].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[invNum].Num].StackCap > 0) { // Check if money and if it is we want to make sure that they aren't trying to drop 0 value if (amount <= 0) { Messenger.PlayerMsg(client, "You must drop more than 0!", Text.BrightRed); return; } if (amount > client.Player.Inventory[invNum].Amount) { Messenger.PlayerMsg(client, "You dont have that much to drop!", Text.BrightRed); return; } } // Prevent hacking if (ItemManager.Items[client.Player.Inventory[invNum].Num].Type != Enums.ItemType.Currency && ItemManager.Items[client.Player.Inventory[invNum].Num].StackCap > 0) { if (amount > client.Player.Inventory[invNum].Amount) { Messenger.HackingAttempt(client, "Item amount modification"); return; } } client.Player.DropItem(invNum, amount); //Messenger.SendStats(client); } break; case "adventurelog": { Messenger.SendAdventureLog(client); } break; case "checkarrows": { //int n = ArrowManagerBase.Arrows[parse[1].ToInt()].Pic; //Messenger.SendDataToMap(client.Player.MapID, TcpPacket.CreatePacket("checkarrows", client.ToString(), n.ToString())); } break; case "checkemoticons": { if (client.Player.Muted == false) { int n = EmoticonManagerBase.Emoticons[parse[1].ToInt()].Pic; Messenger.SendDataToMap(client.Player.MapID, TcpPacket.CreatePacket("checkemoticons", client.ToString(), n.ToString())); } } break; case "clienterror": { string error = parse[1]; error += "\r\n\r\n------- ERROR REPORT END -------\r\n\r\n"; Logging.Logger.AppendToLog("/Client Error Logs/" + DateTime.Now.ToShortDateString().Replace("/", "-") + "/log.txt", error); } break; #endregion #region Scripts case "hotscript1": Scripting.ScriptManager.InvokeSub("HotScript1", client); break; case "hotscript2": Scripting.ScriptManager.InvokeSub("HotScript2", client); break; case "hotscript3": Scripting.ScriptManager.InvokeSub("HotScript3", client); break; case "hotscript4": Scripting.ScriptManager.InvokeSub("HotScript4", client); break; case "questionresult": if (!string.IsNullOrEmpty(client.Player.QuestionID)) { string id = client.Player.QuestionID; client.Player.QuestionID = ""; if (id.StartsWith("DropItem:")) { if (parse[1] == "Yes") { string[] parseID = id.Split(':'); int itemSlot = parseID[1].ToInt(); int amount = parseID[2].ToInt(); if (client.Player.Inventory[itemSlot].Num <= 0) return; if (client.Player.Inventory[itemSlot].Amount < amount) return; if (amount == 0) amount = 1; int payout = ItemManager.Items[client.Player.Inventory[itemSlot].Num].Price * amount; if (client.Player.FindInvSlot(1, payout) == -1) { Messenger.PlayerMsg(client, "You can't carry any more " + ItemManager.Items[1].Name + ".", Text.BrightRed); return; } client.Player.GiveItem(1, payout); Messenger.PlayerMsg(client, "Trade successful!", Text.Yellow); client.Player.TakeItemSlot(itemSlot, amount, true); //client.Player.DropItem(itemSlot, amount, null, true); } } switch (id) { case "BuyItem": { if (parse[1] == "Yes") { if (client.Player.HasItem(1) < client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1) { Messenger.PlayerMsg(client, "You don't have enough " + ItemManager.Items[1].Name + " to buy this item!", Text.BrightRed); return; } if (String.IsNullOrEmpty(client.Player.Map.Tile[client.Player.X, client.Player.Y].String1)) { Messenger.PlayerMsg(client, "Trade successful!", Text.Yellow); client.Player.PickupItem(true); client.Player.TakeItem(1, client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1, true); } else { int slot = client.Player.FindInvSlot(1); if (slot == -1 || client.Player.Inventory[slot].Num != 1) return; Messenger.PlayerMsg(client, "Trade successful!", Text.Yellow); client.Player.PickupItem(true); client.Player.DropItem(slot, client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1, null, true); } } } break; case "CreateGuild": { #region CreateGuild Result if (parse[1] == "Cancel") { client.Player.GuildName = ""; } #endregion } break; case "GuildStepDown": { #region GuildStepDown Result if (parse[1] == "Yes") { Guilds.GuildManager.GuildStepDown(client); } #endregion } break; case "DisbandGuild": { #region DisbandGuild Result if (parse[1] == "Yes") { Guilds.GuildManager.DisbandGuild(client); } #endregion } break; case "RecruitPokemon": { #region RecruitPokemon Result if (parse[1] == "Yes") { int openSlot = client.Player.FindOpenTeamSlot(); int recruitIndex = 0; if (openSlot != -1) { if (client.Player.RequestedRecruit.Level > 0) { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { recruitIndex = client.Player.AddToRecruitmentBank(dbConnection, client.Player.RequestedRecruit); } if (recruitIndex != -1) { client.Player.AddToTeam(recruitIndex, openSlot); client.Player.Team[openSlot].HP = client.Player.Team[openSlot].MaxHP; Messenger.BattleMsg(client, "You have recruited a new team member!", Text.BrightGreen); Messenger.SendActiveTeam(client); } else { Messenger.BattleMsg(client, "You cant recruit! You have too many team members in the assembly!", Text.BrightRed); } } else { Messenger.BattleMsg(client, "You cant recruit! Error 2", Text.BrightRed); } } else { Messenger.BattleMsg(client, "You cant recruit! Your team is full!", Text.BrightRed); } } else { client.Player.RequestedRecruit = null; } client.Player.RequestedRecruit = null; #endregion } break; case "ReleasePokemon": { #region ReleasePokemon Result if (parse[1] == "Yes") { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { client.Player.ReleaseRecruit(dbConnection, client.Player.RequestedRecruit.RecruitIndex); } } client.Player.RequestedRecruit = null; #endregion } break; case "MovesFull": { #region MovesFull Result if (parse[1] == "Yes") { bool allowLearn = true; if (client.Player.GetActiveRecruit().MoveItem != -1) { if (client.Player.HasItem(client.Player.GetActiveRecruit().MoveItem, true) > 0) { client.Player.TakeItem(client.Player.GetActiveRecruit().MoveItem, 0, true); } else { allowLearn = false; } } if (allowLearn) { Messenger.OpenMoveForgetMenu(client); } client.Player.GetActiveRecruit().MoveItem = -1; } else { client.Player.GetActiveRecruit().MoveItem = -1; Messenger.PlayerMsg(client, "You chose to not learn this move.", Text.White); } #endregion } break; case "PlayerTradeRequest": { #region PlayerTradeRequest Result if (parse[1] == "Yes") { Client tradePartner = ClientManager.FindClientFromCharID(client.Player.TradePartner); if (tradePartner != null) { tradePartner.Player.TradePartner = client.Player.CharID; Messenger.OpenTradeMenu(client); } } #endregion } break; case "SingleEvolution": { #region SingleEvolution Result PacketHitList hitlist = null; PacketHitList.MethodStart(ref hitlist); if (parse[1] == "Yes") { int speciesNum = client.Player.GetActiveRecruit().Species; int evoIndex = -1; for (int z = 0; z < EvolutionManager.Evolutions.MaxEvos; z++) { if (EvolutionManager.Evolutions[z].Species == speciesNum) { evoIndex = z; } } if (evoIndex == -1) return; List<int> viableEvos = EvolutionManager.FindViableEvolutions(client, evoIndex); if (viableEvos.Count == 1) { EvolutionBranch evo = Evolutions.EvolutionManager.Evolutions[evoIndex].Branches[viableEvos[0]]; client.Player.GetActiveRecruit().SetSpecies(evo.NewSpecies); if (client.Player.GetActiveRecruit().RecruitIndex > -2) { client.Player.PokemonCaught(client.Player.GetActiveRecruit().Species); } PacketBuilder.AppendPlayerData(client, hitlist); Messenger.SendActiveTeam(client); PacketBuilder.AppendStats(client, hitlist); hitlist.AddPacket(client, PacketBuilder.CreateChatMsg("You have evolved into " + Pokedex.Pokedex.GetPokemon(client.Player.GetActiveRecruit().Species).Name + "! Congratulations!", Text.Yellow)); Scripting.ScriptManager.InvokeFunction("OnEvoDone", client, evo.ReqScript, evo.Data1, evo.Data2, evo.Data3); } } PacketHitList.MethodEnded(ref hitlist); #endregion } break; case "BranchEvolution": { #region BranchEvolution Result PacketHitList hitlist = null; PacketHitList.MethodStart(ref hitlist); if (parse[1] == "Cancel") return; int speciesNum = client.Player.GetActiveRecruit().Species; int evoIndex = -1; for (int z = 0; z < EvolutionManager.Evolutions.MaxEvos; z++) { if (EvolutionManager.Evolutions[z].Species == speciesNum) { evoIndex = z; } } if (evoIndex == -1) return; for (int i = 0; i <= EvolutionManager.Evolutions[evoIndex].Branches.Count; i++) { bool canEvolve = Scripting.ScriptManager.InvokeFunction("ScriptedEvoReq", client, EvolutionManager.Evolutions[evoIndex].Branches[i].ReqScript, EvolutionManager.Evolutions[evoIndex].Branches[i].Data1, EvolutionManager.Evolutions[evoIndex].Branches[i].Data2, EvolutionManager.Evolutions[evoIndex].Branches[i].Data3).ToBool(); if (canEvolve && EvolutionManager.Evolutions[evoIndex].Branches[i].Name == parse[1]) { EvolutionBranch evo = Evolutions.EvolutionManager.Evolutions[evoIndex].Branches[i]; client.Player.GetActiveRecruit().SetSpecies(evo.NewSpecies); if (client.Player.GetActiveRecruit().RecruitIndex > -2) { client.Player.PokemonCaught(client.Player.GetActiveRecruit().Species); } PacketBuilder.AppendPlayerData(client, hitlist); Messenger.SendActiveTeam(client); PacketBuilder.AppendStats(client, hitlist); hitlist.AddPacket(client, PacketBuilder.CreateChatMsg("You have evolved into " + Pokedex.Pokedex.GetPokemon(client.Player.GetActiveRecruit().Species).Name + "! Congratulations!", Text.Yellow)); Scripting.ScriptManager.InvokeFunction("OnEvoDone", client, evo.ReqScript, evo.Data1, evo.Data2, evo.Data3); break; } } PacketHitList.MethodEnded(ref hitlist); //Scripting.ScriptManager.InvokeFunction("EvoDone", player.Client, Evolutions[evoIndex].Branches[i].ReqScript, Evolutions[evoIndex].Branches[i].Data1, Evolutions[evoIndex].Branches[i].Data2, Evolutions[evoIndex].Branches[i].Data3) #endregion } break; case "UseKeyOnEnter": { #region UseKeyOnEnter Result if (parse[1] == "Yes") { IMap map = client.Player.GetCurrentMap(); int newX = client.Player.X; int newY = client.Player.Y; Enums.Direction dir = client.Player.Direction; switch (client.Player.Direction) { case Enums.Direction.Up: newY--; break; case Enums.Direction.Down: newY++; break; case Enums.Direction.Left: newX--; break; case Enums.Direction.Right: newX++; break; } if (newX >= 0 && newX < map.MaxX && newY >= 0 && newY < map.MaxY) { if (map.Tile[newX, newY].Type == Enums.TileType.Key) { for (int i = 1; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num == map.Tile[newX, newY].Data1) { client.Player.UseItem(client.Player.Inventory[i], i); break; } } } } } else if (parse[1] == "No") { } #endregion } break; case "UseMoveKeyOnEnter": { #region UseKeyOnEnter Result if (parse[1] == "Yes") { IMap map = client.Player.GetCurrentMap(); int newX = client.Player.X; int newY = client.Player.Y; Enums.Direction dir = client.Player.Direction; switch (client.Player.Direction) { case Enums.Direction.Up: newY--; break; case Enums.Direction.Down: newY++; break; case Enums.Direction.Left: newX--; break; case Enums.Direction.Right: newX++; break; } if (newX >= 0 && newX < map.MaxX && newY >= 0 && newY < map.MaxY) { if (map.Tile[newX, newY].Type == Enums.TileType.Key) { for (int i = 0; i < client.Player.GetActiveRecruit().Moves.Length; i++) { if (client.Player.GetActiveRecruit().Moves[i].MoveNum > -1) { Move move = MoveManager.Moves[client.Player.GetActiveRecruit().Moves[i].MoveNum]; if (move.KeyItem > 0) { if (move.KeyItem == map.Tile[newX, newY].Data1) { client.Player.GetActiveRecruit().UseMoveKey(map, move, i); break; } } } } } } } #endregion } break; default: { Scripting.ScriptManager.InvokeSub("QuestionResult", client, id, parse[1]); } break; } } break; case "checkcommands": if (!client.Player.Dead) { Scripting.ScriptManager.InvokeSub("Commands", client, CommandProcessor.ParseCommand(parse[1].Trim())); } break; case "reloadscripts": { if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin cloning"); } else { Scripting.ScriptManager.Reload(); Messenger.PlayerMsg(client, "Scripts reloaded!", Text.Yellow); } } break; #endregion #region Tile Checks case "buysprite": { IMap map = client.Player.GetCurrentMap(); if (map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.SpriteChange) { Messenger.PlayerMsg(client, "You need to be on a sprite tile to buy it!", Text.BrightRed); return; } if (map.Tile[client.Player.X, client.Player.Y].Data2 == 0) { client.Player.GetActiveRecruit().SetSpecies(map.Tile[client.Player.X, client.Player.Y].Data1); Messenger.SendStats(client); Messenger.SendInventory(client); Messenger.SendActiveTeam(client); Messenger.SendPlayerData(client); return; } for (int i = 0; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num == map.Tile[client.Player.X, client.Player.Y].Data2) { if (ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Currency) { if (client.Player.Inventory[i].Amount >= map.Tile[client.Player.X, client.Player.Y].Data3) { client.Player.TakeItemSlot(i, map.Tile[client.Player.X, client.Player.Y].Data3, true); Messenger.PlayerMsg(client, "You have bought a new sprite!", Text.BrightGreen); client.Player.GetActiveRecruit().SetSpecies(map.Tile[client.Player.X, client.Player.Y].Data1); Messenger.SendStats(client); //Messenger.SendDataToMap(client.Player.mMap, "checksprite" + TcpManager.SEP_CHAR + client.ToString() + TcpManager.SEP_CHAR + client.Player.GetActiveChar().mSprite.ToString() + TcpManager.SEP_CHAR + TcpManager.END_CHAR); Messenger.SendInventory(client); Messenger.SendActiveTeam(client); Messenger.SendPlayerData(client); } } else { if (client.Player.GetItemSlotHolder(i) == -1) { client.Player.TakeItemSlot(i, 1, true); Messenger.PlayerMsg(client, "You have bought a new sprite!", Text.BrightGreen); client.Player.GetActiveRecruit().SetSpecies(map.Tile[client.Player.X, client.Player.Y].Data1); Messenger.SendStats(client); //Messenger.SendDataToMap(client.Player.mMap, "checksprite" + TcpManager.SEP_CHAR + client.ToString() + TcpManager.SEP_CHAR + client.Player.GetActiveChar().mSprite.ToString() + TcpManager.SEP_CHAR + TcpManager.END_CHAR); Messenger.SendInventory(client); Messenger.SendActiveTeam(client); Messenger.SendPlayerData(client); } } if (client.Player.GetItemSlotHolder(i) == -1) { return; } } } Messenger.PlayerMsg(client, "You dont have enough to buy this sprite!", Text.BrightRed); } break; case "buyhouse": { // TODO: Remake "buyhouse" packet processor //IMap map; //if (client.Player.Map != -2) { // map = MapManager.Maps[client.Player.Map]; //} else { // Messenger.PlayerMsg(client, "You can't buy an instanced map!", Text.BrightRed); // return; //} //if (map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.House) { // Messenger.PlayerMsg(client, "You need to be on a house tile to buy it!", Text.BrightRed); // return; //} //if (map.Tile[client.Player.X, client.Player.Y].Data1 == 0) { // Messenger.PlayerMsg(client, "You have bought a new house!", Text.BrightGreen); // map.Owner = client.Player.Name; // map.Name = client.Player.Name + "'s House"; // map.Revision = map.Revision + 1; // map.Save(); // //MapManager.SaveMap(map.MapNum); // Messenger.SendDataToMap(map.MapID, TcpPacket.CreatePacket("checkformap", map.MapID.ToString(), map.Revision.ToString())); // return; //} //for (int i = 1; i <= Constants.MAX_INV; i++) { // if (client.Player.Inventory[i].Num == map.Tile[client.Player.X, client.Player.Y].Data1) { // if (ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Currency) { // if (client.Player.Inventory[i].Val >= map.Tile[client.Player.X, client.Player.Y].Data2) { // client.Player.Inventory[i].Val -= map.Tile[client.Player.X, client.Player.Y].Data2; // if (client.Player.Inventory[i].Val <= 0) { // client.Player.Inventory[i].Val = 0; // } // Messenger.PlayerMsg(client, "You have bought a new house!", Text.BrightGreen); // map.Owner = client.Player.Name; // map.Name = client.Player.Name + "'s House"; // map.Revision = map.Revision + 1; // map.Save(); // //MapManager.SaveMap(map.MapNum); // Messenger.SendDataToMap(map.MapNum, TcpPacket.CreatePacket("CHECKFORMAP", map.MapNum.ToString(), map.Revision.ToString())); // Messenger.SendInventory(client); // } // } else { // if (client.Player.Weapon != i & client.Player.Weapon != i & client.Player.Shield != i & client.Player.Helmet != i & client.Player.Legs != i & client.Player.Ring != i & client.Player.Necklace != i) { // client.Player.Inventory[i].Num = 0; // Messenger.PlayerMsg(client, "You now own a new house!", Text.BrightGreen); // map.Owner = client.Player.Name; // map.Name = client.Player.Name + "'s House"; // map.Revision = map.Revision + 1; // MapManager.SaveMap(map.MapNum); // Messenger.SendDataToMap(map.MapNum, TcpPacket.CreatePacket("CHECKFORMAP", map.MapNum.ToString(), map.Revision.ToString())); // Messenger.SendInventory(client); // } // } // if (client.Player.Weapon != i & client.Player.Weapon != i & client.Player.Shield != i & client.Player.Helmet != i & client.Player.Legs != i & client.Player.Ring != i & client.Player.Necklace != i) { // return; // } // } //} //Messenger.PlayerMsg(client, "You dont have enough to buy this house!", Text.BrightRed); } break; #endregion #region Story case "needstory": { if (parse[1] == "yes") { Messenger.SendUpdateStoryTo(client, parse[2].ToInt()); if (client.Player.SegmentToStart > -1) { Messenger.SendStartStoryTo(client, parse[2].ToInt(), client.Player.SegmentToStart); } else { Messenger.SendStartStoryTo(client, parse[2].ToInt()); } } else if (parse[1] == "no") { if (client.Player.SegmentToStart > -1) { Messenger.SendStartStoryTo(client, parse[2].ToInt(), client.Player.SegmentToStart); } else { Messenger.SendStartStoryTo(client, parse[2].ToInt()); } } } break; case "updatesegment": { client.Player.CurrentSegment = parse[1].ToInt(-1); } break; case "actonaction": { int storyNum = -1; if (client.Player.CurrentChapter != null && !string.IsNullOrEmpty(client.Player.CurrentChapter.ID)) { storyNum = client.Player.CurrentChapter.ID.ToInt(-1); } if (client.Player.CurrentChapter != null) { StorySegment story = client.Player.CurrentChapter.Segments[client.Player.CurrentSegment]; switch (story.Action) { case Enums.StoryAction.RunScript: { Stories.StoryManager.RunScript(client, story.Parameters.GetValue("ScriptIndex").ToInt(), story.Parameters.GetValue("ScriptParam1"), story.Parameters.GetValue("ScriptParam2"), story.Parameters.GetValue("ScriptParam3"), story.Parameters.GetValue("Pause").ToBool()); } break; case Enums.StoryAction.Padlock: { if (storyNum > -1) { if (story.Parameters.GetValue("State") == "Unlock") { client.Player.SetStoryState(storyNum, false); } else if (story.Parameters.GetValue("State") == "Lock") { client.Player.SetStoryState(storyNum, true); } } } break; case Enums.StoryAction.Warp: { int X, Y; if (story.Parameters.GetValue("X") == "-1") { X = client.Player.X; } else { int tmpX = story.Parameters.GetValue("X").ToInt(-1); if (tmpX > -1) { X = tmpX; } else { X = client.Player.X; } } if (story.Parameters.GetValue("Y") == "-1") { Y = client.Player.Y; } else { int tmpY = story.Parameters.GetValue("Y").ToInt(-1); if (tmpY > -1) { Y = tmpY; } else { Y = client.Player.Y; } } Messenger.PlayerWarp(client, story.Parameters.GetValue("MapID"), X, Y); } break; } } } break; case "chaptercomplete": { client.Player.CurrentChapter = null; client.Player.CurrentSegment = -1; if (client.Player.StoryPlaybackCache.Count > 0) { if (!string.IsNullOrEmpty(client.Player.StoryPlaybackCache[0].ID) && client.Player.StoryPlaybackCache[0].ID.IsNumeric()) { StoryManager.PlayStory(client, client.Player.StoryPlaybackCache[0].ID.ToInt()); } else { StoryManager.PlayStory(client, client.Player.StoryPlaybackCache[0]); } client.Player.StoryPlaybackCache.RemoveAt(0); } } break; case "storyloadingcomplete": { client.Player.LoadingStory = false; } break; #endregion #region Editors #region Random Dungeons case "requesteditrdungeon": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } Messenger.SendRDungeonEditor(client); } break; case "addnewrdungeon": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } Messenger.SendAddRDungeonToAll(RDungeonManager.AddRDungeon()); } break; case "editrdungeon": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } int n = parse[1].ToInt(); if (n < 0 || n > RDungeonManager.RDungeons.Count - 1) { Messenger.PlayerMsg(client, "Invalid dungeon client", Text.BrightRed); return; } Messenger.SendEditRDungeonTo(client, n); } break; case "saverdungeon": {//adjust to new variables if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } int z = parse[1].ToInt(); RDungeonManager.RDungeons[z].DungeonName = parse[2]; RDungeonManager.RDungeons[z].Direction = (Enums.Direction)parse[3].ToInt(); int maxFloors = parse[4].ToInt(); RDungeonManager.RDungeons[z].Recruitment = parse[5].ToBool(); RDungeonManager.RDungeons[z].Exp = parse[6].ToBool(); RDungeonManager.RDungeons[z].WindTimer = parse[7].ToInt(); RDungeonManager.RDungeons[z].DungeonIndex = parse[8].ToInt(); int n = 9; RDungeonManager.RDungeons[z].Floors.Clear(); for (int i = 0; i < maxFloors; i++) { RDungeonManager.RDungeons[z].Floors.Add(new RDungeonFloor()); RDungeonManager.RDungeons[z].Floors[i].Options.TrapMin = parse[n].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.TrapMax = parse[n + 1].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.ItemMin = parse[n + 2].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.ItemMax = parse[n + 3].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.Intricacy = parse[n + 4].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.RoomWidthMin = parse[n + 5].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.RoomWidthMax = parse[n + 6].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.RoomLengthMin = parse[n + 7].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.RoomLengthMax = parse[n + 8].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.HallTurnMin = parse[n + 9].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.HallTurnMax = parse[n + 10].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.HallVarMin = parse[n + 11].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.HallVarMax = parse[n + 12].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.WaterFrequency = parse[n + 13].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.Craters = parse[n + 14].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.CraterMinLength = parse[n + 15].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.CraterMaxLength = parse[n + 16].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.CraterFuzzy = parse[n + 17].ToBool(); RDungeonManager.RDungeons[z].Floors[i].Options.MinChambers = parse[n + 18].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Options.MaxChambers = parse[n + 19].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Darkness = parse[n + 20].ToInt(); RDungeonManager.RDungeons[z].Floors[i].GoalType = (Enums.RFloorGoalType)parse[n + 21].ToInt(); RDungeonManager.RDungeons[z].Floors[i].GoalMap = parse[n + 22].ToInt(); RDungeonManager.RDungeons[z].Floors[i].GoalX = parse[n + 23].ToInt(); RDungeonManager.RDungeons[z].Floors[i].GoalY = parse[n + 24].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Music = parse[n + 25]; n += 26; RDungeonManager.RDungeons[z].Floors[i].StairsX = parse[n].ToInt(); RDungeonManager.RDungeons[z].Floors[i].StairsSheet = parse[n + 1].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mGroundX = parse[n + 2].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mGroundSheet = parse[n + 3].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopLeftX = parse[n + 4].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopLeftSheet = parse[n + 5].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopCenterX = parse[n + 6].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopCenterSheet = parse[n + 7].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopRightX = parse[n + 8].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopRightSheet = parse[n + 9].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterLeftX = parse[n + 10].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterLeftSheet = parse[n + 11].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterCenterX = parse[n + 12].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterCenterSheet = parse[n + 13].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterRightX = parse[n + 14].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterRightSheet = parse[n + 15].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomLeftX = parse[n + 16].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomLeftSheet = parse[n + 17].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomCenterX = parse[n + 18].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomCenterSheet = parse[n + 19].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomRightX = parse[n + 20].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomRightSheet = parse[n + 21].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerTopLeftX = parse[n + 22].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerTopLeftSheet = parse[n + 23].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerBottomLeftX = parse[n + 24].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerBottomLeftSheet = parse[n + 25].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerTopRightX = parse[n + 26].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerTopRightSheet = parse[n + 27].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerBottomRightX = parse[n + 28].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerBottomRightSheet = parse[n + 29].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mIsolatedWallX = parse[n + 30].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mIsolatedWallSheet = parse[n + 31].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnTopX = parse[n + 32].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnTopSheet = parse[n + 33].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnCenterX = parse[n + 34].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnCenterSheet = parse[n + 35].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnBottomX = parse[n + 36].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnBottomSheet = parse[n + 37].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowLeftX = parse[n + 38].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowLeftSheet = parse[n + 39].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowCenterX = parse[n + 40].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowCenterSheet = parse[n + 41].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowRightX = parse[n + 42].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowRightSheet = parse[n + 43].ToInt(); n += 44; RDungeonManager.RDungeons[z].Floors[i].mGroundAltX = parse[n].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mGroundAltSheet = parse[n + 1].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mGroundAlt2X = parse[n + 2].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mGroundAlt2Sheet = parse[n + 3].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopLeftAltX = parse[n + 4].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopLeftAltSheet = parse[n + 5].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopCenterAltX = parse[n + 6].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopCenterAltSheet = parse[n + 7].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopRightAltX = parse[n + 8].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mTopRightAltSheet = parse[n + 9].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterLeftAltX = parse[n + 10].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterLeftAltSheet = parse[n + 11].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterCenterAltX = parse[n + 12].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterCenterAltSheet = parse[n + 13].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterCenterAlt2X = parse[n + 14].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterCenterAlt2Sheet = parse[n + 15].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterRightAltX = parse[n + 16].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mCenterRightAltSheet = parse[n + 17].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomLeftAltX = parse[n + 18].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomLeftAltSheet = parse[n + 19].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomCenterAltX = parse[n + 20].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomCenterAltSheet = parse[n + 21].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomRightAltX = parse[n + 22].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mBottomRightAltSheet = parse[n + 23].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerTopLeftAltX = parse[n + 24].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerTopLeftAltSheet = parse[n + 25].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerBottomLeftAltX = parse[n + 26].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerBottomLeftAltSheet = parse[n + 27].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerTopRightAltX = parse[n + 28].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerTopRightAltSheet = parse[n + 29].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerBottomRightAltX = parse[n + 30].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mInnerBottomRightAltSheet = parse[n + 31].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mIsolatedWallAltX = parse[n + 32].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mIsolatedWallAltSheet = parse[n + 33].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnTopAltX = parse[n + 34].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnTopAltSheet = parse[n + 35].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnCenterAltX = parse[n + 36].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnCenterAltSheet = parse[n + 37].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnBottomAltX = parse[n + 38].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mColumnBottomAltSheet = parse[n + 39].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowLeftAltX = parse[n + 40].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowLeftAltSheet = parse[n + 41].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowCenterAltX = parse[n + 42].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowCenterAltSheet = parse[n + 43].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowRightAltX = parse[n + 44].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mRowRightAltSheet = parse[n + 45].ToInt(); n += 46; RDungeonManager.RDungeons[z].Floors[i].mWaterX = parse[n].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mWaterSheet = parse[n + 1].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mWaterAnimX = parse[n + 2].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mWaterAnimSheet = parse[n + 3].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopLeftX = parse[n + 4].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopLeftSheet = parse[n + 5].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopRightX = parse[n + 6].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopRightSheet = parse[n + 7].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomRightX = parse[n + 8].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomRightSheet = parse[n + 9].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomLeftX = parse[n + 10].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomLeftSheet = parse[n + 11].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalForwardX = parse[n + 12].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalForwardSheet = parse[n + 13].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalBackX = parse[n + 14].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalBackSheet = parse[n + 15].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopX = parse[n + 16].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopSheet = parse[n + 17].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreRightX = parse[n + 18].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreRightSheet = parse[n + 19].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomX = parse[n + 20].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomSheet = parse[n + 21].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreLeftX = parse[n + 22].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreLeftSheet = parse[n + 23].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreVerticalX = parse[n + 24].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreVerticalSheet = parse[n + 25].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreHorizontalX = parse[n + 26].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreHorizontalSheet = parse[n + 27].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopLeftX = parse[n + 28].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopLeftSheet = parse[n + 29].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopRightX = parse[n + 30].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopRightSheet = parse[n + 31].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomRightX = parse[n + 32].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomRightSheet = parse[n + 33].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomLeftX = parse[n + 34].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomLeftSheet = parse[n + 35].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopX = parse[n + 36].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopSheet = parse[n + 37].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerRightX = parse[n + 38].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerRightSheet = parse[n + 39].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomX = parse[n + 40].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomSheet = parse[n + 41].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerLeftX = parse[n + 42].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerLeftSheet = parse[n + 43].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreSurroundedX = parse[n + 44].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreSurroundedSheet = parse[n + 45].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopLeftAnimX = parse[n + 46].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopLeftAnimSheet = parse[n + 47].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopRightAnimX = parse[n + 48].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopRightAnimSheet = parse[n + 49].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomRightAnimX = parse[n + 50].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomRightAnimSheet = parse[n + 51].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomLeftAnimX = parse[n + 52].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomLeftAnimSheet = parse[n + 53].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalForwardAnimX = parse[n + 54].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalForwardAnimSheet = parse[n + 55].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalBackAnimX = parse[n + 56].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalBackAnimSheet = parse[n + 57].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopAnimX = parse[n + 58].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreTopAnimSheet = parse[n + 59].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreRightAnimX = parse[n + 60].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreRightAnimSheet = parse[n + 61].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomAnimX = parse[n + 62].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreBottomAnimSheet = parse[n + 63].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreLeftAnimX = parse[n + 64].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreLeftAnimSheet = parse[n + 65].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreVerticalAnimX = parse[n + 66].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreVerticalAnimSheet = parse[n + 67].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreHorizontalAnimX = parse[n + 68].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreHorizontalAnimSheet = parse[n + 69].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopLeftAnimX = parse[n + 70].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopLeftAnimSheet = parse[n + 71].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopRightAnimX = parse[n + 72].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopRightAnimSheet = parse[n + 73].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomRightAnimX = parse[n + 74].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomRightAnimSheet = parse[n + 75].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomLeftAnimX = parse[n + 76].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomLeftAnimSheet = parse[n + 77].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopAnimX = parse[n + 78].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopAnimSheet = parse[n + 79].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerRightAnimX = parse[n + 80].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerRightAnimSheet = parse[n + 81].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomAnimX = parse[n + 82].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomAnimSheet = parse[n + 83].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerLeftAnimX = parse[n + 84].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreInnerLeftAnimSheet = parse[n + 85].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreSurroundedAnimX = parse[n + 86].ToInt(); RDungeonManager.RDungeons[z].Floors[i].mShoreSurroundedAnimSheet = parse[n + 87].ToInt(); n += 88; RDungeonManager.RDungeons[z].Floors[i].GroundTile.Type = (Enums.TileType)parse[n].ToInt(); RDungeonManager.RDungeons[z].Floors[i].GroundTile.Data1 = parse[n + 1].ToInt(); RDungeonManager.RDungeons[z].Floors[i].GroundTile.Data2 = parse[n + 2].ToInt(); RDungeonManager.RDungeons[z].Floors[i].GroundTile.Data3 = parse[n + 3].ToInt(); RDungeonManager.RDungeons[z].Floors[i].GroundTile.String1 = parse[n + 4]; RDungeonManager.RDungeons[z].Floors[i].GroundTile.String2 = parse[n + 5]; RDungeonManager.RDungeons[z].Floors[i].GroundTile.String3 = parse[n + 6]; RDungeonManager.RDungeons[z].Floors[i].HallTile.Type = (Enums.TileType)parse[n + 7].ToInt(); RDungeonManager.RDungeons[z].Floors[i].HallTile.Data1 = parse[n + 8].ToInt(); RDungeonManager.RDungeons[z].Floors[i].HallTile.Data2 = parse[n + 9].ToInt(); RDungeonManager.RDungeons[z].Floors[i].HallTile.Data3 = parse[n + 10].ToInt(); RDungeonManager.RDungeons[z].Floors[i].HallTile.String1 = parse[n + 11]; RDungeonManager.RDungeons[z].Floors[i].HallTile.String2 = parse[n + 12]; RDungeonManager.RDungeons[z].Floors[i].HallTile.String3 = parse[n + 13]; RDungeonManager.RDungeons[z].Floors[i].WaterTile.Type = (Enums.TileType)parse[n + 14].ToInt(); RDungeonManager.RDungeons[z].Floors[i].WaterTile.Data1 = parse[n + 15].ToInt(); RDungeonManager.RDungeons[z].Floors[i].WaterTile.Data2 = parse[n + 16].ToInt(); RDungeonManager.RDungeons[z].Floors[i].WaterTile.Data3 = parse[n + 17].ToInt(); RDungeonManager.RDungeons[z].Floors[i].WaterTile.String1 = parse[n + 18]; RDungeonManager.RDungeons[z].Floors[i].WaterTile.String2 = parse[n + 19]; RDungeonManager.RDungeons[z].Floors[i].WaterTile.String3 = parse[n + 20]; RDungeonManager.RDungeons[z].Floors[i].WallTile.Type = (Enums.TileType)parse[n + 21].ToInt(); RDungeonManager.RDungeons[z].Floors[i].WallTile.Data1 = parse[n + 22].ToInt(); RDungeonManager.RDungeons[z].Floors[i].WallTile.Data2 = parse[n + 23].ToInt(); RDungeonManager.RDungeons[z].Floors[i].WallTile.Data3 = parse[n + 24].ToInt(); RDungeonManager.RDungeons[z].Floors[i].WallTile.String1 = parse[n + 25]; RDungeonManager.RDungeons[z].Floors[i].WallTile.String2 = parse[n + 26]; RDungeonManager.RDungeons[z].Floors[i].WallTile.String3 = parse[n + 27]; RDungeonManager.RDungeons[z].Floors[i].NpcSpawnTime = parse[n + 28].ToInt(); RDungeonManager.RDungeons[z].Floors[i].NpcMin = parse[n + 29].ToInt(); RDungeonManager.RDungeons[z].Floors[i].NpcMax = parse[n + 30].ToInt(); n += 31; RDungeonManager.RDungeons[z].Floors[i].Items.Clear(); for (int item = 0; item < parse[n].ToInt(); item++) { RDungeonItem newItem = new RDungeonItem(); newItem.ItemNum = parse[n + item * 10 + 1].ToInt(); newItem.MinAmount = parse[n + item * 10 + 2].ToInt(); newItem.MaxAmount = parse[n + item * 10 + 3].ToInt(); newItem.AppearanceRate = parse[n + item * 10 + 4].ToInt(); newItem.StickyRate = parse[n + item * 10 + 5].ToInt(); newItem.Tag = parse[n + item * 10 + 6]; newItem.Hidden = parse[n + item * 10 + 7].ToBool(); newItem.OnGround = parse[n + item * 10 + 8].ToBool(); newItem.OnWater = parse[n + item * 10 + 9].ToBool(); newItem.OnWall = parse[n + item * 10 + 10].ToBool(); RDungeonManager.RDungeons[z].Floors[i].Items.Add(newItem); } n += RDungeonManager.RDungeons[z].Floors[i].Items.Count * 10 + 1; RDungeonManager.RDungeons[z].Floors[i].Npcs.Clear(); for (int npc = 0; npc < parse[n].ToInt(); npc++) { MapNpcPreset newNpc = new MapNpcPreset(); newNpc.NpcNum = parse[n + npc * 7 + 1].ToInt(); newNpc.MinLevel = parse[n + npc * 7 + 2].ToInt(); newNpc.MaxLevel = parse[n + npc * 7 + 3].ToInt(); newNpc.AppearanceRate = parse[n + npc * 7 + 4].ToInt(); newNpc.StartStatus = (Enums.StatusAilment)parse[n + npc * 7 + 5].ToInt(); newNpc.StartStatusCounter = parse[n + npc * 7 + 6].ToInt(); newNpc.StartStatusChance = parse[n + npc * 7 + 7].ToInt(); RDungeonManager.RDungeons[z].Floors[i].Npcs.Add(newNpc); } n += RDungeonManager.RDungeons[z].Floors[i].Npcs.Count * 7 + 1; RDungeonManager.RDungeons[z].Floors[i].SpecialTiles.Clear(); for (int traps = 0; traps < parse[n].ToInt(); traps++) { RDungeonTrap newTile = new RDungeonTrap(); newTile.Type = (Enums.TileType)parse[n + traps * 29 + 1].ToInt(); newTile.Data1 = parse[n + traps * 29 + 2].ToInt(); newTile.Data2 = parse[n + traps * 29 + 3].ToInt(); newTile.Data3 = parse[n + traps * 29 + 4].ToInt(); newTile.String1 = parse[n + traps * 29 + 5]; newTile.String2 = parse[n + traps * 29 + 6]; newTile.String3 = parse[n + traps * 29 + 7]; newTile.Ground = parse[n + traps * 29 + 8].ToInt(); newTile.GroundSet = parse[n + traps * 29 + 9].ToInt(); newTile.GroundAnim = parse[n + traps * 29 + 10].ToInt(); newTile.GroundAnimSet = parse[n + traps * 29 + 11].ToInt(); newTile.Mask = parse[n + traps * 29 + 12].ToInt(); newTile.MaskSet = parse[n + traps * 29 + 13].ToInt(); newTile.Anim = parse[n + traps * 29 + 14].ToInt(); newTile.AnimSet = parse[n + traps * 29 + 15].ToInt(); newTile.Mask2 = parse[n + traps * 29 + 16].ToInt(); newTile.Mask2Set = parse[n + traps * 29 + 17].ToInt(); newTile.M2Anim = parse[n + traps * 29 + 18].ToInt(); newTile.M2AnimSet = parse[n + traps * 29 + 19].ToInt(); newTile.Fringe = parse[n + traps * 29 + 20].ToInt(); newTile.FringeSet = parse[n + traps * 29 + 21].ToInt(); newTile.FAnim = parse[n + traps * 29 + 22].ToInt(); newTile.FAnimSet = parse[n + traps * 29 + 23].ToInt(); newTile.Fringe2 = parse[n + traps * 29 + 24].ToInt(); newTile.Fringe2Set = parse[n + traps * 29 + 25].ToInt(); newTile.F2Anim = parse[n + traps * 29 + 26].ToInt(); newTile.F2AnimSet = parse[n + traps * 29 + 27].ToInt(); newTile.RDungeonMapValue = parse[n + traps * 29 + 28].ToInt(); newTile.AppearanceRate = parse[n + traps * 29 + 29].ToInt(); RDungeonManager.RDungeons[z].Floors[i].SpecialTiles.Add(newTile); } n += RDungeonManager.RDungeons[z].Floors[i].SpecialTiles.Count * 29 + 1; RDungeonManager.RDungeons[z].Floors[i].Weather.Clear(); for (int weather = 0; weather < parse[n].ToInt(); weather++) { RDungeonManager.RDungeons[z].Floors[i].Weather.Add((Enums.Weather)parse[n + 1 + weather].ToInt()); } n += RDungeonManager.RDungeons[z].Floors[i].Weather.Count + 1; RDungeonManager.RDungeons[z].Floors[i].Options.Chambers.Clear(); for (int chamber = 0; chamber < parse[n].ToInt(); chamber++) { RDungeonPresetChamber newChamber = new RDungeonPresetChamber(); newChamber.ChamberNum = parse[n + chamber * 4 + 1].ToInt(); newChamber.String1 = parse[n + chamber * 4 + 2]; newChamber.String2 = parse[n + chamber * 4 + 3]; newChamber.String3 = parse[n + chamber * 4 + 4]; RDungeonManager.RDungeons[z].Floors[i].Options.Chambers.Add(newChamber); } n += RDungeonManager.RDungeons[z].Floors[i].Options.Chambers.Count * 4 + 1; } Messenger.SendUpdateRDungeonToAll(z); RDungeonManager.SaveRDungeon(z); } break; #endregion #region Maps case "mapreportrequest": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } TcpPacket packet = new TcpPacket("mapreport"); packet.AppendParameter(MapManager.StandardMapCount); using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Data)) { for (int i = 1; i <= MapManager.StandardMapCount; i++) { //packet.AppendParameter(MapManager.Maps[i].Name); packet.AppendParameter(DataManager.Maps.MapDataManager.GetMapName(dbConnection.Database, MapManager.GenerateMapID(i))); } } Messenger.SendDataTo(client, packet); } break; case "requesteditmap": if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } if (client.Player.Map.MapType == Enums.MapType.Instanced) { int mapBase = ((InstancedMap)client.Player.Map).MapBase; if (mapBase > 0) { client.Player.BeginUninstancedWarp(); Messenger.PlayerWarp(client, mapBase, client.Player.X, client.Player.Y); client.Player.EndUninstancedWarp(); Messenger.PlayerMsg(client, "You have been warped to the original map to edit it!", Text.BrightBlue); return; } } if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House) { Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed); return; } client.Player.InMapEditor = true; Messenger.SendDataTo(client, TcpPacket.CreatePacket("editmap")); Messenger.SendMapLatestPropertiesTo(client); break; case "requestedithouse": { if (client.Player.Map.MapType == Enums.MapType.House) { House house = client.Player.Map as House; if (house.OwnerID != client.Player.CharID) { Messenger.PlayerMsg(client, "This is not your house!", Text.BrightRed); return; } Messenger.SendDataTo(client, TcpPacket.CreatePacket("edithouse")); } else { Messenger.PlayerMsg(client, "This is not a house!", Text.BrightRed); } } break; case "mapdata": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { if (client.Player.Map.MapType == Enums.MapType.House) { if (((House)client.Player.Map).OwnerID != client.Player.CharID) { return; } } else { return; } } if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House) { Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed); return; } IMap map = null; string mapID = "s0"; int n = 0; int X = 0; int Y = 0; n = 1; mapID = client.Player.MapID; if (mapID != parse[n]) { Messenger.PlayerMsg(client, "Error Saving: Incorrect Map [Error 3]", Text.BrightRed); return; } if (client.Player.Map.MapType == Enums.MapType.Standard) { map = new Map(new DataManager.Maps.Map(mapID)); } else if (client.Player.Map.MapType == Enums.MapType.House) { House houseMap = client.Player.Map as House; DataManager.Maps.HouseMap newHouseMap = new DataManager.Maps.HouseMap(MapManager.GenerateHouseID(houseMap.OwnerID, houseMap.Room)); newHouseMap.Owner = houseMap.OwnerID; newHouseMap.Room = houseMap.Room; newHouseMap.StartX = ((House)client.Player.Map).StartX; newHouseMap.StartY = ((House)client.Player.Map).StartY; map = new House(newHouseMap); } map.IsSaving = true; int revision = MapManager.RetrieveActiveMap(mapID).Revision; map.Name = parse[n + 1]; map.Revision = revision + 1; map.Moral = (Enums.MapMoral)parse[n + 3].ToInt(); map.Up = parse[n + 4].ToInt(); map.Down = parse[n + 5].ToInt(); map.Left = parse[n + 6].ToInt(); map.Right = parse[n + 7].ToInt(); map.Music = parse[n + 8]; map.Indoors = parse[n + 9].ToBool(); map.Weather = (Enums.Weather)parse[n + 10].ToInt(); map.MaxX = parse[n + 11].ToInt(); map.MaxY = parse[n + 12].ToInt(); map.OriginalDarkness = parse[n + 13].ToInt(); map.HungerEnabled = parse[n + 14].ToBool(); map.RecruitEnabled = parse[n + 15].ToBool(); map.ExpEnabled = parse[n + 16].ToBool(); map.TimeLimit = parse[n + 17].ToInt(); map.MinNpcs = parse[n + 18].ToInt(); map.MaxNpcs = parse[n + 19].ToInt(); map.NpcSpawnTime = parse[n + 20].ToInt(); if (map.MapType == Enums.MapType.Standard) { ((Map)map).Instanced = parse[n + 21].ToBool(); } map.Tile = new TileCollection(map.BaseMap, map.MaxX, map.MaxY); n += 22; for (Y = 0; Y <= map.MaxY; Y++) { for (X = 0; X <= map.MaxX; X++) { map.Tile[X, Y].Ground = parse[n].ToInt(); map.Tile[X, Y].GroundAnim = parse[n + 1].ToInt(); map.Tile[X, Y].Mask = parse[n + 2].ToInt(); map.Tile[X, Y].Anim = parse[n + 3].ToInt(); map.Tile[X, Y].Mask2 = parse[n + 4].ToInt(); map.Tile[X, Y].M2Anim = parse[n + 5].ToInt(); map.Tile[X, Y].Fringe = parse[n + 6].ToInt(); map.Tile[X, Y].FAnim = parse[n + 7].ToInt(); map.Tile[X, Y].Fringe2 = parse[n + 8].ToInt(); map.Tile[X, Y].F2Anim = parse[n + 9].ToInt(); map.Tile[X, Y].Type = (Enums.TileType)parse[n + 10].ToInt(); map.Tile[X, Y].Data1 = parse[n + 11].ToInt(); map.Tile[X, Y].Data2 = parse[n + 12].ToInt(); map.Tile[X, Y].Data3 = parse[n + 13].ToInt(); map.Tile[X, Y].String1 = parse[n + 14]; map.Tile[X, Y].String2 = parse[n + 15]; map.Tile[X, Y].String3 = parse[n + 16]; map.Tile[X, Y].RDungeonMapValue = parse[n + 17].ToInt(); map.Tile[X, Y].GroundSet = parse[n + 18].ToInt(); map.Tile[X, Y].GroundAnimSet = parse[n + 19].ToInt(); map.Tile[X, Y].MaskSet = parse[n + 20].ToInt(); map.Tile[X, Y].AnimSet = parse[n + 21].ToInt(); map.Tile[X, Y].Mask2Set = parse[n + 22].ToInt(); map.Tile[X, Y].M2AnimSet = parse[n + 23].ToInt(); map.Tile[X, Y].FringeSet = parse[n + 24].ToInt(); map.Tile[X, Y].FAnimSet = parse[n + 25].ToInt(); map.Tile[X, Y].Fringe2Set = parse[n + 26].ToInt(); map.Tile[X, Y].F2AnimSet = parse[n + 27].ToInt(); n += 28; if (map.MapType == Enums.MapType.House) { if (map.Tile[X, Y].Type == Enums.TileType.Warp || map.Tile[X, Y].Type == Enums.TileType.Item) { Messenger.PlayerMsg(client, "Invalid map tile placed!", Text.BrightRed); return; } } } } int npcCount = parse[n].ToInt(); n++; for (X = 0; X < npcCount; X++) { MapNpcPreset newNpc = new MapNpcPreset(); newNpc.NpcNum = parse[n].ToInt(); newNpc.SpawnX = parse[n + 1].ToInt(); newNpc.SpawnY = parse[n + 2].ToInt(); newNpc.MinLevel = parse[n + 3].ToInt(); newNpc.MaxLevel = parse[n + 4].ToInt(); newNpc.AppearanceRate = parse[n + 5].ToInt(); newNpc.StartStatus = (Enums.StatusAilment)parse[n + 6].ToInt(); newNpc.StartStatusCounter = parse[n + 7].ToInt(); newNpc.StartStatusChance = parse[n + 8].ToInt(); map.Npc.Add(newNpc); n += 9; } for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { map.ClearActiveNpc(i); } // Clear out it all for (int i = 0; i < Constants.MAX_MAP_ITEMS; i++) { map.SpawnItemSlot(i, -1, 0, false, false, "", map.ActiveItem[i].X, map.ActiveItem[i].Y, null); map.ClearActiveItem(i); } map.RemakePlayersList(); MapManager.UpdateActiveMap(mapID, map); //MapManager.Maps[mapID] = map; // Save the map map.Save(); map.IsSaving = false; // Respawn map.SpawnItems(); map.SpawnNpcs(); // Refresh map for everyone online foreach (Client i in map.GetClients()) { if (i.IsPlaying()) { if (Ranks.IsAllowed(i, Enums.Rank.Mapper)) { if (map.MapType == Enums.MapType.Standard) { Map standardMap = map as Map; if (standardMap != null) { Messenger.SendMapNameUpdate(i, standardMap.MapNum, standardMap.Name); } } } if (i.Player.MapID == map.MapID) { i.Player.InvalidateCachedMap(); Messenger.SendCheckForMap(i); } } } } break; case "scriptedtileinforequest": { Messenger.SendScriptedTileInfoTo(client, (string)Scripting.ScriptManager.InvokeFunction("ScriptedTileInfo", client, parse[1].ToInt())); } break; case "scriptedsigninforequest": { Messenger.SendScriptedSignInfoTo(client, (string)Scripting.ScriptManager.InvokeFunction("ScriptedSignInfo", client, parse[1].ToInt())); } break; case "mobilityinforequest": { Messenger.SendMobilityInfoTo(client, (string)Scripting.ScriptManager.InvokeFunction("MobilityInfo", client, parse[1].ToInt())); } break; #endregion #region Live Map Editor case "exitmapeditor": { client.Player.InMapEditor = false; } break; case "mapeditortileplaced": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { if (client.Player.Map.MapType == Enums.MapType.House) { if (((House)client.Player.Map).OwnerID != client.Player.CharID) { return; } } else { return; } } if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House) { Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed); return; } int x = parse[1].ToInt(); int y = parse[2].ToInt(); int layer = parse[3].ToInt(); int set = parse[4].ToInt(); int tile = parse[5].ToInt(); IMap map = client.Player.Map; foreach (Client mapper in map.GetClients()) { // We only want to check the mappers if (Ranks.IsAllowed(mapper, Enums.Rank.Mapper)) { if (mapper != client) { // We're on the same map... if (mapper.Player.InMapEditor) { // We have the map editor open... Messenger.SendLiveMapEditorTilePlacedData(mapper, x, y, layer, set, tile); } } } } } break; case "mapeditorattribplaced": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { if (client.Player.Map.MapType == Enums.MapType.House) { if (((House)client.Player.Map).OwnerID != client.Player.CharID) { return; } } else { return; } } if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House) { Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed); return; } int x = parse[1].ToInt(); int y = parse[2].ToInt(); int type = parse[3].ToInt(); int data1 = parse[4].ToInt(); int data2 = parse[5].ToInt(); int data3 = parse[6].ToInt(); string string1 = parse[7]; string string2 = parse[8]; string string3 = parse[9]; int dungeonValue = parse[10].ToInt(); IMap map = client.Player.Map; foreach (Client mapper in map.GetClients()) { // We only want to check the mappers if (Ranks.IsAllowed(mapper, Enums.Rank.Mapper)) { if (mapper != client) { // We're on the same map... if (mapper.Player.InMapEditor) { // We have the map editor open... Messenger.SendLiveMapEditorAttributePlacedData(mapper, x, y, type, data1, data2, data3, string1, string2, string3, dungeonValue); } } } } } break; case "mapeditorfilllayer": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { if (client.Player.Map.MapType == Enums.MapType.House) { if (((House)client.Player.Map).OwnerID != client.Player.CharID) { return; } } else { return; } } if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House) { Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed); return; } int layer = parse[1].ToInt(); int set = parse[2].ToInt(); int tile = parse[3].ToInt(); IMap map = client.Player.Map; foreach (Client mapper in map.GetClients()) { // We only want to check the mappers if (Ranks.IsAllowed(mapper, Enums.Rank.Mapper)) { if (mapper != client) { // We're on the same map... if (mapper.Player.InMapEditor) { // We have the map editor open... Messenger.SendLiveMapEditorFillLayerData(mapper, layer, set, tile); } } } } } break; case "mapeditorfillattribute": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { if (client.Player.Map.MapType == Enums.MapType.House) { if (((House)client.Player.Map).OwnerID != client.Player.CharID) { return; } } else { return; } } if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House) { Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed); return; } int type = parse[1].ToInt(); int data1 = parse[2].ToInt(); int data2 = parse[3].ToInt(); int data3 = parse[4].ToInt(); string string1 = parse[5]; string string2 = parse[6]; string string3 = parse[7]; int dungeonValue = parse[8].ToInt(); IMap map = client.Player.Map; foreach (Client mapper in map.GetClients()) { // We only want to check the mappers if (Ranks.IsAllowed(mapper, Enums.Rank.Mapper)) { if (mapper != client) { // We're on the same map... if (mapper.Player.InMapEditor) { // We have the map editor open... Messenger.SendLiveMapEditorFillAttributeData(mapper, type, data1, data2, data3, string1, string2, string3, dungeonValue); } } } } } break; #endregion #region Items case "requestedititem": if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } Messenger.SendItemEditor(client); break; //case "edititem": { ~unneeded due to the info already being clientside // int n = -1; // if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { // Messenger.HackingAttempt(client, "Admin cloning"); // return; // } // n = parse[1].ToInt(); // if (n < 0 || n > Items.ItemManager.Items.MaxItems) { // Messenger.HackingAttempt(client, "Invalid item client"); // return; // } // record in log here // Messenger.SendEditItemTo(client, n); // } // break; case "saveitem": { int n = -1; if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } n = parse[1].ToInt(); if (n < 0 || n >= Items.ItemManager.Items.MaxItems) { Messenger.HackingAttempt(client, "Admin cloning"); return; } ItemManager.Items[n].Name = parse[2]; ItemManager.Items[n].Desc = parse[3]; ItemManager.Items[n].Pic = parse[4].ToInt(); ItemManager.Items[n].Type = (Enums.ItemType)parse[5].ToInt(); ItemManager.Items[n].Data1 = parse[6].ToInt(); ItemManager.Items[n].Data2 = parse[7].ToInt(); ItemManager.Items[n].Data3 = parse[8].ToInt(); ItemManager.Items[n].Price = parse[9].ToInt(); ItemManager.Items[n].StackCap = parse[10].ToInt(); ItemManager.Items[n].Bound = parse[11].ToBool(); ItemManager.Items[n].Loseable = parse[12].ToBool(); ItemManager.Items[n].Rarity = parse[13].ToInt(); ItemManager.Items[n].ReqData1 = parse[14].ToInt(); ItemManager.Items[n].ReqData2 = parse[15].ToInt(); ItemManager.Items[n].ReqData3 = parse[16].ToInt(); ItemManager.Items[n].ReqData4 = parse[17].ToInt(); ItemManager.Items[n].ReqData5 = parse[18].ToInt(); ItemManager.Items[n].ScriptedReq = parse[19].ToInt(); ItemManager.Items[n].AddHP = parse[20].ToInt(); ItemManager.Items[n].AddPP = parse[21].ToInt(); ItemManager.Items[n].AddAttack = parse[22].ToInt(); ItemManager.Items[n].AddDefense = parse[23].ToInt(); ItemManager.Items[n].AddSpAtk = parse[24].ToInt(); ItemManager.Items[n].AddSpDef = parse[25].ToInt(); ItemManager.Items[n].AddSpeed = parse[26].ToInt(); ItemManager.Items[n].AddEXP = parse[27].ToInt(); ItemManager.Items[n].AttackSpeed = parse[28].ToInt(); ItemManager.Items[n].RecruitBonus = parse[29].ToInt(); Messenger.SendUpdateItemToAll(n); ItemManager.SaveItem(n); } break; #endregion #region Stories case "requesteditstory": if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } Messenger.SendDataTo(client, TcpPacket.CreatePacket("storyeditor")); break; case "savestory": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } int n = parse[1].ToInt(); if (n < 0 || n > Stories.StoryManager.Stories.MaxStories) { Messenger.HackingAttempt(client, "Invalid story client"); return; } Story story = new Story(StoryManager.Stories[n].ID); story.Name = parse[2]; story.StoryStart = parse[3].ToInt(); story.Revision = StoryManager.Stories[n].Revision + 1; int totalSegments = parse[4].ToInt(); int z = 5; for (int i = 0; i < totalSegments; i++) { story.Segments.Add(new StorySegment()); int totalParameters = parse[z].ToInt(); story.Segments[i].Action = (Enums.StoryAction)parse[z + 1].ToInt(); z += 2; for (int a = 0; a < totalParameters; a++) { story.Segments[i].AddParameter(parse[z], parse[z + 1]); z += 2; } } int exitContinueCount = parse[z].ToInt(); z++; for (int i = 0; i < exitContinueCount; i++) { story.ExitAndContinue.Add(parse[z].ToInt(1)); z++; } StoryManager.Stories.Stories[n] = story; Messenger.SendUpdateStoryNameToAll(n); StoryManager.SaveStory(n); } break; case "editstory": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } int n = parse[1].ToInt(); if (n < 0 || n > Stories.StoryManager.Stories.MaxStories) { Messenger.HackingAttempt(client, "Invalid story client"); return; } Messenger.SendEditStoryTo(client, n); } break; case "requeststory": Messenger.SendUpdateStoryTo(client, parse[1].ToInt()); break; #endregion #region Evolutions case "requesteditevo": // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } Messenger.SendDataTo(client, TcpPacket.CreatePacket("evoeditor")); break; case "editevo": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } // The evo # int n = parse[1].ToInt(-1); // Prevent hacking if (n < 0 || n > Evolutions.EvolutionManager.Evolutions.MaxEvos) { Messenger.HackingAttempt(client, "Invalid Evolution Index"); return; } Messenger.SendEditEvoTo(client, n); } break; case "saveevo": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } int n = parse[1].ToInt(-1); // Prevent hacking if (n < 0 | n > Evolutions.EvolutionManager.Evolutions.MaxEvos) { Messenger.HackingAttempt(client, "Invalid Evolution Index"); return; } Evolution evo = new Evolution(); evo.Name = parse[2]; evo.Species = parse[3].ToInt(); int z = 5; for (int i = 0; i < parse[4].ToInt(); i++) { evo.Branches.Add(new EvolutionBranch()); evo.Branches[i].Name = parse[z]; evo.Branches[i].NewSpecies = parse[z + 1].ToInt(); evo.Branches[i].ReqScript = parse[z + 2].ToInt(); evo.Branches[i].Data1 = parse[z + 3].ToInt(); evo.Branches[i].Data2 = parse[z + 4].ToInt(); evo.Branches[i].Data3 = parse[z + 5].ToInt(); z += 6; } EvolutionManager.Evolutions[n] = evo; Messenger.SendUpdateEvoToAll(n); Evolutions.EvolutionManager.SaveEvo(n); } break; #endregion #region NPCs case "requesteditnpc": // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } Messenger.SendDataTo(client, TcpPacket.CreatePacket("NPCEDITOR")); break; // ::::::::::::::::::::: // :: Edit npc packet :: // ::::::::::::::::::::: case "editnpc": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } // The npc # int n = parse[1].ToInt(-1); // Prevent hacking if (n < 0 | n > Npcs.NpcManager.Npcs.MaxNpcs) { Messenger.HackingAttempt(client, "Invalid NPC Index"); return; } Messenger.SendNpcAiTypes(client); Messenger.SendEditNpcTo(client, n); } break; case "addnewnpc": { if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } Messenger.SendAddNpcToAll(NpcManager.AddNpc()); } break; // ::::::::::::::::::::: // :: Save npc packet :: // ::::::::::::::::::::: case "savenpc": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } int n = parse[1].ToInt(-1); // Prevent hacking if (n < 0 | n > Npcs.NpcManager.Npcs.MaxNpcs) { Messenger.HackingAttempt(client, "Invalid NPC Index"); return; } Npc npc = new Npc(); // Update the npc npc.Name = parse[2]; npc.AttackSay = parse[3]; npc.Form = parse[4].ToInt(); npc.Species = parse[5].ToInt(); npc.ShinyChance = parse[6].ToInt(); npc.Behavior = (Enums.NpcBehavior)parse[7].ToInt(); npc.RecruitRate = parse[8].ToInt(); npc.AIScript = parse[9]; npc.SpawnsAtDawn = parse[10].ToBool(); npc.SpawnsAtDay = parse[11].ToBool(); npc.SpawnsAtDusk = parse[12].ToBool(); npc.SpawnsAtNight = parse[13].ToBool(); int z = 14; // Load npc moves for (int i = 0; i < npc.Moves.Length; i++) { npc.Moves[i] = parse[z].ToInt(); z += 1; } // Load npc drops for (int i = 0; i < npc.Drops.Length; i++) { npc.Drops[i] = new NpcDrop(); npc.Drops[i].ItemNum = parse[z].ToInt(); npc.Drops[i].ItemValue = parse[z + 1].ToInt(); npc.Drops[i].Chance = parse[z + 2].ToInt(); npc.Drops[i].Tag = parse[z + 3]; z += 4; } NpcManager.Npcs[n] = npc; // Save it Messenger.SendUpdateNpcToAll(n); NpcManager.SaveNpc(n); } break; #endregion #region Shops case "requesteditshop": // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } Messenger.SendDataTo(client, TcpPacket.CreatePacket("shopeditor")); break; // :::::::::::::::::::::: // :: Edit shop packet :: // :::::::::::::::::::::: case "editshop": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } // The shop # int n = parse[1].ToInt(-1); // Prevent hacking if (n < 0 || n > Shops.ShopManager.Shops.MaxShops) { Messenger.HackingAttempt(client, "Invalid Shop Index"); return; } Messenger.SendEditShopTo(client, n); } break; // :::::::::::::::::::::: // :: Save shop packet :: // :::::::::::::::::::::: case "saveshop": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } int ShopNum = parse[1].ToInt(-1); // Prevent hacking if (ShopNum < 0 || ShopNum > Shops.ShopManager.Shops.MaxShops) { Messenger.HackingAttempt(client, "Invalid Shop Index"); return; } Shop shop = new Shop(); // Update the shop shop.Name = parse[2]; shop.JoinSay = parse[3]; shop.LeaveSay = parse[4]; //shop.FixesItems = parse[5].ToBool(); ; int n = 5; for (int i = 0; i < Constants.MAX_TRADES; i++) { shop.Items[i].GiveItem = parse[n].ToInt(); shop.Items[i].GiveValue = parse[n + 1].ToInt(); shop.Items[i].GetItem = parse[n + 2].ToInt(); //shop.Sections[z].Items[i].GetValue = parse[n + 3].ToInt(); n = n + 3; } ShopManager.Shops[ShopNum] = shop; // Save it Messenger.SendUpdateShopToAll(ShopNum); ShopManager.SaveShop(ShopNum); } break; #endregion #region Moves case "requesteditmove": // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } Messenger.SendDataTo(client, TcpPacket.CreatePacket("moveeditor")); break; // ::::::::::::::::::::::: // :: Edit move packet :: // ::::::::::::::::::::::: case "editmove": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } // The spell # int n = parse[1].ToInt(-1); // Prevent hacking if (n < 0 | n > Moves.MoveManager.Moves.MaxMoves) { Messenger.HackingAttempt(client, "Invalid Move Index"); return; } Messenger.SendEditMoveTo(client, n); } break; // ::::::::::::::::::::::: // :: Save move packet :: // ::::::::::::::::::::::: case "savemove": { // // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } // Move # int n = parse[1].ToInt(-1); // Prevent hacking if (n < 0 | n > Moves.MoveManager.Moves.MaxMoves) { Messenger.HackingAttempt(client, "Invalid Move Index"); return; } Move move = new Move(); // Update the spell move.Name = parse[2]; move.MaxPP = parse[3].ToInt(); move.EffectType = (Enums.MoveType)parse[4].ToInt(); move.Element = (Enums.PokemonType)parse[5].ToInt(); move.MoveCategory = (Enums.MoveCategory)parse[6].ToInt(); move.TargetType = (Enums.MoveTarget)parse[7].ToInt(); move.RangeType = (Enums.MoveRange)parse[8].ToInt(); move.Range = parse[9].ToInt(); move.Data1 = parse[10].ToInt(); move.Data2 = parse[11].ToInt(); move.Data3 = parse[12].ToInt(); move.Accuracy = parse[13].ToInt(); move.HitTime = parse[14].ToInt(); move.HitFreeze = parse[15].ToBool(); move.AdditionalEffectData1 = parse[16].ToInt(); move.AdditionalEffectData2 = parse[17].ToInt(); move.AdditionalEffectData3 = parse[18].ToInt(); move.PerPlayer = parse[19].ToBool(); move.KeyItem = parse[20].ToInt(); move.Sound = parse[21].ToInt(); move.AttackerAnim.AnimationType = (Enums.MoveAnimationType)parse[22].ToInt(); move.AttackerAnim.AnimationIndex = parse[23].ToInt(); move.AttackerAnim.FrameSpeed = parse[24].ToInt(); move.AttackerAnim.Repetitions = parse[25].ToInt(); move.TravelingAnim.AnimationType = (Enums.MoveAnimationType)parse[26].ToInt(); move.TravelingAnim.AnimationIndex = parse[27].ToInt(); move.TravelingAnim.FrameSpeed = parse[28].ToInt(); move.TravelingAnim.Repetitions = parse[29].ToInt(); move.DefenderAnim.AnimationType = (Enums.MoveAnimationType)parse[30].ToInt(); move.DefenderAnim.AnimationIndex = parse[31].ToInt(); move.DefenderAnim.FrameSpeed = parse[32].ToInt(); move.DefenderAnim.Repetitions = parse[33].ToInt(); MoveManager.Moves[n] = move; // Save it Messenger.SendUpdateMoveToAll(n); MoveManager.SaveMove(n); } break; #endregion #region Arrows case "requesteditarrow": // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } Messenger.SendArrowEditor(client); break; case "editarrow": { // Prevent hacking //if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { // Messenger.HackingAttempt(client, "Admin Cloning"); // return; //} //int n = parse[1].ToInt(-1); //if (n < 0 | n > Constants.MAX_ARROWS) { // Messenger.HackingAttempt(client, "Invalid arrow Index"); // return; //} //Messenger.SendEditArrowTo(client, n); } break; case "savearrow": { // Prevent hacking //if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { // Messenger.HackingAttempt(client, "Admin Cloning"); // return; //} //int n = parse[1].ToInt(-1); //if (n < 0 | n > Constants.MAX_ARROWS) { // Messenger.HackingAttempt(client, "Invalid arrow Index"); // return; //} //ArrowManagerBase.Arrows[n].Name = parse[2]; //ArrowManagerBase.Arrows[n].Pic = parse[3].ToInt(); //ArrowManagerBase.Arrows[n].Range = parse[4].ToInt(); //ArrowManagerBase.Arrows[n].Amount = parse[5].ToInt(); //Messenger.SendUpdateArrowToAll(n); //ArrowManagerBase.SaveArrows(); } break; #endregion #region Scripts case "requesteditscript": { if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin cloning"); Messenger.AdminMsg("All Admins: " + client.Player.Name + " has attempted to access the script editor", Text.BrightRed); } else { Scripting.Editor.EditorHelper.InitTempScript(client); if (parse[1].ToBool() == false) { Messenger.SendDataTo(client, TcpPacket.CreatePacket("scriptsyntax", System.IO.File.ReadAllText(IO.Paths.ScriptsFolder + "CSharp.syn"))); } Messenger.SendDataTo(client, TcpPacket.CreatePacket("scripteditstart")); Messenger.SendDataTo(client, TcpPacket.CreatePacket("scripteditdata", "Main.cs", System.IO.File.ReadAllText(IO.Paths.ScriptsFolder + "Main.cs").Replace(TcpPacket.SEP_CHAR, '/'))); Scripting.Editor.EditorHelper.SendScriptClasses(client); TcpPacket filelistPacket = new TcpPacket("scriptfilelist"); Scripting.Editor.EditorHelper.AppendFileListToPacket(client, filelistPacket); filelistPacket.FinalizePacket(); Messenger.SendDataTo(client, filelistPacket); client.Player.InScriptEditor = true; } } break; case "savescript": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { System.IO.File.WriteAllText(Scripting.Editor.EditorHelper.GetTempFolder(client) + parse[1] + ".cs", parse[2]); Messenger.PlayerMsg(client, "File Saved! (Temp)", Text.Yellow); } break; case "finalizescript": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { bool testVal = Scripting.ScriptManager.TestCompile(Scripting.Editor.EditorHelper.GetTempFolder(client)); if (testVal) { Scripting.Editor.EditorHelper.SaveScript(client); Messenger.PlayerMsg(client, "Script Compiled and Saved!", Text.Yellow); Scripting.Editor.EditorHelper.SendScriptErrors(client); } else { Messenger.PlayerMsg(client, "Error during script compilation... Script was not saved.", Text.Yellow); Scripting.Editor.EditorHelper.SendScriptErrors(client); } } break; case "savetemp": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning."); return; } else { Scripting.Editor.EditorHelper.SaveTempScript(client, parse[1], parse[2]); } break; case "compilescript": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning."); return; } else { bool testVal = Scripting.ScriptManager.TestCompile(Scripting.Editor.EditorHelper.GetTempFolder(client)); if (testVal) { Scripting.Editor.EditorHelper.SaveScript(client); Messenger.PlayerMsg(client, "Script Compiled and Saved!", Text.Yellow); Scripting.Editor.EditorHelper.SendScriptErrors(client); } else { Messenger.PlayerMsg(client, "Error during script compilation... Script was not saved.", Text.Yellow); Scripting.Editor.EditorHelper.SendScriptErrors(client); } } break; case "scripteditexit": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { return; } else { client.Player.InScriptEditor = false; if (System.IO.Directory.Exists(Scripting.Editor.EditorHelper.GetTempFolder(client))) { System.IO.Directory.Delete(Scripting.Editor.EditorHelper.GetTempFolder(client), true); } } break; case "getscriptclasses": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { Scripting.Editor.EditorHelper.SendScriptClasses(client); } break; case "getscriptmethods": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { Scripting.Editor.EditorHelper.SendScriptMethods(client, parse[1]); } break; case "getscriptparam": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { Scripting.Editor.EditorHelper.SendScriptParameters(client, parse[1], parse[2], parse[3].ToInt(1)); } break; case "requestscriptsyntax": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("scriptsyntax", System.IO.File.ReadAllText(IO.Paths.ScriptsFolder + "CSharp.syn"))); } break; case "requesteditscriptfile": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("scriptfiledata", parse[1], Scripting.Editor.EditorHelper.GetScriptFile(client, parse[1]))); } break; case "requestfilelist": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { TcpPacket filelistPacket = new TcpPacket("scriptfilelist"); Scripting.Editor.EditorHelper.AppendFileListToPacket(client, filelistPacket); filelistPacket.FinalizePacket(); Messenger.SendDataTo(client, filelistPacket); } break; case "addnewclass": if (Ranks.IsDisallowed(client, Enums.Rank.Scripter)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } else { Scripting.Editor.EditorHelper.AddNewClass(client, parse[1]); TcpPacket filelistPacket = new TcpPacket("scriptfilelist"); Scripting.Editor.EditorHelper.AppendFileListToPacket(client, filelistPacket); filelistPacket.FinalizePacket(); Messenger.SendDataTo(client, filelistPacket); } break; #endregion #region Dungeons case "requesteditdungeon": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } Messenger.SendDataTo(client, TcpPacket.CreatePacket("dungeoneditor")); } break; case "addnewdungeon": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } DungeonManager.AddDungeon(); Messenger.SendAddDungeonToAll(DungeonManager.Dungeons.Count - 1); } break; case "savedungeon": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } int n = parse[1].ToInt(); if (n < 0 || n > DungeonManager.Dungeons.Count) { return; } Dungeons.Dungeon dungeon = new Dungeon(); dungeon.Name = parse[2]; dungeon.AllowsRescue = parse[3].ToBool(); int scriptCount = parse[4].ToInt(); int z = 5; for (int i = 0; i < scriptCount; i++) { dungeon.ScriptList.Add(parse[z].ToInt(), parse[z + 1]); z += 2; } int standardMapCount = parse[z].ToInt(); z++; for (int i = 0; i < standardMapCount; i++) { StandardDungeonMap map = new StandardDungeonMap(); map.Difficulty = (Enums.JobDifficulty)parse[z].ToInt(); map.IsBadGoalMap = parse[z + 1].ToBool(); map.MapNum = parse[z + 2].ToInt(); z += 3; dungeon.StandardMaps.Add(map); } int randomMapCount = parse[z].ToInt(); z++; for (int i = 0; i < randomMapCount; i++) { RandomDungeonMap map = new RandomDungeonMap(); map.Difficulty = (Enums.JobDifficulty)parse[z].ToInt(); map.IsBadGoalMap = parse[z + 1].ToBool(); map.RDungeonIndex = parse[z + 2].ToInt(); map.RDungeonFloor = parse[z + 3].ToInt(); z += 4; dungeon.RandomMaps.Add(map); } DungeonManager.Dungeons[n] = dungeon; DungeonManager.SaveDungeon(n); Messenger.SendUpdateDungeonToAll(n); } break; case "editdungeon": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } int n = parse[1].ToInt(); if (n < 0 || n > DungeonManager.Dungeons.Count) { Messenger.HackingAttempt(client, "Invalid dungeon client"); return; } Messenger.SendEditDungeonTo(client, n); } break; #endregion #region Missions case "requesteditmission": { if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } Messenger.SendDataTo(client, TcpPacket.CreatePacket("missioneditor")); } break; case "savemission": { WonderMails.MissionPool missionPool = new WonderMails.MissionPool(); int difficulty = parse[1].ToInt() - 1; int clientCount = parse[2].ToInt(); int n = 3; for (int i = 0; i < clientCount; i++) { WonderMails.MissionClientData missionClient = new WonderMails.MissionClientData(); missionClient.Species = parse[n].ToInt(); missionClient.Form = parse[n + 1].ToInt(); missionPool.MissionClients.Add(missionClient); n += 2; } int enemyCount = parse[n].ToInt(); n++; for (int i = 0; i < enemyCount; i++) { WonderMails.MissionEnemyData missionEnemy = new WonderMails.MissionEnemyData(); missionEnemy.NpcNum = parse[n].ToInt(); missionPool.Enemies.Add(missionEnemy); n++; } int rewardCount = parse[n].ToInt(); n++; for (int i = 0; i < rewardCount; i++) { WonderMails.MissionRewardData missionReward = new WonderMails.MissionRewardData(); ; missionReward.ItemNum = parse[n].ToInt(); missionReward.Amount = parse[n + 1].ToInt(); missionReward.Tag = parse[n + 2]; missionPool.Rewards.Add(missionReward); n += 3; } WonderMails.WonderMailManager.Missions[difficulty] = missionPool; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Data)) { WonderMails.WonderMailManager.SaveMissionPool(dbConnection, difficulty); } } break; case "editmission": { if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } int n = parse[1].ToInt(); if (n < 0 || n > 16) { Messenger.HackingAttempt(client, "Invalid mission client"); return; } Messenger.SendEditMissionTo(client, n - 1); } break; #endregion #endregion #region Online List case "whosonline": Messenger.SendWhosOnline(client); break; case "onlinelist": Messenger.SendOnlineList(client); break; case "playerinforequest": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string name = parse[1]; Client i = ClientManager.FindClient(name); if (i != null) { Messenger.PlayerMsg(client, "Account: " + i.Player.AccountName.Trim() + ", " + i.Player.Name.Trim(), Text.BrightGreen); Messenger.PlayerMsg(client, "-=- Stats for " + i.Player.Name + " -=-", Text.BrightGreen); Messenger.PlayerMsg(client, "Level: " + i.Player.GetActiveRecruit().Level.ToString() + " Exp: " + i.Player.GetActiveRecruit().Exp.ToString() + "/" + i.Player.GetActiveRecruit().GetNextLevel().ToString(), Text.BrightGreen); Messenger.PlayerMsg(client, "HP: " + i.Player.GetActiveRecruit().HP.ToString() + "/" + i.Player.GetMaxHP().ToString(), Text.BrightGreen); Messenger.PlayerMsg(client, "Atk: " + i.Player.GetActiveRecruit().Atk.ToString() + " Def: " + i.Player.GetActiveRecruit().Def.ToString() + " Sp.Atk: " + i.Player.GetActiveRecruit().SpclAtk.ToString() + " Sp.Def: " + i.Player.GetActiveRecruit().SpclDef.ToString() + " Speed: " + i.Player.GetActiveRecruit().Spd.ToString(), Text.BrightGreen); Messenger.PlayerMsg(client, "Species: " + i.Player.GetActiveRecruit().Species.ToString() + " [" + Pokedex.Pokedex.GetPokemon(i.Player.GetActiveRecruit().Species).Name + "] Sprite: " + i.Player.GetActiveRecruit().Sprite.ToString(), Text.BrightGreen); } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } } break; case "getstats": { Messenger.PlayerMsg(client, "-=- Stats for " + client.Player.Name + " -=-", Text.BrightGreen); Messenger.PlayerMsg(client, "Level: " + client.Player.GetActiveRecruit().Level.ToString() + " Exp: " + client.Player.GetActiveRecruit().Exp.ToString() + "/" + client.Player.GetActiveRecruit().GetNextLevel().ToString(), Text.BrightGreen); Messenger.PlayerMsg(client, "HP: " + client.Player.GetActiveRecruit().HP.ToString() + "/" + client.Player.GetMaxHP().ToString(), Text.BrightGreen); Messenger.PlayerMsg(client, "Atk: " + client.Player.GetActiveRecruit().Atk.ToString() + " Def: " + client.Player.GetActiveRecruit().Def.ToString() + " Sp.Str: " + client.Player.GetActiveRecruit().SpclAtk.ToString() + " Sp.Def: " + client.Player.GetActiveRecruit().SpclDef.ToString() + " Speed: " + client.Player.GetActiveRecruit().Spd.ToString(), Text.BrightGreen); Messenger.PlayerMsg(client, "Species: " + Pokedex.Pokedex.GetPokemon(client.Player.GetActiveRecruit().Species).Name, Text.BrightGreen); } break; #endregion #region Admin Commands case "setaccess": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Admin)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } // The client Client n = ClientManager.FindClient(parse[1]); // The access int i = parse[2].ToInt(-1); // Check for invalid access level if (i >= 0 || i <= 3) { if (client.Player.Name != n.Player.Name) { // Check if player is on if (n != null) { if (Ranks.IsAllowed(client, (Enums.Rank)i)) { if (Ranks.IsDisallowed(n, Enums.Rank.Moniter)) { Messenger.GlobalMsg(n.Player.Name + " has been blessed with administrative access.", Text.BrightBlue); } n.Player.Access = (Enums.Rank)i; Messenger.SendPlayerData(n); if (Ranks.IsAllowed(n, Enums.Rank.Mapper)) { n.Player.AddExpKitModule(new AvailableExpKitModule(Enums.ExpKitModules.MapReport, true)); } else { if (n.Player.AvailableExpKitModules.Contains(Enums.ExpKitModules.MapReport)) { n.Player.RemoveExpKitModule(Enums.ExpKitModules.MapReport); } } } else { Messenger.PlayerMsg(client, "You cannot set someone's access higher than yours!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "Player is not online.", Text.White); } } else { Messenger.PlayerMsg(client, "You cant change your access.", Text.Red); } } else { Messenger.PlayerMsg(client, "Invalid access level.", Text.Red); } } break; case "setmotd": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } Settings.MOTD = parse[1]; Messenger.GlobalMsg("MOTD changed to: " + parse[1], Text.BrightCyan); Settings.SaveMOTD(); } break; case "restartserver": { // Prevent hacking if (Ranks.IsDisallowed(client, Enums.Rank.ServerHost)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying()) { i.Player.SaveCharacterData(dbConnection); } } } PlayerManager.SavingEnabled = false; System.Windows.Forms.Application.Restart(); System.Environment.Exit(0); } break; case "setsprite": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } else { int n = parse[1].ToInt(-1); if (n > -1) { client.Player.GetActiveRecruit().SetSpecies(n); Messenger.SendPlayerData(client); Messenger.SendActiveTeam(client); Messenger.SendStats(client); } } } break; case "setplayersprite": { if (Ranks.IsDisallowed(client, Enums.Rank.Admin)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } else { int n = parse[2].ToInt(-1); Client player = ClientManager.FindClient(parse[1]); if (n > -1 && player != null) { player.Player.GetActiveRecruit().SetSpecies(n); Messenger.SendPlayerData(player); Messenger.SendActiveTeam(player); Messenger.SendStats(player); } } } break; case "maprespawn": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } else { IMap map = client.Player.GetCurrentMap(); for (int i = 0; i < Constants.MAX_MAP_ITEMS; i++) { map.SpawnItemSlot(i, -1, 0, false, false, "", map.ActiveItem[i].X, map.ActiveItem[i].Y, null); map.ClearActiveItem(i); } map.SpawnItems(); // Respawn NPCs for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { map.ClearActiveNpc(i); } map.SpawnNpcs(); Messenger.PlayerMsg(client, "Map respawned.", Text.Blue); } } break; case "kickplayer": { if (Ranks.IsDisallowed(client, Enums.Rank.Moniter)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } else { Client n = ClientManager.FindClient(parse[1]); if (n == client) { Messenger.PlayerMsg(client, "You can't kick yourself!", Text.BrightRed); } else if (n == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } else if (Ranks.IsAllowed(n, client.Player.Access)) { Messenger.PlayerMsg(client, "That is a higher access admin than you!", Text.BrightRed); } else { //Messenger.GlobalMsg(n.Player.Name + " has been kicked from " + Settings.GameName + " by " + client.Player.Name + "!", Text.White); //Messenger.AlertMsg(n, "You have been kicked by " + client.Player.Name + "!"); Messenger.PlayerMsg(client, n.Player.Name + " has been kicked from the server!", Text.BrightGreen); Messenger.PlainMsg(n, "You have been kicked from the server!", Enums.PlainMsgType.MainMenu); n.CloseConnection(); } } } break; case "banplayer": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } else { Client n = ClientManager.FindClient(parse[1]); if (n == client) { Messenger.PlayerMsg(client, "You can't kick yourself!", Text.BrightRed); } else if (n == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } else if (Ranks.IsAllowed(n, client.Player.Access)) { Messenger.PlayerMsg(client, "That is a higher access admin than you!", Text.BrightRed); } else { // Add banning to scripts //Messenger.GlobalMsg(n.Player.Name + " has been banned from " + Settings.GameName + " by " + client.Player.Name + "!", Text.White); //PlayerManager.AddToBanList(((System.Net.IPEndPoint)n.TcpClient.Socket.RemoteEndPoint).Address.ToString(), client.Player.Name, n.Player.Name); //Messenger.AlertMsg(n, "You have been kicked by " + client.Player.Name + "!"); } } } break; case "banlist": { if (Ranks.IsDisallowed(client, Enums.Rank.Moniter)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } else { // TODO: Display ban list //if (PlayerManager.Bans.Count > 0) { // string list = ""; // for (int i = 0; i < PlayerManager.Bans.Count; i++) { // list += i.ToString() + ". IP: " + PlayerManager.Bans[i].BannedIP + ", Banned By: " + PlayerManager.Bans[i].BannedBy + ", Banned Player: " + PlayerManager.Bans[i].BannedAccount + "\r\n"; // } // Messenger.PlayerMsg(client, list, Text.BrightBlue); //} else { // Messenger.PlayerMsg(client, "There are no bans.", Text.BrightBlue); //} } } break; // TODO: Unban all players/unban single player [MEDIUM] case "banlistdestroy": { } break; case "warpto": { if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Messenger.HackingAttempt(client, "Admin cloning"); return; } else { Messenger.PlayerWarp(client, parse[1].ToInt(), client.Player.X, client.Player.Y); } } break; case "warptome": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { Client n = ClientManager.FindClient(parse[1]); if (n != null) { Messenger.PlayerWarp(n, client.Player.Map, client.Player.X, client.Player.Y); } } } break; case "warpmeto": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { Client n = ClientManager.FindClient(parse[1]); if (n != null) { Messenger.PlayerWarp(client, n.Player.Map, n.Player.X, n.Player.Y); } } } break; case "warploc": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper) || client.Player.Map.MapType == Enums.MapType.House && ((House)client.Player.Map).OwnerID == client.Player.CharID) { Messenger.PlayerXYWarp(client, parse[1].ToInt(), parse[2].ToInt()); } } break; case "arrowhit": { // TODO: Easy way to damage any player. Modify arrow code to be processed server-side [HIGH] int n = parse[1].ToInt(); int z = parse[2].ToInt(); int x = parse[3].ToInt(); int y = parse[4].ToInt(); // BattleProcessor.ArrowHit(client, (Enums.TargetType)n, z); } break; case "saveplayer": { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { client.Player.SaveCharacterData(dbConnection); } Messenger.PlayerMsg(client, "You have saved the game.", Text.Yellow); } break; case "solid": { if (client.Player.Solid == true) { client.Player.Solid = false; Messenger.PlayerMsg(client, "You can run through players now.", Text.Yellow); } else { client.Player.Solid = true; Messenger.PlayerMsg(client, "You can no longer run through players.", Text.Yellow); } Messenger.SendPlayerData(client); } break; case "weather": { if (Ranks.IsAllowed(client, Enums.Rank.Developer)) { int weather = parse[1].ToInt(-1); if (weather > -1 && weather < 13) { Globals.ServerWeather = (Enums.Weather)weather; if (Globals.ServerWeather != Enums.Weather.Ambiguous) { IMap[] mapArray = MapManager.ToArray(); for (int i = 0; i < mapArray.Length; i++) { mapArray[i].Weather = Globals.ServerWeather; } } Messenger.SendWeatherToAll(); } } else { Messenger.HackingAttempt(client, "Admin Cloning [Changing Weather]"); } } break; #endregion #region Friends List case "sendfriendslist": client.Player.SendFriendsList(); break; case "addfriend": client.Player.AddFriend(parse[1]); break; case "removefriend": client.Player.RemoveFriend(parse[1]); break; #endregion #region Guild case "guildpromote": { if (client.Player.GuildAccess < Enums.GuildRank.Founder) { Messenger.PlayerMsg(client, "You are not the owner of this guild!", Text.BrightRed); return; } ListPair<string, int> members; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName); if (parse[1].ToInt() > members.Count) { Messenger.PlayerMsg(client, "That player doesn't seem to be in the guild anymore.", Text.BrightRed); return; } int adminCount = 0; for (int i = 0; i < members.Count; i++) { if (members.ValueByIndex(i) > 1) { adminCount++; } } if (client.Player.HasItem(1) < Guilds.GuildManager.PROMOTE_PRICE * adminCount) { Messenger.PlayerMsg(client, "You need " + Guilds.GuildManager.PROMOTE_PRICE * adminCount + " " + ItemManager.Items[1].Name + " to promote a member.", Text.BrightRed); return; } client.Player.TakeItem(1, Guilds.GuildManager.PROMOTE_PRICE * adminCount, true); DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, members.KeyByIndex(parse[1].ToInt()), (int)Enums.GuildRank.Admin); Messenger.PlayerMsg(client, "The player has been promoted.", Text.Blue); } Client target = ClientManager.FindClientFromCharID(members.KeyByIndex(parse[1].ToInt())); if (target != null) { //Set the player's New access level target.Player.GuildAccess = Enums.GuildRank.Admin; //send the guild access data to all Messenger.SendPlayerGuild(target); } //send the update to all possible guild members Messenger.SendFullGuildUpdate(client.Player.GuildName); } break; case "guilddemote": { if (client.Player.GuildAccess < Enums.GuildRank.Founder) { Messenger.PlayerMsg(client, "You are not the owner of this guild!", Text.BrightRed); return; } ListPair<string, int> members; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName); if (parse[1].ToInt() > members.Count) { Messenger.PlayerMsg(client, "That player doesn't seem to be in the guild anymore.", Text.BrightRed); return; } DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, members.KeyByIndex(parse[1].ToInt()), (int)Enums.GuildRank.Member); Messenger.PlayerMsg(client, "The player has been demoted.", Text.Blue); } Client target = ClientManager.FindClientFromCharID(members.KeyByIndex(parse[1].ToInt())); if (target != null) { //Set the player's New access level target.Player.GuildAccess = Enums.GuildRank.Member; //send the guild access data to all Messenger.SendPlayerGuild(target); } //send the update to all possible guild members Messenger.SendFullGuildUpdate(client.Player.GuildName); } break; // Disown case "guilddisown": { if (client.Player.GuildAccess < Enums.GuildRank.Admin) { Messenger.PlayerMsg(client, "Your guild rank isn't high enough to disown players!", Text.BrightRed); return; } ListPair<string, int> members; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName); if (parse[1].ToInt() > members.Count) { Messenger.PlayerMsg(client, "That player doesn't seem to be in the guild anymore.", Text.BrightRed); return; } DataManager.Players.PlayerDataManager.RemoveGuildMember(dbConnection.Database, members.KeyByIndex(parse[1].ToInt())); Messenger.PlayerMsg(client, "The player has been disowned.", Text.Blue); } Client target = ClientManager.FindClientFromCharID(members.KeyByIndex(parse[1].ToInt())); if (target != null) { target.Player.GuildName = ""; target.Player.GuildAccess = Enums.GuildRank.None; //send the guild access data to all Messenger.SendPlayerGuild(target); } //send the update to all possible guild members Messenger.SendFullGuildUpdate(client.Player.GuildName); } break; // Leave Guild case "guildleave": { // Check if they can leave if (string.IsNullOrEmpty(client.Player.GuildName)) { Messenger.PlayerMsg(client, "You are not in a guild.", Text.BrightRed); return; } bool stepDown = false; if (client.Player.GuildAccess > Enums.GuildRank.Member) { stepDown = true; } int index = -1; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { ListPair<string, int> members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName); index = members.IndexOfKey(client.Player.CharID); int founders = 0; for (int i = 0; i < members.Count; i++) { if (members.ValueByIndex(i) == (int)Enums.GuildRank.Founder) founders++; } if (founders == 1 && client.Player.GuildAccess == Enums.GuildRank.Founder) { Messenger.AskQuestion(client, "DisbandGuild", "As the sole founder of this guild, if you step down, the guild will be disbanded. Is that OK?", -1); } else if (stepDown) { Messenger.AskQuestion(client, "GuildStepDown", "Are you sure you want to step down from your current guild position?", -1); } else { Messenger.AskQuestion(client, "GuildStepDown", "Are you sure you want to leave the guild?", -1); } } } break; // Make A New Guild case "makeguild": { string name = parse[1].Trim(); Guilds.GuildManager.RegisterGuild(client, name); } break; case "guildmember": { if (client.Player.GuildAccess < Enums.GuildRank.Admin) { Messenger.PlayerMsg(client, "Your guild rank isn't high enough to add players!", Text.BrightRed); return; } //find character ID from name in database string charID; string guild; Client target = null; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { charID = DataManager.Players.PlayerDataManager.RetrieveCharacterID(dbConnection.Database, parse[1]); if (String.IsNullOrEmpty(charID)) { Messenger.PlayerMsg(client, "The player could not be found.", Text.BrightRed); return; } target = ClientManager.FindClientFromCharID(charID); if (target == null) { Messenger.PlayerMsg(client, "That player isn't online!", Text.BrightRed); return; } if (target.Player.MapID != client.Player.MapID || target.Player.X != client.Player.X || target.Player.Y != client.Player.Y) { Messenger.PlayerMsg(client, "The joining player needs to be with you on the same tile!", Text.BrightRed); return; } guild = DataManager.Players.PlayerDataManager.GetGuildName(dbConnection.Database, charID); if (!String.IsNullOrEmpty(guild)) { Messenger.PlayerMsg(client, "That player is already in a guild!", Text.BrightRed); return; } ListPair<string, int> members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName); if (client.Player.HasItem(1) < Guilds.GuildManager.RECRUIT_PRICE * members.Count) { Messenger.PlayerMsg(client, "You need " + Guilds.GuildManager.RECRUIT_PRICE * members.Count + " " + ItemManager.Items[1].Name + " to add a member.", Text.BrightRed); return; } client.Player.TakeItem(1, Guilds.GuildManager.RECRUIT_PRICE * members.Count, true); DataManager.Players.PlayerDataManager.AddGuildMember(dbConnection.Database, client.Player.GuildName, charID); Messenger.PlayerMsg(client, "The player has been added to the guild!", Text.Blue); } if (target != null) { target.Player.GuildName = client.Player.GuildName; target.Player.GuildAccess = Enums.GuildRank.Member; //send the guild access data to all Messenger.SendPlayerGuild(target); } //send the update to all possible guild members Messenger.SendFullGuildUpdate(client.Player.GuildName); } break; #endregion #region Items case "useitem": { if (client.Player.GettingMap) return; int invNum = parse[1].ToInt(-1); if (invNum != -1 && (invNum < 1 || invNum > client.Player.MaxInv)) { Messenger.HackingAttempt(client, "Invalid InvNum"); return; } client.Player.UseItem(client.Player.Inventory[invNum], invNum); } break; case "throwitem": { if (client.Player.GettingMap) return; int invNum = parse[1].ToInt(-1); if (invNum != -1 && (invNum < 1 || invNum > client.Player.MaxInv)) { Messenger.HackingAttempt(client, "Invalid InvNum"); return; } client.Player.ThrowItem(client.Player.Inventory[parse[1].ToInt(-1)], parse[1].ToInt(-1)); } break; case "holditem": { client.Player.HoldItem(parse[1].ToInt(-1)); } break; case "removeitem": { client.Player.RemoveItem(parse[1].ToInt(-1)); } break; case "swapinvitems": { int oldInvSlot = parse[1].ToInt(-1); int newInvSlot = parse[2].ToInt(-1); if (oldInvSlot > 0 && oldInvSlot <= client.Player.MaxInv && newInvSlot > 0 && newInvSlot <= client.Player.MaxInv) { InventoryItem oldItem = client.Player.Inventory[oldInvSlot]; InventoryItem newItem = client.Player.Inventory[newInvSlot]; oldItem.Updated = true; newItem.Updated = true; client.Player.Inventory[oldInvSlot] = newItem; client.Player.Inventory[newInvSlot] = oldItem; int[] teamHeldItems = new int[client.Player.Team.Length]; bool heldItemsUpdated = false; for (int i = 0; i < client.Player.Team.Length; i++) { if (client.Player.Team[i].Loaded) { teamHeldItems[i] = client.Player.Team[i].HeldItemSlot; } } for (int i = 0; i < teamHeldItems.Length; i++) { if (teamHeldItems[i] == oldInvSlot) { client.Player.Team[i].HeldItemSlot = newInvSlot; heldItemsUpdated = true; } else if (teamHeldItems[i] == newInvSlot) { client.Player.Team[i].HeldItemSlot = oldInvSlot; heldItemsUpdated = true; } } PacketHitList hitlist = null; PacketHitList.MethodStart(ref hitlist); Messenger.SendInventoryUpdate(client, oldInvSlot, hitlist); Messenger.SendInventoryUpdate(client, newInvSlot, hitlist); if (heldItemsUpdated) { PacketBuilder.AppendWornEquipment(client, hitlist); } PacketHitList.MethodEnded(ref hitlist); } } break; #endregion #region Shops case "shoprequest": { if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Shop) { if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1 > 0) { Messenger.SendTrade(client, client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1); } else { Messenger.PlayerMsg(client, "There is no shop here.", Text.BrightRed); } } } break; case "shopleave": { if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Shop && client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1 > 0) { int shopNum = client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1; if (Shops.ShopManager.Shops[shopNum].LeaveSay.Trim() != "") { Messenger.PlayerMsg(client, Shops.ShopManager.Shops[shopNum].LeaveSay.Trim(), Text.Yellow); } } } break; case "traderequest": { // Trade num int n = parse[1].ToInt(); int z = parse[2].ToInt(); // Prevent hacking if ((z < 0) || (z > Constants.MAX_TRADES)) { Messenger.HackingAttempt(client, "Trade Request Modification (index)"); return; } if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.Shop) { Messenger.HackingAttempt(client, "Trade Request Modification (tile)"); return; } // Index for shop int i = client.Player.GetCurrentMap().Tile[client.Player.X, client.Player.Y].Data1; // Check if inv full if (i <= 0) return; int X = client.Player.FindInvSlot(ShopManager.Shops[i].Items[z].GetItem, n); if (X == -1) { Messenger.PlayerMsg(client, "Trade unsuccessful, inventory full.", Text.BrightRed); return; } if (n == 0) { if (ItemManager.Items[ShopManager.Shops[i].Items[z].GetItem].StackCap > 0) { Messenger.PlayerMsg(client, "You must buy more than 0!", Text.BrightRed); return; } else { n = 1; } } if (ItemManager.Items[ShopManager.Shops[i].Items[z].GetItem].Rarity > (int)client.Player.ExplorerRank + 1) { Messenger.PlayerMsg(client, "Your Explorer Rank is not high enough to receive this item!", Text.BrightRed); return; } // Check if they have the item if (client.Player.HasItem(ShopManager.Shops[i].Items[z].GiveItem) >= ShopManager.Shops[i].Items[z].GiveValue * n) { client.Player.TakeItem(ShopManager.Shops[i].Items[z].GiveItem, ShopManager.Shops[i].Items[z].GiveValue * n); client.Player.GiveItem(ShopManager.Shops[i].Items[z].GetItem, n); Messenger.PlayerMsg(client, "The trade was successful!", Text.Yellow); Messenger.SendInventory(client); } else { Messenger.PlayerMsg(client, "Trade unsuccessful.", Text.BrightRed); } } break; case "sellitem": {//sell multiples int sellItemNum = parse[2].ToInt(); int SellItemAmount = parse[1].ToInt(); // Prevent hacking if ((sellItemNum < 0) || (sellItemNum >= ItemManager.Items.MaxItems)) { Messenger.HackingAttempt(client, "Trade Request Modification"); return; } if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.Shop) { Messenger.HackingAttempt(client, "Trade Request Modification"); return; } if (ItemManager.Items[sellItemNum].Price <= 0) { Messenger.PlayerMsg(client, "You can't sell that!", Text.BrightRed); break; } if (SellItemAmount <= 0) { if (ItemManager.Items[sellItemNum].StackCap > 0) { Messenger.PlayerMsg(client, "You must sell more than 0!", Text.BrightRed); break; } else { SellItemAmount = 1; } } if (client.Player.HasItem(sellItemNum) > 0) { if (client.Player.HasItem(sellItemNum) < SellItemAmount) { Messenger.PlayerMsg(client, "You can't sell more than you have!", Text.BrightRed); break; } client.Player.TakeItem(sellItemNum, SellItemAmount); client.Player.GiveItem(1, ItemManager.Items[sellItemNum].Price * SellItemAmount); Messenger.SendInventory(client); Messenger.PlayerMsg(client, "You have sold " + SellItemAmount + " " + Items.ItemManager.Items[sellItemNum].Name + "!", Text.BrightGreen); //Messenger.SendDataTo(client, TcpPacket.CreatePacket("updatesell")); } } break; case "moverecall": { int recallMove = parse[1].ToInt(); // Prevent hacking if ((recallMove <= 0) || (recallMove > MoveManager.Moves.MaxMoves)) { Messenger.HackingAttempt(client, "Move Recall Out of Range :" + recallMove); return; } if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.LinkShop) { return; } int priceItem = client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1; int priceAmount = client.Player.Map.Tile[client.Player.X, client.Player.Y].Data2; bool earlierEvo = (client.Player.Map.Tile[client.Player.X, client.Player.Y].Data3 == 1); if (Items.ItemManager.Items[priceItem].StackCap <= 0 && Items.ItemManager.Items[priceItem].Type != Enums.ItemType.Currency) { priceAmount = 1; } for (int i = 0; i < 4; i++) { if (client.Player.GetActiveRecruit().Moves[i].MoveNum == recallMove) { Messenger.PlayerMsg(client, "You already know this move.", Text.BrightRed); return; } } if (earlierEvo) { int species = EvolutionManager.FindPreEvolution(client.Player.GetActiveRecruit().Species); while (species > -1) { Pokedex.PokemonForm pokemon = Pokedex.Pokedex.GetPokemonForm(species, client.Player.GetActiveRecruit().Form); if (pokemon != null) { for (int n = 0; n < pokemon.LevelUpMoves.Count; n++) { if (pokemon.LevelUpMoves[n].Level <= client.Player.GetActiveRecruit().Level) { if (pokemon.LevelUpMoves[n].Move == recallMove) { if (client.Player.HasItem(priceItem) >= priceAmount) { client.Player.TakeItem(priceItem, priceAmount); client.Player.GetActiveRecruit().LearnNewMove(recallMove); Messenger.SendPlayerMoves(client); } else { Messenger.PlayerMsg(client, "You do not have enough to recall a move!", Text.BrightRed); } return; } } } } species = EvolutionManager.FindPreEvolution(species); } } else { Pokedex.PokemonForm pokemon = Pokedex.Pokedex.GetPokemonForm(client.Player.GetActiveRecruit().Species, client.Player.GetActiveRecruit().Form); if (pokemon != null) { for (int n = 0; n < pokemon.LevelUpMoves.Count; n++) { if (pokemon.LevelUpMoves[n].Level <= client.Player.GetActiveRecruit().Level && pokemon.LevelUpMoves[n].Move == recallMove) { if (client.Player.HasItem(priceItem) >= priceAmount) { client.Player.TakeItem(priceItem, priceAmount); client.Player.GetActiveRecruit().LearnNewMove(recallMove); Messenger.SendPlayerMoves(client); } else { Messenger.PlayerMsg(client, "You do not have enough to recall a move!", Text.BrightRed); } return; } } } } } break; #endregion #region Bank case "bankdeposit": { if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Bank) { int slot = parse[1].ToInt(); int amount = parse[2].ToInt(); int X = client.Player.Inventory[slot].Num; string tag = client.Player.Inventory[slot].Tag; int i = client.Player.FindBankSlot(X, amount); if (i == -1) { Messenger.StorageMessage(client, "The storage is full!"); return; } if (amount > client.Player.Inventory[slot].Amount) { Messenger.StorageMessage(client, "You cant deposit more than you have!"); return; } if (ItemManager.Items[X].Type == Enums.ItemType.Currency || ItemManager.Items[X].StackCap > 0) {//handle clientside if (amount <= 0) { Messenger.StorageMessage(client, "You must deposit more than 0!"); return; } } client.Player.TakeItemSlot(slot, amount, true); client.Player.GiveBankItem(X, amount, tag, i); } else { Messenger.HackingAttempt(client, "Player not in Storage"); } //Messenger.SendBank(client); } break; case "bankwithdraw": { if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Bank) { int slot = parse[1].ToInt(); int i = client.Player.Bank[parse[1].ToInt()].Num; string tag = client.Player.Bank[parse[1].ToInt()].Tag; int TempVal = parse[2].ToInt(); int X = client.Player.FindInvSlot(i, TempVal); if (X == -1) { Messenger.StorageMessage(client, "There's no more room in your bag!"); return; } if (TempVal > client.Player.Bank[slot].Amount) { Messenger.StorageMessage(client, "You cant withdraw more than you have!"); return; } if (ItemManager.Items[i].Type == Enums.ItemType.Currency || ItemManager.Items[i].StackCap > 0) {//handle clientside if (TempVal <= 0) { Messenger.StorageMessage(client, "You must withdraw more than 0!"); return; } } client.Player.GiveItem(i, TempVal, tag, false); client.Player.TakeBankItem(slot, TempVal); } else { Messenger.HackingAttempt(client, "Player not in Storage"); } //Messenger.SendBank(client); } break; case "bankwithdrawmenu": { Messenger.SendBank(client); } break; #endregion #region Custom Menus case "picclick": case "lblclick": case "txtclick": case "menuclosed": client.Player.CustomMenuManager.ProcessTCP(parse); break; #endregion #region Housing case "housevisitrequest": { string ownerName = parse[1]; // Now, find the owner ID using the char list... string ownerID; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { ownerID = PlayerManager.RetrieveCharacterID(dbConnection, ownerName); } if (!string.IsNullOrEmpty(ownerID)) { Messenger.PlayerWarpToHouse(client, ownerID, 0); } else { Messenger.PlayerMsg(client, "There is no house owned by a player of that name.", Text.BrightRed); } } break; case "addshoprequest": { IMap map = client.Player.Map; if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID) { Messenger.PlayerMsg(client, "You can't place a shop tile here.", Text.BrightRed); return; } int price = parse[1].ToInt(); if (client.Player.HasItem(1) < price / House.SHOP_PRICE) { Messenger.PlayerMsg(client, "You need " + price / House.SHOP_PRICE + " " + ItemManager.Items[1].Name + " to place a shop tile.", Text.BrightRed); return; } client.Player.TakeItem(1, price / House.SHOP_PRICE, true); map.Tile[client.Player.X, client.Player.Y].Type = Enums.TileType.DropShop; map.Tile[client.Player.X, client.Player.Y].Data1 = price; map.Tile[client.Player.X, client.Player.Y].Data2 = 0; map.Tile[client.Player.X, client.Player.Y].Data3 = 0; map.Tile[client.Player.X, client.Player.Y].String1 = client.Player.CharID; map.Tile[client.Player.X, client.Player.Y].String2 = ""; map.Tile[client.Player.X, client.Player.Y].String3 = ""; Messenger.PlayerMsg(client, "A shop tile has been placed! You can now sell items for " + parse[1].ToInt() + " " + ItemManager.Items[1].Name + " by dropping your items on the tile.", Text.BrightGreen); Messenger.RefreshMap(client); } break; case "addnoticerequest": { IMap map = client.Player.Map; if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID) { Messenger.PlayerMsg(client, "You can't place a special tile here.", Text.BrightRed); return; } int totalLength = parse[1].Length + parse[2].Length; if (client.Player.HasItem(1) < House.NOTICE_PRICE) { Messenger.PlayerMsg(client, "You need " + (House.NOTICE_PRICE + House.WORD_PRICE * totalLength) + " " + ItemManager.Items[1].Name + " to place a special tile.", Text.BrightRed); return; } client.Player.TakeItem(1, House.NOTICE_PRICE + House.WORD_PRICE * totalLength, true); map.Tile[client.Player.X, client.Player.Y].Type = Enums.TileType.Notice; map.Tile[client.Player.X, client.Player.Y].Data1 = 0; map.Tile[client.Player.X, client.Player.Y].Data2 = 0; map.Tile[client.Player.X, client.Player.Y].Data3 = 0; map.Tile[client.Player.X, client.Player.Y].String1 = parse[1]; map.Tile[client.Player.X, client.Player.Y].String2 = parse[2]; map.Tile[client.Player.X, client.Player.Y].String3 = parse[3]; //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map); Messenger.PlayerMsg(client, "A notice tile has been placed! Step on it to read what it says.", Text.BrightGreen); Messenger.RefreshMap(client); } break; case "addsoundrequest": { IMap map = client.Player.Map; if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID) { Messenger.PlayerMsg(client, "You can't place a special tile here.", Text.BrightRed); return; } if (client.Player.HasItem(1) < House.SOUND_PRICE) { Messenger.PlayerMsg(client, "You need " + House.SOUND_PRICE + " " + ItemManager.Items[1].Name + " to place a special tile.", Text.BrightRed); return; } client.Player.TakeItem(1, House.SOUND_PRICE, true); map.Tile[client.Player.X, client.Player.Y].Type = Enums.TileType.Sound; map.Tile[client.Player.X, client.Player.Y].Data1 = 0; map.Tile[client.Player.X, client.Player.Y].Data2 = 0; map.Tile[client.Player.X, client.Player.Y].Data3 = 0; map.Tile[client.Player.X, client.Player.Y].String1 = parse[1]; map.Tile[client.Player.X, client.Player.Y].String2 = ""; map.Tile[client.Player.X, client.Player.Y].String3 = ""; //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map); Messenger.PlayerMsg(client, "A sound tile has been placed! Step on it to play a sound.", Text.BrightGreen); Messenger.RefreshMap(client); } break; case "addsignrequest": { IMap map = client.Player.Map; if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID) { Messenger.PlayerMsg(client, "You can't place a special tile here.", Text.BrightRed); return; } int totalLength = parse[1].Length + parse[2].Length + parse[3].Length; if (client.Player.HasItem(1) < House.WORD_PRICE * totalLength) { Messenger.PlayerMsg(client, "You need " + House.WORD_PRICE * totalLength + " " + ItemManager.Items[1].Name + " to place a special tile.", Text.BrightRed); return; } client.Player.TakeItem(1, House.WORD_PRICE * totalLength, true); map.Tile[client.Player.X, client.Player.Y].Type = Enums.TileType.Sign; map.Tile[client.Player.X, client.Player.Y].Data1 = 0; map.Tile[client.Player.X, client.Player.Y].Data2 = 0; map.Tile[client.Player.X, client.Player.Y].Data3 = 0; map.Tile[client.Player.X, client.Player.Y].String1 = parse[1]; map.Tile[client.Player.X, client.Player.Y].String2 = parse[2]; map.Tile[client.Player.X, client.Player.Y].String3 = parse[3]; //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map); Messenger.PlayerMsg(client, "A sign tile has been placed! Press Enter to read signs.", Text.BrightGreen); Messenger.RefreshMap(client); } break; case "weatherrequest": { IMap map = client.Player.Map; if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID) { Messenger.PlayerMsg(client, "You can't change the weather here.", Text.BrightRed); return; } if (client.Player.HasItem(1) < House.WEATHER_PRICE) { Messenger.PlayerMsg(client, "You need " + House.WEATHER_PRICE + " " + ItemManager.Items[1].Name + " to change the weather.", Text.BrightRed); return; } client.Player.TakeItem(1, House.WEATHER_PRICE, true); map.Weather = (Enums.Weather)parse[1].ToInt(); //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map); Messenger.PlayerMsg(client, "The house's weather has been changed!", Text.BrightGreen); Messenger.RefreshMap(client); } break; case "darknessrequest": { IMap map = client.Player.Map; if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID) { Messenger.PlayerMsg(client, "You can't change the lights here.", Text.BrightRed); return; } if (client.Player.HasItem(1) < House.LIGHT_PRICE) { Messenger.PlayerMsg(client, "You need " + House.LIGHT_PRICE + " " + ItemManager.Items[1].Name + " to change the lights.", Text.BrightRed); return; } client.Player.TakeItem(1, House.LIGHT_PRICE, true); map.Darkness = parse[1].ToInt(); //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map); Messenger.PlayerMsg(client, "The house's lights have been changed!", Text.BrightGreen); Messenger.RefreshMap(client); } break; case "expansionrequest": { IMap map = client.Player.Map; if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID) { Messenger.PlayerMsg(client, "You can't expand your house here.", Text.BrightRed); return; } int x = parse[1].ToInt(); int y = parse[2].ToInt(); int total = ((x + 1) * (y + 1) - (map.MaxX + 1) * (map.MaxY + 1)) * House.TILE_PRICE; if (total > 0) { if (client.Player.HasItem(1) < total) { Messenger.PlayerMsg(client, "You need " + total + " " + ItemManager.Items[1].Name + " to expand your house.", Text.BrightRed); return; } client.Player.TakeItem(1, total, true); } if (client.Player.X > x) client.Player.X = x; if (client.Player.Y > y) client.Player.Y = y; int oldX = map.MaxX; int oldY = map.MaxY; TileCollection tiles = new TileCollection(map.BaseMap, x, y); for (int Y = 0; Y <= y && Y <= oldY; Y++) { for (int X = 0; X <= x && X <= oldX; X++) { tiles[X, Y].Ground = map.Tile[X, Y].Ground; tiles[X, Y].GroundAnim = map.Tile[X, Y].GroundAnim; tiles[X, Y].Mask = map.Tile[X, Y].Mask; tiles[X, Y].Anim = map.Tile[X, Y].Anim; tiles[X, Y].Mask2 = map.Tile[X, Y].Mask2; tiles[X, Y].M2Anim = map.Tile[X, Y].M2Anim; tiles[X, Y].Fringe = map.Tile[X, Y].Fringe; tiles[X, Y].FAnim = map.Tile[X, Y].FAnim; tiles[X, Y].Fringe2 = map.Tile[X, Y].Fringe2; tiles[X, Y].F2Anim = map.Tile[X, Y].F2Anim; tiles[X, Y].Type = map.Tile[X, Y].Type; tiles[X, Y].Data1 = map.Tile[X, Y].Data1; tiles[X, Y].Data2 = map.Tile[X, Y].Data2; tiles[X, Y].Data3 = map.Tile[X, Y].Data3; tiles[X, Y].String1 = map.Tile[X, Y].String1; tiles[X, Y].String2 = map.Tile[X, Y].String2; tiles[X, Y].String3 = map.Tile[X, Y].String3; tiles[X, Y].RDungeonMapValue = map.Tile[X, Y].RDungeonMapValue; tiles[X, Y].GroundSet = map.Tile[X, Y].GroundSet; tiles[X, Y].GroundAnimSet = map.Tile[X, Y].GroundAnimSet; tiles[X, Y].MaskSet = map.Tile[X, Y].MaskSet; tiles[X, Y].AnimSet = map.Tile[X, Y].AnimSet; tiles[X, Y].Mask2Set = map.Tile[X, Y].Mask2Set; tiles[X, Y].M2AnimSet = map.Tile[X, Y].M2AnimSet; tiles[X, Y].FringeSet = map.Tile[X, Y].FringeSet; tiles[X, Y].FAnimSet = map.Tile[X, Y].FAnimSet; tiles[X, Y].Fringe2Set = map.Tile[X, Y].Fringe2Set; tiles[X, Y].F2AnimSet = map.Tile[X, Y].F2AnimSet; } } map.Tile = tiles; Messenger.PlayerMsg(client, "The house's boundaries have been changed!", Text.BrightGreen); Messenger.RefreshMap(client); } break; #endregion #region Moves case "overwritemove": { if (client.Player.GetActiveRecruit().LearningMove != -1) { int moveSlot = parse[1].ToInt(-1); if (moveSlot != -1 && moveSlot >= 0 && moveSlot <= 3) { if (client.Player.GetActiveRecruit().Moves[moveSlot].MoveNum > 0) { client.Player.GetActiveRecruit().Moves[moveSlot].MoveNum = client.Player.GetActiveRecruit().LearningMove; client.Player.GetActiveRecruit().Moves[moveSlot].MaxPP = MoveManager.Moves[client.Player.GetActiveRecruit().Moves[moveSlot].MoveNum].MaxPP; client.Player.GetActiveRecruit().Moves[moveSlot].CurrentPP = client.Player.GetActiveRecruit().Moves[moveSlot].MaxPP; Messenger.PlayerMsg(client, "You have learned a new move!", Text.Yellow); Messenger.SendPlayerMoves(client); } } } } break; #endregion #region ExpKit case "activekitmodule": { Enums.ExpKitModules module = (Enums.ExpKitModules)parse[1].ToInt(); if (client.Player.AvailableExpKitModules.Contains(module)) { client.Player.ActiveExpKitModule = module; } } break; #endregion #region Trading case "settradeitem": { if (!string.IsNullOrEmpty(client.Player.TradePartner)) { Client tradePartner = ClientManager.FindClientFromCharID(client.Player.TradePartner); if (tradePartner != null && tradePartner.Player.TradePartner == client.Player.CharID) { int slot = parse[1].ToInt(); int amount = parse[2].ToInt(); if (slot > -1) { if (ItemManager.Items[client.Player.Inventory[slot].Num].Type != Enums.ItemType.Currency && ItemManager.Items[client.Player.Inventory[slot].Num].StackCap <= 0) { amount = 1; } if (ItemManager.Items[client.Player.Inventory[slot].Num].Bound) { Messenger.PlayerMsg(client, "This item cannot be traded!", Text.BrightRed); slot = -1; amount = 0; } else if (client.Player.Inventory[slot].Sticky) { Messenger.PlayerMsg(client, "You cannot trade a sticky item!", Text.BrightRed); slot = -1; amount = 0; } else if (ItemManager.Items[client.Player.Inventory[slot].Num].Rarity > (int)tradePartner.Player.ExplorerRank + 1) { Messenger.PlayerMsg(client, "The other person does not have a high enough Explorer Rank to receive this item.", Text.BrightRed); slot = -1; amount = 0; } else if (amount == 0 && (ItemManager.Items[client.Player.Inventory[slot].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[slot].Num].StackCap > 0)) { Messenger.PlayerMsg(client, "You must trade more than 0!", Text.BrightRed); slot = -1; amount = 0; } else if (amount > client.Player.Inventory[slot].Amount && (ItemManager.Items[client.Player.Inventory[slot].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[slot].Num].StackCap > 0)) { Messenger.PlayerMsg(client, "You cannot trade more than you have!", Text.BrightRed); slot = -1; amount = 0; } else if (tradePartner.Player.FindInvSlot(client.Player.Inventory[slot].Num) == -1) { Messenger.PlayerMsg(client, "The other person does not have enough space to receive this item.", Text.BrightRed); slot = -1; amount = 0; } } client.Player.SetTradeItem = slot; client.Player.SetTradeAmount = amount; client.Player.ReadyToTrade = false; tradePartner.Player.ReadyToTrade = false; Messenger.SendTradeUnconfirm(client); Messenger.SendTradeUnconfirm(tradePartner); if (slot > -1) { string itemName = Items.ItemManager.Items[client.Player.Inventory[slot].Num].Name; if (ItemManager.Items[client.Player.Inventory[slot].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[slot].Num].StackCap > 0) { itemName += " (" + amount + ")"; } Messenger.SendTradeSetItemUpdate(tradePartner, client.Player.Inventory[slot].Num, amount, false); Messenger.SendTradeSetItemUpdate(client, client.Player.Inventory[slot].Num, amount, true); } else { Messenger.SendTradeSetItemUpdate(tradePartner, -1, 0, false); Messenger.SendTradeSetItemUpdate(client, -1, 0, true); } } } } break; case "readytotrade": { if (!string.IsNullOrEmpty(client.Player.TradePartner)) { Client tradePartner = ClientManager.FindClientFromCharID(client.Player.TradePartner); if (tradePartner != null && tradePartner.Player.TradePartner == client.Player.CharID) { int myItem = client.Player.SetTradeItem; int myAmount = client.Player.SetTradeAmount; int partnersItem = tradePartner.Player.SetTradeItem; int partnersAmount = tradePartner.Player.SetTradeAmount; if (ItemManager.Items[client.Player.Inventory[myItem].Num].Type != Enums.ItemType.Currency && ItemManager.Items[client.Player.Inventory[myItem].Num].StackCap <= 0) { myAmount = 1; } if (ItemManager.Items[client.Player.Inventory[myItem].Num].Bound) { Messenger.PlayerMsg(client, "This item cannot be traded!", Text.BrightRed); client.Player.SetTradeItem = -1; client.Player.SetTradeAmount = 0; } else if (client.Player.Inventory[myItem].Sticky) { Messenger.PlayerMsg(client, "You cannot trade a sticky item!", Text.BrightRed); client.Player.SetTradeItem = -1; client.Player.SetTradeAmount = 0; } else if (ItemManager.Items[client.Player.Inventory[myItem].Num].Rarity > (int)tradePartner.Player.ExplorerRank + 1) { Messenger.PlayerMsg(client, "The other person does not have a high enough Explorer Rank to receive this item.", Text.BrightRed); client.Player.SetTradeItem = -1; client.Player.SetTradeAmount = 0; } else if (client.Player.SetTradeAmount == 0 && (ItemManager.Items[client.Player.Inventory[myItem].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[myItem].Num].StackCap > 0)) { Messenger.PlayerMsg(client, "You must trade more than 0!", Text.BrightRed); client.Player.SetTradeItem = -1; client.Player.SetTradeAmount = 0; } else if (client.Player.SetTradeAmount > client.Player.Inventory[client.Player.SetTradeItem].Amount && (ItemManager.Items[client.Player.Inventory[myItem].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[myItem].Num].StackCap > 0)) { Messenger.PlayerMsg(client, "You cannot trade more than you have!", Text.BrightRed); client.Player.SetTradeItem = -1; client.Player.SetTradeAmount = 0; } else if (tradePartner.Player.FindInvSlot(client.Player.Inventory[myItem].Num) == -1) { Messenger.PlayerMsg(client, "The other person does not have enough space to receive this item.", Text.BrightRed); client.Player.SetTradeItem = -1; client.Player.SetTradeAmount = 0; } if (myItem > -1 && partnersItem > -1) { client.Player.ReadyToTrade = true; } //TODO: Allow Empty Trading // Both players have confirmed the trade if (client.Player.ReadyToTrade && tradePartner.Player.ReadyToTrade) { // Start the trade! int clientItemNum = client.Player.Inventory[client.Player.SetTradeItem].Num; string clientItemTag = client.Player.Inventory[client.Player.SetTradeItem].Tag; int clientItemAmount = client.Player.SetTradeAmount; int partnerItemNum = tradePartner.Player.Inventory[tradePartner.Player.SetTradeItem].Num; string partnerItemTag = tradePartner.Player.Inventory[tradePartner.Player.SetTradeItem].Tag; int partnerItemAmount = tradePartner.Player.SetTradeAmount; tradePartner.Player.ReadyToTrade = false; client.Player.ReadyToTrade = false; // Take items from both players. client.Player.TakeItemSlot(client.Player.SetTradeItem, clientItemAmount, true); tradePartner.Player.TakeItemSlot(tradePartner.Player.SetTradeItem, partnerItemAmount, true); // Give items to both players client.Player.GiveItem(partnerItemNum, partnerItemAmount, partnerItemTag); tradePartner.Player.GiveItem(clientItemNum, clientItemAmount, clientItemTag); // Save both players' inventory to prevent cloning! using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { client.Player.SaveCharacterData(dbConnection); tradePartner.Player.SaveCharacterData(dbConnection); } //Messenger.SendInventoryUpdate(client, client.Player.SetTradeItem); //Messenger.SendInventoryUpdate(tradePartner, tradePartner.Player.SetTradeItem); client.Player.SetTradeItem = -1; client.Player.SetTradeAmount = 0; tradePartner.Player.SetTradeItem = -1; tradePartner.Player.SetTradeAmount = 0; Messenger.SendTradeComplete(client); Messenger.SendTradeComplete(tradePartner); } } } } break; case "endplayertrade": { client.Player.EndTrade(true); } break; #endregion #region Tournament case "jointournament": { Tournament tourny = TournamentManager.Tournaments[parse[1]]; if (tourny != null) { tourny.RegisterPlayer(client); } } break; case "viewtournamentrules": { Tournament tourny = TournamentManager.Tournaments[parse[1]]; if (tourny != null) { Messenger.SendTournamentRulesTo(client, null, tourny); } } break; case "savetournamentrules": { Tournament tourny = client.Player.Tournament; if (tourny != null) { if (tourny.RegisteredMembers[client].Admin) { tourny.Rules.SleepClause = parse[1].ToBool(); tourny.Rules.AccuracyClause = parse[2].ToBool(); tourny.Rules.SpeciesClause = parse[3].ToBool(); tourny.Rules.FreezeClause = parse[4].ToBool(); tourny.Rules.OHKOClause = parse[5].ToBool(); tourny.Rules.SelfKOClause = parse[6].ToBool(); } } } break; case "spectatetournament": { Tournament tourny = TournamentManager.Tournaments[parse[1]]; if (client.Player.Tournament != null) { Tournament playerTourny = client.Player.Tournament; playerTourny.RegisteredMembers.Remove(client); } tourny.RegisterSpectator(client); } break; #endregion } #endregion } }
public static void Commands(Client client, Command command) { try { string joinedArgs = JoinArgs(command.CommandArgs); PacketHitList hitlist = null; PacketHitList.MethodStart(ref hitlist); switch (command[0]) { case "/savelogs": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Logger.SaveLogs(); Messenger.PlayerMsg(client, "Logs have been saved.", Text.BrightGreen); } } break; case "/textstory": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Story story = new Story(); StoryBuilderSegment segment = new StoryBuilderSegment(); StoryBuilder.AppendSaySegment(segment, joinedArgs, 25, 0, 0); segment.AppendToStory(story); foreach (Client i in client.Player.Map.GetClients()) { StoryManager.PlayStory(i, story); } } } break; case "/spawnminions": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { for (int i = 0; i < joinedArgs.ToInt(); i++) { MapNpcPreset npc = new MapNpcPreset(); npc.SpawnX = 22; //-1; npc.SpawnY = 32; //-1; npc.NpcNum = 1368; npc.MinLevel = 90; npc.MaxLevel = 100; client.Player.Map.SpawnNpc(npc); } } } break; case "/serverstatus": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Server.Globals.ServerStatus = joinedArgs; Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Server Status] " + client.Player.Name + " changed the server status to: '" + joinedArgs + "'"); } } break; case "/togglequiz": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { InQuiz = !InQuiz; QuestionReady = false; Messenger.AdminMsg("[Staff] In Quiz: " + InQuiz.ToString(), Text.BrightBlue); } } break; case "/questionready": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { QuestionReady = true; Messenger.AdminMsg("[Staff] Question Ready: " + QuestionReady.ToString(), Text.BrightGreen); for (int a = 8; a >= 0; a--) { Messenger.MapMsg(client.Player.MapID, "You can answer in: " + a, Text.BrightGreen); System.Threading.Thread.Sleep(1000); CanAnswer = false; } Messenger.MapMsg(client.Player.MapID, "You can now buzz in!", Text.BrightGreen); CanAnswer = true; } } break; case "/yatterman": { if (client.Player.CharID.Substring(1).ToInt() % 2 == 0) { Messenger.PlayerMsg(client, "All of the PINK", System.Drawing.Color.LimeGreen); } else { Messenger.PlayerMsg(client, "Slightly less PINK", Text.White); } } break; case "/glomp": { if (client.Player.Muted == false) { if (client.Player.CharID.Substring(1).ToInt() % 2 == 0) { Messenger.MapMsg(client.Player.MapID, "Plusle Power! " + client.Player.Name + " used Glomp!", Text.Red); } else { Messenger.MapMsg(client.Player.MapID, "Minun Power! " + client.Player.Name + " used Glomp!", Text.Cyan); } } else { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); } } break; case "/setquizanswer": { if (InQuiz) { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { QuizAnswer = joinedArgs.ToLower(); Messenger.AdminMsg("[Staff] Quiz answer set to: " + QuizAnswer, Text.BrightBlue); } } } break; case "/buzz": { if (InQuiz && QuestionReady && CanAnswer) { //QuestionReady = false; foreach (Client i in client.Player.Map.GetClients()) { if (i.IsPlaying()) { Messenger.BattleMsg(i, client.Player.Name + " has answered with: " + joinedArgs, Text.BrightGreen); /* Story story = new Story(); StoryBuilderSegment segment = new StoryBuilderSegment(); StoryBuilder.AppendSaySegment(segment, client.Player.Name + " has buzzed in! " + client.Player.Name + "'s answer is...", -1, 0, 0); StoryBuilder.AppendSaySegment(segment, joinedArgs, -1, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(i, story);*/ } } if (CanAnswer && joinedArgs.ToLower() == QuizAnswer) { foreach (Client i in client.Player.Map.GetClients()) { Messenger.PlayerMsg(i, client.Player.Name + " has answered correctly! The answer was: " + QuizAnswer, Text.Yellow); } QuestionReady = false; QuizAnswer = ""; } } } break; /*case "/plaza": { //if (Ranks.IsAllowed(client, Server.Enums.Rank.Moniter)) { IMap map = client.Player.Map; //if (map.MapType == Enums.MapType.Standard && map.Name.StartsWith("Exbel")) { // exPlayer.Get(client).PlazaEntranceMap = client.Player.MapID; // exPlayer.Get(client).PlazaEntranceX = client.Player.X; // exPlayer.Get(client).PlazaEntranceY = client.Player.Y; // Messenger.PlayerWarp(client, 1777, 16, 20); // Messenger.PlayerMsg(client, "Welcome to the plaza!", Text.BrightGreen); //} else { Messenger.PlayerMsg(client, "You cannot enter the plaza from here!", Text.BrightRed); //} } break;*/ //case "/leaveplaza": { // IMap map = client.Player.Map; // if (map.Name == "Delite Plaza") { // if (!string.IsNullOrEmpty(exPlayer.Get(client).PlazaEntranceMap)) { // Messenger.PlayerWarp(client, exPlayer.Get(client).PlazaEntranceMap, exPlayer.Get(client).PlazaEntranceX, exPlayer.Get(client).PlazaEntranceY); // } // } // } // break; case "/endgame": { if (exPlayer.Get(client).SnowballGameInstance.GameLeader == client) { exPlayer.Get(client).SnowballGameInstance.EndGame(); Messenger.PlayerMsg(client, "You have ended the game.", Text.Yellow); } } break; case "/snowballplayers": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (Main.ActiveSnowballGames.Count > 0) { Messenger.PlayerMsg(client, "Blue Team:", Text.Yellow); foreach (Client teamClient in Main.ActiveSnowballGames.Values[0].BlueTeam) { Messenger.PlayerMsg(client, teamClient.Player.Name, Text.Yellow); } Messenger.PlayerMsg(client, "Green Team:", Text.Yellow); foreach (Client teamClient in Main.ActiveSnowballGames.Values[0].GreenTeam) { Messenger.PlayerMsg(client, teamClient.Player.Name, Text.Yellow); } } } } break; case "/gmmode": { if (Ranks.IsAllowed(client, Enums.Rank.Developer)) { Server.Globals.GMOnly = !Server.Globals.GMOnly; Messenger.PlayerMsg(client, "GM Only Mode Active: " + Server.Globals.GMOnly, Text.Yellow); } } break; case "/copymap": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { IMap baseMap = MapManager.RetrieveMap(command[1]); IMap destinationMap = MapManager.RetrieveMap(command[2], true); MapCloner.CloneMapTileProperties(baseMap, destinationMap); MapCloner.CloneMapTiles(baseMap, destinationMap); destinationMap.Revision++; destinationMap.Save(); Messenger.PlayerWarp(client, destinationMap, 25, 25); } } break; case "/packetcaching": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Server.Globals.PacketCaching = !Server.Globals.PacketCaching; Messenger.PlayerMsg(client, "Packet caching is: " + (Server.Globals.PacketCaching ? "on!" : "off!"), Text.BrightGreen); } } break; case "/foolsstory": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { foreach (Client i in ClientManager.GetClients()) { //if (i != client) { StoryManager.PlayStory(i, 369 - 1); //} } } } break; case "/foolsmode": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Server.Globals.FoolsMode = !Server.Globals.FoolsMode; Messenger.SendDataToAll(TcpPacket.CreatePacket("foolsmode", Server.Globals.FoolsMode.ToIntString())); Messenger.PlayerMsg(client, "April fool's mode is: " + (Server.Globals.FoolsMode ? "on!" : "off!"), Text.BrightGreen); } } break; case "/lokmovementall": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Messenger.AdminMsg("[Staff] Movement locked...", Text.BrightBlue); foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying() && Ranks.IsDisallowed(i, Enums.Rank.Moniter)) { i.Player.MovementLocked = true; Messenger.PlayerMsg(i, "Movement has been locked, temporarily", Text.BrightGreen); } } } } break; case "/unlokmovementall": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Messenger.AdminMsg("[Staff] Movement unlocked...", Text.BrightBlue); foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying()) { i.Player.MovementLocked = false; Messenger.PlayerMsg(i, "Movement has been unlocked [Debugging]", Text.BrightGreen); } } } } break; case "/lokmovementmap": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Messenger.AdminMsg("[Staff] Movement locked...", Text.BrightBlue); foreach (Client i in client.Player.Map.GetClients()) { if (i.IsPlaying() && Ranks.IsDisallowed(i, Enums.Rank.Moniter)) { i.Player.MovementLocked = true; Messenger.PlayerMsg(i, "You find yourself stuck to the floor!", Text.BrightGreen); } } } } break; case "/unlokmovementmap": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Messenger.AdminMsg("[Staff] Movement unlocked...", Text.BrightBlue); foreach (Client i in client.Player.Map.GetClients()) { if (i.IsPlaying()) { i.Player.MovementLocked = false; Messenger.PlayerMsg(i, "You can move again!", Text.BrightGreen); } } } } break; case "/currentsection": { if (exPlayer.Get(client).StoryEnabled) { if (command.CommandArgs.Count == 2) { client.Player.StoryHelper.SaveSetting("[MainStory]-CurrentSection", joinedArgs.ToInt().ToString()); } Messenger.PlayerMsg(client, "Current section: " + client.Player.StoryHelper.ReadSetting("[MainStory]-CurrentSection").ToInt().ToString(), Text.BrightGreen); } } break; case "/resetstory": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { StoryHelper.ResetStory(client); } } break; case "/storymode": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { exPlayer.Get(client).StoryEnabled = !exPlayer.Get(client).StoryEnabled; Messenger.PlayerMsg(client, "Story mode is now " + (exPlayer.Get(client).StoryEnabled ? "on!" : "off!"), Text.BrightGreen); } } break; case "/staffauction": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { if (Auction.StaffAuction == false) { Auction.StaffAuction = true; Messenger.AdminMsg("[Staff] Staff-only auction mode is now active.", Text.BrightBlue); } else if (Auction.StaffAuction == true) { Auction.StaffAuction = false; Messenger.AdminMsg("[Staff] Staff-only auction mode is now disabled.", Text.BrightBlue); } } } break; case "/itemowners": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { IMap map = client.Player.Map; for (int i = 0; i < map.ActiveItem.Length; i++) { if ((map.ActiveItem[i].Num > 0)) { Messenger.PlayerMsg(client, i + ". \'" + map.ActiveItem[i].TimeDropped.Tick + "\'", Text.BrightGreen); } } } } break; //case "/dungeonopen": { // Messenger.PlayerMsg(client, "Dungeon Unlocked: " + DungeonRules.IsDungeonUnlocked(client, joinedArgs.ToInt()), Text.BrightGreen); // } // break; case "/givejob": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { //if (!client.Player.JobList.HasCompletedMission("0|-1|1|1|7|0|0|1|1|1|-1|1|0|3|0|0|-1|-1|-1|-1|0|-1|-1|-1|")) { //client.Player.JobList.AddJob("0|-1|0|0|7|0|0|3|1|9|-1|46|0|3|0|0|-1|-1|-1|-1|0|-1|-1|-1|"); Messenger.PlayerMsg(client, "Job added!", Text.BrightGreen); Messenger.SendJobList(client); } } break; case "/dungeonnpcs": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { IMap map = client.Player.Map; for (int i = 0; i < map.Npc.Count; i++) { if ((map.Npc[i].NpcNum > 0)) { Messenger.PlayerMsg(client, map.Npc[i].NpcNum.ToString(), Text.BrightGreen); } } } } break; case "/rdstartcheck": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { for (int i = 0; i < 10; i++) { RDungeonMap map = RDungeonFloorGen.GenerateFloor(client, 54, 49, RDungeonManager.RDungeons[54].Floors[49].Options); Messenger.PlayerMsg(client, i.ToString(), Text.Black); } } } break; case "/activemaps": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { IMap[] activeMaps = MapManager.ToArray(); Messenger.PlayerMsg(client, "Active Maps: " + activeMaps.Length.ToString(), Text.BrightGreen); foreach (IMap map in activeMaps) { Messenger.PlayerMsg(client, map.Name, Text.Yellow); int total = 0; foreach (MapPlayer playerOnMap in map.PlayersOnMap.GetPlayers()) { //Messenger.PlayerMsg(client, "-" + playerOnMap, Text.Yellow); total++; } Messenger.PlayerMsg(client, "Total in map: " + total, Text.Red); } } } break; case "/daynight": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Server.Events.World.TimedEventManager.TimedEvents["DayCycle"].OnTimeElapsed(Server.Core.GetTickCount()); Messenger.PlayerMsg(client, Server.Globals.ServerTime.ToString(), Text.BrightGreen); //} } } break; case "/currenttime": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { TimeSpan time = new TimeSpan(0, 0, 0, 0, client.Player.MissionBoard.LastGenTime); Messenger.PlayerMsg(client, time.TotalSeconds.ToString(), Text.BrightGreen); time = new TimeSpan(0, 0, 0, 0, Server.Core.GetTickCount().Tick); Messenger.PlayerMsg(client, time.TotalSeconds.ToString(), Text.BrightGreen); //} } } break; case "/tournyplayers": { Tournament tourny = client.Player.Tournament; if (tourny != null) { if (tourny.RegisteredMembers[client] != null) { if (tourny.RegisteredMembers[client].Admin) { tourny.PlayersNeeded = joinedArgs.ToInt(); Messenger.PlayerMsg(client, "The current player requirement is: " + tourny.PlayersNeeded.ToString(), Text.BrightGreen); } } } } break; case "/createtourny": { Tournament tourny = TournamentManager.CreateTournament(client, joinedArgs, "s1193", 10, 10); tourny.AddCombatMap("s1194"); } break; case "/jointourny": { Tournament tourny = TournamentManager.Tournaments[joinedArgs.ToInt()]; tourny.RegisterPlayer(client); } break; case "/estlevel": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { exPlayer.Get(client).ElectrolockLevel = joinedArgs.ToInt(); Messenger.PlayerMsg(client, "EST level set to: " + joinedArgs.ToInt(), Text.BrightGreen); } } break; case "/april": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { //TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); //DateTime easternTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone); //var tomorrow1am = easternTime.AddDays(1).Date; //double totalHours = (int)( tomorrow1am - easternTime).TotalHours; //Messenger.PlayerMsg(client, "Time: " + totalHours.ToString(), Text.Red); } break; } case "/restartserver": { if (Ranks.IsDisallowed(client, Enums.Rank.Admin)) { Messenger.HackingAttempt(client, "Admin Cloning"); return; } Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Server] Server restart initiated by: " + client.Player.Name); RestartServer(); } break; case "/checktime": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.PlayerMsg(client, joinedArgs + "'s total play time: " + n.Player.Statistics.TotalPlayTime.ToString(), Text.BrightGreen); } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } } break; case "/lastlogin": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { IDataColumn[] columns = dbConnection.Database.RetrieveRow("characteristics", "CharID", "Name=\"" + playerName + "\""); if (columns != null) { string charID = (string)columns[0].Value; string lastLogin = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastLogin", "CharID=\"" + charID + "\"")[0].Value; Messenger.PlayerMsg(client, playerName + "'s last login: "******"Staff", "[Info Request] " + client.Player.Name + " checked " + playerName + "'s last login"); } } } } break; case "/checkparty": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Party party = PartyManager.FindParty(client.Player.PartyID); int onlineClients = 0; if (party != null) { foreach (Client client2 in party.GetOnlineMemberClients()) { onlineClients++; } Messenger.PlayerMsg(client, "Members: " + onlineClients, Text.BrightBlue); } else { Messenger.PlayerMsg(client, "No Party", Text.BrightBlue); } } } break; case "/playtime": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { TimeSpan longestPlayTime = new TimeSpan(); string playerName = ""; foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying()) { TimeSpan currentTime = i.Player.Statistics.TotalPlayTime + (DateTime.UtcNow - i.Player.Statistics.LoginTime); if (currentTime > longestPlayTime) { playerName = i.Player.Name; longestPlayTime = currentTime; } } } Messenger.PlayerMsg(client, "Longest play time:\n" + playerName + " (" + longestPlayTime.ToString() + ")", Text.BrightBlue); } } break; case "/fastshutdown": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerMsg(client, "[SECRET] Fast shutdown started.", Text.BrightRed); using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying()) { i.Player.SaveCharacterData(dbConnection); i.Player.SavingLocked = true; } } } Messenger.PlayerMsg(client, "Everyone saved, shutting down...", Text.BrightRed); Environment.Exit(0); } } break; case "/shutdown": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int waitingTime = 30; string messageText = ""; if (!string.IsNullOrEmpty(joinedArgs)) { messageText = joinedArgs; } for (int i = waitingTime; i >= 1; i--) { Server.Globals.ServerStatus = "Please prepare for a server shutdown for maintenance. It will begin in " + i + " seconds." + messageText; System.Threading.Thread.Sleep(1000); } Messenger.AdminMsg("[Staff] Server shutdown in progress... Saving all players...", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Server] Server shutdown initiated by: " + client.Player.Name); Server.Globals.ServerStatus = "Saving your data... Please wait..."; try { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying()) { i.Player.SaveCharacterData(dbConnection); i.Player.SavingLocked = true; Messenger.PlayerMsg(i, "You saved the game!", Text.BrightGreen); } } } Messenger.PlayerMsg(client, "Everyone has been saved!", Text.Yellow); } catch { } System.Threading.Thread shutdownTimerThread = new System.Threading.Thread(delegate() { waitingTime = 30; for (int i = waitingTime; i >= 1; i--) { Server.Globals.ServerStatus = "The server will be shutting down in " + i + " seconds."; System.Threading.Thread.Sleep(1000); } Environment.Exit(0); } ); shutdownTimerThread.Start(); } } break; case "/warn*": case "/warn": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(command[1], true); } else { n = ClientManager.FindClient(command[1]); } if (n != null) { Messenger.PlayerMsg(n, "You have been warned by a staff member: " + command[2] /* + "\n-" + client.Player.Name*/, System.Drawing.Color.Orange); Messenger.AdminMsg("[Staff] " + client.Player.Name + " has warned " + n.Player.Name + ": " + command[2], Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warning Issued] " + client.Player.Name + " warned " + n.Player.Name + " with message: " + command[2]); } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } } break; case "/getcharinfo": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { CharacterInformation charInfo = PlayerManager.RetrieveCharacterInformation(dbConnection, joinedArgs); if (charInfo != null) { Messenger.PlayerMsg(client, "Info for " + charInfo.Name + ":", Text.Yellow); Messenger.PlayerMsg(client, "Account: " + charInfo.Account, Text.Yellow); Messenger.PlayerMsg(client, "CharID: " + charInfo.ID, Text.Yellow); Messenger.PlayerMsg(client, "Char Slot: " + charInfo.Slot, Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Info Request] " + client.Player.Name + " checked the character information for: " + command[1]); } } } } break; case "/clearjoblist": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { n.Player.JobList.JobList.Clear(); Messenger.SendJobList(n); Messenger.PlayerMsg(n, "Your job list has been cleared!", Text.BrightGreen); Messenger.PlayerMsg(client, "You have cleared " + joinedArgs + "'s job list!", Text.BrightGreen); //Messenger.PlayerMsg(client, joinedArgs + " ID is: " + n.Player.CharID, Text.BrightGreen); } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } } break; case "/void": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerWarpToVoid(client); } } break; case "/voidplayer*": case "/voidplayer": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(playerName, true); } else { n = ClientManager.FindClient(playerName); } if (n != null) { Messenger.PlayerWarpToVoid(n); Messenger.GlobalMsg(n.Player.Name + " has been swallowed by the void...", Text.Red); } else { Messenger.PlayerMsg(client, playerName + " could not be found.", Text.Green); } } } break; case "/unvoid": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; Client n; n = ClientManager.FindClient(playerName); IMap map = n.Player.Map; if (map.MapType == Enums.MapType.Void) { Server.Maps.Void @void = map as Server.Maps.Void; @void.SafeExit = true; Messenger.PlayerWarp(n, 1015, 25, 25); Messenger.PlayerMsg(n, "You have been unvoided.", Text.BrightGreen); Messenger.PlayerMsg(client, playerName + " has been unvoided.", Text.BrightGreen); } } } break; case "/getid": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.PlayerMsg(client, joinedArgs + " ID is: " + n.Player.CharID, Text.BrightGreen); } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } } break; case "/regenboard": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { client.Player.MissionBoard.GenerateMission(); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Missions] " + client.Player.Name + " regenerated their mission board."); } } break; case "/who": { int count = 0; foreach (Client i in ClientManager.GetClients()) { if (i.TcpClient.Socket.Connected && i.IsPlaying()) { count++; } } Messenger.PlayerMsg(client, "Players online: " + count, Text.Yellow); } break; case "/saveall": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { try { foreach (Client i in ClientManager.GetClients()) { i.Player.SaveCharacterData(dbConnection); Messenger.PlayerMsg(i, "You saved the game!", Text.BrightGreen); } } catch (Exception ex) { Messenger.PlayerMsg(client, ex.ToString(), Text.BrightRed); } } Messenger.PlayerMsg(client, "Everyone has been saved!", Text.Yellow); } } break; case "/isveteran": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.PlayerMsg(client, n.Player.Veteran.ToString(), Text.Yellow); } } } break; case "/explode": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.GlobalMsg(client.Player.Name + " has exploded.", Text.BrightRed); } } break; case "/silentkick*": case "/silentkick": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; Client kickedClient; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { kickedClient = ClientManager.FindClient(playerName, true); } else { kickedClient = ClientManager.FindClient(playerName); } if (kickedClient != null) { if (command.CommandArgs.Count > 2 && !String.IsNullOrEmpty(command[2])) { Messenger.AdminMsg("[Staff] " + kickedClient.Player.Name + " has been disconnected silently from the server by " + client.Player.Name + "! " + "Reason: " + command[2], Text.BrightBlue); kickedClient.CloseConnection(); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Kick] " + client.Player.Name + " silently kicked " + playerName + " from the server with reason: " + command[2]); } else { Messenger.AdminMsg("[Staff] " + kickedClient.Player.Name + " has been disconnected silently from the server by " + client.Player.Name + "!", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Kick] " + client.Player.Name + " silently kicked " + playerName + " from the server."); kickedClient.CloseConnection(); } } else { Messenger.PlayerMsg(client, "Unable to find player!", Text.BrightRed); } } } break; case "/kick*": case "/kick": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; Client kickedClient; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { kickedClient = ClientManager.FindClient(playerName, true); } else { kickedClient = ClientManager.FindClient(playerName); } if (kickedClient != null) { if (command.CommandArgs.Count > 2 && !String.IsNullOrEmpty(command[2])) { Messenger.AdminMsg(kickedClient.Player.Name + " has been kicked from the server by " + client.Player.Name + "!" + " Reason: " + command[2], Text.BrightBlue); Messenger.PlainMsg(kickedClient, "You have been kicked from the server! Reason: " + command[2], Enums.PlainMsgType.MainMenu); kickedClient.CloseConnection(); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Kick] " + client.Player.Name + " kicked " + playerName + " from the server with reason: " + command[2]); } else { Messenger.AdminMsg("[Staff] " + kickedClient.Player.Name + " has been kicked from the server by " + client.Player.Name, Text.BrightBlue); Messenger.PlainMsg(kickedClient, "You have been kicked from the server!", Enums.PlainMsgType.MainMenu); kickedClient.CloseConnection(); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Kick] " + client.Player.Name + " kicked " + playerName + " from the server."); } } else { Messenger.PlayerMsg(client, "Unable to find player!", Text.BrightRed); } } } break; case "/ban*": case "/ban": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; string banTimeDays = "-----"; Client bannedClient; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { bannedClient = ClientManager.FindClient(playerName, true); } else { bannedClient = ClientManager.FindClient(playerName); } if (command.CommandArgs.Count > 2 && command[2].IsNumeric()) { banTimeDays = DateTime.Now.AddDays(Convert.ToDouble(command[2])).ToString(); } if (bannedClient != null) { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { Bans.BanPlayer(dbConnection, bannedClient.IP.ToString(), bannedClient.Player.CharID, bannedClient.Player.AccountName + "/" + bannedClient.Player.Name, bannedClient.MacAddress, bannedClient.BiosId, client.Player.CharID, client.IP.ToString(), banTimeDays, Enums.BanType.Ban); Messenger.AdminMsg("[Staff] " + bannedClient.Player.Name + " has been banned by " + client.Player.Name + "!", Text.BrightBlue); PlayerInfoReport(bannedClient); Messenger.PlainMsg(bannedClient, "You have been banned!", Enums.PlainMsgType.MainMenu); bannedClient.CloseConnection(); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Ban] " + client.Player.Name + " banned " + playerName + "."); } } else { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { IDataColumn[] columns = dbConnection.Database.RetrieveRow("characteristics", "CharID", "Name=\"" + playerName + "\""); if (columns != null) { string charID = (string)columns[0].Value; string foundIP = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastIPAddressUsed", "CharID=\"" + charID + "\"")[0].Value; string foundMac = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastMacAddressUsed", "CharID=\"" + charID + "\"")[0].Value; string storedUUID = (string)dbConnection.Database.RetrieveRow("character_statistics", "StoredUUID", "CharID=\"" + charID + "\"")[0].Value; //get previous IP and mac Bans.BanPlayer(dbConnection, foundIP, charID, playerName, foundMac, storedUUID, client.Player.CharID, client.IP.ToString(), banTimeDays, Enums.BanType.Ban); Messenger.AdminMsg("[Staff] " + bannedClient.Player.Name + " has been banned by " + client.Player.Name + "!", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Ban] " + client.Player.Name + " banned " + playerName + "."); } else { Messenger.PlayerMsg(client, "Unable to find player!", Text.BrightRed); } } } } } break; case "/htest": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Messenger.OpenVisitHouseMenu(client); } } break; case "/emptyhouse": { IMap map = client.Player.Map; if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { List<Client> clientList = new List<Client>(); foreach (Client n in client.Player.Map.GetClients()) { if (n != client && Ranks.IsDisallowed(client, Enums.Rank.Moniter)) { clientList.Add(n); } } foreach (Client n in clientList) { if (!string.IsNullOrEmpty(exPlayer.Get(n).HousingCenterMap)) { Messenger.PlayerWarp(n, exPlayer.Get(n).HousingCenterMap, exPlayer.Get(n).HousingCenterX, exPlayer.Get(n).HousingCenterY); } } Messenger.PlayerMsg(client, "All visitors have been kicked from your house!", Text.Yellow); } else { Messenger.PlayerMsg(client, "You aren't in your house!", Text.BrightRed); } } break; case "/leavehouse": { IMap map = client.Player.Map; if (map.MapType == Server.Enums.MapType.House) { if (!string.IsNullOrEmpty(exPlayer.Get(client).HousingCenterMap)) { Messenger.PlayerWarp(client, exPlayer.Get(client).HousingCenterMap, exPlayer.Get(client).HousingCenterX, exPlayer.Get(client).HousingCenterY); } } } break; case "/houseentrance": { IMap map = client.Player.Map; if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { //Messenger.AskQuestion(client, "HouseSpawn", "Will you set your house's entrance here?", -1); Messenger.AskQuestion(client, "HouseSpawn", "Will you set your house's entrance here? It will cost 500 Poké.", -1); } else { Messenger.PlayerMsg(client, "You can't set your house entrance here!", Text.BrightRed); } } break; case "/houseroof": { IMap map = client.Player.Map; if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { if (map.Indoors) { Messenger.AskQuestion(client, "HouseRoof", "Will you open your house's roof and expose it to time and weather conditions? It will cost 500 Poké.", -1); } else { Messenger.AskQuestion(client, "HouseRoof", "Will you close your house to time and weather conditions? It will cost 500 Poké.", -1); } } else { Messenger.PlayerMsg(client, "You can't set your house roof here!", Text.BrightRed); } } break; case "/houseweather": { IMap map = client.Player.Map; if (client.Player.ExplorerRank >= Enums.ExplorerRank.Silver) { if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { if (map.Indoors) { Messenger.PlayerMsg(client, "You can't set your house weather unless you open your house with /houseroof", Text.BrightRed); } else { Messenger.OpenChangeWeatherMenu(client); } } else { Messenger.PlayerMsg(client, "You can't set your house weather here!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Silver or higher.", Text.BrightRed); } } break; case "/houselight": { IMap map = client.Player.Map; if (client.Player.ExplorerRank >= Enums.ExplorerRank.Silver) { if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { Messenger.OpenChangeDarknessMenu(client); } else { Messenger.PlayerMsg(client, "You can't set your house lights here!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Silver or higher.", Text.BrightRed); } } break; case "/houseexpand": { IMap map = client.Player.Map; if (client.Player.ExplorerRank >= Enums.ExplorerRank.Gold) { if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { Messenger.OpenChangeBoundsMenu(client); } else { Messenger.PlayerMsg(client, "You can't expand your house here!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Gold or higher.", Text.BrightRed); } } break; case "/houseshop": { IMap map = client.Player.Map; if (client.Player.ExplorerRank >= Enums.ExplorerRank.Bronze) { if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { Messenger.OpenAddShopMenu(client); } else { Messenger.PlayerMsg(client, "You can't place a shop here!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Bronze or higher.", Text.BrightRed); } } break; case "/housesign": { IMap map = client.Player.Map; if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } if (client.Player.ExplorerRank >= Enums.ExplorerRank.Bronze) { if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { Messenger.OpenAddSignMenu(client); } else { Messenger.PlayerMsg(client, "You can't place a sign here!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Bronze or higher.", Text.BrightRed); } } break; case "/housesound": { IMap map = client.Player.Map; if (client.Player.ExplorerRank >= Enums.ExplorerRank.Bronze) { if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { Messenger.OpenAddSoundMenu(client); } else { Messenger.PlayerMsg(client, "You can't place a sound tile here!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Bronze or higher.", Text.BrightRed); } } break; case "/housenotice": { IMap map = client.Player.Map; if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } if (client.Player.ExplorerRank >= Enums.ExplorerRank.Bronze) { if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID) { Messenger.OpenAddNoticeMenu(client); } else { Messenger.PlayerMsg(client, "You can't place a notice tile here!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Bronze or higher.", Text.BrightRed); } } break; //test2 case "/darktest": { /*if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying() && i.Player.AccountName == "Dandy") { i.Player.Access = Enums.Rank.Mapper; } } }*/ break; } //mapkill case "/kipz": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { if (client.Player.MapID == MapManager.GenerateMapID(1129)) { IMap map = client.Player.Map; foreach (Client i in map.GetClients()) { StoryManager.PlayStory(i, 94); } } } } break; case "/stafflist": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerMsg(client, "The staff that are currently online are:", Text.Green); foreach (Client i in ClientManager.GetClients()) { if (Ranks.IsAllowed(i, Enums.Rank.Moniter)) { Messenger.PlayerMsg(client, "(" + i.Player.Access.ToString() + ")" + i.Player.Name, Text.Green); } } } } break; case "/isitrandom": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int rand = Server.Math.Rand(0, 10); Messenger.PlayerMsg(client, rand.ToString(), Text.Green); } } break; case "/rdungeonscriptgoal": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { RDungeonScriptGoal(client, joinedArgs.ToInt(), 0, 0); } } break; case "/fdh": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { for (int i = 1; i <= 2000; i++) { //for (int x = 0; x <= MapManager.RetrieveMapGeneralInfo(i).MaxX; x++) { // for (int y = 0; y <= MapManager.RetrieveMapGeneralInfo(i).MaxY; y++) { // TODO: map tile info [Scripts] /* Can't get info on a nonactive map's tiles... if (NetScript.GetAttribute(i, x, y) == Enums.TileType.Shop /*|| NetScript.GetAttribute(i, x, y) == Enums.TileType.Warp) { if (NetScript.GetTileData1(i, x, y) == /*243 joinedArg.ToInt()) { NetScript.PlayerMsg(client, "Found warp! On Map " + i.ToString() + " X: " + x.ToString() + " Y: " + y.ToString(), Text.Yellow); //return; } } */ // } //} } } } break; case "/findaccount": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { foreach (Client i in ClientManager.GetClients()) { if (i.Player.AccountName.ToLower() == joinedArgs.ToLower()) { Messenger.PlayerMsg(client, "Found account! [" + i.Player.AccountName + "/" + i.Player.Name + "]", Text.BrightGreen); } } } } break; case "/cc": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Client n = ClientManager.FindClient(joinedArgs); n.CloseConnection(); Messenger.PlayerMsg(client, "CC/ " + n.Player.Name, Text.Blue); } else { Messenger.PlayerMsg(client, "That is not a valid command!", Text.BrightRed); } } break; case "/regenlotto": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Lottery.ForceGenLottoNumbers(); Messenger.PlayerMsg(client, "Lottery numbers regenerated!", Text.Yellow); } } break; case "/lottostats": { // TODO: /lottostats lottery if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Messenger.PlayerMsg(client, "Lottery Stats:", Text.BrightGreen); Messenger.PlayerMsg(client, "Lottery Payout: " + Lottery.LotteryPayout, Text.BrightGreen); Messenger.PlayerMsg(client, "Lottery Earnings: " + Lottery.LotteryEarnings, Text.BrightGreen); Messenger.PlayerMsg(client, "Last Lottery Earnings: " + Lottery.LastLotteryEarnings, Text.BrightGreen); Messenger.PlayerMsg(client, "Total Lottery Earnings: " + Lottery.TotalLotteryEarnings, Text.BrightGreen); } } break; //debug //testbuff case "/playeros": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Client n = ClientManager.FindClient(joinedArgs); Messenger.PlayerMsg(client, n.Player.Name + " OS info:", Text.Yellow); Messenger.PlayerMsg(client, n.Player.GetOSVersion(), Text.Yellow); Messenger.PlayerMsg(client, ".NET info:", Text.Yellow); Messenger.PlayerMsg(client, n.Player.GetDotNetVersion(), Text.Yellow); Messenger.PlayerMsg(client, "Client info:", Text.Yellow); Messenger.PlayerMsg(client, n.Player.GetClientEdition(), Text.Yellow); } else { Messenger.PlayerMsg(client, "That is not a valid command!", Text.BrightRed); } } break; case "/lounge": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerWarp(client, 1466, 39, 21); Messenger.PlayerMsg(client, "Welcome to the staff headquarters!", Text.Yellow); //110 } } break; case "/gccollect": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { GC.Collect(); Messenger.PlayerMsg(client, "Garbage collected!", Text.BrightGreen); } } break; case "/adminmsg": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { //DatabaseManager.OptionsDB.SaveSetting("Generic", "AdminMsg", joinedArgs); //Messenger.PlayerMsg(client, "Admin message changed to: \"" + joinedArgs + "\"", Text.BrightGreen); } } break; case "/motd": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { Server.Settings.MOTD = joinedArgs; Messenger.GlobalMsg("MOTD changed to: " + joinedArgs, Text.BrightCyan); Server.Settings.SaveMOTD(); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[MOTD] " + client.Player.Name + " set the MOTD to: " + joinedArgs); } } break; #region CTF Commands case "/ctfcreate": { if (client.Player.MapID == MapManager.GenerateMapID(CTF.HUBMAP)) { if (ActiveCTF == null) { ActiveCTF = new CTF(CTF.CTFGameState.NotStarted); } if (ActiveCTF.GameState == CTF.CTFGameState.NotStarted) { ActiveCTF.CreateGame(client); return; } else { Messenger.PlayerMsg(client, "A game of Capture The Flag is already started!", Text.BrightRed); } } } break; case "/ctfjoin": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You cannot join the game because you are muted!", Text.BrightRed); } if (client.Player.MapID == MapManager.GenerateMapID(CTF.HUBMAP)) { if (ActiveCTF == null) { Messenger.PlayerMsg(client, "No game has been started yet!", Text.BrightRed); } else if (ActiveCTF.GameState == CTF.CTFGameState.WaitingForPlayers) { if (exPlayer.Get(client).InCTF == false) { ActiveCTF.AddToGame(client); } else { Messenger.PlayerMsg(client, "You have already joined the game!", Text.BrightRed); } } else { if (ActiveCTF.GameState == CTF.CTFGameState.Started) { Messenger.PlayerMsg(client, "There is already a game of Capture The Flag that has been started!", Text.BrightRed); } else { Messenger.PlayerMsg(client, "No game of Capture The Flag has been created yet!", Text.BrightRed); } } } } break; case "/ctfleave": { if (client.Player.MapID == MapManager.GenerateMapID(CTF.REDMAP) || client.Player.MapID == MapManager.GenerateMapID(CTF.BLUEMAP)) { ActiveCTF.RemoveFromGame(client); } } break; case "/ctfstart": { if (ActiveCTF.GameLeader == client) { ActiveCTF.StartGame(); ActiveCTF.CTFMsg("This game of Capture The Flag has started.", Text.Yellow); ActiveCTF.CTFMsg("This game will have " + ActiveCTF.BlueFlags + " flags!", Text.Yellow); } } break; case "/ctfflags": { if (ActiveCTF.GameLeader == client && ActiveCTF.GameState == CTF.CTFGameState.WaitingForPlayers) { ActiveCTF.RedFlags = joinedArgs.ToInt(); ActiveCTF.BlueFlags = joinedArgs.ToInt(); Messenger.PlayerMsg(client, "This game will have " + ActiveCTF.BlueFlags + " flags!", Text.Yellow); } } break; case "/ctfend": { if (ActiveCTF.GameLeader == client) { ActiveCTF.EndGame(client); Messenger.PlayerMsg(client, "You have ended the game.", Text.Yellow); } } break; case "/ctfforceend": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { ActiveCTF.EndGame(client.Player.Name); Messenger.PlayerMsg(client, "You have ended the game.", Text.Yellow); } } break; case "/ctf": { if (ActiveCTF.GameState == CTF.CTFGameState.Started) { if (exPlayer.Get(client).InCTF) { ActiveCTF.CTFMsg(client.Player.Name + " [CTF]: " + joinedArgs, Text.Grey); } } } break; case "/ctft": { if (ActiveCTF.GameState == CTF.CTFGameState.Started) { if (exPlayer.Get(client).InCTF) { ActiveCTF.CTFTMsg(client, client.Player.Name + " [CTF Team]: " + joinedArgs, Text.Grey); } } } break; case "/ctfgen": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { RDungeonMap dungeonMap = RDungeonFloorGen.GenerateFloor(client, 39, 0, RDungeonManager.RDungeons[39].Floors[0].Options); Messenger.PlayerWarp(client, dungeonMap, dungeonMap.StartX, dungeonMap.StartY); } } break; #endregion CTF Commands case "/checkstack": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(command[1]); if (n == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } else if (command[2].ToInt() <= 0) { Messenger.PlayerMsg(client, "Invalid item number.", Text.BrightRed); } else if (n == client) { Messenger.PlayerMsg(client, "Your amount of " + ItemManager.Items[command[2].ToInt()].Name + ": " + n.Player.HasItem(command[2].ToInt()).ToString(), Text.Yellow); } else { Messenger.PlayerMsg(client, n.Player.Name + "'s amount of " + ItemManager.Items[command[2].ToInt()].Name + ": " + n.Player.HasItem(command[2].ToInt()).ToString(), Text.Yellow); } } } break; case "/checkinv*": case "/checkinv": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(joinedArgs, true); } else { n = ClientManager.FindClient(joinedArgs); } Messenger.PlayerMsg(client, n.Player.Name + "'s Inventory:", Text.Yellow); InventoryItem item; for (int i = 1; i <= n.Player.MaxInv; i++) { item = n.Player.Inventory[i]; int amount = 0; string msg = item.Num + " "; if (item.Num > 0) { msg += ItemManager.Items[item.Num].Name; amount = item.Amount; } if (amount > 0) { msg += " (" + amount.ToString() + ")"; } if (item.Tag != "") { msg += " [" + item.Tag + "]"; } if (msg != "") { Messenger.PlayerMsg(client, msg, Text.Yellow); } } } } break; case "/clearinv": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { for (int i = 1; i <= client.Player.MaxInv; i++) { client.Player.TakeItemSlot(i, client.Player.Inventory[i].Amount, true); } Messenger.PlayerMsg(client, "Inventory Cleared", Text.Yellow); } } break; case "/checkbank*": case "/checkbank": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(joinedArgs, true); } else { n = ClientManager.FindClient(joinedArgs); } Messenger.PlayerMsg(client, n.Player.Name + "'s Bank:", Text.Yellow); InventoryItem item; for (int i = 1; i <= n.Player.MaxBank; i++) { item = n.Player.Bank[i]; int amount = 0; string msg = ""; if (item.Num > 0) { msg = ItemManager.Items[item.Num].Name; amount = item.Amount; } if (amount > 0) { msg += " (" + amount.ToString() + ")"; } if (msg != "") { Messenger.PlayerMsg(client, msg, Text.Yellow); } } } } break; case "/checktile": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Tile tile = client.Player.Map.Tile[client.Player.X, client.Player.Y]; Messenger.PlayerMsg(client, tile.Type.ToString(), Text.Yellow); Messenger.PlayerMsg(client, "Ground: " + tile.GroundSet + ":" + tile.Ground, Text.Yellow); Messenger.PlayerMsg(client, "GroundAnim: " + tile.GroundAnimSet + ":" + tile.GroundAnim, Text.Yellow); Messenger.PlayerMsg(client, "Mask: " + tile.MaskSet + ":" + tile.Mask, Text.Yellow); Messenger.PlayerMsg(client, "MaskAnim: " + tile.AnimSet + ":" + tile.Anim, Text.Yellow); Messenger.PlayerMsg(client, "Mask2: " + tile.Mask2Set + ":" + tile.Mask2, Text.Yellow); Messenger.PlayerMsg(client, "Mask2Anim: " + tile.M2AnimSet + ":" + tile.M2Anim, Text.Yellow); Messenger.PlayerMsg(client, "Fringe: " + tile.FringeSet + ":" + tile.Fringe, Text.Yellow); Messenger.PlayerMsg(client, "FringeAnim: " + tile.FAnimSet + ":" + tile.FAnim, Text.Yellow); Messenger.PlayerMsg(client, "Fringe2: " + tile.Fringe2Set + ":" + tile.Fringe2, Text.Yellow); Messenger.PlayerMsg(client, "Fringe2Anim: " + tile.F2AnimSet + ":" + tile.F2Anim, Text.Yellow); Messenger.PlayerMsg(client, "Data1: " + tile.Data1, Text.Yellow); Messenger.PlayerMsg(client, "Data2: " + tile.Data2, Text.Yellow); Messenger.PlayerMsg(client, "Data3: " + tile.Data3, Text.Yellow); Messenger.PlayerMsg(client, "String1: " + tile.String1, Text.Yellow); Messenger.PlayerMsg(client, "String2: " + tile.String2, Text.Yellow); Messenger.PlayerMsg(client, "String3: " + tile.String3, Text.Yellow); } } break; case "/checkmoves": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); Messenger.PlayerMsg(client, n.Player.Name + "'s Moves:", Text.Yellow); for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (n.Player.Team[i] != null && n.Player.Team[i].Loaded) { Messenger.PlayerMsg(client, "Team #" + i + ": " + Pokedex.GetPokemon(n.Player.Team[i].Species).Name, Text.Yellow); for (int j = 0; j < 4; j++) { if (n.Player.Team[i].Moves[j].MoveNum > 0) { Messenger.PlayerMsg(client, MoveManager.Moves[n.Player.Team[i].Moves[j].MoveNum].Name, Text.Yellow); } } } } } } break; case "/checkmissions": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); Messenger.PlayerMsg(client, n.Player.Name + "'s Mission Board:", Text.Yellow); foreach (WonderMail mail in n.Player.MissionBoard.BoardMissions) { Messenger.PlayerMsg(client, mail.Title, Text.Yellow); } Messenger.PlayerMsg(client, n.Player.Name + "'s Job List:", Text.Yellow); foreach (WonderMailJob job in n.Player.JobList.JobList) { Messenger.PlayerMsg(client, job.Mission.Title, Text.Yellow); } } } break; //checkpts ~ what pts? THERE ARE NO PTS ANYMORE #region Auction Commands case "/masswarpauction": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { foreach (Client i in ClientManager.GetClients()) { Messenger.AskQuestion(i, "MassWarpAuction", client.Player.Name + " is inviting you to join an auction! Would you like to play?", -1); } } } break; case "/createauction": { if (client.Player.MapID == Auction.AUCTION_MAP) { if (!Auction.StaffAuction) { Auction.CreateAuction(client); } else if (Auction.StaffAuction && Ranks.IsAllowed(client, Enums.Rank.Mapper)) { Auction.CreateAuction(client); } else { Messenger.PlayerMsg(client, "A staff held auction is in progress. You may not create an auction at this time!", Text.BrightRed); } } } break; case "/startauction": { Auction.StartAuction(client); } break; case "/endauction": { Auction.EndAuction(client); } break; case "/auctionadminhelp": { Auction.SayHelp(client); } break; case "/auctionhelp": { Auction.SayPlayerHelp(client); } break; case "/checkbidder": { Auction.CheckBidder(client); } break; case "/setauctionitem": { Auction.SetAuctionItem(client, joinedArgs); } break; case "/setauctionminbid": { Auction.SetAuctionMinBid(client, joinedArgs.ToInt()); } break; case "/setbidincrement": { Auction.SetBidIncrement(client, joinedArgs.ToInt()); } break; case "/bid": { if (client.Player.HasItem(1) >= joinedArgs.ToInt()) { Auction.UpdateBids(client, joinedArgs.ToInt()); } else { Messenger.PlayerMsg(client, "You don't have enough Poké!", Text.BrightRed); } } break; #endregion Auction Commands case "/reward": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { foreach (Client i in client.Player.Map.GetClients()) { // i.Player.GiveItem(746, 1); i.Player.GiveItem(133, 3); Messenger.PlayerMsg(i, "You have been awarded three event tokens for participating!", Text.BrightGreen); } } } break; case "/givetokens": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n; n = ClientManager.FindClient(command[1]); int numTokens = command[2].ToInt(); n.Player.GiveItem(133, numTokens); Messenger.PlayerMsg(n, client.Player.Name + " has awarded you " + numTokens + " event tokens!", Text.BrightGreen); Messenger.AdminMsg("[Staff] " + client.Player.Name + " has given " + n.Player.Name + " " + numTokens + " event tokens!", Text.BrightBlue); } } break; case "/setname*": case "/setname": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { Client n; string newName = command[2]; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(command[1], true); // Attempt to find our player if they have a difficult name } else { n = ClientManager.FindClient(command[1]); } n.Player.Name = newName; Messenger.SendPlayerData(n); } } break; case "/setguild": { try { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { Client n = ClientManager.FindClient(command[1]); string guildName = command[2]; if (n != null) { // DataManager.Players.PlayerDataManager.AddGuildMember(dbConnection.Database, guildName, n.Player.CharID); // DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, n.Player.CharID, (int)Enums.GuildRank.Founder); // n.Player.GuildName = guildName; // n.Player.GuildAccess = Enums.GuildRank.Founder; // DataManager.Players.PlayerDataManager.RemoveGuildMember(dbConnection.Database, n.Player.CharID); n.Player.GuildName = command[2]; // n.Player.GuildAccess = Enums.GuildRank.None; Messenger.SendPlayerGuild(n); } } } } catch (Exception ex) { } } break; //case "/checkowner": { // if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { // if (client.Player.Map.Owner != null) { // Messenger.PlayerMsg(client, "The owner of this place is: " + client.Player.Map.Owner, Text.Yellow); // } // } // } // break; //blockpm //closeserver //closeall //closenonplayers case "/hb": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { string playerMap = client.Player.MapID; Messenger.MapMsg(playerMap, "H", Text.Blue); Messenger.MapMsg(playerMap, "A", Text.Green); Messenger.MapMsg(playerMap, "P", Text.Cyan); Messenger.MapMsg(playerMap, "P", Text.Red); Messenger.MapMsg(playerMap, "Y", Text.Magenta); Messenger.MapMsg(playerMap, "-", Text.Grey); Messenger.MapMsg(playerMap, "B", Text.Brown); Messenger.MapMsg(playerMap, "I", Text.BrightBlue); Messenger.MapMsg(playerMap, "R", Text.BrightGreen); Messenger.MapMsg(playerMap, "T", Text.BrightCyan); Messenger.MapMsg(playerMap, "H", Text.BrightRed); Messenger.MapMsg(playerMap, "D", Text.Pink); Messenger.MapMsg(playerMap, "A", Text.Yellow); Messenger.MapMsg(playerMap, "Y", Text.Blue); Messenger.MapMsg(playerMap, joinedArgs + "!", Text.White); Messenger.PlaySoundToMap(client.Player.MapID, "magic7.wav"); } } break; case "/pk": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (command.CommandArgs.Count >= 2) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { //n.Player.PK = !n.Player.PK; Messenger.SendPlayerData(n); } } } } break; case "/eat": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { if (command.CommandArgs.Count >= 2) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.GlobalMsg(client.Player.Name + " has eaten " + n.Player.Name + "!", Text.Yellow); Messenger.PlayerWarp(n, 509, 11, 8); //} else if (n == index) { // NetScript.PlayerMsg(index, "You cant eat yourself!", Text.BrightRed); } else if (n == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } else { Messenger.PlayerMsg(client, "You have to pick somebody to eat!", Text.Black); } } } break; case "/._.": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { if (command.CommandArgs.Count >= 2) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.GlobalMsg(client.Player.Name + " has stared into the eternal soul of " + n.Player.Name + "!", System.Drawing.Color.MidnightBlue); Messenger.PlayerWarp(n, 2000, 9, 6); //} else if (n == index) { // NetScript.PlayerMsg(index, "You cant eat yourself!", Text.BrightRed); } else if (n == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } else { Messenger.PlayerMsg(client, "You have to pick somebody to stare into the eternal soul of!", Text.Black); } } } break; case "/addnews": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { if (command.CommandArgs.Count >= 2) { try { Server.Settings.AddNews(joinedArgs); Messenger.GlobalMsg("Updated News: " + joinedArgs, Text.Yellow); } catch (Exception ex) { Messenger.PlayerMsg(client, ex.ToString(), Text.Red); } Messenger.PlayerMsg(client, "News updated!", Text.Yellow); } else { Messenger.PlayerMsg(client, "The new news cant be blank!", Text.BrightRed); } } } break; case "/reloadnews": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { Server.Settings.LoadNews(); Messenger.PlayerMsg(client, "News have been reloaded!", Text.Yellow); } } break; case "/news": { Messenger.PlayerMsg(client, "Latest News:", Text.Yellow); for (int i = 0; i < Server.Settings.News.Count; i++) { Messenger.PlayerMsg(client, Server.Settings.News[i], Text.Yellow); } } break; case "/givemove": { if (Ranks.IsAllowed(client, Enums.Rank.Developer)) { Client n = ClientManager.FindClient(command[1]); if (n != null) { int moveNum; if (command[2].IsNumeric() && command[2].ToInt() > 1 && command[2].ToInt() <= MoveManager.Moves.MaxMoves) { moveNum = command[2].ToInt(); n.Player.GetActiveRecruit().LearnNewMove(moveNum); Messenger.PlayerMsg(client, "You have taught " + n.Player.Name + " the move " + MoveManager.Moves[moveNum].Name, Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Move Given] " + client.Player.Name + " gave " + n.Player.Name + " the move " + MoveManager.Moves[moveNum].Name); } else { moveNum = -1; for (int i = 1; i <= MoveManager.Moves.MaxMoves; i++) { if (MoveManager.Moves[i].Name.ToLower().StartsWith(command[2].ToLower())) { moveNum = i; } } if (moveNum > -1) { n.Player.GetActiveRecruit().LearnNewMove(moveNum); Messenger.PlayerMsg(client, "You have taught " + n.Player.Name + " the move " + MoveManager.Moves[moveNum].Name, Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Move Given] " + client.Player.Name + " gave " + n.Player.Name + " the move " + MoveManager.Moves[moveNum].Name); } } Messenger.SendPlayerMoves(n); } } } break; //global //fakeadmin //serverontime, obsolete case "/hunt": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (client.Player.ProtectionOff) { client.Player.ProtectionOff = false; client.Player.Hunted = false; Messenger.PlayerMsg(client, "You are no longer hunted.", Text.BrightGreen); } else { client.Player.ProtectionOff = true; client.Player.Hunted = true; Messenger.PlayerMsg(client, "You are now hunted.", Text.BrightGreen); } PacketBuilder.AppendHunted(client, hitlist); } } break; case "/learnmove": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { int move = command[1].ToInt(); if (move <= MoveManager.Moves.MaxMoves) { client.Player.GetActiveRecruit().LearnNewMove(move); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Move Given] " + client.Player.Name + " gave themselves the move: " + MoveManager.Moves[move].Name); } Messenger.SendPlayerMoves(client); } } break; case "/give": { if (Ranks.IsAllowed(client, Enums.Rank.Developer)) { Client n = ClientManager.FindClient(command[1]); int itemAmount = command[2].ToInt(); string item = command[3]; if (itemAmount == 0) { Messenger.PlayerMsg(client, "Invalid item amount.", Text.BrightRed); } else if (n == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } else { if (item.IsNumeric()) { if (item.ToInt() <= 0 || item.ToInt() > Server.Items.ItemManager.Items.MaxItems) { Messenger.PlayerMsg(client, "Invalid item number.", Text.BrightRed); } else { if (ItemManager.Items[item.ToInt()].StackCap <= 1) { for (int i = itemAmount; i > 0; i--) { n.Player.GiveItem(item.ToInt(), 1); } Messenger.PlayerMsg(client, "You have given " + n.Player.Name + " " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow); Messenger.PlayerMsg(n, client.Player.Name + " has given you " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Given] " + client.Player.Name + " gave " + n.Player.Name + " " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name); } else { n.Player.GiveItem(item.ToInt(), itemAmount); Messenger.PlayerMsg(client, "You have given " + n.Player.Name + " " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow); Messenger.PlayerMsg(n, client.Player.Name + " has given you " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Given] " + client.Player.Name + " gave " + n.Player.Name + " " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name); } } } else { int itemNum = -1; for (int i = Server.Items.ItemManager.Items.MaxItems; i > 0; i--) { if (ItemManager.Items[i].Name.ToLower().StartsWith(item.ToLower())) { itemNum = i; } } if (itemNum == -1) { Messenger.PlayerMsg(client, "Unable to find an item that starts with " + item, Text.Yellow); } else { n.Player.GiveItem(itemNum, itemAmount); Messenger.PlayerMsg(client, "You have given " + n.Player.Name + " " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow); Messenger.PlayerMsg(n, client.Player.Name + " has given you " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Given] " + client.Player.Name + " gave " + n.Player.Name + " " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name); } } } } } break; case "/take": { if (Ranks.IsAllowed(client, Enums.Rank.Developer)) { Client n = ClientManager.FindClient(command[1]); int itemAmount = command[2].ToInt(); string item = command[3]; if (itemAmount == 0) { Messenger.PlayerMsg(client, "Invalid item amount.", Text.BrightRed); } else if (n == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } else { if (item.IsNumeric()) { if (item.ToInt() <= 0 || item.ToInt() > Server.Items.ItemManager.Items.MaxItems) { Messenger.PlayerMsg(client, "Invalid item number.", Text.BrightRed); } else { n.Player.TakeItem(item.ToInt(), itemAmount); Messenger.PlayerMsg(client, "You have taken " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + " from " + n.Player.Name + "!", Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Taken] " + client.Player.Name + " took " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name + " from " + n.Player.Name); //NetScript.PlayerMsg(player, NetScript.GetPlayerName(index) + " has given you " + itemAmount.ToString() + " " + NetScript.GetItemName(item.ToInt()) + "!", Text.Yellow); } } else { int itemNum = -1; for (int i = Server.Items.ItemManager.Items.MaxItems; i > 0; i--) { if (ItemManager.Items[i].Name.ToLower().StartsWith(item.ToLower())) { itemNum = i; } } if (itemNum == -1) { Messenger.PlayerMsg(client, "Unable to find an item that starts with " + item, Text.Yellow); } else { n.Player.TakeItem(itemNum, itemAmount); Messenger.PlayerMsg(client, "You have taken " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + " from " + n.Player.Name + "!", Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Taken] " + client.Player.Name + " took " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name + " from " + n.Player.Name); //NetScript.PlayerMsg(player, NetScript.GetPlayerName(index) + " has given you " + itemAmount.ToString() + " " + NetScript.GetItemName(itemNum) + "!", Text.Yellow); } } } } } break; case "/save": { if (client.Player.SavingLocked == false) { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { client.Player.SaveCharacterData(dbConnection); } Messenger.PlayerMsg(client, "You have saved the game!", Text.BrightGreen); } else { Messenger.PlayerMsg(client, "You cannot save right now!", Text.BrightRed); } } break; //damageturn ~ obsolete because nothing targets anything anymore case "/s": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying() && i.Player.Access == Enums.Rank.Scripter) { Messenger.PlayerMsg(i, client.Player.Name + " [Script Chat]: " + joinedArgs, System.Drawing.Color.MediumSlateBlue); } } } } break; case "/g": { if (!string.IsNullOrEmpty(client.Player.GuildName) && !string.IsNullOrEmpty(joinedArgs) && client.Player.Muted == false) { OnChatMessageRecieved(client, joinedArgs, Enums.ChatMessageType.Guild); Server.Logging.ChatLogger.AppendToChatLog("Guild Chat/" + client.Player.GuildName, client.Player.Name + ": " + joinedArgs); /* List<System.Drawing.Color> textChoices = new List<System.Drawing.Color>(); textChoices.Add(Text.Blue); textChoices.Add(Text.Green); textChoices.Add(Text.Cyan); textChoices.Add(Text.Red); textChoices.Add(Text.Magenta); textChoices.Add(Text.Grey); textChoices.Add(Text.Brown); textChoices.Add(Text.BrightBlue); textChoices.Add(Text.BrightGreen); textChoices.Add(Text.BrightCyan); textChoices.Add(Text.BrightRed); textChoices.Add(Text.Pink); textChoices.Add(Text.Yellow); textChoices.Add(Text.Blue); */ foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying() && (Ranks.IsAllowed(i, Enums.Rank.Moniter) || i.Player.GuildName == client.Player.GuildName)) { Messenger.PlayerMsg(i, client.Player.Name + " [" + client.Player.GuildName + "]: " + joinedArgs, System.Drawing.Color.MediumSpringGreen); } } } } break; case "/finditemend": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int itemsFound = 0; for (int i = 0; i < Server.Items.ItemManager.Items.MaxItems; i++) { if (ItemManager.Items[i].Name.ToLower().EndsWith(joinedArgs.ToLower())) { Messenger.PlayerMsg(client, ItemManager.Items[i].Name + "'s number is " + i.ToString(), Text.Yellow); itemsFound++; //return; } } if (itemsFound == 0) { Messenger.PlayerMsg(client, "Unable to find an item that starts with '" + joinedArgs + "'", Text.Yellow); } } } break; case "/finditem": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int itemsFound = 0; if (String.IsNullOrEmpty(joinedArgs)) { Messenger.PlayerMsg(client, "Type in an item name.", Text.Yellow); } else { for (int i = 0; i < Server.Items.ItemManager.Items.MaxItems; i++) { if (ItemManager.Items[i].Name.ToLower().Contains(joinedArgs.ToLower())) { Messenger.PlayerMsg(client, ItemManager.Items[i].Name + "'s number is " + i.ToString(), Text.Yellow); itemsFound++; //return; } } if (itemsFound == 0) { Messenger.PlayerMsg(client, "Unable to find an item that starts with '" + joinedArgs + "'", Text.Yellow); } } } } break; case "/itemcheck": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { for (int i = 810; i <= 810; i++) { ItemManager.Items[i].Name = "Poké Flute"; Messenger.SendUpdateItemToAll(i); //ItemManager.SaveItem(i); Messenger.PlayerMsg(client, i + ": " + ItemManager.Items[i].Name, Text.Yellow); } } } break; case "/itemreq": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { for (int i = 1; i <= 1900; i++) { } } } break; case "/itemdesc": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { for (int i = 612; i <= 628; i++) { if (ItemManager.Items[i].ScriptedReq == 1) { ItemManager.Items[i].Desc = "A treasure for " + (Enums.PokemonType)ItemManager.Items[i].ReqData1 + "-Types. Give it to a team member to prevent damage from " + (Enums.PokemonType)ItemManager.Items[i].Data2 + "-type attacks for the team's " + (Enums.PokemonType)ItemManager.Items[i].ReqData1 + "-Type team members."; Messenger.SendUpdateItemToAll(i); ItemManager.SaveItem(i); Messenger.PlayerMsg(client, ItemManager.Items[i].Name, Text.Yellow); } } } } break; case "/findnpc": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int npcsFound = 0; if (String.IsNullOrEmpty(joinedArgs)) { Messenger.PlayerMsg(client, "Type in an npc name.", Text.Yellow); } else { for (int i = 1; i <= Server.Npcs.NpcManager.Npcs.MaxNpcs; i++) { if (NpcManager.Npcs[i].Name.ToLower().Contains(joinedArgs.ToLower())) { Messenger.PlayerMsg(client, NpcManager.Npcs[i].Name + "'s number is " + i.ToString(), Text.Yellow); npcsFound++; //return; } } if (npcsFound == 0) { Messenger.PlayerMsg(client, "Unable to find an npc that starts with '" + joinedArgs + "'", Text.Yellow); } } } } break; case "/findnpcuse": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (joinedArgs.IsNumeric()) { int npcNum = joinedArgs.ToInt(); if (npcNum > 0 && npcNum <= Server.Npcs.NpcManager.Npcs.MaxNpcs) { int itemsFound = 0; Messenger.PlayerMsg(client, "NPC# " + npcNum + " (" + NpcManager.Npcs[npcNum].Name + ") is found in RDungeons:", Text.Yellow); for (int i = 0; i < RDungeonManager.RDungeons.Count; i++) { int rangeStart = -1; for (int j = 0; j < RDungeonManager.RDungeons[i].Floors.Count; j++) { bool npcFoundOnFloor = false; for (int k = 0; k < RDungeonManager.RDungeons[i].Floors[j].Npcs.Count; k++) { //Messenger.PlayerMsg(client, "--" + k.ToString(), Text.Yellow); if (RDungeonManager.RDungeons[i].Floors[j].Npcs[k].NpcNum == npcNum) { itemsFound++; npcFoundOnFloor = true; break; } } if (npcFoundOnFloor) { if (rangeStart == -1) rangeStart = j; } else { if (rangeStart != -1) { int rangeEnd = j; if (rangeEnd - rangeStart == 1) { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1), Text.Yellow); } else { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1) + "-F" + rangeEnd, Text.Yellow); } rangeStart = -1; } } } if (rangeStart != -1) { int rangeEnd = RDungeonManager.RDungeons[i].Floors.Count; if (rangeEnd - rangeStart == 1) { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1), Text.Yellow); } else { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1) + "-F" + rangeEnd, Text.Yellow); } rangeStart = -1; } } if (itemsFound <= 0) { Messenger.PlayerMsg(client, "[None]", Text.Yellow); } } else { Messenger.PlayerMsg(client, "Input Out of Range", Text.Yellow); } } else { Messenger.PlayerMsg(client, "Input invalid.", Text.Yellow); } } } break; case "/finditemuse": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (joinedArgs.IsNumeric()) { int npcNum = joinedArgs.ToInt(); if (npcNum > 0 && npcNum <= Server.Items.ItemManager.Items.MaxItems) { int itemsFound = 0; Messenger.PlayerMsg(client, "Item# " + npcNum + " (" + ItemManager.Items[npcNum].Name + ") is found in RDungeons:", Text.Yellow); for (int i = 0; i < RDungeonManager.RDungeons.Count; i++) { int rangeStart = -1; for (int j = 0; j < RDungeonManager.RDungeons[i].Floors.Count; j++) { bool itemFoundOnFloor = false; for (int k = 0; k < RDungeonManager.RDungeons[i].Floors[j].Items.Count; k++) { //Messenger.PlayerMsg(client, "--" + k.ToString(), Text.Yellow); if (RDungeonManager.RDungeons[i].Floors[j].Items[k].ItemNum == npcNum) { itemsFound++; itemFoundOnFloor = true; break; } } if (itemFoundOnFloor) { if (rangeStart == -1) rangeStart = j; } else { if (rangeStart != -1) { int rangeEnd = j; if (rangeEnd - rangeStart == 1) { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1), Text.Yellow); } else { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1) + "-F" + rangeEnd, Text.Yellow); } rangeStart = -1; } } } if (rangeStart != -1) { int rangeEnd = RDungeonManager.RDungeons[i].Floors.Count; if (rangeEnd - rangeStart == 1) { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1), Text.Yellow); } else { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1) + "-F" + rangeEnd, Text.Yellow); } rangeStart = -1; } } if (itemsFound <= 0) { Messenger.PlayerMsg(client, "[None]", Text.Yellow); } } else { Messenger.PlayerMsg(client, "Input Out of Range", Text.Yellow); } } else { Messenger.PlayerMsg(client, "Input invalid.", Text.Yellow); } } } break; case "/finddex": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int npcsFound = 0; for (int i = 1; i <= Constants.TOTAL_POKEMON; i++) { if (Pokedex.GetPokemon(i).Name.ToLower().Contains(joinedArgs.ToLower())) { foreach (PokemonForm form in Pokedex.GetPokemon(i).Forms) { Messenger.PlayerMsg(client, Pokedex.GetPokemon(i).Name + "'s dex number is " + i, Text.Yellow); } npcsFound++; //return; } } if (npcsFound == 0) { Messenger.PlayerMsg(client, "Unable to find an Pokemon that starts with '" + joinedArgs + "'", Text.Yellow); } } } break; //case "/findmap": { // //how to check inactive maps? // if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { // int mapsFound = 0; // if (!string.IsNullOrEmpty(joinedArgs)) { // for (int i = 1; i <= Server.Settings.MaxMaps; i++) { // MapGeneralInfo generalInfo = MapManager.RetrieveMapGeneralInfo(i); // if (generalInfo.Name.ToLower().StartsWith(joinedArgs.ToLower())) { // Messenger.PlayerMsg(client, generalInfo.Name + "'s number is " + i.ToString(), Text.Yellow); // mapsFound++; // //return; // } // } // if (mapsFound == 0) { // Messenger.PlayerMsg(client, "Unable to find a map that starts with '" + joinedArgs + "'", Text.Yellow); // } // } // } // } // break; case "/findmove": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int movesFound = 0; for (int i = 1; i <= MoveManager.Moves.MaxMoves; i++) { if (MoveManager.Moves[i].Name.ToLower().Contains(joinedArgs.ToLower())) { Messenger.PlayerMsg(client, MoveManager.Moves[i].Name + "'s number is " + i.ToString(), Text.Yellow); movesFound++; //return; } } if (movesFound == 0) { Messenger.PlayerMsg(client, "Unable to find a move that starts with '" + joinedArgs + "'", Text.Yellow); } } } break; case "/findmoverange": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter) && joinedArgs.IsNumeric()) { Enums.MoveRange range = (Enums.MoveRange)joinedArgs.ToInt(); int movesFound = 0; Messenger.PlayerMsg(client, "Moves with " + range + " range", Text.Yellow); for (int i = 1; i <= MoveManager.Moves.MaxMoves; i++) { if (MoveManager.Moves[i].RangeType == range && !String.IsNullOrEmpty(MoveManager.Moves[i].Name)) { Messenger.PlayerMsg(client, "#" + i + ": " + MoveManager.Moves[i].Name, Text.Yellow); movesFound++; //return; } } if (movesFound == 0) { Messenger.PlayerMsg(client, "[None]", Text.Yellow); } } } break; case "/findrdungeon": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int itemsFound = 0; for (int i = 0; i < RDungeonManager.RDungeons.Count; i++) { if (RDungeonManager.RDungeons[i].DungeonName.ToLower().Contains(joinedArgs.ToLower())) { Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + "'s number is " + (i + 1).ToString(), Text.Yellow); itemsFound++; //return; } } if (itemsFound == 0) { Messenger.PlayerMsg(client, "Unable to find a random dungeon that starts with '" + joinedArgs + "'", Text.Yellow); } } } break; case "/finddungeon": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int itemsFound = 0; for (int i = 1; i < DungeonManager.Dungeons.Count; i++) { if (DungeonManager.Dungeons[i].Name.ToLower().Contains(joinedArgs.ToLower())) { Messenger.PlayerMsg(client, DungeonManager.Dungeons[i].Name + "'s number is " + i.ToString(), Text.Yellow); itemsFound++; //return; } } if (itemsFound == 0) { Messenger.PlayerMsg(client, "Unable to find a dungeon that starts with '" + joinedArgs + "'", Text.Yellow); } } } break; case "/addfriend": { client.Player.AddFriend(joinedArgs); } break; case "/removefriend": { client.Player.RemoveFriend(joinedArgs); } break; //storytile //clearstorytile case "/unlockstory": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { client.Player.SetStoryState(command[1].ToInt() - 1, false); Messenger.PlayerMsg(client, "Chapter " + (command[1].ToInt()) + " has been unlocked!", Text.Yellow); } } break; case "/setstorystate": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { client.Player.SetStoryState(command[1].ToInt() - 1, command[2].ToBool()); Messenger.PlayerMsg(client, "Chapter " + (command[1].ToInt()) + " has been set!", Text.Yellow); } } break; case "/resetstats": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { n.Player.Team[0].AtkBonus = 0; n.Player.Team[0].DefBonus = 0; n.Player.Team[0].SpclAtkBonus = 0; n.Player.Team[0].SpclDefBonus = 0; n.Player.Team[0].SpdBonus = 0; Messenger.PlayerMsg(client, "Stats have been reset for " + n.Player.Name + "!", Text.Green); Messenger.PlayerMsg(n, "Your stats have been reset!", Text.Green); } } } break; case "/recruitnum": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.PlayerMsg(client, n.Player.GetActiveRecruit().RecruitIndex.ToString(), Text.Green); } } } break; case "/storytest": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { Messenger.PlayerWarp(client, 500, 7, 9); Messenger.PlayerMsg(client, "Welcome to the story test map!", Text.Yellow); } } break; case "/teststory": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { client.Player.SetStoryState(joinedArgs.ToInt() - 1, false); StoryManager.PlayStory(client, joinedArgs.ToInt() - 1); } } break; case "/teststorybreak": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { Messenger.ForceEndStoryTo(client); client.Player.MovementLocked = false; } } break; case "/findlockedstory": { // TODO: /findlockedstory [What's this do?] } break; //muteadmin case "/mute*": case "/mute": { Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(joinedArgs, true); } else { n = ClientManager.FindClient(joinedArgs); } if (Ranks.IsAllowed(client, Enums.Rank.Moniter) && n != null) { n.Player.Muted = true; n.Player.Status = "MUTED"; Messenger.PlayerMsg(n, "You have been muted.", Text.Green); Messenger.AdminMsg("[Staff] " + client.Player.Name + " has muted " + n.Player.Name + ".", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Mute Issued] " + client.Player.Name + " muted " + n.Player.Name); PlayerInfoReport(n); Messenger.SendPlayerData(n); } } break; case "/permamute*": case "/permamute": { try { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; string muteTimeDays = "-----"; Client bannedClient; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { bannedClient = ClientManager.FindClient(playerName, true); } else { bannedClient = ClientManager.FindClient(playerName); } if (command.CommandArgs.Count > 2 && command[2].IsNumeric()) { muteTimeDays = DateTime.Now.AddDays(Convert.ToDouble(command[2])).ToString(); } if (bannedClient != null) { bannedClient.Player.Muted = true; bannedClient.Player.Status = "MUTED"; Messenger.PlayerMsg(bannedClient, "You have been permamuted.", Text.Green); Messenger.AdminMsg("[Staff] " + client.Player.Name + " has permamuted " + bannedClient.Player.Name + ".", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Permamute Issued] " + client.Player.Name + " muted " + bannedClient.Player.Name); PlayerInfoReport(bannedClient); Messenger.SendPlayerData(bannedClient); using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { Bans.BanPlayer(dbConnection, bannedClient.IP.ToString(), bannedClient.Player.CharID, bannedClient.Player.AccountName + "/" + bannedClient.Player.Name, bannedClient.MacAddress, bannedClient.BiosId, client.Player.CharID, client.IP.ToString(), muteTimeDays, Enums.BanType.Mute); } } else { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { IDataColumn[] columns = dbConnection.Database.RetrieveRow("characteristics", "CharID", "Name=\"" + playerName + "\""); if (columns != null) { string charID = (string)columns[0].Value; string foundIP = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastIPAddressUsed", "CharID=\"" + charID + "\"")[0].Value; string foundMac = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastMacAddressUsed", "CharID=\"" + charID + "\"")[0].Value; string storedUUID = (string)dbConnection.Database.RetrieveRow("character_statistics", "StoredUUID", "CharID=\"" + charID + "\"")[0].Value; //get previous IP and mac Bans.BanPlayer(dbConnection, foundIP, charID, playerName, foundMac, storedUUID, client.Player.CharID, client.IP.ToString(), muteTimeDays, Enums.BanType.Mute); Messenger.AdminMsg("[Staff] " + client.Player.Name + " has permamuted " + bannedClient.Player.Name + ".", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Permamute Issued] " + client.Player.Name + " muted " + bannedClient.Player.Name); } else { Messenger.PlayerMsg(client, "Unable to find player!", Text.BrightRed); } } } } } catch (Exception ex) { Messenger.AdminMsg("Error: Permamute", Text.White); Messenger.AdminMsg(ex.ToString(), Text.White); } } break; case "/unmute*": case "/unmute": { Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(joinedArgs, true); } else { n = ClientManager.FindClient(joinedArgs); } if (Ranks.IsAllowed(client, Enums.Rank.Moniter) && n != null) { n.Player.Muted = false; n.Player.Status = ""; Messenger.PlayerMsg(n, "You have been unmuted.", Text.Green); Messenger.AdminMsg("[Staff] " + client.Player.Name + " has unmuted " + n.Player.Name + ".", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Unmute] " + client.Player.Name + " unmuted " + n.Player.Name); Messenger.SendPlayerData(n); using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { Bans.RemoveBan(dbConnection, "BannedPlayerID", n.Player.CharID); } } } break; case "/kill": { // TODO: /kill [Scripts] Messenger.PlayerMsg(client, "That is (kinda) not a valid command!", Text.BrightRed); } break; case "/jail": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (command.CommandArgs.Count == 2) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { if (n != client) { string mapID = n.Player.MapID; if (mapID == MapManager.GenerateMapID(666)) { Messenger.PlayerMsg(client, "The player is already in jail!", Text.BrightRed); } else { Messenger.PlayerWarp(n, 666, 10, 12); Messenger.PlayerMsg(n, "You have been jailed! " + "Please wait for " + client.Player.Name + " or another online staff member to assess the situation.", Text.Yellow); Messenger.AdminMsg("[Staff] " + n.Player.Name + " has been sent to jail by " + client.Player.Name + "!", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Jail] " + client.Player.Name + " jailed " + n.Player.Name); } } else { Messenger.PlayerMsg(client, "You can't jail yourself!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } } } break; case "/unjail": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (command.CommandArgs.Count == 2) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { if (n != client) { string mapID = n.Player.MapID; if (mapID != MapManager.GenerateMapID(666)) { Messenger.PlayerMsg(client, "The player is not in jail!", Text.BrightRed); } else { Messenger.PlayerWarp(n, Crossroads, 25, 25); Messenger.PlayerMsg(n, "You have been unjailed by " + client.Player.Name + "!", Text.Yellow); Messenger.AdminMsg("[Staff] " + n.Player.Name + " has been freed from jail by " + client.Player.Name + "!", Text.BrightBlue); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Unjail] " + client.Player.Name + " unjailed " + n.Player.Name); } } else { Messenger.PlayerMsg(client, "You can't unjail yourself!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } } } break; //warphere case "/tostartall": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { //if (command[1].IsNumeric()) { List<Client> clientList = new List<Client>(); foreach (Client n in client.Player.Map.GetClients()) { clientList.Add(n); } foreach (Client n in clientList) { Messenger.PlayerWarp(n, 1015, 25, 25); n.Player.Dead = false; PacketBuilder.AppendDead(n, hitlist); Messenger.PlayerMsg(n, "You have been warped to the crossroads by " + client.Player.Name + "!", Text.BrightGreen); Messenger.PlayerMsg(client, n.Player.Name + " has been warped to the crossroads!", Text.BrightGreen); } //} else { //} } } break; case "/tostart*": case "/tostart": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = joinedArgs; Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(playerName, true); } else { n = ClientManager.FindClient(playerName); } if (n != null) { Messenger.PlayerWarp(n, 1015, 25, 25); n.Player.Dead = false; PacketBuilder.AppendDead(n, hitlist); Messenger.PlayerMsg(n, "You have been warped to the crossroads by " + client.Player.Name + "!", Text.BrightGreen); Messenger.PlayerMsg(client, n.Player.Name + " has been warped to the crossroads!", Text.BrightGreen); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warp Event] " + client.Player.Name + " warped " + n.Player.Name + " to The Crossroads."); } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } } break; case "/world": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerWarp(client, 538, 10, 17); Messenger.PlayerMsg(client, "Welcome to the World Map!", Text.BrightGreen); } } break; case "/warpto": { if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) { if (command[1].IsNumeric()) { Messenger.PlayerWarp(client, command[1].ToInt(), client.Player.X, client.Player.Y); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warp Event] " + client.Player.Name + " warped to map " + command[1] + " - " + client.Player.Map.Name); } else { // TODO: /warpto findmap method [Scripts] //findmap method } } } break; case "/warpmeto*": case "/warpmeto": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client target; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { target = ClientManager.FindClient(joinedArgs, true); } else { target = ClientManager.FindClient(joinedArgs); } if (target != null) { Messenger.PlayerWarp(client, target.Player.GetCurrentMap(), target.Player.X, target.Player.Y); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warp Event] " + client.Player.Name + " warped to " + target.Player.Name + " on map: " + target.Player.MapID + " - " + target.Player.Map.Name); } else { Messenger.PlayerMsg(client, "Player could not be found.", Text.Green); } } } break; case "/warptome*": case "/warptome": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client target; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { target = ClientManager.FindClient(joinedArgs, true); } else { target = ClientManager.FindClient(joinedArgs); } if (target != null) { Messenger.PlayerWarp(target, client.Player.GetCurrentMap(), client.Player.X, client.Player.Y); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warp Event] " + client.Player.Name + " warped " + target.Player.Name + " to them on map:" + client.Player.MapID + " - " + client.Player.Map.Name); } else { Messenger.PlayerMsg(client, "Player could not be found.", Text.Green); } } } break; //masswarp case "/help": { //... } break; case "/viewemotes": { //will make the command when we make the emotes } break; case "/map*": case "/map": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(playerName, true); } else { n = ClientManager.FindClient(playerName); } if (n != null) { Messenger.PlayerMsg(client, n.Player.Name + " is at Map " + n.Player.MapID, Text.Green); Messenger.PlayerMsg(client, n.Player.Map.Name, Text.Green); Messenger.PlayerMsg(client, n.Player.X + ", " + n.Player.Y, Text.Green); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Info Request] " + client.Player.Name + " checked " + n.Player.Name + "'s map."); } else { Messenger.PlayerMsg(client, playerName + " could not be found.", Text.Green); } } } break; case "/tcpid": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { string playerName = command[1]; Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(playerName, true); } else { n = ClientManager.FindClient(playerName); } if (n != null) { Messenger.PlayerMsg(client, n.TcpID.EndPoint.ToString(), Text.Yellow); Messenger.PlayerMsg(client, ClientManager.GetClient(n.TcpID).Player.Name, Text.Yellow); } } } break; case "/playerin": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { //if (command[1].IsNumeric()) { //Messenger.PlayerMsg(client, "Players in this map :", Text.Yellow); //foreach (MapPlayer playerOnMap in client.Player.Map.PlayersOnMap.GetPlayers()) { // Messenger.PlayerMsg(client, playerOnMap.PlayerID, Text.Yellow); //} int count = 0; foreach (Client i in client.Player.Map.GetClients()) { count++; //Messenger.PlayerMsg(client, i.Player.Name, Text.Yellow); } Messenger.PlayerMsg(client, "Clients in this map: " + count, Text.Yellow); //foreach (Client i in client.Player.Map.GetClients()) { //Messenger.PlayerMsg(client, i.Player.Name, Text.Yellow); //} //} else { //} } } break; case "/playerindungeon": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (command[1].IsNumeric()) { foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying() && i.Player.Map.MapType == Enums.MapType.RDungeonMap && ((RDungeonMap)i.Player.Map).RDungeonIndex == command[1].ToInt() - 1) { Messenger.PlayerMsg(client, i.Player.Name + " is on Floor " + (((RDungeonMap)i.Player.Map).RDungeonFloor + 1), Text.BrightCyan); } } } else { } } } break; case "/playerintc": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying() && i.Player.Map.MapType == Enums.MapType.RDungeonMap && ((RDungeonMap)i.Player.Map).RDungeonIndex >= 70 && ((RDungeonMap)i.Player.Map).RDungeonIndex <= 86) { Messenger.PlayerMsg(client, i.Player.Name + " is on #" + (((RDungeonMap)i.Player.Map).RDungeonIndex + 1), Text.BrightCyan); Messenger.PlayerMsg(client, "-Floor " + (((RDungeonMap)i.Player.Map).RDungeonFloor + 1), Text.Yellow); } } } } break; case "/playerindungeons": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int total = 0; foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying() && i.Player.Map.Moral == Enums.MapMoral.None) { Messenger.PlayerMsg(client, i.Player.Name + " is at " + i.Player.Map.Name, Text.BrightCyan); total++; } } Messenger.PlayerMsg(client, "Total: " + total, Text.BrightCyan); } } break; case "/hp": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.PlayerMsg(client, n.Player.Name + "'s HP: " + n.Player.GetActiveRecruit().HP.ToString(), Text.Yellow); } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/playerid": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.PlayerMsg(client, n.Player.Name + "'s ID: " + n.Player.CharID, Text.Yellow); } } } break; case "/forceswap": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(command[1]); if (n != null) { int slot = 0; //for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (n.Player.Team[command[2].ToInt()] != null && n.Player.Team[command[2].ToInt()].Loaded) { slot = command[2].ToInt(); } //} n.Player.SwapActiveRecruit(slot); } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/info*": case "/info": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(joinedArgs, true); } else { n = ClientManager.FindClient(joinedArgs); } if (n != null) { Messenger.PlayerMsg(client, "Account: " + n.Player.AccountName + ", Name: " + n.Player.Name, Text.Yellow); for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (n.Player.Team[i] != null && n.Player.Team[i].Loaded) { Messenger.PlayerMsg(client, "Team #" + i + ": " + Pokedex.GetPokemon(n.Player.Team[i].Species).Name + " Lv." + n.Player.Team[i].Level, Text.Yellow); Messenger.PlayerMsg(client, "HP: " + n.Player.Team[i].HP + "/" + n.Player.Team[i].MaxHP, Text.Yellow); Messenger.PlayerMsg(client, "Exp: " + n.Player.Team[i].Exp + "/" + n.Player.Team[i].GetNextLevel(), Text.Yellow); Messenger.PlayerMsg(client, "Atk/Sp.Atk: " + n.Player.Team[i].Atk + "/" + n.Player.Team[i].SpclAtk, Text.Yellow); Messenger.PlayerMsg(client, "Def/Sp.Def: " + n.Player.Team[i].Def + "/" + n.Player.Team[i].SpclDef, Text.Yellow); Messenger.PlayerMsg(client, "Speed: " + n.Player.Team[i].Spd, Text.Yellow); } } Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Info Request] " + client.Player.Name + " checked " + n.Player.Name + "'s team information."); } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/statusinfo": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (n.Player.Team[i] != null && n.Player.Team[i].Loaded) { Messenger.PlayerMsg(client, "Team #" + i + ": " + Pokedex.GetPokemon(n.Player.Team[i].Species).Name + "/" + n.Player.Team[i].StatusAilment, Text.Yellow); for (int j = 0; j < n.Player.Team[i].VolatileStatus.Count; j++) { Messenger.PlayerMsg(client, n.Player.Team[i].VolatileStatus[j].Name + "/" + n.Player.Team[i].VolatileStatus[j].Counter + "/" + n.Player.Team[i].VolatileStatus[j].Tag, Text.Yellow); } } } } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/getip*": case "/getip": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { string playerName = command[1]; Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(playerName, true); } else { n = ClientManager.FindClient(playerName); } if (n != null) { if (Ranks.IsAllowed(n, Enums.Rank.ServerHost)) { Messenger.PlayerMsg(client, n.Player.Name + "'s IP: 46.4.166.141", Text.Yellow); } else { Messenger.PlayerMsg(client, n.Player.Name + "'s IP: " + n.IP.ToString(), Text.Yellow); } Messenger.PlayerMsg(client, n.Player.Name + "'s MAC: " + n.MacAddress, Text.Yellow); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Info Request] " + client.Player.Name + " checked " + n.Player.Name + "'s IP/MAC."); } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/findip": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerMsg(client, "Searching for players with the IP: \"" + joinedArgs + "\"", Text.BrightBlue); foreach (Client n in ClientManager.GetClients()) { if (n.IsPlaying()) { if (n.IP.ToString().StartsWith(joinedArgs)) { Messenger.PlayerMsg(client, n.Player.AccountName + "/" + n.Player.Name + ": " + n.IP.ToString(), Text.BrightGreen); } } } } } break; //getindex; no indexes //poke, hug, praise, yawn, wave case "/praise": { if (client.Player.Muted == false) { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " gave praise to " + joinedArgs + "!", Text.Green); } else { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } } break; case "/hug": { if (client.Player.Muted == false) { if (command.CommandArgs.Count >= 2) { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " has hugged " + command[1] + "!", Text.White); } else { Messenger.PlayerMsg(client, "You have to pick somebody to hug!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } } break; case "/notepad": { if (client.Player.Muted == false) { if (command.CommandArgs.Count >= 2) { if (command[1].ToLower() != "artmax") { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " threw a notepad at " + command[1] + "!", Text.Yellow); } else { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " threw a notepad at " + command[1] + " (nuclear strike!)", Text.Yellow); } } else { Messenger.PlayerMsg(client, "You have to pick somebody to throw a notepad at!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } } break; case "/time": { Messenger.PlayerMsg(client, "It is currently: " + Server.Globals.ServerTime, Text.BrightGreen); } break; case "/me": { if (client.Player.Muted == false) { if (command.CommandArgs.Count >= 2) { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " " + joinedArgs, Text.BrightBlue); } else { Messenger.PlayerMsg(client, "You have to include something to say besides your name!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } } break; case "/poke": { if (client.Player.Muted == false) { if (command.CommandArgs.Count >= 2) { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " poked " + command[1] + ".", Text.Yellow); } else { Messenger.PlayerMsg(client, "You have to pick somebody to poke!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } } break; case "/yawn": { if (client.Player.Muted == false) { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " let out a loud yawn " + joinedArgs + "~", Text.BrightBlue); } else { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } } break; case "/wave": { if (client.Player.Muted == false) { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " waved at " + joinedArgs + ".", Text.BrightGreen); } else { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } } break; case "/away": { if (client.Player.Muted == true) { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } else if (client.Player.MapID == "s791" || client.Player.MapID == "s792") { Messenger.PlayerMsg(client, "You cannot be away while playing Capture The Flag!", Text.BrightRed); } else if (client.Player.Status.ToLower() == "away") { client.Player.Status = ""; Messenger.GlobalMsg(client.Player.Name + " has returned from being away.", Text.Yellow); Messenger.SendPlayerData(client); } else { client.Player.Status = "Away"; Messenger.GlobalMsg(client.Player.Name + " is now away.", Text.Yellow); Messenger.SendPlayerData(client); } } break; case "/wb*": case "/wb": { if (client.Player.Muted == false) { if (command.CommandArgs.Count >= 2) { Client n; string[] subCommand = command[0].Split('*'); if (subCommand.Length > 1) { n = ClientManager.FindClient(joinedArgs, true); } else { n = ClientManager.FindClient(joinedArgs); } if (n != null) { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " welcomes " + n.Player.Name + " back to " + Settings.GameNameShort + "!", Text.White); } else if (n == null) { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } else { Messenger.PlayerMsg(client, "Pick someone to welcome back.", Text.Black); } } else { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } } break; case "/pichu!": { if (client.Player.Muted == false) { if (client.Player.GetActiveRecruit().Species == 172) { Messenger.PlaySoundToMap(client.Player.MapID, "Pichu!.wav"); } } } break; case "/muwaha": { if (client.Player.Muted == false) { Messenger.PlaySoundToMap(client.Player.MapID, "magic1268.wav"); } } break; case "/status": { if (client.Player.Muted == true) { Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed); } else if (exPlayer.Get(client).InCTF == false && exPlayer.Get(client).InSnowballGame == false && joinedArgs != "MUTED") { if (!string.IsNullOrEmpty(joinedArgs)) { string status = joinedArgs; if (joinedArgs.Length > 10) { status = joinedArgs.Substring(0, 10); } client.Player.Status = status; Messenger.SendPlayerData(client); } else { client.Player.Status = ""; Messenger.SendPlayerData(client); } } } break; case "/giveup": { GiveUp(client); } break; case "/watch": { if (client.Player.MapID == MapManager.GenerateMapID(660) || client.Player.MapID == MapManager.GenerateMapID(1718)) { TcpPacket packet = new TcpPacket("focusonpoint"); packet.AppendParameters(15, 15); Messenger.SendDataTo(client, packet); client.Player.MovementLocked = true; } } break; case "/stopwatch": { if (client.Player.MapID == MapManager.GenerateMapID(660) || client.Player.MapID == MapManager.GenerateMapID(1718)) { TcpPacket packet = new TcpPacket("focusonpoint"); packet.AppendParameters(-1, -1); Messenger.SendDataTo(client, packet); client.Player.MovementLocked = false; } } break; case "/sethouse": { if (exPlayer.Get(client).IsValidPlayerSpawn(client.Player.MapID) == true && client.Player.Map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.Blocked) { exPlayer.Get(client).SpawnMap = client.Player.MapID; exPlayer.Get(client).SpawnX = client.Player.X; exPlayer.Get(client).SpawnY = client.Player.Y; Messenger.PlayerMsg(client, "Spawn point saved!", Text.Yellow); } else { Messenger.PlayerMsg(client, "This is not a valid spawn point!", Text.BrightRed); } } break; case "/rstart": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (command[1].IsNumeric()) { int floor = 1; if (command.CommandArgs.Count > 2 && command[2].IsNumeric()) { floor = command[2].ToInt(); } //RDungeonManager.LoadRDungeon(command[1].ToInt() - 1); client.Player.WarpToRDungeon(command[1].ToInt() - 1, floor - 1); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[RDungeon Warp] " + client.Player.Name + " warped to " + RDungeonManager.RDungeons[command[1].ToInt() - 1].DungeonName + ", Floor: " + floor); } } } break; case "/findstory": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { int storiesFound = 0; if (String.IsNullOrEmpty(joinedArgs)) { Messenger.PlayerMsg(client, "This is not the story you are looking for. (Because you didn't specify anything!)", Text.Yellow); } else { for (int i = 0; i < Server.Stories.StoryManagerBase.Stories.MaxStories; i++) { if (StoryManagerBase.Stories[i].Name.ToLower().Contains(joinedArgs.ToLower())) { Messenger.PlayerMsg(client, StoryManagerBase.Stories[i].Name + "'s number is " + i.ToString(), Text.Yellow); storiesFound++; //return; } } if (storiesFound == 0) { Messenger.PlayerMsg(client, "Unable to find a story that starts with '" + joinedArgs + "'", Text.Yellow); } } } } break; case "/nextfloor": { try { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (client.Player.Map.MapType == Enums.MapType.RDungeonMap && ((RDungeonMap)client.Player.Map).RDungeonIndex > -1) { client.Player.WarpToRDungeon(((RDungeonMap)client.Player.Map).RDungeonIndex, ((RDungeonMap)client.Player.Map).RDungeonFloor + 1); } } } catch (Exception ex) { Messenger.AdminMsg("nextfloor error", Text.Pink); Messenger.AdminMsg(ex.ToString(), Text.Pink); } } break; case "/confuse": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { AddExtraStatus(client.Player.GetActiveRecruit(), client.Player.Map, "Confusion", 5, null, "", hitlist); //Confuse(client.Player.GetActiveRecruit(), client.Player.Map, 5, null); } } break; case "/hittime": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { client.Player.GetActiveRecruit().TimeMultiplier = 500; PacketBuilder.AppendTimeMultiplier(client, hitlist); } } break; case "/visible": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { PacketBuilder.AppendVisibility(client, hitlist, false); } } break; case "/infoexp": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { Messenger.PlayerMsg(client, client.Player.ExplorerRank.ToString(), Text.BrightRed); } } break; case "/testexp": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { client.Player.MissionExp += command[1].ToInt(); MissionManager.ExplorerRankUp(client); } } break; case "/fixrank": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { n.Player.ExplorerRank = Enums.ExplorerRank.Normal; MissionManager.ExplorerRankUp(n); Messenger.PlayerMsg(client, n.Player.Name + "'s rank is fixed now!", Text.Yellow); } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/;": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic675.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 9, 1, 2, hitlist); } break; case "/'": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic664.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 6, 2, 1, hitlist); } break; case "/*": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic678.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 5, 2, 1, hitlist); } break; case "/)": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } PacketBuilder.AppendEmote(client, 7, 2, 1, hitlist); } break; case "/))": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic721.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 7, 2, 7, hitlist); } break; case "/)))": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic657.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 7, 2, 8, hitlist); } break; case "/.": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic700.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 12, 2, 1, hitlist); } break; case "/..": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic700.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 12, 2, 2, hitlist); } break; case "/...": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic700.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 12, 2, 3, hitlist); } break; case "/!": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic667.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 13, 2, 1, hitlist); } break; case "/?": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic665.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 8, 2, 1, hitlist); } break; case "/!?": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic671.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 11, 2, 1, hitlist); } break; case "/+": { if (client.Player.Muted) { Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed); return; } hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic674.wav"), client.Player.X, client.Player.Y, 10); PacketBuilder.AppendEmote(client, 10, 2, 1, hitlist); } break; case "/testailment": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (command[1].IsNumeric() && command[1].ToInt() >= 0 && command[1].ToInt() < 6) { SetStatusAilment(client.Player.GetActiveRecruit(), client.Player.Map, (Enums.StatusAilment)(command[1].ToInt()), 1, null); // for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) // { // if (client.Player.Map.ActiveNpc[i].Num > 0) // { // client.Player.Map.ActiveNpc[i].ChangeStatusAilment((Enums.StatusAilment)(command[1].ToInt()), 1); // } // } } } } break; case "/addvstatus": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { if (command[1].IsNumeric()) { ExtraStatus status = new ExtraStatus(); status.Name = client.Player.GetActiveRecruit().VolatileStatus.Count.ToString(); status.Emoticon = command[1].ToInt(); client.Player.GetActiveRecruit().VolatileStatus.Add(status); PacketBuilder.AppendVolatileStatus(client, hitlist); IMap clientMap = client.Player.Map; for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { if (clientMap.ActiveNpc[i].Num > 0) { clientMap.ActiveNpc[i].VolatileStatus.Add(status); PacketBuilder.AppendNpcVolatileStatus(MapManager.RetrieveActiveMap(clientMap.ActiveNpc[i].MapID), hitlist, i); } } } } } break; case "/removevstatus": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { client.Player.GetActiveRecruit().VolatileStatus.Clear(); PacketBuilder.AppendVolatileStatus(client, hitlist); IMap clientMap = client.Player.Map; for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { if (clientMap.ActiveNpc[i].Num > 0) { clientMap.ActiveNpc[i].VolatileStatus.Clear(); PacketBuilder.AppendNpcVolatileStatus(MapManager.RetrieveActiveMap(clientMap.ActiveNpc[i].MapID), hitlist, i); } } } } break; /*case "/diagonal": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { IMap clientMap = client.Player.Map; for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { if (clientMap.ActiveNpc[i].Num > 0) { clientMap.ActiveNpc[i].X += 3; clientMap.ActiveNpc[i].Y += 3; PacketBuilder.AppendNpcXY(MapManager.RetrieveActiveMap(clientMap.ActiveNpc[i].MapID), hitlist, i); } } } } break;*/ case "/checkailment": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerMsg(client, client.Player.GetActiveRecruit().StatusAilment.ToString() + client.Player.GetActiveRecruit().StatusAilmentCounter.ToString(), Text.BrightRed); } } break; case "/checkdungeons": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { Messenger.PlayerMsg(client, n.Player.Name + "'s completed dungeons:", Text.Yellow); for (int i = 0; i < Server.Dungeons.DungeonManager.Dungeons.Count; i++) { Messenger.PlayerMsg(client, Server.Dungeons.DungeonManager.Dungeons[i].Name + ": " + n.Player.GetDungeonCompletionCount(i), Text.Yellow); } } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/testegg": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { } } break; case "/speedlimit": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { if (command[1].IsNumeric() && command[1].ToInt() >= 0 && command[1].ToInt() < 7) { client.Player.GetActiveRecruit().SpeedLimit = (Enums.Speed)(command[1].ToInt()); PacketBuilder.AppendSpeedLimit(client, hitlist); } } } break; case "/testdeath": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { client.Player.Hunted = false; PacketBuilder.AppendHunted(client, hitlist); client.Player.Dead = true; PacketBuilder.AppendDead(client, hitlist); AskAfterDeathQuestion(client); } } break; case "/mobile": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { if (command[1].IsNumeric()) { client.Player.GetActiveRecruit().Mobility[command[1].ToInt()] = true; PacketBuilder.AppendMobility(client, hitlist); } } } break; case "/immobile": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { if (command[1].IsNumeric()) { client.Player.GetActiveRecruit().Mobility[command[1].ToInt()] = false; PacketBuilder.AppendMobility(client, hitlist); } } } break; case "/createparty": { PartyManager.CreateNewParty(client); } break; case "/joinparty": { if (client.Player.PartyID == null) { Party party = PartyManager.FindPlayerParty(ClientManager.FindClient(joinedArgs)); PartyManager.JoinParty(party, client); } else { Messenger.PlayerMsg(client, "You are already in a party!", Text.BrightRed); } } break; case "/leaveparty": { if (client.Player.PartyID != null) { if (client.Player.Map.Moral == Enums.MapMoral.None) { Messenger.PlayerMsg(client, "You can't leave the party here!", Text.BrightRed); } else { Party party = PartyManager.FindPlayerParty(client); PartyManager.RemoveFromParty(party, client); } } else { Messenger.PlayerMsg(client, "You are not in a party!", Text.BrightRed); } } break; case "/myparty": { if (client.Player.PartyID != null) { Party party = PartyManager.FindPlayerParty(client); Messenger.PlayerMsg(client, "Players in your party:", Text.Black); foreach (Client i in party.GetOnlineMemberClients()) { Messenger.PlayerMsg(client, i.Player.Name, Text.White); } } else { Messenger.PlayerMsg(client, "You are not in a party!", Text.BrightRed); } } break; case "/kickparty": { try { if (client.Player.PartyID != null) { Client targetPlayer = ClientManager.FindClient(command[1]); if (targetPlayer.Player.PartyID == client.Player.PartyID) { Party party = PartyManager.FindPlayerParty(client); if (party.GetLeader() == client) { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { if (n.Player.Map.Moral == Enums.MapMoral.None) { Messenger.PlayerMsg(client, "The party member can't be kicked there!", Text.BrightRed); } else { PartyManager.RemoveFromParty(party, n); } } else { Messenger.PlayerMsg(client, "Unable to find player.", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You are not the party leader!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "Player is not in your party!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You are not in a party!", Text.BrightRed); } } catch (Exception ex) { Messenger.AdminMsg(ex.ToString(), Text.White); } } break; case "/moduleswitch": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { client.Player.SetActiveExpKitModule(Enums.ExpKitModules.Counter); } } break; case "/sticky": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { if (command[1].IsNumeric()) { client.Player.SetItemSticky(command[1].ToInt(), true); } } } break; case "/thticky": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { if (command[1].IsNumeric()) { client.Player.SetItemSticky(command[1].ToInt(), false); } } } break; case "/trade": { Client n = ClientManager.FindClient(joinedArgs); if (n != null) { if (n.Player.MapID == client.Player.MapID) { client.Player.RequestTrade(n); Messenger.PlayerMsg(client, "You have asked " + n.Player.Name + " to trade with you!", Text.BrightGreen); } } else { Messenger.PlayerMsg(client, "Player is offline.", Text.Grey); } } break; case "/editemoticon": case "/editemotions": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("emoticoneditor")); } } break; case "/edititem": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { if (command[1].IsNumeric()) { int n = command[1].ToInt(); // Prevent hacking if (n < 0 | n > Server.Items.ItemManager.Items.MaxItems) { Messenger.HackingAttempt(client, "Invalid Item Index"); return; } Messenger.SendEditItemTo(client, n); } } } break; case "/edititems": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendItemEditor(client); } } break; case "/editmove": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { if (command[1].IsNumeric()) { int n = command[1].ToInt(-1); // Prevent hacking if (n < 0 | n > MoveManager.Moves.MaxMoves) { Messenger.HackingAttempt(client, "Invalid Move Index"); return; } Messenger.SendEditMoveTo(client, n); } } } break; case "/editmoves": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("moveeditor")); } } break; case "/editdungeon": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { if (command[1].IsNumeric()) { if (command[1].ToInt() < 0 && command[1].ToInt() >= DungeonManager.Dungeons.Count) { Server.Network.Messenger.HackingAttempt(client, "Invalid Dungeon Number"); } Messenger.SendEditDungeonTo(client, command[1].ToInt()); } } } break; case "/editdungeons": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("dungeoneditor")); } } break; case "/editnpc": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { if (command[1].IsNumeric()) { int n = command[1].ToInt(); // Prevent hacking /*if (n < 0 || n > Server.Npcs.NpcManager.Npcs.MaxNpcs) { Messenger.HackingAttempt(client, "Invalid Npc Index"); return; }*/ Messenger.SendNpcAiTypes(client); Messenger.SendEditNpcTo(client, n); } } } break; case "/editnpcs": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("npceditor")); } } break; case "/editrdungeon": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { if (command[1].IsNumeric()) { int n = command[1].ToInt(); if (n < 0 || n > RDungeonManager.RDungeons.Count - 1) { Messenger.PlayerMsg(client, "Invalid dungeon client", Text.BrightRed); return; } Messenger.SendEditRDungeonTo(client, n); } } } break; case "/editrdungeons": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("rdungeoneditor")); } } break; case "/editstory": case "/editstories": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("storyeditor")); } } break; case "/mapreport": { // Prevent hacking //if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { //Messenger.HackingAttempt(client, "Admin Cloning"); //return; //} // TODO: Fix MapReport to work with on-demand map loading system //TcpPacket packet = new TcpPacket("mapreport"); //for (int i = 1; i <= Server.Settings.MaxMaps; i++) { //packet.AppendParameter(MapManager.Maps[i].Name); //packet.AppendParameter("-Not Implemented-"); //} //Messenger.SendDataTo(client, packet); } break; case "/editevolutions": case "/editevolution": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("evolutioneditor")); } } break; case "/editshop": case "/editshops": { // Prevent Hacking if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) { Server.Network.Messenger.HackingAttempt(client, "Admin Cloning"); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("shopeditor")); } } break; case "/testrecall": { if (Ranks.IsAllowed(client, Enums.Rank.Developer)) { Messenger.SendRecallMenu(client, false); } } break; case "/test": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Debug.RunTest(client); } } break; case "/setform": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { client.Player.GetActiveRecruit().SetForm(command[1].ToInt()); Messenger.SendPlayerData(client); Messenger.SendActiveTeam(client); Messenger.SendStats(client); } } break; case "/setgender": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(command[1]); if (n != null) { n.Player.GetActiveRecruit().Sex = (Enums.Sex)command[2].ToInt(); RefreshCharacterTraits(n.Player.GetActiveRecruit(), n.Player.Map, hitlist); Messenger.SendPlayerData(n); Messenger.SendActiveTeam(n); Messenger.SendStats(n); Messenger.PlayerMsg(client, n.Player.Name + "'s " + n.Player.GetActiveRecruit().Name + "'s gender was set to " + ((Enums.Sex)command[2].ToInt()).ToString(), Text.Pink); Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Characteristics] " + client.Player.Name + " changed the gender of " + n.Player.Name + "'s " + n.Player.GetActiveRecruit().Name + " to " + ((Enums.Sex)command[2].ToInt()).ToString()); } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/offlinetostart": { try { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { dbConnection.Database.ExecuteNonQuery("UPDATE mdx_players.location " + "JOIN mdx_players.characteristics ON mdx_players.characteristics.CharID = mdx_players.location.CharID " + "SET mdx_players.location.Map = \'s1015\' " + "WHERE characteristics.Name = \'" + command[1] + "\';"); Messenger.PlayerMsg(client, "Character has been offline-warped to the crossroads", Text.Yellow); } } } catch (Exception ex) { Messenger.PlayerMsg(client, ex.ToString(), Text.Black); } } break; case "/fixhouse": { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Client n = ClientManager.FindClient(command[1]); if (n != null) { string houseID = MapManager.GenerateHouseID(n.Player.CharID, 0); // Make an empty house DataManager.Maps.HouseMap rawHouse = new DataManager.Maps.HouseMap(houseID); rawHouse.Owner = n.Player.CharID; rawHouse.Room = 0; IMap map = new House(rawHouse); map.Moral = Enums.MapMoral.House; map.Name = n.Player.Name + "'s House"; map.Save(); Messenger.PlayerMsg(client, n.Player.Name + "'s house is cleared.", Text.Pink); } else { Messenger.PlayerMsg(client, "Player is offline", Text.Grey); } } } break; case "/addmaps": { if (Ranks.IsAllowed(client, Enums.Rank.Admin)) { for (int i = 2002; i <= 3000; i++) { // Make an empty house DataManager.Maps.Map rawMap = new DataManager.Maps.Map("s" + i); Server.Maps.Map map = new Server.Maps.Map(rawMap); map.Save(); Messenger.PlayerMsg(client, "Map " + i + " added.", Text.Pink); } Messenger.PlayerMsg(client, "Maps added.", Text.Pink); } } break; case "/copycharacter": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { //try { // using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { // // PlayerDataManager.CopyCharacter(dbConnection.Database, command[1], command[2]); // Messenger.PlayerMsg(client, "Character copied from " + command[1] + " to " + command[2], Text.Black); // } //} catch (Exception ex) { // Messenger.PlayerMsg(client, ex.ToString(), Text.Black); //} } } break; case "/addnpcs": { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { for (int i = 2002; i <= 3000; i++) { NpcManager.SaveNpc(i); Messenger.PlayerMsg(client, "NPC " + i + " added.", Text.BrightGreen); } } } break; default: { Messenger.PlayerMsg(client, "That is not a valid command.", Text.BrightRed); } break; } PacketHitList.MethodEnded(ref hitlist); } catch (Exception ex) { Messenger.AdminMsg("Error: Command (" + command.CommandArgs[0] + ")", Text.Black); //Messenger.AdminMsg(ex.ToString(), Text.Black); } }
public static House LoadHouseMap(DatabaseConnection dbConnection, string mapID) { DataManager.Maps.HouseMap loadedMap = MapDataManager.LoadHouseMap(dbConnection.Database, mapID); if (loadedMap != null) { House map = new House(loadedMap); return map; } else { return null; } }
public static void SaveHouseMap(DatabaseConnection dbConnection, string mapID, House map) { for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { map.ActiveNpc[i].Save(); } MapDataManager.SaveHouseMap(dbConnection.Database, mapID, map.baseMap); }