- OTClient version
- Kondra's v8
I’ve got this Rarity module, and since it didn’t match the original expectations, I thought I’d share it with everyone.
Rarity module info:
Here is a simple guide on how to add it to your server:
In client/mods place game_itemrarity and game_itemupgrade
In server/data/scripts place rarity.lua
In client\modules\corelib\ui\uiitemtooltip.lua below
In client\modules\gamelib\ui\uiitem.lua add this function at the end:
In client\modules\game_containers\containers.lua
replace this function
with this one:
In client\modules\game_interface\interface.otmod add this:
You can then use rarity anywhere by checking whether an item has a rarity level from 1 to 5, where 1 = Common and 5 = Legendary, and easily add extra loot, experience, damage, or anything else through Lua scripts.
Note: Keep in mind this module may still have some bugs and issues, but it’s good to go.
Scan Results (VirusTotal)
Rarity module info:
- Sacrifice items to get defusion points
- Turn items into points and use them to upgrade their rarity level
- 5 different rarity levels, from Common to Legendary, each with its own frame
- Custom rarity function that can be used to boost stats, give extra experience, improve loot, etc.
Here is a simple guide on how to add it to your server:
In client/mods place game_itemrarity and game_itemupgrade
In server/data/scripts place rarity.lua
In client\modules\corelib\ui\uiitemtooltip.lua below
tooltip:setFocusable(false) add these:
LUA:
tooltip.itemLevel = 0
tooltip.uLevel = 0
tooltip.rarityId = 0
In client\modules\gamelib\ui\uiitem.lua add this function at the end:
LUA:
function UIItem:onItemChange()
local tooltip = nil
if self:getItem() and self:getItem():getTooltip():len() > 0 then
tooltip = self:getItem():getTooltip()
end
self.colorFrame = self.colorFrame and self.colorFrame or g_ui.createWidget("ItemColorFrame", self)
if self:getItem() then
if not modules.game_itemrarity then
return
end
if self:getId() == "itemSprite" then
return
end
local img, color = modules.game_itemrarity.getImageRarity(self:getItem())
if img ~= "" then
self.colorFrame:setImageSource(img)
self.colorFrame:setImageColor(color)
self.colorFrame:setVisible(true)
else
self.colorFrame:setVisible(false)
end
else
if self.colorFrame then
self.colorFrame:setVisible(false)
end
end
self:setTooltip(tooltip)
end
In client\modules\game_containers\containers.lua
replace this function
refreshContainerItems(container)with this one:
LUA:
function refreshContainerItems(container)
for slot = 0, container:getCapacity() - 1 do
local itemWidget = container.itemsPanel:getChildById("item" .. slot)
itemWidget.colorFrame = itemWidget.colorFrame and itemWidget.colorFrame or g_ui.createWidget("ItemColorFrame", itemWidget)
itemWidget.colorFrame:setVisible(false)
itemWidget.colorFrame:setImageSource("")
local item = container:getItem(slot)
if item ~= nil then
local img, color = modules.game_itemrarity.getImageRarity(container:getItem(slot))
if img ~= "" then
itemWidget.colorFrame:setImageSource(img)
itemWidget.colorFrame:setImageColor(color)
itemWidget.colorFrame:setVisible(true)
else
itemWidget.colorFrame:setVisible(false)
end
else
itemWidget:setTooltip("")
end
itemWidget:setItem(container:getItem(slot))
local categoryIdWidget = itemWidget:getChildById("lootCategoryId")
categoryIdWidget:hide()
if item then
local iconId = getIconId(item:getLootCategory())
if iconId ~= LOOT_CATEGORY_NONE then
categoryIdWidget:show()
setIconImageType(categoryIdWidget, iconId)
end
end
end
if container:hasPages() then
refreshContainerPages(container)
end
end
In client\modules\game_interface\interface.otmod add this:
- game_itemrarityYou can then use rarity anywhere by checking whether an item has a rarity level from 1 to 5, where 1 = Common and 5 = Legendary, and easily add extra loot, experience, damage, or anything else through Lua scripts.
item:getCustomAttribute("rarity")item:getCustomAttribute("rarityPoints")Note: Keep in mind this module may still have some bugs and issues, but it’s good to go.
Scan Results (VirusTotal)