Jump to content

ProfessorEnte

Inactive Member
  • Posts

    42
  • Joined

  • Last visited

  • Days Won

    3
  • Feedback

    0%

Posts posted by ProfessorEnte

  1. #Update:

    Money Animation Class

    Preview
    hR3Zbmh.gif

    Call it:
    Add to imports at the top of game.py:
    "import example_moneyAnimation"
    After the login in the game you will see the window

    Download:

    This is the hidden content, please

    Type Writer Scrollable Textline Class

    Preview
    ZrdZWhm.gif

    Call it:
    Add to imports at the top of game.py:
    "import example_typeWriterAnimation"
    After the login in the game you will see the window

    Download:

    This is the hidden content, please

    ListBoxDrag Class

    Preview
    crCdkZt.gif

    Call it:
    Add to imports at the top of game.py:
    "import example_listBoxDrag"
    After the login in the game you will see the window

    Download:

    This is the hidden content, please

    • Metin2 Dev 19
    • Good 9
    • Love 11
  2. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Hey,


    the idea to implement Snake in Metin2 came from MrSIB

    I think it's a cool idea and that's why I implemented it.

     

    gl1sH9E.png

     

    Preview

    Spoiler

    071700kVOwZEQ.gif
    071700xQN7SHV.gif
    071700Rb411Bz.gif

     

    Control

    w,a,s,d to control the snake

    spacebar = pause


    Settings

    You can set in the script if you are allowed to go through the wall or not and change the size of the drawn boxes or the playing field.


    Execute:

    e.g. in the game.py above to the imports:

    "import snakeGame"

    After logging into the game you will see the window.

     

    Settings

    Spoiler
    
    
    DEBUG = False ## Enable debug
    
    BOX_SIZE = 10 ## You can change the size of the drawn boxes as you like. I found 10 quite good.
    ## width and height are your playfield sizes. I found 200 quite good. But if you set the BOX_SIZE to 1 it is too big.
    GAME_BOARD_WIDTH = 200
    GAME_BOARD_HEIGHT = 200
    
    ## keyboard bindings
    KEY_RIGHT = app.DIK_D
    KEY_LEFT = app.DIK_A
    KEY_UP = app.DIK_W
    KEY_DOWN = app.DIK_S
    KEY_PAUSE = app.DIK_SPACE
    
    INCREASE_SPEED_AFTER_EAT_COUNT = 3 ## after the snake reaches the length 3, 6, 9, ... the speed is increased.
    SNAKE_START_COORDS = [[2,1],[1,1],[0,1]] ## head, tail, tail => Ooooo
    SNAKE_START_DIRECTION = KEY_RIGHT ## the starting direction of the snake
    START_SPEED = 1.2 ## 1.2 = slow (paint snake every 1.2s)
    MAX_SPEED = 0.5 ## 0 = fast
    BORDER_DEAD = True ## if the border is hit then dead (true) or pass through (false)
    
    ## https://doc.instantreality.org/tools/color_calculator/
    SNAKE_COLOR = grp.GenerateColor(0.027, 0.490, 0.078, 1.0)
    SNAKE_HEAD_COLOR = grp.GenerateColor(0.176, 0.725, 0.235, 1.0)
    SNAKE_DEAD_COLOR = grp.GenerateColor(0.9, 0, 0, 1.0)
    FOOD_COLOR = grp.GenerateColor(0.9, 0.5, 0, 1.0)
    BORDER_COLOR = grp.GenerateColor(1, 1, 1, 1.0)

     

     

    Have fun! 😄

     

    Download:

    This is the hidden content, please

     

    • Metin2 Dev 9
    • Sad 1
    • Lmao 3
    • Good 6
    • Love 2
    • Love 11
  3. Hey,

    due to recent events, I wanted to publish a bug, which was available in my itemshop a few years ago.

    In many pub systems written with Lua, it is still present and some people like to take advantage of it.


    If we continue the example with the itemshop, it was possible to "buy" items for free.

    For example, instead of a number, the client sends the value "NaN" (Not a Number) for the number of items to be bought.

    In the quest tonumber() is now executed and "NaN" remains "NaN".

    cmd = "NaN" --(sends "NaN" instead of a number)
    amount = tonumber(cmd) -- now contains NaN

     

    If a comparison now is made, the result is always false:

    if amount > 200 then print'The maximum amount is 200.' return end -- FALSE
    if amount < 1 then print'The minimum amount is 1.' return end -- FALSE


    That is not such a big problem at first.

    But if you do a calculation and then compare if the coins are enough, then we have a problem:

    cmd = "NaN" --(sends "NaN" instead of a number)
    amount = tonumber(cmd) -- now contains NaN
    mycoins = 0 -- The number of coins from the Coins column of the account table
    itemPrice = 1000 -- Price of the item in the item store
    realPrice = itemPrice*amount -- 1000 * NaN => NaN
    if mycoins < realPrice then print 'Unfortunately you do not have enough coins.' return end -- FALSE (0 < NaN)
    -- Not enough Coins, but it goes on, because the comparison was false.
    -- Give item.
    -- Item was bought with 0 Coins.

     

    Here is a link to it:

    http://lua-users.org/wiki/InfAndNanComparisons

     

    A script for testing (https://repl.it/ under Lua):

    -- cmd is the value sent by the client as example a number of items you want to buy. If you now calculate with this value and send instead of a number NaN, inf, -inf, ...
    cmd = "200"
    --cmd = "NaN" -- remove comment for testing (sends "NaN" instead of a number)
    amount = tonumber(cmd)
    -- mycoins is the number of coins, which are in the Coins column of the account table
    mycoins = 1000
    -- mycoins = 0 -- remove comment for testing (sets existing coins to 0)
    itemPrice = 100
     
    if amount > 200 then print 'The maximum amount is 200.' return end
    if amount < 1 then print 'The minimum amount is 1.' return end
     
    realPrice = itemPrice*amount
     
    if mycoins < realPrice then print 'Unfortunately you do not have enough coins.' return end
     
    newCoins = mycoins-realPrice
     
    print('set new coins in db '..newCoins)
    print 'give item

     

    How it can be fixed, for example:

    function IsFinite(num)
        return not (num ~= num or tostring(num) == "inf" or tostring(num) == "-inf" )
    end
    
    -- Example call
    amount = tonumber("123")
    if not IsFinite(amount) then return end -- Everything ok
    amount = tonumber("NaN")
    if not IsFinite(amount) then return end -- triggers return

     

    • Sad 1
    • Love 4
  4. #Update (very easy to use):

    "Board" Animation Class (enlarge and shrink)

    Preview

    wcNlBQm.gif

     

    Video

    https://metin2.download/picture/2U7koEpVJDF8XLGAwz85oA3G6MfQC23h/.gif

     

    Call it:
    Add to imports at the top of game.py:
    "import example_boardAnimation"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    • Metin2 Dev 33
    • Dislove 1
    • Good 8
    • Love 1
    • Love 27
  5. #Small changes

    When holding CTRL (can be changed) the cursor changes and text can be translated instantly.

    In addition, already translated texts are now stored for faster translation.

    Spoiler

    • Love 2
  6. 20 minutes ago, Tunio said:

    There is already an identical system on the server rop2.global ...

    Yes this is my system. xD

    It's the first Version. I am currently updating the translator with some new functions.

  7. Hey,

    I am currently working on an ingame translator (Python & c++) for Metin2.

    It uses the Google Translator.

     

    You only have to press the "Translate Button" at the bottom of the taskbar (the cursor changes then) and any text can be translated directly.

    If you want to select more text at once, then you have to hold shift.
    If the "Instant Translate" checkbox is activated, the text will be translated on sending (for chat and whisper).


    A preview of the current state:

    https://metin2.download/video/5if9WiAT80epQDleLVyeH9aoSi5QZOe4/.mp4


    Do you find the whole thing useful at all and would you want to use it?

    Do you have any ideas?

    • Good 2
    • Love 11
  8. 8 hours ago, hachiwari said:

    Sexy, i hope that code is also sexy ;3

    The code has been kept simple so that it can be easily understood. You can always optimize everything. :)

     

    21 hours ago, North said:

    Great job, this is a very handy reference. Could you use github gists/repo instead of mega downloads? Thanks

    Yeah, I've been thinking about that, too, because things are getting messy. As soon as I find the time.

  9. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Introduction

    Hey,

    since I'm often asked if I can make an example for this or that in Python, I just post some of these examples in this thread from time to time. :)

    Usually they just end up in my trash (that's why the collection is small for now) but maybe it will help some of you to learn something.


    You are also welcome to post examples here and I will add them to the startpost.


    You have a wish for a certain example?

    Then write it in here.


    PS:

    These examples are designed very simple, so that they can be understood.

     

    Examples

    ui.ComoBox()

    Spoiler

    Preview:
    gU42KYg.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_combobox"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ui.ScrollBar() with text

    Spoiler

    Preview:
    rGE57ti.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_scrollbar"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ui.AniImageBox() as loading bar

    Spoiler

    Preview:
    cC6o7zx.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_loadingbar"

    and simply move the file "loading_bar.tga" into the client folder. (There where the .exe is located).

    Otherwise change the path in the python file "example_loadingbar.py".

    After the login in the game you will see the window.


    Download:

    This is the hidden content, please

     

    ui.ListBox()

    Spoiler

    Preview:
    HOuQhTB.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_listbox"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ui.ToggleButton()

    Spoiler

    Preview:
    FulTpMj.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_toggleButton"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ui.RadioButtonGroup()

    Spoiler

    Preview:
    Bs3UUlB.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_radioButtonGroup"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ui.DragButton()

    Spoiler

    Preview:
    J5gxzBc.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_dragButton"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ui.Bar(), ui.Box(), ui.Line()

    Spoiler

    Preview:
    DMLURef.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_barBoxLine"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ui.Gauge(), ui.SliderBar()

    Spoiler

    Preview:
    wKiWZgA.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_gaugeSlider"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ui.TextLine(), ui.EditLine()

    Spoiler

    Preview:
    e3OQOTs.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_textLineEditLine"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    Pagination

    Spoiler

    Preview:
    DZmbP4S.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_pagination"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    Tabs

    Spoiler

    Preview:
    bbovi1T.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_tabs"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    DropDown Tree

    Spoiler

    Preview:
    gmb3X0x.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_dropdownTree"

    and simply move the folder "exampleDropdownTree" into the client folder. (where the .exe is located).

    Otherwise change the path in the python file "example_dropdownTree.py".

    After the login in the game you will see the window.


    Download:

    This is the hidden content, please

     

    Category Navigation

    Spoiler

    Preview:
    BPzLnLe.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_categoryNav"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    ListBox Search

    Spoiler

    Preview:
    iMpNu3B.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_listBoxSearch"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    TextLineScrollable Class

    Spoiler

    Preview:
    haRL2QL.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_textLineScrollable"

    After the login in the game you will see the window


    Download:

    This is the hidden content, please

     

    Collapsible window

    Spoiler

    Preview:
    MwpRKdO.gif


    Call it:
    Add to imports at the top of game.py:
    "import example_collapseWnd"

    and simply move the folder "exampleCollapseWnd" into the client folder. (where the .exe is located).

    Otherwise change the path in the python file "example_collapseWnd.py".

    After the login in the game you will see the window.


    Download:

    This is the hidden content, please

     

    • Metin2 Dev 85
    • Angry 1
    • Sad 2
    • Think 2
    • Confused 2
    • Good 26
    • Love 6
    • Love 99
  10. On 11.9.2015 at 3:32 PM, Dafuq313 said:

    Closed mind ? I just said that i don't like it because it's useless ( IT IS ).And no,is not always good to have something else on the server.

    This system is purely useless,you can write informations that are not yours ( facebook,skype,email etc ) and then somebody takes them and harras somebody else.Is this "good to have on the server" ... i think you are closed mind since you think so,you look forward ( like you said ) "is good to have something new" but you don't look in other ways "what impact would have this on the server".

    Wow, these arguments are shit.

    Good idea! :)

  11. I just found some old questfunctions from my old lua extensions.
    On this way I spawned the ugly fences in the background:
    https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

    But you can't set the direction, so look for something roundly :D
     

    -- Join a dungeon index like: 208001
    function d.join_by_index(dungeonIndex,x,y)
    	pc.warp(x*100,y*100,dungeonIndex)
    end
    
    -- Spawn fences: Name, Vnum, Startposition X on map,Startposition Y on map, X Space between the fences, Y Space between the fences, How many fences you want to spawn
    function d.spawn_object_fence(objectName,objectVnum,objectX,objectXadd,objectY,objectYadd,objectCount)
    	local i = 0
    	while i < objectCount do
    		d.set_unique(objectName.."_"..i,d.spawn_mob(objectVnum, objectX, objectY))
    		i = i+1
    		objectX = objectX + objectXadd 
    		objectY = objectY + objectYadd
    	end
    end 
    -- Delete fences: Name, How many fences of this name you want to delete
    function d.delete_object_fence(objectName,objectCount)
    	local i = 0
    	while i < objectCount do
    		d.purge_unique(objectName.."_"..i)
    		i = i+1
    	end
    end
    • Metin2 Dev 1
×
×
  • 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.