[OpenEUO] Equipment Evaluator/Shop Searcher (beta)

If you make a Client-side script you can publish it here for other players to use
Locked
davvol
Passer by
Posts: 3
Joined: Sun Jun 05, 2011 1:23 pm

[OpenEUO] Equipment Evaluator/Shop Searcher (beta)

Post by davvol »

Hi,

I have recently been working on a script to assess the stats of a targeted player (including yourself), as well as to help scan a vendor for stat equipment.

The script itself is still pretty raw, and there are plenty of rough edges for me to still round off, but feedback from people here would be great if anyone fancies playing with it.

Features:

* Provides a breakdown of equipment on the targeted player/vendor, reporting resists and various bonuses
* Takes the combined values and reports on whether they are above/below any caps based on this page

Things that will be added:
* Ability to sort it results
* Ability to filter results, showing only items matching the filters you have given
* Deep scan of vendors, searching all containers they are carrying
* Ability to click an item from the vendor results and 'buy this item'
* Possibly, ability to scan all vendors on screen, though unsure on whether I will implement this yet

Current Issues:
* Interface looks crappy
* Minimal error handling, though tends to behave pretty well
* No sanity checking on what you ask it to scan. If you ask it to scan a trapped container, don't blame me when your hair catches fire...

Requirements:
* Kal In Ex - FindItem for OpenEUO

Feel free to PM/reply here with any comments you may have...

Ok, the script itself:

Code: Select all

--==================================
-- Script Name: Equipment Evaluator
-- Author: Davvol
-- Version: 0.5
-- OpenEUO version tested with: 0.91
-- Purpose: Scan players/vendors, reporting on equipment stats/caps
--==================================


function init_vars()
physrt=0
physmax=70
firert=0
firemax=70
coldrt=0
coldmax=70
poisonrt=0
poisonmax=70
energyrt=0
energymax=70
dirt=0
dimax=100
hcirt=0
hcimax=45
dcirt=0
dcimax=65
ssirt=0
ssimax=60
hmlrt=0
hmlmax=100
fcrt=0
fcmax=4
fcrrt=0
fcrmax=6
mrrt=0
mrmax=35
lmcrt=0
lmcmax=40
rprt=0
rpmax=105

statpass=0x33cc33
statfail=0x0033cc


formwidth=800
formheight=600
end

function get_stat(details,string)
   tmpstring=string.match (details, string)
   if tmpstring then
      return tmpstring
   else
      return(0)
   end
end

function check_resists(details)
   physical=get_stat(details,'Physical Resist (%d+)')
   physrt=physrt+physical
   fire=get_stat(details,'Fire Resist (%d+)')
   firert=firert+fire
   cold=get_stat(details,'Cold Resist (%d+)')
   coldrt=coldrt+cold
   poison=get_stat(details,'Poison Resist (%d+)')
   poisonrt=poisonrt+poison
   energy=get_stat(details,'Energy Resist (%d+)')
   energyrt=energyrt+energy
   
end

function check_caster(details)
   fc=get_stat(details,'Faster Casting (%d+)')
   fcrt=fcrt+fc
   fcr=get_stat(details,'Faster Cast Recovery (%d+)')
   fcrrt=fcrrt+fcr
   mr=get_stat(details,'Mana Regeneration (%d+)')
   mrrt=mrrt+mr
   lmc=get_stat(details,'Lower Mana Cost (%d+)')
   lmcrt=lmcrt+lmc
end

function check_hits(details)
   di=get_stat(details,'Damage Increase (%d+)')
   dirt=dirt+di
   hci=get_stat(details,'Hit Chance Increase (%d+)')
   hcirt=hcirt+hci
   dci=get_stat(details,'Defense Chance Increase (%d+)')
   dcirt=dcirt+dci
   ssi=get_stat(details,'Swing Speed Increase (%d+)')
   ssirt=ssirt+ssi
   hml=get_stat(details,'Hit Mana Leech (%d+)')
   hmlrt=hmlrt+hml
   rp=get_stat(details,'Reflect Physical Damage (%d+)')
   rprt=rprt+rp
end


function spacer()
   print("")
   print("===")
   print("")
end

function MyCloseHandler()
Obj.Exit()
end

function create_row(row,name,physical,fire,cold,poison,energy,DI,HCI,DCI,SSI,HML,RP,FC,FCR,MR,LMC,sum)
space=180
spacing=30
print("Row: "..row)
label[row]={}
label[row][1] = Obj.Create("TLabel")   --create a TButton object 
label[row][1].Caption = name 
label[row][1].Left = 10
label[row][1].Top = 20*row 
if sum==1 then
   label[row][1].Parent = total_group
elseif sum==2 then
   label[row][1].Parent = item_group
else
   label[row][1].Parent = item_group2 
end 


space=space+spacing
label[row][2] = Obj.Create("TLabel")   --create a TButton object 
label[row][2].Caption = ""..physical 
label[row][2].Left = space
label[row][2].Top = 20*row 
label[row][2].Width=30
if sum==1 then
   label[row][2].Parent = total_group
   if physical>=physmax then
      label[row][2].Color=statpass 
   else
      label[row][2].Color=statfail
   end
elseif sum==2 then
   label[row][2].Parent = item_group
else
   label[row][2].Parent = item_group2 
end 
       
space=space+spacing
label[row][3] = Obj.Create("TLabel")   --create a TButton object 
label[row][3].Caption = ""..fire 
label[row][3].Left = space
label[row][3].Top = 20*row 
label[row][3].Width=30
if sum==1 then
   label[row][3].Parent = total_group
   if fire>=firemax then
      label[row][3].Color=statpass 
   else
      label[row][3].Color=statfail
   end
elseif sum==2 then
   label[row][3].Parent = item_group
else
   label[row][3].Parent = item_group2 
end 
     
space=space+spacing
label[row][4] = Obj.Create("TLabel")   --create a TButton object 
label[row][4].Caption = ""..cold 
label[row][4].Left = space
label[row][4].Top = 20*row
label[row][4].Width=30
if sum==1 then
   label[row][4].Parent = total_group
   if cold>=coldmax then
      label[row][4].Color=statpass 
   else
      label[row][4].Color=statfail
   end 
elseif sum==2 then
   label[row][4].Parent = item_group
else
   label[row][4].Parent = item_group2 
end 
         
space=space+spacing
label[row][5] = Obj.Create("TLabel")   --create a TButton object 
label[row][5].Caption = ""..poison 
label[row][5].Left = space
label[row][5].Top = 20*row
label[row][5].Width=30
if sum==1 then
   label[row][5].Parent = total_group
   if poison>=poisonmax then
      label[row][5].Color=statpass 
   else
      label[row][5].Color=statfail
   end 
elseif sum==2 then
   label[row][5].Parent = item_group
else
   label[row][5].Parent = item_group2 
end 
     
space=space+spacing
label[row][6] = Obj.Create("TLabel")   --create a TButton object 
label[row][6].Caption = ""..energy 
label[row][6].Left = space
label[row][6].Top = 20*row 
label[row][6].Width=30
if sum==1 then
   label[row][6].Parent = total_group
   if energy>=energymax then
      label[row][6].Color=statpass 
   else
      label[row][6].Color=statfail
   end   
elseif sum==2 then
   label[row][6].Parent = item_group
else
   label[row][6].Parent = item_group2 
end 
  
space=space+spacing
label[row][7] = Obj.Create("TLabel")   --create a TButton object 
label[row][7].Caption = ""..DI
label[row][7].Left = space
label[row][7].Top = 20*row
label[row][7].Width=30
if sum==1 then
   label[row][7].Parent = total_group
   if DI>=dimax then
      label[row][7].Color=statpass 
   else
      label[row][7].Color=statfail
   end   
elseif sum==2 then
   label[row][7].Parent = item_group
else
   label[row][7].Parent = item_group2 
end 
   
space=space+spacing
label[row][8] = Obj.Create("TLabel")   --create a TButton object 
label[row][8].Caption = ""..HCI 
label[row][8].Left = space
label[row][8].Top = 20*row
label[row][8].Width=30
if sum==1 then
   label[row][8].Parent = total_group
   if HCI>=hcimax then
      label[row][8].Color=statpass 
   else
      label[row][8].Color=statfail
   end    
elseif sum==2 then
   label[row][8].Parent = item_group
else
   label[row][8].Parent = item_group2 
end 
     
space=space+spacing
label[row][9] = Obj.Create("TLabel")   --create a TButton object 
label[row][9].Caption = ""..DCI 
label[row][9].Left = space
label[row][9].Top = 20*row
label[row][9].Width=30
if sum==1 then
   label[row][9].Parent = total_group
   if DCI>=dcimax then
      label[row][9].Color=statpass 
   else
      label[row][9].Color=statfail
   end    
elseif sum==2 then
   label[row][9].Parent = item_group
else
   label[row][9].Parent = item_group2 
end 
     
space=space+spacing
label[row][10] = Obj.Create("TLabel")   --create a TButton object 
label[row][10].Caption = ""..SSI 
label[row][10].Left = space
label[row][10].Top = 20*row
label[row][10].Width=30
if sum==1 then
   label[row][10].Parent = total_group
   if SSI>=ssimax then
      label[row][10].Color=statpass 
   else
      label[row][10].Color=statfail
   end    
elseif sum==2 then
   label[row][10].Parent = item_group
else
   label[row][10].Parent = item_group2 
end 
  
space=space+spacing
label[row][11] = Obj.Create("TLabel")   --create a TButton object 
label[row][11].Caption = ""..HML 
label[row][11].Left = space
label[row][11].Top = 20*row
label[row][11].Width=30
if sum==1 then
   label[row][11].Parent = total_group
   if HML>=hmlmax then
      label[row][11].Color=statpass 
   else
      label[row][11].Color=statfail
   end     
elseif sum==2 then
   label[row][11].Parent = item_group
else
   label[row][11].Parent = item_group2 
end 
   
space=space+spacing
label[row][12] = Obj.Create("TLabel")   --create a TButton object 
label[row][12].Caption = ""..RP
label[row][12].Left = space
label[row][12].Top = 20*row
label[row][12].Width=30
if sum==1 then
   label[row][12].Parent = total_group
   if RP>=rpmax then
      label[row][12].Color=statpass 
   else
      label[row][12].Color=statfail
   end    
elseif sum==2 then
   label[row][12].Parent = item_group
else
   label[row][12].Parent = item_group2 
end 
   
space=space+spacing
label[row][13] = Obj.Create("TLabel")   --create a TButton object 
label[row][13].Caption = ""..FC 
label[row][13].Left = space
label[row][13].Top = 20*row
label[row][13].Width=30
if sum==1 then
   label[row][13].Parent = total_group
   if FC>=fcmax then
      label[row][13].Color=statpass 
   else
      label[row][13].Color=statfail
   end         
elseif sum==2 then
   label[row][13].Parent = item_group
else
   label[row][13].Parent = item_group2 
end 
     
space=space+spacing
label[row][14] = Obj.Create("TLabel")   --create a TButton object 
label[row][14].Caption = ""..FCR 
label[row][14].Left = space
label[row][14].Top = 20*row
label[row][14].Width=30
if sum==1 then
   label[row][14].Parent = total_group
   if FCR>=fcrmax then
      label[row][14].Color=statpass 
   else
      label[row][14].Color=statfail
   end     
elseif sum==2 then
   label[row][14].Parent = item_group
else
   label[row][14].Parent = item_group2 
end 
    
space=space+spacing
label[row][15] = Obj.Create("TLabel")   --create a TButton object 
label[row][15].Caption = ""..MR 
label[row][15].Left = space
label[row][15].Top = 20*row
label[row][15].Width=30
if sum==1 then
   label[row][15].Parent = total_group
   if MR>=mrmax then
      label[row][15].Color=statpass 
   else
      label[row][15].Color=statfail
   end        
elseif sum==2 then
   label[row][15].Parent = item_group
else
   label[row][15].Parent = item_group2 
end 
   
space=space+spacing
label[row][16] = Obj.Create("TLabel")   --create a TButton object 
label[row][16].Caption = ""..LMC 
label[row][16].Left = space
label[row][16].Top = 20*row
label[row][16].Width=30
if sum==1 then
   label[row][16].Parent = total_group
   if LMC>=lmcmax then
      label[row][16].Color=statpass 
   else
      label[row][16].Color=statfail
   end    
elseif sum==2 then
   label[row][16].Parent = item_group
else
   label[row][16].Parent = item_group2 
end  


row=row+1
print("Next row: "..row)
return(row)
end

function init_display()
label={}
row=1
form = Obj.Create("TForm")       --create a TForm object 
form.Caption = "Item Results"     --assign window title 
form.OnClose = MyCloseHandler    --assign event handler function
form.Width = formwidth
form.Height = formheight
form.FormStyle = 3 
form.BorderStyle = 3
form.BorderIcons = 1 




item_group=Obj.Create("TGroupBox")
item_group.Caption="Item Stats"
item_group.Width=750
item_group.Parent=form


item_panel=Obj.Create("TPanel")
item_panel.Parent=item_group
item_panel.Top=40
item_panel.Left=3
item_panel.Width=730
item_panel.Height=380
item_panel.BorderStyle=0
item_panel.BevelWidth=0
item_panel.BorderWidth=0

ig2top=0

item_group2=Obj.Create("TPanel")
item_group2.Parent=item_panel
item_group2.Top=ig2top
item_group2.Left=0
item_group2.Width=720
item_group2.BorderStyle=0
item_panel.BevelWidth=0
item_group2.BorderWidth=0


total_group=Obj.Create("TGroupBox")
total_group.Caption="Totals"
total_group.Width=750
total_group.Height=40
total_group.Parent=form

--button=Obj.Create("TButton")
--button.Caption="Change Border"
--button.OnClick=changeborder
--button.Parent=form

border=0







row=create_row(row," Name"," Ph"," Fi"," Co"," Po"," En"," DI"," HCI"," DCI"," SSI"," HML"," RP"," FC"," FCR"," MR"," LMC",2)
row=0
end

function changeborder()
    item_panel.BorderStyle=border
    item_group2.BorderStyle=border
    button.Caption="Border type: "..border
    border=border+1
    
end


function itemmove()
      ig2top=0-(scrollbar.Position*20)
      item_group2.Top=ig2top
end


function print_results()
igheight=20*row
item_group2.Height=20*row
scrollmax=0
if igheight>400 then
   print("Applying scrollbar")
   scrollbar=Obj.Create("TScrollBar")
   scrollbar.Kind=1
   scrollbar.Top=10
   scrollbar.Left=728
   scrollbar.Min=0
   scrollbar.Parent = item_group
   scrollbar.OnChange=itemmove
   scrollmax=row-20
   igheight=400
   scrollbar.Max=scrollmax
   scrollbar.Height=igheight+48
end

item_group.Height=igheight+62
total_group.Top=igheight+90


row=1

--row=create_row(row,"","Ph","Fi","Co","Po","En","DI","HCI","DCI","SSI","HML","RP","FC","FCR","MR","LMC",1)
row=create_row(row,"Total",physrt,firert,coldrt,poisonrt,energyrt,dirt,hcirt,dcirt,ssirt,hmlrt,rprt,fcrt,fcrrt,mrrt,lmcrt,1)
   
form.Show()                      --call Show method 
Obj.Loop()
Obj.Free(form)
end


dofile("FindItems.lua")
run=1
UO.SysMessage("Equipment Evaluator started")
UO.SysMessage("Press F8 to scan a target")
while run==1 do
init_vars()
           local bpressed = getkey("F8")
           if bpressed == true then

UO.TargCurs=true
while UO.TargCurs==true do
      wait(10)
end
init_display()
print("")
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
print("")
if UO.LTargetID~=UO.CharID then
target=UO.LTargetID
print("Target is "..target)
UO.LObjectID=target
UO.Macro(17,0)
wait(300)
check_id=UO.ContID
else
print("Target is player")
check_id=UO.CharID
end
t = ScanItems(true,{ContID=check_id})
if #t>0 then
   for i=1,#t do
      if t[i].Name~="" then
      check_resists(t[i].Details)
      check_hits(t[i].Details)
      check_caster(t[i].Details)
      row=create_row(row,t[i].Name,physical,fire,cold,poison,energy,di,hci,dci,ssi,hml,rp,fc,fcr,mr,lmc,0)
      end
   end
end

print_results()
end
end
Locked