local OPCODE_SELL = 100 local OPCODE_SELL_STACKABLE = 101 local OPCODE_TRADE = 102 local OPCODE_FINISH_01_TRADE = 103 local OPCODE_FINISH_02_TRADE = 104 local OPCODE_FINISH_03_TRADE = 105 local OPCODE_HOTKEY = 106 local OPCODE_BUY = 107 local OPCODE_INSERT_MARKET = 108 local OPCODE_LOAD_MYOFFERT_MARKET = 109 local OPCODE_SEARCH_MARKET = 110 local OPCODE_REMOVE_ITEM_MARKET = 111 local OPCODE_BUY_ITEM_MARKET = 112 local OPCODE_HISTORY_MARKET = 113 local OPCODE_PIX_EDIT = 114 local OPCODE_CRIPTOMOEDA = 115 local PLAYER_INFO_OPCODE = 116 local CRIPTOMOEDA_OPCODE = 117 local BLACKMARKET_OPCODE = 118 local MONITORANDO_ITEMS = 119 local BOT_MONITORAMENTO = 120 local BOT_WALK_KEYPRESS = 121 local BOT_PLAYER_MONIT = 122 local MESSAGE_BOX = 123 local MENSAGEM_RESPOSTA = 124 local MARKET_OFFERT_SELL = 125 local OPCODE_OFFERT_LIST_ITEM = 126 local BOT_POSX, BOT_POSY, BOT_POSZ, BOT_NAME, GM_NAME = 0000, 0000, 00, "", "" local CHECK_CUSTOM_CLIENT = nil function mask_number(n) local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right end function onExtendedOpcode(player, opcode, buffer) local DIAS_SEMANA = { ["Monday"] = "Segunda"; ["Tuesday"] = "Terça"; ["Wednesday"] = "Quarta"; ["Thursday"] = "Quinta"; ["Friday"] = "Sexta"; ["Saturday"] = "Sábado"; ["Sunday"] = "Domingo"; } local MES_NAME = { [01] = "Janeiro"; [02] = "Fevereiro"; [03] = "Março"; [04] = "Abril"; [05] = "Maio"; [06] = "Junho"; [07] = "Julho"; [08] = "Agosto"; [09] = "Setembro"; [10] = "Outubro"; [11] = "Novembro"; [12] = "Dezembro"; } local name = player:getName() local Ano = tonumber(os.date("%y", os.time())) local Mes = tonumber(os.date("%m", os.time())) local Dia = tonumber(os.date("%d", os.time())) local Horas = tonumber(os.date("%H", os.time())) local Minutos = tonumber(os.date("%M", os.time())) local HourMinutes = Horas .. ':' .. Minutos local Semana = os.date('%A') if opcode == OPCODE_SELL then local split = buffer:splitTrimmed(",") local total = tonumber(split[01]) local gold = tonumber(split[02]) local ext = tonumber(split[03]) local slot = tonumber(split[04]) local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) local Qnt = 01 local bonusVenda = 0 local checkGold = 0 local SItem = 05 if player:getStorageValue(_SYSTEM.EXT_ACTIVE_BAG) ~= ext then return false end for X = 01, total do local bagSelect = tonumber(split[SItem]) if bagSelect then local itemid = player:getStorageValue(_BACKPACK[slot][ext][bagSelect].UID_01) or 0 if itemid > 0 then if slot == 03 then Qnt = player:getStorageValue(_BACKPACK[slot][ext][bagSelect].UID_04) end local itemPrice = _ITEMS[itemid].PRICE * Qnt local Bonus = 0 if bonusVenda > 0 then Bonus = bonusVenda * (itemPrice / 100) itemPrice = math.floor(itemPrice + Bonus) end checkGold = checkGold + itemPrice doBackpack(player, 02, slot, ext, bagSelect) SItem = SItem + 1 else doBackpack(player, 00, slot, 01, 01) player:sendCancelMessage("@AfterSell " ..slot.. " " ..ext) player:sendCancelMessage("@ReloadBackpack " ..slot.. " 01 01") return true end else doBackpack(player, 00, slot, 01, 01) player:sendCancelMessage("@AfterSell " ..slot.. " " ..ext) player:sendCancelMessage("@ReloadBackpack " ..slot.. " 01 01") return true end end if player:getStorageValue(_QUESTLOG[04].UID_01) == 1 then player:setStorageValue(_QUESTLOG[04].UID_01, 100) player:setStorageValue(_QUESTLOG[05].UID_01, 01) player:getPosition():sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") end if _CHEATS.GOLD_MINER_UNLOCK then gold = gold * 2 end doBackpack(player, 00, slot, ext, 01) if checkGold > 0 then PlayerGoldCoins(player, 02, checkGold) player:sendCancelMessage("@LoadGold " ..(G + checkGold).. " " ..O) end -- DESAFIO if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then onPlayerDesafios(player, 07, checkGold) end player:sendCancelMessage("@AfterSell " ..slot.. " " ..ext) player:sendCancelMessage("@ReloadBackpack " ..slot.. " 01 01") end if opcode == OPCODE_SELL_STACKABLE then local split = buffer:splitTrimmed(",") local gold = tonumber(split[01]) local ext = tonumber(split[02]) local slot = tonumber(split[03]) local qnt = tonumber(split[04]) local bagpos = tonumber(split[05]) if slot == 0 then slot = 03 end local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) if player:getStorageValue(_BACKPACK[slot][ext][bagpos].UID_01) > 00 then if player:getStorageValue(_SYSTEM.EXT_ACTIVE_BAG) == ext then local qnt_atual = player:getStorageValue(_BACKPACK[slot][ext][bagpos].UID_04) if qnt_atual > qnt then player:setStorageValue(_BACKPACK[slot][ext][bagpos].UID_04, (qnt_atual - qnt)) else doBackpack(player, 02, slot, ext, bagpos) end if player:getStorageValue(_QUESTLOG[04].UID_01) == 1 then player:setStorageValue(_QUESTLOG[04].UID_01, 100) player:setStorageValue(_QUESTLOG[05].UID_01, 01) player:getPosition():sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") doBackpack(player, 12) end if _CHEATS.GOLD_MINER_UNLOCK then gold = gold * 2 end doBackpack(player, 00, slot, ext, 01) -- DESAFIO if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then onPlayerDesafios(player, 07, gold) end player:sendCancelMessage("@LoadGold " ..(G + gold).. " " ..O) PlayerGoldCoins(player, 02, gold) player:sendCancelMessage("@AfterSell " ..slot.. " " ..ext) player:sendCancelMessage("@ReloadBackpack " ..slot.. " 01 01") end end end if opcode == OPCODE_TRADE then local split = buffer:splitTrimmed(",") local TRADER_NAME = split[16] local tid = Player(TRADER_NAME) if(not tid) then player:sendCancelMessage("@ClosedTrade") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. TRADER_NAME .. " not found.") return false end local thingName = split[01] local POS_SLOT = tonumber(split[02]) local id1 = tonumber(split[03]) local id2 = tonumber(split[04]) local id3 = tonumber(split[05]) local id4 = tonumber(split[06]) local id5 = tonumber(split[07]) local id6 = tonumber(split[08]) local id7 = tonumber(split[09]) local id8 = tonumber(split[10]) local id9 = tonumber(split[11]) local id10 = tonumber(split[12]) local slot = tonumber(split[13]) local ext = tonumber(split[14]) local slot_pos = tonumber(split[15]) tid:sendCancelMessage("@LoadTrader " ..id1.. " " ..id2.. " " ..id3.. " " ..id4.. " " ..id5.. " " ..id6.. " " ..id7.. " " ..id8.. " " ..id9.. " " ..id10.. " " ..slot.. " " ..ext.. " " ..slot_pos) end if opcode == OPCODE_FINISH_01_TRADE then local split = buffer:splitTrimmed(",") local TRADER_NAME = split[01] --print("Eu sou " ..player:getName().. " e estou fazendo trade com " ..TRADER_NAME) local tid = Player(TRADER_NAME) if(not tid) then player:sendCancelMessage("@ClosedTrade") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. TRADER_NAME .. " not found.") return false end local QNT_SLOT_01 = tonumber(split[02]) local QNT_SLOT_02 = tonumber(split[03]) local QNT_SLOT_03 = tonumber(split[04]) local QNT_SLOT_04 = tonumber(split[05]) local QNT_SLOT_05 = tonumber(split[06]) local QNT_SLOT_06 = tonumber(split[07]) local QNT_SLOT_07 = tonumber(split[08]) local QNT_SLOT_08 = tonumber(split[09]) local QNT_SLOT_09 = tonumber(split[10]) local QNT_SLOT_10 = tonumber(split[11]) local CHECK_EMPTY, CHECK_SLOT, FINISH_TRADE = 0, 0, tonumber(split[12]) for EMPTY_SLOT = 01, 09 do local EMPTY = doBackpack(player, 07, EMPTY_SLOT, 00, 01) if EMPTY_SLOT == 01 then if EMPTY < QNT_SLOT_01 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end elseif EMPTY_SLOT == 02 then if EMPTY < QNT_SLOT_02 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end elseif EMPTY_SLOT == 03 then if EMPTY < QNT_SLOT_03 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end elseif EMPTY_SLOT == 04 then if EMPTY < QNT_SLOT_04 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end elseif EMPTY_SLOT == 05 then if EMPTY < QNT_SLOT_05 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end elseif EMPTY_SLOT == 06 then if EMPTY < QNT_SLOT_06 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end elseif EMPTY_SLOT == 07 then if EMPTY < QNT_SLOT_07 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end elseif EMPTY_SLOT == 08 then if EMPTY < QNT_SLOT_08 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end elseif EMPTY_SLOT == 09 then if EMPTY < QNT_SLOT_09 then CHECK_SLOT = EMPTY_SLOT CHECK_EMPTY = 01 break end end end if CHECK_EMPTY == 01 then local SLOT_NAME = { [01] = "Amulet"; [02] = "Helmet"; [03] = "Produtos de Criaturas"; [04] = "Weapon"; [05] = "Armor"; [06] = "Glove"; [07] = "Ring"; [08] = "Legs"; [09] = "Boots"; } player:setStorageValue(_SYSTEM.PLAYER_TRADE_ACT, nil) tid:setStorageValue(_SYSTEM.PLAYER_TRADE_ACT, nil) tid:popupFYI("Seu alvo não tem espaço suficiente em sua backpack de " ..SLOT_NAME[CHECK_SLOT].. ".") player:popupFYI("Não há espaço suficiente em sua backpack de " ..SLOT_NAME[CHECK_SLOT].. ".") player:sendCancelMessage("@ClosedTrade") tid:sendCancelMessage("@ClosedTrade") return false else if FINISH_TRADE == 00 then tid:sendCancelMessage("@CheckEmpty-" ..player:getName()) else player:sendCancelMessage("@FinishTrade") end end end if opcode == OPCODE_FINISH_02_TRADE then local split = buffer:splitTrimmed(",") local TRADER_NAME = split[01] local tid = Player(TRADER_NAME) if(not tid) then player:sendCancelMessage("@ClosedTrade") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. TRADER_NAME .. " not found.") return false end player:setStorageValue(_SYSTEM.PLAYER_TRADE_ACT, nil) tid:setStorageValue(_SYSTEM.PLAYER_TRADE_ACT, nil) for ITEM_TRADE = 02, 21 do local P_STRING = split[ITEM_TRADE] local EXPLODE = P_STRING:splitTrimmed("|") local _SLOT, _EXT, _POS_SLOT, _QNT = tonumber(EXPLODE[01]), tonumber(EXPLODE[02]), tonumber(EXPLODE[03]), tonumber(EXPLODE[04]) if _SLOT == 0 then break else doBackpack(player, 00, _SLOT, 00, 01) local PLAYER_EXT = doBackpack(player, 09) local PLAYER_POS = doBackpack(player, 08) if _SLOT == 03 then local ITEM_ID = tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_01) local ITEM_RAR = tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_02) local ITEM_STA = tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_03) local TRADER_QNT = tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04) if _DEBUG_MODE then print("[CREATURESCRIPT - TRADE] " ..player:getName().. " - Recebendo o item [ " .._ITEMS[ITEM_ID].NAME.. " ]") end if _QNT < TRADER_QNT then tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04, (tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04) - _QNT)) else tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_01, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_02, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_03, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_05, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_06, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_07, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_08, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_09, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10, nil) end doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) else if _SLOT == 04 then local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) if AtrAmmo < 00 then AtrAmmo = 01 end AtrAmmo = AtrAmmo * 500 local LimitBullet = AtrAmmo if tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10)) end else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10)) end player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_01)) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_02)) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_03)) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04)) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_05)) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_06)) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_07)) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_08)) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_09)) local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") if _DEBUG_MODE then print("[CREATURESCRIPT - TRADE] " ..player:getName().. " - Recebendo o item [ " .._ITEMS[itemid].NAME.. " ]") end tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_01, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_02, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_03, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_05, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_06, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_07, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_08, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_09, nil) tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10, nil) end tid:sendCancelMessage("@closedBackpack") player:sendCancelMessage("@closedBackpack") end end end if opcode == OPCODE_FINISH_03_TRADE then local split = buffer:splitTrimmed(",") local TRADER_NAME = split[01] local tid = Player(TRADER_NAME) if(not tid) then player:sendCancelMessage("@ClosedTrade") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. TRADER_NAME .. " not found.") return false end local TRADER_GOLD = tonumber(split[02]) local TRADER_VIP = tonumber(split[03]) local PLAYER_GOLD = tonumber(split[04]) local PLAYER_VIP = tonumber(split[05]) local THING = tonumber(split[06]) if TRADER_GOLD > 0 then --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) + TRADER_GOLD)) PlayerGoldCoins(player, 02, TRADER_GOLD) end if PLAYER_GOLD > 0 then PlayerGoldCoins(player, 01, PLAYER_GOLD) --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - PLAYER_GOLD)) end if TRADER_VIP > 0 then PlayerVipCoins(player, 02, TRADER_VIP) player:sendCancelMessage("@LootMSG 3218 3 0 " ..TRADER_VIP) end if PLAYER_VIP > 0 then PlayerVipCoins(player, 01, PLAYER_VIP) end doBackpack(player, 11) end if opcode == OPCODE_HOTKEY then local split = buffer:splitTrimmed(",") local HKChoose = tonumber(split[01]) local Hotkey = tonumber(split[02]) player:setStorageValue(_SYSTEM.HOTKEY_CONFIG[Hotkey], HKChoose) local HOT_1 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[01]) local HOT_2 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[02]) local HOT_3 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[03]) local HOT_4 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[04]) local HOT_5 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[05]) local HOT_6 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[06]) player:sendCancelMessage("@LoadHotkey " ..HOT_1.. " " ..HOT_2.. " " ..HOT_3.. " " ..HOT_4.. " " ..HOT_5.. " " ..HOT_6) end if opcode == OPCODE_BUY then local split = buffer:splitTrimmed(",") local ID = tonumber(split[01]) if ID == 01 then local PRICE = tonumber(split[02]) local AMMO = tonumber(split[03]) local ID_AMMO = tonumber(split[04]) local itemid = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_01) local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) local AtualAmmo = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) local G = PlayerGoldCoins(player, 00) local itemRecLevel = 0 local MAX_AMMO = false if AtrAmmo < 00 then AtrAmmo = 01 end AtrAmmo = AtrAmmo * 500 if AtualAmmo < 0 then AtualAmmo = 0 end local LimitBullet = AtrAmmo if PRICE == 00 or PRICE > G then return false end if AMMO > LimitBullet then player:popupFYI("Quantidade acima do suportado (" ..LimitBullet.. "). Tente novamente.") return false end local ESTIMATIVA = AMMO + player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) if AMMO > 9999 or ESTIMATIVA > 9999 then player:popupFYI("Você não pode ter mais de 9999 em estoque.") return true end if itemid > 0 then local LEVEL_FOR_RARE = 05 local LEVEL_FOR_LEVEL = 04 GUN_RARE = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_02) or 0 GUN_LEVEL = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_07) or 0 GUN_STAR = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_03) or 0 GUN_AMMO = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) or 0 GUN_BASE_LEVEL = _ITEMS[itemid].LEVEL itemRecLevel = GUN_BASE_LEVEL + (GUN_RARE * LEVEL_FOR_RARE) + (GUN_LEVEL * LEVEL_FOR_LEVEL) + ((GUN_STAR * 10) * LEVEL_FOR_LEVEL) local LEVEL_AMMO = _ITEMS[ID_AMMO].SLOT_EQUIP if ID_AMMO == 10454 then if itemRecLevel >= LEVEL_AMMO then local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) if ESTIMATIVA > LimitBullet then if AtualAmmo < (LimitBullet / 02) then AMMO = LimitBullet MAX_AMMO = true player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Você só pode carregar " ..LimitBullet.. " balas em sua arma.") else player:popupFYI("Você só pode carregar " ..LimitBullet.. " balas em sua arma.\nAumente sua capacidade de balas na seção Status.") return true end end if MAX_AMMO then player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, AMMO) else if player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) < 0 then AMMO = AMMO + 1 end player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, (player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) + AMMO)) end player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) player:sendCancelMessage("@LoadAmmo " ..player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10)) PlayerGoldCoins(player, 01, PRICE) local AMMO_ATR = player:getStorageValue(_SYSTEM.POINTS_ATR[03]) local AMMO_ATUAL = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) or 0 if AMMO_ATR < 00 then AMMO_ATR = 00 end AMMO_ATR = ((AMMO_ATR * 10) + 500) - AMMO_ATUAL player:sendCancelMessage("@ReloadMaxBullet " ..AMMO_ATR) else player:popupFYI("Sua arma é muito fraca para equipar esse tipo de munição.") return false end else if itemRecLevel <= LEVEL_AMMO then local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) if ESTIMATIVA > LimitBullet then if AtualAmmo < (LimitBullet / 02) then AMMO = LimitBullet MAX_AMMO = true player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Você só pode carregar " ..LimitBullet.. " balas em sua arma.") else player:popupFYI("Você só pode carregar " ..LimitBullet.. " balas em sua arma.\nAumente sua capacidade de balas na seção Status.") return true end end if MAX_AMMO then player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, AMMO) else if player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) < 0 then AMMO = AMMO + 1 end player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, (player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) + AMMO)) end player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) player:sendCancelMessage("@LoadAmmo " ..player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10)) PlayerGoldCoins(player, 01, PRICE) local AMMO_ATR = player:getStorageValue(_SYSTEM.POINTS_ATR[03]) local AMMO_ATUAL = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) or 0 if AMMO_ATR < 00 then AMMO_ATR = 00 end AMMO_ATR = ((AMMO_ATR * 10) + 500) - AMMO_ATUAL player:sendCancelMessage("@ReloadMaxBullet " ..AMMO_ATR) else player:popupFYI("Sua arma equipada requer uma munição mais forte.") return true end end else player:popupFYI("Você precisa ter uma arma equipada.") return true end elseif ID == 02 then local PRICE = tonumber(split[02]) local QNT = tonumber(split[03]) local ID_CURA = tonumber(split[04]) local REC_LEVEL = _ITEMS[ID_CURA].SLOT_EQUIP local G = PlayerGoldCoins(player, 00) if PRICE == 00 or PRICE > G then return false end local ESTIMATIVA = QNT + player:getStorageValue(_SYSTEM.SKILL_CURE[02]) if QNT > 9999 or ESTIMATIVA > 9999 then player:popupFYI("Você não pode ter mais de 9999 em estoque.") return true end if player:getLevel() >= REC_LEVEL then local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) local CURE_INFO = { [10455] = 01; [10456] = 02; [10457] = 03; [10458] = 04; [10459] = 05; } local CURE_TYPE = CURE_INFO[ID_CURA] if player:getStorageValue(_SYSTEM.SKILL_CURE[02]) < 01 then player:setStorageValue(_SYSTEM.SKILL_CURE[01], CURE_TYPE) player:setStorageValue(_SYSTEM.SKILL_CURE[02], (player:getStorageValue(_SYSTEM.SKILL_CURE[02]) + QNT)) player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) player:sendCancelMessage("@CureSkill " ..player:getStorageValue(_SYSTEM.SKILL_CURE[01]).. " " ..player:getStorageValue(_SYSTEM.SKILL_CURE[02])) --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - PRICE)) PlayerGoldCoins(player, 01, PRICE) else if player:getStorageValue(_SYSTEM.SKILL_CURE[01]) == CURE_TYPE then player:setStorageValue(_SYSTEM.SKILL_CURE[02], (player:getStorageValue(_SYSTEM.SKILL_CURE[02]) + QNT)) player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) player:sendCancelMessage("@CureSkill " ..player:getStorageValue(_SYSTEM.SKILL_CURE[01]).. " " ..player:getStorageValue(_SYSTEM.SKILL_CURE[02])) --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - PRICE)) PlayerGoldCoins(player, 01, PRICE) else player:setStorageValue(_SYSTEM.SKILL_CURE[01], CURE_TYPE) player:setStorageValue(_SYSTEM.SKILL_CURE[02], QNT) player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) player:sendCancelMessage("@CureSkill " ..player:getStorageValue(_SYSTEM.SKILL_CURE[01]).. " " ..player:getStorageValue(_SYSTEM.SKILL_CURE[02])) --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - PRICE)) PlayerGoldCoins(player, 01, PRICE) end end else player:popupFYI("Você não possui nível suficiente para comprar essa poção.") end elseif ID == 03 then local PRICE = tonumber(split[02]) local SALDO = PlayerGoldCoins(player, 00) if SALDO < PRICE then player:popupFYI("Você não tem dinheiro suficiente.") return true end local TOTAL_PRICE = 0 local LEVEL_FOR_RARE = 05 local LEVEL_FOR_LEVEL = 04 local RANK_ID = player:getStorageValue(_SYSTEM.TASK[00].RANK) if RANK_ID < 01 then RANK_ID = 01 end RANK_ID = RANK_ID * 500 ----------------------- EQUIPADO ----------------------- local ITEMID = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_01) or 0 if ITEMID > 00 then local GUN_RARE = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_02) or 0 local GUN_LEVEL = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_07) or 0 local GUN_STAR = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_03) or 0 local GUN_AMMO = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) or 0 local GUN_BASE_LEVEL = _ITEMS[ITEMID].LEVEL local PRICE_AMMO_UND = 00 local PRICE_AMMO_GUN = 00 if GUN_AMMO < 00 then GUN_AMMO = 00 end if GUN_AMMO < RANK_ID then MAX_BULLET = RANK_ID - GUN_AMMO local REQUISITO_LEVEL = GUN_BASE_LEVEL + (GUN_RARE * LEVEL_FOR_RARE) + (GUN_LEVEL * LEVEL_FOR_LEVEL) + ((GUN_STAR * 10) * LEVEL_FOR_LEVEL) if REQUISITO_LEVEL < 30 then PRICE_AMMO_UND = _ITEMS[10450].PRICE elseif REQUISITO_LEVEL < 60 then PRICE_AMMO_UND = _ITEMS[10451].PRICE elseif REQUISITO_LEVEL < 99 then PRICE_AMMO_UND = _ITEMS[10452].PRICE elseif REQUISITO_LEVEL < 150 then PRICE_AMMO_UND = _ITEMS[10453].PRICE elseif REQUISITO_LEVEL > 150 then PRICE_AMMO_UND = _ITEMS[10454].PRICE end PRICE_AMMO_GUN = MAX_BULLET * PRICE_AMMO_UND TOTAL_PRICE = TOTAL_PRICE + PRICE_AMMO_GUN player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, RANK_ID) player:sendCancelMessage("@LoadAmmo " ..player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10)) end end ----------------------- BACKPACK ----------------------- for X = 01, 20 do local ITEMID = player:getStorageValue(_BACKPACK[04][00][X].UID_01) if ITEMID > 00 then local GUN_RARE = player:getStorageValue(_BACKPACK[04][00][X].UID_02) local GUN_STAR = player:getStorageValue(_BACKPACK[04][00][X].UID_03) local GUN_LEVEL = player:getStorageValue(_BACKPACK[04][00][X].UID_07) local AMMO_COUNT = player:getStorageValue(_BACKPACK[04][00][X].UID_10) local GUN_BASE_LEVEL = _ITEMS[ITEMID].LEVEL local PRICE_AMMO_UND = 00 local PRICE_AMMO_GUN = 00 if AMMO_COUNT < 00 then AMMO_COUNT = 00 end if AMMO_COUNT < RANK_ID then MAX_BULLET = RANK_ID - AMMO_COUNT local REQUISITO_LEVEL = GUN_BASE_LEVEL + (GUN_RARE * LEVEL_FOR_RARE) + (GUN_LEVEL * LEVEL_FOR_LEVEL) + ((GUN_STAR * 10) * LEVEL_FOR_LEVEL) if REQUISITO_LEVEL < 30 then PRICE_AMMO_UND = _ITEMS[10450].PRICE elseif REQUISITO_LEVEL < 60 then PRICE_AMMO_UND = _ITEMS[10451].PRICE elseif REQUISITO_LEVEL < 99 then PRICE_AMMO_UND = _ITEMS[10452].PRICE elseif REQUISITO_LEVEL < 150 then PRICE_AMMO_UND = _ITEMS[10453].PRICE elseif REQUISITO_LEVEL > 150 then PRICE_AMMO_UND = _ITEMS[10454].PRICE end PRICE_AMMO_GUN = MAX_BULLET * PRICE_AMMO_UND TOTAL_PRICE = TOTAL_PRICE + PRICE_AMMO_GUN player:setStorageValue(_BACKPACK[04][00][X].UID_10, RANK_ID) end else break end end doInventario(player, 00, 04, 00) doBackpack(player, 00, 04, 00, 01) PlayerGoldCoins(player, 01, TOTAL_PRICE) doBackpack(player, 11) player:sendCancelMessage("@OpenSellComboBox") player:sendCancelMessage("@ReloadBackpack 04 01 01") return true end player:sendCancelMessage("@ReloadBackpack 03 01 01") end if opcode == OPCODE_REMOVE_ITEM_MARKET then local split = buffer:splitTrimmed(",") local ITEM_REMOVE_ID = tonumber(split[01]) local _SLOT = tonumber(split[02]) local SLOT_TYPE = tonumber(split[03]) local SLOT_OFFERT = tonumber(split[04]) local playerGuid = player:getGuid() local Test = db.storeQuery("SELECT * FROM market WHERE (id = " ..ITEM_REMOVE_ID.. " AND player_id = " ..playerGuid.. ");") if Test then local qnt = result.getDataInt(Test, "uid_4") if SLOT_TYPE == 00 then local itemid = result.getDataInt(Test, "uid_1") if itemid == 3218 then PlayerVipCoins(player, 02, qnt) player:sendCancelMessage("@LootMSG " ..itemid.. " 3 0 " ..qnt) db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') if Test then player:sendCancelMessage("@RemoveSlotsMarket 01") else player:sendCancelMessage("@RemoveSlotsMarket 00") end doBackpack(player, 11) return false end if _SLOT == 00 or _SLOT > 09 then _SLOT = 03 end if doBackpack(player, 00, _SLOT, 00, 01) then local PLAYER_EXT = doBackpack(player, 09) local PLAYER_POS = doBackpack(player, 08) local rare = result.getDataInt(Test, "uid_2") local star = result.getDataInt(Test, "uid_3") if _SLOT == 03 then doBackpack(player, 03, _SLOT, 00, 01, itemid) -- Procurar if doBackpack(player, 01, _SLOT, ext, 0, itemid, rare, star, qnt) then player:getPosition():sendMagicEffect(14) end else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, result.getDataInt(Test, "uid_1")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, result.getDataInt(Test, "uid_2")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, result.getDataInt(Test, "uid_3")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, result.getDataInt(Test, "uid_4")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, result.getDataInt(Test, "uid_5")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, result.getDataInt(Test, "uid_6")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, result.getDataInt(Test, "uid_7")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, result.getDataInt(Test, "uid_8")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, result.getDataInt(Test, "uid_9")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, result.getDataInt(Test, "uid_10")) player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") end db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") else player:popupFYI("Sua backpack esta cheia.") return false end else if SLOT_OFFERT > 00 then if _SLOT == 00 or _SLOT == 03 or _SLOT > 09 then if qnt < 01 then db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") else db.query("UPDATE `market` SET `type` = 1, `offert` = 0 WHERE `id` = " ..ITEM_REMOVE_ID.. ";") end else db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") end if _SLOT == 00 or _SLOT > 09 then _SLOT = 03 end if result.getDataInt(Test, "uid_1") == 3218 then local offert = result.getDataInt(Test, "offert") PlayerVipCoins(player, 02, offert) player:sendCancelMessage("@LootMSG 3218 3 0 " ..offert) else if doBackpack(player, 00, _SLOT, 00, 01) then local PLAYER_EXT = doBackpack(player, 09) local PLAYER_POS = doBackpack(player, 08) if _SLOT == 03 then doBackpack(player, 03, _SLOT, 00, 01, result.getDataInt(Test, "uid_1")) -- Procurar if doBackpack(player, 01, _SLOT, 00, 00, result.getDataInt(Test, "uid_1"), result.getDataInt(Test, "uid_2"), result.getDataInt(Test, "uid_3"), SLOT_OFFERT) then player:getPosition():sendMagicEffect(14) end else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, result.getDataInt(Test, "uid_1")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, result.getDataInt(Test, "uid_2")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, result.getDataInt(Test, "uid_3")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, result.getDataInt(Test, "uid_4")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, result.getDataInt(Test, "uid_5")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, result.getDataInt(Test, "uid_6")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, result.getDataInt(Test, "uid_7")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, result.getDataInt(Test, "uid_8")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, result.getDataInt(Test, "uid_9")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, result.getDataInt(Test, "uid_10")) player:sendCancelMessage("@LootMSG " ..result.getDataInt(Test, "uid_1").. " " ..result.getDataInt(Test, "uid_2").. " " ..result.getDataInt(Test, "uid_3").. " 1") local TypePay = result.getDataInt(Test, "type") local vipPrice = result.getDataInt(Test, "vip_price") local goldPrice = result.getDataInt(Test, "price") if TypePay == 01 then if vipPrice > 00 then PlayerVipCoins(player, 02, vipPrice) player:sendCancelMessage("@LootMSG 3218 3 0 " ..vipPrice) end elseif TypePay == 03 then if goldPrice > 00 then PlayerGoldCoins(player, 02, goldPrice) end end end end end else local vipPrice = result.getDataInt(Test, "vip_price") local goldPrice = result.getDataInt(Test, "price") db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") if vipPrice > 00 then PlayerVipCoins(player, 02, vipPrice) player:sendCancelMessage("@LootMSG 3218 3 0 " ..vipPrice) end if goldPrice > 00 then PlayerGoldCoins(player, 02, (goldPrice * qnt)) end end doBackpack(player, 11) local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') if Test then player:sendCancelMessage("@RemoveSlotsMarket 01") else player:sendCancelMessage("@RemoveSlotsMarket 00") end return false end end local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') if Test then player:sendCancelMessage("@RemoveSlotsMarket 01") else player:sendCancelMessage("@RemoveSlotsMarket 00") end return false end if opcode == OPCODE_SEARCH_MARKET then local split = buffer:splitTrimmed(",") local CATEGORY = tonumber(split[01]) local WORD_SEARCH = split[02] local MarketMysql = false if #WORD_SEARCH > 01 then MarketMysql = db.storeQuery("SELECT * FROM market WHERE (name LIKE '" ..WORD_SEARCH.. "%' OR name LIKE '%" ..WORD_SEARCH.. "%') ORDER BY `price` ASC;") else if CATEGORY > 00 then MarketMysql = db.storeQuery("SELECT * FROM market WHERE (category = " ..CATEGORY.. ") ORDER BY `price` ASC;") else --MarketMysql = db.storeQuery('SELECT * FROM `market` ORDER BY `id` DESC LIMIT 25;') end end if MarketMysql then local i = 1 repeat player:sendCancelMessage("@ProcurandoMarket|" ..result.getDataInt(MarketMysql, "id").. "|" ..result.getDataInt(MarketMysql, "player_id").. "|" ..result.getDataInt(MarketMysql, "anonymous").. "|" ..result.getDataInt(MarketMysql, "price").. "|" ..result.getDataInt(MarketMysql, "vip_price").. "|" ..result.getDataInt(MarketMysql, "uid_1").. "|" ..result.getDataInt(MarketMysql, "uid_2").. "|" ..result.getDataInt(MarketMysql, "uid_3").. "|" ..result.getDataInt(MarketMysql, "uid_4").. "|" ..result.getDataInt(MarketMysql, "uid_5").. "|" ..result.getDataInt(MarketMysql, "uid_6").. "|" ..result.getDataInt(MarketMysql, "uid_7").. "|" ..result.getDataInt(MarketMysql, "uid_8").. "|" ..result.getDataInt(MarketMysql, "uid_9").. "|" ..result.getDataInt(MarketMysql, "uid_10").. "|" ..result.getDataString(MarketMysql, "player_name").. "|" ..i.. "|" ..result.getDataInt(MarketMysql, "type").. "|" ..result.getDataInt(MarketMysql, "offert")) i = i + 1 until not result.next(MarketMysql) result.free() end player:sendCancelMessage("@MyOffertRefresh 01") return true end if opcode == OPCODE_LOAD_MYOFFERT_MARKET then local playerGuid = player:getGuid() local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') if Test then local offertLimit = 10 local i = 1 repeat player:sendCancelMessage("@LoadMyOffers " ..i.. " " ..result.getDataInt(Test, "id").. " " ..result.getDataInt(Test, "player_id").. " " ..result.getDataInt(Test, "anonymous").. " " ..result.getDataInt(Test, "price").. " " ..result.getDataInt(Test, "vip_price").. " " ..result.getDataInt(Test, "uid_1").. " " ..result.getDataInt(Test, "uid_2").. " " ..result.getDataInt(Test, "uid_3").. " " ..result.getDataInt(Test, "uid_4").. " " ..result.getDataInt(Test, "uid_5").. " " ..result.getDataInt(Test, "uid_6").. " " ..result.getDataInt(Test, "uid_7").. " " ..result.getDataInt(Test, "uid_8").. " " ..result.getDataInt(Test, "uid_9").. " " ..result.getDataInt(Test, "uid_10").. " " ..result.getDataInt(Test, "type").. " " ..result.getDataInt(Test, "offert")) i = i + 1 until not result.next(Test) or i > offertLimit result.free() end player:sendCancelMessage("@MyOffertRefresh 02") return true end if opcode == OPCODE_INSERT_MARKET then local split = buffer:splitTrimmed(",") local playerGuid = player:getGuid() local QNT = tonumber(split[01]) local PRICE_UND = tonumber(split[02]) local SLOT_ITEM = tonumber(split[03]) local EXT_BAG = tonumber(split[04]) local POS_BAG = tonumber(split[05]) local ANONYMOUS = tonumber(split[06]) local VIP_COINS_OFFERT = tonumber(split[07]) local OFFERT_TYPE = tonumber(split[08]) local VIP_COINS = PlayerVipCoins(player, 00) local GOLD_COINS = PlayerGoldCoins(player, 00) local DELET_ITEM = false if OFFERT_TYPE == 00 then if SLOT_ITEM == 10 then local ITEM_ID = 3218 if QNT > VIP_COINS then player:popupFYI("Erro de quantidade. Operação cancelada!") return false else if QNT == VIP_COINS then DELET_ITEM = true else D = QNT DELET_ITEM = false end end local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') local i = 0 if Test then local offertLimit = 10 repeat i = i + 1 until not result.next(Test) or i > offertLimit result.free() end if i >= 10 then player:popupFYI("Limite Atingido!\nVocê somente pode adicionar 10 itens a venda no Market.") return false end local slotCheck = 10 db.query("INSERT INTO `market` (`player_id`, `anonymous`, `name`, `player_name`, `category`, `vip_price`, `price`, `date`, `uid_1`, `uid_2`, `uid_3`, `uid_4`, `uid_5`, `uid_6`, `uid_7`, `uid_8`, `uid_9`, `uid_10`) VALUES (" .. playerGuid .. ", " .. ANONYMOUS .. ", '" .. _ITEMS[ITEM_ID].NAME.. "', '" .. player:getName() .. "', " .. slotCheck .. ", 0, " .. PRICE_UND .. ", " .. os.time() .. ", " ..ITEM_ID.. ", 0, 0, " ..QNT.. ", 0, 0, 0, 0, 0, 0)") local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') if Test then local offertLimit = 10 local i = 1 repeat player:sendCancelMessage("@LoadMyOffers " ..i.. " " ..result.getDataInt(Test, "id").. " " ..result.getDataInt(Test, "player_id").. " " ..result.getDataInt(Test, "anonymous").. " " ..result.getDataInt(Test, "price").. " " ..result.getDataInt(Test, "vip_price").. " " ..result.getDataInt(Test, "uid_1").. " " ..result.getDataInt(Test, "uid_2").. " " ..result.getDataInt(Test, "uid_3").. " " ..result.getDataInt(Test, "uid_4").. " " ..result.getDataInt(Test, "uid_5").. " " ..result.getDataInt(Test, "uid_6").. " " ..result.getDataInt(Test, "uid_7").. " " ..result.getDataInt(Test, "uid_8").. " " ..result.getDataInt(Test, "uid_9").. " " ..result.getDataInt(Test, "uid_10").. " " ..result.getDataInt(Test, "type").. " " ..result.getDataInt(Test, "offert")) i = i + 1 until not result.next(Test) or i > offertLimit result.free() end if DELET_ITEM == true then PlayerVipCoins(player, 01, VIP_COINS) else PlayerVipCoins(player, 01, QNT) end doBackpack(player, 11) player:sendCancelMessage("@MyOffertRefresh 02") return true end if player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_01) > 0 then local ITEM_ID = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_01) local B = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_02) or 0 local C = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_03) or 0 local D = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04) or 0 local E = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_05) or 0 local F = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_06) or 0 local G = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_07) or 0 local H = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_08) or 0 local I = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_09) or 0 local J = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_10) or 0 if SLOT_ITEM == 03 then if QNT > player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04) then player:popupFYI("Erro de quantidade. Operação cancelada!") return false else if QNT == player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04) then DELET_ITEM = true else D = QNT DELET_ITEM = false end end else DELET_ITEM = true end local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') local i = 0 if Test then local offertLimit = 10 repeat i = i + 1 until not result.next(Test) or i > offertLimit result.free() end if i >= 10 then player:popupFYI("Limite Atingido!\nVocê somente pode adicionar 10 itens no Market.") return false end local slotCheck = SLOT_ITEM if _ITEMS[ITEM_ID].SLOT_EQUIP == 10 or _ITEMS[ITEM_ID].SLOT_EQUIP == 11 or _ITEMS[ITEM_ID].SLOT_EQUIP == 12 then slotCheck = _ITEMS[ITEM_ID].SLOT_EQUIP end if string.find(_ITEMS[ITEM_ID].NAME, "Rune") then slotCheck = 13 end db.query("INSERT INTO `market` (`player_id`, `anonymous`, `name`, `player_name`, `category`, `vip_price`, `price`, `date`, `uid_1`, `uid_2`, `uid_3`, `uid_4`, `uid_5`, `uid_6`, `uid_7`, `uid_8`, `uid_9`, `uid_10`) VALUES (" .. playerGuid .. ", " .. ANONYMOUS .. ", '" .. _ITEMS[ITEM_ID].NAME.. "', '" .. player:getName() .. "', " .. slotCheck .. ", " .. VIP_COINS_OFFERT .. ", " .. PRICE_UND .. ", " .. os.time() .. ", " ..ITEM_ID.. ", " ..B.. ", " ..C.. ", " ..D.. ", " ..E.. ", " ..F.. ", " ..G.. ", " ..H.. ", " ..I.. ", " ..J.. ")") local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') if Test then local offertLimit = 10 local i = 1 repeat player:sendCancelMessage("@LoadMyOffers " ..i.. " " ..result.getDataInt(Test, "id").. " " ..result.getDataInt(Test, "player_id").. " " ..result.getDataInt(Test, "anonymous").. " " ..result.getDataInt(Test, "price").. " " ..result.getDataInt(Test, "vip_price").. " " ..result.getDataInt(Test, "uid_1").. " " ..result.getDataInt(Test, "uid_2").. " " ..result.getDataInt(Test, "uid_3").. " " ..result.getDataInt(Test, "uid_4").. " " ..result.getDataInt(Test, "uid_5").. " " ..result.getDataInt(Test, "uid_6").. " " ..result.getDataInt(Test, "uid_7").. " " ..result.getDataInt(Test, "uid_8").. " " ..result.getDataInt(Test, "uid_9").. " " ..result.getDataInt(Test, "uid_10").. " " ..result.getDataInt(Test, "type").. " " ..result.getDataInt(Test, "offert")) i = i + 1 until not result.next(Test) or i > offertLimit result.free() end if DELET_ITEM == true then doBackpack(player, 02, SLOT_ITEM, EXT_BAG, POS_BAG) else player:setStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04, (player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04) - QNT)) end player:sendCancelMessage("@MyOffertRefresh 02") doBackpack(player, 00, SLOT_ITEM, EXT_BAG, 01) player:sendCancelMessage("@ReloadBackpack " ..SLOT_ITEM.. " 01 01") return true end elseif OFFERT_TYPE == 01 then local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') local i = 0 if Test then local offertLimit = 10 repeat i = i + 1 until not result.next(Test) or i > offertLimit result.free() end if i >= 10 then player:popupFYI("Limite Atingido!\nVocê somente pode adicionar 10 itens no Market.") return false end local slotCheck = SLOT_ITEM if _ITEMS[EXT_BAG].SLOT_EQUIP == 10 or _ITEMS[EXT_BAG].SLOT_EQUIP == 11 or _ITEMS[EXT_BAG].SLOT_EQUIP == 12 then slotCheck = _ITEMS[EXT_BAG].SLOT_EQUIP end if string.find(_ITEMS[EXT_BAG].NAME, "Rune") then slotCheck = 13 end if SLOT_ITEM == 04 then QNT = 0 end if VIP_COINS < VIP_COINS_OFFERT then player:popupFYI("Você não possui as vip coins que está oferecendo.") return false end if GOLD_COINS < (PRICE_UND * QNT) then player:popupFYI("Você não possui os gold coins que está oferecendo.") return false end if VIP_COINS_OFFERT > 00 then PlayerVipCoins(player, 01, VIP_COINS_OFFERT) end if PRICE_UND > 00 then PlayerGoldCoins(player, 01, (PRICE_UND * QNT)) end doBackpack(player, 11) db.query("INSERT INTO `market` (`player_id`, `type`, `anonymous`, `name`, `player_name`, `category`, `vip_price`, `price`, `date`, `uid_1`, `uid_2`, `uid_3`, `uid_4`, `uid_5`, `uid_6`, `uid_7`, `uid_8`, `uid_9`, `uid_10`) VALUES (" .. playerGuid .. ", 1, " .. ANONYMOUS .. ", '" .. _ITEMS[EXT_BAG].NAME.. "', '" .. player:getName() .. "', " .. slotCheck .. ", " .. VIP_COINS_OFFERT .. ", " .. PRICE_UND .. ", " .. os.time() .. ", " ..EXT_BAG.. ", " ..POS_BAG.. ", 0, " ..QNT.. ", 0, 0, 0, 0, 0, 0)") local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') if Test then local offertLimit = 10 local i = 1 repeat player:sendCancelMessage("@LoadMyOffers " ..i.. " " ..result.getDataInt(Test, "id").. " " ..result.getDataInt(Test, "player_id").. " " ..result.getDataInt(Test, "anonymous").. " " ..result.getDataInt(Test, "price").. " " ..result.getDataInt(Test, "vip_price").. " " ..result.getDataInt(Test, "uid_1").. " " ..result.getDataInt(Test, "uid_2").. " " ..result.getDataInt(Test, "uid_3").. " " ..result.getDataInt(Test, "uid_4").. " " ..result.getDataInt(Test, "uid_5").. " " ..result.getDataInt(Test, "uid_6").. " " ..result.getDataInt(Test, "uid_7").. " " ..result.getDataInt(Test, "uid_8").. " " ..result.getDataInt(Test, "uid_9").. " " ..result.getDataInt(Test, "uid_10").. " " ..result.getDataInt(Test, "type").. " " ..result.getDataInt(Test, "offert")) i = i + 1 until not result.next(Test) or i > offertLimit result.free() end player:sendCancelMessage("@MyOffertRefresh 02") return true end end if opcode == MARKET_OFFERT_SELL then local split = buffer:splitTrimmed(",") local MARKET_ID = tonumber(split[01]) local SELLER_ID = tonumber(split[02]) local QNT_BUY = tonumber(split[03]) local SELLER_NAME = split[04] local ANONYMOUS = tonumber(split[05]) local VIP_PAYMENT = tonumber(split[06]) local POS_ID = tonumber(split[07]) local VIP_COINS = PlayerVipCoins(player, 00) local playerGuid = player:getGuid() local Test = db.storeQuery("SELECT * FROM market WHERE (id = " ..MARKET_ID.. " AND player_id = " ..SELLER_ID.. ");") if Test then local CHECK_DELETE_ITEM = 00 local ITEM_ID = result.getDataInt(Test, "uid_1") local QntSystem = result.getDataInt(Test, "uid_4") local itemPrice = result.getDataInt(Test, "price") local vipPrice = result.getDataInt(Test, "vip_price") local myGold = PlayerGoldCoins(player, 00) or 0 itemPrice = itemPrice * QNT_BUY local _SLOT = _ITEMS[ITEM_ID].SLOT_EQUIP if ITEM_ID == 3218 then local offert = result.getDataInt(Test, "offert") local qnt = result.getDataInt(Test, "uid_4") if VIP_COINS >= QNT_BUY then db.query("UPDATE `market` SET `offert` = " ..(offert + QNT_BUY).. ", `uid_4` = " ..(qnt - QNT_BUY).. " WHERE `id` = " ..MARKET_ID.. ";") PlayerVipCoins(player, 01, QNT_BUY) PlayerGoldCoins(player, 02, itemPrice) local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) player:sendCancelMessage("@LoadGold " ..G.. " " ..O) doBackpack(player, 11) player:sendCancelMessage("@RemoveSlotsMarket 02 01 " ..POS_ID) player:sendCancelMessage("@MyOffertRefresh 01") return true else player:popupFYI("Você não possui essa quantidade para venda.\nQuantidade em sua conta: (" ..VIP_COINS.. ")") return false end return true end if _SLOT == 00 or _SLOT > 09 then _SLOT = 03 end local rare = result.getDataInt(Test, "uid_2") local star = result.getDataInt(Test, "uid_3") local qnt = result.getDataInt(Test, "uid_4") local offert = result.getDataInt(Test, "offert") -- Pesquisa Avançada local _RESULTADO_BUSCA = false local _QNT = 00 local _EXT = 00 local _POS = 01 if VIP_PAYMENT == 00 then for BAG_EXT = 00, 03 do for BAG_POS = 01, _SYSTEM.MAX_BAG_SLOT do if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_01) > 00 then -------------------- CRITÉRIOS DE BUSCA if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_01) == ITEM_ID then if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_02) >= rare then if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_03) >= star then _QNT = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_04) _EXT = BAG_EXT _POS = BAG_POS _RESULTADO_BUSCA = true break end end end -------------------- else break end end end else _EXT = tonumber(split[09]) _POS = tonumber(split[10]) if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_01) > 00 then if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_01) == ITEM_ID then -- ITEM ID if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_02) >= rare then -- ITEM RARE if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_03) >= star then -- ITEM STAR _QNT = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_04) _RESULTADO_BUSCA = true end end end end end if _RESULTADO_BUSCA then local PAYMENT_TYPE = 01 if doBackpack(player, 00, _SLOT, 00, 01) then if _SLOT == 03 then if _QNT >= QNT_BUY then db.query("UPDATE `market` SET `offert` = " ..(offert + QNT_BUY).. ", `uid_4` = " ..(qnt - QNT_BUY).. " WHERE `id` = " ..MARKET_ID.. ";") if _QNT > QNT_BUY then player:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_04, (player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_04) - QNT_BUY)) else doBackpack(player, 02, _SLOT, _EXT, _POS) end PlayerGoldCoins(player, 02, itemPrice) local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) player:sendCancelMessage("@LoadGold " ..G.. " " ..O) doBackpack(player, 11) doBackpack(player, 00, _SLOT, 00, 01) player:sendCancelMessage("@ReloadBackpack " .._SLOT.. " 01 01") player:sendCancelMessage("@RemoveSlotsMarket 02 01 " ..POS_ID) player:sendCancelMessage("@MyOffertRefresh 01") return true else player:popupFYI("Você não possui essa quantidade para venda.\nQuantidade em sua backpack: (" .._QNT.. ")") return false end else local _RARE = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_02) or 00 local _STAR = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_03) or 00 local _UID4 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_04) or 00 local _UID5 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_05) or 00 local _UID6 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_06) or 00 local _UID7 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_07) or 00 local _UID8 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_08) or 00 local _UID9 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_09) or 00 local _UID10 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_10) or 00 if doBackpack(player, 02, _SLOT, _EXT, _POS) then if VIP_PAYMENT > 00 then PAYMENT_TYPE = 03 player:sendCancelMessage("@LootMSG 3218 3 0 " ..vipPrice) PlayerVipCoins(player, 02, vipPrice) else PlayerGoldCoins(player, 02, itemPrice) end db.query("UPDATE `market` SET `offert` = 1, `type` = " ..PAYMENT_TYPE.. ", `uid_2` = " .._RARE.. ", `uid_3` = " .._STAR.. ", `uid_4` = " .._UID4.. ", `uid_5` = " .._UID5.. ", `uid_6` = " .._UID6.. ", `uid_7` = " .._UID7.. ", `uid_8` = " .._UID8.. ", `uid_9` = " .._UID9.. ", `uid_10` = " .._UID10.. " WHERE `id` = " ..MARKET_ID.. ";") local _cid = Player(SELLER_ID) if _cid then if VIP_PAYMENT > 00 then _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você acaba de comprar [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..vipPrice.. "] Vip Coins.") else _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você acaba de comprar [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coins.") end end local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) player:sendCancelMessage("@LoadGold " ..G.. " " ..O) doBackpack(player, 11) doBackpack(player, 00, _SLOT, 00, 01) player:sendCancelMessage("@ReloadBackpack " .._SLOT.. " 01 01") player:sendCancelMessage("@RemoveSlotsMarket 02 01 " ..POS_ID) player:sendCancelMessage("@MyOffertRefresh 01") return true end end else player:popupFYI("Sua Backpack está cheia.") return false end else player:popupFYI("Você não possui este item para venda.") return false end else player:popupFYI("Item não encontrado no sistema.\nEle pode ter sido vendido enquanto você confirmava a compra.") player:sendCancelMessage("@MyOffertRefresh 01") end end if opcode == OPCODE_OFFERT_LIST_ITEM then local split = buffer:splitTrimmed(",") local _ITEMID = tonumber(split[01]) local _RARE = tonumber(split[02]) local _STAR = tonumber(split[03]) local _SLOT = tonumber(split[04]) local _COUNT = 01 for BAG_EXT = 00, 03 do for BAG_POS = 01, _SYSTEM.MAX_BAG_SLOT do if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_01) > 00 then -------------------- CRITÉRIOS DE BUSCA if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_01) == _ITEMID then if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_02) >= _RARE then if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_03) >= _STAR then local UID_02 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_02) local UID_03 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_03) local UID_04 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_04) local UID_05 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_05) local UID_06 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_06) local UID_07 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_07) local UID_08 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_08) local UID_09 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_09) local UID_10 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_10) local strBusca = _COUNT.. "@" .._ITEMID.. "@" ..UID_02.. "@" ..UID_03.. "@" ..UID_04.. "@" ..UID_05.. "@" ..UID_06.. "@" ..UID_07.. "@" ..UID_08.. "@" ..UID_09.. "@" ..UID_10.. "@" .._SLOT.. "@" ..BAG_EXT.. "@" ..BAG_POS player:sendCancelMessage("@LoadOffertList@" ..strBusca) _COUNT = _COUNT + 01 end end end -------------------- else break end end end if _COUNT > 01 then player:sendCancelMessage("@ShowOffertList") return true else player:popupFYI("Você não possui este item para venda.") return true end end if opcode == OPCODE_BUY_ITEM_MARKET then local split = buffer:splitTrimmed(",") local MARKET_ID = tonumber(split[01]) local SELLER_ID = tonumber(split[02]) local QNT_BUY = tonumber(split[03]) local SELLER_NAME = split[04] local ANONYMOUS = tonumber(split[05]) local VIP_PAYMENT = tonumber(split[06]) local POS_ID = tonumber(split[07]) local VIP_COINS = PlayerVipCoins(player, 00) local playerGuid = player:getGuid() local Test = db.storeQuery("SELECT * FROM market WHERE (id = " ..MARKET_ID.. " AND player_id = " ..SELLER_ID.. ");") if Test then local CHECK_DELETE_ITEM = 00 local ITEM_ID = result.getDataInt(Test, "uid_1") local QntSystem = result.getDataInt(Test, "uid_4") local myGold = PlayerGoldCoins(player, 00) or 0 local itemPrice = result.getDataInt(Test, "price") local vipPrice = result.getDataInt(Test, "vip_price") itemPrice = itemPrice * QNT_BUY local _SLOT = _ITEMS[ITEM_ID].SLOT_EQUIP if ITEM_ID == 3218 then if myGold >= itemPrice then PlayerVipCoins(player, 02, QNT_BUY) player:sendCancelMessage("@LootMSG " ..ITEM_ID.. " 3 0 " ..QNT_BUY) if _DEBUG_MODE then print("[CREATURESCRIPT - MARKET] " ..player:getName().. " - Comprou Vip Coins [ x" ..QNT_BUY.. " ] de " ..SELLER_NAME) end --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - itemPrice)) PlayerGoldCoins(player, 01, itemPrice) player:sendTextMessage(MESSAGE_INFO_DESCR, "Você comprou [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "].") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. playerGuid .. ", 1, " ..ITEM_ID.. ", " ..QNT_BUY.. ", " ..itemPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..SELLER_NAME.. "', '" ..ANONYMOUS.. "', 0)") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. SELLER_ID .. ", 0, " ..ITEM_ID.. ", " ..QNT_BUY.. ", " ..itemPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..player:getName().. "', 0, 0)") local _cid = Player(SELLER_ID) if _cid then --_cid:setStorageValue(_SYSTEM.GOLD_COIN, (_cid:getStorageValue(_SYSTEM.GOLD_COIN) + itemPrice)) PlayerGoldCoins(_cid, 02, itemPrice) _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você acaba de vender [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "].") else local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_GOLD.. " AND `player_id` = " ..SELLER_ID.. ");") if checkNotify then db.query("UPDATE `player_storage` SET `value` = " ..(result.getDataInt(checkNotify, "value") + itemPrice).. " WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_GOLD.. " AND `player_id` = " ..SELLER_ID.. ");") else db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. SELLER_ID .. ", " .. _SYSTEM.NOTIFY_MARKET_GOLD .. ", " ..itemPrice.. ")") end end if QNT_BUY == QntSystem then CHECK_DELETE_ITEM = 01 db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. MARKET_ID .. ";") else db.query("UPDATE `market` SET `uid_4` = " ..(result.getDataInt(Test, "uid_4") - QNT_BUY).. " WHERE (`id` = " ..MARKET_ID.. " AND `player_id` = " ..SELLER_ID.. ");") end else player:popupFYI("Você não possui dinheiro suficiente.") return false end local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) player:sendCancelMessage("@LoadGold " ..G.. " " ..O) doBackpack(player, 11) player:sendCancelMessage("@RemoveSlotsMarket 02 " ..CHECK_DELETE_ITEM.. " " ..POS_ID) player:sendCancelMessage("@MyOffertRefresh 01") return true end if _SLOT == 00 or _SLOT > 09 then _SLOT = 03 end local checkBuy = false if VIP_PAYMENT > 00 then if VIP_COINS >= vipPrice then checkBuy = true else player:popupFYI("Você não possui Vip Coins suficiente.") return false end else if myGold >= itemPrice then checkBuy = true else player:popupFYI("Você não possui dinheiro suficiente.") return false end end if checkBuy then local rare = result.getDataInt(Test, "uid_2") local star = result.getDataInt(Test, "uid_3") if doBackpack(player, 00, _SLOT, 00, 01) then if _SLOT == 03 then doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) -- Procurar if doBackpack(player, 01, _SLOT, 00, 0, ITEM_ID, rare, star, QNT_BUY) then player:getPosition():sendMagicEffect(14) if VIP_PAYMENT > 00 then PlayerVipCoins(player, 01, vipPrice) player:sendTextMessage(MESSAGE_INFO_DESCR, "Você comprou [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..vipPrice.. "] Vip Coin.") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. playerGuid .. ", 1, " ..ITEM_ID.. ", " ..QNT_BUY.. ", " ..vipPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..SELLER_NAME.. "', '" ..ANONYMOUS.. "', " ..VIP_PAYMENT.. ")") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. SELLER_ID .. ", 0, " ..ITEM_ID.. ", " ..QNT_BUY.. ", " ..vipPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..player:getName().. "', 0, " ..VIP_PAYMENT.. ")") else PlayerGoldCoins(player, 01, itemPrice) player:sendTextMessage(MESSAGE_INFO_DESCR, "Você comprou [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coin.") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. playerGuid .. ", 1, " ..ITEM_ID.. ", " ..QNT_BUY.. ", " ..itemPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..SELLER_NAME.. "', '" ..ANONYMOUS.. "', " ..VIP_PAYMENT.. ")") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. SELLER_ID .. ", 0, " ..ITEM_ID.. ", " ..QNT_BUY.. ", " ..itemPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..player:getName().. "', 0, " ..VIP_PAYMENT.. ")") end --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - itemPrice)) if _DEBUG_MODE then print("[CREATURESCRIPT - MARKET] " ..player:getName().. " - Comprou [ " .._ITEMS[ITEM_ID].NAME.. " x" ..QNT_BUY.. " ] por " ..mask_number(itemPrice).. " de " ..SELLER_NAME) end end else local PLAYER_EXT = doBackpack(player, 09) local PLAYER_POS = doBackpack(player, 08) if _SLOT == 04 then local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) if AtrAmmo < 00 then AtrAmmo = 01 end AtrAmmo = AtrAmmo * 500 local LimitBullet = AtrAmmo local market_ammo = result.getDataInt(Test, "uid_10") if market_ammo > LimitBullet then player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, market_ammo) end else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, market_ammo) end player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, result.getDataInt(Test, "uid_1")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, result.getDataInt(Test, "uid_2")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, result.getDataInt(Test, "uid_3")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, result.getDataInt(Test, "uid_4")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, result.getDataInt(Test, "uid_5")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, result.getDataInt(Test, "uid_6")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, result.getDataInt(Test, "uid_7")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, result.getDataInt(Test, "uid_8")) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, result.getDataInt(Test, "uid_9")) player:sendCancelMessage("@LootMSG " ..ITEM_ID.. " " ..rare.. " " ..star.. " 1") --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - itemPrice)) if VIP_PAYMENT > 00 then PlayerVipCoins(player, 01, vipPrice) player:sendTextMessage(MESSAGE_INFO_DESCR, "Você comprou [" .._ITEMS[ITEM_ID].NAME.. "] no Market por [" ..vipPrice.. "] Vip Coin.") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. playerGuid .. ", 1, " ..ITEM_ID.. ", 1, " ..vipPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..SELLER_NAME.. "', '" ..ANONYMOUS.. "', " ..VIP_PAYMENT.. ")") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. SELLER_ID .. ", 0, " ..ITEM_ID.. ", 1, " ..vipPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..player:getName().. "', 0, " ..VIP_PAYMENT.. ")") else PlayerGoldCoins(player, 01, itemPrice) player:sendTextMessage(MESSAGE_INFO_DESCR, "Você comprou [" .._ITEMS[ITEM_ID].NAME.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coin.") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. playerGuid .. ", 1, " ..ITEM_ID.. ", 1, " ..itemPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..SELLER_NAME.. "', '" ..ANONYMOUS.. "', " ..VIP_PAYMENT.. ")") db.query("INSERT INTO `market_hist` (`player_id`, `sale`, `itemtype`, `qnt`, `price`, `date`, `item_name`, `seller_name`, `anonymous`, `sale_type`) VALUES (" .. SELLER_ID .. ", 0, " ..ITEM_ID.. ", 1, " ..itemPrice.. ", " ..os.time().. ", '" .._ITEMS[ITEM_ID].NAME.. "', '" ..player:getName().. "', 0, " ..VIP_PAYMENT.. ")") end if _DEBUG_MODE then print("[CREATURESCRIPT - MARKET] " ..player:getName().. " - Comprou [ " .._ITEMS[ITEM_ID].NAME.. " ] por " ..mask_number(itemPrice).. " de " ..SELLER_NAME) end end local _cid = Player(SELLER_ID) if _cid then if _SLOT == 03 then --_cid:setStorageValue(_SYSTEM.GOLD_COIN, (_cid:getStorageValue(_SYSTEM.GOLD_COIN) + itemPrice)) if VIP_PAYMENT > 00 then PlayerVipCoins(_cid, 02, vipPrice) _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você acaba de vender [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..vipPrice.. "] Vip Coins.") else PlayerGoldCoins(_cid, 02, itemPrice) _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você acaba de vender [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coin.") end else --_cid:setStorageValue(_SYSTEM.GOLD_COIN, (_cid:getStorageValue(_SYSTEM.GOLD_COIN) + itemPrice)) if VIP_PAYMENT > 00 then PlayerVipCoins(_cid, 02, vipPrice) _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você acaba de vender [" .._ITEMS[ITEM_ID].NAME.. "] no Market por [" ..vipPrice.. "] Vip Coins.") else PlayerGoldCoins(_cid, 02, itemPrice) _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você acaba de vender [" .._ITEMS[ITEM_ID].NAME.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coin.") end end else if VIP_PAYMENT > 00 then local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_VIP.. " AND `player_id` = " ..SELLER_ID.. ");") if checkNotify then db.query("UPDATE `player_storage` SET `value` = " ..(result.getDataInt(checkNotify, "value") + vipPrice).. " WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_VIP.. " AND `player_id` = " ..SELLER_ID.. ");") else db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. SELLER_ID .. ", " .. _SYSTEM.NOTIFY_MARKET_VIP .. ", " ..vipPrice.. ")") end else local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_GOLD.. " AND `player_id` = " ..SELLER_ID.. ");") if checkNotify then db.query("UPDATE `player_storage` SET `value` = " ..(result.getDataInt(checkNotify, "value") + itemPrice).. " WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_GOLD.. " AND `player_id` = " ..SELLER_ID.. ");") else db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. SELLER_ID .. ", " .. _SYSTEM.NOTIFY_MARKET_GOLD .. ", " ..itemPrice.. ")") end end end if _SLOT == 03 then if QNT_BUY == QntSystem then CHECK_DELETE_ITEM = 01 db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. MARKET_ID .. ";") else db.query("UPDATE `market` SET `uid_4` = " ..(result.getDataInt(Test, "uid_4") - QNT_BUY).. " WHERE (`id` = " ..MARKET_ID.. " AND `player_id` = " ..SELLER_ID.. ");") end else db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. MARKET_ID .. ";") end local G = PlayerGoldCoins(player, 00) local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) player:sendCancelMessage("@LoadGold " ..G.. " " ..O) doBackpack(player, 11) doBackpack(player, 00, _SLOT, 00, 01) player:sendCancelMessage("@RemoveSlotsMarket 02 " ..CHECK_DELETE_ITEM.. " " ..POS_ID) player:sendCancelMessage("@MyOffertRefresh 01") return true else player:popupFYI("Sua backpack esta cheia.") return false end else player:popupFYI("Falha ao comprar este produto") return false end else player:popupFYI("Item não encontrado no sistema.\nEle pode ter sido vendido enquanto você confirmava a compra.") player:sendCancelMessage("@MyOffertRefresh 01") end end if opcode == OPCODE_HISTORY_MARKET then local playerGuid = player:getGuid() local History = db.storeQuery('SELECT * FROM `market_hist` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` DESC LIMIT 30;') if History then local i = 1 repeat player:sendCancelMessage("@HistoryLoad|" ..i.. "|" ..result.getDataInt(History, "id").. "|" ..result.getDataInt(History, "player_id").. "|" ..result.getDataInt(History, "sale").. "|" ..result.getDataInt(History, "itemtype").. "|" ..result.getDataInt(History, "qnt").. "|" ..result.getDataInt(History, "price").. "|" ..result.getDataInt(History, "date").. "|" ..result.getDataString(History, "item_name").. "|" ..result.getDataString(History, "seller_name").. "|" ..result.getDataString(History, "anonymous").. "|" ..result.getDataInt(History, "sale_type")) i = i + 1 until not result.next(History) result.free() player:sendCancelMessage("@ShowHistory 01") else player:sendCancelMessage("@ShowHistory 00") end end if opcode == OPCODE_PIX_EDIT then local split = buffer:splitTrimmed(",") local PLAYER_ACCOUNT = player:getAccountId() local NAME = split[01] local EMAIL = split[02] local BANK = split[03] db.query("UPDATE `accounts` SET `rlname` = '" ..NAME.. "', `vote` = '" ..EMAIL.. "', `location` = '" ..BANK.. "' WHERE `id` = " ..PLAYER_ACCOUNT.. ";") return true end if opcode == OPCODE_CRIPTOMOEDA then local split = buffer:splitTrimmed(",") local PLAYER_ACCOUNT = player:getAccountId() local FINAL_ID = tonumber(split[01]) local FINAL_VALOR = split[02] local FINAL_NAME = split[03] local FINAL_EMAIL = split[04] local FINAL_BANK = split[05] local FINAL_COIN = tonumber(split[06]) local FINAL_PRICE = split[07] local OLD_CRIPTO = tonumber(split[08]) local ITEM_ID = 00 local MAX_REQUEST = 00 if FINAL_ID == 01 then -- FAZENDO UMA SOLICITAÇÃO DE PAGAMENTO. local COUNT_REQUEST = db.storeQuery("SELECT id FROM links WHERE account_id = " ..PLAYER_ACCOUNT.. " AND status = 1 ORDER BY `id` ASC;") if COUNT_REQUEST then repeat MAX_REQUEST = MAX_REQUEST + 01 until not result.next(COUNT_REQUEST) result.free() end if MAX_REQUEST >= 10 then player:popupFYI("O máximo de solicitações por conta é 10.\nVocê atualmente possui [ " ..MAX_REQUEST.. " solicitações em aberto.") return true end local INSERINDO = nil if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) >= FINAL_COIN then INSERINDO = db.query("INSERT INTO `links` (`account_id`, `name`, `email`, `banco`, `criptomoeda`, `price`, `valor`, `status`, `obs`) VALUES (" .. PLAYER_ACCOUNT .. ", '" .. FINAL_NAME .. "', '" .. FINAL_EMAIL.. "', '" .. FINAL_BANK .. "', " .. FINAL_COIN .. ", '" .. FINAL_PRICE .. "', '" .. FINAL_VALOR .. "', 1, '')") if INSERINDO then player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) - FINAL_COIN)) player:sendCancelMessage("@StatusCript 01") doBackpack(player, 11) else player:sendCancelMessage("@StatusCript 02") return true end else player:sendCancelMessage("@StatusCript 02") return true end local BLACKMARKET = 0 local SALDO_BLACK = db.storeQuery("SELECT gender FROM accounts WHERE id = 1;") local CRIPTO = player:getStorageValue(_SYSTEM.CRIPTOMOEDA) if SALDO_BLACK then repeat BLACKMARKET = result.getDataString(SALDO_BLACK, "gender") until not result.next(SALDO_BLACK) result.free() end BLACKMARKET = BLACKMARKET - FINAL_VALOR player:sendCancelMessage("@CriptLoad-02-" ..CRIPTO.. "-" ..BLACKMARKET) db.query("UPDATE `accounts` SET `gender` = " ..BLACKMARKET.. " WHERE `id` = 1;") end if FINAL_ID == 02 then -- EDITANDO UMA SOLICITAÇÃO DE PAGAMENTO. ITEM_ID = tonumber(split[09]) local EDITANDO = nil EDITANDO = db.query("UPDATE `links` SET `name` = '" ..FINAL_NAME.. "', `email` = '" ..FINAL_EMAIL.. "', `banco` = '" ..FINAL_BANK.. "', `criptomoeda` = " ..FINAL_COIN.. ", `valor` = '" ..FINAL_VALOR.. "', `status` = 1, `obs` = '' WHERE `id` = " ..ITEM_ID.. ";") if EDITANDO then local OLD_FINAL_VALOR = split[10] local BLACKMARKET = 0 local SALDO_BLACK = db.storeQuery("SELECT gender FROM accounts WHERE id = 1;") if SALDO_BLACK then repeat BLACKMARKET = result.getDataString(SALDO_BLACK, "gender") until not result.next(SALDO_BLACK) result.free() end if FINAL_COIN > OLD_CRIPTO then local NEW_OLD_CRIPT = FINAL_COIN - OLD_CRIPTO BLACKMARKET = BLACKMARKET - (FINAL_VALOR - OLD_FINAL_VALOR) player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) - NEW_OLD_CRIPT)) else local NEW_OLD_CRIPT = OLD_CRIPTO - FINAL_COIN BLACKMARKET = BLACKMARKET + (OLD_FINAL_VALOR - FINAL_VALOR) if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) < 00 then player:setStorageValue(_SYSTEM.CRIPTOMOEDA, ((player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + NEW_OLD_CRIPT) + 01)) else player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + NEW_OLD_CRIPT)) end end db.query("UPDATE `accounts` SET `gender` = " ..BLACKMARKET.. " WHERE `id` = 1;") player:sendCancelMessage("@StatusCript 03") doBackpack(player, 11) else player:sendCancelMessage("@StatusCript 04") return true end end if FINAL_ID == 03 then ITEM_ID = tonumber(split[09]) db.asyncQuery("DELETE FROM `links` WHERE `id` = " .. ITEM_ID .. ";") if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) < 00 then player:setStorageValue(_SYSTEM.CRIPTOMOEDA, ((player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + FINAL_COIN) + 01)) else player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + FINAL_COIN)) end player:sendCancelMessage("@StatusCript 05") doBackpack(player, 11) end -- REGISTRANDO QUEM FEZ O PEDIDO. local file = io.open("data/reports/criptomoeda/criptomoeda.txt", "a") if not file then print("Houve um erro em seu processo de report. Por favor, contate o administrador.") player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Houve um erro em seu processo de report. Por favor, contate o administrador.") return true end local CriptMount = 01 if player:getLevel() < 100 then CriptMount = 0.05 elseif player:getLevel() < 200 then CriptMount = 0.06 elseif player:getLevel() < 300 then CriptMount = 0.07 elseif player:getLevel() < 400 then CriptMount = 0.08 elseif player:getLevel() < 500 then CriptMount = 0.09 elseif player:getLevel() < 600 then CriptMount = 0.10 elseif player:getLevel() < 700 then CriptMount = 0.11 elseif player:getLevel() < 800 then CriptMount = 0.12 elseif player:getLevel() < 900 then CriptMount = 0.13 elseif player:getLevel() < 999 then CriptMount = 0.14 elseif player:getLevel() > 999 then CriptMount = 0.15 end io.output(file) io.write("Name: " .. name) io.write("\n" ..DIAS_SEMANA[Semana].. ", " ..Dia.. " de " ..MES_NAME[Mes].. ", as " ..HourMinutes) if FINAL_ID == 01 then local REQUEST = db.storeQuery("SELECT id FROM links WHERE account_id = " ..PLAYER_ACCOUNT.. " ORDER BY `id` ASC;") if REQUEST then local i = 1 repeat ITEM_ID = result.getDataInt(REQUEST, "id") i = i + 1 until not result.next(REQUEST) result.free() end io.write("\nTipo: Fazendo Pedido [ID: " ..ITEM_ID.. "]") io.write("\nO jogador [ " .. FINAL_NAME .. " ] realizou um pedido de pagamento no valor de [ R$ " .. FINAL_VALOR .. " ] usando [ " .. FINAL_COIN .. " ] criptomoedas sob o preço fixo de [ " ..FINAL_PRICE.. " ] e estando no Level [ " ..player:getLevel().. " (" ..CriptMount.. ")].\n\n") elseif FINAL_ID == 02 then io.write("\nTipo: Editando Pedido [ID: " ..ITEM_ID.. "]") io.write("\nO jogador [ " .. FINAL_NAME .. " ] alterou um pedido de pagamento de [ R$ " .. (OLD_CRIPTO * FINAL_PRICE) .. " para R$ " .. FINAL_VALOR .. " ] gastando [ " ..FINAL_COIN.. " ] criptomoedas. Seu saldo final de criptomoedas é de [ " ..player:getStorageValue(_SYSTEM.CRIPTOMOEDA).. " ].\n\n") else io.write("\nTipo: Excluindo Pedido [ID: " ..ITEM_ID.. "]") io.write("\nO jogador [ " .. FINAL_NAME .. " ] excluiu seu pedido de pagamento no valor de [ R$ " .. FINAL_VALOR .. " ]. Ele recuperou [ " ..FINAL_COIN.. " ] criptomoedas. Seu saldo final de criptomoedas é de [ " ..player:getStorageValue(_SYSTEM.CRIPTOMOEDA).. " ].\n\n") end io.write("------------------------------------------------\n\n") io.close(file) end if opcode == CRIPTOMOEDA_OPCODE then local split = buffer:splitTrimmed(",") local ACTION_ID = tonumber(split[01]) if ACTION_ID < 05 then local REQUEST = db.storeQuery("SELECT * FROM links WHERE status = " ..ACTION_ID.. " ORDER BY `id` ASC;") if REQUEST then local i = 1 repeat local A = result.getDataInt(REQUEST, "id") local B = result.getDataInt(REQUEST, "account_id") local C = result.getDataString(REQUEST, "name") local D = result.getDataString(REQUEST, "email") local E = result.getDataString(REQUEST, "banco") local F = result.getDataInt(REQUEST, "criptomoeda") local G = result.getDataString(REQUEST, "price") local H = result.getDataString(REQUEST, "valor") local I = result.getDataInt(REQUEST, "status") local J = result.getDataString(REQUEST, "obs") player:sendCancelMessage("@LinksLoad-" ..i.. "-" ..A.. "-" ..B.. "-" ..C.. "-" ..D.. "-" ..E.. "-" ..F.. "-" ..G.. "-" ..H.. "-" ..I.. "-" ..J) i = i + 1 until not result.next(REQUEST) result.free() else player:sendCancelMessage("@DelLinks") end return true else local STATUS = split[02] local EDIT_ID = tonumber(split[03]) local LAST_STATUS = split[04] local STATUS_OBS = split[05] if STATUS_OBS == nil then STATUS_OBS = '' end if STATUS == "04" then STATUS_OBS = STATUS_OBS.. "\nPagamento realizado [ " ..DIAS_SEMANA[Semana].. ", " ..Dia.. " de " ..MES_NAME[Mes].. " de 20" ..Ano.. ", as " ..HourMinutes.. " ]" end db.query("UPDATE `links` SET `status` = " ..STATUS.. ", `obs` = '" ..STATUS_OBS.. "' WHERE `id` = " ..EDIT_ID.. ";") player:sendCancelMessage("@DelLinks") local REQUEST_EDIT = db.storeQuery("SELECT * FROM links WHERE status = " ..LAST_STATUS.. " ORDER BY `id` ASC;") if REQUEST_EDIT then local i = 1 repeat local A = result.getDataInt(REQUEST_EDIT, "id") local B = result.getDataInt(REQUEST_EDIT, "account_id") local C = result.getDataString(REQUEST_EDIT, "name") local D = result.getDataString(REQUEST_EDIT, "email") local E = result.getDataString(REQUEST_EDIT, "banco") local F = result.getDataInt(REQUEST_EDIT, "criptomoeda") local G = result.getDataString(REQUEST_EDIT, "price") local H = result.getDataString(REQUEST_EDIT, "valor") local I = result.getDataInt(REQUEST_EDIT, "status") local J = result.getDataString(REQUEST_EDIT, "obs") player:sendCancelMessage("@LinksLoad-" ..i.. "-" ..A.. "-" ..B.. "-" ..C.. "-" ..D.. "-" ..E.. "-" ..F.. "-" ..G.. "-" ..H.. "-" ..I.. "-" ..J) i = i + 1 until not result.next(REQUEST_EDIT) result.free() end return true end end if opcode == BLACKMARKET_OPCODE then local split = buffer:splitTrimmed(",") local BLACK_VALOR = split[01] db.query("UPDATE `accounts` SET `gender` = " ..BLACK_VALOR.. " WHERE `id` = 1;") local players = Game.getPlayers() for _, targetPlayer in ipairs(players) do targetPlayer:sendCancelMessage("@CriptLoad-02-" ..targetPlayer:getStorageValue(_SYSTEM.CRIPTOMOEDA).. "-" ..BLACK_VALOR) end player:popupFYI("Fundos adicionados com sucesso.") return end if opcode == MONITORANDO_ITEMS then local split = buffer:splitTrimmed(",") local ACTION = tonumber(split[01]) if ACTION == 01 then local MON_ITEMID = tonumber(split[02]) local MON_TYPE = tonumber(split[03]) local players = Game.getPlayers() for _, targetPlayer in ipairs(players) do for X = 01, 03 do if X == 01 then -- ITEM EQUIPADO if targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_01) == MON_ITEMID then local UID_02 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_02) local UID_03 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_03) local UID_04 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_04) local UID_05 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_05) local UID_06 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_06) local UID_07 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_07) local UID_08 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_08) local UID_09 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_09) local UID_10 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_10) player:sendCancelMessage("@MonItems-" ..targetPlayer:getName().. "-Equipado-0-0-" ..UID_02.. "-" ..UID_03.. "-" ..UID_04.. "-" ..UID_05.. "-" ..UID_06.. "-" ..UID_07.. "-" ..UID_08.. "-" ..UID_09.. "-" ..UID_10) end end if X == 02 then -- ITEM NA BACKPACK for _SLOT = 00, 03 do for _BAG = 01, 20 do if targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_01) == MON_ITEMID then local UID_02 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_02) local UID_03 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_03) local UID_04 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_04) local UID_05 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_05) local UID_06 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_06) local UID_07 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_07) local UID_08 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_08) local UID_09 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_09) local UID_10 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_10) player:sendCancelMessage("@MonItems-" ..targetPlayer:getName().. "-Backpack-" .._SLOT.. "-" .._BAG.. "-" ..UID_02.. "-" ..UID_03.. "-" ..UID_04.. "-" ..UID_05.. "-" ..UID_06.. "-" ..UID_07.. "-" ..UID_08.. "-" ..UID_09.. "-" ..UID_10) end end end end if X == 03 then -- ITEM NO DEPOT for _SLOT = 01, #_SYSTEM.DEPOT[01] do if targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_01) == MON_ITEMID then local UID_02 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_02) local UID_03 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_03) local UID_04 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_04) local UID_05 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_05) local UID_06 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_06) local UID_07 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_07) local UID_08 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_08) local UID_09 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_09) local UID_10 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_10) player:sendCancelMessage("@MonItems-" ..targetPlayer:getName().. "-Depot-1-" .._SLOT.. "-" ..UID_02.. "-" ..UID_03.. "-" ..UID_04.. "-" ..UID_05.. "-" ..UID_06.. "-" ..UID_07.. "-" ..UID_08.. "-" ..UID_09.. "-" ..UID_10) end end end end end player:sendCancelMessage("@LoadMonItems 01") end if ACTION == 02 then local tid = Player(split[02]) if(not tid) then player:popupFYI("Player " .. split[01] .. " not found.") return false end local TARGET = split[04] local SLOT = tonumber(split[03]) local EXT = tonumber(split[05]) local BAG = tonumber(split[06]) if TARGET == "Equipado" then tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_01, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_02, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_03, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_04, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_05, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_06, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_07, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_08, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_09, nil) tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_10, nil) doInventario(tid, 00, SLOT, EXT) -- Organizo Inventário doBackpack(tid, 00, SLOT, EXT, 01) -- Organizo Backpack if SLOT == 04 then tid:sendCancelMessage("@LoadAmmo " ..tid:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10)) end tid:sendCancelMessage("@RemoveItemInventario " ..SLOT) player:sendCancelMessage("@LoadMonItems 02") return true end if TARGET == "Backpack" then doBackpack(tid, 02, SLOT, EXT, BAG) doBackpack(tid, 00, SLOT, EXT, 01) tid:sendCancelMessage("@ReloadBackpack " ..SLOT.. " 01 01") player:sendCancelMessage("@LoadMonItems 02") return true end if TARGET == "Depot" then tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_01, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_02, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_03, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_04, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_05, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_06, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_07, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_08, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_09, nil) tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_10, nil) onDepot(tid, 00, 01) player:sendCancelMessage("@LoadMonItems 02") return true end end if ACTION == 03 then local MON_SHOP = db.storeQuery("SELECT * FROM coins_transactions ORDER BY `id` DESC LIMIT 99;") if MON_SHOP then local i = 0 local offertLimit = 99 repeat local ID = result.getDataInt(MON_SHOP, "id") local PLAYER_GUID = result.getDataInt(MON_SHOP, "account_id") local CATEGORY = result.getDataInt(MON_SHOP, "type") local INDEX = result.getDataInt(MON_SHOP, "amount") local ITEM_NAME = result.getDataString(MON_SHOP, "description") player:sendCancelMessage("@MonShop-1-" ..ID.. "-" ..PLAYER_GUID.. "-" ..CATEGORY.. "-" ..INDEX.. "-" ..ITEM_NAME) i = i + 1 until not result.next(MON_SHOP) or i > offertLimit result.free() player:sendCancelMessage("@MonShop-2") end end if ACTION == 04 then local playerCrypt = {} local totalCrypt = 00 local totalSaldo = 00 local ESTIMATIVA = db.storeQuery("SELECT * FROM `player_storage` WHERE `key` = " .. _SYSTEM.CRIPTOMOEDA .. ";") if ESTIMATIVA then local i = 0 repeat local PLA_ID = result.getDataInt(ESTIMATIVA, "player_id") local QUANT = result.getDataInt(ESTIMATIVA, "value") totalCrypt = totalCrypt + QUANT table.insert(playerCrypt, PLA_ID.. "|" ..QUANT) until not result.next(ESTIMATIVA) result.free() end for X = 01, #playerCrypt do local str = playerCrypt[X] local trim = str:splitTrimmed("|") local playerGuid = tonumber(trim[01]) local playerCriptomoeda = tonumber(trim[02]) local LEVEL_PLAYER_OFF = db.storeQuery("SELECT level FROM `players` WHERE `id` = " .. playerGuid .. ";") if LEVEL_PLAYER_OFF then local LEVEL = result.getDataInt(LEVEL_PLAYER_OFF, "level") local CriptoPrice = 00 if LEVEL < 100 then CriptoPrice = 0.05 elseif LEVEL < 200 then CriptoPrice = 0.06 elseif LEVEL < 300 then CriptoPrice = 0.07 elseif LEVEL < 400 then CriptoPrice = 0.08 elseif LEVEL < 500 then CriptoPrice = 0.09 elseif LEVEL < 600 then CriptoPrice = 0.10 elseif LEVEL < 700 then CriptoPrice = 0.11 elseif LEVEL < 800 then CriptoPrice = 0.12 elseif LEVEL < 900 then CriptoPrice = 0.13 elseif LEVEL < 999 then CriptoPrice = 0.14 elseif LEVEL > 999 then CriptoPrice = 0.15 else CriptoPrice = 0 end totalSaldo = totalSaldo + (playerCriptomoeda * CriptoPrice) end end player:sendCancelMessage("@EstimativaCrypt " ..totalCrypt.. " " ..totalSaldo) end if ACTION == 05 then local MON_ITEMID = tonumber(split[02]) local MON_TYPE = tonumber(split[03]) local DATA = tonumber(split[04]) local players = Game.getPlayers() for _, targetPlayer in ipairs(players) do for X = 01, 03 do if X == 01 then -- ITEM EQUIPADO if targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_01) == MON_ITEMID then if targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_08) == DATA then local UID_02 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_02) local UID_03 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_03) local UID_04 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_04) local UID_05 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_05) local UID_06 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_06) local UID_07 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_07) local UID_08 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_08) local UID_09 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_09) local UID_10 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_10) player:sendCancelMessage("@MonItems-" ..targetPlayer:getName().. "-Equipado-0-0-" ..UID_02.. "-" ..UID_03.. "-" ..UID_04.. "-" ..UID_05.. "-" ..UID_06.. "-" ..UID_07.. "-" ..UID_08.. "-" ..UID_09.. "-" ..UID_10) end end end if X == 02 then -- ITEM NA BACKPACK for _SLOT = 00, 03 do for _BAG = 01, 20 do if targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_01) == MON_ITEMID then if targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_08) == DATA then local UID_02 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_02) local UID_03 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_03) local UID_04 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_04) local UID_05 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_05) local UID_06 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_06) local UID_07 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_07) local UID_08 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_08) local UID_09 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_09) local UID_10 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_10) player:sendCancelMessage("@MonItems-" ..targetPlayer:getName().. "-Backpack-" .._SLOT.. "-" .._BAG.. "-" ..UID_02.. "-" ..UID_03.. "-" ..UID_04.. "-" ..UID_05.. "-" ..UID_06.. "-" ..UID_07.. "-" ..UID_08.. "-" ..UID_09.. "-" ..UID_10) end end end end end if X == 03 then -- ITEM NO DEPOT for _SLOT = 01, #_SYSTEM.DEPOT[01] do if targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_01) == MON_ITEMID then if targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_08) == DATA then local UID_02 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_02) local UID_03 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_03) local UID_04 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_04) local UID_05 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_05) local UID_06 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_06) local UID_07 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_07) local UID_08 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_08) local UID_09 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_09) local UID_10 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_10) player:sendCancelMessage("@MonItems-" ..targetPlayer:getName().. "-Depot-1-" .._SLOT.. "-" ..UID_02.. "-" ..UID_03.. "-" ..UID_04.. "-" ..UID_05.. "-" ..UID_06.. "-" ..UID_07.. "-" ..UID_08.. "-" ..UID_09.. "-" ..UID_10) end end end end end end player:sendCancelMessage("@LoadMonItems 01") end end if opcode == MENSAGEM_RESPOSTA then local split = buffer:splitTrimmed(",") local FILTRO_MSG = tonumber(split[01]) local FILTRO_RESP = tonumber(split[02]) if FILTRO_MSG == -1 then local MSG = split[03] local TARGET_NAME = split[04] local TARGET_ID = tonumber(split[05]) local CHECK_RESPOSTA = db.query("UPDATE `email_news` SET `resposta` = '" ..MSG.. "', `lida` = 0 WHERE `id` = " ..FILTRO_RESP.. ";") if CHECK_RESPOSTA then player:sendCancelMessage("@MonitMsg|02") local cid = Player(TARGET_NAME) if(not cid) then local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.MESSAGE_ALERT.. " AND `player_id` = " ..TARGET_ID.. ");") if checkNotify then db.query("UPDATE `player_storage` SET `value` = 1 WHERE (`key` = " .._SYSTEM.MESSAGE_ALERT.. " AND `player_id` = " ..TARGET_ID.. ");") else db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. TARGET_ID .. ", " .. _SYSTEM.MESSAGE_ALERT .. ", 1)") end else cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você possui um novo email em sua Caixa de Mensagem.\nDigite Ctrl + Z para verificar.") end return true else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Erro ao confirmar essa mensagem.") return true end return true end local LOAD_MSG = false if FILTRO_MSG == 00 then if FILTRO_RESP == 00 then LOAD_MSG = db.storeQuery('SELECT * FROM `email_news` WHERE `type` <> 4 AND `resposta` = "";') else LOAD_MSG = db.storeQuery('SELECT * FROM `email_news` WHERE `type` <> 4 AND `resposta` <> "";') end else if FILTRO_RESP == 00 then LOAD_MSG = db.storeQuery('SELECT * FROM `email_news` WHERE `type` = ' ..FILTRO_MSG .. ' AND `resposta` = "";') else LOAD_MSG = db.storeQuery('SELECT * FROM `email_news` WHERE `type` = ' ..FILTRO_MSG .. ' AND `resposta` <> "";') end end if LOAD_MSG then local i = 1 local offertLimit = 50 repeat local A = result.getDataInt(LOAD_MSG, "id") local B = result.getDataInt(LOAD_MSG, "type") local C = result.getDataInt(LOAD_MSG, "player_id") local D = result.getDataString(LOAD_MSG, "name") local E = result.getDataInt(LOAD_MSG, "target_id") local F = result.getDataString(LOAD_MSG, "target_name") local G = result.getDataString(LOAD_MSG, "title") local H = result.getDataString(LOAD_MSG, "message") local I = result.getDataString(LOAD_MSG, "resposta") local J = result.getDataString(LOAD_MSG, "box_1") local K = result.getDataString(LOAD_MSG, "box_2") local L = result.getDataString(LOAD_MSG, "box_3") local M = result.getDataString(LOAD_MSG, "box_4") local N = result.getDataInt(LOAD_MSG, "gold") local O = result.getDataInt(LOAD_MSG, "vip") local P = result.getDataInt(LOAD_MSG, "lida") local Q = result.getDataInt(LOAD_MSG, "box_check") local R = result.getDataInt(LOAD_MSG, "del_msg") local S = result.getDataInt(LOAD_MSG, "del_resp") player:sendCancelMessage("@MonitMsg|00|" ..i.. "|" ..A.. "|" ..B.. "|" ..C.. "|" ..D.. "|" ..E.. "|" ..F.. "|" ..G.. "|" ..H.. "|" ..I.. "|" ..J.. "|" ..K.. "|" ..L.. "|" ..M.. "|" ..N.. "|" ..O.. "|" ..P.. "|" ..Q.. "|" ..R.. "|" ..S) i = i + 1 until not result.next(LOAD_MSG) or i > offertLimit result.free() player:sendCancelMessage("@MonitMsg|01") return true end return true end if opcode == BOT_MONITORAMENTO then local split = buffer:splitTrimmed(",") local BotV8 = tonumber(split[01]) local ClientType = tonumber(split[02]) local getFollow = tonumber(split[03]) BOT_NAME = split[04] BOT_POSX = tonumber(split[05]) BOT_POSY = tonumber(split[06]) BOT_POSZ = tonumber(split[07]) GM_NAME = split[08] local GM = Player(GM_NAME) if(not GM) then local GET_BOT = Player(BOT_NAME) if(not GET_BOT) then return true else GET_BOT:sendCancelMessage("@BotCheck-02") end else stopEvent(CHECK_CUSTOM_CLIENT) CHECK_CUSTOM_CLIENT = nil GM:sendCancelMessage("@MonitBot#1#" ..BotV8.. "#" ..ClientType.. "#" ..getFollow.. "#" ..BOT_NAME) end end if opcode == BOT_PLAYER_MONIT then local split = buffer:splitTrimmed(",") local TARGET_NAME = split[01] local GM_NAME = split[02] local ACTION = tonumber(split[03]) if ACTION ~= 04 then if player:getGroup():getId() < 3 then return true end end local tid = Player(TARGET_NAME) if(not tid) then if ACTION == 04 then return true else player:sendCancelMessage("@MonitBot#4") player:popupFYI("Este jogador não existe ou está offline.") return true end else if ACTION == 01 then tid:sendCancelMessage("@BotCheck-01-" ..GM_NAME) CHECK_CUSTOM_CLIENT = addEvent(function() player:sendCancelMessage("@MonitBot#3") end, 3000) elseif ACTION == 03 then tid:sendCancelMessage("@BotCheck-03-" ..GM_NAME) elseif ACTION == 04 then tid:sendCancelMessage("@MonitBot#5") else tid:sendCancelMessage("@BotCheck-02") return true end return false end end if opcode == BOT_WALK_KEYPRESS then local split = buffer:splitTrimmed(",") local KEYPRESS = tonumber(split[01]) local NEW_POSX = tonumber(split[02]) local NEW_POSY = tonumber(split[03]) local NEW_POSZ = tonumber(split[04]) local CHE_NAME = split[05] local BotV8 = tonumber(split[06]) local AutoTarget = tonumber(split[07]) local AutoCura = tonumber(split[08]) local cid = Player(CHE_NAME) if(not cid) then player:popupFYI("Jogador não encontrado.") return true else local GM = Player(GM_NAME) if(not GM) then cid:sendCancelMessage("@BotCheck-02") return true else if NEW_POSX ~= BOT_POSX or NEW_POSY ~= BOT_POSY or NEW_POSZ ~= BOT_POSZ then BOT_POSX = NEW_POSX BOT_POSY = NEW_POSY BOT_POSZ = NEW_POSZ GM:sendCancelMessage("@MonitBot#2#" ..KEYPRESS.. "#1#" ..BotV8.. "#" ..AutoTarget.. "#" ..AutoCura) else GM:sendCancelMessage("@MonitBot#2#" ..KEYPRESS.. "#0#" ..BotV8.. "#" ..AutoTarget.. "#" ..AutoCura) end end end end if opcode == MESSAGE_BOX then local split = buffer:splitTrimmed("|") local TYPE = tonumber(split[01]) local playerGuid = player:getGuid() if TYPE == 99 then local ID = tonumber(split[02]) local BOX_1 = split[03] or "0" local BOX_2 = split[04] or "0" local BOX_3 = split[05] or "0" local BOX_4 = split[06] or "0" local CHECK_LIDA = db.query("UPDATE `email_news` SET `lida` = 1, `box_check` = 1 WHERE (`id` = " ..ID.. " AND `target_id` = " ..playerGuid.. " OR `player_id` = " ..playerGuid.. ");") if CHECK_LIDA then if BOX_1 ~= "0" then local REC = BOX_1:splitTrimmed("-") local UID_01 = tonumber(REC[01]) local UID_02 = tonumber(REC[02]) local UID_03 = tonumber(REC[03]) local UID_04 = tonumber(REC[04]) local UID_05 = tonumber(REC[05]) local UID_06 = tonumber(REC[06]) local UID_07 = tonumber(REC[07]) local UID_08 = tonumber(REC[08]) local UID_09 = tonumber(REC[09]) local UID_10 = tonumber(REC[10]) local _SLOT = tonumber(REC[11]) local _EXT = tonumber(REC[12]) local _POS_SLOT = tonumber(REC[13]) doBackpack(player, 00, _SLOT, 00, 01) local PLAYER_EXT = doBackpack(player, 09) local PLAYER_POS = doBackpack(player, 08) if _SLOT == 03 then local ITEM_ID = UID_01 local ITEM_RAR = UID_02 local ITEM_STA = UID_03 local _QNT = UID_04 doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) else if _SLOT == 04 then local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) if AtrAmmo < 00 then AtrAmmo = 01 end AtrAmmo = AtrAmmo * 500 local LimitBullet = AtrAmmo if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) end else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) end player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, UID_01) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, UID_02) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, UID_03) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, UID_04) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, UID_05) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, UID_06) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, UID_07) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, UID_08) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, UID_09) local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") end end if BOX_2 ~= "0" then local REC = BOX_2:splitTrimmed("-") local UID_01 = tonumber(REC[01]) local UID_02 = tonumber(REC[02]) local UID_03 = tonumber(REC[03]) local UID_04 = tonumber(REC[04]) local UID_05 = tonumber(REC[05]) local UID_06 = tonumber(REC[06]) local UID_07 = tonumber(REC[07]) local UID_08 = tonumber(REC[08]) local UID_09 = tonumber(REC[09]) local UID_10 = tonumber(REC[10]) local _SLOT = tonumber(REC[11]) local _EXT = tonumber(REC[12]) local _POS_SLOT = tonumber(REC[13]) doBackpack(player, 00, _SLOT, 00, 01) local PLAYER_EXT = doBackpack(player, 09) local PLAYER_POS = doBackpack(player, 08) if _SLOT == 03 then local ITEM_ID = UID_01 local ITEM_RAR = UID_02 local ITEM_STA = UID_03 local _QNT = UID_04 doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) else if _SLOT == 04 then local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) if AtrAmmo < 00 then AtrAmmo = 01 end AtrAmmo = AtrAmmo * 500 local LimitBullet = AtrAmmo if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) end else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) end player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, UID_01) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, UID_02) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, UID_03) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, UID_04) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, UID_05) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, UID_06) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, UID_07) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, UID_08) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, UID_09) local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") end end if BOX_3 ~= "0" then local REC = BOX_3:splitTrimmed("-") local UID_01 = tonumber(REC[01]) local UID_02 = tonumber(REC[02]) local UID_03 = tonumber(REC[03]) local UID_04 = tonumber(REC[04]) local UID_05 = tonumber(REC[05]) local UID_06 = tonumber(REC[06]) local UID_07 = tonumber(REC[07]) local UID_08 = tonumber(REC[08]) local UID_09 = tonumber(REC[09]) local UID_10 = tonumber(REC[10]) local _SLOT = tonumber(REC[11]) local _EXT = tonumber(REC[12]) local _POS_SLOT = tonumber(REC[13]) doBackpack(player, 00, _SLOT, 00, 01) local PLAYER_EXT = doBackpack(player, 09) local PLAYER_POS = doBackpack(player, 08) if _SLOT == 03 then local ITEM_ID = UID_01 local ITEM_RAR = UID_02 local ITEM_STA = UID_03 local _QNT = UID_04 doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) else if _SLOT == 04 then local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) if AtrAmmo < 00 then AtrAmmo = 01 end AtrAmmo = AtrAmmo * 500 local LimitBullet = AtrAmmo if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) end else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) end player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, UID_01) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, UID_02) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, UID_03) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, UID_04) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, UID_05) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, UID_06) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, UID_07) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, UID_08) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, UID_09) local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") end end if BOX_4 ~= "0" then local REC = BOX_4:splitTrimmed("-") local UID_01 = tonumber(REC[01]) local UID_02 = tonumber(REC[02]) local UID_03 = tonumber(REC[03]) local UID_04 = tonumber(REC[04]) local UID_05 = tonumber(REC[05]) local UID_06 = tonumber(REC[06]) local UID_07 = tonumber(REC[07]) local UID_08 = tonumber(REC[08]) local UID_09 = tonumber(REC[09]) local UID_10 = tonumber(REC[10]) local _SLOT = tonumber(REC[11]) local _EXT = tonumber(REC[12]) local _POS_SLOT = tonumber(REC[13]) doBackpack(player, 00, _SLOT, 00, 01) local PLAYER_EXT = doBackpack(player, 09) local PLAYER_POS = doBackpack(player, 08) if _SLOT == 03 then local ITEM_ID = UID_01 local ITEM_RAR = UID_02 local ITEM_STA = UID_03 local _QNT = UID_04 doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) else if _SLOT == 04 then local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) if AtrAmmo < 00 then AtrAmmo = 01 end AtrAmmo = AtrAmmo * 500 local LimitBullet = AtrAmmo if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) end else player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) end player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, UID_01) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, UID_02) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, UID_03) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, UID_04) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, UID_05) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, UID_06) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, UID_07) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, UID_08) player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, UID_09) local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") end end return true else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Erro ao confirmar essa mensagem.") return true end end if TYPE == 98 then local ID = tonumber(split[02]) local DELET = tonumber(split[03]) local CHECK_DELETE = false if DELET == 00 then CHECK_DELETE = db.query("UPDATE `email_news` SET `del_msg` = 1 WHERE (`id` = " ..ID.. " AND `player_id` = " ..playerGuid.. ");") else CHECK_DELETE = db.query("UPDATE `email_news` SET `del_resp` = 1 WHERE (`id` = " ..ID.. " AND `target_id` = " ..playerGuid.. ");") end if CHECK_DELETE then player:sendCancelMessage("@Notice|02") return true else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Erro ao confirmar essa mensagem.") return true end return true end if TYPE == 05 then local LOAD_MESSAGE = db.storeQuery('SELECT * FROM `email_news` WHERE `player_id` = ' ..playerGuid .. ' OR `target_id` = ' ..playerGuid .. ' ORDER BY `id` DESC LIMIT 50;') if LOAD_MESSAGE then local offertLimit = 50 local i = 1 repeat local A = result.getDataInt(LOAD_MESSAGE, "id") local B = result.getDataInt(LOAD_MESSAGE, "type") local C = result.getDataInt(LOAD_MESSAGE, "player_id") local D = result.getDataString(LOAD_MESSAGE, "name") local E = result.getDataInt(LOAD_MESSAGE, "target_id") local F = result.getDataString(LOAD_MESSAGE, "target_name") local G = result.getDataString(LOAD_MESSAGE, "title") local H = result.getDataString(LOAD_MESSAGE, "message") local I = result.getDataString(LOAD_MESSAGE, "resposta") local J = result.getDataString(LOAD_MESSAGE, "box_1") local K = result.getDataString(LOAD_MESSAGE, "box_2") local L = result.getDataString(LOAD_MESSAGE, "box_3") local M = result.getDataString(LOAD_MESSAGE, "box_4") local N = result.getDataInt(LOAD_MESSAGE, "gold") local O = result.getDataInt(LOAD_MESSAGE, "vip") local P = result.getDataInt(LOAD_MESSAGE, "lida") local Q = result.getDataInt(LOAD_MESSAGE, "box_check") local R = result.getDataInt(LOAD_MESSAGE, "del_msg") local S = result.getDataInt(LOAD_MESSAGE, "del_resp") player:sendCancelMessage("@Notice|00|" ..i.. "|" ..A.. "|" ..B.. "|" ..C.. "|" ..D.. "|" ..E.. "|" ..F.. "|" ..G.. "|" ..H.. "|" ..I.. "|" ..J.. "|" ..K.. "|" ..L.. "|" ..M.. "|" ..N.. "|" ..O.. "|" ..P.. "|" ..Q.. "|" ..R.. "|" ..S) i = i + 1 until not result.next(LOAD_MESSAGE) or i > offertLimit result.free() end player:sendCancelMessage("@Notice|01") return true end if TYPE == 04 then local TARGET_NAME = split[02] local TITLE = split[03] local MSG = split[04] local BOX_1 = split[05] local BOX_2 = split[06] local BOX_3 = split[07] local BOX_4 = split[08] local GOLD = tonumber(split[09]) local VIP = tonumber(split[10]) local TARGET_ID = 00 local DESTINATARIO = db.storeQuery('SELECT id FROM `players` WHERE `name` = "' ..TARGET_NAME .. '";') TARGET_ID = result.getDataInt(DESTINATARIO, "id") if TARGET_ID == 00 then return true end if DESTINATARIO then local CHECK_ITEM, CHECK_QNT = false, false if BOX_1 ~= "0" then local REC = BOX_1:splitTrimmed("-") local UID_01 = tonumber(REC[01]) local UID_02 = tonumber(REC[02]) local UID_03 = tonumber(REC[03]) local UID_04 = tonumber(REC[04]) local UID_05 = tonumber(REC[05]) local UID_06 = tonumber(REC[06]) local UID_07 = tonumber(REC[07]) local UID_08 = tonumber(REC[08]) local UID_09 = tonumber(REC[09]) local UID_10 = tonumber(REC[10]) local SLOT = tonumber(REC[11]) local EXT = tonumber(REC[12]) local POS = tonumber(REC[13]) if UID_01 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01) then if UID_02 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02) then if UID_03 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03) then if SLOT == 03 then if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) >= UID_04 then CHECK_QNT = true end else if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) == UID_04 then CHECK_QNT = true end end if UID_05 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05) then if UID_06 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06) then if UID_07 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07) then if UID_08 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08) then if UID_09 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09) then if UID_10 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10) then if CHECK_QNT then if SLOT == 03 then if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) > UID_04 then player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, (player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) - UID_04)) else player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) end else player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) end CHECK_ITEM = true end end end end end end end end end end else CHECK_ITEM = true end if CHECK_ITEM then CHECK_ITEM = false CHECK_QNT = false if BOX_2 ~= "0" then local REC = BOX_2:splitTrimmed("-") local UID_01 = tonumber(REC[01]) local UID_02 = tonumber(REC[02]) local UID_03 = tonumber(REC[03]) local UID_04 = tonumber(REC[04]) local UID_05 = tonumber(REC[05]) local UID_06 = tonumber(REC[06]) local UID_07 = tonumber(REC[07]) local UID_08 = tonumber(REC[08]) local UID_09 = tonumber(REC[09]) local UID_10 = tonumber(REC[10]) local SLOT = tonumber(REC[11]) local EXT = tonumber(REC[12]) local POS = tonumber(REC[13]) if UID_01 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01) then if UID_02 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02) then if UID_03 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03) then if SLOT == 03 then if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) >= UID_04 then CHECK_QNT = true end else if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) == UID_04 then CHECK_QNT = true end end if UID_05 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05) then if UID_06 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06) then if UID_07 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07) then if UID_08 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08) then if UID_09 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09) then if UID_10 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10) then if CHECK_QNT then if SLOT == 03 then if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) > UID_04 then player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, (player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) - UID_04)) else player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) end else player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) end CHECK_ITEM = true end end end end end end end end end end else CHECK_ITEM = true end if CHECK_ITEM then CHECK_ITEM = false CHECK_QNT = false if BOX_3 ~= "0" then local REC = BOX_3:splitTrimmed("-") local UID_01 = tonumber(REC[01]) local UID_02 = tonumber(REC[02]) local UID_03 = tonumber(REC[03]) local UID_04 = tonumber(REC[04]) local UID_05 = tonumber(REC[05]) local UID_06 = tonumber(REC[06]) local UID_07 = tonumber(REC[07]) local UID_08 = tonumber(REC[08]) local UID_09 = tonumber(REC[09]) local UID_10 = tonumber(REC[10]) local SLOT = tonumber(REC[11]) local EXT = tonumber(REC[12]) local POS = tonumber(REC[13]) if UID_01 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01) then if UID_02 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02) then if UID_03 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03) then if SLOT == 03 then if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) >= UID_04 then CHECK_QNT = true end else if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) == UID_04 then CHECK_QNT = true end end if UID_05 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05) then if UID_06 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06) then if UID_07 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07) then if UID_08 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08) then if UID_09 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09) then if UID_10 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10) then if CHECK_QNT then if SLOT == 03 then if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) > UID_04 then player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, (player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) - UID_04)) else player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) end else player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) end CHECK_ITEM = true end end end end end end end end end end else CHECK_ITEM = true end if CHECK_ITEM then CHECK_ITEM = false CHECK_QNT = false if BOX_4 ~= "0" then local REC = BOX_4:splitTrimmed("-") local UID_01 = tonumber(REC[01]) local UID_02 = tonumber(REC[02]) local UID_03 = tonumber(REC[03]) local UID_04 = tonumber(REC[04]) local UID_05 = tonumber(REC[05]) local UID_06 = tonumber(REC[06]) local UID_07 = tonumber(REC[07]) local UID_08 = tonumber(REC[08]) local UID_09 = tonumber(REC[09]) local UID_10 = tonumber(REC[10]) local SLOT = tonumber(REC[11]) local EXT = tonumber(REC[12]) local POS = tonumber(REC[13]) if UID_01 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01) then if UID_02 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02) then if UID_03 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03) then if SLOT == 03 then if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) >= UID_04 then CHECK_QNT = true end else if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) == UID_04 then CHECK_QNT = true end end if UID_05 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05) then if UID_06 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06) then if UID_07 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07) then if UID_08 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08) then if UID_09 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09) then if UID_10 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10) then if CHECK_QNT then if SLOT == 03 then if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) > UID_04 then player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, (player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) - UID_04)) else player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) end else player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) end CHECK_ITEM = true end end end end end end end end end end else CHECK_ITEM = true end if CHECK_ITEM then player:sendCancelMessage("@closedBackpack") local SEND_MAIL = db.query("INSERT INTO `email_news` (`type`, `player_id`, `name`, `target_id`, `target_name`, `title`, `message`, `resposta`, `box_1`, `box_2`, `box_3`, `box_4`, `gold`, `vip`, `lida`, `box_check`) VALUES (" .. TYPE .. ", " .. playerGuid .. ", '" .. player:getName().. "', " .. TARGET_ID .. ", '" .. TARGET_NAME .. "', '" .. TITLE .. "', '" .. MSG .. "', '', '" ..BOX_1.. "', '" ..BOX_2.. "', '" ..BOX_3.. "', '" ..BOX_4.. "', " ..GOLD.. ", " ..VIP.. ", 0, 0)") if SEND_MAIL then player:sendCancelMessage("@Notice|02") player:popupFYI("Email enviado com sucesso.") local cid = Player(TARGET_NAME) if(not cid) then local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.MESSAGE_ALERT.. " AND `player_id` = " ..TARGET_ID.. ");") if checkNotify then db.query("UPDATE `player_storage` SET `value` = 1 WHERE (`key` = " .._SYSTEM.MESSAGE_ALERT.. " AND `player_id` = " ..TARGET_ID.. ");") else db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. TARGET_ID .. ", " .. _SYSTEM.MESSAGE_ALERT .. ", 1)") end else cid:sendTextMessage(MESSAGE_INFO_DESCR, "Você possui um novo email em sua Caixa de Mensagem.\nDigite Ctrl + Z para verificar.") end return true end return true end else player:popupFYI("Erro ao encontrar item anexado.") return true end else player:popupFYI("Erro ao encontrar item anexado.") return true end else player:popupFYI("Erro ao encontrar item anexado.") return true end else player:popupFYI("O destinatário dessa mensagem não existe.") return true end else local TITLE = split[02] local MSG = split[03] local SEND_MAIL = db.query("INSERT INTO `email_news` (`type`, `player_id`, `name`, `target_id`, `target_name`, `title`, `message`, `resposta`, `box_1`, `box_2`, `box_3`, `box_4`, `gold`, `vip`, `lida`, `box_check`) VALUES (" .. TYPE .. ", " .. playerGuid .. ", '" .. player:getName().. "', 0, '', '" .. TITLE .. "', '" .. MSG .. "', '', '', '', '', '', 0, 0, 1, 1)") if SEND_MAIL then player:sendCancelMessage("@Notice|02") player:popupFYI("Email enviado com sucesso.") return true else player:popupFYI("Erro ao enviar este email.") return true end end end return true end