-- Rate Item by Rock5 v0.01 alpha local STR, STA, INT, WIS, DEX, ALLATTR = 2, 3, 4, 5, 6, 7 local HP, MP, PATT, PDEF, MDEF, MATT= 8, 9, 12, 13, 14, 15 local PDAM, MDAM = 25, 191 local CLASS_EFFECT={ [CLASS_WARRIOR] = { [STR] = {[PATT]=2, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=2.3}, [INT] = {[MATT]=2, [MP]=1}, [WIS] = {[MP]=5, [MDEF]=2.2}, [ALLATTR] ={[PATT]=2,[HP]=5.2, [PDEF]=2.3,[MATT]=2, [MP]=6 ,[MDEF]=2.2}, [DEX] = {}, }, [CLASS_SCOUT] = { [STR] = {[PATT]=1, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=1.8}, [INT] = {[MATT]=2, [MP]=1}, [WIS] = {[MP]=5, [MDEF]=2.6}, [ALLATTR] ={ [PATT]=2, [HP]=5.2, [PDEF]=1.8,[MATT]=2, [MP]=6, [MDEF]=2.6}, [DEX] = {[PATT]=1}, }, [CLASS_ROGUE] = { [STR] = {[PATT]=1.2, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=1.8}, [INT] = {[MATT]=2, [MP]=1}, [WIS] = {[MP]=5, [MDEF]=2.3}, [ALLATTR] ={ [PATT]=2.5, [HP]=5.2, [PDEF]=1.8,[MATT]=2, [MP]=6, [MDEF]=2.6}, [DEX] = {[PATT]=1.3}, }, [CLASS_MAGE] = { [STR] = {[PATT]=0.8, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=1.5}, [INT] = {[MATT]=2, [MP]=1, [PATT]=0.5}, [WIS] = {[MP]=5, [MDEF]=3}, [ALLATTR] ={[MATT]=2, [PATT]=1.3, [HP]=5.2, [PDEF]=1.5,[MATT]=2, [MP]=6, [MDEF]= 3}, [DEX] = {}, }, [CLASS_PRIEST] = { [STR] = {[PATT]=0.8, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=1.5}, [INT] = {[MATT]=2, [MP]=1, [PATT]=0.5}, [WIS] = {[MP]=5, [MDEF]=3.2}, [ALLATTR] ={[MATT]=2, [PATT]=1.3, [HP]=5.2, [PDEF]=1.5,[MATT]=2, [MP]=6, [MDEF]= 3.2}, [DEX] = {}, }, [CLASS_KNIGHT] = { [STR] = {[PATT]=1.5, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=3}, [INT] = {[MATT]=2, [MP]=1, [PATT]=0.5}, [WIS] = {[MP]=5, [MDEF]=2.4}, [ALLATTR] ={[MATT]=2, [PATT]=2, [HP]=5.2, [PDEF]=3,[MATT]=2, [MP]=6, [MDEF]= 2.4}, [DEX] = {}, }, [CLASS_DRUID] = { [STR] = {[PATT]=0.8, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=1.5}, [INT] = {[MATT]=2, [MP]=1}, [WIS] = {[MP]=5, [MDEF]=3}, [ALLATTR] ={[MATT]=2, [PATT]=0.8, [HP]=5.2, [PDEF]=1.5,[MATT]=2, [MP]=6, [MDEF]=3}, [DEX] = {}, }, [CLASS_WARDEN] = { [STR] = {[PATT]=1.5, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=2}, [INT] = {[MATT]=2, [MP]=1, [PATT]=0.5}, [WIS] = {[MP]=5, [MDEF]=2.4}, [ALLATTR] ={[MATT]=2, [PATT]=2.5, [HP]=5.2, [PDEF]=2,[MATT]=2, [MP]=6, [MDEF]=2.4}, [DEX] = {}, }, [CLASS_CHAMPION] = { [STR] = {[PATT]=2, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=2.3}, [INT] = {[MATT]=2, [MP]=1}, [WIS] = {[MP]=5, [MDEF]=2.2}, [ALLATTR] ={[MATT]=2, [PATT]=2, [HP]=5.2, [PDEF]=2.3,[MATT]=2, [MP]=6, [MDEF]=2.2}, [DEX] = {}, }, [CLASS_WARLOCK] = { [STR] = {[PATT]=0.8, [HP]=0.2}, [STA] = {[HP]=5, [PDEF]=1.5}, [INT] = {[MATT]=2, [MP]=1, [PATT]=0.5}, [WIS] = {[MP]=5, [MDEF]=3.0}, [ALLATTR] ={[MATT]=2, [PATT]=1.3, [HP]=5.2, [PDEF]=1.5,[MATT]=2, [MP]=6, [MDEF]=3.0}, [DEX] = {}, }, } local CLASS_SCORE ={ [CLASS_WARRIOR] = { [STR] = 4, [STA] = 3.7, [INT] = 0, [WIS] = 0, [DEX] = 2.5, [MATT] = 0, [PATT]= 5, [MDEF] = 0, [PDEF] = 3, [HP] = 3, [MP] = 0, [PDAM] = 4 }, [CLASS_SCOUT] = { [STR] = 3.7, [STA] = 3.5, [INT] = 0, [WIS] = 0, [DEX] = 4, [MATT] = 1, [PATT]= 5, [MDEF] = 0, [PDEF] = 3, [HP] = 3, [MP] = 0, [PDAM] = 4 }, [CLASS_ROGUE] = { [STR] = 0, [STA] = 3.5, [INT] = 0, [WIS] = 0, [DEX] = 4, [MATT] = 0, [PATT]= 5, [MDEF] = 0, [PDEF] = 3, [HP] = 3, [MP] = 0, [PDAM] = 4 }, [CLASS_MAGE] = { [STR] = 0, [STA] = 3.5, [INT] = 4, [WIS] = 2, [DEX] = 0, [MATT] = 5, [PATT]= 0, [MDEF] = 2, [PDEF] = 1.5, [HP] = 3, [MP] = 2, [MDAM] = 4 }, [CLASS_PRIEST] = { [STR] = 0, [STA] = 4, [INT] = 2, [WIS] = 5, [DEX] = 0, [MATT] = 0, [PATT]= 0, [MDEF] = 3.5, [PDEF] = 1.5, [HP] = 4, [MP] = 0, [MDAM] = 4 }, [CASS_KNIGHT] = { [STR] = 3, [STA] = 3.5, [INT] = 0, [WIS] = 2, [DEX] = 0, [MATT] = 0, [PATT]= 4, [MDEF] = 0, [PDEF] = 3.5, [HP] = 4, [MP] = 2, [PDAM] = 4 }, -- some said only less wisdom [CLASS_DRUID] = { [STR] = 0, [STA] = 4, [INT] = 2, [WIS] = 4.2, [DEX] = 0, [MATT] = 0, [PATT]= 0, [MDEF] = 3.5, [PDEF] = 1.5, [HP] = 4, [MP] = 0, [MDAM] = 4 }, --played as PDD [CLASS_WARDEN] = { [STR] = 4, [STA] = 3.7, [INT] = 0, [WIS] = 0, [DEX] = 0, [MATT] = 0, [PATT]= 5, [MDEF] = 0, [PDEF] = 3, [HP] = 3, [MP] = 2, [PDAM] = 4 }, [CLASS_CHAMPION] = { [STR] = 4, [STA] = 3.7, [INT] = 0, [WIS] = 0, [DEX] = 0, [MATT] = 0, [PATT]= 5, [MDEF] = 0, [PDEF] = 3, [HP] = 3, [MP] = 2, [PDAM] = 4 }, [CLASS_WARLOCK] = { [STR] = 0, [STA] = 3.5, [INT] = 4, [WIS] = 2, [DEX] = 0, [MATT] = 5, [PATT]= 0, [MDEF] = 2, [PDEF] = 1.5, [HP] = 3, [MP] = 2, [MDAM] = 4 } } local CLASS_ARMOR = { [CLASS_WARRIOR] = { itemtypes[1][1] }, [CLASS_SCOUT] = { itemtypes[1][2] }, [CLASS_ROGUE] = { itemtypes[1][2] }, [CLASS_MAGE] = { itemtypes[1][3] }, [CLASS_PRIEST] = { itemtypes[1][3] }, [CASS_KNIGHT] = { itemtypes[1][0] }, [CLASS_DRUID] = { itemtypes[1][3] }, -- kette? [CLASS_WARDEN] = { itemtypes[1][1] }, [CLASS_CHAMPION] = { itemtypes[1][1] }, [CLASS_WARLOCK] = { itemtypes[1][3] } }; local CLASS_WEAPON = { CLASS_WARRIOR] = { itemtypes[0][1] }, [CLASS_SCOUT] = { itemtypes[0][5],itemtypes[0][3] }, [CLASS_ROGUE] = { itemtypes[0][3] }, [CLASS_MAGE] = { itemtypes[0][4] }, [CLASS_PRIEST] = { itemtypes[0][4] }, [CASS_KNIGHT] = { itemtypes[0][0],itemtypes[1][5][0] }, [CLASS_DRUID] = { itemtypes[0][4] }, -- kette? [CLASS_WARDEN] = { itemtypes[0][0] }, [CLASS_CHAMPION] = { itemtypes[0][2] }, [CLASS_WARLOCK] = { itemtypes[0][4] } } local function evalWeaponType( item ) if CLASS_WEAPON[player.Class1][2] == nil then if( item:isType(CLASS_WEAPON[player.Class1][1])then return true else return false; end else if( item:isType(CLASS_WEAPON[player.Class1][1] or item:isType(CLASS_WEAPON[player.Class1][2])then return true else return false; end end end function evalItems() local result ={{{{}}}}; for i, item in pairs(inventory.BagSlot) do local objtype, objsubtype, objsubsubtype, objsubsubuniquetype = item:getTypes() --armor and jewels if((item:isType( itemtypes[1].Name) and item:isType(CLASS_ARMOR[player.Class1][1])) or item:isType(itemtypes[1][4])) then tmp = getRaterDataByItem(item); local score = 0; for k,v in pairs(tmp.Effects) do score = CLASS_SCORE[player.Class1][k] * v + score; end if(result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Score ~= nil)then if(result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Score < score)then result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Score = score; result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Item = item; result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].BagSlot = i; end else result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Score = score; result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Item = item; result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].BagSlot = i; end --weapons and left hand elseif( (item:isType(itemtypes[0].Name) or item:isType(itemtypes[1][5].Name)) and evalWeaponType(item))) then tmp = getRaterDataByItem(item); local score = 0; for k,v in pairs(tmp.Effects) do if( CLASS_SCORE[player.Class1][k] ) then score = CLASS_SCORE[player.Class1][k] * v + score; end end if(result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Score ~= nil)then if(result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Score < score)then result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Score = score; result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Item = item; result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].BagSlot = i; end else result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Score = score; result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].Item = item; result[objtype][objsubtype][objsubsubtype or -1][objsubsubuniquetype or -1].BagSlot = i; end end end -- we equip for key,value in pairs(result) do local item; if not BagSlot <= 21 then item:use(); end end end local function addEffects(tabel, address, dura) dura = dura or 1 local place = 0 local effectId = memoryReadInt(getProc(),address+0xB8) while effectId > 0 do if CLASS_EFFECT[player.Class1][effectId] then local size = memoryReadInt(getProc(),address+0xB8+place+0x28) for eff,mul in pairs (CLASS_EFFECT[player.Class1][effectId]) do tabel[eff] = (tabel[eff] or 0) + size * mul * dura end else tabel[effectId] = (tabel[effectId] or 0) + memoryReadInt(getProc(),address+0xB8+place+0x28)* dura end place = place + 4 effectId = memoryReadInt(getProc(),address+0xB8+place) end end function getRaterDataById(id,exclude_stats) local tmp = {} tmp.Id = id tmp.Name = GetIdName(id) tmp.BaseItemAddress = GetItemAddress(id) if tmp.BaseItemAddress == nil or tmp.BaseItemAddress == 0 then return tmp end tmp.ObjType = memoryReadInt(getProc(),tmp.BaseItemAddress+0x78) tmp.ObjSubType = memoryReadInt(getProc(),tmp.BaseItemAddress+0x7C) tmp.ObjSubSubType = memoryReadInt(getProc(),tmp.BaseItemAddress+0x80) -- is equipment if (tmp.ObjType == 0 and tmp.ObjSubType ~= -1 and (tmp.ObjSubType ~= 5 or tmp.ObjSubSubType == 1) and tmp.ObjSubType ~= 6 and tmp.ObjSubType ~= 7) or (tmp.ObjType == 1 and tmp.ObjSubType ~= 6 and tmp.ObjSubType ~= 7) then if tmp.ObjType == 0 then -- Weapon tmp.Speed = memoryReadInt(getProc(),tmp.BaseItemAddress+0x190)/10 end tmp.RequiredLvl = memoryReadInt(getProc(),tmp.BaseItemAddress+0x58) tmp.Value = memoryReadInt(getProc(),tmp.BaseItemAddress+0x34) tmp.Effects = {} -- Base item effects addEffects(tmp.Effects, tmp.BaseItemAddress) -- Base item stat effects tmp.StatCount = 0 if exclude_stats ~= true then for i = 1, 6 do local statId = memoryReadUInt( getProc(), tmp.BaseItemAddress + 0x114 + 0x8*(i-1) ); if statId == 0 then -- No More stats break end tmp.StatCount = tmp.StatCount + 1 local tmpidaddress = GetItemAddress(statId) addEffects(tmp.Effects,tmpidaddress) end end end printRater(tmp) return tmp end function getRaterDataByItem(item) local tmp = {} tmp.Id = item.Id tmp.Name = item.Name tmp.Address = item.Address tmp.BaseItemAddress = item.BaseItemAddress tmp.ObjType = item.ObjType tmp.ObjSubType = item.ObjSubType tmp.ObjSubSubType = item.ObjSubSubType if (tmp.ObjType == 0 and tmp.ObjSubType ~= -1 and (tmp.ObjSubType ~= 5 or tmp.ObjSubSubType == 1) and tmp.ObjSubType ~= 6 and tmp.ObjSubType ~= 7) or (tmp.ObjType == 1 and tmp.ObjSubType ~= 6 and tmp.ObjSubType ~= 7) then if tmp.ObjType == 0 then -- Weapon tmp.Speed = memoryReadInt(getProc(),tmp.BaseItemAddress+0x190)/10 end local dura = 1.0 if item.Durability > 100 or item.Durability > item.MaxDurability then dura = 1.2 end local plusQuality = memoryReadByte( getProc(), item.Address + addresses.qualityTierOffset ); local quality, tier = math.modf ( plusQuality / 16 ); tier = tier * 16 - 10; tmp.RequiredLvl = item.RequiredLvl tmp.Value = item.Value tmp.Effects = {} -- Base item effects addEffects(tmp.Effects, tmp.BaseItemAddress, dura) -- Apply tier bonus to damage and defence. Before stat and runes effects are added. if tier ~= 0 then if tmp.Effects[PDAM] then tmp.Effects[PDAM] = tmp.Effects[PDAM] + (tmp.Effects[PDAM]*0.1 * tier) elseif tmp.Effects[PDAM] then tmp.Effects[MDAM] = tmp.Effects[MDAM] + (tmp.Effects[MDAM]*0.1 * tier) elseif tmp.Effects[PDAM] then tmp.Effects[PDEF] = tmp.Effects[PDEF] + (tmp.Effects[PDEF]*0.1 * tier) elseif tmp.Effects[PDAM] then tmp.Effects[MDEF] = tmp.Effects[MDEF] + (tmp.Effects[MDEF]*0.1 * tier) end end -- Stat effects tmp.StatCount = #item.Stats for k,v in pairs(item.Stats) do local statBaseAddress = GetItemAddress(v.Id) addEffects(tmp.Effects, statBaseAddress, dura) end -- Rune effects for k,v in pairs(item.Runes) do local runeBaseAddress = GetItemAddress(v.Id) addEffects(tmp.Effects,runeBaseAddress, dura) end -- Plus value local plus = memoryReadUByte(getProc(), item.Address + 0x17) if plus > 0 then local tmpid = memoryReadInt(getProc(), item.BaseItemAddress+0x3AC) + plus local tmpidaddress = GetItemAddress(tmpid) addEffects(tmp.Effects, tmpidaddress, dura) end end printRater(tmp) return tmp end function printRater(tmp) print("=========================================") printf("%s, Id %d, BaseItemAddress %X\n",tmp.Name,tmp.Id,tmp.BaseItemAddress) print("-----------------------------------------") if tmp.Address then printf("Address\t%X\n",tmp.Address) end printf("\tObject types\t%s\t%s\t",itemtypes[tmp.ObjType].Name,itemtypes[tmp.ObjType][tmp.ObjSubType].Name) if itemtypes[tmp.ObjType][tmp.ObjSubType][tmp.ObjSubSubType] then print(itemtypes[tmp.ObjType][tmp.ObjSubType].Name) else print() end print("\tRequired level", tmp.RequiredLvl) print("\tValue",tmp.Value) if tmp.Speed then print("\tSpeed",tmp.Speed) end print("\tEffects:") for k,v in pairs(tmp.Effects) do print("\t\t+"..v,getTEXT("SYS_WEAREQTYPE_"..k)) end end