Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server > Metin2 PServer Guides & Strategies
You last visited: Today at 11:56

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] Advanced Python Data Structures

Discussion on [Release] Advanced Python Data Structures within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
VegaS ♆'s Avatar
 
elite*gold: 10
Join Date: Jul 2013
Posts: 93
Received Thanks: 416
Cool [Release] Advanced Python Data Structures

Code:
#@../root/ui.py
#@Search for:
def RegisterToolTipWindow(type, createToolTipWindow):
	createToolTipWindowDict[type]=createToolTipWindow
#@Add after:
#######################################
#### START OF REGISTER STRUCT CLASS ####
"""
    How To Use Ex:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	@E.g #1:
	class ZodiacTempleToolTipBoard(ui.ThinBoard):
		CONFIG = ui.RegisterStructClass('TOOLTIP_BASE_POS TOOLTIP_WIDTH TOOLTIP_HEIGHT TOOLTIP_DEFAULT_SIZE_DICT '
			'TOOLTIP_TOP_RANK_LIST TOOLTIP_ADD_STRING')(100, 450, 300, {'w': 400, 'h': 500}, [1, 2, 3], 'String')
	
		def __mem_func__(self):
			print (self.CONFIG.TOOLTIP_BASE_POS, self.CONFIG.TOOLTIP_WIDTH, self.CONFIG.TOOLTIP_HEIGHT, self.CONFIG.TOOLTIP_ADD_STRING)
			print (self.CONFIG.TOOLTIP_DEFAULT_SIZE_DICT.get('w'), self.CONFIG.TOOLTIP_DEFAULT_SIZE_DICT.get('h'))
			print self.CONFIG.TOOLTIP_TOP_RANK_LIST

	@E.g #2:
		self.Transfer(ui.RegisterStructClass('szName lX lY')(player.GetName(), player.GetX(), player.GetY())) # TPacketGGTransfer

		def Transfer(self, c_pData):
			print(c_pData.szName, c_pData.lX, c_pData.lY)
			
	@E.g #3:
		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)
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
def RegisterStructClass(obj):
	import exception

	if (not isinstance(obj, str)):
		exception.Abort('RegisterStructClass:: Objects {0} need to be as {1}.'.format(type(obj), type(str)))

	def register(self, * kwargs):
		args = obj.split()
		if (len(args) <> len(kwargs)):
			exception.Abort('RegisterStructClass:: Failed to read arguments.')
	
		[self.__dict__.setdefault(key, value) for (key, value) in zip(args, kwargs)]

	return type('__struct__', (object, ), {'__init__': register})

######################################
#### END OF REGISTER STRUCT CLASS ####
VegaS ♆ is offline  
Thanks
3 Users
Old 11/30/2017, 22:05   #2
 
fannan10's Avatar
 
elite*gold: 0
Join Date: Apr 2013
Posts: 130
Received Thanks: 16
Nice release
fannan10 is offline  
Reply

Tags
epvp, m2release, python, struct


Similar Threads Similar Threads
[RELEASE] 5298 EntitySpawn Packet Structures
09/13/2010 - CO2 PServer Guides & Releases - 12 Replies
Entity Spawn: (10014) Spoiler: Offset| Type | Value 0 | Short | Size 2 | Short | Type 75 | Byte | Level 78 | Short | HairStyle 80 | Short | CharX 82 | Short | CharY 123 | int | QuizPoints
[RELEASE] 5293 Packet Structures
09/06/2010 - CO2 PServer Guides & Releases - 47 Replies
Hello :awesome:. Do NOT flame me for releasing this, saying noobs can now get the latest patch to work, because 'noobs' as we like to call them, need more than simple packet structures. Please if you use these packet structures, do not use them for ready to use sources, that would really, really mess up the private servers gain. From this moment on I am going to release Packet Structures for the Conquer Client patch 5293. These might be missing, or incorrect, but work for me, or...



All times are GMT +1. The time now is 11:56.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.