⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callfromcli.c

📁 石器时代2.0完整版源代码.已经加入新功能. 在REDHAT9下GCC3.4编译成功.
💻 C
📖 第 1 页 / 共 4 页
字号:
	CHAR_setMyPosition( charaindex, x,y,TRUE);	if( CHAR_CHECKINDEX( charaindex ) == FALSE )return;	floor = CHAR_getInt( charaindex, CHAR_FLOOR );	if( floor == 1007	|| floor == 2007	|| floor == 3007	|| floor == 4007	|| floor == 130	#ifdef _AUTO_PK	|| (floor == 20000 && CHAR_getInt( charaindex, CHAR_AUTOPK ) == -1)#endif#ifdef _WATCH_FLOOR		|| floor == getWatchFloor(1)		|| floor == getWatchFloor(2)		|| floor == getWatchFloor(3)		|| floor == getWatchFloor(4)		|| floor == getWatchFloor(5)		|| !strcmp(getWatchFloorCF(),"是")#endif		){		BATTLE_WatchTry( charaindex );	}else{		BATTLE_RescueTry( charaindex );	}}void lssproto_KN_recv( int fd,int havepetindex,char* data ){    int fd_charaindex;    CHECKFD;    fd_charaindex = CONNECT_getCharaindex( fd );        // Robin 04/26 debug    if( strlen(data) > 16 )	return;        // CoolFish: Prevent Trade Cheat 2001/4/18    if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE)	    	return;	if( checkStringErr(data) )	return;		CHAR_inputUserPetName( fd_charaindex, havepetindex, data);	}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_WN_recv( int fd,int x,int y,int seqno,                       int objindex,int select, char* data ){    int fd_charaindex;    CHECKFDANDTIME;        if( checkStringErr(data) )	return;    fd_charaindex = CONNECT_getCharaindex( fd );    // CoolFish: Prevent Trade Cheat 2001/4/18    if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE)	{		return;	}    // Robin    if( checkStringErr(data) )	return;    {//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)){           // Robin 04/20 test           return;           x=ch->data[CHAR_X];           y=ch->data[CHAR_Y];       }     //ttom avoid WN at will     if(seqno==CHAR_WINDOWTYPE_NPCENEMY_START){//      Char *ch;        OBJECT  object;        int ix,iy,ifloor,i,j;        int     whichtype= -1;        int enemy=0;        int enemy_index;        if(!CHECKOBJECT(objindex)){            goto  FIRST;        }        enemy_index=OBJECT_getIndex(objindex);//ttom 11/15/2000        ix    =ch->data[CHAR_X];        iy    =ch->data[CHAR_Y];        ifloor=ch->data[CHAR_FLOOR];        for(i=iy-1;i<=iy+1;i++){            for(j=ix-1;j<=ix+1;j++){             for( object = MAP_getTopObj(ifloor,j,i) ; object ;                  object = NEXT_OBJECT(object ) ){                  int objindex = GET_OBJINDEX(object);                  switch( OBJECT_getType(objindex)  ){                          case OBJTYPE_CHARA:                               whichtype =  CHAR_getInt( OBJECT_getIndex( objindex), CHAR_WHICHTYPE);                               if( whichtype == CHAR_TYPENPCENEMY){                                   int i_ene_temp;                                   i_ene_temp=OBJECT_getIndex( objindex);                                   //print("\n<WN>--enetemp=%d",i_ene_temp);                                   if(i_ene_temp== enemy_index){                                       goto START_WN;                                   }else{                                       enemy=0;                                   }                               }                               break;                          case OBJTYPE_ITEM:                               break;                          case OBJTYPE_GOLD:                               break;                          default:                           break;                  }             }            }        }        if(enemy==0){FIRST:		           lssproto_EN_send( fd, FALSE, 0 );           CHAR_talkToCli(fd_charaindex, -1, "事件错误。", CHAR_COLORYELLOW);           goto END_WN;        }     }     }     //ttom endSTART_WN:        CHAR_setMyPosition( fd_charaindex, x,y,TRUE);	if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){	         if(seqno==CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN){		         if(!CONNECT_get_first_warp(fd)){		             select=1;	        	 }		     }	         CHAR_processWindow( fd_charaindex, seqno,							select, objindex, makeStringFromEscaped(data));	}//ttom+1END_WN:	return;          //CONNECT_set_pass(fd,TRUE);//ttom}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_HL_recv( int fd,int flg ){	char	msgbuf[128];	int		i, fd_charaindex;    CHECKFD;    fd_charaindex = CONNECT_getCharaindex( fd );	if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE)		== BATTLE_CHARMODE_NONE)	{		return;	}#ifdef _LOCKHELP_OK				// (不可开) Syu ADD 锁定不可加入战斗	if((CHAR_getInt(fd_charaindex,CHAR_FLOOR) >= 8200 && CHAR_getInt(fd_charaindex,CHAR_FLOOR) <= 8213) ||		 (CHAR_getInt(fd_charaindex,CHAR_FLOOR) >= 30017 && CHAR_getInt(fd_charaindex,CHAR_FLOOR) <= 30021)		 || CHAR_getInt(fd_charaindex,CHAR_FLOOR) == 20000		){		return ; 	}#endif	if( flg == TRUE ) {		BattleArray[CHAR_getWorkInt( fd_charaindex,			CHAR_WORKBATTLEINDEX)].Side[			CHAR_getWorkInt( fd_charaindex,			CHAR_WORKBATTLESIDE)].flg |= BSIDE_FLG_HELP_OK;		snprintf( msgbuf, sizeof( msgbuf),				  "%s 在求救!",				  CHAR_getChar( fd_charaindex, CHAR_NAME));	}	else {		BattleArray[CHAR_getWorkInt( fd_charaindex,			CHAR_WORKBATTLEINDEX)].Side[			CHAR_getWorkInt( fd_charaindex,			CHAR_WORKBATTLESIDE)].flg &= ~BSIDE_FLG_HELP_OK;		snprintf( msgbuf, sizeof( msgbuf),				  "%s 决定拒绝帮助。",				  CHAR_getChar( fd_charaindex, CHAR_NAME));	}	for( i = 0; i < 5; i ++ ) {		int toindex = BattleArray[CHAR_getWorkInt(					    fd_charaindex, CHAR_WORKBATTLEINDEX)].Side[						CHAR_getWorkInt( fd_charaindex,						CHAR_WORKBATTLESIDE)].Entry[i].charaindex;		if( CHAR_CHECKINDEX( toindex)) {			int tofd = getfdFromCharaIndex( toindex );			if( tofd != -1 ) {				lssproto_HL_send( tofd, flg);			}			/* 丢永本□斥霜耨 */			CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORYELLOW);			CHAR_sendBattleEffect( toindex, ON);		}	}}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_ProcGet_recv( int fd ){	outputNetProcLog( fd, 1);}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_PlayerNumGet_recv( int fd ){	int		i;	int		clicnt  =0;	int		playercnt = 0;    for( i = 0; i < ConnectLen; i ++ ) {        if( CONNECT_getUse_debug(i,1017) ){            if( CONNECT_getCtype(i) == CLI) {            	clicnt ++;            	if( CONNECT_getCharaindex(i) >= 0 ) playercnt++;            }		}	}	lssproto_PlayerNumGet_send( fd, clicnt, playercnt);}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_LB_recv( int fd,int x,int y ){    int 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<LB>--Error!!!!");         //print("\n<LB>origion x=%d,y=%d",ix,iy);         //print("\n<LB>modify  X=%d,Y=%d",x,y);         x=ix;         y=iy;       }    }       CHAR_setMyPosition( fd_charaindex, x,y,TRUE);	/* 杀梁匹五月井民尼永弁仄化杀梁允月 */	BATTLE_WatchTry( fd_charaindex );}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_Shutdown_recv( int fd,char* passwd,int min ){	char	buff[32];	if( strcmp( passwd, "hogehoge") == 0 ) {	    int     i;	    int     playernum = CHAR_getPlayerMaxNum();		snprintf( buff, sizeof( buff),"%s公告。",getGameserverID());	    for( i = 0 ; i < playernum ; i++) {	        if( CHAR_getCharUse(i) != FALSE ) {				CHAR_talkToCli( i, -1, buff, CHAR_COLORYELLOW);			}		}		SERVSTATE_setLimittime(min);		SERVSTATE_setShutdown( NowTime.tv_sec );		SERVSTATE_setDsptime( 0 );	}}void lssproto_PMSG_recv( int fd,int index,int petindex,int itemindex,						char* message,int color ){	// CoolFish: Prevent Trade Cheat 2001/4/18	int fd_charaindex;	fd_charaindex = CONNECT_getCharaindex(fd);	if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE)	    	return;	PETMAIL_sendPetMail( CONNECT_getCharaindex( fd ),							index, petindex, itemindex, message, color);}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_PS_recv( int fd, int havepetindex, int havepetskill, int toindex, char* data ){    int to_charaindex = Callfromcli_Util_getTargetCharaindex( fd, toindex);	int charaindex = CONNECT_getCharaindex( fd );	int	petindex;	BOOL	ret;	petindex = CHAR_getCharPet( charaindex, havepetindex);	if( !CHAR_CHECKINDEX( petindex)) return;		ret = PETSKILL_Use( petindex, havepetskill, to_charaindex, data );	lssproto_PS_send( fd, ret, havepetindex, havepetskill, toindex);}/*------------------------------------------------------------ ------------------------------------------------------------*/void lssproto_SP_recv( int fd,int x,int y, int dir  ){    int fd_charaindex;    fd_charaindex = CONNECT_getCharaindex( fd );    {//ttom avoid the warp at will       int i_x,i_y;       i_x=CHAR_getInt(fd_charaindex, CHAR_X);       i_y=CHAR_getInt(fd_charaindex, CHAR_Y);                                if((i_x!=x)||(i_y!=y)){           x=i_x;           y=i_y;       }    }//ttom                                                                                           CHAR_setMyPosition_main( fd_charaindex, x,y,dir,TRUE);}/*------------------------------------------------------------ * CoolFish: Trade Command 2001/4/18 ------------------------------------------------------------*/void lssproto_TD_recv( int fd, char* message ){      int fd_charaindex;      CHECKFDANDTIME;                fd_charaindex = CONNECT_getCharaindex( fd );//      print(" MAP_TRADEPICKUP_check0 ");      CHAR_Trade(fd, fd_charaindex, message);}/*------------------------------------------------------------ * CoolFish: Family Command 2001/5/24 ------------------------------------------------------------*/void lssproto_FM_recv( int fd, char* message ){      int fd_charaindex;      struct timeval recvtime;      CHECKFDANDTIME;            // add code by shan      CONNECT_getLastrecvtime( fd, &recvtime);      if( time_diff( NowTime, recvtime) < 0.5 ){          return;      }      CONNECT_setLastrecvtime(fd, &NowTime);      fd_charaindex = CONNECT_getCharaindex( fd );            if( checkStringErr( message ) )	return;            CHAR_Family(fd, fd_charaindex, message);      }// shan 2002/01/10void lssproto_PETST_recv( int fd,  int nPet, int sPet ){      int charaindex;	  int i, nums=0;      CHECKFDANDTIME;            charaindex = CONNECT_getCharaindex( fd );	  if (!CHAR_CHECKINDEX( charaindex ) )	return;	  if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE)		!= BATTLE_CHARMODE_NONE) return ;	  	  for( i=0; i<5; i++)	{		if( CHAR_getWorkInt( charaindex, CHAR_WORK_PET0_STAT+i) == TRUE )			nums++;	  }	  if( nums <= 3 )		CHAR_setWorkInt( charaindex, CHAR_WORK_PET0_STAT+nPet, sPet);	     }#ifdef _MIND_ICONvoid lssproto_MA_recv(int fd, int x, int y, int nMind){	int charaindex;    CHECKFDANDTIME;	charaindex = CONNECT_getCharaindex( fd);	if(!CHAR_CHECKINDEX( charaindex)) return;	if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ;	{       int i_x, i_y;       i_x = CHAR_getInt( charaindex, CHAR_X);       i_y = CHAR_getInt( charaindex, CHAR_Y);       if((i_x!=x)||(i_y!=y)){           x = i_x;           y = i_y;       }    }	//print("\nshan------------------>mind action->%d x->%d y->%d", nMind, x, y);	CHAR_setMyPosition( charaindex, x, y, TRUE);	CHAR_setWorkInt( charaindex, CHAR_MIND_NUM, nMind);	CHAR_sendMindEffect( charaindex, CHAR_getWorkInt( charaindex, CHAR_MIND_NUM));	if(CHAR_getWorkInt( charaindex, CHAR_MIND_NUM) != 101290 &&	   CHAR_getWorkInt( charaindex, CHAR_MIND_NUM) != 101294   &&	   CHAR_getWorkInt( charaindex, CHAR_MIND_NUM) != 101288 )	CHAR_setWorkInt( charaindex, CHAR_MIND_NUM, 0);	//print("\nshan------------------>end");	return;}#endifBOOL checkStringErr( char *checkstring ){        int i,ach;        for (i=0,ach=0;i<strlen(checkstring);i++) {        	if ((unsigned char)checkstring[i]==0xff) { ach=1; break; } // Force no 0xff                if ((unsigned char)checkstring[i]==0x80) { ach=1; break; } // Force no 0x80                if ((unsigned char)checkstring[i]==0x7f) { ach=1; break; } // Force no 0x7f                if ((unsigned char)checkstring[i]<=0x20) { ach=1; break; } // Force greater than 0x20                if (ach) {                	if ((((unsigned char)checkstring[i]>=0x40)&&((unsigned char)checkstring[i]<=0x7e))||                        (((unsigned char)checkstring[i]>=0xa1)&&((unsigned char)checkstring[i]<=0xfe))) ach=0;                } else {                	if (((unsigned char)checkstring[i]>=0xa1)&&((unsigned char)checkstring[i]<=0xfe)) ach=1;                }	}	if (ach)	{		print(" StringDog! ");		return	TRUE;	}		return FALSE;	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -