Shadowmacx

Bongo Cat auto claim chest

Oct 14th, 2025 (edited)
1,157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using BongoCat.Multiplayer;
  5. using Steamworks;
  6. using TMPro;
  7. using UnityEngine;
  8. using Vfx;
  9.  
  10. namespace BongoCat
  11. {
  12. // Token: 0x020000E9 RID: 233
  13. public partial class Shop : MonoBehaviour
  14. {
  15. // Token: 0x060004B4 RID: 1204 RVA: 0x00011DDD File Offset: 0x0000FFDD
  16. private IEnumerator TimerUpdate()
  17. {
  18. for (;;)
  19. {
  20. if (this._outOfStockObj.activeSelf)
  21. {
  22. this.StockRefreshTimeLeft--;
  23. PlayerPrefs.SetInt(this._shopTimeKey, this.StockRefreshTimeLeft);
  24. this._stockRefreshText.text = string.Format("{0:mm':'ss}", TimeSpan.FromSeconds((double)this.StockRefreshTimeLeft));
  25.  
  26. SteamItemDetails_t normalChest = this._catInventory.ChestToken;
  27. SteamItemDetails_t emoteChest = this._catInventory.EmoteChestToken;
  28.  
  29. if (this.StockRefreshTimeLeft <= 0)
  30. {
  31. if (normalChest.m_unQuantity == 0 && emoteChest.m_unQuantity == 0)
  32. {
  33. // Reset to full refresh time when truly out of stock
  34. this.StockRefreshTimeLeft = this._stockRefreshTime;
  35. }
  36. else
  37. {
  38. // Auto-loot both chests if available
  39. yield return StartCoroutine(AutoLootBothChests(normalChest, emoteChest));
  40. }
  41. }
  42. }
  43. else if (this.StockRefreshTimeLeft <= 0 && !this._shopVisuals.activeInHierarchy && this._showChestPopup.Value && this._shopItem.CanBuy())
  44. {
  45. this._shopVisuals.SetActive(true);
  46. }
  47. yield return new WaitForSecondsRealtime(1f);
  48. }
  49. yield break;
  50. }
  51.  
  52. private IEnumerator AutoLootBothChests(SteamItemDetails_t normalChest, SteamItemDetails_t emoteChest)
  53. {
  54. bool origState = this._isEmoteShop;
  55. this._isEmoteShop = true;
  56. if (emoteChest.m_unQuantity > 0 && this._shopItem.CanBuy())
  57. {
  58. this._shopItem.Buy();
  59. yield return new WaitForSecondsRealtime(0.5f); // Short delay for loading
  60. }
  61. this._isEmoteShop = false;
  62. if (normalChest.m_unQuantity > 0 && this._shopItem.CanBuy())
  63. {
  64. this._shopItem.Buy();
  65. yield return new WaitForSecondsRealtime(0.5f);
  66. }
  67. this._isEmoteShop = origState;
  68. this.ChestIsReady = false;
  69. this._steamMultiplayer.SendChestReady(this.ChestIsReady); // Notify multiplayer
  70. this._shopItem.gameObject.SetActive(false);
  71. this._outOfStockObj.SetActive(true);
  72. this.StockRefreshTimeLeft = this._stockRefreshTime;
  73. PlayerPrefs.SetInt(this._shopTimeKey, this.StockRefreshTimeLeft);
  74. this._stockRefreshText.text = string.Format("{0:mm':'ss}", TimeSpan.FromSeconds((double)this.StockRefreshTimeLeft));
  75. yield break;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment