| | | @@ -0,0 +1,3019 @@ |
| 1 | + | local OPCODE_SELL = 100 |
| 2 | + | local OPCODE_SELL_STACKABLE = 101 |
| 3 | + | local OPCODE_TRADE = 102 |
| 4 | + | local OPCODE_FINISH_01_TRADE = 103 |
| 5 | + | local OPCODE_FINISH_02_TRADE = 104 |
| 6 | + | local OPCODE_FINISH_03_TRADE = 105 |
| 7 | + | local OPCODE_HOTKEY = 106 |
| 8 | + | local OPCODE_BUY = 107 |
| 9 | + | local OPCODE_INSERT_MARKET = 108 |
| 10 | + | local OPCODE_LOAD_MYOFFERT_MARKET = 109 |
| 11 | + | local OPCODE_SEARCH_MARKET = 110 |
| 12 | + | local OPCODE_REMOVE_ITEM_MARKET = 111 |
| 13 | + | local OPCODE_BUY_ITEM_MARKET = 112 |
| 14 | + | local OPCODE_HISTORY_MARKET = 113 |
| 15 | + | local OPCODE_PIX_EDIT = 114 |
| 16 | + | local OPCODE_CRIPTOMOEDA = 115 |
| 17 | + | local PLAYER_INFO_OPCODE = 116 |
| 18 | + | local CRIPTOMOEDA_OPCODE = 117 |
| 19 | + | local BLACKMARKET_OPCODE = 118 |
| 20 | + | local MONITORANDO_ITEMS = 119 |
| 21 | + | local BOT_MONITORAMENTO = 120 |
| 22 | + | local BOT_WALK_KEYPRESS = 121 |
| 23 | + | local BOT_PLAYER_MONIT = 122 |
| 24 | + | local MESSAGE_BOX = 123 |
| 25 | + | local MENSAGEM_RESPOSTA = 124 |
| 26 | + | local MARKET_OFFERT_SELL = 125 |
| 27 | + | local OPCODE_OFFERT_LIST_ITEM = 126 |
| 28 | + | local BOT_POSX, BOT_POSY, BOT_POSZ, BOT_NAME, GM_NAME = 0000, 0000, 00, "", "" |
| 29 | + | local CHECK_CUSTOM_CLIENT = nil |
| 30 | + | |
| 31 | + | function mask_number(n) |
| 32 | + | local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') |
| 33 | + | return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right |
| 34 | + | end |
| 35 | + | function onExtendedOpcode(player, opcode, buffer) |
| 36 | + | local DIAS_SEMANA = { |
| 37 | + | ["Monday"] = "Segunda"; |
| 38 | + | ["Tuesday"] = "Ter�a"; |
| 39 | + | ["Wednesday"] = "Quarta"; |
| 40 | + | ["Thursday"] = "Quinta"; |
| 41 | + | ["Friday"] = "Sexta"; |
| 42 | + | ["Saturday"] = "S�bado"; |
| 43 | + | ["Sunday"] = "Domingo"; |
| 44 | + | } |
| 45 | + | local MES_NAME = { |
| 46 | + | [01] = "Janeiro"; |
| 47 | + | [02] = "Fevereiro"; |
| 48 | + | [03] = "Mar�o"; |
| 49 | + | [04] = "Abril"; |
| 50 | + | [05] = "Maio"; |
| 51 | + | [06] = "Junho"; |
| 52 | + | [07] = "Julho"; |
| 53 | + | [08] = "Agosto"; |
| 54 | + | [09] = "Setembro"; |
| 55 | + | [10] = "Outubro"; |
| 56 | + | [11] = "Novembro"; |
| 57 | + | [12] = "Dezembro"; |
| 58 | + | } |
| 59 | + | |
| 60 | + | local name = player:getName() |
| 61 | + | local Ano = tonumber(os.date("%y", os.time())) |
| 62 | + | local Mes = tonumber(os.date("%m", os.time())) |
| 63 | + | local Dia = tonumber(os.date("%d", os.time())) |
| 64 | + | local Horas = tonumber(os.date("%H", os.time())) |
| 65 | + | local Minutos = tonumber(os.date("%M", os.time())) |
| 66 | + | local HourMinutes = Horas .. ':' .. Minutos |
| 67 | + | local Semana = os.date('%A') |
| 68 | + | |
| 69 | + | if opcode == OPCODE_SELL then |
| 70 | + | local split = buffer:splitTrimmed(",") |
| 71 | + | local total = tonumber(split[01]) |
| 72 | + | local gold = tonumber(split[02]) |
| 73 | + | local ext = tonumber(split[03]) |
| 74 | + | local slot = tonumber(split[04]) |
| 75 | + | local G = PlayerGoldCoins(player, 00) |
| 76 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 77 | + | local Qnt = 01 |
| 78 | + | local bonusVenda = 0 |
| 79 | + | local checkGold = 0 |
| 80 | + | local SItem = 05 |
| 81 | + | |
| 82 | + | if player:getStorageValue(_SYSTEM.EXT_ACTIVE_BAG) ~= ext then |
| 83 | + | return false |
| 84 | + | end |
| 85 | + | for X = 01, total do |
| 86 | + | local bagSelect = tonumber(split[SItem]) |
| 87 | + | if bagSelect then |
| 88 | + | local itemid = player:getStorageValue(_BACKPACK[slot][ext][bagSelect].UID_01) or 0 |
| 89 | + | if itemid > 0 then |
| 90 | + | if slot == 03 then |
| 91 | + | Qnt = player:getStorageValue(_BACKPACK[slot][ext][bagSelect].UID_04) |
| 92 | + | end |
| 93 | + | local itemPrice = _ITEMS[itemid].PRICE * Qnt |
| 94 | + | local Bonus = 0 |
| 95 | + | if bonusVenda > 0 then |
| 96 | + | Bonus = bonusVenda * (itemPrice / 100) |
| 97 | + | itemPrice = math.floor(itemPrice + Bonus) |
| 98 | + | end |
| 99 | + | |
| 100 | + | checkGold = checkGold + itemPrice |
| 101 | + | doBackpack(player, 02, slot, ext, bagSelect) |
| 102 | + | SItem = SItem + 1 |
| 103 | + | else |
| 104 | + | doBackpack(player, 00, slot, 01, 01) |
| 105 | + | player:sendCancelMessage("@AfterSell " ..slot.. " " ..ext) |
| 106 | + | player:sendCancelMessage("@ReloadBackpack " ..slot.. " 01 01") |
| 107 | + | return true |
| 108 | + | end |
| 109 | + | else |
| 110 | + | doBackpack(player, 00, slot, 01, 01) |
| 111 | + | player:sendCancelMessage("@AfterSell " ..slot.. " " ..ext) |
| 112 | + | player:sendCancelMessage("@ReloadBackpack " ..slot.. " 01 01") |
| 113 | + | return true |
| 114 | + | end |
| 115 | + | end |
| 116 | + | if player:getStorageValue(_QUESTLOG[04].UID_01) == 1 then |
| 117 | + | player:setStorageValue(_QUESTLOG[04].UID_01, 100) |
| 118 | + | player:setStorageValue(_QUESTLOG[05].UID_01, 01) |
| 119 | + | |
| 120 | + | player:getPosition():sendMagicEffect(14) |
| 121 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") |
| 122 | + | end |
| 123 | + | if _CHEATS.GOLD_MINER_UNLOCK then |
| 124 | + | gold = gold * 2 |
| 125 | + | end |
| 126 | + | |
| 127 | + | doBackpack(player, 00, slot, ext, 01) |
| 128 | + | if checkGold > 0 then |
| 129 | + | PlayerGoldCoins(player, 02, checkGold) |
| 130 | + | player:sendCancelMessage("@LoadGold " ..(G + checkGold).. " " ..O) |
| 131 | + | end |
| 132 | + | |
| 133 | + | -- DESAFIO |
| 134 | + | if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then |
| 135 | + | onPlayerDesafios(player, 07, checkGold) |
| 136 | + | end |
| 137 | + | player:sendCancelMessage("@AfterSell " ..slot.. " " ..ext) |
| 138 | + | player:sendCancelMessage("@ReloadBackpack " ..slot.. " 01 01") |
| 139 | + | end |
| 140 | + | if opcode == OPCODE_SELL_STACKABLE then |
| 141 | + | local split = buffer:splitTrimmed(",") |
| 142 | + | local gold = tonumber(split[01]) |
| 143 | + | local ext = tonumber(split[02]) |
| 144 | + | local slot = tonumber(split[03]) |
| 145 | + | local qnt = tonumber(split[04]) |
| 146 | + | local bagpos = tonumber(split[05]) |
| 147 | + | if slot == 0 then slot = 03 end |
| 148 | + | local G = PlayerGoldCoins(player, 00) |
| 149 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 150 | + | |
| 151 | + | if player:getStorageValue(_BACKPACK[slot][ext][bagpos].UID_01) > 00 then |
| 152 | + | if player:getStorageValue(_SYSTEM.EXT_ACTIVE_BAG) == ext then |
| 153 | + | local qnt_atual = player:getStorageValue(_BACKPACK[slot][ext][bagpos].UID_04) |
| 154 | + | if qnt_atual > qnt then |
| 155 | + | player:setStorageValue(_BACKPACK[slot][ext][bagpos].UID_04, (qnt_atual - qnt)) |
| 156 | + | else |
| 157 | + | doBackpack(player, 02, slot, ext, bagpos) |
| 158 | + | end |
| 159 | + | if player:getStorageValue(_QUESTLOG[04].UID_01) == 1 then |
| 160 | + | player:setStorageValue(_QUESTLOG[04].UID_01, 100) |
| 161 | + | player:setStorageValue(_QUESTLOG[05].UID_01, 01) |
| 162 | + | |
| 163 | + | player:getPosition():sendMagicEffect(14) |
| 164 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") |
| 165 | + | doBackpack(player, 12) |
| 166 | + | end |
| 167 | + | if _CHEATS.GOLD_MINER_UNLOCK then |
| 168 | + | gold = gold * 2 |
| 169 | + | end |
| 170 | + | |
| 171 | + | doBackpack(player, 00, slot, ext, 01) |
| 172 | + | -- DESAFIO |
| 173 | + | if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then |
| 174 | + | onPlayerDesafios(player, 07, gold) |
| 175 | + | end |
| 176 | + | player:sendCancelMessage("@LoadGold " ..(G + gold).. " " ..O) |
| 177 | + | PlayerGoldCoins(player, 02, gold) |
| 178 | + | player:sendCancelMessage("@AfterSell " ..slot.. " " ..ext) |
| 179 | + | player:sendCancelMessage("@ReloadBackpack " ..slot.. " 01 01") |
| 180 | + | end |
| 181 | + | end |
| 182 | + | end |
| 183 | + | if opcode == OPCODE_TRADE then |
| 184 | + | local split = buffer:splitTrimmed(",") |
| 185 | + | local TRADER_NAME = split[16] |
| 186 | + | local tid = Player(TRADER_NAME) |
| 187 | + | if(not tid) then |
| 188 | + | player:sendCancelMessage("@ClosedTrade") |
| 189 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. TRADER_NAME .. " not found.") |
| 190 | + | return false |
| 191 | + | end |
| 192 | + | |
| 193 | + | local thingName = split[01] |
| 194 | + | local POS_SLOT = tonumber(split[02]) |
| 195 | + | |
| 196 | + | local id1 = tonumber(split[03]) |
| 197 | + | local id2 = tonumber(split[04]) |
| 198 | + | local id3 = tonumber(split[05]) |
| 199 | + | local id4 = tonumber(split[06]) |
| 200 | + | local id5 = tonumber(split[07]) |
| 201 | + | local id6 = tonumber(split[08]) |
| 202 | + | local id7 = tonumber(split[09]) |
| 203 | + | local id8 = tonumber(split[10]) |
| 204 | + | local id9 = tonumber(split[11]) |
| 205 | + | local id10 = tonumber(split[12]) |
| 206 | + | local slot = tonumber(split[13]) |
| 207 | + | local ext = tonumber(split[14]) |
| 208 | + | local slot_pos = tonumber(split[15]) |
| 209 | + | |
| 210 | + | tid:sendCancelMessage("@LoadTrader " ..id1.. " " ..id2.. " " ..id3.. " " ..id4.. " " ..id5.. " " ..id6.. " " ..id7.. " " ..id8.. " " ..id9.. " " ..id10.. " " ..slot.. " " ..ext.. " " ..slot_pos) |
| 211 | + | end |
| 212 | + | if opcode == OPCODE_FINISH_01_TRADE then |
| 213 | + | local split = buffer:splitTrimmed(",") |
| 214 | + | local TRADER_NAME = split[01] |
| 215 | + | --print("Eu sou " ..player:getName().. " e estou fazendo trade com " ..TRADER_NAME) |
| 216 | + | local tid = Player(TRADER_NAME) |
| 217 | + | if(not tid) then |
| 218 | + | player:sendCancelMessage("@ClosedTrade") |
| 219 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. TRADER_NAME .. " not found.") |
| 220 | + | return false |
| 221 | + | end |
| 222 | + | |
| 223 | + | local QNT_SLOT_01 = tonumber(split[02]) |
| 224 | + | local QNT_SLOT_02 = tonumber(split[03]) |
| 225 | + | local QNT_SLOT_03 = tonumber(split[04]) |
| 226 | + | local QNT_SLOT_04 = tonumber(split[05]) |
| 227 | + | local QNT_SLOT_05 = tonumber(split[06]) |
| 228 | + | local QNT_SLOT_06 = tonumber(split[07]) |
| 229 | + | local QNT_SLOT_07 = tonumber(split[08]) |
| 230 | + | local QNT_SLOT_08 = tonumber(split[09]) |
| 231 | + | local QNT_SLOT_09 = tonumber(split[10]) |
| 232 | + | local QNT_SLOT_10 = tonumber(split[11]) |
| 233 | + | local CHECK_EMPTY, CHECK_SLOT, FINISH_TRADE = 0, 0, tonumber(split[12]) |
| 234 | + | |
| 235 | + | for EMPTY_SLOT = 01, 09 do |
| 236 | + | local EMPTY = doBackpack(player, 07, EMPTY_SLOT, 00, 01) |
| 237 | + | if EMPTY_SLOT == 01 then |
| 238 | + | if EMPTY < QNT_SLOT_01 then |
| 239 | + | CHECK_SLOT = EMPTY_SLOT |
| 240 | + | CHECK_EMPTY = 01 |
| 241 | + | break |
| 242 | + | end |
| 243 | + | elseif EMPTY_SLOT == 02 then |
| 244 | + | if EMPTY < QNT_SLOT_02 then |
| 245 | + | CHECK_SLOT = EMPTY_SLOT |
| 246 | + | CHECK_EMPTY = 01 |
| 247 | + | break |
| 248 | + | end |
| 249 | + | elseif EMPTY_SLOT == 03 then |
| 250 | + | if EMPTY < QNT_SLOT_03 then |
| 251 | + | CHECK_SLOT = EMPTY_SLOT |
| 252 | + | CHECK_EMPTY = 01 |
| 253 | + | break |
| 254 | + | end |
| 255 | + | elseif EMPTY_SLOT == 04 then |
| 256 | + | if EMPTY < QNT_SLOT_04 then |
| 257 | + | CHECK_SLOT = EMPTY_SLOT |
| 258 | + | CHECK_EMPTY = 01 |
| 259 | + | break |
| 260 | + | end |
| 261 | + | elseif EMPTY_SLOT == 05 then |
| 262 | + | if EMPTY < QNT_SLOT_05 then |
| 263 | + | CHECK_SLOT = EMPTY_SLOT |
| 264 | + | CHECK_EMPTY = 01 |
| 265 | + | break |
| 266 | + | end |
| 267 | + | elseif EMPTY_SLOT == 06 then |
| 268 | + | if EMPTY < QNT_SLOT_06 then |
| 269 | + | CHECK_SLOT = EMPTY_SLOT |
| 270 | + | CHECK_EMPTY = 01 |
| 271 | + | break |
| 272 | + | end |
| 273 | + | elseif EMPTY_SLOT == 07 then |
| 274 | + | if EMPTY < QNT_SLOT_07 then |
| 275 | + | CHECK_SLOT = EMPTY_SLOT |
| 276 | + | CHECK_EMPTY = 01 |
| 277 | + | break |
| 278 | + | end |
| 279 | + | elseif EMPTY_SLOT == 08 then |
| 280 | + | if EMPTY < QNT_SLOT_08 then |
| 281 | + | CHECK_SLOT = EMPTY_SLOT |
| 282 | + | CHECK_EMPTY = 01 |
| 283 | + | break |
| 284 | + | end |
| 285 | + | elseif EMPTY_SLOT == 09 then |
| 286 | + | if EMPTY < QNT_SLOT_09 then |
| 287 | + | CHECK_SLOT = EMPTY_SLOT |
| 288 | + | CHECK_EMPTY = 01 |
| 289 | + | break |
| 290 | + | end |
| 291 | + | end |
| 292 | + | end |
| 293 | + | if CHECK_EMPTY == 01 then |
| 294 | + | local SLOT_NAME = { |
| 295 | + | [01] = "Amulet"; |
| 296 | + | [02] = "Helmet"; |
| 297 | + | [03] = "Produtos de Criaturas"; |
| 298 | + | [04] = "Weapon"; |
| 299 | + | [05] = "Armor"; |
| 300 | + | [06] = "Glove"; |
| 301 | + | [07] = "Ring"; |
| 302 | + | [08] = "Legs"; |
| 303 | + | [09] = "Boots"; |
| 304 | + | } |
| 305 | + | |
| 306 | + | player:setStorageValue(_SYSTEM.PLAYER_TRADE_ACT, nil) |
| 307 | + | tid:setStorageValue(_SYSTEM.PLAYER_TRADE_ACT, nil) |
| 308 | + | tid:popupFYI("Seu alvo n�o tem espa�o suficiente em sua backpack de " ..SLOT_NAME[CHECK_SLOT].. ".") |
| 309 | + | player:popupFYI("N�o h� espa�o suficiente em sua backpack de " ..SLOT_NAME[CHECK_SLOT].. ".") |
| 310 | + | player:sendCancelMessage("@ClosedTrade") |
| 311 | + | tid:sendCancelMessage("@ClosedTrade") |
| 312 | + | return false |
| 313 | + | else |
| 314 | + | if FINISH_TRADE == 00 then |
| 315 | + | tid:sendCancelMessage("@CheckEmpty-" ..player:getName()) |
| 316 | + | else |
| 317 | + | player:sendCancelMessage("@FinishTrade") |
| 318 | + | end |
| 319 | + | end |
| 320 | + | end |
| 321 | + | if opcode == OPCODE_FINISH_02_TRADE then |
| 322 | + | local split = buffer:splitTrimmed(",") |
| 323 | + | local TRADER_NAME = split[01] |
| 324 | + | local tid = Player(TRADER_NAME) |
| 325 | + | if(not tid) then |
| 326 | + | player:sendCancelMessage("@ClosedTrade") |
| 327 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. TRADER_NAME .. " not found.") |
| 328 | + | return false |
| 329 | + | end |
| 330 | + | |
| 331 | + | player:setStorageValue(_SYSTEM.PLAYER_TRADE_ACT, nil) |
| 332 | + | tid:setStorageValue(_SYSTEM.PLAYER_TRADE_ACT, nil) |
| 333 | + | for ITEM_TRADE = 02, 21 do |
| 334 | + | local P_STRING = split[ITEM_TRADE] |
| 335 | + | local EXPLODE = P_STRING:splitTrimmed("|") |
| 336 | + | local _SLOT, _EXT, _POS_SLOT, _QNT = tonumber(EXPLODE[01]), tonumber(EXPLODE[02]), tonumber(EXPLODE[03]), tonumber(EXPLODE[04]) |
| 337 | + | |
| 338 | + | if _SLOT == 0 then |
| 339 | + | break |
| 340 | + | else |
| 341 | + | doBackpack(player, 00, _SLOT, 00, 01) |
| 342 | + | local PLAYER_EXT = doBackpack(player, 09) |
| 343 | + | local PLAYER_POS = doBackpack(player, 08) |
| 344 | + | |
| 345 | + | if _SLOT == 03 then |
| 346 | + | local ITEM_ID = tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_01) |
| 347 | + | local ITEM_RAR = tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_02) |
| 348 | + | local ITEM_STA = tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_03) |
| 349 | + | local TRADER_QNT = tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04) |
| 350 | + | if _DEBUG_MODE then |
| 351 | + | print("[CREATURESCRIPT - TRADE] " ..player:getName().. " - Recebendo o item [ " .._ITEMS[ITEM_ID].NAME.. " ]") |
| 352 | + | end |
| 353 | + | if _QNT < TRADER_QNT then |
| 354 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04, (tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04) - _QNT)) |
| 355 | + | else |
| 356 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_01, nil) |
| 357 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_02, nil) |
| 358 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_03, nil) |
| 359 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04, nil) |
| 360 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_05, nil) |
| 361 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_06, nil) |
| 362 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_07, nil) |
| 363 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_08, nil) |
| 364 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_09, nil) |
| 365 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10, nil) |
| 366 | + | end |
| 367 | + | |
| 368 | + | doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) |
| 369 | + | doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) |
| 370 | + | else |
| 371 | + | if _SLOT == 04 then |
| 372 | + | local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) |
| 373 | + | if AtrAmmo < 00 then AtrAmmo = 01 end |
| 374 | + | AtrAmmo = AtrAmmo * 500 |
| 375 | + | local LimitBullet = AtrAmmo |
| 376 | + | |
| 377 | + | if tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then |
| 378 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) |
| 379 | + | else |
| 380 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10)) |
| 381 | + | end |
| 382 | + | else |
| 383 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10)) |
| 384 | + | end |
| 385 | + | |
| 386 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_01)) |
| 387 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_02)) |
| 388 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_03)) |
| 389 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04)) |
| 390 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_05)) |
| 391 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_06)) |
| 392 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_07)) |
| 393 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_08)) |
| 394 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, tid:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_09)) |
| 395 | + | |
| 396 | + | local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) |
| 397 | + | local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) |
| 398 | + | local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) |
| 399 | + | player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") |
| 400 | + | if _DEBUG_MODE then |
| 401 | + | print("[CREATURESCRIPT - TRADE] " ..player:getName().. " - Recebendo o item [ " .._ITEMS[itemid].NAME.. " ]") |
| 402 | + | end |
| 403 | + | |
| 404 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_01, nil) |
| 405 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_02, nil) |
| 406 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_03, nil) |
| 407 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_04, nil) |
| 408 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_05, nil) |
| 409 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_06, nil) |
| 410 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_07, nil) |
| 411 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_08, nil) |
| 412 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_09, nil) |
| 413 | + | tid:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10, nil) |
| 414 | + | end |
| 415 | + | |
| 416 | + | tid:sendCancelMessage("@closedBackpack") |
| 417 | + | player:sendCancelMessage("@closedBackpack") |
| 418 | + | end |
| 419 | + | end |
| 420 | + | end |
| 421 | + | if opcode == OPCODE_FINISH_03_TRADE then |
| 422 | + | local split = buffer:splitTrimmed(",") |
| 423 | + | local TRADER_NAME = split[01] |
| 424 | + | local tid = Player(TRADER_NAME) |
| 425 | + | if(not tid) then |
| 426 | + | player:sendCancelMessage("@ClosedTrade") |
| 427 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. TRADER_NAME .. " not found.") |
| 428 | + | return false |
| 429 | + | end |
| 430 | + | |
| 431 | + | local TRADER_GOLD = tonumber(split[02]) |
| 432 | + | local TRADER_VIP = tonumber(split[03]) |
| 433 | + | local PLAYER_GOLD = tonumber(split[04]) |
| 434 | + | local PLAYER_VIP = tonumber(split[05]) |
| 435 | + | local THING = tonumber(split[06]) |
| 436 | + | |
| 437 | + | if TRADER_GOLD > 0 then |
| 438 | + | --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) + TRADER_GOLD)) |
| 439 | + | PlayerGoldCoins(player, 02, TRADER_GOLD) |
| 440 | + | end |
| 441 | + | if PLAYER_GOLD > 0 then |
| 442 | + | PlayerGoldCoins(player, 01, PLAYER_GOLD) |
| 443 | + | --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - PLAYER_GOLD)) |
| 444 | + | end |
| 445 | + | if TRADER_VIP > 0 then |
| 446 | + | PlayerVipCoins(player, 02, TRADER_VIP) |
| 447 | + | player:sendCancelMessage("@LootMSG 3218 3 0 " ..TRADER_VIP) |
| 448 | + | end |
| 449 | + | if PLAYER_VIP > 0 then |
| 450 | + | PlayerVipCoins(player, 01, PLAYER_VIP) |
| 451 | + | end |
| 452 | + | |
| 453 | + | doBackpack(player, 11) |
| 454 | + | end |
| 455 | + | if opcode == OPCODE_HOTKEY then |
| 456 | + | local split = buffer:splitTrimmed(",") |
| 457 | + | local HKChoose = tonumber(split[01]) |
| 458 | + | local Hotkey = tonumber(split[02]) |
| 459 | + | |
| 460 | + | player:setStorageValue(_SYSTEM.HOTKEY_CONFIG[Hotkey], HKChoose) |
| 461 | + | |
| 462 | + | local HOT_1 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[01]) |
| 463 | + | local HOT_2 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[02]) |
| 464 | + | local HOT_3 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[03]) |
| 465 | + | local HOT_4 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[04]) |
| 466 | + | local HOT_5 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[05]) |
| 467 | + | local HOT_6 = player:getStorageValue(_SYSTEM.HOTKEY_CONFIG[06]) |
| 468 | + | player:sendCancelMessage("@LoadHotkey " ..HOT_1.. " " ..HOT_2.. " " ..HOT_3.. " " ..HOT_4.. " " ..HOT_5.. " " ..HOT_6) |
| 469 | + | end |
| 470 | + | if opcode == OPCODE_BUY then |
| 471 | + | local split = buffer:splitTrimmed(",") |
| 472 | + | local ID = tonumber(split[01]) |
| 473 | + | if ID == 01 then |
| 474 | + | local PRICE = tonumber(split[02]) |
| 475 | + | local AMMO = tonumber(split[03]) |
| 476 | + | local ID_AMMO = tonumber(split[04]) |
| 477 | + | local itemid = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_01) |
| 478 | + | local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) |
| 479 | + | local AtualAmmo = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) |
| 480 | + | local G = PlayerGoldCoins(player, 00) |
| 481 | + | local itemRecLevel = 0 |
| 482 | + | local MAX_AMMO = false |
| 483 | + | |
| 484 | + | if AtrAmmo < 00 then AtrAmmo = 01 end |
| 485 | + | AtrAmmo = AtrAmmo * 500 |
| 486 | + | if AtualAmmo < 0 then AtualAmmo = 0 end |
| 487 | + | local LimitBullet = AtrAmmo |
| 488 | + | if PRICE == 00 or PRICE > G then |
| 489 | + | return false |
| 490 | + | end |
| 491 | + | if AMMO > LimitBullet then |
| 492 | + | player:popupFYI("Quantidade acima do suportado (" ..LimitBullet.. "). Tente novamente.") |
| 493 | + | return false |
| 494 | + | end |
| 495 | + | |
| 496 | + | local ESTIMATIVA = AMMO + player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) |
| 497 | + | if AMMO > 9999 or ESTIMATIVA > 9999 then |
| 498 | + | player:popupFYI("Voc� n�o pode ter mais de 9999 em estoque.") |
| 499 | + | return true |
| 500 | + | end |
| 501 | + | if itemid > 0 then |
| 502 | + | local LEVEL_FOR_RARE = 05 |
| 503 | + | local LEVEL_FOR_LEVEL = 04 |
| 504 | + | GUN_RARE = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_02) or 0 |
| 505 | + | GUN_LEVEL = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_07) or 0 |
| 506 | + | GUN_STAR = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_03) or 0 |
| 507 | + | GUN_AMMO = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) or 0 |
| 508 | + | GUN_BASE_LEVEL = _ITEMS[itemid].LEVEL |
| 509 | + | |
| 510 | + | itemRecLevel = GUN_BASE_LEVEL + (GUN_RARE * LEVEL_FOR_RARE) + (GUN_LEVEL * LEVEL_FOR_LEVEL) + ((GUN_STAR * 10) * LEVEL_FOR_LEVEL) |
| 511 | + | |
| 512 | + | local LEVEL_AMMO = _ITEMS[ID_AMMO].SLOT_EQUIP |
| 513 | + | if ID_AMMO == 10454 then |
| 514 | + | if itemRecLevel >= LEVEL_AMMO then |
| 515 | + | local G = PlayerGoldCoins(player, 00) |
| 516 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 517 | + | |
| 518 | + | if ESTIMATIVA > LimitBullet then |
| 519 | + | if AtualAmmo < (LimitBullet / 02) then |
| 520 | + | AMMO = LimitBullet |
| 521 | + | MAX_AMMO = true |
| 522 | + | player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Voc� s� pode carregar " ..LimitBullet.. " balas em sua arma.") |
| 523 | + | else |
| 524 | + | player:popupFYI("Voc� s� pode carregar " ..LimitBullet.. " balas em sua arma.\nAumente sua capacidade de balas na se��o Status.") |
| 525 | + | return true |
| 526 | + | end |
| 527 | + | end |
| 528 | + | if MAX_AMMO then |
| 529 | + | player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, AMMO) |
| 530 | + | else |
| 531 | + | if player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) < 0 then AMMO = AMMO + 1 end |
| 532 | + | player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, (player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) + AMMO)) |
| 533 | + | end |
| 534 | + | player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) |
| 535 | + | player:sendCancelMessage("@LoadAmmo " ..player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10)) |
| 536 | + | PlayerGoldCoins(player, 01, PRICE) |
| 537 | + | |
| 538 | + | local AMMO_ATR = player:getStorageValue(_SYSTEM.POINTS_ATR[03]) |
| 539 | + | local AMMO_ATUAL = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) or 0 |
| 540 | + | if AMMO_ATR < 00 then AMMO_ATR = 00 end |
| 541 | + | AMMO_ATR = ((AMMO_ATR * 10) + 500) - AMMO_ATUAL |
| 542 | + | player:sendCancelMessage("@ReloadMaxBullet " ..AMMO_ATR) |
| 543 | + | else |
| 544 | + | player:popupFYI("Sua arma � muito fraca para equipar esse tipo de muni��o.") |
| 545 | + | return false |
| 546 | + | end |
| 547 | + | else |
| 548 | + | if itemRecLevel <= LEVEL_AMMO then |
| 549 | + | local G = PlayerGoldCoins(player, 00) |
| 550 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 551 | + | |
| 552 | + | if ESTIMATIVA > LimitBullet then |
| 553 | + | if AtualAmmo < (LimitBullet / 02) then |
| 554 | + | AMMO = LimitBullet |
| 555 | + | MAX_AMMO = true |
| 556 | + | player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Voc� s� pode carregar " ..LimitBullet.. " balas em sua arma.") |
| 557 | + | else |
| 558 | + | player:popupFYI("Voc� s� pode carregar " ..LimitBullet.. " balas em sua arma.\nAumente sua capacidade de balas na se��o Status.") |
| 559 | + | return true |
| 560 | + | end |
| 561 | + | end |
| 562 | + | if MAX_AMMO then |
| 563 | + | player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, AMMO) |
| 564 | + | else |
| 565 | + | if player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) < 0 then AMMO = AMMO + 1 end |
| 566 | + | player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, (player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) + AMMO)) |
| 567 | + | end |
| 568 | + | player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) |
| 569 | + | player:sendCancelMessage("@LoadAmmo " ..player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10)) |
| 570 | + | PlayerGoldCoins(player, 01, PRICE) |
| 571 | + | |
| 572 | + | local AMMO_ATR = player:getStorageValue(_SYSTEM.POINTS_ATR[03]) |
| 573 | + | local AMMO_ATUAL = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) or 0 |
| 574 | + | if AMMO_ATR < 00 then AMMO_ATR = 00 end |
| 575 | + | AMMO_ATR = ((AMMO_ATR * 10) + 500) - AMMO_ATUAL |
| 576 | + | player:sendCancelMessage("@ReloadMaxBullet " ..AMMO_ATR) |
| 577 | + | else |
| 578 | + | player:popupFYI("Sua arma equipada requer uma muni��o mais forte.") |
| 579 | + | return true |
| 580 | + | end |
| 581 | + | end |
| 582 | + | else |
| 583 | + | player:popupFYI("Voc� precisa ter uma arma equipada.") |
| 584 | + | return true |
| 585 | + | end |
| 586 | + | |
| 587 | + | elseif ID == 02 then |
| 588 | + | local PRICE = tonumber(split[02]) |
| 589 | + | local QNT = tonumber(split[03]) |
| 590 | + | local ID_CURA = tonumber(split[04]) |
| 591 | + | local REC_LEVEL = _ITEMS[ID_CURA].SLOT_EQUIP |
| 592 | + | local G = PlayerGoldCoins(player, 00) |
| 593 | + | |
| 594 | + | if PRICE == 00 or PRICE > G then |
| 595 | + | return false |
| 596 | + | end |
| 597 | + | local ESTIMATIVA = QNT + player:getStorageValue(_SYSTEM.SKILL_CURE[02]) |
| 598 | + | if QNT > 9999 or ESTIMATIVA > 9999 then |
| 599 | + | player:popupFYI("Voc� n�o pode ter mais de 9999 em estoque.") |
| 600 | + | return true |
| 601 | + | end |
| 602 | + | if player:getLevel() >= REC_LEVEL then |
| 603 | + | local G = PlayerGoldCoins(player, 00) |
| 604 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 605 | + | local CURE_INFO = { |
| 606 | + | [10455] = 01; |
| 607 | + | [10456] = 02; |
| 608 | + | [10457] = 03; |
| 609 | + | [10458] = 04; |
| 610 | + | [10459] = 05; |
| 611 | + | } |
| 612 | + | local CURE_TYPE = CURE_INFO[ID_CURA] |
| 613 | + | if player:getStorageValue(_SYSTEM.SKILL_CURE[02]) < 01 then |
| 614 | + | player:setStorageValue(_SYSTEM.SKILL_CURE[01], CURE_TYPE) |
| 615 | + | player:setStorageValue(_SYSTEM.SKILL_CURE[02], (player:getStorageValue(_SYSTEM.SKILL_CURE[02]) + QNT)) |
| 616 | + | player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) |
| 617 | + | player:sendCancelMessage("@CureSkill " ..player:getStorageValue(_SYSTEM.SKILL_CURE[01]).. " " ..player:getStorageValue(_SYSTEM.SKILL_CURE[02])) |
| 618 | + | --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - PRICE)) |
| 619 | + | PlayerGoldCoins(player, 01, PRICE) |
| 620 | + | else |
| 621 | + | if player:getStorageValue(_SYSTEM.SKILL_CURE[01]) == CURE_TYPE then |
| 622 | + | player:setStorageValue(_SYSTEM.SKILL_CURE[02], (player:getStorageValue(_SYSTEM.SKILL_CURE[02]) + QNT)) |
| 623 | + | player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) |
| 624 | + | player:sendCancelMessage("@CureSkill " ..player:getStorageValue(_SYSTEM.SKILL_CURE[01]).. " " ..player:getStorageValue(_SYSTEM.SKILL_CURE[02])) |
| 625 | + | --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - PRICE)) |
| 626 | + | PlayerGoldCoins(player, 01, PRICE) |
| 627 | + | else |
| 628 | + | player:setStorageValue(_SYSTEM.SKILL_CURE[01], CURE_TYPE) |
| 629 | + | player:setStorageValue(_SYSTEM.SKILL_CURE[02], QNT) |
| 630 | + | player:sendCancelMessage("@LoadGold " ..(G - PRICE).. " " ..O) |
| 631 | + | player:sendCancelMessage("@CureSkill " ..player:getStorageValue(_SYSTEM.SKILL_CURE[01]).. " " ..player:getStorageValue(_SYSTEM.SKILL_CURE[02])) |
| 632 | + | --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - PRICE)) |
| 633 | + | PlayerGoldCoins(player, 01, PRICE) |
| 634 | + | end |
| 635 | + | end |
| 636 | + | else |
| 637 | + | player:popupFYI("Voc� n�o possui n�vel suficiente para comprar essa po��o.") |
| 638 | + | end |
| 639 | + | |
| 640 | + | elseif ID == 03 then |
| 641 | + | local PRICE = tonumber(split[02]) |
| 642 | + | local SALDO = PlayerGoldCoins(player, 00) |
| 643 | + | if SALDO < PRICE then |
| 644 | + | player:popupFYI("Voc� n�o tem dinheiro suficiente.") |
| 645 | + | return true |
| 646 | + | end |
| 647 | + | |
| 648 | + | local TOTAL_PRICE = 0 |
| 649 | + | local LEVEL_FOR_RARE = 05 |
| 650 | + | local LEVEL_FOR_LEVEL = 04 |
| 651 | + | local RANK_ID = player:getStorageValue(_SYSTEM.TASK[00].RANK) |
| 652 | + | if RANK_ID < 01 then |
| 653 | + | RANK_ID = 01 |
| 654 | + | end |
| 655 | + | RANK_ID = RANK_ID * 500 |
| 656 | + | ----------------------- EQUIPADO ----------------------- |
| 657 | + | local ITEMID = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_01) or 0 |
| 658 | + | if ITEMID > 00 then |
| 659 | + | local GUN_RARE = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_02) or 0 |
| 660 | + | local GUN_LEVEL = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_07) or 0 |
| 661 | + | local GUN_STAR = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_03) or 0 |
| 662 | + | local GUN_AMMO = player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10) or 0 |
| 663 | + | local GUN_BASE_LEVEL = _ITEMS[ITEMID].LEVEL |
| 664 | + | local PRICE_AMMO_UND = 00 |
| 665 | + | local PRICE_AMMO_GUN = 00 |
| 666 | + | |
| 667 | + | if GUN_AMMO < 00 then |
| 668 | + | GUN_AMMO = 00 |
| 669 | + | end |
| 670 | + | if GUN_AMMO < RANK_ID then |
| 671 | + | MAX_BULLET = RANK_ID - GUN_AMMO |
| 672 | + | local REQUISITO_LEVEL = GUN_BASE_LEVEL + (GUN_RARE * LEVEL_FOR_RARE) + (GUN_LEVEL * LEVEL_FOR_LEVEL) + ((GUN_STAR * 10) * LEVEL_FOR_LEVEL) |
| 673 | + | if REQUISITO_LEVEL < 30 then |
| 674 | + | PRICE_AMMO_UND = _ITEMS[10450].PRICE |
| 675 | + | elseif REQUISITO_LEVEL < 60 then |
| 676 | + | PRICE_AMMO_UND = _ITEMS[10451].PRICE |
| 677 | + | elseif REQUISITO_LEVEL < 99 then |
| 678 | + | PRICE_AMMO_UND = _ITEMS[10452].PRICE |
| 679 | + | elseif REQUISITO_LEVEL < 150 then |
| 680 | + | PRICE_AMMO_UND = _ITEMS[10453].PRICE |
| 681 | + | elseif REQUISITO_LEVEL > 150 then |
| 682 | + | PRICE_AMMO_UND = _ITEMS[10454].PRICE |
| 683 | + | end |
| 684 | + | |
| 685 | + | PRICE_AMMO_GUN = MAX_BULLET * PRICE_AMMO_UND |
| 686 | + | TOTAL_PRICE = TOTAL_PRICE + PRICE_AMMO_GUN |
| 687 | + | player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, RANK_ID) |
| 688 | + | player:sendCancelMessage("@LoadAmmo " ..player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10)) |
| 689 | + | end |
| 690 | + | end |
| 691 | + | ----------------------- BACKPACK ----------------------- |
| 692 | + | for X = 01, 20 do |
| 693 | + | local ITEMID = player:getStorageValue(_BACKPACK[04][00][X].UID_01) |
| 694 | + | if ITEMID > 00 then |
| 695 | + | local GUN_RARE = player:getStorageValue(_BACKPACK[04][00][X].UID_02) |
| 696 | + | local GUN_STAR = player:getStorageValue(_BACKPACK[04][00][X].UID_03) |
| 697 | + | local GUN_LEVEL = player:getStorageValue(_BACKPACK[04][00][X].UID_07) |
| 698 | + | local AMMO_COUNT = player:getStorageValue(_BACKPACK[04][00][X].UID_10) |
| 699 | + | local GUN_BASE_LEVEL = _ITEMS[ITEMID].LEVEL |
| 700 | + | local PRICE_AMMO_UND = 00 |
| 701 | + | local PRICE_AMMO_GUN = 00 |
| 702 | + | |
| 703 | + | if AMMO_COUNT < 00 then |
| 704 | + | AMMO_COUNT = 00 |
| 705 | + | end |
| 706 | + | if AMMO_COUNT < RANK_ID then |
| 707 | + | MAX_BULLET = RANK_ID - AMMO_COUNT |
| 708 | + | local REQUISITO_LEVEL = GUN_BASE_LEVEL + (GUN_RARE * LEVEL_FOR_RARE) + (GUN_LEVEL * LEVEL_FOR_LEVEL) + ((GUN_STAR * 10) * LEVEL_FOR_LEVEL) |
| 709 | + | if REQUISITO_LEVEL < 30 then |
| 710 | + | PRICE_AMMO_UND = _ITEMS[10450].PRICE |
| 711 | + | elseif REQUISITO_LEVEL < 60 then |
| 712 | + | PRICE_AMMO_UND = _ITEMS[10451].PRICE |
| 713 | + | elseif REQUISITO_LEVEL < 99 then |
| 714 | + | PRICE_AMMO_UND = _ITEMS[10452].PRICE |
| 715 | + | elseif REQUISITO_LEVEL < 150 then |
| 716 | + | PRICE_AMMO_UND = _ITEMS[10453].PRICE |
| 717 | + | elseif REQUISITO_LEVEL > 150 then |
| 718 | + | PRICE_AMMO_UND = _ITEMS[10454].PRICE |
| 719 | + | end |
| 720 | + | |
| 721 | + | PRICE_AMMO_GUN = MAX_BULLET * PRICE_AMMO_UND |
| 722 | + | TOTAL_PRICE = TOTAL_PRICE + PRICE_AMMO_GUN |
| 723 | + | player:setStorageValue(_BACKPACK[04][00][X].UID_10, RANK_ID) |
| 724 | + | end |
| 725 | + | else |
| 726 | + | break |
| 727 | + | end |
| 728 | + | end |
| 729 | + | |
| 730 | + | |
| 731 | + | doInventario(player, 00, 04, 00) |
| 732 | + | doBackpack(player, 00, 04, 00, 01) |
| 733 | + | PlayerGoldCoins(player, 01, TOTAL_PRICE) |
| 734 | + | doBackpack(player, 11) |
| 735 | + | player:sendCancelMessage("@OpenSellComboBox") |
| 736 | + | player:sendCancelMessage("@ReloadBackpack 04 01 01") |
| 737 | + | return true |
| 738 | + | end |
| 739 | + | |
| 740 | + | player:sendCancelMessage("@ReloadBackpack 03 01 01") |
| 741 | + | end |
| 742 | + | if opcode == OPCODE_REMOVE_ITEM_MARKET then |
| 743 | + | local split = buffer:splitTrimmed(",") |
| 744 | + | local ITEM_REMOVE_ID = tonumber(split[01]) |
| 745 | + | local _SLOT = tonumber(split[02]) |
| 746 | + | local SLOT_TYPE = tonumber(split[03]) |
| 747 | + | local SLOT_OFFERT = tonumber(split[04]) |
| 748 | + | local playerGuid = player:getGuid() |
| 749 | + | local Test = db.storeQuery("SELECT * FROM market WHERE (id = " ..ITEM_REMOVE_ID.. " AND player_id = " ..playerGuid.. ");") |
| 750 | + | |
| 751 | + | if Test then |
| 752 | + | local qnt = result.getDataInt(Test, "uid_4") |
| 753 | + | if SLOT_TYPE == 00 then |
| 754 | + | local itemid = result.getDataInt(Test, "uid_1") |
| 755 | + | if itemid == 3218 then |
| 756 | + | PlayerVipCoins(player, 02, qnt) |
| 757 | + | player:sendCancelMessage("@LootMSG " ..itemid.. " 3 0 " ..qnt) |
| 758 | + | |
| 759 | + | db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") |
| 760 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 761 | + | if Test then |
| 762 | + | player:sendCancelMessage("@RemoveSlotsMarket 01") |
| 763 | + | else |
| 764 | + | player:sendCancelMessage("@RemoveSlotsMarket 00") |
| 765 | + | end |
| 766 | + | |
| 767 | + | doBackpack(player, 11) |
| 768 | + | return false |
| 769 | + | end |
| 770 | + | |
| 771 | + | if _SLOT == 00 or _SLOT > 09 then |
| 772 | + | _SLOT = 03 |
| 773 | + | end |
| 774 | + | if doBackpack(player, 00, _SLOT, 00, 01) then |
| 775 | + | local PLAYER_EXT = doBackpack(player, 09) |
| 776 | + | local PLAYER_POS = doBackpack(player, 08) |
| 777 | + | local rare = result.getDataInt(Test, "uid_2") |
| 778 | + | local star = result.getDataInt(Test, "uid_3") |
| 779 | + | if _SLOT == 03 then |
| 780 | + | doBackpack(player, 03, _SLOT, 00, 01, itemid) -- Procurar |
| 781 | + | if doBackpack(player, 01, _SLOT, ext, 0, itemid, rare, star, qnt) then |
| 782 | + | player:getPosition():sendMagicEffect(14) |
| 783 | + | end |
| 784 | + | else |
| 785 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, result.getDataInt(Test, "uid_1")) |
| 786 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, result.getDataInt(Test, "uid_2")) |
| 787 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, result.getDataInt(Test, "uid_3")) |
| 788 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, result.getDataInt(Test, "uid_4")) |
| 789 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, result.getDataInt(Test, "uid_5")) |
| 790 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, result.getDataInt(Test, "uid_6")) |
| 791 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, result.getDataInt(Test, "uid_7")) |
| 792 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, result.getDataInt(Test, "uid_8")) |
| 793 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, result.getDataInt(Test, "uid_9")) |
| 794 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, result.getDataInt(Test, "uid_10")) |
| 795 | + | player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") |
| 796 | + | end |
| 797 | + | |
| 798 | + | db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") |
| 799 | + | else |
| 800 | + | player:popupFYI("Sua backpack esta cheia.") |
| 801 | + | return false |
| 802 | + | end |
| 803 | + | else |
| 804 | + | if SLOT_OFFERT > 00 then |
| 805 | + | if _SLOT == 00 or _SLOT == 03 or _SLOT > 09 then |
| 806 | + | if qnt < 01 then |
| 807 | + | db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") |
| 808 | + | else |
| 809 | + | db.query("UPDATE `market` SET `type` = 1, `offert` = 0 WHERE `id` = " ..ITEM_REMOVE_ID.. ";") |
| 810 | + | end |
| 811 | + | else |
| 812 | + | db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") |
| 813 | + | end |
| 814 | + | |
| 815 | + | if _SLOT == 00 or _SLOT > 09 then |
| 816 | + | _SLOT = 03 |
| 817 | + | end |
| 818 | + | if result.getDataInt(Test, "uid_1") == 3218 then |
| 819 | + | local offert = result.getDataInt(Test, "offert") |
| 820 | + | PlayerVipCoins(player, 02, offert) |
| 821 | + | player:sendCancelMessage("@LootMSG 3218 3 0 " ..offert) |
| 822 | + | else |
| 823 | + | if doBackpack(player, 00, _SLOT, 00, 01) then |
| 824 | + | local PLAYER_EXT = doBackpack(player, 09) |
| 825 | + | local PLAYER_POS = doBackpack(player, 08) |
| 826 | + | if _SLOT == 03 then |
| 827 | + | doBackpack(player, 03, _SLOT, 00, 01, result.getDataInt(Test, "uid_1")) -- Procurar |
| 828 | + | 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 |
| 829 | + | player:getPosition():sendMagicEffect(14) |
| 830 | + | end |
| 831 | + | else |
| 832 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, result.getDataInt(Test, "uid_1")) |
| 833 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, result.getDataInt(Test, "uid_2")) |
| 834 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, result.getDataInt(Test, "uid_3")) |
| 835 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, result.getDataInt(Test, "uid_4")) |
| 836 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, result.getDataInt(Test, "uid_5")) |
| 837 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, result.getDataInt(Test, "uid_6")) |
| 838 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, result.getDataInt(Test, "uid_7")) |
| 839 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, result.getDataInt(Test, "uid_8")) |
| 840 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, result.getDataInt(Test, "uid_9")) |
| 841 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, result.getDataInt(Test, "uid_10")) |
| 842 | + | player:sendCancelMessage("@LootMSG " ..result.getDataInt(Test, "uid_1").. " " ..result.getDataInt(Test, "uid_2").. " " ..result.getDataInt(Test, "uid_3").. " 1") |
| 843 | + | |
| 844 | + | local TypePay = result.getDataInt(Test, "type") |
| 845 | + | local vipPrice = result.getDataInt(Test, "vip_price") |
| 846 | + | local goldPrice = result.getDataInt(Test, "price") |
| 847 | + | if TypePay == 01 then |
| 848 | + | if vipPrice > 00 then |
| 849 | + | PlayerVipCoins(player, 02, vipPrice) |
| 850 | + | player:sendCancelMessage("@LootMSG 3218 3 0 " ..vipPrice) |
| 851 | + | end |
| 852 | + | elseif TypePay == 03 then |
| 853 | + | if goldPrice > 00 then |
| 854 | + | PlayerGoldCoins(player, 02, goldPrice) |
| 855 | + | end |
| 856 | + | end |
| 857 | + | end |
| 858 | + | end |
| 859 | + | end |
| 860 | + | else |
| 861 | + | local vipPrice = result.getDataInt(Test, "vip_price") |
| 862 | + | local goldPrice = result.getDataInt(Test, "price") |
| 863 | + | |
| 864 | + | db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. ITEM_REMOVE_ID .. ";") |
| 865 | + | if vipPrice > 00 then |
| 866 | + | PlayerVipCoins(player, 02, vipPrice) |
| 867 | + | player:sendCancelMessage("@LootMSG 3218 3 0 " ..vipPrice) |
| 868 | + | end |
| 869 | + | if goldPrice > 00 then |
| 870 | + | PlayerGoldCoins(player, 02, (goldPrice * qnt)) |
| 871 | + | end |
| 872 | + | end |
| 873 | + | |
| 874 | + | doBackpack(player, 11) |
| 875 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 876 | + | if Test then |
| 877 | + | player:sendCancelMessage("@RemoveSlotsMarket 01") |
| 878 | + | else |
| 879 | + | player:sendCancelMessage("@RemoveSlotsMarket 00") |
| 880 | + | end |
| 881 | + | return false |
| 882 | + | end |
| 883 | + | end |
| 884 | + | |
| 885 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 886 | + | if Test then |
| 887 | + | player:sendCancelMessage("@RemoveSlotsMarket 01") |
| 888 | + | else |
| 889 | + | player:sendCancelMessage("@RemoveSlotsMarket 00") |
| 890 | + | end |
| 891 | + | return false |
| 892 | + | end |
| 893 | + | if opcode == OPCODE_SEARCH_MARKET then |
| 894 | + | local split = buffer:splitTrimmed(",") |
| 895 | + | local CATEGORY = tonumber(split[01]) |
| 896 | + | local WORD_SEARCH = split[02] |
| 897 | + | local MarketMysql = false |
| 898 | + | |
| 899 | + | if #WORD_SEARCH > 01 then |
| 900 | + | MarketMysql = db.storeQuery("SELECT * FROM market WHERE (name LIKE '" ..WORD_SEARCH.. "%' OR name LIKE '%" ..WORD_SEARCH.. "%') ORDER BY `price` ASC;") |
| 901 | + | else |
| 902 | + | if CATEGORY > 00 then |
| 903 | + | MarketMysql = db.storeQuery("SELECT * FROM market WHERE (category = " ..CATEGORY.. ") ORDER BY `price` ASC;") |
| 904 | + | else |
| 905 | + | --MarketMysql = db.storeQuery('SELECT * FROM `market` ORDER BY `id` DESC LIMIT 25;') |
| 906 | + | end |
| 907 | + | end |
| 908 | + | |
| 909 | + | if MarketMysql then |
| 910 | + | local i = 1 |
| 911 | + | repeat |
| 912 | + | 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")) |
| 913 | + | i = i + 1 |
| 914 | + | until not result.next(MarketMysql) |
| 915 | + | result.free() |
| 916 | + | end |
| 917 | + | |
| 918 | + | player:sendCancelMessage("@MyOffertRefresh 01") |
| 919 | + | return true |
| 920 | + | end |
| 921 | + | if opcode == OPCODE_LOAD_MYOFFERT_MARKET then |
| 922 | + | local playerGuid = player:getGuid() |
| 923 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 924 | + | |
| 925 | + | if Test then |
| 926 | + | local offertLimit = 10 |
| 927 | + | local i = 1 |
| 928 | + | repeat |
| 929 | + | 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")) |
| 930 | + | i = i + 1 |
| 931 | + | until not result.next(Test) or i > offertLimit |
| 932 | + | result.free() |
| 933 | + | end |
| 934 | + | |
| 935 | + | player:sendCancelMessage("@MyOffertRefresh 02") |
| 936 | + | return true |
| 937 | + | end |
| 938 | + | if opcode == OPCODE_INSERT_MARKET then |
| 939 | + | local split = buffer:splitTrimmed(",") |
| 940 | + | local playerGuid = player:getGuid() |
| 941 | + | local QNT = tonumber(split[01]) |
| 942 | + | local PRICE_UND = tonumber(split[02]) |
| 943 | + | local SLOT_ITEM = tonumber(split[03]) |
| 944 | + | local EXT_BAG = tonumber(split[04]) |
| 945 | + | local POS_BAG = tonumber(split[05]) |
| 946 | + | local ANONYMOUS = tonumber(split[06]) |
| 947 | + | local VIP_COINS_OFFERT = tonumber(split[07]) |
| 948 | + | local OFFERT_TYPE = tonumber(split[08]) |
| 949 | + | local VIP_COINS = PlayerVipCoins(player, 00) |
| 950 | + | local GOLD_COINS = PlayerGoldCoins(player, 00) |
| 951 | + | local DELET_ITEM = false |
| 952 | + | |
| 953 | + | if OFFERT_TYPE == 00 then |
| 954 | + | if SLOT_ITEM == 10 then |
| 955 | + | local ITEM_ID = 3218 |
| 956 | + | if QNT > VIP_COINS then |
| 957 | + | player:popupFYI("Erro de quantidade. Opera��o cancelada!") |
| 958 | + | return false |
| 959 | + | else |
| 960 | + | if QNT == VIP_COINS then |
| 961 | + | DELET_ITEM = true |
| 962 | + | else |
| 963 | + | D = QNT |
| 964 | + | DELET_ITEM = false |
| 965 | + | end |
| 966 | + | end |
| 967 | + | |
| 968 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 969 | + | local i = 0 |
| 970 | + | if Test then |
| 971 | + | local offertLimit = 10 |
| 972 | + | repeat |
| 973 | + | i = i + 1 |
| 974 | + | until not result.next(Test) or i > offertLimit |
| 975 | + | result.free() |
| 976 | + | end |
| 977 | + | if i >= 10 then |
| 978 | + | player:popupFYI("Limite Atingido!\nVoc� somente pode adicionar 10 itens a venda no Market.") |
| 979 | + | return false |
| 980 | + | end |
| 981 | + | |
| 982 | + | local slotCheck = 10 |
| 983 | + | 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)") |
| 984 | + | |
| 985 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 986 | + | if Test then |
| 987 | + | local offertLimit = 10 |
| 988 | + | local i = 1 |
| 989 | + | repeat |
| 990 | + | 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")) |
| 991 | + | i = i + 1 |
| 992 | + | until not result.next(Test) or i > offertLimit |
| 993 | + | result.free() |
| 994 | + | end |
| 995 | + | if DELET_ITEM == true then |
| 996 | + | PlayerVipCoins(player, 01, VIP_COINS) |
| 997 | + | else |
| 998 | + | PlayerVipCoins(player, 01, QNT) |
| 999 | + | end |
| 1000 | + | |
| 1001 | + | doBackpack(player, 11) |
| 1002 | + | player:sendCancelMessage("@MyOffertRefresh 02") |
| 1003 | + | return true |
| 1004 | + | end |
| 1005 | + | if player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_01) > 0 then |
| 1006 | + | local ITEM_ID = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_01) |
| 1007 | + | local B = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_02) or 0 |
| 1008 | + | local C = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_03) or 0 |
| 1009 | + | local D = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04) or 0 |
| 1010 | + | local E = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_05) or 0 |
| 1011 | + | local F = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_06) or 0 |
| 1012 | + | local G = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_07) or 0 |
| 1013 | + | local H = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_08) or 0 |
| 1014 | + | local I = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_09) or 0 |
| 1015 | + | local J = player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_10) or 0 |
| 1016 | + | |
| 1017 | + | if SLOT_ITEM == 03 then |
| 1018 | + | if QNT > player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04) then |
| 1019 | + | player:popupFYI("Erro de quantidade. Opera��o cancelada!") |
| 1020 | + | return false |
| 1021 | + | else |
| 1022 | + | if QNT == player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04) then |
| 1023 | + | DELET_ITEM = true |
| 1024 | + | else |
| 1025 | + | D = QNT |
| 1026 | + | DELET_ITEM = false |
| 1027 | + | end |
| 1028 | + | end |
| 1029 | + | else |
| 1030 | + | DELET_ITEM = true |
| 1031 | + | end |
| 1032 | + | |
| 1033 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 1034 | + | local i = 0 |
| 1035 | + | if Test then |
| 1036 | + | local offertLimit = 10 |
| 1037 | + | repeat |
| 1038 | + | i = i + 1 |
| 1039 | + | until not result.next(Test) or i > offertLimit |
| 1040 | + | result.free() |
| 1041 | + | end |
| 1042 | + | |
| 1043 | + | if i >= 10 then |
| 1044 | + | player:popupFYI("Limite Atingido!\nVoc� somente pode adicionar 10 itens no Market.") |
| 1045 | + | return false |
| 1046 | + | end |
| 1047 | + | |
| 1048 | + | local slotCheck = SLOT_ITEM |
| 1049 | + | if _ITEMS[ITEM_ID].SLOT_EQUIP == 10 or _ITEMS[ITEM_ID].SLOT_EQUIP == 11 or _ITEMS[ITEM_ID].SLOT_EQUIP == 12 then |
| 1050 | + | slotCheck = _ITEMS[ITEM_ID].SLOT_EQUIP |
| 1051 | + | end |
| 1052 | + | if string.find(_ITEMS[ITEM_ID].NAME, "Rune") then |
| 1053 | + | slotCheck = 13 |
| 1054 | + | end |
| 1055 | + | |
| 1056 | + | 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.. ")") |
| 1057 | + | |
| 1058 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 1059 | + | if Test then |
| 1060 | + | local offertLimit = 10 |
| 1061 | + | local i = 1 |
| 1062 | + | repeat |
| 1063 | + | 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")) |
| 1064 | + | i = i + 1 |
| 1065 | + | until not result.next(Test) or i > offertLimit |
| 1066 | + | result.free() |
| 1067 | + | end |
| 1068 | + | if DELET_ITEM == true then |
| 1069 | + | doBackpack(player, 02, SLOT_ITEM, EXT_BAG, POS_BAG) |
| 1070 | + | else |
| 1071 | + | player:setStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04, (player:getStorageValue(_BACKPACK[SLOT_ITEM][EXT_BAG][POS_BAG].UID_04) - QNT)) |
| 1072 | + | end |
| 1073 | + | |
| 1074 | + | player:sendCancelMessage("@MyOffertRefresh 02") |
| 1075 | + | doBackpack(player, 00, SLOT_ITEM, EXT_BAG, 01) |
| 1076 | + | player:sendCancelMessage("@ReloadBackpack " ..SLOT_ITEM.. " 01 01") |
| 1077 | + | return true |
| 1078 | + | end |
| 1079 | + | elseif OFFERT_TYPE == 01 then |
| 1080 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 1081 | + | local i = 0 |
| 1082 | + | if Test then |
| 1083 | + | local offertLimit = 10 |
| 1084 | + | repeat |
| 1085 | + | i = i + 1 |
| 1086 | + | until not result.next(Test) or i > offertLimit |
| 1087 | + | result.free() |
| 1088 | + | end |
| 1089 | + | |
| 1090 | + | if i >= 10 then |
| 1091 | + | player:popupFYI("Limite Atingido!\nVoc� somente pode adicionar 10 itens no Market.") |
| 1092 | + | return false |
| 1093 | + | end |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | local slotCheck = SLOT_ITEM |
| 1097 | + | if _ITEMS[EXT_BAG].SLOT_EQUIP == 10 or _ITEMS[EXT_BAG].SLOT_EQUIP == 11 or _ITEMS[EXT_BAG].SLOT_EQUIP == 12 then |
| 1098 | + | slotCheck = _ITEMS[EXT_BAG].SLOT_EQUIP |
| 1099 | + | end |
| 1100 | + | if string.find(_ITEMS[EXT_BAG].NAME, "Rune") then |
| 1101 | + | slotCheck = 13 |
| 1102 | + | end |
| 1103 | + | if SLOT_ITEM == 04 then |
| 1104 | + | QNT = 0 |
| 1105 | + | end |
| 1106 | + | |
| 1107 | + | if VIP_COINS < VIP_COINS_OFFERT then |
| 1108 | + | player:popupFYI("Voc� n�o possui as vip coins que est� oferecendo.") |
| 1109 | + | return false |
| 1110 | + | end |
| 1111 | + | if GOLD_COINS < (PRICE_UND * QNT) then |
| 1112 | + | player:popupFYI("Voc� n�o possui os gold coins que est� oferecendo.") |
| 1113 | + | return false |
| 1114 | + | end |
| 1115 | + | |
| 1116 | + | if VIP_COINS_OFFERT > 00 then |
| 1117 | + | PlayerVipCoins(player, 01, VIP_COINS_OFFERT) |
| 1118 | + | end |
| 1119 | + | if PRICE_UND > 00 then |
| 1120 | + | PlayerGoldCoins(player, 01, (PRICE_UND * QNT)) |
| 1121 | + | end |
| 1122 | + | |
| 1123 | + | doBackpack(player, 11) |
| 1124 | + | 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)") |
| 1125 | + | |
| 1126 | + | local Test = db.storeQuery('SELECT * FROM `market` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` ASC;') |
| 1127 | + | if Test then |
| 1128 | + | local offertLimit = 10 |
| 1129 | + | local i = 1 |
| 1130 | + | repeat |
| 1131 | + | 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")) |
| 1132 | + | i = i + 1 |
| 1133 | + | until not result.next(Test) or i > offertLimit |
| 1134 | + | result.free() |
| 1135 | + | end |
| 1136 | + | |
| 1137 | + | player:sendCancelMessage("@MyOffertRefresh 02") |
| 1138 | + | return true |
| 1139 | + | end |
| 1140 | + | end |
| 1141 | + | if opcode == MARKET_OFFERT_SELL then |
| 1142 | + | local split = buffer:splitTrimmed(",") |
| 1143 | + | local MARKET_ID = tonumber(split[01]) |
| 1144 | + | local SELLER_ID = tonumber(split[02]) |
| 1145 | + | local QNT_BUY = tonumber(split[03]) |
| 1146 | + | local SELLER_NAME = split[04] |
| 1147 | + | local ANONYMOUS = tonumber(split[05]) |
| 1148 | + | local VIP_PAYMENT = tonumber(split[06]) |
| 1149 | + | local POS_ID = tonumber(split[07]) |
| 1150 | + | local VIP_COINS = PlayerVipCoins(player, 00) |
| 1151 | + | local playerGuid = player:getGuid() |
| 1152 | + | local Test = db.storeQuery("SELECT * FROM market WHERE (id = " ..MARKET_ID.. " AND player_id = " ..SELLER_ID.. ");") |
| 1153 | + | if Test then |
| 1154 | + | local CHECK_DELETE_ITEM = 00 |
| 1155 | + | local ITEM_ID = result.getDataInt(Test, "uid_1") |
| 1156 | + | local QntSystem = result.getDataInt(Test, "uid_4") |
| 1157 | + | local itemPrice = result.getDataInt(Test, "price") |
| 1158 | + | local vipPrice = result.getDataInt(Test, "vip_price") |
| 1159 | + | local myGold = PlayerGoldCoins(player, 00) or 0 |
| 1160 | + | |
| 1161 | + | itemPrice = itemPrice * QNT_BUY |
| 1162 | + | local _SLOT = _ITEMS[ITEM_ID].SLOT_EQUIP |
| 1163 | + | if ITEM_ID == 3218 then |
| 1164 | + | local offert = result.getDataInt(Test, "offert") |
| 1165 | + | local qnt = result.getDataInt(Test, "uid_4") |
| 1166 | + | if VIP_COINS >= QNT_BUY then |
| 1167 | + | db.query("UPDATE `market` SET `offert` = " ..(offert + QNT_BUY).. ", `uid_4` = " ..(qnt - QNT_BUY).. " WHERE `id` = " ..MARKET_ID.. ";") |
| 1168 | + | PlayerVipCoins(player, 01, QNT_BUY) |
| 1169 | + | |
| 1170 | + | PlayerGoldCoins(player, 02, itemPrice) |
| 1171 | + | local G = PlayerGoldCoins(player, 00) |
| 1172 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 1173 | + | player:sendCancelMessage("@LoadGold " ..G.. " " ..O) |
| 1174 | + | |
| 1175 | + | doBackpack(player, 11) |
| 1176 | + | player:sendCancelMessage("@RemoveSlotsMarket 02 01 " ..POS_ID) |
| 1177 | + | player:sendCancelMessage("@MyOffertRefresh 01") |
| 1178 | + | return true |
| 1179 | + | else |
| 1180 | + | player:popupFYI("Voc� n�o possui essa quantidade para venda.\nQuantidade em sua conta: (" ..VIP_COINS.. ")") |
| 1181 | + | return false |
| 1182 | + | end |
| 1183 | + | return true |
| 1184 | + | end |
| 1185 | + | |
| 1186 | + | if _SLOT == 00 or _SLOT > 09 then |
| 1187 | + | _SLOT = 03 |
| 1188 | + | end |
| 1189 | + | local rare = result.getDataInt(Test, "uid_2") |
| 1190 | + | local star = result.getDataInt(Test, "uid_3") |
| 1191 | + | local qnt = result.getDataInt(Test, "uid_4") |
| 1192 | + | local offert = result.getDataInt(Test, "offert") |
| 1193 | + | |
| 1194 | + | -- Pesquisa Avan�ada |
| 1195 | + | local _RESULTADO_BUSCA = false |
| 1196 | + | local _QNT = 00 |
| 1197 | + | local _EXT = 00 |
| 1198 | + | local _POS = 01 |
| 1199 | + | if VIP_PAYMENT == 00 then |
| 1200 | + | for BAG_EXT = 00, 03 do |
| 1201 | + | for BAG_POS = 01, _SYSTEM.MAX_BAG_SLOT do |
| 1202 | + | if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_01) > 00 then |
| 1203 | + | -------------------- CRIT�RIOS DE BUSCA |
| 1204 | + | if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_01) == ITEM_ID then |
| 1205 | + | if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_02) >= rare then |
| 1206 | + | if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_03) >= star then |
| 1207 | + | _QNT = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_04) |
| 1208 | + | _EXT = BAG_EXT |
| 1209 | + | _POS = BAG_POS |
| 1210 | + | _RESULTADO_BUSCA = true |
| 1211 | + | break |
| 1212 | + | end |
| 1213 | + | end |
| 1214 | + | end |
| 1215 | + | -------------------- |
| 1216 | + | else |
| 1217 | + | break |
| 1218 | + | end |
| 1219 | + | end |
| 1220 | + | end |
| 1221 | + | else |
| 1222 | + | _EXT = tonumber(split[09]) |
| 1223 | + | _POS = tonumber(split[10]) |
| 1224 | + | if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_01) > 00 then |
| 1225 | + | if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_01) == ITEM_ID then -- ITEM ID |
| 1226 | + | if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_02) >= rare then -- ITEM RARE |
| 1227 | + | if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_03) >= star then -- ITEM STAR |
| 1228 | + | _QNT = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_04) |
| 1229 | + | _RESULTADO_BUSCA = true |
| 1230 | + | end |
| 1231 | + | end |
| 1232 | + | end |
| 1233 | + | end |
| 1234 | + | end |
| 1235 | + | |
| 1236 | + | if _RESULTADO_BUSCA then |
| 1237 | + | local PAYMENT_TYPE = 01 |
| 1238 | + | if doBackpack(player, 00, _SLOT, 00, 01) then |
| 1239 | + | if _SLOT == 03 then |
| 1240 | + | if _QNT >= QNT_BUY then |
| 1241 | + | db.query("UPDATE `market` SET `offert` = " ..(offert + QNT_BUY).. ", `uid_4` = " ..(qnt - QNT_BUY).. " WHERE `id` = " ..MARKET_ID.. ";") |
| 1242 | + | |
| 1243 | + | if _QNT > QNT_BUY then |
| 1244 | + | player:setStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_04, (player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_04) - QNT_BUY)) |
| 1245 | + | else |
| 1246 | + | doBackpack(player, 02, _SLOT, _EXT, _POS) |
| 1247 | + | end |
| 1248 | + | |
| 1249 | + | PlayerGoldCoins(player, 02, itemPrice) |
| 1250 | + | local G = PlayerGoldCoins(player, 00) |
| 1251 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 1252 | + | player:sendCancelMessage("@LoadGold " ..G.. " " ..O) |
| 1253 | + | doBackpack(player, 11) |
| 1254 | + | doBackpack(player, 00, _SLOT, 00, 01) |
| 1255 | + | player:sendCancelMessage("@ReloadBackpack " .._SLOT.. " 01 01") |
| 1256 | + | |
| 1257 | + | player:sendCancelMessage("@RemoveSlotsMarket 02 01 " ..POS_ID) |
| 1258 | + | player:sendCancelMessage("@MyOffertRefresh 01") |
| 1259 | + | return true |
| 1260 | + | else |
| 1261 | + | player:popupFYI("Voc� n�o possui essa quantidade para venda.\nQuantidade em sua backpack: (" .._QNT.. ")") |
| 1262 | + | return false |
| 1263 | + | end |
| 1264 | + | else |
| 1265 | + | local _RARE = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_02) or 00 |
| 1266 | + | local _STAR = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_03) or 00 |
| 1267 | + | local _UID4 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_04) or 00 |
| 1268 | + | local _UID5 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_05) or 00 |
| 1269 | + | local _UID6 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_06) or 00 |
| 1270 | + | local _UID7 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_07) or 00 |
| 1271 | + | local _UID8 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_08) or 00 |
| 1272 | + | local _UID9 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_09) or 00 |
| 1273 | + | local _UID10 = player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS].UID_10) or 00 |
| 1274 | + | |
| 1275 | + | if doBackpack(player, 02, _SLOT, _EXT, _POS) then |
| 1276 | + | if VIP_PAYMENT > 00 then |
| 1277 | + | PAYMENT_TYPE = 03 |
| 1278 | + | player:sendCancelMessage("@LootMSG 3218 3 0 " ..vipPrice) |
| 1279 | + | PlayerVipCoins(player, 02, vipPrice) |
| 1280 | + | else |
| 1281 | + | PlayerGoldCoins(player, 02, itemPrice) |
| 1282 | + | end |
| 1283 | + | |
| 1284 | + | 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.. ";") |
| 1285 | + | local _cid = Player(SELLER_ID) |
| 1286 | + | if _cid then |
| 1287 | + | if VIP_PAYMENT > 00 then |
| 1288 | + | _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� acaba de comprar [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..vipPrice.. "] Vip Coins.") |
| 1289 | + | else |
| 1290 | + | _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� acaba de comprar [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coins.") |
| 1291 | + | end |
| 1292 | + | end |
| 1293 | + | |
| 1294 | + | local G = PlayerGoldCoins(player, 00) |
| 1295 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 1296 | + | player:sendCancelMessage("@LoadGold " ..G.. " " ..O) |
| 1297 | + | doBackpack(player, 11) |
| 1298 | + | doBackpack(player, 00, _SLOT, 00, 01) |
| 1299 | + | player:sendCancelMessage("@ReloadBackpack " .._SLOT.. " 01 01") |
| 1300 | + | |
| 1301 | + | player:sendCancelMessage("@RemoveSlotsMarket 02 01 " ..POS_ID) |
| 1302 | + | player:sendCancelMessage("@MyOffertRefresh 01") |
| 1303 | + | return true |
| 1304 | + | end |
| 1305 | + | end |
| 1306 | + | else |
| 1307 | + | player:popupFYI("Sua Backpack est� cheia.") |
| 1308 | + | return false |
| 1309 | + | end |
| 1310 | + | else |
| 1311 | + | player:popupFYI("Voc� n�o possui este item para venda.") |
| 1312 | + | return false |
| 1313 | + | end |
| 1314 | + | else |
| 1315 | + | player:popupFYI("Item n�o encontrado no sistema.\nEle pode ter sido vendido enquanto voc� confirmava a compra.") |
| 1316 | + | player:sendCancelMessage("@MyOffertRefresh 01") |
| 1317 | + | end |
| 1318 | + | end |
| 1319 | + | if opcode == OPCODE_OFFERT_LIST_ITEM then |
| 1320 | + | local split = buffer:splitTrimmed(",") |
| 1321 | + | local _ITEMID = tonumber(split[01]) |
| 1322 | + | local _RARE = tonumber(split[02]) |
| 1323 | + | local _STAR = tonumber(split[03]) |
| 1324 | + | local _SLOT = tonumber(split[04]) |
| 1325 | + | local _COUNT = 01 |
| 1326 | + | for BAG_EXT = 00, 03 do |
| 1327 | + | for BAG_POS = 01, _SYSTEM.MAX_BAG_SLOT do |
| 1328 | + | if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_01) > 00 then |
| 1329 | + | -------------------- CRIT�RIOS DE BUSCA |
| 1330 | + | if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_01) == _ITEMID then |
| 1331 | + | if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_02) >= _RARE then |
| 1332 | + | if player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_03) >= _STAR then |
| 1333 | + | local UID_02 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_02) |
| 1334 | + | local UID_03 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_03) |
| 1335 | + | local UID_04 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_04) |
| 1336 | + | local UID_05 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_05) |
| 1337 | + | local UID_06 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_06) |
| 1338 | + | local UID_07 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_07) |
| 1339 | + | local UID_08 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_08) |
| 1340 | + | local UID_09 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_09) |
| 1341 | + | local UID_10 = player:getStorageValue(_BACKPACK[_SLOT][BAG_EXT][BAG_POS].UID_10) |
| 1342 | + | |
| 1343 | + | 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 |
| 1344 | + | player:sendCancelMessage("@LoadOffertList@" ..strBusca) |
| 1345 | + | _COUNT = _COUNT + 01 |
| 1346 | + | end |
| 1347 | + | end |
| 1348 | + | end |
| 1349 | + | -------------------- |
| 1350 | + | else |
| 1351 | + | break |
| 1352 | + | end |
| 1353 | + | end |
| 1354 | + | end |
| 1355 | + | if _COUNT > 01 then |
| 1356 | + | player:sendCancelMessage("@ShowOffertList") |
| 1357 | + | return true |
| 1358 | + | else |
| 1359 | + | player:popupFYI("Voc� n�o possui este item para venda.") |
| 1360 | + | return true |
| 1361 | + | end |
| 1362 | + | end |
| 1363 | + | if opcode == OPCODE_BUY_ITEM_MARKET then |
| 1364 | + | local split = buffer:splitTrimmed(",") |
| 1365 | + | local MARKET_ID = tonumber(split[01]) |
| 1366 | + | local SELLER_ID = tonumber(split[02]) |
| 1367 | + | local QNT_BUY = tonumber(split[03]) |
| 1368 | + | local SELLER_NAME = split[04] |
| 1369 | + | local ANONYMOUS = tonumber(split[05]) |
| 1370 | + | local VIP_PAYMENT = tonumber(split[06]) |
| 1371 | + | local POS_ID = tonumber(split[07]) |
| 1372 | + | local VIP_COINS = PlayerVipCoins(player, 00) |
| 1373 | + | local playerGuid = player:getGuid() |
| 1374 | + | local Test = db.storeQuery("SELECT * FROM market WHERE (id = " ..MARKET_ID.. " AND player_id = " ..SELLER_ID.. ");") |
| 1375 | + | if Test then |
| 1376 | + | local CHECK_DELETE_ITEM = 00 |
| 1377 | + | local ITEM_ID = result.getDataInt(Test, "uid_1") |
| 1378 | + | local QntSystem = result.getDataInt(Test, "uid_4") |
| 1379 | + | local myGold = PlayerGoldCoins(player, 00) or 0 |
| 1380 | + | local itemPrice = result.getDataInt(Test, "price") |
| 1381 | + | local vipPrice = result.getDataInt(Test, "vip_price") |
| 1382 | + | itemPrice = itemPrice * QNT_BUY |
| 1383 | + | local _SLOT = _ITEMS[ITEM_ID].SLOT_EQUIP |
| 1384 | + | if ITEM_ID == 3218 then |
| 1385 | + | if myGold >= itemPrice then |
| 1386 | + | PlayerVipCoins(player, 02, QNT_BUY) |
| 1387 | + | player:sendCancelMessage("@LootMSG " ..ITEM_ID.. " 3 0 " ..QNT_BUY) |
| 1388 | + | if _DEBUG_MODE then |
| 1389 | + | print("[CREATURESCRIPT - MARKET] " ..player:getName().. " - Comprou Vip Coins [ x" ..QNT_BUY.. " ] de " ..SELLER_NAME) |
| 1390 | + | end |
| 1391 | + | --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - itemPrice)) |
| 1392 | + | PlayerGoldCoins(player, 01, itemPrice) |
| 1393 | + | player:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� comprou [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "].") |
| 1394 | + | 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)") |
| 1395 | + | 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)") |
| 1396 | + | |
| 1397 | + | local _cid = Player(SELLER_ID) |
| 1398 | + | if _cid then |
| 1399 | + | --_cid:setStorageValue(_SYSTEM.GOLD_COIN, (_cid:getStorageValue(_SYSTEM.GOLD_COIN) + itemPrice)) |
| 1400 | + | PlayerGoldCoins(_cid, 02, itemPrice) |
| 1401 | + | _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� acaba de vender [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "].") |
| 1402 | + | else |
| 1403 | + | local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_GOLD.. " AND `player_id` = " ..SELLER_ID.. ");") |
| 1404 | + | if checkNotify then |
| 1405 | + | db.query("UPDATE `player_storage` SET `value` = " ..(result.getDataInt(checkNotify, "value") + itemPrice).. " WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_GOLD.. " AND `player_id` = " ..SELLER_ID.. ");") |
| 1406 | + | else |
| 1407 | + | db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. SELLER_ID .. ", " .. _SYSTEM.NOTIFY_MARKET_GOLD .. ", " ..itemPrice.. ")") |
| 1408 | + | end |
| 1409 | + | end |
| 1410 | + | |
| 1411 | + | if QNT_BUY == QntSystem then |
| 1412 | + | CHECK_DELETE_ITEM = 01 |
| 1413 | + | db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. MARKET_ID .. ";") |
| 1414 | + | else |
| 1415 | + | db.query("UPDATE `market` SET `uid_4` = " ..(result.getDataInt(Test, "uid_4") - QNT_BUY).. " WHERE (`id` = " ..MARKET_ID.. " AND `player_id` = " ..SELLER_ID.. ");") |
| 1416 | + | end |
| 1417 | + | else |
| 1418 | + | player:popupFYI("Voc� n�o possui dinheiro suficiente.") |
| 1419 | + | return false |
| 1420 | + | end |
| 1421 | + | |
| 1422 | + | local G = PlayerGoldCoins(player, 00) |
| 1423 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 1424 | + | player:sendCancelMessage("@LoadGold " ..G.. " " ..O) |
| 1425 | + | doBackpack(player, 11) |
| 1426 | + | player:sendCancelMessage("@RemoveSlotsMarket 02 " ..CHECK_DELETE_ITEM.. " " ..POS_ID) |
| 1427 | + | player:sendCancelMessage("@MyOffertRefresh 01") |
| 1428 | + | return true |
| 1429 | + | end |
| 1430 | + | |
| 1431 | + | if _SLOT == 00 or _SLOT > 09 then |
| 1432 | + | _SLOT = 03 |
| 1433 | + | end |
| 1434 | + | |
| 1435 | + | local checkBuy = false |
| 1436 | + | if VIP_PAYMENT > 00 then |
| 1437 | + | if VIP_COINS >= vipPrice then |
| 1438 | + | checkBuy = true |
| 1439 | + | else |
| 1440 | + | player:popupFYI("Voc� n�o possui Vip Coins suficiente.") |
| 1441 | + | return false |
| 1442 | + | end |
| 1443 | + | else |
| 1444 | + | if myGold >= itemPrice then |
| 1445 | + | checkBuy = true |
| 1446 | + | else |
| 1447 | + | player:popupFYI("Voc� n�o possui dinheiro suficiente.") |
| 1448 | + | return false |
| 1449 | + | end |
| 1450 | + | end |
| 1451 | + | |
| 1452 | + | if checkBuy then |
| 1453 | + | local rare = result.getDataInt(Test, "uid_2") |
| 1454 | + | local star = result.getDataInt(Test, "uid_3") |
| 1455 | + | |
| 1456 | + | if doBackpack(player, 00, _SLOT, 00, 01) then |
| 1457 | + | if _SLOT == 03 then |
| 1458 | + | doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) -- Procurar |
| 1459 | + | if doBackpack(player, 01, _SLOT, 00, 0, ITEM_ID, rare, star, QNT_BUY) then |
| 1460 | + | player:getPosition():sendMagicEffect(14) |
| 1461 | + | if VIP_PAYMENT > 00 then |
| 1462 | + | PlayerVipCoins(player, 01, vipPrice) |
| 1463 | + | player:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� comprou [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..vipPrice.. "] Vip Coin.") |
| 1464 | + | 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.. ")") |
| 1465 | + | 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.. ")") |
| 1466 | + | else |
| 1467 | + | PlayerGoldCoins(player, 01, itemPrice) |
| 1468 | + | player:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� comprou [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coin.") |
| 1469 | + | 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.. ")") |
| 1470 | + | 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.. ")") |
| 1471 | + | end |
| 1472 | + | --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - itemPrice)) |
| 1473 | + | if _DEBUG_MODE then |
| 1474 | + | print("[CREATURESCRIPT - MARKET] " ..player:getName().. " - Comprou [ " .._ITEMS[ITEM_ID].NAME.. " x" ..QNT_BUY.. " ] por " ..mask_number(itemPrice).. " de " ..SELLER_NAME) |
| 1475 | + | end |
| 1476 | + | end |
| 1477 | + | else |
| 1478 | + | local PLAYER_EXT = doBackpack(player, 09) |
| 1479 | + | local PLAYER_POS = doBackpack(player, 08) |
| 1480 | + | if _SLOT == 04 then |
| 1481 | + | local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) |
| 1482 | + | if AtrAmmo < 00 then AtrAmmo = 01 end |
| 1483 | + | AtrAmmo = AtrAmmo * 500 |
| 1484 | + | local LimitBullet = AtrAmmo |
| 1485 | + | local market_ammo = result.getDataInt(Test, "uid_10") |
| 1486 | + | |
| 1487 | + | if market_ammo > LimitBullet then |
| 1488 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) |
| 1489 | + | else |
| 1490 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, market_ammo) |
| 1491 | + | end |
| 1492 | + | else |
| 1493 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, market_ammo) |
| 1494 | + | end |
| 1495 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, result.getDataInt(Test, "uid_1")) |
| 1496 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, result.getDataInt(Test, "uid_2")) |
| 1497 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, result.getDataInt(Test, "uid_3")) |
| 1498 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, result.getDataInt(Test, "uid_4")) |
| 1499 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, result.getDataInt(Test, "uid_5")) |
| 1500 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, result.getDataInt(Test, "uid_6")) |
| 1501 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, result.getDataInt(Test, "uid_7")) |
| 1502 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, result.getDataInt(Test, "uid_8")) |
| 1503 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, result.getDataInt(Test, "uid_9")) |
| 1504 | + | player:sendCancelMessage("@LootMSG " ..ITEM_ID.. " " ..rare.. " " ..star.. " 1") |
| 1505 | + | |
| 1506 | + | --player:setStorageValue(_SYSTEM.GOLD_COIN, (player:getStorageValue(_SYSTEM.GOLD_COIN) - itemPrice)) |
| 1507 | + | if VIP_PAYMENT > 00 then |
| 1508 | + | PlayerVipCoins(player, 01, vipPrice) |
| 1509 | + | player:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� comprou [" .._ITEMS[ITEM_ID].NAME.. "] no Market por [" ..vipPrice.. "] Vip Coin.") |
| 1510 | + | 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.. ")") |
| 1511 | + | 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.. ")") |
| 1512 | + | else |
| 1513 | + | PlayerGoldCoins(player, 01, itemPrice) |
| 1514 | + | player:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� comprou [" .._ITEMS[ITEM_ID].NAME.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coin.") |
| 1515 | + | 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.. ")") |
| 1516 | + | 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.. ")") |
| 1517 | + | end |
| 1518 | + | if _DEBUG_MODE then |
| 1519 | + | print("[CREATURESCRIPT - MARKET] " ..player:getName().. " - Comprou [ " .._ITEMS[ITEM_ID].NAME.. " ] por " ..mask_number(itemPrice).. " de " ..SELLER_NAME) |
| 1520 | + | end |
| 1521 | + | end |
| 1522 | + | |
| 1523 | + | local _cid = Player(SELLER_ID) |
| 1524 | + | if _cid then |
| 1525 | + | if _SLOT == 03 then |
| 1526 | + | --_cid:setStorageValue(_SYSTEM.GOLD_COIN, (_cid:getStorageValue(_SYSTEM.GOLD_COIN) + itemPrice)) |
| 1527 | + | if VIP_PAYMENT > 00 then |
| 1528 | + | PlayerVipCoins(_cid, 02, vipPrice) |
| 1529 | + | _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� acaba de vender [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..vipPrice.. "] Vip Coins.") |
| 1530 | + | else |
| 1531 | + | PlayerGoldCoins(_cid, 02, itemPrice) |
| 1532 | + | _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� acaba de vender [" .._ITEMS[ITEM_ID].NAME.. ", x" ..QNT_BUY.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coin.") |
| 1533 | + | end |
| 1534 | + | else |
| 1535 | + | --_cid:setStorageValue(_SYSTEM.GOLD_COIN, (_cid:getStorageValue(_SYSTEM.GOLD_COIN) + itemPrice)) |
| 1536 | + | if VIP_PAYMENT > 00 then |
| 1537 | + | PlayerVipCoins(_cid, 02, vipPrice) |
| 1538 | + | _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� acaba de vender [" .._ITEMS[ITEM_ID].NAME.. "] no Market por [" ..vipPrice.. "] Vip Coins.") |
| 1539 | + | else |
| 1540 | + | PlayerGoldCoins(_cid, 02, itemPrice) |
| 1541 | + | _cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� acaba de vender [" .._ITEMS[ITEM_ID].NAME.. "] no Market por [" ..mask_number(itemPrice).. "] Gold Coin.") |
| 1542 | + | end |
| 1543 | + | end |
| 1544 | + | else |
| 1545 | + | if VIP_PAYMENT > 00 then |
| 1546 | + | local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_VIP.. " AND `player_id` = " ..SELLER_ID.. ");") |
| 1547 | + | if checkNotify then |
| 1548 | + | db.query("UPDATE `player_storage` SET `value` = " ..(result.getDataInt(checkNotify, "value") + vipPrice).. " WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_VIP.. " AND `player_id` = " ..SELLER_ID.. ");") |
| 1549 | + | else |
| 1550 | + | db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. SELLER_ID .. ", " .. _SYSTEM.NOTIFY_MARKET_VIP .. ", " ..vipPrice.. ")") |
| 1551 | + | end |
| 1552 | + | else |
| 1553 | + | local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_GOLD.. " AND `player_id` = " ..SELLER_ID.. ");") |
| 1554 | + | if checkNotify then |
| 1555 | + | db.query("UPDATE `player_storage` SET `value` = " ..(result.getDataInt(checkNotify, "value") + itemPrice).. " WHERE (`key` = " .._SYSTEM.NOTIFY_MARKET_GOLD.. " AND `player_id` = " ..SELLER_ID.. ");") |
| 1556 | + | else |
| 1557 | + | db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. SELLER_ID .. ", " .. _SYSTEM.NOTIFY_MARKET_GOLD .. ", " ..itemPrice.. ")") |
| 1558 | + | end |
| 1559 | + | end |
| 1560 | + | end |
| 1561 | + | if _SLOT == 03 then |
| 1562 | + | if QNT_BUY == QntSystem then |
| 1563 | + | CHECK_DELETE_ITEM = 01 |
| 1564 | + | db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. MARKET_ID .. ";") |
| 1565 | + | else |
| 1566 | + | db.query("UPDATE `market` SET `uid_4` = " ..(result.getDataInt(Test, "uid_4") - QNT_BUY).. " WHERE (`id` = " ..MARKET_ID.. " AND `player_id` = " ..SELLER_ID.. ");") |
| 1567 | + | end |
| 1568 | + | else |
| 1569 | + | db.asyncQuery("DELETE FROM `market` WHERE `id` = " .. MARKET_ID .. ";") |
| 1570 | + | end |
| 1571 | + | |
| 1572 | + | local G = PlayerGoldCoins(player, 00) |
| 1573 | + | local O = player:getStorageValue(_SYSTEM.ONLINE_COIN) |
| 1574 | + | player:sendCancelMessage("@LoadGold " ..G.. " " ..O) |
| 1575 | + | doBackpack(player, 11) |
| 1576 | + | doBackpack(player, 00, _SLOT, 00, 01) |
| 1577 | + | |
| 1578 | + | player:sendCancelMessage("@RemoveSlotsMarket 02 " ..CHECK_DELETE_ITEM.. " " ..POS_ID) |
| 1579 | + | player:sendCancelMessage("@MyOffertRefresh 01") |
| 1580 | + | return true |
| 1581 | + | else |
| 1582 | + | player:popupFYI("Sua backpack esta cheia.") |
| 1583 | + | return false |
| 1584 | + | end |
| 1585 | + | else |
| 1586 | + | player:popupFYI("Falha ao comprar este produto") |
| 1587 | + | return false |
| 1588 | + | end |
| 1589 | + | else |
| 1590 | + | player:popupFYI("Item n�o encontrado no sistema.\nEle pode ter sido vendido enquanto voc� confirmava a compra.") |
| 1591 | + | player:sendCancelMessage("@MyOffertRefresh 01") |
| 1592 | + | end |
| 1593 | + | end |
| 1594 | + | if opcode == OPCODE_HISTORY_MARKET then |
| 1595 | + | local playerGuid = player:getGuid() |
| 1596 | + | local History = db.storeQuery('SELECT * FROM `market_hist` WHERE `player_id` = ' ..playerGuid .. ' ORDER BY `id` DESC LIMIT 30;') |
| 1597 | + | if History then |
| 1598 | + | local i = 1 |
| 1599 | + | repeat |
| 1600 | + | 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")) |
| 1601 | + | i = i + 1 |
| 1602 | + | until not result.next(History) |
| 1603 | + | result.free() |
| 1604 | + | |
| 1605 | + | player:sendCancelMessage("@ShowHistory 01") |
| 1606 | + | else |
| 1607 | + | player:sendCancelMessage("@ShowHistory 00") |
| 1608 | + | end |
| 1609 | + | end |
| 1610 | + | if opcode == OPCODE_PIX_EDIT then |
| 1611 | + | local split = buffer:splitTrimmed(",") |
| 1612 | + | local PLAYER_ACCOUNT = player:getAccountId() |
| 1613 | + | local NAME = split[01] |
| 1614 | + | local EMAIL = split[02] |
| 1615 | + | local BANK = split[03] |
| 1616 | + | |
| 1617 | + | db.query("UPDATE `accounts` SET `rlname` = '" ..NAME.. "', `vote` = '" ..EMAIL.. "', `location` = '" ..BANK.. "' WHERE `id` = " ..PLAYER_ACCOUNT.. ";") |
| 1618 | + | return true |
| 1619 | + | end |
| 1620 | + | if opcode == OPCODE_CRIPTOMOEDA then |
| 1621 | + | local split = buffer:splitTrimmed(",") |
| 1622 | + | local PLAYER_ACCOUNT = player:getAccountId() |
| 1623 | + | local FINAL_ID = tonumber(split[01]) |
| 1624 | + | local FINAL_VALOR = split[02] |
| 1625 | + | local FINAL_NAME = split[03] |
| 1626 | + | local FINAL_EMAIL = split[04] |
| 1627 | + | local FINAL_BANK = split[05] |
| 1628 | + | local FINAL_COIN = tonumber(split[06]) |
| 1629 | + | local FINAL_PRICE = split[07] |
| 1630 | + | local OLD_CRIPTO = tonumber(split[08]) |
| 1631 | + | local ITEM_ID = 00 |
| 1632 | + | local MAX_REQUEST = 00 |
| 1633 | + | |
| 1634 | + | if FINAL_ID == 01 then -- FAZENDO UMA SOLICITA��O DE PAGAMENTO. |
| 1635 | + | local COUNT_REQUEST = db.storeQuery("SELECT id FROM links WHERE account_id = " ..PLAYER_ACCOUNT.. " AND status = 1 ORDER BY `id` ASC;") |
| 1636 | + | if COUNT_REQUEST then |
| 1637 | + | repeat |
| 1638 | + | MAX_REQUEST = MAX_REQUEST + 01 |
| 1639 | + | until not result.next(COUNT_REQUEST) |
| 1640 | + | result.free() |
| 1641 | + | end |
| 1642 | + | if MAX_REQUEST >= 10 then |
| 1643 | + | player:popupFYI("O m�ximo de solicita�es por conta � 10.\nVoc� atualmente possui [ " ..MAX_REQUEST.. " solicita�es em aberto.") |
| 1644 | + | return true |
| 1645 | + | end |
| 1646 | + | local INSERINDO = nil |
| 1647 | + | if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) >= FINAL_COIN then |
| 1648 | + | 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, '')") |
| 1649 | + | if INSERINDO then |
| 1650 | + | player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) - FINAL_COIN)) |
| 1651 | + | player:sendCancelMessage("@StatusCript 01") |
| 1652 | + | doBackpack(player, 11) |
| 1653 | + | else |
| 1654 | + | player:sendCancelMessage("@StatusCript 02") |
| 1655 | + | return true |
| 1656 | + | end |
| 1657 | + | else |
| 1658 | + | player:sendCancelMessage("@StatusCript 02") |
| 1659 | + | return true |
| 1660 | + | end |
| 1661 | + | |
| 1662 | + | local BLACKMARKET = 0 |
| 1663 | + | local SALDO_BLACK = db.storeQuery("SELECT gender FROM accounts WHERE id = 1;") |
| 1664 | + | local CRIPTO = player:getStorageValue(_SYSTEM.CRIPTOMOEDA) |
| 1665 | + | if SALDO_BLACK then |
| 1666 | + | repeat |
| 1667 | + | BLACKMARKET = result.getDataString(SALDO_BLACK, "gender") |
| 1668 | + | until not result.next(SALDO_BLACK) |
| 1669 | + | result.free() |
| 1670 | + | end |
| 1671 | + | |
| 1672 | + | BLACKMARKET = BLACKMARKET - FINAL_VALOR |
| 1673 | + | player:sendCancelMessage("@CriptLoad-02-" ..CRIPTO.. "-" ..BLACKMARKET) |
| 1674 | + | db.query("UPDATE `accounts` SET `gender` = " ..BLACKMARKET.. " WHERE `id` = 1;") |
| 1675 | + | end |
| 1676 | + | if FINAL_ID == 02 then -- EDITANDO UMA SOLICITA��O DE PAGAMENTO. |
| 1677 | + | ITEM_ID = tonumber(split[09]) |
| 1678 | + | local EDITANDO = nil |
| 1679 | + | 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.. ";") |
| 1680 | + | if EDITANDO then |
| 1681 | + | local OLD_FINAL_VALOR = split[10] |
| 1682 | + | local BLACKMARKET = 0 |
| 1683 | + | local SALDO_BLACK = db.storeQuery("SELECT gender FROM accounts WHERE id = 1;") |
| 1684 | + | if SALDO_BLACK then |
| 1685 | + | repeat |
| 1686 | + | BLACKMARKET = result.getDataString(SALDO_BLACK, "gender") |
| 1687 | + | until not result.next(SALDO_BLACK) |
| 1688 | + | result.free() |
| 1689 | + | end |
| 1690 | + | if FINAL_COIN > OLD_CRIPTO then |
| 1691 | + | local NEW_OLD_CRIPT = FINAL_COIN - OLD_CRIPTO |
| 1692 | + | BLACKMARKET = BLACKMARKET - (FINAL_VALOR - OLD_FINAL_VALOR) |
| 1693 | + | player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) - NEW_OLD_CRIPT)) |
| 1694 | + | else |
| 1695 | + | local NEW_OLD_CRIPT = OLD_CRIPTO - FINAL_COIN |
| 1696 | + | BLACKMARKET = BLACKMARKET + (OLD_FINAL_VALOR - FINAL_VALOR) |
| 1697 | + | if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) < 00 then |
| 1698 | + | player:setStorageValue(_SYSTEM.CRIPTOMOEDA, ((player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + NEW_OLD_CRIPT) + 01)) |
| 1699 | + | else |
| 1700 | + | player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + NEW_OLD_CRIPT)) |
| 1701 | + | end |
| 1702 | + | end |
| 1703 | + | |
| 1704 | + | db.query("UPDATE `accounts` SET `gender` = " ..BLACKMARKET.. " WHERE `id` = 1;") |
| 1705 | + | player:sendCancelMessage("@StatusCript 03") |
| 1706 | + | doBackpack(player, 11) |
| 1707 | + | else |
| 1708 | + | player:sendCancelMessage("@StatusCript 04") |
| 1709 | + | return true |
| 1710 | + | end |
| 1711 | + | end |
| 1712 | + | if FINAL_ID == 03 then |
| 1713 | + | ITEM_ID = tonumber(split[09]) |
| 1714 | + | db.asyncQuery("DELETE FROM `links` WHERE `id` = " .. ITEM_ID .. ";") |
| 1715 | + | if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) < 00 then |
| 1716 | + | player:setStorageValue(_SYSTEM.CRIPTOMOEDA, ((player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + FINAL_COIN) + 01)) |
| 1717 | + | else |
| 1718 | + | player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + FINAL_COIN)) |
| 1719 | + | end |
| 1720 | + | |
| 1721 | + | player:sendCancelMessage("@StatusCript 05") |
| 1722 | + | doBackpack(player, 11) |
| 1723 | + | end |
| 1724 | + | |
| 1725 | + | -- REGISTRANDO QUEM FEZ O PEDIDO. |
| 1726 | + | local file = io.open("data/reports/criptomoeda/criptomoeda.txt", "a") |
| 1727 | + | |
| 1728 | + | if not file then |
| 1729 | + | print("Houve um erro em seu processo de report. Por favor, contate o administrador.") |
| 1730 | + | player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Houve um erro em seu processo de report. Por favor, contate o administrador.") |
| 1731 | + | return true |
| 1732 | + | end |
| 1733 | + | local CriptMount = 01 |
| 1734 | + | if player:getLevel() < 100 then |
| 1735 | + | CriptMount = 0.05 |
| 1736 | + | elseif player:getLevel() < 200 then |
| 1737 | + | CriptMount = 0.06 |
| 1738 | + | elseif player:getLevel() < 300 then |
| 1739 | + | CriptMount = 0.07 |
| 1740 | + | elseif player:getLevel() < 400 then |
| 1741 | + | CriptMount = 0.08 |
| 1742 | + | elseif player:getLevel() < 500 then |
| 1743 | + | CriptMount = 0.09 |
| 1744 | + | elseif player:getLevel() < 600 then |
| 1745 | + | CriptMount = 0.10 |
| 1746 | + | elseif player:getLevel() < 700 then |
| 1747 | + | CriptMount = 0.11 |
| 1748 | + | elseif player:getLevel() < 800 then |
| 1749 | + | CriptMount = 0.12 |
| 1750 | + | elseif player:getLevel() < 900 then |
| 1751 | + | CriptMount = 0.13 |
| 1752 | + | elseif player:getLevel() < 999 then |
| 1753 | + | CriptMount = 0.14 |
| 1754 | + | elseif player:getLevel() > 999 then |
| 1755 | + | CriptMount = 0.15 |
| 1756 | + | end |
| 1757 | + | |
| 1758 | + | io.output(file) |
| 1759 | + | io.write("Name: " .. name) |
| 1760 | + | io.write("\n" ..DIAS_SEMANA[Semana].. ", " ..Dia.. " de " ..MES_NAME[Mes].. ", as " ..HourMinutes) |
| 1761 | + | if FINAL_ID == 01 then |
| 1762 | + | local REQUEST = db.storeQuery("SELECT id FROM links WHERE account_id = " ..PLAYER_ACCOUNT.. " ORDER BY `id` ASC;") |
| 1763 | + | if REQUEST then |
| 1764 | + | local i = 1 |
| 1765 | + | repeat |
| 1766 | + | ITEM_ID = result.getDataInt(REQUEST, "id") |
| 1767 | + | i = i + 1 |
| 1768 | + | until not result.next(REQUEST) |
| 1769 | + | result.free() |
| 1770 | + | end |
| 1771 | + | io.write("\nTipo: Fazendo Pedido [ID: " ..ITEM_ID.. "]") |
| 1772 | + | 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") |
| 1773 | + | elseif FINAL_ID == 02 then |
| 1774 | + | io.write("\nTipo: Editando Pedido [ID: " ..ITEM_ID.. "]") |
| 1775 | + | 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") |
| 1776 | + | else |
| 1777 | + | io.write("\nTipo: Excluindo Pedido [ID: " ..ITEM_ID.. "]") |
| 1778 | + | 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") |
| 1779 | + | end |
| 1780 | + | io.write("------------------------------------------------\n\n") |
| 1781 | + | io.close(file) |
| 1782 | + | |
| 1783 | + | end |
| 1784 | + | if opcode == CRIPTOMOEDA_OPCODE then |
| 1785 | + | local split = buffer:splitTrimmed(",") |
| 1786 | + | local ACTION_ID = tonumber(split[01]) |
| 1787 | + | |
| 1788 | + | if ACTION_ID < 05 then |
| 1789 | + | local REQUEST = db.storeQuery("SELECT * FROM links WHERE status = " ..ACTION_ID.. " ORDER BY `id` ASC;") |
| 1790 | + | if REQUEST then |
| 1791 | + | local i = 1 |
| 1792 | + | repeat |
| 1793 | + | local A = result.getDataInt(REQUEST, "id") |
| 1794 | + | local B = result.getDataInt(REQUEST, "account_id") |
| 1795 | + | local C = result.getDataString(REQUEST, "name") |
| 1796 | + | local D = result.getDataString(REQUEST, "email") |
| 1797 | + | local E = result.getDataString(REQUEST, "banco") |
| 1798 | + | local F = result.getDataInt(REQUEST, "criptomoeda") |
| 1799 | + | local G = result.getDataString(REQUEST, "price") |
| 1800 | + | local H = result.getDataString(REQUEST, "valor") |
| 1801 | + | local I = result.getDataInt(REQUEST, "status") |
| 1802 | + | local J = result.getDataString(REQUEST, "obs") |
| 1803 | + | |
| 1804 | + | player:sendCancelMessage("@LinksLoad-" ..i.. "-" ..A.. "-" ..B.. "-" ..C.. "-" ..D.. "-" ..E.. "-" ..F.. "-" ..G.. "-" ..H.. "-" ..I.. "-" ..J) |
| 1805 | + | i = i + 1 |
| 1806 | + | until not result.next(REQUEST) |
| 1807 | + | result.free() |
| 1808 | + | else |
| 1809 | + | player:sendCancelMessage("@DelLinks") |
| 1810 | + | end |
| 1811 | + | return true |
| 1812 | + | else |
| 1813 | + | local STATUS = split[02] |
| 1814 | + | local EDIT_ID = tonumber(split[03]) |
| 1815 | + | local LAST_STATUS = split[04] |
| 1816 | + | local STATUS_OBS = split[05] |
| 1817 | + | |
| 1818 | + | if STATUS_OBS == nil then |
| 1819 | + | STATUS_OBS = '' |
| 1820 | + | end |
| 1821 | + | if STATUS == "04" then |
| 1822 | + | STATUS_OBS = STATUS_OBS.. "\nPagamento realizado [ " ..DIAS_SEMANA[Semana].. ", " ..Dia.. " de " ..MES_NAME[Mes].. " de 20" ..Ano.. ", as " ..HourMinutes.. " ]" |
| 1823 | + | end |
| 1824 | + | db.query("UPDATE `links` SET `status` = " ..STATUS.. ", `obs` = '" ..STATUS_OBS.. "' WHERE `id` = " ..EDIT_ID.. ";") |
| 1825 | + | player:sendCancelMessage("@DelLinks") |
| 1826 | + | local REQUEST_EDIT = db.storeQuery("SELECT * FROM links WHERE status = " ..LAST_STATUS.. " ORDER BY `id` ASC;") |
| 1827 | + | if REQUEST_EDIT then |
| 1828 | + | local i = 1 |
| 1829 | + | repeat |
| 1830 | + | local A = result.getDataInt(REQUEST_EDIT, "id") |
| 1831 | + | local B = result.getDataInt(REQUEST_EDIT, "account_id") |
| 1832 | + | local C = result.getDataString(REQUEST_EDIT, "name") |
| 1833 | + | local D = result.getDataString(REQUEST_EDIT, "email") |
| 1834 | + | local E = result.getDataString(REQUEST_EDIT, "banco") |
| 1835 | + | local F = result.getDataInt(REQUEST_EDIT, "criptomoeda") |
| 1836 | + | local G = result.getDataString(REQUEST_EDIT, "price") |
| 1837 | + | local H = result.getDataString(REQUEST_EDIT, "valor") |
| 1838 | + | local I = result.getDataInt(REQUEST_EDIT, "status") |
| 1839 | + | local J = result.getDataString(REQUEST_EDIT, "obs") |
| 1840 | + | |
| 1841 | + | player:sendCancelMessage("@LinksLoad-" ..i.. "-" ..A.. "-" ..B.. "-" ..C.. "-" ..D.. "-" ..E.. "-" ..F.. "-" ..G.. "-" ..H.. "-" ..I.. "-" ..J) |
| 1842 | + | i = i + 1 |
| 1843 | + | until not result.next(REQUEST_EDIT) |
| 1844 | + | result.free() |
| 1845 | + | end |
| 1846 | + | return true |
| 1847 | + | end |
| 1848 | + | end |
| 1849 | + | if opcode == BLACKMARKET_OPCODE then |
| 1850 | + | local split = buffer:splitTrimmed(",") |
| 1851 | + | local BLACK_VALOR = split[01] |
| 1852 | + | |
| 1853 | + | db.query("UPDATE `accounts` SET `gender` = " ..BLACK_VALOR.. " WHERE `id` = 1;") |
| 1854 | + | local players = Game.getPlayers() |
| 1855 | + | for _, targetPlayer in ipairs(players) do |
| 1856 | + | targetPlayer:sendCancelMessage("@CriptLoad-02-" ..targetPlayer:getStorageValue(_SYSTEM.CRIPTOMOEDA).. "-" ..BLACK_VALOR) |
| 1857 | + | end |
| 1858 | + | |
| 1859 | + | player:popupFYI("Fundos adicionados com sucesso.") |
| 1860 | + | return |
| 1861 | + | end |
| 1862 | + | if opcode == MONITORANDO_ITEMS then |
| 1863 | + | local split = buffer:splitTrimmed(",") |
| 1864 | + | local ACTION = tonumber(split[01]) |
| 1865 | + | |
| 1866 | + | if ACTION == 01 then |
| 1867 | + | local MON_ITEMID = tonumber(split[02]) |
| 1868 | + | local MON_TYPE = tonumber(split[03]) |
| 1869 | + | local players = Game.getPlayers() |
| 1870 | + | for _, targetPlayer in ipairs(players) do |
| 1871 | + | for X = 01, 03 do |
| 1872 | + | if X == 01 then -- ITEM EQUIPADO |
| 1873 | + | if targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_01) == MON_ITEMID then |
| 1874 | + | local UID_02 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_02) |
| 1875 | + | local UID_03 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_03) |
| 1876 | + | local UID_04 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_04) |
| 1877 | + | local UID_05 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_05) |
| 1878 | + | local UID_06 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_06) |
| 1879 | + | local UID_07 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_07) |
| 1880 | + | local UID_08 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_08) |
| 1881 | + | local UID_09 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_09) |
| 1882 | + | local UID_10 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_10) |
| 1883 | + | |
| 1884 | + | 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) |
| 1885 | + | end |
| 1886 | + | end |
| 1887 | + | if X == 02 then -- ITEM NA BACKPACK |
| 1888 | + | for _SLOT = 00, 03 do |
| 1889 | + | for _BAG = 01, 20 do |
| 1890 | + | if targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_01) == MON_ITEMID then |
| 1891 | + | local UID_02 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_02) |
| 1892 | + | local UID_03 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_03) |
| 1893 | + | local UID_04 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_04) |
| 1894 | + | local UID_05 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_05) |
| 1895 | + | local UID_06 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_06) |
| 1896 | + | local UID_07 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_07) |
| 1897 | + | local UID_08 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_08) |
| 1898 | + | local UID_09 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_09) |
| 1899 | + | local UID_10 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_10) |
| 1900 | + | |
| 1901 | + | 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) |
| 1902 | + | end |
| 1903 | + | end |
| 1904 | + | end |
| 1905 | + | end |
| 1906 | + | if X == 03 then -- ITEM NO DEPOT |
| 1907 | + | for _SLOT = 01, #_SYSTEM.DEPOT[01] do |
| 1908 | + | if targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_01) == MON_ITEMID then |
| 1909 | + | local UID_02 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_02) |
| 1910 | + | local UID_03 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_03) |
| 1911 | + | local UID_04 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_04) |
| 1912 | + | local UID_05 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_05) |
| 1913 | + | local UID_06 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_06) |
| 1914 | + | local UID_07 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_07) |
| 1915 | + | local UID_08 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_08) |
| 1916 | + | local UID_09 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_09) |
| 1917 | + | local UID_10 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_10) |
| 1918 | + | |
| 1919 | + | 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) |
| 1920 | + | end |
| 1921 | + | end |
| 1922 | + | end |
| 1923 | + | end |
| 1924 | + | end |
| 1925 | + | |
| 1926 | + | player:sendCancelMessage("@LoadMonItems 01") |
| 1927 | + | end |
| 1928 | + | if ACTION == 02 then |
| 1929 | + | local tid = Player(split[02]) |
| 1930 | + | if(not tid) then |
| 1931 | + | player:popupFYI("Player " .. split[01] .. " not found.") |
| 1932 | + | return false |
| 1933 | + | end |
| 1934 | + | |
| 1935 | + | local TARGET = split[04] |
| 1936 | + | local SLOT = tonumber(split[03]) |
| 1937 | + | local EXT = tonumber(split[05]) |
| 1938 | + | local BAG = tonumber(split[06]) |
| 1939 | + | if TARGET == "Equipado" then |
| 1940 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_01, nil) |
| 1941 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_02, nil) |
| 1942 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_03, nil) |
| 1943 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_04, nil) |
| 1944 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_05, nil) |
| 1945 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_06, nil) |
| 1946 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_07, nil) |
| 1947 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_08, nil) |
| 1948 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_09, nil) |
| 1949 | + | tid:setStorageValue(_SYSTEM.INVENTARIO[SLOT].UID_10, nil) |
| 1950 | + | |
| 1951 | + | doInventario(tid, 00, SLOT, EXT) -- Organizo Invent�rio |
| 1952 | + | doBackpack(tid, 00, SLOT, EXT, 01) -- Organizo Backpack |
| 1953 | + | |
| 1954 | + | if SLOT == 04 then |
| 1955 | + | tid:sendCancelMessage("@LoadAmmo " ..tid:getStorageValue(_SYSTEM.INVENTARIO[04].UID_10)) |
| 1956 | + | end |
| 1957 | + | tid:sendCancelMessage("@RemoveItemInventario " ..SLOT) |
| 1958 | + | player:sendCancelMessage("@LoadMonItems 02") |
| 1959 | + | return true |
| 1960 | + | end |
| 1961 | + | if TARGET == "Backpack" then |
| 1962 | + | doBackpack(tid, 02, SLOT, EXT, BAG) |
| 1963 | + | doBackpack(tid, 00, SLOT, EXT, 01) |
| 1964 | + | tid:sendCancelMessage("@ReloadBackpack " ..SLOT.. " 01 01") |
| 1965 | + | |
| 1966 | + | player:sendCancelMessage("@LoadMonItems 02") |
| 1967 | + | return true |
| 1968 | + | end |
| 1969 | + | if TARGET == "Depot" then |
| 1970 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_01, nil) |
| 1971 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_02, nil) |
| 1972 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_03, nil) |
| 1973 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_04, nil) |
| 1974 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_05, nil) |
| 1975 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_06, nil) |
| 1976 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_07, nil) |
| 1977 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_08, nil) |
| 1978 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_09, nil) |
| 1979 | + | tid:setStorageValue(_SYSTEM.DEPOT[01][BAG].UID_10, nil) |
| 1980 | + | |
| 1981 | + | onDepot(tid, 00, 01) |
| 1982 | + | player:sendCancelMessage("@LoadMonItems 02") |
| 1983 | + | return true |
| 1984 | + | end |
| 1985 | + | end |
| 1986 | + | if ACTION == 03 then |
| 1987 | + | local MON_SHOP = db.storeQuery("SELECT * FROM coins_transactions ORDER BY `id` DESC LIMIT 99;") |
| 1988 | + | if MON_SHOP then |
| 1989 | + | local i = 0 |
| 1990 | + | local offertLimit = 99 |
| 1991 | + | repeat |
| 1992 | + | local ID = result.getDataInt(MON_SHOP, "id") |
| 1993 | + | local PLAYER_GUID = result.getDataInt(MON_SHOP, "account_id") |
| 1994 | + | local CATEGORY = result.getDataInt(MON_SHOP, "type") |
| 1995 | + | local INDEX = result.getDataInt(MON_SHOP, "amount") |
| 1996 | + | local ITEM_NAME = result.getDataString(MON_SHOP, "description") |
| 1997 | + | |
| 1998 | + | player:sendCancelMessage("@MonShop-1-" ..ID.. "-" ..PLAYER_GUID.. "-" ..CATEGORY.. "-" ..INDEX.. "-" ..ITEM_NAME) |
| 1999 | + | i = i + 1 |
| 2000 | + | |
| 2001 | + | until not result.next(MON_SHOP) or i > offertLimit |
| 2002 | + | result.free() |
| 2003 | + | |
| 2004 | + | player:sendCancelMessage("@MonShop-2") |
| 2005 | + | end |
| 2006 | + | end |
| 2007 | + | if ACTION == 04 then |
| 2008 | + | local playerCrypt = {} |
| 2009 | + | local totalCrypt = 00 |
| 2010 | + | local totalSaldo = 00 |
| 2011 | + | local ESTIMATIVA = db.storeQuery("SELECT * FROM `player_storage` WHERE `key` = " .. _SYSTEM.CRIPTOMOEDA .. ";") |
| 2012 | + | if ESTIMATIVA then |
| 2013 | + | local i = 0 |
| 2014 | + | repeat |
| 2015 | + | local PLA_ID = result.getDataInt(ESTIMATIVA, "player_id") |
| 2016 | + | local QUANT = result.getDataInt(ESTIMATIVA, "value") |
| 2017 | + | |
| 2018 | + | totalCrypt = totalCrypt + QUANT |
| 2019 | + | table.insert(playerCrypt, PLA_ID.. "|" ..QUANT) |
| 2020 | + | until not result.next(ESTIMATIVA) |
| 2021 | + | result.free() |
| 2022 | + | end |
| 2023 | + | for X = 01, #playerCrypt do |
| 2024 | + | local str = playerCrypt[X] |
| 2025 | + | local trim = str:splitTrimmed("|") |
| 2026 | + | local playerGuid = tonumber(trim[01]) |
| 2027 | + | local playerCriptomoeda = tonumber(trim[02]) |
| 2028 | + | |
| 2029 | + | local LEVEL_PLAYER_OFF = db.storeQuery("SELECT level FROM `players` WHERE `id` = " .. playerGuid .. ";") |
| 2030 | + | if LEVEL_PLAYER_OFF then |
| 2031 | + | local LEVEL = result.getDataInt(LEVEL_PLAYER_OFF, "level") |
| 2032 | + | local CriptoPrice = 00 |
| 2033 | + | if LEVEL < 100 then |
| 2034 | + | CriptoPrice = 0.05 |
| 2035 | + | elseif LEVEL < 200 then |
| 2036 | + | CriptoPrice = 0.06 |
| 2037 | + | elseif LEVEL < 300 then |
| 2038 | + | CriptoPrice = 0.07 |
| 2039 | + | elseif LEVEL < 400 then |
| 2040 | + | CriptoPrice = 0.08 |
| 2041 | + | elseif LEVEL < 500 then |
| 2042 | + | CriptoPrice = 0.09 |
| 2043 | + | elseif LEVEL < 600 then |
| 2044 | + | CriptoPrice = 0.10 |
| 2045 | + | elseif LEVEL < 700 then |
| 2046 | + | CriptoPrice = 0.11 |
| 2047 | + | elseif LEVEL < 800 then |
| 2048 | + | CriptoPrice = 0.12 |
| 2049 | + | elseif LEVEL < 900 then |
| 2050 | + | CriptoPrice = 0.13 |
| 2051 | + | elseif LEVEL < 999 then |
| 2052 | + | CriptoPrice = 0.14 |
| 2053 | + | elseif LEVEL > 999 then |
| 2054 | + | CriptoPrice = 0.15 |
| 2055 | + | else |
| 2056 | + | CriptoPrice = 0 |
| 2057 | + | end |
| 2058 | + | |
| 2059 | + | totalSaldo = totalSaldo + (playerCriptomoeda * CriptoPrice) |
| 2060 | + | end |
| 2061 | + | end |
| 2062 | + | |
| 2063 | + | player:sendCancelMessage("@EstimativaCrypt " ..totalCrypt.. " " ..totalSaldo) |
| 2064 | + | end |
| 2065 | + | if ACTION == 05 then |
| 2066 | + | local MON_ITEMID = tonumber(split[02]) |
| 2067 | + | local MON_TYPE = tonumber(split[03]) |
| 2068 | + | local DATA = tonumber(split[04]) |
| 2069 | + | local players = Game.getPlayers() |
| 2070 | + | for _, targetPlayer in ipairs(players) do |
| 2071 | + | for X = 01, 03 do |
| 2072 | + | if X == 01 then -- ITEM EQUIPADO |
| 2073 | + | if targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_01) == MON_ITEMID then |
| 2074 | + | if targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_08) == DATA then |
| 2075 | + | local UID_02 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_02) |
| 2076 | + | local UID_03 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_03) |
| 2077 | + | local UID_04 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_04) |
| 2078 | + | local UID_05 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_05) |
| 2079 | + | local UID_06 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_06) |
| 2080 | + | local UID_07 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_07) |
| 2081 | + | local UID_08 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_08) |
| 2082 | + | local UID_09 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_09) |
| 2083 | + | local UID_10 = targetPlayer:getStorageValue(_SYSTEM.INVENTARIO[MON_TYPE].UID_10) |
| 2084 | + | |
| 2085 | + | 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) |
| 2086 | + | end |
| 2087 | + | end |
| 2088 | + | end |
| 2089 | + | if X == 02 then -- ITEM NA BACKPACK |
| 2090 | + | for _SLOT = 00, 03 do |
| 2091 | + | for _BAG = 01, 20 do |
| 2092 | + | if targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_01) == MON_ITEMID then |
| 2093 | + | if targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_08) == DATA then |
| 2094 | + | local UID_02 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_02) |
| 2095 | + | local UID_03 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_03) |
| 2096 | + | local UID_04 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_04) |
| 2097 | + | local UID_05 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_05) |
| 2098 | + | local UID_06 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_06) |
| 2099 | + | local UID_07 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_07) |
| 2100 | + | local UID_08 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_08) |
| 2101 | + | local UID_09 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_09) |
| 2102 | + | local UID_10 = targetPlayer:getStorageValue(_BACKPACK[MON_TYPE][_SLOT][_BAG].UID_10) |
| 2103 | + | |
| 2104 | + | 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) |
| 2105 | + | end |
| 2106 | + | end |
| 2107 | + | end |
| 2108 | + | end |
| 2109 | + | end |
| 2110 | + | if X == 03 then -- ITEM NO DEPOT |
| 2111 | + | for _SLOT = 01, #_SYSTEM.DEPOT[01] do |
| 2112 | + | if targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_01) == MON_ITEMID then |
| 2113 | + | if targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_08) == DATA then |
| 2114 | + | local UID_02 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_02) |
| 2115 | + | local UID_03 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_03) |
| 2116 | + | local UID_04 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_04) |
| 2117 | + | local UID_05 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_05) |
| 2118 | + | local UID_06 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_06) |
| 2119 | + | local UID_07 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_07) |
| 2120 | + | local UID_08 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_08) |
| 2121 | + | local UID_09 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_09) |
| 2122 | + | local UID_10 = targetPlayer:getStorageValue(_SYSTEM.DEPOT[01][_SLOT].UID_10) |
| 2123 | + | |
| 2124 | + | 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) |
| 2125 | + | end |
| 2126 | + | end |
| 2127 | + | end |
| 2128 | + | end |
| 2129 | + | end |
| 2130 | + | end |
| 2131 | + | |
| 2132 | + | player:sendCancelMessage("@LoadMonItems 01") |
| 2133 | + | end |
| 2134 | + | end |
| 2135 | + | if opcode == MENSAGEM_RESPOSTA then |
| 2136 | + | local split = buffer:splitTrimmed(",") |
| 2137 | + | local FILTRO_MSG = tonumber(split[01]) |
| 2138 | + | local FILTRO_RESP = tonumber(split[02]) |
| 2139 | + | |
| 2140 | + | if FILTRO_MSG == -1 then |
| 2141 | + | local MSG = split[03] |
| 2142 | + | local TARGET_NAME = split[04] |
| 2143 | + | local TARGET_ID = tonumber(split[05]) |
| 2144 | + | local CHECK_RESPOSTA = db.query("UPDATE `email_news` SET `resposta` = '" ..MSG.. "', `lida` = 0 WHERE `id` = " ..FILTRO_RESP.. ";") |
| 2145 | + | if CHECK_RESPOSTA then |
| 2146 | + | player:sendCancelMessage("@MonitMsg|02") |
| 2147 | + | local cid = Player(TARGET_NAME) |
| 2148 | + | if(not cid) then |
| 2149 | + | local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.MESSAGE_ALERT.. " AND `player_id` = " ..TARGET_ID.. ");") |
| 2150 | + | if checkNotify then |
| 2151 | + | db.query("UPDATE `player_storage` SET `value` = 1 WHERE (`key` = " .._SYSTEM.MESSAGE_ALERT.. " AND `player_id` = " ..TARGET_ID.. ");") |
| 2152 | + | else |
| 2153 | + | db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. TARGET_ID .. ", " .. _SYSTEM.MESSAGE_ALERT .. ", 1)") |
| 2154 | + | end |
| 2155 | + | else |
| 2156 | + | cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� possui um novo email em sua Caixa de Mensagem.\nDigite Ctrl + Z para verificar.") |
| 2157 | + | end |
| 2158 | + | return true |
| 2159 | + | else |
| 2160 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Erro ao confirmar essa mensagem.") |
| 2161 | + | return true |
| 2162 | + | end |
| 2163 | + | return true |
| 2164 | + | end |
| 2165 | + | |
| 2166 | + | local LOAD_MSG = false |
| 2167 | + | if FILTRO_MSG == 00 then |
| 2168 | + | if FILTRO_RESP == 00 then |
| 2169 | + | LOAD_MSG = db.storeQuery('SELECT * FROM `email_news` WHERE `type` <> 4 AND `resposta` = "";') |
| 2170 | + | else |
| 2171 | + | LOAD_MSG = db.storeQuery('SELECT * FROM `email_news` WHERE `type` <> 4 AND `resposta` <> "";') |
| 2172 | + | end |
| 2173 | + | else |
| 2174 | + | if FILTRO_RESP == 00 then |
| 2175 | + | LOAD_MSG = db.storeQuery('SELECT * FROM `email_news` WHERE `type` = ' ..FILTRO_MSG .. ' AND `resposta` = "";') |
| 2176 | + | else |
| 2177 | + | LOAD_MSG = db.storeQuery('SELECT * FROM `email_news` WHERE `type` = ' ..FILTRO_MSG .. ' AND `resposta` <> "";') |
| 2178 | + | end |
| 2179 | + | end |
| 2180 | + | if LOAD_MSG then |
| 2181 | + | local i = 1 |
| 2182 | + | local offertLimit = 50 |
| 2183 | + | repeat |
| 2184 | + | local A = result.getDataInt(LOAD_MSG, "id") |
| 2185 | + | local B = result.getDataInt(LOAD_MSG, "type") |
| 2186 | + | local C = result.getDataInt(LOAD_MSG, "player_id") |
| 2187 | + | local D = result.getDataString(LOAD_MSG, "name") |
| 2188 | + | local E = result.getDataInt(LOAD_MSG, "target_id") |
| 2189 | + | local F = result.getDataString(LOAD_MSG, "target_name") |
| 2190 | + | local G = result.getDataString(LOAD_MSG, "title") |
| 2191 | + | local H = result.getDataString(LOAD_MSG, "message") |
| 2192 | + | local I = result.getDataString(LOAD_MSG, "resposta") |
| 2193 | + | local J = result.getDataString(LOAD_MSG, "box_1") |
| 2194 | + | local K = result.getDataString(LOAD_MSG, "box_2") |
| 2195 | + | local L = result.getDataString(LOAD_MSG, "box_3") |
| 2196 | + | local M = result.getDataString(LOAD_MSG, "box_4") |
| 2197 | + | local N = result.getDataInt(LOAD_MSG, "gold") |
| 2198 | + | local O = result.getDataInt(LOAD_MSG, "vip") |
| 2199 | + | local P = result.getDataInt(LOAD_MSG, "lida") |
| 2200 | + | local Q = result.getDataInt(LOAD_MSG, "box_check") |
| 2201 | + | local R = result.getDataInt(LOAD_MSG, "del_msg") |
| 2202 | + | local S = result.getDataInt(LOAD_MSG, "del_resp") |
| 2203 | + | |
| 2204 | + | player:sendCancelMessage("@MonitMsg|00|" ..i.. "|" ..A.. "|" ..B.. "|" ..C.. "|" ..D.. "|" ..E.. "|" ..F.. "|" ..G.. "|" ..H.. "|" ..I.. "|" ..J.. "|" ..K.. "|" ..L.. "|" ..M.. "|" ..N.. "|" ..O.. "|" ..P.. "|" ..Q.. "|" ..R.. "|" ..S) |
| 2205 | + | i = i + 1 |
| 2206 | + | until not result.next(LOAD_MSG) or i > offertLimit |
| 2207 | + | result.free() |
| 2208 | + | |
| 2209 | + | player:sendCancelMessage("@MonitMsg|01") |
| 2210 | + | return true |
| 2211 | + | end |
| 2212 | + | |
| 2213 | + | return true |
| 2214 | + | end |
| 2215 | + | |
| 2216 | + | if opcode == BOT_MONITORAMENTO then |
| 2217 | + | local split = buffer:splitTrimmed(",") |
| 2218 | + | local BotV8 = tonumber(split[01]) |
| 2219 | + | local ClientType = tonumber(split[02]) |
| 2220 | + | local getFollow = tonumber(split[03]) |
| 2221 | + | BOT_NAME = split[04] |
| 2222 | + | BOT_POSX = tonumber(split[05]) |
| 2223 | + | BOT_POSY = tonumber(split[06]) |
| 2224 | + | BOT_POSZ = tonumber(split[07]) |
| 2225 | + | GM_NAME = split[08] |
| 2226 | + | |
| 2227 | + | local GM = Player(GM_NAME) |
| 2228 | + | if(not GM) then |
| 2229 | + | local GET_BOT = Player(BOT_NAME) |
| 2230 | + | if(not GET_BOT) then |
| 2231 | + | return true |
| 2232 | + | else |
| 2233 | + | GET_BOT:sendCancelMessage("@BotCheck-02") |
| 2234 | + | end |
| 2235 | + | else |
| 2236 | + | stopEvent(CHECK_CUSTOM_CLIENT) |
| 2237 | + | CHECK_CUSTOM_CLIENT = nil |
| 2238 | + | GM:sendCancelMessage("@MonitBot#1#" ..BotV8.. "#" ..ClientType.. "#" ..getFollow.. "#" ..BOT_NAME) |
| 2239 | + | end |
| 2240 | + | end |
| 2241 | + | if opcode == BOT_PLAYER_MONIT then |
| 2242 | + | local split = buffer:splitTrimmed(",") |
| 2243 | + | local TARGET_NAME = split[01] |
| 2244 | + | local GM_NAME = split[02] |
| 2245 | + | local ACTION = tonumber(split[03]) |
| 2246 | + | |
| 2247 | + | if ACTION ~= 04 then |
| 2248 | + | if player:getGroup():getId() < 3 then |
| 2249 | + | return true |
| 2250 | + | end |
| 2251 | + | end |
| 2252 | + | |
| 2253 | + | local tid = Player(TARGET_NAME) |
| 2254 | + | if(not tid) then |
| 2255 | + | if ACTION == 04 then |
| 2256 | + | return true |
| 2257 | + | else |
| 2258 | + | player:sendCancelMessage("@MonitBot#4") |
| 2259 | + | player:popupFYI("Este jogador n�o existe ou est� offline.") |
| 2260 | + | return true |
| 2261 | + | end |
| 2262 | + | else |
| 2263 | + | if ACTION == 01 then |
| 2264 | + | tid:sendCancelMessage("@BotCheck-01-" ..GM_NAME) |
| 2265 | + | CHECK_CUSTOM_CLIENT = addEvent(function() |
| 2266 | + | player:sendCancelMessage("@MonitBot#3") |
| 2267 | + | end, 3000) |
| 2268 | + | elseif ACTION == 03 then |
| 2269 | + | tid:sendCancelMessage("@BotCheck-03-" ..GM_NAME) |
| 2270 | + | elseif ACTION == 04 then |
| 2271 | + | tid:sendCancelMessage("@MonitBot#5") |
| 2272 | + | else |
| 2273 | + | tid:sendCancelMessage("@BotCheck-02") |
| 2274 | + | return true |
| 2275 | + | end |
| 2276 | + | return false |
| 2277 | + | end |
| 2278 | + | end |
| 2279 | + | if opcode == BOT_WALK_KEYPRESS then |
| 2280 | + | local split = buffer:splitTrimmed(",") |
| 2281 | + | local KEYPRESS = tonumber(split[01]) |
| 2282 | + | local NEW_POSX = tonumber(split[02]) |
| 2283 | + | local NEW_POSY = tonumber(split[03]) |
| 2284 | + | local NEW_POSZ = tonumber(split[04]) |
| 2285 | + | local CHE_NAME = split[05] |
| 2286 | + | local BotV8 = tonumber(split[06]) |
| 2287 | + | local AutoTarget = tonumber(split[07]) |
| 2288 | + | local AutoCura = tonumber(split[08]) |
| 2289 | + | |
| 2290 | + | local cid = Player(CHE_NAME) |
| 2291 | + | if(not cid) then |
| 2292 | + | player:popupFYI("Jogador n�o encontrado.") |
| 2293 | + | return true |
| 2294 | + | else |
| 2295 | + | local GM = Player(GM_NAME) |
| 2296 | + | if(not GM) then |
| 2297 | + | cid:sendCancelMessage("@BotCheck-02") |
| 2298 | + | return true |
| 2299 | + | else |
| 2300 | + | if NEW_POSX ~= BOT_POSX or NEW_POSY ~= BOT_POSY or NEW_POSZ ~= BOT_POSZ then |
| 2301 | + | BOT_POSX = NEW_POSX |
| 2302 | + | BOT_POSY = NEW_POSY |
| 2303 | + | BOT_POSZ = NEW_POSZ |
| 2304 | + | GM:sendCancelMessage("@MonitBot#2#" ..KEYPRESS.. "#1#" ..BotV8.. "#" ..AutoTarget.. "#" ..AutoCura) |
| 2305 | + | else |
| 2306 | + | GM:sendCancelMessage("@MonitBot#2#" ..KEYPRESS.. "#0#" ..BotV8.. "#" ..AutoTarget.. "#" ..AutoCura) |
| 2307 | + | end |
| 2308 | + | end |
| 2309 | + | end |
| 2310 | + | end |
| 2311 | + | |
| 2312 | + | if opcode == MESSAGE_BOX then |
| 2313 | + | local split = buffer:splitTrimmed("|") |
| 2314 | + | local TYPE = tonumber(split[01]) |
| 2315 | + | local playerGuid = player:getGuid() |
| 2316 | + | |
| 2317 | + | if TYPE == 99 then |
| 2318 | + | local ID = tonumber(split[02]) |
| 2319 | + | local BOX_1 = split[03] or "0" |
| 2320 | + | local BOX_2 = split[04] or "0" |
| 2321 | + | local BOX_3 = split[05] or "0" |
| 2322 | + | local BOX_4 = split[06] or "0" |
| 2323 | + | |
| 2324 | + | 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.. ");") |
| 2325 | + | if CHECK_LIDA then |
| 2326 | + | if BOX_1 ~= "0" then |
| 2327 | + | local REC = BOX_1:splitTrimmed("-") |
| 2328 | + | local UID_01 = tonumber(REC[01]) |
| 2329 | + | local UID_02 = tonumber(REC[02]) |
| 2330 | + | local UID_03 = tonumber(REC[03]) |
| 2331 | + | local UID_04 = tonumber(REC[04]) |
| 2332 | + | local UID_05 = tonumber(REC[05]) |
| 2333 | + | local UID_06 = tonumber(REC[06]) |
| 2334 | + | local UID_07 = tonumber(REC[07]) |
| 2335 | + | local UID_08 = tonumber(REC[08]) |
| 2336 | + | local UID_09 = tonumber(REC[09]) |
| 2337 | + | local UID_10 = tonumber(REC[10]) |
| 2338 | + | local _SLOT = tonumber(REC[11]) |
| 2339 | + | local _EXT = tonumber(REC[12]) |
| 2340 | + | local _POS_SLOT = tonumber(REC[13]) |
| 2341 | + | |
| 2342 | + | doBackpack(player, 00, _SLOT, 00, 01) |
| 2343 | + | local PLAYER_EXT = doBackpack(player, 09) |
| 2344 | + | local PLAYER_POS = doBackpack(player, 08) |
| 2345 | + | |
| 2346 | + | if _SLOT == 03 then |
| 2347 | + | local ITEM_ID = UID_01 |
| 2348 | + | local ITEM_RAR = UID_02 |
| 2349 | + | local ITEM_STA = UID_03 |
| 2350 | + | local _QNT = UID_04 |
| 2351 | + | |
| 2352 | + | doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) |
| 2353 | + | doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) |
| 2354 | + | else |
| 2355 | + | if _SLOT == 04 then |
| 2356 | + | local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) |
| 2357 | + | if AtrAmmo < 00 then AtrAmmo = 01 end |
| 2358 | + | AtrAmmo = AtrAmmo * 500 |
| 2359 | + | local LimitBullet = AtrAmmo |
| 2360 | + | |
| 2361 | + | if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then |
| 2362 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) |
| 2363 | + | else |
| 2364 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) |
| 2365 | + | end |
| 2366 | + | else |
| 2367 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) |
| 2368 | + | end |
| 2369 | + | |
| 2370 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, UID_01) |
| 2371 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, UID_02) |
| 2372 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, UID_03) |
| 2373 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, UID_04) |
| 2374 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, UID_05) |
| 2375 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, UID_06) |
| 2376 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, UID_07) |
| 2377 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, UID_08) |
| 2378 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, UID_09) |
| 2379 | + | |
| 2380 | + | local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) |
| 2381 | + | local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) |
| 2382 | + | local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) |
| 2383 | + | player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") |
| 2384 | + | end |
| 2385 | + | end |
| 2386 | + | if BOX_2 ~= "0" then |
| 2387 | + | local REC = BOX_2:splitTrimmed("-") |
| 2388 | + | local UID_01 = tonumber(REC[01]) |
| 2389 | + | local UID_02 = tonumber(REC[02]) |
| 2390 | + | local UID_03 = tonumber(REC[03]) |
| 2391 | + | local UID_04 = tonumber(REC[04]) |
| 2392 | + | local UID_05 = tonumber(REC[05]) |
| 2393 | + | local UID_06 = tonumber(REC[06]) |
| 2394 | + | local UID_07 = tonumber(REC[07]) |
| 2395 | + | local UID_08 = tonumber(REC[08]) |
| 2396 | + | local UID_09 = tonumber(REC[09]) |
| 2397 | + | local UID_10 = tonumber(REC[10]) |
| 2398 | + | local _SLOT = tonumber(REC[11]) |
| 2399 | + | local _EXT = tonumber(REC[12]) |
| 2400 | + | local _POS_SLOT = tonumber(REC[13]) |
| 2401 | + | |
| 2402 | + | doBackpack(player, 00, _SLOT, 00, 01) |
| 2403 | + | local PLAYER_EXT = doBackpack(player, 09) |
| 2404 | + | local PLAYER_POS = doBackpack(player, 08) |
| 2405 | + | |
| 2406 | + | if _SLOT == 03 then |
| 2407 | + | local ITEM_ID = UID_01 |
| 2408 | + | local ITEM_RAR = UID_02 |
| 2409 | + | local ITEM_STA = UID_03 |
| 2410 | + | local _QNT = UID_04 |
| 2411 | + | |
| 2412 | + | doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) |
| 2413 | + | doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) |
| 2414 | + | else |
| 2415 | + | if _SLOT == 04 then |
| 2416 | + | local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) |
| 2417 | + | if AtrAmmo < 00 then AtrAmmo = 01 end |
| 2418 | + | AtrAmmo = AtrAmmo * 500 |
| 2419 | + | local LimitBullet = AtrAmmo |
| 2420 | + | |
| 2421 | + | if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then |
| 2422 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) |
| 2423 | + | else |
| 2424 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) |
| 2425 | + | end |
| 2426 | + | else |
| 2427 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) |
| 2428 | + | end |
| 2429 | + | |
| 2430 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, UID_01) |
| 2431 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, UID_02) |
| 2432 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, UID_03) |
| 2433 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, UID_04) |
| 2434 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, UID_05) |
| 2435 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, UID_06) |
| 2436 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, UID_07) |
| 2437 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, UID_08) |
| 2438 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, UID_09) |
| 2439 | + | |
| 2440 | + | local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) |
| 2441 | + | local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) |
| 2442 | + | local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) |
| 2443 | + | player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") |
| 2444 | + | end |
| 2445 | + | end |
| 2446 | + | if BOX_3 ~= "0" then |
| 2447 | + | local REC = BOX_3:splitTrimmed("-") |
| 2448 | + | local UID_01 = tonumber(REC[01]) |
| 2449 | + | local UID_02 = tonumber(REC[02]) |
| 2450 | + | local UID_03 = tonumber(REC[03]) |
| 2451 | + | local UID_04 = tonumber(REC[04]) |
| 2452 | + | local UID_05 = tonumber(REC[05]) |
| 2453 | + | local UID_06 = tonumber(REC[06]) |
| 2454 | + | local UID_07 = tonumber(REC[07]) |
| 2455 | + | local UID_08 = tonumber(REC[08]) |
| 2456 | + | local UID_09 = tonumber(REC[09]) |
| 2457 | + | local UID_10 = tonumber(REC[10]) |
| 2458 | + | local _SLOT = tonumber(REC[11]) |
| 2459 | + | local _EXT = tonumber(REC[12]) |
| 2460 | + | local _POS_SLOT = tonumber(REC[13]) |
| 2461 | + | |
| 2462 | + | doBackpack(player, 00, _SLOT, 00, 01) |
| 2463 | + | local PLAYER_EXT = doBackpack(player, 09) |
| 2464 | + | local PLAYER_POS = doBackpack(player, 08) |
| 2465 | + | |
| 2466 | + | if _SLOT == 03 then |
| 2467 | + | local ITEM_ID = UID_01 |
| 2468 | + | local ITEM_RAR = UID_02 |
| 2469 | + | local ITEM_STA = UID_03 |
| 2470 | + | local _QNT = UID_04 |
| 2471 | + | |
| 2472 | + | doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) |
| 2473 | + | doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) |
| 2474 | + | else |
| 2475 | + | if _SLOT == 04 then |
| 2476 | + | local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) |
| 2477 | + | if AtrAmmo < 00 then AtrAmmo = 01 end |
| 2478 | + | AtrAmmo = AtrAmmo * 500 |
| 2479 | + | local LimitBullet = AtrAmmo |
| 2480 | + | |
| 2481 | + | if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then |
| 2482 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) |
| 2483 | + | else |
| 2484 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) |
| 2485 | + | end |
| 2486 | + | else |
| 2487 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) |
| 2488 | + | end |
| 2489 | + | |
| 2490 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, UID_01) |
| 2491 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, UID_02) |
| 2492 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, UID_03) |
| 2493 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, UID_04) |
| 2494 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, UID_05) |
| 2495 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, UID_06) |
| 2496 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, UID_07) |
| 2497 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, UID_08) |
| 2498 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, UID_09) |
| 2499 | + | |
| 2500 | + | local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) |
| 2501 | + | local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) |
| 2502 | + | local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) |
| 2503 | + | player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") |
| 2504 | + | end |
| 2505 | + | end |
| 2506 | + | if BOX_4 ~= "0" then |
| 2507 | + | local REC = BOX_4:splitTrimmed("-") |
| 2508 | + | local UID_01 = tonumber(REC[01]) |
| 2509 | + | local UID_02 = tonumber(REC[02]) |
| 2510 | + | local UID_03 = tonumber(REC[03]) |
| 2511 | + | local UID_04 = tonumber(REC[04]) |
| 2512 | + | local UID_05 = tonumber(REC[05]) |
| 2513 | + | local UID_06 = tonumber(REC[06]) |
| 2514 | + | local UID_07 = tonumber(REC[07]) |
| 2515 | + | local UID_08 = tonumber(REC[08]) |
| 2516 | + | local UID_09 = tonumber(REC[09]) |
| 2517 | + | local UID_10 = tonumber(REC[10]) |
| 2518 | + | local _SLOT = tonumber(REC[11]) |
| 2519 | + | local _EXT = tonumber(REC[12]) |
| 2520 | + | local _POS_SLOT = tonumber(REC[13]) |
| 2521 | + | |
| 2522 | + | doBackpack(player, 00, _SLOT, 00, 01) |
| 2523 | + | local PLAYER_EXT = doBackpack(player, 09) |
| 2524 | + | local PLAYER_POS = doBackpack(player, 08) |
| 2525 | + | |
| 2526 | + | if _SLOT == 03 then |
| 2527 | + | local ITEM_ID = UID_01 |
| 2528 | + | local ITEM_RAR = UID_02 |
| 2529 | + | local ITEM_STA = UID_03 |
| 2530 | + | local _QNT = UID_04 |
| 2531 | + | |
| 2532 | + | doBackpack(player, 03, _SLOT, 00, 01, ITEM_ID) |
| 2533 | + | doBackpack(player, 01, _SLOT, 00, 00, ITEM_ID, ITEM_RAR, ITEM_STA, _QNT) |
| 2534 | + | else |
| 2535 | + | if _SLOT == 04 then |
| 2536 | + | local AtrAmmo = player:getStorageValue(_SYSTEM.TASK[00].RANK) |
| 2537 | + | if AtrAmmo < 00 then AtrAmmo = 01 end |
| 2538 | + | AtrAmmo = AtrAmmo * 500 |
| 2539 | + | local LimitBullet = AtrAmmo |
| 2540 | + | |
| 2541 | + | if player:getStorageValue(_BACKPACK[_SLOT][_EXT][_POS_SLOT].UID_10) > LimitBullet then |
| 2542 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, LimitBullet) |
| 2543 | + | else |
| 2544 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) |
| 2545 | + | end |
| 2546 | + | else |
| 2547 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_10, UID_10) |
| 2548 | + | end |
| 2549 | + | |
| 2550 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01, UID_01) |
| 2551 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02, UID_02) |
| 2552 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03, UID_03) |
| 2553 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_04, UID_04) |
| 2554 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_05, UID_05) |
| 2555 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_06, UID_06) |
| 2556 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_07, UID_07) |
| 2557 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_08, UID_08) |
| 2558 | + | player:setStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_09, UID_09) |
| 2559 | + | |
| 2560 | + | local itemid = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_01) |
| 2561 | + | local rare = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_02) |
| 2562 | + | local star = player:getStorageValue(_BACKPACK[_SLOT][PLAYER_EXT][PLAYER_POS].UID_03) |
| 2563 | + | player:sendCancelMessage("@LootMSG " ..itemid.. " " ..rare.. " " ..star.. " 1") |
| 2564 | + | end |
| 2565 | + | end |
| 2566 | + | |
| 2567 | + | return true |
| 2568 | + | else |
| 2569 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Erro ao confirmar essa mensagem.") |
| 2570 | + | return true |
| 2571 | + | end |
| 2572 | + | end |
| 2573 | + | if TYPE == 98 then |
| 2574 | + | local ID = tonumber(split[02]) |
| 2575 | + | local DELET = tonumber(split[03]) |
| 2576 | + | local CHECK_DELETE = false |
| 2577 | + | |
| 2578 | + | if DELET == 00 then |
| 2579 | + | CHECK_DELETE = db.query("UPDATE `email_news` SET `del_msg` = 1 WHERE (`id` = " ..ID.. " AND `player_id` = " ..playerGuid.. ");") |
| 2580 | + | else |
| 2581 | + | CHECK_DELETE = db.query("UPDATE `email_news` SET `del_resp` = 1 WHERE (`id` = " ..ID.. " AND `target_id` = " ..playerGuid.. ");") |
| 2582 | + | end |
| 2583 | + | if CHECK_DELETE then |
| 2584 | + | player:sendCancelMessage("@Notice|02") |
| 2585 | + | return true |
| 2586 | + | else |
| 2587 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Erro ao confirmar essa mensagem.") |
| 2588 | + | return true |
| 2589 | + | end |
| 2590 | + | return true |
| 2591 | + | end |
| 2592 | + | if TYPE == 05 then |
| 2593 | + | local LOAD_MESSAGE = db.storeQuery('SELECT * FROM `email_news` WHERE `player_id` = ' ..playerGuid .. ' OR `target_id` = ' ..playerGuid .. ' ORDER BY `id` DESC LIMIT 50;') |
| 2594 | + | if LOAD_MESSAGE then |
| 2595 | + | local offertLimit = 50 |
| 2596 | + | local i = 1 |
| 2597 | + | repeat |
| 2598 | + | local A = result.getDataInt(LOAD_MESSAGE, "id") |
| 2599 | + | local B = result.getDataInt(LOAD_MESSAGE, "type") |
| 2600 | + | local C = result.getDataInt(LOAD_MESSAGE, "player_id") |
| 2601 | + | local D = result.getDataString(LOAD_MESSAGE, "name") |
| 2602 | + | local E = result.getDataInt(LOAD_MESSAGE, "target_id") |
| 2603 | + | local F = result.getDataString(LOAD_MESSAGE, "target_name") |
| 2604 | + | local G = result.getDataString(LOAD_MESSAGE, "title") |
| 2605 | + | local H = result.getDataString(LOAD_MESSAGE, "message") |
| 2606 | + | local I = result.getDataString(LOAD_MESSAGE, "resposta") |
| 2607 | + | local J = result.getDataString(LOAD_MESSAGE, "box_1") |
| 2608 | + | local K = result.getDataString(LOAD_MESSAGE, "box_2") |
| 2609 | + | local L = result.getDataString(LOAD_MESSAGE, "box_3") |
| 2610 | + | local M = result.getDataString(LOAD_MESSAGE, "box_4") |
| 2611 | + | local N = result.getDataInt(LOAD_MESSAGE, "gold") |
| 2612 | + | local O = result.getDataInt(LOAD_MESSAGE, "vip") |
| 2613 | + | local P = result.getDataInt(LOAD_MESSAGE, "lida") |
| 2614 | + | local Q = result.getDataInt(LOAD_MESSAGE, "box_check") |
| 2615 | + | local R = result.getDataInt(LOAD_MESSAGE, "del_msg") |
| 2616 | + | local S = result.getDataInt(LOAD_MESSAGE, "del_resp") |
| 2617 | + | |
| 2618 | + | player:sendCancelMessage("@Notice|00|" ..i.. "|" ..A.. "|" ..B.. "|" ..C.. "|" ..D.. "|" ..E.. "|" ..F.. "|" ..G.. "|" ..H.. "|" ..I.. "|" ..J.. "|" ..K.. "|" ..L.. "|" ..M.. "|" ..N.. "|" ..O.. "|" ..P.. "|" ..Q.. "|" ..R.. "|" ..S) |
| 2619 | + | i = i + 1 |
| 2620 | + | until not result.next(LOAD_MESSAGE) or i > offertLimit |
| 2621 | + | result.free() |
| 2622 | + | end |
| 2623 | + | |
| 2624 | + | player:sendCancelMessage("@Notice|01") |
| 2625 | + | return true |
| 2626 | + | end |
| 2627 | + | if TYPE == 04 then |
| 2628 | + | local TARGET_NAME = split[02] |
| 2629 | + | local TITLE = split[03] |
| 2630 | + | local MSG = split[04] |
| 2631 | + | local BOX_1 = split[05] |
| 2632 | + | local BOX_2 = split[06] |
| 2633 | + | local BOX_3 = split[07] |
| 2634 | + | local BOX_4 = split[08] |
| 2635 | + | local GOLD = tonumber(split[09]) |
| 2636 | + | local VIP = tonumber(split[10]) |
| 2637 | + | local TARGET_ID = 00 |
| 2638 | + | local DESTINATARIO = db.storeQuery('SELECT id FROM `players` WHERE `name` = "' ..TARGET_NAME .. '";') |
| 2639 | + | TARGET_ID = result.getDataInt(DESTINATARIO, "id") |
| 2640 | + | if TARGET_ID == 00 then |
| 2641 | + | return true |
| 2642 | + | end |
| 2643 | + | if DESTINATARIO then |
| 2644 | + | local CHECK_ITEM, CHECK_QNT = false, false |
| 2645 | + | if BOX_1 ~= "0" then |
| 2646 | + | local REC = BOX_1:splitTrimmed("-") |
| 2647 | + | local UID_01 = tonumber(REC[01]) |
| 2648 | + | local UID_02 = tonumber(REC[02]) |
| 2649 | + | local UID_03 = tonumber(REC[03]) |
| 2650 | + | local UID_04 = tonumber(REC[04]) |
| 2651 | + | local UID_05 = tonumber(REC[05]) |
| 2652 | + | local UID_06 = tonumber(REC[06]) |
| 2653 | + | local UID_07 = tonumber(REC[07]) |
| 2654 | + | local UID_08 = tonumber(REC[08]) |
| 2655 | + | local UID_09 = tonumber(REC[09]) |
| 2656 | + | local UID_10 = tonumber(REC[10]) |
| 2657 | + | local SLOT = tonumber(REC[11]) |
| 2658 | + | local EXT = tonumber(REC[12]) |
| 2659 | + | local POS = tonumber(REC[13]) |
| 2660 | + | |
| 2661 | + | if UID_01 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01) then |
| 2662 | + | if UID_02 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02) then |
| 2663 | + | if UID_03 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03) then |
| 2664 | + | |
| 2665 | + | if SLOT == 03 then |
| 2666 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) >= UID_04 then |
| 2667 | + | CHECK_QNT = true |
| 2668 | + | end |
| 2669 | + | else |
| 2670 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) == UID_04 then |
| 2671 | + | CHECK_QNT = true |
| 2672 | + | end |
| 2673 | + | end |
| 2674 | + | |
| 2675 | + | if UID_05 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05) then |
| 2676 | + | if UID_06 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06) then |
| 2677 | + | if UID_07 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07) then |
| 2678 | + | if UID_08 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08) then |
| 2679 | + | if UID_09 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09) then |
| 2680 | + | if UID_10 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10) then |
| 2681 | + | if CHECK_QNT then |
| 2682 | + | if SLOT == 03 then |
| 2683 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) > UID_04 then |
| 2684 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, (player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) - UID_04)) |
| 2685 | + | else |
| 2686 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) |
| 2687 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) |
| 2688 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) |
| 2689 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) |
| 2690 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) |
| 2691 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) |
| 2692 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) |
| 2693 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) |
| 2694 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) |
| 2695 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) |
| 2696 | + | end |
| 2697 | + | else |
| 2698 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) |
| 2699 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) |
| 2700 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) |
| 2701 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) |
| 2702 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) |
| 2703 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) |
| 2704 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) |
| 2705 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) |
| 2706 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) |
| 2707 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) |
| 2708 | + | end |
| 2709 | + | CHECK_ITEM = true |
| 2710 | + | end |
| 2711 | + | end |
| 2712 | + | end |
| 2713 | + | end |
| 2714 | + | end |
| 2715 | + | end |
| 2716 | + | end |
| 2717 | + | end |
| 2718 | + | end |
| 2719 | + | end |
| 2720 | + | else |
| 2721 | + | CHECK_ITEM = true |
| 2722 | + | end |
| 2723 | + | if CHECK_ITEM then |
| 2724 | + | CHECK_ITEM = false |
| 2725 | + | CHECK_QNT = false |
| 2726 | + | if BOX_2 ~= "0" then |
| 2727 | + | local REC = BOX_2:splitTrimmed("-") |
| 2728 | + | local UID_01 = tonumber(REC[01]) |
| 2729 | + | local UID_02 = tonumber(REC[02]) |
| 2730 | + | local UID_03 = tonumber(REC[03]) |
| 2731 | + | local UID_04 = tonumber(REC[04]) |
| 2732 | + | local UID_05 = tonumber(REC[05]) |
| 2733 | + | local UID_06 = tonumber(REC[06]) |
| 2734 | + | local UID_07 = tonumber(REC[07]) |
| 2735 | + | local UID_08 = tonumber(REC[08]) |
| 2736 | + | local UID_09 = tonumber(REC[09]) |
| 2737 | + | local UID_10 = tonumber(REC[10]) |
| 2738 | + | local SLOT = tonumber(REC[11]) |
| 2739 | + | local EXT = tonumber(REC[12]) |
| 2740 | + | local POS = tonumber(REC[13]) |
| 2741 | + | |
| 2742 | + | if UID_01 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01) then |
| 2743 | + | if UID_02 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02) then |
| 2744 | + | if UID_03 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03) then |
| 2745 | + | |
| 2746 | + | if SLOT == 03 then |
| 2747 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) >= UID_04 then |
| 2748 | + | CHECK_QNT = true |
| 2749 | + | end |
| 2750 | + | else |
| 2751 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) == UID_04 then |
| 2752 | + | CHECK_QNT = true |
| 2753 | + | end |
| 2754 | + | end |
| 2755 | + | |
| 2756 | + | if UID_05 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05) then |
| 2757 | + | if UID_06 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06) then |
| 2758 | + | if UID_07 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07) then |
| 2759 | + | if UID_08 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08) then |
| 2760 | + | if UID_09 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09) then |
| 2761 | + | if UID_10 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10) then |
| 2762 | + | if CHECK_QNT then |
| 2763 | + | if SLOT == 03 then |
| 2764 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) > UID_04 then |
| 2765 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, (player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) - UID_04)) |
| 2766 | + | else |
| 2767 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) |
| 2768 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) |
| 2769 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) |
| 2770 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) |
| 2771 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) |
| 2772 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) |
| 2773 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) |
| 2774 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) |
| 2775 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) |
| 2776 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) |
| 2777 | + | end |
| 2778 | + | else |
| 2779 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) |
| 2780 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) |
| 2781 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) |
| 2782 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) |
| 2783 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) |
| 2784 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) |
| 2785 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) |
| 2786 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) |
| 2787 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) |
| 2788 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) |
| 2789 | + | end |
| 2790 | + | CHECK_ITEM = true |
| 2791 | + | end |
| 2792 | + | end |
| 2793 | + | end |
| 2794 | + | end |
| 2795 | + | end |
| 2796 | + | end |
| 2797 | + | end |
| 2798 | + | end |
| 2799 | + | end |
| 2800 | + | end |
| 2801 | + | else |
| 2802 | + | CHECK_ITEM = true |
| 2803 | + | end |
| 2804 | + | if CHECK_ITEM then |
| 2805 | + | CHECK_ITEM = false |
| 2806 | + | CHECK_QNT = false |
| 2807 | + | if BOX_3 ~= "0" then |
| 2808 | + | local REC = BOX_3:splitTrimmed("-") |
| 2809 | + | local UID_01 = tonumber(REC[01]) |
| 2810 | + | local UID_02 = tonumber(REC[02]) |
| 2811 | + | local UID_03 = tonumber(REC[03]) |
| 2812 | + | local UID_04 = tonumber(REC[04]) |
| 2813 | + | local UID_05 = tonumber(REC[05]) |
| 2814 | + | local UID_06 = tonumber(REC[06]) |
| 2815 | + | local UID_07 = tonumber(REC[07]) |
| 2816 | + | local UID_08 = tonumber(REC[08]) |
| 2817 | + | local UID_09 = tonumber(REC[09]) |
| 2818 | + | local UID_10 = tonumber(REC[10]) |
| 2819 | + | local SLOT = tonumber(REC[11]) |
| 2820 | + | local EXT = tonumber(REC[12]) |
| 2821 | + | local POS = tonumber(REC[13]) |
| 2822 | + | |
| 2823 | + | if UID_01 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01) then |
| 2824 | + | if UID_02 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02) then |
| 2825 | + | if UID_03 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03) then |
| 2826 | + | |
| 2827 | + | if SLOT == 03 then |
| 2828 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) >= UID_04 then |
| 2829 | + | CHECK_QNT = true |
| 2830 | + | end |
| 2831 | + | else |
| 2832 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) == UID_04 then |
| 2833 | + | CHECK_QNT = true |
| 2834 | + | end |
| 2835 | + | end |
| 2836 | + | |
| 2837 | + | if UID_05 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05) then |
| 2838 | + | if UID_06 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06) then |
| 2839 | + | if UID_07 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07) then |
| 2840 | + | if UID_08 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08) then |
| 2841 | + | if UID_09 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09) then |
| 2842 | + | if UID_10 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10) then |
| 2843 | + | if CHECK_QNT then |
| 2844 | + | if SLOT == 03 then |
| 2845 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) > UID_04 then |
| 2846 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, (player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) - UID_04)) |
| 2847 | + | else |
| 2848 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) |
| 2849 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) |
| 2850 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) |
| 2851 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) |
| 2852 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) |
| 2853 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) |
| 2854 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) |
| 2855 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) |
| 2856 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) |
| 2857 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) |
| 2858 | + | end |
| 2859 | + | else |
| 2860 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) |
| 2861 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) |
| 2862 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) |
| 2863 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) |
| 2864 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) |
| 2865 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) |
| 2866 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) |
| 2867 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) |
| 2868 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) |
| 2869 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) |
| 2870 | + | end |
| 2871 | + | CHECK_ITEM = true |
| 2872 | + | end |
| 2873 | + | end |
| 2874 | + | end |
| 2875 | + | end |
| 2876 | + | end |
| 2877 | + | end |
| 2878 | + | end |
| 2879 | + | end |
| 2880 | + | end |
| 2881 | + | end |
| 2882 | + | else |
| 2883 | + | CHECK_ITEM = true |
| 2884 | + | end |
| 2885 | + | if CHECK_ITEM then |
| 2886 | + | CHECK_ITEM = false |
| 2887 | + | CHECK_QNT = false |
| 2888 | + | if BOX_4 ~= "0" then |
| 2889 | + | local REC = BOX_4:splitTrimmed("-") |
| 2890 | + | local UID_01 = tonumber(REC[01]) |
| 2891 | + | local UID_02 = tonumber(REC[02]) |
| 2892 | + | local UID_03 = tonumber(REC[03]) |
| 2893 | + | local UID_04 = tonumber(REC[04]) |
| 2894 | + | local UID_05 = tonumber(REC[05]) |
| 2895 | + | local UID_06 = tonumber(REC[06]) |
| 2896 | + | local UID_07 = tonumber(REC[07]) |
| 2897 | + | local UID_08 = tonumber(REC[08]) |
| 2898 | + | local UID_09 = tonumber(REC[09]) |
| 2899 | + | local UID_10 = tonumber(REC[10]) |
| 2900 | + | local SLOT = tonumber(REC[11]) |
| 2901 | + | local EXT = tonumber(REC[12]) |
| 2902 | + | local POS = tonumber(REC[13]) |
| 2903 | + | |
| 2904 | + | if UID_01 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01) then |
| 2905 | + | if UID_02 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02) then |
| 2906 | + | if UID_03 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03) then |
| 2907 | + | |
| 2908 | + | if SLOT == 03 then |
| 2909 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) >= UID_04 then |
| 2910 | + | CHECK_QNT = true |
| 2911 | + | end |
| 2912 | + | else |
| 2913 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) == UID_04 then |
| 2914 | + | CHECK_QNT = true |
| 2915 | + | end |
| 2916 | + | end |
| 2917 | + | |
| 2918 | + | if UID_05 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05) then |
| 2919 | + | if UID_06 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06) then |
| 2920 | + | if UID_07 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07) then |
| 2921 | + | if UID_08 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08) then |
| 2922 | + | if UID_09 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09) then |
| 2923 | + | if UID_10 == player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10) then |
| 2924 | + | if CHECK_QNT then |
| 2925 | + | if SLOT == 03 then |
| 2926 | + | if player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) > UID_04 then |
| 2927 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, (player:getStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04) - UID_04)) |
| 2928 | + | else |
| 2929 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) |
| 2930 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) |
| 2931 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) |
| 2932 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) |
| 2933 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) |
| 2934 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) |
| 2935 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) |
| 2936 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) |
| 2937 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) |
| 2938 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) |
| 2939 | + | end |
| 2940 | + | else |
| 2941 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_01, nil) |
| 2942 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_02, nil) |
| 2943 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_03, nil) |
| 2944 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_04, nil) |
| 2945 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_05, nil) |
| 2946 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_06, nil) |
| 2947 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_07, nil) |
| 2948 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_08, nil) |
| 2949 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_09, nil) |
| 2950 | + | player:setStorageValue(_BACKPACK[SLOT][EXT][POS].UID_10, nil) |
| 2951 | + | end |
| 2952 | + | CHECK_ITEM = true |
| 2953 | + | end |
| 2954 | + | end |
| 2955 | + | end |
| 2956 | + | end |
| 2957 | + | end |
| 2958 | + | end |
| 2959 | + | end |
| 2960 | + | end |
| 2961 | + | end |
| 2962 | + | end |
| 2963 | + | else |
| 2964 | + | CHECK_ITEM = true |
| 2965 | + | end |
| 2966 | + | if CHECK_ITEM then |
| 2967 | + | player:sendCancelMessage("@closedBackpack") |
| 2968 | + | 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)") |
| 2969 | + | if SEND_MAIL then |
| 2970 | + | player:sendCancelMessage("@Notice|02") |
| 2971 | + | player:popupFYI("Email enviado com sucesso.") |
| 2972 | + | |
| 2973 | + | local cid = Player(TARGET_NAME) |
| 2974 | + | if(not cid) then |
| 2975 | + | local checkNotify = db.storeQuery("SELECT * FROM player_storage WHERE (`key` = " .._SYSTEM.MESSAGE_ALERT.. " AND `player_id` = " ..TARGET_ID.. ");") |
| 2976 | + | if checkNotify then |
| 2977 | + | db.query("UPDATE `player_storage` SET `value` = 1 WHERE (`key` = " .._SYSTEM.MESSAGE_ALERT.. " AND `player_id` = " ..TARGET_ID.. ");") |
| 2978 | + | else |
| 2979 | + | db.query("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. TARGET_ID .. ", " .. _SYSTEM.MESSAGE_ALERT .. ", 1)") |
| 2980 | + | end |
| 2981 | + | else |
| 2982 | + | cid:sendTextMessage(MESSAGE_INFO_DESCR, "Voc� possui um novo email em sua Caixa de Mensagem.\nDigite Ctrl + Z para verificar.") |
| 2983 | + | end |
| 2984 | + | return true |
| 2985 | + | end |
| 2986 | + | return true |
| 2987 | + | end |
| 2988 | + | else |
| 2989 | + | player:popupFYI("Erro ao encontrar item anexado.") |
| 2990 | + | return true |
| 2991 | + | end |
| 2992 | + | else |
| 2993 | + | player:popupFYI("Erro ao encontrar item anexado.") |
| 2994 | + | return true |
| 2995 | + | end |
| 2996 | + | else |
| 2997 | + | player:popupFYI("Erro ao encontrar item anexado.") |
| 2998 | + | return true |
| 2999 | + | end |
| 3000 | + | else |
| 3001 | + | player:popupFYI("O destinat�rio dessa mensagem n�o existe.") |
| 3002 | + | return true |
| 3003 | + | end |
| 3004 | + | else |
| 3005 | + | local TITLE = split[02] |
| 3006 | + | local MSG = split[03] |
| 3007 | + | 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)") |
| 3008 | + | if SEND_MAIL then |
| 3009 | + | player:sendCancelMessage("@Notice|02") |
| 3010 | + | player:popupFYI("Email enviado com sucesso.") |
| 3011 | + | return true |
| 3012 | + | else |
| 3013 | + | player:popupFYI("Erro ao enviar este email.") |
| 3014 | + | return true |
| 3015 | + | end |
| 3016 | + | end |
| 3017 | + | end |
| 3018 | + | return true |
| 3019 | + | end |