保镖系统优化

这个提交包含在:
2020-04-23 17:29:03 +08:00
父节点 6b647f1ebf
当前提交 7277918e42
共有 6 个文件被更改,包括 62 次插入 和 11 次删除

查看文件

@ -2,6 +2,7 @@
const fs=require("fs");
const Core = require("./Core");
const MoneyInterfaces = require("./Money").add.Interfaces;
const 保镖In = require("./保镖.i");
exports.add={
Interfaces:{},
Control:function(connect,info){
@ -15,16 +16,26 @@ exports.add={
UQQ = UQQ.replace(']',"");
UQQ = UQQ.replace('抢劫',"");
UQQ = UQQ.replace(' ',"");
if(MoneyInterfaces.GetUserMoney(UQQ)<1000){
Core.frame.SendMsg(connect,info,Core.frame.At(UQQ)+"的余额不足1000,不可抢劫。");
if(保镖In.使用用户保镖(Core.GetUser(UQQ))){
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info.user_id))+"对方有保镖,不可抢劫。");
}else{
var Temp2 = Math.ceil(Math.random() * MoneyInterfaces.GetUserMoney(Core.GetUser(UQQ)) * 0.25);
if(UQQ == Core.GetUser(info["user_id"])){
Temp2 = 0;
if(isNaN(new Number(UQQ).valueOf())){
if(UQQ.indexOf("@") != -1){
Core.frame.SendMsg(connect,info,"你可能是复制了一个At,目前AI暂不支持At复制,请使用At选择框或者输入QQ号码");
}
return;
}
if(MoneyInterfaces.GetUserMoney(UQQ)<1000){
Core.frame.SendMsg(connect,info,Core.frame.At(UQQ)+"的余额不足1000,不可抢劫。");
}else{
var Temp2 = Math.ceil(Math.random() * MoneyInterfaces.GetUserMoney(Core.GetUser(UQQ)) * 0.25);
if(UQQ == Core.GetUser(info["user_id"])){
Temp2 = 0;
}
MoneyInterfaces.GiveUserMoney(Core.GetUser(info["user_id"]),Temp2,`抢劫${UQQ}`);
MoneyInterfaces.CostUserMoney(UQQ,Temp2,`被${info["user_id"]}抢劫`);
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"抢劫成功!你抢到"+Temp2+"元,你的余额"+MoneyInterfaces.GetUserMoney(Core.GetUser(info["user_id"]))+"元");
}
MoneyInterfaces.GiveUserMoney(Core.GetUser(info["user_id"]),Temp2,`抢劫${UQQ}`);
MoneyInterfaces.CostUserMoney(UQQ,Temp2,`被${info["user_id"]}抢劫`);
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"抢劫成功!你抢到"+Temp2+"元,你的余额"+MoneyInterfaces.GetUserMoney(Core.GetUser(info["user_id"]))+"元");
}
}
}