Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Augsorn Chanklad committed Feb 21, 2019
1 parent d96513f commit 97b4897
Show file tree
Hide file tree
Showing 22 changed files with 680 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ typings/

# next.js build output
.next

package-lock.json
99 changes: 99 additions & 0 deletions flex_templates/item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
const moment = require('moment')
const poporingConfig = require('../src/poporing.config');

module.exports = generate = (item, price, volume) => {

let imageUrl = (item.image_url)? [poporingConfig.imageUrl, item.image_url].join('/'): 'https://via.placeholder.com/50x50?text=?';
let actionUri = [poporingConfig.actionUri, item.name].join();

return {
"type": "bubble",
"hero": {
"type": "image",
"url": imageUrl,
"size": "md",
"aspectRatio": "5:8",
"aspectMode": "fit",
"action": {
"type": "uri",
"uri": actionUri
}
},
"body": {
"type": "box",
"layout": "vertical",
"spacing": "md",
"action": {
"type": "uri",
"uri": actionUri
},
"contents": [
{
"type": "text",
"text": item.display_name,
"size": "md",
"weight": "bold"
},
{
"type": "box",
"layout": "vertical",
"spacing": "sm",
"contents": [
{
"type": "box",
"layout": "baseline",
"contents": [
{
"type": "text",
"text": "Price: ",
"flex": 0
},
{
"type": "text",
"text": "" + (price)? price.toLocaleString() : 'Unknown',
"weight": "bold",
"margin": "sm",
"flex": 0
},
{
"type": "text",
"text": "z",
"size": "sm",
"margin": "sm",
"color": "#aaaaaa",
"flex": 0
}
]
},
{
"type": "box",
"layout": "baseline",
"contents": [
{
"type": "text",
"text": "Volume: ",
"flex": 0
},
{
"type": "text",
"text": "" + (volume)? volume.toLocaleString() : 'Unknown',
"weight": "bold",
"margin": "sm",
"flex": 0
},
{
"type": "text",
"text": "ea",
"size": "sm",
"margin": "sm",
"color": "#aaaaaa",
"flex": 0
}
]
}
]
}
]
}
}
}
5 changes: 5 additions & 0 deletions flex_templates/itemList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const itemTemplate = require('./item')

module.exports = generate = (items) => {
return { type: 'carousel', contents: items.map(i => itemTemplate(i, i.priceData.price, i.priceData.volume))}
};
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const lineConfig = require('./line.config');
const webhookHandler = require('./webhook.handler');
const express = require('express');

const app = express();

app.post('/callback', lineConfig.middleware, webhookHandler);

app.get('/',(req, res) => {
res.send('hello kafra')
})

// listen on port
const port = process.env.PORT || 3200;
app.listen(port, () => {
console.log(`listening on ${port}`);
});
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "kafra-line",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "./node_modules/mocha/bin/mocha"
},
"author": "up2up",
"license": "MIT",
"dependencies": {
"@line/bot-sdk": "^6.4.0",
"axios": "^0.18.0",
"cache-manager": "^2.9.0",
"chance": "^1.0.18",
"express": "^4.16.4",
"moment": "^2.24.0",
"node-cache": "^4.2.0",
"object-hash": "^1.3.1",
"string-format": "^2.0.0"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^6.0.0"
}
}
32 changes: 32 additions & 0 deletions ref/aldeqa
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Al De Baran Q&A
Bard Quest Level 90
Answer: 3 2 3

Bard Quest Level 92
Answer: 1 1 2

Bard Quest Level 93
Answer: 1 2 3

Kafra (Cadele) in Town
Answer: 2 4 2 1

Boys (Rani) in Town
Answer: 4 2 4 4

5 Anvils in CT 1F
Answer: 1 3 2 3 3
Start from left to right

3 Switches in CT 1F
Answer: 2 1 3
Start from middle - left - right
Elite Quest Level 91

3 Switches in CT 2F
Answer: 2 2 4
Start from middle - right - left
Elite Quest Level 92

Clock Puzzle in CT 2F
Answer: 9 6 11
41 changes: 41 additions & 0 deletions ref/ghqa
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Glast Heim Q&A
#1 Bard Quest
Answer: 2 1 3

#2 Bard Quest
Answer: 2 1 1

#3 Bard Quest
Answer: 3 1 2

#1 Wild Rose NPC at Glast Heim (Unlock Hairstyle)
Answer: 4 1 3 2

#2 Wild Rose NPC at Glast Heim (Unlock Little Wood Block Headgear)
Answer: 1 2 1 4

#1 Knight NPC at Glast Heim Culvert
Answer: 2 3 3

#2 Knight NPC at Glast Heim Culvert
Answer: 1 4 2

Hunter at Glast Heim Churchyard
Answer: 3 2 2

Mimic at Glast Heim Field
Answer: 3 2 1 4

Lord Knight (Haidamu) at Glast Heim Lobby/Hall
Answer: 3 1 1

Horong (Schneider) at top left of Glast Heim Lobby/Hall
Answer: 1 2 4 (CN)
Answer: 1 2 3 (SEA)
(let us know if answer for CN change)

Horong (Schultz) at lower right of Glast Heim Lobby/Hall
Answer: 3 2 2

Horong (Schneider) with 7 traps top left of Glast Heim Lobby/Hall
Answer: 3 3 3 2 2 2 1 (Clock Wise)
8 changes: 8 additions & 0 deletions ref/saferefine
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
+5 1 Equip 5 Ori/Elu 100,000 Zeny
+6 2 Equip 10 Ori/Elu 220,000 Zeny
+7 3 Equip 15 Ori/Elu 470,000 Zeny
+8 4 Equip 25 Ori/Elu 910,000 Zeny
+9 6 Equip 50 Ori/Elu 1,630,000 Zeny
+10 10 Equip 85 Ori/Elu 2,740,000 Zeny

Total 26 Item 190 Ori/Elu 6,070,000 zeny
3 changes: 3 additions & 0 deletions ref/slot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Geffen - weapon, off-hand, armor
Payon - accessory
Morroc - footgear, garment
13 changes: 13 additions & 0 deletions src/cache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const NodeCache = require( "node-cache" );
const myCache = new NodeCache({ stdTTL: 100, checkperiod: 120 });

module.exports = {
get: (key, callback) => {
console.log('Try get ' + key + ' from cache');
return myCache.get(key, callback);
},
set: (key, value) => {
console.log('Try set ' + key + ' to cache');
return myCache.set(key, value);
}
}
Loading

0 comments on commit 97b4897

Please sign in to comment.