StatRating: Better Equipment Swapper

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Message
Author
User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

StatRating: Better Equipment Swapper

#1 Post by MiesterMan » Fri Jun 10, 2011 7:47 pm

StatRating Runes of Magicaddon RoMBot companion:
This is a bot addon that works off of the game addon StatRating: http://rom.curse.com/downloads/rom-addo ... ating.aspx. It pulls tooltip info that has comparative information and swaps the gear you're wearing for better gear you've looted or otherwise aquired.

**NEEDS TESTING**
I was able to verify that StatRating is working but haven't had the oppurtunity to test if this userfunction is working since I made changes. Please let me know.


Please feel free to change, update, and correct anything I've got wrong. And please post your feedback so I can fix it.

Currently it does not:
Compare ammunition damage - It will only load if empty and the right class.
Factor in heal amounts - It does however calc magic damage difference for magic classes.
Wear amulets - couldn't get any to test it.
Wear wings or other backslot items - again, none available to test it.

I haven't tested the ranged weapon swapping ability but I believe it works (same code as the other DPS weapons).
  • Two Parts to Install: (Download them below)
  • The file that goes in your "...MicroMacro\Scripts\rom\userfunctions" folder
    • addon_SRSwap.lua
  • The Morefunctions addon installed to "C:\Program Files (x86)\Runes of Magic\interface\addons\morefunctions":
    • morefunctions.lua
    • morefunctions.toc
UPDATE: This is far from the product I'd like to present. But as it stands I don't play all that much and I don't have the time to do elaborate memory mappings. I would like to get some stub functions made for when the information can be pulled from memory to help calculate values if anyone is interested in assisting (or if you think you can write the code to find and pull tooltips from memory that would be tremendously helpful). I promised that I'd have a working version up a long time ago but failed to provide; therefore I'm posting this quickfix version.
Attachments
morefunctions.zip
The Morefunctions addon should be unzipped to "C:\Program Files (x86)\Runes of Magic\interface\addons\morefunctions":
(791 Bytes) Downloaded 236 times
addon_SRSwap.lua
The file that goes in your "...MicroMacro\Scripts\rom\userfunctions" folder
(20.84 KiB) Downloaded 258 times
Last edited by MiesterMan on Thu Sep 15, 2011 10:02 am, edited 3 times in total.

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: StatRating: Better Equipment Swapper

#2 Post by MiesterMan » Fri Jun 10, 2011 7:51 pm

-- V 0.0:
  • Problem: OD items being compared while UD, fix is to add a custom merchant func that repairs right before comparing, wearing, and selling
  • Problem: The existing SRSwap didn't account for primary+secondary. The format is different, I will need to redo a portion of the compare func
  • Problem: The information has to be pulled through IGF, I'm working on a solution but it's a long ways out
    Because of the issue with compare, I'm afraid people might get their weapons swapped and lose some expensive offhand that wasn't accounted for so I've removed it for now.
-- V 0.1:
  • Added custom merchant function
  • No longer swaps primary if secondary is present (temp fix)
  • Problem: The information has to be pulled through IGF, I'm working on a solution but it's a long ways out (not fixed)

Code: Select all

Also, props to the creators of "commandline.xml", I wouldn't have stuck with it if I couldn't test all my boorish code for failure via this tool.  :P
Last edited by MiesterMan on Thu Sep 15, 2011 9:52 am, edited 2 times in total.

kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: StatRating: Better Equipment Swapper

#3 Post by kanta » Sat Jun 11, 2011 1:23 am

Grats on the success :)

I'd check it out but right now I'm butting my head against a wall and wondering what possessed me to begin coding a pet feeding menu system for golden eggs....
Scout/Knight/Rogue 70/66/66

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: StatRating: Better Equipment Swapper

#4 Post by rock5 » Sat Jun 11, 2011 3:24 am

MiesterMan wrote:Also, props to the creators of "commandline.xml", I wouldn't have stuck with it if I couldn't test all my boorish code for failure via this tool. :P
Thank you. :)
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

squeekthegeek
Posts: 25
Joined: Mon Nov 08, 2010 1:50 pm

Re: StatRating: Better Equipment Swapper

#5 Post by squeekthegeek » Tue Jun 21, 2011 4:04 pm

StatRating is broken since Chapter IV

here'e the fix:

<StatRating.lua>

Lines 50-51 change the 1 for a 0

Code: Select all

elseif(arg == "DPS") then
    SRC_guess_dps(0);
Lines 526-577 comment everything(or just delete)

Code: Select all

-- DPS Support for the weapon line
    --if side == "L" and completeTip["Right"][index] ~= nil and completeTip["Right"][index]["text"] ~= nil then -- ohne Attackspeed kein DPS
    --  local PDmg_name = SRC_Texts.Summary.PDmg[1];
    --  local speed_name = SRC_Texts.Summary.Speed;

    --  if PDmg_name ~= "TODO!" and speed_name ~= "TODO!" then
    --   local pos_PDmg = string.find(text, PDmg_name);
    --    local pos_speed = string.find(completeTip["Right"][index]["text"], speed_name);
    --    local len_dmg = string.len(PDmg_name);
    --    local len_speed = string.len(speed_name);
    --    if pos_PDmg ~= nil and pos_speed ~= nil then
    --      local dmg = string.sub(text, pos_PDmg + len_dmg + 1);
    --      local as = string.sub(completeTip["Right"][index]["text"], pos_speed + len_speed + 1);
    --     if (string.sub(dmg, 1, 1) == "|") then dmg = string.sub(dmg, 11); end;
    --      if (string.find(dmg, '|') ~= nil) then dmg = string.sub(dmg, 1, string.find(dmg, '|')-1); end;
    --      if (string.sub(as, 1, 1)  == "|") then as = string.sub(as, 11); end;
    --      if (string.find(as, '|')  ~= nil) then as = string.sub(as, 1, string.find(as, '|')-1); end;
    --      self:tableAddNumericValue(self.tbl_sumEffectStats, 'PDmg', dmg);
    --      local dpsValue = r(((tonumber(dmg)) / (tonumber(as))), 2);
          -- DPS in die Zusammenfassung reinnehmen
    --      if splitSum then
    --        if self.tbl_sumEffectStats.DPS == nil then
    --          if(my_got_dura == true and my_dura_min ~= nil) then
    --            if(my_dura_min > 100) then --it's high dura allright
    --              self.tbl_sumEffectStats.DPS = dpsValue * my_dura_rate;
    --            else
    --              self.tbl_sumEffectStats.DPS = dpsValue;
    --            end
    --          else
    --            self.tbl_sumEffectStats.DPS = dpsValue;
    --          end
    --        else
    --          if(my_got_dura == true and my_dura_min ~= nil) then
    --            if(my_dura_min > 100) then       --it's high dura allright
    --              self.tbl_sumEffectStats.DPS = (self.tbl_sumEffectStats.DPS + (dpsValue * my_dura_rate));
    --            else
    --              self.tbl_sumEffectStats.DPS = self.tbl_sumEffectStats.DPS + dpsValue;
    --            end
    --          else
    --            self.tbl_sumEffectStats.DPS = self.tbl_sumEffectStats.DPS + dpsValue;
    --          end
    --        end;
    --      end;
    --      if(my_got_dura == true and my_dura_min ~= nil) then
    --        if((my_dura_min > 100) and my_hammered == false) then  --it's high dura allright
    --          return SRC_Texts.Summary.PDmg[1] .. " |cffffff00" .. string.format("%.0f",tonumber(dmg * my_dura_rate)) .." ("..tostring(dpsValue*my_dura_rate)..' DPS)|r';
    --        end
    --      end
    --      return text.."|cff"..rateColor.." ("..tostring(dpsValue)..' DPS)|r';
    --    end;
    --  end;
    --end;
Lines 1055-1062, or whatever it is if you deleted the previous lines... change to 2 for a 0

Code: Select all

function StatRating_OnEvent(event)
  if event == "VARIABLES_LOADED" then
    StatRating_registerAddonManager();
  end;
  if event == "PLAYER_BAG_CHANGED" then
  SRC_guess_dps(0);
  end;
end;
I attached the working StatRating.lua
Attachments
StatRating.lua
(42.38 KiB) Downloaded 192 times

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: StatRating: Better Equipment Swapper

#6 Post by MiesterMan » Tue Jun 21, 2011 6:37 pm

Thanks, I'll give it a try!

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: StatRating: Better Equipment Swapper

#7 Post by MiesterMan » Tue Jun 28, 2011 8:52 am

Update: I have a working fix of StatRating now but for some reason it doesn't always show stats. I can't do it right now but I think I can get this UF working again if only for the gear.

Note: I also want to add comparing and choosing quest rewards with this. I will update when I've made some progress.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: StatRating: Better Equipment Swapper

#8 Post by rock5 » Tue Jun 28, 2011 9:08 am

I've started using a version I found that is fixed for 4.0.0
https://forum.runesofmagic.com/showthre ... 761&page=1
It is based on the fan update version.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

erikasha
Posts: 1
Joined: Mon Jul 04, 2011 6:45 am

Re: StatRating: Better Equipment Swapper

#9 Post by erikasha » Mon Jul 04, 2011 6:50 am

MiesterMan wrote:Update: I have a working fix of StatRating now but for some reason it doesn't always show stats. I can't do it right now but I think I can get this UF working again if only for the gear.

Note: I also want to add comparing and choosing quest rewards with this. I will update when I've made some progress.
hmm thanks dud. :)


material handling equipment

dillonchem.com/c-15-material-handling-equipment.aspx
Last edited by erikasha on Wed Jul 06, 2011 4:24 am, edited 1 time in total.

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: StatRating: Better Equipment Swapper

#10 Post by MiesterMan » Mon Jul 04, 2011 1:20 pm

Again sorry. I should have this working some time next week.

Adi21
Posts: 1
Joined: Fri Sep 09, 2011 11:40 pm

Re: StatRating: Better Equipment Swapper

#11 Post by Adi21 » Fri Sep 09, 2011 11:43 pm

Thank you very much taking time to help!!!!

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: StatRating: Better Equipment Swapper

#12 Post by MiesterMan » Thu Sep 15, 2011 10:06 am

Well, I'm only a month late... I readded the quickfixed version. I'm unsatisfied with the end product but since I've been unable to find a pattern that will allow to me find tooltips from memory I can't really complain. The update has not been tested, so be careful and test before comitting it to scripts. If anything is wrong let me know in this thread.

imaginethat
Posts: 61
Joined: Sun Jul 10, 2011 10:39 pm

Re: StatRating: Better Equipment Swapper

#13 Post by imaginethat » Mon Dec 19, 2011 9:21 pm

Hi
I am aware this may not be a completely polished function, but it sounds like the general functionality of this should be working.

I have just implemented it for the first time and already have an issue. I was wondering if there is any assistance for this function, or its at a "as is basis".

I have downloaded the Morefunctions addon, and added it to *gamefolder*\interface\addons\morefunctions
I have downloaded the SRswap.lua file and added to *MM*\scripts\rom\userfunctions
I have downloaded and installed the StatRating addon, and added to *gamefolder*\interface\addons\statrating (the link posted by rock5)

I have added a single "srCheckSwap()" into my waypoint file, and when the function ran for the first time it came up with error : ...icromacro/scripts/rom/userfunctions/addon_SRSwap.lua:104: attempt to index field '?' (a nil value)

The line it seems to be talking about is

Code: Select all

equipItemData[i].Empty = true;
I am lost as to where to even start.

I have items in my bag that can be equiped. I have most items on my char equiped, but not all (head, earing, neacklace, shield)

Can anyone point me in the right direction?

Thanks

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: StatRating: Better Equipment Swapper

#14 Post by rock5 » Mon Dec 19, 2011 10:19 pm

This has too many diverse out of date pieces of code, so I think it will be too much trouble to get working.

I'm actually planning to add this functionallity myself using a different method. I'm planning to rate gear based on items regular tooltip. So it will be rating based on stam,dex,str,wis,hp,mp,patt,matt,def,mdef on the gear. Also it will also take into account if a class can use the gear. The reason I want to add this functionballity is because I want to be able to rate quest rewards before selecting them. Deciding how to rate the different stats per class is going to take some doing and probably require some community involvement.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

imaginethat
Posts: 61
Joined: Sun Jul 10, 2011 10:39 pm

Re: StatRating: Better Equipment Swapper

#15 Post by imaginethat » Tue Dec 20, 2011 2:46 pm

thanks for your reply rock5, I thought it might be a case of 'out of date'
I look forward to what you come up with. I would love to offer my help, but I have only a basic understanding of lua, I think it would be way out of my depth.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: StatRating: Better Equipment Swapper

#16 Post by rock5 » Tue Dec 20, 2011 7:56 pm

I've worked out most of the building blocks I'll need to do it and done a bit of the coding but my nephew came over yesterday and he's still here today. I find it hard to get anything done with him here. I'll see if I can wrangle some 'me time' today to work on it. :)

Edit: Nearly forget to say, Christmas is nearly here so preparations for that will occupy some of my time too.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: StatRating: Better Equipment Swapper

#17 Post by MiesterMan » Wed Dec 21, 2011 9:34 pm

I'd actually been holding off to work on this till I had a better picture of where everything stands. While exploring the values of the stats on gear I got from reading the existing code for locating stats, I found that all stats are related on the same index and it goes from 1-200 or something like that. Since some are looking into it I'll post what little I've done. (The real reason is that this relates to skills, buffs, stats, and a few other things that slip my mind. The offsets are different and in different tables but the index is the same.)

Try not to let this mess of information be too confusing, not sure how much I commented it:

Code: Select all

-- This works with item stats and single value runes.
-- To find the second value, goto the Item Address in
-- cheat engine's memory view and look for offsets.
function PrintStat(itemId)
	if itemId ~= nil and itemId > 0 then
		local itemAddress = GetItemAddress(itemId)
		if itemAddress ~= nil and itemAddress > 0 then
			local nameAddress = memoryReadInt(getProc(), itemAddress + addresses.nameOffset)
			local name = memoryReadString(getProc(), nameAddress)
			local statIndex = memoryReadInt(getProc(), itemAddress + 0xB8)
			local statValue = memoryReadInt(getProc(), itemAddress + 0xE0)
			printf("Name Address:  0x%x \nItem Address:  0x%x \nItem ID:  %d\nName:  %s\nStat Index:  %d\nStat Value:  %d\n",nameAddress,itemAddress,itemId,name, statIndex, statValue);
		end
	end
end

-- Type is the index I mentioned, enumerated below
-- type offsets - 0xB8, 0xBC, 0xC0
-- amount offsets - 0xE0, 0xE4, 0xE8

-- 1 is 
-- 2 is STR
-- 3 is STA
-- 4 is INT
-- 5 is WIS
-- 6 is DEX
-- 7 is All Attributes
-- 8 is HP
-- 9 is MP
-- 10 is HP Recovery
-- 11 is MP Recovery
-- 12 is PA
-- 13 is PDef
-- 14 is MDef
-- 15 is MA
-- 16 is 
-- 17 is Dodge Rate
-- 18 is PCrit
-- 19 is 
-- 20 is MCrit
-- 21 is 
-- 22 is 
-- 23 is Attack Speed
-- 24 is 
-- 25 is PDamage
-- 26 is All Resists
-- 27 is Earth Resist
-- 28 is Water Resist
-- 29 is Fire Resist
-- 30 is Wind Resist
-- 31 is Light Resist
-- 32 is Dark Resist
-- 33 is 
-- 34 is Exp Rate
-- 35 is Drop Rate
-- 51 is Spellcasting Delay
-- 138 is Aggro (signed int)
-- 191 is MDamage
-- 197 is Physical Accuracy
-- 199 is Magical Accuracy
If you want to continue finishing out this list, you can. Just find the offsets for buff tables, modify the function at the top of the code, and look up the buff ID's in itempreview. It's the fastest way to go through the valid ID's, without regurgitating info back and forth from memory view.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: StatRating: Better Equipment Swapper

#18 Post by rock5 » Wed Dec 21, 2011 10:45 pm

That's excellent. That's the info that you need to rate the item. I had trouble going into that much detail when I added the .Stats to the items awhile ago.

To get the name of the types you can use this

Code: Select all

print(RoMScript("TEXT('SYS_WEAREQTYPE_type')")
Unfortunately, I don't think I can use that to rate quest rewards as I haven't been able to get ids or addresses or anything like that. All I can get is the tooltip info. So I'll be limited to using names not ids. I'm still not sure how it will work but I suspect it would be useful to get the type names from memory too. I don't know if that's possible though.

Actually we will probably only be interrested in a limited number of stats for rating as it will mainly be used for low level characters and scripts so we could use the command above to get them at the start then remember them.

Hm... I was going to just use tooltips for my rating function but now I'll have to rethink it.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: StatRating: Better Equipment Swapper

#19 Post by MiesterMan » Thu Dec 22, 2011 3:58 am

That's one of the things I was looking into in the tables for quest info. I just didn't dig far enough in yet.

While the stat info feels like a big leap, I've been unable to find some more crucial info for rating items.

I'll list some that would be needed:
MaxDura (is it OD or no?)
Plusses? (is it plussed and how much?)
Added Tiers? (is it tiered and how much?)
ghost stats (I just can't figure out where these are)

Pretty much everything in the info collection function is going to be needed type being one of them. How does print(RoMScript("TEXT('SYS_WEAREQTYPE_type')") work?

Too tired to look at it tonight but I'd suspect the likely indicator would be another index or some sort... but that's just guessing. If I peek into RoM's memory again I'll take a look.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: StatRating: Better Equipment Swapper

#20 Post by rock5 » Thu Dec 22, 2011 5:11 am

MiesterMan wrote:MaxDura (is it OD or no?)
The items.MaxDurability value will give you that. Until a short while ago it was only available to equiped items but I added it to inventory items too.
MiesterMan wrote:Plusses? (is it plussed and how much?)
Added Tiers? (is it tiered and how much?)
These values are specific to the item. They should be an offset of the items.address. We just don't save them.
MiesterMan wrote:ghost stats (I just can't figure out where these are)
Ghost stats, both the ones that come with items or the ones added when an item is plussed, would be the same for all similar items so they would be an offset of the baseitemaddress.

I hope that helps.

Let me clarify the difference between an items Address and BaseItemAddress, just in case you don't know. The item address is where you find the actual item. Offset from it, you will find values that are specific to that item, eg. dura, maxdura, stats, how many slots, runes, whether it's bound or not, and probably tier and plus amount. The baseitemaddress is where the values that are shared with every other item with the same id, is kept. eg. name, level, type, damage, armor, whether it's "binds on equip" or not, and maybe what ghost stats you get if you plus it. Consider the baseitemaddress where you get the basic description of the id, not the specific items.
MiesterMan wrote:How does print(RoMScript("TEXT('SYS_WEAREQTYPE_type')") work?
"SYS_WEAREQTYPE_2" is a text string that, when used with the TEXT function, returns a language specific name for "Strength". Pretty much everything that has a language specific name has a text string. In the past we have used

Code: Select all

RoMScript("TEXT('Sys123456_name')")
to get the name of an id. Of course we have an easier way to do it now. I use a couple of programs to find these strings, if your interested. I posted them a while ago so you can check them out.
http://www.solarstrike.net/phpBB3/viewt ... 258#p22258
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests