private static string SequenceResponse(Player player, string[] command) { try { //Set the player's Sequence to an instance of the sequence noted in the player file //EX: 'FST1' becomes an instance of FST.cs using the number case in Substring(3) to determine section Sequence sequence = (Sequence)Activator.CreateInstance(Type.GetType("GameServer.Sequences." + player.Sequence.Substring(0, 3)), player, command); //Set the response to be sent to the player to the response from the sequence case response = sequence.Response; //Set the last command entered and last response sent for re-logging purposes player.LastCommand = command; player.LastResponse = sequence.Response; //Send the player stats/gear/spells to be updated on the client side response += string.Format("%%{0}/{1}/{2}/{3}/{4}/{5}/{6}/{7}/{8}/{9}/{10}/{11}/{12}/{13}%%", player.Name, player.Level, player.Experience, player.Gold, player.MaxHealth, player.CurrentHealth, player.MaxMana, player.CurrentMana, player.Strength, player.Dexterity, player.Constitution, player.Intelligence, player.Wisdom, player.Charisma); player.Items.ForEach(item => response += item.Name + "/"); response += "%%"; player.Spells.ForEach(s => response += s.Name + "/"); SaveJson(command[0], player); } catch (ArgumentNullException) { //Errors with the player's sequence sends the player back to Town and lets them know the error causing sequence, and to alert an admin if the issue persists string error = "Error getting sequence! Setting to 'TWN1'. Contact an Admin if this continues. Player ID: " + player.UserID + " Sequence: " + player.Sequence.Substring(0, 3); response += error; GameServer.Log(error); player.SetSequence("TWN1"); SaveJson(command[0], player); } return(response); }