Jump to content

Sistema de múltiplos pontos status e skills


Marcos
 Share

Recommended Posts

uicharacter.py:

Spoiler

Substituir função por:

def __OnClickStatusPlusButton(self, statusKey):
		try:
			statusPlusPoint=player.GetStatus(player.STAT)
			if statusPlusPoint > 4:
				self.ChooseCountPlusStat(statusKey)
			else:
				statusPlusCommand=self.statusPlusCommandDict[statusKey]
				net.SendChatPacket(statusPlusCommand)

		except KeyError, msg:
			dbg.TraceError("CharacterWindow.__OnClickStatusPlusButton KeyError: %s", msg)

Adicionar:

def ChooseCountPlusStat(self, statusKey):
		inputDialog = uiCommon.InputDialog()
		inputDialog.SetTitle(localeInfo.STATUS_BOX)
		inputDialog.SetMaxLength(2)
		inputDialog.SetNumberMode()
		inputDialog.SetFocus()
		inputDialog.SetAcceptEvent(lambda arg1=statusKey: self.ChooseCountPlusStatConfirm(arg1))
		inputDialog.SetCancelEvent(self.ChooseCountPlusStatHide)
		inputDialog.Open()
		self.inputDialog = inputDialog
		
	def ChooseCountPlusStatHide(self):
		self.inputDialog.Hide()
		
	def ChooseCountPlusStatConfirm(self, statusKey):
		self.ChooseCountPlusStatHide()
		statusPlusCommand=self.statusPlusCommandDict[statusKey]
		try:
			count = int(self.inputDialog.GetText())
			if count <= 0:
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.STATUS_BOX_PLUS)
				return
			if count > 30:
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.STATUS_BOX_INFO)
				return
			if count > 1:
				for i in xrange(count):
					net.SendChatPacket(statusPlusCommand)
			else:
				net.SendChatPacket(statusPlusCommand)

		except ValueError:
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.STATUS_BOX_PLUS)

 

locale_game.txt:

Spoiler
STATUS_BOX	Adiciona pontos nos status.
STATUS_BOX_INFO	Aumenta no máximo 30 pontos para não haver problemas com o teu personagem.
STATUS_BOX_PLUS	Apenas números positivos.

 

Limite estabelecido para nº de pontos por uso é 30 para não dar problemas com crashes, pode ser alterado.

Só está para stats, reproduzir o mesmo processo para skills.

Link to comment
Share on other sites

13 horas atrás, oserra disse:

uicharacter.py:

  Ocultar conteúdo

Substituir função por:


def __OnClickStatusPlusButton(self, statusKey):
		try:
			statusPlusPoint=player.GetStatus(player.STAT)
			if statusPlusPoint > 4:
				self.ChooseCountPlusStat(statusKey)
			else:
				statusPlusCommand=self.statusPlusCommandDict[statusKey]
				net.SendChatPacket(statusPlusCommand)

		except KeyError, msg:
			dbg.TraceError("CharacterWindow.__OnClickStatusPlusButton KeyError: %s", msg)

Adicionar:


def ChooseCountPlusStat(self, statusKey):
		inputDialog = uiCommon.InputDialog()
		inputDialog.SetTitle(localeInfo.STATUS_BOX)
		inputDialog.SetMaxLength(2)
		inputDialog.SetNumberMode()
		inputDialog.SetFocus()
		inputDialog.SetAcceptEvent(lambda arg1=statusKey: self.ChooseCountPlusStatConfirm(arg1))
		inputDialog.SetCancelEvent(self.ChooseCountPlusStatHide)
		inputDialog.Open()
		self.inputDialog = inputDialog
		
	def ChooseCountPlusStatHide(self):
		self.inputDialog.Hide()
		
	def ChooseCountPlusStatConfirm(self, statusKey):
		self.ChooseCountPlusStatHide()
		statusPlusCommand=self.statusPlusCommandDict[statusKey]
		try:
			count = int(self.inputDialog.GetText())
			if count <= 0:
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.STATUS_BOX_PLUS)
				return
			if count > 30:
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.STATUS_BOX_INFO)
				return
			if count > 1:
				for i in xrange(count):
					net.SendChatPacket(statusPlusCommand)
			else:
				net.SendChatPacket(statusPlusCommand)

		except ValueError:
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.STATUS_BOX_PLUS)

 

locale_game.txt:

  Ocultar conteúdo

STATUS_BOX	Adiciona pontos nos status.
STATUS_BOX_INFO	Aumenta no máximo 30 pontos para não haver problemas com o teu personagem.
STATUS_BOX_PLUS	Apenas números positivos.

 

Limite estabelecido para nº de pontos por uso é 30 para não dar problemas com crashes, pode ser alterado.

Só está para stats, reproduzir o mesmo processo para skills.

implementei o sistema, ao clicar nos pontos de status aparece o seguinte erro:

1207 10:28:10598 :: Traceback (most recent call last):

1207 10:28:10598 ::   File "ui.py", line 1362, in CallEvent

1207 10:28:10599 ::   File "ui.py", line 87, in __call__

1207 10:28:10599 ::   File "ui.py", line 78, in __call__

1207 10:28:10600 ::   File "uiCharacter.py", line 506, in __OnClickStatusPlusButton

1207 10:28:10600 ::   File "uiCharacter.py", line 1338, in ChooseCountPlusStat

1207 10:28:10600 :: NameError
1207 10:28:10600 :: : 
1207 10:28:10600 :: global name 'uiCommon' is not defined
1207 10:28:10600 :: 

Edited by Marcos
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...