I`ve decided to release my SQL based white stats decoder.
This task has been completed multiple times via php and / or c# but never via SQL (at lease not that I am aware of)
I personally don't have any use cases however maybe you guys have an Idea what this could be used for.
Code:
SET NOCOUNT ON;
DECLARE @Variance BIGINT = 34359738367
, @Type VARCHAR(16) = 'WEAPON'
, @Counter INT = 0;
DECLARE @tmpTable TABLE (ID INT IDENTITY(1, 1), Value INT);
DECLARE @resultTable TABLE (ID INT IDENTITY(1, 1), Description VARCHAR(128), Value INT);
WHILE @Variance > 0
BEGIN
INSERT @tmpTable (Value)
VALUES ((@Variance & 0x1F) * 100 / 31);
SET @Counter = 5;
WHILE @Counter <> 0
BEGIN
SET @Variance = (@Variance - (@Variance & 1)) / 2;
SET @Counter -= 1;
END;
END;
IF @Type = 'WEAPON'
BEGIN
IF (SELECT COUNT(*)FROM @tmpTable) <> 7
BEGIN
PRINT ('INVALID TYPE!');
RETURN;
END;
INSERT @resultTable (Description, Value)
VALUES ('Physitcal Damage', (SELECT Value FROM @tmpTable WHERE ID = 5))
, ('Magical Damage', (SELECT Value FROM @tmpTable WHERE ID = 6))
, ('Durability', (SELECT Value FROM @tmpTable WHERE ID = 1))
, ('Hit Ratio', (SELECT Value FROM @tmpTable WHERE ID = 4))
, ('Critical', (SELECT Value FROM @tmpTable WHERE ID = 7))
, ('Physitcal Reinforce', (SELECT Value FROM @tmpTable WHERE ID = 2))
, ('Magical Reinforce', (SELECT Value FROM @tmpTable WHERE ID = 3));
END;
ELSE IF @Type = 'SHIELD'
BEGIN
IF (SELECT COUNT(*)FROM @tmpTable) <> 6
BEGIN
PRINT ('INVALID TYPE!');
RETURN;
END;
INSERT @resultTable (Description, Value)
VALUES ('Physitcal Defensive', (SELECT Value FROM @tmpTable WHERE ID = 5))
, ('Magical Defensive', (SELECT Value FROM @tmpTable WHERE ID = 6))
, ('Durability', (SELECT Value FROM @tmpTable WHERE ID = 1))
, ('Block Ratio', (SELECT Value FROM @tmpTable WHERE ID = 4))
, ('Physitcal Reinforce', (SELECT Value FROM @tmpTable WHERE ID = 2))
, ('Magical Reinforce', (SELECT Value FROM @tmpTable WHERE ID = 3));
END;
ELSE IF @Type = 'EQUIPMENT'
BEGIN
IF (SELECT COUNT(*)FROM @tmpTable) <> 6
BEGIN
PRINT ('INVALID TYPE!');
RETURN;
END;
INSERT @resultTable (Description, Value)
VALUES ('Physitcal Defensive', (SELECT Value FROM @tmpTable WHERE ID = 4))
, ('Magical Defensive', (SELECT Value FROM @tmpTable WHERE ID = 5))
, ('Durability', (SELECT Value FROM @tmpTable WHERE ID = 1))
, ('Parry Ratio', (SELECT Value FROM @tmpTable WHERE ID = 6))
, ('Physitcal Reinforce', (SELECT Value FROM @tmpTable WHERE ID = 2))
, ('Magical Reinforce', (SELECT Value FROM @tmpTable WHERE ID = 3));
END;
ELSE IF @Type = 'ACCESSORY'
BEGIN
IF (SELECT COUNT(*)FROM @tmpTable) <> 2
BEGIN
PRINT ('INVALID TYPE!');
RETURN;
END;
INSERT @resultTable (Description, Value)
VALUES ('Physitcal Absorption', (SELECT Value FROM @tmpTable WHERE ID = 1))
, ('Magical Absorption', (SELECT Value FROM @tmpTable WHERE ID = 2));
END;
SELECT Description
, Value
FROM @resultTable
ORDER BY ID;
Since no explanation at all was given, I will add it.
Variance is pretty simple, it's an int64 with 7 flags (occupies upto 35 bits), each flag is 5 bit and represents a value from 0 to 31, 0 being 0% and 31 being 100%
This order is for Little-endian.
first 5 bits: Durability (wep, prot, shield) | Phy. Abs. (acc)
second 5 bits: Phy. Reinforcement (eu str wep, ch wep, prot, shield) | Mag. Abs. (acc)
third 5 bits: Mag. Reinforcement (eu int wep, ch wep, prot, shield)
forth 5 bits: Hit Ratio (wep) | Parry Ratio (prot)
fifth 5 bits: Phy. Power (eu str wep, ch wep) | Phy. Def. (prot, shield)
sixth 5 bits: Mag. Power (eu int wep, ch wep) | Mag. Def. (prot, shield)
seventh 5 bits: Critical (eu str wep, ch wep) | Block Ratio (shield)
If you want to set all values to a specific %, take this value 1108378657 and multiply it for any number between 0 and 31.
If you want to set a specific value, then or-it with the flag mask. Example, let's say you want to set 41% stats but for whatever reason you want 61% parry/hit rate. This is the formula (pseudo-code):
(1108378657 * 13) | (19 << (5 * 4))
1108378657 is every flag set to 1 (binary 00001-00001-00001-00001-00001-00001-00001)
* 13 makes everything 41% (binary 01101-01101-01101-01101-01101-01101-01101)
19 is the 61% stat (binary 11101)
5 is the bits length
* 4 is the position for hit rate, which is the 4th 5 bits.
5 * 4 = 20 so it will be rotated 20 bits to the left.
19 << 20 = binary 00000-00000-10011-00000-00000-00000-00000
(1108378657 * 13) | (19 << 20)
01101-01101-01101-01101-01101-01101-01101
00000-00000-10011-00000-00000-00000-00000 OR
--------------------------------------------------------------
01101-01101-11101-01101-01101-01101-01101
And there you have, I hope this explanation serves to people to know how it works.
[Release] White stats calculator program ( Can be used with PHP ). 06/25/2016 - SRO PServer Guides & Releases - 16 Replies Hello,
This is my first release on elitepvpers, I hope you will like it.
So today I'm going to release a small program, made by me.
This program calculates white stats of any item you give it,
take a look on the PHP code and you will understand how simple is to use that.
Most of you use PHP 32 BIT, in PHP 32 BIT you don't have the abilities to do what the program does, PHP 32 BIT can't get high numbers into int variables, so you have to use this program for make it works perfectly.
I...
Vb6 Conquer Packet Decoder 12/11/2007 - CO2 Exploits, Hacks & Tools - 42 Replies This Counts As A Tool Right?
Anyway, Yeah, Heres The Exe, Source Being Posted Shortly.
I hope this helps somone who needs a way to decrypt packets :)
Please Report Any Errors/Mistakes And I'll Be Happy To Correct Them
[INT] Config decoder 09/27/2007 - Kal Online - 23 Replies Copyright by BakaBug =O grad eben fertiggestellt.
Downloadlink: BakaBugs Blog