Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Serverside Modding => Topic started by: Смердокрыл on November 28, 2015, 06:37:13 pm

Title: [QUESTION] Calculating playerBytes
Post by: Смердокрыл on November 28, 2015, 06:37:13 pm
Hey!
How can I calculate the needed value of playerBytes in order to change a character in navicat, and not in the client?
Title: Re: [QUESTION] Calculating playerBytes
Post by: Rangorn on November 28, 2015, 11:24:24 pm
[deleted]
Title: Re: [QUESTION] Calculating playerBytes
Post by: Смердокрыл on December 01, 2015, 06:20:32 pm
Quote from: "Rangorn"
Hey.

This is how i do in PHP :

Code: [Select]
 
        $b = $row['playerBytes']; // PlayerBytes in Character table
        $b2 = $row['playerBytes2']; // PlayerBytes in Character table

        // Set Character Features
        $ha = ($b>>16)%256; // Hairs
        $hc = ($b>>24)%256; // Hairs color
        $fa = ($b>>8)%256; // Face
        $sk = $b%256; // Skin
        $fh = $b2%256; // Facial / Others


Ehm... You overestimate me.
Title: Re: [QUESTION] Calculating playerBytes
Post by: Смердокрыл on December 02, 2015, 08:24:38 pm
Basically, my knowledge of PHP is not even enough for Hello world. Could you explain the mathematical way of calculating it?

Also, if its possible to do this via vb.net, I'll be happy to know
Title: Re: [QUESTION] Calculating playerBytes
Post by: Rochet2 on December 02, 2015, 08:46:39 pm
in most programming languages and elsewhere (C, C++, java, lua, SQL, ... whatever else) you would use almost exact same code.
I myself wouldnt bother with the maths. instead just look up what %, << and >> operators do. % is modulo (3%2 = 1) and the rest are bit shifting operators.
Everything else is just a bunch of variables.
Title: Re: [QUESTION] Calculating playerBytes
Post by: Смердокрыл on December 03, 2015, 09:54:01 pm
http://phptester.net/ (http://phptester.net/" onclick="window.open(this.href);return false;)

It returns

NOTICE Undefined variable: row on line number 2

NOTICE Undefined variable: row on line number 3
Title: Re: [QUESTION] Calculating playerBytes
Post by: Rangorn on December 03, 2015, 10:00:49 pm
[deleted]
Title: Re: [QUESTION] Calculating playerBytes
Post by: Смердокрыл on December 03, 2015, 10:36:05 pm
It just crashes and says This application is free so please don't break it !
Another website (http://sandbox.onlinephpfunctions.com/) says



Parse error:  syntax error, unexpected '&lt;' in <>>[...][...] on line 1



Also, is there a backward code? To get the bytes from needed character settings?
Title: Re: [QUESTION] Calculating playerBytes
Post by: Kaev on December 04, 2015, 05:22:05 pm
Try it without the php tags:
Code: [Select]
$b = 17367552; // PlayerBytes in Character table
$b2 = 33554436; // PlayerBytes2 in Character table

// Set Character Features
$ha = ($b>>16)%256; // Hairs
$hc = ($b>>24)%256; // Hairs color
$fa = ($b>>8)%256; // Face
$sk = $b%256; // Skin
$fh = $b2%256; // Facial / Others

echo "Hairs : ".$ha."<br>";
echo "Hair Color : ".$hc."<br>";
echo "Face : ".$fa."<br>";
echo "Skin : ".$sk."<br>";
echo "Facial/Other : ".$fh."<br>";
Title: Re: [QUESTION] Calculating playerBytes
Post by: Смердокрыл on December 04, 2015, 08:47:47 pm
Thanks, Kaev, it works! What about a backward conversion?
Title: Re: [QUESTION] Calculating playerBytes
Post by: schlumpf on December 04, 2015, 11:09:14 pm
Code: [Select]
$a= ($z>>24)&0xff;
$b= ($z>>16)&0xff;
$c= ($z>>8)&0xff;
$d= ($z>>0)&0xff;
$z = ($a<<24) |  ($b<<16) |  ($c<<8) |  ($d<<0);
Title: Re: [QUESTION] Calculating playerBytes
Post by: Смердокрыл on December 05, 2015, 10:59:54 am
Quote from: "schlumpf"
Code: [Select]
$a= ($z>>24)&0xff;
$b= ($z>>16)&0xff;
$c= ($z>>8)&0xff;
$d= ($z>>0)&0xff;
$z = ($a<<24) |  ($b<<16) |  ($c<<8) |  ($d<<0);
Which of these are what? I mean skin color, facial features, etc.
Title: Re: [QUESTION] Calculating playerBytes
Post by: schlumpf on December 05, 2015, 11:07:38 am
Please map the four numbers to the four names yourself. It really isn't hard.
Title: Re: [QUESTION] Calculating playerBytes
Post by: Смердокрыл on December 05, 2015, 11:32:07 am
Quote from: "schlumpf"
Please map the four numbers to the four names yourself. It really isn't hard.
It isnt, but there should be five numbers. Hair, Hair colour, Skin colour, Face and Facial features
Title: Re: [QUESTION] Calculating playerBytes
Post by: schlumpf on December 05, 2015, 12:21:15 pm
There is also b and b2.