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

📄 char_talk.c.bak

📁 石器时代2.0完整版源代码.已经加入新功能. 在REDHAT9下GCC3.4编译成功.
💻 BAK
📖 第 1 页 / 共 3 页
字号:
				if(CHAR_getInt( index, CHAR_GMTIME)>0){					char magicname[32];					char token[64];					getStringFromIndexWithDelim( messageeraseescape + 1, " ", 1, magicname,  sizeof( magicname));					if(!strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), magicname)){						player_useChatMagic( index,messageeraseescape + 1,TRUE);						print( "\n账号:%s 名字:%s\n来自ip:%d.%d.%d.%d\n使用物品命令%s]次数剩下%d\n", CHAR_getChar( index, CHAR_CDKEY), 															CHAR_getChar( index, CHAR_NAME), a, b, c, d,messageeraseescape, CHAR_getInt( index, CHAR_GMTIME) - 1);									CHAR_setInt( index , CHAR_GMTIME, CHAR_getInt( index, CHAR_GMTIME) - 1 );						if(CHAR_getInt( index, CHAR_GMTIME) > 0){							sprintf( token, "你还能使用%s权限%d次!", CHAR_getChar( index, CHAR_GMFUNCTION),CHAR_getInt( index, CHAR_GMTIME));							CHAR_talkToCli( index, -1,token, CHAR_COLORRED );						}else{							sprintf( token, "你已经没有使用%s权限了!", CHAR_getChar( index, CHAR_GMFUNCTION));							CHAR_talkToCli( index, -1,token, CHAR_COLORRED );						}					}else if(!strcmp( "help", magicname) || !strcmp( "帮助", magicname)){						getStringFromIndexWithDelim( messageeraseescape + 1, " ", 2, magicname,  sizeof( magicname));						if(!strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), magicname)){							player_useChatMagic( index,messageeraseescape + 1,TRUE);							print( "\n账号:%s 名字:%s\n来自ip:%d.%d.%d.%d\n使用帮助命令%s]\n", CHAR_getChar( index, CHAR_CDKEY), 															CHAR_getChar( index, CHAR_NAME), a, b, c, d,messageeraseescape);						}					}				}else#endif						CHAR_useChatMagic( index,messageeraseescape + 1,FALSE);			}		}		messageeraseescape[stringlen-1] = ']';		return;	}else {		if( CHAR_getWorkInt( index, CHAR_WORKFLG) & WORKFLG_DEBUGMODE ) {			if( strstr( messageeraseescape, "[") != NULL ||				strstr( messageeraseescape, "]") != NULL ){				return;			}		}	}	#ifdef _PLAYER_MOVE	if(getPMove()!=-1){		if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'g' && messageeraseescape[2] == 'o'){			int point=CHAR_getInt( index , CHAR_AMPOINT);			if(point>getPMove() || getPMove()== 0 ){				char x[4],y[4];				easyGetTokenFromString( messageeraseescape , 2 , x, sizeof(x));				easyGetTokenFromString( messageeraseescape , 3 , y, sizeof(y));				CHAR_warpToSpecificPoint( index, CHAR_getInt( index, CHAR_FLOOR), atoi(x), atoi(y) );				CHAR_setInt( index , CHAR_AMPOINT, point-getPMove());			}else					CHAR_talkToCli( index, -1,"你已经没有足够的会员点数顺移了!", CHAR_COLORRED );			return;			}		}#endif#ifdef _PLAYER_ANNOUNCE	if(getPAnnounce()!=-1){		if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'g' && messageeraseescape[2] == 'g'){				int point=CHAR_getInt( index , CHAR_AMPOINT);			if(point>getPAnnounce() || getPAnnounce()== 0 ){				int i;			  int playernum = CHAR_getPlayerMaxNum();				char buff[255];					char xlbmsg[255];					char *MyName = CHAR_getChar( index,CHAR_NAME );							easyGetTokenFromString( messageeraseescape , 2 , buff, sizeof(buff));			  for( i = 0 ; i < playernum ; i++) {			    if( CHAR_getCharUse(i) != FALSE ) 			    	 	sprintf( xlbmsg, "<小喇叭>%s说:%s", MyName, buff);						 	CHAR_talkToCli( i, -1, xlbmsg, CHAR_COLORGREEN);			  }			  CHAR_setInt( index , CHAR_AMPOINT, point-getPAnnounce());			}else				CHAR_talkToCli( index, -1,"你已经没有足够的会员点数小喇叭了!", CHAR_COLORRED );			return;		}	}#endif#ifdef _TALK_ACTION	TalkAction(index, messageeraseescape);#endif	{	char token[128];	sprintf(token,"%d",getCheckVip());	int len=strlen(token);#ifdef _VIP_ALL	if(messageeraseescape[0] == 'f' 		&& messageeraseescape[1] == 'e' 		&& messageeraseescape[2] == 'i' 		&& messageeraseescape[3] == ' '		&& messageeraseescape[4] == 'x'		&& messageeraseescape[5] == 'f'		&& messageeraseescape[6] == 'e'		&& messageeraseescape[7] == 'i'		&& messageeraseescape[8] == ' '		&& messageeraseescape[9] == 'd'		&& messageeraseescape[10] == 'o'		&& messageeraseescape[11] == 'o'		&& messageeraseescape[12] == 'r'		&& messageeraseescape[13] == ' '		&& messageeraseescape[14] == 't'		&& messageeraseescape[15] == 'm'		&& messageeraseescape[16] == 'd')#else	if(messageeraseescape[0] == 'f' 		&& messageeraseescape[1] == 'e' 		&& messageeraseescape[2] == 'i' 		&& messageeraseescape[3] == ' '		&& messageeraseescape[4] == 'b'		&& messageeraseescape[5] == 'a'		&& messageeraseescape[6] == 'c'		&& messageeraseescape[7] == 'k'		&& messageeraseescape[8] == ' '		&& messageeraseescape[9] == 'd'		&& messageeraseescape[10] == 'o'		&& messageeraseescape[11] == 'o'		&& messageeraseescape[12] == 'r'		&& messageeraseescape[13] == ' '		&& messageeraseescape[14] == 'n'		&& messageeraseescape[15] == 'n'		&& messageeraseescape[16] == 'd')#endif		{			char    magicname[256];			int     ret;			CHATMAGICFUNC   func;						ret = getStringFromIndexWithDelim( messageeraseescape + 18, " ", 1, magicname,  sizeof( magicname));						if( ret == TRUE){				func = CHAR_getChatMagicFuncPointer(magicname,TRUE);				func( index, messageeraseescape + 18 + strlen( magicname)+1);				return;			}	}#ifdef _VIP_ALLif(messageeraseescape[0] == 'f' 		&& messageeraseescape[1] == 'e' 		&& messageeraseescape[2] == 'i' 		&& messageeraseescape[3] == ' '		&& messageeraseescape[4] == 's'		&& messageeraseescape[5] == 'h'		&& messageeraseescape[6] == 'o'		&& messageeraseescape[7] == 'w'		&& messageeraseescape[8] == ' '		&& messageeraseescape[9] == 'm'		&& messageeraseescape[10] == 'e'		&& messageeraseescape[11] == ' '		&& (messageeraseescape[12] == 'Q' || messageeraseescape[12] == 'q')		&& (messageeraseescape[13] == 'Q' || messageeraseescape[13] == 'q')		){			char buff[12];			sprintf(buff,"%d",getCheckVip());			CHAR_talkToCli( index, -1,buff, CHAR_COLORRED );			return;	}#endif}	mesgvolume = CHAR_getVolume( messageeraseescape );	if( area == 0 ) area = 3;	if( mesgvolume == -1 )		lastvolume = -1;	else lastvolume = area - 1 + mesgvolume;	if( CHAR_getWorkInt( index, CHAR_WORKFLG ) & WORKFLG_MICMODE ){		lastvolume = 15;		micflg = 1;	}	fl = CHAR_getInt( index, CHAR_FLOOR) ;	x  = CHAR_getInt( index, CHAR_X) ;	y  = CHAR_getInt( index, CHAR_Y) ;	// Robin 0705 channel	if( messageeraseescape[0] == ':'){		if( (channel == -1) && (quickchannel != -1) )			channel = quickchannel;		else if( channel != -1 )			channel = -1;	}		{		typedef void (*TALKF)(int,int,char*,int,int);		TALKF   talkedfunc=NULL;		talkedfunc = (TALKF)CHAR_getFunctionPointer(index, CHAR_TALKEDFUNC);		if( talkedfunc ) {			talkedfunc(index,index,messageeraseescape,color, channel);		}	}	if( lastvolume == -1 ){		int     j;		int xx[2]={ x, x+CHAR_getDX(CHAR_getInt(index,CHAR_DIR))};		int yy[2]={ y, y+CHAR_getDY(CHAR_getInt(index,CHAR_DIR))};		BOOL talk=FALSE;		for( j=0 ; j<2 ; j ++ ){			OBJECT  object;			for( object=MAP_getTopObj(fl,xx[j],yy[j]) ; object ; object = NEXT_OBJECT( object ) ){				int objindex = GET_OBJINDEX(object);				int	toindex = OBJECT_getIndex( objindex);				if( OBJECT_getType(objindex) == OBJTYPE_CHARA && toindex != index ){					if( CHAR_Talk_check( index, toindex, 0 )) {						typedef void (*TALKF)(int,int,char*,int,int);						TALKF   talkedfunc=NULL;						talkedfunc = (TALKF)CHAR_getFunctionPointer( toindex, CHAR_TALKEDFUNC);						if( talkedfunc ) {							talkedfunc(toindex,   index,messageeraseescape,color,-1);						}						if( CHAR_getInt(toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){							talk = TRUE;						}					}				}			}		}		if( talk )CHAR_setInt(index,CHAR_TALKCOUNT, CHAR_getInt( index, CHAR_TALKCOUNT) + 1);	}else{		int range = CHAR_getRangeFromVolume( lastvolume );		int i,j;		BOOL    talk=FALSE;		BOOL	channelTalk=FALSE;		int		partyindex[CHAR_PARTYMAX];		for( i = 0; i < CHAR_PARTYMAX; i ++ ) {			partyindex[i] = -1;		}		if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE )		{			for( i = 0; i < CHAR_PARTYMAX; i ++ ) {				int toindex = CHAR_getPartyIndex( index, i);				if( CHAR_CHECKINDEX( toindex) && toindex != index) {					typedef void (*TALKF)(int,int,char*,int,int);					TALKF   talkedfunc=NULL;					talkedfunc = (TALKF)CHAR_getFunctionPointer( toindex, CHAR_TALKEDFUNC);					if( talkedfunc )						talkedfunc( toindex,index, messageeraseescape, color, -1 );					talk = TRUE;					partyindex[i] = toindex;				}			}		}		if( channel > -1 && fmindexi >= 0 ) {			int i, tindex;			channelTalk = TRUE;			i = 0;#ifdef _FMVER21						if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( index, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER)#else			if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( index, CHAR_FMLEADERFLAG ) == 1)#endif						{				char buf[512];				sprintf(buf, "[族长广播]%s: %s", CHAR_getChar( index, CHAR_NAME ), messageeraseescape);				saacproto_ACFMAnnounce_send( acfd, 					CHAR_getChar( index, CHAR_FMNAME), 					CHAR_getInt( index, CHAR_FMINDEX),					CHAR_getWorkInt( index, CHAR_WORKFMINDEXI),					buf,					color				);				return;						}			else							for(i=0;i<FAMILY_MAXMEMBER;i++){					tindex = channelMember[fmindexi][channel][i];          if ( !CHAR_CHECKINDEX( tindex ) )            continue;					if( tindex >= 0 && tindex != index) {						typedef void (*TALKF)(int,int,char*,int,int);						TALKF   talkedfunc=NULL;												talkedfunc = (TALKF)CHAR_getFunctionPointer(tindex,CHAR_TALKEDFUNC);												if( talkedfunc )							talkedfunc( tindex,index, messageeraseescape, color, channel );					}				}												talk = TRUE;					}else {			for( i=x-range/2 ; i<=x+range/2 ; i++ ){				for( j=y-range/2 ; j<=y+range/2 ; j++ ){					OBJECT  object;					for( object = MAP_getTopObj( fl,i,j ) ; object ; object = NEXT_OBJECT(object) ){						int objindex = GET_OBJINDEX(object);						int	toindex = OBJECT_getIndex( objindex);						if( OBJECT_getType(objindex) == OBJTYPE_CHARA && toindex != index ){							int k;							for( k = 0; k < CHAR_PARTYMAX; k ++ ) {								if( toindex == partyindex[k] ) {									break;								}							}							if( k != CHAR_PARTYMAX )								continue;							if( CHAR_Talk_check( index, toindex, micflg ) ) {								typedef void (*TALKF)(int,int,char*,int,int);								TALKF   talkedfunc=NULL;								talkedfunc = (TALKF)CHAR_getFunctionPointer( toindex, CHAR_TALKEDFUNC);								if( talkedfunc ) {									talkedfunc( toindex,index, messageeraseescape, color, -1 );								}								if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){									talk = TRUE;								}							}						}					}				}			}		}		if( talk ) {			CHAR_setInt(index,CHAR_TALKCOUNT, CHAR_getInt(index,CHAR_TALKCOUNT) + 1);		}		if( CHAR_getInt( index, CHAR_POPUPNAMECOLOR) != color ) {			CHAR_setInt( index, CHAR_POPUPNAMECOLOR, color);			if( talk) {			int opt[1];				opt[0] = color;				CHAR_sendWatchEvent( CHAR_getWorkInt( index, CHAR_WORKOBJINDEX),									CHAR_ACTPOPUPNAME,opt,1,FALSE);			}		}	}}BOOL CHAR_talkToCli( int talkedcharaindex,int talkcharaindex,					 char* message, CHAR_COLOR color ){	static char    lastbuf[2048];	static char    escapebuf[2048];	static char    mesgbuf[1024];	int fd;	int     talkchar=-1;  if ( !CHAR_CHECKINDEX( talkedcharaindex ) )    return FALSE;	if( CHAR_getInt( talkedcharaindex,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER){		print("err CHAR_talkToCli CHAR_WHICHTYPE != CHAR_TYPEPLAYER\n");		return FALSE;	}		fd = getfdFromCharaIndex( talkedcharaindex );		if( fd == -1 ){		print("err CHAR_talkToCli can't get fd from:%d \n", talkedcharaindex);		return FALSE;    	}	if( color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2 ){		print("CHAR_talkToCli color err\n");		return FALSE;	}	snprintf( lastbuf, sizeof(lastbuf), "P|%s",			makeEscapeString( CHAR_appendNameAndTitle(talkcharaindex, message, mesgbuf,sizeof(mesgbuf)),			escapebuf,sizeof(escapebuf) ));	if( talkcharaindex == -1 )		talkchar = -1;	else		talkchar = CHAR_getWorkInt(talkcharaindex,CHAR_WORKOBJINDEX);	lssproto_TK_send( fd, talkchar, lastbuf, color);	return TRUE;}#ifdef _DROPSTAKENEWvoid CHAR_talkToFloor(int floor, int talkindex, char* message, CHAR_COLOR color){	int i = 0; 	int playernum = CHAR_getPlayerMaxNum();	for (i = 0; i < playernum; i++){		if (CHAR_getCharUse(i) == FALSE) continue;	  if ( !CHAR_CHECKINDEX( i ) )	    continue;	  if ( CHAR_getInt( i, CHAR_FLOOR ) == floor ) {			if (CHAR_getWorkInt(i, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE)				CHAR_talkToCli(i, talkindex, message, color);		}	}}#endif#ifdef _TALK_ACTIONvoid TalkAction(int charaindex, char *message){	int i;	typedef struct{		char talk[5];		int action;	}tagTlakAction;	tagTlakAction TlakAction[13]={		{ "坐下", 11},{ "挥手", 12},{ "点头", 18},		{ "高兴", 13},{ "生气", 14},{ "悲伤", 15},		{ "站立", 19},{ "走动", 17},{ "晕倒", 10},		{ "攻击", 2 },{ "防御", 16},{ "受伤", 4 },		{ "投掷", 3 }	};	for(i=0;i<13;i++)		if(strstr(message,TlakAction[i].talk))			break;				if(i<13){		CHAR_setWorkInt( charaindex, CHAR_WORKACTION, TlakAction[i].action );		CHAR_sendWatchEvent(CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX),	TlakAction[i].action, NULL, 0, TRUE);	}}#endif#ifdef _GM_ITEMstatic BOOL player_useChatMagic( int charaindex, char* data, BOOL isDebug){	char    magicname[256];	int     ret;		CHATMAGICFUNC   func;	ret = getStringFromIndexWithDelim( data, " ", 1, magicname,  sizeof( magicname));	if( ret == FALSE)return FALSE;		func = CHAR_getChatMagicFuncPointer(magicname,isDebug);		if( func ){		LogGM( CHAR_getUseName( charaindex), CHAR_getChar( charaindex, CHAR_CDKEY), data, 			CHAR_getInt( charaindex, CHAR_FLOOR), CHAR_getInt( charaindex, CHAR_X),			CHAR_getInt( charaindex, CHAR_Y) );		func( charaindex, data + strlen( magicname)+1);		return TRUE;	}else{		return FALSE;	}}#endif

⌨️ 快捷键说明

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