private Ientity[] CalculateLoots(levels level, int[] catIDs) { List <Ientity> loots = new List <Ientity>(); List <loots> possibleLoots = new List <loots>(level.loots); foreach (int ID in catIDs) { Ientity bestLoot = null; catData cat = CLD.GetCatData(ID); foreach (loots lootData in possibleLoots) { ILootable lootCand; if (lootData.type == "cat") { lootCand = CLD.GetCatData(lootData.id); } else { lootCand = CLD.GetItemData(lootData.id); } int dice = (int)(Random.Range(0, 100) - (lootCand.rarity - cat.rarity) * CLD.GetPossibleBonus()); if (dice <= lootData.pos) { bestLoot = lootCand; } } if (bestLoot != null) { loots.Add(bestLoot); } } return(loots.ToArray()); }
public catData GetCatData(int id) { catData tmp = new catData(); try{ tmp.id = id; tmp.name = entityCollection.cats[id].name; tmp.level = entityCollection.cats[id].level; tmp.price = entityCollection.cats[id].price; tmp.description = entityCollection.cats[id].description; }catch (Exception e) { tmp.id = id; tmp.name = "ERRORCAT"; tmp.level = -1; tmp.price = -1; tmp.description = "U DON FKED UP:\n" + e.Message; } return(tmp); }