I think it is tiring to put all the weapon and armor codes.
I modified the code to make it easier to get the weapon or armor level.
in ui.py
Find: def SetItemSlot(self, renderingSlotNumber, ItemIndex, ItemCount = 0, diffuseColor = (1.0, 1.0, 1.0, 1.0)):
replace with:
def SetItemSlot(self, renderingSlotNumber, ItemIndex, ItemCount = 0, diffuseColor = (1.0, 1.0, 1.0, 1.0)):
if 0 == ItemIndex or None == ItemIndex:
wndMgr.ClearSlot(self.hWnd, renderingSlotNumber)
return
item.SelectItem(ItemIndex)
itemIcon = item.GetIconImage()
item.SelectItem(ItemIndex)
(width, height) = item.GetItemSize()
wndMgr.SetSlot(self.hWnd, renderingSlotNumber, ItemIndex, width, height, itemIcon, diffuseColor)
wndMgr.SetSlotCount(self.hWnd, renderingSlotNumber, ItemCount)
if app.ENABLE_LEGENDARY_SLOT_EFFECT:
if ItemIndex > 0:
wndMgr.ActivateLegendaryEffect(self.hWnd, renderingSlotNumber, *legendaryitems.GetEffectColor(ItemIndex))
else:
wndMgr.DeactivateLegendaryEffect(self.hWnd, renderingSlotNumber)
in legendaryitems.py
replace all with:
import item
EFFECTS = {
"WEAPON": {
30: (0.3, 0.3, 0.3, 0.4), # Common
65: (0.0, 1.0, 0.0, 0.7), # Uncommon
75: (0.0, 0.5, 1.0, 0.7), # Rare
90: (1.0, 0.0, 1.0, 0.7), # Epic
105: (1.0, 0.8, 0.0, 0.8), # Legendary
},
"ARMOR": { # Armor
30: (1.0, 1.0, 1.0, 0.4), # Common
}
}
def GetEffectColor(ItemIndex):
# select the item based on the ItemIndex
item.SelectItem(ItemIndex)
itemType = item.GetItemType() # return itemType of the item
# select the effect_type based on the itemType
if itemType == item.ITEM_TYPE_WEAPON:
effect_type = "WEAPON"
elif itemType == item.ITEM_TYPE_ARMOR:
effect_type = "ARMOR"
else:
return (0.0, 0.0, 0.0, 0.0) # default color
# search for the limitValue in the EFFECTS dictionary
for i in range(item.LIMIT_MAX_NUM):
limitValue = item.GetLimit(i)[1] # return limitValue of the item
# if limitValue is in the EFFECTS dictionary, return the color
if limitValue in EFFECTS[effect_type]:
return EFFECTS[effect_type][limitValue]
# default color
return (0.0, 0.0, 0.0, 0.0)