Jump to content

Sash showing wrong bonus after absorbtion


Recommended Posts

Hello metin2dev,

I have the following problem with the sash system on my server: Although the sash is showing the right absorption bonus in the absorb window, after the absorption it shows a 100% bonus.

It's just a visual bug, the sash is absorbing the correct value but I have no idea where's the problem and how to fix it. Can someone give me some guidelines?

 

TGXhq9r.pngEbg2VA9.png

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

This is the part of uitooltip.py that deals with the sashes. full uitooltip here: https://pastebin.com/HDDbwTaG

if app.ENABLE_SASH_SYSTEM:
        def SetSashResultItem(self, slotIndex, window_type = player.INVENTORY):
            (itemVnum, MinAbs, MaxAbs) = sash.GetResultItem()
            if not itemVnum:
                return
           
            self.ClearToolTip()
           
            metinSlot = [player.GetItemMetinSocket(window_type, slotIndex, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
            attrSlot = [player.GetItemAttribute(window_type, slotIndex, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]
           
            item.SelectItem(itemVnum)
            itemType = item.GetItemType()
            itemSubType = item.GetItemSubType()
            if itemType != item.ITEM_TYPE_COSTUME and itemSubType != item.COSTUME_TYPE_SASH:
                return
           
            absChance = MaxAbs
            itemDesc = item.GetItemDescription()
            self.__AdjustMaxWidth(attrSlot, itemDesc)
            self.__SetItemTitle(itemVnum, metinSlot, attrSlot)
            self.AppendDescription(itemDesc, 26)
            self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
            self.__AppendLimitInformation()
           
            ## ABSORPTION RATE
            if MinAbs == MaxAbs:
                self.AppendTextLine(localeInfo.SASH_ABSORB_CHANCE % (MinAbs), self.CONDITION_COLOR)
            else:
                self.AppendTextLine(localeInfo.SASH_ABSORB_CHANCE2 % (MinAbs, MaxAbs), self.CONDITION_COLOR)
            ## END ABSOPRTION RATE
           
            itemAbsorbedVnum = int(metinSlot[sash.ABSORBED_SOCKET])
            if itemAbsorbedVnum:
                ## ATTACK / DEFENCE
                item.SelectItem(itemAbsorbedVnum)
                if item.GetItemType() == item.ITEM_TYPE_WEAPON:
                    if item.GetItemSubType() == item.WEAPON_FAN:
                        self.__AppendMagicAttackInfo(absChance)
                        item.SelectItem(itemAbsorbedVnum)
                        self.__AppendAttackPowerInfo(absChance)
                    else:
                        self.__AppendAttackPowerInfo(absChance)
                        item.SelectItem(itemAbsorbedVnum)
                        self.__AppendMagicAttackInfo(absChance)
                elif item.GetItemType() == item.ITEM_TYPE_ARMOR:
                    defGrade = item.GetValue(1)
                    defBonus = item.GetValue(5) * 2
                    defGrade = self.CalcSashValue(defGrade, absChance)
                    defBonus = self.CalcSashValue(defBonus, absChance)
                   
                    if defGrade > 0:
                        self.AppendSpace(5)
                        self.AppendTextLine(localeInfo.TOOLTIP_ITEM_DEF_GRADE % (defGrade + defBonus), self.GetChangeTextLineColor(defGrade))
                   
                    item.SelectItem(itemAbsorbedVnum)
                    self.__AppendMagicDefenceInfo(absChance)
                ## END ATTACK / DEFENCE
               
                ## EFFECT
                item.SelectItem(itemAbsorbedVnum)
                for i in xrange(item.ITEM_APPLY_MAX_NUM):
                    (affectType, affectValue) = item.GetAffect(i)
                    affectValue = self.CalcSashValue(affectValue, absChance)
                    affectString = self.__GetAffectString(affectType, affectValue)
                    if affectString and affectValue > 0:
                        self.AppendTextLine(affectString, self.GetChangeTextLineColor(affectValue))
                   
                    item.SelectItem(itemAbsorbedVnum)
                # END EFFECT
               
            item.SelectItem(itemVnum)
            ## ATTR
            self.__AppendAttributeInformation(attrSlot, MaxAbs)
            # END ATTR
           
            self.AppendWearableInformation()
            self.ShowToolTip()
 
        def SetSashResultAbsItem(self, slotIndex1, slotIndex2, window_type = player.INVENTORY):
            itemVnumSash = player.GetItemIndex(window_type, slotIndex1)
            itemVnumTarget = player.GetItemIndex(window_type, slotIndex2)
            if not itemVnumSash or not itemVnumTarget:
                return
           
            self.ClearToolTip()
           
            item.SelectItem(itemVnumSash)
            itemType = item.GetItemType()
            itemSubType = item.GetItemSubType()
            if itemType != item.ITEM_TYPE_COSTUME and itemSubType != item.COSTUME_TYPE_SASH:
                return
           
            metinSlot = [player.GetItemMetinSocket(window_type, slotIndex1, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
            attrSlot = [player.GetItemAttribute(window_type, slotIndex2, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]
           
            itemDesc = item.GetItemDescription()
            self.__AdjustMaxWidth(attrSlot, itemDesc)
            self.__SetItemTitle(itemVnumSash, metinSlot, attrSlot)
            self.AppendDescription(itemDesc, 26)
            self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
            item.SelectItem(itemVnumSash)
            self.__AppendLimitInformation()
           
            ## ABSORPTION RATE
            self.AppendTextLine(localeInfo.SASH_ABSORB_CHANCE % (metinSlot[sash.ABSORPTION_SOCKET]), self.CONDITION_COLOR)
            ## END ABSOPRTION RATE
           
            ## ATTACK / DEFENCE
            itemAbsorbedVnum = itemVnumTarget
            item.SelectItem(itemAbsorbedVnum)
            if item.GetItemType() == item.ITEM_TYPE_WEAPON:
                if item.GetItemSubType() == item.WEAPON_FAN:
                    self.__AppendMagicAttackInfo(metinSlot[sash.ABSORPTION_SOCKET])
                    item.SelectItem(itemAbsorbedVnum)
                    self.__AppendAttackPowerInfo(metinSlot[sash.ABSORPTION_SOCKET])
                else:
                    self.__AppendAttackPowerInfo(metinSlot[sash.ABSORPTION_SOCKET])
                    item.SelectItem(itemAbsorbedVnum)
                    self.__AppendMagicAttackInfo(metinSlot[sash.ABSORPTION_SOCKET])
            elif item.GetItemType() == item.ITEM_TYPE_ARMOR:
                defGrade = item.GetValue(1)
                defBonus = item.GetValue(5) * 2
                defGrade = self.CalcSashValue(defGrade, metinSlot[sash.ABSORPTION_SOCKET])
                defBonus = self.CalcSashValue(defBonus, metinSlot[sash.ABSORPTION_SOCKET])
               
                if defGrade > 0:
                    self.AppendSpace(5)
                    self.AppendTextLine(localeInfo.TOOLTIP_ITEM_DEF_GRADE % (defGrade + defBonus), self.GetChangeTextLineColor(defGrade))
               
                item.SelectItem(itemAbsorbedVnum)
                self.__AppendMagicDefenceInfo(metinSlot[sash.ABSORPTION_SOCKET])
            ## END ATTACK / DEFENCE
           
            ## EFFECT
            item.SelectItem(itemAbsorbedVnum)
            for i in xrange(item.ITEM_APPLY_MAX_NUM):
                (affectType, affectValue) = item.GetAffect(i)
                affectValue = self.CalcSashValue(affectValue, metinSlot[sash.ABSORPTION_SOCKET])
                affectString = self.__GetAffectString(affectType, affectValue)
                if affectString and affectValue > 0:
                    self.AppendTextLine(affectString, self.GetChangeTextLineColor(affectValue))
               
                item.SelectItem(itemAbsorbedVnum)
            ## END EFFECT
           
            ## ATTR
            item.SelectItem(itemAbsorbedVnum)
            for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
                type = attrSlot[i][0]
                value = attrSlot[i][1]
                if not value:
                    continue
               
                value = self.CalcSashValue(value, metinSlot[sash.ABSORPTION_SOCKET])
                affectString = self.__GetAffectString(type, value)
                if affectString and value > 0:
                    affectColor = self.__GetAttributeColor(i, value)
                    self.AppendTextLine(affectString, affectColor)
               
                item.SelectItem(itemAbsorbedVnum)
            ## END ATTR
           
            ## WEARABLE
            item.SelectItem(itemVnumSash)
            self.AppendSpace(5)
            self.AppendTextLine(localeInfo.TOOLTIP_ITEM_WEARABLE_JOB, self.NORMAL_COLOR)
           
            item.SelectItem(itemVnumSash)
            flagList = (
                        not item.IsAntiFlag(item.ITEM_ANTIFLAG_WARRIOR),
                        not item.IsAntiFlag(item.ITEM_ANTIFLAG_ASSASSIN),
                        not item.IsAntiFlag(item.ITEM_ANTIFLAG_SURA),
                        not item.IsAntiFlag(item.ITEM_ANTIFLAG_SHAMAN)
            )
           
            characterNames = ""
            for i in xrange(self.CHARACTER_COUNT):
                name = self.CHARACTER_NAMES[i]
                flag = flagList[i]
                if flag:
                    characterNames += " "
                    characterNames += name
           
            textLine = self.AppendTextLine(characterNames, self.NORMAL_COLOR, True)
            textLine.SetFeather()
           
            item.SelectItem(itemVnumSash)
            if item.IsAntiFlag(item.ITEM_ANTIFLAG_MALE):
                textLine = self.AppendTextLine(localeInfo.FOR_FEMALE, self.NORMAL_COLOR, True)
                textLine.SetFeather()
           
            if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE):
                textLine = self.AppendTextLine(localeInfo.FOR_MALE, self.NORMAL_COLOR, True)
                textLine.SetFeather()
            ## END WEARABLE
           
            self.ShowToolTip()

 

Link to comment
Share on other sites

  • Developer
			## ABSORPTION RATE
            self.AppendTextLine(localeInfo.SASH_ABSORB_CHANCE % (metinSlot[sash.ABSORPTION_SOCKET]), self.CONDITION_COLOR)
            ## END ABSOPRTION RATE
			
			
			#REPLACE WITH:
			
			
			## ABSORPTION RATE
			if itemVnumSash == MY_VNUM_SASH_WITH_100PERC_ABSORD:
				self.AppendTextLine(localeInfo.SASH_ABSORB_CHANCE % (100), self.CONDITION_COLOR)
			else:
				self.AppendTextLine(localeInfo.SASH_ABSORB_CHANCE % (metinSlot[sash.ABSORPTION_SOCKET]), self.CONDITION_COLOR)
            ## END ABSOPRTION RATE

 

 

pastebin version : https://pastebin.com/dw2nSzJa

  • Love 1

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


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