|
You last visited: Today at 02:11
Advertisement
calculating item % (white stats)
Discussion on calculating item % (white stats) within the SRO Coding Corner forum part of the Silkroad Online category.
08/08/2012, 17:16
|
#16
|
elite*gold: 60
Join Date: Jan 2010
Posts: 48
Received Thanks: 253
|
Quote:
Originally Posted by IceAmStiel
Lolz thanks Stratti, I could finally convert the Variance values of the database properly xD
|
No problem  I just figured that out while I was developing my emulator long time ago ^^
|
|
|
08/08/2012, 17:20
|
#17
|
elite*gold: 0
Join Date: Jul 2011
Posts: 1,058
Received Thanks: 1,118
|
Quote:
Originally Posted by Stratti
No problem  I just figured that out while I was developing my emulator long time ago ^^
|
Oh well, apparently I just picked a working one by chance, the others aren't exactly %5=0 long, I'll keep on trying to get the "missing" bits then, but the hint was already helping me
It might be not related to this section but either I am totally retarded or there's something weird going on (I tend to the first one).
Code:
DECLARE @val bigint = 450278816;
WHILE ( @val > 0 )
BEGIN
PRINT CONVERT(varchar(max),((@val%32)*100)/31)+'%'+CHAR(13)
SET @val = @val/32
END
Outputs it almost everytime correctly, BESIDES sometimes in a wrong order of the percentages OR on an EU 2Hands weapon 7 pseud-white stats.
I tried only accessories, misc gear pieces and a light staff out though ^^
|
|
|
08/08/2012, 21:03
|
#18
|
elite*gold: 60
Join Date: Jan 2010
Posts: 48
Received Thanks: 253
|
Quote:
Originally Posted by IceAmStiel
Oh well, apparently I just picked a working one by chance, the others aren't exactly %5=0 long, I'll keep on trying to get the "missing" bits then, but the hint was already helping me
It might be not related to this section but either I am totally retarded or there's something weird going on (I tend to the first one).
Code:
DECLARE @val bigint = 450278816;
WHILE ( @val > 0 )
BEGIN
PRINT CONVERT(varchar(max),((@val%32)*100)/31)+'%'+CHAR(13)
SET @val = @val/32
END
Outputs it almost everytime correctly, BESIDES sometimes in a wrong order of the percentages OR on an EU 2Hands weapon 7 pseud-white stats.
I tried only accessories, misc gear pieces and a light staff out though ^^
|
The wrong order of the percentages is because the stats are not packed in the same order as they are displayed. If you take a look into SMC then you'll find the correct order of the stats:
Code:
IVS_ARMOR_DURABILITY
IVS_ARMOR_PHY_SPECIALIZE
IVS_ARMOR_MAG_SPECIALIZE
IVS_ARMOR_PHY_DEFENSE
IVS_ARMOR_MAG_DEFENSE
IVS_ARMOR_EVASION_RATIO
IVS_WEAPON_DURABILITY
IVS_WEAPON_PHY_SPECIALIZE
IVS_WEAPON_MAG_SPECIALIZE
IVS_WEAPON_HIT_RATIO
IVS_WEAPON_PHY_DMG
IVS_WEPAON_MAG_DMG
IVS_WEAPON_CRITICAL_HITRATIO
IVS_SHIELD_DURABILITY
IVS_SHIELD_PHY_SPECIALIZE
IVS_SHIELD_MAG_SPECIALIZE
IVS_SHIELD_BLOCK_RATIO
IVS_SHIELD_PHY_DEFENSE
IVS_SHIELD_MAG_DEFENSE
IVS_ACCESSORY_PHY_ABSORB_RATIO
IVS_ACCESSORY_MAG_ABSORB_RATIO
Knowing the right order I made a very simple C# application to display the percentages correctly.
NOTE: This application identifies the type of the item by the amount of white stats (7 stats = weapon, 2 = stats accessory, ...) . This is actually a bad choice because equip & shield items both have 6 stats, you should rather identify it by its TypeIds. I was too lazy for that, so my application will display shield stats in the wrong order
Code:
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Program
{
private const byte ShieldDurabilitySlot = 0,
ShieldPhySpecSlot = 1,
ShieldMagSpecSlot = 2,
ShieldBlockRatioSlot = 3,
ShieldPhyDefSlot = 4,
ShieldMagDefSlot = 5;
private const byte ArmorDurabilitySlot = 0,
ArmorPhySpecSlot = 1,
ArmorMagSpecSlot = 2,
ArmorPhyDefSlot = 3,
ArmorMagDefSlot = 4,
ArmorEvasionRatioSlot = 5;
private const byte WeaponDurabilitySlot = 0,
WeaponPhySpecSlot = 1,
WeaponMagSpecSlot = 2,
WeaponHitRatioSlot = 3,
WeaponPhyDmgSlot = 4,
WeaponMagDmgSlot = 5,
WeaponCritSlot = 6;
private const byte AccessoryPhyAbsorpSlot = 0,
AccessoryMagAbsorpSlot = 1;
static void Main()
{
const ulong variance = 234924384;
DisplayVariance(variance);
Console.ReadLine();
}
static void DisplayVariance(ulong variance)
{
var stats = new List<byte>();
while (variance > 0)
{
var stat = (byte)(variance & 0x1f);
variance >>= 5;
stats.Add(stat);
}
switch (stats.Count)
{
case 2:
//Accessory
Console.WriteLine(ToPercentage(stats[AccessoryPhyAbsorpSlot]));
Console.WriteLine(ToPercentage(stats[AccessoryMagAbsorpSlot]));
break;
case 6:
//Equip
//NOTE this can also be a shield !
Console.WriteLine(ToPercentage(stats[ArmorPhyDefSlot]));
Console.WriteLine(ToPercentage(stats[ArmorMagDefSlot]));
Console.WriteLine(ToPercentage(stats[ArmorDurabilitySlot]));
Console.WriteLine(ToPercentage(stats[ArmorEvasionRatioSlot]));
Console.WriteLine(ToPercentage(stats[ArmorPhySpecSlot]));
Console.WriteLine(ToPercentage(stats[ArmorMagSpecSlot]));
break;
case 7:
//Weapon
Console.WriteLine(ToPercentage(stats[WeaponPhyDmgSlot]));
Console.WriteLine(ToPercentage(stats[WeaponMagDmgSlot]));
Console.WriteLine(ToPercentage(stats[WeaponDurabilitySlot]));
Console.WriteLine(ToPercentage(stats[WeaponHitRatioSlot]));
Console.WriteLine(ToPercentage(stats[WeaponCritSlot]));
Console.WriteLine(ToPercentage(stats[WeaponPhySpecSlot]));
Console.WriteLine(ToPercentage(stats[WeaponMagSpecSlot]));
break;
default:
Console.WriteLine("{0} stats... wtf?", stats.Count);
break;
}
}
private static string ToPercentage(byte stat)
{
return String.Format("{0}%", stat*100/31);
}
}
}
|
|
|
08/08/2012, 21:27
|
#19
|
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
|
I feel like it's my time to share something useful about the TypeID stuff..
so this is a little help for determining the item types by their TypeID:
Quote:
TypeID1 --> 3 items group
TypeID2 --> 1 equipable items.
TypeID3 --> 1-3 chinese armor
TypeID3 --> 4 shields
TypeID3 --> 5 chinese jewellery
TypeID3 --> 6 weapons
TypeID3 --> 9-11 european armor
TypeID3 --> 12 european jewellery
|
have fun with it.
|
|
|
08/21/2012, 22:26
|
#20
|
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
|
What packet will give the data ?
0xB151 OR 0xB150 ?
NVM: My Analyzer failed xD
|
|
|
08/22/2012, 10:16
|
#21
|
elite*gold: 0
Join Date: Dec 2007
Posts: 2,400
Received Thanks: 1,517
|
Quote:
Originally Posted by Stratti
(...)
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
(...)
|
I for some reason feel that OR would be 'better' here than ADD (on stats + __Absorp). You're already working with bits.
(I'm talking about readability, not performance. Performance should be (about) equal.)
|
|
|
08/22/2012, 11:46
|
#22
|
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
|
Maybe its not related to this topic more i think it is
I try parse the packet with the stats more i dont know if my parsing job is right anyone can check it for me ? because my values are not equal to the values in game
Code:
[byte] unknown(?? i think its the typeID)
[byte] unknown(??)
[byte] isFailed
[byte] item slot in inventory
[dword] 0 unknown(??)
[dword] itemID
[byte] plus value
[qword] item stats
[dword] durability
[byte] blues count
Loop
{
[dword] blue ID
[dword] value
}
|
|
|
08/22/2012, 13:45
|
#23
|
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
|
Quote:
Originally Posted by cyberninjah
Maybe its not related to this topic more i think it is
I try parse the packet with the stats more i dont know if my parsing job is right anyone can check it for me ? because my values are not equal to the values in game
Code:
[byte] unknown(?? i think its the typeID)
[byte] unknown(??)
[byte] isFailed
[byte] item slot in inventory
[dword] 0 unknown(??)
[dword] itemID
[byte] plus value
[qword] item stats
[dword] durability
[byte] blues count
Loop
{
[dword] blue ID
[dword] value
}
|
ye thats right, also when isfailed == 0x00
then 1 byte comes wihch will tell if its destroyed or failed.
if its destoryed == 0x01 then the packet ends
also after the blues parse the special item skills (like socket stones) will come
maybe if you post the whole packet and how you would parse it, then i can probably tell you why the values are not equal to the game
|
|
|
08/22/2012, 23:54
|
#24
|
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
|
Code:
[S -> C][B151]
01 ................
02 ................
01 ................
0D ................
00 00 00 00 ................
E3 98 00 00 ................
0A ................
00 00 70 C0 04 00 00 00 ..p.............
96 00 00 00 ................
05 ................
A3 01 00 00 C8 00 00 00 ................
A5 01 00 00 64 00 00 00 ....d...........
A4 01 00 00 3C 00 00 00 ....<...........
A2 01 00 00 08 00 00 00 ................
A1 01 00 00 08 00 00 00 ................
01 ................
00 ................
02 ................
01 ................
00 ................
7D A3 00 00 04 00 00 00 }...............
is the full packet more i just got it on the parry stat only it whas 2% more my Tool said it whas 3%
Edit: thats not the packet where i got the parry i lost that one this just one i collected to give you the full packet
|
|
|
08/24/2012, 08:28
|
#25
|
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
|
Quote:
Originally Posted by cyberninjah
Code:
[S -> C][B151]
01 ................
02 ................
01 ................
0D ................
00 00 00 00 ................
E3 98 00 00 ................
0A ................
00 00 70 C0 04 00 00 00 ..p.............
96 00 00 00 ................
05 ................
A3 01 00 00 C8 00 00 00 ................
A5 01 00 00 64 00 00 00 ....d...........
A4 01 00 00 3C 00 00 00 ....<...........
A2 01 00 00 08 00 00 00 ................
A1 01 00 00 08 00 00 00 ................
01 ................
00 ................
02 ................
01 ................
00 ................
7D A3 00 00 04 00 00 00 }...............
is the full packet more i just got it on the parry stat only it whas 2% more my Tool said it whas 3%
Edit: thats not the packet where i got the parry i lost that one this just one i collected to give you the full packet 
|
ye this parse looks fine although is this isro ?
since that itemID is an immo stone in isro.
and about the stats i am guessing its a weapon since it has 7 stats
Code:
04 C0 70 00 00 = 10011 00000 00111 00000 00000 00000 00000
so its :
0 * (100/31) = 0% dura
0 * (100/31) = 0% phy rein
0 * (100/31) = 0% mag rein
0 * (100/31) = 0% hit ratio
7 * (100/31) = 22.6% phy dmg
0 * (100/31) = 0% mag dmg
19 * (100/31) = 61.3% crit
are this the right % you are looking for?
|
|
|
08/24/2012, 09:12
|
#26
|
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
|
Its not for Isro Just a private server bases on vSRO files.
easier to make a clientless bot there because no hackshield haha
hmm yea that are the right values i have no problems with dura phy and stuff only parry and hitratio are wrong sometimes.
|
|
|
08/24/2012, 11:17
|
#27
|
elite*gold: 0
Join Date: Feb 2008
Posts: 73
Received Thanks: 18
|
Quote:
Originally Posted by cyberninjah
Its not for Isro Just a private server bases on vSRO files.
easier to make a clientless bot there because no hackshield haha
hmm yea that are the right values i have no problems with dura phy and stuff only parry and hitratio are wrong sometimes.
|
yes i noticed that too. i think its since joymax made that strange change like
22%>19% of hit ratio, no idea why.
|
|
|
08/24/2012, 15:08
|
#28
|
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
|
At least the most starts are the right values so i can finally finish my alchemy bot
Thanks for the help =)
The only thing i need right now is to know how i can redirect sro client with C# i found the loader in C# coded for RU sro more i dont understand how he did that redirect stuff
|
|
|
09/13/2012, 19:33
|
#29
|
elite*gold: 0
Join Date: Apr 2009
Posts: 120
Received Thanks: 17
|
Code:
[S -> C][B151]
01 ................
02 ................
01 ................
0D ................
00 00 00 00 ................
61 00 00 00 a...............
00 ................
12 9C 16 C8 05 00 00 00 ................
80 00 00 00 ................
01 ................
46 00 00 00 05 00 00 00 F...............
01 ................
00 ................
02 ................
00 ................
Code:
12 [phy reinforce]
9C [mag reinforce]
16 [attack rate]
C8
05
00
00
00
when i try to calculate the stats % (e.g. the phy reinforce)
[phy rein] 18 * 100 / 31 = 58% which is not correct
so what am I doing wrong ?
|
|
|
09/13/2012, 21:04
|
#30
|
elite*gold: 60
Join Date: Jan 2010
Posts: 48
Received Thanks: 253
|
Quote:
Originally Posted by supermando
Code:
[S -> C][B151]
01 ................
02 ................
01 ................
0D ................
00 00 00 00 ................
61 00 00 00 a...............
00 ................
12 9C 16 C8 05 00 00 00 ................
80 00 00 00 ................
01 ................
46 00 00 00 05 00 00 00 F...............
01 ................
00 ................
02 ................
00 ................
Code:
12 [phy reinforce]
9C [mag reinforce]
16 [attack rate]
C8
05
00
00
00
when i try to calculate the stats % (e.g. the phy reinforce)
[phy rein] 18 * 100 / 31 = 58% which is not correct
so what am I doing wrong ?
|
Read my post again?
There are 5 bits foreach stat, not 1 byte.
|
|
|
 |
|
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 02:11.
|
|