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

View 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(""));
}

View 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
View 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
View 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);
}

View 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);
}

View 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
View 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
View 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
View 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;
}

View 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];
}
}
}

View 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", "确定遣散");
}
}

View 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
View 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
View 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 = {
};

View 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
View 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
View 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
View 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", "踢出游戏");
}
}
}
}

View 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>");
}
}

View 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
View 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 + "。");
}
}

View 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(""));
}
}

View 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
View 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);
}

24
world/cmd/admin/call.js Normal file
View File

@@ -0,0 +1,24 @@
this.inherits(COMMAND);
this.command = "call";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.allow_level = 6;
this.regex = /^(?:(\w+)\s)?(.+)$/;
this.enter = function (me, target, arg) {
try {
var func = new Function(arg);
var player = me;
if (target) {
player = WORLD.getUser(target);
if (!player) return me.notify("没有这个玩家");
}
func.call(player);
//me.recount();
me.notify("ok");
} catch (e) {
console.log(e);
me.notify("error:" + e);
}
}

32
world/cmd/admin/notice.js Normal file
View File

@@ -0,0 +1,32 @@
this.inherits(COMMAND);
this.command = "notice";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_level = 1;
const MESSAGE = WORLD.MESSAGE;
this.enter = function (me, arg) {
var nt = {
content: arg,
time: Date.now()
};
MESSAGE.NOTICES.push(nt);
var item = {
type: "dialog", dialog: "message", message: {
time: nt.time,
content: nt.content,
id: "notice",
name: "系统公告"
}
};
var str = JSON.stringify(item);
WORLD.sendAll(str);
}
this.updatelast = function (me) {
MESSAGE.NOTICES[MESSAGE.NOTICES.length - 1].content = `
古大陆妖族营地在每周快速完成后,仍可以继续手动击杀,直到每周上限。
降低营地1刷新速度10秒其他营地暂时关闭
`;
me.send(MESSAGE.NOTICES[MESSAGE.NOTICES.length - 1].content);
}

View File

@@ -0,0 +1,20 @@
this.inherits(COMMAND);
this.command = "recover";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.admin = true;
this.regex = /^(.+?)(?:\s(\w+))?$/;
this.allow_level = 2;
this.enter = function (me, userid, objid) {
}
this.clear = function (user) {
}
this.add_obj = function (me, obj, type, key) {
}

71
world/cmd/admin/send.js Normal file
View File

@@ -0,0 +1,71 @@
this.inherits(COMMAND);
this.command = "send";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.regex = /^(\w+)\s(.+)$/;
this.enter = function (me, user, arg) {
if (me && me.allow_level < 5) return false;
if (!arg) return me && me.send("没有消息内容。");
var msg;
var is_str = typeof arg == "string";
if (is_str && arg[0] != "{") {
msg = { content: arg, time: Date.now() };
} else {
msg = is_str ? JSON.toObject(arg) : arg;
if (!msg.content || !msg.attach) return me && me.send("格式错误。");
msg.time = Date.now();
for (var i = 0; i < msg.attach.length; i++) {
let attach = msg.attach[i];
var obj = OBJ.CREATE(attach.obj, attach.count);
if (obj) {
attach.name = obj.unit_name(attach.count);
}
}
}
var users = [];
if (user == "all") {
users = WORLD.USERS;
} else {
var player = WORLD.getUser(user);
if (!player) player = { id: user };
users.push(player);
}
var obj = {};
obj.type = "dialog";
obj.dialog = "message";
obj.message = {
id: msg.from || "system",
name: msg.from_name || "系统",
content: msg.content,
time: msg.time,
attach: msg.attach
};
for (var i = 0; i < users.length; i++) {
let user_msg = {
time: msg.time,
content: msg.content,
attach: msg.attach
};
let mail_type = obj.message.id;
WORLD.MESSAGE.pushUserMessage(users[i].id, {
id: mail_type, name: obj.message.name
}, user_msg);
obj.message.index = user_msg.index;
if (users[i].socket) users[i].send(JSON.stringify(obj));
if (RECORD[mail_type]) {
WORLD.log(users[i], mail_type, msg.content);
}
}
me && me.notify("发送完成,共发送" + users.length);
}
const RECORD = {
top: true,
score: true,
weapon: true
};

View File

@@ -0,0 +1,27 @@
this.inherits(COMMAND);
this.command = "shutdown";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_level = 6;
this.handler = 0;
this.enter = function (me, arg) {
if (arg == "stop") {
if (this.handler) {
clearInterval(this.handler);
WORLD.sendAll("<hic>服务器停止维护,谢谢大家支持。</hic>");
}
return;
}
WORLD.sendAll("<hir>服务器将要关闭维护,各位玩家请处理好自己的游戏状态。</hir>");
this.handler = this.call_interval(function (count) {
WORLD.sendAll("<red>还有" + (100 - count * 10) + "秒后服务器将关闭维护,请处理好自己的游戏状态。</red>");
}, 10000, 10, function () {
WORLD.sendAll("<red>服务器关闭。</red>");
WORLD.close();
// WORLD.LISTENER.tcpServer._events.connection = null;
});
}

120
world/cmd/admin/update.js Normal file
View File

@@ -0,0 +1,120 @@
this.inherits(COMMAND);
this.command = "update";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_level = 6;
this.enter = function (me, arg) {
try {
if (!arg) return this.notify(me, "路径不合理");
if (arg === 'room') {
return this.update_room(me);
} else if (arg === 'npc') {
return this.update_npc(me);
}
arg = arg.replace(/\\/g, "/");
if (arg.startsWith("doc/")) return;
var index = arg.indexOf("/");
if (index == -1) return this.notify(me, "路径不合理");
var path = __PATH.WORLD + arg.substr(0, index + 1);
var fname = arg.substr(index + 1);
BASE.UPDATE(path, fname);
this.notify(me, arg + "已更新。");
} catch (e) {
console.log(e);
this.notify(me, "error:" + e);
}
}
this.notify = function (me, msg) {
if (me) return me.notify(msg);
console.log(msg);
}
this.update_npc = function (me, path) {
this.enter(me, "npc/" + path);
let npc = me.environment.find_obj_bypath(path);
if (npc) {
npc.destroy();
NPC.CREATE(path, me.environment);
}
let map = WORLD.NPC_STROE;
npc = map.get(path);
if (!npc.on_create) return;
let keys = map.keys();
path = path + "#";
for (let key of keys) {
if (key.startsWith(path)) {
map.delete(key);
me.send('delete' + key);
}
}
}
this.update_obj = function (me, path) {
this.enter(me, "obj/" + path);
let map = WORLD.OBJ_STROE;
let obj = map.get(path);
if (!obj.on_create) return;
let keys = map.keys();
path = path + "#";
for (let key of keys) {
if (key.startsWith(path)) {
map.delete(key);
me.send('delete' + key);
}
}
}
this.update_room = function () {
}
if (WORLD.COMMANDS.update && WORLD.COMMANDS.update.clear_update) {
WORLD.COMMANDS.update.clear_update();
}
this.clear_update = function () {
if (this.update_hander)
clearTimeout(this.update_hander);
this.update_time = null;
console.log('clear timeout');
}
this.wait_update = function (me, upd_time) {
if (!upd_time) return me.send('没有设置更新时间');
if (typeof upd_time === 'string') {
upd_time = new Date(upd_time);
}
let time = upd_time - Date.now();
if (!(time > 10000))
return me.send('更新时间不能小于当前时间');
this.update_hander = this.call_out(this.on_update, time);
this.update_time = upd_time;
this.format_time(me, this.update_time);
}
this.format_time = function (me, time) {
let str = ['已设置', time.toLocaleString(), '更新,在'];
time = time - Date.now();
if (time > 3600000) {
str.push(Math.floor(time / 3600000), "小时");
time = time % 3600000;
}
if (time > 60000) {
str.push(Math.floor(time / 60000), "分钟");
time = time % 60000;
}
time = Math.floor(time / 1000);
str.push(time, '秒后');
me.send(str.join(""));
}
this.on_update = function () {
this.update_hander = null;
this.update_time = null;
}
this.wait = function (me) {
let task = TASK.GET('time');
let updtime = new Date(2026, 1, 15, 12);
let time = updtime.getTime() - Date.now();
task.handler = task.call_out(task.run2, time);
this.format_time(me, updtime);
}

11
world/cmd/admin/user.js Normal file
View File

@@ -0,0 +1,11 @@
this.inherits(COMMAND);
this.command = "user";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_level = 3;
const num_reg = /\d+/;
this.enter = function (me, arg) {
}

View File

@@ -0,0 +1,53 @@
this.inherits(COMMAND);
this.command = "combat";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, type) {
if (type=="end") {
me.combat_info = false;
} else {
me.combat_info = true;
//me.notify(me.query_status());
me.notify(me.query_pfms());
//if (me.is_fighting()) {
// var target = me.enemy[0];
// if (target)
// me.notify(target.query_status());
//}
}
}
//USER.prototype.query_pfms = function () {
// if (this.pfm_json) return this.pfm_json;
// var obj = {};
// obj.type = "perform";
// obj.distime = this.gjsd;
// obj.items = [];
// var skills = this.skills;
// if (skills) {
// var bases = ["unarmed", "force", "dodge", "parry"];
// var weapon = this.query_weapon_type();
// if (weapon != WEAPON_TYPE.NONE) bases.push(weapon);
// for (var i = 0; i < bases.length; i++) {
// var base_skill = skills[bases[i]];
// if (base_skill) {
// var sp_skill = SKILL.get(base_skill.enable || bases[i]);
// if (sp_skill && sp_skill.pfm) {
// for (var p in sp_skill.pfm) {
// var pfmitem = sp_skill.pfm[p];
// obj.items.push({
// name: pfmitem.name,
// distime: pfmitem.distime || 1,
// id: bases[i] + "." + p
// });
// }
// }
// }
// }
// }
// this.pfm_json = JSON.stringify(obj)
// return this.pfm_json;
//}

View File

@@ -0,0 +1,9 @@
this.inherits(COMMAND);
this.command = "escape";
this.enter = function (me) {
if (!me.fight_type) {
return me.notify("你现在没有在战斗,逃跑干嘛?");
}
me.do_escape();
}

75
world/cmd/battle/fight.js Normal file
View File

@@ -0,0 +1,75 @@
this.inherits(COMMAND);
this.command = "fight";
this.enter = function (me, argid) {
if (argid == "none") {
var items = me.environment.items;
for (var i = 0; i < items.length; i++) {
if (items[i].is_player && items[i].query_temp("fight") == me.id) {
me.send_room("看起来$N并不想跟$n较量。", items[i], true);
return me.notify("你拒绝了" + items[i].name + "的比试请求。");
}
}
return me.notify("这里没有人想要和你比试。");
}
if (me.environment.no_fight) return me.notify("这里不允许战斗。");
var target = me.find_obj(argid, me.environment);
if (!target) {
return me.notify("你要攻击谁?");
}
if (target.can_speek == false) return me.notify("看起来它并不想跟你较量。");
if (target == me) return me.notify("你不能和自己比试。");
if (target.hp < target.max_hp * 0.95) {
return me.notify(target.name + "的状态不是很好,你想趁人之危吗?");
}
if (me.hp < me.max_hp) {
return me.notify("你先调整好自己的状态再来找别人比试吧。");
}
if (me.is_fighting(target)) {
return me.notify("加油,加油!!");
}
if (me.is_fighting()) {
return me.notify("等你打完再和别人比试吧!");
}
if (target.is_fighting()) {
return me.notify("对方正在切搓,等对方打完再来吧");
}
me.send_room("\n$N对著$n说道"
+ me.callme()
+ me.name + ",领教"
+ target.call() + "的高招!\n", target);
if (target.no_fight || target.query_setting("off_fight")) {
return me.send_room("看起来$n并不想跟$N较量。", target);
} else {
var ol_fight = me.query_temp("fight");
if (ol_fight) {
if (ol_fight != target.id) {
var ol_target = me.find_obj(ol_fight, me.environment);
if (ol_target) {
ol_target.notify("<yel>" + me.name + "取消了和你比试的念头。\n</yel>");
}
me.remove_temp("fight");
}
}
if (target.is_player) {
if (target.query_temp("fight") != me.id) {
me.set_temp("fight", target.id, 10000);
target.notify("<hiy>" + me.name + "想和你比试,你是否同意:</hiy>");
target.send_commands("fight " + me.id, "和" + me.name + "比试", "fight none", "不同意");
return me.notify("<hiy>已发送比试请求,正在等待对方同意。</hiy>");
} else {
target.remove_temp("fight");
}
} else {
if (target.on_before_fight && target.on_before_fight(me) === false)
return;
}
me.send_room("$n说道既然" + me.call() + "赐教," + target.callme() + "只好奉陪。\n", target);
me.begin_attack(target, 1);
target.begin_attack(me, 1);
}
}

88
world/cmd/battle/kill.js Normal file
View File

@@ -0,0 +1,88 @@
this.inherits(COMMAND);
this.command = "kill";
this.enter = function (me, argid) {
if (me.state) {
return me.notify("你现在正在" + me.state.title + ",没时间杀人。");
}
if (me.environment.no_fight) {
return me.notify("这里不允许战斗。");
}
var target = me.find_obj(argid, me.environment);
if (!target || !target.do_kill) {
return me.notify("你要攻击谁?");
}
if (target === me) return me.notify("你要攻击谁?");
if (target.is_player) {
// me.add_temp('k_ss', 1, UTIL.diff_time());
if (target.query_setting("ban_pk"))
return me.notify(target.name + "正在开启PK保护你不能击杀" + target.call3() + "。");
if (me.query_setting("ban_pk"))
return me.notify("你正在开启PK保护无法主动PK玩家。");
else {
if (!me.query_temp("pk")) {
me.notify("<hic>你主动击杀玩家7天内不能开启PK保护。</hic>");
}
me.set_temp("pk", 1, 24 * 3600000 * 7);
}
} else if (target.family && target.on_master) {
if (me.query_setting("ban_pk"))
return me.notify("你正在开启PK保护无法击杀拜师NPC。");
}
if (me.enemy && me.enemy[0] == target) {
return me.notify("加油,加油!!");
}
if (me.fight_type == 1) return me.notify("你先比试完再说。");
if (me.is_fighting()) {
for (var i = 0; i < me.enemy.length; i++) {
if (me.enemy[i] == target) {
me.enemy.splice(i, 1);
me.enemy.splice(0, 0, target);
return me.send_room("$N扑向$n", target);;
}
}
if (target.on_kill && target.on_kill(me) == false) return;
target.do_kill(me);
target.begin_kill && target.begin_kill(me);
return me.send_room("$N扑向$n", target);
}
if (target.fight_type == 1) {
// var eny = target.query_enemy();
// if (eny) {
// eny.end_fight();
// }
// target.end_fight();
// return me.notify('对方正在比试,你不能趁人之危。');
}
// me.send_room("$N对$n大喊一声看招\n", target);
me.send_room("\n$N对著$n喝道「"
+ target.call(me, true) + "!今日不是你死就是我活!」\n", target);
//me.begin_attack(target, 2);
if (target.on_kill && target.on_kill(me) == false) return;
if (me.team) {
for (var i = 0; i < me.team.length; i++) {
var item = me.team[i];
if (item.master == me.id && item.query_setting("auto_kill") == 2 && item.is_here(me)) {
item.do_kill(target);
}
}
}
me.do_kill(target);
target.begin_kill && target.begin_kill(me);
if (me.team) {
for (var i = 0; i < me.team.length; i++) {
var item = me.team[i];
if (item.master == me.id && item.query_setting("auto_kill") == 1 && item.is_here(me)) {
item.do_kill(target);
}
}
}
WORLD.auto_pfm(me, target);
}

169
world/cmd/battle/pfm.js Normal file
View File

@@ -0,0 +1,169 @@
this.inherits(COMMAND);
this.command = "perform";
this.allow_busy = true;
this.allow_faint = true;
this.regex = /^(\w+)\.(.+?)$/;
this.enter = function (me, sk, pfmid) {
if (!sk || !pfmid) return me.notify("你要使用什么绝招。");
if (!me.skills) return me.notify("你目前没有学会任何技能。");
var baseSkill = me.skills[sk];
if (!baseSkill) return me.notify("你不会用这个技能。");
var sp_skill = SKILL.get(baseSkill.enable_skill || sk);
if (!sp_skill) return me.notify("没有这个技能。");
var sp_myskill = me.skills[sp_skill.id];
if (!sp_myskill || sp_myskill.disable)
return me.notify("这个技能暂时无法使用,请联系管理员处理。");
var is_ref = false;
let pfm = sp_skill.get_pfm(pfmid);
if (!pfm) {
if (pfmid == 'ref') {
pfm = me.query_ref_skill(me.skills[baseSkill.enable_skill]);
}
if (!pfm) {
return me.notify(sp_skill.name + "没有这个绝招。");
} else {
is_ref = true;
}
}
if (me.environment.no_fight && !pfm.allow_safe) return me.notify("这里不允许战斗。");
var name = "【" + pfm.name + "】";
//0 只能战斗中使用, 1只能非战斗 2任何时候
if (me.hp <= 0) return;
if (!pfm.allow_busy && me.is_busy) return me.notify("你现在手忙脚乱,无法使用" + name + "。");
if (me.is_faint && !pfm.allow_faint) return me.send("你正在昏迷中。");
if (!pfm.use_type && !me.is_fighting()) return me.notify(name + "只能在战斗中使用。");
if (pfm.use_type == 1 && me.is_fighting()) return me.notify("战斗中无法使用" + name + "。");
var lv = me.query_skill(sp_skill.id, 0);
if (is_ref) lv = parseInt(lv / 2);
if (me.mp < pfm.query_mp(me, lv)) {
return me.notify("你的内力不够,无法使用" + name);
}
if (pfm.check && !pfm.check(me,
lv, sk)) return;
if (pfm.enable_skill && pfm.enable_skill != sk) {
return me.notify(name + "需要装备为" + SKILL.get(pfm.enable_skill).name + "才可以使用。");
}
if (sk === "throwing" && !me.can_throwing()) {
return me.notify("你没有装备暗器,无法使用" + name);
}
if (pfm.weapon_type) {
if (pfm.weapon_type != me.query_weapon_type())
return me.notify("你装备的武器不对,无法使用" + name);
} else {
let need_weapon = WEAPON[sk];
if (need_weapon && need_weapon !== me.query_weapon_type()) {
return me.notify("你装备的武器不对,无法使用" + name);
}
// if (!NOWEAPON[pfm.enable_skill]) {
// if (pfm.enable_skill != me.query_weapon_type()) {
// return me.notify("你装备的武器不对,无法使用" + name);
// }
// }
}
if (pfm.check && !pfm.no_check && !pfm.check(me, lv)) {
return;
}
var key = "pfm/" + sk + "/" + pfmid;
if (me.query_temp(key)) {
return me.notify(pfm.name + "还没准备好,你还不能使用。");
}
var target = me.query_enemy();
if (!pfm.use_type) {
if (!target) return me.notify("你要用绝招对付谁?");
}
var now = Date.now();
if (me.release_time && now < me.release_time)//上个技能还没释放完
{
return me.notify("你上个技能还没释放完成。");
}
var isrelease = false;
if (me.query_prop('no_pfm')) {
me.send_room("<red>$N释放技能" + pfm.name + ",但是没有产生任何效果。</red>\n");
me.remove_status('bikou');
isrelease = true;
} else if (target && target.parry_skill && target.parry_skill.on_parry_pfm) {
isrelease = target.parry_skill.on_parry_pfm(target, me, pfm, lv, sk);
} else {
if (pfm.is_weapon && sp_skill != me.attack_skill) {
//me.attack_skill = sp_skill;
me.remove_status('weapon', true);
}
isrelease = pfm.use(me, target, lv, sk) != false;
}
if (isrelease) {
me.add_mp(-pfm.query_mp(me, lv) || 0);
//释放成功才算释放时间
// if (!pfm.use_type) {
// //保存目标被释放的技能
// me.set_temp("used_pfm", pfm.id, 20000);
// }
me.set_temp("used_pfm", pfm.id, 20000);
var time = pfm.query_releasetime(me, lv);
if (time) me.release_time = time + now;
else me.release_time = 0;
var distime = pfm.query_distime(me, lv, is_ref);
var rtime = isrelease ? pfm.query_releasetime(me, lv) : 0;
me.set_temp(key, 1, distime + rtime);
me.notify('{type:"dispfm",id:"' + sk + "." + pfmid + '",rtime:'
+ rtime + ',distime:' + (distime + rtime) + '}');
if (pfm.is_weapon && sp_skill != me.attack_skill) {
me.attack_skill = sp_skill;
me.remove_status('weapon', true);
}
}
}
const NOWEAPON = {
"force": true,
"unarmed": true, "dodge": true,
"parry": true, throwing: true
};
const WEAPON = {
sword: "sword",
blade: "blade",
staff: "staff",
club: "club",
whip: "whip"
};
// WEAPON_TYPE = {
// NONE: "unarmed",
// SWORD: "sword",
// BLADE: "blade",
// STAFF: "staff",
// CLUB: "club",
// WHIP: "whip",
// THROWING: "throwing"
// }

11
world/cmd/battle/pk.js Normal file
View File

@@ -0,0 +1,11 @@
this.inherits(COMMAND);
this.command = "pk";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.enter = function (me) {
var zc = WORLD.AREAS[6];
}

109
world/cmd/battle/relive.js Normal file
View File

@@ -0,0 +1,109 @@
this.inherits(COMMAND);
this.command = "relive";
this.allow_die = true;
this.enter = function (me, arg) {
if (!WORLD.is_server(me)) {
return WORLD.on_cross_user_relive(me);
}
if (me.hp > 0) return me.notify("你还没死呢。");
if (!me.environment) return me.notify("你不知道在哪。");
if (me.query_temp("relive")) {
return me.notify("你已经使用了天师符,正在等待复活。");
}
me.die = USER.prototype.die;
var dt = new Date();
var isqmhd = dt.getMonth() === 3 && dt.getDate() === 5;
var ismaxcount = false;
if (isqmhd) {
let next = new Date(dt.getFullYear(), dt.getMonth(), dt.getDate(), dt.getHours() + 1);
ismaxcount = me.add_temp('died', 1, next.getTime() - dt.getTime()) < 11;
}
// me.add_temp('died', 1, UTIL.diff_time());
if (arg == "locale") {
if (me.environment.no_relive)
return me.notify('这里不能复活。');
if (!isqmhd) {
var fu = me.find_obj_bypath("cash/tianshifu");
if (!fu || !fu.count) return me.notify("你身上没有天师符。");
me.remove_obj(fu, 1);
}
if (isqmhd && ismaxcount) {
WORLD.DATA.set_temp("new_die", me.id, 600000);
WORLD.DATA.set_temp("new_die_type", 1, 600000);
// me.add_temp('die1', 1, 3600000 * 28);
}
me.set_temp("relive", 1, 5000);
me.notify("<MAG>你拿出一张天师符,口中念念有词!</MAG><hik>\n五秒后将原地复活</hik>");
this.call_out(x => {
me.hp = me.max_hp;
me.mp = me.max_mp;
me.notify('{type:"die",relive:true}');
if (me.force_skill.on_relive) {
me.force_skill.on_relive(me);
}
if (me.environment.on_relive && me.environment.on_relive(me, true) === false) {
return;
}
me.clear_status();
let room = me.environment;
me.environment = null;
me.moveto(room, null, "<mag>" + me.name + "的尸体发出阵阵光芒。</mag>");
}, 5000);
} else {
var area = me.environment.parent;
var area_name = null;
if (area) area_name = area.name;
if (me.environment.on_relive && me.environment.on_relive(me, false) === false) {
return;
}
var recover_room = me.environment.query_recover_room();
var is_fb = me.environment.is_fb();
if (is_fb) {
me.environment.clear_copy(me);
}
// if(me.query_temp('ns_bt')){
// let npc=me.environment.find_obj_bypath('pub/nianshou');
// if(npc){
// npc.destroy();
// //me.remove_temp('ns_bt');
// }
// }
me.environment.item_changed(me, false);
var room = ROOM.Get(recover_room);
me.hp = 1;
me.clear_status();
room.do_enter(me, true, "<wht>你忽然发现前面多了一个人影,不过那人影又好像已经在那里很久了,只是你一直没发觉。</wht>");
area.on_leaved(me);
if (isqmhd && ismaxcount) {
WORLD.DATA.set_temp("new_die", me.id, 600000);
WORLD.DATA.set_temp("new_die_type", 2, 600000);
//me.add_temp('die2', 1, 3600000 * 28);
}
if (area_name && is_fb) {
me.notify("你的副本" + area_name + "失败了。");
}
me.notify('{type:"die",relive:true}');
if (me.force_skill.on_relive) {
me.force_skill.on_relive(me);
}
if ((!me.team || me.team[0] === me) && me.query_temp('fbbs', 0) === 1) {
me.remove_temp('fbbs');
}
}
}

24
world/cmd/battle/spfm.js Normal file
View File

@@ -0,0 +1,24 @@
this.inherits(COMMAND);
this.command = "spfm";
this.allow_die = true;
this.allow_faint = true;
this.allow_state = true;
this.allow_busy = true;
this.regex = /(\w+)(?:\s+(\w+))?/;
this.enter = function (me, arg1, arg2) {
if (!arg1) return;
let func = this['set_' + arg1];
if (func) {
func.call(this, me, arg2);
}
}
this.set_qkyz = function (me, arg) {
if (!arg || (!(arg > 0))) {
me.remove_temp('qkyz_m');
return me.send('<cyn>你将乾坤一掷更改为使用内力,不消耗铜板。</cyn>');
}
if (arg > 100000) arg = 100000;
me.set_temp('qkyz_m', arg);
me.send('<cyn>你的乾坤一掷每次使用将消耗' + arg + '个铜板。</cyn>');
}

52
world/cmd/channel/chat.js Normal file
View File

@@ -0,0 +1,52 @@
this.inherits(COMMAND);
this.command = "chat";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, str) {
if (!str) return;
if (me.master) return;
if (str.length > 200) return me.notify("你说的太多了。");
if (me.query_temp("no_chat")) {
if (me.temp.no_chat.e) {
let time = new Date(me.temp.no_chat.e);
return me.notify("你已经被禁言,持续到" + time.getFullYear()
+ "年" + (time.getMonth() + 1) + "月" +
time.getDate() + "日" + time.getHours() + "时" + time.getMinutes() + "分。");
}
return me.notify("你已经被禁言。");
}
if (me.query_temp("chat")) return me.notify("你说话速度太快了。");
if (me.query_setting("off_chat")) return me.notify("你目前禁止公共频道中。");
//if (me.query_temp("new")) return me.notify("新手训练完成前不能在世界频道发言。");
if (me.exp < 100000) return me.notify("新注册账号不能在世界频道发言");
if (!me.name) {
// WORLD.log(null, me.ip_address || me.userid || "chat", str);
return;
}
var msg = "", name = me.name;
if (str[0] == "*") {
str = str.substr(1);
msg = WORLD.COMMANDS["emote"].enter(me, str);
if (!msg) {
msg = UTIL.htmlEncode(str);
msg = UTIL.replace_word(str);
}
else name = "";
} else {
msg = UTIL.htmlEncode(UTIL.replace_word(str));
}
let content = { type: "msg", ch: "chat", content: msg, uid: me.id, lv: (me.level || 0), name: name };
if (me.level === 6) {
let lv6 = me.query_temp('lv6');
if (lv6) content.lv6 = lv6;
}
msg = JSON.stringify(content);
for (var i = 0; i < WORLD.USERS.length; i++) {
if (!WORLD.USERS[i].query_setting("off_chat"))
WORLD.USERS[i].send(msg);
}
me.set_temp('chat', 1, 3000);
//me.add_temp('chat2', 1, UTIL.diff_time());
}

220
world/cmd/channel/emote.js Normal file
View File

@@ -0,0 +1,220 @@
this.inherits(COMMAND);
this.command = "emote";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
const WT_REG = /\s+/;
this.enter = function (me, str) {
if (!str) return me.send(this.emote_data());
let paras = str.split(WT_REG);
let target = null, emts = null;
if (paras.length > 1) {
emts = emote[paras[0]];
target = WORLD.find_user(paras[1]);
} else {
emts = emote[str];
}
if (!emts) return;
var emt = target ? emts[1] : emts[0];
var msg = splitmessage(me, emt, 3, target);
return msg;
}
function splitmessage(me, text, type, target) {
if (text.length < 3) return text;
var str = [];
var start = 0;
for (var i = 0; i < text.length; i++) {
if (text[i] == "$") {
start < i && str.push(text.substring(start, i));
var ch = text[++i];
start = i + 1;
//type 1本人视角 2目标视角 3第三人称视角
switch (ch) {
case "N"://本人
str.push(type == 1 ? "你" : me.name);
break;
case "n"://目标
str.push(type == 2 ? "你" : target.name);
break;
case "P":
str.push(type == 1 ? "你" : me.call3());
break;
case "p":
str.push(type == 2 ? "你" : target.call3());
break;
case "c":
str.push(target.call());
break;
case "C":
str.push(me.callme());
break;
case "r":
str.push(target.call(true));
break;
case "R":
str.push(me.callme(me));
break;
case "l":
str.push(target.call());
break;
case "W":
case "w":
str.push(me.weapon_name() || "手");
break;
case "i":
str.push(target.weapon_name() || "手");
break;
}
}
}
start < i && str.push(text.substring(start, i));
return str.join("");
}
this.emote_data = function (me) {
if (this.json) return this.json;
var str = ["{type:'emote',items:["];
for (var key in emote) {
if (str.length > 1) str.push(",");
str.push("\"");
str.push(key);
str.push("\"");
}
str.push("]}");
this.json = str.join("");
return this.json;
}
var emote = {
哈欠: ["$N打了个哈欠觉得无聊极了。", "$N白了$n一眼$n无聊不无聊啊 ?", "$N打了个哈欠觉得自己真是无聊透顶。"],
睡着: ["$N睡着了呼噜打得震天响。", "$N睡梦中幸福地笑着口水流了一枕头。", "$N在$n的身边睡着了呼噜打得震天响。"],
后会有期: ["$N抱拳道青山不改绿水常流咱们后会有期", "$N对$n抱拳道青山不改绿水常流咱们后会有期"],
加油: ["$N使劲地用手拨拉着一大堆泥巴一边吆喝着一二三加油干六七八挖泥巴", "$N冲着$n大喊$c加油加油"],
清醒: ["$N揉揉眼睛清醒了过来。", "$N摇著$n试著把$n叫醒。大声在$n耳边大叫「 猪! 起来了! 」"],
无辜: ["$N无辜的流下泪来!", "$N满脸委屈地对$n说到:$c,你可别冤枉好人呀!"],
傻笑: ["$N发出一阵傻笑。 ", "$N对着$n一阵傻笑。"],
去死: ["$N披发仗剑念起天魔大咒四周荒野间顿时鬼哭狼嚎天空上传来阵阵狞笑声你们都给我死吧", "$N高举双手大喝去死吧 从天上降下一道闪电将$n化作一堆灰烬。"],
耳光: ["$N的手好象蠢蠢欲动。", "$N打了$n一记响亮的耳光。 "],
做菜: ["$N撸起袖子准备做菜。", "$N把$n做成的肉块放进锅里用薄油炒了炒再盛到沙锅里用大汤文火炖烂。"],
: ["$P哼了一声。", "$N看都不看$n一眼 哼了一声,高高的把头扬起来了.......不理$N...."],
姐姐: ["$N作了一个揖说道”各位姐妹们大家好", "$N满脸严肃的对$n敬个礼“姐姐好"],
: ["$N高兴地跳了起来。", "$N扑进了$n怀里撒起了娇。"],
惊讶: ["$N惊讶地吐出了舌头.", "$N对$N惊讶地吐出了舌头."],
: ["$P把手放在自己的□□□□□□□□", "$N紧紧靠在$n的怀里口中轻声叫道“$n$c”鼻翼歙动面赛桃花羞答答地抚摸$n坚实的肌肤。"],
好样的: ["$N竖起了右手大拇指。", "$N对着$n竖起了右手大拇指好样的。"],
诗1: ["$N拔剑对着自己长吟道“十年磨一剑霜寒未曾试。今日把问君谁有不平事", "$N拔剑指着$n长吟道“十年磨一剑霜寒未曾试。今日把问君谁有不平事"],
: ["$N高声大喊“狼来了狼来了大家快逃", "$N恶狠狠地对着$n说“这年头谁知道坐在电脑后面的你是不是一头狼"],
色迷迷: ["$N陶醉地低声唱道“一呀摸摸到妹妹的头发边……", "$N色迷迷地盯着$n陶醉地低声唱道“一呀摸摸到$n$c的头发边……"],
美味: ["$N拼命在啃他自己的脚趾头似乎觉得其味无穷", "$N盯着$n上上下下地看一边咕噜噜地使劲咽着唾沫。"],
无耻: ["$N自豪地宣布“武林中我最无耻你们能把我怎么样", "$N对$n说道“你这个人怎么脸皮比城墙拐弯儿还厚"],
好香: ["$N皱了皱眉似乎嗅到什麽东西烧糊了。", "$N仰起脸伸长鼻子对着空气猛嗅了几下对着$n大声赞道\"好香,好香!\""],
害羞: ["一朵红云飞上了$N的面颊。", "$N刮着$n的鼻子说“不羞不羞。。。"],
扎针: ["$N掏出一根闪闪亮的小针, 眯着眼睛, 看了看, 满意的点点头.", "$N掏出一根闪闪亮的小针, 猛地往$n的屁股扎下去.....哇!!疼啊!!"],
同意: ["$N说你们大家都对行了吧", "$N完全同意$n的观点。"],
嘿嘿: ["$N嘿嘿的奸笑了几声, 看来又想到了什么歪处。", "$N嘿嘿的对着$n奸笑了几声。"],
求帮: ["$N泪流满面地说各位大佬帮帮我吧", "$N泪流满面地对$n说$c帮帮我吧。"],
咯咯: ["$N「咯。。。咯。。。咯。。。」地笑个不停。", "$N对着$n「咯咯咯」地笑了几声。"],
流氓: ["$N嘴角一撇狞笑道“我是流氓我怕谁”", "$N对着$n大叫“$n你这个臭流氓”"],
造谣: ["$N狞笑着说:我这个人从不信谣,传谣,.........我只造谣!!", "$N急得满脸通红对$n说你...你可别造谣!"],
打劫: ["$N拿着把锋利的钢刀架在自己脖子上喊道你们给不给钱 不给我就自杀了!", "$N一刀砍去把$n的...钱袋挥作两半!"],
好汉: ["$N声嘶力竭地大声叫道砍头不过头点地老子十八年後又是一条好汉", "$N对$n大声叫道怕什麽怕掉个脑袋不过碗大的疤你小子有胆就跟他拼一场"],
什么: ["$N脸上露出迷惑的表情。", "$N似乎不懂$n是什么意思。"],
拜访: ["$N郎声说道拜山拜水拜码头$C初到宝地还请各位老大们多多关照", "$N对$n说道$c在上$C初到码头人生地不熟万事请多关照"],
吹牛: ["$N把胸脯拍得噼啪响“武林中拳头大的说话有种的上来$s比划比划", "$N把胸脯拍得噼啪响对$n咆哮“武林中拳头大的说话$r你有种上来跟$R比划比划"],
哥哥: ["$N弯弯腰道了个万福“各位大哥$C有礼了", "$N甜甜地跟$n打招呼“$n哥哥好呀"],
失恋: ["$N向天长叹了一口气, 留下泪来。", "$N含着泪水对$n说到:随你好了,只要你幸福就好,你走吧。"],
佩服: ["$N抱拳团团一拜讨好地说道$C对各位的景仰之情有如滔滔江水连绵不绝。", "$N双手抱拳讨好地对$n说道“$C对$c的景仰之情有如滔滔江水连绵不绝。"],
阴笑: ["$N邪恶地发出一阵阴笑声。", "$N对着$n发出一阵阴笑声。"],
鞠躬: ["$N恭恭敬敬地向墓碑鞠了一躬浩然长叹“前辈神技令人难以想象。”", "$N恭恭敬敬地向$n的墓碑鞠了一躬浩然长叹“前辈神技令人难以想象。"],
等着: ["$N一脸气极败坏恶狠狠地说道这事没这麽容易了结你们都给我走着瞧", "$N对$n抱拳说道$R武功惊人$S极是拜服十年之後再来领教"],
: ["$N觉得自己真是酷毙了", "$N对$n大叫道「哇噻你简直酷毙了!」。"],
冷笑: ["$N「哼」地冷笑一声。", "$N对着$n「哼」地冷笑一声。"],
闷棍: ["$N晃动着手中的木棒到处寻找目标。", "$N手舞木棒对准$n的后脑一记闷棍$n哼也没哼一声软软的摔倒在地。"],
微笑: ["$N愉快地微笑着。", "$N朝$n愉快地微笑着。"],
鼓掌: ["$N「啪啪啪」鼓起掌来。", "$N对着$n鼓起掌来干得好。"],
无奈: ["$N无奈地耸了耸肩。", "$N对着$n无奈地耸了耸肩。"],
答应: ["$N歪头想了会说道好吧", "$N对$n痛快地说道好吧"],
委屈: ["$N满脸委曲地嚷到不是我干的", "$N满脸委曲地嚷到$n你可别冤枉好人"],
感动: ["$N感动极了两行热泪夺眶而出。", "$N冲上前去激动地紧紧握住$n的双手哽咽着说不出话来。"],
脸红: ["$N的脸「唰」的一下红了起来。", "$N看着$n脸「唰」的一下红了起来。"],
装逼: ["$N仰首面对苍天狂笑不已长叹道难道这天底下竟然没有人是我的对手", "$N剑眉一轩冷冷的瞥了$n一眼背转身淡淡说道不是我的对手。"],
点头: ["$N点了点头。", "$N对着$n点了点头。"],
装死: ["$N两眼翻白腿儿蹬了几下脑袋一歪断气了。", "$N很利索地把$n的肚子剖了开来塞进稻草只一会就作成了一具好看的木乃伊。"],
考虑: ["$N开始认真考虑这个问题。", "$N开始考虑是否要杀了$n。"],
脑崩儿: ["$N用手指弹了一下自己的脑门儿。", "$N在$n的头上弹了个清脆的脑崩儿$n的脑门儿上立刻长出了个小臌包。"],
眨眼: ["$N眨了眨迷人的眼睛!", "$N对$n眨了眨眼, 眼神中充满诱惑, 似乎................"],
对视: ["$N遥望着在场的众人微微一笑。一双妙目间情意流动顾盼生姿。", "$N拉着$n的手温柔地默默对视。目光中孕含着千种柔情万般蜜意。"],
吃醋: ["$N含情脉脉的看着世界上的女孩们觉得三妻四妾真好!", "$N对$n骂道你这黄脸婆我和女孩说句话都不行醋缸一个!"],
拍头: ["$N拍了拍自己的头。", "$N轻轻地拍了拍$n的头。"],
怀疑: ["$N想啊想结果把脑袋给想破了白白的脑浆流了一地。", "$N歪着脑袋似乎很不明白为什麽$n死的时候白白的肚皮朝着天。"],
挥砍: ["$N舞了个刀花。", "$N怒火中烧一刀把$n劈成两半!"],
大笑: ["$N捧住肚子嘻嘻哈哈地直笑得两眼翻白喘不过气来。", "$N张大眼奇怪地瞪着$n慢慢地咧开嘴捧腹大笑起来。"],
作揖: ["$N躬身作了个揖。", "$N对着$n躬身作了个揖。"],
西瓜: ["$N的脑袋长的跟西瓜似的, 别惊讶, 这是事实.", "$N认真的告诉$n, 你的脑袋长的跟西瓜似的, 别生气, 这是事实."],
过奖: ["$N拱了拱手道过奖过奖!", "$N哈哈大笑对着$n拱了拱手道$c过奖了!"],
生气: ["$N很生气地撅了撅嘴。", "$N很生气地看着$n。"],
哭哭啼啼: ["$N不停地哭哭啼啼....", "$N靠在$n的肩上不停地哭哭啼啼."],
安慰: ["$N怀着满腔热情寻思道我该去安慰谁呢", "$N安慰$n别难过了。"],
疯子: ["$N看看这个又看看那个疯了都疯了整个世界都疯了。", "$N看着疯疯癫癫的$n叹了口气真可怜..."],
感谢: ["$N对所有在场的人表示感谢。", "$N对$n表示衷心的感谢。"],
生气: ["$N自己一个人在生闷气谁也别理他啊惹不起!", "$N哄着$n说别生气了就算我不对吧笑一笑好吗求你啦还不行。。?"],
吹牛: ["$N拍着胸脯打包票放心天塌下来有我顶着你们都不用怕", "$N对著$n把胸脯拍得震天响放心天塌下来有我顶着你不用怕"],
巴掌: ["$N使劲地拍自己的屁股。", "$N抓住$n照着屁股来了一巴掌?"],
去死: ["$N想去死了算了。", "$N真希望看到$n去死。"],
大喊: ["$N咬牙切齿地对着天空大叫“贼老天”", "$N瞪大眼对着$n大声喊道左右是个死$R跟你拼了"],
: ["$N舔了舔自己嘴边的「哈喇滋」。", "$N舔了舔$n。"],
: ["$N无聊的用手指到处乱捅!似乎想找个人陪陪!", "$N无聊的用手指捅了捅$n, 可是$n象根木头一样, 什么反应也没有。"],
: ["$N嘟起嘴“卟”地一声吻了吻空气。", "$N轻轻地捧起$n的脸给了$n一个无限温柔的吻。"],
: ["$N轻轻地抱住梦中的情人。", "$N深情的把$n轻轻地搂在怀里。"],
逃跑: ["$N一看形势不对脚底抹油一声不吭地溜了。", "$N一边跑一边对着$n大声喊道$c风紧扯乎!"],
口水: ["$N不知道想到什么诱人的东西口水都流出来了。", "$N对$n垂涎三尺不知道下一步会有何举动了。"],
万福: ["$N给大家盈盈的福了一福。", "$N对$n福了一福, 说道:小女子这厢有礼了."],
不行: ["$N板着脸咬着牙说打死我也不干", "$N对$n斩钉截铁地说不行不行就是不行 哇...."],
: ["$N拍了拍手问道谁能挡住我的拳头", "$N一把揪住$n的脖子抡了几圈狠狠的把$n拍在了地上"],
咆哮: ["$N勃然大怒一下撕开了衣服露出了累累伤疤, 咆哮道:我征战沙场这么多年,难道还怕了你们不成?", "$N勃然大怒撕开衣服露出了累累伤疤, 朝$n咆哮道我征战沙场这么多年还怕了你不成 ?"],
群殴: ["$N声嘶力竭地叫道“大伙并肩子上啊”。", "$N声嘶力竭地叫道“对$n这样的$r还讲什么江湖道义大伙并肩子上啊”。"],
昏迷: ["$N口吐白沫昏了过去。", "$N眼前一黑昏倒在$n的怀里。"],
抱歉: ["$N对所有在场的人表示歉意。", "$N痛哭流涕的哀求$n的原谅。"],
乖宝宝: ["$N对大家说“叔叔阿姨们我给大家唱支《我是一个乖宝宝》好不好”", "$N拍了拍$n的头“好孩子听话乖。”"],
: ["$N磨了磨牙。", "$N真想狠狠地咬$n一口。"],
: ["$N飞起一脚似乎在踢苍蝇。", "$N飞起一脚正好踢中$n的屁股"],
不知道: ["$N摇了摇头不知道。", "$N对着$n说对不起我不知道。"],
哈哈: ["$N「哈哈哈」大笑几声。", "$N对着$n「哈哈哈」大笑几声。"],
呆子: ["$N对着镜子照了照觉得自己象个呆子。", "$N含羞地瞪了$n一眼娇嗔道有什么好看的大呆子!"],
可怜: ["$N叹道好可怜呀", "$N怜惜的对$n说好可怜的孩子$n的眼圈马上就红了起来。"],
握手: ["$N的左手跟右手握了握怎么不对劲", "$N跟$n握了握手。"],
: ["$N的手高高举起不知道要敲什麽东西。", "$N狠狠地敲著$n的脑袋$n被敲得脑袋大了三圈满头大包。"],
嫁人: ["$N把几百两黄金一摆叉着腰说谁娶了本姑娘这钱就是他的了", "$N把几百两黄金一摆叉着腰对$n说你嫁不嫁"],
难过: ["$N露出一丝难过的表情。", "$N看着$n难过的要哭了。"],
思考: ["$N背着双手踱来踱去似乎在想什麽坏念头。", "$N看着$n踱来踱去摇摇头叹口气又摇了摇头。"],
开房: ["$N一个人坐在房间里百无聊赖希望谁来陪陪。。。。", "$N搂着$n的纤腰亲热地说咱俩开房去"],
皱眉: ["$N皱了皱眉似乎想说什么。", "$N皱了皱眉似乎想对$n说些什么。"],
知道了: ["$N使劲拍了一下脑袋我知道了", "$N使劲拍了一下脑袋对$n说我知道了"],
哈欠: ["$N困得眼睛都睁不开了迷迷糊糊地打了个哈欠。", "$N对着$n打了个哈欠熏得$n昏昏欲睡。"],
得意: ["$N得意地打了个响指哈哈", "$N冲着$n伸出了两个手指做了个“V”大声叫道“YEAH”"],
诱惑: ["$N满脸的媚态作出一副迷人的姿态诱惑所有在场的人。", "$N满脸的媚态作出一副迷人的姿态诱惑$n。"],
嘻嘻: ["$N嘻嘻的笑了几声。", "$N笑嘻嘻的看着$n。"],
不要: ["$N惊叫不要不要", "$N对$n惊叫不要不要啊"],
害怕: ["$N面露怯色好像害怕什么。", "$N被$n吓得脸都白了。"],
擦汗: ["$N喘了口气擦了擦额头上的汗水。", "$N替$n擦了擦额头上的汗水。"],
失望: ["$N失望极了。", "$N对$n失望极了$n没救了。"],
呕吐: ["$N突然「稀哩哗啦」呕出了一大堆东西。", "$N「稀哩哗啦」吐了$n一身。"],
摇头: ["$N把头摇得跟拨浪鼓似的。", "$N对着$n摇了摇头。"],
打招呼: ["$N双手抱拳作了个揖道各位英雄请了", "$N双手抱拳对$n作了个揖道这位$c请了"],
挥手: ["$N挥了挥手。", "$N对着$n挥了挥手。"],
喊人: ["$N跳起来拼命地招动双手也不知道是在叫谁。", "$N伸出食指往里勾了勾$n$r过来"],
: ["$N伸出指头把大家挨个点了一遍", "$N指着$n。"],
恭喜: ["$N双手抱拳, 说到:恭喜恭喜!!", "$N对$n笑嘻嘻的说道:恭喜恭喜!!"],
欣慰: ["$N看到这种情景心中觉得欣慰极了。", "$N对$n说你能这样想我也就好欣慰了。"],
: ["$N肚子饿得咕咕叫眼睛在到处找有什么吃的。", "$N看着$n喉咙里“咕噜”的响了一下眼中冒出火来"],
举手: ["$N拼命地伸长自己的手臂高声叫道", "$N拼命地伸长自己的手臂对$n高声叫道"],
赞扬: ["$N伸出指头把大家挨个点了一遍“高手都是高手”", "$N指着$n赞叹道$n是武林第一高手"],
痴呆: ["$N看起来一脸痴呆的样子。", "$N毫不留情地耻笑$n的愚昧."],
大哭: ["$N嚎啕大哭起来。", "$N越想越伤心终于忍不住趴在$n的肩膀上放声大哭起来。"],
呵呵: ["$N「呵呵」傻笑了几声", "$N对着$n「呵呵」傻笑了几声。"],
惊讶: ["$N惊讶地张着嘴巴半天也说不出一句话来。", "$N对着$n惊讶地「啊」了一声。"],
叹气: ["$N深深地叹了口气。", "$N看着$n深深地叹了口气。"]
};

39
world/cmd/channel/es.js Normal file
View File

@@ -0,0 +1,39 @@
this.inherits(COMMAND);
this.command = "es";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, str) {
if (!str) return;
if (me.master) return;
if (str.length > 200) return me.notify("你说的太多了。");
if (!me.level) return me.notify("你无法发送全区消息");
if (me.query_temp("no_chat")) return me.notify("你目前被禁言中。");
if (me.query_temp("chat")) return me.notify("你说话速度太快了。");
if (me.query_setting("off_es")) return me.notify("你目前禁止全区频道中。");
var msg = "", name = me.name;
if (str[0] == "*") {
str = str.substr(1);
msg = WORLD.COMMANDS["emote"].enter(me, str);
if (!msg) {
msg = UTIL.htmlEncode(str);
msg = UTIL.replace_word(str);
}
else name = "";
} else {
msg = UTIL.htmlEncode(UTIL.replace_word(str));
}
msg = JSON.stringify({ type: "msg", ch: "es", content: msg, uid: me.id, lv: (me.level || 0), name: name, server: WORLD.SERVER.name });
for (var i = 0; i < WORLD.USERS.length; i++) {
if (!WORLD.USERS[i].query_setting("off_es"))
WORLD.USERS[i].send(msg);
}
WORLD.sendAllServer(msg);
me.set_temp('chat', 1, 5000);
me.add_temp('chat2', 1, UTIL.diff_time());
}

35
world/cmd/channel/fam.js Normal file
View File

@@ -0,0 +1,35 @@
this.inherits(COMMAND);
this.command = "fam";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, str) {
if (!str) return;
if (str.length > 200) return me.notify("你说的太多了。");
if (me.query_temp("no_chat")) return me.notify("你目前被禁言中。");
if (me.query_setting("off_fam")) return me.notify("你目前禁止门派频道中。");
if (me.query_temp("chat")) return me.notify("你说话速度太快了。");
var msg = "";
var name = me.name;
if (str[0] == "*") {
str = str.substr(1);
msg = WORLD.COMMANDS["emote"].enter(me, str);
if (!msg) {
msg = UTIL.htmlEncode(str);
msg = UTIL.replace_word(str);
} else {
name = "";
}
} else {
msg = UTIL.htmlEncode(UTIL.replace_word(str));
}
msg = JSON.stringify({ type: "msg", ch: "fam", content: msg, uid: me.id, name: name, fam: me.family.name })
for (var i = 0; i < WORLD.USERS.length; i++) {
if (WORLD.USERS[i].family == me.family && !WORLD.USERS[i].query_setting("off_fam"))
WORLD.USERS[i].send(msg);
}
me.set_temp('chat', 1, 5000);
me.add_temp('chat2', 1, UTIL.diff_time());
}

421
world/cmd/channel/filter.js Normal file
View File

@@ -0,0 +1,421 @@
this.inherits(COMMAND);
this.command = "filter";
this.enter = function (me, str) {
}
UTIL.check_word = function (str) {
for (var i = 0; i < UTIL.workds_regex.length; i++) {
if (UTIL.workds_regex[i].test(str)) {
return false;
}
}
return true;
}
UTIL.replace_word = function (str) {
for (var i = 0; i < UTIL.workds_regex.length; i++) {
str = str.replace(UTIL.workds_regex[i], "*");
}
return str;
}
UTIL.add_world = function (str) {
UTIL.workds_regex.push(new RegExp(str));
}
var workds = [
'爱液',
'按摩棒',
'爆草',
'暴干',
'暴奸',
'暴淫',
'奸',
'屄',
"奸杀",
"足交",
'被操',
'被插',
'逼奸',
'插暴',
'操逼',
'操黑',
'操烂',
'肏你',
'肏死',
'操死',
'操我',
'厕奴',
'插比',
'插b',
'插逼',
'插我',
'插阴',
'潮吹',
'潮喷',
'吃精',
'抽插',
'荡妇',
'荡女',
'盗撮',
'多人轮',
'放尿',
'肥逼',
'粉穴',
'干死你',
'干穴',
'肛交',
'肛门',
'龟头',
'豪乳',
'黑逼',
'后庭',
'后穴',
'换妻',
'黄片',
'鸡吧',
'鸡巴',
'鸡奸',
'妓女',
'淫',
'奸情',
'叫床',
'精液',
'就去日',
'巨屌',
'菊花洞',
'菊门',
'巨奶',
'巨乳',
'菊穴',
'开苞',
'口爆',
'口活',
'口交',
'口射',
'口淫',
'狂操',
'狂插',
'浪逼',
'浪妇',
'浪叫',
'浪女',
'狼友',
'流淫',
'凌辱',
'漏乳',
'露b',
'乱交',
'乱伦',
'轮暴',
'轮操',
'轮奸',
'裸陪',
'买春',
'美逼',
'美穴',
'美幼',
'迷奸',
'密穴',
'蜜穴',
'摸奶',
'母奸',
'奶子',
'内射',
'嫩逼',
'嫩穴',
'喷精',
'屁眼',
'品香堂',
'强暴',
'强奸',
'情色',
'全裸',
'群交',
'人妻',
'人兽',
'日逼',
'日烂',
'肉棒',
'肉逼',
'肉唇',
'肉洞',
'肉缝',
'肉棍',
'肉茎',
'肉具',
'肉穴',
'肉欲',
'乳房',
'乳沟',
'乳交',
'乳头',
'骚逼',
'骚比',
'骚女',
'骚水',
'骚穴',
'色逼',
'色情',
'射爽',
'射颜',
'食精',
'兽奸',
'兽交',
'手淫',
'熟母',
'熟女',
'死逼',
'体奸',
'舔阴',
'吸精',
'相奸',
'小逼',
'校鸡',
'小穴',
'性交',
'性奴',
'性虐',
'穴口',
'颜射',
'阳具',
'阴部',
'淫虫',
'阴唇',
'阴道',
'淫电',
'淫妇',
'阴核',
'阴户',
'淫贱',
'淫叫',
'阴茎',
'阴精',
'淫浪',
'淫媚',
'淫糜',
'淫魔',
'淫母',
'淫女',
'淫虐',
'淫妻',
'淫情',
'淫色',
'淫书',
'淫水',
'淫娃',
'淫威',
'淫液',
'淫照',
'幼交',
'幼男',
'幼女',
'玉穴',
'招鸡',
'招妓',
'自慰',
'作爱',
'fuck',
'gay片',
'g点',
'g片',
'傻逼',
'傻b',
'煞逼',
'傻比',
'欠干',
'婊子养的',
'我日你',
'我操',
'我草',
'爆你菊',
'艹你',
'cao你',
'草你吗',
'草你丫',
'操你妈',
'擦你妈',
'操你娘',
'操他妈',
'日你妈',
'干你妈',
'干你娘',
'娘西皮',
'狗操',
'狗草',
'狗杂种',
'狗日的',
'操你祖宗',
'操你全家',
'操你大爷',
'妈逼',
'你麻痹',
'麻痹的',
'妈了个逼',
'狗娘养',
'贱比',
'贱b',
'下贱',
'死全家',
'全家死光',
'全家死绝',
'婊子',
'贱货',
'射精',
'诱奸',
'强奸',
'做爱',
'性爱',
'少妇',
'屌',
'干你',
'我干',
'乱奸',
'乱伦',
'裸聊',
'裸照',
'迷幻药',
'迷幻藥',
'迷昏口',
'迷昏药',
'迷昏藥',
'迷魂香',
'迷魂药',
'迷魂藥',
'迷奸粉',
'迷奸药',
'迷情粉',
'迷情水',
'迷情药',
'迷药',
'迷藥',
'谜奸药',
'骚妇',
'骚货',
'骚浪',
'骚女',
'骚嘴',
'色情',
'性伴侣',
'性服务',
'性交',
'性奴',
'性虐',
'阴唇',
'阴道',
'阴蒂',
'阴户',
'阴茎',
'阴毛',
'陰唇',
'陰道',
'陰戶',
'淫乱',
'淫靡',
'淫魔',
'淫女',
'淫肉',
'淫騷',
'淫兽',
'淫水',
'淫穴',
'摇头丸',
'迷药',
'乖乖粉',
'麻醉药',
"周恩来",
'共产党',
'胡锦涛',
'江泽民',
'江主席',
'李鹏',
'罗干',
'温家宝',
'中共',
'朱镕基',
'特供',
'政治',
'胡平',
'苏晓康',
'贺卫方',
'谭作人',
'焦国标',
'万润南',
'张志新',
'辛灝年',
'高勤荣',
'王炳章',
'高智晟',
'司马璐',
'刘晓竹',
'刘宾雁',
'魏京生',
'林昭',
'毒品',
'反共',
'暴动',
'灭共',
"蒋介石",
'八九',
'六四',
'8964',
'198964',
'学潮',
'血洗',
'王丹',
'柴玲',
'沈彤',
'封从德',
'王超华',
'王维林',
'吾尔开希',
'吾尔开西',
'侯德健',
'阎明复',
'方励之',
'蒋捷连',
'丁子霖',
'辛灏年',
'蒋彦永',
'严家其',
'陈一咨',
'何清涟',
'汪兆钧',
'人肉',
'台湾独立',
'日本万岁',
'江绵恒',
'江宰民',
'江贼',
'江贼民',
'江主席',
'法轮',
'邓小平',
'催眠',
'催情',
'华国锋',
'李鹏',
'男妓',
'男奴',
'嫩阴',
'嫖妓',
'情视频',
"毛主席",
'群奸',
'乳交',
'幼齿',
'习近平', '毛泽东'];
UTIL.workds_regex = [];
for (var i = 0; i < workds.length; i++) {
workds[i] = new RegExp(workds[i]);
}
UTIL.workds_regex = workds;

39
world/cmd/channel/pty.js Normal file
View File

@@ -0,0 +1,39 @@
this.inherits(COMMAND);
this.command = "pty";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, str) {
if (!str) return;
if (str.length > 200) return me.notify("你说的太多了。");
if (me.query_temp("no_chat")) return me.notify("你目前被禁言中。");
if (me.query_setting("off_pty")) return me.notify("你目前禁止帮派频道中。");
if (me.query_temp("chat")) return me.notify("你说话速度太快了。");
if (!me.query_temp("pt")) return me.notify("你还没加入过帮派。");
var pt = WORLD.DATA.parties.get(me.query_temp("pt"));
if (!pt) me.notify("没有这个帮派。");
var msg = "", name = me.name;
if (str[0] == "*") {
str = str.substr(1);
msg = WORLD.COMMANDS["emote"].enter(me, str);
if (!msg) {
msg = UTIL.htmlEncode(str);
msg = UTIL.replace_word(str);
}
else name = "";
} else {
msg = UTIL.htmlEncode(UTIL.replace_word(str));
}
msg = JSON.stringify({ type: "msg", ch: "pty", content: msg, uid: me.id, name: name })
for (var i = 0; i < pt.roles.length; i++) {
var user = pt.roles[i].user;
if (user && !user.query_setting("off_pty")) {
user.send(msg);
}
}
me.set_temp('chat', 1, 5000);
me.add_temp('chat2', 1, UTIL.diff_time());
}

View File

@@ -0,0 +1,14 @@
this.inherits(COMMAND);
this.command = "rumor";
this.allow_busy = true;
this.allow_state = true;
this.enter = function (me, msg) {
if (me) return;
//if (!msg) {
// return;
//}
//msg = UTIL.htmlEncode(msg);
var msg = JSON.stringify({ type: "msg", ch: "rumor", content: msg});
WORLD.sendAll(msg);
}

19
world/cmd/channel/say.js Normal file
View File

@@ -0,0 +1,19 @@
this.inherits(COMMAND);
this.command = "say";
this.allow_busy = true;
this.allow_state = true;
this.enter = function (me, msg) {
if (!msg) {
return me.send_room("$N在自言自语的说些什么。");
}
if (me.query_temp("no_chat")) return me.notify("你目前被禁言中。");
if (msg.length > 200) return me.notify("你说的太多了。");
if (msg[0] == "/") {
if (me.query_temp("admin") || me.query_temp("wiz"))
return me.command(msg.substr(1));
}
msg = UTIL.htmlEncode(UTIL.replace_word(msg));
me.add_temp('chat2', 1, UTIL.diff_time());
return me.send_room("$N说" + UTIL.htmlEncode(msg));
}

16
world/cmd/channel/sys.js Normal file
View File

@@ -0,0 +1,16 @@
this.inherits(COMMAND);
this.command = "sys";
this.allow_busy = true;
this.allow_state = true;
this.enter = function (me, msg) {
if (me) return;
//if (!msg) {
// return;
//}
//msg = UTIL.htmlEncode(msg);
var msg = JSON.stringify({ type: "msg", ch: "sys", content: msg });
WORLD.sendAll(msg);
}

View File

@@ -0,0 +1,9 @@
this.inherits(COMMAND);
this.command = "tell";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.regex = /^(\w+)\s(.+)$/;
this.enter = function (me, target, cont) {
}

22
world/cmd/channel/tm.js Normal file
View File

@@ -0,0 +1,22 @@
this.inherits(COMMAND);
this.command = "tm";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, str) {
if (!str) return;
if (me.query_temp("no_chat")) return me.notify("你目前被禁言中。");
if (str.length > 200) return me.notify("你说的太多了。");
var msg = "";
if (str[0] == "*") {
str = str.substr(1);
msg = WORLD.COMMANDS["emote"].enter(me, str);
if (msg) {
return me.send_team(JSON.stringify({ type: "msg", ch: "tm", content: msg, uid: me.id }));
}
}
msg = UTIL.htmlEncode(UTIL.replace_word(str));
me.send_team(JSON.stringify({ type: "msg", ch: "tm", content: msg, uid: me.id, name: me.name }));
me.add_temp('chat2', 1, UTIL.diff_time());
}

View File

@@ -0,0 +1,6 @@
this.inherits(COMMAND);
this.command = "clearwait";
this.enter = function (player, arg, par) {
player.wait_input = null;
}

View File

@@ -0,0 +1,98 @@
this.inherits(COMMAND);
this.command = "createrole";
var name_reg = /^[\u4E00-\u9FA5]{2,5}$/;
var id_reg = /^[a-z][a-z0-9]{2,9}$/;
this.allow_login = true;
this.enter = function (me, pars) {
if (me.id) return me.send('{"type":"regist","result":"请刷新页面重新操作"}');
pars = pars.split(' ');
var name = pars[0], gender = parseInt(pars[1]),
str = parseInt(pars[2]), con = parseInt(pars[3]), dex = parseInt(pars[4]), int = parseInt(pars[5]);
if (gender != 1 && gender != 2) {
return me.send('{"type":"regist","result":"注册信息错误"}');
}
if (!name_reg.test(name)) {
return me.send('{"type":"regist","result":"姓名需要是2-5个汉字"}');
}
if (!UTIL.check_word(name)) {
return me.send('{"type":"regist","result":"你不能用这个名字"}');
}
if (WORLD.find_user(name)) {
return me.send('{"type":"regist","result":"这个名字已经有人用了"}');
}
if (str < 15 || str > 30) {
return me.send('{"type":"regist","result":"力量属性需要在15-30之间。"}');
}
if (con < 15 || con > 30) {
return me.send('{"type":"regist","result":"根骨属性需要在15-30之间。"}');
}
if (dex < 15 || dex > 30) {
return me.send('{"type":"regist","result":"身法属性需要在15-30之间。"}');
}
if (int < 15 || int > 30) {
return me.send('{"type":"regist","result":"悟性属性需要在15-30之间。"}');
}
if (str + con + dex + int != 80) {
return me.send('{"type":"regist","result":"属性之和必须等于80"}');
}
me.ip_address = me.socket.remoteAddress;
if (!WORLD.USERLOGIN.check_user(me)) return;
me.name = name;
me.id = UTIL.create_id();
me.gender = gender;
me.level = 0;
me.exp = 0;
me.pot = 0;
//me.age = 14;
me.str = str;
me.con = con;
me.dex = dex;
me.int = int;
me.per = parseInt(Math.random() * 5) + 20;
me.kar = 20;
me.limit_mp = 0;
me.max_mp = 100;
me.recount();
me.hp = me.max_hp;
me.mp = me.max_mp;
me.reg_time = parseInt(Date.now() / 60000);
me.set_objects(["eq/lv0/cloth", 1, 1]);
me.set_temp("new", 1);
me.set_temp("sr", 1);
me.set_temp("hy_ct", 50);
me.set_setting("ban_pk", 1);
me.eq_groups = [];
me.sk_groups = [];
me.skills = {};
this.save2db(me);
}
this.save2db = async function (me) {
try {
let roleData = me.getData();
roleData.server = WORLD.SERVERID;
let suc = await WORLD.DB.addRole(roleData);
if (suc) {
WORLD.USERS.push(me);
me.wait_input = null;
me.do_login();
} else {
return me.send('{"type":"regist","result":"创建角色失败"}');
}
} catch (err) {
if (err.errno == 1062) {
me.id = null;
return me.send('{"type":"regist","result":"角色名称重复,请重新输入"}');
} else {
console.log("角色创建失败", err, pars);
return me.send('{"type":"regist","result":"创建角色失败"}');
}
}
}

50
world/cmd/comm/dc.js Normal file
View File

@@ -0,0 +1,50 @@
this.inherits(COMMAND);
this.command = "dc";
this.regex = /(\w+)\s+(\w+)\s*(.+)?/;
this.enter = function (player, arg, cmd, par) {
if (!arg || !cmd) return;
var target = player.find_obj(arg, player.environment);
if (!target) return player.send("没有这个人。");
if (target.master != player.id) return player.send("你没办法这么做。");
try {
if (!ALLOW_DC[cmd]) return;
target.set_listener(player, player);
target.do_command(cmd, par);
} catch (e) {
throw e;
}
target.set_listener(player, null);
}
const ALLOW_DC = {
study: true,
store: true,
dazuo: true,
liaoshang: true,
learn: true,
xue: true,
enable: true,
equip: true,
unequip: true,
lianxi: true,
fangqi: true,
give: true,
caiyao: true,
diaoyu: true,
cai: true,
diao: true,
wa: true,
wk: true,
stopstate: true,
state: true,
eq: true,
uneq: true,
checkobj: true,
drop: true,
lingwu: true,
use: true,
lianyao: true,
sell: true,
lingwu3: true,
fenjie: true
};

View File

@@ -0,0 +1,24 @@
this.inherits(COMMAND);
this.command = "deleterole";
this.allow_login = true;
this.enter = function (me, pars) {
if (!pars) return;
var olduser = WORLD.getUser(pars);
if (olduser) {
return me.notify("{type:\"deleterole\",result:0,message:\"登陆中的角色不允许删除\"}");
}
WORLD.DB.deleteRole(me.userid, pars).then(x => {
if (x) {
me.notify("{type:\"deleterole\",result:1,id:\"" + pars + "\"}");
var user = WORLD.getUser(pars);
if (user) {
if (user.environment) user.environment.item_changed(user, false);
WORLD.USERS.remove(user);
}
} else {
me.notify("{type:\"deleterole\",result:0}");
}
}).catch(err => {
me.notify("{type:\"deleterole\",result:0}");
});
}

68
world/cmd/comm/greet.js Normal file
View File

@@ -0,0 +1,68 @@
this.inherits(COMMAND);
this.command = "greet";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, arg) {
if (arg == "master") {
if (!me.query_temp("shifu")) {
return me.notify("你还没有师父。");
}
if (me.query_temp("greet1")) {
return me.notify("你今天已经请安过了。");
}
var user = WORLD.getUser(me.query_temp("shifu"));
if (!user) return me.notify("没有这个玩家,或者不在线。");
if (user.query_temp("tudi") != me.id) return me.notify("你不是" + user.name + "徒弟,无法请安。");
me.notify("你对" + user.name + "说道:师父好。");
user.notify("<hic>" + me.name + "恭恭敬敬的向你打招呼:师父好。</hic>");
me.add_exp(10000, 10000);
me.set_temp("greet1", 1, UTIL.diff_time());
} else {
var count = parseInt(arg);
if (!(count > 0 && count < 100)) return me.notify("数量错误");
if (!me.query_temp("wife") && !me.query_temp("husband")) {
return me.notify("你还没有结婚。");
}
if (me.query_temp("greet2")) {
return me.notify("你本周已经送过花了。");
}
var user = WORLD.getUser(me.query_temp("wife") || me.query_temp("husband"));
if (!user) return me.notify("没有这个玩家,或者不在线。");
if (me.money < 1000 * count) {
return me.notify("你身上的钱不够,买不起花。");
}
if (me.query_temp("wife")) {
if (user.query_temp("husband") != me.id) return me.notify("你不是" + user.name + "丈夫,无法送花。");
me.money -= 1000 * count;
me.notify("你购买了" + UTIL.to_c(count) + "朵玫瑰花送给你妻子" + user.name + "。");
me.set_temp("greet2", 1, UTIL.diff_week_time());
COMMAND.DO("send", user.id, {
content: "你的老公" + me.name + "送给你" + UTIL.to_c(count) + "朵玫瑰花。",
attach: [
{
obj: "money/hua",
count: count
}
]
});
}
else {
if (user.query_temp("wife") != me.id) return me.notify("你不是" + user.name + "妻子,无法送花。");
me.money -= 10000 * count;
me.notify("你购买了" + UTIL.to_c(count) + "朵玫瑰花送给你丈夫" + user.name + "。");
me.set_temp("greet2", 1, UTIL.diff_week_time());
COMMAND.DO("send", user.id, {
content: "你的妻子" + me.name + "送给你" + UTIL.to_c(count) + "朵玫瑰花。",
attach: [
{
obj: "money/hua",
count: count
}
]
});
}
}
}

69
world/cmd/comm/info.js Normal file
View File

@@ -0,0 +1,69 @@
this.inherits(COMMAND);
this.command = "info";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, tid) {
let str = [];
let notifier = me;
if (tid) {
if (me.user_level > 0) {
me = WORLD.getUser(tid);
if (!me)
return notifier.send('没有这个角色。');
}
}
str.push(me.color_name, '\n');
str.push('武道塔进度', me.query_temp('wd_level', 0), '层,已累积', this.query_wdcount(me), '份奖励\n');
str.push('武道残页总量', me.query_temp('wds', 0), '\n');
str.push('门派职位等级', me.family.query_task_title(me),
',已累积', this.query_smcount(me), '份师门物资\n');
str.push('衙门职位等级', YMTITLES[me.query_temp('ym_level', 0)],
',已累积', this.query_ymcount(me), '份奖励\n');
str.push('今日副本次数', me.query_temp('fb_count_day', 0), '/20', '\n');
str.push('BOSS挑战', me.query_temp('bcc', 0), '/5', '\n');
if (me.query_temp('qingan')) {
str.push('已经门派请安', '\n');
} else {
str.push('尚未请安', '\n');
}
if (me.level < 5 && me.level > 2) {
str.push('获取圣元碎片', me.query_temp('mpz', 0), '/1\n');
}
if (me.level > 3)
str.push('获取帝魄碎片', me.query_temp('mpcd', 0), '/1\n');
str.push('获取额外', me.query_temp('sssc', 0), '/', 500 + me.query_prop('shashou'), '师门功绩\n');
str.push('本周已经获取襄阳军功', me.query_temp('jg_week', 0), '/', JUNGONG_LIMITS[me.level], '\n');
str.push('已领取', me.query_temp('xy_hd', 0) * REWARDS_LIMIT[me.level], '/', REWARDS_LIMIT[me.level] * 5, '奖励军功\n');
notifier.send(str.join(""));
}
const REWARDS_LIMIT = [0, 10, 20, 30, 40, 50, 60];//奖励等级对应的每份上限
const JUNGONG_LIMITS = [10, 50, 100, 200, 300, 400, 500];//每周功绩上限
const YMTITLES = ['', '衙役', '捕快', '捕头', '总捕头', '巡检 ', '神捕'];
this.query_wdcount = function (me) {
let tm = me.query_temp("wd_tm", 0);
if (!tm) return 0;
tm = Math.floor((Date.now() - tm * 100000) / 3600000 / 24);
return Math.min(tm, 7);
}
this.query_smcount = function (me) {
let sm = me.query_temp("sm_tm", 0);
if (!sm) return -1;
sm = Math.floor((Date.now() - sm * 100000) / 3600000);
return Math.min(sm, 60);
}
this.query_ymcount = function (me) {
let sm = me.query_temp("ym_tm", 0);
if (!sm) return 0;
sm = Math.floor((Date.now() - sm * 100000) / 3600000);
return Math.min(sm, 60);
}

102
world/cmd/comm/login.js Normal file
View File

@@ -0,0 +1,102 @@
this.inherits(COMMAND);
this.command = "login";
this.allow_login = true;
this.enter = function (user, id) {
if (user.id) return;
if (user.serverid !== WORLD.SERVERID) return;
user.ip_address = user.socket.remoteAddress;
const oldUser = this.check_user(user, id);
if (!oldUser) return;
if (oldUser.id) {
this.relogin(oldUser, user);
} else {
this.loginIn(user, id);
}
}
this.check_user = function (loginuser, id) {
for (var i = 0; i < WORLD.USERS.length; i++) {
let user = WORLD.USERS[i];
if (user.id === id) {
return user;
}
//其他检测loginuser
}
return {};
}
this.relogin = function (oldUser, user) {
if (oldUser.userid === user.userid) {
if (!this.on_user_relogin(oldUser, user) !== false) return;
if (oldUser.password !== user.password && oldUser.loginTime > user.loginTime) {
return user.send("{type:'loginerror',msg:'密码失效,请<CMD onclick=\\'HideAndShow(\"#login_panel\")\\'>重新登录</CMD>'}");
}
oldUser.password = user.password;
oldUser.loginTime = user.loginTime;
oldUser.ip_address = user.socket.remoteAddress;
oldUser.disconnect(true);
user.socket.setTimeout(0);
return oldUser.relogin(user);
} else {
WORLD.log(null, "登陆失败:" + oldUser.id + ",原始ID"
+ oldUser.userid + "现在ID" + user.userid);
return user.send("{type:'loginerror',msg:'当前使用的登陆凭证和角色不一致'}");
}
}
this.on_user_relogin = function (user, me) {
if (user.state && user.state.id == "cross") {
if (user.state.is_over || Date.now() - user.state.stime > 1800000) {
user.moveto(user.query_temp("enter_room") || "yz/wumiao");
return true;
} else {
me.send("{type:'cross',sid:" + user.state.sid + ",pid:'" + user.id + "',cross_type:'" + user.state.cross_type + "'}");
}
return false;
}
return true;
}
this.loginIn = async function (user, id) {
try {
const data = await WORLD.DB.getRoleData(user.userid, id);
if (!data) return user.send("{type:'loginerror',msg:'角色读取失败,请重新登陆 '}");
oldUser = WORLD.getUser(id);
if (oldUser) return user.send("{type:'loginerror',msg:'重复登录'}");
if (data.pwd !== user.password)
return user.send("{type:'loginerror',msg:'密码失效,请<CMD onclick=\\'Process.relogin()\\'>重新登录</CMD>'}");
WORLD.USERS.push(user);
user.loadData(data);
user.do_login();
user.wait_input = null;
if (user.socket)
user.socket.setTimeout(0);
this.on_user_login(user);
} catch (e) {
console.error('登陆失败', e);
WORLD.log(user, "登陆失败", e.message);
user.send("{type:'loginerror',msg:'数据加载失败'}");
}
}
this.on_user_login = function (user) {
user.send("欢迎登陆<HIW>MUD游戏</HIW>");
const area = user.environment.parent;
area.on_login && area.on_login(user);
if (user.force_skill.on_relive) {
user.force_skill.on_relive(user);
}
}

81
world/cmd/comm/rel.js Normal file
View File

@@ -0,0 +1,81 @@
this.inherits(COMMAND);
this.command = "rel";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.regex = /^(\w+)?(?:\s+(\w+))?$/;
this.enter = function (me, type, cmd) {
if (type === 'marry') {
return me.send('解除夫妻关系,需要到扬州城的衙门找户部主簿办理。');
}
else if (type === 'st') {
if (me.query_temp('tudi'))
return me.send('你的徒弟成长为宗师后自动解除关系,或者去扬州衙门办理强制解除。');
if (me.query_temp('shifu'))
return me.send('你成长为宗师后自动解除关系,或者去扬州衙门办理强制解除。');
return me.send('你没有师父或徒弟,不用解除。');
} else {
let target = FOLLOWER.GET(me, { id: type });
if (!target) return me.send('你没有这个随从。');
if (cmd === 'stop') {
if (!target.state) return me.send(target.name + "没有正在进行的工作。");
target.set_state(null);
return WORLD.COMMANDS.relation.enter(me);
}
if (target.state) return me.send(target.name + "正在" + target.state.title + "。");
let home = me.query_temp('home');
if (!home) return me.send('你还没购买住宅。');
if (home !== 2) return me.send('你的住宅没有随从工作的地方。');
if (target.environment && target.environment.is_fb()) {
return me.send(target.name + "正在副本中。");
}
if (cmd === 'diaoyu' || cmd === 'caiyao' || cmd === 'wk') {
let room = me.query_home('home/huayuan');
if (!room) return me.send('你还没购买带有花园的住宅。');
//target.set_listener(me, me);
if (target.hp <= 0) target.hp = 1;
if (target.environment !== room) {
target.moveto(room);
}
if (cmd === 'diaoyu') {
var wea = target.query_weapon();
if (!wea ||
!wea.path.startsWith("sp/tool/diao")) {
return me.notify(target.name + "没有装备钓竿不可以钓鱼(进入住宅选择目标随从-背包-装备钓鱼竿)。");
}
var er = query_er(target);
if (!er) return me.notify(target.name + "身上没有鱼饵,可以去扬州城的杂货店购买钓竿和鱼饵。");
} else if (cmd === 'wk') {
if (target.query_skill('guanshanjue', 0) < 100) {
return me.notify(target.name + '的观山诀等级太低,无法在小花园挖矿。');
}
var wea = target.query_weapon();
if (!wea ||
!wea.path.startsWith("sp/tool/chu")) {
return me.notify(target.name + "没有装备铁镐无法挖矿(进入住宅选择目标随从-背包-装备铁镐)。");
}
}
target.do_command(cmd);
// me.do_command('dc', target.id + " " + cmd);
// target.set_listener(me, null);
return WORLD.COMMANDS.relation.enter(me);
} else {
return me.send('你要让' + target.name + "做什么?");
}
}
}
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];
}
}
}

315
world/cmd/comm/setting.js Normal file
View File

@@ -0,0 +1,315 @@
this.inherits(COMMAND);
this.command = "setting";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.regex = /^(?:(\w+)?\s+(.+))?$/;
this.enter = function (me, key, value) {
if (!me.is_player) return;
if (!key) {
var str = ['{type:"setting",items:{'];
if (me.setting) {
str.push(JSON.stringify(me.setting));
}
str.push("}}");
me.notify(str.join(""));
} else {
if (key === 'psxk' || key === 'fullscreen') return;
let setting_item = setting_keys[key];
if (!setting_item) return me.notify("无效设定项。");
if (setting_item.type === 'String') {
if (value && setting_item.length && value.length > setting_item.length) {
return me.notify("设定值太长。");
}
if (value === 'none') value = "";
else if (setting_item.def && setting_item.def === value)
value = "";
} else if (setting_item.type === 'Boolean') {
value = value || 0;
value = parseInt(value);
if (value !== 0 && value !== 1) return me.notify("无效设定值。");
}
if (setting_item.on_setting) {
if (setting_item.on_setting(me, value) === false) return;
}
if (key == "no_message") {
me.no_message = (value == 1) ? true : false;
}
me.set_setting(key, value);
if (setting_item.desc) {
if (setting_item.type === 'String') {
if (value && value !== '0') {
me.notify("<hic>已设置" + setting_item.desc + "</hic>");
} else {
me.notify("<cyn>已取消" + setting_item.desc + "</cyn>");
}
} else if (setting_item.type === 'Boolean') {
if (value) {
me.notify("<hic>已开启" + setting_item.desc + "</hic>");
} else {
me.notify("<cyn>已关闭" + setting_item.desc + "</cyn>");
}
}
}
//var parent = me.environment;
//if (!parent) return;
//switch (key) {
// case "exits_map":
// parent.send_exits(me);
// break;
//}
}
}
this.clear = function (me) {
let str = [];
for (let user of WORLD.USERS) {
if (!user.settings) continue;
for (let key in user.settings) {
if (!setting_keys[key]) {
str.push(user.name, key, '\n');
delete user.settings[key];
}
}
}
if (me) me.send(str.join(''));
}
const setting_keys = {
'hide_roomdesc': {
type: "Boolean",
desc: "隐藏房间描述"
}, 'exits_dir': {
type: "Boolean",
desc: "出口描述使用方向描述"
},
'show_command': {
type: "Boolean",
desc: "列出NPC或道具的可用命令"
},
'show_roomitem': {
type: "Boolean",
desc: "在命令栏列出房间内的可用物品"
}, 'item_firstme': {
type: "Boolean",
desc: "列出NPC自己始终显示在房间物品第一列"
},
'keep_msg': {
type: "Boolean",
desc: "切换房间时不清空上房间信息"
}, 'off_move': {
type: "Boolean",
desc: "不显示玩家进出房间描述"
},
'off_plist': {
type: "Boolean",
desc: "隐藏玩家列表"
}, 'no_spmsg': {
type: "Boolean",
desc: "聊天信息不分开显示"
},
'auto_sortitem': {
type: "Boolean",
desc: "按品质自动排列背包和技能"
}, 'no_message': {
type: "Boolean",
desc: " 不显示其他玩家或NPC的房间消息"
},
'auto_showcombat': {
type: "Boolean",
desc: "战斗时自动打开战斗面板"
}, 'auto_hideroom': {
type: "Boolean",
desc: "战斗时自动隐藏房间信息"
},
'no_combatmsg': {
type: "Boolean",
desc: "不显示其他玩家的战斗信息"
}, 'no_mcmsg': {
type: "Boolean",
desc: "不显示自己的普通战斗信息"
},
'combat_wrap': {
type: "Boolean",
desc: "技能栏允许换行"
},
'action_wrap': {
type: "Boolean",
desc: "动作栏允许换行"
},
'show_hpnum': {
type: "Boolean",
desc: "显示血量为数字"
},
'off_hp': {
type: "Boolean",
desc: "关闭血条显示"
}, 'show_damage': {
type: "Boolean",
desc: "显示伤害统计"
}, 'show_sa': {
type: "Boolean",
desc: "显示快捷动作"
},
'font': {
type: "String",
length: 10,
desc: "字体"
},
'combat_size': {
type: "String",
length: 10,
desc: "操作栏大小",
def: "1em"
},
'dialog_size': {
type: "String",
length: 10,
desc: "窗口大小",
def: "1em"
},
'menu_size': {
type: "String",
length: 10,
desc: "菜单栏大小",
def: "1em"
},
'fontsize': {
type: "String",
length: 10,
desc: "字体大小",
def: "0.875rem"
}, 'fontcolor': {
type: "String",
length: 20,
desc: "正常字体颜色",
def: "#008000"
}, 'backcolor': {
type: "String",
length: 20,
desc: "背景颜色"
}, 'hide_equip': {
type: "Boolean",
desc: "隐藏自己的装备"
},
'off_fight': {
type: "Boolean",
desc: "不接受比试"
}, 'ban_pk': {
type: "Boolean",
desc: "",
on_setting: function (me, value) {
if (value == 1) {
if (me.query_setting("ban_pk")) return false;
// if (me.level >= 3) return me.notify("你已经是宗师,不再需要保护了。");
if (me.query_temp("pk")) {
return me.notify_fail("<hir>你最近7天内关闭过PK保护或击杀过其他玩家需要一段时间后才可以再次打开保护。</hir>");
}
me.notify("你已开启PK保护不可主动击杀玩家不可被玩家主动击杀。");
me.set_temp("pk", 1, 24 * 3600000 * 7);
} else {
if (!me.query_setting("ban_pk")) return false;
me.notify("你已关闭PK保护。");
}
}
}, 'no_master': {
type: "Boolean",
desc: "不接受玩家拜师"
}, 'no_team': {
type: "Boolean",
desc: "不接受玩家组队邀请"
},
'off_chat': {
type: "Boolean",
desc: "屏蔽公共频道"
}, 'off_fam': {
type: "Boolean",
desc: "屏蔽门派频道"
},
'off_es': {
type: "Boolean",
desc: "屏蔽全区频道"
}, 'off_pty': {
type: "Boolean",
desc: "屏蔽帮派频道"
},
'auto_get': {
type: "Boolean",
desc: "击杀NPC后自动拾取战利品"
}, 'auto_pfm': {
type: "String",
length: 300,
desc: "击杀玩家或NPC时自动出招"
},
'show_cus': {
type: "Boolean",
desc: "允许其他玩家查看自己的自创武功"
},
'auto_pfm2': {
type: "String",
length: 300,
desc: "被玩家击杀时自动反击"
}, 'auto_work': {
type: "String",
length: 400,
desc: "",
on_setting: function (me, value) {
if (!value || value === '0')
return me.notify('<cyn>已关闭学习,练习,打坐中断后的自动操作</hic>');
if (value === '1') {
return me.notify('<hic>已设置学习,练习,打坐中断后,自动去挖矿</hic>');
}
return me.notify('<hic>已设置学习,练习,打坐中断后的自动操作</hic>');
}
}
};

View File

@@ -0,0 +1,30 @@
this.inherits(COMMAND);
this.command = "shortcut";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.enter = function (player, arg) {
if (!arg) return;
var obj = player.find_obj(arg);
if (!obj) {
return player.notify("你身上没有这个东西。");
}
if (obj.is_equipment) {
if (obj.eq_type != EQUIP_TYPE.WEAPON) return player.notify("你目前只能设置武器的快捷操作。");
} else if (!obj.on_use){
return player.notify("这个道具不可以设置快捷操作。");
}
if (obj.is_shortcut) {
obj.is_shortcut = false;
player.notify("你取消了" + obj.color_name + "的快速设置。");
player.send("{type:'removeAction',id:'" + obj.id + "'}");
} else {
obj.is_shortcut = true;
player.notify("你设置了" + obj.color_name + "的快速使用。");
player.send("{type:'addAction',id:'" + obj.id + "',name:'" + obj.name + "'}");
}
}

221
world/cmd/comm/sx.js Normal file
View File

@@ -0,0 +1,221 @@
this.inherits(COMMAND);
this.command = "sx";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.regex = /^(\w+)(?:\s+(\w+))?(?:\s+(\w+))?$/;
this.enter = function (me, type, par1, par2) {
if (type === 'greet') {
this.do_greet(me);
} else {
this.do_manage(me, par1, par2);
}
}
this.do_greet = function (me) {
let npc = me.family.first_npc;
if (!npc) return me.send('首席目前不在线。');
if (me.level > 5) return me.notify("堂堂武神大人就不要凑热闹了好吧。");
if (npc.family != me.family) {
return me.notify("你又不是" + npc.family.name + "弟子,凑什么热闹。");
}
if (WORLD.DATA.query_temp(npc.family.id + "_top") == me.id) {
return me.notify("你自己就是" + npc.title + ",凑什么热闹。");
}
if (me.query_temp('qingan')) return me.notify("每天请一次安就可以了,多了会惹人烦的。");
var user = WORLD.getUser(WORLD.DATA.query_temp(npc.family.id + "_top"));
var userexp = npc.exp || Number.MAX_VALUE;
if (user) userexp = user.exp;
var ch = npc.gender == 1 ? "师兄" : "师姐";
if (me.query_age() > npc.age) {
ch = npc.gender == 1 ? "师弟" : "师妹";
}
var val = 10000 + me.level * 10000;
me.set_temp('qingan', 1, UTIL.diff_time());
//UTIL.add_task(me, 'qa', 1);
if (userexp < me.exp) {
me.send_room("$N向$n拱手道" + npc.name + "" + ch + "好。", npc);
// if (WORLD.is_server(me) && userexp < me.exp * 0.9) {
// WORLD.DATA.add_temp(fam.id + '_greetings', parseInt(val / 2));
// }
} else {
me.send_room("$N向$n恭恭敬敬的一鞠躬" + npc.name + "" + ch + ",神功盖世,千秋万代。", npc);
}
me.add_exp(val, val);
}
this.check_power = function (me, npc) {
if (npc.family != me.family) {
return me.notify_fail("你又不是" + npc.family.name + "弟子,凑什么热闹。");
}
if (WORLD.DATA.query_temp(npc.family.id + "_top") !== me.id) {
return me.notify_fail("你不是" + npc.title + ",不能更改设置。");
}
return true;
}
// this.add_action('manage1', null, function (me, paras) {
// if (!this.check_power(me)) return;
// if (WORLD.DATA.query_temp(this.family.id + "_buff", 0))
// return me.send('今天已经设置过增益效果了。');
// console.log(paras)
// });
this.do_manage = function (me, par1, par2) {
let npc = me.family.first_npc;
if (!npc) return me.send('你的门派还没有首席弟子。');
if (!this.check_power(me, npc)) return;
if (par1) {
if (par1 === 'buff')
return this.manage_buff(me, par2);
if (par1 === 'battle')
return this.manage_battle(me, par2);
}
me.send("你是" + npc.title + ",可以更改一些设置。");
me.send_commands('sx manage buff', '设置增益', 'sx manage battle', '发起门派战争');
}
this.manage_buff = function (me, par2) {
let buff = me.family.query_temp("buff", 0);
if (buff >= 1)
return me.send('今天已经设置过门派增益了。');
if (!par2) {
me.send('你可以设置以下增益效果,持续一小时:');
return me.send_commands('sx manage buff xue', '学习效率+20%',
'sx manage buff lianxi', '练习效率+20%',
'sx manage buff dazuo', '打坐效率+20%');
}
let msg = null;
switch (par2) {
case "xue":
me.family.add_temp("study_per", 20, 3600000);
msg = "学习效率";
break;
case "lianxi":
me.family.add_temp("lianxi_per", 20, 3600000);
msg = "练习效率";
break;
case "dazuo":
me.family.add_temp("dazuo_per", 20, 3600000);
msg = "打坐效率";
break;
default:
return;
}
me.family.add_temp("buff", 1, UTIL.diff_time());
me.send('<cyn>设置完成,全体门派增益效果:' + msg + '+20%</cyn>');
me.family.send_channel(me, "已设置全体门派增益效果:" + msg + "+20%");
if (!me.query_temp('qingan')) {
var val = 10000 + me.level * 10000;
me.add_exp(val, val);
me.set_temp('qingan', 1, UTIL.diff_time());
}
}
const FAMS = ['WUDANG', 'SHAOLIN', 'HUASHAN', 'EMEI', 'GAIBANG', 'XIAOYAO'];
this.manage_battle = function (me, par2) {
if (me.family === FAMILIES.NONE)
return me.send('你无门无派,要干什么?');
if (me.family === FAMILIES.SHASHOU)
return this.manage_battle2(me, par2);
if (me.family.battle_family)
return me.send('你的门派正在和' + FAMILIES[me.family.battle_family].name + "进行战争。");
if (me.family.query_temp("sxwar", 0) > 0)
return me.send('今天已经开启过门派战争了。');
if (me.family.query_temp('battle')) {
// let time = me.family.temp["battle"].e - Date.now();
// if (time > 20 * 60000) {
// return me.send("你的门派刚结刚束战争,需要休养。");
// }
return me.send("你的门派刚结刚束战争,需要休养。");
}
if (!par2) {
var str = ["{type:\"cmds\",items:["];
for (var key of FAMS) {
let fam = FAMILIES[key];
if (fam === me.family || fam.battle_family || fam.query_temp('battle')) continue;
if (str.length > 1) str.push(",");
str.push("{cmd:\"sx manage battle ");
str.push(key);
str.push("\",name:\"", "向", fam.name, '宣战');
str.push("\"}");
}
if (str.length == 1) {
return me.notify("当前没有可宣战的门派。");
}
str.push("]}");
me.send('选择你要进攻的门派:');
return me.send(str.join(""));
}
let fam = FAMILIES[par2];
if (!fam || fam === me.family) return me.send('你要进攻哪个门派?');
if (fam.battle_family)
return me.send(fam.name + '正在和' + FAMILIES[fam.battle_family].name + "进行战争。");
if (fam.query_temp('battle'))
return me.send(fam.name + '刚结束战斗,趁人之危非君子所为。');
me.family.set_temp("sxwar", 1, UTIL.diff_time());
me.family.check_battle(me, null, fam);
me.family.send_channel(me, "所有门下弟子听令,开始进攻" + fam.name);
}
this.manage_battle2 = function (me, par2) {
if (me.family.query_temp("sxwar", 0) >= 5)
return me.send('杀手楼每天最多可介入5次其他门派的战争。');
if (me.family.query_temp('battle')) {
return me.send("你的门派正在战斗。");
}
if (!par2) {
var str = ["{type:\"cmds\",items:["];
for (var key of FAMS) {
let fam = FAMILIES[key];
if (fam === me.family || !fam.battle_family) continue;
if (str.length > 1) str.push(",");
str.push("{cmd:\"sx manage battle ");
str.push(key);
str.push("\",name:\"", "进攻", fam.name);
str.push("\"}");
}
if (str.length == 1) {
return me.notify("当前没有正在战斗中的门派。");
}
str.push("]}");
me.send('选择你要趁乱进攻的门派:');
return me.send(str.join(""));
}
let fam = FAMILIES[par2];
if (!fam || fam === me.family) return me.send('你要进攻哪个门派?');
if (!fam.battle_family)
return me.send(fam.name + '没有发生战争,你无法介入 。');
sxwar = me.family.add_temp("sxwar", 1, UTIL.diff_time());
me.family.add_temp('battle', 1, 3600000);
me.family.set_temp('ss_target', fam.id, 3600000);
me.family.send_channel(me, "门下所有杀手听令,开始进攻" + fam.name);
me.send('<cyn>已选择' + fam.name + '作为目标门派,本日已开启' + sxwar + '/5次。</cyn>');
EVENTS.add({
id: "SHASHOU_bat",
name: "门派战争",
desc: "你的门派正在进攻" + fam.name + ",击杀对方弟子会获得丰厚奖励。",
time: fam.temp.battle.e,
grade: 2,
command: "进入战场",
check: (me) => me.family === FAMILIES.SHASHOU,
on_command: function (me) {
me.do_command('goto', 'fam3');
}
});
}

22
world/cmd/comm/systask.js Normal file
View File

@@ -0,0 +1,22 @@
this.inherits(COMMAND);
this.command = "systask";
this.regex = /(\w+)\s+(\w+)?/;
this.enter = function (me, arg, par) {
if (!arg) return false;
var task = TASK.GET(arg);
if (!task) return false;
if (me.user_level < 5) {
let cmds = task.allow_commands;
if (!cmds || !cmds[par])
return false;
}
var func = task[par];
if (!func) return;
func.call(task, me);
}
const ALLOW_COMMANDS = {
bm: true,
reward: true
};

234
world/cmd/comm/team.js Normal file
View File

@@ -0,0 +1,234 @@
this.inherits(COMMAND);
this.command = "team";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.regex = /^(add|with|remove|out|reply|dismiss|set)?(?:\s(\w+))?$/;
this.enter = function (me, act, user) {
if (act) {
var func = this["team_" + act];
return func && func.call(this, me, user);
} else {
me.send(teamToString(me));
}
}
function teamToString(me) {
var str = ['{"type":"dialog","dialog":"team","items":['];
if (me.team) {
for (var i = 0; i < me.team.length; i++) {
var p = me.team[i];
str.push("{id:\"");
str.push(p.id);
str.push("\",name:\"");
str.push(p.long_name());
str.push("\"}");
if (i != me.team.length - 1) {
str.push(",");
}
}
}
str.push("]}");
return str.join("");
}
this.team_set = function (me, arg) {
if (!me.team) return me.notify("你没有组队。");
if (!arg) {
me.notify("目前队伍的分配方式是:" + (me.team.free_get ? "自由拾取" : "需求分配"));
if (me.team.free_get) {
me.send_commands("team set allot_get", "更改为按需求分配");
} else {
me.send_commands("team set free_get", "更改为自由拾取");
}
return;
}
switch (arg) {
case "free_get":
me.team.free_get = true;
me.send_team("<hig>拾取方式已设置为自由拾取。</hig>");
break;
case "allot_get":
me.team.free_get = false;
me.send_team("<hig>拾取方式已设置为需求分配。</hig>");
break;
}
}
this.team_with = function (me, user) {
var player = me.find_obj(user, me.environment);
if (!player) return me.notify("没有这个玩家,或者不在线");
if (player.master != me.id) return me.notify(player.name + "拒绝了你的组队邀请。");
if (player.team) return me.notify(player.name + "已加入组队,无法接受你的请求。");
if (me.environment.is_fb()) return me.notify("你正在副本,无法邀请别人。");
if (me.environment.parent.no_team) return me.notify("你正在副本,无法邀请别人。");
if (me.team) {
if (me.team.length > 4) {
return me.notify("你的队伍人数已满。");
}
}
player.set_temp("team", me.id);
this.team_reply(player, "ok");
}
this.team_add = function (me, user) {
var player = WORLD.getUser(user);
if (!player) {
//player = me.find_obj(user, me.environment);
//if (player) {
// return me.notify(player.name + "已加入组队,无法接受你的请求。");
//}
return me.notify("没有这个玩家,或者不在线");
}
if (player.serverid !== me.serverid) return me.notify("你不能组他。");
if (player === me) return;
if (player.query_setting('no_team')) return me.notify(player.name + "目前不接受组队邀请。");
if (player.team) return me.notify(player.name + "已加入组队,无法接受你的请求。");
if (me.environment.is_fb()) return me.notify("你正在副本,无法邀请别人。");
if (me.environment.parent.no_team) return me.notify("你正在副本,无法邀请别人。");
if (player.query_temp('team') == me.id) return me.notify("你已经邀请过" + player.name + "了,正在等待回应。");
if (me.team) {
if (me.team.length > 4) {
return me.notify("你的队伍人数已满。");
}
for (var i = 0; i < me.team.length; i++) {
if (me.team[i].environment && me.team[i].environment.is_fb()) {
return me.notify("你的队伍已经开启副本,无法增加队员。");
}
}
}
player.send("<hic>" + me.name + "邀请你加入组队,是否同意?</hic>");
player.send_commands("team reply ok", "同意", "team reply no", "不同意");
player.set_temp("team", me.id, 10000);
me.send("<hig>已经发送对" + player.name + "的组队邀请。</hig>");
}
this.team_reply = function (me, act) {
var p = me.query_temp("team");
if (!p) return me.send("没有人邀请你组队,或邀请已过期。");
var player = WORLD.getUser(p);
if (!player) me.send("没有人邀请你组队,或邀请已过期。");
if (act == "ok") {
if (me.team) return me.send("你已经有队伍了。");
if (me.environment && me.environment.parent.is_copy && !me.environment.parent.not_fb) {
return me.send("你目前正在副本中,无法加入队伍。");
}
if (me.environment.parent.no_team) return me.notify("你正在副本,无法加入队伍。");
if (!player.team) {
//如果开始组队的玩家没有队伍就先创建个
player.team = [];
player.team.alloc = team_dice;
player.team.id = UTIL.create_id();
player.team.push(player);
} else if (player.team.length > 4) {
return me.send("<red>" + player.name + "队伍人数已经满了。</red>");
}
player.team.push(me);
me.team = player.team;
me.send_team("<hig>" + me.name + "加入队伍。</hig>");
me.send_team(teamToString(me));
me.on_teamin && me.on_teamin(player);
} else {
player.send("<red>" + me.name + "拒绝了你的邀请。</red>");
me.send("<hic>你拒绝了" + player.name + "的邀请。</hic>");
}
me.remove_temp("team");
}
function team_dice(obj) {
if (!this.objs || this.objs.indexOf(obj) == -1) return;
var me = this[0];
if (!me) {
for (let i = 0; i < this.objs.length; i++) {
this.objs[i].dice = null;
}
return;
}
if (!obj.dice || !obj.dice.user) {
me.send_team(obj.color_name + "所有人都放弃。");
return;
}
var userid = obj.dice.user;
var player = null;
for (var i = 0; i < this.length; i++) {
if (this[i].id == userid) {
player = this[i];
break;
}
}
if (!player) {
obj.dice = null;
this.objs.remove(obj);
return me.notify("战利品分配失败,玩家不在队伍。");
}
obj.dice = null;
this.objs.remove(obj);
player.add_obj(obj);
player.send_team(player.name + "获得" + UTIL.to_c(obj.count) + obj.unit + obj.color_name + "。");
}
this.team_remove = function (me, user) {
var tm = me.team;
if (!tm) return me.notify("你还没有加入队伍。");
if (me != tm[0]) return me.notify("你不是队长没有权利移除队员。");
for (var i = 1; i < tm.length; i++) {
var player = tm[i];
if (player.id == user) {
if (player.environment && player.environment.is_fb()) return me.notify(player.name + "现在正在副本区域,不能移除。");
player.send("<red>你被移除出了队伍。</red>");
player.on_teamout && player.on_teamout(me);
player.team = null;
tm.splice(i, 1);
me.send_team("<hic>" + player.name + "被移出组队。</hic>");
me.send_team('{"type":"dialog","dialog":"team",remove:"' + player.id + '"}');
break;
}
}
if (tm.length == 1) {
me.send("<hic>你的队伍解散了。</hic>");
me.send('{"type":"dialog","dialog":"team",dismiss:true}');
tm.length = 0;
me.team = null;
checkTeamfb(me);
}
}
this.team_dismiss = function (me) {
if (!me.team) return me.notify("你没有加入队伍。");
if (me != me.team[0]) return me.notify("你不是队长没有权利解散队伍。");
for (var i = 0; i < me.team.length; i++) {
var tm = me.team[i];
if (tm.environment.is_fb())
return me.notify((tm == me ? "你" : tm.name) + "现在正在副本区域,不能解散队伍。");
}
for (var i = 0; i < me.team.length; i++) {
var tm = me.team[i];
tm.send("<hic>你的队伍解散了。</hic>");
tm.send('{"type":"dialog","dialog":"team",dismiss:true}');
if (tm != me) {
tm.on_teamout && tm.on_teamout(me);
tm.team = null;
}
}
me.team.length = 0;
me.team = null;
checkTeamfb(me);
}
this.team_out = function (me) {
if (!me.team) return me.notify("你没有加入队伍。");
if (me.environment.is_fb()) return me.notify("你现在正在副本区域,不能离开队伍。");
me.team_out("退出队伍");
}
function checkTeamfb(me) {
if (me.environment && me.environment.is_fb()) {
WORLD.COMMANDS['cr'].enter(me, 'over')
me.notify("<hic>你退出了队伍,自动离开副本。</hic>");
}
}

35
world/cmd/comm/title.js Normal file
View File

@@ -0,0 +1,35 @@
this.inherits(COMMAND);
this.command = "title";
this.allow_busy = true;
this.allow_state = true;
this.enter = function(me, index) {
if (!me.titles) return me.notify("你还没有任何称号。");
index = parseInt(index);
if (!(index >= 0 && index < me.titles.length)) return me.notify("你没有这个称号。");
var title = null;
for (var i = 0; i < me.titles.length; i++) {
if (i == index) {
if (me.titles[i].use) {
me.titles[i].use = false;
} else {
title = me.titles[i];
title.use = true;
}
} else {
me.titles[i].use = false;
}
}
if (title) {
me.title = title.title;
me.notify("你决定使用" + title.title + "做为你的称号。");
} else {
me.title = null;
me.notify("你决定不使用任何称号。");
}
me.color_name = null;
me.environment.item_changed(me, true);
}

50
world/cmd/comm/zigong.js Normal file
View File

@@ -0,0 +1,50 @@
this.inherits(COMMAND);
this.command = "zigong";
this.enter = function (me, arg) {
if (me.gender == 2) return me.notify("你要割什么?");
if (me.gender == 3) return me.notify("你都没有了还要割什么?");
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 != 3) {
list.push(skill);
}
}
}
if (arg=="ok") {
var weap = me.query_weapon_type();
if (weap == WEAPON_TYPE.NONE) return me.notify("好歹准备个好用的工具吧?");
for (var i = 0; i < list.length; i++) {
if (me.remove_skill(list[i].id)) {
me.notify('{type:"dialog",dialog:"skills",remove:"' + list[i].id + '"}');
}
}
me.send_room("<hic>$N一咬牙褪下下衣伸出" + me.weapon_name() + "插到$P两腿之间飞速一剜……\n\n</hic>");
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 = 3;
} else {
var str = ["<hir>你可想好了,割了可就没了!</hir>"];
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.send(str.join(""));
me.send_commands("zigong ok","确认不要了");
}
}

76
world/cmd/dialog/cha.js Normal file
View File

@@ -0,0 +1,76 @@
this.inherits(COMMAND);
this.command = "cha,skills";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.enter = function (me, arg) {
var target = me;
var isfollower = false;
if (arg) {
if (arg == "none") return me.notify('{"type":"dialog","dialog":"skills","limit":' + me.skill_limit() + "}");
target = me.find_obj(arg, me.environment);
if (!target && me.user_level > 1) {
target = WORLD.getUser(arg);
}
if (!target) {
return me.notify("这里没有这个人。");
}
if (target.master == me.id) {
isfollower = true;
} else {
if (target.on_checkskill) {
if (target.on_checkskill(me) == false) return;
} else {
if (me.user_level < 4 && !target.is(me.query_temp("master")))
return me.notify("你只能查看自己师父的技能。");
}
}
}
this.render_skill(me, target, isfollower);
}
this.render_skill = function (me, target, isfollower) {
var skills = target.skills;
var str = ['{"type":"dialog","dialog":"'];
str.push(me === target ? 'skills' : 'master');
str.push('","items":[');
if (skills) {
var skill_count = 0;
for (var skid in skills) {
var skill_base = SKILL.get(skid);
if (!skill_base) continue;
if (skill_count > 0) str.push(",");
skill_base.item_to_json(str, skills[skid], target);
skill_count++;
}
}
str.push('],title:"');
str.push(target == me ? "你" : target.name);
str.push(skill_count > 0 ? "共学会" + skill_count + "项技能" : "没有学会任何技能");
str.push('"');
str.push(',limit:');
if (isfollower)
str.push(target.skill_limit());
else
str.push(me.skill_limit());
str.push(',pot:');
str.push(me.pot);
if (target !== me) {
str.push(isfollower ? ",follower:\"" : ',master:\"');
str.push(target.id);
str.push("\"");
if (isfollower) {
str.push(',target:\"');
str.push(target.name);
str.push("\"");
}
} else {
str.push(',sk_group:', WORLD.COMMANDS.skgroup.cur_eqs(me));
}
str.push("}");
me.send(str.join(""));
}

View File

@@ -0,0 +1,64 @@
this.inherits(COMMAND);
this.command = "events";
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, paras) {
let events = WORLD.USER_EVENTS;
if (type) {
for (let i = 0; i < events.length; i++) {
let evt = events[i];
if (evt.id === type) {
if (this.check_command(evt, me)) {
if (evt.on_command?.(me, paras)) {
me.send('{type:"dialog",dialog:"events",close:true}');
}
}
return;
}
}
return me.send('什么?');
} else {
let str = ['{type:"dialog",dialog:"events",items:['];
let now = Date.now();
for (let i = 0; i < events.length; i++) {
let evt = events[i];
if (evt.check && !evt.check(me))
continue;
if (evt.time > 0 && evt.time < now) {
continue;
}
if (str.length > 1) str.push(',');
str.push(`["${evt.id}","${evt.name}","${evt.query_desc(me)}",${evt.query_grade(me)},${evt.time},"${evt.command ?? ""}"]`);
}
str.push(']}');
me.send(str.join(""));
}
}
this.check_command = function (event, me) {
if (me.hp <= 0 && !event.allow_die) {
return me.notify_fail("你现在是灵魂状态,不能那么做。");
}
if (!event.allow_faint && me.is_faint) {
me.send("你正在昏迷中!");
return false;
}
if (!event.allow_state && me.state) {
return me.notify_fail("你正在" + me.state.title + ",没时间这么做。");
}
if (!event.allow_fight && me.fight_type > 0) {
return me.notify_fail("你正在战斗,待会再说。");
}
if (!event.allow_busy && me.is_busy) {
return me.notify_fail("你现在正忙。");
}
return true;
}

103
world/cmd/dialog/i.js Normal file
View File

@@ -0,0 +1,103 @@
this.inherits(COMMAND);
this.command = "pack";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.enter = function (me, arg) {
var target = me;
if (arg) {
if (arg == "none") return me.notify('{"type":"dialog","dialog":"pack","money":' + me.money + "}");
target = me.find_obj(arg, me.environment);
if (!target && me.user_level > 1) {
target = WORLD.getUser(arg);
}
if (!target) {
return me.notify("这里没有这个人。");
}
if (me.user_level < 4 && target.master != me.id)
return me.notify("你只能查看自己的背包。");
}
var str = ['{"type":"dialog","dialog":"'];
if (target != me) {
str.push('pack2",id:"');
str.push(target.id);
str.push('",name:"');
str.push(target.name);
str.push('",');
} else {
str.push('pack",');
}
str.push('"items":[');
var items = target.items;
if (items) {
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (i > 0) str.push(",");
str.push(item.format_to_pack());
// str.push('{name:"');
// str.push(item.color_name);
// str.push('",id:"');
// str.push(item.id);
// str.push('",count:');
// str.push(item.count);
// str.push(',unit:"');
// str.push(item.unit);
// str.push('"');
// str.push(',value:');
// str.push(parseInt(item.value / 10));
// if (item.is_equipment) {
// str.push(',can_eq:1');
// }
// if (item.on_use) {
// str.push(',can_use:1');
// }
// if (item.on_study) {
// str.push(',can_study:1');
// }
// if (item.on_open) {
// str.push(',can_open:1');
// }
// if (item.combine_count) {
// str.push(',can_combine:' + item.combine_count);
// }
// str.push('}');
}
}
str.push('],"money":');
str.push(target.money || 0);
items = target.equipment;
if (items) {
str.push(',eqs:[');
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (i > 0) str.push(",");
if (item) {
str.push(`["${item.color_name}","${item.id}",${item.grade},${item.on_use ? 1 : 0},${item.is_locked ? 1 : 0}]`);
// str.push('{name:"');
// str.push(item.color_name);
// str.push('",id:"');
// str.push(item.id);
// str.push('"');
// if (item.on_use) {
// str.push(',can_use:1');
// }
// str.push('}');
} else {
str.push("null");
}
}
str.push(']');
}
str.push(",max_item_count:");
str.push(target.max_item_count);
if (target === me) {
str.push(",eq_group:");
str.push(target.eq_group);
}
str.push('}');
me.send(str.join(""));
}

385
world/cmd/dialog/jh.js Normal file
View File

@@ -0,0 +1,385 @@
this.inherits(COMMAND);
this.command = "jh";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.fbs_json = null;
this.fbs = [];
this.regex = /^(\w+)?\s?(lock|\d+)?(?:\s(start[1|2|3]?))?$/;
this.enter = function (me, type, arg, isstart) {
if (!me.is_player) return;
var unlock = me.query_temp("fb", 0);
var unlock2 = me.query_temp("fb2", 0);
if (arg == "lock")
return me.send(`{type:"dialog",dialog:"jh",unlock:${unlock},unlock2:${unlock2}}`);
if (!this.map_json) {
this.map_json = this.getAllMaps();
}
if (!arg && !type) {
me.send(this.map_json);
me.send(`{type:"dialog",dialog:"jh",unlock:${unlock},unlock2:${unlock2}}`);
} else {
var index = parseInt(arg);
if (!isstart) {
if (type == "fb") return this.return_fbdesc(me, index);
if (type == "fam") return this.return_famdesc(me, index);
else return this.return_areadesc(me, index);
} else {
if (me.check_command({
allow_busy: false, allow_state: false,
allow_die: false, allow_faint: false,
allow_fight: false
}) == false) return;
if (type == "fb") {
var fb = this.fbs[index];
if (fb.is_lock) {
return me.notify("暂未开放,正在修复");
}
if (fb.unlock_index) {
if (fb.unlock_index > unlock) {
return me.notify("你需要完成" + this.fbs[fb.unlock_index - 1].name + "才能解锁" + fb.name + "。");
}
} else if (index > unlock) {
return me.notify(fb.name + "尚未解锁。");
}
if (!me.environment) return me.notify("你不知道在哪。");
if (me.environment.is_fb()) return me.notify("你现在正在副本区域。");
if (!fb || !fb.id) return me.notify("没有这个副本。");
if (fb.start_room && !me.is_in(fb.start_room))
return me.notify('你要进入哪个副本?');
if (isstart == "start1") {
// if (me.team) return me.notify("你目前处于队伍当中,无法进入单人副本。");
var count = me.query_temp("fbc_0_" + fb.fb_index, 0);
if (count) {
me.notify("即将进入副本(" + fb.name + ")区域,已完成" + count + "次,本次副本需要消耗" + fb.expend + "点精力。\n当前精力" + me.query_jingli());
} else {
me.notify("即将进入副本(" + fb.name + ")区域,本次副本需要消耗" + fb.expend + "点精力。\n当前精力" + me.query_jingli());
}
let can_sd = false;
if (fb.unlock_index) {
can_sd = me.query_temp('fb_sao' + index, 0) === 1;
} else {
can_sd = me.query_temp('fb_sao0') >= index;
}
if (can_sd) {
return me.send_commands('cr ' + fb.id, "进入副本", "cr " + fb.id + " 0 1", "扫荡一次",
"cr " + fb.id + " 0 10", "扫荡十次");
} else {
return me.send_commands('cr ' + fb.id, "进入副本");
}
} else if (isstart == "start2") {
// if (me.team) return me.notify("你目前处于队伍当中,无法进入单人副本。");
let count = me.query_temp("fbc_1_" + fb.fb_index, 0);
if (count) {
me.notify("即将进入副本(" + fb.name + ")<hir>困难区域</hir>,已完成" + count + "次,本次副本需要消耗" + fb.expend + "点精力。\n当前精力" + me.query_jingli());
} else {
me.notify("即将进入副本(" + fb.name + ")<hir>困难区域</hir>,本次副本需要消耗" + fb.expend + "点精力。\n当前精力" + me.query_jingli());
}
let can_sd = false;
if (fb.unlock_index) {
can_sd = me.query_temp('fb_sao' + fb.index, 0) === 2;
} else {
can_sd = me.query_temp('fb_sao1') >= index;
}
if (can_sd) {
return me.send_commands('cr ' + fb.id + " 1 0", "进入副本", "cr " + fb.id + " 1 1",
"扫荡一次", "cr " + fb.id + " 1 10", "扫荡十次");
} else {
return me.send_commands('cr ' + fb.id + " 1 0", "进入副本");
}
} else if (isstart == "start3") {
if (!me.team) return me.notify("你目前没有在队伍当中,无法进入组队副本。");
for (var i = 0; i < me.team.length; i++) {
var tm = me.team[i];
if (tm.environment && tm.environment.is_fb() &&
tm.environment.parent != fb) {
return me.notify(tm.name + "现在正在副本【" + tm.environment.parent.name + "】区域,无法开启其它副本。");
}
}
me.send("即将组队进入副本(" + fb.name + ")区域,本次副本需要消耗" + fb.expend + "点精力。\n当前精力" + me.query_jingli() + "/100");
return me.send_commands('cr ' + fb.id + " 2 0", "进入副本");
}
} else if (type === 'ar') {
if (!me.can_trans()) return;
let fb = this.areas[index];
if (!fb || !fb.id) return me.notify("没有这个禁地区域。");
if (!(fb.jd_index >= 0)) return me.notify("没有这个禁地区域。");
if (fb.is_lock) return me.notify("暂未开放,正在修复");
let diff = 0;
if (me.team) diff = 2;
if (!me.isenable_area(fb)) return me.notify("未解锁区域");
if (fb.is_copy && !fb.not_fb) {//禁地类型的副本
this.enter_ar_fb(me, fb, diff);
} else {
if (fb.on_enter(me) == false) {
return;
}
me.moveto(fb.first, me.name + "走了。", me.name + "来了。");
}
} else {
if (!me.can_trans()) return;
let fb = this.families[index];
if (!fb || !fb.first) return me.notify("没有这个门派。");
if (fb.on_enter(me) == false) {
return;
}
me.moveto(ROOM.Get(fb.first), me.name + "走了。", me.name + "来了。");
}
me.send('{type:"dialog",dialog:"jh",close:true}');
}
}
}
this.enter_ar_fb = function (me, fb, diff = 0) {
var count =
me.query_temp(fb.count_key ?? ("fbc_0_" + fb.fb_index), 0);
if (count) {
me.notify("即将进入禁地副本(" + fb.name
+ ")区域,已完成" + count +
"次,本次副本需要消耗<hic>" + fb.expend
+ "</hic>点精力。\n当前精力" + me.query_jingli());
} else {
me.notify("即将进入禁地副本(" + fb.name
+ ")区域,本次副本需要消耗<hic>" + fb.expend
+ "</hic>点精力。\n当前精力" + me.query_jingli());
}
let can_sd = me.query_temp('fb_sao' + fb.fb_index, 0) === 1;
if (can_sd) {
let sd_diff = diff;
if (sd_diff === 2) sd_diff = 0;
return me.send_commands('cr ' + fb.id + " " + diff + " 0",
"进入副本", "cr " + fb.id + " " + sd_diff + " 1",
"扫荡一次", "cr " + fb.id + " " + sd_diff + " 10", "扫荡十次");
} else {
return me.send_commands('cr ' + fb.id + " " + diff + " 0",
"进入副本");
}
}
this.return_famdesc = function (me, index) {
if (!(index >= 0 && index < this.families.length)) return me.notify("没有这个门派。");
var fb = this.families[index];
if (!fb) return me.notify("没有这个门派。");
if (fb.json) return me.send(fb.json);
var obj = {};
obj.type = "dialog";
obj.dialog = "jh";
obj.index = index;
obj.ref = fb.no_cache ? 0 : 1;
obj.desc = fb.query_desc();
obj.actions = fb.query_actions(me);
obj.sp = fb.sp;
obj.t = "fam";
if (fb.family) {
var fam = FAMILIES[fb.family];
if (fam) {
fb.skills = fam.skills;
fb.skills2 = fam.skills2;
fb.skills4 = fam.skills4;
}
}
var str = [];
if (fb.skills) {
str.push("门派武功:\n");
for (var i = 0; i < fb.skills.length; i++) {
str.push("<span cmd='checkskill ");
str.push(fb.skills[i].id);
str.push(" help'>");
str.push(fb.skills[i].color_name);
str.push("</span>\n");
}
}
if (str.length) obj.skills = str.join("");
fb.json = JSON.stringify(obj);
me.send(fb.json);
}
this.return_areadesc = function (me, index) {
if (!(index >= 0 && index < this.areas.length)) return me.notify("没有这个副本。");
var fb = this.areas[index];
if (!fb) return me.notify("没有这个区域。");
if (fb.json) return me.send(fb.json);
var obj = {};
obj.type = "dialog";
obj.dialog = "jh";
obj.t = "ar";
obj.index = index;
obj.desc = fb.desc;
obj.actions = fb.query_actions(me);
// if (fb.is_copy && !fb.not_fb)
// obj.status = this.fb_status(fb);
obj.reward = "掉落或解谜奖励:\n" + this.fb_drops(fb);
fb.json = JSON.stringify(obj);
me.send(fb.json);
}
this.return_fbdesc = function (me, index) {
if (!(index >= 0 && index < this.fbs.length)) return me.notify("没有这个副本。");
var fb = this.fbs[index];
if (!fb) return me.notify("没有这个副本。");
if (fb.json) return me.send(fb.json);;
var obj = {};
obj.type = "dialog";
obj.dialog = "jh";
obj.t = "fb";
obj.index = index;
obj.desc = fb.desc;
obj.status = this.fb_status(fb);
var str = [];
var exp = fb.query_exp();
str.push("获得");
str.push(exp);
str.push("点经验,");
str.push(exp);
str.push("点潜能\n掉落或解谜奖励\n");
str.push(this.fb_drops(fb));
obj.reward = str.join("");
obj.diffs = [1, fb.is_diffi ? 1 : 0, fb.is_multi ? 1 : 0];
fb.json = JSON.stringify(obj);
me.send(fb.json);
}
this.fb_drops = function (fb) {
var json = [];
var drops = fb.drops || [];
fb.drop_items = [];
for (var i = 0; i < drops.length; i++) {
var oitem = OBJ.CREATE(drops[i]);
if (oitem) {
json.push("<span cmd='look3 " + fb.drop_items.length
+ " of fb_" + fb.area_index + "'>" + oitem.color_name + "</span>");
fb.drop_items.push(oitem);
}
}
return json.join("\n");
}
this.fb_status = function (fb) {
let status = [];
let fblock = fb.fb_index + 1;
let fb_key = "fb_first_" + fblock + "_0";
let ss_0 = WORLD.DATA.query_temp(fb_key);
if (ss_0) {
status[0] = [1, ss_0];
} else {
status[0] = [0, fb.is_diffi ? "" : fb.ss_title];
}
if (fb.is_diffi) {
fb_key = "fb_first_" + fblock + "_1";
ss_0 = WORLD.DATA.query_temp(fb_key);
if (ss_0) {
status[1] = [1, ss_0];
} else {
status[1] = [0, fb.ss_title ?? ""];
}
} else {
status[1] = null;
}
if (fb.is_multi) {
fb_key = "fb_first_" + fblock + "_2";
ss_0 = WORLD.DATA.query_temp(fb_key);
if (ss_0) {
status[2] = [1, ss_0];
} else {
status[2] = [0, ""];
}
}
return status;
}
this.init = function () {
this.map_json = this.getAllMaps();
}
this.getAllMaps = function (me) {
var map = {};
map.type = "dialog";
map.dialog = "jh";
map.fbs = [];
map.families = [];
map.areas = [];
this.fbs = [];
this.families = [];
this.areas = [];
for (var i = 0; i < WORLD.AREAS.length; i++) {
var area = WORLD.AREAS[i];
area.area_index = i;
if (AREAS[area.id] >= 0) {
let index = AREAS[area.id];
map.families[index] = area.name;
this.families[index] = area;
// AREAS[area.id] = area;
} else if (FBS[area.id] >= 0) {
area.fb_index = FBS[area.id];
map.fbs.push(area.name);
this.fbs.push(area);
FBS[area.id] = area;
} else if (JDS[area.id] >= 0) {
let index = JDS[area.id];
area.jd_index = index;
this.areas[index] = area;
map.areas[index] = area.name;
}
}
AREA.FBS = this.fbs;
return JSON.stringify(map);
}
AREA.Get_FB = function (id) {
return FBS[id];
}
this.get_area = function (id) {
if (!this.areas) this.getAllMaps();
let index = AREAS[id];
if (index >= 0) {
return this.areas[index];
}
return null;
}
const AREAS = {
yz: 0, wudang: 1, shaolin: 2, huashan: 3, emei: 4,
xiaoyao: 5, gaibang: 6, shashou: 7, xiangyang: 8, wudao: 9
};
const FBS = {
"lw": 0, "cuifu": 1, "lmw": 2, "lcy": 3,
"by": 4, "zhuang": 5, "ao": 6, "tdh": 7
}
const JDS = {
heiying: 0,
// gmp: 4,
// gumen: 5,
// gzc: 6,
// gysd: 7,
// yzjd: 8
};

53
world/cmd/dialog/list.js Normal file
View File

@@ -0,0 +1,53 @@
this.inherits(COMMAND);
this.command = "list";
this.enter = function (me, arg) {
var target = me;
if (arg) {
target = me.find_obj(arg, me.environment);
if (!target) {
return me.notify("这里没有这个人。");
}
}
var selllist = target.sell_list;
if (target.on_sell) {
selllist = target.on_sell(me);
}
if (!selllist) {
return me.notify(target.name + "不出售任何东西。");
}
var str = ['{"type":"dialog","dialog":"list","selllist":['];
for (var i = 0; i < selllist.length; i++) {
if (i > 0) str.push(",");
var item = selllist[i];
str.push(item.format_to_sell());
}
str.push(']');
//,items: [
//items = me.items;
//if (items) {
// for (var i = 0; i < items.length; i++) {
// var item = items[i];
// if (i > 0) str.push(",");
// str.push('{name:"');
// str.push(item.color_name);
// str.push('",id:"');
// str.push(item.id);
// str.push('",count:');
// str.push(item.count);
// str.push(',unit:"');
// str.push(item.unit);
// str.push('"}');
// }
//}
str.push(",title:\"");
str.push(target.name);
str.push("正在贩卖以下物品:\"");
str.push(",seller:\"");
str.push(target.id);
str.push("\"}");
me.send(str.join(""));
}

71
world/cmd/dialog/map.js Normal file
View File

@@ -0,0 +1,71 @@
this.inherits(COMMAND);
this.command = "map";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.map_json;
this.buffer = {};
var world_map = null;
this.enter = function (me, area) {
//if (!area) {
// if (!this.map_json) this.map_json = getAllMaps(me);
// return me.send(this.map_json);
//}
if (!area || area == "here") {
if (!me.environment) return;
var str = me.environment.path;
area = str.substr(0, str.lastIndexOf("/"));
}
var path = area + "/"
if (this.buffer[area]) return me.send(this.buffer[area]);
var area_obj = null;
for (var i = 0; i < WORLD.AREAS.length; i++) {
if (path == WORLD.AREAS[i].room_path) {
area_obj = WORLD.AREAS[i];
break;
}
}
if (!area_obj) return;
if (area_obj.render_map) return area_obj.render_map(me);
this.buffer[area] = this.createMapJson(area_obj, area);
me.send(this.buffer[area]);
}
this.clearCache = function () {
this.buffer = {};
}
this.update_map = function (id, rm, pos) {
this.buffer[id] = null;
if (!rm) {
var area_obj;
for (var i = 0; i < WORLD.AREAS.length; i++) {
if (path == WORLD.AREAS[i].room_path) {
area_obj = WORLD.AREAS[i];
break;
}
}
return;
}
var str = "{type:'updatemap',map:'" + id + "',id:'" + rm.path + "',n:'" + rm.name + "'";
if (pos) str += ",pos:[" + pos.join() + "]}";
else str += "}";
for (var i = 0; i < rm.items.length; i++) {
if (rm.items[i].is_player)
rm.items[i].send(str);
}
}
this.createMapJson = function (area_obj, area) {
if (!area_obj) return '{type:"map",maps:[]}';
var obj = {};
obj.type = "map";
obj.path = area;
obj.map = area_obj.map;
return JSON.stringify(obj);
}
function getAreaByPath(areas, path) {
if (!areas) return;
for (var i = 0; i < areas.length; i++) {
if (areas[i].path == path) return areas[i];
}
}

View File

@@ -0,0 +1,74 @@
this.inherits(COMMAND);
this.command = "message";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
const MESSAGE = WORLD.MESSAGE;
this.regex = /^(\w+)\s(\w+)$/;
this.enter = function (me, arg, arg2) {
if (arg === 'delete') {
if (!arg2) return this.delete_all(me);
return this.delete_from(me, arg2);
}
var obj = {};
obj.type = "dialog";
obj.dialog = "message";
if (arg) {
obj.items = MESSAGE.getMessageFromID(me, arg);
obj.id = arg;
} else {
obj.messages = MESSAGE.getUserMessages(me);
}
// obj.messages = [];
// let notices = MESSAGE.getNotice();
// for (let nt of notices) {
// obj.messages.push({
// id: "notice",
// content: nt.content,
// time: nt.time,
// name: "公告"
// });
// }
// let stores = MESSAGE.getUserMessages(me);
// let diff_time = 24 * 3600000 * 30;
// let now = Date.now();
// if (stores) {
// }
me.send(JSON.stringify(obj));
}
this.delete_from = function (me, from) {
let stores = MESSAGE.stores.get(me.id);
if (!stores) return me.send('你没有消息。');
let store = stores.get(from);
if (!store) return me.send('你没有这个类型的消息。');
if (!this.check_store(store)) {
return me.send('你有未领取的消息,无法删除。');
}
stores.delete(from);
me.send('{type:"dialog",dialog:"message",clear:"' + from + '"}');
}
this.delete_all = function (me) {
let stores = MESSAGE.stores.get(me.id);
if (!stores) return;
stores.forEach((x, y) => {
if (!this.check_store(x)) {
return me.send('你有未领取的消息,无法删除。');
}
});
MESSAGE.stores.delete(me.id);
me.send('{type:"dialog",dialog:"message",clear:true}');
}
this.check_store = function (store) {
let items = store.items;
for (let item of items) {
if (item.attach && !item.rec)
return false;
}
return true;
}

24
world/cmd/dialog/qu.js Normal file
View File

@@ -0,0 +1,24 @@
this.inherits(COMMAND);
this.command = "qu";
this.regex = /^(?:(\d+\s+))?(\w+)$/;
this.enter = function (me, count, arg) {
if (!me.environment.allow_store) return me.notify("这里没有仓库。");
if (!arg) return me.notify("你要取什么东西?");
me.items = me.items || [];
var obj = {};
obj.remove_item_byid = me.remove_item_byid;
obj.items = me.stores || [];
var move_count = 1;
if (count) move_count = parseInt(count);
var moved_obj = obj.remove_item_byid(arg, move_count);
if (!moved_obj) return me.notify("你的仓库里没有这样东西。");
moved_obj = me.push_item(moved_obj);
me.stores = obj.items;
me.send_room("$N从仓库里取出" + UTIL.to_c(move_count) + moved_obj.unit + moved_obj.color_name + "。");
me.notify('{type:"dialog",dialog:"list",id:"' + moved_obj.id + '",storeid:"' + arg + '",store:' + (-move_count) + '}');
}

View File

@@ -0,0 +1,94 @@
this.inherits(COMMAND);
this.command = "relation";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, arg) {
var str = ['{"type":"dialog","dialog":"relation"'];
if (me.query_temp("shifu")) {
var shifu = WORLD.getUser(me.query_temp("shifu"));
str.push(",shifu:\"");
if (shifu) {
str.push(shifu.color_name);
} else {
str.push(me.query_temp("shifu_n"));
}
str.push("\"");
if (shifu) {
str.push(",sid:\"");
str.push(shifu.id);
str.push("\"");
}
} else if (me.query_temp("tudi")) {
var tudi = WORLD.getUser(me.query_temp("tudi"));
str.push(",tudi:\"");
if (tudi) {
str.push(tudi.color_name);
} else {
str.push(me.query_temp("tudi_n"));
}
str.push("\",st:");
str.push(me.query_temp("st_count", 0));
if (tudi) {
str.push(",tid:\"");
str.push(tudi.id);
str.push("\"");
var lv = tudi.level ? tudi.level : 1;
if (lv < 3) {
str.push(",reward:\"你的徒弟境界提升到");
str.push(["<wht>武士</wht>", "<hig>武师</hig>", "<hiy>宗师</hiy>"][lv]);
str.push("后,你将获得一个");
str.push(["<hig>精铁宝箱</hig>", "<hic>白银宝箱</hic>", "<hiy>黄金宝箱</hiy>"][lv]);
str.push("\"");
}
}
}
if (me.query_temp("st_leave")) {
var time = new Date(me.temp["st_leave"].e) - Date.now();
str.push(",reward:\"你需要");
str.push(parseInt(time / 3600000));
str.push("小时");
str.push(parseInt((time % 3600000) / 60000));
str.push("分后才可以另行收徒或拜师\"");
}
if (me.query_temp("husband")) {
var husband = null;// WORLD.getUser(me.query_temp("husband"));
str.push(",husband:\"");
if (husband) {
str.push(husband.color_name);
} else {
str.push(me.query_temp("husband_n"));
}
str.push("\"");
} else if (me.query_temp("wife")) {
var wife = null;// WORLD.getUser(me.query_temp("wife"));
str.push(",wife:\"");
if (wife) {
str.push(wife.color_name);
} else {
str.push(me.query_temp("wife_n"));
}
str.push("\"");
}
if (me.follower) {
str.push(",fls:[");
let now = Date.now();
for (let item of me.follower) {
let follower = FOLLOWER.GET(me, item);
if (follower) {
str.push('["', follower.long_name(), '","', follower.id, '"');
if (follower.state) {
str.push(',"', follower.state.title, '",', now - follower.state.stime);
}
str.push('],');
}
}
str.push("0]");
}
str.push("}");
me.send(str.join(""));
}

View File

@@ -0,0 +1,65 @@
this.inherits(COMMAND);
this.command = "reward";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.regex = /^(\w+)(?:\s+(\d+))?$/;
this.enter = function (me, par, index) {
if (!par) {
return;
}
let rule = this.rules[par];
if (!rule) return me.notify("你要看什么?");
let ary = this[par] ?? [];
let reward = ary[index - 1] ?? "";
me.notify("<hic>" + rule + reward + "</hic>");
}
this.score_reward = function (i) {
return {
obj: "money/exp",
count: (20 - i) * 1000
};
}
this.top_reward = function (i) {
return {
obj: "money/gold",
count: (50 + (10 - i) * 5)
};
}
this.weapon_reward = function (i) {
return {
obj: "st/xuanjing",
count: (50 + (10 - i) * 5)
};
}
this.rules = {
score: "根据你所有学会的武学计算的分数,按照门派榜单发放奖励,",
top: "每日消耗精力获得挑战次数,只可挑战积分比自己高的玩家,挑战成功自己增加积分,失败双方积分不变,按照门派榜单发放奖励,",
weapon: "当武器获得精炼或者自制装备时会计算分数玩家同一部件多件装备取最高分上榜所有榜单奖励总计上限200",
mp: "定时更新,无奖励",
exp: "定时更新,无奖励",
money: "定时更新,无奖励",
};
this.top = [
];
for (let i = 0; i < 10; i++) {
this.top[i] = "每天获得黄金*" + (50 + (10 - i) * 5);
}
this.weapon = [
];
for (let i = 0; i < 10; i++) {
this.weapon[i] = "每天获得玄晶*" + (50 + (10 - i) * 5);
}
this.score = [
];
for (let i = 0; i < 20; i++) {
this.score[i] = "每天获得潜能:" + (20 - i) * 1000;
}

145
world/cmd/dialog/score.js Normal file
View File

@@ -0,0 +1,145 @@
this.inherits(COMMAND);
this.command = "score";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, arg) {
var target = me;
if (arg) {
if (arg === "title") {
let str = ['{"type":"dialog","dialog":"score"'];
str.push(',titles:[');
if (me.titles) {
for (var i = 0; i < me.titles.length; i++) {
var item = me.titles[i];
if (i > 0) str.push(",");
str.push("{title:\"");
str.push(item.title);
str.push("\"");
if (item.use) {
str.push(",use:true");
}
str.push("}");
}
}
str.push("]}");
return me.send(str.join(""));
}
target = me.find_obj(arg, me.environment);
if (!target && me.user_level > 1) {
target = WORLD.getUser(arg);
}
if (!target) {
return me.notify("你要查看谁的属性。");
}
if (target.master != me.id && me.user_level < 4) {
return me.notify("你要查看谁的属性。");
}
}
let str = ['{"type":"dialog","dialog":"score"'];
str.push(',id:"');
str.push(target.id);
str.push('","name":"');
str.push(target.long_name());
str.push('","id":"');
str.push(target.id);
str.push('","age":"');
var age = target.query_age();
if (age < 10) age = 10;
var int_age = parseInt(age);
str.push(UTIL.to_c(int_age));
str.push('岁');
let month = parseInt((age - int_age) * 12);
if (month) {
str.push(UTIL.to_c(month));
str.push('个月');
}
str.push('","family":"');
str.push(target.family.name);
str.push('",master:\"');
str.push(target.master ? target.master : "无");
str.push('",gender:\"');
str.push(target.gender == 1 ? "男" : "女");
str.push('",level:\"');
str.push(this.get_level_desc(target));
str.push('"');
target.pot = parseInt(target.pot);
target.hp = parseInt(target.hp);
target.mp = parseInt(target.mp);
for (var i = 0; i < this.props.length; i++) {
str.push(',"');
str.push(this.props[i]);
str.push('":');
str.push(target[this.props[i]] || 0);
}
//if (target.dodge_skill.on_score) {
// str.push(',ds:', target.dodge_skill.on_score(target));
//} else {
//}
str.push(',ds:', target.ds);
str.push(',per:');
str.push(target.query_prop("per") + target.per);
str.push(',str_add:');
str.push(target.query_prop("str"));
str.push(',con_add:');
str.push(target.query_prop("con"));
str.push(',dex_add:');
str.push(target.query_prop("dex"));
str.push(',int_add:');
str.push(target.query_prop("int"));
var limit_mp = target.limit_mp + target.query_prop("limit_mp");
str.push(',limit_mp:');
str.push(limit_mp);
if (target.query_jingli) {
str.push(',jingli:"', target.query_temp('ad_jl', 0), '/', target.query_jclimit(), "<hig>(+", 200 - target.query_temp('ex_jl', 0), ')</hig>"');
} else {
str.push(',jingli:0');
}
str.push(',gjsd:');
str.push(target.gjsd / 1000);
str.push(',bj:"');
str.push(target.bj);
str.push('%",');
str.push('master:"');
str.push(MASTER_NAME(target));
str.push('",family:"');
str.push(target.family.name);
str.push('",gongji:');
str.push(target.query_temp("gongji") || 0);
str.push('}');
me.send(str.join(""));
}
const MASTER_NAMES = {};
const MASTER_NAME = function (me) {
let path = me.query_temp('master');
if (!path) return '无';
if (MASTER_NAMES[path])
return MASTER_NAMES[path];
let obj = NPC.GET(path);
MASTER_NAMES[path] = obj.name;
return obj.name
}
this.props = ["hp", "mp", "max_hp", "max_mp", "str", "con",
"dex", "int", "kar", "gj", "fy", "mz", "zj", "exp", "pot"];
const level_descs = ["普通百姓", "武士", "武师", "宗师", "武圣", "武帝", "武神"];
const level_color = ["", "wht", "hig", "hiy", "hiz", "hio", "ord"];
const level6_descs = ["武神", '剑神', '刀皇', '兵主', '战神'];
this.get_level_desc = function (me) {
if (!me.level) return level_descs[me.level];
var cc = level_color[me.level];
if (me.level === 6) {
return "<" + cc + ">" + level6_descs[me.query_temp('lv6', 0)] + "</" + cc + ">";
}
return "<" + cc + ">" + level_descs[me.level] + "</" + cc + ">";
}

View File

@@ -0,0 +1,77 @@
this.inherits(COMMAND);
this.command = "score2";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.enter = function (me, arg) {
var target = me;
if (arg) {
target = me.find_obj(arg, me.environment);
if (!target && me.user_level > 1) {
target = WORLD.getUser(arg);
}
if (!target) {
return me.notify("你要查看谁的属性。");
}
if (target.master != me.id && me.user_level < 4) {
return me.notify("你要查看谁的属性。");
}
}
var str = ['{"type":"dialog","dialog":"score",'];
str.push('id:"');
str.push(target.id);
str.push("\",add_sh:\"");
str.push(target.query_prop("add_sh_per"));
str.push("%\",diff_fy:\"");
str.push(parseInt(target.diff_fy_per * 100) / 100);
str.push("%\",add_bj:\"");
str.push(target.query_prop("add_bjsh_per") + 150);
str.push("%\",diff_sh:\"");
str.push(target.query_prop("diff_sh"));
str.push("+");
str.push(parseInt(target.diff_sh_per * 100) / 100);
str.push("%\",diff_bj:\"");
str.push(target.query_prop("diff_bj"));
str.push("%\",releasetime:\"");
str.push(target.query_prop("releasetime") / 1000);
str.push("秒+");
str.push(target.query_prop("releasetime_per"));
str.push("%\",busy:\"");
str.push(target.query_prop("busy") / 1000);
str.push("秒+");
str.push(target.query_prop("busy_per"));
str.push("%\",diff_busy:\"");
str.push(target.query_prop("diff_busy") / 1000);
str.push("秒+");
str.push(target.query_prop("diff_busy_per"));
str.push("%\",distime:\"");
str.push(target.query_prop("distime") / 1000);
str.push("秒+");
str.push(target.query_prop("distime_per"));
str.push("%\",expend_mp:\"");
str.push(target.query_prop("expend_mp"));
str.push("+");
str.push(target.query_prop("expend_mp_per"));
str.push("%\",dazuo_per:\"");
str.push(target.query_prop("dazuo_per"), '%');
let per = WORLD.DATA.query_temp('dazuo_per', 0) + target.family.query_temp('dazuo_per', 0);
if (per > 0) {
str.push('+', per, '%');
}
str.push('",study_per:"');
str.push(target.query_prop("study_per") + me.int, '%');
per = WORLD.DATA.query_temp('study_per', 0) + target.family.query_temp('study_per', 0);
if (per > 0) {
str.push('+', per, '%');
}
str.push('",lianxi_per:"');
str.push(target.query_prop("lianxi_per") + me.int * 2, '%');
per = WORLD.DATA.query_temp('lianxi_per', 0) + target.family.query_temp('lianxi_per', 0);
if (per > 0) {
str.push('+', per, '%');
}
str.push('",downside_per:"');
str.push(target.query_prop("diff_downside_per"));
str.push('%"}');
me.send(str.join(""));
}

281
world/cmd/dialog/shop.js Normal file
View File

@@ -0,0 +1,281 @@
this.inherits(COMMAND);
this.command = "shop";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.regex = /(?:(\w+)\s+(\d+))/;
this.enter = function (me, par, count) {
if (me.query_temp("new")) return me.notify("你先完成新手指导再说。");
if (!me.is_player) return me.notify("你不能购买。");
if (!this.list)
this.load_selllist();
if (count != undefined) {
var item = this.list.get(par);
if (!item) return me.notify("商店不出售这个东西。");
if (item.is_show && item.is_show(me) === false) return me.notify("商店不出售这个东西。");
count = parseInt(count);
if (!(count > 0)) return;
if (item.limit > 0 && me.query_temp(item.limit_key, 0) + count > item.limit) {
return me.notify(item.name + "到达" + (item.limit_time < 3 ?
["本日", '本周', '本月'][item.limit_time] : "") + "购买上限。");
}
if (item.max > 0 && me.query_temp(item.max_key, 0) + count > item.max) {
return me.notify("没有这么多的" + item.name + "出售了。");
}
if (item.on_buy && item.on_buy(me, count) === false) return;
let discount = 1;
if (item.query_discount) discount = item.query_discount(me);
else discount = item.discount ?? 1;
let need_money = 0;
if (item.mtype === 0) {
need_money = item.value * count * 10000;
if (discount < 1) need_money = need_money * discount;
need_money = parseInt(need_money);
if (!(me.money >= need_money)) {
return me.notify("你没有那么多的银两。");
}
me.add_money(-need_money, "购买" + item.name + "");
} else if (item.mtype === 1) {
need_money = item.value * count;
if (discount < 1) need_money = need_money * discount;
need_money = parseInt(need_money);
if (!(me.cash_money >= need_money)) {
return me.notify("你没有那么多的元宝。");
}
me.add_cash(-need_money, "购买" + item.name + "");
} else {
need_money = item.value * count;
if (discount < 1) need_money = need_money * discount;
need_money = parseInt(need_money);
if (!(me.query_temp('my', 0) >= need_money))
return me.notify("你没有那么多的古币。");
me.add_temp('my', -need_money);
}
var obj = me.add_obj(item.path, count);
me.notify("你从商店里购买了" + obj.unit_name(count) + "。");
if (item.limit > 0) {
let val = 0;
if (item.limit_time === 0) {
val = me.add_temp(item.limit_key, count, UTIL.diff_time());
} else if (item.limit_time === 1) {
val = me.add_temp(item.limit_key, count, UTIL.diff_week_time());
} else if (item.limit_time === 2) {
val = me.add_temp(item.limit_key, count, UTIL.diff_month_time());
} else if (item.limit_time > 10000) {
val = me.add_temp(item.limit_key, count, item.limit_time);
}
// me.send(`{"type":"dialog","dialog":"shop",item:["${item.id}",${val}],money:[${me.money},${me.cash_money}]}`);
for (let x of this.list_keys) {
if (x.limit_key === item.limit_key) {
me.send(`{"type":"dialog","dialog":"shop",item:["${x.id}",${Math.min(val, x.limit)}],${format_moneys(me)}}`);
}
}
} else {
me.send(`{"type":"dialog","dialog":"shop",${format_moneys(me)}}`);
}
if (item.max > 0) {
let val = me.add_temp(item.max_key, count);
if (val >= item.max) {
me.send(`{"type":"dialog","dialog":"shop",remove:"${item.id}"}`);
item.on_full && item.on_full(me);
}
}
if (item.mtype === 1 && item.rcash) {
me.add_money(need_money * 10000);
me.notify('你获得' + need_money + '两<hiy>黄金</hiy>。');
}
WORLD.add_recover_obj(me, {
name: obj.unit_name(count),
count: count,
value: need_money,
limit_key: item.limit > 0 ? item.limit_key : null,
max_key: item.max_key,
id: obj.id,
rcash: item.rcash,
path: obj.path
}, 12, item.mtype);
return;
}
if (par && par === this.idx)
return me.send(`{"type":"dialog","dialog":"shop",${format_moneys(me)}}`);
var str = ['{"type":"dialog","dialog":"shop","selllist":['];
for (let i = 0; i < this.groups.length; i++) {
if (i > 0) str.push(',[');
else str.push('[');
for (let item of this.groups[i]) {
if (item.is_show && item.is_show(me) === false) continue;
str.push('["', item.id, '","', item.name, '","', item.desc, '"');
str.push(',', item.value, ',', item.grade, ',');
if (item.query_discount) str.push(item.query_discount(me));
else str.push(item.discount ?? 1);
if (item.limit > 0)
str.push(',', item.limit, ',', me.query_temp(item.limit_key, 0), '');
else if (item.max > 0)
str.push(',', item.max, ',', me.query_temp(item.max_key, 0), '');
str.push('],');
}
str.push('0]');
}
str.push('],', format_moneys(me));
str.push(`,idx:"`, this.idx, `"}`);
me.send(str.join(""));
}
function format_moneys(me) {
return `money:[${me.money},${me.cash_money}]`;
// return `money:[${me.money},${me.cash_money},${me.query_temp('my', 0)}],mtype:"枚<hij>古币</hij>"`;
}
this.list = null;
this.list_keys = null;
this.idx = null;
this.load_selllist = function () {
this.list = new Map();
this.list_keys = [];
this.idx = UTIL.create_id();
for (let i = 0; i < this.groups.length; i++) {
for (let item of this.groups[i]) {
item.mtype = i;
let obj = OBJ.CREATE(item.path);
if (!obj) continue;
item.name = obj.name;
item.unit = obj.unit;
item.grade = obj.grade;
item.id = Object.getPrototypeOf(obj).id + i.toString();
this.list.set(item.id, item);
if (item.limit_key) {
this.list_keys.push(item);
}
}
}
}
//去掉元宝,每周兑换,按月领取,黄金频率降低
function query_age_discount(me) {
var dt = Date.now() - me.reg_time * 60000;
let age = Math.floor(dt / 86400000 / 12);
if (age < 1) age = 1;
else if (age > 10) age = 10;
return age / 10;
}
const start_date = new Date(2026, 1, 15, 0, 0);
const end_date = new Date(2026, 1, 24, 0, 0);
this.groups = [
[
{
name: "<hic>扫荡符</hic>", unit: "张", path: "cash/saodang", grade: 2,
desc: "可以快速完成副本,前提是这个副本你已经解锁相关单人难度的扫荡模式", value: 1,
discount: 0.5,
query_discount: query_age_discount,
limit: 50, limit_time: 0, limit_key: "shp1"
},
{
name: "<hic>天师符</hic>", unit: "张", grade: 3,
path: "cash/tianshifu", desc: "可使你原地复活,不用跑路", value: 5,
query_discount: query_age_discount,
limit: 10, limit_time: 0, limit_key: "shp2"
},
{
name: "<hig>背包扩充</hig>", unit: "块", grade: 1,
path: "cash/pack_add", desc: "使你的背包扩充10格最大100格", value: 128,
limit: 1, limit_time: 1, limit_key: "shp3"
},
{
name: "<hig>仓库扩充</hig>", unit: "块", grade: 1,
path: "cash/ck_add", desc: "使你的仓库扩充10格最大400格", value: 168,
limit: 1, limit_time: 1, limit_key: "shp4"
},
{
name: "<hiy>洗髓丹</hiy>", unit: "颗", grade: 3,
path: "cash/xi", desc: "重置你的先天属性", value: 128,
limit: 5, limit_time: 1, limit_key: "shp5"
},
{
name: "<hic>改名符</hic>", unit: "张", grade: 2,
path: "cash/gaiming", limit: 1, limit_time: 2, limit_key: "shp9",
desc: "更改你的名字", value: 200
},
{
name: "<hio>叛师符</hio>", unit: "张", grade: 5,
path: "cash/tuoli", value: 500,
desc: "重新选择你的门派,会遗忘你当前门派的武功,返还你消耗的潜能(不包括100级前的消耗)",
limit: 3, limit_time: 2, limit_key: "shp6"
},
{
name: "<hio>变性丹</hio>", unit: "颗", grade: 5, value: 500,
path: "cash/bian", desc: "更改性别,会遗忘不符合性别要求的武功,返还你消耗的潜能(不包括100级前的消耗)",
limit: 3, limit_time: 2, limit_key: "shp7",
}
]
, [
{
name: "<hic>扫荡符</hic>", unit: "张", path: "cash/saodang", grade: 2,
desc: "可以快速完成副本,前提是这个副本你已经解锁相关单人难度的扫荡模式", value: 1
},
{
name: "<hic>天师符</hic>", unit: "张", grade: 3,
path: "cash/tianshifu", desc: "可使你原地复活,不用跑路", value: 5
},
{
name: "<hig>背包扩充</hig>", unit: "块", grade: 1,
path: "cash/pack_add", desc: "使你的背包扩充10格最大100格", value: 32
},
{
name: "<hig>仓库扩充</hig>", unit: "块", grade: 1,
path: "cash/ck_add", desc: "使你的仓库扩充10格最大400格", value: 40
},
{
name: "<hiy>洗髓丹</hiy>", unit: "颗", grade: 3,
path: "cash/xi", desc: "重置你的先天属性", value: 80
},
{
name: "<hic>改名符</hic>", unit: "张", grade: 2,
path: "cash/gaiming", desc: "更改你的名字", value: 98
},
{
name: "<hio>叛师符</hio>", unit: "张", grade: 5,
path: "cash/tuoli",
desc: "重新选择你的门派,会遗忘你当前门派的武功,返还你消耗的潜能(不包括100级前的消耗)",
value: 300
},
{
name: "<hio>变性丹</hio>", unit: "颗", grade: 5,
path: "cash/bian", desc: "更改性别,会遗忘不符合性别要求的武功,返还你消耗的潜能(不包括100级前的消耗)",
value: 300
},
{
name: "房契", unit: "颗", grade: 3,
path: "cash/fang", desc: "使用后获得扬州城豪华型住宅,拥有自己的练功房,钓鱼采药的小花园,和管家黄金购买的房子无区别。",
value: 998, max_key: "shpm1", max: 1,
is_show: function (me) {
if (me.query_temp('home', 0) === 2) return false;
if (me.query_bool('gift', 1)) return false;
return true;
},
on_full: function (me) {
me.remove_temp('shpm1');
me.set_bool('gift', 1, true);//gift标志0随从包 1房契 2程灵素
}
}
]
];

418
world/cmd/dialog/stats.js Normal file
View File

@@ -0,0 +1,418 @@
this.inherits(COMMAND);
this.command = "stats";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.regex = /^(\w+)(?:\s+([a-z]+))?(?:\s+(\d+))?$/;
const STATS = WORLD.STATS;
this.enter = function (me, par, fam, index) {
if (!par) {
return;
}
if (par === "top") {
if (index) {
return render_top_item(me, fam, index);
}
return renderTops(me, fam);
}
if (par === "weapon") {
if (index) {
return render_eq(me,fam,index);
}
return renderWeapons(me, fam);
}
if (par === "score") {
if (index)
return render_score_item(me,fam, index);
return renderScore(me, fam);
}
if (par === "exp") {
if (index)
return this.render_item(me,EXP_STATS, fam, index);
this.renderExp(me, fam);
}
if (par === "mp") {
if (index)
return this.render_item(me,MP_STATS,fam, index);
this.renderMP(me, fam);
}
if (par === "money") {
if (index)
return this.render_item(me, MONEY_STATS, fam, index);
this.renderMoney(me, fam);
}
}
this.render_item = function (me, cache, fam, index) {
if (!fam) fam = "all";
let stats = cache[fam];
if (!stats|| !stats.result) return me.send('你要看什么?');
index = parseInt(index) - 1;
if (!(index >= 0 && index < stats.result.length))
return me.send('你要看什么?');
let item = stats.result[index];
if (!item) return me.send('没有这个人。');
let user = WORLD.getUser(item.id);
if (!user) return me.send(item.name + "现在不在线。");
if (user.query_desc) {
me.notify(user.query_desc(me, "look1"));
}
}
function render_top_item(me, fam, index) {
let tops = STATS.TOPS;
if (fam) tops = STATS['tops_' + fam.toUpperCase()] ?? [];
let item = tops[index - 1];
if (!item) return me.send('你要看什么?');
return me.notify(item.query_desc(item, 'look1'));
}
function render_score_item(me, fam, index) {
let tops = STATS.SCORE;
if (fam) tops = STATS.SC_STATS[fam.toUpperCase()] ?? [];
let item = tops[index-1];
if (!item) return me.send('你要看什么?');
let user = WORLD.getUser(item.id);
if (!user) return me.send('对方不在线。');
return me.notify(user.query_desc(me));
}
function renderScore(me, fam) {
let tops = STATS.SCORE;
if (fam) tops = STATS.SC_STATS[fam.toUpperCase()] ?? [];
var str = ['{"type":"dialog","dialog":"stats","scores":['];
for (var i = 0; i < tops.length; i++) {
if (i > 19) break;
var item = tops[i];
if (i > 0) str.push(",");
str.push('["');
str.push(item.name);
str.push('",');
str.push(item.score);
str.push(']');
}
str.push('],score:');
str.push(me.score);
str.push("}");
me.send(str.join(""));
}
// this.query_scores = function () {
// return SCORE_STATS;
// }
// const SCORE_STATS = {};
// function renderScore(me, fam) {
// let stype = fam;
// if (!stype) stype = "all";
// let stats = SCORE_STATS[stype];
// if (!stats) {
// stats = new UserStats(
// (me, item) => {
// return me.score < item.value
// },
// me => {
// return {
// id: me.id,
// value: me.score,
// name: me.color_name
// };
// });
// stats.type = "score";
// stats.fam = fam;
// SCORE_STATS[stype] = stats;
// }
// if (stats.isExpire()) {
// stats.order(',score:'+me.score);
// }
// me.send(stats.cache);
// }
function renderTops(me, stype) {
let tops = STATS.TOPS;
let famid = null;
if (stype) {
famid = stype.toUpperCase();
tops = STATS["tops_" + famid];
if (!tops) return me.send('没有这个榜单。');
}
var str = ['{"type":"dialog","dialog":"stats","tops":['];
for (var i = 0; i < tops.length; i++) {
var item = tops[i];
if (i > 0) str.push(",");
str.push('["', item.long_name(),'",',item.score,']');
}
if (!stype || famid === me.family.id) {
str.push('],top:', (me.query_temp(stype ? "top_fam" : "top", 0)));
str.push(',sc:', me.query_temp(stype ? "top_fam_sc" : "top_sc", 0));
} else {
str.push('],top:0');
str.push(',sc:0');
}
str.push(',fam:"', stype,'"');
str.push("}");
me.send(str.join(""));
}
function render_eq(me, type,index) {
if (!type) type = 'weapon';
let eqs = STATS.EQ_STATS[EQUIP_TYPE[type.toUpperCase()]] ?? [];
let wea = eqs[index - 1];
me.send(wea.desc);
}
function renderWeapons(me,type) {
var str = ['{"type":"dialog","dialog":"stats","weapons":['];
if (!type) type = 'weapon';
let eqs = STATS.EQ_STATS[EQUIP_TYPE[type.toUpperCase()]]??[];
for (var i = 0; i < eqs.length; i++) {
if (i > 9) break;
var item = eqs[i];
if (i > 0) str.push(",");
str.push('["');
if (item.name) {
str.push('<wht>');
str.push(item.name);
str.push('的</wht>');
str.push(item.wname);
} else {
str.push('无');
}
str.push('",',item.score,']');
}
str.push(']');
str.push("}");
me.send(str.join(""));
}
const EXP_STATS = {};
this.renderExp = function (me, fam) {
let stype = fam;
if (!stype) stype = "all";
let stats = EXP_STATS[stype];
if (!stats) {
stats = new UserStats(
(me, item) => { return me.exp < item.value },
me => {
return {
id: me.id,
value: me.exp,
name: me.color_name
};
});
stats.type = "exp";
stats.fam = fam;
EXP_STATS[stype] = stats;
}
if (stats.isExpire()) {
stats.order();
}
me.send(stats.cache);
}
const MONEY_STATS = {};
this.renderMoney = function (me, fam) {
let stype = fam;
if (!stype) stype = "all";
let stats = MONEY_STATS[stype];
if (!stats) {
stats = new UserStats(
(me, item) => { return me.money < item.value },
me => {
return {
id: me.id,
value: me.money,
name: me.color_name
};
});
stats.type = "money";
stats.formatter = value => {
if (value >= 10000) {
return '"' + Math.floor(value / 10000) + "两黄金" + '"';
}
if (value > 100) {
return '"' + Math.floor(value / 100) + "两白银" + '"';
}
if (value > 0) {
return '"' + Math.floor(value / 100) + "个铜板" + '"';
}
return '""';
};
stats.fam = fam;
MONEY_STATS[stype] = stats;
}
if (stats.isExpire()) {
stats.order();
}
me.send(stats.cache);
}
const MP_STATS = {};
this.renderMP = function (me, fam) {
let stype = fam;
if (!stype) stype = "all";
let stats = MP_STATS[stype];
if (!stats) {
stats = new UserStats(
(me, item) => { return me.max_mp < item.value },
me => {
return {
id: me.id,
value: me.max_mp,
name: me.color_name
};
});
stats.type = "mp";
stats.fam = fam;
MP_STATS[stype] = stats;
}
if (stats.isExpire()) {
stats.order();
}
me.send(stats.cache);
}
function UserStats(order,added) {
this.result = null;
this.cache = null;
this.time = 0;
this.lessThan = order;
this.addItem = added;
this.maxCount = 20;
this.type = null;
}
UserStats.prototype.formatter = function (val) {
return val;
}
UserStats.prototype.isExpire = function () {
return Date.now() - this.time > 0;
}
UserStats.prototype.order = function (append) {
this.result = [];
this.time = Date.now() + 60000;
let fam = this.fam;
if (fam) fam = fam.toUpperCase();
for (let i = 0; i < WORLD.USERS.length; i++) {
let user = WORLD.USERS[i];
if (user.user_level > 4) continue;
if (fam && user.family.id !== fam)
continue;
this.queue(user);
}
let str = ['{"type":"dialog","dialog":"stats","items":['];
for (let i = 0; i < this.result.length; i++) {
let user = this.result[i];
if (i > 0) str.push(",");
str.push('["', user.name, '",', this.formatter(user.value),']');
}
str.push(']');
str.push(',"time":', Date.now(), '');
str.push(',"st":"', this.type, '"', append ?? "");
str.push(',"fam":"', this.fam,'"');
str.push("}");
this.cache= str.join("");
}
UserStats.prototype.queue = function (me) {
let index = this.result.length - 1;
if (index < 0) {
this.result.push(this.addItem(me));
return;
}
let user = this.result[index];
if (this.result.length >= this.maxCount && this.lessThan(me,user)) {
return;
}
while (index >= 0) {
user = this.result[index];
if (this.lessThan(me, user)) {
this.result.splice(index + 1, 0, this.addItem(me));
break;
}
index--;
}
if (index < 0) {
this.result.splice(0, 0, this.addItem(me));
}
if (this.result.length >= this.maxCount) {
this.result.length = this.maxCount;
}
}
//this.expStats = [];
//this.expStatsCache = null;
//this.expStatsTime = 0;
//this.maxCount = 50;
//this.orderExpBy = function (me, user) {
// return me.exp > user.exp;
//}
//this.addExpItem = function (me) {
// return {
// id: me.id,
// value: me.exp,
// name: me.color_name
// };
//}
//this.reStats = function (result,func) {
// for (let i = 0; i < WORLD.USERS.length; i++) {
// this.addToExpQueue(WORLD.USERS[i], result, func);
// }
// let str = [];
// for (let i = 0; i < result.length; i++) {
// let user = result[i];
// str.push(i + 1, "、\t", user.name, '\t', user.value, '\r\n');
// }
// let time = new Date();
// str.push("最后更新时间", time.getHours() + ":" + time.getMinutes());
// return str.join("");
//}
//this.addToExpQueue = function (me, result, func) {
// let index = result.length - 1;
// if (index < 0) {
// result.push(func(me));
// return;
// }
// let user = result[index];
// if (result.length >= this.maxCount && user.exp > me.exp) {
// return;
// }
// while (index >= 0) {
// user = result[index];
// if (user.exp > me.exp) {
// result.splice(index + 1, 0, func(me));
// break;
// }
// index--;
// }
// if (index < 0) {
// result.splice(0, 0, func(me));
// }
// if (result.length >= this.maxCount) {
// result.length = this.maxCount;
// }
//}

122
world/cmd/dialog/store.js Normal file
View File

@@ -0,0 +1,122 @@
this.inherits(COMMAND);
this.command = "store";
this.regex = /^(?:(\d+)\s)?(\w+)$/;// /^(?:(\d+))?(?:\s+(\w+))?$/;
this.enter = function (me, count, arg) {
if (arg && arg.length < 2) {
count = arg;
arg = null;
}
if (arg) {
me.items = me.items || [];
let target = me;
if (!me.is_player) {
if (!me.master) return;
target = WORLD.getUser(me.master);
if (!target) return;
}
target.stores = target.stores || [];
if (arg === 'all') return this.store_all(target, me);
let move_item = me.find_obj(arg), store_item = null;
if (!move_item) return me.notify("你要存什么东西?");
const st = { items: target.stores, push_item: me.push_item };
if (target.stores.length >= target.max_store_count) {
if (!move_item.combined)
return me.notify("你的仓库放不下那么多东西了。");
store_item = me.find_obj_bypath(move_item.path, st);
if (!store_item) return me.notify("你的仓库放不下那么多东西了。");
// old_item.count += move_count;
}
let move_count = move_item.count;
if (count !== undefined) {
move_count = parseInt(count);
}
if (!(move_count <= move_item.count)) return me.notify("你要存什么东西?");
move_item = me.remove_item_byid(arg, move_count);
if (move_item.combined && store_item) {
store_item.count += move_count;
move_item = store_item;
} else {
move_item = st.push_item(move_item);
}
// move_item = null, move_count = 0;
// if (count !== undefined) {
// move_count = parseInt(count);
// if (!(move_count >= 0)) return;
// move_item = me.remove_item_byid(arg, move_count);
// if (!move_item) return me.notify("你要存什么东西?");
// } else {
// move_item = me.remove_item_byid(arg);
// if (!move_item) return me.notify("你要存什么东西?");
// move_count = move_item.count;
// }
// move_item = st.push_item(move_item);
me.send("你把" + UTIL.to_c(move_count) + move_item.unit + move_item.color_name + "存入仓库。");
return me.notify('{type:"dialog",dialog:"list",id:"' +
arg + '",storeid:"' + move_item.id + '",store:' +
move_count + ',sum:' + target.stores.length + '}');
}
if (!me.is_player) return;
var items = me.stores || [];
var str = ['{"type":"dialog","dialog":"list","stores":['];
if (me.max_store_count > 200) {
var otype = parseInt(count ?? 0);
if (!(otype >= 0)) otype = 0;
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (item.otype !== otype) continue;
if (str.length > 1) str.push(",");
str.push(item.format_to_pack());
}
str.push(']');
str.push(",max_store_count:");
str.push(me.max_store_count);
str.push(",sum:");
str.push(items.length);
} else {
for (var i = 0; i < items.length; i++) {
if (i > 0) str.push(",");
str.push(items[i].format_to_pack());
}
str.push(']');
str.push(",max_store_count:");
str.push(me.max_store_count);
}
str.push("}");
me.send(str.join(""));
}
this.store_all = function (target, me) {//target仓库所有人=玩家 me玩家或者随从
// if (me !== notifier) return;
if (me.query_temp('store_all'))
return me.send('背包的道具已经自动合并到仓库中。');
const idToIndex = new Map();
for (let i = 0; i < target.stores.length; i++) {
let item = target.stores[i];
if (!item.combined) continue;
idToIndex.set(item.path, i);
}
for (let i = 0; i < me.items.length; i++) {
let move_item = me.items[i];
if (!move_item.combined) continue;
const indexIn = idToIndex.get(move_item.path);
if (indexIn >= 0) {
let store_item = target.stores[indexIn];
store_item.count += move_item.count;
me.send("你把" + UTIL.to_c(move_item.count) + move_item.unit + move_item.color_name + "存入仓库。");
target.notify('{type:"dialog",dialog:"list",id:"' + move_item.id + '",storeid:"' + store_item.id + '",store:' + move_item.count + '}');
me.items.splice(i, 1);
i--;
}
}
me.send('你将背包中的道具自动合并到仓库中已有的道具。');
me.set_temp('store_all', 1, 6000);
}

64
world/cmd/dialog/task.js Normal file
View File

@@ -0,0 +1,64 @@
this.inherits(COMMAND);
this.command = "task";
this.regex = /(\w+)\s+(\w+)(?:\s(\w+))?(?:\s(\w+))?/;
this.allow_state = true;
this.enter = function (me, tid, cmd, oid) {
if (!tid || !cmd) return;
if (!me.is_player || !WORLD.is_server(me)) return;
if (tid === 'all') return this.tasks_fin(me);
let task = USERTASK.GET(tid);
if (!task) return me.notify("没有这个任务。");
let target = null;
if (!oid && !(ALLOW_COMMANDS[cmd])) {
oid = cmd;
cmd = 'start';
}
if (oid) {
target = me.find_obj(oid, me.environment);
if (!target) return me.notify("这里没有这个人。");
}
switch (cmd) {
case "fin":
this.task_fin(me, task);
break;
case "start":
task.start(me, target);
break;
case "giveup":
task.giveup(me);
break;
case "fin2":
this.task_fin(me, task, 'ok');
break;
}
}
const ALLOW_COMMANDS = {
start: true,
giveup: true,
fin: true,
fin2: true
};
this.task_fin = function (me, task, par) {
if (task.on_finish(me, par)) {
const obj = {};
obj.type = "dialog";
obj.dialog = "tasks";
obj.id = task.id;
obj.state = task.query_state(me);
if (obj.state) {
obj.title = task.query_title(me);
obj.desc = task.query_desc(me);
}
return me.notify(JSON.stringify(obj));
}
}
this.tasks_fin = function (me) {
for (let i = 0; i < WORLD.TASKS.length; i++) {
const task = WORLD.TASKS[i];
if (task.query_state(me) === 2) {
this.task_fin(me, task);
}
}
}

25
world/cmd/dialog/tasks.js Normal file
View File

@@ -0,0 +1,25 @@
this.inherits(COMMAND);
this.command = "tasks";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.enter = function (me, arg) {
var obj = {};
obj.type = "dialog";
obj.dialog = "tasks";
obj.items = [];
for (var i = 0; i < WORLD.TASKS.length; i++) {
var task = WORLD.TASKS[i];
var state=task.query_state(me);
if (!state) continue;
obj.items.push({
id:task.id,
title: task.query_title(me),
desc: task.query_desc(me),
state: state,
});
}
me.notify( JSON.stringify(obj));
}

13
world/cmd/dialog/trade.js Normal file
View File

@@ -0,0 +1,13 @@
this.inherits(COMMAND);
this.command = "trade";
this.allow_fight = false;
this.enter = function (me, arg) {
if (!arg) return;
var target = me.find_obj(arg, me.environment);
if (!target) {
return me.notify("这里没有这个人。");
}
if (target.is_player) return me.notify("你不能和玩家交易。");
me.send('{"type":"dialog","dialog":"trade",target:"' + target.id + '",name:"' + target.name + '"}');
}

70
world/cmd/extend/auto.js Normal file
View File

@@ -0,0 +1,70 @@
this.inherits(COMMAND);
this.command = "auto";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.admin = true;
this.enter = function (me, type) {
}
WORLD.check_user_next = function (me) {
var type = me.query_setting("auto_work");
if (!type || !me.hp || me.is_faint || me.is_busy || me.environment.is_fb()) return;
me.state = null;
me.send("{type:\"state\"}");
me.environment.item_changed(me, true);
if (type == 1) {
me.do_command("wakuang");
} else {
var str = type.split(",");
for (var i = 0; i < str.length; i++) {
me.command(str[i]);
}
}
return false;
}
WORLD.auto_get = function (me, corpse, npc) {
if (npc && npc.damages) {
for (var i = 0; i < npc.die_room.items.length; i++) {
var item = npc.die_room.items[i];
if (item.is_player && item.query_setting("auto_get") && npc.damages[item.id]) {
//item.do_command('get', "all from " + corpse.id);
WORLD.COMMANDS['get'].enter(item, "", "all", corpse.id);
}
}
} else if (me && me.is_player) {
if (!me.is_here(corpse) || !me.query_setting("auto_get") || me.state || !me.hp) return;
//me.do_command('get', "all from " + corpse.id);
WORLD.COMMANDS['get'].enter(me, "", "all", corpse.id);
}
//if (me && me.is_player) {
// me.add_temp('killed', 1, UTIL.diff_time());
//}
}
WORLD.auto_pfm = function (me, target) {
if (me.hp <= 0 || target.hp <= 0) return;
if (me.query_setting("auto_pfm")) {
var setting = me.query_setting("auto_pfm");
if (!setting.split) return WORLD.log(me, 'auto', setting);
var str = setting.split(",");
for (var i = 0; i < str.length; i++) {
var ps = str[i].split(".");
WORLD.COMMANDS["perform"].enter(me, ps[0], ps[1]);
}
}
if (target.query_setting("auto_pfm2")) {
var str = target.query_setting("auto_pfm2").split(",");
for (var i = 0; i < str.length; i++) {
var ps = str[i].split(".");
WORLD.COMMANDS["perform"].enter(target, ps[0], ps[1]);
}
}
}

446
world/cmd/extend/biwu.js Normal file
View File

@@ -0,0 +1,446 @@
this.inherits(COMMAND);
this.command = "biwu";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.biwu_state = {
allow_busy: false,
allow_state: false,
allow_die: false,
allow_die: false
};
const STATS = WORLD.STATS;
this.regex = /^(emei|wudang|shaolin|huashan|xiaoyao|gaibang|shashou|none)?\s*(\d+)(?:\s+(ok))?$/;
this.enter = function (me, fam, type, par) {
if (!me.can_trans()) return;
if (!WORLD.COMMANDS.events.check_command(this.biwu_state, me)) return;
let index = parseInt(type);
if (!(index > 0 && index < 11)) return me.notify('错误的对手编号。');
if (fam && me.family.id !== fam.toUpperCase())
return me.notify('你只能挑战自己门派的高手榜单。');
const top_key = fam ? "top_fam" : "top";
let top = me.query_temp(top_key, 999);
if (top === index) {
return me.notify('你不能挑战自己。');
// return me.send_commands('biwu recopy', '更新擂台使用的技能和装备属性');
}
if (top <= index)
return me.notify('你只能挑战积分比你高的对手。');
let max = Math.floor(me.query_temp("ex_jl", 0) / 40);
let count = me.query_temp('top_c', 0);
if (count >= max) return me.notify('你今天的挑战次数已经用尽每日精力每消耗40增加一次挑战机会。');
if (!par) {
me.notify(`<hig>当你每消耗40精力后增加一次挑战机会当前可挑战次数${count}/${max}</hig>`);
if (count < max) {
fam = fam ? (fam + " ") : "";
return me.send_commands('biwu ' + fam + type + " ok", '确定挑战');
}
return;
}
if (me.state) return me.send('你正在' + me.state.title + "。");
if (me.status && me.status.length)
return me.send('你需要清理掉自身的增益效果才可上擂台挑战。');
if (me.hp / me.max_hp < 0.9 || me.mp / me.max_mp < 0.9)
return me.send('你先调整好自身的状态再来挑战吧。');
this.start_biwu(me, fam, index - 1);
}
this.start_biwu = function (me, fam, index) {
let tops = STATS.TOPS;
if (fam) tops = STATS['tops_' + fam.toUpperCase()];
if (!tops) return me.send('错误的对手,无法挑战。');
var npc = tops[index];
if (!npc) {
return me.send(me, "错误的对手。");
}
if (me.moveto('yz/leitai/leitai') === false) return;
npc = this.create_npc(npc);
let room = me.environment;
me.die = challenge_end;
npc.die = challenge_end;
room.on_heart_beat = this.on_heart_beat;
room.biwu_step = 0;
me.auto_pfm = true;
me.check_pfms = this.check_pfms;
me.init_pfms = this.init_pfms;
npc.fight_type = 0;
room.item_changed(npc, true, npc.name + "跳上了擂台。");
npc.full();
me.add_temp('top_c', 1, UTIL.diff_time());
me.set_temp('biwu_fam', fam);
me.call_interval(x => {
me.send_message("\n<hic>挑战还有" + (3 - x) + "秒钟正式开始!</hic>", true);
},
1000,
3,
function () {
npc.do_kill(me);
}
);
me.send('{type:"dialog",dialog:"stats",close:true}');
}
this.surrender = function (me) {
// if (!me.fight_type)
// return me.send('你还没开始战斗呢。');
let npc = me.environment.items[1];
if (npc.is_player) {
npc = me.environment.items[0];
}
me.end_fight();
npc.end_fight();
challenge_over(me, 2);
challenge_fail(me);
}
this.on_heart_beat = function (dt) {
this.biwu_step++;
if (this.biwu_step < 60) return;
if (!this.items.length) {
return;
}
let me = this.items[0], npc = this.items[1];
if (npc && npc.is_player) {
me = npc;
npc = this.items[0];
}
me.end_fight();
npc?.end_fight();
challenge_over(me, 2);
challenge_fail(me);
me.notify("<yel>挑战超时,自动离开擂台。</yel>");
}
function challenge_end(killer) {
if (this.on_die && this.on_die(killer) === false) {
this.hp = 1;
return false;
}
let me = killer, npc = this;
if (this.is_player) {
npc = killer, me = this;
}
if (me.hp <= 0) me.hp = 1;
me.end_fight();
npc.end_fight();
if (killer === me) {
challenge_over(me, 1, npc);
challenge_success(me, npc);
} else {
challenge_over(me, 0, npc);
challenge_fail(me, npc);
// me.notify("<cyn>挑战失败,你的积分保持不变。</cyn>");
}
}
function challenge_over(me, result, npc) {
me.environment.on_heart_beat = null;
me.die = USER.prototype.die
me.auto_pfm = false;
me.auto_skills = null;
me.check_pfms = USER.prototype.check_pfms;
me.init_pfms = USER.prototype.init_pfms;
let leitai = me.environment;
if (result === 0)
me.moveto('yz/leitai/ltx', null, me.name +
"被" + npc.name + "一脚踢下了擂台。", 'fightend');
else if (result === 1) {
me.moveto('yz/leitai/ltx', null, me.name +
"走了下来。", 'fightend');
} else {
me.moveto('yz/leitai/ltx', null, me.name +
"被赶下来。", 'fightend');
}
leitai.items.length = 0;
me.clear_downside(true);
}
function challenge_fail(me, npc) {
me.notify("<cyn>挑战失败,擂台积分保持不变。</cyn>");
me.remove_temp('biwu_fam');
}
function challenge_success(me, npc) {
const fam = me.query_temp('biwu_fam');
let top_key = fam ? "top_fam_sc" : "top_sc";
let sc = me.query_temp(top_key, 0);
let target_sc = npc.score ?? 0;
let add = Math.floor((target_sc - sc) / 2);
if (add === 0) {
add = 1;
}
if (add > 0) {
sc += add;
me.set_temp(top_key, sc);
} else {
add = 0;
}
if (fam)
me.notify("<hig>挑战成功,当前" + me.family.name + "榜单积分" + sc + "。</hig>");
else
me.notify("<hig>挑战成功,当前总榜积分" + sc + "。</hig>");
if (add > 0)
WORLD.COMMANDS.biwu.updatePlayerStats(me, sc, fam);
me.remove_temp('biwu_fam');
}
const COPY_TEMPS = ["copy_pfm_sword",//"copy_pfm",
"copy_pfm_unarmed", "jiuyang", "zyy"];
const COPY_PROPS = ["str", "con", "dex", "int", "gender", "max_mp", "exp", "pot", "kar", "per"
, "name", "hp", "max_hp", "mp"];
this.create_npc = function (player, fam) {
var npc = NPC.CLONE('pub/gaoshou1');
for (var i = 0; i < COPY_PROPS.length; i++) {
npc[COPY_PROPS[i]] = player[COPY_PROPS[i]];
}
npc.equipment = [];
if (player.equipment) {
var eqs = player.equipment;
for (var i = 0; i < eqs.length; i++) {
if (!eqs[i]) continue;
var obj = eqs[i].clone(player);
npc.equipment[obj.eq_type] = obj;
if (obj.on_eq) obj.on_eq(npc);
}
}
npc.skills = {};
if (player.skills) {
for (var sk in player.skills) {
let item = player.skills[sk];
npc.skills[sk] = { ...item };
}
}
npc.attack_count = 3;
if (player.is_player) {
npc.title = player.query_title("family");
npc.age = player.query_age();
npc.userid = player.id;
npc.score = player.query_temp(fam ? 'top_fam_sc' : "top_sc", 0);
npc.top_index = player.query_temp(fam ? 'top_fam' : "top", 0);
npc.id = "top_" + (fam ? fam.toUpperCase() : "") + "_" + (npc.top_index - 1);
} else {
npc.title = player.title;
npc.age = player.age;
npc.userid = player.userid;
npc.score = player.score;
npc.top_index = player.top_index;
}
for (let key of COPY_TEMPS) {
let value = player.query_temp(key);
if (value) {
npc.set_temp(key, value);
}
}
npc.clear_prop();
npc.init();
npc.recount = this.recount;
npc.recount();
npc.check_pfms = this.check_pfms;
npc.init_pfms = this.init_pfms;
if (npc.force_skill.on_relive) {
npc.force_skill.on_relive(npc);
}
npc.hp = npc.max_hp;
return npc;
}
this.recount = function () {
this.max_hp = parseInt(this.con * 5 + (this.max_mp * this.query_force_rad() + this.query_prop("max_hp") + this.query_prop("con") * this.con) * (100 + this.query_prop("hp_per")) / 100);
this.max_hp = this.max_hp;
if (this.max_hp < 1) this.max_hp = 1;
if (this.hp > this.max_hp) this.hp = this.max_hp;
this.gjsd = 4000 - this.query_prop("gjsd");
if (this.gjsd > 500) {
this.gjsd = parseInt(this.gjsd - (this.gjsd * this.query_prop("gjsd_per") / 100));
}
if (this.gjsd < 500) this.gjsd = 500;
this.gj = parseInt(this.str + (this.query_prop("gj") + this.query_prop("str") * this.str / 10) * (100 + this.query_prop("gj_per")) / 100);
this.fy = parseInt(((this.str + this.con) / 10 + this.query_prop("fy") + this.query_prop("con") * this.con / 10) * (100 + this.query_prop("fy_per")) / 100);
this.mz = parseInt((this.dex / 2 + this.query_prop("mz")) * (100 + this.query_prop("mz_per")) / 100);
this.ds = parseInt((this.dex / 2 + this.query_prop("ds") + this.query_prop("dex") * this.dex / 10) * (100 + this.query_prop("ds_per")) / 100);
this.zj = parseInt((this.str / 2 + this.query_prop("zj") + this.query_prop("str") * this.str / 10) * (100 + this.query_prop("zj_per")) / 100);
this.bj = parseInt(this.dex / 10 + this.query_prop("bj_per"));
if (this.parry_skill && this.parry_skill.on_recount_parry) {
this.zj += this.parry_skill.on_recount_parry(this);
}
if (this.dodge_skill && this.dodge_skill.on_recount_dodge) {
this.ds += this.dodge_skill.on_recount_dodge(this);
}
this.diff_sh_per = this.query_prop('diff_sh_per');
if (this.diff_sh_per > 80) {
this.diff_sh_per = 80 + Math.sqrt((this.diff_sh_per - 80) * 4);
if (this.diff_sh_per > 99.9999) this.diff_sh_per = 99.9999;
}
this.diff_sh_per += this.query_prop('diff_sh_per2');
}
this.check_pfms = function (target) {
if (!this.auto_skills) this.init_pfms()
if (!this.equipment[0] && this.items[0] && this.random(3) === 0) {
return this.equip(this.items[0]);
}
if (this.auto_eqs.length > 0 && this.random(3) === 1) {
let eqs = [];
for (var i = 0; i < this.auto_eqs.length; i++) {
let obj = this.auto_eqs[i];
let key = "disobj_" + (obj.distype || obj.id);
if (obj.distime && this.query_temp(key)) {
continue;
}
eqs.push(obj);
}
if (eqs.length > 0) {
let obj = eqs.random();
if (obj.on_use(this) !== false) {
if (obj.distime) {
this.set_temp("disobj_" + (obj.distype || obj.id), 1, obj.distime);
}
return;
}
}
}
return CHARACTER.prototype.check_pfms.call(this, target);
}
this.init_pfms = function () {
CHARACTER.prototype.init_pfms.call(this);
this.auto_eqs = [];
for (var i = 1; i < this.equipment.length; i++) {
if (this.equipment[i] && this.equipment[i].on_use) {
this.auto_eqs.push(this.equipment[i]);
}
}
}
const TOPS = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
this.setStatsTitle = function (player, index, fam) {
if (fam) return;//门派称号先不用
if (index < 10) {
let title = "天下第" + TOPS[index];
player.add_title(title, "top");
player.notify('<hiy>你的高手榜称号变动为【'
+ title + '】。</hiy>');
}
else
player.add_title(null, "top");
}
this.checkStats = function (player) {
let top = player.query_temp("top");
if (top) {
this.check_fams_stats(player, STATS.TOPS, top);
}
top = player.query_temp("top_fam");
if (top) {
this.check_fams_stats(player, STATS['tops_' + player.family.id], top, player.family.id);
}
}
this.check_fams_stats = function (player, tops, top, fam) {
let npc = tops[top - 1];
if (!npc) return;
let top_key = fam ? "top_fam" : "top";
if (npc.userid !== player.id) {
for (let i = 0; i < tops.length; i++) {
if (tops[i].userid === player.id) {
player.set_temp(top_key, i + 1);
return this.setStatsTitle(player, i, fam);
}
}
player.remove_temp(top_key);
this.setStatsTitle(player, 9999, fam);
}
}
this.updateTopStats = function (top, index, fam) {
let top_user = top.userid ? WORLD.getUser(top.userid) : null;
let top_key = fam ? "top_fam" : "top";
if (index > 0) {
top.top_index = index + 1;
top.id = "top_" + (fam ? fam.toUpperCase() : "") + "_" + index;
if (top_user) {
top_user.set_temp(top_key, index + 1);
this.setStatsTitle(top_user, index, fam);
}
} else {
top.top_index = -1;
if (top_user) {
top_user.remove_temp(top_key);
this.setStatsTitle(top_user, 10, fam);
}
}
}
this.checkTopindex = function (sc, tops) {
let index = -1;
for (let i = tops.length - 1; i >= 0; i--) {
let item = tops[i];
if (item.score >= sc) return index;
index = i;
}
return 0;
}
this.updatePlayerStats = function (player, sc, fam) {
//玩家挑战没上榜不用管,挑战失败减分也不会下榜,因为没有记录以下的玩家
//这里只会上升不会下降
let tops = STATS.TOPS;
let top_key = "top";
if (fam) {
tops = STATS['tops_' + fam.toUpperCase()];
top_key = "top_fam";
}
if (!tops) return;
let index = this.checkTopindex(sc, tops);
if (index < 0) {
return;
}
let top = player.query_temp(top_key, 0);
if (top > 0) {
tops[top - 1].score = sc;
if (top <= index + 1) return;
tops.splice(top - 1, 1);
}
player.set_temp(top_key, index + 1);
tops.splice(index, 0, this.create_npc(player, fam));
if (tops.length > 10) {
this.updateTopStats(tops.splice(tops.length - 1)[0], -1, fam);
}
if (top == 0) {
top = tops.length;
}
for (let i = index + 1; i < top; i++) {
this.updateTopStats(tops[i], i, fam);
}
if (!fam) {
this.setStatsTitle(player, index);
// player.notify('<hiy>恭喜你获得称号【' + "天下第" + TOPS[index] + '】</hiy>');
}
}
this.biwu_watch = function (me) {
}

18
world/cmd/extend/ex.js Normal file
View File

@@ -0,0 +1,18 @@
this.inherits(COMMAND);
this.command = "ex";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.admin = true;
this.enter = function (me, type) {
return false;
}
this.append_sklf = function (env) {
}
this.on_enter_fb = function (me, env) {
}

View File

@@ -0,0 +1,11 @@
this.inherits(COMMAND);
this.command = "pm";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.admin = true;
this.regex = /^(\w+)(?:\s(\w+))?(?:\s(\w+))?$/;
this.enter = function (me, type, par, par2) {
return me.send('未开放');
}

10
world/cmd/extend/party.js Normal file
View File

@@ -0,0 +1,10 @@
this.inherits(COMMAND);
this.command = "party";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.admin = true;
this.regex = /^(\w+)(?:\s+(.+?))?(?:\s+(\w+))?$/;
this.enter = function (me, cmd, par, par2) {
}

80
world/cmd/obj/buy.js Normal file
View File

@@ -0,0 +1,80 @@
this.inherits(COMMAND);
this.command = "buy";
this.regex = /^(?:(\d+)\s)?(\w+)(?:\s+from\s+(.+?))?$/;
this.enter = function (me, count, objid, from) {
var target;
if (from) {
target = me.find_obj(from, me.environment);
if (!target) {
return me.notify("你要从哪买东西?");
}
if (target == me) {
return me.notify("你自己的东西还用得着买吗?");
}
}
var buy_count = 1;
if (count) buy_count = parseInt(count);
if (!(buy_count > 0)) return;
if (!target) return;
var selllist = target.sell_list;
if (target.on_sell) {
selllist = target.on_sell(me, buy_count, objid);
}
if (selllist === true) return;
if (!selllist) {
return me.notify(target.name + "不出售任何东西。");
}
var sellitem = null;
for (var i = 0; i < selllist.length; i++) {
if (selllist[i].id == objid) {
sellitem = selllist[i];
break;
}
}
if (!sellitem) return me.notify(target.name + "不出售这个东西。");
if (!sellitem.combined && buy_count > 1) {
buy_count = 1;
me.notify("<cyn>不可堆叠道具最大购买数量1</cyn>");
}
if (me.is_full(sellitem.combined ? 0 : buy_count)) {
return me.notify("你拿不下那么多东西。");
}
var need_money = sellitem.value * buy_count;
if (need_money > (me.money || 0)) {
return me.notify("你没有那么多的钱。");
}
if (target.before_sell_item) {
if (target.before_sell_item(me, sellitem, buy_count) === false)
return;
}
if ((!target.is_player && sellitem.count == -1)) {
me.money -= need_money;
me.add_temp('money1', need_money, UTIL.diff_time());
sell_obj = me.add_obj(sellitem.path, buy_count);
if (sell_obj) {
me.send_room("$N从$n购买了" + UTIL.to_c(buy_count) + sell_obj.unit + sell_obj.color_name + "。", target);
if (target.on_sell_item) target.on_sell_item(me, sell_obj, count);
}
} else {
if (sellitem.count >= buy_count) {
sellitem.count -= buy_count;
me.money -= need_money;
me.add_temp('money1', need_money, UTIL.diff_time());
sell_obj = me.add_obj(sellitem.path, buy_count);
if (sell_obj) {
me.send_room("$N从$n购买了" + UTIL.to_c(buy_count) + sell_obj.unit + sell_obj.color_name + "。", target);
}
me.send('{type:"dialog",dialog:"list",id:"' + sellitem.id + '",sell:' + buy_count + '}');
if (target.on_sell_item) target.on_sell_item(me, sell_obj, count);
} else {
return me.notify(target.name + "没有那么多的" + sellitem.color_name + "买给你。");
}
//玩家售卖
}
// me.send('你给他' + UTIL.moneyToStr(need_money) + "。");
}

65
world/cmd/obj/checkobj.js Normal file
View File

@@ -0,0 +1,65 @@
this.inherits(COMMAND);
this.command = "checkobj";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.regex = /^(\w+?)\s+from\s+(\w+)$/;
this.enter = function (player, objid, type) {
var obj = null;
if (type == "item") {
obj = player.find_obj(objid);
} else if (type == "eq") {//装备和物品只能检查自己的
if (player.equipment) {
for (var i = 0; i < player.equipment.length; i++) {
if (player.equipment[i]&&player.equipment[i].id == objid) {
obj = player.equipment[i];
break;
}
}
}
} else if (type == "store") {
obj = player.find_obj_byid(player.stores, objid);
} else if (type == "sj") {
obj = player.find_obj_byid(player.books, objid);
} else {
var target = player.find_obj(type, player.environment);
if (!target) return player.notify("你要从谁那里看?");
if (target.on_checkobj) {
obj = target.on_checkobj(player, objid);
} else if (target.sell_list) {
var selllist = target.sell_list;
if (target.on_sell) {
selllist = target.on_sell(player);
}
if (!selllist) {
return player.notify(target.name + "不出售这个东西。");
}
obj = player.find_obj_byid(selllist, objid);
}
}
if (!obj) {
return player.notify("你要看什么?");
}
player.notify(query_obj_desc(player,obj, type));
}
function query_obj_desc(player,obj, type) {
var json = {};
json.type = "dialog";
json.dialog = "pack";
json.from = type;
json.id = obj.id;
json.desc = obj.get_desc(player);
if (obj.actions) {
json.commands = [];
for (var key in obj.actions) {
if (obj.actions[key].name)
json.commands.push({ cmd: key, name: obj.actions[key].name });
}
}
return JSON.stringify(json);
}

40
world/cmd/obj/combine.js Normal file
View File

@@ -0,0 +1,40 @@
this.inherits(COMMAND);
this.command = "combine";
this.regex = /^(\w+)(?:\s(\d+))?$/;
this.enter = function (player, objid, count) {
var obj = player.find_obj(objid);
if (!obj) {
return player.notify("你要用什么合成?");
}
if (!obj.combine_count || !obj.combine_to) return player.send(obj.color_name + "不能合成任何东西。");
var result_count = parseInt(count || 1);
if (!(result_count > 0)) return;
var need_count = result_count * obj.combine_count;
if (obj.count < need_count) return player.notify("你身上的" + obj.color_name + "不够合成那么多。");
var remove_obj = player.remove_obj(obj, need_count);
if (!remove_obj) return player.notify("移除" + obj.color_name + "失败。");
let ispacket = obj.grade !== 5 || !obj.path.startsWith('st/st_');
if (ispacket) {
//if (obj.on_combine && obj.on_combine(result_count) == false) return;
let result = player.add_obj(obj.combine_to, result_count);
if (result) {
if (result.is_equipment && result.grade > 5) {
COMMAND.DO("rumor", "听说有人合成了" + result.unit_name(1)+ "。");
}
player.notify("你合成了" + UTIL.to_c(result_count) + result.unit + result.color_name + "。");
} else {
player.notify("合成" + obj.color_name + "失败。");
}
} else {
for (let i = 0; i < result_count; i++) {
let result = player.add_obj(obj.combine_to, 1);
if (result) {
player.notify("你合成了" + UTIL.to_c(1) + result.unit + result.color_name + "。");
}
}
}
}

71
world/cmd/obj/dice.js Normal file
View File

@@ -0,0 +1,71 @@
this.inherits(COMMAND);
this.command = "dice";
this.allow_busy = true;
this.allow_state = true;
this.allow_die = true;
this.allow_faint = true;
this.regex = /^(\d)\s(\w+)$/;
this.enter = function (me, type, objid) {
if (!me.team) return me.send("你没有在队伍里。");
if (!me.team.objs || !me.team.objs.length) return me.send("目前没有等待分配的战利品。");
var item = null;
for (var i = 0; i < me.team.objs.length; i++) {
if (me.team.objs[i].id == objid) {
item = me.team.objs[i];
break;
}
}
if (!item) return me.send("目前没有这个战利品等待分配。");
if (!item.dice) return;
if (!item.dice.users.remove(me.id)) return me.send("目前没有这个战利品等待分配。");
type = parseInt(type);
if (!(type >= 0)) return;
var num = me.random(100) + 1;
var msg = null;
if (type === 2) {
num = 0;
msg = me.name + "放弃" + item.color_name + "。";
} else if (type === 0) {
switch (me.random(5)) {
case 3:
msg = "<hig>" + me.name + ":天灵灵,地灵灵,看我骰子来显灵,这" + item.unit + item.color_name + "是我的了," + num +"点。</hig>";
break;
case 2:
msg = "<hig>" + me.name + "大喝一声:对不住了各位,这" + item.unit + item.color_name + me.callme() + "要了," + num + "点。</hig>";
break;
case 1:
msg = "<hig>" + me.name + "笑眯眯地说道:各位,这" + item.unit + item.color_name + "与" + me.callme() + "有缘," + num + "点。</hig>";
break;
default:
msg = "<hig>" + me.name + "哈哈笑道:运气不错," + me.callme() + "刚好需要这" + item.unit + item.color_name + "" + num + "点。</hig>";
break;
}
num += 100;
} else {
switch (me.random(5)) {
case 3:
msg = "<hic>" + me.name + ":我的,我的,都是我的,说不定运气好,这" + item.unit + item.color_name + "没人要就是我的了," + num + "点。</hic>";
break;
case 2:
msg = "<hic>" + me.name + "嘿嘿笑道:这" + item.unit + item.color_name + "不错,可以卖个好价钱," + num + "点。</hic>";
break;
case 1:
msg = "<hic>" + me.name + "笑眯眯地说道:嗯?" + item.color_name + ",说不定与" + me.callme() + "有缘," + num + "点。</hic>";
break;
default:
msg = "<hic>" + me.name + "哈哈笑道:这" + item.unit + item.color_name + "虽然不需要,但是拿着也没坏处," + num + "点。</hic>";
break;
}
}
me.send_team(msg);
if (num > item.dice.num) {
item.dice.user = me.id;
item.dice.num = num;
}
if (item.dice.users.length===0) {
me.team.alloc(item);
}
}

40
world/cmd/obj/drop.js Normal file
View File

@@ -0,0 +1,40 @@
this.inherits(COMMAND);
this.command = "drop";
this.regex = /^(?:(\d+\s))?(.+?)$/;
this.enter = function (player, count, objid) {
var obj = player.find_obj(objid);
if (!obj) {
return player.notify("你要丢掉什么东西?");
}
if (obj.is_locked) {
return player.notify(obj.color_name + "处于锁定状态,无法丢弃,贩卖,分解。");
// player.send_commands('lockobj ' + obj.id, '解除锁定');
}
if (obj.no_drop) return player.notify("这个东西丢不掉。");
this.exec(player, obj, count);
}
this.exec = function (player, obj, count) {
if (!obj || !player.environment) return;
var drop_count = 1;
if (count) drop_count = parseInt(count);
if (!(drop_count > 0)) return;
if (obj.count > 0) {
if (drop_count > obj.count) return player.notify("你身上没有那么多的" + obj.color_name + "。");
} else {
for (var i = 0; i < player.items.length; i++) {
if (player.items[i] == obj) {
player.items.splice(i, 1);
player.send('{type:"dialog",dialog:"pack",id:"' + obj.id + '",remove:1}');
return player.notify("你销毁了" + obj.color_name + "。");
}
}
return player.notify("你什么都没丢掉。");
}
var drop_obj = player.remove_obj(obj, drop_count);
if (drop_obj) {
player.send_room("$N丢掉" + UTIL.to_c(drop_count) + obj.unit + obj.color_name + "。");
WORLD.add_recover_obj(player, drop_obj, 0);
} else {
player.notify("你什么都没丢掉。");
}
}

42
world/cmd/obj/eq_group.js Normal file
View File

@@ -0,0 +1,42 @@
this.inherits(COMMAND);
this.command = "eqgroup";
this.allow_fight = false;
this.enter = function (me, par) {
let index = parseInt(par);
if (!(index >= 0 && index < 3)) return;
this.save_eqgroup(me);
let eqs = me.eq_groups[index];
if (!eqs) eqs = new Array(me.equipment.length);
for (let i = 0; i < me.equipment.length; i++) {
let eq = me.equipment[i];
if (!eq) continue;
me.unequip(eq);
if (!eq.is_shortcut)
eq.notify_action(me, false);
}
for (let i = 0; i < me.equipment.length; i++) {
if (!eqs[i]) continue;
let obj = me.find_obj(eqs[i]);
if (!obj || !obj.is_equipment) continue;
if (me.equip(obj) !== false && obj.on_use) {
obj.notify_action(me, true);
}
}
me.eq_group = index;
me.send(`{type:"dialog",dialog:"pack",eq_group:${index}}`);
}
this.save_eqgroup = function (me) {
let eqs = me.eq_groups[me.eq_group];
if (!eqs) {
eqs = new Array(me.equipment.length);
me.eq_groups[me.eq_group] = eqs;
}
for (let i = 0; i < me.equipment.length; i++) {
let eq = me.equipment[i];
eqs[i] = eq ? eq.id : null;
}
}

29
world/cmd/obj/equip.js Normal file
View File

@@ -0,0 +1,29 @@
this.inherits(COMMAND);
this.command = "eq";
this.enter = function (me, oid) {
var obj = me.find_obj(oid);
if (!obj) {
return me.notify("你要装备什么?");
}
if (!obj.is_equipment) {
return me.notify("这个东西不能装备。");
}
if (me.fight_type) {
if (me.query_temp('eq_wea') !== oid)
return me.notify("战斗中不能更换装备。");
}
if (me.release_time) {
var diff_time = me.release_time - Date.now();
if (diff_time > 0) {
return me.notify("你的技能还没释放完成,无法切换装备。");
}
}
if (me.equip(obj) != false && obj.on_use) {
obj.notify_action(me, true);
if (me.fight_type) {
me.remove_temp('eq_wea');
}
}
}

109
world/cmd/obj/fenjie.js Normal file
View File

@@ -0,0 +1,109 @@
this.inherits(COMMAND);
this.command = "fenjie";
this.regex = /^(\w+)(?:\s(\w+))?$/;
this.enter = function (player, objid, isok) {
var obj = player.find_obj(objid);
if (!obj) {
return player.notify("你要分解什么装备?");
}
if (obj.is_locked) {
return player.notify(obj.color_name + "处于锁定状态,无法丢弃,贩卖,分解。");
// player.send_commands('lockobj ' + obj.id, '解除锁定');
}
if (!obj.is_equipment || obj.no_fenjie)
return player.notify("这个东西分解不了。");
if (!obj.grade) return player.notify(obj.color_name + "蕴含的力量太弱了,分解不出来什么东西。");
if (obj.grade > 5) {
return player.notify("你确定要分解" + obj.color_name + "吗?");
}
if (obj.grade >= 5) {
return this.fenjie2(player, obj, isok);
}
let count = Math.floor(obj.value / 1000);
if (obj.level > 0) {
count += (Math.pow(2, obj.level + 1) - 2) * obj.grade;
}
if (!isok && obj.st_prop && obj.st_prop.length > 0) {
return player.notify(obj.color_name + "已经镶嵌宝石,清理宝石后才可以分解。");
}
obj = player.remove_obj(obj);
if (!obj) return player.notify("你要分解什么装备?");
let attach = player.query_prop('fenjie');
let sum_count = count + attach;
var item = player.add_obj("st/xuanjing", sum_count);
if (!item) return player.notify("分解失败。");
player.send("你将" + obj.color_name + "分解为" + item.unit_name(sum_count) + "。");
WORLD.add_recover_obj(player, obj, 2, sum_count);
}
const default_prop = ["gj", 'fy', 'fy', 'fy', 'fy', null, null, null,
'fy', 'fy', 'gj'];
this.fenjie2 = function (player, obj, isok) {
// if (obj.path.startsWith('eq/cp')
// || obj.path.startsWith('eq/zb'))
// return player.notify('自制装备暂时不能分解。');
let count = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 6][obj.level];
let props = obj.prop;
if (!props) return player.send('无法拆解。');
let sts = [];
let st_names = [];
if (obj.path.startsWith('eq/cp')
|| obj.path.startsWith('eq/zb')) {
const duanzao = WORLD.COMMANDS.duanzao;
for (var key in obj.temp) {
let level = obj.temp[key];
if (!level) continue;
let prop = duanzao.PROPS[key];
if (!prop) continue;
let st = OBJ.CREATE('st/p#' + key, duanzao.sum_needs(prop, level));
sts.push(st);
st_names.push(st.unit_name());
}
count += 8;
count += obj.query_temp('sc', 0);
} else {
let active_props = WORLD.COMMANDS.duanzao.PROPS;
const def_prop = WORLD.COMMANDS.duanzao.DEFAULT_PROPS[obj.eq_type];
for (let prop in props) {
if (!active_props[prop]) continue;
if (def_prop && def_prop === prop) continue;
let st = OBJ.CREATE('st/p#' + prop, obj.query_temp(prop, 1));
sts.push(st);
st_names.push(st.unit_name());
}
}
if (!isok) {
player.notify("是否确认分解" + obj.color_name
+ "?精炼等级越高分解的元晶数量越多,当前等级分解后可以获得:" + count + "个<hio>元晶</hio>、" + st_names.join("、"));
return player.send_commands("fenjie " + obj.id + " ok", "确认分解")
}
if (obj.st_prop && obj.st_prop.length > 0) {
return player.notify(obj.color_name + "已经镶嵌宝石,清理宝石后才可以分解。");
}
obj = player.remove_obj(obj);
if (!obj) return player.notify("你要分解什么装备?");
let item = player.add_obj("st/yuanjing", count);
if (!item) return player.notify("分解失败。");
player.send("你将" + obj.color_name + "分解为" + item.unit_name(count) + "。");
let rec_items = ['st/yuanjing', count];
for (let st of sts) {
player.add_obj(st);
player.send("你获得" + st.unit_name() + "。");
rec_items.push(st.path);
}
return WORLD.add_recover_obj(player, obj, 2, rec_items);
}

132
world/cmd/obj/get.js Normal file
View File

@@ -0,0 +1,132 @@
this.inherits(COMMAND);
this.command = "get";
this.regex = /^(?:(\d+)\s)?(\w+)(?:\s+from\s(\w+))?$/;
this.enter = function (player, count, objid, from) {
if (!objid) return player.notify("你要捡什么东西?");
var parent = player.environment;
if (from) {
parent = player.find_obj(from, player.environment);
if (!parent) {
return player.notify("你要从哪拿走什么东西?");
}
if (parent == player) {
return player.notify("东西就在你身上");
}
if (parent.is_character) {
return player.notify("你不能搜身。");
}
if (!parent.is_container) {
return player.notify("你不能从" + parent.name + "里拿走任何东西。");
}
}
if (objid !== "all" || !from) {
var obj = parent.find_obj(objid);
if (!obj) {
return player.notify("你要捡起什么东西?");
}
var get_count = obj.count;
if (obj.count < get_count) {
return player.notify("这里没有那么多的" + obj.name + "。");
}
if (obj.is_living && obj.is_living()) {
return player.notify(obj.name + "不用你背。");
}
if (obj.no_get) {
return player.notify("这个东西你捡不起来。");
}
if (obj.on_get && obj.on_get(player) === false) return;
parent = parent || player.environment;
if (player.is_full()) {
return player.notify("你身上东西太多了。");
}
obj = parent.remove_item(obj, get_count);
if (!obj) return player.notify("你什么都没捡起来。");
obj.count = get_count;
player.add_obj(obj);
if (from) {
player.send_room("$N从" + parent.name + "里拿出来" + UTIL.to_c(get_count) + obj.unit + obj.color_name + "。");
} else {
player.send_room("$N捡起" + UTIL.to_c(get_count) + obj.unit + obj.color_name + "。");
player.environment.item_changed(obj, false);
}
} else if (objid === "all" && from) {
var items = parent.query_items(player);
if (!items || !items.length) { return player.notify("那里面没有东西。") }
if (player.is_full()) {
return player.notify("你身上东西太多了。");
}
var no_get = [];
for (var i = 0; i < items.length; i++) {
if (!getObj(player, items[i], parent)) {
no_get.push(items[i]);
}
}
parent.clear_items(player, no_get);
parent.refresh();
}
}
function getObj(me, item, parent) {
if (!(item.count > 0)) return true;
if (item.on_get && item.on_get(me) === false) return false;
if (!me.team || me.team.free_get || !item.grade || parent.no_alloc) {
if (parent.on_getitem && parent.on_getitem(me, item) === false) return false;
me.add_obj(item);
} else {
var list = [];
for (var i = 0; i < me.team.length; i++) {
var tm = me.team[i];
if (tm.environment && tm.environment.parent === me.environment.parent) {
if (parent.on_getitem && parent.on_getitem(tm, item) === false) {
if (tm === me) return false;
continue;
}
list.push(tm);
}
}
if (list.length > 1) {
me.team.objs = me.team.objs || [];
me.team.objs.push(item);
item.dice = { user: null, users: [], num: 0 };
var str = ["{type:\"warn\",content:\"", item.color_name, '",time:60000,cmds:[',
"{cmd:\"dice 0 ", item.id, '",name:"有需求想要"},{cmd:"dice 1 ', item.id,
'",name:"无需求想要"},{cmd:"dice 2 ', item.id, '", name: "不想要" }]}'].join("");
for (let i = 0; i < list.length; i++) {
if (!list[i].is_player) {
var dtype = list[i].query_setting("auto_dice");
WORLD.COMMANDS["dice"].enter(list[i], dtype ? (dtype - 1) : 2, item.id);
} else {
list[i].send(str);
item.dice.users.push(list[i].id);
}
}
let tm = me.team;
me.call_out(() => tm.alloc(item), 60000);
} else if (list.length === 1) {
me.add_obj(item);
} else {
return false;
}
}
if (item.is_equipment && item.grade >= 5) {
COMMAND.DO("rumor", "听说有人捡到了一" + item.unit + item.name + "。");
}
if (parent)
me.send_room("$N从" + parent.name + "里拿出来" + UTIL.to_c(item.count) + item.unit + item.color_name + "。");
else
me.send_room("$N捡起" + UTIL.to_c(item.count) + item.unit + item.color_name + "。");
return true;
}

63
world/cmd/obj/give.js Normal file
View File

@@ -0,0 +1,63 @@
this.inherits(COMMAND);
this.command = "give";
this.regex = /^(\w+)(?:\s+(\w+))?\s+(\w+)$/;
this.enter = function (player, target, count, objid) {
target = player.find_obj(target, player.environment);
if (!target || !target.hp) return player.notify("你要给谁东西?");
if (target.is_player && player.master != target.id) return player.notify("不能给玩家控制的人物东西。");
if (objid == "money") {
if (!count) return player.notify("你要给" + target.name + "多少钱?");
count = parseInt(count);
if (count <= 0) return player.notify("你要给" + target.name + "多少钱?");
if (count > player.money) return player.notify("你身上没有那么多的钱给" + target.name + "。");
if (target.on_accept && target.on_accept(player, objid, count)) {
player.money -= count;
//target.money = target.money || 0;
//target.money += count;
// player.add_temp('money1', count, UTIL.diff_time());
player.send_room("$N给了$n" + UTIL.moneyToStr(count) + "。", target);
return;
}
return player.notify(target.name + "不要你的钱。");
} else if (objid == "cash") {
if (!count) return player.notify("你要给" + target.name + "多少元宝?");
if (count <= 0) return player.notify("你要给" + target.name + "多少元宝?");
if (count > player.cash_money) return player.notify("你身上没有那么多的元宝给" + target.name + "。");
if (target.on_accept && target.on_accept(player, objid, count)) {
return player.add_cash(-count, "给" + target.name);
}
return player.notify(target.name + "不要你的钱。");
}
var obj = player.find_obj(objid);
if (!obj) {
return player.notify("你要给" + target.name + "什么东西?");
}
if (!count) count = 1;
else if (count === 'all')
count = obj.count;
else
count = parseInt(count);
if (!(count > 0)) return;
if (obj.count < count) {
return player.notify("你没有那么多的" + obj.name + "。");
}
if (target.master == player.id || target.id == player.master) {
if (target.is_full()) return player.notify(target.name + "身上东西太多了。");
obj = player.remove_obj(obj, count);
if (obj) {
target.add_obj(obj);
player.send_room("$N给了$n" + UTIL.to_c(count) + obj.unit + obj.color_name + "。", target);
}
return;
}
if (target.on_accept && target.on_accept(player, obj, count)) {
obj = player.remove_obj(obj, count);
if (obj) {
player.send_room("$N给了$n" + UTIL.to_c(count) + obj.unit + obj.color_name + "。", target);
}
}
}

106
world/cmd/obj/jinglian.js Normal file
View File

@@ -0,0 +1,106 @@
this.inherits(COMMAND);
this.command = "jinglian";
this.regex = /^(\w+)(?:\s(\w+))?$/;
this.enter = function (player, objid, isok) {
var obj = player.find_obj(objid);
if (!obj) {
return player.notify("你要精炼什么装备?");
}
if (!obj.is_equipment || obj.no_jinglian) return player.notify("这个东西没办法精炼。");
if (!obj.grade) return player.notify(obj.color_name + "品质太低了,承受不住再多的力量。");
if (obj.level >= 12) return player.notify(obj.color_name + "已经到了极限,无法再承受更多的力量。");
var item = {
path: obj.grade == 6 ? "st/yuanjing" : "st/xuanjing",
color_name: obj.grade == 6 ? "<hio>元晶</hio>" : "<hiw>玄晶</hiw>", count: 0
};
for (var i = 0; i < player.items.length; i++) {
if (player.items[i].is(item.path)) {
item = player.items[i];
break;
}
}
var lv = obj.level + 1;
var need_count = obj.grade < 6 ? Math.pow(2, lv) * obj.grade : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12][lv - 1];
var full_count = 0;
if (obj.grade < 6) {
full_count = (Math.pow(2, 12 + 1) - 2) * obj.grade;
if (obj.level > 0) {
full_count -= (Math.pow(2, obj.level + 1) - 2) * obj.grade;
}
} else {
full_count = (1 + 12) * 12 / 2;
if (obj.level > 0) {
full_count -= (1 + obj.level) * obj.level / 2;
}
}
//绿8190 橙5*8190
if (isok) {
let isfull = isok === 'full';
if (isfull) need_count = full_count;
if (item.count < need_count) {
return player.notify("你的" + item.color_name + "数量不够精炼。");
}
item = player.remove_obj(item, need_count);
if (!item) player.notify("你的" + item.color_name + "数量不够精炼。");
player.send_room("<hiw>$N用内力把" + item.color_name + "炼化,小心翼翼的引入" + obj.color_name + "。</hiw>");
if (isfull) {
player.send_room("<ora>$N的" + obj.color_name + "古井无波,空中却一瞬间电闪雷鸣,似有神兵出世,轰鸣声中你好似听到有阵阵龙吟自" + obj.color_name + "中传出!</ora>");
obj.level_up(12);
} else {
if (obj.level < 5) {
player.send_room("<yel>$N的" + obj.color_name + "发出一阵耀眼的光芒,看上去似乎变强了!</yel>");
} else if (obj.level < 9) {
player.send_room("<yel>$N的" + obj.color_name + "发出一阵璀璨的光芒,看上去似乎更加强大了!</yel>");
} else if (obj.level < 12) {
player.send_room("<mag>$N的" + obj.color_name + "爆出一阵炽热的光芒,周身似乎有雷光环绕,连绵不绝!</mag>");
} else {
player.send_room("<ora>$N的" + obj.color_name + "古井无波,空中却一瞬间电闪雷鸣,似有神兵出世,轰鸣声中你好似听到有阵阵龙吟自" + obj.color_name + "中传出!</ora>");
}
obj.level_up(obj.level + 1);
}
// lv = obj.level + 1;
// need_count = Math.pow(2, lv) * obj.grade;
player.items_changed(obj);
return WORLD.STATS.updateWeapon(player, obj);
}
var str = ['{type:"dialog",dialog:"pack",jldesc:\"',
obj.color_name, "<br/>精炼", query_level_color(lv), " 需要以下物品:<br/>"];
str.push(item.color_name, ' ');
if (item.count < need_count) {
str.push("<red>");
}
str.push(item.count, '/', need_count);
if (item.count < need_count) {
str.push("</red>");
}
str.push("<br/>精炼", query_level_color(12), " 需要以下物品:<br/>");
str.push(item.color_name, ' ');
if (item.count < full_count) {
str.push("<red>");
}
str.push(item.count, '/', full_count);
if (item.count < need_count) {
str.push("</red>");
}
str.push('",id:"');
str.push(obj.id);
str.push('"}');
player.notify(str.join(""));
}
function query_level_color(lv) {
if (!lv) return "";
var jlcolor = ["", "hig", "hig", "hic", "hic", "hiy", "hiy", "HIZ", "HIZ", "hio", "hio", "ord", "ord"];
var cc = jlcolor[lv];
return "<" + cc + ">" + lv + " </" + cc + ">";
}

7
world/cmd/obj/lianyao.js Normal file
View File

@@ -0,0 +1,7 @@
this.inherits(COMMAND);
this.command = "lianyao";
this.regex = /^(\w+)?(?:\s(-?\d+))?$/;
this.enter = function (player, arg, id) {
}

Some files were not shown because too many files have changed in this diff Show More