private void OnPurchaseMissingSoftCurrency(object result, object cookie) { if (GameUtils.HandleSoftCurrencyFlow(result, cookie)) { ShardShopPurchaseCookie shardShopPurchaseCookie = null; if (cookie is CurrencyTag) { CurrencyTag currencyTag = (CurrencyTag)cookie; shardShopPurchaseCookie = (ShardShopPurchaseCookie)currencyTag.Cookie; } else if (cookie is MultiCurrencyTag) { MultiCurrencyTag multiCurrencyTag = (MultiCurrencyTag)cookie; shardShopPurchaseCookie = (ShardShopPurchaseCookie)multiCurrencyTag.Cookie; } if (shardShopPurchaseCookie != null) { shardShopPurchaseCookie.DeferredSuccessCallback(shardShopPurchaseCookie.Quantity, true); CostVO cost = shardShopPurchaseCookie.Cost; this.PurchasePoolIdShard(shardShopPurchaseCookie.SlotIndex, shardShopPurchaseCookie.Quantity, shardShopPurchaseCookie.ServerCallback, shardShopPurchaseCookie.Cookie, cost); } else { Service.Logger.Error("Shard Shop Missing soft currency purchase has null purchase cookie"); } } }
public static bool ShowIfNotEnoughCurrency(int credits, int materials, int contraband, string purchaseContext, OnScreenModalResult onModalResult) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); CurrencyType currencyType = GameUtils.GetCurrencyType(credits, materials, contraband); int num = 0; switch (currencyType) { case CurrencyType.Credits: num = credits - currentPlayer.CurrentCreditsAmount; break; case CurrencyType.Materials: num = materials - currentPlayer.CurrentMaterialsAmount; break; case CurrencyType.Contraband: num = contraband - currentPlayer.CurrentContrabandAmount; break; } if (num > 0) { if (GameUtils.HasEnoughCurrencyStorage(currencyType, num)) { Lang lang = Service.Get <Lang>(); string currencyStringId = LangUtils.GetCurrencyStringId(currencyType); string text = lang.Get(currencyStringId, new object[0]); string title = lang.Get("NEED_MORE", new object[] { text }); string message = lang.Get("NEED_MORE_BUY_MISSING", new object[] { lang.ThousandsSeparated(num), text }); int num2 = 0; switch (currencyType) { case CurrencyType.Credits: num2 = GameUtils.CreditsCrystalCost(num); break; case CurrencyType.Materials: num2 = GameUtils.MaterialsCrystalCost(num); break; case CurrencyType.Contraband: num2 = GameUtils.ContrabandCrystalCost(num); break; } string currencyItemAssetName = UXUtils.GetCurrencyItemAssetName(currencyType.ToString()); CurrencyTag modalResultCookie = new CurrencyTag(currencyType, num, num2, purchaseContext); PayMeScreen.ShowModal(num2, false, title, message, currencyItemAssetName, onModalResult, modalResultCookie); } else { onModalResult(null, null); } return(true); } return(false); }
string GetCmdText(int Step) //fold00 { AccCode = AccCode.Trim(); ClientCode = ClientCode.Trim(); CurrencyTag = CurrencyTag.Trim().ToUpper(); string Result = " exec dbo.Mega_Extract"; switch (Step) { case 1: { Result += ";1 " + " @DateFrom=" + DateFrom.ToString() + " , @DateInto=" + DateInto.ToString() + " , @OverMode=" + (OverMode & 3).ToString() + " , @OverDate=" + DateInto.ToString() + " , @FlgTag=" + ((CurrencyTag == "") ? "0" : "1") + " , @CbMode=" + ((CbMode) ? "2" : "1") + " , @UserId=" + UserId.ToString() + " , @ClientCode='" + ClientCode + "'" + " , @BranchId=" + BranchId.ToString() + " , @GroupId=" + GroupId.ToString() + " , @AmountCode='" + __.GetCodeByMoniker(AccCode) + "%'" + " , @CurrencyTag='" + ((CurrencyTag == "UAH") ? "" : CurrencyTag) + "'" + " , @AllAmounts=" + ((AllAmounts) ? "1" : "0") + " , @AmountMode= 0 , @IsExpected=0 " ; break; } case 2: { Result += ";4 " + " @DateFrom=" + DateFrom.ToString() + " , @DateInto=" + DateInto.ToString() + " , @OverMode=" + (OverMode & 3).ToString() + " , @OverDate=" + DateInto.ToString() + " , @AmountId=" + Accounts_ExtId.ToString() + " , @ShowSubRate=1 , @Mode=1 , @Depth=1 " ; break; } case 3: { int Date = Amounts_LastDate; if (__.Month(Date) < __.Month(DateFrom)) { Date = __.GetDate(__.Year(DateFrom) + "/" + __.Month(DateFrom).ToString("00") + "/01") - 1; } Result += ";5 " + " @DateFrom=" + (Date + 1).ToString() + " , @DateInto=" + Amounts_DateInto.ToString() + " , @AmountId=" + Accounts_RootId.ToString() + " , @SortMode=" + (SortMode & 7).ToString() + " , @IsRight=0 , @IsExpected=0 " ; break; } case 4: { Result += (((DateFrom == DateInto) && (DateFrom == TODAY)) ? ";6 " : ";5 ") + " @DateFrom=" + DateFrom.ToString() + " , @DateInto=" + DateInto.ToString() + " , @AmountId=" + Accounts_ExtId.ToString() + " , @SortMode=" + (SortMode & 7).ToString() + " , @IsRight=0 , @IsExpected=0 " ; break; } } return(Result); } //FOLD00
public static Currency ToCurrency(this CurrencyTag currencyTag) { return(AssetTag.Currencies.ToAsset().GetItem <Currency>(currencyTag)); }