Skip to content

Commit

Permalink
书页初版
Browse files Browse the repository at this point in the history
  • Loading branch information
ENIACJushi committed Aug 8, 2024
1 parent 7292903 commit 997d10b
Show file tree
Hide file tree
Showing 25 changed files with 1,969 additions and 420 deletions.
14 changes: 8 additions & 6 deletions Docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@

## 计划

自动更新书本版本 <!-- 基础教程书(无UI版)等oreUI再写 -->
- 使用lore记录章节和版本号 √
- 向下兼容(用书名判断版本号)
- 设置手持书本的版本指令
- 潜行状态打开书,进入下一章
√ 改良UI,使其能够更好兼容其它模组的特殊UI

指南书更新
√ 更好的自动生成,可以一次性导出所有页面
√ 使用lore记录章节和版本号
√ 无法向下兼容,因为旧书和其它成书别无二致
√ 设置手持书本的版本指令
- 打开书时检查版本号,和当前版本不一致则更新版本
- 潜行状态打开书,进入下一章


NTR工具:开墓碑

隙间

- 物品隙间:可以放置6个方向的方块隙间
- 方块隙间:放置时原地生成一个实体隙间
- 实体隙间
Expand Down
42 changes: 37 additions & 5 deletions MemorizableGensokyo/Book.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,26 @@ export class Book {
*
* @param {Number} page 页数
* @param {String} value 内容
* @param {boolean} trim
*/
setLang(page, value){
setLang(page, value, trim=true){
let key = `tlm.${Book.getSeqStr(this.bookId)}${Book.getSeqStr(page)}`;
this.langs.set(key, value);
// 去除末尾的换行和空格
let res = value;
if(trim){
while(true){
if(res.endsWith(' ')){
res = res.substring(0, res.length - 1);
}
else if(res.endsWith('%1')){
res = res.substring(0, res.length - 2);
}
else{
break;
}
}
}
this.langs.set(key, res);
return key;
}
/**
Expand All @@ -52,13 +68,22 @@ export class Book {
/**
* 导出所有语言文本
*/
exportLangs(){
exportLangs(align){
let res = [];
for(let [key, value] of this.langs){
res.push(`${key}=${value}`);
}
return res;
}
/**
* 对齐 若页数小于所给值,则在末尾填充空text页面
* @param {Number} n
*/
align(n){
while(this.pages.length < n){
this.addText(' ', false);
}
}
/**
* 解析一组书籍数据
* @param {Array} book
Expand All @@ -71,17 +96,19 @@ export class Book {
case "craft": this.addCraft(page.content, page.recipe); break;
case "altar": this.addAltar(page.content, page.recipe); break;
case "double_module": this.addDoubleModule(page.content, page.module1, page.module2); break;
case "placeholder": this. addPlaceholder(); break;
default: break;
}
}
}
/**
* 增加一个纯文本页 文本中的 \n 将会单独列出
* @param {String} text
* @param {boolean} [trim=true]
*/
addText(text){
addText(text, trim=true){
let lines = text.replace(new RegExp('\n', 'g'), "%1");
let key = this.setLang(this.pages.length, lines);
let key = this.setLang(this.pages.length, lines, trim);
this.pages.push({"rawtext":[{"translate": key,"with":["\n"]}]});
}
/**
Expand Down Expand Up @@ -147,10 +174,15 @@ export class Book {
let key = this.setLang(this.pages.length, res);
this.pages.push({"rawtext":[{"translate": key,"with":["\n"]}]});
}

addPlaceholder(){
this.addText(' ', false);
}

addInvalidItem(name){
this.invalidItems.add(`${this.bookId}-${this.pages.length}-${name}`);
}

//// Tools ////
static resolveModule(module){
switch(module.type){
Expand Down
247 changes: 247 additions & 0 deletions MemorizableGensokyo/books/en_US.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
import {recipeList} from "../../TouHouLittleMaid_BP/scripts/data/recipes/index.js"

export const book1 = [
// 前言
{ type: "text", content:
` §lOverview§r
§7(1/3)§r
A mod about the maid and the touhou project. Thanks 7z for making the UI. Thanks to people like Tartrate and Snownee for making TLM java mod. Thanks to the artists for producing excellent models. Thanks to Verclene, the author of LMM mod.`
// 目录
},
{ type: "text", content:
` §lCatalogue§r
Touhou Project..............3
Fairy Maid.............................4
Power Point.........................5
Gohei & Danmaku..............7
Altar..........................................9`
},
{type: "text", content:
`§lTouhou Project§r
The Touhou Project is a Japanese doujin game series by Sole Team Shanghai Alice member ZUN that specializes in Shoot 'em Ups.
Touhou Wiki: https://en.touhouwiki.net/wiki/Touhou_Wiki`
// 单图 图片位置用 $image$ 表示
},
{ type: "img", img: 0x10, content:
`§lFairy Maid§r
The looting of this mob are important crafting ingredient.
$image$
Spawn on the night and attack the player with danmaku.`
},
{ type: "img", img: 0x12, content:
`§lPower Point§r
The power point is an important resource for this mod, which is obtained by killing the maid fairy Can be used for altar crafting.
$image$`
},
{ type: "text", content:
`
You can also find some in the chest of the desert temple.
When you holds gohei, you can see the power value above the inventory. The maximum power value is 5, and more than this number power point no longer increases.`
},
// 工作台合成 自动区分有序/无序,但物品贴图要手动添加 $recipe$是合成表插入的位置
{type: "craft", recipe: "hakurei_gohei.json", content:
`§lGohei and Danmaku§r
The gohei is a long-range weapon that shoots a barrage.
$recipe$
`
},
{ type: "text", content:
`
When you interact with any block in sneaking mode, you can switch types.
Due to technical limitations, the gohei made by the composite table need to be used by the other block before they can be activated.`
},
{ type: "img", img: 0x11, content:
`§lAltar§r
The altar is the multi-block structure required for the craft of this mod. The craft also requires player's power point.
$image$`
},
{ type: "img", img: 0x13, content:
`
Use the gohei to right click on the red wool front left of center of the fourth layer to build an altar.
$image$`
},
{ type: "text", content:
` You can right click on the top of each of the six pillars to place items. Jump under the pole and pick it up. When the item is fully placed and the Power value is sufficient, the altar can trigger crafting.
When crafting is interrupted due to lack of Power, replacing any material after obtaining enough Power can `
},
{ type: "text", content:
`trigger crafting.
There is no need to worry about forgetting to remove the material, the items on the altar will not automatically disappear.`
}

]

////// 第二章 //////
export const book2 = [
{ type: "text", content:
`
§lMaid§r
§7(2/3)§r
Introduced the basic functions of the maid.`
},
// 目录
{ type: "text", content:
`
§lCatalogue§r
Spawn Maid.............................3
Reborn Maid..........................4
Upgrade Maid.......................5
Camera & Photo.................7
Chisel & Statues...............9
Backpack.................................9
Princess Hug....................10`
},
// patchouli.touhou_little_maid:book.entries.maid.spawn_maid.name.name
{ type: "altar", recipe: recipeList.spawn_box, content:
`§lSpawn Maid§r
The way to get a maid is very special and needs to be done through a multi-blocks altar.
$recipe$`
},
{type: "text", content:
`
After the maid is successfully spawned in a multi-blocks altar, you will get a cake box wrapped with the maid, just right-click the cake box to open it. You will need a cake to tame the maid.
In the standing state, the master can switch between standby modes. A maid in standby mode`
},
{type: "text", content:
`does nothing, not even to avoid risk.
In the sneaking state, an attack can open the information panel and interactive can open the backpack interface.`
},
// patchouli.touhou_little_maid:book.entries.maid.film.pages.0.text.name
{ type: "altar", recipe: recipeList.reborn_maid, content:
`§lReborn Maid§r
The maid will drop a film after death, and the film can be used in altar to reborn the maid.
$recipe$`
},
{ type: "altar", recipe: recipeList.maid_upgrade, content:
`§lUpgrade Maid§r
Place maids who have reached 200 kills in the center of the altar and level up with Sakura Gohei and Magic Powder.
$recipe$`
},
{ type: "altar", recipe: recipeList.craft_camera, content:
`§lCamera & Photo§r
Carry a maid across dimensions or at a distance is a hassle, and the camera is designed for this purpose.
$recipe$`
},
{ type: "text", content:
`
Just take a photo of your maid with camera and turn it into a photo, then hold the photo and right click on a block to release it.
`
},
// patchouli.touhou_little_maid:book.entries.other.chisel_and_statues.name.name
{ type: "altar", recipe: recipeList.craft_chisel, content:
`§lChisel & Statues§r
Right-click the clay with a chisel can make statues of different sizes. Currently supports 1x1x1, 1x1x2, 2x2x4, 3x3x6 sizes.
$recipe$`
},
{ type: "text", content:
`
Holds a photo in offhand, chisel in mainhand, then right-clicks the lower left corner of the multi-block structure to engrave the maid in the photo.
The fire roasted 1x1 size statue can be converted into Garage Kit.`
},
{ type: "img", img: 0x14, content:
`
$image$`
},
{ type: "altar", recipe: recipeList.craft_maid_backpack_small, content:
`§lBackpack§r
The backpack can be used to expand the inventory of the maid. It can be applied by holding the backpack, sneaking, and right-click on the maid.
Use the shears to remove the maid's backpack.`
},
{ type: "double_module", module1: {type: "altar", recipe: recipeList.craft_maid_backpack_small},
module2: {type: "altar", recipe: recipeList.craft_maid_backpack_middle}, content:
`$module1$
$module2$`
},
{ type: "altar", recipe: recipeList.craft_maid_backpack_big, content:
`
$recipe$`
},
{ type: "img", img: 0x15, content:
`§lPrincess Hug§r
Hold the saddle, interact with the maid, you can pick her up, interact again, you can put her down.
$image$
`
}
]


////// 第三章 //////
export const book3 = [
{ type: "text", content:
`
§lOthers§r
§7(3/3)§r
Introduce some miscellaneous content.
`
},
{ type: "text", content:
`
§lCatalogue§r
Memorizable Gensokyo..1
Gohei............................................2
Lighting......................................3
Gold Microwave Oven.....4`
},
{ type: "craft", recipe: "memorizable_gensokyo.json", content:
`§lMemorizable Gensokyo§r
Book, cake.
$recipe$`
},
{ type: "altar", recipe: recipeList.craft_hakurei_gohei, content:
`§lGohei (Crafting)§r
Gohei can be made at the altar at a much lower cost.
$recipe$`
},
{ type: "altar", recipe: recipeList.repair_hakurei_gohei, content:
`§lGohei (repairing)§r
Gohei cannot be repaired by mending, but here's a better way without repair punishment.
$recipe$`
},
{ type: "altar", recipe: recipeList.gohei_cherry, content:
`§lSakura gohei§r
Gohei, sakura saplings, buckets, dirt.
$recipe$`
},
{ type: "altar", recipe: recipeList.spawn_lightning_bolt, content:
`§lLighting§r
Summon a lightning bolt.
$recipe$`
},
{ type: "craft", recipe: "gold_microwaver.json", content:
`§lGold microwave oven§r
Bell, blaze powder, yellow glass, gold ingot, Ender crystal.
$recipe$`
},
{ type: "craft", recipe: "dragon_skull.json", content:
`§lDragon skull§r
Lapis lazis, lightning rod, amethyst, dragon skull, chorus flower.
$recipe$`
}
]
Loading

0 comments on commit 997d10b

Please sign in to comment.