保镖系统优化
这个提交包含在:
@ -54,10 +54,10 @@ exports.add={
|
||||
}
|
||||
}
|
||||
if(Temp1 == "抢红包"){
|
||||
if(exports.add.Interfaces.GetRedPacketPool()<1000){
|
||||
if(exports.add.Interfaces.GetRedPacketPool()<10000){
|
||||
var M = exports.add.Interfaces.GetRedPacketPool();
|
||||
}else{
|
||||
var M = Math.ceil(1000 * Math.random());
|
||||
var M = Math.ceil(exports.add.Interfaces.GetRedPacketPool() * Math.random() * 0.05);
|
||||
}
|
||||
MoneyInterfaces.GiveUserMoney(Core.GetUser(info["user_id"]),M);
|
||||
exports.add.Interfaces.CostRedPacketPool(M);
|
||||
|
||||
25
保镖.i.js
普通文件
25
保镖.i.js
普通文件
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// .i.ts : Interface TS文件
|
||||
class 数字 extends Number {
|
||||
}
|
||||
;
|
||||
const Core = __importStar(require("./Core"));
|
||||
exports.使用用户保镖 = ((用户) => {
|
||||
var 数据 = Core.frame.ReadSystemConfig("保镖");
|
||||
if (数据[用户.valueOf()] == undefined || new Number(数据[用户.valueOf()]).valueOf() < 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
数据[用户.valueOf()] = 数据[用户.valueOf()] - 1;
|
||||
Core.frame.WriteSystemConfig("保镖", 数据);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
13
保镖.i.ts
普通文件
13
保镖.i.ts
普通文件
@ -0,0 +1,13 @@
|
||||
// .i.ts : Interface TS文件
|
||||
class 数字 extends Number{};
|
||||
import * as Core from "./Core";
|
||||
export var 使用用户保镖 = ((用户:数字)=>{
|
||||
var 数据 = Core.frame.ReadSystemConfig("保镖");
|
||||
if(数据[用户.valueOf()] == undefined || new Number(数据[用户.valueOf()]).valueOf() < 0){
|
||||
return false;
|
||||
}else{
|
||||
数据[用户.valueOf()] = 数据[用户.valueOf()] - 1;
|
||||
Core.frame.WriteSystemConfig("保镖",数据);
|
||||
return true;
|
||||
}
|
||||
})
|
||||
1
保镖.js
1
保镖.js
@ -15,6 +15,7 @@ const 保镖配置 = {
|
||||
使用次数: 5,
|
||||
禁言权重: 25
|
||||
};
|
||||
exports.Interfaces = {};
|
||||
Core.AddListener((connect, info) => {
|
||||
if (info.message == "聘请保镖") {
|
||||
if (Money.add.Interfaces.GetUserMoney(Core.GetUser(info.user_id)) < 保镖配置.聘请定价) {
|
||||
|
||||
3
保镖.ts
3
保镖.ts
@ -6,6 +6,7 @@ const 保镖配置 = {
|
||||
使用次数:5,
|
||||
禁言权重:25
|
||||
}
|
||||
export var Interfaces = {};
|
||||
Core.AddListener((connect,info)=>{
|
||||
if(info.message == "聘请保镖"){
|
||||
if(Money.add.Interfaces.GetUserMoney(Core.GetUser(info.user_id)) < 保镖配置.聘请定价){
|
||||
@ -23,4 +24,4 @@ Core.AddListener((connect,info)=>{
|
||||
Core.frame.WriteSystemConfig("保镖",Data);
|
||||
Core.frame.SendMsg(connect,info,`${Core.frame.At(Core.GetUser(info.user_id))},聘请保镖成功,你剩下${User保镖}位保镖,还剩${Money.add.Interfaces.GetUserMoney(Core.GetUser(info.user_id))}RMB.`)
|
||||
}
|
||||
})
|
||||
});
|
||||
27
抢劫.js
27
抢劫.js
@ -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"]))+"元");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户