36 lines
997 B
JavaScript
36 lines
997 B
JavaScript
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);
|
|
|
|
}
|