Jump to content

Recommended Posts

Hi community!

I decided to write this topic because a friend of mine contacted me a little while ago informing me of a recently discovered bug with won that affects several private servers

If you write "1.999" in the section "Won -> Yang" you will receive 199kk, about the double of its real value

On my server the problem would have been much bigger as the won is worth 1kkk

I'll post a hotfix that I did on the fly and it worked:

Go to the server, in the quest path, open the won.lua quest

Look for the following statement:

local amount = input()

is located in the first lines of the quest, under this instruction add the following:

if string.find(amount, ".") then
    syschat("No punctuation marks allowed")
    return
end

Code translation:

Check if there is a period in the string that the user entered (the player in our case)

If the dot is present, end the quest by printing the message "No punctuation marks allowed"

The bug could be fixed in many ways even more effective than this, but for something "on the fly" I give you this hotfix ?

  • Good 2
Link to comment
https://metin2.dev/topic/26898-hotfix-bug-won/
Share on other sites

1 hour ago, MrQuin said:

tonumber
spacer.png

tonumber will not remove the dot as it's a correct number (Even if it's a float)

 

Edit: Use math.floor instead

math.floor(4.1)) -> 4
math.floor(3.8)`) -> 3

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 2
Link to comment
https://metin2.dev/topic/26898-hotfix-bug-won/#findComment-139330
Share on other sites

local inputPrice = tonumber(string.gsub(input(), "[^0-9]", ""))
local realPrice = math.floor(inputPrice)

There is no logic explanation for the math.floor since you only let people write numbers but you can let that be there just in case.

As long as I'll be a threat for you , i will always be your target :3

Link to comment
https://metin2.dev/topic/26898-hotfix-bug-won/#findComment-139333
Share on other sites

  • 4 months later...
Guest Anonymous
On 5/13/2021 at 11:02 AM, Goddino said:

Hi community!

I decided to write this topic because a friend of mine contacted me a little while ago informing me of a recently discovered bug with won that affects several private servers

If you write "1.999" in the section "Won -> Yang" you will receive 199kk, about the double of its real value

On my server the problem would have been much bigger as the won is worth 1kkk

I'll post a hotfix that I did on the fly and it worked:

Go to the server, in the quest path, open the won.lua quest

Look for the following statement:

local amount = input()

is located in the first lines of the quest, under this instruction add the following:

if string.find(amount, ".") then
    syschat("No punctuation marks allowed")
    return
end

Code translation:

Check if there is a period in the string that the user entered (the player in our case)

If the dot is present, end the quest by printing the message "No punctuation marks allowed"

The bug could be fixed in many ways even more effective than this, but for something "on the fly" I give you this hotfix ?

This does not work as intended.

Link to comment
https://metin2.dev/topic/26898-hotfix-bug-won/#findComment-143889
Share on other sites

  • Premium

This is a copy paste message from stack.

"If it's okay to accept a string that contains a number, tonumber(foo) will work, and will actually convert it to a "number" value internally. But if you need to know whether Lua considers it an actual number or not, rather than a string, use 'number' == type(foo) in your test conditions."

Link to comment
https://metin2.dev/topic/26898-hotfix-bug-won/#findComment-143957
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.