Example #1
0
        public void Update()
        {
            _lootBoxTimeOut.Update();
            if (_bot.Game is null || _lootBoxTimeOut.IsActive)
            {
                return;
            }

            if (IsEnabled && _bot.Game.IsLoggedIn && _bot.Game.IsMapLoaded)
            {
                if (_lootBoxHandler is null)
                {
                    _lootBoxHandler = _bot.Game.RecievedLootBoxes;
                }

                if (!_sentOpenLootBoxReq && _lootBoxHandler.Lootboxes.Count > 0)
                {
                    var loot = _lootBoxHandler.Lootboxes[0];
                    _lootBoxHandler.Lootboxes.RemoveAt(0);
                    if (loot.Remaining > 0 && !_bot.Game.IsInBattle)
                    {
                        _bot.Game.OpenLootBox(Poke1Protocol.ConvertLootBoxType.FromResponseType(loot.Type));
                        _sentOpenLootBoxReq = true;
                        _lootBoxTimeOut.Set(_lootBoxHandler.Lootboxes.Count > 0 ? _bot.Rand.Next(2000, 3000) :  _bot.Rand.Next(1500, 2000));
                    }
                }
            }
        }
Example #2
0
 private void Bot_ClientChanged()
 {
     if (_bot.Game != null)
     {
         _lootBoxHandler             = _bot.Game.RecievedLootBoxes;
         _bot.Game.ConnectionClosed += Client_ConnectionClosed;
         _bot.Game.ConnectionFailed += Client_ConnectionClosed;
         _bot.Game.LootBoxOpened    += Game_LootBoxOpened;
         _bot.Game.RecievedLootBox  += Game_RecievedLootBox;
     }
 }
Example #3
0
 private void Client_ConnectionClosed(Exception ex)
 {
     _lootBoxHandler = null;
 }
Example #4
0
 private void Game_LootBoxOpened(PSXAPI.Response.Payload.LootboxRoll[] arg1, PSXAPI.Response.LootboxType arg2)
 {
     _lootBoxHandler     = null;
     _sentOpenLootBoxReq = false;
     _lootBoxTimeOut.Set();
 }
Example #5
0
 private void Game_RecievedLootBox(Poke1Protocol.LootboxHandler obj)
 {
     _sentOpenLootBoxReq = false;
 }