public void SpawnWeapons(Agent.Creature creature, Agent.Weapon weapon, OperacjeMapy.Pole[,] map)
 {
     for (int i = 0; i < map[creature.currentpossition.X, creature.currentpossition.Y].Creature.Count; i++)
     {
         if (map[creature.currentpossition.X, creature.currentpossition.Y].Creature[i] == creature)
         {
             map[creature.currentpossition.X, creature.currentpossition.Y].Creature[i].inventory.Add(weapon);
         }
     }
     Console.WriteLine("Spawning {0} to {1}s inventory.", weapon.name, creature.name);
 }
        public void MakeWeapons()
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load("Weapons.xml");
            XmlNodeList elemList = xmlDoc.GetElementsByTagName("weapon");

            Console.WriteLine("Number of weapons: {0}", elemList.Count);
            for (int i = 0; i < elemList.Count; i++)
            {
                var weapon = new Agent.Weapon();
                Console.WriteLine("Adding Weapon no. {0}", i);
                weapon.type = elemList[i].Attributes["type"].Value[0];
                Console.WriteLine("Weapon type: {0}", weapon.type);
                weapon.name         = elemList[i].Attributes["name"].Value;
                weapon.weight       = int.Parse(elemList[i].Attributes["weight"].Value);
                weapon.minDamage    = int.Parse(elemList[i].Attributes["minDamage"].Value);
                weapon.maxDamage    = int.Parse(elemList[i].Attributes["maxDamage"].Value);
                weapon.weaponLength = byte.Parse(elemList[i].Attributes["weaponLength"].Value);
                string special, dmgtype;
                special = elemList[i].Attributes["special"].Value;
                dmgtype = elemList[i].Attributes["damageType"].Value;
                char[]   separator = new char[] { ',' };
                string[] splitString;
                splitString = special.Split(separator);
                foreach (String attr in splitString)
                {
                    var specialAttr = new Agent.specialWeaponQualities();
                    if (attr == "woodchopping")
                    {
                        specialAttr = Agent.specialWeaponQualities.woodchopping;
                        weapon.special.Add(specialAttr);
                    }
                }
                splitString = dmgtype.Split(separator);
                foreach (String attr in splitString)
                {
                    var specialAttr = new Agent.kindOfDamage();
                    if (attr == "slashing")
                    {
                        specialAttr = Agent.kindOfDamage.slashing;
                        weapon.damageType.Add(specialAttr);
                    }
                    if (attr == "blunt")
                    {
                        specialAttr = Agent.kindOfDamage.blunt;
                        weapon.damageType.Add(specialAttr);
                    }
                }

                weaponsList.Add(weapon);
            }
        }
        public void DrawCommandMenu(List <Agent.Weapon> wpnList, List <Agent.Creature> crtList, OperacjeMapy.Pole[,] mapa, List <Agent.Resource> resourcesList)
        {
            Point coords;
            bool  coordsIsOK = true;

            while (input != "1")
            {
                Console.WriteLine("\n");
                Console.WriteLine("1. Exit command menu.");
                Console.WriteLine("2. Spawn an item.");
                Console.WriteLine("3. Spawn a creature.");
                Console.WriteLine("4. Spawn a mapEntity.");
                input = Console.ReadLine();
                switch (input)
                {
                case "1":
                {
                    break;
                }

                case "2":
                {
                    var    spawner = new ItemSpawner();
                    string whichItem;
                    Console.WriteLine("Which kind of item would you like to spawn?\n 1.Weapon\n 2.null");
                    whichItem = Console.ReadLine();
                    switch (whichItem)
                    {
                    case "1":
                    {
                        Console.WriteLine("Which weapon would you like to spawn (type in ID number for answer):");
                        int i = 0;
                        foreach (Agent.Weapon wpn in wpnList)
                        {
                            Console.WriteLine("ID: {4}\t{0}\tMinDamage: {1}\tMaxDamage: {2}\tWeaponLength: {3}\n", wpn.name, wpn.minDamage, wpn.maxDamage, wpn.weaponLength, i);
                            i++;
                        }
                        int wpnID        = Convert.ToInt16(Console.ReadLine());
                        var answerWeapon = new Agent.Weapon();
                        answerWeapon = wpnList[wpnID];

                        Console.WriteLine("Would you like to spawn the weapon to a creatures inventory(1) or on the map(2)?");
                        string answer = Console.ReadLine();

                        switch (answer)
                        {
                        case "1":
                        {
                            break;
                        }

                        case "2":
                        {
                            //do{
                            Console.WriteLine("Where would you like to spawn the weapon (coord x and y):");
                            int x, y;
                            x      = Convert.ToInt16(Console.ReadLine());
                            y      = Convert.ToInt16(Console.ReadLine());
                            coords = new Point(y--, x--);

                            spawner.SpawnWeapons(coords, answerWeapon, mapa);
                            //}while(coordsIsOK);
                            break;
                        }

                        default:
                        {
                            break;
                        }
                        }

                        break;
                    }

                    case "2":
                    {
                        break;
                    }
                    }
                    break;
                }

                case "3":
                {
                    var spawner = new CreatureSpawner();
                    Console.WriteLine("Which creature would you like to spawn (type in ID number for answer):");
                    int i = 0;
                    foreach (Agent.Creature crt in crtList)
                    {
                        Console.WriteLine("ID: {1}\t{0}\n", crt.name, i);
                        i++;
                    }
                    int crtID          = Convert.ToInt16(Console.ReadLine());
                    var answerCreature = new Agent.Creature();
                    answerCreature = crtList[crtID];
                    //do{
                    Console.WriteLine("Where would you like to spawn the creature (coord x and y):");
                    int x, y;
                    x      = Convert.ToInt16(Console.ReadLine());
                    y      = Convert.ToInt16(Console.ReadLine());
                    coords = new Point(y--, x--);

                    spawner.SpawnCreature(coords, answerCreature, mapa);
                    //}while(coordsIsOK);
                    break;
                }

                default:
                {
                    break;
                }
                }
                break;
            }
        }
 // Spawn weapon into coordinates x,y;
 public void SpawnWeapons(Point coords, Agent.Weapon weapon, OperacjeMapy.Pole[,] map)
 {
     map[coords.X, coords.Y].Items.Add(weapon);
     Console.WriteLine("Spawning {0} to X{1},Y{2}.", weapon.name, coords.X, coords.Y);
 }