local itemInfo = require("main\\ItemInfo")
local hintHelper = require("main\\hintHelper")
--获取物品属性
function on_getItemInfo(item, actor, itemFrom, itemPos, mainAppend)
local ret, _temp, _mainItemInfo, _steelInfo, _steelSuitInfo, _suitInfo = "", "", "", "", "", ""
--local _startTime = os.clock()
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
--获取物品信息
_mainItemInfo = itemInfo.getItemInfo(item, dbitem, actor, itemFrom, itemPos)
if _mainItemInfo ~= "" then
--获取钢纹属性
_steelInfo = itemInfo.getItemSteelInfo(item, dbitem)
end
end
--装备栏专有属性
if in_array(itemFrom, {const.ift_state, const.ift_herostate, const.ift_user1state}) then
if item:getName() ~= "" then
if _mainItemInfo ~= "" then
--获取钢纹套装属性
_steelSuitInfo = itemInfo.getItemSteelSuitInfo(item, dbitem, actor, itemFrom, itemPos)
--获取套装属性
_suitInfo = itemInfo.getItemSuitProp(itemFrom, itemPos)
end
end
--检测装备栏头盔位是否存在面巾或斗笠
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)
if _temp ~= "" then
if _mainItemInfo ~= "" then
_temp = _temp..hintHelper.addParent()..hintHelper.addSubParent().._mainItemInfo
end
_mainItemInfo = _temp
--获取钢纹属性
if _steelInfo == "" then
_steelInfo = itemInfo.getItemSteelInfo(_ZLItem, dbitem)
end
--获取钢纹套装属性
if _steelSuitInfo == "" then
_steelSuitInfo = itemInfo.getItemSteelSuitInfo(_ZLItem, dbitem, actor, _nowItemPos)
end
--获取套装属性
if _suitInfo == "" then
_suitInfo = itemInfo.getItemSuitProp(itemFrom, _nowItemPos)
end
end
end
end
end
--鉴定星级套装
_mainItemInfo = _mainItemInfo..itemInfo.getIdentifySuitProp(item, itemFrom, itemPos)
--体格属性
_mainItemInfo = _mainItemInfo..itemInfo.getPhysiqueProp(actor, itemFrom, itemPos)
end
--整理最后输出hint字符串
if _mainItemInfo ~= "" then
_temp = ""
if _suitInfo ~= "" or _steelSuitInfo ~= "" then
_temp = hintHelper.addParent()
if _suitInfo ~= "" then
_temp = _temp..hintHelper.addSubParent().._suitInfo
end
if _steelSuitInfo ~= "" then
_temp = _temp..hintHelper.addSubParent().._steelSuitInfo
end
end
_suitInfo = _temp
end
if _suitInfo ~= "" then
_suitInfo = hintHelper.addParent().._suitInfo
end
--ret = _mainItemInfo..mainAppend.._steelInfo
ret = _mainItemInfo..mainAppend.._suitInfo
--local _endTime = os.clock()
--print(string.format("所用时间:%.4fms",_endTime-_startTime))
return ret
end |