Jump to content
Sign in to follow this  
unkoll

HP y MP OPONENTE en duelo

Recommended Posts

A petición del usuario

Debes iniciar sesión para ver el contenido del enlace en esta publicación.
 dejo esto por aqui

costinfo.py

INPUT_IGNORE = 0

VID = 0
STHX = 0
HPXD = 0

PLAYER_HP = 0
PLAYER_MAX_HP = 0
PLAYER_SP = 0
PLAYER_MAX_SP = 0
PLAYER_NAME = ""

game.py

import uiHealth
			
			#wskaznikiHP
			"super_quest"				: self.Tabulejtor,
			"pvp_zdruwko"				: self.Mozart,
			
			#inputpowerdziwko
			"get_input_value"				: self.GetInputValue,
			"get_input_start"				: self.GetInputOn,
			"get_input_end"					: self.GetInputOff,

def Mozart(self, data):
		dane = data.split("|")
		constInfo.PLAYER_NAME = str(dane[0])
		constInfo.PLAYER_HP = int(dane[1])
		constInfo.PLAYER_MAX_HP = int(dane[2])
		constInfo.PLAYER_SP = int(dane[3])
		constInfo.PLAYER_MAX_SP = int(dane[4])

def Tabulejtor(self, id):
		constInfo.STHX = int(id)
			
	def GetInputOn(self):
		constInfo.INPUT_IGNORE = 1
		
	def GetInputOff(self):
		constInfo.INPUT_IGNORE = 0
			
	def GetInputValue(self):
		net.SendQuestInputStringPacket(str(constInfo.VID))

def OpenQuestWindow(self, skin, idx):
		if constInfo.INPUT_IGNORE == 1:
			return
		else:
			self.interface.OpenQuestWindow(skin, idx)

uitarget.py

import uiHealth
import constInfo

def OnUpdate(self):		
		if player.IsPVPInstance(self.vid):
			constInfo.VID = self.vid
			event.QuestButtonClick(constInfo.STHX)
			if not self.healthBoard.IsShow() and self.vid != 0:
				self.healthBoard.Show()
		else:
			self.healthBoard.Hide()
		
		if self.isShowButton:
			
			exchangeButton = self.buttonDict[locale.TARGET_BUTTON_EXCHANGE]
			distance = player.GetCharacterDistance(self.vid)

			if distance < 0:
				return

			if exchangeButton.IsShow():
				if distance > self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

			else:
				if distance < self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

En def __init__(self) (uitarget.py) agregar

		self.healthBoard = uiHealth.HealthBoard()

En def Close()

		self.healthBoard.Hide()

Ejemplo

def Close(self):
		self.__Initialize()
		self.healthBoard.Hide()
		self.Hide()

Crea el archivo uihealth.py en root

import ui
import constInfo

def GetInfoFrom(id):
	table = {
		1	:	constInfo.PLAYER_NAME,
		2	:	constInfo.PLAYER_HP,
		3	:	constInfo.PLAYER_MAX_HP,
		4	:	constInfo.PLAYER_SP,
		5	:	constInfo.PLAYER_MAX_SP}
		
	if table.has_key(id):
		return table[id]
		

class HealthBoard(ui.ThinBoard):

	def __init__(self):
		ui.ThinBoard.__init__(self)
		
		self.Config()

	def __del__(self):
		ui.ThinBoard.__del__(self)
		
	def Config(self):
		self.SetSize(200, 120)
		self.SetPosition(0, 20)
		
		self.hp_bar = ui.Gauge()
		self.hp_bar.SetParent(self)
		self.hp_bar.SetPosition(30, 30+20)
		self.hp_bar.MakeGauge(130, "red")
		self.hp_bar.Show()
		
		self.sp_bar = ui.Gauge()
		self.sp_bar.SetParent(self)
		self.sp_bar.SetPosition(30, 60+20)
		self.sp_bar.MakeGauge(130, "blue")
		self.sp_bar.Show()
		
		self.name = ui.TextLine()
		self.name.SetParent(self)
		self.name.SetDefaultFontName()
		self.name.SetPosition(45, 30)
		self.name.SetText("")
		self.name.Show()	
		
		self.hp_show = ui.TextLine()
		self.hp_show.SetParent(self)
		self.hp_show.SetDefaultFontName()
		self.hp_show.SetPosition(60-15, 57)
		self.hp_show.SetText("")
		self.hp_show.Show()	
		
		self.sp_show = ui.TextLine()
		self.sp_show.SetParent(self)
		self.sp_show.SetDefaultFontName()
		self.sp_show.SetPosition(60-15, 80+7)
		self.sp_show.SetText("")
		self.sp_show.Show()	
		
	def OnUpdate(self):
		if (GetInfoFrom(2)+GetInfoFrom(3)+GetInfoFrom(4)+GetInfoFrom(5)) == 0:
			self.Hide()
		self.hp_bar.SetPercentage(GetInfoFrom(2), GetInfoFrom(3))
		self.sp_bar.SetPercentage(GetInfoFrom(4), GetInfoFrom(5))
		self.name.SetText(GetInfoFrom(1))
		self.hp_show.SetText("Health Points: %s / %s" % (GetInfoFrom(2), GetInfoFrom(3)))
		self.sp_show.SetText("Mana Points: %s / %s" % (GetInfoFrom(4), GetInfoFrom(5)))
		self.name.SetText("Character: %s" % (GetInfoFrom(1)))

Y la quest

quest wskaznikHpWroga begin
	state start begin
		when login begin
			cmdchat("super_quest "..q.getcurrentquestindex())
		end

		when info or button begin
			cmdchat("get_input_start")
			local vid = input(cmdchat("get_input_value"))
			cmdchat("get_input_end")
			local old_pc = pc.select(vid)
			local name = pc.get_name()
			local hp = pc.get_hp()
			local max_hp = pc.get_max_hp()
			local mp = pc.get_sp()
			local max_mp = pc.get_max_sp()
			pc.select(old_pc)
			cmdchat("pvp_zdruwko "..name.."|"..hp.."|"..max_hp.."|"..mp.."|"..max_mp)
		end
	end
end

 

 

Source: EPVP

Share this post


Link to post
Share on other sites

Si salta este error

1229 23:04:16952 :: self.name.SetText("Character: %s" % (GetInfoFrom(1)))

1229 11:44:05019 ::
networkModule.py(line:201) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:26) ?
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - exceptions.SyntaxError:invalid syntax (line 530)

1229 11:44:05019 :: ================================================== ================================================== ========
1229 11:44:05019 :: Abort!!!!

Hay que revisar los TAB e importar el evento event.QuestButtonClick(constInfo.STHX).

	def OnUpdate(self):
		if player.IsPVPInstance(self.vid):
			constInfo.VID = self.vid
			import event
			event.QuestButtonClick(constInfo.STHX)
			if not self.healthBoard.IsShow() and self.vid != 0:
				self.healthBoard.Show()
		else:
			self.healthBoard.Hide()

		if self.isShowButton:

			exchangeButton = self.buttonDict[locale.TARGET_BUTTON_EXCHANGE]
			distance = player.GetCharacterDistance(self.vid)

			if distance < 0:
				return

			if exchangeButton.IsShow():
				if distance > self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

			else:
				if distance < self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...