Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EquipInfo = {
- ItemInfo = GetResPath("iteminfo.txt"),
- Cache = {},
- Stats = {
- [1] = "Strength +%s%",
- [2] = "Agility +%s%",
- [3] = "Accuracy +%s%",
- [4] = "Constitution +%s%",
- [5] = "Spirit +%s%",
- [6] = "Luck +%s%",
- [7] = "Attack Speed +%s%",
- [8] = "Attack Range +%s%",
- [9] = "Min Attack +%s%",
- [10] = "Max Attack +%s%",
- [11] = "Defence +%s%",
- [12] = "HP +%s%",
- [13] = "SP +%s%",
- [14] = "Dodge +%s%",
- [15] = "HitRate +%s%",
- [16] = "Critical Hit +%s%",
- [17] = "Drop Rate +%s%",
- [18] = "HP Recovery +%s%",
- [19] = "SP Recovery +%s%",
- [21] = "Movement Speed +%s%",
- --[22] = "Resource Gathering +%s%",
- [26] = "Strength +%s",
- [27] = "Agility+%s",
- [28] = "Accuracy+%s",
- [29] = "Constitution+%s",
- [30] = "Spirit+%s",
- [31] = "Luck+%s",
- [32] = "Attack Speed+%s",
- [33] = "Attack Range+%s",
- [34] = "Min Attack+%s",
- [35] = "Max Attack+%s",
- [36] = "Defence+%s",
- [37] = "HP+%s",
- [38] = "SP+%s",
- [39] = "Dodge+%s",
- [40] = "HitRate+%s",
- [41] = "Critical Hit+%s",
- [42] = "Drop Rate+%s",
- [43] = "HP Recovery+%s",
- [44] = "SP Recovery+%s",
- [45] = "Movement Speed+%s",
- --[46] = "Resource Gathering+%s",
- [47] = "Physical Resist+%s",
- }
- }
- function EquipInfo.DisplayItem(role,Item)
- local msg = ''
- local ID = GetItemID(Item)
- local FuseID = GetItemAttr(Item,ITEMATTR_VAL_FUSIONID)
- local FuseLvl = GetItemAttr(Item,ITEMATTR_VAL_LEVEL)
- local ForgeParam = TansferNum(GetItemForgeParam(Item,1))
- if ID == nil or ID == 0 then
- SystemNotice(role,'Item does not exist.')
- return
- end
- msg = GetItemName(ID)
- if FuseID ~= 0 then
- msg = EquipInfo.PadString(string.format('Lv%s %s',FuseLvl,msg),true)
- msg = string.format('%s%s',msg,EquipInfo.PadString(string.format('(Fused to %s)',GetItemName(FuseID)),true))
- else
- msg = EquipInfo.PadString(msg,true)
- end
- for i,v in pairs(EquipInfo.Stats) do
- local value = EquipInfo.GetItemStat(Item,i)
- if value ~= 0 then
- msg = string.format('%s%s',msg, EquipInfo.PadString(string.format(v,value),true))
- end
- end
- msg = string.format('%s%s',msg, EquipInfo.PadString('',true))
- msg = string.format('%s%s',msg, EquipInfo.PadString(string.format('Sockets: %s',GetNum_Part1(ForgeParam)),true))
- local Forge = {
- {
- Gem = GetItemName(StoneTpye_ID [GetNum_Part2(ForgeParam)]),
- Lvl = GetNum_Part3(ForgeParam),
- },
- {
- Gem = GetItemName(StoneTpye_ID [GetNum_Part4(ForgeParam)]),
- Lvl = GetNum_Part5(ForgeParam),
- },
- {
- Gem = GetItemName(StoneTpye_ID [GetNum_Part6(ForgeParam)]),
- Lvl = GetNum_Part7(ForgeParam),
- },
- }
- for i,v in pairs(Forge) do
- if v.Gem ~= 'Unknown' and v.Lvl ~= 0 then
- msg = string.format('%s%s',msg, EquipInfo.PadString(string.format('Lv%s %s',v.Lvl,v.Gem),true))
- end
- end
- HelpInfo(role,0,msg)
- end
- function EquipInfo.GetItemStat(Item,Stat)
- local Stats = GetItemAttr(Item,Stat)
- local ID = GetItemID(Item)
- local FuseID = GetItemAttr(Item,ITEMATTR_VAL_FUSIONID)
- if Stats == 0 then
- if FuseID == 0 then
- Stats = EquipInfo.Cache[ID][Stat]
- else
- Stats = EquipInfo.Cache[FuseID][Stat]
- end
- end
- return Stats
- end
- function EquipInfo.GetItemLevel(Item)
- return EquipInfo.Cache[GetItemID(Item)].Level
- end
- function EquipInfo.split(str, delim, maxNb)--not my function
- if string.find(str, delim) == nil then
- return { str }
- end
- if maxNb == nil or maxNb < 1 then
- maxNb = 0 -- No limit
- end
- local result = {}
- local pat = "(.-)" .. delim .. "()"
- local nb = 0
- local lastPos
- for part, pos in string.gfind(str, pat) do
- nb = nb + 1
- result[nb] = part
- lastPos = pos
- if nb == maxNb then break end
- end
- if nb ~= maxNb then
- result[nb + 1] = string.sub(str, lastPos)
- end
- return result
- end
- function EquipInfo.PadString(str,center)
- local Len = string.len(str)
- local toggle = true
- if Len == 42 then
- return str
- end
- if Len < 42 then
- for i = 1,42-Len do
- if center == true then
- toggle = not toggle
- end
- if toggle == true then
- str = str.." "
- else
- str = " "..str
- end
- end
- end
- return str
- end
- function EquipInfo.ReadItemInfo()
- local OpenFile = io.open(EquipInfo.ItemInfo)
- while true do
- local line = OpenFile:read()
- if line == nil then
- break
- end
- if string.find(line ,"//") == nil and line ~= '' then
- local strings = {}
- strings = EquipInfo.split(line,"\t")
- if strings[1] ~= '' then
- EquipInfo.Cache[tonumber(strings[1])] =
- {
- Level = tonumber(strings[25]),
- Type = tonumber(strings[11]),
- }
- for i = 1,22 do
- local ModAttr = EquipInfo.split(strings[31 + i],",")
- local Attr = EquipInfo.split(strings[52 + i],",")
- EquipInfo.Cache[tonumber(strings[1])][i] = tonumber(ModAttr[1])
- EquipInfo.Cache[tonumber(strings[1])][i + 25] = tonumber(Attr[1])
- end
- end
- end
- end
- OpenFile:close()
- end
- EquipInfo.ReadItemInfo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement