• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How can I add colors to the sqm of rare, epic, legendary items? OTclient

Jpstafe

Well-Known Member
Joined
Aug 8, 2011
Messages
561
Reaction score
76
Hello, good evening, I have added a basic randomstats system, which can give you rare, epic, legendary items... the script is basic and it works well, the only thing I would like is for it to differentiate in the sqms of the otclient panel? How can I make that work, that the rare is purple, that the epic is blue and the legendary yellow... I am using tfs 1.2 and otclient v8.

rareeeees.png
 
put the images of the boxesn in your otclient in the folder /data/images/ui ui.rar

11-03-2023_221637.jpg
put this function, before onContainerOpen
\modules\game_containers\containers.lua
LUA:
local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          local id = child:getItemId()
          local price = 0

          local name = child:getTooltip()
          child:setImageSource("/images/ui/item")
          if (name) then
            if (string.find(name, "legendary")) then
              child:setImageSource('/images/ui/rarity_gold')
            elseif (string.find(name, "epic")) then
              child:setImageSource('/images/ui/rarity_purple')
            elseif (string.find(name, "rare")) then
              child:setImageSource('/images/ui/rarity_blue')
            end
          end

      end
  end
end
image.png

the logic is simple, if the item name has the string "legendary", it will show rarity_gold boxif name contains "epic", it will show the rarity_purpleand for rare is rarity_blue and in the end of the file put this:
image.png
 

Attachments

put the images of the boxesn in your otclient in the folder /data/images/ui ui.rar

View attachment 80983
put this function, before onContainerOpen
\modules\game_containers\containers.lua
LUA:
local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          local id = child:getItemId()
          local price = 0

          local name = child:getTooltip()
          child:setImageSource("/images/ui/item")
          if (name) then
            if (string.find(name, "legendary")) then
              child:setImageSource('/images/ui/rarity_gold')
            elseif (string.find(name, "epic")) then
              child:setImageSource('/images/ui/rarity_purple')
            elseif (string.find(name, "rare")) then
              child:setImageSource('/images/ui/rarity_blue')
            end
          end

      end
  end
end
View attachment 80984

the logic is simple, if the item name has the string "legendary", it will show rarity_gold boxif name contains "epic", it will show the rarity_purpleand for rare is rarity_blue and in the end of the file put this:
View attachment 80985
Thank you for replying to the post, I did everything you put in the message, paste the images into the /data/images/ui ui.rar folder
Paste the code you put into modulesgame_containerscontainers.lua. And when the items come out, the SQMS doesn't work. What am I doing wrong?
There I pass you the containers.lua, see if I put the code right, if you can review it.
pabellon.png
 

Attachments

LUA:
local gameStart = 0

function init()
  connect(Container, { onOpen = onContainerOpen,
                       onClose = onContainerClose,
                       onSizeChange = onContainerChangeSize,
                       onUpdateItem = onContainerUpdateItem })
  connect(g_game, {
    onGameStart = markStart,
    onGameEnd = clean
  })

  reloadContainers()
end

function terminate()
  disconnect(Container, { onOpen = onContainerOpen,
                          onClose = onContainerClose,
                          onSizeChange = onContainerChangeSize,
                          onUpdateItem = onContainerUpdateItem })
  disconnect(g_game, {
    onGameStart = markStart,
    onGameEnd = clean
  })
end

function reloadContainers()
  clean()
  for _,container in pairs(g_game.getContainers()) do
    onContainerOpen(container)
  end
end

function clean()
  for containerid,container in pairs(g_game.getContainers()) do
    destroy(container)
  end
end

function markStart()
  gameStart = g_clock.millis()
end

function destroy(container)
  if container.window then
    container.window:destroy()
    container.window = nil
    container.itemsPanel = nil
  end
end

function refreshContainerItems(container)
  for slot=0,container:getCapacity()-1 do
    local itemWidget = container.itemsPanel:getChildById('item' .. slot)
    itemWidget:setItem(container:getItem(slot))
  end

  if container:hasPages() then
    refreshContainerPages(container)
  end
end

function toggleContainerPages(containerWindow, hasPages)
  if hasPages == containerWindow.pagePanel:isOn() then
    return
  end
  containerWindow.pagePanel:setOn(hasPages)
  if hasPages then
    containerWindow.miniwindowScrollBar:setMarginTop(containerWindow.miniwindowScrollBar:getMarginTop() + containerWindow.pagePanel:getHeight())
    containerWindow.contentsPanel:setMarginTop(containerWindow.contentsPanel:getMarginTop() + containerWindow.pagePanel:getHeight()) 
  else 
    containerWindow.miniwindowScrollBar:setMarginTop(containerWindow.miniwindowScrollBar:getMarginTop() - containerWindow.pagePanel:getHeight())
    containerWindow.contentsPanel:setMarginTop(containerWindow.contentsPanel:getMarginTop() - containerWindow.pagePanel:getHeight())
  end
end

function refreshContainerPages(container)
  local currentPage = 1 + math.floor(container:getFirstIndex() / container:getCapacity())
  local pages = 1 + math.floor(math.max(0, (container:getSize() - 1)) / container:getCapacity())
  container.window:recursiveGetChildById('pageLabel'):setText(string.format('Page %i of %i', currentPage, pages))

  local prevPageButton = container.window:recursiveGetChildById('prevPageButton')
  if currentPage == 1 then
    prevPageButton:setEnabled(false)
  else
    prevPageButton:setEnabled(true)
    prevPageButton.onClick = function() g_game.seekInContainer(container:getId(), container:getFirstIndex() - container:getCapacity()) end
  end

  local nextPageButton = container.window:recursiveGetChildById('nextPageButton')
  if currentPage >= pages then
    nextPageButton:setEnabled(false)
  else
    nextPageButton:setEnabled(true)
    nextPageButton.onClick = function() g_game.seekInContainer(container:getId(), container:getFirstIndex() + container:getCapacity()) end
  end
 
  local pagePanel = container.window:recursiveGetChildById('pagePanel')
  if pagePanel then
    pagePanel.onMouseWheel = function(widget, mousePos, mouseWheel)
      if pages == 1 then return end
      if mouseWheel == MouseWheelUp then
        return prevPageButton.onClick()
      else
        return nextPageButton.onClick()
      end
    end
  end
end

local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          local id = child:getItemId()
          local price = 0

          local name = child:getTooltip()
          child:setImageSource("/images/ui/item")
          if (name) then
            if (string.find(name, "legendary")) then
              child:setImageSource('/images/ui/rarity_gold')
            elseif (string.find(name, "epic")) then
              child:setImageSource('/images/ui/rarity_purple')
            elseif (string.find(name, "rare")) then
              child:setImageSource('/images/ui/rarity_blue')
            end
          end

      end
  end
end
function onContainerOpen(container, previousContainer)
  local containerWindow
  if previousContainer then
    containerWindow = previousContainer.window
    previousContainer.window = nil
    previousContainer.itemsPanel = nil
  else
    containerWindow = g_ui.createWidget('ContainerWindow', modules.game_interface.getContainerPanel())

    -- white border flash effect
    containerWindow:setBorderWidth(2)
    containerWindow:setBorderColor("#FFFFFF")
    scheduleEvent(function()
      if containerWindow then
        containerWindow:setBorderWidth(0)
      end
    end, 300)
  end
 
  containerWindow:setId('container' .. container:getId())
  if gameStart + 1000 < g_clock.millis() then
    containerWindow:clearSettings()
  end
 
  local containerPanel = containerWindow:getChildById('contentsPanel')
  local containerItemWidget = containerWindow:getChildById('containerItemWidget')
  containerWindow.onClose = function()
    g_game.close(container)
    containerWindow:hide()
  end
  containerWindow.onDrop = function(container, widget, mousePos)
    if containerPanel:getChildByPos(mousePos) then
      return false
    end
    local child = containerPanel:getChildByIndex(-1)
    if child then
      child:onDrop(widget, mousePos, true)       
    end
  end
 
  containerWindow.onMouseRelease = function(widget, mousePos, mouseButton)
    if mouseButton == MouseButton4 then
      if container:hasParent() then
        return g_game.openParent(container)
      end
    elseif mouseButton == MouseButton5 then
      for i, item in ipairs(container:getItems()) do
        if item:isContainer() then
          return g_game.open(item, container)
        end
      end
    end
  end

  -- this disables scrollbar auto hiding
  local scrollbar = containerWindow:getChildById('miniwindowScrollBar')
  scrollbar:mergeStyle({ ['$!on'] = { }})

  local upButton = containerWindow:getChildById('upButton')
  upButton.onClick = function()
    g_game.openParent(container)
  end
  upButton:setVisible(container:hasParent())

  local name = container:getName()
  name = name:sub(1,1):upper() .. name:sub(2)
  containerWindow:setText(name)

  containerItemWidget:setItem(container:getContainerItem())

  containerPanel:destroyChildren()
  for slot=0,container:getCapacity()-1 do
    local itemWidget = g_ui.createWidget('Item', containerPanel)
    itemWidget:setId('item' .. slot)
    itemWidget:setItem(container:getItem(slot))
    itemWidget:setMargin(0)
    itemWidget.position = container:getSlotPosition(slot)

    if not container:isUnlocked() then
      itemWidget:setBorderColor('red')
    end
  end

  container.window = containerWindow
  container.itemsPanel = containerPanel

  toggleContainerPages(containerWindow, container:hasPages())
  refreshContainerPages(container)

  local layout = containerPanel:getLayout()
  local cellSize = layout:getCellSize()
  containerWindow:setContentMinimumHeight(cellSize.height)
  containerWindow:setContentMaximumHeight(cellSize.height*layout:getNumLines())

  if container:hasPages() then
    local height = containerWindow.miniwindowScrollBar:getMarginTop() + containerWindow.pagePanel:getHeight()+17
    if containerWindow:getHeight() < height then
      containerWindow:setHeight(height)
    end
  end

  if not previousContainer then
    local filledLines = math.max(math.ceil(container:getItemsCount() / layout:getNumColumns()), 1)
    containerWindow:setContentHeight(filledLines*cellSize.height)
  end
  setFrames()
  containerWindow:setup()
end

function onContainerClose(container)
  destroy(container)
end

function onContainerChangeSize(container, size)
  if not container.window then return end
  refreshContainerItems(container)
  setFrames()
end

function onContainerUpdateItem(container, slot, item, oldItem)
  if not container.window then return end
  local itemWidget = container.itemsPanel:getChildById('item' .. slot)
  itemWidget:setItem(item)
  setFrames()
end
There I did it exactly as in the photo. And I saved it, restarted the otclient and it still doesn't show up. Do I have to do anything extra? Do I clear the data in %appdata%?
 
Try it like this

LUA:
local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          local id = child:getItemId()
          local price = 0

          local name = child:getTooltip()
          child:setImageSource("/images/ui/item")
          if (name) then
print("name: " .. name)
            if (string.find(name, "legendary")) then
              child:setImageSource('/images/ui/rarity_gold')
            elseif (string.find(name, "epic")) then
              child:setImageSource('/images/ui/rarity_purple')
            elseif (string.find(name, "rare")) then
              child:setImageSource('/images/ui/rarity_blue')
            end
          end

      end
  end
end
 
You inserted 2 the picture shows 3
If there are all three, copy the setframes where they are in the photo.
Post automatically merged:

LUA:
local gameStart = 0

function init()
  connect(Container, { onOpen = onContainerOpen,
                       onClose = onContainerClose,
                       onSizeChange = onContainerChangeSize,
                       onUpdateItem = onContainerUpdateItem })
  connect(g_game, {
    onGameStart = markStart,
    onGameEnd = clean
  })

  reloadContainers()
end

function terminate()
  disconnect(Container, { onOpen = onContainerOpen,
                          onClose = onContainerClose,
                          onSizeChange = onContainerChangeSize,
                          onUpdateItem = onContainerUpdateItem })
  disconnect(g_game, {
    onGameStart = markStart,
    onGameEnd = clean
  })
end

function reloadContainers()
  clean()
  for _,container in pairs(g_game.getContainers()) do
    onContainerOpen(container)
  end
end

function clean()
  for containerid,container in pairs(g_game.getContainers()) do
    destroy(container)
  end
end

function markStart()
  gameStart = g_clock.millis()
end

function destroy(container)
  if container.window then
    container.window:destroy()
    container.window = nil
    container.itemsPanel = nil
  end
end

function refreshContainerItems(container)
  for slot=0,container:getCapacity()-1 do
    local itemWidget = container.itemsPanel:getChildById('item' .. slot)
    itemWidget:setItem(container:getItem(slot))
  end

  if container:hasPages() then
    refreshContainerPages(container)
  end
end

function toggleContainerPages(containerWindow, hasPages)
  if hasPages == containerWindow.pagePanel:isOn() then
    return
  end
  containerWindow.pagePanel:setOn(hasPages)
  if hasPages then
    containerWindow.miniwindowScrollBar:setMarginTop(containerWindow.miniwindowScrollBar:getMarginTop() + containerWindow.pagePanel:getHeight())
    containerWindow.contentsPanel:setMarginTop(containerWindow.contentsPanel:getMarginTop() + containerWindow.pagePanel:getHeight()) 
  else 
    containerWindow.miniwindowScrollBar:setMarginTop(containerWindow.miniwindowScrollBar:getMarginTop() - containerWindow.pagePanel:getHeight())
    containerWindow.contentsPanel:setMarginTop(containerWindow.contentsPanel:getMarginTop() - containerWindow.pagePanel:getHeight())
  end
end

function refreshContainerPages(container)
  local currentPage = 1 + math.floor(container:getFirstIndex() / container:getCapacity())
  local pages = 1 + math.floor(math.max(0, (container:getSize() - 1)) / container:getCapacity())
  container.window:recursiveGetChildById('pageLabel'):setText(string.format('Page %i of %i', currentPage, pages))

  local prevPageButton = container.window:recursiveGetChildById('prevPageButton')
  if currentPage == 1 then
    prevPageButton:setEnabled(false)
  else
    prevPageButton:setEnabled(true)
    prevPageButton.onClick = function() g_game.seekInContainer(container:getId(), container:getFirstIndex() - container:getCapacity()) end
  end

  local nextPageButton = container.window:recursiveGetChildById('nextPageButton')
  if currentPage >= pages then
    nextPageButton:setEnabled(false)
  else
    nextPageButton:setEnabled(true)
    nextPageButton.onClick = function() g_game.seekInContainer(container:getId(), container:getFirstIndex() + container:getCapacity()) end
  end
 
  local pagePanel = container.window:recursiveGetChildById('pagePanel')
  if pagePanel then
    pagePanel.onMouseWheel = function(widget, mousePos, mouseWheel)
      if pages == 1 then return end
      if mouseWheel == MouseWheelUp then
        return prevPageButton.onClick()
      else
        return nextPageButton.onClick()
      end
    end
  end
end

local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          local id = child:getItemId()
          local price = 0

          local name = child:getTooltip()
          child:setImageSource("/images/ui/item")
          if (name) then
print("name: " .. name)
            if (string.find(name, "legendary")) then
              child:setImageSource('/images/ui/rarity_gold')
            elseif (string.find(name, "epic")) then
              child:setImageSource('/images/ui/rarity_purple')
            elseif (string.find(name, "rare")) then
              child:setImageSource('/images/ui/rarity_blue')
            end
          end

      end
  end
end

function onContainerOpen(container, previousContainer)
  local containerWindow
  if previousContainer then
    containerWindow = previousContainer.window
    previousContainer.window = nil
    previousContainer.itemsPanel = nil
  else
    containerWindow = g_ui.createWidget('ContainerWindow', modules.game_interface.getContainerPanel())

    -- white border flash effect
    containerWindow:setBorderWidth(2)
    containerWindow:setBorderColor("#FFFFFF")
    scheduleEvent(function()
      if containerWindow then
        containerWindow:setBorderWidth(0)
      end
    end, 300)
  end
 
  containerWindow:setId('container' .. container:getId())
  if gameStart + 1000 < g_clock.millis() then
    containerWindow:clearSettings()
  end
 
  local containerPanel = containerWindow:getChildById('contentsPanel')
  local containerItemWidget = containerWindow:getChildById('containerItemWidget')
  containerWindow.onClose = function()
    g_game.close(container)
    containerWindow:hide()
  end
  containerWindow.onDrop = function(container, widget, mousePos)
    if containerPanel:getChildByPos(mousePos) then
      return false
    end
    local child = containerPanel:getChildByIndex(-1)
    if child then
      child:onDrop(widget, mousePos, true)       
    end
  end
 
  containerWindow.onMouseRelease = function(widget, mousePos, mouseButton)
    if mouseButton == MouseButton4 then
      if container:hasParent() then
        return g_game.openParent(container)
      end
    elseif mouseButton == MouseButton5 then
      for i, item in ipairs(container:getItems()) do
        if item:isContainer() then
          return g_game.open(item, container)
        end
      end
    end
  end

  -- this disables scrollbar auto hiding
  local scrollbar = containerWindow:getChildById('miniwindowScrollBar')
  scrollbar:mergeStyle({ ['$!on'] = { }})

  local upButton = containerWindow:getChildById('upButton')
  upButton.onClick = function()
    g_game.openParent(container)
  end
  upButton:setVisible(container:hasParent())

  local name = container:getName()
  name = name:sub(1,1):upper() .. name:sub(2)
  containerWindow:setText(name)

  containerItemWidget:setItem(container:getContainerItem())

  containerPanel:destroyChildren()
  for slot=0,container:getCapacity()-1 do
    local itemWidget = g_ui.createWidget('Item', containerPanel)
    itemWidget:setId('item' .. slot)
    itemWidget:setItem(container:getItem(slot))
    itemWidget:setMargin(0)
    itemWidget.position = container:getSlotPosition(slot)

    if not container:isUnlocked() then
      itemWidget:setBorderColor('red')
    end
  end

  container.window = containerWindow
  container.itemsPanel = containerPanel

  toggleContainerPages(containerWindow, container:hasPages())
  refreshContainerPages(container)

  local layout = containerPanel:getLayout()
  local cellSize = layout:getCellSize()
  containerWindow:setContentMinimumHeight(cellSize.height)
  containerWindow:setContentMaximumHeight(cellSize.height*layout:getNumLines())

  if container:hasPages() then
    local height = containerWindow.miniwindowScrollBar:getMarginTop() + containerWindow.pagePanel:getHeight()+17
    if containerWindow:getHeight() < height then
      containerWindow:setHeight(height)
    end
  end

  if not previousContainer then
    local filledLines = math.max(math.ceil(container:getItemsCount() / layout:getNumColumns()), 1)
    containerWindow:setContentHeight(filledLines*cellSize.height)
  end
  setFrames()
  containerWindow:setup()
end

function onContainerClose(container)
  destroy(container)
end

function onContainerChangeSize(container, size)
  if not container.window then return end
  refreshContainerItems(container)
  setFrames()
end

function onContainerUpdateItem(container, slot, item, oldItem)
  if not container.window then return end
  local itemWidget = container.itemsPanel:getChildById('item' .. slot)
  itemWidget:setItem(item)
  setFrames()
end
There is a try with this but it doesn't work. Still don't give me

Try it like this

LUA:
local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          local id = child:getItemId()
          local price = 0

          local name = child:getTooltip()
          child:setImageSource("/images/ui/item")
          if (name) then
print("name: " .. name)
            if (string.find(name, "legendary")) then
              child:setImageSource('/images/ui/rarity_gold')
            elseif (string.find(name, "epic")) then
              child:setImageSource('/images/ui/rarity_purple')
            elseif (string.find(name, "rare")) then
              child:setImageSource('/images/ui/rarity_blue')
            end
          end

      end
  end
end
 

Attachments

Last edited:
Wouldn't the server be missing the sending to the client, then returning the images as they should be?
 
LUA:
local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          if child:getItemId() ~= 0 then
            local name = child:getItem():getName()

            child:setImageSource("/images/ui/item")
            if (name) then
              if (string.find(name, "legendary")) then
                child:setImageSource('/images/ui/rarity_gold')
              elseif (string.find(name, "epic")) then
                child:setImageSource('/images/ui/rarity_purple')
              elseif (string.find(name, "rare")) then
                child:setImageSource('/images/ui/rarity_blue')
              end
            end
          end
      end
  end
end

It doesn't work because your items don't have tooltips - the keywords are directly set in their names. Use the function above, it should work properly now.
 
LUA:
local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          if child:getItemId() ~= 0 then
            local name = child:getItem():getName()

            child:setImageSource("/images/ui/item")
            if (name) then
              if (string.find(name, "legendary")) then
                child:setImageSource('/images/ui/rarity_gold')
              elseif (string.find(name, "epic")) then
                child:setImageSource('/images/ui/rarity_purple')
              elseif (string.find(name, "rare")) then
                child:setImageSource('/images/ui/rarity_blue')
              end
            end
          end
      end
  end
end

It doesn't work because your items don't have tooltips - the keywords are directly set in their names. Use the function above, it should work properly now.

Still doesn't work for me, tfs 1.4.2, otcv8

If i put:
LUA:
local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          if child:getItemId() ~= 0 then
            local name = child:getItem():getName()

            child:setImageSource("/images/ui/item")
            if (name) then
              if (string.find(name, "legendary")) then
                child:setImageSource('/images/ui/rarity_gold')
              elseif (string.find(name, "epic")) then
                child:setImageSource('/images/ui/rarity_purple')
              elseif (string.find(name, "rare")) then
                child:setImageSource('/images/ui/rarity_blue')
              else
                child:setImageSource('/images/ui/rarity_white') --checking if frames work at all
              end
            end
          end
      end
  end
end

Then all items appear as 'white' but even if an item is 'epic', 'rare' or 'legendary' they won't change the frame to gold/purple etc.

Also, if you move the items out of backpack or out of corpse, the field remains with white frame. Even if this box in container is already empty, there's still rarity frame.

Tried to fix it but failed.
Any ideas?
 
try printing item's name. it's probably an empty string which is why the above script doesn't work.
 
try printing item's name. it's probably an empty string which is why the above script doesn't work.

Soo... It found the items, their clientID (as its not server ids) but not the item's name.
The name should be after 'item found:"

print("Item found:", name, "with itemId:", itemId)


setFrames function called
Processing container: 0
Item found: with itemId: 3387
Common item detected:
Item found: with itemId: 3264
Common item detected:
No item found in child index: 3
No item found in child index: 4
No item found in child index: 5
No item found in child index: 6
No item found in child index: 7
No item found in child index: 8
No item found in child index: 9
No item found in child index: 10
No item found in child index: 11
No item found in child index: 12
No item found in child index: 13
No item found in child index: 14
No item found in child index: 15
No item found in child index: 16
No item found in child index: 17
No item found in child index: 18
No item found in child index: 19
No item found in child index: 20
setFrames function completed

//edit
I give up, if anyone find a way to make it work pls tag me / DM me :D
 
Last edited:
From what I can tell, item name is probably only sent to the client when playerLookAt item.
 
Still doesn't work for me, tfs 1.4.2, otcv8

If i put:
LUA:
local function setFrames()
  for _, container in pairs(g_game.getContainers()) do
      local window = container.itemsPanel
      for i, child in pairs(window:getChildren()) do
          if child:getItemId() ~= 0 then
            local name = child:getItem():getName()

            child:setImageSource("/images/ui/item")
            if (name) then
              if (string.find(name, "legendary")) then
                child:setImageSource('/images/ui/rarity_gold')
              elseif (string.find(name, "epic")) then
                child:setImageSource('/images/ui/rarity_purple')
              elseif (string.find(name, "rare")) then
                child:setImageSource('/images/ui/rarity_blue')
              else
                child:setImageSource('/images/ui/rarity_white') --checking if frames work at all
              end
            end
          end
      end
  end
end

Then all items appear as 'white' but even if an item is 'epic', 'rare' or 'legendary' they won't change the frame to gold/purple etc.

Also, if you move the items out of backpack or out of corpse, the field remains with white frame. Even if this box in container is already empty, there's still rarity frame.

Tried to fix it but failed.
Any ideas?
This OTClient module is 100% correct. Now, you just need to make changes to the source code of the TFS server. Follow the commit, make the changes, and test it. Be happy! :)

 
This OTClient module is 100% correct. Now, you just need to make changes to the source code of the TFS server. Follow the commit, make the changes, and test it. Be happy! :)

Well, I was excited that there's a solution to make it work but... it doesn't work for me.

//edit
1.4.2
so, just to clarify
no errors with networkmessage.ccp / .h

with protocolgame had many errors so:
otclientV8 is undefined -> ive defined it
this: void ProtocolGame::sendFeatures() - is not even in the source, had to add it
result: ive compiled tfs and no errors in the console when running the server, no errors in the otc but the rarity frames simply does not work
 
Last edited:
Well, I was excited that there's a solution to make it work but... it doesn't work for me.
if (withDescription) {
addString(item->getDescription(0));
} in networkmessage.cpp in additem function

in addItem function check networkmessage.cpp :) to fix sendTextWindow
 
Back
Top