So if I'm understanding this correctly, you're parsing the WZ files (XML) to generate item JSONs with positions and the base64 encoded image? If so, I was just wondering why you decided to use PHP for this (over Java/Python)
So if I'm understanding this correctly, you're parsing the WZ files (XML) to generate item JSONs with positions and the base64 encoded image? If so, I was just wondering why you decided to use PHP for this (over Java/Python)
I could of done Java honestly, however since this is a GD for a website, I rather work with web languages to keep it simple, I dont want people to download a Java IDE just to run multiple java codes. Besides the one extra line needed to prolong the execution time, I see no problem using PHP over Java. Python I have no experience with yet so that's out of the picture lol. Also PHP is one of my strongest web languages, followed by C#(learning for two semester at my college)
Last edited by iAkira; 06-01-16 at 06:49 PM.
Yeah, PHP is one of my strongest web languages, followed by C#(learning for two semester at my college) atm. If I were to move to Java I would actually be slower on debugging and what not trying to remember/relearn most of the Java functions, but it's doable.
- - - Updated - - - @Novak
Out of curiosity can Java replicate this code? I feel it lacks some of the array function and flexibility that PHP has :
Array_diff compares two array and find the difference, array_slice removes the first two values in the array(./, and ../), and scandir scan all the files inside a folder. Just curious on how much Java can do in terms of array manipulations since I play with a shitload of arrays in these scripts.PHP Code:print_r(array_diff(array_slice(scandir('greater_than_0/'), 2), array_slice(scandir('greater_than_3/'), 2)));
Commons Collection ListUtils can do the same as array_slice in 1 line iirc. But as far as i know you can't scan an entire directory as easily. I've never really enjoyed the java file utils.
You'd probably have to write a small fileSearcher and call that in order to keep it as one liners on all those lines. I'm convinced java can do the same as PHP, and probably more, but it's not always tailored to specific use as much :p
Well I figured it had a bit of limitation but it's still possible, I feel Java should be used for more complex things though :p GD scripts are just cleaning XML and loads of arrays and looping lol.
-----------
Update: Added Hair script(had to make a function for sourcing due to hairShade being a imgdir and need to call sourcing twice, i rather make a function out of it lol)
It includes hairShade, removal of duplicates, support on hairBelowHead, etc.
Out of 5,880 XML files, 5,856 were converted to JSON files.
Well hey, it's working so far with PHP, so stick with it :P
And to answer your question, you can recursively iterate through a folder with FileUtils. PHP packages it nicely in one function call, I don't think there is a similar function that does this for you in FileUtils.
Update:
I finished getting all the types of capes and debug their z-values(something like the duplicate image print I did, but I check for z values for each type of cape and find unique ones). As of now I can say, this GD will have 100% cape support from all and every cape available and will not be displayed incorrectly.
Below are a couple of capes(the capes below are one of many in their groups, they aren't individually unique single item capes, except the cat one.)
There are capes has 3 images, a cape thats below the body, a cape arm, and a capeOverHead. Some capes have a unique canvas called "capeOverArm" as it says, this 'cape' is to cover the arm a bit. Some capes have a unique canvas called "capeArmBelowBody" so the capeArm is below the body, normal capeArms are above the body. Regular back cape only no capeArm or anything. There are capes where the cap is above the body only. Alright this cape right here is retarded. The belowBody image is above the body, and the capearm(which is above the body) is below the body. . . . There are capes like this one which are above the body, luckily Nexon distinguished this through their z-value so yeah.. cape above the body but they are capes, not capeArms.. you can imagine how my if statements are when displaying these.. This cat cape is the only one with a unique imgdir called "Cape 3" and this cape acts like a cape above the body. Nexon made a special cape, with a special name for a cat. There are capes with capeArm above the body like so.
Also notice that some capes cover the earring and others dont (:! I will release the cape script soon just need to clean it a tad bit.
Duuude, the first two capes (Heartbeat/Medical) are amazing, mind giving me the xmls?
Ehh I forgot them :/ been testing other equipment >.<!
Update:
Alright so I am slowly working on this since university started again for me. I fixed a bit with cape(the 7th picture above the arm is above the overheadCape image, and currently debugging coat and longcoat. Something interesting I found was that there are coats with effects! Also I found out the z values are important, the Maplebit's GD doesn't use any z value for coats for some reason..(not anyone's fault). Here are the z values of all the items.
The characterStart canvas is the item with the "effects".PHP Code:01040000.img.xml || mailArm
01040001.img.xml || mailChest
01040006.img.xml || mailChestBelowPants
01040018.img.xml || mailChestOverHighest
01040031.img.xml || mailChestOverPants
01042312.img.xml || characterStart
(the hearts is the effect from the shirt, cool ehh?)
What script are you using to generate the constructed char IMG? Also, if you're planning on making this public you should throw it up on Github!
Borrowed holthelper's coordinate and character.php, but removed everything in coordinate and remade coordinate's scripts to suit me, character has a bit of modification but nothing to drastic. This is how it looks calling my methods:(supports full accessories, cape, face, body, hair, and cap):
NOT OPTIMIZED! been focusing on ordering the images, I will optimize the constructed img when I have all the methods and ordering of the images):
PHP Code:$Image->createCap('vslot');
$merces = false;
$Image->createCape('capeArmBelowBody');
$Image->createCape('capeOverArm');//act as a capeBelowBody
$Image->createCape('cape');
$Image->createCape('capeArm');
$Image->createCap('Ac', 0);
$Image->createHair('belowBody');
$Image->createBody('body');
$Image->createBody('head');
$Image->createAccessories('Mask', 'accessoryFaceBelowFace');//not sure to flip this with eyes below
$Image->createAccessories('Eyes', 'accessoryEyeBelowFace');
$Image->createFace();//check the vslots of faces
$Image->createAccessories('Mask', 'accessoryFaceOverFaceBelowCap');//test 01012438 in game.
$Image->createCap('Ac', 1);//fighting for center
$Image->createAccessories('Mask', 'accessoryFace');
$Image->createAccessories('Mask', 'capeOverHead');//one item white bread.
$Image->createAccessories('Eyes', 'accessoryEye');
if($merces){
$Image->createHair();
$Image->createHair('overHead');
$Image->createBody('ear');
$Image->createAccessories('Ears', 'accessoryEar');
} else {
$Image->createAccessories('Ears', 'accessoryEar');
$Image->createHair();
$Image->createHair('overHead');
}
$Image->createAccessories('Eyes', 'accessoryOverHair');
$Image->createAccessories('Eyes', 'hairOverHead');
$Image->createAccessories('Mask', 'weaponBelowArm');//Really accessoryFace(the 6 items that have this are Lucky Tree Branch Noses or Tree Branch Noses)
$Image->createAccessories('Ears', 'accessoryEarOverHair');//the weird helmet thingie Xeonon I think. //fighting for center
$Image->createCap();
$Image->createAccessories('Ears', 'capOverHair');//Andriod Earrings might be below cap
$Image->createAccessories('Eyes', 'accessoryEyeOverCap');
$Image->createBody('arm');
$Image->createCape('capeOverHead');//[01102564]
$Image->createCape('cape', 1);
//needs to test if the two cape above should be below the clothe
//$Image->createCoat(0); // mailChestBelowPants
//$Image->createPants();//chest and arm
$Image->createCoat(1);//chest and arm / mailChestOverPants/mailChestOverHighest
$Image->createCape('capeArm', 1);//above everything even clothe
$Image->createCape('capeOverArm',1);//above everything even clothe
$Image->createBody('hand');
2-3 months school and stuff slows it down a bit, but I'm not going to stop developing it until i finish it:p
- - - Updated - - -
Also I do apologize on not adding scripts yet, atm to test coat I need pants and to have pants I need shoes.. so basically I need to create three scripts to display three things due to the z values of each of them.Here is my coat, and pants positioning(I haven't tested it but by naming), and pants have shoes z values so now I have to make the shoes scripts:
PHP Code:/*
$Image->createCoat('mailChestBelowPants');
$Image->createPants();//z value default is pants
$Image->createCoat();//z value default is mailChest(mailChest/mailArm/characterStart)
$Image->createCoat('mailChestOverPants');
$Image->createPants('pantsOverMailChest');
$Image->createCoat('mailChestOverHighest');over everything? what the fuck is this Nexon.
01060001.img.xml || pantsBelowShoes <~CreatePants
01060010.img.xml || pantsOverShoesBelowMailChest <~CreatePants ( need shoes to check their z values.. lol)*/
Update:
Alright guys, so I finally(my god this was painful as hell) finished longcoat, coat, pants, and shoes..(once I finished coat and did longcoat, it broke most of my previous work with coat so it was a back and forth). Strangely, as you saw above coat had effect imgdir which was amazing. However, when I finished doing shoes I found this itemID(1073010 - ODM Gear) Which is the shoes of attack on titan. What is unique about this shoe is that it contains an OverBody canvas, so by definition this isn't a standard shoe. Below are the images of this shoes for you to see what I mean by "more than a shoe":
![]()
First thought was .. wtf how the hell is this even a shoe it's so much more... so upon checking out the event online I found out how it suppose to look like:
I was tempted not to support that canvas because it's a freaking shoe.. so I added support to it, and decided to "mimic" the AOT look and here is the result:
Nexon's version
My version.
For shits and giggles, I also found the cap that mimics the AOT face(itemid:1004393):
Here is where it gets interesting.. in Nexon's verision the girl to the left(Mikasa) is shown there through a cape. Yes that's a cape. However in the XML THERE IS NO IMGDIR FOR THESE CAPES AT ALL just the "info" imgdir:
I'm here like where is the "cape" image at? then I did some digging, and decided to check the effect.wz file to see if it's there. Lord behold, I found it:
SOO. When I found it, I also found there is a list full of "Effect" for items in the effects.wz, like the zak helm background, wings, and stuff, so I was wondering if you guys want this GD to support the "effects" of certain items or not, this means when you guys create a GD you will need the character.wz XMLs and effect.wz XMLS.
Oh here is the event where I found most of Nexon's images: MapleStory Cash Shop Specials 1/21 - 1/27
Also for those curious how big the "Titan escape" cape is:
![]()
Last edited by iAkira; 11-01-16 at 01:45 AM.