public override void run()
 {
     try
     {
         Account player = this._client._player;
         if (player == null)
         {
             return;
         }
         PlayerEvent playerEvent = player._event;
         GoodItem    good        = ShopManager.getGood(this.goodId);
         if (good == null || playerEvent == null)
         {
             return;
         }
         PlayTimeModel runningEvent = EventPlayTimeSyncer.getRunningEvent();
         if (runningEvent == null)
         {
             return;
         }
         uint rewardCount = (uint)runningEvent.GetRewardCount(this.goodId);
         if (playerEvent.LastPlaytimeFinish != 1 || rewardCount <= 0U || !ComDiv.updateDB("player_events", "last_playtime_finish", (object)2, "player_id", (object)this._client.player_id))
         {
             return;
         }
         playerEvent.LastPlaytimeFinish = 2;
         this._client.SendPacket((SendPacket) new INVENTORY_ITEM_CREATE_PAK(1, player, new ItemsModel(good._item._id, good._item._category, "Playtime reward", good._item._equip, rewardCount, 0L)));
     }
     catch (Exception ex)
     {
         Logger.info("EVENT_PLAYTIME_REWARD_REC] " + ex.ToString());
     }
 }
Example #2
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || player.events == null || player.checkEventPlayTimeReward)
         {
             return;
         }
         GoodItem good = ShopManager.GetGood(goodId);
         if (good == null)
         {
             return;
         }
         PlayTimeModel eventPlayTime = EventPlayTimeSyncer.GetRunningEvent();
         if (eventPlayTime != null)
         {
             int count = eventPlayTime.GetRewardCount(goodId);
             if (player.events.LastPlaytimeFinish == 1 && count > 0 && player.UpdatePlayTimeReward())
             {
                 player.events.LastPlaytimeFinish = 2;
                 client.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, new ItemsModel(good.item.id, good.item.category, "Playtime reward", good.item.equip, count)));
             }
             player.checkEventPlayTimeReward = true;
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }