Jump to content

Metin2 - Python Data Structures


Recommended Posts

  • Forum Moderator

M2 Download Center

This is the hidden content, please
( Internal )

This is the hidden content, please
( GitHub )

I added two years ago a small function that allow you to make a struct like C++ for different purposes.

# Example #1

    pack = ui.RegisterStructClass('a b c')(15, {}, [])
    pack.a += 50
    pack.b.update({0: 250})
    pack.c.append(100)
    print (pack.a, pack.b, pack.c)

# Example #2.

    def Transfer(self, p):
		print(p.szName, p.lX, p.lY)

    self.Transfer(ui.RegisterStructClass('szName lX lY')(GetName(), GetX(), GetY()))

# Example #3.

config = ui.RegisterStructClass('width height default_size_dict rank_list text')(450, 300, {'w': 400, 'h': 500}, [1, 2, 3], 'Metin2')

print (
	config.width, config.height, config.text,
	config.default_size_dict.get('w'), config.default_size_dict.get('h'),
	config.rank_list
)

Repository:

This is the hidden content, please

  • Metin2 Dev 10
  • kekw 1
  • Sad 1
  • Lmao 1
  • Good 3
  • Love 1
  • Love 6
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Announcements



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