knights-canvas
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -37,2 +37,4 @@ const Canvas = require("canvas"); | ||
module.exports.Inv = require('./src/update/Inv'); | ||
module.exports.Horny = require('./src/update/Horny'); | ||
module.exports.Vs = require('./src/update/Vs'); | ||
//welcome | ||
@@ -39,0 +41,0 @@ module.exports.Goodbye2 = require('./src/greetings2/Goodbye2'); |
{ | ||
"name": "knights-canvas", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "hello world(>////<)", | ||
@@ -20,7 +20,5 @@ "main": "index.js", | ||
"knights canvas", | ||
"squad 404", | ||
"Girl Frontline", | ||
"Arknights" | ||
"squad 404" | ||
], | ||
"author": "LINZ", | ||
"author": "squad404", | ||
"license": "ISC", | ||
@@ -27,0 +25,0 @@ "bugs": { |
@@ -31,3 +31,3 @@ <p align="center"> | ||
const knights = require("knights-canvas"), | ||
const fs = require('fs'); | ||
const fs = require('fs'); | ||
@@ -56,3 +56,3 @@ const image = await new knights.Welcome() | ||
const knights = require("knights-canvas"), | ||
const fs = require('fs'); | ||
const fs = require('fs'); | ||
@@ -79,3 +79,3 @@ var image = await new knights.Welcome2() | ||
const knights = require("knights-canvas"), | ||
const fs = require('fs'); | ||
const fs = require('fs'); | ||
@@ -105,3 +105,3 @@ const image = await new knights.Rank() | ||
const knights = require("knights-canvas"), | ||
const fs = require('fs'); | ||
const fs = require('fs'); | ||
@@ -120,5 +120,28 @@ const image = await new knights.Up() | ||
#### new update | ||
<!-- Maker --> | ||
<details><summary><b>Maker</b></summary><br> | ||
```js | ||
const knights = require("knights-canvas"), | ||
const fs = require('fs'); | ||
const image = await new knights.Horny() | ||
.setAvatar("https://i.ibb.co/1s8T3sY/48f7ce63c7aa.jpg") | ||
.toBuild(); | ||
data = image.toBuffer(); | ||
await fs.writeFileSync(__path +'/tmp/swelkom.png', data) | ||
``` | ||
#### result | ||
<img src="https://i.ibb.co/dQChtfB/Horny.png" height="240"></img> | ||
</details> | ||
#### ✉ req ? chat me on | ||
[![Telegram](https://img.shields.io/badge/Telegram-362a63?style=for-the-badge&logo=telegram&logoColor=black)](https://t.me/dr_lingz) | ||
## Credits | ||
@@ -128,5 +151,5 @@ ##### thanks my team for the help | ||
* [`Len`](https://github.com/lenz-cmd) | ||
* [`Arya`](https://github.com/) | ||
* [`Felix`](https://github.com/) | ||
* [`Arya`](https://github.com/Arya-202265) | ||
* [`Felix`](https://github.com/Felix-502) | ||
##### knights-canvas | ||
## (>y<) | ||
## (^ω^) |
@@ -62,10 +62,7 @@ const Canvas = require("canvas"); | ||
ctx.textAlign = 'center'; | ||
ctx.fillStyle = "#000000"; | ||
ctx.fillStyle = "#ff4b74"; | ||
ctx.fillText(`~ ${this.num} ~`, 300, 370); | ||
ctx.lineWidth = 5; | ||
ctx.strokeStyle = "#d7ceff"; | ||
ctx.strokeText(`~ ${this.num} ~`, 300, 370); | ||
return canvas; | ||
} | ||
}; |
@@ -42,5 +42,5 @@ const Canvas = require("canvas"); | ||
let pp1 = Canvas.loadImage(this.avatar1); | ||
let pp1 = await Canvas.loadImage(this.avatar1); | ||
ctx.drawImage(pp1, 28, 30, 183, 183); | ||
let pp2 = Canvas.loadImage(this.avatar2); | ||
let pp2 = await Canvas.loadImage(this.avatar2); | ||
ctx.drawImage(pp2, 320, 30, 183, 183); | ||
@@ -47,0 +47,0 @@ |
const Canvas = require("canvas"); | ||
function intToString(num) { | ||
if (num < 1000) { | ||
return num; | ||
} | ||
var si = [ | ||
{v: 1E3, s: "K"}, | ||
{v: 1E6, s: "M"}, | ||
{v: 1E9, s: "B"}, | ||
{v: 1E12, s: "T"}, | ||
{v: 1E15, s: "P"}, | ||
{v: 1E18, s: "E"} | ||
]; | ||
var i; | ||
for (i = si.length - 1; i > 0; i--) { | ||
if (num >= si[i].v) { | ||
break; | ||
} | ||
} | ||
return (num / si[i].v).toFixed(2).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, "$1") + si[i].s; | ||
} | ||
module.exports = class Stat { | ||
constructor() { | ||
this.bg = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT9qmH2D7bFOOcWpuOldMB54s9clDtQ3EmAmg&usqp=CAU"; | ||
this.profile = "https://i.ibb.co/zHVJHHW/Profile.png"; | ||
this.chara = "https://i.ibb.co/wCt3dr7/magician.png"; | ||
this.bg = "https://i.ibb.co/y0nDg4Y/images-q-tbn-ANd9-Gc-QD6c-GUO5dnbw-B1r-JCz4w-MYyqp-DNJu-Ik-Nmayw-usqp-CAU.jpg"; | ||
this.energy = "https://i.ibb.co/3dFrDkg/Energy.png"; | ||
this.health = "https://i.ibb.co/cFg8r0m/Health.png"; | ||
this.chp = "10"; | ||
this.nhp = "100"; | ||
this.cenergy = "10"; | ||
this.nenergy = "100"; | ||
this.caxe = "10"; | ||
this.naxe = "100"; | ||
this.cpick = "100"; | ||
this.npick = "100"; | ||
this.csword = "10"; | ||
this.nsword = "10"; | ||
this.chara = "https://i.ibb.co/wCt3dr7/magician.png"; | ||
this.assent = "https://i.ibb.co/wwwPKP1/Me.png"; | ||
this.currhp = "10"; | ||
this.needhp = "100"; | ||
this.currener = "10"; | ||
this.needer = "50"; | ||
this.money = "10"; | ||
} | ||
//*****background | ||
setBg(value) { | ||
this.bg = value; | ||
setCurrentHp(value) { | ||
this.currhp = value; | ||
return this; | ||
} | ||
setChara(value) { | ||
this.avatar = value; | ||
setNeedHp(value) { | ||
this.needhp = value; | ||
return this; | ||
} | ||
//*****health | ||
setHp(value) { | ||
this.chp = value; | ||
setCurrentEnergy(value) { | ||
this.currener = value; | ||
return this; | ||
} | ||
setFhp(value) { | ||
this.nhp = value; | ||
setNeedEnergy(value) { | ||
this.needer = value; | ||
return this; | ||
} | ||
//*****energy | ||
setEnergy(value) { | ||
this.cenergy = value; | ||
setChara(value) { | ||
this.chara = value; | ||
return this; | ||
} | ||
setFenergy(value) { | ||
this.nenergy = value; | ||
setMoney(value) { | ||
this.money = value; | ||
return this; | ||
} | ||
//*****axe | ||
setAxe(value) { | ||
this.caxe = value; | ||
return this; | ||
} | ||
setFaxe(value) { | ||
this.naxe = value; | ||
return this; | ||
} | ||
//*****Pickaxe | ||
setPickaxe(value) { | ||
this.cpick = value; | ||
return this; | ||
} | ||
setFpick(value) { | ||
this.npick = value; | ||
return this; | ||
} | ||
//*****Sword | ||
setSword(value) { | ||
this.csword = value; | ||
return this; | ||
} | ||
setFsword(value) { | ||
this.nsword = value; | ||
return this; | ||
} | ||
async toAttachment() { | ||
const canvas = Canvas.createCanvas(600, 600); | ||
// Create canvas | ||
const canvas = Canvas.createCanvas(450, 300); | ||
const ctx = canvas.getContext("2d"); | ||
//bar hp | ||
const currhp = this.chp; | ||
const needhp = this.nhp; | ||
const currhp = this.currhp; | ||
const needhp = this.needhp; | ||
const health = (100 * currhp) / needhp; | ||
const darah = (health * 210) / 100; | ||
const darah = (health * 160) / 100; | ||
//bar energy | ||
const curre = this.cenergy; | ||
const neede = this.nenergy; | ||
const curre = this.currener; | ||
const neede = this.needer | ||
const energy = (100 * curre) / neede; | ||
const energi = (energy * 218) / 100; | ||
const energi = (energy * 172) / 100; | ||
//bar axe | ||
const curraxe = this.caxe; | ||
const needaxe = this.naxe; | ||
const axe = (100 * curraxe) / needaxe; | ||
const kapak = (axe * 90) / 100; | ||
//bar pickaxe | ||
const currpick = this.cpick; | ||
const needpick = this.npick; | ||
const pickaxe = (100 * currpick) / needpick; | ||
const beliung = (pickaxe * 90) / 100; | ||
//bar sword | ||
const csword = this.csword; | ||
const nsword = this.nsword; | ||
const sword = (100 * csword) / nsword; | ||
const pedang = (sword * 90) / 100; | ||
//background | ||
// Draw background | ||
let background = await Canvas.loadImage(this.bg); | ||
ctx.drawImage(background, 0, 0, 450, 300); | ||
let iyga = await Canvas.loadImage(this.bg); | ||
ctx.drawImage(iyga, 0, 0, 600, 600); | ||
//frame background | ||
ctx.globalAlpha = 10; | ||
let imgb = await Canvas.loadImage(this.profile); | ||
ctx.drawImage(imgb, 0, 0, 600, 600); | ||
//bar health | ||
ctx.fillStyle = "#CB5A8D"; | ||
ctx.fillRect(358, 111, 210, 25); | ||
// frame background | ||
let b = await Canvas.loadImage(this.assent); | ||
ctx.drawImage(b, 0, 0, 450, 300); | ||
ctx.save(); | ||
ctx.beginPath(); | ||
ctx.fillStyle = "#CB5A8D"; | ||
ctx.fillRect(256, 81, 160, 18.5); | ||
ctx.fillStyle = "#F44336"; | ||
ctx.fillRect(358, 111, darah, 25); | ||
ctx.fillRect(256, 81, darah, 18.5); | ||
ctx.strokeStyle = "#ffffff"; | ||
ctx.lineWidth = 1; | ||
ctx.strokeRect(358, 111, 210, 25); | ||
ctx.strokeRect(256, 81, 160, 18.5); | ||
let iy = await Canvas.loadImage(this.health); | ||
ctx.drawImage(iy, 286, 50, 290, 145); | ||
var iy = await Canvas.loadImage(this.health); | ||
ctx.drawImage(iy, 195, 30, 228, 120); | ||
//bar energi | ||
//bar energi | ||
ctx.save(); | ||
ctx.beginPath(); | ||
ctx.fillStyle = "#ffae89"; | ||
ctx.fillRect(352, 185, 218, 25); | ||
ctx.fillRect(247, 148.5, 172, 21); | ||
ctx.fillStyle = "#ffe300"; | ||
ctx.fillRect(352, 185, energi, 25); | ||
ctx.fillRect(247, 148.5, energi, 21); | ||
ctx.strokeStyle = "#ffffff"; | ||
ctx.lineWidth = 1; | ||
ctx.strokeRect(352, 185, 218, 25); | ||
ctx.strokeRect(247, 148.5, 172, 21); | ||
let petir = await Canvas.loadImage(this.energy); | ||
ctx.drawImage(petir, 300, 130, 280, 136); | ||
var petir = await Canvas.loadImage(this.energy); | ||
ctx.drawImage(petir, 206, 100, 220, 118); | ||
let chara = await Canvas.loadImage(this.chara); | ||
ctx.drawImage(character, -10, 15, 370, 370); | ||
var character = await Canvas.loadImage(this.chara); | ||
ctx.drawImage(character, -35, 10, 300, 300); | ||
this.money = 2000 | ||
ctx.globalAlpha = 1; | ||
ctx.font = "700 35px arial"; | ||
ctx.textAlign = 'left'; | ||
ctx.fillStyle = "black"; | ||
ctx.fillText(intToString(this.money), 276, 255); | ||
//bar axe | ||
ctx.fillStyle = "#dde4e1"; | ||
ctx.fillRect(51, 503, 90, 5 + 5); | ||
ctx.fillStyle = "#007e36"; | ||
ctx.fillRect(51, 503, kapak, 5 + 5) | ||
ctx.strokeStyle = "#000000"; | ||
ctx.lineWidth = 2; | ||
ctx.strokeRect(51, 503, 90, 5 + 5); | ||
//bar pickaxe | ||
ctx.fillStyle = "#dde4e1"; | ||
ctx.fillRect(179, 503, 90, 10); | ||
ctx.fillStyle = "#007e36"; | ||
ctx.fillRect(179, 503, beliung, 10) | ||
ctx.strokeStyle = "#000000"; | ||
ctx.lineWidth = 2; | ||
ctx.strokeRect(179, 503, 90, 10); | ||
ctx.fillStyle = "#dde4e1"; | ||
ctx.fillRect(307, 503, 90, 10); | ||
ctx.fillStyle = "#007e36"; | ||
ctx.fillRect(307, 503, pedang, 10) | ||
ctx.strokeStyle = "#000000"; | ||
ctx.lineWidth = 2; | ||
ctx.strokeRect(307, 503, 90, 10); | ||
return canvas; | ||
} | ||
}; |
8409918
105
4895
149