Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 00:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



calculating item % (white stats)

Discussion on calculating item % (white stats) within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
calculating item % (white stats)

hi,

i am bussy with trying to figure out how sro calculates the % stats on an item from the values you get of the packet sro sends.

for example i get these values:

Code:
E0 80 73 00 00 00 00 00
which display on a 2h item 22% phy, 19% att rate, 22% phy rein other are 0%

sro always reads it in reverse so we will get this value:
Code:
00 00 00 00 00 73 80 E0
after a bit of changing the stats around i figured out that

7 = phy
3 8 = att rate
0 E0 = phy rein

and for example phy rein can change like this:
0 E0 = 22%
2 60 = 61%

and also to make it more confusing some values are added up like:
(other item them above - gear part)

Code:
00 00 00 1A 03 80 00
the part: 3 80 = phy def
but when i added mag rein it became: 3 B4 = phy def & mag rein combined

and now i am stuck since i have no idea how to calculate the % out of these values which seems to be different on every white kind

does anyone know how to or maybe i am totally wrong on how to do this?

thx
pergian is offline  
Thanks
2 Users
Old 08/08/2012, 13:29   #2
 
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
wtf r u talking about? you cannot split up a byte -.-"
that is seriously one of the stupidest thing I have ever seen. xDDD
vorosmihaly is offline  
Old 08/08/2012, 13:40   #3
 
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
you can in sro xd, for example i am 100% sure about is
hp/mp in party are in 1 byte

AA which is A = 100% mp, and other A = 100% hp

and yes idk why sro does this but, what i posted above is what came out of it when i changed a stat
pergian is offline  
Old 08/08/2012, 13:43   #4
 
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
Quote:
Originally Posted by pergian View Post
you can in sro xd, for example i am 100% sure about is
hp/mp in party are in 1 byte

AA which is A = 100% mp, and other A = 100% hp

and yes idk why sro does this but, what i posted above is what came out of it when i changed a stat
yeah,you can split a byte,but not in this case. D
anyway,if this is the item packet each byte represents one stat,so you don't have to do any **** with the bytes,just leave them as they are and find out which one represents which stat.
vorosmihaly is offline  
Old 08/08/2012, 13:49   #5
 
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
Quote:
Originally Posted by vorosmihaly View Post
yeah,you can split a byte,but not the way you did it. xDD it's not simply writing the 2 parts of it seperately.
anyway,if this is the item packet each byte represents one stat,so you don't have to do any **** with the bytes,just leave them as they are and find out which one represents which stat.
no not every byte = 1 stat idk why ask joymax :P

like this:
Code:
00 00 00 02 48 C4 3C 23
this is a degree 1 prot hands with 6 stats (above 0%) , but i see only 5 bytes how you explaine this?

and when i change stats i figured out which represents which stat like i said in my first post
pergian is offline  
Old 08/08/2012, 13:50   #6
 
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
got any opcode ? so i can trace some packets my self and help you out with info ?
cyberninjah is offline  
Old 08/08/2012, 13:51   #7
 
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
Quote:
Originally Posted by pergian View Post
no not every byte = 1 stat idk why ask joymax :P

like this:
Code:
00 00 00 02 48 C4 3C 23
this is a degree 1 prot hands with 6 stats (above 0%) , but i see only 5 bytes how you explaine this?

and when i change stats i figured out which represents which stat like i said in my first post
well,that sounds weird,but there should be a seperate byte for each stat from what I remember. I'll take a look in my code tomorrow or somewhen if I'll be at home.
vorosmihaly is offline  
Old 08/08/2012, 13:52   #8
 
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
I think you need to know the max values of the item.

Sro always display the old value and the new value not the lowest value and the highest value.

Maybe the calculation is clientside ?
cyberninjah is offline  
Old 08/08/2012, 13:53   #9
 
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
its in any packet which contains an item but for example you can get this out of the inventory which is inside of the playerdata packet 0x3013
pergian is offline  
Old 08/08/2012, 13:54   #10
 
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
Quote:
Originally Posted by pergian View Post
its in any packet which contains an item but for example you can get this out of the inventory which is inside of the playerdata packet 0x3013
The max white values are in that packet ?
are you sure about that i cant remember i found that values when i parsed that one.
cyberninjah is offline  
Old 08/08/2012, 13:56   #11
 
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
Quote:
Originally Posted by cyberninjah View Post
The max white values are in that packet ?
are you sure about that i cant remember i found that values when i parsed that one.
ah no those values are the actually % but not the max value which i was thinking about too but i couldnt find anything so far in the pk2 about it

and yes i think the calculations is also clientside which i am trying to figure out or is there a easier way to get those calculations of the client?
pergian is offline  
Old 08/08/2012, 14:08   #12
 
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
if you know how much % the item has before you start using alchemy you know enough to calculate the new % value
cyberninjah is offline  
Old 08/08/2012, 16:28   #13
 
elite*gold: 60
Join Date: Jan 2010
Posts: 48
Received Thanks: 253
Calculating the uint64 which holds the item white-stats is pretty simple.
First of all you must know that there are 5 bits available for each item stat, so prepare for some bit manipulation.
In this example I'll show you how to calculate 100% stats for accessories, but this will also work with weapons and equip.

5 bits = 32 available numbers (range from 0 to 31)
0 = 0% stat
31 = 100% stat

If you now want to calculate an accessory with 100% stats then you'll need to define two variables (one for phy absorption and one for mag absorption)

Code:
phyAbsorp = 31
magAbsorp = 31
Now you must calculate the uint64 which will be sent to the client.
Foreach white stat you'll have to left shift the previous value of the uint64 by 5 bits and then add the value of the specified white stat to it.

Code:
//"<<" means left shift

stats = 0

stats = stats << 5 //This line is actually unnecessary because 0 << 5 is 0
stats = stats | magAbsorp
stats = stats << 5
stats = stats | phyAbsorp

//The result will be 1023, send this value to the client and you'll have a accessory 
//with 100% white stats, no matter if it is a ring, earring or necklace
Simple C# example:
Code:
byte phyAbsorp = 31; 
byte magAbsorp = 31;

ulong stats = 0;
stats |= magAbsorp;
stats <<= 5;
stats |= phyAbsorp;
Just to make it clear for you, here is the binary view:
Quote:
//Note: I'm not displaying all 64 bits of the uint64, that would be insane.

magAbsorp
phyAbsorp

000000000000000000000000000000000 //stats = 0
000000000000000000000000000011111 //stats = stats | magAbsorp (31)
000000000000000000000001111100000 //stats = stats << 5
000000000000000000000001111111111 //stats = stats | phyAbsorp (31)
That's it! That's how you calculate a 100% accessory, play around with the values from 0 to 31 to see how it affects the % of the selected white stat.
You can do the same for weapons or equip just use more stats.

I hope you understood what I was trying to say because I really suck at explaining

Stratti
Stratti is offline  
Thanks
9 Users
Old 08/08/2012, 16:37   #14
 
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
thx alot this is what i need, so far i understand all you said, i will go test now
pergian is offline  
Old 08/08/2012, 17:14   #15
 
IceAmStiel's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 1,058
Received Thanks: 1,118
Lolz thanks Stratti, I could finally convert the Variance values of the database properly xD
IceAmStiel is offline  
Reply


Similar Threads Similar Threads
[Help]Editing Item Stats
12/21/2011 - Cabal Online - 2 Replies
Someone know how to make something like this?: Thor's Screenshots - Xfire Thor's Screenshots - Xfire If you know please share...dont matter if it works on private server or official server!
Changing item stats
01/06/2011 - CO2 Private Server - 3 Replies
Hi all, I got Kimo's source version 5095. I want to change my item stats, I first thought that if i go into the database search for the item and then change it attack,defense etc etc it will change it in game to. So i went to cq_item and then searched for shield changed added some more defense and then saved after that I restarted the server so i want to look for the changes and i see that there are no changes. So my question is what am i doing wrong?
char stats, and item stats
01/27/2010 - Lineage 2 - 6 Replies
hi all today.. on a private server. i made a verry strange exp..... some clannies called me to come to HS to help for pvp as i came there i seen mass pvp arround 30 ppl all hitted 1 person ................ a S dagger items drago set and AS i watched it.... he needed for everyone just 1 or 2 hits beamed arround like hell..
1 to +12 item stats any one?
11/29/2007 - Conquer Online 2 - 3 Replies
:confused: 1 to +12 item stats any one?
Unequip item but still keep its stats
09/28/2006 - World of Warcraft - 7 Replies
1) Get the spider's kiss dagger. 2) Get 2 other weapons. 3) Equip the skd in your main hand. 4) Put one weapon in your off hand. 5) The thrid weapon in your inventory. 6) Switch the main weapon with your off hand (skd should be in your off hand now) 7) Switch your skd with your inventory weapon. Cool You should have the bonus of your skd even though its in your inventory.



All times are GMT +1. The time now is 00:25.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.