public void Process(byte[] buffer, IConnection connection) { var msg = new ByteBuffer(buffer); string name = msg.ReadString(); int genderType = msg.ReadInt32(); int classIndex = msg.ReadInt32(); int spriteIndex = msg.ReadInt32(); int characterIndex = msg.ReadInt32(); if (name.Length > 0) { var creation = new CharacterCreation(name, characterIndex, classIndex, genderType, spriteIndex) { Player = Authentication.Players[connection.Index] }; creation.Create(); } }
static void Main(string[] args) { int score = 0; WindowsMediaPlayer daoIntro = new WindowsMediaPlayer(); daoIntro.URL = " C:\\Users\\Student\\Music\\LordSeeker.wav"; daoIntro.controls.play(); Console.Title = "o==(=====>A Dragon Age Inspired Dungeon Experience<=====)==o"; //Console.WriteLine("Welcome to Thedas"); string msg = "Welcome to Thedas"; Console.WriteLine("{0," + ((Console.WindowWidth / 2) + msg.Length / 2) + "}", msg); Player player = CharacterCreation.Create(); //TODO create a player //Player player = new Player("Ser", "Sam", Race.DalishElf, sword, 20, 20, 15, 70); //TODO create a loop for the room bool exit = false; do { //TODO Write a () for showing a room description //TODO Add linebreaks Console.WriteLine(GetRoom()); //Program.party_member.cur; //TODO Show a monster in the room Dragon d1 = new Dragon(); Dragon d2 = new Dragon("Momma Dragon", 25, 25, 60, 20, 2, 8, "A very large mother dragon. She is not pleased", true); Dragon d3 = new Dragon(false); DarkSpawn ds1 = new DarkSpawn(1); DarkSpawn ds2 = new DarkSpawn(); DarkSpawn ds3 = new DarkSpawn("Ogre", 24, 8, 24, 50, 30, 2, "An ogre. Towering over double, maybe triple your height." + " Blood drips from its weapons.", 2); List <Monster> monsters = new List <Monster>(); monsters.Add(d1); monsters.Add(d1); monsters.Add(d1); monsters.Add(d1); monsters.Add(d1); monsters.Add(d2); monsters.Add(d3); monsters.Add(d3); monsters.Add(d3); monsters.Add(ds1); monsters.Add(ds1); monsters.Add(ds1); monsters.Add(ds1); monsters.Add(ds2); monsters.Add(ds2); monsters.Add(ds3); Loot[] loot = { Loot.BlockPotion, Loot.EquippedWeaponPlus, Loot.HealthPotion, Loot.HitChancePotion, Loot.LifePotion, Loot.HealthPotion, Loot.HealthPotion, Loot.HealthPotion, Loot.BlockPotion, Loot.Nothing, Loot.Nothing, Loot.Nothing, Loot.Nothing }; //loot[] Random rand3 = new Random(); int indexNbr = rand3.Next(loot.Length); Monster monster = monsters[rand3.Next(monsters.Capacity)]; Console.WriteLine("\nIn this room: " + monster.Name); //Loot item = loot[indexNbr]; //string l = ""; //List<Loot> playerLoot = new List<Loot>(); //List<string> showLoot = new List<string>(); List <string> drop = new List <string> { "Block Potion", "Equipped Weapon Plus", "Health Potion", "Nothing", };//list loot //TODO Create a loop for the menu bool reload = false; List <string> showLoot = new List <string>(); do { //TODO Menu Console.Write("\nChoose an ACTION:\n" + "A) Attack\n" + "R) RUN\n" + "C) Character Info\n" + "M) Monster Info\n" + "I) Inventory\n" + "X) Exit\n" + "Enter your choice: "); //TODO catch user's choice string userChoice = Console.ReadLine().ToUpper(); Console.Clear(); switch (userChoice) { case "A": //TODO Handle if Player wins Combat.DoBattle(player, monster); if (monster.Life <= 0) { Random rand = new Random(); int iNbr = rand.Next(4); string item = drop[iNbr]; Console.WriteLine("\nYou defeated {0}!\n", monster.Name); score += 1; switch (item) { case "Block Potion": Console.WriteLine("You got a block potion!"); player.Inventory.Add("Block Potion"); break; case "Equipped Weapon Plus": Console.WriteLine("You got Equipped Weapon Plus!"); player.Inventory.Add("Better Weapon"); break; case "Health Potion": Console.WriteLine("You got a health potion!"); player.Inventory.Add("Health Potion"); break; case "Nothing": Console.WriteLine("Bad luck! You didn't get anything!"); break; } //switch //this is where you would add loot and experience reload = true; } //if monster is dead break; case "R": Console.WriteLine("RUN AWAY!"); Combat.DoAttack(monster, player); reload = true; break; case "C": Console.WriteLine("Character INFO"); Console.WriteLine(player); Console.WriteLine("Monsters Defeated: " + score); break; case "M": Console.WriteLine("Monster Info"); Console.WriteLine(monster); break; case "I": Console.WriteLine("Inventory"); foreach (string i in player.Inventory) { Console.WriteLine(i + "/n"); } //foreach break; case "X": Console.WriteLine("Really? Okay. Bye."); Console.WriteLine("Monsters Defeated: " + score); exit = true; break; default: Console.WriteLine("Invalid choice. Try again."); break; }//switch on userChoice //TODO Handle if player dies if (player.Life <= 0) { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("YOU DIED"); Console.ResetColor(); Console.WriteLine("Monsters Defeated: " + score); exit = true; }//if } while (!reload && !exit); } while (!exit); }//main