Ejemplo n.º 1
0
        private Inventory[] GetIteams(ref List <Person> people)
        {
            ModelInventory modelInventory = new ModelInventory();

            Inventory[] items = new Inventory[0];
            if (!people.Any())
            {
                return(null);
            }
            foreach (Person person in people)
            {
                List <Inventory> inventory = modelInventory.GetPersonInventory(person.id);
                if (inventory != null)
                {
                    var rnd     = new Random();
                    int randind = rnd.Next(0, 100);
                    if (randind <= 10)
                    {
                        var       rand      = new Random();
                        int       randIteam = rand.Next(0, inventory.Count());
                        Inventory item      = inventory[randIteam];
                        item.count -= 1;
                        if (item.count == 0)
                        {
                            _modelIteam.DeleteIteamFromInventory(person.id, item.id);
                        }
                        else
                        {
                            _modelIteam.UpdatePersonInventory(item);
                        }
                        Array.Resize(ref items, items.Length + 1);
                        items[items.Length - 1] = item;
                    }
                }
            }
            return(items);
        }
Ejemplo n.º 2
0
 public ModelWar()
 {
     _modelPerson = new ModelPerson();
     modelGuild   = new ModelGuild();
     _modelIteam  = new ModelInventory();
 }
Ejemplo n.º 3
0
 public ModelPerson()
 {
     modelInventory = new ModelInventory();
     crudPerson     = new CRUDPerson();
     modelItem      = new ModelItem();
 }