Advertisement
7n6

PKO Equip Lister

7n6
Aug 22nd, 2016
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.95 KB | None | 0 0
  1. EquipInfo = {
  2.     ItemInfo = GetResPath("iteminfo.txt"),
  3.     Cache = {},
  4.     Stats = {
  5.         [1] = "Strength +%s%",  
  6.         [2] = "Agility +%s%",  
  7.         [3] = "Accuracy +%s%",  
  8.         [4] = "Constitution +%s%",  
  9.         [5] = "Spirit +%s%",  
  10.         [6] = "Luck +%s%",
  11.         [7] = "Attack Speed +%s%",    
  12.         [8] = "Attack Range +%s%",
  13.         [9] = "Min Attack +%s%",  
  14.         [10] = "Max Attack +%s%",  
  15.         [11] = "Defence +%s%",  
  16.         [12] = "HP +%s%",  
  17.         [13] = "SP +%s%",  
  18.         [14] = "Dodge +%s%",  
  19.         [15] = "HitRate +%s%",
  20.         [16] = "Critical Hit +%s%",
  21.         [17] = "Drop Rate +%s%",
  22.         [18] = "HP Recovery +%s%",  
  23.         [19] = "SP Recovery +%s%",  
  24.         [21] = "Movement Speed +%s%",  
  25.         --[22] = "Resource Gathering +%s%",
  26.         [26] = "Strength +%s",  
  27.         [27] = "Agility+%s",  
  28.         [28] = "Accuracy+%s",  
  29.         [29] = "Constitution+%s",  
  30.         [30] = "Spirit+%s",  
  31.         [31] = "Luck+%s",
  32.         [32] = "Attack Speed+%s",    
  33.         [33] = "Attack Range+%s",
  34.         [34] = "Min Attack+%s",  
  35.         [35] = "Max Attack+%s",  
  36.         [36] = "Defence+%s",  
  37.         [37] = "HP+%s",  
  38.         [38] = "SP+%s",  
  39.         [39] = "Dodge+%s",  
  40.         [40] = "HitRate+%s",
  41.         [41] = "Critical Hit+%s",
  42.         [42] = "Drop Rate+%s",
  43.         [43] = "HP Recovery+%s",  
  44.         [44] = "SP Recovery+%s",  
  45.         [45] = "Movement Speed+%s",
  46.         --[46] = "Resource Gathering+%s",  
  47.         [47] = "Physical Resist+%s",
  48.     }
  49. }
  50.  
  51.  
  52. function EquipInfo.DisplayItem(role,Item)
  53.     local msg = ''
  54.     local ID = GetItemID(Item)
  55.     local FuseID = GetItemAttr(Item,ITEMATTR_VAL_FUSIONID)
  56.     local FuseLvl = GetItemAttr(Item,ITEMATTR_VAL_LEVEL)
  57.     local ForgeParam = TansferNum(GetItemForgeParam(Item,1))
  58.     if ID == nil or ID == 0 then
  59.         SystemNotice(role,'Item does not exist.')
  60.         return
  61.     end
  62.     msg = GetItemName(ID)
  63.     if FuseID ~= 0 then
  64.         msg = EquipInfo.PadString(string.format('Lv%s %s',FuseLvl,msg),true)
  65.         msg = string.format('%s%s',msg,EquipInfo.PadString(string.format('(Fused to %s)',GetItemName(FuseID)),true))
  66.     else
  67.         msg = EquipInfo.PadString(msg,true)
  68.     end
  69.     for i,v in pairs(EquipInfo.Stats) do
  70.         local value = EquipInfo.GetItemStat(Item,i)
  71.         if value ~= 0 then
  72.             msg = string.format('%s%s',msg, EquipInfo.PadString(string.format(v,value),true))
  73.         end
  74.     end
  75.     msg = string.format('%s%s',msg, EquipInfo.PadString('',true))
  76.    
  77.     msg = string.format('%s%s',msg, EquipInfo.PadString(string.format('Sockets: %s',GetNum_Part1(ForgeParam)),true))
  78.    
  79.     local Forge = {
  80.         {
  81.             Gem = GetItemName(StoneTpye_ID [GetNum_Part2(ForgeParam)]),
  82.             Lvl = GetNum_Part3(ForgeParam),
  83.         },
  84.         {
  85.             Gem = GetItemName(StoneTpye_ID [GetNum_Part4(ForgeParam)]),
  86.             Lvl = GetNum_Part5(ForgeParam),
  87.         },
  88.         {
  89.             Gem = GetItemName(StoneTpye_ID [GetNum_Part6(ForgeParam)]),
  90.             Lvl = GetNum_Part7(ForgeParam),
  91.         },
  92.    
  93.     }
  94.     for i,v in pairs(Forge) do
  95.         if v.Gem ~= 'Unknown' and v.Lvl ~= 0 then
  96.             msg = string.format('%s%s',msg, EquipInfo.PadString(string.format('Lv%s %s',v.Lvl,v.Gem),true))
  97.         end
  98.     end
  99.  
  100.     HelpInfo(role,0,msg)
  101. end
  102.  
  103. function EquipInfo.GetItemStat(Item,Stat)
  104.     local Stats = GetItemAttr(Item,Stat)
  105.     local ID = GetItemID(Item)
  106.     local FuseID = GetItemAttr(Item,ITEMATTR_VAL_FUSIONID)
  107.     if Stats == 0 then
  108.         if FuseID == 0 then
  109.             Stats = EquipInfo.Cache[ID][Stat]
  110.         else
  111.             Stats = EquipInfo.Cache[FuseID][Stat]
  112.         end
  113.     end
  114.     return Stats
  115. end
  116.  
  117. function EquipInfo.GetItemLevel(Item)
  118.     return EquipInfo.Cache[GetItemID(Item)].Level
  119. end
  120.  
  121. function EquipInfo.split(str, delim, maxNb)--not my function
  122.     if string.find(str, delim) == nil then
  123.         return { str }
  124.     end
  125.     if maxNb == nil or maxNb < 1 then
  126.         maxNb = 0    -- No limit
  127.     end
  128.     local result = {}
  129.     local pat = "(.-)" .. delim .. "()"
  130.     local nb = 0
  131.     local lastPos
  132.     for part, pos in string.gfind(str, pat) do
  133.         nb = nb + 1
  134.         result[nb] = part
  135.         lastPos = pos
  136.         if nb == maxNb then break end
  137.     end
  138.     if nb ~= maxNb then
  139.         result[nb + 1] = string.sub(str, lastPos)
  140.     end
  141.     return result
  142. end
  143.  
  144. function EquipInfo.PadString(str,center)
  145.     local Len = string.len(str)
  146.     local toggle = true
  147.     if Len == 42 then
  148.         return str
  149.     end
  150.    
  151.     if Len < 42 then
  152.         for i = 1,42-Len do
  153.             if center == true then
  154.                 toggle = not toggle
  155.             end
  156.             if toggle == true then
  157.                 str = str.." "
  158.             else
  159.                 str = " "..str
  160.             end
  161.         end
  162.     end
  163.     return str
  164. end
  165.    
  166. function EquipInfo.ReadItemInfo()
  167.     local OpenFile = io.open(EquipInfo.ItemInfo)
  168.     while true do
  169.         local line = OpenFile:read()
  170.         if line == nil then
  171.             break
  172.         end
  173.         if string.find(line ,"//") == nil and line ~= '' then
  174.             local strings = {}
  175.             strings = EquipInfo.split(line,"\t")
  176.             if strings[1] ~= '' then
  177.                 EquipInfo.Cache[tonumber(strings[1])] =
  178.                 {
  179.                     Level = tonumber(strings[25]),
  180.                     Type = tonumber(strings[11]),
  181.                 }
  182.                 for i = 1,22 do
  183.                     local ModAttr = EquipInfo.split(strings[31 + i],",")
  184.                     local Attr = EquipInfo.split(strings[52 + i],",")
  185.                     EquipInfo.Cache[tonumber(strings[1])][i] = tonumber(ModAttr[1])
  186.                     EquipInfo.Cache[tonumber(strings[1])][i + 25] = tonumber(Attr[1])
  187.                 end
  188.             end
  189.         end
  190.     end
  191.     OpenFile:close()
  192. end
  193. EquipInfo.ReadItemInfo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement