init: add workspace files
This commit is contained in:
44
world/cmd/action/actions.js
Normal file
44
world/cmd/action/actions.js
Normal file
@@ -0,0 +1,44 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "actions";
|
||||
this.allow_busy = true;
|
||||
this.allow_state = true;
|
||||
this.allow_die = true;
|
||||
this.allow_faint = true;
|
||||
this.enter = function (me, type) {
|
||||
//if (!me.actions_changed) return ;
|
||||
var str = ["{type:\"actions\",actions:["];
|
||||
var items = me.items;
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if ((items[i].showAction && !items[i].is_equipment) || items[i].is_shortcut) {
|
||||
if (str.length > 1) str.push(",");
|
||||
str.push("{cmd:\"use ");
|
||||
str.push(items[i].id);
|
||||
str.push("\",name:\"");
|
||||
str.push(items[i].name);
|
||||
str.push("\"");
|
||||
if (items[i].distime) {
|
||||
str.push(",distime:");
|
||||
str.push(items[i].distime);
|
||||
}
|
||||
str.push("}");
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < me.equipment.length; i++) {
|
||||
if (me.equipment[i] && me.equipment[i].on_use) {
|
||||
if (str.length > 1) str.push(",");
|
||||
str.push("{cmd:\"use ");
|
||||
str.push(me.equipment[i].id);
|
||||
str.push("\",name:\"");
|
||||
str.push(me.equipment[i].name);
|
||||
str.push("\"");
|
||||
if (me.equipment[i].distime) {
|
||||
str.push(",distime:");
|
||||
str.push(me.equipment[i].distime);
|
||||
}
|
||||
str.push("}");
|
||||
}
|
||||
}
|
||||
str.push("]}");
|
||||
me.send(str.join(""));
|
||||
}
|
||||
24
world/cmd/action/answer.js
Normal file
24
world/cmd/action/answer.js
Normal file
@@ -0,0 +1,24 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "answer";
|
||||
this.regex = /^(\w+)(?:\s+(\w+))$/;
|
||||
this.allow_busy = true;
|
||||
this.enter = function (me, objid, par) {
|
||||
var obj = me.find_obj(objid, me.environment);
|
||||
|
||||
if (!obj || !obj.on_answer) return me.notify("你要回答什么?");
|
||||
|
||||
obj.on_answer(me, par);
|
||||
}
|
||||
|
||||
USER.prototype.send_question = function (npc, list, callbacks) {
|
||||
if (!list || !Array.isArray(list)) return;
|
||||
|
||||
let str = ['<div class="sel">'];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (str.length > 1) str.push('\n');
|
||||
str.push(i + 1, '、', '<cmd cmd="answer ', npc.id, ' ', i + 1, '">', list[i], '</cmd>');
|
||||
}
|
||||
str.push('</div>');
|
||||
this.send(str.join(''));
|
||||
npc.on_answers = callbacks;
|
||||
}
|
||||
70
world/cmd/action/ask.js
Normal file
70
world/cmd/action/ask.js
Normal file
@@ -0,0 +1,70 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "ask";
|
||||
this.regex = /^(\w+)\s+about\s+(.+)$/;
|
||||
this.enter = function (me, objid,par) {
|
||||
var obj = me.find_obj(objid, me.environment);
|
||||
if (!obj || !obj.on_ask) return me.notify("你要问谁什么?");
|
||||
if (!par || par.length>10) return me.notify("你要问什么?");
|
||||
par = UTIL.htmlEncode(UTIL.replace_word(par));
|
||||
|
||||
me.send_room("$N向$n打听有关「" + par + "」的问题。", obj);
|
||||
if (obj.on_ask(me, par) != false) return;
|
||||
me.send_room(ask_dunno.random(), obj);
|
||||
}
|
||||
var ask_dunno = ["$n摇摇头,说道:没听说过。",
|
||||
"$n睁大眼睛望着$N,显然不知道$P在说什么。",
|
||||
"$n耸了耸肩,很抱歉地说:无可奉告。",
|
||||
"$n说道:嗯....这我可不清楚,你最好问问别人吧。",
|
||||
"很显然,$n根本不想回答$P的问题。",
|
||||
"$n想了一会儿,说道:对不起,你问的事我实在没有印象。",
|
||||
"$n睁大眼睛望着$N,这么简单的问题也要问吗?",];
|
||||
NPC.prototype.set_ask = function (name, func) {
|
||||
if (!this.question) this.question = {};
|
||||
this.question[name] = func;
|
||||
}
|
||||
NPC.prototype.on_ask = function (me, par) {
|
||||
if (!this.question) return;
|
||||
var item = this.question[par];
|
||||
if (!item) return;
|
||||
return item.call(this,me);
|
||||
}
|
||||
|
||||
//switch( topic ) {
|
||||
// case "name":
|
||||
// message_vision( YEL "$N向$n"+YEL"问道:敢问" + RANK_D->query_respect(ob)
|
||||
// + "尊姓大名?\n" NOR, me, ob);
|
||||
// return 1;
|
||||
// case "here":
|
||||
// message_vision(YEL "$N向$n"+YEL"问道:这位" + RANK_D->query_respect(ob)
|
||||
// + "," + RANK_D->query_self(me) + "初来乍到,不知这里有些什麽风土人情?\n" NOR,
|
||||
// me, ob);
|
||||
// return 1;
|
||||
// case "rumors":
|
||||
// message_vision(RED "$N向$n"+RED"问道:这位" + RANK_D->query_respect(ob)
|
||||
// + ",不知最近有没有听说什么小道消息?\n" NOR, me, ob);
|
||||
// return 1;
|
||||
// case "marry":
|
||||
// message_vision(CYN "$N眯着一双贼眼,不怀好意的向$n"+CYN"问道:敢问这位"+RANK_D->query_respect(ob)
|
||||
// +"是否婚配?\n" NOR,me,ob);
|
||||
// return 1;
|
||||
// case "food":
|
||||
// message_vision(CYN "$N可怜兮兮的向$n"+CYN"问道:“不知这位"+RANK_D->query_respect(ob)
|
||||
// +"是否能给我点吃的, 在下已经三天没有进食了?”\n" NOR,me,ob);
|
||||
// return 1;
|
||||
|
||||
// case "water":
|
||||
// message_vision(CYN "$N可怜兮兮的向$n"+CYN"问道:“不知这位"+RANK_D->query_respect(ob)
|
||||
// +"是否能给我点喝的, 在下口渴得很?”\n" NOR,me,ob);
|
||||
// return 1;
|
||||
|
||||
// case "money":
|
||||
// message_vision(CYN "$N双手抱拳向$n"+CYN"问道:“在下初来咋到,行走江湖缺了些盘缠,这位"+RANK_D->query_respect(ob)
|
||||
// +"是否能施舍一二, 在下不甚感激?”\n" NOR,me,ob);
|
||||
// return 1;
|
||||
// case "friend":
|
||||
// message_vision(CYN "$N双手抱拳向$n"+CYN"说道:“四海之内皆兄弟也,这位"+RANK_D->query_respect(ob)
|
||||
// +",不知愿否与在下交个朋友”\n" NOR,me,ob);
|
||||
// return 1;
|
||||
// default:
|
||||
// return 0;
|
||||
//}
|
||||
55
world/cmd/action/bai.js
Normal file
55
world/cmd/action/bai.js
Normal file
@@ -0,0 +1,55 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "bai";
|
||||
this.enter = function (me, target) {
|
||||
if (!WORLD.is_server(me)) return me.notify("你不能拜师。");
|
||||
if (!target) return me.notify("你要拜谁为师?");
|
||||
target = me.find_obj(target, me.environment);
|
||||
if (!target || !target.call3) return me.notify("你要拜谁为师?");
|
||||
if (!target.family || target.family == FAMILIES.NONE)
|
||||
return me.notify(target.name + "无门无派,你不能拜" + target.call3() + "为师。");
|
||||
if (me.query_temp("master") == target.path) {
|
||||
return me.send_room("$N恭恭敬敬的向$n磕头请安,叫道:「师父!」", target);
|
||||
}
|
||||
me.send_room("$N想拜$n为师。\n", target);
|
||||
if (target.on_before_master && target.on_before_master(me) === false)
|
||||
return;
|
||||
|
||||
if (me.family != FAMILIES.NONE) {
|
||||
if (me.family == target.family) {
|
||||
var level = me.query_temp("family_level");
|
||||
if (level < target.family_level) {
|
||||
return me.send_room("$n笑着对$N说:师叔不要开玩笑了。", target);
|
||||
}
|
||||
else if (level == target.family_level) {
|
||||
return me.send_room("$n笑着对$N说:" + (me.gender === 1 ? "师弟" : "师妹") + "不要开玩笑了。", target);
|
||||
}
|
||||
} else {
|
||||
return me.send_room("$n对$N说:" + me.call() + "既然已有名师指点,何必再来拜" + target.callme() + "。", target);
|
||||
}
|
||||
}
|
||||
if (target.on_master) {
|
||||
if (target.on_master(me) == false) {
|
||||
return;
|
||||
}
|
||||
let is_reset = me.family === FAMILIES.NONE;
|
||||
me.family = target.family;
|
||||
var lv = (target.family_level || 0) + 1;
|
||||
|
||||
var title = me.family.query_title(lv);
|
||||
me.add_title(title, "family");
|
||||
me.set_temp("master", target.path);
|
||||
me.set_temp("family", target.family.id);
|
||||
me.set_temp("family_level", lv);
|
||||
if (!me.query_temp("sm_tm")) {
|
||||
me.set_temp("sm_tm", Math.floor(Date.now() / 100000));
|
||||
}
|
||||
me.remove_temp('sr');
|
||||
if (is_reset)
|
||||
WORLD.DATA.reset_famtops(me, FAMILIES.NONE);
|
||||
me.send_room("<HIG>$n说道:好吧," + target.callme() + "就收下你了。</HIG>\n$n决定收$N为弟子。\n$N跪下来向$n恭恭敬敬的磕了四个响头,叫道:「师父!」", target);
|
||||
return me.notify("<hic>恭喜你成为" + title + ",师门将持续向你发放物资(任务栏领取)。</hic>\n");
|
||||
|
||||
|
||||
}
|
||||
return me.send_room("$n说道:在下才疏学浅,不敢误人子弟。", target);
|
||||
}
|
||||
56
world/cmd/action/caiyao.js
Normal file
56
world/cmd/action/caiyao.js
Normal file
@@ -0,0 +1,56 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "caiyao";
|
||||
|
||||
this.enter = function (me) {
|
||||
if (!me.environment) return false;
|
||||
if (!me.environment.can_caiyao)
|
||||
return me.notify('这里不能采药、');
|
||||
let name = "药林";
|
||||
if (me.environment.is('home/huayuan'))
|
||||
name = '花圃';
|
||||
me.send_room("$N走进" + name + ",开始认真寻找药材。");
|
||||
me.set_state({
|
||||
id: "cai",
|
||||
type: "work",
|
||||
title: "采药",
|
||||
player: me,
|
||||
attach_level: 0,
|
||||
rate: 2,
|
||||
on_enter: do_cai,
|
||||
stime: Date.now(),
|
||||
on_check: on_check,
|
||||
no_move: "你还在采药,专心点比较好!",
|
||||
desc: '["你仔细盯着树底下,石缝下面,一颗小草也不放过。","你找到一株奇怪的药草,努力辨别它的品种。","你爬到树上仔细寻找有没有需要的药材。"]',
|
||||
});
|
||||
}
|
||||
|
||||
function on_check(me) {
|
||||
var exp = WORLD.DATA.exps[me.level]
|
||||
+ WORLD.DATA.query_temp("caiyao_exp", 0)
|
||||
+ me.query_prop('caiyao_exp');
|
||||
let grade = me.query_prop('caiyao1');
|
||||
|
||||
let str = "";
|
||||
if (grade > 80) {
|
||||
str = "有概率采集到红色及以下药材";
|
||||
} else if (grade > 18) {
|
||||
str = "有概率采集到橙色及以下药材";
|
||||
} else if (grade > 10) {
|
||||
str = "有概率采集到紫色及以下药材";
|
||||
} else {
|
||||
str = "有概率采集到黄色及以下药材";
|
||||
}
|
||||
me.send(`你正在采药,当前效率${grade},每10秒获得${exp}经验,${exp}潜能,${str}。`);
|
||||
}
|
||||
|
||||
function do_cai(me) {
|
||||
let lv = me.random(18);
|
||||
let obj = me.add_obj('res/cao#' + lv);
|
||||
if (obj) {
|
||||
me.send_room("<hig>$N采到一株" + obj.color_name + "。</hig>");
|
||||
}
|
||||
let exp = WORLD.DATA.get_exp(me)
|
||||
+ WORLD.DATA.query_temp("caiyao_exp", 0);
|
||||
let pot = exp + me.query_prop('ly_qn');
|
||||
me.add_exp(exp, pot, 0);
|
||||
}
|
||||
7
world/cmd/action/challenge.js
Normal file
7
world/cmd/action/challenge.js
Normal file
@@ -0,0 +1,7 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "challenge";
|
||||
this.allow_fight = false;
|
||||
this.enter = function (player, index) {
|
||||
|
||||
return WORLD.COMMANDS['biwu'].biwu_record(player);
|
||||
}
|
||||
489
world/cmd/action/cr.js
Normal file
489
world/cmd/action/cr.js
Normal file
@@ -0,0 +1,489 @@
|
||||
|
||||
this.inherits(COMMAND);
|
||||
this.command = "cr";
|
||||
this.allow_fight = true;
|
||||
//this.allow_busy = true;
|
||||
this.enter = function (me, arg) {
|
||||
if (!me.environment) return;
|
||||
|
||||
if (!arg) {
|
||||
fb_confirm_over(me);
|
||||
} else if (arg == "over") {
|
||||
fb_over(me);
|
||||
}
|
||||
else {
|
||||
fb_start(me, arg);
|
||||
}
|
||||
}
|
||||
function fb_ok(me) {
|
||||
var r = me.query_temp("teamcr");
|
||||
if (r == 1) {
|
||||
me.set_temp("teamcr", 2, 200000);
|
||||
me.send_team("<hig>" + me.name + "同意进入副本。</hig>");
|
||||
for (var i = 0; i < me.team.length; i++) {
|
||||
if (me.team[i].query_temp("teamcr") != 2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
} else if (r == 2) {
|
||||
return me.notify("你已经同意了。");
|
||||
}
|
||||
return me.notify("没有人邀请你进入副本。");
|
||||
}
|
||||
function fb_reject(me) {
|
||||
var r = me.query_temp("teamcr");
|
||||
if (r == 1) {
|
||||
me.remove_temp("teamcr");
|
||||
return me.send_team("<hic>" + me.name + "拒绝进入副本。</hic>");
|
||||
} else if (r == 2) {
|
||||
return me.notify("你已经同意了。");
|
||||
}
|
||||
return me.notify("没有人邀请你进入副本。");
|
||||
}
|
||||
function fb_saodang(me, path, isdiff, count) {
|
||||
var fb = AREA.Get_FB(path);
|
||||
if (!fb) {
|
||||
return me.notify("没有这个副本!");
|
||||
}
|
||||
let next_room = ROOM.Get(fb.first);
|
||||
if (!next_room) {
|
||||
return me.notify("没有这个房间");
|
||||
}
|
||||
if (!next_room.is_fb()) return me.notify(fb.name + "不是副本区域!");
|
||||
|
||||
if (!fb.is_unlock(me))
|
||||
return me.notify("副本" + fb.name + "还没解锁!");
|
||||
|
||||
if (me.is_full(-10)) return me.notify("你身上东西太多了!");
|
||||
var area = next_room.parent;
|
||||
var unlock_name = isdiff ? "fb_sao1" : "fb_sao0";
|
||||
if (area.unlock_index) {
|
||||
if (me.query_temp('fb_sao' + area.fb_index, 0) !== (isdiff ? 2 : 1))
|
||||
return me.notify("你需要" + area.name + (isdiff ? "(困难)" : "(普通)") + "单人模式完成100%才可以扫荡副本!");
|
||||
} else {
|
||||
if (area.fb_index >= (me.query_temp(unlock_name) || 0))
|
||||
return me.notify("你需要" + area.name + (isdiff ? "(困难)" : "(普通)") + "单人模式完成100%才可以扫荡副本!");
|
||||
}
|
||||
|
||||
count = parseInt(count);
|
||||
|
||||
if (me.query_jingli() < area.expend) return me.notify("你的精力不够,无法扫荡副本。");
|
||||
var fu = me.find_obj_bypath("cash/saodang");
|
||||
if (!fu || fu.count < count) return me.notify_fail("你的扫荡符不够继续扫荡了。");
|
||||
if (count == 1) return fb_quick(me, area, isdiff);
|
||||
me.call_interval(fb_quick.bind(me, me, area, isdiff), 500, count, x => {
|
||||
me.notify(area.name + "扫荡完成。");
|
||||
});
|
||||
}
|
||||
|
||||
function fb_quick(me, area, isdiff) {
|
||||
|
||||
var drops = area.query_drops(isdiff, me);
|
||||
if (!drops || !drops.length) return me.notify_fail('这里不能快速完成。');
|
||||
|
||||
var fu = me.find_obj_bypath("cash/saodang");
|
||||
|
||||
if (!fu || !fu.count) return me.notify_fail("你的扫荡符不够继续扫荡了。");
|
||||
if (me.query_jingli() < area.expend) {
|
||||
me.notify("你的精力不够继续开启副本。");
|
||||
return false;
|
||||
}
|
||||
if (me.items.length > 204) return me.notify_fail("你背包的东西太多了。");
|
||||
|
||||
if (area.on_quick && !area.on_quick(me)) return false;
|
||||
|
||||
if (me.expend_jingli(area.expend) == false) { return me.notify_fail("你的精力不够,不能开启副本。"); }
|
||||
|
||||
|
||||
me.remove_obj(fu, 1);
|
||||
var max_score = area.query_exp();
|
||||
me.add_exp(max_score, max_score);
|
||||
me.add_temp("fb_count", 1);
|
||||
me.add_temp("fb_count_day", 1, UTIL.diff_time());
|
||||
|
||||
var diff = isdiff ? 1 : 0;
|
||||
if (area.is_record(diff)) {
|
||||
''
|
||||
me.add_temp("fbc_" + diff + "_" + area.fb_index, 1);
|
||||
}
|
||||
for (var j = 0; j < drops.length; j++) {
|
||||
var items = OBJ.create_by_odds(drops[j]);
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = me.add_obj(items[i]);
|
||||
if (item.is_equipment && item.grade >= 5) {
|
||||
COMMAND.DO("rumor", "听说有人得到了一" + item.unit + item.name + "。");
|
||||
}
|
||||
var count = items[i].count || 1;
|
||||
if (item) {
|
||||
me.send("你获得了" + UTIL.to_c(count) + item.unit + item.color_name + "。");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
area.on_quick_over && area.on_quick_over(me);
|
||||
}
|
||||
function get_mincount(drops, obj) {
|
||||
for (var i = 0; i < drops.length; i++) {
|
||||
if (typeof drops[i].obj == "string") {
|
||||
if (drops[i].obj == obj) {
|
||||
return drops[i].min;
|
||||
}
|
||||
} else if (drops[i].obj.indexOf(obj) > -1) {
|
||||
return drops[i].min;
|
||||
}
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
function get_odds(drops, obj) {
|
||||
for (var i = 0; i < drops.length; i++) {
|
||||
if (typeof drops[i].obj == "string") {
|
||||
if (drops[i].obj == obj) {
|
||||
return drops[i].odds;
|
||||
}
|
||||
} else if (drops[i].obj.indexOf(obj) > -1) {
|
||||
return drops[i].odds;
|
||||
}
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
function fb_start(me, path) {
|
||||
if (!path) return me.notify("你要开始哪个副本?");
|
||||
if (!me.environment) return me.notify("你不知道在哪。");
|
||||
if (me.environment.is_fb()) return me.notify("你现在正在副本区域。");
|
||||
if (me.environment.parent.on_leave && me.environment.parent.on_leave(me) == false) return;
|
||||
|
||||
var pars = /^(.+?)\s(\d)\s(\d+)$/.exec(path);
|
||||
|
||||
|
||||
var diff_type = 0;
|
||||
if (pars != null) {
|
||||
path = pars[1];
|
||||
diff_type = parseInt(pars[2]);
|
||||
if (diff_type < 0 || diff_type > 2) return;
|
||||
var sao = parseInt(pars[3]);
|
||||
if (sao > 0) {
|
||||
if (diff_type == 2) {
|
||||
return me.notify("组队副本不可以扫荡!");
|
||||
}
|
||||
return fb_saodang(me, path, diff_type == 1, sao);
|
||||
}
|
||||
|
||||
}
|
||||
var fb = AREA.Get_FB(path);
|
||||
if (!fb) {
|
||||
return me.notify("没有这个副本!");
|
||||
}
|
||||
var next_room = ROOM.Get(fb.first);
|
||||
if (!next_room) {
|
||||
return me.notify("没有这个副本!");
|
||||
}
|
||||
if (fb.is_lock) {
|
||||
return me.notify("暂未开放,正在修复");
|
||||
}
|
||||
if (diff_type == 1 && !fb.is_diffi) {
|
||||
return me.notify(fb.name + "没有困难模式!");
|
||||
}
|
||||
if (diff_type == 2) {
|
||||
if (!fb.is_multi)
|
||||
return me.notify(fb.name + "没有组队模式!");
|
||||
if (!me.team || !me.team.length)
|
||||
return me.notify("你没有组队无法进入组队模式!");
|
||||
} else {
|
||||
if (me.team)
|
||||
return me.notify("你正在队伍中,无法进入单人副本!");
|
||||
}
|
||||
if (!next_room.is_copy() || !next_room.is_fb())
|
||||
return me.notify(fb.name + "不是副本区域!");
|
||||
|
||||
if (!fb.is_unlock(me))
|
||||
return me.notify("副本" + fb.name + "还没解锁!");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (fb.on_enter && fb.on_enter(me) === false) return;
|
||||
var team = me.query_teamid();
|
||||
var copy_room = next_room.query_copy(team);
|
||||
if (copy_room) {
|
||||
next_room = copy_room;
|
||||
if (me.team) {
|
||||
if (copy_room.query_temp(me, me.id) == 1) {
|
||||
return me.notify("你已经完成副本,必须等其他队员也完成后才可以重新进入。");
|
||||
}
|
||||
if (me.expend_jingli(fb.expend) == false) { return me.notify("你的精力不够,无法副本。"); }
|
||||
//记录这个玩家进入副本的标志,防止重复进入
|
||||
copy_room.set_temp(me, me.id, 1);
|
||||
} else {
|
||||
if (diff_type == 2)
|
||||
return me.notify("你需要组队才可以进入副本。");
|
||||
}
|
||||
} else {
|
||||
if (me.query_jingli() < fb.expend) {
|
||||
return me.notify("你的精力不够,不能开启副本。");
|
||||
}
|
||||
if (me.expend_jingli(fb.expend) == false) { return me.notify("你的精力不够,不能开启副本。"); }
|
||||
next_room = next_room.create_copy(team, diff_type);
|
||||
|
||||
if (!next_room) {
|
||||
return me.notify("副本创建失败。");
|
||||
}
|
||||
next_room.set_temp(me, "diff", diff_type);
|
||||
if (me.team) {
|
||||
next_room.set_temp(me, me.id, 1);
|
||||
for (var i = 0; i < me.team.length; i++) {
|
||||
var tm = me.team[i];
|
||||
if (tm != me && tm.is_player) {
|
||||
tm.send("<hic>你的队友" + me.name + "已进入组队副本【"
|
||||
+ fb.name + "】,是否进入?</hic>", true);
|
||||
tm.send('{type:\"cmds\",items:[{cmd:"cr ' + path + ' 2 0",name:"进入副本"}]}', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!me.team || me.team[0] === me) {
|
||||
WORLD.COMMANDS['ex'].on_enter_fb(me, next_room);
|
||||
}
|
||||
}
|
||||
me.send('{type:"dialog",dialog:"jh",close:true}');
|
||||
|
||||
me.set_temp("enter_room", me.environment.path);
|
||||
|
||||
|
||||
if (me.moveto(next_room, me.name + "离开了。", me.name + "走了进来。")) {
|
||||
|
||||
if (me.team) {
|
||||
me.notify("<hic>你已进入组队副本,在副本中退出游戏,退出队伍,完成副本都会离开当前副本,当前队伍所有人都离开副本后才可以重新进入。</hic>");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function fb_over(me) {
|
||||
var area = me.environment.parent;
|
||||
if (!me.environment || !me.environment.is_fb()) return;
|
||||
var score = me.query_fbscore();
|
||||
var max_score = area.score || 100;
|
||||
var max_exp = area.query_exp();
|
||||
var p = parseInt(score * 100 / max_score);
|
||||
if (p <= 0) p = 0;
|
||||
if (p > 100) p = 100;
|
||||
var exp = max_exp * p / 100;
|
||||
var pot = max_exp * p / 100;
|
||||
|
||||
var fb = me.environment;
|
||||
var diff = fb.query_temp(me, "diff") || 0;
|
||||
if (me.moveto(me.query_temp("enter_room"), me.name + "离开了副本。", me.name + "走了过来。") != false) {
|
||||
|
||||
if (me.team && me.environment.parent.id !== 'home') {
|
||||
for (let i = 0; i < me.team.length; i++) {
|
||||
if (!me.team[i].is_player && me.team[i].master === me.id &&
|
||||
me.team[i].environment && me.team[i].environment.parent.id !== 'home') {
|
||||
me.team[i].end_fight();
|
||||
if (me.team[i].hp < 1) me.team[i].hp = 1;
|
||||
me.team[i].moveto(me.query_home());
|
||||
me.send(me.team[i].name + "回家了。");
|
||||
}
|
||||
}
|
||||
}
|
||||
fb.clear_copy(me);
|
||||
me.add_temp("fb_count", 1);
|
||||
me.add_temp("fb_count_day", 1, UTIL.diff_time());
|
||||
var unlock = me.query_temp("fb", 0);
|
||||
if (p >= 100) {
|
||||
let is_first_k = false;
|
||||
if (fb.parent.unlock_index) {
|
||||
if (!me.team && diff === 0) {
|
||||
if (!me.query_temp("fb_sao" + fb.parent.fb_index, 0)) {
|
||||
me.notify("<hic>单人(普通)模式扫荡解锁。</hic>");
|
||||
me.set_temp("fb_sao" + fb.parent.fb_index, 1);
|
||||
is_first_k = true;
|
||||
}
|
||||
} else if (!me.team && diff === 1) {
|
||||
if (!me.query_temp("fb_sao" + fb.parent.fb_index, 0)) {
|
||||
me.notify("<hic>单人(困难)模式扫荡解锁。</hic>");
|
||||
me.set_temp("fb_sao" + fb.parent.fb_index, 2);
|
||||
is_first_k = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (unlock === fb.parent.fb_index) {
|
||||
me.set_temp("fb", unlock + 1);
|
||||
me.notify("<hig>完成度100%,解锁下个副本。</hig>");
|
||||
me.send('{type:"dialog",dialog:"jh",unlock:' + (unlock + 1) + '}');
|
||||
is_first_k = true;
|
||||
}
|
||||
if (!me.team && diff === 0) {
|
||||
if (me.query_temp("fb_sao0", 0) <= fb.parent.fb_index) {
|
||||
me.notify("<hic>单人(普通)模式扫荡解锁。</hic>");
|
||||
|
||||
me.set_temp("fb_sao0", fb.parent.fb_index + 1);
|
||||
is_first_k = true;
|
||||
}
|
||||
|
||||
} else if (!me.team && diff === 1) {
|
||||
if (me.query_temp("fb_sao1", 0) <= fb.parent.fb_index) {
|
||||
me.notify("<hic>单人(困难)模式扫荡解锁。</hic>");
|
||||
me.set_temp("fb_sao1", fb.parent.fb_index + 1);
|
||||
is_first_k = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_first_k)
|
||||
fb_first_check(me, fb, area, diff);
|
||||
|
||||
|
||||
} else {
|
||||
me.notify("完成度未满100%,未能解锁下个副本。");
|
||||
}
|
||||
me.add_exp(exp, pot);
|
||||
if ((!me.team || me.team[0] === me) && me.query_temp('fbbs', 0) === 1) {
|
||||
me.remove_temp('fbbs');
|
||||
}
|
||||
if (diff != 2) {
|
||||
if (me.follow_targets && me.follow_targets.length) {
|
||||
me.follow_targets.length = 0;
|
||||
}
|
||||
}
|
||||
if (!me.team && fb.parent.is_record(diff)) {
|
||||
me.add_temp("fbc_" + diff + "_" + fb.parent.fb_index, 1);
|
||||
}
|
||||
|
||||
if (me.team && me.team.length == 2 && me.query_temp("tudi")) {
|
||||
if (me.query_temp("st_count", 0) >= 10) {
|
||||
return;
|
||||
}
|
||||
var next = me.team[0] == me ? me.team[1] : me.team[0];
|
||||
if (next.environment && next.environment.parent == fb.parent) {
|
||||
if (next.id == me.query_temp("tudi") && me.id == next.query_temp("shifu")) {
|
||||
if (next.query_temp("fb") >= fb.parent.fb_index) {
|
||||
var count = me.add_temp("st_count", 1, UTIL.diff_week_time());
|
||||
|
||||
me.send_team("<hic>你们师徒合力完成一次组队副本,获得额外收益,目前次数" + count + "(每周10次)。</hic>");
|
||||
me.add_exp(exp * 10, pot * 10);
|
||||
next.add_exp(exp * 10, pot * 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
me.notify("你现在还不能离开副本。");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function fb_first_check(me, fb, area, diff) {
|
||||
if (me.family === FAMILIES.NONE && !me.query_temp('sr')) {
|
||||
return;//无门无派的非长期散人不参与
|
||||
}
|
||||
if (!WORLD.is_server(me)) return;
|
||||
|
||||
const fblock = fb.parent.fb_index + 1;
|
||||
const famkey = me.family.id;
|
||||
const fb_key = "fb_first_" + fblock + "_" + diff;//存全服第一个通过
|
||||
let fb_fam_key = "fb_first_" + famkey + "_" + fblock + "_" + diff; //每个门派的
|
||||
if (diff === 2) fb_fam_key = fb_key;
|
||||
if (WORLD.DATA.query_temp(fb_fam_key)) return;//这个门派已经拿过了
|
||||
var fb_key2 = "fb_first_" + fblock;
|
||||
var ss_users = WORLD.DATA.query_temp(fb_key2);
|
||||
var teams = me.team || [me];
|
||||
if (ss_users) {
|
||||
for (var i = 0; i < teams.length; i++) {
|
||||
if (ss_users.indexOf(teams[i].id) !== -1) {
|
||||
return;//存在任意一个位置就算重复
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const fb_name = area.name + "(" + ["普通", "困难", "组队"][diff] + ")";
|
||||
let isfirst = false;
|
||||
if (!WORLD.DATA.query_temp(fb_key)) {
|
||||
const user_name = me.team ? team_name(me.team) : me.name;
|
||||
WORLD.DATA.set_temp(fb_key, user_name);
|
||||
COMMAND.DO("rumor", "听说" + user_name + "首次通过了" + fb_name + "区域。");
|
||||
isfirst = true;
|
||||
}
|
||||
if (diff < 2) {
|
||||
WORLD.DATA.set_temp(fb_fam_key, me.name);
|
||||
if (!isfirst)
|
||||
COMMAND.DO("rumor", "听说" + me.family.name + me.name + "首次通过了" + fb_name + "区域。");
|
||||
}
|
||||
if (area.ss_title && !me.team) {
|
||||
if ((diff == 0 && !area.is_diffi) || (diff == 1 && area.is_diffi)) {
|
||||
me.add_title(area.ss_title, "fb_" + fb.parent.fb_index);
|
||||
me.send("<hig>你获得了称号【" + area.ss_title + "】。</hig>");
|
||||
}
|
||||
}
|
||||
if (area.is_show && WORLD.DATA.query_temp("fb_index", 0) < fb.parent.fb_index) {
|
||||
WORLD.DATA.set_temp("fb_index", fb.parent.fb_index);
|
||||
}
|
||||
let ss_userids = WORLD.DATA.query_temp(fb_key2, "");
|
||||
let msg = "<hio>恭喜你完成副本" + fb_name + "的首杀!</hio>";
|
||||
if (diff < 2) msg = "<hio>恭喜你做为" + me.family.name + "弟子首次通过了副本" + fb_name + "!</hio>";
|
||||
for (var i = 0; i < teams.length; i++) {
|
||||
if (!teams[i].is_player) continue;
|
||||
teams[i].send(msg);
|
||||
ss_userids += teams[i].id + ",";
|
||||
}
|
||||
WORLD.DATA.set_temp(fb_key2, ss_userids);
|
||||
fb.parent.notify_update();
|
||||
}
|
||||
|
||||
function team_name(tms) {
|
||||
var str = [];
|
||||
for (var i = 0; i < tms.length; i++) {
|
||||
str.push(tms[i].name);
|
||||
}
|
||||
return str.join(",");
|
||||
}
|
||||
function fb_confirm_over(me) {
|
||||
var area = me.environment.parent;
|
||||
var score = me.query_fbscore();
|
||||
var max_score = area.score || 100;
|
||||
var p = parseInt(score * 100 / max_score);
|
||||
if (p <= 0) p = 0;
|
||||
if (p > 100) p = 100;
|
||||
|
||||
var exp = 1200;
|
||||
var str = ["当前副本:"];
|
||||
str.push(area.name);
|
||||
if (exp > 0) {
|
||||
str.push("\n将获得经验:");
|
||||
str.push(exp);
|
||||
str.push(",潜能:");
|
||||
str.push(exp);
|
||||
}
|
||||
str.push("\n完成度:");
|
||||
if (p < 30) {
|
||||
str.push(p);
|
||||
str.push("%\n");
|
||||
} else if (p < 60) {
|
||||
str.push("<hig>");
|
||||
str.push(p);
|
||||
str.push("%</hig>\n");
|
||||
} else if (p < 80) {
|
||||
str.push("<hic>");
|
||||
str.push(p);
|
||||
str.push("%</hic>\n");
|
||||
} else if (p < 100) {
|
||||
str.push("<hiy>");
|
||||
str.push(p);
|
||||
str.push("%</hiy>\n");
|
||||
} else {
|
||||
p = 100;
|
||||
str.push("<hiz>");
|
||||
str.push(p);
|
||||
str.push("%</hiz>\n");
|
||||
}
|
||||
me.notify(str.join(""));
|
||||
me.send_commands("cr over", "领取奖励并离开副本");
|
||||
}
|
||||
74
world/cmd/action/cr2.js
Normal file
74
world/cmd/action/cr2.js
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
this.inherits(COMMAND);
|
||||
this.command = "cr2";
|
||||
this.allow_fight = true;
|
||||
this.allow_die = true;
|
||||
this.allow_state = true;
|
||||
this.regex = /(\d+)\s(\d+)/;
|
||||
this.enter = function (me, index, diff) {
|
||||
index = parseInt(index);
|
||||
let area = AREA.FBS[index];
|
||||
if (!area || area.no_fb || !area.is_copy || !DIFFS[diff])
|
||||
return me.send('你要看哪个副本?');
|
||||
index = area.fb_index;
|
||||
let key = "fb_first_" + (index + 1) + "_" + diff;
|
||||
let name = WORLD.DATA.query_temp(key);
|
||||
let fbname = area.name + DIFFS[diff] + "模式";
|
||||
if (!name) return me.send(fbname + "尚未完成首杀。");
|
||||
let str = ['<hic>', fbname, '由' + name + "首次通过。</hic>\n"];
|
||||
if (diff < 2) {
|
||||
for (let fam of FAMS_TATAS) {
|
||||
key = "fb_first_" + fam + "_" + (index + 1) + "_" + diff; //每个门派的
|
||||
name = WORLD.DATA.query_temp(key);
|
||||
if (!name) str.push(FAMILIES[fam].name, '尚未完成门派首杀。\n');
|
||||
else str.push('<hic>', FAMILIES[fam].name, '弟子', name, '完成门派首杀。</hic>\n');
|
||||
}
|
||||
}
|
||||
me.send(str.join(""));
|
||||
|
||||
}
|
||||
const DIFFS = ["普通", "困难", "组队"];
|
||||
const FAMS_TATAS = ['WUDANG', 'HUASHAN', 'SHAOLIN',
|
||||
'EMEI', 'GAIBANG', 'XIAOYAO', 'SHASHOU', 'NONE'];
|
||||
|
||||
this.set_fb_first = function (me) {
|
||||
|
||||
let data = [];
|
||||
for (let item of FB_DATAS) {
|
||||
let index = parseInt(item.fb);
|
||||
let fbs = data[index];
|
||||
if (!fbs) fbs = data[index] = {};
|
||||
fbs[item.family] = item;
|
||||
}
|
||||
let str = [];
|
||||
for (let i = 0; i < 18; i++) {
|
||||
let area = AREA.FBS[i];
|
||||
if (!area || !area.is_copy || area.not_fb) continue;
|
||||
let fbs = data[i] ?? {};
|
||||
for (let item of FAMS_TATAS) {
|
||||
if (!fbs[item]) {
|
||||
if (FB_MAX[item] <= i) continue;
|
||||
fbs[item] = {
|
||||
name: UTIL.random_name(1)
|
||||
}
|
||||
}
|
||||
let fam = FAMILIES[item];
|
||||
let key = "fb_first_" + item + "_" + (i + 1) + "_0"; //每个门派的
|
||||
WORLD.DATA.set_temp(key, fbs[item].name);
|
||||
str.push(area.name, fam.name, '设置首通', fbs[item].name, '\n');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
me.send(str.join(""));
|
||||
}
|
||||
const FB_MAX = {
|
||||
HUASHAN: 15,
|
||||
XIAOYAO: 18,
|
||||
SHASHOU: 12,
|
||||
EMEI: 14,
|
||||
WUDANG: 14,
|
||||
GAIBANG: 15,
|
||||
SHAOLIN: 13,
|
||||
NONE: 12
|
||||
};
|
||||
93
world/cmd/action/dazuo.js
Normal file
93
world/cmd/action/dazuo.js
Normal file
@@ -0,0 +1,93 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "dazuo";
|
||||
this.enter = function (me) {
|
||||
if (me.is_fighting()) return me.notify("战斗中打坐,你找死吗?");
|
||||
if (me.state) return me.notify("你正在" + me.state.title + ",没有时间打坐。");
|
||||
if (me.query_skill("force", 0) == 0) return me.notify("你还没学习任何内功心法,不会打坐。");
|
||||
me.notify("<hir>你坐下来运气用功,一股<HIW>内息</HIW>开始在体内流动。</hir>");
|
||||
me.send_message(me.name + "盘膝坐下,开始修炼内力。");
|
||||
me.set_state({
|
||||
id: "dazuo",
|
||||
cmd: "dazuo",
|
||||
title: "打坐运功",
|
||||
rate: 2,
|
||||
on_enter: do_dazuo,
|
||||
no_move: "打坐时要专心,小心走火入魔。",
|
||||
desc: '[]',
|
||||
stime: Date.now(),
|
||||
//"你只觉丹田处一股热流,慢慢涌向全身经脉。","你只觉你的内息游遍了你全身,全身上下舒畅无比。","你感觉冥冥之中有股力量被引入体内,化为内力。"
|
||||
on_stop: function (me, isauto) {
|
||||
me.notify("<hiy>你运功完毕,深深吸了口气,站了起来。</hiy>");
|
||||
me.send_message(me.name + "运功完毕,站了起来。");
|
||||
if (isauto && me.query_setting('auto_work')) {
|
||||
return WORLD.check_user_next(me);
|
||||
}
|
||||
},
|
||||
on_check: on_check
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
function on_check(me) {
|
||||
let speed = count_speed(me);
|
||||
let str = ['<hic>你正在打坐运功,当你满内力时,每10秒增加', speed, "最大内力,预计"];
|
||||
|
||||
var max = me.limit_mp + me.query_prop("limit_mp");
|
||||
let time = Math.floor((max - me.max_mp) / speed) * 10;
|
||||
|
||||
if (time < 60) str.push('不到1分钟');
|
||||
else {
|
||||
if (time > 86400) {
|
||||
str.push(Math.floor(time / 86400), '天');
|
||||
time = time % 86400;
|
||||
}
|
||||
if (time > 3600) {
|
||||
str.push(Math.floor(time / 3600), '小时');
|
||||
time = time % 3600;
|
||||
}
|
||||
str.push(Math.floor(time / 60), '分钟');
|
||||
}
|
||||
str.push('达到内力上限', max, '</hic>。');
|
||||
me.send(str.join(""));
|
||||
}
|
||||
|
||||
|
||||
function do_dazuo(me) {
|
||||
var max = me.limit_mp + me.query_prop("limit_mp");
|
||||
|
||||
var force_skill = me.force_skill;
|
||||
if (!force_skill) return me.notify_fail("<hir>你突然忘了怎么打坐。</hir>");
|
||||
if (me.mp < me.max_mp) {
|
||||
if (me.mp >= me.max_mp) {
|
||||
return me.notify_fail("<hic>你觉得你的经脉充盈,已经没有办法再增加内力了。</hic>");
|
||||
}
|
||||
let v = me.query_skill(me.force_skill.id, 0) + me.con;
|
||||
v = v + (me.con * (me.query_prop("con") + v));
|
||||
v = parseInt(v * (100 + me.query_prop("dazuo_per")) / 100);
|
||||
me.notify("<hig>你的内力恢复了" + v + "点。</hig>");
|
||||
me.add_mp(v);
|
||||
} else {
|
||||
if (max > me.max_mp) {
|
||||
let v = count_speed(me);
|
||||
me.notify("<hig>你的最大内力增加了" + v + "点。</hig>");
|
||||
me.max_mp += v;
|
||||
me.mp += v;
|
||||
me.recount();
|
||||
return me.notify_hp();
|
||||
}
|
||||
return me.notify_fail("<hic>你觉得你的经脉充盈,已经没有办法再增加内力了。</hic>");
|
||||
|
||||
}
|
||||
}
|
||||
function count_speed(me) {
|
||||
|
||||
let exp = parseInt((me.query_skill("force") / 100 + me.query_prop("dazuo")
|
||||
+ 1 + me.con / 10) * (100 + me.family.query_temp('dazuo_per', 0)
|
||||
+ WORLD.DATA.query_temp("dazuo_per", 0) + me.query_prop("dazuo_per")) / 100);
|
||||
let prop = me.query_prop('shaolin');
|
||||
if (prop > 0) {
|
||||
let time = Math.floor((Date.now() - me.state.stime) / 60000);
|
||||
exp += Math.min(time, prop);
|
||||
}
|
||||
return exp;
|
||||
}
|
||||
75
world/cmd/action/diaoyu.js
Normal file
75
world/cmd/action/diaoyu.js
Normal file
@@ -0,0 +1,75 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "diaoyu";
|
||||
|
||||
this.enter = function (me) {
|
||||
if (!me.environment || !me.environment.can_diaoyu)
|
||||
return false;
|
||||
var wea = me.query_weapon();
|
||||
if (!wea || !wea.path.startsWith("sp/tool/diao")) return me.notify("你没有装备钓竿不可以钓鱼。");
|
||||
var er = query_er(me);
|
||||
if (!er) return me.notify("你身上没有鱼饵,可以去扬州城的杂货店购买钓竿和鱼饵。");
|
||||
me.send_room("$N坐在岸边,把手中的$W甩到水里。");
|
||||
|
||||
me.set_state({
|
||||
id: "diao",
|
||||
type: "work",
|
||||
title: "钓鱼",
|
||||
player: me,
|
||||
rate: 2,
|
||||
yuer: er,
|
||||
on_enter: do_diaoyu,
|
||||
stime: Date.now(),
|
||||
on_check: on_check,
|
||||
no_move: "你还在钓鱼,专心点比较好!",
|
||||
desc: '["你眼睛一眨也不眨地盯着浮漂,专心致志。","浮漂一上一下的在动,看样子有东西要上钩了!"]',
|
||||
});
|
||||
}
|
||||
|
||||
function on_check(me) {
|
||||
var exp = WORLD.DATA.exps[me.level]
|
||||
+ WORLD.DATA.query_temp("diaoyu_exp", 0);
|
||||
|
||||
var pot = exp + me.query_prop('lsj_qn');
|
||||
let er = this.yuer;
|
||||
|
||||
let grade = me.query_prop('diaoyu1') + (er.grade) * 5;
|
||||
let str = "";
|
||||
if (grade > 30) {
|
||||
str = "有概率钓到橙色及以下鱼类";
|
||||
} else if (grade > 10) {
|
||||
str = "有概率钓到紫色及以下鱼类";
|
||||
} else if (grade > 1) {
|
||||
str = "有概率钓到黄色及以下鱼类";
|
||||
} else {
|
||||
str = "有概率钓到蓝色及以下鱼类";
|
||||
}
|
||||
me.send(`你正在钓鱼,当前效率${grade},每10秒获得${exp}经验,${pot}潜能,${str}。`);
|
||||
}
|
||||
function do_diaoyu(me) {
|
||||
|
||||
|
||||
let er = this.yuer;
|
||||
var obj = me.add_obj('res/yu#' + me.random(18));
|
||||
if (obj)
|
||||
me.send_room("<hig>$N钓到一条" + obj.color_name + "。</hig>");
|
||||
if (er.count > 1)
|
||||
me.remove_obj(er, 1);
|
||||
else {
|
||||
me.remove_obj(er);
|
||||
er = query_er(me);
|
||||
this.yuer = er;
|
||||
}
|
||||
var exp = WORLD.DATA.get_exp(me)
|
||||
+ WORLD.DATA.query_temp("diaoyu_exp", 0);
|
||||
var pot = exp + me.query_prop('lsj_qn');
|
||||
me.add_exp(exp, pot, 0);
|
||||
|
||||
}
|
||||
|
||||
function query_er(me) {
|
||||
for (var i = 0; i < me.items.length; i++) {
|
||||
if (me.items[i].path.startsWith("sp/tool/er#")) {
|
||||
return me.items[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
28
world/cmd/action/dismiss.js
Normal file
28
world/cmd/action/dismiss.js
Normal file
@@ -0,0 +1,28 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "dismiss";
|
||||
this.regex = /^(\w+)(\s+ok)?$/;
|
||||
this.enter = function (me, objid, isok) {
|
||||
var npc = me.find_obj(objid, me.environment);
|
||||
if (!npc) return me.notify("你要遣散谁?");
|
||||
if (!npc.master || npc.master != me.id) return me.notify("你不能遣散" + npc.call3() + "。");
|
||||
if (npc.team) return me.notify(npc.name+"需要离开队伍才可以遣散。");
|
||||
if (isok) {
|
||||
|
||||
for (var i = 0; i < me.follower.length; i++) {
|
||||
if (me.follower[i].id == objid) {
|
||||
me.follower.splice(i, 1);
|
||||
npc.set_state(null);
|
||||
npc.environment && npc.environment.item_changed(npc, false);
|
||||
FOLLOWER.STORES.delete(me.id + "_" + npc.id);
|
||||
|
||||
return me.notify(npc.name + "遣散成功,以后" + npc.call3()+"和你再没有任何关系了。");
|
||||
}
|
||||
}
|
||||
me.notify("遣散失败。");
|
||||
|
||||
} else {
|
||||
me.notify("<hir>是否确认遣散" + npc.name + "?" + npc.call3() + "的背包,技能,装备将会被清空,随从将被删除,该操作无法恢复。</hir>");
|
||||
|
||||
me.send_commands("dismiss " + objid + " ok", "确定遣散");
|
||||
}
|
||||
}
|
||||
19
world/cmd/action/follow.js
Normal file
19
world/cmd/action/follow.js
Normal file
@@ -0,0 +1,19 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "follow";
|
||||
this.enter = function (me, objid) {
|
||||
if (me.is_player && !me.query_temp("admin")) return false;
|
||||
if (!objid) {
|
||||
return me.notify("你要跟随谁?");
|
||||
}
|
||||
if (objid == "none") {
|
||||
me.do_follow(null);
|
||||
|
||||
} else {
|
||||
var obj = me.find_obj(objid, me.environment);
|
||||
if (!obj || !obj.is_living) {
|
||||
return me.notify("你要跟随谁?");
|
||||
}
|
||||
me.do_follow(obj);
|
||||
}
|
||||
|
||||
}
|
||||
135
world/cmd/action/go.js
Normal file
135
world/cmd/action/go.js
Normal file
@@ -0,0 +1,135 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "go";
|
||||
//this.regex = /^(\w+)(?:\s+(n|s|m))?$/;
|
||||
|
||||
this.enter = function (me, dir) {
|
||||
if (me.hp <= 0) return;
|
||||
if (!dir) return me.notify("你要往哪里走?");
|
||||
dir = OUTER_DOORS[dir];
|
||||
if (!dir) return me.notify("你要往哪里走?");
|
||||
var cur_room = me.environment;
|
||||
if (!cur_room) {
|
||||
return me.notify("这里不知道怎么走。");
|
||||
}
|
||||
var rm = cur_room.exits && cur_room.exits[dir];
|
||||
if (!rm) return me.notify("这个方向没有出路。");
|
||||
// if (rm === " ") {
|
||||
// console.log(me.name, cur_room.path);
|
||||
// }
|
||||
|
||||
var next_room = ROOM.Get(rm);
|
||||
if (!next_room) {
|
||||
return me.notify(rm + "还没开放!");
|
||||
}
|
||||
if (me.fight_type > 0 && !me.do_escape()) {
|
||||
return;
|
||||
}
|
||||
if (me.is_rash) return me.notify("你现在没办法移动。");
|
||||
if (cur_room.owner) {
|
||||
//当前房间在副本区域
|
||||
var copyroom = next_room.query_copy(cur_room.owner);
|
||||
if (copyroom) {
|
||||
next_room = copyroom;
|
||||
} else {
|
||||
if (cur_room.is_fb()) {
|
||||
//不能从副本直接出去
|
||||
return me.notify("这里不能过去。");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (me.query_temp("killer")) {
|
||||
if (next_room.is_copy() || next_room.no_fight)
|
||||
return me.notify("你现在正在被追杀,不能进入安全区和副本区域。");
|
||||
}
|
||||
me.moveto(next_room, sendOutMessage(me, dir), sendInMessage(me), dir);
|
||||
}
|
||||
|
||||
var OUTER_DOORS = {
|
||||
};
|
||||
var doors = ["west", "north", "south", "east", "northwest", "southwest", "northeast", "southeast",
|
||||
"down", "up", "westdown", "northdown", "southdown", "eastdown", "westup", "northup", "southup", "eastup", "enter", "out"];
|
||||
var doors_short = ["s", "n", "w", "e", "se", "sw", "nw", "ne", "d", "u", "sd", "ed", "nd", "wd", "su", "eu", "wu", "nu"];
|
||||
for (var i = 0; i < doors.length; i++) {
|
||||
if (i < doors_short.length) {
|
||||
OUTER_DOORS[doors_short[i]] = doors[i];
|
||||
}
|
||||
OUTER_DOORS[doors[i]] = doors[i];
|
||||
}
|
||||
function sendOutMessage(player, dir) {
|
||||
dir = dirs[dir] || "";
|
||||
if (player.is_fighting()) {
|
||||
return player.name + "往" + dir + "落荒而逃了。";
|
||||
}
|
||||
var eq = player.hp * 100 / player.max_hp;
|
||||
if (eq < 5) {
|
||||
return player.name + "撑起满是<HIR>鲜血</HIR>的躯体,一瘸一拐地朝" + dir + "挪去。";
|
||||
} else if (eq < 10) {
|
||||
return player.name + "一边擦着嘴角的<HIR>鲜血</HIR>,一边朝" + dir + "走去。";
|
||||
} else if (eq < 30) {
|
||||
return player.name + "灰头土脸、狼狈不堪地向" + dir + "离去。";
|
||||
} else if (eq < 50) {
|
||||
return player.name + "一声不吭的转身朝" + dir + "走去,脸色好像有些难看。";
|
||||
}
|
||||
return player.name + "往" + dir + "离开。";
|
||||
}
|
||||
function sendInMessage(player, dir) {
|
||||
if (player.fight_type) {
|
||||
return player.name + "跌跌撞撞地跑了过来,模样有些狼狈。";
|
||||
}
|
||||
var eq = player.hp * 100 / player.max_hp;
|
||||
if (eq < 5) {
|
||||
return player.name + "撑着满是<HIR>鲜血</HIR>的躯体,一瘸一拐地挪了过来。";
|
||||
} else if (eq < 10) {
|
||||
return player.name + "一边擦着嘴角的<HIR>鲜血</HIR>,一边走了过来,龇牙咧嘴的。";
|
||||
} else if (eq < 30) {
|
||||
return player.name + "灰头土脸、狼狈不堪地走了过来。";
|
||||
} else if (eq < 50) {
|
||||
return player.name + "像斗败了的公鸡,垂头丧气地走了过来。";
|
||||
}
|
||||
|
||||
var face = getFace(player) + "的" + player.name;
|
||||
var weapon = player.weapon_name();
|
||||
if (weapon) face += "手执" + weapon;
|
||||
if (!player.get_equipment(EQUIP_TYPE.CLOTH) && !player.get_equipment(EQUIP_TYPE.PANTS)) {
|
||||
face += "全身清洁溜溜的";
|
||||
}
|
||||
return face + "走了过来。";
|
||||
}
|
||||
|
||||
var dirs = {
|
||||
"north": "北方",
|
||||
"south": "南方",
|
||||
"east": "东方",
|
||||
"west": "西方",
|
||||
"northup": "北边",
|
||||
"southup": "南边",
|
||||
"eastup": "东边",
|
||||
"westup": "西边",
|
||||
"northdown": "北边",
|
||||
"southdown": "南边",
|
||||
"eastdown": "东边",
|
||||
"westdown": "西边",
|
||||
"northeast": "东北",
|
||||
"northwest": "西北",
|
||||
"southeast": "东南",
|
||||
"southwest": "西南",
|
||||
"up": "上面",
|
||||
"down": "下面",
|
||||
"enter": "里面",
|
||||
"out": "外面",
|
||||
};
|
||||
var face1 = ["眉歪眼斜", "贼眉鼠眼", "尖嘴猴腮", "相貌平平", "膀大腰圆", "一表人才",
|
||||
"仪表堂堂", "丰神如玉", "气宇不凡", "玉树临风般"];
|
||||
var face2 = ["奇丑无比", "獐头鼠目", "身材干瘦", "相貌平平", "体态轻盈", "亭亭玉立",
|
||||
"面目姣好", "容色秀丽", "风情万种", "清丽绝俗", "美若天仙"];
|
||||
function getFace(player) {
|
||||
var v = parseInt((player.per || 20) / 4);
|
||||
if (player.gender == 1) {
|
||||
if (v > face1.length - 1) v = face1.length - 1;
|
||||
return face1[v];
|
||||
} else {
|
||||
if (v > face2.length - 1) v = face2.length - 1;
|
||||
return face2[v];
|
||||
}
|
||||
}
|
||||
158
world/cmd/action/goto.js
Normal file
158
world/cmd/action/goto.js
Normal file
@@ -0,0 +1,158 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "goto";
|
||||
this.allow_fight = false;
|
||||
this.regex = /^(\w+)(?:\s+(\w+))$/;
|
||||
this.enter = function (me, arg, par) {
|
||||
|
||||
if (!me.can_trans()) return;
|
||||
let action = this.actions[arg];
|
||||
if (!action) return me.send('没有这个动作设定。');
|
||||
if (action(me, par)) {
|
||||
me.send('{type:"dialog",dialog:"jh",close:true}');
|
||||
}
|
||||
}
|
||||
this.actions = {
|
||||
home: function (me) {
|
||||
|
||||
let home = me.query_temp("home");
|
||||
if (!home) {
|
||||
me.moveto('yz/home', me.name + '离开了。', me.name + "走了过来。", 'goto');
|
||||
me.notify("你还没购买房屋,和管家谈谈购买吧。");
|
||||
} else {
|
||||
me.go_home();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
kuang: function (me) {
|
||||
WORLD.COMMANDS['wakuang'].enter(me);
|
||||
return true;
|
||||
},
|
||||
bp: function (me) {
|
||||
let home = me.query_temp("pt");
|
||||
if (!home) {
|
||||
me.moveto('yz/banghui', me.name + '离开了。', me.name + "走了过来。", 'goto');
|
||||
me.notify("你还加入任何帮会,先和帮会管理员聊聊吧。");
|
||||
} else {
|
||||
let rm = ROOM.Get("banghui/yuanzi");
|
||||
let my_room = rm.query_copy2(me);
|
||||
if (!my_room) {
|
||||
my_room = rm.create_copy2(me);
|
||||
}
|
||||
me.moveto(my_room, me.name + "离开了。", me.name + "走了进来。", 'goto');
|
||||
}
|
||||
return true;
|
||||
},
|
||||
fam1: function (me) {
|
||||
|
||||
|
||||
let master = me.query_temp('master');
|
||||
if (!master) return me.notify_fail('你无门无派,不知道师父在哪里。');
|
||||
let area = me.family.area;
|
||||
if (!area) return me.notify_fail('你无门无派,不知道师父在哪里。');
|
||||
let room_path = find_room(area, master);
|
||||
if (!room_path) return me.notify_fail('你的师父现在不在' + area.name + '。');
|
||||
me.moveto(room_path, me.name + "离开了。", me.name + "走了进来。");
|
||||
// WORLD.COMMANDS['cha'].render_skill(me,);
|
||||
return true;
|
||||
},
|
||||
fam2: function (me, fam) {
|
||||
let family = FAMILIES[fam] ?? me.family;
|
||||
if (!family) return me.notify_fail('没有这个门派。');
|
||||
if (family === FAMILIES.SHASHOU && me.family !== FAMILIES.SHASHOU)
|
||||
return me.notify_fail('那里你去不了。');
|
||||
let area = family.area;
|
||||
if (!area) return me.notify_fail('你还没有加入门派。');
|
||||
let room_path = find_room(area, 'pub/mpguanli#' + family.id);
|
||||
if (!room_path) return me.notify_fail('门派管理不知道跑哪里去了。');
|
||||
|
||||
me.moveto(room_path, me.name + "离开了。", me.name + "走了进来。", 'goto');
|
||||
return true;
|
||||
}, fam3: function (me, to_fam) {
|
||||
if (!to_fam) {
|
||||
to_fam = me.family.battle_family;
|
||||
if (!to_fam)
|
||||
return me.send('你的门派没有和其他门派产生冲突。');
|
||||
}
|
||||
let target_fam = FAMILIES[to_fam];
|
||||
if (!target_fam || !target_fam.battle_family)
|
||||
return me.send('门派战争已经结束了。');
|
||||
let room = ROOM.Get(target_fam.area.first).query_copy(target_fam.id);
|
||||
if (!room) return me.send('门派战争已经结束了。');
|
||||
if (me.level < 1 && me.exp < 1000000) return me.send('那里正在进行门派战争,你实力不够还是不要掺和了。');
|
||||
me.moveto(room, me.name + "离开了。", me.name + "走了进来。", 'goto');
|
||||
return true;
|
||||
}, fam4: function (me) {
|
||||
const pt = me.query_party();
|
||||
if (!pt) return me.send('你还没加入任何帮派。');
|
||||
if (!pt.battle_family) return me.send('你的帮派没有进攻任何门派。');
|
||||
let fam = FAMILIES[pt.battle_family];
|
||||
let count = me.query_temp('pt_mc');
|
||||
if (!me.query_temp('pt_mp')) {
|
||||
if (count >= 7)
|
||||
return me.notify('你本周内参与帮派战的次数已满。');
|
||||
let time = pt.temp.battle.e - Date.now();
|
||||
me.set_temp('pt_mp', 1, time);
|
||||
count = me.add_temp('pt_mc', 1, UTIL.diff_week_time());
|
||||
}
|
||||
me.moveto(pt.get_room(ROOM.Get(fam.area.first)),
|
||||
me.name + "走了。", me.name + "来了。", 'goto');
|
||||
me.notify('<cyn>你已进入帮派战区域,本周已参与' + count + '/7次。</cyn>');
|
||||
return true;
|
||||
},
|
||||
wd1: function (me) {
|
||||
let level = me.query_temp('wd_level', 0);
|
||||
if (level < 99)
|
||||
me.moveto('wudao/ta',
|
||||
me.name + "走了。", null, 'goto');
|
||||
else
|
||||
me.moveto('wudao/ta2',
|
||||
me.name + "走了。", null, 'goto');
|
||||
|
||||
return true;
|
||||
},
|
||||
wd2: function (me) {
|
||||
if (me.query_temp('wd_level', 0) < 99)
|
||||
return me.send('你要去哪里?');
|
||||
me.moveto('wudao/ding',
|
||||
me.name + "走了。", null, 'goto');
|
||||
return true;
|
||||
},
|
||||
|
||||
ddz: function (me) {
|
||||
let fam = me.family;
|
||||
if (fam.first_npc) {
|
||||
if (fam.first_npc.userid === me.id)
|
||||
return fam.first_npc.manage(me);
|
||||
return fam.first_npc.greeting(me);
|
||||
}
|
||||
return me.send('你的门派目前没有首席大弟子。');
|
||||
}, yamen2: function (me) {
|
||||
let task = USERTASK.GET('yamen2');
|
||||
task.to_taofan(me);
|
||||
}
|
||||
};
|
||||
function find_npc(family, path) {
|
||||
for (let item of family.def_npcs) {
|
||||
if (path !== item[0]) continue;
|
||||
let rm = ROOM.Get(item[1]);
|
||||
if (!rm) continue;
|
||||
let npc = rm.find_obj_bypath(path);
|
||||
|
||||
}
|
||||
}
|
||||
function find_room(area, path) {
|
||||
let room_path = NPC_ROOMS[path];
|
||||
if (room_path) return room_path;
|
||||
for (let room of area.rooms) {
|
||||
if (room.find_by_path(path)) {
|
||||
room_path = room.path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!room_path) return;
|
||||
NPC_ROOMS[path] = room_path;
|
||||
return room_path;
|
||||
}
|
||||
const NPC_ROOMS = {
|
||||
|
||||
};
|
||||
56
world/cmd/action/liaoshang.js
Normal file
56
world/cmd/action/liaoshang.js
Normal file
@@ -0,0 +1,56 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "liaoshang";
|
||||
this.enter = function (me) {
|
||||
if (me.is_fighting()) return me.notify("战斗中疗伤,你找死吗?");
|
||||
if (me.hp >= me.max_hp) return me.notify("<hig>你目前气血充沛,没有受到任何伤害。</hig>");
|
||||
if (me.query_skill("force", 0) == 0) return me.notify("你还没学习任何内功心法,不会疗伤。");
|
||||
//if (me.mp < 1) return me.notify("你内力不够,无法治疗自身伤势。");
|
||||
// let pudu = me.query_prop('pudu');
|
||||
// if (pudu > 0 && !me.query_temp('pudu')) {
|
||||
// let add = me.do_recover(me.max_hp * pudu / 100);
|
||||
// me.notify("<hig>你的气血恢复了" + add + "点。</hig>");
|
||||
// return me.set_temp('pudu', 1, 10000);
|
||||
// }
|
||||
me.notify("<hic>你坐下来运气用功,催动内力试图修复伤势。</hic>");
|
||||
me.send_message(me.name + "盘膝坐下,开始治疗伤势。");
|
||||
me.set_state({
|
||||
id: "liaoshang",
|
||||
cmd: "liaoshang",
|
||||
title: "疗伤",
|
||||
rate: 1,
|
||||
on_enter: do_dazuo,
|
||||
no_move: "疗伤时要专心,小心走火入魔。",
|
||||
desc: '[]',
|
||||
//"你只觉丹田处一股热流,慢慢涌向全身经脉。","你只觉你的内息游遍了你全身,身上的伤口渐渐愈合。"
|
||||
on_stop: function (me, isauto) {
|
||||
if (!isauto) {
|
||||
me.notify("<hiy>你停止疗伤,深深吸了口气,站了起来。</hiy>");
|
||||
me.send_message(me.name + "停止疗伤站了起来,脸色看起来好了很多。");
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
function do_dazuo(me) {
|
||||
var diff_hp = me.max_hp - me.hp;
|
||||
if (diff_hp > 0) {
|
||||
var v = me.query_skill(me.force_skill.id, 0) + me.con;
|
||||
|
||||
v = v + (me.con * (me.query_prop("con") + v)
|
||||
* (me.query_skill("force", 0) / 1000 + 100));
|
||||
|
||||
v = parseInt(v * (100 + me.query_prop("dazuo_per")) / 100);
|
||||
|
||||
if (diff_hp < v) {
|
||||
v = parseInt(diff_hp);
|
||||
diff_hp = 0;
|
||||
}
|
||||
v = me.do_recover(v);
|
||||
me.notify("<hig>你的气血恢复了" + v + "点。</hig>");
|
||||
}
|
||||
if (diff_hp <= 0) {
|
||||
me.notify("<hiy>你疗伤完毕,深深吸了口气,脸色看起来好了很多。</hiy>");
|
||||
me.send_message(me.name + "疗伤完毕,脸色看起来好了很多。");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
98
world/cmd/action/look.js
Normal file
98
world/cmd/action/look.js
Normal file
@@ -0,0 +1,98 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "look,l";
|
||||
this.allow_busy = true;
|
||||
this.allow_state = true;
|
||||
this.regex = /^(\w+?)?(?:\sof\s(\w+))?$/;
|
||||
//只能看房间里的物品
|
||||
this.enter = function (player, objid, from) {
|
||||
if (!objid) {
|
||||
|
||||
//player.notify(parent.items_to_json());
|
||||
//return parent.send_exits(player);
|
||||
return;
|
||||
}
|
||||
if (from) {
|
||||
let parent = player.find_obj(from, player.environment);
|
||||
if (!parent) return player.notify("你要看谁的装备?");
|
||||
var eq = parseInt(objid);
|
||||
if (!(eq >= 0 && eq < 11)) return player.notify("你要看什么?");
|
||||
if (parent.query_setting("hide_equip")) {
|
||||
return player.send("看样子" + parent.call3() + "不想让别人看自己的装备。");
|
||||
}
|
||||
var item = parent.equipment[eq];
|
||||
if (!item) return player.notify(parent.name + "没有装备你要看的东西。");
|
||||
|
||||
player.notify(item.get_desc(parent));
|
||||
if (parent != player)
|
||||
player.send_room("$N正盯着$n的" + item.color_name + "看,不知道在打什么主意。", parent, true);
|
||||
|
||||
} else {
|
||||
let parent = player.environment;
|
||||
if (!parent) return;
|
||||
let obj = parent.find_obj(objid);
|
||||
if (!obj) {
|
||||
return player.notify("你要看什么?");
|
||||
}
|
||||
if (obj.query_desc) {
|
||||
player.notify(obj.query_desc(player));
|
||||
if (obj != player)
|
||||
player.send_room(look_str.random(), obj, true);
|
||||
if (obj.hp > 0) {
|
||||
this.obs(player, obj);
|
||||
}
|
||||
}
|
||||
if (player.is_player && !obj.is_player) {
|
||||
obj.on_look && obj.on_look(player);
|
||||
}
|
||||
}
|
||||
|
||||
//if (from) {
|
||||
// parent = parent.find_obj(from);
|
||||
// if (!parent) {
|
||||
// return player.notify("你要看什么?");
|
||||
// }
|
||||
//}
|
||||
|
||||
//this.exec(player,obj);
|
||||
}
|
||||
var look_str = ["$N正盯着$n看,不知道在打什么主意。", "$N笑眯眯的看着$n,不知道在想些什么。"];
|
||||
|
||||
this.obs = function (me, target) {
|
||||
let obs = me.query_prop('obs');
|
||||
if (!obs || target.is_player || !target.attack_skill) return;
|
||||
if (me.query_temp('obs')) return;
|
||||
let sk_level = target.query_skill(target.attack_skill.id);
|
||||
|
||||
if (me.random(obs) + obs > sk_level) {
|
||||
let index = me.random(PROPS1.length);
|
||||
let prop = PROPS1[index];
|
||||
let val = target[prop];
|
||||
let diff = 1;
|
||||
let desc = '该有';
|
||||
if (sk_level > obs) {
|
||||
|
||||
let oper = (sk_level - obs) / obs;
|
||||
let diff = Math.random() * oper * (me.random(2) === 1 ? -0.5 : 0.5);
|
||||
val = val + Math.floor(val * diff);
|
||||
// diff = 10;
|
||||
// if (oper > 0.2) diff *= 10;
|
||||
// if (oper > 0.4) diff *= 10;
|
||||
// if (oper > 0.6) diff *= 10;
|
||||
// if (oper > 0.8) diff *= 10;
|
||||
// if (diff > val) {
|
||||
// diff = Math.pow(10, Math.floor(Math.log10(val)));
|
||||
// }
|
||||
desc = diff > 0 ? "不上" : "不下";
|
||||
}
|
||||
val = Math.floor(val / diff) * diff;
|
||||
me.send('你以观气术探向' + target.name + ",其" + PROPS2[index] + "之数" + desc + val + "。");
|
||||
|
||||
|
||||
} else {
|
||||
me.send('你以观气术探向' + target.name + ",却见其气场凝练如山,毫无所获。");
|
||||
}
|
||||
me.set_temp('obs', 1, 10000);
|
||||
}
|
||||
const PROPS1 = ['hp', 'mp', 'gj', 'fy', 'mz', 'ds', 'zj'];
|
||||
const PROPS2 = ['气血', '内力', '攻击', '防御', '命中', '躲闪', '招架'];
|
||||
|
||||
32
world/cmd/action/look1.js
Normal file
32
world/cmd/action/look1.js
Normal file
@@ -0,0 +1,32 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "look1";
|
||||
this.allow_busy = true;
|
||||
this.allow_state = true;
|
||||
this.regex = /^(\d+)(?:\sof\s(\w+))?$/;
|
||||
//只能看排行榜的物品
|
||||
this.enter = function (player, index, from) {
|
||||
index = parseInt(index);
|
||||
if (from) {
|
||||
var paras = from.split('_');
|
||||
let tops = WORLD.STATS.TOPS;
|
||||
if (paras[1]) tops = WORLD.STATS['tops_' + paras[1]] ?? [];
|
||||
let parent = tops[parseInt(paras[2])];
|
||||
if (!parent) {
|
||||
return player.notify("你要看什么?");
|
||||
}
|
||||
if (!(index >= 0 && index < 11)) return player.notify("你要看什么?");
|
||||
var item = parent.equipment[index];
|
||||
|
||||
if (!item) return player.notify(parent.name + "没有装备你要看的东西。");
|
||||
player.notify(item.get_desc(parent));
|
||||
|
||||
} else {
|
||||
var obj = WORLD.STATS.TOPS[index - 1];
|
||||
if (!obj) {
|
||||
return player.notify("你要看什么?");
|
||||
}
|
||||
if (obj.query_desc) {
|
||||
player.notify(obj.query_desc(player, "look1"));
|
||||
}
|
||||
}
|
||||
}
|
||||
64
world/cmd/action/look3.js
Normal file
64
world/cmd/action/look3.js
Normal file
@@ -0,0 +1,64 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "look3";
|
||||
this.allow_busy = true;
|
||||
this.allow_state = true;
|
||||
this.regex = /^(?:(\w+)\sof\s)?(\w+)$/;
|
||||
//查看不在同一房间的
|
||||
this.enter = function (me, index, userid) {
|
||||
if (userid.startsWith("fb_")) {
|
||||
var area_index = parseInt(userid.substr(3));
|
||||
var area = WORLD.AREAS[area_index];
|
||||
if (!area) return me.notify("没有这个副本。");
|
||||
var drop_items = area.query_drop_items();
|
||||
if (!drop_items) return me.notify("没有这件装备。");
|
||||
var item = drop_items[index];
|
||||
if (!item) return me.notify("没有这件装备。");
|
||||
if (item.skill) {
|
||||
var skill_base = SKILL.get(item.skill);
|
||||
if (!skill_base) {
|
||||
return me.send("没有这个技能。");
|
||||
}
|
||||
if (!me.skills) me.skills = {};
|
||||
return me.send(skill_base.query_desc(me, 1000));
|
||||
}
|
||||
// var book_index = item.path.indexOf("book/bc#");
|
||||
// if (book_index == 0) {
|
||||
// var skillid = item.path.substr(8);
|
||||
// var skill_base = SKILL.get(skillid);
|
||||
// if (!skill_base) {
|
||||
// return me.send("没有这个技能。");
|
||||
// }
|
||||
// return me.send(skill_base.query_desc(me, 1000));
|
||||
// }
|
||||
me.notify(item.get_desc(me));
|
||||
return;
|
||||
}
|
||||
if (userid === me.id) return me.send(me.query_desc(me, "look3"));
|
||||
var user = WORLD.getUser(userid);
|
||||
if (!user) return me.notify("没有这个玩家。");
|
||||
if (index != undefined) {
|
||||
if (index === 'body') {
|
||||
return me.send(user.query_desc(me, "look3"));
|
||||
}
|
||||
index = parseInt(index);
|
||||
if (!(index >= 0 && index < 11)) return me.notify("你要看什么?");
|
||||
if (user.query_setting("hide_equip")) {
|
||||
return me.send("看样子" + user.call3() + "不想让别人看自己的装备。");
|
||||
}
|
||||
|
||||
let item = user.equipment[index];
|
||||
if (!item) return me.notify(user.name + "没有装备你要看的东西。");
|
||||
me.notify(item.get_desc(user));
|
||||
|
||||
} else {
|
||||
// me.notify(user.query_desc(me, "look3"));
|
||||
me.send(user.long_name() + "<div class='item-commands'><span cmd='look3 body of " + user.id + "'>查看</span><span cmd='team add " + user.id + "'>邀请组队</span></div>");
|
||||
if (me.user_level >= 2) {
|
||||
if (user.query_temp("no_chat")) {
|
||||
me.send_commands("setuser " + user.id + " chat3", "解除禁言", "setuser " + user.id + " quit", "踢出游戏");
|
||||
} else {
|
||||
me.send_commands("setuser " + user.id + " chat1", "永久禁言", "setuser " + user.id + " chat2", "禁言1小时", "setuser " + user.id + " quit", "踢出游戏");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
world/cmd/action/makelove.js
Normal file
120
world/cmd/action/makelove.js
Normal file
@@ -0,0 +1,120 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "makelove";
|
||||
this.allow_fight = false;
|
||||
|
||||
this.enter = function (me, oid) {
|
||||
|
||||
if (me.environment.parent.id != 'home') return me.notify("这里双修可不太好,找个安全点的地方吧!");
|
||||
|
||||
let target = me.find_obj(oid, me.environment);
|
||||
|
||||
if (!target) return me.notify("你要和谁双修?");
|
||||
if (target == me) return me.notify("你要和自己双修?");
|
||||
//if (me.gender == 1 && target.gender == me.gender) return me.notify("没有这个功能。");
|
||||
// if (hasother && me.is_player) return me.notify("这儿还有别人呢,你好意思双修呀!");
|
||||
// if (me.is_player && target.is_player) return me.notify("你不能和玩家控制的人物双修。");
|
||||
if (!target.is_player && target.master != me.id) return me.notify(target.name + "不愿意和你双修。");
|
||||
//if (target.on_makelove && target.on_makelove(me) === false) return;
|
||||
if (me.query_temp("mk_request")) {
|
||||
this.accept(me, target);
|
||||
this.accept(target, me);
|
||||
} else {
|
||||
if (target.query_temp("mk_request")) return;
|
||||
|
||||
if (target.is_player) {
|
||||
target.notify("<yel>看样子" + me.call3() + "想和你双修...</yel>");
|
||||
target.send_commands("makelove " + me.id, "接受");
|
||||
target.set_temp("mk_request", 1, 10000);
|
||||
} else {
|
||||
|
||||
this.accept(me, target);
|
||||
|
||||
this.accept(target, me);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.accept = function (me, target) {
|
||||
|
||||
let name = target.name;
|
||||
me.send("<yel>你和" + name + "面对面盘膝坐下,掌心相对,双掌相抵。</yel>");
|
||||
let str = '["自' + name + '掌心涌来一股热流,慢慢涌向你全身经脉。","内力游遍任督二脉,你只觉全身舒畅无比。", "你将内力引入丹田,化为一股热流涌入' + name + '掌心。"]';
|
||||
|
||||
me.set_state({
|
||||
id: "sx",
|
||||
title: "双修中",
|
||||
rate: 2,
|
||||
on_enter: do_dazuo,
|
||||
no_move: "双修时要专心,小心走火入魔。",
|
||||
desc: str,
|
||||
stime: Date.now(),
|
||||
on_check: on_check,
|
||||
on_stop: function (p, isauto) {
|
||||
p.notify("<hiy>你双修完毕,深深吸了口气,站了起来。</hiy>");
|
||||
if (p.is_player && !target.is_player)
|
||||
target.set_state(null);
|
||||
if (isauto && p.query_setting('auto_work')) {
|
||||
return WORLD.check_user_next(p);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
function on_check(me) {
|
||||
let speed = parseInt((me.query_skill("force") / 100
|
||||
+ me.query_prop("shuangxiu")
|
||||
+ 1 + me.con / 10) * (100 + me.query_prop("dazuo_per")
|
||||
+ me.family.query_temp('dazuo_per', 0)
|
||||
+ WORLD.DATA.query_temp("dazuo_per", 0) + 50) / 100);
|
||||
let str = ['<hic>你正在双修中,每10秒增加', speed, "最大内力,预计"];
|
||||
|
||||
var max = me.limit_mp + me.query_prop("limit_mp");
|
||||
let time = Math.floor((max - me.max_mp) / speed) * 10;
|
||||
|
||||
if (time < 60) str.push('不到1分钟');
|
||||
else {
|
||||
if (time > 86400) {
|
||||
str.push(Math.floor(time / 86400), '天');
|
||||
time = time % 86400;
|
||||
}
|
||||
if (time > 3600) {
|
||||
str.push(Math.floor(time / 3600), '小时');
|
||||
time = time % 3600;
|
||||
}
|
||||
str.push(Math.floor(time / 60), '分钟');
|
||||
}
|
||||
str.push('达到内力上限', max, '</hic>。');
|
||||
me.send(str.join(""));
|
||||
}
|
||||
function do_dazuo(me) {
|
||||
var max = me.limit_mp + me.query_prop("limit_mp");
|
||||
|
||||
var force_skill = me.force_skill;
|
||||
if (!force_skill) return me.notify_fail("<hir>你突然忘了怎么打坐。</hir>");
|
||||
if (me.mp < me.max_mp) {
|
||||
if (me.mp >= me.max_mp) {
|
||||
return me.notify_fail("<hic>你觉得你的经脉充盈,已经没有办法再增加内力了。</hic>");
|
||||
}
|
||||
let v = parseInt(me.max_mp / 3);
|
||||
me.notify("<hig>你的内力恢复了" + v + "点。</hig>");
|
||||
me.add_mp(v);
|
||||
} else {
|
||||
if (max > me.max_mp) {
|
||||
let v = parseInt((me.query_skill("force") / 100
|
||||
+ me.query_prop("shuangxiu")
|
||||
+ 1 + me.con / 10) * (100 + me.query_prop("dazuo_per")
|
||||
+ me.family.query_temp('dazuo_per', 0)
|
||||
+ WORLD.DATA.query_temp("dazuo_per", 0) + 50) / 100);
|
||||
me.notify("<hig>你的最大内力增加了" + v + "点。</hig>");
|
||||
me.max_mp += v;
|
||||
me.mp += v;
|
||||
me.recount();
|
||||
return me.notify_hp();
|
||||
}
|
||||
if (me.is_player)
|
||||
return me.notify_fail("<hic>你觉得你的经脉充盈,已经没有办法再增加内力了。</hic>");
|
||||
|
||||
}
|
||||
}
|
||||
81
world/cmd/action/select.js
Normal file
81
world/cmd/action/select.js
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
this.inherits(COMMAND);
|
||||
this.command = "select,command";
|
||||
this.allow_busy = true;
|
||||
this.allow_state = true;
|
||||
this.enter = function (me, arg) {
|
||||
if (!me.environment) return;
|
||||
if (arg) {
|
||||
var target = me.environment.find_obj(arg);
|
||||
if (!target) {
|
||||
return me.notify("这里没有这个东西。");
|
||||
}
|
||||
me.notify(target.query_commands(me));
|
||||
if (target.hp) {
|
||||
var str = ["{type:\"cmds\",items:["];
|
||||
|
||||
if (target.path && me.query_temp('yb_npc2') == target.path) {
|
||||
str.push("{cmd:\"task yunbiao ");
|
||||
str.push(target.id);
|
||||
str.push(" give\",name:\"交镖银\"}");
|
||||
}
|
||||
str.push("]}");
|
||||
if (str.length > 2) {
|
||||
|
||||
me.send(str.join(''));
|
||||
}
|
||||
|
||||
}
|
||||
if (me.user_level > 0 && target.is_player) {
|
||||
me.send_commands("setuser " + target.id + " chat1", "永久禁言",
|
||||
|
||||
"setuser " + target.id + " chat2", "禁言24小时",
|
||||
"setuser " + target.id + " quit", "踢出游戏",
|
||||
"setuser " + target.id + " dis", "登录限制",
|
||||
"setuser " + target.id + " query", "查询信息",
|
||||
"setuser " + target.id + " reback", "开始回档");
|
||||
}
|
||||
|
||||
} else {
|
||||
me.notify(me.environment.query_commands(me, true));
|
||||
}
|
||||
}
|
||||
this.exec = function (me, target) {
|
||||
var str = ['{type:"'];
|
||||
str.push(me == target ? 'login"' : 'select"');
|
||||
if (target) {
|
||||
str.push(',hp:');
|
||||
str.push(target.hp);
|
||||
str.push(',mp:');
|
||||
str.push(target.mp);
|
||||
str.push(',max_hp:');
|
||||
str.push(target.max_hp);
|
||||
str.push(',max_mp:');
|
||||
str.push(target.max_mp);
|
||||
str.push(',name:"');
|
||||
str.push(target.long_name());
|
||||
str.push('",level:');
|
||||
str.push(target.level);
|
||||
str.push(',id:"');
|
||||
str.push(target.id);
|
||||
|
||||
|
||||
str.push('",status:[');
|
||||
if (target.status) {
|
||||
for (var item in target.status) {
|
||||
str.push(target.status[item].to_json());
|
||||
}
|
||||
}
|
||||
str.push(']');
|
||||
}
|
||||
str.push('}');
|
||||
if (me != target) {
|
||||
if (me.action_target) {
|
||||
me.action_target.remove_listen(me);
|
||||
}
|
||||
me.action_target = target;
|
||||
if (target)
|
||||
me.action_target.add_listen(me);
|
||||
}
|
||||
return this.notify(str.join(""));
|
||||
}
|
||||
20
world/cmd/action/state.js
Normal file
20
world/cmd/action/state.js
Normal file
@@ -0,0 +1,20 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "state";
|
||||
this.allow_busy = true;
|
||||
this.allow_state = true;
|
||||
this.enter = function (me, type) {
|
||||
if (!me.state) return me.send('你没有在忙。');
|
||||
if (type === 'stop') {
|
||||
if (me.state) {
|
||||
if (me.state.no_stop) return me.notify(me.state.no_stop);
|
||||
}
|
||||
me.set_state(null);
|
||||
} else {
|
||||
if (me.state.on_check) {
|
||||
return me.state.on_check(me);
|
||||
}
|
||||
return me.send('你正在' + me.state.title + "。");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
44
world/cmd/action/status.js
Normal file
44
world/cmd/action/status.js
Normal file
@@ -0,0 +1,44 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "status";
|
||||
this.allow_busy = true;
|
||||
this.allow_state = true;
|
||||
this.allow_die = true;
|
||||
this.allow_faint = true;
|
||||
this.regex = /^(\w+)(?:\s(\w+))?$/;
|
||||
this.enter = function (me, type, tid) {
|
||||
if (type) {
|
||||
var target = me;
|
||||
if (tid) {
|
||||
target = me.find_obj(tid, me.environment);
|
||||
if (!target) return;
|
||||
}
|
||||
|
||||
if (!target.status) return me.send("没有这个状态。");
|
||||
|
||||
var status = null;
|
||||
for (var i = 0; i < target.status.length; i++) {
|
||||
if (target.status[i].id == type) {
|
||||
status = target.status[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!status) return me.send("没有这个状态。");
|
||||
var str = [];
|
||||
str.push(status.downside ? "<red>" : "<hig>");
|
||||
str.push(status.name);
|
||||
if (status.override == 1) {
|
||||
str.push(UTIL.to_c(status.count));
|
||||
str.push("层");
|
||||
}
|
||||
|
||||
str.push(status.downside ? "</red>\n" : "</hig>\n");
|
||||
if (status.desc) {
|
||||
str.push(status.desc);
|
||||
str.push("\n");
|
||||
}
|
||||
str.push(status.downside ? "<red>" : "<hig>");
|
||||
str.push(UTIL.prop_toString(status.prop, "\n", status.count));
|
||||
str.push(status.downside ? "</red>\n" : "</hig>\n");
|
||||
me.send(str.join(""));
|
||||
}
|
||||
}
|
||||
29
world/cmd/action/wakuang.js
Normal file
29
world/cmd/action/wakuang.js
Normal file
@@ -0,0 +1,29 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "wakuang";
|
||||
this.enter = function (me, arg) {
|
||||
if (!me.equipment || !me.equipment[0]
|
||||
|| !me.equipment[0].path.startsWith("sp/tool/chu")) {
|
||||
var chu = null;
|
||||
for (let item of me.items) {
|
||||
if (!item.is_equipment) continue;
|
||||
if (item.path.startsWith("sp/tool/chu")) {
|
||||
if (!chu || chu.grade < item.grade)
|
||||
chu = item;
|
||||
}
|
||||
}
|
||||
|
||||
if (!chu) return me.notify('你身上没有挖矿工具,去铁匠铺购买铁镐再去挖矿。');
|
||||
me.do_command("eq", chu.id);
|
||||
}
|
||||
if (arg === 'home') {
|
||||
me.do_command("goto", "home");
|
||||
me.do_command("go", "northeast");
|
||||
return me.do_command("wk");
|
||||
}
|
||||
me.do_command("jh", "fam 0 start");
|
||||
me.do_command("go", "west");
|
||||
me.do_command("go", "west");
|
||||
me.do_command("go", "west");
|
||||
me.do_command("go", "west");
|
||||
me.do_command("wa");
|
||||
}
|
||||
63
world/cmd/action/wk.js
Normal file
63
world/cmd/action/wk.js
Normal file
@@ -0,0 +1,63 @@
|
||||
this.inherits(COMMAND);
|
||||
this.command = "wk";
|
||||
|
||||
this.enter = function (me) {
|
||||
|
||||
var wea = me.query_weapon();
|
||||
if (me.master) {
|
||||
if (!me.is_in('home/huayuan')) return false;
|
||||
if (me.query_skill('guanshanjue', 0) < 100) {
|
||||
return me.notify('你的观山诀等级太低,无法在这里挖矿。');
|
||||
}
|
||||
}
|
||||
if (me.is_player) {
|
||||
if (!me.is_in('yz/kuang')) {
|
||||
if (!me.is_in('home/huayuan')) {
|
||||
return false;
|
||||
}
|
||||
if (me.query_skill('guanshanjue', 0) < 100) {
|
||||
return me.notify('你的观山诀等级太低,无法在这里挖矿。');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!wea || !wea.path.startsWith("sp/tool/chu")) return me.notify("挖矿不拿铁镐可怎么挖,你可以去扬州城的铁匠那里购买。");
|
||||
me.send_room("$N挥着铁镐开始认真挖矿。");
|
||||
|
||||
me.set_state({
|
||||
id: "wk",
|
||||
type: "work",
|
||||
title: "挖矿",
|
||||
player: me,
|
||||
rate: 2,
|
||||
on_enter: do_diaoyu,
|
||||
stime: Date.now(),
|
||||
no_move: "你还在挖矿,专心点比较好!",
|
||||
desc: '["你扒拉着石头,仔细寻找碎石中有没有宝贝。","你拿着一块小石头对着阳光仔细的看着,不知道是不是宝贝。","你扔掉手中的碎石继续寻找,加油吧,运气好你就发达了。"]',
|
||||
on_check: on_check
|
||||
});
|
||||
}
|
||||
|
||||
function on_check(me) {
|
||||
var exp = WORLD.DATA.exps[me.level]
|
||||
+ WORLD.DATA.query_temp("kuang_exp", 0);
|
||||
var pot = exp + me.query_prop('gsj_qn');
|
||||
me.send(`你正在挖矿,每10秒获得${exp}经验,${pot}潜能,有概率挖到<hig>玄晶</hig>和其他宝石。`);
|
||||
}
|
||||
function do_diaoyu(me) {
|
||||
let obj = me.add_obj(["st/xuanjing", "st/st_red#0", "st/st_blu#0", "st/st_gre#0", "st/st_yel#0"
|
||||
, "st/st_red#1", "st/st_blu#1", "st/st_gre#1", "st/st_yel#1"][me.random(9)]);
|
||||
if (obj) {
|
||||
me.notify("<hig>恭喜你得到一颗" + obj.color_name + "。</hig>");
|
||||
}
|
||||
|
||||
|
||||
var exp = WORLD.DATA.get_exp(me)
|
||||
+ WORLD.DATA.query_temp("kuang_exp", 0);
|
||||
|
||||
var pot = exp + me.query_prop('gsj_qn');
|
||||
me.add_exp(exp, pot, 0);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user