peonso / tibialegacyserver

Tibia Legacy Server is a OpenTibia 7.72 real map server.
32 stars 29 forks source link

withdraw money bug fix #86

Closed tarantonio closed 7 years ago

tarantonio commented 7 years ago

The bank npcs have a bug in the withdraw part, missing signs =, fix:

----WITHDRAW-------------------------------------------------------------------------
    elseif  msgcontains(msg, 'withdraw all') then
        WITHDRAWMONEY = getPlayerBalance(cid)
        if WITHDRAWMONEY >= 1 then
            if getPlayerBalance(cid) >= WITHDRAWMONEY then
                npcHandler:say("Would you like to withdraw ".. WITHDRAWMONEY .." gold?", 1)
                talk_state = 303
            else
                npcHandler:say('There is not enough gold on your account.', 1)
                talk_state = 0
            end
        else
            npcHandler:say("You don't have money on your bank account!", 1)
            talk_state = 0
        end

    elseif msgcontains(msg, 'withdraw') then
        WITHDRAWMONEY = getMoneyCount(msg)
        if WITHDRAWMONEY >= 1 then
            if getPlayerBalance(cid) >= WITHDRAWMONEY then
                npcHandler:say("Would you like to withdraw ".. WITHDRAWMONEY .." gold?", 1)
                talk_state = 303
            else
                npcHandler:say('There is not enough gold on your account.', 1)
                talk_state = 0
            end
        else
            npcHandler:say('How much would you like to withdraw?', 1)
            talk_state = 301
        end

    elseif talk_state == 301 then
        WITHDRAWMONEY = getMoneyCount(msg)
        if WITHDRAWMONEY >= 1 then
            if getPlayerBalance(cid) >= WITHDRAWMONEY then
                npcHandler:say("Would you like to withdraw ".. WITHDRAWMONEY .." gold?", 1)
                talk_state = 303
            else
                npcHandler:say('There is not enough gold on your account.', 1)
                talk_state = 0
            end
        else
            npcHandler:say("I'm sorry, but you must give me a valid amount of how much you would like to withdraw.", 1)
            talk_state = 0
        end

    elseif talk_state == 303 and msgcontains(msg, 'yes') then
        if doPlayerWithdrawMoney(cid, WITHDRAWMONEY) == true then
            npcHandler:say("Here you are.", 1)
            talk_state = 0
        else
            npcHandler:say("You don't have that money amount on your bank account!", 1)
            talk_state = 0
        end

    elseif talk_state == 303 and msgcontains(msg, 'no') then
        npcHandler:say('Ok then.')
        talk_state = 0

Easy to fix with notepad++ with replace all in find in files:

smgdmt7

tarantonio commented 7 years ago

Pull request created