• 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!

Item double info problem

qosiu

New Member
Joined
May 23, 2018
Messages
8
Reaction score
1
Hi. Recently I've added randomItemStats to my server but now I have problem with double information showing when i shift-click on any item


18:28 You see a backpack of holding (Vol:24).
It weighs 5470.20 oz.a backpack of holding (Vol:24).
It weighs 5470.20 oz.

Any ideas?
I've added monsterLootMessage = 0 to config.lua, but nothing changed :(
 
U mean this? I'm a newbe

<event class="Player" method="onLook" enabled="1" />

Lua:
function Player:onLook(thing, position, distance)
   local description = "You see " .. thing:getDescription(distance)
   description = stat_onLook(thing, description)
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. "a honeyflower patch."
        elseif thing.actionid == 5641 then
            description = description .. "a banana palm."
        elseif thing.itemid >= ITEM_HEALTH_CASK_START and thing.itemid <= ITEM_HEALTH_CASK_END
        or thing.itemid >= ITEM_MANA_CASK_START and thing.itemid <= ITEM_MANA_CASK_END
        or thing.itemid >= ITEM_SPIRIT_CASK_START and thing.itemid <= ITEM_SPIRIT_CASK_END
        or thing.itemid >= ITEM_KEG_START and thing.itemid <= ITEM_KEG_END then
            description = description .. thing:getDescription(distance)
            local charges = thing:getCharges()
            if charges then
            description = string.format("%s\nIt has %d refillings left.", description, charges)
            end
        else
            description = description .. thing:getDescription(distance)
        end

        local itemType = thing:getType()
        if (itemType and itemType:getImbuingSlots() > 0) then
            local imbuingSlots = "Imbuements: ("
            for i = 1, itemType:getImbuingSlots() do
                local specialAttr = thing:getSpecialAttribute(i)
                local time = 0
                if (thing:getSpecialAttribute(i+3)) then
                    time = getTime(thing:getSpecialAttribute(i+3))
                end

                if (specialAttr and specialAttr ~= 0) then
                    if (i ~= itemType:getImbuingSlots()) then
                        imbuingSlots = imbuingSlots.. "" ..specialAttr.." " ..time..", "
                    else
                        imbuingSlots = imbuingSlots.. "" ..specialAttr.." " ..time..")."
                    end
                else
                    if (i ~= itemType:getImbuingSlots()) then
                        imbuingSlots = imbuingSlots.. "Empty Slot, "
                    else
                        imbuingSlots = imbuingSlots.. "Empty Slot)."
                    end
                end
            end
            description = string.gsub(description, "It weighs", imbuingSlots.. "\nIt weighs")
        end
    else
        description = description .. thing:getDescription(distance)
        if thing:isMonster() then
            local master = thing:getMaster()
            if master and table.contains({'thundergiant','grovebeast','emberwing','skullfrost'}, thing:getName():lower()) then
                description = description..' (Master: ' .. master:getName() .. '). It will disappear in ' .. getTimeinWords(master:getStorageValue(Storage.PetSummon) - os.time())
            end
        end
    end

    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        local position = thing:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )

        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
            end
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Last edited:
Solved! I removed from "local description = "You see " .. thing:getDescription(distance)"

".. thing:getDescription(distance)"

and it works! :)
 
Back
Top