예제 #1
0
 public Encounter(int enPCs, int enPCLvls, int[] enDifficulty, int enChanceForSame, bool enSingleType, bool enSingleSubType, List <string> enRestrictedTypes, Compendium enCompendium)
 {
     compendium       = enCompendium;
     DifficultyValues = enDifficulty;
     PCs               = enPCs;
     PCLvls            = enPCLvls;
     ChanceForSame     = enChanceForSame;
     SingleType        = enSingleType;
     SingleSubType     = enSingleSubType;
     ExpValues         = compendium.ExpValues;
     BaseExp           = DetermineBaseExp();
     RestrictedTypes   = enRestrictedTypes;
     AvailableMonsters = compendium.getSortedMonster(RestrictedTypes);
     ChosenMonsters    = PickMonsters();
     GoldAmt           = DetermineGold();
     if (GoldAmt > compendium.CommonItemValueMin)
     {
         ChosenItems = FindPotentialItems(GoldAmt);
     }
     else
     {
         ChosenItems = new List <Item>();
     }
     AdjExpMult = DetermineAdjustedExp();
 }
예제 #2
0
        private void generateCompendium()
        {
            string monsterData;
            string itemData;

            List <MonsterData> monsterDataList = new List <MonsterData>();
            List <ItemData>    itemDataList    = new List <ItemData>();

            Monster mstr;
            Item    itm;

            List <Monster> monsterList = new List <Monster>();
            List <Item>    itemList    = new List <Item>();


            client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
            monsterData     = FetchData(baseURL + monsterUrl, 7);
            itemData        = FetchData(baseURL + itemsUrl, 5);
            monsterDataList = new JavaScriptSerializer().Deserialize <List <MonsterData> >(monsterData);
            //System.Diagnostics.Debug.WriteLine("monsterList: " + monsterDataList.Count + " items");
            //System.Diagnostics.Debug.WriteLine("Example" + monsterDataList[rand.Next(monsterDataList.Count)].ToString());
            itemDataList = new JavaScriptSerializer().Deserialize <List <ItemData> >(itemData);
            //System.Diagnostics.Debug.WriteLine("itemList: " + itemDataList.Count + "items");
            //System.Diagnostics.Debug.WriteLine("Example" + itemDataList[rand.Next(itemDataList.Count)].ToString());

            for (int i = 0; i < monsterDataList.Count; i++)
            {
                mstr = new Monster(monsterDataList[i]);
                monsterList.Add(mstr);
            }
            for (int i = 0; i < itemDataList.Count; i++)
            {
                itm = new Item(itemDataList[i]);
                itemList.Add(itm);
            }
            compendium = new Compendium(monsterList, itemList);
        }