搜索
查看: 823|回复: 0

[求助] 如何修改装备对比显示

[复制链接]
发表于 2021-11-26 15:41:15 | 显示全部楼层 |阅读模式
local itemInfo = require("main\\ItemInfo")
local hintHelper = require("main\\hintHelper")
--@reloadclientlua
--获取物品属性
function on_getItemInfo(item, actor, itemFrom, itemPos, mainAppend)
        local ret = {}
        local _startTime = os.clock()
        --c.share.addChat("测试", 1, 2)
        itemInfo.init(item, actor, itemFrom, itemPos, mainAppend)
        local dbitem = nil
        if item:getName() ~= "" then
                --根据物品ID获取数据库实例
                dbitem = c.item.getDBItem(item:getIndex())
                if dbitem == nil then return "" end
                --获取物品信息
                insert(ret,itemInfo.getItemInfo(item, dbitem, actor, itemFrom, itemPos,mainAppend))
        end
        --背包物品
        if itemFrom == 0 then
                local race = actor:getRace()
                if race == 0 then        --         主号背包
                        --c.share.addChat("主号背包:"..itemPos, 1, 2)
                        if itemPos > 5 and itemPos < 46 then --背包物品
                                local useItemPos = itemInfo.getUseItemPos(dbitem)
                                local _type_useItemPos = type(useItemPos)
                                if _type_useItemPos == "number" then
                                        local useItem = c.item.getMyEquipPos(useItemPos)
                                        if useItem then
                                                local _tmp = itemInfo.getItemInfo(useItem,c.item.getDBItem(useItem:getIndex()),actor,const.ift_state,useItemPos,"")
                                                if _tmp ~= "" then
                                                        insert(ret,_tmp)
                                                end
                                        end
                                end
                                if _type_useItemPos == "table" then
                                        for k,v in pairs(useItemPos) do
                                                local useItem = c.item.getMyEquipPos(v)
                                                if useItem then
                                                        local _tmp = itemInfo.getItemInfo(useItem,c.item.getDBItem(useItem:getIndex()),actor,const.ift_state,v,"")
                                                        if _tmp ~= "" then
                                                                insert(ret,_tmp)
                                                        end
                                                end
                                        end
                                end
                        end
                else        --英雄背包
                        --c.share.addChat("英雄背包:"..itemPos, 1, 2)
                        local useItemPos = itemInfo.getUseItemPos(dbitem)
                        local _type_useItemPos = type(useItemPos)
                        if _type_useItemPos == "number" then
                                local useItem = c.item.getHeroEquipPos(useItemPos)
                                if useItem then
                                        local _tmp = itemInfo.getItemInfo(useItem,c.item.getDBItem(useItem:getIndex()),actor,const.ift_herostate,useItemPos,"")
                                        if _tmp ~= "" then
                                                insert(ret,_tmp)
                                        end
                                end
                        end
                        if _type_useItemPos == "table" then
                                for k,v in pairs(useItemPos) do
                                        local useItem = c.item.getHeroEquipPos(v)
                                        if useItem then
                                                local _tmp = itemInfo.getItemInfo(useItem,c.item.getDBItem(useItem:getIndex()),actor,const.ift_herostate,v,"")
                                                if _tmp ~= "" then
                                                        insert(ret,_tmp)
                                                end
                                        end
                                end
                        end
                end
                return concat(ret,"{type=addparent;align=right}{type=addsubparent}{type=set;ox=150}{s=已装备;fc=4278255360}{type=set;oy=-14}\\")
        end
        --查看英雄装备栏
        --查看装备栏、英雄装备栏、他人装备栏
        if in_array(itemFrom, {const.ift_state, const.ift_herostate, const.ift_user1state}) then
                --检测装备栏头盔位是否存在面巾或斗笠
                if itemPos == const.item_helmet or itemPos == const.item_fasguin_helmet then
                        local _nowItemPos
                        if itemPos == const.item_helmet then
                                _nowItemPos = const.item_zhuli
                        else
                                _nowItemPos = const.item_fasguin_zhuli
                        end

                        --获取斗笠或面巾
                        local _ZLItem = nil
                        if itemFrom == const.ift_state then
                                _ZLItem = c.item.getMyEquipPos(_nowItemPos)
                        elseif itemFrom == const.ift_herostate then
                                _ZLItem = c.item.getHeroEquipPos(_nowItemPos)
                        elseif  itemFrom == const.ift_user1state then
                                _ZLItem = c.item.getUser1EquipPos(_nowItemPos)
                        end

                        if _ZLItem ~= nil then
                                dbitem = c.item.getDBItem(_ZLItem:getIndex())
                                if dbitem ~= nil then
                                        _temp = itemInfo.getItemInfo(_ZLItem, dbitem, actor, itemFrom, _nowItemPos,"")
                                        insert(ret,_temp)
                                end
                        end
                end
                return concat(ret,"{type=addparent;align=right}{type=addsubparent}\\")
        end
        return concat(ret,"{type=addparent;align=right}{type=addsubparent}{type=set;ox=150}{s=已装备;fc=4278255360}{type=set;oy=-14}\\")
end

--物品掉落回调
function on_DropItem(x, y, looks, color, effectId, name, expand1, dbIdx, count, seeMode)

end
--@reloadclientlua




怎么改成用图片显示的那种阿 ... 有LUA大佬帮忙吗

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|HGEM2论坛

GMT+8, 2024-9-22 01:54 , Processed in 0.500281 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表