
Originally Posted by
das7002
Yeah that is basically what I got to, 04 is type, 0a is name length, bytes after that is the name, I have a feeling it might have something to do with all the 0s that are there even with a null name that have something to do with mine not working
Here, this is loosely based on my C# version. It should generate 100% valid names, even if the creator is an empty string.
PHP Code:
<?php
echo makeName("Pikko");
function makeName($name = "") {
$arrout = array();
$output = "";
if ($name != "") {
for ($cnt = 0; $cnt < strlen($name); $cnt++) {
$arrout[] = str_pad(dechex(ord(substr($name,$cnt,1))), 4, "0", STR_PAD_LEFT);
}
$output = "04" . str_pad(dechex(strlen($name) * 2),2,"0",STR_PAD_LEFT) . HexReverse($arrout);
}
else {
$output = "0200";
}
return $output;
}
/**
* @desc A function to reverse hex order
* @param $input string array
*/
function HexReverse($input) {
$tempout = array();
$sringout = "";
$output = "";
for ($cnt = 0; $cnt < count($input); $cnt++) {
$tempout = SplitBy($input[$cnt],2);
for ($cnt2 = 0; $cnt2 < count($tempout); $cnt2++) {
$stringout .= $tempout[count($tempout) - 1 - $cnt2];
}
$output .= $stringout; $tempout = array(); $stringout = "";
}
return $output;
}
/**
* @desc A function to split strings by a static value
* @param $input string
* @param $splitValue integer
*/
function SplitBy($input, $splitValue = 2) {
$result = array();
for ($cnt = 0; $cnt < strlen($input); $cnt++) {
$result[] = substr($input,$cnt,$splitValue);
$cnt += $splitValue - 1;
}
return $result;
}
?>

Originally Posted by
das7002
And 02 prepending the hex string also seems to work if its armor or a weapon...
Yes, I caught this. Which is why I'm still unsure of its purpose. I suppose trying to crash my server as a test will be a good idea.