Page 1 of 2

Retrieve Physical or Magical Damage?

Posted: Thu Jun 04, 2015 9:24 am
by noobbotter
Is there a way to read/retrieve the amount of Physical Damage or Magical Damage of the bot? I don't mean damage done to something, but rather the stat that is based primarily on the weapon wielded.

Thanks.

Re: Retrieve Physical or Magical Damage?

Posted: Thu Jun 04, 2015 1:05 pm
by rock5
Not really. I believe they are calculated values. I actually did some work on a rating function. It turned out to be very complex extracting the information. Here it is if you want to check it out. There are 2 functions, 1 that returns the stats of your actual items and 1 that returns base stats based on an id. When you use the functions it prints out something like this.

Code: Select all

Command> getRaterDataByItem(equipment.BagSlot[15])
=========================================
Forsaken Sword, Id 213360, BaseItemAddress 368A4600
-----------------------------------------
Address 9EE5A8
        Object types    Weapons Swords  Swords
        Required level  65
        Value   33134
        Speed   2.4
        Effects:
                +549    Physical Attack
                +71.28  Defense
                +1338   Damage
                +214.08 Maximum HP
                +586.8  Magical Damage Points

Re: Retrieve Physical or Magical Damage?

Posted: Thu Jun 04, 2015 2:42 pm
by noobbotter
Yeah, Interesting function, but not quite what I was looking for. I'm basically Combining many of my different daily scripts by using one startup script which will call a particular set of dailies based on character HP (and hopefully damage capability). That way I won't send a level 50 Warlock that is used solely for buffing and has no equipment off to Jinner's camp to his death, whereas the lvl 56 Mage or Rogue that has 6000 HP and more than bare hand damage can handle doing some daily quests in those slightly tougher areas.

Ultimately, I'm going to make a large pool of dailies that any of my characters can run and will also allow me to not run 16 characters through a single spot one after another. I just need some checks and balances so I can ensure I don't send weak bots to tough areas.

Re: Retrieve Physical or Magical Damage?

Posted: Sun Jun 28, 2015 11:53 pm
by BlubBlab
I think you forgot to add the additional effect of the ALLATTR to add

Re: Retrieve Physical or Magical Damage?

Posted: Mon Jun 29, 2015 9:32 am
by noobbotter
I just found the function GetPlayerAbility in the ROM API list. I'm going to play around with this tonight as it looks like it will give me exactly what I'm looking for.

Re: Retrieve Physical or Magical Damage?

Posted: Wed Jul 01, 2015 3:07 am
by BlubBlab
I realized what I'm missing is the pdmg and the mdmg.(not stats) I'm not sure if it is bug or just missing but I would need those values from the weapons. Can you take a look into it Rock5 (fine dagger +8) ?

I have also another question also about the dagger off-hand at the moment I simple remove items before I equip this will work with everything but the off-hand at least manually it switch place with the main hand when equip instead of the off-hand is there a solution ?

Re: Retrieve Physical or Magical Damage?

Posted: Wed Jul 01, 2015 3:50 am
by rock5
I have a userfunction that rates weapons. Would you like to look at that? I don't remember exactly why I didn't post it. Probably because the logic to decide which equipment to use was too complex but the functions return all relevant data needed to rate it I think. The table it returns looks like this.

Code: Select all

table: 0A9702C8
Name:   Root of Nightmares
ObjSubType:     4
Address:        10413480
Id:     212500
BaseItemAddress:        116241920
Value:  34020
Effects:        table: 0A970318
        12:     7.8
        25:     2730.6
        191:    2128.8
        14:     10.8
        15:     1166.4
        8:      12
        9:      33.6
        20:     192
        31:     6
RequiredLvl:    60
ObjType:        0
Speed:  3.1
StatCount:      6
ObjSubSubType:  1
You'll notice the 'Effects' are listed my number instead of name. The included printRater function displays the data in a more user friendly output and gets used automatically every time one of the 2 functions are used. The print looks like this.

Code: Select all

=========================================
Root of Nightmares, Id 212500, BaseItemAddress 6EDB600
-----------------------------------------
Address 9EE5A8
        Object types    Weapons Staves  Staves
        Required level  60
        Value   34020
        Speed   3.1
        Effects:
                +7.8    Physical Attack
                +2730.6 Damage
                +2128.8 Magical Damage Points
                +10.8   Magical Defense
                +1166.4 Magical Attack
                +12     Maximum HP
                +33.6   Maximum MP
                +192    Magical Critical Hit Rate
                +6      Light Resistance
Hm... Looks like some of the values are wrong. Maybe some offsets have changed. If you're interested I'll make an effort to fix it.

Re: Retrieve Physical or Magical Damage?

Posted: Wed Jul 01, 2015 5:03 am
by BlubBlab
Yeah I need that^^

With this I can finish my scoring/auto-equip + cleanbag function after this I only need infos about quest-rewards with multiple choices(with this I could than finish my record-userfunction)

Re: Retrieve Physical or Magical Damage?

Posted: Thu Jul 02, 2015 10:07 pm
by BlubBlab
I played a bit around I realized what was missing seems the + level of the weapon.
I remember faintly that you and Lisa couldn't find the addressee for + level ? I tried to simply find the value but I would need some gold on the server to by 'cheap' + stones for searching which byte change(I think it is a byte or even a bit)

Re: Retrieve Physical or Magical Damage?

Posted: Thu Jul 02, 2015 11:44 pm
by lisa
http://www.solarstrike.net/phpBB3/viewt ... =20#p32369

Code: Select all

 -- Bag Item Stat Info
 -- level requirement is 0x58
 -- plus value is 0x17 (Byte)
 -- tier +- is 0x16 - 10 (Byte)
http://www.solarstrike.net/phpBB3/viewt ... =20#p32378

If you have an item with high plus value you can see what value you get from memory by placing it in the first bag slot then executing the following line at the commandline. It would be interesting to see what value a +16 item gives.

Code: Select all

print(memoryReadByte( getProc(),inventory.BagSlot[61].Address+ addresses.qualityTierOffset ))

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 12:55 am
by rock5
I do add the plus value in my rater. it looks like this.

Code: Select all

		-- 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
I don't know if the offsets are still right.

What this does is it gets the plus value from 0x17 offset then uses that to look up the damage, in a round about way, from a table of damages starting from 0x3AC offset of the BaseItemAddress.

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 2:06 am
by BlubBlab
Okay I got it but I'm not sure what went wrong now.

Command> getItemScore(inventory.BagSlot[61])
plus: 8 (This is right)
tmpid: 740008
tmpidaddress: 847108096
=========================================
Feines Langschwert, Id 210516, BaseItemAddress 39ED1500
-----------------------------------------
Address 9FCFC0
Object types Waffen Schwerter Schwerter
Required level 1
Value 60
Speed 2.5
Effects:
+7 Magieschadenspunkte
+9 Verteidigung
+24 Schaden (PDMG)
+15 Maximale LP

What is wrong is the PDMG it must be 56 also the Patt which came out from the + is missing.
EDIT: It seems really like addEffects comes out with 0 I can calculate the DMG 24* 1,1^9 = 56,590744584

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 2:45 am
by BlubBlab
My second print:

Code: Select all

Command> getItemScore(inventory.BagSlot[61])
effectId: 25
effectId: 191
effectId: 3
effect size: 3
plus: 8
tmpid: 740008
tmpidaddress: 847108096
=========================================
Feines Langschwert, Id 210516, BaseItemAddress 39ED1500
-----------------------------------------
Address 9FCFC0
        Object types    Waffen  Schwerter       Schwerter
        Required level  1
        Value   60
        Speed   2.5
        Effects:
                +7      Magieschadenspunkte
                +9      Verteidigung
                +24     Schaden
                +15     Maximale LP
Command>
My best guess is that the effect offset for the + off the gear is wrong with 0x3AC

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 5:03 am
by BlubBlab
@Lisa this what it returns with your code.

Code: Select all

Command> print(memoryReadByte( getProc(),inventory.BagSlot[61].Address+ addresse
s.qualityTierOffset ))
10
I'm not sure if this is right the tier 1 and it is +8

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 5:37 am
by BlubBlab
Okay :D I found it the offset for the + plus level is +0x98 not +0xB8.
I'm not sure it seem there are still bugs at least not much I have 60 PDMG instead of 56.
Geat I will post a new version

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 7:06 am
by beanybabe
If you can do these kind of calculations can you make one that could look at the gear you have and list list instance mobs you should be able to kill using the mob stats from the german site. another idea is if you are in pvp it might avoid targeting any player that you cannot kill.

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 8:01 am
by BlubBlab
beanybabe wrote:If you can do these kind of calculations can you make one that could look at the gear you have and list list instance mobs you should be able to kill using the mob stats from the german site. another idea is if you are in pvp it might avoid targeting any player that you cannot kill.
I think in that case you should plainly use your DPS, M-Attack and P-Attack and some experience and but that into a table.
In theory you can also use experience + gearscore for your class.

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 10:59 am
by rock5
Ok lets break this down.

Code: Select all

      -- 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
On my item with +5 the 0x17 offset gave me 0x25. I tested it by plusing a cheap item and the offset is correct. So it looks like the 2 in 0x25 is not part of the plus. That means that the plus can't be more than 15, unless it's base 32 (ie. 5 bits). So that's the first thing that needs to be fixed. I'll try using modulo 32 and seeing if that works.
item.BaseItemAddress+0x3AC does yield an id. GetItemAddress gives and address that is passed to the addEffects function. This all looks correct.

There seems to be something wrong with the offsets in addEffects. I'm having trouble working it out. I'll keep at it.

Re: Retrieve Physical or Magical Damage?

Posted: Fri Jul 03, 2015 9:12 pm
by BlubBlab
Sry I meant addEffects

Code: Select all

local function addEffects2(tabel, address, dura)
	dura = dura or 1
	local place = 0
	local effectId = memoryReadInt(getProc(),address+0x98)
	
	while effectId > 0 do
	--	print("effectId: "..effectId.."");
		if CLASS_EFFECT[player.Class1][effectId] then
			local size = memoryReadInt(getProc(),address+0x98+place+0x28)
			--print("effect size: "..size.."");
			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+0x98+place+0x28)* dura
		end
		place = place + 4
		effectId = memoryReadInt(getProc(),address+0x98+place)
	end
end
There was also another type 9 one int more address lower but with a value 0

Re: Retrieve Physical or Magical Damage?

Posted: Sat Jul 04, 2015 3:57 am
by BlubBlab
rock5 wrote:Ok lets break this down.

Code: Select all

      -- 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
On my item with +5 the 0x17 offset gave me 0x25. I tested it by plusing a cheap item and the offset is correct. So it looks like the 2 in 0x25 is not part of the plus. That means that the plus can't be more than 15, unless it's base 32 (ie. 5 bits). So that's the first thing that needs to be fixed. I'll try using modulo 32 and seeing if that works.
item.BaseItemAddress+0x3AC does yield an id. GetItemAddress gives and address that is passed to the addEffects function. This all looks correct.

There seems to be something wrong with the offsets in addEffects. I'm having trouble working it out. I'll keep at it.
AH I forgot the plus level goes until +20