init: add workspace files

This commit is contained in:
2026-05-26 16:41:20 +08:00
commit f4f2393f72
1041 changed files with 67405 additions and 0 deletions

47
world/obj/book/book.js Normal file
View File

@@ -0,0 +1,47 @@
this.inherits(OBJ);
this.set({
unit: "本",
name: "武功秘籍",
desc: "一本武功秘籍",
max_level: 100,
combined: true,
value: 0
});
this.otype = 1;
this.on_create = function (path, par) {
if (!par) return;
par = par.substr(1);
var skill = SKILL.get(par);
if (!skill) return;
this.skill = skill.id;
this.grade = skill.grade;
var cc = this.query_grade_color();
this.name = skill.name + "秘籍";
this.color_name = "<" + cc + ">" + this.name + "</" + cc + ">";
this.desc = "一本武功秘籍,里面记载了" + skill.color_name + "的练习方法。";
var cond = skill.condition_tostring();
if (cond) {
this.desc = this.desc + "\n学习条件\n" + cond;
} else {
this.desc = this.desc + "\n学习条件无" + cond;
}
this.value = WORLD.DATA.book_values[this.grade] * COMBINED[this.grade];
}
this.on_study = function (me, skill, lv) {
if (skill.do_learn && skill.do_learn(me, lv) == false) return false;
return true;
}
//const VALUES = [1, 1000, 5000, 10000, 100000, 500000, 2000000];
const COMBINED = [1, 10, 30, 50, 100, 200, 500];
this.add_action('sbook', '存到技能仓库', function (me) {
WORLD.COMMANDS.sbook.enter(me, this.id);
});
this.add_action('split', '拆分', function (me) {
WORLD.COMMANDS.sbook.split_book(me, this);
});