📄 callfromcli.c
字号:
BOOL found = FALSE; CHECKFDANDTIME; fd_charaindex = CONNECT_getCharaindex( fd ); {//ttom avoid warp at will int ix,iy; ix=CHAR_getInt(fd_charaindex, CHAR_X); iy=CHAR_getInt(fd_charaindex, CHAR_Y); if( (ix!=x)||(iy!=y)){ //print("\n<DU>--Error!!!!"); //print("\n<DU>origion x=%d,y=%d",ix,iy); //print("\n<DU>modify X=%d,Y=%d",x,y); x=ix; y=iy; } } if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_CLIENT) { int i; // 愤坌及奶件犯永弁旦 charaindex = fd_charaindex; CHAR_setMyPosition( charaindex, x,y,TRUE); /* WALKARRAY毛弁伉失允月 */ CHAR_setWorkChar( charaindex, CHAR_WORKWALKARRAY,""); /* 赓渝祭允月 */ for( i = 0; i < CONNECT_WINDOWBUFSIZE ; i ++ ) { CONNECT_setDuelcharaindex( fd, i, -1 ); } CHAR_getCoordinationDir( CHAR_getInt( charaindex, CHAR_DIR ) , CHAR_getInt( charaindex , CHAR_X ), CHAR_getInt( charaindex , CHAR_Y ) , 1 , &frontx , &fronty ); for( object = MAP_getTopObj( CHAR_getInt( charaindex, CHAR_FLOOR), frontx,fronty) ; object ; object = NEXT_OBJECT(object ) ) { int toindex; int objindex = GET_OBJINDEX(object); /* 平乓仿弁正□元扎卅中 */ if( OBJECT_getType( objindex) != OBJTYPE_CHARA) continue; toindex = OBJECT_getIndex( objindex); /* 皿伊奶乩□元扎卅中 */ if( CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) continue; found = TRUE; if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE )continue; int floor = CHAR_getInt( charaindex, CHAR_FLOOR ); if(!CHAR_getFlg( toindex, CHAR_ISDUEL)#ifdef _BATTLE_FLOOR && (!strcmp(getBattleFloorCF(),"是") && floor!=getBattleFloor(1) && floor!=getBattleFloor(2) && floor!=getBattleFloor(3) && floor!=getBattleFloor(4) && floor!=getBattleFloor(5))#endif )continue;#ifdef _AUTO_PK if(!CHAR_getFlg( toindex, CHAR_ISDUEL)){ if(AutoPk_PKTimeGet()>0)continue; if(floor!=20000)continue; if(CHAR_getInt( charaindex, CHAR_AUTOPK ) == -1)continue; if(CHAR_getInt( toindex, CHAR_AUTOPK ) == -1)continue; }#endif // shan begin { int i; for( i=0; i<FAMILY_FMPKFLOOR; i++){ if( fmpkflnum[i].fl == CHAR_getInt( charaindex, CHAR_FLOOR) ){ if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLAG) == -1 ){ lssproto_EN_send( fd, FALSE, 0 ); return; } if(CHAR_getInt( charaindex, CHAR_FMINDEX) == CHAR_getInt( toindex, CHAR_FMINDEX)){ lssproto_EN_send( fd, FALSE, 0 ); return; } } } } // shan end // 阂间卅日褪毛裟氏匹仁月 if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ) { int tmpindex = CHAR_getWorkInt( toindex, CHAR_WORKPARTYINDEX1 ); /* 锹澎互皿伊奶乩□匹卅中仪手丐月 */ if( CHAR_CHECKINDEX( tmpindex)) { if( CHAR_getWorkInt( tmpindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){ continue; } } } CONNECT_setDuelcharaindex( fd, cnt,toindex ); cnt++; if( cnt == CONNECT_WINDOWBUFSIZE ) break; } /* 中卅井匀凶 */ if( cnt == 0 ) { goto lssproto_DU_recv_Err; } /* ㄠ谛分仃分匀凶日穑巨件玄伉□ */ else if( cnt == 1 ) { enemyindex = CONNECT_getDuelcharaindex(fd,0); // 锹澎互褪卅日公及引引巨件市它件玄今六月互 // 阂间卅日褪毛裟氏匹仁月 if( CHAR_getWorkInt( enemyindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ) { enemyindex = CHAR_getWorkInt( enemyindex, CHAR_WORKPARTYINDEX1 ); // 卅兮井褪互中卅中 if( enemyindex < 0 )goto lssproto_DU_recv_Err; } ret = BATTLE_CreateVsPlayer( charaindex, enemyindex ); if( ret != 0 ){ ret = FALSE; }else{ ret = TRUE; } } else if( cnt > 1 ) { int strlength; char msgbuf[1024]; char escapebuf[2048]; strcpy( msgbuf, "1\n要和谁战斗?\n"); strlength = strlen( msgbuf); for( i = 0; CONNECT_getDuelcharaindex( fd,i) != -1 && i< CONNECT_WINDOWBUFSIZE; i ++ ) { char *a = CHAR_getChar( CONNECT_getDuelcharaindex( fd,i) , CHAR_NAME); char buf[256]; snprintf( buf, sizeof( buf),"%s [%s]\n", a, CHAR_getWorkInt( CONNECT_getDuelcharaindex(fd,i), CHAR_WORKPARTYMODE ) != CHAR_PARTY_NONE ? "团体": "单独"); if( strlength + strlen( buf) > arraysizeof( msgbuf)){ print( "%s:%d视窗讯息buffer不足。\n", __FILE__,__LINE__); break; } strcpy( &msgbuf[strlength], buf); strlength += strlen(buf); } lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, WINDOW_BUTTONTYPE_CANCEL, CHAR_WINDOWTYPE_SELECTDUEL, -1, makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf))); ret = TRUE; } }lssproto_DU_recv_Err:; if( ret == FALSE ) { /* 瑛绊霜耨 */ lssproto_EN_send( fd, FALSE, 0 ); if( cnt > 0 ) CHAR_talkToCli( charaindex, -1, "遭遇失败!", CHAR_COLORYELLOW); else if( found ) CHAR_talkToCli( charaindex, -1, "无人可以对战。", CHAR_COLORYELLOW); else CHAR_talkToCli( charaindex, -1, "那里没有任何人。", CHAR_COLORYELLOW); }}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_EO_recv( int fd, int dummy ){ int fd_charaindex; int battle_index;//ttom++ CHECKFD; fd_charaindex = CONNECT_getCharaindex( fd ); BattleEncountOut( fd_charaindex ); // Nuke start 0827 : Battle acceleration battle_index=CHAR_getWorkInt(fd_charaindex,CHAR_WORKBATTLEINDEX); if( BATTLE_CHECKINDEX( battle_index ) == FALSE ){ return; } if(BattleArray[battle_index].type != BATTLE_TYPE_P_vs_P){ if(CONNECT_get_watchmode(fd)) { //print("fd= %d Watching the battle __ lssprot_EO_recv \n",fd);//for debug CONNECT_set_watchmode(fd,FALSE); return; } else if (checkBEOTime( fd ) < 0) { //CHAR_talkToCli(fd_charaindex, -1, "你加速喔。", CHAR_COLORYELLOW); } } // Nuke end }/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_BU_recv( int fd, int dummy){ int fd_charaindex; CHECKFD; fd_charaindex = CONNECT_getCharaindex( fd ); // shan 2001/12/25 //BATTLE_WatchStop( fd_charaindex );}void lssproto_B_recv( int fd, char *command ){ int fd_charaindex; int battle_index;//ttom++ CHECKFD; fd_charaindex = CONNECT_getCharaindex( fd ); BattleCommandDispach( fd, command ); // Nuke +1 0827: Battle acceleration battle_index=CHAR_getWorkInt(fd_charaindex,CHAR_WORKBATTLEINDEX); if( BATTLE_CHECKINDEX( battle_index ) == FALSE ){ return; } if(BattleArray[battle_index].type != BATTLE_TYPE_P_vs_P){ if(BattleArray[battle_index].type == BATTLE_TYPE_WATCH) { CONNECT_set_watchmode(fd,TRUE); return; } } //Nuke end}void lssproto_FS_recv( int fd,int flg ){ int fd_charaindex; CHECKFDANDTIME; fd_charaindex = CONNECT_getCharaindex( fd ); /* 椭瘀反竣卞六内卞公及引引白仿弘凳蕙 */ CHAR_setFlg( fd_charaindex, CHAR_ISPARTY, (flg & CHAR_FS_PARTY )? TRUE:FALSE); //CHAR_setFlg( fd_charaindex, CHAR_ISBATTLE, // (flg & CHAR_FS_BATTLE )? TRUE:FALSE); CHAR_setFlg( fd_charaindex, CHAR_ISDUEL, (flg & CHAR_FS_DUEL )? TRUE:FALSE); CHAR_setFlg( fd_charaindex, CHAR_ISPARTYCHAT, (flg & CHAR_FS_PARTYCHAT )? TRUE:FALSE); CHAR_setFlg( fd_charaindex, CHAR_ISTRADECARD, (flg & CHAR_FS_TRADECARD )? TRUE:FALSE); // CoolFish: Trade 2001/4/18 CHAR_setFlg( fd_charaindex, CHAR_ISTRADE, (flg & CHAR_FS_TRADE )? TRUE:FALSE); /* if (CHAR_getFlg(fd_charaindex, CHAR_ISTRADECARD) == TRUE) CHAR_setFlg(fd_charaindex, CHAR_ISTRADE, FALSE); if (CHAR_getFlg(fd_charaindex, CHAR_ISTRADE) == TRUE) CHAR_setFlg(fd_charaindex, CHAR_ISTRADECARD, FALSE); */ lssproto_FS_send( fd, flg);}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_PR_recv( int fd,int x, int y, int request ){ int result = FALSE; int fd_charaindex; CHECKFDANDTIME; fd_charaindex = CONNECT_getCharaindex( fd );#if 1 // 禁止组队区域 if( request == 1 ) { int nowFloor; nowFloor = CHAR_getInt( fd_charaindex, CHAR_FLOOR); if( nowFloor == 31706 || nowFloor == 10204 || (10601 <= nowFloor && nowFloor <= 10605 ) || nowFloor == 10919 || nowFloor == 10920 || nowFloor == 20711 || nowFloor == 20712 || nowFloor == 1008 || nowFloor == 1021 || nowFloor == 3008 || nowFloor == 3021 || ( nowFloor <= 8213 && nowFloor >= 8200 ) || ( nowFloor >= 30017 && nowFloor <= 30021 )#ifdef _TIME_TICKET || check_TimeTicketMap(nowFloor)#endif ){ print("\n 改封包!禁止组队区域!!:%s ", CHAR_getChar( fd_charaindex, CHAR_CDKEY) ); return; } }#endif {//ttom avoid warp at will int ix,iy; ix=CHAR_getInt(fd_charaindex, CHAR_X); iy=CHAR_getInt(fd_charaindex, CHAR_Y); if( (ix!=x)||(iy!=y)){ //print("\n<PR>--Error!!!!"); //print("\n<PR>origion x=%d,y=%d",ix,iy); //print("\n<PR>modify X=%d,Y=%d",x,y); x=ix; y=iy; } } CHAR_setMyPosition( fd_charaindex, x,y,TRUE); if( request == 0 ) { /* 轮迩允月 */ result = CHAR_DischargeParty(fd_charaindex, 0); } else if( request == 1 ) { result = CHAR_JoinParty(fd_charaindex); }}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_KS_recv( int fd,int petarray ){ int ret , fd_charaindex; CHECKFDANDTIME; fd_charaindex = CONNECT_getCharaindex( fd ); if( CHAR_getInt( fd_charaindex, CHAR_RIDEPET) == petarray ) lssproto_KS_send( fd, petarray, FALSE); ret = PET_SelectBattleEntryPet( fd_charaindex, petarray); lssproto_KS_send( fd, petarray, ret);}#ifdef _STANDBYPETvoid lssproto_SPET_recv( int fd, int standbypet ){ int fd_charaindex; int i, s_pet =0, cnt =0; CHECKFDANDTIME; fd_charaindex = CONNECT_getCharaindex( fd ); if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE && standbypet >= CHAR_getWorkInt( fd_charaindex, CHAR_WORKSTANDBYPET) ) { print("\n 改封包!??战斗中用SPET增加待机宠!!:%s ", CHAR_getChar( fd_charaindex, CHAR_CDKEY) ); return; } //if( CHAR_getInt( fd_charaindex, CHAR_RIDEPET) == petarray ) { // lssproto_SPET_send( fd, petarray, FALSE); //} for( i =0; i < CHAR_MAXPETHAVE; i++) { if( standbypet & ( 1 << i ) ) { //if( CHAR_getInt( fd_charaindex, CHAR_RIDEPET) == i ) // continue; cnt++; if( cnt > 3 ) { print("\n 改封包!待机宠超过数量!!:%s ", CHAR_getChar( fd_charaindex, CHAR_CDKEY) ); //lssproto_SPET_send( fd, s_pet, FALSE); break; } s_pet |= ( 1 << i ); } } CHAR_setWorkInt( fd_charaindex, CHAR_WORKSTANDBYPET, s_pet); lssproto_SPET_send( fd, s_pet, TRUE);}#endif/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_AC_recv( int fd,int x, int y,int actionno ){ int fd_charaindex; CHECKFDANDTIME; fd_charaindex = CONNECT_getCharaindex( fd ); {//ttom avoid the warp at will Char *ch; ch = CHAR_getCharPointer( fd_charaindex); // CoolFish: +1 2001/11/05 if (!ch) return; if((ch->data[CHAR_X]!=x)||(ch->data[CHAR_Y]!=y)){ return; } } CHAR_setMyPosition( fd_charaindex, x,y,TRUE); CHAR_sendAction( fd_charaindex, actionno, FALSE); return;}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_MU_recv( int fd,int x,int y,int array,int toindex ){ int to_charaindex = -1, fd_charaindex; CHECKFDANDTIME; fd_charaindex = CONNECT_getCharaindex( fd ); {//ttom avoid warp at will int ix,iy; ix=CHAR_getInt(fd_charaindex, CHAR_X); iy=CHAR_getInt(fd_charaindex, CHAR_Y); if( (ix!=x)||(iy!=y)){ //print("\n<MU>--Error!!!!"); //print("\n<MU>origion x=%d,y=%d",ix,iy); //print("\n<MU>modify X=%d,Y=%d",x,y); x=ix; y=iy; } } CHAR_setMyPosition( fd_charaindex, x,y,TRUE); to_charaindex = Callfromcli_Util_getTargetCharaindex( fd, toindex); MAGIC_Use( fd_charaindex, array, to_charaindex);}void lssproto_JB_recv( int fd,int x,int y ){ int charaindex, floor; CHECKFDANDTIME; charaindex = CONNECT_getCharaindex( fd ); { int ix,iy; ix=CHAR_getInt(charaindex, CHAR_X); iy=CHAR_getInt(charaindex, CHAR_Y); if( (ix!=x)||(iy!=y)){ x=ix; y=iy; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -