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

71
world/obj/cash/bian.js Normal file
View File

@@ -0,0 +1,71 @@
this.inherits(OBJ);
this.set({
unit: "颗",
name: "变性丹",
desc: "使用后可以使男性变为女性,女性变为男性,无性变为男性,不满足条件的武功将被移除",
grade: 5,
value: 0
});
this.on_use = function (me) {
if (!me.is_player) return me.notify_fail("你不能使用" + this.name + "。");
var gender = me.gender == 1 ? 2 : 1;
var list = [];
for (var key in me.skills) {
var skill = SKILL.get(key);
if (skill.learn_condition) {
if (skill.learn_condition.gender &&
skill.learn_condition.gender != gender) {
if (me.skills[key].ref)
return me.notify_fail('请先取消' + skill.query_color_name(me) + '融合的技能。');
if (me.skills[key].addin && me.skills[key].addin.length)
return me.notify_fail('请先取消' + skill.query_color_name(me) + '的技能进阶。');
list.push(skill);
}
}
}
if (me.query_temp("bianxing")) {
var sum = 0;
for (var i = 0; i < list.length; i++) {
var needpot = list[i].query_needexp(me.skills[list[i].id].level, me);
if (me.remove_skill(list[i].id)) {
if (needpot)
sum += needpot;
me.notify('{type:"dialog",dialog:"skills",remove:"' + list[i].id + '"}');
}
}
me.send_room("<hiy>$N一咬牙仰头吞下一颗变性丹……\n\n</hiy>");
if (sum) {
me.notify("<hig>你遗忘的武功转化为" + sum + "点潜能。</hig>");
me.pot += sum;
}
me.add_status({
id: "faint",
is_faint: true,
duration: 10000,
name: "昏迷", downside: true,
finish_msg: "<hiy>慢慢的$N又恢复了知觉...</hiy>\n",
start_msg: "<hir>$N顿时全身经脉逆行疼痛难忍惨叫一声昏了过去……</hir>\n"
});
me.gender = gender;
} else {
var str = ["<hiy>你吞下这颗丹药后将变成:"];
str.push(["男性", "女性"][gender - 1]);
str.push("</hiy>");
if (list.length) {
str.push("\n<hir>以下武功将会被遗忘:");
for (var i = 0; i < list.length; i++) {
str.push("\n");
str.push(list[i].color_name);
}
str.push("</hir>");
}
me.notify(str.join(""));
me.set_temp("bianxing", 1, 10000);
me.send_commands("use " + this.id, "确定要吃");
return false;
}
}

21
world/obj/cash/box_sm.js Normal file
View File

@@ -0,0 +1,21 @@
this.inherits(OBJ);
this.set({
name: "师门补给包",
desc: "里面有28个橙色师门令牌,6个紫色师门令牌50精力",
unit: "个",
value: 0,
grade: 5
});
this.on_open = function (me) {
var result = [
{
obj: ["cash/jing#3"], count: 1,
}
];
return OBJ.create_by_odds(result);
}

16
world/obj/cash/ck_add.js Normal file
View File

@@ -0,0 +1,16 @@
this.inherits(OBJ);
this.set({
unit: "颗",
name: "仓库扩充石",
desc: "使用后增加你的仓库容量+10",
grade: 1,
value: 0
});
this.on_use = function (me) {
if (!me.is_player) return me.notify_fail("你不能使用" + this.name + "。");
var size = 10;
if (me.max_store_count + size > 400) return me.notify_fail("仓库最多只能扩充到400格。");
me.max_store_count += size;
me.notify('你的仓库容量扩充为' + me.max_store_count + "。");
return true;
}

25
world/obj/cash/fang.js Normal file
View File

@@ -0,0 +1,25 @@
this.inherits(OBJ);
this.set({
unit: "份",
name: "房契",
desc: "使用获得扬州城豪华住宅",
grade: 3,
value: 0
});
this.on_use = function (me, par) {
if (!me.is_player) return me.notify_fail("你不能使用" + this.name + "。");
let home = me.query_temp('home', 0);
if (home === 2) return me.notify_fail('你已经拥有自己的住宅了。');
if (home === 1) {
if (!par) {
me.notify_fail('你已经购买了单间使用契约将退款100<hiy>黄金</hiy>,是否确定?');
me.send_commands('use ' + this.id + " ok", '确定使用');
return false;
}
me.add_exp(0, 0, 1000000);
}
me.set_temp('home', 2);
me.send('<hic>感谢购买,恭喜你拥有了自己的住宅。</hic>');
me.send_commands('goto home', '现在就过去');
return true;
}

15
world/obj/cash/fangqi.js Normal file
View File

@@ -0,0 +1,15 @@
this.inherits(OBJ);
this.set({
unit: "张",
name: "技能重置卡",
desc: "把你的某项特殊技能完全重置,返回所有潜能",
grade: 4,
value: 0
});
this.on_use = function (me) {
if (!me.is_player) return me.notify_fail("你不能使用" + this.name + "。");
me.send('请从技能列表选择遗忘技能,然后选择使用重置卡,将会重置你的某项技能。');
return false;
}

97
world/obj/cash/gaiming.js Normal file
View File

@@ -0,0 +1,97 @@
this.inherits(OBJ);
this.set({
unit: "张",
name: "改名符",
desc: "更改你的名字",
grade: 2,
value: 0
});
this.on_use = function (me) {
if (!me.is_player) return me.notify_fail("你不能使用" + this.name + "。");
me.notify("请说出你的名字(打开聊天框任意频道输入)");
me.send_commands("clearwait", "取消使用");
me.wait_input = readname;
return false;
}
function readname(me, cmd) {
if (cmd == "clearwait") {
me.wait_input = null;
return me.notify("停止使用");
}
if (!cmd) return me.send('请说出你的名字(打开聊天框任意频道输入)');
var ss = cmd.split(' ');
if (ss.length != 2) return me.notify("请说出你的名字(打开聊天框任意频道输入)");
var name = ss[1];
var name_reg = /^[\u4E00-\u9FA5]{2,5}$/;
if (!name_reg.test(name)) {
return me.send('你的名字需要是2-5个中文字符');
}
if (!UTIL.check_word(name)) {
return me.send('你不能用这个名字');
}
var obj = me.find_obj_bypath("cash/gaiming");
if (!obj || !obj.count) {
me.wait_input = null;
me.send('你身上没有改名符,改名失败。');
return;
}
update_name(me, name, obj);
return false;
}
async function update_name(me, name, obj) {
try {
let result = await WORLD.DB.change_name(me.id, name);
if (!result) return me.send('名称更改失败,请联系管理员');
me.wait_input = null;
me.name = name;
me.color_name = null;
me.commands_json = null;
me.environment.item_changed(me, true);
me.remove_obj(obj, 1);
var pt = me.query_party();
if (pt) {
for (var i = 0; i < pt.roles.length; i++) {
if (pt.roles[i].id == me.id) {
pt.roles[i].name = me.name;
break;
}
}
}
if (me.query_temp('wife')) {
var wife = WORLD.getUser(me.query_temp('wife'));
if (wife) {
wife.add_title(name + '的老婆', 'mar');
wife.set_temp('husband_n', name);
}
}
if (me.query_temp('husband')) {
var husband = WORLD.getUser(me.query_temp('husband'));
if (husband) {
husband.add_title(name + '的老公', 'mar');
husband.set_temp('wife_n', name);
}
}
if (me.custom_skills) {
for (let skid of me.custom_skills) {
var sk = SKILL.get(skid);
if (sk) {
sk.desc = name + "所创造的武功";
}
}
}
return me.send('你的名字已经改为:' + name + "。");
} catch (err) {
if (err.errno == 1062) {
return me.send('这个名字已经有人使用了。');
} else {
me.wait_input = null;
return me.send('名称更改失败,请联系管理员');
}
}
}

57
world/obj/cash/jing.js Normal file
View File

@@ -0,0 +1,57 @@
this.inherits(OBJ);
this.set({
unit: "枚",
name: "养精丹",
desc: "一枚丹药吃了后会增加10点精力但是吃多了会伤肝。",
ad_jl: 10,
grade: 1,
value: 10000,
max_count: 10
});
this.on_use = function (me) {
//if (this.grade==1&& me.query_temp("jing" + this.grade) >= 10) {
// me.notify("<yel>你已经吃太多养精丹了,要注意身体。</yel>");
// return false;
//}
if (this.grade < 3) return me.notify_fail('养精丹已无法使用。');
//me.add_temp("jing" + this.grade, 1, UTIL.diff_time());
me.add_temp("ad_jl", this.ad_jl);
me.notify("<hiy>你增加了" + this.ad_jl + "点精力。</hiy>");
return true;
}
this.on_create = function (path, par) {
if (!par) return;
par = par.substr(1);
var lv = parseInt(par);
if (!(lv > 0 && lv < 5)) return;
switch (lv) {
case 1:
this.name = "养精丹";
this.ad_jl = 20;
this.desc = "一枚丹药吃了后会增加20点精力但是吃多了会伤肝。";
break;
case 2:
this.name = "养精丹";
this.ad_jl = 30;
this.desc = "一枚丹药吃了后会增加30点精力但是吃多了会伤肝。";
break;
case 3:
this.name = "养精丹";
this.ad_jl = 50;
this.desc = "一枚丹药吃了后会增加50点精力但是吃多了会伤肝。";
break;
case 4:
this.name = "养精丹";
this.ad_jl = 100;
this.desc = "一枚丹药吃了后会增加100点精力但是吃多了会伤肝。";
break;
default:
this.name = "养精丹";
this.ad_jl = 10;
this.desc = "一枚丹药吃了后会增加10点精力但是吃多了会伤肝。";
break;
}
this.grade = lv + 1;
}

19
world/obj/cash/new_box.js Normal file
View File

@@ -0,0 +1,19 @@
this.inherits(OBJ);
this.set({
name: "新手宝箱",
desc: "这是一个精铁制成的箱子,里面好像放了一些值钱的东西。",
unit: "个",
value: 0,
grade: 1,
combined: false
});
this.on_open = function (me) {
var result = [
{ obj: "cash/jing#2", count: 3 },
{ obj: "cash/saodang", count: 10 },
{ obj: "cash/tianshifu", count: 5 }
];
return OBJ.create_by_odds(result);
}

View File

@@ -0,0 +1,16 @@
this.inherits(OBJ);
this.set({
unit: "颗",
name: "背包扩充石",
desc: "使用后增加你的背包容量+10",
grade: 1,
value: 0
});
this.on_use = function (me) {
var size = 10;
if (me.max_item_count + size > 100) return me.notify_fail("背包最多只能扩充到100格。");
me.max_item_count += size;
me.send('{"type":"dialog","dialog":"pack",max_item_count:' + me.max_item_count + '}');
// me.notify('你的背包容量扩充为' + me.max_item_count + "。");
return true;
}

View File

@@ -0,0 +1,8 @@
this.inherits(OBJ);
this.set({
name: "扫荡符",
desc: "副本通关完成度100%后,可以快速完成副本",
unit: "个",
value: 10000,
grade: 2
});

27
world/obj/cash/sm.js Normal file
View File

@@ -0,0 +1,27 @@
this.inherits(OBJ);
this.set({
name: "副本补给包",
desc: "包含328个扫荡符18个天师符100精力",
unit: "个",
value: 0,
grade: 5
});
this.on_open = function (me) {
var result = [
{
obj: "cash/saodang",
count: 328
},
{
obj: "cash/tianshifu",
count: 18
},
{
obj: "cash/jing#4"
}
];
return OBJ.create_by_odds(result);
}

View File

@@ -0,0 +1,9 @@
this.inherits(OBJ);
this.set({
name: "天师符",
desc: "使用后可使你原地复活",
unit: "个",
value: 0,
value: 50000,
grade: 3
});

45
world/obj/cash/tool.js Normal file
View File

@@ -0,0 +1,45 @@
this.inherits(OBJ);
this.set({
unit: "个",
name: "工具自选礼包",
desc: "使用后可选择任意一种工具",
grade: 1,
value: 100
});
this.on_create = function (path, par) {
if (!par) return;
par = par.substr(1);
var lv = parseInt(par);
if (!(lv > 0 && lv < 6)) return;
this.grade = lv;
}
function wrap_name(text, grade) {
const level_desc = ["wht", "hig", "hic", "hiy", "hiz", "hio", 'ord'];
let tag = level_desc[grade];
return `<${tag}>${text}</${tag}>`;
}
this.on_use = function (me, par) {
if (!par) {
var str = ["{type:\"cmds\",items:["];
var list = ["一把" + wrap_name('铁镐', this.grade), "一根"
+ wrap_name('钓鱼竿', this.grade), "一本" + wrap_name('药王神篇', this.grade)];
for (var i = 0; i < list.length; i++) {
str.push("{cmd:\"use " + this.id + " ");
str.push(i + 1);
str.push("\",name:\"");
str.push(list[i]);
str.push("\"},");
}
str.push("]}");
me.notify("选择你想要的工具:");
return me.notify_fail(str.join(""));
}
let path = ['sp/tool/chu#', 'sp/tool/diao#', 'sp/tool/yao#'][parseInt(par) - 1];
if (!path)
return me.notify_fail('选择错误,请重新选择。');
let obj = me.add_obj(path + this.grade, 1);
me.send('你获得了' + obj.unit_name(1) + "。");
return true;
}

View File

@@ -0,0 +1,68 @@
this.inherits(OBJ);
this.set({
name: "工具包",
desc: "里面有一套黄色工具,几个橙色鱼饵,指南",
unit: "个",
value: 0,
grade: 5
});
this.on_open = function (me) {
let index = me.add_temp('gjx1', 1);
let result = [];
if (index === 1) {
result.push(
{
obj: "sp/tool/yao#4"
});
result.push(
{
obj: "sp/tool/chu#3"
});
result.push(
{
obj: "sp/tool/diao#3"
});
} else if (index === 2) {
result.push(
{
obj: "sp/tool/chu#4"
});
result.push(
{
obj: "sp/tool/yao#3"
});
result.push(
{
obj: "sp/tool/diao#3"
});
} else if (index === 3) {
result.push(
{
obj: "sp/tool/diao#4"
});
result.push(
{
obj: "sp/tool/chu#3"
});
result.push(
{
obj: "sp/tool/yao#3"
});
me.remove_temp('gjx1');
}
result.push({
obj: "sp/tool/er#5", min: 5, max: 6
});
result.push(
{
obj: "sp/tool/exp#5", min: 1, max: 3
});
return OBJ.create_by_odds(result);
}

94
world/obj/cash/tuoli.js Normal file
View File

@@ -0,0 +1,94 @@
this.inherits(OBJ);
this.set({
unit: "张",
name: "叛师符",
desc: "使用后可以使脱离当前门派,门派学到的所有武功会遗忘,会返还你学习和练习技能消耗的潜能",
grade: 5,
value: 0
});
this.on_use = function (me) {
if (!me.is_player) return me.notify_fail("你不能使用" + this.name + "。");
if (me.query_temp('tuolicd')) return me.notify_fail("你刚脱离门派没多久,频繁的背叛师门会被武林中人所不齿的。");
if (!me.family || me.family == FAMILIES.NONE)
return me.notify_fail("你还没有门派,不需要叛师。");
var list = [];
var up_count = 0;
for (var key in me.skills) {
var skill = SKILL.get(key);
if (skill.family === me.family) {
let skitem = me.skills[key];
if (skitem.ref)
return me.notify_fail('请先取消' + skill.query_color_name(me) + '融合的绝招。');
if (skitem.addin && skitem.addin.length)
return me.notify_fail('请先取消' + skill.query_color_name(me) + '的技能进阶。');
list.push(skill);
if (skill.source_skill) {
up_count += (skill.grade === 4 ? 50 : 100);
}
}
}
if (me.query_temp("tuoli")) {
var sum = 0;
for (var i = 0; i < list.length; i++) {
var needpot = list[i].query_needexp(me.skills[list[i].id].level, me);
if (me.remove_skill(list[i].id)) {
if (needpot)
sum += needpot;
me.notify('{type:"dialog",dialog:"skills",remove:"' + list[i].id + '"}');
}
}
me.send_room("<hiy>$N义无反顾的拿出叛师符嘴里念念有词...\n\n</hiy>");
if (sum) {
me.notify("<hig>你遗忘的武功转化为" + parseInt(sum) + "点潜能。</hig>");
me.pot += parseInt(sum);
}
if (up_count > 0) {
let obj = me.add_obj('book/up', up_count);
me.notify("你获得了" + obj.unit_name(up_count) + "。");
}
me.add_status({
id: "faint",
is_faint: true,
duration: 10000,
name: "昏迷", downside: true,
finish_msg: "<hiy>慢慢的$N又恢复了知觉...</hiy>\n",
start_msg: "<hir>$N突然觉得一生所学忘了个精光头痛难忍惨叫一声昏了过去……</hir>\n"
});
let fam = me.family;
me.family = FAMILIES.NONE;
me.add_title("普通百姓", "family");
me.remove_temp("master");
//me.remove_temp("master");
me.remove_temp("family");
me.remove_temp("family_level");
me.set_temp('tuolicd', 1, UTIL.diff_time());
WORLD.DATA.reset_famtops(me, fam);
} else {
var str = ["<hiy>你使用这张符咒后将会脱离" + me.family.name + ",以下武功将会被遗忘:"];
str.push("</hiy>");
if (list.length) {
str.push("\n");
for (var i = 0; i < list.length; i++) {
str.push("\n");
str.push(list[i].color_name);
}
str.push("");
}
str.push('\n脱离门派期间师门物资将停止发放。');
if (up_count > 0) {
str.push('\n退还' + up_count + '份<hiz>门派进阶残页</hiz>。');
}
me.notify(str.join(""));
me.set_temp("tuoli", 1, 10000);
me.send_commands("use " + this.id, "确定脱离门派");
return false;
}
}

79
world/obj/cash/xi.js Normal file
View File

@@ -0,0 +1,79 @@
this.inherits(OBJ);
this.set({
unit: "颗",
name: "洗髓丹",
desc: "使用后可以重新设置你的先天属性",
grade: 3,
value: 0
});
this.on_use = function (me) {
if (!me.is_player) return me.notify_fail("你不能使用" + this.name + "。");
var count = me.str + me.con + me.dex + me.int;
var max = 30 + count - 80;
me.notify("请说出你的先天属性(臂力 根骨 身法 悟性)每项15-" + max + ",总计" + count + ",比如:20 20 20 20");
me.wait_input = readnumber;
me.send_commands("quxiao", "取消使用");
return false;
}
function readnumber(me, cmd) {
var count = me.str + me.con + me.dex + me.int;
var max = 30 + count - 80;
var nitify = "请说出你的先天属性(臂力 根骨 身法 悟性)每项15-" + max + ",总计" + count + ",比如:20 20 20 20";
if (!cmd) {
return me.notify(nitify);
}
if (cmd == 'quxiao') {
me.wait_input = null;
me.notify('已取消使用洗髓丹。');
return;
}
var ss = cmd.split(' ');
if (ss.length != 5) return me.notify(nitify);
var str = parseInt(ss[1]);
var con = parseInt(ss[2]);
var dex = parseInt(ss[3]);
var int = parseInt(ss[4]);
if (!(str > 14 && str <= max)) return me.notify("臂力需要在15-" + max + "之间。");
if (!(con > 14 && con <= max)) return me.notify("根骨需要在15-" + max + "之间。");
if (!(dex > 14 && dex <= max)) return me.notify("身法需要在15-" + max + "之间。");
if (!(int > 14 && int <= max)) return me.notify("悟性需要在15-" + max + "之间。");
if (str + con + dex + int != count) {
return me.notify("总计需要是" + count + ",请重新设置:");
}
me.set_temp("re_str", str);
me.set_temp("re_con", con);
me.set_temp("re_dex", dex);
me.set_temp("re_int", int);
me.notify("属性调整为臂力:" + str + ",根骨:" + con + ",身法:" + dex + ",悟性:" + int + ",是否确认?");
me.send_commands("ok", "确认", "cancle", "重新设置");
me.wait_input = checkResult;
}
function checkResult(me, str) {
if (str == "ok") {
var obj = me.find_obj_bypath('cash/xi');
if (!obj || !obj.count) {
return me.notify('你身上没有洗髓丹。');
}
me.remove_obj(obj, 1);
me.str = me.query_temp("re_str");
me.con = me.query_temp("re_con");
me.int = me.query_temp("re_int");
me.dex = me.query_temp("re_dex");
me.recount();
me.notify("属性调整完成");
me.wait_input = null;
me.remove_temp("re_dex");
me.remove_temp("re_con");
me.remove_temp("re_int");
me.remove_temp("re_dex");
} else {
me.wait_input = readnumber;
var count = me.str + me.con + me.dex + me.int;
var max = 30 + count - 80;
me.notify("请说出你的先天属性(臂力 根骨 身法 悟性)每项15-" + max + ",总计" + count + ",比如:20 20 20 20");
me.send_commands("quxiao", "取消使用");
}
}