public bool RandomShop(int stage, int roomid, RoomGenerateBase.RoomType roomtype) { if (roomtype != RoomGenerateBase.RoomType.eBoss) { Shop_MysticShopShow beanById = LocalModelManager.Instance.Shop_MysticShopShow.GetBeanById(stage); if (beanById == null) { object[] args = new object[] { stage }; SdkManager.Bugly_Report("Shop_MysticShopModel_Extra", Utils.FormatString("RandomShop stage:[{0}] is not in Shop_MysticShopShow.xls", args)); return(false); } if (beanById.ShowRoom.Length != 2) { object[] args = new object[] { stage, beanById.ShowRoom.Length }; SdkManager.Bugly_Report("Shop_MysticShopModel_Extra", Utils.FormatString("RandomShop stage:[{0}].ShowRoom.Length[{1}] != 2", args)); return(false); } if (((roomid == 0) || (roomid > beanById.ShowRoom[1])) || (roomid < beanById.ShowRoom[0])) { return(false); } if (this.mMysticShopData.stage != stage) { this.mMysticShopData.Reset(stage, beanById.ShowProb); } int rate = this.mMysticShopData.rate; if (GameLogic.Random(0, 0x2710) < rate) { this.mMysticShopData.ResetRate(beanById.ShowProb); return(true); } this.mMysticShopData.AddRate(beanById.AddProb); } return(false); }
public void Init() { this.init_show_prop_weight(); this.mMysticShopData = LocalSave.Instance.mSaveData.mMysticShopData; IList <Shop_MysticShop> allBeans = base.GetAllBeans(); int num = 0; int count = allBeans.Count; while (num < count) { Shop_MysticShop shop = allBeans[num]; int index = 0; int length = shop.Stage.Length; while (index < length) { if (!this.mEquipList.TryGetValue(shop.Stage[index], out ShopData data)) { data = new ShopData { stageid = shop.Stage[index] }; this.mEquipList.Add(shop.Stage[index], data); } data.Add(shop); index++; } num++; } IList <Shop_MysticShopShow> list2 = LocalModelManager.Instance.Shop_MysticShopShow.GetAllBeans(); int num5 = 0; int num6 = list2.Count; while (num5 < num6) { Shop_MysticShopShow show = list2[num5]; WeightRandom random = new WeightRandom(); int index = 0; int length = show.ShopTypeProb.Length; while (index < length) { random.Add(index + 1, show.ShopTypeProb[index]); index++; } this.mCountList.Add(show.ID, random); num5++; } }
public void AddRatio(int stage) { Shop_MysticShopShow beanById = LocalModelManager.Instance.Shop_MysticShopShow.GetBeanById(stage); this.mMysticShopData.AddRate(beanById.AddProb); }