Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Item Hex Generator

Junior Spellweaver
Joined
Dec 11, 2010
Messages
101
Reaction score
110
Due to the fact that the old XML item generator had some bugs and was missing things. I took it upon myself to dissect and figure out how the hex data in the items are generated.

It's meant to be used in conjunction with something like Ronny's SendMail addon for PWAdmin. Or direct XML character editing if you choose.

Screen Shots



NRG's Perfect World Hex Generator
  • v0.7d with Updater

-- Version --
Code:
Version 0.4 (12/10/2010)
+Initial Version
+Armor Hex Generation

Version 0.5b (12/19/2010)
+GUI Changes
+Movement+
+Endurance+
+Requirements-

Version 0.7d (12/31/2010)
+Weapon Hex Generator
+Updater
+Misc

Version 0.8a (1/1/2011) [Get by updater]
+Save/Load for Weapons (Still might have bugs)
+Hex Breakdown (Some)
+Misc

Version 0.8c (1/26/2011) [Get by updater]
+Special: Soul Shatter

Version 0.8d (1/26/2011) [Get by updater]
+Armor Bonus Bug Fix
+Slight GUI change in preparation for upcoming update (Sockets box)

Version 2.0 (1/17/2012) [Not released yet]
+Language Files
+Database
+Program rewritten to clean up all of the unused/old code

-- Bugs --
  • A little regarding addon generation which was perfected 1/13/2012, read this
  • Endurance, Requirement, stats don't subtract info. This is being worked on currently.

-- What's Not working --
  • Import / Export
  • Saving Armor in .nhx format

-- Extra Notes --
  • Endurance plus and Requirement minus as stat editions will do NOTHING, other than make the equipment duration and stat requirements blue. Because Perfect World appends the endurance and requirements strangely. Take, 100, if you have endurance +25% and +50%, it will add like this, 100 + (100 * .25) = 125 + (125 * .50) = 187 endurance. Opposed to base endurance +stats for each endurance percentage added. So ensure that the duration and stats requirements you have set are the duration and stats requirements you want, even if you add the bonuses.
  • This DOES NOT have the ability to read from the elements.data, everything must be put in by hand.
  • ABOUT REFINES: I purposely did not include the refine add, because NO MATTER what. If you start refining the item that was sent with refines on it. The item can and will allow you to refine it starting back at 1, then 2, and so on till 12. Meaning there's some very special way it records refines. So there's no reason to add it.
  • IF YOU'RE USING 1.4.4 AND IT'S NOT WORKING, DON'T BOTHER TELLING ME. THIS WAS MADE FOR VERSION 1.2.6/1.3.6 SERVER!

-- Special Thanks To --
  • Drakaer, for figuring out half of the addon system puzzle (it was tricky)
  • das7002, for a lot of things
  • ronny1982, for all of the magical programs you wrote
  • 343, for plenty of laughs, among lots of help
  • Romulan, for pointing out issues, among other things here
  • tbnanubis, keep up your awesome work
  • Eistiger, you did tons of awesomeness
  • hrace009, for making that VBox that my first PW server started with a while ago
  • And anyone else who I probably forgot to name who's helped

-- Last Note --
If you have any problems except for the ones I've explicitly described, tell me. If you have any actual errors, please give me the error so I can attempt to find and fix the problem.

** This program is a work-in-progress. I will periodically update it until it's final. **
 
Last edited:
Black Magic Development
Loyal Member
Joined
Apr 29, 2010
Messages
2,170
Reaction score
600
Source code would be nice, as I have a semi working PHP one I put on the backburner due to other projects I've been working on and haven't had a ton of time to work on disecting all the parts of the hex
 
Junior Spellweaver
Joined
Dec 11, 2010
Messages
101
Reaction score
110
Source code would be nice, as I have a semi working PHP one I put on the backburner due to other projects I've been working on and haven't had a ton of time to work on disecting all the parts of the hex

When I finish this C#.NET version of the program, I'll personally convert it to php. As my primary field of work is php, 7-years experience. As well as hand out the C# source code.

Right now though, I won't give out the source code for the C# one because it's dirty; And until it's finished, I won't do any code cleaning. So converting the code as is, would be a very bad idea. Not to worry though, I'll really try to finish this soon. Then you can have the source code of this and the php one to use freely.
 
Black Magic Development
Loyal Member
Joined
Apr 29, 2010
Messages
2,170
Reaction score
600
I'm mostly interested in how you managed to get the name to encode properly as that is the one thing that keeps stumping me and I have a feeling I'm missing something glaringly obvious, just about everything in mine does work except for that...
 
Nerd-IO
Loyal Member
Joined
Feb 13, 2009
Messages
3,303
Reaction score
651
Nice editor, ill try it soon... :):
 
Junior Spellweaver
Joined
Dec 11, 2010
Messages
101
Reaction score
110
I'm mostly interested in how you managed to get the name to encode properly as that is the one thing that keeps stumping me and I have a feeling I'm missing something glaringly obvious, just about everything in mine does work except for that...

I'm still trying to figure out the naming breakdown myself. Here are some rough notes I wrote down as I was breaking down the name. Maybe they'll help.


Code:
11: 0200 or 0300 - *Naming System (0300 for no creator)
------ Naming System (By Example with the name Pikko)
11: 040a (04 = 4 = Type? | 0a = 10 in bytes / 2 (bytes) = 5 in length)
12: 5000 - 80 : P
13: 6900 - 105 : i
14: 6b00 - 107 : k
15: 6b00 - 107 : k
16: 6f00 - 111 : o
------
12: Physical Defence...
 
Black Magic Development
Loyal Member
Joined
Apr 29, 2010
Messages
2,170
Reaction score
600
I'm still trying to figure out the naming breakdown myself. Here are some rough notes I wrote down as I was breaking down the name. Maybe they'll help.


Code:
11: 0200 or 0300 - *Naming System (0300 for no creator)
------ Naming System (By Example with the name Pikko)
11: 040a (04 = 4 = Type? | 0a = 10 in bytes / 2 (bytes) = 5 in length)
12: 5000 - 80 : P
13: 6900 - 105 : i
14: 6b00 - 107 : k
15: 6b00 - 107 : k
16: 6f00 - 111 : o
------
12: Physical Defence...

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

PHP:
function name2hex($n){
    $n = str_split($n);
    foreach($n as $na){
        $nn[] = bin2hex(pack("v",ord($na)));
    }
    $nn = implode($nn);
    return $nn;
}
function makename($name, $type){
    //this is assumed to be the name, haven't worked out how to convert yet
    //$a = "040a440045004200550047004b00000000000000";
    //$w = "040a440045004200550047000000000024010000";
    $name = substr($name, 0, 9);
    $nl = substr(bin2hex(pack("v", strlen($name)*2)), 0, 2);
    $name = name2hex($name);
    if($type == "armor"){
        $name = "02".$nl.$name;
    } elseif($type == "weapon") {
        $name = "02".$nl.$name;
    } elseif($type == "acces"){
        $name = "03".$nl.$name;
    }
    return $name;
}

That is my name encoder for PHP and it can create valid names... it's just I am not entirely sure why it isn't working to well

And 02 prepending the hex string also seems to work if its armor or a weapon...
 
Last edited:
Junior Spellweaver
Joined
Dec 11, 2010
Messages
101
Reaction score
110
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:
<?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;
}
?>

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. :p:
 
Black Magic Development
Loyal Member
Joined
Apr 29, 2010
Messages
2,170
Reaction score
600
Here, this is loosely based on my C# version. It should generate 100% valid names, even if the creator is an empty string.

PHP:
<?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;
}
?>



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. :p:

Hmm you used ord and str_pad and I just used pack to always have it as the proper size... granted both would end up with the same result (I decided to just use pack for all hex conversions after I had an issue with big-endian to little-endian, since client uses little and php gave big with dechex)

Anyway I'll test yours a bit more and see how it comes out
 
Junior Spellweaver
Joined
Dec 11, 2010
Messages
101
Reaction score
110
In advance, since finishing the weapon generator parts is taking a little longer than expected, I updated the generator. Everything that was missing, excluding physical attack+, was added. As well as error handling for the GUI, though not 100%. Save/Load, etc. are not implemented yet.

Download:

---
Are there anymore stat bonuses anyone wants me to add that I may have missed that IS definitely allowed on armor?
 
Nerd-IO
Loyal Member
Joined
Feb 13, 2009
Messages
3,303
Reaction score
651
Possibility to change the "mask"? Cuz "16" is not for all of armor types. I mean footwear, wrist, and so on don't have the same mask as top or other...

There are different mask for each part of the stuff.

Maybe I'm wrong but I remember that when I hex edited a wrist by simply copy/paste from a top, I was unable to wear the wrist anymore...
 
Last edited:
Junior Spellweaver
Joined
Dec 11, 2010
Messages
101
Reaction score
110
I had only tested with wristguards and breastplates, and both worked fine with 16. However, I went to actually see what each one was. And I guess I'll get rid of that text because you're correct. I'll add another form that has the mask list on it, as shown below.

0: General Items
1: Weapon
2: Headgear
4: Necklace
8: Cape
16: Breastplate
32: Belt
64: Leggings
128: Footwear
256: Wristguard
1536: Ring
2048: Arrows
4096: Wings
8192: Fashion top
16384: Fashion legs
32768: Fashion footwear
65536: Fashion arms
131072: Atk/Mag Atk Charms
524288: Smilies
1048576: Guardian Charm
2097152: Spirit Charm
 
Junior Spellweaver
Joined
Dec 11, 2010
Messages
101
Reaction score
110
Updated, it now has weapon generator and updater system.

If you already have the program, you can just get the updater and put it in your folder that has the program. The updater is and run it to get the latest version.

----
Notes: I haven't done much testing. I'm just working really hard right now to finish this program up. So if you have any problems, tell me so I can fix them. Because I'm sure that there is a bug or two I missed.

Any more special stats you want, tell me. I've only put in the ones that were in the other generator with the international translation.
 
Newbie Spellweaver
Joined
Oct 29, 2010
Messages
40
Reaction score
1
Well, big thanks for great tool, it works perfect but I expected to see the missing weapon addons I didn't found on old XML Creator, for example:
Spirit Blackhole: Has a higher chance to dispel target's positive effect, or:
Soul Shatter: Has a chance to dispel opponent's positive buffs.
You can see both of them one on Nebulous Shooter (28511) and another on Heaven Shatterer (16086). As I have no idea how to acquire Nebulous Shooter (with stats on it) ingame, im trying to make it this way.

P.S. Can't acquire it, because quest keeps giving me the TB rank9 weapon Catastrophe Stinger only instead of Bow.

Thanks!
 
Last edited:
Junior Spellweaver
Joined
Dec 11, 2010
Messages
101
Reaction score
110
The status effect, "Spirit Blackhole," doesn't exist in the old version of the game. I did add Soul Shatter though. Get the newer version through the auto-updater.
 
Back
Top