//public long GetOffset(int gachaItemId) //{ // var item = Static.GachaItems[gachaItemId]; // int count = 0; // switch (item.RollsQuantity) // { // case TimeQuantityType.Hour: // count = 60 * 60; // break; // case TimeQuantityType.Hour6: // count = 6 * 60 * 60; // break; // case TimeQuantityType.Hour12: // count = 6 * 60 * 60; // break; // case TimeQuantityType.Day: // count = 24 * 60 * 60; // break; // case TimeQuantityType.Weak: // count = 7 * 24 * 60 * 60; // break; // } // return Static.GachaItems[gachaItemId].RollsPeriod * count; //} public (IGacha, IUniversalPrice, int) GetGacha(int gachaId, GachaCountType count, ConditionController condition) { var gachaItem = Static.GachaItems[gachaId]; IReadOnlyDictionary <int, IUniversalPrice> prices = null; int countDrop = 0; switch (count) { case GachaCountType.One: prices = gachaItem.Prices1; countDrop = 1; break; case GachaCountType.Ten: prices = gachaItem.Prices10; countDrop = 10; break; default: throw new ArgumentOutOfRangeException(nameof(count), count, null); } IUniversalPrice price = null; foreach (var ordered in prices.Keys.OrderBy(x => x)) { if (condition.Check(prices[ordered].Condition)) { price = prices[ordered]; break; } } return(gachaItem, price, countDrop); }
public void Drop(Int32 gachaId, GachaCountType count) { PreCommand(); try { _modules.GachaModule.Drop(gachaId, count); } catch (Exception e) { Logger.ErrorEmulate(e); return; } PostCommand(); }
public void Drop(Int32 gachaId, GachaCountType count) { PreCommand(); try { _modules.GachaModule.Drop(gachaId, count); } catch (Exception e) { Logger.Exception(e, "Drop", new object[] { (object)gachaId, (object)(int)count }); return; } PostCommand("Drop", new object[] { (object)gachaId, (object)(int)count }); }
public void Drop(int gachaId, GachaCountType count) { var(gachaItem, prices, countDrop) = _resources.GetGacha(gachaId, count, _condition); for (var i = 0; i < countDrop; i++) { _impactLogic.ExecuteImpact(gachaItem.Impact); } var gachaPrice = prices.Prices ?? new Dictionary <int, IPrice>(); foreach (var price in gachaPrice.Values) { _scorers.Spend(price, _formuls); } _impactLogic.ExecuteImpact(prices.Impact); LogicLog.Gacha(gachaId, countDrop); UpdateDropItems(); }