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大佬帮忙吗
|