This commit is contained in:
libccy 2016-04-07 21:21:19 +08:00
parent 6a264add30
commit b78f31f8b3
8 changed files with 346 additions and 273 deletions

View File

@ -1358,7 +1358,7 @@ character.xianjian={
pal_hanlingsha:'韩菱纱',
pal_liumengli:'柳梦璃',
pal_murongziying:'慕容紫英',
pal_changqing:'长',
pal_changqing:'长',
pal_xuanxiao:'玄霄',
xuanyan:'玄炎',

View File

@ -2108,7 +2108,7 @@ character.yxs={
yxs_mingchenghuanghou:'明成皇后',
yxs_wangzhaojun:'王昭君',
yxs_luocheng:'罗成',
yxs_direnjie:'狄杰',
yxs_direnjie:'狄杰',
yxs_sunwu:'孙武',
yxs_chengyaojin:'程咬金',
yxs_yujix:'虞姬',

View File

@ -207,6 +207,7 @@ window.config={
hiddenPlayPack:[],
favouriteCharacter:[],
recentCharacter:[],
recentIP:[],
theme:'woodden',
layout:'mobile',

View File

@ -65,7 +65,7 @@
onover:[],
chatHistory:[],
arenaReady:[],
packageReady:[],
extensions:[],
characterDialogGroup:{
'收藏':function(name,capt){
return lib.config.favouriteCharacter.contains(name)?capt:null;
@ -138,9 +138,11 @@
onclick:function(bool){
game.saveConfig('cheat',bool);
if(_status.connectMode) return;
if(lib.config.cheat&&bool==false){
lib.cheat=window.cheat;
delete window.cheat;
if(bool){
lib.cheat.i();
}
else{
delete window.cheat;
delete window.game;
delete window.ui;
delete window.get;
@ -148,10 +150,6 @@
delete window.lib;
delete window._status;
}
else if(!lib.config.cheat&&bool){
window.cheat=lib.cheat;
window.cheat.i();
}
},
unfrequent:true,
},
@ -3068,7 +3066,7 @@
lib.configMenu.appearence.config.theme.item[i]=theme.pack[i];
}
}
ui.fontsheet=document.createElement('style');
document.head.appendChild(ui.fontsheet);
if(font&&font.pack){
@ -3122,9 +3120,14 @@
}
}
try{
_status.extension=game.importedPack.name;
game.importedPack.content(cfg);
delete _status.extension;
if(game.importedPack.precontent){
_status.extension=game.importedPack.name;
game.importedPack.precontent(cfg);
delete _status.extension;
}
if(game.importedPack.content){
lib.extensions.push([game.importedPack.name,game.importedPack.content,cfg]);
}
}
catch(e){
console.log(e);
@ -3748,12 +3751,8 @@
_status.connectMode=true;
}
if(lib.config.cheat&&!lib.storage.test&&(!_status.connectMode||lib.config.debug)){
cheat.i();
lib.cheat.i();
}
else{
lib.cheat=window.cheat;
delete window.cheat;
}
lib.config.sort_card=get.sortCard(lib.config.sort);
delete window.config;
delete window.mode;
@ -3765,10 +3764,19 @@
delete lib.init[i];
}
}
while(lib.packageReady.length){
(lib.init.eval(lib.packageReady.shift()))();
}
delete lib.packageReady;
if(!_status.connectMode){
for(var i=0;i<lib.extensions.length;i++){
try{
_status.extension=lib.extensions[i][0];
lib.extensions[i][1](lib.extensions[i][2]);
delete _status.extension;
}
catch(e){
console.log(e);
}
}
}
delete lib.extensions;
ui.create.arena();
if(window.indexedDB&&!_status.characterLoaded){
@ -4042,6 +4050,211 @@
return str;
}
},
cheat:{
i:function(){
window.cheat=lib.cheat;
window.game=game;
window.ui=ui;
window.get=get;
window.ai=ai;
window.lib=lib;
window._status=_status;
},
uy:function(me){
if(me){
game.me.useCard({name:'spell_yexinglanghun'},game.me);
}
else{
var enemy=game.me.getEnemy();
enemy.useCard({name:'spell_yexinglanghun'},enemy);
}
},
gs:function(name,act){
var card=game.createCard('spell_'+name);
game.me.node.handcards1.appendChild(card);
if(!act){
game.me.actused=-99;
}
ui.updatehl();
setTimeout(game.check,300);
},
gc:function(name,act){
var card=game.createCard('stone_'+name+'_stonecharacter');
game.me.node.handcards1.appendChild(card);
if(!act){
game.me.actused=-99;
}
ui.updatehl();
setTimeout(game.check,300);
},
aa:function(){
game.saveConfig('test_game',!lib.config.test_game);
game.reload();
},
a:function(name){
if(lib.storage.test&&!name){
game.save('test',false);
if(lib.config.mode=='identity'){
game.saveConfig('double_character',false,true);
}
}
else{
game.save('test',name||true);
if(lib.config.mode=='identity'){
game.saveConfig('double_character',true,true);
}
}
game.reload();
},
u:function(){
var card={name:'sha'},source=game.me.next;
for(var i=0;i<arguments.length;i++){
if(get.itemtype(arguments[i])=='player'){
source=arguments[i];
}
else if(typeof arguments[i]=='object'){
card=arguments[i];
}
else if(typeof arguments[i]=='string'){
card={name:arguments[i]}
}
}
source.useCard(game.createCard(card.name,card.suit,card.number,card.nature),game.me);
},
rank:function(){
var list=lib.rank.s.concat(lib.rank.ap).concat(lib.rank.a).concat(lib.rank.am).
concat(lib.rank.bp).concat(lib.rank.b).concat(lib.rank.bm).concat(lib.rank.c).concat(lib.rank.d);
for(var i in lib.character){
if(i!='zuoci'&&i.indexOf('boss_')!=0&&!list.contains(i)&&!lib.customCharacters.contains(i)) console.log(i);
}
},
h:function(player){
console.log(get.translation(player.get('h')));
},
g:function(){
for(var i=0;i<arguments.length;i++){
if(i>0&&typeof arguments[i]=='number'){
for(var j=0;j<arguments[i]-1;j++){
cheat.gx(arguments[i-1]);
}
}
else{
cheat.gx(arguments[i]);
}
}
},
gx:function(name,target){
target=target||game.me;
var nature=null;
var suit=null;
var suits=['club','spade','diamond','heart'];
for(var i=0;i<suits.length;i++){
if(name.indexOf(suits[i])==0){
suit=suits[i];
name=name.slice(suits[i].length);
break;
}
}
if(name.indexOf('red')==0){
name=name.slice(3);
suit=['diamond','heart'].randomGet();
}
if(name.indexOf('black')==0){
name=name.slice(5);
suit=['spade','club'].randomGet();
}
if(name=='huosha'){
name='sha';
nature='fire';
}
else if(name=='leisha'){
name='sha';
nature='thunder';
}
var card=game.createCard(name,suit,null,nature);
target.node.handcards1.appendChild(card);
game.check();
target.update();
ui.updatehl();
},
ge:function(){
cheat.g('zhuge');
cheat.g('qilin');
cheat.g('bagua');
cheat.g('dilu');
cheat.g('chitu');
cheat.g('muniu');
},
gj:function(){
cheat.g('shandian');
cheat.g('huoshan');
cheat.g('hongshui');
cheat.g('lebu');
cheat.g('bingliang');
cheat.g('guiyoujie');
},
d:function(num,target){
if(num==undefined) num=1;
var cards=get.cards(num);
for(var i=0;i<num;i++){
var card=cards[i];
game.me.node.handcards1.appendChild(card);
game.check();
game.me.update();
ui.updatehl();
}
},
s:function(skill){
game.me.addSkill(skill);
game.check();
},
t:function(num){
if(num==undefined){
for(var i=0;i<game.players.length;i++) cheat.t(i);
return;
}
var player=game.players[num];
var cards=player.get('hej');
for(var i=0;i<cards.length;i++){
ui.discardPile.appendChild(cards[i]);
}
player.update();
},
k:function(i){
if(i==undefined) i=1;
game.players[i].hp=1;
cheat.t(i);
cheat.g('juedou');
},
z:function(name){
game.zhu.init(name);
game.zhu.maxHp++;
game.zhu.hp++;
game.zhu.update();
},
cp:function(){
cheat.z('caopi');
},
cc:function(){
cheat.z('re_caocao');
},
ls:function(){
cheat.z('liushan');
},
zj:function(){
cheat.z('sp_zhangjiao');
},
sc:function(){
cheat.z('sunce');
},
lc:function(){
cheat.z('liushan');
},
lb:function(){
cheat.z('liubei');
}
},
translate:{
'default':"默认",
zhenfa:'阵法',
@ -5936,9 +6149,10 @@
}
};
var broadcast=function(){
game.broadcast(function(player,cards){
game.broadcast(function(player,cards,num){
player.directgain(cards);
},player,cards);
_status.cardPileNum=num;
},player,cards,ui.cardPile.childNodes.length);
};
if(event.animate=='draw'){
player.$draw(cards.length);
@ -6016,7 +6230,7 @@
}
}
if(player==game.me) ui.updatehl();
game.broadcast(function(player,cards){
game.broadcast(function(player,cards,num){
for(var i=0;i<cards.length;i++){
cards[i].classList.remove('glow');
cards[i].delete();
@ -6036,7 +6250,8 @@
}
ui.updatehl();
}
},player,cards);
_status.cardPileNum=num;
},player,cards,ui.cardPile.childNodes.length);
game.addVideo('lose',player,[get.cardsInfo(hs),get.cardsInfo(es),get.cardsInfo(js)]);
player.update();
game.addVideo('loseAfter',player);
@ -10874,11 +11089,13 @@
}
},
onclose:function(){
if(this._nocallback) return;
if(_status.connectCallback){
_status.connectCallback(false);
delete _status.connectCallback;
}
if(game.online){
localStorage.setItem(lib.configprefix+'directstart',true);
game.reload();
}
else{
@ -11541,6 +11758,10 @@
game.onlineID=id;
game.ip=ip;
game.saveConfig('reconnect_info',[_status.ip,id]);
lib.config.recentIP.remove(_status.ip);
lib.config.recentIP.unshift(_status.ip);
lib.config.recentIP.splice(5);
game.saveConfig('recentIP',lib.config.recentIP);
_status.connectMode=true;
lib.configOL=config;
lib.playerOL={};
@ -11552,19 +11773,22 @@
ui.create.connectPlayers(ip);
ui.pause.hide();
ui.auto.hide();
ui.cardPileButton.style.display='none';
if(ui.ipnode){
ui.ipnode.delete();
ui.ipnode.remove();
delete ui.ipnode;
}
if(ui.iptext){
ui.iptext.delete();
ui.iptext.remove();
delete ui.iptext;
}
if(ui.ipbutton){
ui.ipbutton.delete();
ui.ipbutton.remove();
delete ui.ipbutton;
}
if(ui.recentIP){
ui.recentIP.remove();
delete ui.recentIP;
}
clearTimeout(_status.createNodeTimeout);
var proceed=function(){
@ -11614,17 +11838,21 @@
},
reinit:function(config,state,state2,ip,observe){
if(ui.ipnode){
ui.ipnode.delete();
ui.ipnode.remove();
delete ui.ipnode;
}
if(ui.iptext){
ui.iptext.delete();
ui.iptext.remove();
delete ui.iptext;
}
if(ui.ipbutton){
ui.ipbutton.delete();
ui.ipbutton.remove();
delete ui.ipbutton;
}
if(ui.recentIP){
ui.recentIP.remove();
delete ui.recentIP;
}
clearTimeout(_status.createNodeTimeout);
game.online=true;
game.ip=ip;
@ -11880,19 +12108,26 @@
}
game.broadcast('updateWaiting',map);
},
waitForPlayer:function(){
waitForPlayer:function(func){
var next=game.createEvent('waitForPlayer',false);
next.func=func;
next.content=function(){
'step 0'
ui.auto.hide();
ui.pause.hide();
ui.cardPileButton.style.display='none';
game.createServer();
if(event.func){
event.func();
}
ui.create.connectPlayers(game.ip);
var me=game.connectPlayers[0];
me.initOL(lib.config.connect_nickname,lib.config.connect_avatar);
me.playerid=1;
me.setIdentity('zhu');
_status.waitingForPlayer=true;
game.pause();
'step 1'
_status.waitingForPlayer=false;
@ -11974,6 +12209,11 @@
}
_status.connectCallback=callback;
try{
if(game.ws){
game.ws._nocallback=true;
game.ws.close();
delete game.ws;
}
game.ws=new WebSocket('ws://'+ip+'');
}
catch(e){
@ -17214,7 +17454,7 @@
if(!lib.config.show_wuxie){
ui.wuxie.style.display='none';
}
if(!lib.config.show_cardpile){
if(!lib.config.show_cardpile||_status.connectMode){
ui.cardPileButton.style.display='none';
}
if(lib.config.touchscreen&&!lib.config.confirmtouch){
@ -20971,7 +21211,16 @@
uiintro.listen(function(e){
e.stopPropagation();
});
uiintro.add('剩余 <span style="font-family:'+'xinwei'+'">'+ui.cardPile.childNodes.length);
var num;
if(game.online){
num=_status.cardPileNum||0;
}
else{
num=ui.cardPile.childNodes.length;
}
uiintro.add('剩余 <span style="font-family:'+'xinwei'+'">'+num);
if(_status.connectMode) return uiintro;
uiintro.add('<div class="text center">弃牌堆</div>');
if(ui.discardPile.childNodes.length){
var list=[];
@ -25369,210 +25618,6 @@
}
return list;
};
window.cheat={
i:function(){
window.game=game;
window.ui=ui;
window.get=get;
window.ai=ai;
window.lib=lib;
window._status=_status;
},
uy:function(me){
if(me){
game.me.useCard({name:'spell_yexinglanghun'},game.me);
}
else{
var enemy=game.me.getEnemy();
enemy.useCard({name:'spell_yexinglanghun'},enemy);
}
},
gs:function(name,act){
var card=game.createCard('spell_'+name);
game.me.node.handcards1.appendChild(card);
if(!act){
game.me.actused=-99;
}
ui.updatehl();
setTimeout(game.check,300);
},
gc:function(name,act){
var card=game.createCard('stone_'+name+'_stonecharacter');
game.me.node.handcards1.appendChild(card);
if(!act){
game.me.actused=-99;
}
ui.updatehl();
setTimeout(game.check,300);
},
aa:function(){
game.saveConfig('test_game',!lib.config.test_game);
game.reload();
},
a:function(name){
if(lib.storage.test&&!name){
game.save('test',false);
if(lib.config.mode=='identity'){
game.saveConfig('double_character',false,true);
}
}
else{
game.save('test',name||true);
if(lib.config.mode=='identity'){
game.saveConfig('double_character',true,true);
}
}
game.reload();
},
u:function(){
var card={name:'sha'},source=game.me.next;
for(var i=0;i<arguments.length;i++){
if(get.itemtype(arguments[i])=='player'){
source=arguments[i];
}
else if(typeof arguments[i]=='object'){
card=arguments[i];
}
else if(typeof arguments[i]=='string'){
card={name:arguments[i]}
}
}
source.useCard(game.createCard(card.name,card.suit,card.number,card.nature),game.me);
},
rank:function(){
var list=lib.rank.s.concat(lib.rank.ap).concat(lib.rank.a).concat(lib.rank.am).
concat(lib.rank.bp).concat(lib.rank.b).concat(lib.rank.bm).concat(lib.rank.c).concat(lib.rank.d);
for(var i in lib.character){
if(i!='zuoci'&&i.indexOf('boss_')!=0&&!list.contains(i)&&!lib.customCharacters.contains(i)) console.log(i);
}
},
h:function(player){
console.log(get.translation(player.get('h')));
},
g:function(){
for(var i=0;i<arguments.length;i++){
if(i>0&&typeof arguments[i]=='number'){
for(var j=0;j<arguments[i]-1;j++){
cheat.gx(arguments[i-1]);
}
}
else{
cheat.gx(arguments[i]);
}
}
},
gx:function(name,target){
target=target||game.me;
var nature=null;
var suit=null;
var suits=['club','spade','diamond','heart'];
for(var i=0;i<suits.length;i++){
if(name.indexOf(suits[i])==0){
suit=suits[i];
name=name.slice(suits[i].length);
break;
}
}
if(name.indexOf('red')==0){
name=name.slice(3);
suit=['diamond','heart'].randomGet();
}
if(name.indexOf('black')==0){
name=name.slice(5);
suit=['spade','club'].randomGet();
}
if(name=='huosha'){
name='sha';
nature='fire';
}
else if(name=='leisha'){
name='sha';
nature='thunder';
}
var card=game.createCard(name,suit,null,nature);
target.node.handcards1.appendChild(card);
game.check();
target.update();
ui.updatehl();
},
ge:function(){
cheat.g('zhuge');
cheat.g('qilin');
cheat.g('bagua');
cheat.g('dilu');
cheat.g('chitu');
cheat.g('muniu');
},
gj:function(){
cheat.g('shandian');
cheat.g('huoshan');
cheat.g('hongshui');
cheat.g('lebu');
cheat.g('bingliang');
cheat.g('guiyoujie');
},
d:function(num,target){
if(num==undefined) num=1;
var cards=get.cards(num);
for(var i=0;i<num;i++){
var card=cards[i];
game.me.node.handcards1.appendChild(card);
game.check();
game.me.update();
ui.updatehl();
}
},
s:function(skill){
game.me.addSkill(skill);
game.check();
},
t:function(num){
if(num==undefined){
for(var i=0;i<game.players.length;i++) cheat.t(i);
return;
}
var player=game.players[num];
var cards=player.get('hej');
for(var i=0;i<cards.length;i++){
ui.discardPile.appendChild(cards[i]);
}
player.update();
},
k:function(i){
if(i==undefined) i=1;
game.players[i].hp=1;
cheat.t(i);
cheat.g('juedou');
},
z:function(name){
game.zhu.init(name);
game.zhu.maxHp++;
game.zhu.hp++;
game.zhu.update();
},
cp:function(){
cheat.z('caopi');
},
cc:function(){
cheat.z('re_caocao');
},
ls:function(){
cheat.z('liushan');
},
zj:function(){
cheat.z('sp_zhangjiao');
},
sc:function(){
cheat.z('sunce');
},
lc:function(){
cheat.z('liushan');
},
lb:function(){
cheat.z('liubei');
}
}
window.countGroups=function(){
var a=0,b=0,c=0,d=0;
var sa=0,sb=0,sc=0,sd=0;

View File

@ -1,7 +1,9 @@
window.noname_update={
version:'1.8.3.3',
version:'1.8.3.5',
changeLog:[
'修复重连问题',
'修复无法进入游戏的问题'
'联机可显示弃牌堆数量',
'最近连接ip列表',
'扩展机制修改',
'联机自动禁用扩展',
]
}

View File

@ -535,6 +535,8 @@ margin-bottom: 5px;
.caption>.text{font-size:16px;text-align:left}
.caption>.text.center{text-align:center}
.caption>.text.chat{word-break: break-all;margin-bottom: 3px;margin-left: 10px;width: calc(100% - 20px)}
.caption>.text.textlink{margin-left: 10px}
.caption>.text.textlink:hover{text-decoration: underline;}
.caption>div>div{font-size: 16px;position: relative;width: calc(100% - 70px);vertical-align: top;margin: 0;padding: 0;}
.skill{left: 0 !important;width: 70px !important;}
.caption>.ctext{text-align:center;font-size:16px;}

View File

@ -21,7 +21,7 @@ mode.connect={
var connect=function(e){
clearTimeout(event.timeout);
e.preventDefault();
if(e) e.preventDefault();
game.saveConfig('last_ip',node.innerHTML);
game.connect(node.innerHTML);
};
@ -53,6 +53,31 @@ mode.connect={
button.style.top='calc(50% + 60px)';
ui.window.appendChild(button);
ui.ipbutton=button;
ui.recentIP=ui.create.system('最近连接',null,true);
var clickLink=function(){
node.innerHTML=this.innerHTML;
connect();
};
var trimIP=function(str){
var len=str.length-5;
if(str.lastIndexOf(':8080')==len){
str=str.slice(0,len);
}
return str;
};
lib.setPopped(ui.recentIP,function(){
var uiintro=ui.create.dialog('hidden');
uiintro.listen(function(e){
e.stopPropagation();
});
var list=ui.create.div('.caption');
for(var i=0;i<lib.config.recentIP.length;i++){
ui.create.div('.text.textlink',list,clickLink).innerHTML=trimIP(lib.config.recentIP[i]);
}
uiintro.add(list);
return uiintro;
},220);
}
if(lib.config.reconnect_info){
var info=lib.config.reconnect_info;

View File

@ -6,32 +6,6 @@ mode.identity={
ui.arena.classList.add('only_dialog');
}
_status.mode=get.config('identity_mode');
if(lib.config.connectMode){
game.createServer();
for(var i in lib.mode.identity.config){
if(lib.mode.identity.config[i].connect){
lib.configOL[i]=get.config(i);
}
}
if(_status.mode=='zhong'){
lib.configOL.number=8;
}
else{
lib.configOL.number=lib.configOL.player_number;
}
lib.configOL.characterPack=['standard','shenhua'];
lib.configOL.cardPack=['standard','ex','extra','refresh','mingzhong'];
lib.configOL.mode='identity';
var cardPackList=[];
for(var i=0;i<lib.configOL.cardPack.length;i++){
cardPackList=cardPackList.concat(lib.cardPack[lib.configOL.cardPack[i]]);
}
for(var i=0;i<lib.card.list.length;i++){
if(!cardPackList.contains(lib.card.list[i][2])){
lib.card.list.splice(i--,1);
}
}
}
"step 1"
var playback=localStorage.getItem(lib.configprefix+'playback');
if(playback){
@ -166,7 +140,31 @@ mode.identity={
ui.auto.classList.add('glow');
}
if(_status.connectMode){
game.waitForPlayer();
game.waitForPlayer(function(){
for(var i in lib.mode.identity.config){
if(lib.mode.identity.config[i].connect){
lib.configOL[i]=get.config(i);
}
}
if(_status.mode=='zhong'){
lib.configOL.number=8;
}
else{
lib.configOL.number=lib.configOL.player_number;
}
lib.configOL.characterPack=['standard','shenhua'];
lib.configOL.cardPack=['standard','ex','extra','refresh','mingzhong'];
lib.configOL.mode='identity';
var cardPackList=[];
for(var i=0;i<lib.configOL.cardPack.length;i++){
cardPackList=cardPackList.concat(lib.cardPack[lib.configOL.cardPack[i]]);
}
for(var i=0;i<lib.card.list.length;i++){
if(!cardPackList.contains(lib.card.list[i][2])){
lib.card.list.splice(i--,1);
}
}
});
}
"step 4"
if(_status.connectMode){