Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6278 from ibm2431/varchet
Browse files Browse the repository at this point in the history
Make Varchet stop trusting the client
  • Loading branch information
zynjec authored Nov 8, 2019
2 parents 028c27f + 3cb2e94 commit 4369854
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions scripts/zones/Southern_San_dOria/npcs/Varchet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ function onTrade(player, npc, trade)
local pdie2 = math.random(1, 6)
local ptotal = pdie1 + pdie2

local result = GAME_LOST
if ptotal > vtotal then
player:startEvent(519, vdie1, vdie2, vtotal, pdie1, pdie2, ptotal, GAME_WON)
elseif vtotal > ptotal then
player:startEvent(519, vdie1, vdie2, vtotal, pdie1, pdie2, ptotal, GAME_LOST)
result = GAME_WON
elseif ptotal == vtotal then
player:startEvent(519, vdie1, vdie2, vtotal, pdie1, pdie2, ptotal, GAME_TIE)
result = GAME_TIE
end
player:setLocalVar('VarchetGame', result)
player:startEvent(519, vdie1, vdie2, vtotal, pdie1, pdie2, ptotal, result)
else
player:startEvent(608)
end
Expand All @@ -48,7 +49,8 @@ end

function onEventFinish(player, csid, option)
if csid == 519 then
if option == GAME_WON then
local result = player:getLocalVar('VarchetGame')
if result == GAME_WON then
local gilPayout = 10
player:addGil(gilPayout)
player:messageSpecial(ID.text.GIL_OBTAINED, gilPayout)
Expand All @@ -57,12 +59,13 @@ function onEventFinish(player, csid, option)
player:setCharVar("exitTheGamblerStat", 1)
player:showText(player:getEventTarget(), ID.text.VARCHET_KEEP_PROMISE)
end
elseif option == GAME_TIE then
elseif result == GAME_TIE then
local gilPayout = 5
player:addGil(gilPayout)
player:messageSpecial(ID.text.GIL_OBTAINED, gilPayout)
else
player:messageSpecial(ID.text.VARCHET_BET_LOST)
end
player:setLocalVar('VarchetGame', 0)
end
end

0 comments on commit 4369854

Please sign in to comment.