Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using BongoCat.Multiplayer;
- using Steamworks;
- using TMPro;
- using UnityEngine;
- using Vfx;
- namespace BongoCat
- {
- // Token: 0x020000E9 RID: 233
- public partial class Shop : MonoBehaviour
- {
- // Token: 0x060004B4 RID: 1204 RVA: 0x00011DDD File Offset: 0x0000FFDD
- private IEnumerator TimerUpdate()
- {
- for (;;)
- {
- if (this._outOfStockObj.activeSelf)
- {
- this.StockRefreshTimeLeft--;
- PlayerPrefs.SetInt(this._shopTimeKey, this.StockRefreshTimeLeft);
- this._stockRefreshText.text = string.Format("{0:mm':'ss}", TimeSpan.FromSeconds((double)this.StockRefreshTimeLeft));
- SteamItemDetails_t normalChest = this._catInventory.ChestToken;
- SteamItemDetails_t emoteChest = this._catInventory.EmoteChestToken;
- if (this.StockRefreshTimeLeft <= 0)
- {
- if (normalChest.m_unQuantity == 0 && emoteChest.m_unQuantity == 0)
- {
- // Reset to full refresh time when truly out of stock
- this.StockRefreshTimeLeft = this._stockRefreshTime;
- }
- else
- {
- // Auto-loot both chests if available
- yield return StartCoroutine(AutoLootBothChests(normalChest, emoteChest));
- }
- }
- }
- else if (this.StockRefreshTimeLeft <= 0 && !this._shopVisuals.activeInHierarchy && this._showChestPopup.Value && this._shopItem.CanBuy())
- {
- this._shopVisuals.SetActive(true);
- }
- yield return new WaitForSecondsRealtime(1f);
- }
- yield break;
- }
- private IEnumerator AutoLootBothChests(SteamItemDetails_t normalChest, SteamItemDetails_t emoteChest)
- {
- bool origState = this._isEmoteShop;
- this._isEmoteShop = true;
- if (emoteChest.m_unQuantity > 0 && this._shopItem.CanBuy())
- {
- this._shopItem.Buy();
- yield return new WaitForSecondsRealtime(0.5f); // Short delay for loading
- }
- this._isEmoteShop = false;
- if (normalChest.m_unQuantity > 0 && this._shopItem.CanBuy())
- {
- this._shopItem.Buy();
- yield return new WaitForSecondsRealtime(0.5f);
- }
- this._isEmoteShop = origState;
- this.ChestIsReady = false;
- this._steamMultiplayer.SendChestReady(this.ChestIsReady); // Notify multiplayer
- this._shopItem.gameObject.SetActive(false);
- this._outOfStockObj.SetActive(true);
- this.StockRefreshTimeLeft = this._stockRefreshTime;
- PlayerPrefs.SetInt(this._shopTimeKey, this.StockRefreshTimeLeft);
- this._stockRefreshText.text = string.Format("{0:mm':'ss}", TimeSpan.FromSeconds((double)this.StockRefreshTimeLeft));
- yield break;
- }
Advertisement
Add Comment
Please, Sign In to add comment