-
Old figure format image
Hey,
I'm trying to get either a converter from old figure format to new figure format or an avatar image for the old figure format. I tried making the converter, so far I have this:
PHP Code:
class FigureParser
{
private $partNames = array('hr', 'hd', 'sh', 'lg', 'ch');
private $figure = '';
private $parts = array();
public function __construct($figure)
{
$this->figure = $figure;
foreach ($this->partNames as $partname)
{
$this->parts[$partname] = array('id' => $this->getPart(3), 'colour' => $this->getPart(2));
}
}
private function getPart($amount)
{
$part = substr($this->figure, 0, $amount);
$this->figure = substr($this->figure, $amount);
return $part;
}
public function generateNewFigure()
{
$newFigureParts = array();
foreach ($this->parts as $partname => $part)
{
array_push($newFigureParts, $partname . '-' . $part['id'] . '-' . $part['colour']);
}
return implode('.', $newFigureParts);
}
}
It's shitty code I know right... the problem is the colors. So, I got the new figure format and it seems like the figure parts (so type of shoes, shirt etc.) seems alright, but the colors are completely wrong. I have no idea if something like this works or not.
Simply said, I just have to be able to show the old figure format as an image just like you can do with the new figure format. If somebody can help me with it, eventually at the end of this month (when I get the money for my internship) I will give you a little money :)