Item Hex Generator

Page 1 of 8 12345678 LastLast
Results 1 to 15 of 119
  1. #1
    Valued Member Goodlookinguy is offline
    MemberRank
    Dec 2010 Join Date
    101Posts

    wink Item Hex Generator

    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
    http://dump.nrgs.org/pwhexgen/pwhexgen.png
    http://dump.nrgs.org/pwhexgen/pwhexgen2.png

    NRG's Perfect World Hex Generator


    -- 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 by Goodlookinguy; 07-03-12 at 08:31 AM. Reason: Updated


  2. #2
    Black Magic Development das7002 is offline
    MemberRank
    Apr 2010 Join Date
    EarthLocation
    2,188Posts

    Re: Item Hex Generator

    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

  3. #3
    Valued Member Goodlookinguy is offline
    MemberRank
    Dec 2010 Join Date
    101Posts

    Re: Item Hex Generator

    Quote Originally Posted by das7002 View Post
    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.

  4. #4
    Black Magic Development das7002 is offline
    MemberRank
    Apr 2010 Join Date
    EarthLocation
    2,188Posts

    Re: Item Hex Generator

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

  5. #5
    Nerd-IO Romulan is offline
    MemberRank
    Feb 2009 Join Date
    BelgiumLocation
    3,333Posts

    Re: Item Hex Generator

    Nice editor, ill try it soon...

  6. #6
    Member epyonro is offline
    MemberRank
    Apr 2009 Join Date
    BrazilLocation
    92Posts

    Re: Item Hex Generator

    Nice editor, thx.

  7. #7
    Member Ramona22 is offline
    MemberRank
    Jul 2010 Join Date
    Stargate-CenterLocation
    58Posts

    Re: Item Hex Generator

    nice big thx

  8. #8
    Valued Member Goodlookinguy is offline
    MemberRank
    Dec 2010 Join Date
    101Posts

    Re: Item Hex Generator

    Quote Originally Posted by das7002 View Post
    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...

  9. #9
    Black Magic Development das7002 is offline
    MemberRank
    Apr 2010 Join Date
    EarthLocation
    2,188Posts

    Re: Item Hex Generator

    Quote Originally Posted by Goodlookinguy View Post
    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 Code:
    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($name09);
        
    $nl substr(bin2hex(pack("v"strlen($name)*2)), 02);
        
    $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 by das7002; 11-12-10 at 09:23 PM.

  10. #10
    Valued Member Goodlookinguy is offline
    MemberRank
    Dec 2010 Join Date
    101Posts

    Re: Item Hex Generator

    Quote Originally Posted by das7002 View Post
    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) - $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;
    }
    ?>
    Quote Originally Posted by das7002 View Post
    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.

  11. #11
    Black Magic Development das7002 is offline
    MemberRank
    Apr 2010 Join Date
    EarthLocation
    2,188Posts

    Re: Item Hex Generator

    Quote Originally Posted by Goodlookinguy View Post
    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) - $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.
    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

  12. #12
    Valued Member Goodlookinguy is offline
    MemberRank
    Dec 2010 Join Date
    101Posts

    Re: Item Hex Generator

    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: http://nrgs.org/dev/pwhexgen/PWHexGen_12192010.zip

    ---
    Are there anymore stat bonuses anyone wants me to add that I may have missed that IS definitely allowed on armor?

  13. #13
    Nerd-IO Romulan is offline
    MemberRank
    Feb 2009 Join Date
    BelgiumLocation
    3,333Posts

    Re: Item Hex Generator

    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 by Romulan; 19-12-10 at 07:23 PM.

  14. #14
    Valued Member Goodlookinguy is offline
    MemberRank
    Dec 2010 Join Date
    101Posts

    Re: Item Hex Generator

    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

  15. #15
    Omega 343 is offline
    MemberRank
    Oct 2009 Join Date
    Ancient DGN CTYLocation
    5,514Posts

    Re: Item Hex Generator

    IDK if it isn't in the list 'on purpose' but there is one item missing from the above list:

    262144 = Heaven Book/Tome

    ;)



Page 1 of 8 12345678 LastLast

Advertisement