Hallo. Das ist ein Sprite-Generator der für ARES entwickelt wurde.
Da Projekt Tot ist gebe ich euch den Code.
Anwendungsbeispiele:
PHP
set_time_limit(60 * 60);
require "lib.php";
$sg = new \Habbo\SpriteGenerator(\Habbo\Host::DE);
$sg->setFigure('lg-285-64.hr-170-39.ea-1404-63.ca-1805-64.hd-180-3.sh-295-64.ch-878-64.fa-1201-64,s-0.g-1.d-3.h-3.a-0');
const FRAMES = 5;
$bundle = $sg->createBundle();
foreach(\Habbo\Direction::toArray() as $direction) {
$sprite = new \Habbo\Sprite(FRAMES, $sg);
$sprite->setDirection($direction);
$sprite->setHeadDirection($direction);
$sprite->setAction(\Habbo\Action::WALK);
$sprite->setGesture(\Habbo\Gesture::SMILE);
$bundle->add($sprite);
}
$bundle->create();
Alles anzeigen
Outcome: https://cdn.discordapp.com/attachments/37…358376/walk.png
Das ganze kann man mit der AnimGif.php Library noch verbinden, dann kann man solche gifs erstellen:
https://cdn.discordapp.com/attachments/37…7/localhost.gif
Bin mir nicht sicher aber das hier müsste der relevante Code sein:
PHP
<?php
require("lib.php");
set_time_limit(60 * 60);
function err($text) {
header("Content-Type: text/plain");
echo $text;
exit;
}
if (!isset($_GET["figure"])) {
err("parameter missing: figure");
}
if (!isset($_GET["size"])) {
err("parameter missing: size");
}
$size = $_GET["size"];
if (!isset($_GET["gesture"])) {
err("parameter missing: gesture");
}
$gesture = $_GET["gesture"];
if (!isset($_GET["action"])) {
err("parameter missing: action");
}
$action = $_GET["action"];
if (!isset($_GET["direction"])) {
err("parameter missing: direction");
}
$direction = $_GET["direction"];
if (!isset($_GET["head_direction"])) {
err("parameter missing: head_direction");
}
$headDirection = $_GET["head_direction"];
$sg = new \Habbo\SpriteGenerator(\Habbo\Host::DE);
$sg->setFigure($_GET["figure"]);
try {
$sg->setSize($size);
} catch (Exception $e) {
err("invalid parameter value: size, valid values = " . implode(", ", \Habbo\Size::toArray()));
}
$bundle = $sg->createBundle();
$bundle->setFilePath("./out/");
$sprite = new \Habbo\Sprite($_GET["frames"] ?? 5, $sg);
try {
$sprite->setGesture($gesture);
} catch (Exception $e) {
err("invalid parameter value: gesture, valid values = " . implode(", ", \Habbo\Gesture::toArray()));
}
try {
$sprite->setAction($action);
} catch (Exception $e) {
err("invalid parameter value: action, valid values = " . implode(", ", \Habbo\Action::toArray()));
}
try {
$sprite->setDirection($direction);
} catch (Exception $e) {
err("invalid parameter value: direction, valid values = " . implode(", ", \Habbo\Direction::toArray()));
}
try {
$sprite->setHeadDirection($headDirection);
} catch (Exception $e) {
err("invalid parameter value: head_direction, valid values = " . implode(", ", \Habbo\Direction::toArray()));
}
$bundle->add($sprite);
$gif = isset($_GET["gif"]) && !!$_GET["gif"];
if (!$gif) {
$bundle->create(true);
} else {
$s = $bundle->create(false, true);
$images = [];
$durations = [];
for ($i = 0; $i < $sprite->getFrames(); $i++) {
$img = imagecreatetruecolor(imagesx($s) / $sprite->getFrames(), imagesy($s));
imagesavealpha($img, true);
$color = imagecolorallocatealpha($img, 0, 0, 0, 127);
imagefill($img, 0, 0, $color);
imagecopy($img, $s, 0, 0, $i * (imagesx($s) / $sprite->getFrames()), 0, imagesx($s), imagesy($s));
$images[] = $img;
$durations[] = isset($_GET["duration"]) && is_numeric($_GET["duration"]) ? (int)$_GET["duration"] : 10;
}
require("./AnimGif.php");
$animation = new GifCreator\AnimGif();
$gif_object = $animation->create($images, $durations, 0);
$gif_binary = $gif_object->get();
$file_name = "animated.gif";
header("Content-type: image/gif");
echo $gif_binary;
exit;
}
Alles anzeigen
AnimGif.php: https://github.com/lunakid/AnimGi…tor/AnimGif.php
-
Version 1.0.0
-
Rapamycin -
13. März 2019 um 08:57 -
2,7 kB -
21 Downloads
-
Autor