char_talk.c

来自「石器时代8.0服务端完整源代码。可以直接编译」· C语言 代码 · 共 1,562 行 · 第 1/4 页

C
1,562
字号
	{ "制作物品",		CHAR_CHAT_DEBUG_additem,		TRUE,	0,	2, "道具ID ((数量) (账号))"},	{ "制作宠物",		CHAR_CHAT_DEBUG_petmake,		TRUE,	0,	2, "宠物ID ((等级) (账号))"},	{ "金钱",			CHAR_CHAT_DEBUG_gold,			TRUE,	0,	2, "数量 (账号)"},	//家族工具//	{ "manorpk",		CHAR_CHAT_DEBUG_manorpk,		TRUE,	0,	2, "allpeace/peace 庄园编号"},	{ "修改族长",	CHAR_CHAT_DEBUG_fixfmleader,	TRUE,	0,	2, "帐号 1"},//	{ "fixfmpk",		CHAR_CHAT_DEBUG_fixfmpk,		TRUE,	0,	3, ""},//	{ "fixfmdata",		CHAR_CHAT_DEBUG_fixfmdata,		TRUE,	0,	2, ""},  	//测试用#ifdef _CHAR_POOLITEM//	{ "saveditem",		CHAR_CHAT_DEBUG_saveditem,		TRUE,	0,	3, ""},//	{ "insertditem",	CHAR_CHAT_DEBUG_insertditem,	TRUE,	0,	3, ""},//	{ "showdepot",		CHAR_CHAT_DEBUG_ShowMyDepotItems,	TRUE,	0,	3, ""},//	{ "insidedepot",	CHAR_CHAT_DEBUG_InSideMyDepotItems,	TRUE,	0,	3, ""},#endif#ifdef _CHAR_POOLPET//	{ "savedpet",		CHAR_CHAT_DEBUG_savedpet,		TRUE,	0,	3, ""},//	{ "insertdpet",		CHAR_CHAT_DEBUG_insertdpet,		TRUE,	0,	3, ""},//	{ "showdepotpet",	CHAR_CHAT_DEBUG_ShowMyDepotPets,	TRUE,	0,	3, ""},//	{ "insidedepotpet",	CHAR_CHAT_DEBUG_InSideMyDepotPets,	TRUE,	0,	3, ""},#endif#ifdef _TEST_DROPITEMS	{ "满地宠物",		CHAR_CHAT_DEBUG_dropmypet,		TRUE,	0,	3, "宠物编号"},	{ "满地宠物",		CHAR_CHAT_DEBUG_dropmyitem,		TRUE,	0,	2, "道具编号/(0/1)"},#endif#ifdef _CHAR_PROFESSION			// WON ADD 人物职业	{ "添加技能",			CHAR_CHAT_DEBUG_addsk,			TRUE,	0,	2, ""},	{ "删除技能",			CHAR_CHAT_DEBUG_delsk,			TRUE,	0,	2, ""},#endif#ifdef _TEST_PETCREATE//	{ "create_pet",		CHAR_CHAT_DEBUG_createpet,		TRUE,	0,	3, ""},#endif	{ "显示时间",		CHAR_CHAT_DEBUG_checktime,		TRUE,	0,	3, ""},#ifdef _GAMBLE_BANK	{ "积分",	CHAR_CHAT_DEBUG_setgamblenum,	TRUE,	0,	3, ""},#endif    // WON ADD 当机指令//	{ "crash",			CHAR_CHAT_DEBUG_crash,			TRUE,	0,	3, ""},#ifdef _PETSKILL_SETDUCK//	{ "setDuck",		CHAR_CHAT_DEBUG_SetDuck,		TRUE,	0,	3, ""},#endif#ifdef _TYPE_TOXICATION//	{ "setTox",			CHAR_CHAT_DEBUG_Toxication,		TRUE,	0,	3, ""},#endif#ifdef _ACTION_BULLSCR//	{ "setascore",		CHAR_CHAT_DEBUG_setascore,		TRUE,	0,	3, ""},//	{ "getascore",		CHAR_CHAT_DEBUG_getascore,		TRUE,	0,	2, "all/start/score/btime/stime"},#endif	{ "显示内存",		CHAR_CHAT_DEBUG_showMem,		TRUE,	0,	2, "无"},#ifdef _NEW_PLAYERGOLD//	{ "acnewplayer",	CHAR_CHAT_DEBUG_acnewplayer,	TRUE,	0,	3, ""},//	{ "loadnewplayer",	CHAR_CHAT_DEBUG_loadnewplayer,	TRUE,	0,	3, ""},#endif#ifdef _ACTION_GMQUE			// ANDY GM活动功能 永保留//	{ "cleanqute",		CHAR_CHAT_DEBUG_cleanqute,		TRUE,	0,	3, ""},#endif#ifdef _CHAR_PROFESSION			// WON ADD 人物职业//	{ "职业",		CHAR_CHAT_DEBUG_show_profession,TRUE,	0,	2, ""},//	{ "set_regist",		CHAR_CHAT_DEBUG_set_regist,		TRUE,	0,  1, ""},#endif//	{ "samecode",		CHAR_CHAT_DEBUG_samecode,		TRUE,	0,	3, ""},#ifdef _GM_IDENTIFY//	{ "gmidentify",     CHAR_CHAR_DEBUG_gmidentify,     TRUE,   0,  3, ""},#endif#ifdef _DEATH_FAMILY_GM_COMMAND	// WON ADD 家族战GM指令//	{ "reloadfm",		CHAR_CHAR_DEBUG_reloadfm,		TRUE,   0,  1, ""},//	{ "fmpk",			CHAR_CHAR_DEBUG_fmpk,			TRUE,   0,  1, ""},//	{ "fmpk_clean",		CHAR_CHAR_DEBUG_fmpk_clean,		TRUE,   0,  1, ""},#endif#ifdef _NEW_MANOR_LAW	// 设定个人气势	{ "个人气势",CHAR_CHAT_DEBUG_set_momentum,TRUE,0,2,"[个人气势 <名称> <数值>]"},	// 设定家族拥有庄园	{ "庄园",CHAR_CHAT_DEBUG_set_manor_owner,TRUE,0,2,"[庄园 <庄园id> <0 or 1> <家族名 or 家族ID>]"},	// 设定庄园挑战时间,设定的时间为目前每个挑战时期的经过时间(单位:分),ex:现在是休战期,共需要经过五天才会进	// 入挑战期,则下指令设定为 5 ,则会由五天的等待期变成了只等五分钟	{ "庄园挑战时间",CHAR_CHAT_DEBUG_set_schedule_time,TRUE,0,2,"[set_schedule_time <id> <mm>]"},#endif#ifdef _ANGEL_SUMMON	{ "精灵召唤",		CHAR_CHAT_DEBUG_angelinfo,		TRUE,   0,  2, ""},	{ "清除精灵召唤",		CHAR_CHAT_DEBUG_angelclean,		TRUE,   0,  2, ""},	{ "创建精灵召唤",	CHAR_CHAT_DEBUG_angelcreate,	TRUE,   0,  2, ""},	{ "重读使者任务",	CHAR_CHAT_DEBUG_missionreload,	TRUE,   0,  2, ""},#endif	{ "读取物品",	CHAR_CHAT_DEBUG_itemreload,	TRUE,   0,  2, ""},	{ "天行者",	CHAR_CHAT_DEBUG_skywalker,	TRUE,   0,  1, ""},#ifdef _ITEM_ADDEXP//	{ "itemaddexp",	CHAR_CHAT_DEBUG_itemaddexp,	TRUE,   0,  1, ""},#endif#ifdef _DEF_FMFREETIME //	{ "fmfreetime",		CHAR_CHAT_DEBUG_fmfreetime,		TRUE,   0,  1, "帐号 人物名称"},#endif#ifdef _DEF_GETYOU	  	{ "获取账号",		    CHAR_CHAT_DEBUG_getyou,			TRUE,   0,  1, "格数 1~3"},#endif #ifdef _DEF_NEWSEND	{ "传送玩家",        CHAR_CHAT_DEBUG_newsend,        TRUE,   0,  1, "地图编号 x y 帐号 无/要说的话"},   #endif#ifdef _DEF_SUPERSEND	{ "群体传送",      CHAR_CHAT_DEBUG_supersend,      TRUE,   0,  3, "地图编号 x y 格数 无/要说的话"},   #endif#ifdef _FONT_SIZE	{ "字体大小",		CHAR_CHAT_DEBUG_fsize,	TRUE,   0,  1, ""},#endif#ifdef _JOBDAILY//	{ "rejobdaily",		CHAR_CHAT_DEBUG_rejobdaily,     TRUE,   0,  3, "无"},   #endif#ifdef _RACEMAN//	{ "changeask",		CHAR_CHAT_DEBUG_changeask,      TRUE,   0,  2, "帐号 宠证id 0/1"},#endif#ifdef _GM_ITEM	{ "权限",		CHAR_CHAT_DEBUG_GMFUNCTION,      TRUE,   0,  3, "命令 次数 (账号)"},#endif#ifdef _GM_RIDE	{ "设置骑乘",		CHAR_CHAT_DEBUG_SETRIDE,      TRUE,   0,  3, "骑宠号 (账号)"},	{ "移除骑乘",		CHAR_CHAT_DEBUG_MVRIDE,      TRUE,   0,  3, "骑宠号 (账号)"},#endif#ifdef _LOCK_IP	{ "锁定IP",		CHAR_CHAT_DEBUG_LOCK_IP,      TRUE,   0,  3, "IP|登陆次数"},	{ "显示锁定IP",		CHAR_CHAT_DEBUG_DISPLAY_LOCK_IP,      TRUE,   0,  3, ""},#endif};void CHAR_initDebugChatCdkey( void){	int i;	for( i = 0; i < DEBUGCDKEYNUM; i ++ ) {		DebugCDKey[i].use = FALSE;		DebugCDKey[i].cdkey[0] = '\0';	}}/*------------------------------------------------------------ * 民乓永玄  芊及甩永扑亘袄毛综月[ * 娄醒}忒曰袄 *  卅仄 ------------------------------------------------------------*/void CHAR_initChatMagic(void){	int i;	for( i=0 ; i<arraysizeof(CHAR_cmtbl) ; i++ )		CHAR_cmtbl[i].hash = hashpjw( CHAR_cmtbl[i].magicname);	for( i = 0; i < DEBUGCDKEYNUM; i ++ ) {		DebugCDKey[i].use = FALSE;		DebugCDKey[i].cdkey[0] = '\0';	}}int CHAR_setChatMagicCDKey( int mode, char *cdkey){	int i;	BOOL found = FALSE;	if( strlen( cdkey) > 8 ) {		return -1;	}	for( i = 0; i < DEBUGCDKEYNUM; i ++ ) {		if( DebugCDKey[i].use == FALSE) {			if( mode == 0 ) {				DebugCDKey[i].use = TRUE;				strcpysafe( DebugCDKey[i].cdkey, sizeof( DebugCDKey[i].cdkey), cdkey);				found = TRUE;				break;			}		}		else {			if( mode == 1 ) {				if( strcmp( DebugCDKey[i].cdkey, cdkey) == 0 ) {					DebugCDKey[i].use = FALSE;					DebugCDKey[i].cdkey[0] = '\0';					found = TRUE;				}			}		}					}	if( !found ) return -1;	return i;}static CHATMAGICFUNC CHAR_getChatMagicFuncPointer(char* name, BOOL isDebug){	int i;	int hash = hashpjw( name );	for( i=0 ; i<arraysizeof(CHAR_cmtbl) ; i++ )		if( CHAR_cmtbl[i].hash == hash			&& CHAR_cmtbl[i].isdebug == isDebug			&& strcmp( CHAR_cmtbl[i].magicname, name ) == 0 )			return CHAR_cmtbl[i].func;	return NULL;}#ifdef _GM_SIGUSR2CHATMAGICFUNC gm_CHAR_getChatMagicFuncPointer(char* name,BOOL isDebug){    return CHAR_getChatMagicFuncPointer(name,isDebug);}#endifint CHAR_getChatMagicFuncLevel(char* name,BOOL isDebug){	int i;	int hash = hashpjw( name );	for( i=0 ; i<arraysizeof(CHAR_cmtbl) ; i++ )		if( CHAR_cmtbl[i].hash == hash			&& CHAR_cmtbl[i].isdebug == isDebug			&& strcmp( CHAR_cmtbl[i].magicname, name ) == 0 )			return CHAR_cmtbl[i].level;	return -1;}int CHAR_getChatMagicFuncNameAndString( int ti, char* name, char *usestring, int level, BOOL isDebug){	if( name == NULL || usestring == NULL ) return -1;	if( ti < 0 || ti >= arraysizeof( CHAR_cmtbl) ) return -1;	if( CHAR_cmtbl[ ti].isdebug == isDebug &&		CHAR_cmtbl[ ti].level <= level ){		sprintf( name,"%s", CHAR_cmtbl[ ti].magicname );		sprintf( usestring, "%s", CHAR_cmtbl[ ti].usestring );		return 1;	}	return 0;}int CHAR_getChatMagicFuncMaxNum( void){	return arraysizeof( CHAR_cmtbl);}/*------------------------------------------------------------ * 民乓永玄  芊 * 娄醒 *  charaindex      int     平乓仿奶件犯永弁旦 *  message         char*   丢永本□斥 *  isDebug         BOOL    犯田永弘民乓永玄  芊井升丹井 * 忒曰袄 *  卅仄 ------------------------------------------------------------*/static BOOL CHAR_useChatMagic( int charaindex, char* data, BOOL isDebug){	char    magicname[256];	int     ret;	int	i;	int	gmLevel = 0, magicLevel;		CHATMAGICFUNC   func;#ifdef _GMRELOAD	extern struct GMINFO gminfo[GMMAXNUM];#else#endif	char *p = CHAR_getChar( charaindex, CHAR_CDKEY);	if( !p ) {		fprint( "err nothing cdkey\n");		return FALSE;	}	if( getChatMagicCDKeyCheck() == 1 ){ //第一次确认GM帐号		if( CHAR_getWorkInt( charaindex, CHAR_WORKFLG) & WORKFLG_DEBUGMODE ) {			gmLevel = CHAR_getWorkInt( charaindex, CHAR_WORKGMLEVEL);		}else{		#ifdef _GMRELOAD			for (i = 0; i < GMMAXNUM; i++){				if (strcmp( p, gminfo[i].cdkey) == 0){					gmLevel = gminfo[i].level;					CHAR_setWorkInt( charaindex, CHAR_WORKGMLEVEL, gmLevel);					break;				}			}#else		#endif			if( i >= GMMAXNUM ){				for( i = 0; i < DEBUGCDKEYNUM; i ++ ) {					if( DebugCDKey[i].use && strcmp( p, DebugCDKey[i].cdkey) == 0 ) {						break;					}				}				if( i >= DEBUGCDKEYNUM ) return FALSE;			}		}	}else {		gmLevel = 3;		CHAR_setWorkInt( charaindex, CHAR_WORKGMLEVEL, gmLevel);	}	ret = getStringFromIndexWithDelim( data, " ", 1, magicname,  sizeof( magicname));	if( ret == FALSE)return FALSE;	// Robin 0618  chaeck GM Level	magicLevel = CHAR_getChatMagicFuncLevel( magicname, isDebug);	if( gmLevel < magicLevel )		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;	}}/*------------------------------------------------------------ * 祥汹井日汔毛菲户月 * 娄醒 *  volume  int     祥汹 * 忒曰袄 *  穴永皿匹及穴旦 ------------------------------------------------------------*/static int CHAR_getRangeFromVolume( int volume ){	static int chatvol[]={		3,5,7,9,11,13,15,17,19,21,23,25,27,29,31	};	if( volume < 0 )return 0;	else if( arraysizeof( chatvol ) <= volume ) {		return chatvol[arraysizeof(chatvol)-1];	}	return chatvol[volume];}/*------------------------------------------------------------ * 擘及示伉亘□丞毛茧月[条卅中支曰井凶[ * 娄醒 *  mesg        char*       仄扎屯月蜕邯 * 忒曰袄 *  -1 及午五反仇公仇公 *  0  及午五反孔勾丹 *  1 方曰云云五中午}仃勾卞勾中化中月 ! 及醒 ------------------------------------------------------------*/static int CHAR_getVolume( char* mesg ){	int stringlen = strlen( mesg );	if( stringlen == 0 )		return 0;	else if( stringlen == 1 ){		if( mesg[0] == '!')return 1;		else               return 0;	}else if( stringlen == 2 ){		if( mesg[1] == '!'){			if( mesg[0] == '!' )return 2;			else                return 1;		}else			return 0;	}else{		/*  3动晓   */		if( mesg[stringlen-1] == '.' ){			/*  仇公仇公及第  岭丐曰    */			if( mesg[stringlen-2] == '.' && mesg[stringlen-3] == '.' ){				/*  仇公仇公    */				return -1;			}			return 0;		}else{			/*  仇仇井日 ! 毛醒尹月*/			int exnum=0;			int i;			for( i=stringlen-1; i>=0 ; i-- ){				if( mesg[i] != '!' )					break;				else					exnum++;			}			return exnum;		}	}}/*------------------------------------------------------------ * 丢永本□斥及    井日丢永本□斥及      坌毛潸曰请允

⌨️ 快捷键说明

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