This commit is contained in:
Bill 2021-09-11 02:09:55 -04:00
parent 16479bfbfc
commit 9f3d9895be
3 changed files with 31 additions and 25 deletions

View File

@ -12,17 +12,17 @@ export const HabboAvatarGeometry = {
'geometries': [ 'geometries': [
{ {
'id': 'vertical', 'id': 'vertical',
'width': 64, 'width': 90,
'height': 110, 'height': 130,
'dx': 0, 'dx': 0,
'dy': 6 'dy': 6
}, },
{ {
'id': 'sitting', 'id': 'sitting',
'width': 64, 'width': 90,
'height': 110, 'height': 130,
'dx': 0, 'dx': 0,
'dy': 6 'dy': 0
}, },
{ {
'id': 'horizontal', 'id': 'horizontal',

View File

@ -19,21 +19,21 @@ export const HabboImagingRouterGet = async (request: Request<any, any, any, Requ
const avatarString = BuildFigureOptionsStringRequest(buildOptions); const avatarString = BuildFigureOptionsStringRequest(buildOptions);
const saveFile = new File(`${ directory.path }/${ avatarString }.${ buildOptions.imageFormat }`); const saveFile = new File(`${ directory.path }/${ avatarString }.${ buildOptions.imageFormat }`);
if(saveFile.exists()) // if(saveFile.exists())
{ // {
const buffer = await FileUtilities.readFileAsBuffer(saveFile.path); // const buffer = await FileUtilities.readFileAsBuffer(saveFile.path);
if(buffer) // if(buffer)
{ // {
response // response
.writeHead(200, { // .writeHead(200, {
'Content-Type': ((buildOptions.imageFormat === 'gif') ? 'image/gif' : 'image/png') // 'Content-Type': ((buildOptions.imageFormat === 'gif') ? 'image/gif' : 'image/png')
}) // })
.end(buffer); // .end(buffer);
} // }
return; // return;
} // }
if(buildOptions.effect > 0) if(buildOptions.effect > 0)
{ {
@ -184,8 +184,6 @@ function ProcessAvatarSprites(canvas: Canvas, avatar: IAvatarImage, avatarOffset
for(const sprite of avatar.getSprites()) for(const sprite of avatar.getSprites())
{ {
if(sprite.id === 'avatar') continue;
const layerData = avatar.getLayerData(sprite); const layerData = avatar.getLayerData(sprite);
let offsetX = sprite.getDirectionOffsetX(avatar.getDirection()); let offsetX = sprite.getDirectionOffsetX(avatar.getDirection());
@ -221,14 +219,19 @@ function ProcessAvatarSprites(canvas: Canvas, avatar: IAvatarImage, avatarOffset
const texture = asset.texture; const texture = asset.texture;
let x = ((canvasOffset.x - (1 * asset.offsetX)) + offsetX); let x = canvasOffset.x - (-(asset.offsetX));
let y = ((canvasOffset.y - (1 * asset.offsetY)) + offsetY); let y = canvasOffset.y - (-(asset.offsetY));
x += offsetX;
y += offsetY;
console.log(avatarOffset);
ctx.save(); ctx.save();
if(sprite.ink === 33) ctx.globalCompositeOperation = 'lighter'; if(sprite.ink === 33) ctx.globalCompositeOperation = 'lighter';
ctx.transform(1, 0, 0, 1, (x - avatarOffset.x), (y - avatarOffset.y)); ctx.transform(1, 0, 0, 1, (x - avatarOffset.x), y);
ctx.drawImage(texture.drawableCanvas, 0, 0, texture.width, texture.height); ctx.drawImage(texture.drawableCanvas, 0, 0, texture.width, texture.height);
ctx.restore(); ctx.restore();

View File

@ -31,8 +31,11 @@ export class Point
{ {
const clone = this.clone(); const clone = this.clone();
if(point)
{
clone.x += point.x; clone.x += point.x;
clone.y += point.y; clone.y += point.y;
}
return clone; return clone;
} }