Jump to content

[SHARE] Hexagon Character Stats


Recommended Posts

Hey everybody,

 

One habit I have is creating a lot of stuff for Lineage 2 (java at least) and deleting it after I'm done with it. As I've recently been working on a project related to L2 with a friend I decided instead to release building blocks of my code that people can use to implement in their own solutions.

 

So part of my project involves a custom character creation process via a web user interface. One of the things I wanted to implement was a hexagonal style chart displaying the spread of statistical points.

YtYOr7v.jpg

 

Live test example of my objects in use: http://www.qzmpox.nl/l2/hexagon/hexagontest.php

 

So, I made it! And because I love all you guys so much (not really, most of you release the same pvp buffers over and over again and ask the same inane java questions, but oh well) I decided to release the building blocks I'm using to create the above image. So, let me explain:

 

- This requires a knowledge of PHP Programming

- This requires object oriented knowledge.

- This requires basic trigonometry knowledge.

 

Firstly, let me explain what this isn't:

This isn't code that will effect your gameserver. This isn't code that will have an impact on your data. This isn't a final solution to ready to be deployed. This also isn't the graphical information you see above in the picture.

 

Ok, then what is it?

Building block objects, provided to help you easily implement this style of solution in your own forum/website/project.

 

Then why is this useful?

Versatility! These objects have been built to be used with each other but also these objects can be use independently in projects even outside of Lineage 2! Perhaps you're even just curious and would like to see the code how it's done.

 

- CVector2.php

This is a general 2 dimensional vector object. You have an X and Y value. This object also includes static helper functions for doing mathematical operations upon vectors easily without having to pull their individual X and Y values out from the object. This can be used in all applications that involve some points in a coordinate system.

 

- CHexagon.php

This is a general hexagon calculated within a unit circle. An offset can be provided to this class since images in browsers are calculated with the origin of (0,0) being the top left corner instead of in the center. This hexagon can also be scaled to whichever size fits your application the best.

 

I'm not sure how Lineage 2 is involved.

No problem, because there are more objects!

 

- CL2StatsRepository.php

Following Domain Driven Design this object is responsible for pulling up information regarding the different classes which are defined in a seperate file (classes.json, but we'll talk about that in a bit). This repository will collect information from the JSON file, create instances of domain objects (CL2Stats) and place them in an array.

 

- CL2Stats.php

Following Domain Driven Design still this object contains all the information about a particular class. This object also calculates the scalar values for each statistic. The scalar value is a percentage of the actual stat value versus the max possible stat value. I originally had Interlude in mind but I know the later chronicles have higher values so I left this value adjustable.

 

- classes.json

A json string that contains information about avaliable classes. If your server features custom classes or you've removed some than this list is adjustable whenever so it's no problem! The inside hexagon points will be calculated automatically for the new class.

 

You said earlier theres no graphics, how do you use it then?

However you want! The geometrical information describing the entire picture is already completed for you. How you choose to draw or present these to players is left up to you using whichever graphical library you'd like to use. Maybe you don't even want to use in the same sense as I do. This can be applied to statistical things regarding L2 as well. There is an example of how I did it which you can see via files hexagontext.php and hexagonpng.php.

 

I know this one isn't very fantastic for most of you guys, but I'll be releasing my work as I go along. So perhaps I'll have some nice goodies in the future.

Download: http://www.qzmpox.nl/l2/hexagon/L2Hexagon.zip

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...