Ir para conteúdo

dougotserv

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Curtir
    dougotserv recebeu reputação de Duvidas Muitas Dvds em Comando: !bless 1.3   
    Claro, desculpa a demora.
     
    function onSay(cid) local player = Player(cid) local totalBlessPrice = getBlessingsCost(player:getLevel()) * 10 * 0.5 if player:getBlessings() == 5 then player:sendCancelMessage("You already have been blessed!", cid) elseif player:removeMoneyNpc(totalBlessPrice) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been blessed by all of eight gods!") for b = 1, 8 do if not player:hasBlessing(b) then player:addBlessing(b, 1) end end player:setStorageValue(999563, 1) player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA) else player:sendCancelMessage("You don't have enough money. You need " .. totalBlessPrice .. " to buy bless.", cid) end return false end  
    Qualquer duvida só pergunta ai
  2. Obrigado
    dougotserv deu reputação a VitorNM em Prey system   
    Eu consegui resolver por conta própria, porém acredito de fato que não seja o melhor jeito para resolver essa situação, mas foi da única forma que consegui.
     
    1 - No arquivo "src/iologindata.cpp", altere o seguinte trecho:
     
    De:
    DBInsert preyDataQuery("INSERT INTO `prey_slots` (`player_id`, `num`, `state`, `unlocked`, `current`, `monster_list`, `free_reroll_in`, `time_left`, `next_use`, `bonus_type`, `bonus_value`, `bonus_grade`) VALUES "); for (size_t num = 0; num < PREY_SLOTNUM_THIRD + 1; num++) { query << player->getGUID() << ',' << num << ',' << 3 << ',' << 1 << ',' << db.escapeString("") << ',' << db.escapeString("") << ',' << 0 << ',' << 0 << ',' << 0 << ',' << 0 << ',' << 0 << ',' << 0; if (!preyDataQuery.addRow(query)) { return false; } }  
    Para:
    DBInsert preyDataQuery("INSERT INTO `prey_slots` (`player_id`, `num`, `state`, `unlocked`, `current`, `monster_list`, `free_reroll_in`, `time_left`, `next_use`, `bonus_type`, `bonus_value`, `bonus_grade`) VALUES "); for (size_t num = 0; num < PREY_SLOTNUM_THIRD + 1; num++) { query << player->getGUID() << ',' << num << ',' << "CASE WHEN `num` = 2 AND `player_id` NOT IN(SELECT `player_id` FROM `player_storage` WHERE `key` = 63253 AND `value` = 1) THEN 1 ELSE 3 END" << ',' << "CASE WHEN `num` = 2 AND `player_id` NOT IN(SELECT `player_id` FROM `player_storage` WHERE `key` = 63253 AND `value` = 1) THEN 0 ELSE 1 END" << ',' << db.escapeString("") << ',' << db.escapeString("") << ',' << 0 << ',' << 0 << ',' << 0 << ',' << 0 << ',' << 0 << ',' << 0; if (!preyDataQuery.addRow(query)) { return false; } }  
    2 - No arquivo "data/modules/scripts/gamestore/gamestore.lua" defina o preço da compra do slot prey e guarde esse valor pois será utilizado no próximo arquivo.
     
    3 - No arquivo "data/modules/scripts/gamestore/init.lua" altere o seguinte trecho:
     
    De:
    function GameStore.processPreySlotPurchase(player) if player:getStorageValue(63253) < 1 then player:setStorageValue(63253, 1) end player:setStorageValue(63253, 1) end  
    Para:
    function GameStore.processPreySlotPurchase(player) local playerId = player:getId() local playerGuid = player:getGuid() local accountId = player:getAccountId() if player:getStorageValue(63253) < 1 then local tile = Tile(player:getPosition()) if (tile) then if (not tile:hasFlag(TILESTATE_PROTECTIONZONE)) then return error({code = 1, message = "You can unlock your third prey slot only in Protection Zone."}) end end player:setStorageValue(63253, 1) message = "You have successfully unlocked your third prey slot permanently, relogin!" player:remove() db.query("UPDATE `prey_slots` SET `state` = 3, `unlocked` = 1 WHERE `player_id` = " .. playerGuid .. " AND `num` = 2") db.query("UPDATE `accounts` SET `coins` = `coins` -30 WHERE `id` = " .. accountId) GameStore.insertHistory(accountId, GameStore.HistoryTypes.HISTORY_TYPE_NONE, "Permanent Prey Slot", -30) addEvent(function() local player = Player(playerId) if not player then return false end end, 500) end end  
    Na parte 3, você precisará alterar o valor da prey slot definida na gamestore. Altere nesses dois trechos em vermelho:
     
    1:
    db.query("UPDATE `accounts` SET `coins` = `coins` -30 WHERE `id` = " .. accountId)
     
    2:
    GameStore.insertHistory(accountId, GameStore.HistoryTypes.HISTORY_TYPE_NONE, "Permanent Prey Slot", -30)
     
    Feito isso, basta compilar novamente o tfs e testar. Aqui funcionou direito. Caso tenha algum problema, pode me perguntar que eu tento ajudar.
     
    Vale ressaltar novamente: o método que eu utilizei não é o mais adequado por causa dos CASES no iologindata.cpp e também por dar muita volta atoa, mas foi o único jeito que consegui pois me falta muito conhecimento em C++ e LUA para poder desenvolver melhor esse código.
     
    []s
  3. Curtir
    dougotserv recebeu reputação de VitorNM em Prey system   
    mandei os arquivos ali, tinha mandado errado foi mal.
     
    fiz o seguinte, deixei o gamestore.lua e init.lua original sem alterar. Ficou da seguinte forma:
     
    Mesmo comprando na store, não consigo usar.
    Fiz algumas alteraçoes, agora segue esse error:
    Gamestore: Purchase failed due to an unhandled script error. Stacktrace: data/modules/scripts/gamestore/init.lua:1269: attempt to call method 'getGuid' (a nil value)    

Informação Importante

Confirmação de Termo