Jump to content
×
×
  • Create New...

[HOTFIX] Bug Won


Goddino

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
Share on other sites

  • Premium

tonumber
spacer.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
  • Lmao 1

My only accounts are here and on M2D, Don't trust anyone else from other shitty sites.

Link to comment
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
Share on other sites

  • Premium

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
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.

Edited by Guest
Link to comment
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
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Metin2 Dev Github
  • Activity

    1. 6

      Owsap Productions

    2. 11

      BUG SAFEBOX disappear stacks ..

    3. 2

      Error no member named SetcCreateTime in Citem

    4. 2

      Need some help with effect slot on pickup system

    5. 1

      GF Pet system "x" level / percent

    6. 1

      disable quest esc

    7. 2

      Navicat Premium 16.1.3 x64

    8. 2

      Join the Metin2 Dev team

    9. 2

      Error no member named SetcCreateTime in Citem

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.