Example #1
0
        public override void run()
        {
            try
            {
                Account    player     = this._client._player;
                ItemsModel itemsModel = player == null ? (ItemsModel)null : player._inventory.getItem(this.objId);
                if (itemsModel != null && itemsModel._id > 1300000000)
                {
                    int  itemId    = ComDiv.createItemId(12, ComDiv.getIdStatics(itemsModel._id, 2), ComDiv.getIdStatics(itemsModel._id, 3), 0);
                    uint cuponDays = uint.Parse(DateTime.Now.AddDays((double)ComDiv.getIdStatics(itemsModel._id, 4)).ToString("yyMMddHHmm"));
                    switch (itemId)
                    {
                    case 1200005000:
                    case 1201052000:
                        this.objetivo = BitConverter.ToUInt32(this.info, 0);
                        break;

                    case 1200010000:
                    case 1201047000:
                    case 1201051000:
                        this.txt = ComDiv.arrayToString(this.info, this.info.Length);
                        break;

                    default:
                        if (this.info.Length != 0)
                        {
                            this.objetivo = (uint)this.info[0];
                            break;
                        }
                        break;
                    }
                    this.CreateCuponEffects(itemId, cuponDays, player);
                }
                else
                {
                    this.erro = 2147483648U;
                }
                this._client.SendPacket((SendPacket) new INVENTORY_ITEM_EQUIP_PAK(this.erro, itemsModel, player));
            }
            catch (Exception ex)
            {
                Logger.info("INVENTORY_ITEM_EFFECT_REC: " + ex.ToString());
                this._client.SendPacket((SendPacket) new INVENTORY_ITEM_EQUIP_PAK(2147483648U, (ItemsModel)null, (Account)null));
            }
        }
        public override void run()
        {
            try
            {
                Account    p    = _client._player;
                ItemsModel item = p == null ? null : p._inventory.getItem(objId);
                if (item != null && item._id > 1300000000)
                {
                    int  cuponId   = ComDiv.createItemId(12, ComDiv.getIdStatics(item._id, 2), ComDiv.getIdStatics(item._id, 3), 0);
                    uint cuponDays = uint.Parse(DateTime.Now.AddDays(ComDiv.getIdStatics(item._id, 4)).ToString("yyMMddHHmm"));

                    if (cuponId == 1201047000 || cuponId == 1201051000 || cuponId == 1200010000)
                    {
                        txt = ComDiv.arrayToString(info, info.Length);
                    }
                    else if (cuponId == 1201052000 || cuponId == 1200005000)
                    {
                        objetivo = BitConverter.ToUInt32(info, 0);
                    }
                    else if (info.Length > 0)
                    {
                        objetivo = info[0];
                    }

                    CreateCuponEffects(cuponId, cuponDays, p);
                }
                else
                {
                    erro = 0x80000000;
                }
                _client.SendPacket(new INVENTORY_ITEM_EQUIP_PAK(erro, item, p));
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[INVENTORY_ITEM_EFFECT_REC.run] Erro fatal!");
                _client.SendPacket(new INVENTORY_ITEM_EQUIP_PAK(0x80000000));
            }
        }