Page 2 of 2
Re: Retrieve Physical or Magical Damage?
Posted: Sat Jul 04, 2015 6:39 am
by BlubBlab
Here is something to add to your version:
Code: Select all
-- Apply tier bonus to damage and defence. Before stat and runes effects are added.
if tier ~= 0 then
if tier > 9 then
if tmp.Effects[PDAM] then
tmp.Effects[PDAM] = tmp.Effects[PDAM] + (tmp.Effects[PDAM]*0.05 * tier)
elseif tmp.Effects[PDAM] then
tmp.Effects[MDAM] = tmp.Effects[MDAM] + (tmp.Effects[MDAM]*0.05 * tier)
elseif tmp.Effects[PDAM] then
tmp.Effects[PDEF] = tmp.Effects[PDEF] + (tmp.Effects[PDEF]*0.05 * tier)
elseif tmp.Effects[PDAM] then
tmp.Effects[MDEF] = tmp.Effects[MDEF] + (tmp.Effects[MDEF]*0.05 * tier)
end
else
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
end
from tier 10 to 11 the increase is only 5% and so on
Re: Retrieve Physical or Magical Damage?
Posted: Sat Jul 04, 2015 1:46 pm
by rock5
BlubBlab wrote:from tier 10 to 11 the increase is only 5% and so on
I didn't know that. Wouldn't that mean you would loose bonus when going from tier 9 to 10?
Is it just me or does that code look wrong? All the expressions are the same ie.
if tmpEffects[PDAM] then.
Re: Retrieve Physical or Magical Damage?
Posted: Sat Jul 04, 2015 3:44 pm
by BlubBlab
rock5 wrote:BlubBlab wrote:from tier 10 to 11 the increase is only 5% and so on
I didn't know that. Wouldn't that mean you would loose bonus when going from tier 9 to 10?
Is it just me or does that code look wrong? All the expressions are the same ie.
if tmpEffects[PDAM] then.
The expressions are the same what differ is the number at the end its your code.
Tier 10 was originally the maximum tier after that RW decided to make the new ones only with 5%. Something similar happened with the weapons since level 75 too.
unlike the ones before when you go from +12 to +13 you get only 5% instead of 10%. I think the whole thing about it is that people don't throw money out so easily.
Re: Retrieve Physical or Magical Damage?
Posted: Sun Jul 05, 2015 8:41 am
by rock5
I'm just saying does the bonus apply to all levels or only levels 10 and above? The way you have written it if you have say an item with 1000 damage and tier 9 you would get
- 1000 x 0.1 x 9 = 900 bonus
If your tier it to level 10 you would get
- 1000 x 0.05 x 10 = 500 bonus
That just seems wrong.
Re: Retrieve Physical or Magical Damage?
Posted: Sun Jul 05, 2015 11:14 am
by BlubBlab
rock5 wrote:I'm just saying does the bonus apply to all levels or only levels 10 and above? The way you have written it if you have say an item with 1000 damage and tier 9 you would get
- 1000 x 0.1 x 9 = 900 bonus
If your tier it to level 10 you would get
- 1000 x 0.05 x 10 = 500 bonus
That just seems wrong.
No not level, I mean tier that with the level is only for + of the weapons since level 75 that 2 things
1.)from tier 1 to 10 in each step 10% more , from tier 10 to 20 5% for each step.
2.)+ apply only to one dmg type peer weapon but also brings out additional stats which but I think this part is automatically taken care of by your function.
So far I understood your function in it is tier 0 is 1 and so on at least that was what printed out and the values were correct.
Re: Retrieve Physical or Magical Damage?
Posted: Sun Jul 05, 2015 11:45 am
by rock5
BlubBlab wrote:1.)from tier 1 to 10 in each step 10% more , from tier 10 to 20 5% for each step.
That makes more sense. I believe you didn't have it programmed that way though. I can do it though. Just to be clear is tier 10 10% or 5%? This is what I have so far
Code: Select all
-- Apply tier bonus to damage and defence. Before stat and runes effects are added.
if tier ~= 0 then
local tierTo10 = tier>10 and 10 or tier
local tierOver10 = tier>10 and (tier-10) or 0
if tmp.Effects[PDAM] then
tmp.Effects[PDAM] = tmp.Effects[PDAM] + (tmp.Effects[PDAM]*0.1 * tierTo10) + (tmp.Effects[PDAM]*0.05 * tierOver10)
end
if tmp.Effects[MDAM] then
tmp.Effects[MDAM] = tmp.Effects[MDAM] + (tmp.Effects[MDAM]*0.1 * tierTo10) + (tmp.Effects[MDAM]*0.05 * tierOver10)
end
if tmp.Effects[PDEF] then
tmp.Effects[PDEF] = tmp.Effects[PDEF] + (tmp.Effects[PDEF]*0.1 * tierTo10) + (tmp.Effects[PDEF]*0.05 * tierOver10)
end
if tmp.Effects[MDEF] then
tmp.Effects[MDEF] = tmp.Effects[MDEF] + (tmp.Effects[MDEF]*0.1 * tierTo10) + (tmp.Effects[MDEF]*0.05 * tierOver10)
end
end
BlubBlab wrote:2.)+ apply only to one dmg type peer weapon but also brings out additional stats which but I think this part is automatically taken care of by your function.
I guess my code added the it to both damage types? Is it always obvious which it adds too. Eg. Are all Staves and wand add to magic damage and all other weapons add to physical damage?
Re: Retrieve Physical or Magical Damage?
Posted: Sun Jul 05, 2015 11:40 pm
by BlubBlab
rock5 wrote:BlubBlab wrote:1.)from tier 1 to 10 in each step 10% more , from tier 10 to 20 5% for each step.
That makes more sense. I believe you didn't have it programmed that way though. I can do it though. Just to be clear is tier 10 10% or 5%? This is what I have so far
Code: Select all
-- Apply tier bonus to damage and defence. Before stat and runes effects are added.
if tier ~= 0 then
local tierTo10 = tier>10 and 10 or tier
local tierOver10 = tier>10 and (tier-10) or 0
if tmp.Effects[PDAM] then
tmp.Effects[PDAM] = tmp.Effects[PDAM] + (tmp.Effects[PDAM]*0.1 * tierTo10) + (tmp.Effects[PDAM]*0.05 * tierOver10)
end
if tmp.Effects[MDAM] then
tmp.Effects[MDAM] = tmp.Effects[MDAM] + (tmp.Effects[MDAM]*0.1 * tierTo10) + (tmp.Effects[MDAM]*0.05 * tierOver10)
end
if tmp.Effects[PDEF] then
tmp.Effects[PDEF] = tmp.Effects[PDEF] + (tmp.Effects[PDEF]*0.1 * tierTo10) + (tmp.Effects[PDEF]*0.05 * tierOver10)
end
if tmp.Effects[MDEF] then
tmp.Effects[MDEF] = tmp.Effects[MDEF] + (tmp.Effects[MDEF]*0.1 * tierTo10) + (tmp.Effects[MDEF]*0.05 * tierOver10)
end
end
BlubBlab wrote:2.)+ apply only to one dmg type peer weapon but also brings out additional stats which but I think this part is automatically taken care of by your function.
I guess my code added the it to both damage types? Is it always obvious which it adds too. Eg. Are all Staves and wand add to magic damage and all other weapons add to physical damage?
When I print out a tier1 item which tier it has I got 0 ....so I thought it count from 0(1) to 9(10).
yeah tier 10 is 10%
I suspect that only wooden weapons have increased MDMG and the rest PDMG but like I said the function will take care of it.
Re: Retrieve Physical or Magical Damage?
Posted: Mon Jul 06, 2015 3:13 am
by rock5
Ok. I had to do a bit of experimentation to remind myself how it works. The calculation we use works but it gives the
difference in tier not the tier itself. Which is what we want anyway. If an item has a base tier of 3 and we tier it to 5 then our calculations will yield a value of 2 and so we apply the bonus twice. Although I highly suspect the /16 in the calculation is wrong. I suspect it should be /32.
Code: Select all
local quality, tier = math.modf ( plusQuality / 32 );
tier = tier * 32 - 10;
As 16 you wouldn't be able to raise the tier more than 6 levels. As 32 you would be able to raise the tier 22 levels. The maximum mana stone is tier 20 so the highest tier increase is 19 levels ( assuming a tier 1 item). So 32 works.
I still can't get values to match though. It could be a problem with StatRating addon. It might be out of date but Item Preview addon yields similar results. It looks like it's the plus value specifically not working. I'll keep working on it.
Re: Retrieve Physical or Magical Damage?
Posted: Sun Jul 12, 2015 8:04 am
by BlubBlab
I tries that it seems on that address there also the numbers of the runslots as bit flags because every item I have with 1 slot is + 32
Edit:
I guess the solution because I have no purpose for the slots I do it quick and dirty
Code: Select all
local slots = 0;
if( plus >= 256)then
plus = plus -256;
slots = slots + 1;
end
if( plus >= 128)then
plus = plus - 128
slots = slots + 1;
end
if( plus >= 64)then
plus = plus - 64;
slots = slots + 1;
end
if( plus >= 32)then
plus = plus - 32;
slots = slots + 1;
end
Which would mean either this structure is 2 bytes or 256 is somewhere else but the rest is very clear:
2^0,2^1,2^3,2^4, bits are for plus level which means total plus is max 31 with this data structure, 2^5, 2^6, 2^7 and maybe 2^8 are the (empty) slots on the gear.
Re: Retrieve Physical or Magical Damage?
Posted: Mon Jul 13, 2015 1:38 am
by rock5
Ah, so that's what it is, the number of runes slots. Yes that is useless.
Looks a bit wrong. The first 5 bits are for the plus which range from 0 to 31. The 3 remaining bits are for the slots. That's 32,64 and 128.
The way I would do it is to use the modf function again like I did with the tier and quality.
Code: Select all
slot, plus = math.modf(memoryReadUByte(getProc(), item.Address + 0x17)/32)
plus=plus*32
Of course we don't need the slots so the easiest way would be to use the modulo % like I've been doing.
Code: Select all
local plus = memoryReadUByte(getProc(), item.Address + 0x17)%32
Re: Retrieve Physical or Magical Damage?
Posted: Mon Jul 20, 2015 11:29 am
by beanybabe
I was reading in the mm forum and someone was trying to retrieve hp and other stats from memory. it made me wonder does rom caculate your hp damage and other state every time you move or does it do it when you change gear and store it in memory some where.
I have been wanting a way to see instant changes in stats when gear is changed. If it updates on gear change there should be the values stored some place. Has anyone every checked for this?
Re: Retrieve Physical or Magical Damage?
Posted: Mon Jul 20, 2015 11:46 am
by rock5
I think the player hp is updated every time player:update() is run (or player:updateHP() ) so it should be updating all the time. Well, as soon as you leave the waypoint where you put on the new gear, it should do an update.