internal void Inventory(Worn wornEquipment, Runtime runtime) { Console.Clear(); Console.WriteLine("Current equipment:"); //myLists.Environment[currentRoomNumber - 1000].RoomContent int i = 0; foreach (var pieceOfEquipment in runtime.myLists.Items[0].ArmorSlotContains) { Console.WriteLine(runtime.myLists.ArmorItem[i].Position); //i++; //Console.ReadLine(); /* * if (pieceOfEquipment.Position == 0) * { * Console.Write("Head: "); * } * else if (pieceOfEquipment.Position == 1) * { * Console.Write("Neck: "); * } * else if (pieceOfEquipment.Position == 2) * { * Console.Write("Shoulders: "); * } * else if (pieceOfEquipment.Position == 3) * { * Console.Write("Torso: "); * } * else if (pieceOfEquipment.Position == 4) * { * Console.Write("Arms: "); * } * else if (pieceOfEquipment.Position == 5) * { * Console.Write("Hands: "); * } * else if (pieceOfEquipment.Position == 6) * { * Console.Write("Legs: "); * } * else if (pieceOfEquipment.Position == 7) * { * Console.Write("Feet: "); * }*/ Console.WriteLine(pieceOfEquipment.ArmorName); } Console.WriteLine("Do you want to remove something? (y/n)"); string input = Console.ReadLine().ToLower(); if (input == "y") { EquipmentRemover(wornEquipment, runtime); } }
private void EquipmentRemover(Worn wornEquipment, Runtime runtime) { Console.WriteLine(); Console.WriteLine("Which equipment would you like to remove?"); Console.WriteLine("(Head, Neck, Shoulders, Torso, Arms, Hands, Legs, Feet)"); string input = Console.ReadLine().ToLower(); if (input == "head") { wornEquipment.ArmorName = "Empty"; } }
public void Start(Runtime runtime, PlayerControls playerControls) { var currentLocation = new Location(); var userInterface = new UI(); var map = new Map(); var wornEquipment = new Worn(); var equipmentHandler = new EquipmentHandler(); NewGameReset.ResetGame(currentLocation); userInterface.ShownUserInterface( map, runtime, userInterface, currentLocation, playerControls, myLists.Environment, wornEquipment, equipmentHandler ); }
public void ShownUserInterface(Map map, Runtime runtime, UI userInterface, Location currentLocation, PlayerControls playerControls, List <IEnvironment> environments, Worn wornEquipment, EquipmentHandler equipmentHandler) { bool gameLoop = true; while (gameLoop) { runtime.ExitUpdater(currentLocation, runtime, currentLocation.CurrentRoomNumber); runtime.UpdateList(currentLocation.CurrentRoomNumber); map.ShowMap(currentLocation, environments); Console.WriteLine("━━━"); Console.WriteLine(runtime.RoomDescription(map, currentLocation, currentLocation.CurrentRoomX, currentLocation.CurrentRoomY, currentLocation.CurrentRoomNumber, runtime, userInterface)); Console.WriteLine("{0} HP - {1} Stamina. TNL: {2} Exits: {3}", Player.Health, Player.Moves, (Player.MaxExperience - Player.Experience), runtime.Exits); Console.WriteLine("X: {0} Y: {1}", currentLocation.CurrentRoomX, currentLocation.CurrentRoomY); Console.WriteLine("━━━"); Console.Write("Command: "); runtime.Exits = ""; playerControls.UserInput(userInterface, runtime, currentLocation, environments, wornEquipment, currentLocation.CurrentRoomNumber, equipmentHandler); Console.Clear(); } }
public void UserInput(UI userInterface, Runtime runtime, Location currentLocation, List <IEnvironment> environments, Worn wornEquipment, int CurrentRoomNumber, EquipmentHandler equipmentHandler) { string input = Console.ReadLine().ToLower(); if (Player.Moves == 0 && input == "n" || Player.Moves == 0 && input == "s" || Player.Moves == 0 && input == "w" || Player.Moves == 0 && input == "e") { Console.WriteLine("You are too fatigued too move. Sleep or examine things to gain your moves back."); Console.WriteLine("Press <enter> and try again."); Console.ReadLine(); } else { if (input == "n" && currentLocation.PossibleExitNorth > 0) { currentLocation.CurrentRoomNumber = currentLocation.PossibleExitNorth; Player.Moves--; currentLocation.CurrentRoomX++; } else if (input == "s" && currentLocation.PossibleExitSouth > 0) { currentLocation.CurrentRoomNumber = currentLocation.PossibleExitSouth; Player.Moves--; currentLocation.CurrentRoomX--; } else if (input == "w" && currentLocation.PossibleExitWest > 0) { currentLocation.CurrentRoomNumber = currentLocation.PossibleExitWest; Player.Moves--; currentLocation.CurrentRoomY--; } else if (input == "e" && currentLocation.PossibleExitEast > 0) { currentLocation.CurrentRoomNumber = currentLocation.PossibleExitEast; Player.Moves--; currentLocation.CurrentRoomY++; } else if (input == "eq") { equipmentHandler.Inventory(wornEquipment, runtime); } else if (input == "listen" || input == "lis") { runtime.MobListener(currentLocation, runtime, userInterface); if (Player.Moves > Player.FullMoves) { Player.Moves++; } } else if (input == "examine" || input == "ex") { runtime.RoomExaminer(currentLocation, runtime, userInterface); if (Player.Moves < Player.FullMoves) { Player.Moves++; } } else if (input == "examine mob" || input == "ex mob") { runtime.PersonExaminer(currentLocation, runtime, userInterface); if (Player.Moves < Player.FullMoves) { Player.Moves++; } } else if (input == "quest accept" || input == "qa" || input == "q a") { QuestSystem.Questgetter(currentLocation, userInterface, runtime); } else if (input == "kill" || input == "k") { AttackHandler.Kill(currentLocation, runtime, userInterface, environments, CurrentRoomNumber); } else if (input == "cheat") { Player.Moves = 1000; Questor.QuestStarted = true; Questor.QuestHalfway = true; Console.WriteLine("Ok."); } else if (input == "whois") { Player.WhoisScreen(); } else if (input == "help") { Player.Help(); } else if (input == "noexp") { if (Player.noExperience == false) { Player.noExperience = true; Console.WriteLine("Done. You will not receive experience."); } else { Player.noExperience = false; Console.WriteLine("Done. You will now receive experience."); } Console.ReadLine(); } else if (input == "sleep" || input == "sl") { Console.WriteLine("You quickly fall asleep"); Console.WriteLine("Type wake to wake up."); bool asleep = true; while (asleep) { string asleepInput = Console.ReadLine(); if (asleepInput == "wake") { Console.WriteLine("You wake up fresh and rested!"); Console.WriteLine("Press <enter> to continue."); Player.Moves = Player.FullMoves; Player.Health = Player.FullHealth; Console.ReadLine(); asleep = false; } } } else if (input == "con" || input == "consider") { AttackHandler.Consider(currentLocation, runtime, userInterface, environments, CurrentRoomNumber); } else if (input == "n" || input == "s" || input == "w" || input == "e") { Console.WriteLine("You don't see an exit that way."); Console.WriteLine("Press <enter> and try again"); Console.ReadLine(); } else { Console.WriteLine("Not a recognizable command. Press <enter> and try again."); Console.ReadLine(); } } }
public CharacterArmor SaveCharacterArmor() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertUpdate_CharacterArmor"; command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterArmorID", SqlDbType.Int, CharacterArmorID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterID", SqlDbType.Int, CharacterID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ArmorID", SqlDbType.Int, ArmorID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@Worn", SqlDbType.Bit, Worn.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@Notes", SqlDbType.VarChar, Notes, 100)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message.ToString()); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }