初始化仓库:友乐/gameabc 房卡游戏平台脚手架(client + server + docs)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
///////////////////////////////////////////////////
|
||||
////////////////////系统服务app////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
var app_server = app_server || cls_app.new("server", packet_face);
|
||||
|
||||
//加载或更新js文件
|
||||
min_loadJsFile("server/loadjs/mod.js", function (){
|
||||
//服务器心跳包
|
||||
min_loadJsFile("server/heartbeat/mod.js", function (){
|
||||
//通道管理
|
||||
min_loadJsFile("server/channel/mod.js", function (){
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//TCP客户端连上
|
||||
app_server.OnTcpConnected = function(_str_tcpid) {
|
||||
for (var i = 0; i < app_server.modlist.length; i++) {
|
||||
if (app_server.modlist[i].OnTcpConnected) {
|
||||
app_server.modlist[i].OnTcpConnected(_str_tcpid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
///////////////////////////////////////////////////
|
||||
////////////////////// 通道管理 ///////////////////
|
||||
///////////////////////////////////////////////////
|
||||
var mod_channel = mod_channel || cls_mod.new("mod_channel", "channel", app_server);
|
||||
|
||||
//最小通道id
|
||||
mod_channel.minid = 100000;
|
||||
//最大通道id
|
||||
mod_channel.maxid = 999999;
|
||||
|
||||
//可用的通道id列表
|
||||
mod_channel.ids = [];
|
||||
mod_channel.ids.length = mod_channel.maxid - mod_channel.minid + 1;
|
||||
for (var i = 0; i < mod_channel.ids.length; i++) {
|
||||
mod_channel.ids[i] = mod_channel.minid + i;
|
||||
};
|
||||
//可用的通道id列表的有效长度
|
||||
mod_channel.validlen = mod_channel.maxid - mod_channel.minid + 1;
|
||||
|
||||
//通道列表
|
||||
mod_channel.list = [];
|
||||
mod_channel.list.length = mod_channel.maxid - mod_channel.minid + 1;
|
||||
|
||||
//创建
|
||||
mod_channel.create = function(pack){
|
||||
//在有效通道id列表中随机数组下标
|
||||
var idx = min_random(0, mod_channel.validlen - 1);
|
||||
//确定通道id
|
||||
var id = mod_channel.ids[idx];
|
||||
//将有效数组的最后一个房号移至该位置
|
||||
if (idx < mod_channel.validlen - 1) {
|
||||
mod_channel.ids[idx] = mod_channel.ids[mod_channel.validlen - 1];
|
||||
};
|
||||
mod_channel.ids[mod_channel.validlen - 1] = 0;
|
||||
//有效数组长度减1
|
||||
mod_channel.validlen = mod_channel.validlen - 1;
|
||||
//根据通道id创建通道
|
||||
var o_channel = {};
|
||||
o_channel.id = id;
|
||||
o_channel.plist = []; //谁在通道里面
|
||||
//添加到通道列表中
|
||||
mod_channel.list[id - mod_channel.minid] = o_channel;
|
||||
|
||||
//返回前端
|
||||
pack.data = {};
|
||||
pack.data.channelid = id;
|
||||
return pack;
|
||||
}
|
||||
|
||||
//释放
|
||||
mod_channel.free = function(pack){
|
||||
var channelid = parseInt(pack.data.channelid);
|
||||
|
||||
//通道序号
|
||||
var idx = channelid - mod_channel.minid;
|
||||
|
||||
//检查通道id
|
||||
if (idx < 0 || idx >= mod_channel.list.length) {
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "通道id不存在";
|
||||
return pack;
|
||||
}
|
||||
|
||||
if (!mod_channel.list[idx]) {
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "通道id不存在";
|
||||
return pack;
|
||||
}
|
||||
|
||||
//释放通道
|
||||
mod_channel.list[idx] = null;
|
||||
|
||||
//释放通道id
|
||||
mod_channel.ids[mod_channel.validlen] = channelid;
|
||||
mod_channel.validlen = mod_channel.validlen + 1;
|
||||
|
||||
//返回前端
|
||||
pack.data = {};
|
||||
pack.data.state = 0;
|
||||
return pack;
|
||||
}
|
||||
|
||||
//加入
|
||||
mod_channel.join = function(pack){
|
||||
var channelid = parseInt(pack.data.channelid);
|
||||
|
||||
//通道序号
|
||||
var idx = channelid - mod_channel.minid;
|
||||
|
||||
//检查通道id
|
||||
if (idx < 0 || idx >= mod_channel.list.length) {
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "通道id不存在";
|
||||
return pack;
|
||||
}
|
||||
|
||||
if (!mod_channel.list[idx]) {
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "通道id不存在";
|
||||
return pack;
|
||||
}
|
||||
|
||||
o_channel = mod_channel.list[idx];
|
||||
var p = {};
|
||||
p.conmode = pack.conmode;
|
||||
p.fromid = pack.fromid;
|
||||
o_channel.plist.push(p);
|
||||
|
||||
//返回前端
|
||||
pack.data = {};
|
||||
pack.data.state = 0;
|
||||
return pack;
|
||||
}
|
||||
|
||||
//退出
|
||||
mod_channel.exit = function(pack){
|
||||
var channelid = parseInt(pack.data.channelid);
|
||||
|
||||
//通道序号
|
||||
var idx = channelid - mod_channel.minid;
|
||||
|
||||
//检查通道id
|
||||
if (idx < 0 || idx >= mod_channel.list.length) {
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "通道id不存在";
|
||||
return pack;
|
||||
}
|
||||
|
||||
if (!mod_channel.list[idx]) {
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "通道id不存在";
|
||||
return pack;
|
||||
}
|
||||
|
||||
o_channel = mod_channel.list[idx];
|
||||
for (var i = 0; i < o_channel.plist.length; i++) {
|
||||
if (o_channel.plist[i]) {
|
||||
if (o_channel.plist[i].fromid == pack.fromid) {
|
||||
o_channel.plist[i] = null;
|
||||
//返回前端
|
||||
pack.data = {};
|
||||
pack.data.state = 0;
|
||||
return pack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//返回前端
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "未在通道内";
|
||||
return pack;
|
||||
}
|
||||
|
||||
//广播
|
||||
mod_channel.broadcast = function(pack){
|
||||
var channelid = parseInt(pack.data.channelid);
|
||||
var content = pack.data.msg;
|
||||
|
||||
//通道序号
|
||||
var idx = channelid - mod_channel.minid;
|
||||
|
||||
//检查通道id
|
||||
if (idx < 0 || idx >= mod_channel.list.length) {
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "通道id不存在";
|
||||
return pack;
|
||||
}
|
||||
|
||||
if (!mod_channel.list[idx]) {
|
||||
pack.data = {};
|
||||
pack.data.state = 1;
|
||||
pack.data.error = "通道id不存在";
|
||||
return pack;
|
||||
}
|
||||
|
||||
o_channel = mod_channel.list[idx];
|
||||
for (var i = 0; i < o_channel.plist.length; i++) {
|
||||
if (o_channel.plist[i]) {
|
||||
//广播前端
|
||||
var msg = {};
|
||||
msg.app = pack.app;
|
||||
msg.route = pack.route;
|
||||
msg.rpc = pack.rpc;
|
||||
msg.conmode = o_channel.plist[i].conmode;
|
||||
msg.fromid = o_channel.plist[i].fromid;
|
||||
msg.data = {};
|
||||
msg.data.state = 0;
|
||||
msg.data.msg = content;
|
||||
mod_channel.app.SendPack(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//断线
|
||||
mod_channel.OnTcpDisConnected = function(str_tcpid){
|
||||
for (var i = 0; i < mod_channel.list.length; i++) {
|
||||
if (mod_channel.list[i]){
|
||||
for (var j = 0; j < mod_channel.list[i].plist.length; j++) {
|
||||
if (mod_channel.list[i].plist[j]) {
|
||||
if (mod_channel.list[i].plist[j].fromid == str_tcpid) {
|
||||
//广播前端
|
||||
var msg = {};
|
||||
msg.app = mod_channel.app.appname;
|
||||
msg.route = mod_channel.routename;
|
||||
msg.rpc = "disconnected";
|
||||
msg.data = {};
|
||||
msg.data.channelid = mod_channel.list[i].id;
|
||||
msg.data.idx = j;
|
||||
for (var k = 0; k < mod_channel.list[i].plist.length; k++) {
|
||||
if (k != j){
|
||||
msg.conmode = mod_channel.list[i].plist[k].conmode;
|
||||
msg.fromid = mod_channel.list[i].plist[k].fromid;
|
||||
mod_channel.app.SendPack(msg);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
var NN_control = {};
|
||||
NN_control.showlog = 0; //是否显示平衡日志
|
||||
|
||||
//非星星场历史累计平衡
|
||||
NN_control.hist_high_grade = 5000; //历史累计得分最高的玩家平衡阀值
|
||||
NN_control.hist_high_rate = 15; //历史累计得分最高的玩家平衡至倒数第一的概率
|
||||
|
||||
//非星星场当前局大分平衡
|
||||
NN_control.curr_high_grade = 800; //当前局得分最高的玩家平衡阀值
|
||||
NN_control.curr_high_rate1 = 30; //当前局得分最高的玩家平衡至倒数第一的概率
|
||||
NN_control.curr_high_rate2 = 20; //当前局得分最高的玩家平衡至倒数第二的概率
|
||||
NN_control.curr_low_grade = -400; //当前局得分最低的玩家平衡阀值
|
||||
NN_control.curr_low_rate1 = 30; //当前局得分最低的玩家平衡至第一的概率
|
||||
NN_control.curr_low_rate2 = 20; //当前局得分最低的玩家平衡至第二的概率
|
||||
|
||||
//星星场历史平衡
|
||||
NN_control.xx_hist_high_min = 5000; //历史累计得分最高的玩家平衡阀值范围:最小值
|
||||
NN_control.xx_hist_high_max = 10000; //历史累计得分最高的玩家平衡阀值范围:最大值
|
||||
NN_control.xx_hist_high_rate = 15; //历史累计得分最高的玩家平衡至倒数第一的概率
|
||||
|
||||
//robot
|
||||
NN_control.xx_rb_hist_high_min = 0;
|
||||
NN_control.xx_rb_hist_high_max = 100000;
|
||||
NN_control.xx_rb_hist_high_rate = 15;
|
||||
|
||||
NN_control.xx_rb_hist_low_min = -100000;
|
||||
NN_control.xx_rb_hist_low_max = 0;
|
||||
NN_control.xx_rb_hist_low_rate = 15;
|
||||
|
||||
NN_control.xx_rb_offset = 0; //偏移值
|
||||
|
||||
NN_control.conctllog = function(log){
|
||||
if (NN_control.showlog){
|
||||
console.log(log);
|
||||
}
|
||||
}
|
||||
|
||||
// min_loadJsFile("server/channel/mod_ctl1.js",function(){});
|
||||
min_loadJsFile("server/channel/mod_ctl2.js",function(){});
|
||||
@@ -0,0 +1,375 @@
|
||||
if (typeof NN_deskInfo!="undefined"){
|
||||
|
||||
NN_deskInfo.prototype.logic_dealCards = function(seatList, isDealAll){
|
||||
//对应玩家发牌
|
||||
if(!seatList){
|
||||
return ;
|
||||
};
|
||||
if(isDealAll){ //是否发所有玩家的牌
|
||||
seatList = [];
|
||||
for(var i=0;i<this.pList.length;i++){
|
||||
if(this.pList[i] && this.pList[i].gameinfo.isprepare){
|
||||
seatList.push(i);
|
||||
//标记庄参与游戏
|
||||
this.room.seatlist[i].gameinfo.isbet = 1;
|
||||
this.pList[i].isJoin = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
//获取随机牌组
|
||||
var _cards = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];
|
||||
if(this.pairs == 2){
|
||||
_cards = _cards.concat(_cards);
|
||||
};
|
||||
var c_list = [];
|
||||
var a = 0;
|
||||
for(var i=0;i<seatList.length;i++){
|
||||
c_list[i] = [];
|
||||
for(var j=0;j<5;j++){
|
||||
a = min_random1(_cards.length);
|
||||
c_list[i][j] = _cards[a];
|
||||
_cards.splice(a,1);
|
||||
};
|
||||
};
|
||||
|
||||
//玩家得到牌
|
||||
for(var i=0;i<seatList.length;i++){
|
||||
this.pList[seatList[i]].cards.cards = c_list[i].slice(0);
|
||||
|
||||
//分析牌型
|
||||
this.pList[seatList[i]].cards.AnalysisType(this.cardList,this.model_mult,this.cardTypeMult[1]);
|
||||
|
||||
if(this.model == 4 || this.model == 5){ //看牌抢庄时默认搓第三张牌
|
||||
this.pList[seatList[i]].rubcard = [3];
|
||||
};
|
||||
};
|
||||
|
||||
try{
|
||||
//牌从大到小排序
|
||||
var _order_pai = function(){
|
||||
var _result = [];
|
||||
for (var i = 0; i < seatList.length; i++){
|
||||
var _isfound = false;
|
||||
for (var j = 0; j < _result.length; j++){
|
||||
if (this.compareCards(seatList[i], seatList[_result[j]])){
|
||||
_result.splice(j, 0, i);
|
||||
_isfound = true;
|
||||
break;
|
||||
};
|
||||
};
|
||||
if (!_isfound){
|
||||
_result.push(i);
|
||||
};
|
||||
};
|
||||
return _result;
|
||||
}.bind(this);
|
||||
//历史输赢从低到高排序
|
||||
var _order_winlose = function(){
|
||||
var _result = [];
|
||||
for (var i = 0; i < seatList.length; i++){
|
||||
var _player = this.pList[seatList[i]];
|
||||
var _winlose = {};
|
||||
_winlose.i = i;
|
||||
_winlose.id = _player.playerid;
|
||||
_winlose.isrobot = _player.isrobot;
|
||||
if (!_player.isrobot){
|
||||
var _agentsvr_agent = youle_agent.agents.method.find_agent(this.room.o_game.o_agent.agentid);
|
||||
var _agentsvr_player = _agentsvr_agent.method.find_player(_player.playerid);
|
||||
|
||||
if (this.room.roommode){
|
||||
if (_agentsvr_player.nn_winlose_x2){
|
||||
_winlose.winlose = _agentsvr_player.nn_winlose_x2;
|
||||
} else {
|
||||
_winlose.winlose = 0;
|
||||
};
|
||||
} else {
|
||||
if (_agentsvr_player.nn_winlose){
|
||||
_winlose.winlose = _agentsvr_player.nn_winlose;
|
||||
} else {
|
||||
_winlose.winlose = 0;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if (this.room.roommode){
|
||||
var _agentsvr_agent = youle_agent.agents.method.find_agent(this.room.o_game.o_agent.agentid);
|
||||
var _agentsvr_game = _agentsvr_agent.method.find_game(this.room.o_game.gameid);
|
||||
|
||||
var winlose_total = 0;
|
||||
if (_agentsvr_game.robot_x2){
|
||||
winlose_total = _agentsvr_game.robot_x2;
|
||||
}
|
||||
//平均数 + 偏移值C + 随机数
|
||||
_winlose.winlose = parseInt(winlose_total / this.room.o_game.robotcount) * this.room.beanmult + NN_control.xx_rb_offset * this.room.beanmult + min_random(1, 100);
|
||||
//输出日志
|
||||
if (NN_control.showlog == 1 || NN_control.showlog == 2){
|
||||
var _log = {};
|
||||
_log.memo = "robot历史得分";
|
||||
_log.roomcode = this.room.roomcode;
|
||||
_log.beanmult = this.room.beanmult;
|
||||
_log.asetnum = this.nowCount;
|
||||
_log.playerid = _winlose.id;
|
||||
_log.winlose = _winlose.winlose;
|
||||
_log.agentid = this.room.o_game.o_agent.agentid;
|
||||
_log.gameid = this.room.o_game.gameid;
|
||||
_log.time = min_now();
|
||||
NN_control.conctllog(_log);
|
||||
};
|
||||
} else {
|
||||
_winlose.winlose = 0;
|
||||
}
|
||||
}
|
||||
|
||||
var _isfound = false;
|
||||
for (var j = 0; j < _result.length; j++){
|
||||
if (_winlose.winlose < _result[j].winlose){
|
||||
_result.splice(j, 0, _winlose);
|
||||
_isfound = true;
|
||||
break;
|
||||
};
|
||||
};
|
||||
if (!_isfound){
|
||||
_result.push(_winlose);
|
||||
};
|
||||
};
|
||||
return _result;
|
||||
}.bind(this);
|
||||
//当前得分从低到高排序
|
||||
var _order_grade = function(){
|
||||
var _result = [];
|
||||
for (var i = 0; i < seatList.length; i++){
|
||||
var _grade = {};
|
||||
_grade.i = i;
|
||||
_grade.id = this.pList[seatList[i]].playerid;
|
||||
_grade.isrobot = this.pList[seatList[i]].isrobot;
|
||||
if (this.room.roommode && this.room.beanmult){
|
||||
_grade.grade = parseInt(this.pList[seatList[i]].scores / this.room.beanmult);
|
||||
} else {
|
||||
_grade.grade = this.pList[seatList[i]].scores;
|
||||
};
|
||||
var _isfound = false;
|
||||
for (var j = 0; j < _result.length; j++) {
|
||||
if (_grade.grade < _result[j].grade){
|
||||
_result.splice(j, 0, _grade);
|
||||
_isfound = true;
|
||||
break;
|
||||
};
|
||||
};
|
||||
if (!_isfound){
|
||||
_result.push(_grade);
|
||||
};
|
||||
};
|
||||
return _result;
|
||||
}.bind(this);
|
||||
//玩家重新得到牌,得到牌后分析牌型(与原逻辑保持一致)
|
||||
var _player_getpai = function(seat_i, pai_i){
|
||||
if (seat_i != pai_i){
|
||||
this.pList[seatList[seat_i]].cards.cards = c_list[pai_i].slice(0);
|
||||
this.pList[seatList[seat_i]].cards.AnalysisType(this.cardList,this.model_mult,this.cardTypeMult[1]);
|
||||
if(this.model == 4 || this.model == 5){
|
||||
this.pList[seatList[seat_i]].rubcard = [3];
|
||||
};
|
||||
};
|
||||
}.bind(this);
|
||||
|
||||
var haveplayer = false;
|
||||
for (var i = 0; i < seatList.length; i++){
|
||||
if (!this.pList[seatList[i]].isrobot){
|
||||
haveplayer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!haveplayer){
|
||||
return;
|
||||
}
|
||||
|
||||
//牌从大到小排序
|
||||
var _pailist = _order_pai();
|
||||
//历史输赢从低到高排序
|
||||
var _winloselist = _order_winlose();
|
||||
//当前得分从低到高排序
|
||||
var _gradelist = _order_grade();
|
||||
|
||||
|
||||
//非星星场
|
||||
if (!this.room.roommode){
|
||||
//历史最高分平衡
|
||||
if (_winloselist[_winloselist.length - 1].winlose >= NN_control.hist_high_grade){
|
||||
var _rand_hist = min_random(1, 100);
|
||||
if (_rand_hist <= NN_control.hist_high_rate){
|
||||
var _seat_i = _winloselist[_winloselist.length - 1].i;
|
||||
var _pai_i = _pailist[_pailist.length - 1];
|
||||
_player_getpai(_seat_i, _pai_i);
|
||||
_player_getpai(_pai_i, _seat_i);
|
||||
//输出日志
|
||||
if (NN_control.showlog == 1 || NN_control.showlog == 11){
|
||||
var _log = {};
|
||||
_log.memo = "非星星场:历史最高";
|
||||
_log.roomcode = this.room.roomcode;
|
||||
_log.asetnum = this.nowCount;
|
||||
_log.playerid = _winloselist[_winloselist.length - 1].id;
|
||||
_log.isrobot = _winloselist[_winloselist.length - 1].isrobot;
|
||||
_log.agentid = this.room.o_game.o_agent.agentid;
|
||||
_log.gameid = this.room.o_game.gameid;
|
||||
_log.time = min_now();
|
||||
NN_control.conctllog(_log);
|
||||
};
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//当前局最低分平衡
|
||||
if (_gradelist[0].grade <= NN_control.curr_low_grade){
|
||||
var _rand_grade = min_random(1, 100);
|
||||
if (_rand_grade <= (NN_control.curr_low_rate1 + NN_control.curr_low_rate2)){
|
||||
var _seat_i = _gradelist[0].i;
|
||||
if (_rand_grade <= NN_control.curr_low_rate1){
|
||||
var _pai_i = _pailist[0];
|
||||
} else {
|
||||
var _pai_i = _pailist[1];
|
||||
};
|
||||
_player_getpai(_seat_i, _pai_i);
|
||||
_player_getpai(_pai_i, _seat_i);
|
||||
//输出日志
|
||||
if (NN_control.showlog == 1 || NN_control.showlog == 12){
|
||||
var _log = {};
|
||||
if (_rand_grade <= NN_control.curr_low_rate1){
|
||||
_log.memo = "非星星场:当前最低至第一";
|
||||
} else {
|
||||
_log.memo = "非星星场:当前最低至第二";
|
||||
};
|
||||
_log.roomcode = this.room.roomcode;
|
||||
_log.asetnum = this.nowCount;
|
||||
_log.playerid = _gradelist[0].id;
|
||||
_log.isrobot = _gradelist[0].isrobot;
|
||||
_log.agentid = this.room.o_game.o_agent.agentid;
|
||||
_log.gameid = this.room.o_game.gameid;
|
||||
_log.time = min_now();
|
||||
NN_control.conctllog(_log);
|
||||
};
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
//当前局最高分平衡
|
||||
if (_gradelist[_gradelist.length - 1].grade >= NN_control.curr_high_grade){
|
||||
var _rand_grade = min_random(1, 100);
|
||||
if (_rand_grade <= (NN_control.curr_high_rate1 + NN_control.curr_high_rate2)){
|
||||
var _seat_i = _gradelist[_gradelist.length - 1].i;
|
||||
if (_rand_grade <= NN_control.curr_high_rate1){
|
||||
var _pai_i = _pailist[_pailist.length - 1];
|
||||
} else {
|
||||
var _pai_i = _pailist[_pailist.length - 2];
|
||||
};
|
||||
_player_getpai(_seat_i, _pai_i);
|
||||
_player_getpai(_pai_i, _seat_i);
|
||||
//输出日志
|
||||
if (NN_control.showlog == 1 || NN_control.showlog == 13){
|
||||
var _log = {};
|
||||
if (_rand_grade <= NN_control.curr_high_rate1){
|
||||
_log.memo = "非星星场:当前最高至倒数第一";
|
||||
} else {
|
||||
_log.memo = "非星星场:当前最高至倒数第二";
|
||||
};
|
||||
_log.roomcode = this.room.roomcode;
|
||||
_log.asetnum = this.nowCount;
|
||||
_log.playerid = _gradelist[_gradelist.length - 1].id;
|
||||
_log.isrobot = _gradelist[_gradelist.length - 1].isrobot;
|
||||
_log.agentid = this.room.o_game.o_agent.agentid;
|
||||
_log.gameid = this.room.o_game.gameid;
|
||||
_log.time = min_now();
|
||||
NN_control.conctllog(_log);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
//星星场
|
||||
else {
|
||||
var maxHigh_player = _winloselist[_winloselist.length - 1];
|
||||
var maxLow_player = _winloselist[0];
|
||||
//历史最高分平衡
|
||||
if (!maxHigh_player.isrobot &&
|
||||
maxHigh_player.winlose >= NN_control.xx_hist_high_min * this.room.beanmult &&
|
||||
maxHigh_player.winlose <= NN_control.xx_hist_high_max * this.room.beanmult){
|
||||
var _rand_hist = min_random(1, 100);
|
||||
if (_rand_hist <= NN_control.xx_hist_high_rate){
|
||||
var _seat_i = _winloselist[_winloselist.length - 1].i;
|
||||
var _pai_i = _pailist[_pailist.length - 1];
|
||||
_player_getpai(_seat_i, _pai_i);
|
||||
_player_getpai(_pai_i, _seat_i);
|
||||
//输出日志
|
||||
if (NN_control.showlog == 1 || NN_control.showlog == 21){
|
||||
var _log = {};
|
||||
_log.memo = "星星场:历史最高";
|
||||
_log.roomcode = this.room.roomcode;
|
||||
_log.beanmult = this.room.beanmult;
|
||||
_log.asetnum = this.nowCount;
|
||||
_log.playerid = _winloselist[_winloselist.length - 1].id;
|
||||
_log.isrobot = _winloselist[_winloselist.length - 1].isrobot;
|
||||
_log.agentid = this.room.o_game.o_agent.agentid;
|
||||
_log.gameid = this.room.o_game.gameid;
|
||||
_log.time = min_now();
|
||||
NN_control.conctllog(_log);
|
||||
};
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//robot历史最高分平衡
|
||||
if (maxHigh_player.isrobot &&
|
||||
maxHigh_player.winlose >= NN_control.xx_rb_hist_high_min * this.room.beanmult &&
|
||||
maxHigh_player.winlose <= NN_control.xx_rb_hist_high_max * this.room.beanmult){
|
||||
var _rand_hist = min_random(1, 100);
|
||||
if (_rand_hist <= NN_control.xx_rb_hist_high_rate){
|
||||
var _seat_i = _winloselist[_winloselist.length - 1].i;
|
||||
var _pai_i = _pailist[_pailist.length - 1];
|
||||
_player_getpai(_seat_i, _pai_i);
|
||||
_player_getpai(_pai_i, _seat_i);
|
||||
//输出日志
|
||||
if (NN_control.showlog == 1 || NN_control.showlog == 22){
|
||||
var _log = {};
|
||||
_log.memo = "星星场:robot历史最高";
|
||||
_log.roomcode = this.room.roomcode;
|
||||
_log.beanmult = this.room.beanmult;
|
||||
_log.asetnum = this.nowCount;
|
||||
_log.playerid = _winloselist[_winloselist.length - 1].id;
|
||||
_log.isrobot = _winloselist[_winloselist.length - 1].isrobot;
|
||||
_log.agentid = this.room.o_game.o_agent.agentid;
|
||||
_log.gameid = this.room.o_game.gameid;
|
||||
_log.time = min_now();
|
||||
NN_control.conctllog(_log);
|
||||
};
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//robot历史最低分平衡
|
||||
if (maxLow_player.isrobot &&
|
||||
maxLow_player.winlose >= NN_control.xx_rb_hist_low_min * this.room.beanmult &&
|
||||
maxLow_player.winlose <= NN_control.xx_rb_hist_low_max * this.room.beanmult){
|
||||
var _rand_hist = min_random(1, 100);
|
||||
if (_rand_hist <= NN_control.xx_rb_hist_low_rate){
|
||||
var _seat_i = _winloselist[0].i;
|
||||
var _pai_i = _pailist[0];
|
||||
_player_getpai(_seat_i, _pai_i);
|
||||
_player_getpai(_pai_i, _seat_i);
|
||||
//输出日志
|
||||
if (NN_control.showlog == 1 || NN_control.showlog == 23){
|
||||
var _log = {};
|
||||
_log.memo = "星星场:robot历史最低";
|
||||
_log.roomcode = this.room.roomcode;
|
||||
_log.beanmult = this.room.beanmult;
|
||||
_log.asetnum = this.nowCount;
|
||||
_log.playerid = _winloselist[0].id;
|
||||
_log.isrobot = _winloselist[0].isrobot;
|
||||
_log.agentid = this.room.o_game.o_agent.agentid;
|
||||
_log.gameid = this.room.o_game.gameid;
|
||||
_log.time = min_now();
|
||||
NN_control.conctllog(_log);
|
||||
};
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(e){};
|
||||
};
|
||||
};
|
||||
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
///////////////////////////////////////////////////
|
||||
////////////////////服务器心跳包///////////////////
|
||||
///////////////////////////////////////////////////
|
||||
var mod_heartbeat = mod_heartbeat || cls_mod.new("mod_heartbeat", "heartbeat", app_server);
|
||||
|
||||
// mod_heartbeat.TCPList = [];
|
||||
|
||||
//TCP客户端连接
|
||||
// mod_heartbeat.OnTcpConnected = function(str_tcpid)
|
||||
// {
|
||||
// if (min_ary_indexof(mod_heartbeat.TCPList, str_tcpid) == -1)
|
||||
// {
|
||||
// if (str_tcpid){
|
||||
// mod_heartbeat.TCPList.push(str_tcpid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//TCP客户端断开
|
||||
// mod_heartbeat.OnTcpDisConnected = function(str_tcpid)
|
||||
// {
|
||||
// if (str_tcpid){
|
||||
// min_ary_delval(mod_heartbeat.TCPList, str_tcpid);
|
||||
// }
|
||||
// }
|
||||
|
||||
//发送心跳包
|
||||
mod_heartbeat.doheartbeat = function()
|
||||
{
|
||||
if ((mod_heartbeat.app) && (mod_heartbeat.app.SendPack_Tcp))
|
||||
{
|
||||
mod_heartbeat.app.SendPack_Tcp([-1], '{"com":"@serverheartbeat"}');
|
||||
}
|
||||
}
|
||||
|
||||
//开启定时器发送心跳包
|
||||
min_ontime(mod_heartbeat.doheartbeat, 20000);
|
||||
@@ -0,0 +1,16 @@
|
||||
///////////////////////////////////////////////////
|
||||
//////////////////加载或更新js文件/////////////////
|
||||
///////////////////////////////////////////////////
|
||||
var mod_loadjs = mod_loadjs || cls_mod.new("mod_loadjs", "loadjs", app_server);
|
||||
|
||||
mod_loadjs.doloadjs = function(obj_msg)
|
||||
{
|
||||
if (!obj_msg.data.flag) {
|
||||
min_loadJsFile(obj_msg.data.jsfile);
|
||||
} else {
|
||||
min_loadJsFile(obj_msg.data.jsfile, function(){}, 1);
|
||||
}
|
||||
|
||||
obj_msg.result = "success";
|
||||
return obj_msg;
|
||||
}
|
||||
Reference in New Issue
Block a user