Build2
这个提交包含在:
二进制
.vs/JSAICore/v16/.suo
普通文件
二进制
.vs/JSAICore/v16/.suo
普通文件
二进制文件未显示。
二进制
.vs/slnx.sqlite
普通文件
二进制
.vs/slnx.sqlite
普通文件
二进制文件未显示。
1
AI.js
1
AI.js
@ -47,7 +47,6 @@ exports.add={
|
|||||||
temp[Core.GetUser(info["user_id"])] = false;
|
temp[Core.GetUser(info["user_id"])] = false;
|
||||||
Core.frame.WriteSystemConfig("AITalk",temp);
|
Core.frame.WriteSystemConfig("AITalk",temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
info["message"] = info["message"].replace("[CQ:at,qq=2142562417]","");
|
info["message"] = info["message"].replace("[CQ:at,qq=2142562417]","");
|
||||||
|
|
||||||
if(info["message"].indexOf("[CQ:at,qq=")!=-1){
|
if(info["message"].indexOf("[CQ:at,qq=")!=-1){
|
||||||
|
|||||||
@ -1,29 +1,32 @@
|
|||||||
const Core = require("./Core");
|
"use strict";
|
||||||
exports.add={
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
InterFaces:{
|
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];
|
||||||
Control:function(connect,info){
|
result["default"] = mod;
|
||||||
if(info["message"]=="Creeper?"){
|
return result;
|
||||||
Core.frame.SendMsg(connect,info,"awww man!");
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var Core = __importStar(require("./Core"));
|
||||||
|
exports.Creeper = ["Creeper?", "awwww man!", "So we back in the mine"];
|
||||||
|
var Creepering = 0;
|
||||||
|
Core.AddListener(function (c, info) {
|
||||||
|
if (Creepering != 0) {
|
||||||
|
var temp = true;
|
||||||
|
if (info.message == exports.Creeper[Creepering]) {
|
||||||
|
Core.frame.SendMsg(c, info, exports.Creeper[Creepering + 1]);
|
||||||
|
Creepering = Creepering + 2;
|
||||||
|
temp = false;
|
||||||
|
if (Creepering > exports.Creeper.length) {
|
||||||
|
Core.frame.SendMsg(c, info, "The End");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(info["message"]=="awww man!"){
|
if (temp) {
|
||||||
Core.frame.SendMsg(connect,info,"So we back in the mine.");
|
Core.frame.SendMsg(c, info, "有人发送了一个与Creeper无关的消息,Creeper进度已终止!");
|
||||||
}
|
|
||||||
if(info["message"]=="So we back in the mine."){
|
|
||||||
Core.frame.SendMsg(connect,info,"Got are pickaxr swingin' from side to side");
|
|
||||||
}
|
|
||||||
if(info["message"]=="Side to Side"){
|
|
||||||
Core.frame.SendMsg(connect,info,"Side side to side");
|
|
||||||
}
|
|
||||||
if(info["message"]=="Side side to Side"){
|
|
||||||
Core.frame.SendMsg(connect,info,"Night night diamonds tonight");
|
|
||||||
}
|
|
||||||
if(info["message"]=="Night night diamonds tonight"){
|
|
||||||
Core.frame.SendMsg(connect,info,"Heads up.");
|
|
||||||
}
|
|
||||||
if(info["message"]=="Heads up."){
|
|
||||||
Core.frame.SendMsg(connect,info,"You hear a sound turn around and look up");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (info.message == exports.Creeper[0]) {
|
||||||
|
Creepering = 1;
|
||||||
|
Core.frame.SendMsg(c, info, exports.Creeper[1]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
23
AutoCreeper.ts
普通文件
23
AutoCreeper.ts
普通文件
@ -0,0 +1,23 @@
|
|||||||
|
import * as Core from "./Core";
|
||||||
|
export var Creeper = ["Creeper?", "awwww man!","So we back in the mine"];
|
||||||
|
var Creepering = 0;
|
||||||
|
Core.AddListener((c, info) => {
|
||||||
|
if (Creepering != 0) {
|
||||||
|
var temp = true;
|
||||||
|
if (info.message == Creeper[Creepering]) {
|
||||||
|
Core.frame.SendMsg(c, info, Creeper[Creepering + 1]);
|
||||||
|
Creepering = Creepering + 2;
|
||||||
|
temp = false;
|
||||||
|
if (Creepering > Creeper.length) {
|
||||||
|
Core.frame.SendMsg(c, info, "The End");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (temp) {
|
||||||
|
Core.frame.SendMsg(c, info, "有人发送了一个与Creeper无关的消息,Creeper进度已终止!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info.message == Creeper[0]) {
|
||||||
|
Creepering = 1;
|
||||||
|
Core.frame.SendMsg(c, info, Creeper[1]);
|
||||||
|
}
|
||||||
|
});
|
||||||
23
BBS.js
普通文件
23
BBS.js
普通文件
@ -0,0 +1,23 @@
|
|||||||
|
"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 });
|
||||||
|
//BBS.js => 提供一个论坛机制
|
||||||
|
var Core = __importStar(require("./Core"));
|
||||||
|
(function () {
|
||||||
|
var BBSCore = {
|
||||||
|
GetUserPermission: (function (User, BBS) {
|
||||||
|
return;
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
Core.AddListener(function (connect, info) {
|
||||||
|
if (info.raw_message.substr(0, 3) != "BBS") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
17
BBS.ts
普通文件
17
BBS.ts
普通文件
@ -0,0 +1,17 @@
|
|||||||
|
//BBS.js => 提供一个论坛机制
|
||||||
|
import * as Core from "./Core";
|
||||||
|
(()=>{
|
||||||
|
var BBSCore = {
|
||||||
|
|
||||||
|
GetUserPermission:((User:Number|number,BBS:String)=>{//Get A User's Permission of A BBS Part.
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
Core.AddListener((connect,info)=>{
|
||||||
|
if(info.raw_message.substr(0,3)!="BBS"){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
15
CGI.js
15
CGI.js
@ -1,10 +1,17 @@
|
|||||||
const ws = require("websocket");
|
const ws = require("websocket");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const Core = require("./Core");
|
const Core = require("./Core");
|
||||||
var wss = new ws.client();
|
|
||||||
var HOOK = false;
|
var HOOK = false;
|
||||||
wss.connect("ws://127.0.0.1:6700/");
|
console.log("["+new Date().toString()+"][./Core.js]服务器已启动");
|
||||||
console.log("["+new Date().toString()+"][./Core.js]服务器已启动\r\n");
|
var wss = new ws.client();
|
||||||
|
wss.connect("ws://127.0.0.1:6700");
|
||||||
|
global.ReConnect = (()=>{
|
||||||
|
throw new Error("Reconnect");
|
||||||
|
})
|
||||||
|
wss.once("connectFailed",()=>{
|
||||||
|
console.log("["+new Date().toString()+"][./Core.js]功能已断线。");
|
||||||
|
process.exit(-1)
|
||||||
|
});
|
||||||
exports.HOOK = HOOK;
|
exports.HOOK = HOOK;
|
||||||
exports.frame={
|
exports.frame={
|
||||||
SendMsg:function(connect,info,message){
|
SendMsg:function(connect,info,message){
|
||||||
@ -28,6 +35,7 @@ exports.frame={
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
wss.on("connect",(connect)=>{
|
wss.on("connect",(connect)=>{
|
||||||
|
console.log("["+new Date().toString()+"][./Core.js]链接成功");
|
||||||
exports.connect = connect;
|
exports.connect = connect;
|
||||||
exports.frame.SetHook(false);
|
exports.frame.SetHook(false);
|
||||||
exports.HOOK = HOOK;
|
exports.HOOK = HOOK;
|
||||||
@ -40,7 +48,6 @@ wss.on("connect",(connect)=>{
|
|||||||
}else{
|
}else{
|
||||||
connect.send(`{"action":"set_group_add_request","params":{"flag":"${s["flag"]}","sub_type":"${s["sub_type"]}","approve":true}}`)
|
connect.send(`{"action":"set_group_add_request","params":{"flag":"${s["flag"]}","sub_type":"${s["sub_type"]}","approve":true}}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Core.frame.CGI(connect,JSON.parse(data.utf8Data));
|
Core.frame.CGI(connect,JSON.parse(data.utf8Data));
|
||||||
|
|||||||
22
Core.d.ts
vendored
22
Core.d.ts
vendored
@ -32,6 +32,21 @@ import * as Core from "./Core";
|
|||||||
/**添加事件监听器
|
/**添加事件监听器
|
||||||
* @param callback 回调函数
|
* @param callback 回调函数
|
||||||
*/export function AddListener(/**回调函数*/callback:((Connect:net.Socket,Info:InfoType)=>void)):void;
|
*/export function AddListener(/**回调函数*/callback:((Connect:net.Socket,Info:InfoType)=>void)):void;
|
||||||
|
/**Config类型*/declare interface Config<T>{
|
||||||
|
/**
|
||||||
|
* 读取某个人的Config
|
||||||
|
* @param QQ QQ
|
||||||
|
*/
|
||||||
|
ReadValue(QQ:Number|number):T;
|
||||||
|
/**
|
||||||
|
* 写入某个人的Config
|
||||||
|
* @param QQ QQ
|
||||||
|
* @param value 内容
|
||||||
|
*/
|
||||||
|
WriteValue(QQ:Number|number,value:T):void;
|
||||||
|
API_GET():any;
|
||||||
|
constructor(Value:Array<T>):any;
|
||||||
|
}
|
||||||
/**部分公开功能*/export namespace frame{
|
/**部分公开功能*/export namespace frame{
|
||||||
/**禁言某人
|
/**禁言某人
|
||||||
* @param connect 会话
|
* @param connect 会话
|
||||||
@ -46,4 +61,11 @@ import * as Core from "./Core";
|
|||||||
/** \@某人
|
/** \@某人
|
||||||
* @param UserId QQ号
|
* @param UserId QQ号
|
||||||
*/function At(UserId:number|Number):string;
|
*/function At(UserId:number|Number):string;
|
||||||
|
/** 读取某个配置项目
|
||||||
|
* @param ConfigName 配置项名称
|
||||||
|
*/function NReadSystemConfig(ConfigName:String|string):Config<any>;
|
||||||
|
/**写入某个配置项目
|
||||||
|
* @param ConfigName 配置名称
|
||||||
|
* @param ConfigValue 配置内容
|
||||||
|
*/function NWriteSystemConfig(ConfigName:String|string,ConfigValue:Config<any>):Boolean|boolean;
|
||||||
}
|
}
|
||||||
30
Core.js
30
Core.js
@ -67,6 +67,20 @@ exports.AddListener = ((callback)=>{
|
|||||||
Listeners[Listeners.length] = callback;
|
Listeners[Listeners.length] = callback;
|
||||||
console.log(`[${new Date().toString()}]新的服务注册。`);
|
console.log(`[${new Date().toString()}]新的服务注册。`);
|
||||||
});
|
});
|
||||||
|
class Config{
|
||||||
|
constructor(value){
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
ReadValue(QQ){
|
||||||
|
return this.value[QQ.valueOf()];
|
||||||
|
}
|
||||||
|
WriteValue(QQ,value){
|
||||||
|
this.value[QQ.valueOf()] = value;
|
||||||
|
}
|
||||||
|
API_GET(){//旧版API
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
};
|
||||||
exports.frame={
|
exports.frame={
|
||||||
__Ban:function(connect,group,someone,time){
|
__Ban:function(connect,group,someone,time){
|
||||||
connect.send(`{"action":"set_group_ban","params":{"group_id":"${group}","user_id":"${someone}","duration":${time}}}`);
|
connect.send(`{"action":"set_group_ban","params":{"group_id":"${group}","user_id":"${someone}","duration":${time}}}`);
|
||||||
@ -102,6 +116,14 @@ exports.frame={
|
|||||||
return temp[Name];
|
return temp[Name];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
NReadSystemConfig(Name){
|
||||||
|
var temp = JSON.parse(fs.readFileSync("UserDataBase.json").toString())
|
||||||
|
if(temp[Name]==undefined||temp[Name]==null){
|
||||||
|
return new Config(new Object());
|
||||||
|
}else{
|
||||||
|
return new Config(temp[Name]);
|
||||||
|
}
|
||||||
|
},
|
||||||
WriteSystemConfig(Name,Value){
|
WriteSystemConfig(Name,Value){
|
||||||
var Data = JSON.parse(fs.readFileSync("UserDataBase.json").toString());
|
var Data = JSON.parse(fs.readFileSync("UserDataBase.json").toString());
|
||||||
Data[Name] = Value;
|
Data[Name] = Value;
|
||||||
@ -109,7 +131,13 @@ exports.frame={
|
|||||||
fs.writeFileSync("UserDataBase.json",JSON.stringify(Data));
|
fs.writeFileSync("UserDataBase.json",JSON.stringify(Data));
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
NWriteSystemConfig(Name,Value){
|
||||||
|
var Data = JSON.parse(fs.readFileSync("UserDataBase.json").toString());
|
||||||
|
Data[Name] = Value.API_GET();
|
||||||
|
//console.log(Data);
|
||||||
|
fs.writeFileSync("UserDataBase.json",JSON.stringify(Data));
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
CGI:function(connect,info){
|
CGI:function(connect,info){
|
||||||
console.log("["+new Date().toString()+"][./Core.js]收到新消息");
|
console.log("["+new Date().toString()+"][./Core.js]收到新消息");
|
||||||
exports.HOOK = JSCGI.HOOK;
|
exports.HOOK = JSCGI.HOOK;
|
||||||
|
|||||||
23
Data/BBS/权限表
普通文件
23
Data/BBS/权限表
普通文件
@ -0,0 +1,23 @@
|
|||||||
|
|----------------------------------------------|
|
||||||
|
|[权限名称]|[访问许可]|[发帖]|[回复]|[警告]|[删帖]|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|封禁账号 |5 |拒绝 |拒绝 | N/A |不允许|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|普通用户 |5 |允许 |拒绝 | 0 |自己的|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|签到用户 |10 |允许 |允许 | 1 |自己的|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|长期用户 |20 |允许 |允许 | 5 |范围内|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|荣誉用户 |50 |允许 |允许 | 10 |范围内|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|公会用户 |70 |允许 |允许 | 15 |范围内|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|公会管理 |80 |允许 |允许 | --- |本公会|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|论坛管理 |100 |允许 |允许 | --- |论坛内|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|论坛版主 |101 |允许 |允许 | --- |论坛内|
|
||||||
|
|----------------------------------------------|
|
||||||
|
|系统管理 |200 |允许 |允许 | --- |-----|
|
||||||
|
|----------------------------------------------|
|
||||||
37
JSAICore.njsproj
普通文件
37
JSAICore.njsproj
普通文件
@ -0,0 +1,37 @@
|
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||||
|
<PropertyGroup>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
<Name>JSAICore</Name>
|
||||||
|
<RootNamespace>JSAICore</RootNamespace>
|
||||||
|
<SaveNodeJsSettingsInProjectFile>True</SaveNodeJsSettingsInProjectFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>f4876de3-472d-4a7f-803a-3a3061d8136f</ProjectGuid>
|
||||||
|
<ProjectHome>.</ProjectHome>
|
||||||
|
<StartupFile>Run.bat</StartupFile>
|
||||||
|
<StartWebBrowser>False</StartWebBrowser>
|
||||||
|
<SearchPath>
|
||||||
|
</SearchPath>
|
||||||
|
<WorkingDirectory>.</WorkingDirectory>
|
||||||
|
<OutputPath>.</OutputPath>
|
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
|
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
|
||||||
|
<StartWebBrowser>False</StartWebBrowser>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="*" />
|
||||||
|
<Content Include="package.json" />
|
||||||
|
<Content Include="README.md" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsToolsV2.targets" />
|
||||||
|
</Project>
|
||||||
30
OnlineAI.js
30
OnlineAI.js
@ -1,21 +1,17 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const cp = require("child_process");
|
const cp = require("child_process");
|
||||||
|
const Core = require("./Core");
|
||||||
global.UpData = function(){
|
global.UpData = function(){
|
||||||
cp.execSync("git reset --hard&git pull origin master");
|
cp.execSync("git reset --hard&git pull origin master");
|
||||||
console.log(`[${new this.Date().toString()}][OnlineAI.js]获取更新完毕`);
|
console.log(`[${new this.Date().toString()}][OnlineAI.js]获取更新完毕`);
|
||||||
}
|
|
||||||
fs.exists("./UserDataBase.json",(ex)=>{
|
|
||||||
if(ex){
|
|
||||||
console.log(`[${new Date().toString()}][OnlineAI.js]载入"UserDataBase.js"成功!`);
|
|
||||||
}else{
|
|
||||||
fs.writeFile("./UserDataBase.json","{}",(err)=>{
|
|
||||||
console.log(`[${new Date().toString()}][OnlineAI.js]用户信息初始化完成!`)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
try{
|
|
||||||
require("./CGI.js")
|
|
||||||
}catch(err){
|
|
||||||
console.log("请下载OnlineAI Core核心功能包(https://gitee.com/computer_internet_inc/OnlineAi-Core)")
|
|
||||||
process.exit();
|
|
||||||
}
|
}
|
||||||
|
fs.exists("./UserDataBase.json",(ex)=>{
|
||||||
|
if(ex){
|
||||||
|
console.log(`[${new Date().toString()}][OnlineAI.js]载入"UserDataBase.js"成功!`);
|
||||||
|
}else{
|
||||||
|
fs.writeFile("./UserDataBase.json","{}",(err)=>{
|
||||||
|
console.log(`[${new Date().toString()}][OnlineAI.js]用户信息初始化完成!`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
require("./CGI");
|
||||||
7
UD/Core.d.ts
vendored
7
UD/Core.d.ts
vendored
@ -46,4 +46,11 @@ import * as Core from "./Core";
|
|||||||
/** \@某人
|
/** \@某人
|
||||||
* @param UserId QQ号
|
* @param UserId QQ号
|
||||||
*/function At(UserId:number|Number):string;
|
*/function At(UserId:number|Number):string;
|
||||||
|
/** 读取某个配置项目
|
||||||
|
* @param ConfigName 配置项名称
|
||||||
|
*/function ReadSystemConfig(ConfigName:String|string):any;
|
||||||
|
/**写入某个配置项目
|
||||||
|
* @param ConfigName 配置名称
|
||||||
|
* @param ConfigValue 配置内容
|
||||||
|
*/function WriteSystemConfig(ConfigName:String|string,ConfigValue:any):Boolean|boolean;
|
||||||
}
|
}
|
||||||
1
UD/Easy.js
普通文件
1
UD/Easy.js
普通文件
@ -0,0 +1 @@
|
|||||||
|
"use strict";
|
||||||
0
UD/Easy.ts
普通文件
0
UD/Easy.ts
普通文件
@ -19,34 +19,67 @@ var GameAction = /** @class */ (function () {
|
|||||||
this.Type = "";
|
this.Type = "";
|
||||||
this.Settings = {};
|
this.Settings = {};
|
||||||
}
|
}
|
||||||
GameAction.prototype.Execute = function (c, i) {
|
GameAction.prototype.Execute = function (c, i, Temp_this) {
|
||||||
var _this = this;
|
if (Temp_this.Type == "对话") {
|
||||||
if (this.Type == "对话") {
|
Core.frame.SendMsg(c, i, "" + Temp_this.Settings.对话_内容);
|
||||||
Core.frame.SendMsg(c, i, "" + this.Settings.对话_内容);
|
|
||||||
}
|
}
|
||||||
if (this.Type == "跳转") {
|
if (Temp_this.Type == "跳转") {
|
||||||
|
var data = fs.readFileSync("./UnderDenyData/Player.json");
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
data_obj[i.user_id.toString()].Schedule = Temp_this.Settings.跳转_目标.valueOf();
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
||||||
|
}
|
||||||
|
if (Temp_this.Type == "判断") {
|
||||||
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
||||||
var data_obj = JSON.parse(data.toString());
|
var data_obj = JSON.parse(data.toString());
|
||||||
data_obj[i.user_id.toString()].Schedule = _this.Settings.跳转_目标.valueOf();
|
if (data_obj[i.user_id.toString()].Vars[Temp_this.Settings.判断_变量.valueOf()] == Temp_this.Settings.判断_依据.valueOf()) {
|
||||||
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.Type == "判断") {
|
|
||||||
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
|
||||||
var data_obj = JSON.parse(data.toString());
|
|
||||||
if (data_obj[i.user_id.toString()].Vars[_this.Settings.判断_变量.valueOf()] == _this.Settings.判断_依据.valueOf()) {
|
|
||||||
var temp = new GameAction();
|
var temp = new GameAction();
|
||||||
temp.Create(_this.Settings.判断_执行).Execute(c, i);
|
var s = Temp_this.Settings.判断_执行;
|
||||||
|
for (var j = 0; j < s.length; j++) {
|
||||||
|
temp.Create(s[j]).Execute(c, i, temp.Create(s[j]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.Type == "变量") {
|
if (Temp_this.Type == "变量") {
|
||||||
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
||||||
var data_obj = JSON.parse(data.toString());
|
var data_obj = JSON.parse(data.toString());
|
||||||
data_obj[i.user_id.toString()].Vars[_this.Settings.变量_设置.valueOf()] = _this.Settings.变量_内容.valueOf();
|
data_obj[i.user_id.toString()].Vars[Temp_this.Settings.变量_设置.valueOf()] = Temp_this.Settings.变量_内容.valueOf();
|
||||||
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (Temp_this.Type == "随机") {
|
||||||
|
var rom = Math.floor(Math.random() * 100);
|
||||||
|
if (rom < Temp_this.Settings.触发_几率.valueOf()) {
|
||||||
|
var temp = new GameAction();
|
||||||
|
var s = Temp_this.Settings.触发_回调;
|
||||||
|
for (var j = 0; j < s.length; j++) {
|
||||||
|
temp.Create(s[j]).Execute(c, i, temp.Create(s[j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (Temp_this.Settings.触发_否则 != undefined || Temp_this.Settings.触发_否则 != null) {
|
||||||
|
var temp = new GameAction();
|
||||||
|
var s = Temp_this.Settings.触发_否则;
|
||||||
|
for (var j = 0; j < s.length; j++) {
|
||||||
|
temp.Create(s[j]).Execute(c, i, temp.Create(s[j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Temp_this.Type == "战斗=>扣血") {
|
||||||
|
var data_obj = JSON.parse(fs.readFileSync("./UnderDenyData/Player.json").toString());
|
||||||
|
var Player = new PlayerData(data_obj[i.user_id.toString()].Info);
|
||||||
|
console.log(Temp_this.Settings);
|
||||||
|
Player.HP = Player.HP.valueOf() - Temp_this.Settings.战斗_扣血.valueOf();
|
||||||
|
Core.frame.SendMsg(c, i, Temp_this.Settings.战斗_目标 + "\u5BF9\u4F60\u4F7F\u7528\u4E86" + Temp_this.Settings.战斗_弹幕 + "\uFF0C\u9020\u6210" + Temp_this.Settings.战斗_扣血 + "\u70B9\u4F24\u5BB3\uFF0C\u4F60\u5269\u4F59" + Player.HP + "\u70B9\u8840\u91CF\u3002");
|
||||||
|
data_obj[i.user_id.toString()].Info = Player;
|
||||||
|
if (Player.HP < 0) {
|
||||||
|
data_obj[i.user_id.toString()] = undefined;
|
||||||
|
Core.frame.SendMsg(c, i, "\u4F60\u5931\u8D25\u4E86\r\n" + Core.frame.At(i.user_id) + "\u4FDD\u6301\u4F60\u7684\u51B3\u5FC3\u3002");
|
||||||
|
}
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
;
|
;
|
||||||
GameAction.prototype.Create = function (that) {
|
GameAction.prototype.Create = function (that) {
|
||||||
@ -93,7 +126,7 @@ Core.AddListener(function (connect, info) {
|
|||||||
Core.frame.SendMsg(connect, info, Core.frame.At(info.user_id) + ",\u4F60\u8FD8\u5728\u8FDB\u884C\u6E38\u620F\uFF0C\u53D1\u9001\"UD\u91CD\u7F6E\"\u624D\u53EF\u4EE5\u91CD\u65B0\u5F00\u59CB");
|
Core.frame.SendMsg(connect, info, Core.frame.At(info.user_id) + ",\u4F60\u8FD8\u5728\u8FDB\u884C\u6E38\u620F\uFF0C\u53D1\u9001\"UD\u91CD\u7F6E\"\u624D\u53EF\u4EE5\u91CD\u65B0\u5F00\u59CB");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerData[info.user_id.toString()] = { Schedule: "Start", Vars: {}, Info: { LOVE: 0, EXP: 0, HP: 21, Itea: [] } };
|
PlayerData[info.user_id.toString()] = { Schedule: "Start", Vars: {}, Info: { LOVE: 0, EXP: 0, HP: 21, Item: [] } };
|
||||||
fs.readFile("./UnderDenyData/Script.json", function (err2, data2) {
|
fs.readFile("./UnderDenyData/Script.json", function (err2, data2) {
|
||||||
var data_obj = JSON.parse(data2.toString());
|
var data_obj = JSON.parse(data2.toString());
|
||||||
PlayerData[info.user_id.toString()].Vars = data_obj["Settings"]["init"];
|
PlayerData[info.user_id.toString()].Vars = data_obj["Settings"]["init"];
|
||||||
@ -132,6 +165,26 @@ Core.AddListener(function (connect, info) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (msg == "进行存档") {
|
||||||
|
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
||||||
|
var PlayerData = JSON.parse(data.toString());
|
||||||
|
if (PlayerData[info.user_id.toString()] == undefined) {
|
||||||
|
Core.frame.SendMsg(connect, info, Core.frame.At(info.user_id) + ",\u4F60\u6CA1\u6709\u8FDB\u884C\u6E38\u620F\uFF0C\u53D1\u9001\"UD\u5F00\u59CB\u6E38\u620F\"\u6765\u5F00\u59CB\u6E38\u620F\u3002");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.readFile("./UnderDenyData/Script.json", function (err2, data2) {
|
||||||
|
var data2_obj = JSON.parse(data2.toString());
|
||||||
|
if (data2_obj["Game"][PlayerData[info.user_id.toString()].Schedule].SaveAble != true) {
|
||||||
|
Core.frame.SendMsg(connect, info, "此时你无法存档。");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PlayerData[info.user_id + "_SAVE"] = PlayerData[info.user_id.toString()];
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(PlayerData), function (err3) { });
|
||||||
|
Core.frame.SendMsg(connect, info, data2_obj["Game"][PlayerData[info.user_id.toString()].Schedule].SaveInfo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
if (msg.substr(0, 2) == "行动") {
|
if (msg.substr(0, 2) == "行动") {
|
||||||
var action = msg.replace("行动", "");
|
var action = msg.replace("行动", "");
|
||||||
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
||||||
@ -151,7 +204,7 @@ Core.AddListener(function (connect, info) {
|
|||||||
var ActionGroup = GameAct[action];
|
var ActionGroup = GameAct[action];
|
||||||
var Act = new GameAction();
|
var Act = new GameAction();
|
||||||
for (var i = 0; i < ActionGroup.length; i++) {
|
for (var i = 0; i < ActionGroup.length; i++) {
|
||||||
Act.Create(ActionGroup[i]).Execute(connect, info);
|
Act.Create(ActionGroup[i]).Execute(connect, info, Act.Create(ActionGroup[i]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -17,35 +17,74 @@ class GameAction{
|
|||||||
常量_设置?:String;
|
常量_设置?:String;
|
||||||
判断_变量?:String;
|
判断_变量?:String;
|
||||||
判断_依据?:String;
|
判断_依据?:String;
|
||||||
判断_执行?:GameAction;
|
判断_执行?:GameAction[];
|
||||||
|
触发_几率?:Number;
|
||||||
|
触发_回调?:GameAction[];
|
||||||
|
触发_否则?:GameAction[];
|
||||||
|
战斗_目标?:String;
|
||||||
|
战斗_弹幕?:String;
|
||||||
|
战斗_扣血?:Number;
|
||||||
};
|
};
|
||||||
Execute(c:Socket,i:Core.InfoType){
|
Execute(c:Socket,i:Core.InfoType,Temp_this:GameAction){
|
||||||
if(this.Type=="对话"){
|
if(Temp_this.Type=="对话"){
|
||||||
Core.frame.SendMsg(c,i,`${this.Settings.对话_内容}`);
|
Core.frame.SendMsg(c,i,`${Temp_this.Settings.对话_内容}`);
|
||||||
}
|
}
|
||||||
if(this.Type=="跳转"){
|
if(Temp_this.Type=="跳转"){
|
||||||
|
var data = fs.readFileSync("./UnderDenyData/Player.json");
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
data_obj[i.user_id.toString()].Schedule = (Temp_this.Settings.跳转_目标 as String).valueOf();
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json",JSON.stringify(data_obj),(err2)=>{});
|
||||||
|
}
|
||||||
|
if(Temp_this.Type=="判断"){
|
||||||
fs.readFile("./UnderDenyData/Player.json",(err,data)=>{
|
fs.readFile("./UnderDenyData/Player.json",(err,data)=>{
|
||||||
var data_obj = JSON.parse(data.toString());
|
var data_obj = JSON.parse(data.toString());
|
||||||
data_obj[i.user_id.toString()].Schedule = (this.Settings.跳转_目标 as string).valueOf();
|
if(data_obj[i.user_id.toString()].Vars[(Temp_this.Settings.判断_变量 as String).valueOf()] == (Temp_this.Settings.判断_依据 as String).valueOf()){
|
||||||
fs.writeFile("./UnderDenyData/Player.json",JSON.stringify(data_obj),(err2)=>{});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if(this.Type=="判断"){
|
|
||||||
fs.readFile("./UnderDenyData/Player.json",(err,data)=>{
|
|
||||||
var data_obj = JSON.parse(data.toString());
|
|
||||||
if(data_obj[i.user_id.toString()].Vars[(this.Settings.判断_变量 as String).valueOf()] == (this.Settings.判断_依据 as String).valueOf()){
|
|
||||||
var temp = new GameAction();
|
var temp = new GameAction();
|
||||||
temp.Create(this.Settings.判断_执行 as GameAction).Execute(c,i);
|
var s = (Temp_this.Settings.判断_执行 as GameAction[]);
|
||||||
|
for(var j=0;j<s.length;j++){
|
||||||
|
temp.Create(s[j]).Execute(c,i,temp.Create(s[j]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(this.Type=="变量"){
|
if(Temp_this.Type=="变量"){
|
||||||
fs.readFile("./UnderDenyData/Player.json",(err,data)=>{
|
fs.readFile("./UnderDenyData/Player.json",(err,data)=>{
|
||||||
var data_obj = JSON.parse(data.toString());
|
var data_obj = JSON.parse(data.toString());
|
||||||
data_obj[i.user_id.toString()].Vars[(this.Settings.变量_设置 as String).valueOf()] = (this.Settings.变量_内容 as String).valueOf();
|
data_obj[i.user_id.toString()].Vars[(Temp_this.Settings.变量_设置 as String).valueOf()] = (Temp_this.Settings.变量_内容 as String).valueOf();
|
||||||
fs.writeFile("./UnderDenyData/Player.json",JSON.stringify(data_obj),(err2)=>{});
|
fs.writeFile("./UnderDenyData/Player.json",JSON.stringify(data_obj),(err2)=>{});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if(Temp_this.Type=="随机"){
|
||||||
|
var rom = Math.floor(Math.random() * 100);
|
||||||
|
if(rom<(Temp_this.Settings.触发_几率 as Number).valueOf()){
|
||||||
|
var temp = new GameAction();
|
||||||
|
var s = (Temp_this.Settings.触发_回调 as GameAction[]);
|
||||||
|
for(var j=0;j<s.length;j++){
|
||||||
|
temp.Create(s[j]).Execute(c,i,temp.Create(s[j]));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(Temp_this.Settings.触发_否则!=undefined||Temp_this.Settings.触发_否则!=null){
|
||||||
|
var temp = new GameAction();
|
||||||
|
var s = (Temp_this.Settings.触发_否则 as GameAction[]);
|
||||||
|
for(var j=0;j<s.length;j++){
|
||||||
|
temp.Create(s[j]).Execute(c,i,temp.Create(s[j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Temp_this.Type=="战斗=>扣血"){
|
||||||
|
var data_obj = JSON.parse(fs.readFileSync("./UnderDenyData/Player.json").toString());
|
||||||
|
var Player = new PlayerData(data_obj[i.user_id.toString()].Info as PlayerData);
|
||||||
|
console.log(Temp_this.Settings);
|
||||||
|
Player.HP = Player.HP.valueOf() - (Temp_this.Settings.战斗_扣血 as Number).valueOf();
|
||||||
|
Core.frame.SendMsg(c,i,`${Temp_this.Settings.战斗_目标 as String}对你使用了${Temp_this.Settings.战斗_弹幕 as String},造成${(Temp_this.Settings.战斗_扣血 as Number)}点伤害,你剩余${Player.HP}点血量。`)
|
||||||
|
data_obj[i.user_id.toString()].Info = Player;
|
||||||
|
if(Player.HP<0){
|
||||||
|
data_obj[i.user_id.toString()] = undefined;
|
||||||
|
Core.frame.SendMsg(c,i,`你失败了\r\n${Core.frame.At(i.user_id)}保持你的决心。`);
|
||||||
|
}
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json",JSON.stringify(data_obj),(err2)=>{});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Create(that:GameAction):GameAction{
|
Create(that:GameAction):GameAction{
|
||||||
if(that!=undefined){
|
if(that!=undefined){
|
||||||
@ -97,7 +136,7 @@ Core.AddListener((connect,info)=>{
|
|||||||
Core.frame.SendMsg(connect,info,`${Core.frame.At(info.user_id)},你还在进行游戏,发送\"UD重置\"才可以重新开始`);
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(info.user_id)},你还在进行游戏,发送\"UD重置\"才可以重新开始`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerData[info.user_id.toString()] = {Schedule:"Start",Vars:{},Info:{LOVE:0,EXP:0,HP:21,Itea:[]}}
|
PlayerData[info.user_id.toString()] = {Schedule:"Start",Vars:{},Info:{LOVE:0,EXP:0,HP:21,Item:[]}}
|
||||||
fs.readFile("./UnderDenyData/Script.json",(err2,data2)=>{
|
fs.readFile("./UnderDenyData/Script.json",(err2,data2)=>{
|
||||||
var data_obj = JSON.parse(data2.toString());
|
var data_obj = JSON.parse(data2.toString());
|
||||||
PlayerData[info.user_id.toString()].Vars = data_obj["Settings"]["init"];
|
PlayerData[info.user_id.toString()].Vars = data_obj["Settings"]["init"];
|
||||||
@ -136,6 +175,27 @@ Core.AddListener((connect,info)=>{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(msg == "进行存档"){
|
||||||
|
fs.readFile("./UnderDenyData/Player.json",(err,data)=>{
|
||||||
|
var PlayerData = JSON.parse(data.toString());
|
||||||
|
if(PlayerData[info.user_id.toString()]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(info.user_id)},你没有进行游戏,发送\"UD开始游戏\"来开始游戏。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.readFile("./UnderDenyData/Script.json",(err2,data2)=>{
|
||||||
|
var data2_obj = JSON.parse(data2.toString());
|
||||||
|
if(data2_obj["Game"][PlayerData[info.user_id.toString()].Schedule].SaveAble!=true){
|
||||||
|
Core.frame.SendMsg(connect,info,"此时你无法存档。");
|
||||||
|
}else{
|
||||||
|
PlayerData[`${info.user_id}_SAVE`] = PlayerData[info.user_id.toString()];
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json",JSON.stringify(PlayerData),(err3)=>{});
|
||||||
|
Core.frame.SendMsg(connect,info,data2_obj["Game"][PlayerData[info.user_id.toString()].Schedule].SaveInfo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(msg.substr(0,2)=="行动"){
|
if(msg.substr(0,2)=="行动"){
|
||||||
var action = msg.replace("行动","");
|
var action = msg.replace("行动","");
|
||||||
fs.readFile("./UnderDenyData/Player.json",(err,data)=>{
|
fs.readFile("./UnderDenyData/Player.json",(err,data)=>{
|
||||||
@ -155,7 +215,7 @@ Core.AddListener((connect,info)=>{
|
|||||||
var ActionGroup = GameAct[action] as Array<GameAction>;
|
var ActionGroup = GameAct[action] as Array<GameAction>;
|
||||||
var Act:GameAction|undefined = new GameAction();
|
var Act:GameAction|undefined = new GameAction();
|
||||||
for(var i=0;i<ActionGroup.length;i++){
|
for(var i=0;i<ActionGroup.length;i++){
|
||||||
Act.Create(ActionGroup[i]).Execute(connect,info);
|
Act.Create(ActionGroup[i]).Execute(connect,info,Act.Create(ActionGroup[i]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
4
UD/对于UD内核地相关事务
普通文件
4
UD/对于UD内核地相关事务
普通文件
@ -0,0 +1,4 @@
|
|||||||
|
UD文字版内核不同于JSTextGameCore。
|
||||||
|
UDTC和JTGC都使用CIS编写的TWS作为参数库(Type With Settings:类型和设置),所以在语法上内容相似,但实现机制完全不一致。
|
||||||
|
UDTC针对OnlineAi Core做了特别的优化适配,而JTGC只是一般插件。
|
||||||
|
UDTC针对JTGC的Items库和Attack库做了特别修改,
|
||||||
89
UnderDeny.js
89
UnderDeny.js
@ -19,34 +19,67 @@ var GameAction = /** @class */ (function () {
|
|||||||
this.Type = "";
|
this.Type = "";
|
||||||
this.Settings = {};
|
this.Settings = {};
|
||||||
}
|
}
|
||||||
GameAction.prototype.Execute = function (c, i) {
|
GameAction.prototype.Execute = function (c, i, Temp_this) {
|
||||||
var _this = this;
|
if (Temp_this.Type == "对话") {
|
||||||
if (this.Type == "对话") {
|
Core.frame.SendMsg(c, i, "" + Temp_this.Settings.对话_内容);
|
||||||
Core.frame.SendMsg(c, i, "" + this.Settings.对话_内容);
|
|
||||||
}
|
}
|
||||||
if (this.Type == "跳转") {
|
if (Temp_this.Type == "跳转") {
|
||||||
|
var data = fs.readFileSync("./UnderDenyData/Player.json");
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
data_obj[i.user_id.toString()].Schedule = Temp_this.Settings.跳转_目标.valueOf();
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
||||||
|
}
|
||||||
|
if (Temp_this.Type == "判断") {
|
||||||
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
||||||
var data_obj = JSON.parse(data.toString());
|
var data_obj = JSON.parse(data.toString());
|
||||||
data_obj[i.user_id.toString()].Schedule = _this.Settings.跳转_目标.valueOf();
|
if (data_obj[i.user_id.toString()].Vars[Temp_this.Settings.判断_变量.valueOf()] == Temp_this.Settings.判断_依据.valueOf()) {
|
||||||
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.Type == "判断") {
|
|
||||||
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
|
||||||
var data_obj = JSON.parse(data.toString());
|
|
||||||
if (data_obj[i.user_id.toString()].Vars[_this.Settings.判断_变量.valueOf()] == _this.Settings.判断_依据.valueOf()) {
|
|
||||||
var temp = new GameAction();
|
var temp = new GameAction();
|
||||||
temp.Create(_this.Settings.判断_执行).Execute(c, i);
|
var s = Temp_this.Settings.判断_执行;
|
||||||
|
for (var j = 0; j < s.length; j++) {
|
||||||
|
temp.Create(s[j]).Execute(c, i, temp.Create(s[j]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.Type == "变量") {
|
if (Temp_this.Type == "变量") {
|
||||||
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
||||||
var data_obj = JSON.parse(data.toString());
|
var data_obj = JSON.parse(data.toString());
|
||||||
data_obj[i.user_id.toString()].Vars[_this.Settings.变量_设置.valueOf()] = _this.Settings.变量_内容.valueOf();
|
data_obj[i.user_id.toString()].Vars[Temp_this.Settings.变量_设置.valueOf()] = Temp_this.Settings.变量_内容.valueOf();
|
||||||
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (Temp_this.Type == "随机") {
|
||||||
|
var rom = Math.floor(Math.random() * 100);
|
||||||
|
if (rom < Temp_this.Settings.触发_几率.valueOf()) {
|
||||||
|
var temp = new GameAction();
|
||||||
|
var s = Temp_this.Settings.触发_回调;
|
||||||
|
for (var j = 0; j < s.length; j++) {
|
||||||
|
temp.Create(s[j]).Execute(c, i, temp.Create(s[j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (Temp_this.Settings.触发_否则 != undefined || Temp_this.Settings.触发_否则 != null) {
|
||||||
|
var temp = new GameAction();
|
||||||
|
var s = Temp_this.Settings.触发_否则;
|
||||||
|
for (var j = 0; j < s.length; j++) {
|
||||||
|
temp.Create(s[j]).Execute(c, i, temp.Create(s[j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Temp_this.Type == "战斗=>扣血") {
|
||||||
|
var data_obj = JSON.parse(fs.readFileSync("./UnderDenyData/Player.json").toString());
|
||||||
|
var Player = new PlayerData(data_obj[i.user_id.toString()].Info);
|
||||||
|
console.log(Temp_this.Settings);
|
||||||
|
Player.HP = Player.HP.valueOf() - Temp_this.Settings.战斗_扣血.valueOf();
|
||||||
|
Core.frame.SendMsg(c, i, Temp_this.Settings.战斗_目标 + "\u5BF9\u4F60\u4F7F\u7528\u4E86" + Temp_this.Settings.战斗_弹幕 + "\uFF0C\u9020\u6210" + Temp_this.Settings.战斗_扣血 + "\u70B9\u4F24\u5BB3\uFF0C\u4F60\u5269\u4F59" + Player.HP + "\u70B9\u8840\u91CF\u3002");
|
||||||
|
data_obj[i.user_id.toString()].Info = Player;
|
||||||
|
if (Player.HP < 0) {
|
||||||
|
data_obj[i.user_id.toString()] = undefined;
|
||||||
|
Core.frame.SendMsg(c, i, "\u4F60\u5931\u8D25\u4E86\r\n" + Core.frame.At(i.user_id) + "\u4FDD\u6301\u4F60\u7684\u51B3\u5FC3\u3002");
|
||||||
|
}
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(data_obj), function (err2) { });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
;
|
;
|
||||||
GameAction.prototype.Create = function (that) {
|
GameAction.prototype.Create = function (that) {
|
||||||
@ -93,7 +126,7 @@ Core.AddListener(function (connect, info) {
|
|||||||
Core.frame.SendMsg(connect, info, Core.frame.At(info.user_id) + ",\u4F60\u8FD8\u5728\u8FDB\u884C\u6E38\u620F\uFF0C\u53D1\u9001\"UD\u91CD\u7F6E\"\u624D\u53EF\u4EE5\u91CD\u65B0\u5F00\u59CB");
|
Core.frame.SendMsg(connect, info, Core.frame.At(info.user_id) + ",\u4F60\u8FD8\u5728\u8FDB\u884C\u6E38\u620F\uFF0C\u53D1\u9001\"UD\u91CD\u7F6E\"\u624D\u53EF\u4EE5\u91CD\u65B0\u5F00\u59CB");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerData[info.user_id.toString()] = { Schedule: "Start", Vars: {}, Info: { LOVE: 0, EXP: 0, HP: 21, Itea: [] } };
|
PlayerData[info.user_id.toString()] = { Schedule: "Start", Vars: {}, Info: { LOVE: 0, EXP: 0, HP: 21, Item: [] } };
|
||||||
fs.readFile("./UnderDenyData/Script.json", function (err2, data2) {
|
fs.readFile("./UnderDenyData/Script.json", function (err2, data2) {
|
||||||
var data_obj = JSON.parse(data2.toString());
|
var data_obj = JSON.parse(data2.toString());
|
||||||
PlayerData[info.user_id.toString()].Vars = data_obj["Settings"]["init"];
|
PlayerData[info.user_id.toString()].Vars = data_obj["Settings"]["init"];
|
||||||
@ -132,6 +165,26 @@ Core.AddListener(function (connect, info) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (msg == "进行存档") {
|
||||||
|
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
||||||
|
var PlayerData = JSON.parse(data.toString());
|
||||||
|
if (PlayerData[info.user_id.toString()] == undefined) {
|
||||||
|
Core.frame.SendMsg(connect, info, Core.frame.At(info.user_id) + ",\u4F60\u6CA1\u6709\u8FDB\u884C\u6E38\u620F\uFF0C\u53D1\u9001\"UD\u5F00\u59CB\u6E38\u620F\"\u6765\u5F00\u59CB\u6E38\u620F\u3002");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.readFile("./UnderDenyData/Script.json", function (err2, data2) {
|
||||||
|
var data2_obj = JSON.parse(data2.toString());
|
||||||
|
if (data2_obj["Game"][PlayerData[info.user_id.toString()].Schedule].SaveAble != true) {
|
||||||
|
Core.frame.SendMsg(connect, info, "此时你无法存档。");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PlayerData[info.user_id + "_SAVE"] = PlayerData[info.user_id.toString()];
|
||||||
|
fs.writeFile("./UnderDenyData/Player.json", JSON.stringify(PlayerData), function (err3) { });
|
||||||
|
Core.frame.SendMsg(connect, info, data2_obj["Game"][PlayerData[info.user_id.toString()].Schedule].SaveInfo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
if (msg.substr(0, 2) == "行动") {
|
if (msg.substr(0, 2) == "行动") {
|
||||||
var action = msg.replace("行动", "");
|
var action = msg.replace("行动", "");
|
||||||
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
fs.readFile("./UnderDenyData/Player.json", function (err, data) {
|
||||||
@ -151,7 +204,7 @@ Core.AddListener(function (connect, info) {
|
|||||||
var ActionGroup = GameAct[action];
|
var ActionGroup = GameAct[action];
|
||||||
var Act = new GameAction();
|
var Act = new GameAction();
|
||||||
for (var i = 0; i < ActionGroup.length; i++) {
|
for (var i = 0; i < ActionGroup.length; i++) {
|
||||||
Act.Create(ActionGroup[i]).Execute(connect, info);
|
Act.Create(ActionGroup[i]).Execute(connect, info, Act.Create(ActionGroup[i]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
二进制文件未显示。
@ -0,0 +1 @@
|
|||||||
|
a006da68cee2e5948f791e89043c9fd33dcfa03a
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
C:\Users\1\source\repos\JSAICore\JSAICore\obj\Debug\JSAICore.njsproj.CoreCompileInputs.cache
|
||||||
|
C:\Users\1\source\repos\JSAICore\JSAICore\bin\Microsoft.NodejsTools.WebRole.dll
|
||||||
15
test.js
15
test.js
@ -1,14 +1,21 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
exports.__esModule = true;
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
var Core = require("./Core");
|
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 });
|
||||||
|
var Core = __importStar(require("./Core"));
|
||||||
var ZExec = (function (Str) { return ""; });
|
var ZExec = (function (Str) { return ""; });
|
||||||
(function (R, Info) {
|
(function (R, Info) {
|
||||||
if (R.$1.indexOf("则") == -1) {
|
if (R.$1.indexOf("则") == -1) {
|
||||||
return "行动缺失";
|
return "行动缺失";
|
||||||
}
|
}
|
||||||
var k = R.$1.split("则", 2);
|
var k = R.$1.split("则", 2);
|
||||||
console.log(k);
|
console.log("k:" + k + "k");
|
||||||
console.log(R.$1);
|
console.log("" + R.$1);
|
||||||
console.log(ZExec(k[0]));
|
console.log(ZExec(k[0]));
|
||||||
console.log(eval(ZExec(k[1])));
|
console.log(eval(ZExec(k[1])));
|
||||||
if (eval(ZExec(k[0]))) {
|
if (eval(ZExec(k[0]))) {
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户