Register for your free account! | Forgot your password?

You last visited: Today at 05:08

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

Advertisement



[Mini-Python] Class Render Monster Card

Discussion on [Mini-Python] Class Render Monster Card 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
[Mini-Python] Class Render Monster Card

Code:
#! /usr/bin/env python
import app, dbg, chr, chrmgr, os, introSelect

"""
    Render Monster Card
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	A simple Python Module which gives you the chance to be able to turn mob differently with a specific animation such as atack, motion, death etc.
	This module was not designed for beginners in python, this is just a beginning for the rendering of every monster.
	You can also use it for other systems for render.
	
	WARNING:
		I don't offer any support for this, that module is just for guys who know what have to do.
		Code isn't working like official one.
		This script has not been tested, is just a simple idea like better then 'pseudocode', 
		you need to improve and do compatible with your scripts.

	Copyright: (c) 2016 VegaS
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""

class RenderMonsterCardParser():
    def __init__(self):
		self.monsterCardDict = GetMonsterCardPaths()
		self.srcFileName = 'monster_card.txt'
		self.startInstanceIndex = 90000
		self.destRotation = 25.0
		self.renderPos = {
			'x': 70.0,
			'y': 22.0,
			'z': 30.0
		}
		
		self.chrRenderer = introSelect.SelectCharacterWindow().CharacterRenderer()
		self.chrRenderer.SetParent(self)
		self.chrRenderer.Show()
		
	def GetMonsterCardPaths(self):
		m2dict = {'pathName': '','raceData': ''}
		try:
			lines = pack_open(self.srcFileName, "r").readlines()
		except IOError:
			dbg.LogBox("Can't load: {0}".format(self.srcFileName))
			app.Abort()

		for (key, value) in enumerate(lines):
			data = value[:-1].split(",")

			if (not len(data) or not data[0] or not data[1]):
				continue

			m2dict.update({key : {'pathName': data[0].strip(), 'raceData': data[1].strip()}})
			
		return m2dict
		
	def RegisterDefaultMotion(self):
		chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)
		chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, 'wait.msa')
		chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, 'wait2.msa')
		
	def OnUpdate(self):
		chr.Update()
		self.destRotation -= 0.5
		chr.SetRotation(self.destRotation)

	def OnRender(self, slotIndex):

		def CreateMonsterInstance(slotIndex):
			chrmgr.CreateRace(slotIndex)
			chrmgr.SelectRace(slotIndex)
			chrmgr.SetPathName(self.monsterCardDict[slotIndex]['pathName'])
			chrmgr.LoadRaceData(self.monsterCardDict[slotIndex]['raceData'])

		CreateMonsterInstance(slotIndex)

		chrEventDict = {
			0 : (lambda : chr.CreateInstance(slotIndex)),
			1 : (lambda : chr.SelectInstance(slotIndex)),
			2 : (lambda : chr.SetVirtualID(slotIndex)),
			3 : (lambda : chr.SetRace(slotIndex)),
			4 : (lambda : chr.SetArmor(0)),
			5 : (lambda : chr.SetRotation(self.destRotation)),
			6 : (lambda : chr.SetPixelPosition(self.renderPos['x'], self.renderPos['y'], self.renderPos['z'])),
			7 : (lambda : chr.SetMotionMode(chr.MOTION_MODE_GENERAL)),
			8 : (lambda : chr.SetLoopMotion(chr.MOTION_WAIT)),
			9 : (lambda : chr.Refresh()),
			10 : (lambda : chr.Show())
		}
		
		[chrEventDict.get(chrObject, lambda *arg: None)() for chrObject in chrEventDict.values()]
		
	def OnChangeMotionData(self, motionMode = chr.MOTION_MODE_GENERAL, motionType = chr.MOTION_COMBO_ATTACK_1, motionPathName = '', motionWeight = 0)
		chrmgr.RegisterMotionData(motionMode, motionType, motionPathName, motionWeight)

	def OnRenderMonsterCard(self, slotIndex):
		def ClearInstance(max_range_num):
			[chr.DeleteInstance(self.startInstanceIndex + rangeInst) for rangeInst in xrange(max_range_num)]

		if (not self.monsterCardDict.has_key(slotIndex)):
			return

		ClearInstance(len(self.monsterCardDict[0]))
		self.RegisterDefaultMotion()
		self.OnRender(self.startInstanceIndex + slotIndex)
VegaS ♆ is offline  
Thanks
6 Users
Old 11/28/2017, 16:14   #2
 
BizepsSupportAccount's Avatar
 
elite*gold: 0
Join Date: Dec 2014
Posts: 1,018
Received Thanks: 499
For those who have no clue about what this release is, there is a new System on the official Servers called Monster Card, and that's only the python class. It's comparable to the Okey-Card System.
BizepsSupportAccount is offline  
Old 11/28/2017, 22:59   #3
 
elite*gold: 26
Join Date: Oct 2011
Posts: 1,262
Received Thanks: 1,062
Official Servers aren't using a Python Class.
He3o Crysis is offline  
Thanks
1 User
Old 11/29/2017, 00:20   #4
 
VegaS ♆'s Avatar
 
elite*gold: 10
Join Date: Jul 2013
Posts: 93
Received Thanks: 416
Quote:
Originally Posted by He3o Crysis View Post
Official Servers aren't using a Python Class.
Quote:
Code isn't working like official one, is just a simple idea like better then 'pseudocode', you need to improve.
__
VegaS ♆ is offline  
Thanks
2 Users
Reply

Tags
epvp, monster card, render monster card


Similar Threads Similar Threads
[WTB] unded mini ghostly/mini panada/mini polar bear
05/07/2012 - Guild Wars Trading - 2 Replies
Hi, Would like to buy one of those pets. Make me an offer if you got one. Thanks.
[Service] Render Signaturen / Render signatures
07/10/2010 - elite*gold Trading - 84 Replies
Deutsch: Hallo Community, hier biete ich euch meinen Service an, Signaturen für euch zu erstellen. Eine Signatur wird 0 Elite Gold kosten. Die Signaturen werden auf Rendern basieren, die ihr euch aussuchen könnt. Finden könnt ihr diese über die Bildersuche bei Google, oder auch in verschiedenen Foren. Renderpacks auf elitepvpers: http://www.elitepvpers.com/forum/epvp-artists/57062 2-sammelthread-stocks-c4ds-brushes-render-und-font s.html



All times are GMT +1. The time now is 05:10.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.