Jump to content

Shaman System - Equipment


Recommended Posts

Hello, I would like to ask for your help. I am solving a problem with Shaman system (Support buff character).

Costume and hair equipment for the character.

Unfortunately, the GUI does not show the icon of the fitted costume. The costume on the character can be seen.

See picture.

Thank you for your help

spacer.png

supportinformationwindow.py

import uiScriptLocale

ROOT_PATH = "d:/ymir work/ui/game/windows/"
ROOT = "d:/ymir work/ui/game/"
SUPPORT_DIRECTORY = "d:/ymir work/ui/support/"
SMALL_VALUE_FILE = "d:/ymir work/ui/public/Parameter_Slot_00.sub"
MIDDLE_VALUE_FILE = "d:/ymir work/ui/public/Parameter_Slot_01.sub"
LARGE_VALUE_FILE = "d:/ymir work/ui/public/Parameter_Slot_03.sub"
XLARGE_BUTTON_FILE = "d:/ymir work/ui/public/xlarge_button_03.sub"
BASE_SLOT_FILE = "d:/ymir work/ui/public/Slot_Base.sub"

SUPPORT_BG_WIDTH		= 352
SUPPORT_BG_HEIGHT	= 416

LONG_LABEL_WIDTH	= 266
LONG_LABEL_HEIGHT	= 19

SHORT_LABLE_WIDTH	= 90
SHORT_LABLE_HEIGHT	= 20

MIDDLE_LABLE_WIDTH	= 168
MIDDLE_LABLE_HEIGHT	= 20

EXP_GAGUE_INTERVAL	= 2
EXP_IMG_WIDTH		= 16
EXP_IMG_HEIGHT		= 16

GOLD_COLOR	= 0xFFFEE3AE
WHITE_COLOR = 0xFFFFFFFF
ORANGE_COLOR = 0xFFF2A505
	
window = {
	"name" : "SupportInformationWindow",
	"style" : ("movable", "float",),
	
	"x" : SCREEN_WIDTH - 176 -200 -146 -145,
	"y" : SCREEN_HEIGHT - 37 - 565,

	"width" : SUPPORT_BG_WIDTH,
	"height" : SUPPORT_BG_HEIGHT,

	"children" :
	(
		{
			"name" : "board",
			"type" : "window",

			"x" : 0,
			"y" : 0,

			"width" : SUPPORT_BG_WIDTH,
			"height" : SUPPORT_BG_HEIGHT,
			
			"children" :
			(
				## Support UI BG
				{ "name" : "PetUIBG", "type" : "expanded_image", "style" : ("attach",), "x" : 0, "y" : 0, "image" : "d:/ymir work/ui/support/support_bg.tga" },
				
				## Support Information Title
				{ 
					"name" : "TitleWindow", "type" : "window", "x" : 10, "y" : 10, "width" : SUPPORT_BG_WIDTH-10-15, "height" : 15, "style" : ("attach",),
					"children" :
					(
						{"name":"TitleName", "type":"text", "x":0, "y":0, "text":"Support Character System", "all_align" : "center"},
					),	
				},
				
				## Close Button
				{ 
					"name" : "CloseButton", 
					"type" : "button", 
					"x" : SUPPORT_BG_WIDTH -10-15, 
					"y" : 10, 
					"tooltip_text" : "Close", 
					"default_image" : "d:/ymir work/ui/public/close_button_01.sub",	
					"over_image" : "d:/ymir work/ui/public/close_button_02.sub",
					"down_image" : "d:/ymir work/ui/public/close_button_03.sub",
				},
				{
					"name" : "SlotSupportImage",
					"type" : "slot",
					"x" : 25,
					"y" : 226,
					"width" : 32,
					"height" : 32,
					
					"slot" : ({"index":0, "x":0, "y":0, "width":32, "height":32},),
				},
				
				## Support Name Window
				{ 
					"name" : "SupportsNameWindow", "type" : "window", "x" : 227, "y" : 30, "width" : SHORT_LABLE_WIDTH, "height" : SHORT_LABLE_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"SupportsNameWindows", "type":"text", "x":0, "y":0, "text": "Name", "color":GOLD_COLOR, "all_align" : "center"},
					),	
				},
				##Slot Support
				{
					"name" : "CombSlot",
					"type" : "slot",
			
					"x" : 8,
					"y" : 90,
			
					"width" : 300,
					"height" : 300,
			
					"slot" :
					(
						{"index":1, "x":69, "y":220, "width":31, "height":96},
						{"index":2, "x":243, "y":243, "width":32, "height":32},
					),
					
					"children" :
					(
						{
							"name" : "Slot1_Name",
							"type":"text",
							"x":85,
							"y":200,
							"text" : "Costume",
							"text_horizontal_align":"center"
						},
						{
							"name" : "Slot2_Name",
							"type":"text",
							"x":260,
							"y":200,
							"text" : "Hair",
							"text_horizontal_align":"center"
						},
					),
				},
				## Support Name
				{ 
					"name" : "NameWindow", "type" : "window", "x" : 136, "y" : 26+SHORT_LABLE_HEIGHT+3, "width" : LONG_LABEL_WIDTH, "height" : LONG_LABEL_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"SupportsName", "type":"text", "x":0, "y":0, "text": "", "r":1.0, "g":1.0, "b":1.0, "a":1.0, "all_align" : "center"},
					),	
				},
				
				## Level Title
				{ 
					"name" : "LevelWindow", "type" : "window", "x" : 228, "y" : 72, "width" : SHORT_LABLE_WIDTH, "height" : SHORT_LABLE_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"LevelTitle", "type":"text", "x":0, "y":0, "text": "Level", "color":GOLD_COLOR, "all_align" : "center"},
					),	
				},
				## Level Value
				{ 
					"name" : "LevelValueWindow", "type" : "window", "x" : 228, "y" : 69+SHORT_LABLE_HEIGHT+3, "width" : SHORT_LABLE_WIDTH, "height" : SHORT_LABLE_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"LevelValue", "type":"text", "x":0, "y":0, "text": "", "color":WHITE_COLOR, "all_align" : "center"},
					),	
				},
				## Specialita Title
				{ 
					"name" : "SpecialityWindow", "type" : "window", "x" : 228, "y" : 115, "width" : SHORT_LABLE_WIDTH, "height" : SHORT_LABLE_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"SpecialityTitle", "type":"text", "x":0, "y":0, "text": "Speciality", "color":GOLD_COLOR, "all_align" : "center"},
					),	
				},
				## Speciality Value
				{ 
					"name" : "SpecialityValueWindow", "type" : "window", "x" : 228, "y" : 111+SHORT_LABLE_HEIGHT+3, "width" : SHORT_LABLE_WIDTH, "height" : SHORT_LABLE_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"SpecialityValue", "type":"text", "x":0, "y":0, "text": "", "color":WHITE_COLOR, "all_align" : "center"},
					),	
				},			
				## EXP Title
				{ 
					"name" : "ExpWindow", "type" : "window", "x" : 228, "y" : 158, "width" : SHORT_LABLE_WIDTH, "height" : SHORT_LABLE_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"ExpTitle", "type":"text", "x":0, "y":0, "text": "Experience", "color":GOLD_COLOR, "all_align" : "center"},
					),	
				},
				## EXP Gauge
				{
					"name" : "UpBringing_Support_EXP_Gauge_Board",
					"type" : "window",
					"style": ("ltr",),

					"x" : 232,
					"y" : 180,
				
					"width"		: EXP_IMG_WIDTH * 5 + EXP_GAGUE_INTERVAL * 4,
					"height"	: EXP_IMG_HEIGHT,

					"children" :
					(
						{
							"name" : "UpBringing_Support_EXPGauge_01",
							"type" : "expanded_image",

							"x" : 0,
							"y" : 0,

							"image" : SUPPORT_DIRECTORY + "exp_gauge/exp_on.sub",
						},
						{
							"name" : "UpBringing_Support_EXPGauge_02",
							"type" : "expanded_image",

							"x" : EXP_IMG_WIDTH + EXP_GAGUE_INTERVAL + 1,
							"y" : 0,

							"image" : SUPPORT_DIRECTORY + "exp_gauge/exp_on.sub",
						},
						{
							"name" : "UpBringing_Support_EXPGauge_03",
							"type" : "expanded_image",

							"x" : EXP_IMG_WIDTH * 2 + EXP_GAGUE_INTERVAL * 2 + 3,
							"y" : 0,

							"image" : SUPPORT_DIRECTORY + "exp_gauge/exp_on.sub",
						},
						{
							"name" : "UpBringing_Support_EXPGauge_04",
							"type" : "expanded_image",

							"x" : EXP_IMG_WIDTH * 3 + EXP_GAGUE_INTERVAL * 3 + 4,
							"y" : 0,

							"image" : SUPPORT_DIRECTORY + "exp_gauge/exp_on.sub",
						},
					),
				}, 
				#End of EXP
				{ 
					"name" : "AbilitiesWindow", "type" : "window", "x" : 43, "y" : 202, "width" : LONG_LABEL_WIDTH, "height" : LONG_LABEL_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"AbilitiesName", "type":"text", "x":0, "y":0, "text": "Bonus", "color":ORANGE_COLOR, "all_align" : "center"},
					),	
				},
				##Equip
				{ 
					"name" : "EquipWindow", "type" : "window", "x" : 43, "y" : 265, "width" : LONG_LABEL_WIDTH, "height" : LONG_LABEL_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"EquipName", "type":"text", "x":0, "y":0, "text": "Equipment", "color":ORANGE_COLOR, "all_align" : "center"},
					),	
				},		
				## Int Title
				{ 
					"name" : "IntWindow", "type" : "window", "x" : 25, "y" : 232, "width" : MIDDLE_LABLE_WIDTH, "height" : MIDDLE_LABLE_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"IntTitle", "type":"text", "x":0, "y":0, "text": "Intelligence Value", "color":GOLD_COLOR, "all_align" : "center"},
					),	
				},
				## Int Value
				{ 
					"name" : "IntValueWindow", "type" : "window", "x" : -10 + MIDDLE_LABLE_WIDTH, "y" : 232, "width" : MIDDLE_LABLE_WIDTH, "height" : MIDDLE_LABLE_HEIGHT, "style" : ("attach",),
					"children" :
					(
						{"name":"SupportIntValue", "type":"text", "x":0, "y":0, "text": "", "color":WHITE_COLOR, "all_align" : "center"},
					),	
				},
			),			
		},
	),
}

uisupportsystem.py

import os
import ui
import player
import mouseModule
import net
import app
import snd
import item
import player
import chat
import grp
import uiScriptLocale
import localeInfo
import constInfo
import ime
import wndMgr
import uiToolTip


AFFECT_DICT = {
		item.APPLY_INT : localeInfo.TOOLTIP_INT,
	}
	
	
def checkdiv(n):
	x = str(n/10.0)
	if len(x) > 3:
		return str(x)[0:3]
	return str(x)

def pointop(n):
	t = int(n)
	if t / 10 < 1:
		return "0."+n
	else:		
		return n[0:len(n)-1]+"."+n[len(n)-1:]
		
class SupportMainGui(ui.ScriptWindow):
	class TextToolTip(ui.Window):
		def __init__(self, y):
			ui.Window.__init__(self, "TOP_MOST")

			textLine = ui.TextLine()
			textLine.SetParent(self)
			textLine.SetHorizontalAlignLeft()
			textLine.SetOutline()
			textLine.Show()
			self.y = y
			self.textLine = textLine

		def __del__(self):
			ui.Window.__del__(self)

		def SetText(self, text):
			self.textLine.SetText(text)

		def OnRender(self):
			(mouseX, mouseY) = wndMgr.GetMousePosition()
			self.textLine.SetPosition(mouseX, mouseY - 60 + self.y)

	def __init__(self, vnum = 0):
		ui.ScriptWindow.__init__(self)
		self.vnum = vnum
		self.__LoadWindow()
		

	def __del__(self):
		ui.ScriptWindow.__del__(self)

	def Show(self):
		ui.ScriptWindow.Show(self)

	def Close(self):
		self.Hide()
		constInfo.SUPPORTGUI = 0
		
	def OnPressEscapeKey(self):
		self.Close()
		return TRUE	

	def __LoadWindow(self):
		try:
			pyScrLoader = ui.PythonScriptLoader()
			pyScrLoader.LoadScriptFile(self, "uiscript/supportinformationwindow.py")
		except:
			import exception
			exception.Abort("supportinformationwindow.LoadWindow.LoadObject")
			
		try:
			self.board = self.GetChild("board")
			self.boardclose = self.GetChild("CloseButton")
			
			self.slotimage = self.GetChild("SlotSupportImage")
			self.supportname = self.GetChild("SupportsName")
			self.speciality = self.GetChild("SpecialityValue")
			
			self.suppexp = self.GetChild("UpBringing_Support_EXP_Gauge_Board")
			self.tooltipexp = []
			for i in range(0,4):
				self.tooltipexp.append(self.TextToolTip(15*i))
				self.tooltipexp[i].Hide()
						
			self.supportlvl = self.GetChild("LevelValue")
			self.combSlot = self.GetChild("CombSlot")
			self.petexpa = self.GetChild("UpBringing_Support_EXPGauge_01")
			self.petexpb = self.GetChild("UpBringing_Support_EXPGauge_02")
			self.petexpc = self.GetChild("UpBringing_Support_EXPGauge_03")
			self.petexpd = self.GetChild("UpBringing_Support_EXPGauge_04")
			self.petexppages = []			
			self.petexppages.append(self.petexpa)
			self.petexppages.append(self.petexpb)
			self.petexppages.append(self.petexpc)
			self.petexppages.append(self.petexpd)
			
			for exp in self.petexppages:
				exp.SetSize(0, 0)
			
			self.supportint = self.GetChild("SupportIntValue")
			self.SetDefaultInfo()
			self.boardclose.SetEvent(ui.__mem_func__(self.Close,))
			self.combSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.__OnSelectEmptySlot))

		except:
			import exception
			exception.Abort("PetInformationWindow.LoadWindow.BindObject")

	def SetDefaultInfo(self):
		self.supportname.SetText("")
		self.speciality.SetText("")
		self.supportlvl.SetText("")
		self.supportint.SetText("")
		
		self.slotimage.ClearSlot(0)
		for i in xrange(4):
			self.combSlot.ClearSlot(i)
		self.SetExperience(0,0)

	def SetImageSlot(self, vnum):
		self.slotimage.SetItemSlot(0, int(vnum), 0)
		self.slotimage.SetAlwaysRenderCoverButton(0, True)
	
	def SetName(self, name , name2):
		real_name = name + name2
		self.supportname.SetText(real_name)
	
	def SetLevel(self, level):
		self.supportlvl.SetText(level)
		
	def SetSpeciality(self, speciality):
		self.speciality.SetText(speciality)
		
	def SetInt(self, ints):
		self.supportint.SetText(ints +"%")
			
	def SetExperience(self, expm, exptot):
		expm = int(expm)
		exptot = int(exptot)
		
		if exptot > 0:	
			totalexp = exptot
			totexpm = int(float(totalexp) / 100 * 100 )
			totexpi = totalexp - totexpm
			expmp =  float(expm) / totexpm * 100
		else:
			totalexp = 0
			totexpm = 0
			totexpi = 0
			expmp =  0
			
		
		curPoint = int(min(expm, totexpm))
		curPoint = int(max(expm, 0))
		maxPoint = int(max(totexpm, 0))
		
		maxPointi = int(max(totexpi, 0))

		quarterPoint = maxPoint / 4
		quarterPointi = maxPointi 
		FullCount = 0

		if 0 != quarterPoint:
			FullCount = min(4, curPoint / quarterPoint)

		for i in xrange(3):
			self.petexppages[i].Hide()
			
		self.petexppages[3].Hide()

		for i in xrange(FullCount):
			self.petexppages[i].SetRenderingRect(0.0, 0.0, 0.0, 0.0)
			self.petexppages[i].Show()

		if 0 != quarterPoint:
			if FullCount < 4:
				Percentage = float(curPoint % quarterPoint) / quarterPoint - 1.0
				self.petexppages[FullCount].SetRenderingRect(0.0, Percentage, 0.0, 0.0)
				self.petexppages[FullCount].Show()
			
		#####
		self.tooltipexp[0].SetText("Experience : %d of %d" % (expm, totexpm))
		self.tooltipexp[1].SetText("Experience : %.2f%%" % expmp)
	def __OnSelectEmptySlot(self, selectedSlotPos):
		isAttached = mouseModule.mouseController.isAttached()
		if isAttached:
			attachedSlotType = mouseModule.mouseController.GetAttachedType()
			attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
			targetIndex = player.GetItemIndex(attachedSlotPos)
			if attachedSlotType != player.SLOT_TYPE_INVENTORY:
				return
				
			mouseModule.mouseController.DeattachObject()
				
			item.SelectItem(targetIndex)
			itemType = item.GetItemType()
			itemSubType = item.GetItemSubType()
			itemVnum = player.GetItemIndex(attachedSlotPos)
			if itemType != item.ITEM_TYPE_COSTUME:
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.COMB_ALERT3)
				return
				
			if itemSubType == item.ITEM_TYPE_COSTUME:
				chat.AppendChat(chat.CHAT_TYPE_INFO, "<Support System> You can not put this item!")
				return
				
			if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE):
				chat.AppendChat(chat.CHAT_TYPE_INFO, "<Support System> You can not put this item. Your support is male!")
				return
				
			self.combSlot.SetItemSlot(selectedSlotPos, player.GetItemIndex(attachedSlotPos), player.GetItemCount(attachedSlotPos))
	
			if selectedSlotPos == 1:
				net.SendChatPacket("/support_system %s" % (str(itemVnum)))
			else:
				net.SendChatPacket("/support_system_d %s" % (str(itemVnum)))
					
			for i in xrange(4):
				self.combSlot.ClearSlot(i)
			
	def OnUpdate(self):
		if TRUE == self.suppexp.IsIn():
			for i in range(0,4):				
				self.tooltipexp[i].Show()
		else:
			for i in range(0,4):				
				self.tooltipexp[i].Hide()
	

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 1 year later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.