Jump to content

xGalardo

Member
  • Posts

    46
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by xGalardo

  1. Not work.

     

    class TargetBoard(ui.ThinBoard):
    	if app.ENABLE_SEND_TARGET_INFO:
    		class InfoBoard(ui.ThinBoard):
    			class ItemListBoxItem(ui.ListBoxExNew.Item):
    				def __init__(self, width):
    					ui.ListBoxExNew.Item.__init__(self)
    
    					image = ui.ExpandedImageBox()
    					image.SetParent(self)
    					image.Show()
    					self.image = image
    
    					nameLine = ui.TextLine()
    					nameLine.SetParent(self)
    					nameLine.SetPosition(32 + 5, 0)
    					nameLine.Show()
    					self.nameLine = nameLine
    
    					if app.ENABLE_SEND_TARGET_INFO_EXTENDED:
    						rarity = ui.TextLine()
    						rarity.SetParent(self)
    						rarity.SetPosition(32 + 5, 11)
    						rarity.Show()
    						self.rarity = rarity
    
    					self.SetSize(width, 32 + 5)
    
    				def LoadImage(self, image, name = None):
    					self.image.LoadImage(image)
    					self.SetSize(self.GetWidth(), self.image.GetHeight() + 5 * (self.image.GetHeight() / 32))
    					if name != None:
    						self.SetText(name)
    
    				def SetText(self, text):
    					self.nameLine.SetText(text)
    
    				if app.ENABLE_SEND_TARGET_INFO_EXTENDED:
    					def SetRarity(self, rarity):
    						if rarity <= 0:
    							return
    
    						real_rarity = rarity / 10000
    						self.rarity.SetText(str(self.GetRarity(real_rarity)))
    
    					def GetRarity(self, rarity):
    						if rarity >= 100:
    							return "|cFFFFFFFFGarantált|r"
    						elif rarity < 100 and rarity >= 70:
    							return "|cFFFFFFFFÁtlagos|r"
    						elif rarity < 70 and rarity >= 50:
    							return "|cFF32CD32Átlagon felüli|r"
    						elif rarity < 50 and rarity >= 30:
    							return "|cFF9400D3Ritka|r"
    						elif rarity < 30 and rarity >= 11:
    							return "|cFF1E90FFEpikus|r"
    						elif rarity <= 10:
    							return "|cFFFFD700Legendás|r"
    							
    						return ""
    
    				def RefreshHeight(self):
    					ui.ListBoxExNew.Item.RefreshHeight(self)
    					self.image.SetRenderingRect(0.0, 0.0 - float(self.removeTop) / float(self.GetHeight()), 0.0, 0.0 - float(self.removeBottom) / float(self.GetHeight()))
    					self.image.SetPosition(0, - self.removeTop)
    
    			MAX_ITEM_COUNT = 5
    
    			EXP_BASE_LVDELTA = [
    				1,  #  -15 0
    				5,  #  -14 1
    				10, #  -13 2
    				20, #  -12 3
    				30, #  -11 4
    				50, #  -10 5
    				70, #  -9  6
    				80, #  -8  7
    				85, #  -7  8
    				90, #  -6  9
    				92, #  -5  10
    				94, #  -4  11
    				96, #  -3  12
    				98, #  -2  13
    				100,	#  -1  14
    				100,	#  0   15
    				105,	#  1   16
    				110,	#  2   17
    				115,	#  3   18
    				120,	#  4   19
    				125,	#  5   20
    				130,	#  6   21
    				135,	#  7   22
    				140,	#  8   23
    				145,	#  9   24
    				150,	#  10  25
    				155,	#  11  26
    				160,	#  12  27
    				165,	#  13  28
    				170,	#  14  29
    				180,	#  15  30
    			]
    
    			RACE_FLAG_TO_NAME = {
    				1 << 0  : localeInfo.TARGET_INFO_RACE_ANIMAL,
    				1 << 1 	: localeInfo.TARGET_INFO_RACE_UNDEAD,
    				1 << 2  : localeInfo.TARGET_INFO_RACE_DEVIL,
    				1 << 3  : localeInfo.TARGET_INFO_RACE_HUMAN,
    				1 << 4  : localeInfo.TARGET_INFO_RACE_ORC,
    				1 << 5  : localeInfo.TARGET_INFO_RACE_MILGYO,
    				1 << 6	: localeInfo.TARGET_INFO_NEWRACE_INSECT,
    				1 << 7	: localeInfo.TARGET_INFO_NEWRACE_FIRE,
    				1 << 8	: localeInfo.TARGET_INFO_NEWRACE_ICE,
    				1 << 9	: localeInfo.TARGET_INFO_NEWRACE_DESERT,
    				1 << 10	: localeInfo.TARGET_INFO_NEWRACE_TREE,
    			}
    
    			SUB_RACE_FLAG_TO_NAME = {
    				1 << 11 : localeInfo.TARGET_INFO_RACE_ELEC,
    				1 << 12 : localeInfo.TARGET_INFO_RACE_FIRE,
    				1 << 13 : localeInfo.TARGET_INFO_RACE_ICE,
    				1 << 14 : localeInfo.TARGET_INFO_RACE_WIND,
    				1 << 15 : localeInfo.TARGET_INFO_RACE_EARTH,
    				1 << 16 : localeInfo.TARGET_INFO_RACE_DARK,
    			}
    
    			STONE_START_VNUM = 28030
    			STONE_LAST_VNUM = 28042
    
    			BOARD_WIDTH = 250
    
    			def __init__(self):
    				ui.ThinBoard.__init__(self)
    
    				self.HideCorners(self.LT)
    				self.HideCorners(self.RT)
    				self.HideLine(self.T)
    
    				self.race = 0
    				self.hasItems = False
    
    				self.itemTooltip = uiToolTip.ItemToolTip()
    				self.itemTooltip.HideToolTip()
    
    				self.stoneImg = None
    				self.stoneVnum = None
    				self.lastStoneVnum = 0
    				self.nextStoneIconChange = 0
    				self.itemScrollBar = None
    
    				self.SetSize(self.BOARD_WIDTH, 0)
    
    			def __del__(self):
    				ui.ThinBoard.__del__(self)
    
    			def __UpdatePosition(self, targetBoard):
    				self.SetPosition(targetBoard.GetLeft() + (targetBoard.GetWidth() - self.GetWidth()) / 2, targetBoard.GetBottom() - 17)
    
    			def Open(self, targetBoard, race):
    				self.__LoadInformation(race)
    
    				self.SetSize(self.BOARD_WIDTH, self.yPos + 10)
    				self.__UpdatePosition(targetBoard)
    
    				self.Show()
    
    			def Refresh(self):
    				self.__LoadInformation(self.race)
    				self.SetSize(self.BOARD_WIDTH, self.yPos + 10)
    
    			def Close(self):
    				self.itemTooltip.HideToolTip()
    				self.itemScrollBar = None
    				self.Hide()
    
    			def __LoadInformation(self, race):
    				self.yPos = 7
    				self.children = []
    				self.race = race
    				self.stoneImg = None
    				self.stoneVnum = None
    				self.nextStoneIconChange = 0
    
    				self.__LoadInformation_Default(race)
    				self.__LoadInformation_Race(race)
    				self.__LoadInformation_Resists(race)
    				self.__LoadInformation_Drops(race)
    
    			def __LoadInformation_Default_GetHitRate(self, race):
    				attacker_dx = nonplayer.GetMonsterDX(race)
    				attacker_level = nonplayer.GetMonsterLevel(race)
    
    				self_dx = player.GetStatus(player.DX)
    				self_level = player.GetStatus(player.LEVEL)
    
    				iARSrc = min(90, (attacker_dx * 4 + attacker_level * 2) / 6)
    				iERSrc = min(90, (self_dx * 4 + self_level * 2) / 6)
    
    				fAR = (float(iARSrc) + 210.0) / 300.0
    				fER = (float(iERSrc) * 2 + 5) / (float(iERSrc) + 95) * 3.0 / 10.0
    
    				return fAR - fER
    				
    			def __LoadInformation_Resists(self, race):
    				self.AppendSeperator()
    				self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS)
    				self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE0 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_SWORD), nonplayer.GetResist(race, nonplayer.MOB_RESIST_TWOHAND), nonplayer.GetResist(race, nonplayer.MOB_RESIST_BELL)))
    				self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE1 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_DAGGER), nonplayer.GetResist(race, nonplayer.MOB_RESIST_FAN), nonplayer.GetResist(race, nonplayer.MOB_RESIST_BOW)))
    				self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE2 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_MAGIC)))
    
    			def __LoadInformation_Default(self, race):
    				self.AppendSeperator()
    				self.AppendTextLine(localeInfo.TARGET_INFO_MAX_HP % localeInfo.DottedNumber(nonplayer.GetMonsterMaxHP(race)))
    
    				# calc att damage
    				monsterLevel = nonplayer.GetMonsterLevel(race)
    				fHitRate = self.__LoadInformation_Default_GetHitRate(race)
    				iDamMin, iDamMax = nonplayer.GetMonsterDamage(race)
    				iDamMin = int((iDamMin + nonplayer.GetMonsterST(race)) * 2 * fHitRate) + monsterLevel * 2
    				iDamMax = int((iDamMax + nonplayer.GetMonsterST(race)) * 2 * fHitRate) + monsterLevel * 2
    				iDef = player.GetStatus(player.DEF_GRADE) * (100 + player.GetStatus(player.DEF_BONUS)) / 100
    				fDamMulti = nonplayer.GetMonsterDamageMultiply(race)
    				iDamMin = int(max(0, iDamMin - iDef) * fDamMulti)
    				iDamMax = int(max(0, iDamMax - iDef) * fDamMulti)
    				if iDamMin < 1:
    					iDamMin = 1
    				if iDamMax < 5:
    					iDamMax = 5
    				self.AppendTextLine(localeInfo.TARGET_INFO_DAMAGE % (str(iDamMin), str(iDamMax)))
    
    				idx = min(len(self.EXP_BASE_LVDELTA) - 1, max(0, (monsterLevel + 15) - player.GetStatus(player.LEVEL)))
    				iExp = nonplayer.GetMonsterExp(race) * self.EXP_BASE_LVDELTA[idx] / 100
    				self.AppendTextLine(localeInfo.TARGET_INFO_EXP % localeInfo.DottedNumber(iExp))
    				
    				self.AppendTextLine(localeInfo.TARGET_INFO_GOLD_MIN_MAX % (localeInfo.DottedNumber(nonplayer.GetMobGoldMin(race)), localeInfo.DottedNumber(nonplayer.GetMobGoldMax(race))))
    				self.AppendTextLine(localeInfo.TARGET_INFO_REGEN_INFO % (nonplayer.GetMobRegenPercent(race), nonplayer.GetMobRegenCycle(race)))
    
    			def __LoadInformation_Race(self, race):
    				dwRaceFlag = nonplayer.GetMonsterRaceFlag(race)
    				self.AppendSeperator()
    
    				mainrace = ""
    				subrace = ""
    				for i in xrange(17):
    					curFlag = 1 << i
    					if HAS_FLAG(dwRaceFlag, curFlag):
    						if self.RACE_FLAG_TO_NAME.has_key(curFlag):
    							mainrace += self.RACE_FLAG_TO_NAME[curFlag] + ", "
    						elif self.SUB_RACE_FLAG_TO_NAME.has_key(curFlag):
    							subrace += self.SUB_RACE_FLAG_TO_NAME[curFlag] + ", "
    				if nonplayer.IsMonsterStone(race):
    					mainrace += localeInfo.TARGET_INFO_RACE_METIN + ", "
    				if mainrace == "":
    					mainrace = localeInfo.TARGET_INFO_NO_RACE
    				else:
    					mainrace = mainrace[:-2]
    				if subrace == "":
    					subrace = localeInfo.TARGET_INFO_NO_RACE
    				else:
    					subrace = subrace[:-2]
    
    				self.AppendTextLine(localeInfo.TARGET_INFO_MAINRACE % mainrace)
    				self.AppendTextLine(localeInfo.TARGET_INFO_SUBRACE % subrace)
    
    			def __LoadInformation_Drops(self, race):
    				self.AppendSeperator()
    
    
    				if race in MONSTER_INFO_DATA:
    					if len(MONSTER_INFO_DATA[race]["items"]) == 0:
    						if self.itemScrollBar.IsShow():
    							self.AppendTextLine(localeInfo.TARGET_INFO_NO_DEBUG)
    						else:	
    							self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT)
    					else:
    						itemListBox = ui.ListBoxExNew(32 + 5, self.MAX_ITEM_COUNT)
    						itemListBox.SetSize(self.GetWidth() - 15 * 2 - ui.ScrollBar.SCROLLBAR_WIDTH, (32 + 5) * self.MAX_ITEM_COUNT)
    						height = 0
    						for curItem in MONSTER_INFO_DATA[race]["items"]:
    							if curItem.has_key("vnum_list"):
    								height += self.AppendItem(itemListBox, curItem["vnum_list"], curItem["count"], curItem["rarity"])
    							else:
    								height += self.AppendItem(itemListBox, curItem["vnum"], curItem["count"], curItem["rarity"])						
    						
    						if height < itemListBox.GetHeight():
    							itemListBox.SetSize(itemListBox.GetWidth(), height)
    						self.AppendWindow(itemListBox, 15)
    						itemListBox.SetBasePos(0)
    
    						if len(MONSTER_INFO_DATA[race]["items"]) > itemListBox.GetViewItemCount():
    							itemScrollBar = ui.ScrollBar()
    							itemScrollBar.SetParent(self)
    							itemScrollBar.SetPosition(itemListBox.GetRight(), itemListBox.GetTop())
    							itemScrollBar.SetScrollBarSize(32 * self.MAX_ITEM_COUNT + 5 * (self.MAX_ITEM_COUNT - 1))
    							itemScrollBar.SetMiddleBarSize(float(self.MAX_ITEM_COUNT) / float(height / (32 + 5)))
    							itemScrollBar.Show()
    							itemListBox.SetScrollBar(itemScrollBar)
    							self.itemScrollBar = itemScrollBar
    				else:
    					self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT)
    
    			def AppendTextLine(self, text):
    				textLine = ui.TextLine()
    				textLine.SetParent(self)
    				textLine.SetWindowHorizontalAlignCenter()
    				textLine.SetHorizontalAlignCenter()
    				textLine.SetText(text)
    				textLine.SetPosition(0, self.yPos)
    				textLine.Show()
    
    				self.children.append(textLine)
    				self.yPos += 17
    
    			def AppendSeperator(self):
    				img = ui.ImageBox()
    				img.LoadImage("d:/ymir work/ui/seperator.tga")
    				self.AppendWindow(img)
    				img.SetPosition(img.GetLeft(), img.GetTop() - 15)
    				self.yPos -= 15
    
    			#def AppendItem(self, listBox, vnums, count):
    			def AppendItem(self, listBox, vnums, count, rarity = 0):
    				if type(vnums) == int:
    					vnum = vnums
    				else:
    					vnum = vnums[0]
    
    				item.SelectItem(vnum)
    				itemName = item.GetItemName()
    				if type(vnums) != int and len(vnums) > 1:
    					vnums = sorted(vnums)
    					realName = itemName[:itemName.find("+")]
    					if item.GetItemType() == item.ITEM_TYPE_METIN:
    						realName = localeInfo.TARGET_INFO_STONE_NAME
    						itemName = realName + "+0 - +4"
    					else:
    						itemName = realName + "+" + str(vnums[0] % 10) + " - +" + str(vnums[len(vnums) - 1] % 10)
    					vnum = vnums[len(vnums) - 1]
    
    				myItem = self.ItemListBoxItem(listBox.GetWidth())
    				myItem.LoadImage(item.GetIconImageFileName())
    				if count <= 1:
    					myItem.SetText(itemName)
    				else:
    					myItem.SetText("%dx %s" % (count, itemName))
    					
    				if app.ENABLE_SEND_TARGET_INFO_EXTENDED:
    					myItem.SetRarity(rarity)					
    					
    				myItem.SAFE_SetOverInEvent(self.OnShowItemTooltip, vnum)
    				myItem.SAFE_SetOverOutEvent(self.OnHideItemTooltip)
    				listBox.AppendItem(myItem)
    
    				if item.GetItemType() == item.ITEM_TYPE_METIN:
    					self.stoneImg = myItem
    					self.stoneVnum = vnums
    					self.lastStoneVnum = self.STONE_LAST_VNUM + vnums[len(vnums) - 1] % 1000 / 100 * 100
    
    				return myItem.GetHeight()
    
    			def OnShowItemTooltip(self, vnum):
    				item.SelectItem(vnum)
    				if item.GetItemType() == item.ITEM_TYPE_METIN:
    					self.itemTooltip.isStone = True
    					self.itemTooltip.isBook = False
    					self.itemTooltip.isBook2 = False
    					self.itemTooltip.SetItemToolTip(self.lastStoneVnum)
    				else:
    					self.itemTooltip.isStone = False
    					self.itemTooltip.isBook = True
    					self.itemTooltip.isBook2 = True
    					self.itemTooltip.SetItemToolTip(vnum)
    
    			def OnHideItemTooltip(self):
    				self.itemTooltip.HideToolTip()
    
    			def AppendWindow(self, wnd, x = 0, width = 0, height = 0):
    				if width == 0:
    					width = wnd.GetWidth()
    				if height == 0:
    					height = wnd.GetHeight()
    
    				wnd.SetParent(self)
    				if x == 0:
    					wnd.SetPosition((self.GetWidth() - width) / 2, self.yPos)
    				else:
    					wnd.SetPosition(x, self.yPos)
    				wnd.Show()
    
    				self.children.append(wnd)
    				self.yPos += height + 5
    
    			def OnUpdate(self):
    				if self.stoneImg != None and self.stoneVnum != None and app.GetTime() >= self.nextStoneIconChange:
    					nextImg = self.lastStoneVnum + 1
    					if nextImg % 100 > self.STONE_LAST_VNUM % 100:
    						nextImg -= (self.STONE_LAST_VNUM - self.STONE_START_VNUM) + 1
    					self.lastStoneVnum = nextImg
    					self.nextStoneIconChange = app.GetTime() + 2.5
    
    					item.SelectItem(nextImg)
    					itemName = item.GetItemName()
    					realName = itemName[:itemName.find("+")]
    					realName = realName + "+0 - +4"
    					self.stoneImg.LoadImage(item.GetIconImageFileName(), realName)
    
    					if self.itemTooltip.IsShow() and self.itemTooltip.isStone:
    						self.itemTooltip.SetItemToolTip(nextImg)

     

  2. Thanks, but not work!

     

    class TargetBoard(ui.ThinBoard):
    	if app.ENABLE_SEND_TARGET_INFO:
    		class InfoBoard(ui.ThinBoard):
    			class ItemListBoxItem(ui.ListBoxExNew.Item):
    				def __init__(self, width):
    					ui.ListBoxExNew.Item.__init__(self)
    
    					image = ui.ExpandedImageBox()
    					image.SetParent(self)
    					image.Show()
    					self.image = image
    
    					nameLine = ui.TextLine()
    					nameLine.SetParent(self)
    					nameLine.SetPosition(32 + 5, 0)
    					nameLine.Show()
    					self.nameLine = nameLine
    
    					if app.ENABLE_SEND_TARGET_INFO_EXTENDED:
    						rarity = ui.TextLine()
    						rarity.SetParent(self)
    						rarity.SetPosition(32 + 5, 11)
    						rarity.Show()
    						self.rarity = rarity
    
    					self.SetSize(width, 32 + 5)
    
    				def LoadImage(self, image, name = None):
    					self.image.LoadImage(image)
    					self.SetSize(self.GetWidth(), self.image.GetHeight() + 5 * (self.image.GetHeight() / 32))
    					if name != None:
    						self.SetText(name)
    
    				def SetText(self, text):
    					self.nameLine.SetText(text)
    
    				if app.ENABLE_SEND_TARGET_INFO_EXTENDED:
    					def SetRarity(self, rarity):
    						if rarity <= 0:
    							return
    
    						real_rarity = rarity / 10000
    						self.rarity.SetText(str(self.GetRarity(real_rarity)))
    
    					def GetRarity(self, rarity):
    						if rarity >= 100:
    							return "|cFFFFFFFFGarantált|r"
    						elif rarity < 100 and rarity >= 70:
    							return "|cFFFFFFFFÁtlagos|r"
    						elif rarity < 70 and rarity >= 50:
    							return "|cFF32CD32Átlagon felüli|r"
    						elif rarity < 50 and rarity >= 30:
    							return "|cFF9400D3Ritka|r"
    						elif rarity < 30 and rarity >= 11:
    							return "|cFF1E90FFEpikus|r"
    						elif rarity <= 10:
    							return "|cFFFFD700Legendás|r"
    							
    						return ""
    
    				def RefreshHeight(self):
    					ui.ListBoxExNew.Item.RefreshHeight(self)
    					self.image.SetRenderingRect(0.0, 0.0 - float(self.removeTop) / float(self.GetHeight()), 0.0, 0.0 - float(self.removeBottom) / float(self.GetHeight()))
    					self.image.SetPosition(0, - self.removeTop)
    
    			MAX_ITEM_COUNT = 5
    
    			EXP_BASE_LVDELTA = [
    				1,  #  -15 0
    				5,  #  -14 1
    				10, #  -13 2
    				20, #  -12 3
    				30, #  -11 4
    				50, #  -10 5
    				70, #  -9  6
    				80, #  -8  7
    				85, #  -7  8
    				90, #  -6  9
    				92, #  -5  10
    				94, #  -4  11
    				96, #  -3  12
    				98, #  -2  13
    				100,	#  -1  14
    				100,	#  0   15
    				105,	#  1   16
    				110,	#  2   17
    				115,	#  3   18
    				120,	#  4   19
    				125,	#  5   20
    				130,	#  6   21
    				135,	#  7   22
    				140,	#  8   23
    				145,	#  9   24
    				150,	#  10  25
    				155,	#  11  26
    				160,	#  12  27
    				165,	#  13  28
    				170,	#  14  29
    				180,	#  15  30
    			]
    
    			RACE_FLAG_TO_NAME = {
    				1 << 0  : localeInfo.TARGET_INFO_RACE_ANIMAL,
    				1 << 1 	: localeInfo.TARGET_INFO_RACE_UNDEAD,
    				1 << 2  : localeInfo.TARGET_INFO_RACE_DEVIL,
    				1 << 3  : localeInfo.TARGET_INFO_RACE_HUMAN,
    				1 << 4  : localeInfo.TARGET_INFO_RACE_ORC,
    				1 << 5  : localeInfo.TARGET_INFO_RACE_MILGYO,
    				1 << 6	: localeInfo.TARGET_INFO_NEWRACE_INSECT,
    				1 << 7	: localeInfo.TARGET_INFO_NEWRACE_FIRE,
    				1 << 8	: localeInfo.TARGET_INFO_NEWRACE_ICE,
    				1 << 9	: localeInfo.TARGET_INFO_NEWRACE_DESERT,
    				1 << 10	: localeInfo.TARGET_INFO_NEWRACE_TREE,
    			}
    
    			SUB_RACE_FLAG_TO_NAME = {
    				1 << 11 : localeInfo.TARGET_INFO_RACE_ELEC,
    				1 << 12 : localeInfo.TARGET_INFO_RACE_FIRE,
    				1 << 13 : localeInfo.TARGET_INFO_RACE_ICE,
    				1 << 14 : localeInfo.TARGET_INFO_RACE_WIND,
    				1 << 15 : localeInfo.TARGET_INFO_RACE_EARTH,
    				1 << 16 : localeInfo.TARGET_INFO_RACE_DARK,
    			}
    
    			STONE_START_VNUM = 28030
    			STONE_LAST_VNUM = 28042
    
    			BOARD_WIDTH = 250
    
    			def __init__(self):
    				ui.ThinBoard.__init__(self)
    
    				self.HideCorners(self.LT)
    				self.HideCorners(self.RT)
    				self.HideLine(self.T)
    
    				self.race = 0
    				self.hasItems = False
    
    				self.itemTooltip = uiToolTip.ItemToolTip()
    				self.itemTooltip.HideToolTip()
    
    				self.stoneImg = None
    				self.stoneVnum = None
    				self.lastStoneVnum = 0
    				self.nextStoneIconChange = 0
    				self.itemScrollBar = None
    
    				self.SetSize(self.BOARD_WIDTH, 0)
    
    			def __del__(self):
    				ui.ThinBoard.__del__(self)
    
    			def __UpdatePosition(self, targetBoard):
    				self.SetPosition(targetBoard.GetLeft() + (targetBoard.GetWidth() - self.GetWidth()) / 2, targetBoard.GetBottom() - 17)
    
    			def Open(self, targetBoard, race):
    				self.__LoadInformation(race)
    
    				self.SetSize(self.BOARD_WIDTH, self.yPos + 10)
    				self.__UpdatePosition(targetBoard)
    
    				self.Show()
    
    			def Refresh(self):
    				self.__LoadInformation(self.race)
    				self.SetSize(self.BOARD_WIDTH, self.yPos + 10)
    
    			def Close(self):
    				self.itemTooltip.HideToolTip()
    				self.itemScrollBar = None
    				self.Hide()
    
    			def __LoadInformation(self, race):
    				self.yPos = 7
    				self.children = []
    				self.race = race
    				self.stoneImg = None
    				self.stoneVnum = None
    				self.nextStoneIconChange = 0
    				self.itemScrollBar = None
    
    				self.__LoadInformation_Default(race)
    				self.__LoadInformation_Race(race)
    				self.__LoadInformation_Resists(race)
    				self.__LoadInformation_Drops(race)
    
    			def __LoadInformation_Default_GetHitRate(self, race):
    				attacker_dx = nonplayer.GetMonsterDX(race)
    				attacker_level = nonplayer.GetMonsterLevel(race)
    
    				self_dx = player.GetStatus(player.DX)
    				self_level = player.GetStatus(player.LEVEL)
    
    				iARSrc = min(90, (attacker_dx * 4 + attacker_level * 2) / 6)
    				iERSrc = min(90, (self_dx * 4 + self_level * 2) / 6)
    
    				fAR = (float(iARSrc) + 210.0) / 300.0
    				fER = (float(iERSrc) * 2 + 5) / (float(iERSrc) + 95) * 3.0 / 10.0
    
    				return fAR - fER
    				
    			def __LoadInformation_Resists(self, race):
    				self.AppendSeperator()
    				self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS)
    				self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE0 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_SWORD), nonplayer.GetResist(race, nonplayer.MOB_RESIST_TWOHAND), nonplayer.GetResist(race, nonplayer.MOB_RESIST_BELL)))
    				self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE1 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_DAGGER), nonplayer.GetResist(race, nonplayer.MOB_RESIST_FAN), nonplayer.GetResist(race, nonplayer.MOB_RESIST_BOW)))
    				self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE2 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_MAGIC)))
    
    			def __LoadInformation_Default(self, race):
    				self.AppendSeperator()
    				self.AppendTextLine(localeInfo.TARGET_INFO_MAX_HP % localeInfo.DottedNumber(nonplayer.GetMonsterMaxHP(race)))
    
    				# calc att damage
    				monsterLevel = nonplayer.GetMonsterLevel(race)
    				fHitRate = self.__LoadInformation_Default_GetHitRate(race)
    				iDamMin, iDamMax = nonplayer.GetMonsterDamage(race)
    				iDamMin = int((iDamMin + nonplayer.GetMonsterST(race)) * 2 * fHitRate) + monsterLevel * 2
    				iDamMax = int((iDamMax + nonplayer.GetMonsterST(race)) * 2 * fHitRate) + monsterLevel * 2
    				iDef = player.GetStatus(player.DEF_GRADE) * (100 + player.GetStatus(player.DEF_BONUS)) / 100
    				fDamMulti = nonplayer.GetMonsterDamageMultiply(race)
    				iDamMin = int(max(0, iDamMin - iDef) * fDamMulti)
    				iDamMax = int(max(0, iDamMax - iDef) * fDamMulti)
    				if iDamMin < 1:
    					iDamMin = 1
    				if iDamMax < 5:
    					iDamMax = 5
    				self.AppendTextLine(localeInfo.TARGET_INFO_DAMAGE % (str(iDamMin), str(iDamMax)))
    
    				idx = min(len(self.EXP_BASE_LVDELTA) - 1, max(0, (monsterLevel + 15) - player.GetStatus(player.LEVEL)))
    				iExp = nonplayer.GetMonsterExp(race) * self.EXP_BASE_LVDELTA[idx] / 100
    				self.AppendTextLine(localeInfo.TARGET_INFO_EXP % localeInfo.DottedNumber(iExp))
    				
    				self.AppendTextLine(localeInfo.TARGET_INFO_GOLD_MIN_MAX % (localeInfo.DottedNumber(nonplayer.GetMobGoldMin(race)), localeInfo.DottedNumber(nonplayer.GetMobGoldMax(race))))
    				self.AppendTextLine(localeInfo.TARGET_INFO_REGEN_INFO % (nonplayer.GetMobRegenPercent(race), nonplayer.GetMobRegenCycle(race)))
    
    			def __LoadInformation_Race(self, race):
    				dwRaceFlag = nonplayer.GetMonsterRaceFlag(race)
    				self.AppendSeperator()
    
    				mainrace = ""
    				subrace = ""
    				for i in xrange(17):
    					curFlag = 1 << i
    					if HAS_FLAG(dwRaceFlag, curFlag):
    						if self.RACE_FLAG_TO_NAME.has_key(curFlag):
    							mainrace += self.RACE_FLAG_TO_NAME[curFlag] + ", "
    						elif self.SUB_RACE_FLAG_TO_NAME.has_key(curFlag):
    							subrace += self.SUB_RACE_FLAG_TO_NAME[curFlag] + ", "
    				if nonplayer.IsMonsterStone(race):
    					mainrace += localeInfo.TARGET_INFO_RACE_METIN + ", "
    				if mainrace == "":
    					mainrace = localeInfo.TARGET_INFO_NO_RACE
    				else:
    					mainrace = mainrace[:-2]
    				if subrace == "":
    					subrace = localeInfo.TARGET_INFO_NO_RACE
    				else:
    					subrace = subrace[:-2]
    
    				self.AppendTextLine(localeInfo.TARGET_INFO_MAINRACE % mainrace)
    				self.AppendTextLine(localeInfo.TARGET_INFO_SUBRACE % subrace)
    
    			def __LoadInformation_Drops(self, race):
    				self.AppendSeperator()
    
    
    				if race in MONSTER_INFO_DATA:
    					if len(MONSTER_INFO_DATA[race]["items"]) == 0:
    						if self.itemScrollBar.IsShow():
    							self.AppendTextLine(localeInfo.TARGET_INFO_NO_DEBUG)
    						else:	
    							self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT)
    					else:
    						itemListBox = ui.ListBoxExNew(32 + 5, self.MAX_ITEM_COUNT)
    						itemListBox.SetSize(self.GetWidth() - 15 * 2 - ui.ScrollBar.SCROLLBAR_WIDTH, (32 + 5) * self.MAX_ITEM_COUNT)
    						height = 0
    						for curItem in MONSTER_INFO_DATA[race]["items"]:
    							if curItem.has_key("vnum_list"):
    								height += self.AppendItem(itemListBox, curItem["vnum_list"], curItem["count"], curItem["rarity"])
    							else:
    								height += self.AppendItem(itemListBox, curItem["vnum"], curItem["count"], curItem["rarity"])						
    						
    						if height < itemListBox.GetHeight():
    							itemListBox.SetSize(itemListBox.GetWidth(), height)
    						self.AppendWindow(itemListBox, 15)
    						itemListBox.SetBasePos(0)
    
    						if len(MONSTER_INFO_DATA[race]["items"]) > itemListBox.GetViewItemCount():
    							itemScrollBar = ui.ScrollBar()
    							itemScrollBar.SetParent(self)
    							itemScrollBar.SetPosition(itemListBox.GetRight(), itemListBox.GetTop())
    							itemScrollBar.SetScrollBarSize(32 * self.MAX_ITEM_COUNT + 5 * (self.MAX_ITEM_COUNT - 1))
    							itemScrollBar.SetMiddleBarSize(float(self.MAX_ITEM_COUNT) / float(height / (32 + 5)))
    							itemScrollBar.Show()
    							itemListBox.SetScrollBar(itemScrollBar)
    				else:
    					self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT)
    
    			def AppendTextLine(self, text):
    				textLine = ui.TextLine()
    				textLine.SetParent(self)
    				textLine.SetWindowHorizontalAlignCenter()
    				textLine.SetHorizontalAlignCenter()
    				textLine.SetText(text)
    				textLine.SetPosition(0, self.yPos)
    				textLine.Show()
    
    				self.children.append(textLine)
    				self.yPos += 17
    
    			def AppendSeperator(self):
    				img = ui.ImageBox()
    				img.LoadImage("d:/ymir work/ui/seperator.tga")
    				self.AppendWindow(img)
    				img.SetPosition(img.GetLeft(), img.GetTop() - 15)
    				self.yPos -= 15
    
    			#def AppendItem(self, listBox, vnums, count):
    			def AppendItem(self, listBox, vnums, count, rarity = 0):
    				if type(vnums) == int:
    					vnum = vnums
    				else:
    					vnum = vnums[0]
    
    				item.SelectItem(vnum)
    				itemName = item.GetItemName()
    				if type(vnums) != int and len(vnums) > 1:
    					vnums = sorted(vnums)
    					realName = itemName[:itemName.find("+")]
    					if item.GetItemType() == item.ITEM_TYPE_METIN:
    						realName = localeInfo.TARGET_INFO_STONE_NAME
    						itemName = realName + "+0 - +4"
    					else:
    						itemName = realName + "+" + str(vnums[0] % 10) + " - +" + str(vnums[len(vnums) - 1] % 10)
    					vnum = vnums[len(vnums) - 1]
    
    				myItem = self.ItemListBoxItem(listBox.GetWidth())
    				myItem.LoadImage(item.GetIconImageFileName())
    				if count <= 1:
    					myItem.SetText(itemName)
    				else:
    					myItem.SetText("%dx %s" % (count, itemName))
    					
    				if app.ENABLE_SEND_TARGET_INFO_EXTENDED:
    					myItem.SetRarity(rarity)					
    					
    				myItem.SAFE_SetOverInEvent(self.OnShowItemTooltip, vnum)
    				myItem.SAFE_SetOverOutEvent(self.OnHideItemTooltip)
    				listBox.AppendItem(myItem)
    
    				if item.GetItemType() == item.ITEM_TYPE_METIN:
    					self.stoneImg = myItem
    					self.stoneVnum = vnums
    					self.lastStoneVnum = self.STONE_LAST_VNUM + vnums[len(vnums) - 1] % 1000 / 100 * 100
    
    				return myItem.GetHeight()
    
    			def OnShowItemTooltip(self, vnum):
    				item.SelectItem(vnum)
    				if item.GetItemType() == item.ITEM_TYPE_METIN:
    					self.itemTooltip.isStone = True
    					self.itemTooltip.isBook = False
    					self.itemTooltip.isBook2 = False
    					self.itemTooltip.SetItemToolTip(self.lastStoneVnum)
    				else:
    					self.itemTooltip.isStone = False
    					self.itemTooltip.isBook = True
    					self.itemTooltip.isBook2 = True
    					self.itemTooltip.SetItemToolTip(vnum)
    
    			def OnHideItemTooltip(self):
    				self.itemTooltip.HideToolTip()
    
    			def AppendWindow(self, wnd, x = 0, width = 0, height = 0):
    				if width == 0:
    					width = wnd.GetWidth()
    				if height == 0:
    					height = wnd.GetHeight()
    
    				wnd.SetParent(self)
    				if x == 0:
    					wnd.SetPosition((self.GetWidth() - width) / 2, self.yPos)
    				else:
    					wnd.SetPosition(x, self.yPos)
    				wnd.Show()
    
    				self.children.append(wnd)
    				self.yPos += height + 5
    
    			def OnUpdate(self):
    				if self.stoneImg != None and self.stoneVnum != None and app.GetTime() >= self.nextStoneIconChange:
    					nextImg = self.lastStoneVnum + 1
    					if nextImg % 100 > self.STONE_LAST_VNUM % 100:
    						nextImg -= (self.STONE_LAST_VNUM - self.STONE_START_VNUM) + 1
    					self.lastStoneVnum = nextImg
    					self.nextStoneIconChange = app.GetTime() + 2.5
    
    					item.SelectItem(nextImg)
    					itemName = item.GetItemName()
    					realName = itemName[:itemName.find("+")]
    					realName = realName + "+0 - +4"
    					self.stoneImg.LoadImage(item.GetIconImageFileName(), realName)
    
    					if self.itemTooltip.IsShow() and self.itemTooltip.isStone:
    						self.itemTooltip.SetItemToolTip(nextImg)

     

  3. tables.h
     

    Quote

    typedef struct SRefineTable
    {
        //DWORD src_vnum;
        //DWORD result_vnum;
        DWORD id;
        BYTE material_count;
    #ifdef ENABLE_LONG_LONG_GOLD
        long long cost;
    #else    
        int cost;
    #endif
        int prob;
        TRefineMaterial materials[REFINE_MATERIAL_MAX_NUM];
    } TRefineTable;

    server/packet.h

    Quote

    typedef struct SPacketGCRefineInformaion
    {
        BYTE    header;
        BYTE    type;
        WORD    pos;
        DWORD    src_vnum;
        DWORD    result_vnum;
        BYTE    material_count;
    #ifdef ENABLE_LONG_LONG_GOLD
        long long    cost;
    #else    
        int        cost;
    #endif
        int        prob;
        TRefineMaterial materials[REFINE_MATERIAL_MAX_NUM];
    } TPacketGCRefineInformation;

    char_item.cpp
     

    Quote

        // REFINE_COST
    #ifdef ENABLE_LONG_LONG_GOLD
        long long cost = ComputeRefineFee(prt->cost);
    #else    
        int cost = ComputeRefineFee(prt->cost);
    #endif

        int RefineChance = GetQuestFlag("main_quest_lv7.refine_chance");

        if (RefineChance > 0)
        {
            if (!item->CheckItemUseLevel(20) || item->GetType() != ITEM_WEAPON)
            {
                ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ą«·á °ł·® ±âȸ´Â 20 ŔĚÇĎŔÇ ą«±â¸¸ °ˇ´ÉÇŐ´Ď´Ů"));
                return false;
            }

            cost = 0;
            SetQuestFlag("main_quest_lv7.refine_chance", RefineChance - 1);
        }
        // END_OF_REFINE_COST

    Client/Packet.h

    Quote

    typedef struct SRefineTable
    {
        DWORD src_vnum;
        DWORD result_vnum;
        BYTE material_count;
    #ifdef ENABLE_LONG_LONG_GOLD
        long long cost;
    #else
        int cost;
    #endif
        int prob;
        TMaterial materials[REFINE_MATERIAL_MAX_NUM];
    } TRefineTable;

    PythonNetworkStreamPhaseGame.cpp

    Quote

    bool CPythonNetworkStream::RecvRefineInformationPacket()
    {
        TPacketGCRefineInformation kRefineInfoPacket;
        if (!Recv(sizeof(kRefineInfoPacket), &kRefineInfoPacket))
            return false;

        TRefineTable & rkRefineTable = kRefineInfoPacket.refine_table;
        PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],
            "OpenRefineDialog",
            Py_BuildValue("(iiii)",
                kRefineInfoPacket.pos,
                kRefineInfoPacket.refine_table.result_vnum,
                rkRefineTable.cost,
                rkRefineTable.prob));

        for (int i = 0; i < rkRefineTable.material_count; ++i)
        {
            PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "AppendMaterialToRefineDialog", Py_BuildValue("(ii)", rkRefineTable.materials[i].vnum, rkRefineTable.materials[i].count));
        }

    #ifdef _DEBUG
        Tracef(" >> RecvRefineInformationPacket(pos=%d, result_vnum=%d, cost=%d, prob=%d)\n",
                                                            kRefineInfoPacket.pos,
                                                            kRefineInfoPacket.refine_table.result_vnum,
                                                            rkRefineTable.cost,
                                                            rkRefineTable.prob);
    #endif

        return true;
    }

    bool CPythonNetworkStream::RecvRefineInformationPacketNew()
    {
        TPacketGCRefineInformationNew kRefineInfoPacket;
        if (!Recv(sizeof(kRefineInfoPacket), &kRefineInfoPacket))
            return false;

        TRefineTable & rkRefineTable = kRefineInfoPacket.refine_table;
        PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],
            "OpenRefineDialog",
            Py_BuildValue("(iiiii)",
                kRefineInfoPacket.pos,
                kRefineInfoPacket.refine_table.result_vnum,
                rkRefineTable.cost,
                rkRefineTable.prob,
                kRefineInfoPacket.type)
            );

        for (int i = 0; i < rkRefineTable.material_count; ++i)
        {
            PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "AppendMaterialToRefineDialog", Py_BuildValue("(ii)", rkRefineTable.materials[i].vnum, rkRefineTable.materials[i].count));
        }

    #ifdef _DEBUG
        Tracef(" >> RecvRefineInformationPacketNew(pos=%d, result_vnum=%d, cost=%d, prob=%d, type=%d)\n",
                                                            kRefineInfoPacket.pos,
                                                            kRefineInfoPacket.refine_table.result_vnum,
                                                            rkRefineTable.cost,
                                                            rkRefineTable.prob,
                                                            kRefineInfoPacket.type);
    #endif

        return true;
    }

    I suspect PythonNetworkPhaseGame, I haven't found much code related to refine elsewhere.
    Where there is sysser, I have also rewritten them, of course.

  4. It seems better, I have logged out about 30 times, but it still closes the client.

    0729 12:29:22691 :: Phase Game does not handle this header (header: 4, last: 121, 4)
    0729 12:29:22739 :: CPythonNetworkStream::RecvFlyTargetingPacket() - dwShooterVID[1818386798] NOT EXIST
    0729 12:29:22739 :: Unknown packet header: 12, last: 4 69

  5. Hello! I came across an interesting bug. I uploaded stuff from my home server to a newly purchased VPS, game, db started, runs fine.

    However, when I would enter the game, as soon as the character would appear, the client would close (Tested several times). I have collected the following packet errors.

     

    0728 14:14:16188 :: Phase Loading does not handle this header (header: 115, last: 1, 115)
    0728 14:14:16189 :: Unknown packet header: 64, last: 1 115
    
    0728 14:16:14861 :: Phase Loading does not handle this header (header: 115, last: 1, 115)
    0728 14:16:14862 :: Unknown packet header: 101, last: 1 115
    
    0728 14:37:28114 :: Phase Game does not handle this header (header: 130, last: 75, 130)
    0728 14:37:28147 :: Unknown packet header: 217, last: 75 130


    When the client closes, it almost always complains about another packet error. (There is absolutely no such problem on a hosted server.)

    Thanks for the help in advance!

    What might also be of interest is that the game, db clang++-devel version is compiled backwards.

  6. Hello! I have a problem, I have an updated source (clang++-devel), which works perfectly on bsd 12, on a home server.

    I put it on vps, game,db, but it is missing libs on startup, which I can't do in any way. I've installed gcc, devel, etc. with pkg install.

    Anyone who can help me with this would be appreciated.

×
×
  • 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.