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

📄 chatmagic.c

📁 石器时代2.0完整版源代码.已经加入新功能. 在REDHAT9下GCC3.4编译成功.
💻 C
📖 第 1 页 / 共 5 页
字号:
				CHAR_getCharPoolPet( index, 0),				CHAR_getCharPoolPet( index, 1),				CHAR_getCharPoolPet( index, 2),				CHAR_getCharPoolPet( index, 3),				CHAR_getCharPoolPet( index, 4));		CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE );		snprintf( line, sizeof( line),					  "poolpetindex [%d][%d][%d][%d][%d] " ,				CHAR_getCharPoolPet( index, 5),				CHAR_getCharPoolPet( index, 6),				CHAR_getCharPoolPet( index, 7),				CHAR_getCharPoolPet( index, 8),				CHAR_getCharPoolPet( index, 9));		CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE );	}	snprintf( line, sizeof( line),				  "levelup [%d], 累积 %d   赌场积分[%d]" ,			CHAR_getInt( index, CHAR_LEVELUPPOINT),			CHAR_getWorkInt( index, 	CHAR_WORKULTIMATE),			CHAR_getInt( index, CHAR_GAMBLENUM) );	CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE );}void CHAR_CHAT_DEBUG_sysinfo( int charindex , char *message ){	char msg[1024],name[256];	int i;	time_t new_t;	int dd,hh,mm,ss;	int items=0 , chars=0, golds=0, nouses=0;	int	players=0,pets=0,others=0;	int	whichtype= -1;	int objnum = OBJECT_getNum();	int itemnum = ITEM_getITEM_itemnum();	int itemuse =0;	makeEscapeString( getGameserverID(), name, sizeof( name));	sprintf( msg, "GSID:%s GSNAME:%s", getGameserverID(), name);	CHAR_talkToCli( charindex, -1, msg, CHAR_COLORYELLOW);	for( i=0 ; i<objnum ; i++){		switch( OBJECT_getType( i )){		case OBJTYPE_NOUSE:			nouses++;			break;		case OBJTYPE_CHARA:			chars++;			whichtype =  CHAR_getInt( OBJECT_getIndex( i), CHAR_WHICHTYPE);			if( whichtype == CHAR_TYPEPLAYER) players++;			else if( whichtype == CHAR_TYPEPET) pets++;			else others ++;			break;		case OBJTYPE_ITEM:			items++;			break;		case OBJTYPE_GOLD:			golds++;			break;		default:			break;		}	}	for( i=0 ; i<itemnum ; i++)		if( ITEM_getITEM_use(i) )			itemuse++;	snprintf( msg , sizeof(msg),			  "Object Char:%d Item:%d Gold:%d Nouse:%d Item use:%d",			  chars,items,golds, nouses, itemuse );	CHAR_talkToCli(charindex,-1,msg,CHAR_COLORYELLOW );	snprintf( msg , sizeof(msg),			  "player : %d  pet : %d  others  : %d",			  players, pets, others );	CHAR_talkToCli(charindex,-1,msg,CHAR_COLORYELLOW );		time(&new_t);	new_t -= initTime;        dd=(int) new_t / 86400; new_t=new_t % 86400;        hh=(int) new_t / 3600;  new_t=new_t % 3600;        mm=(int) new_t / 60;    new_t=new_t % 60;        ss=(int) new_t;	snprintf( msg, sizeof( msg ) ,          	"start: %d days %d hours %d min %d sec。",dd,hh,mm,ss);        CHAR_talkToCli( charindex, -1, msg, CHAR_COLORYELLOW );	{		showMem( msg);		CHAR_talkToCli( charindex, -1, msg, CHAR_COLORYELLOW);	}	snprintf( msg, sizeof( msg ) ,			"NPC_createnum:%d。",NPC_createnum);	CHAR_talkToCli( charindex, -1, msg, CHAR_COLORYELLOW );}void CHAR_CHAT_DEBUG_announce(int charindex , char *message ){    int     i;    int     playernum = CHAR_getPlayerMaxNum();    for( i = 0 ; i < playernum ; i++) {        if( CHAR_getCharUse(i) != FALSE ) {			CHAR_talkToCli( i, -1, message, CHAR_COLORRED);    }	}}void CHAR_CHAT_DEBUG_level( int charaindex, char* message ){	int i, level;	char buf[64];	char cdkey[CDKEYLEN];	char token[128];	int playernum = CHAR_getPlayerMaxNum();	easyGetTokenFromString( message , 1 , buf, sizeof(buf));	level=atoi(buf);	easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey));	if(strlen(cdkey)>0){		for(i=0;i<playernum;i++){			if(CHAR_CHECKINDEX(i) == FALSE) continue;			if(!strcmp( CHAR_getChar( i, CHAR_CDKEY), cdkey))			{				break;			}		}		if (i>=playernum)		{		 	CHAR_talkToCli( charaindex, -1, "此账号不在线~", CHAR_COLORYELLOW );			return;		}		CHAR_setInt(i,CHAR_LV, atoi( message ));		CHAR_send_P_StatusString( i , CHAR_P_STRING_LV|CHAR_P_STRING_NEXTEXP);		sprintf( token, "[GM]%s把你的等级设置为%d!", CHAR_getChar( charaindex, CHAR_NAME),level);		CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW );		sprintf( token, "玩家%s的等级设置为%d!", CHAR_getChar( i, CHAR_NAME),level);		CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW );	}else{		CHAR_setInt(charaindex,CHAR_LV, atoi( message ));		CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_LV|CHAR_P_STRING_NEXTEXP);		sprintf( token, "等级设置为%d!",level);		CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW );	}	}void CHAR_CHAT_DEBUG_exp( int charaindex, char* message ){	int i;	char exp[15];	char cdkey[CDKEYLEN];	char token[128];	int playernum = CHAR_getPlayerMaxNum();	easyGetTokenFromString( message , 1 , exp, sizeof(exp));	easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey));	if(strlen(cdkey)>0){		for(i=0;i<playernum;i++){			if(CHAR_CHECKINDEX(i) == FALSE) continue;			if(!strcmp( CHAR_getChar( i, CHAR_CDKEY), cdkey))			{				break;			}		}		if (i>=playernum)		{		 	CHAR_talkToCli( charaindex, -1, "此账号不在线~", CHAR_COLORYELLOW );			return;		}		CHAR_setMaxExp( i, atoi( exp ));		CHAR_send_P_StatusString( i , CHAR_P_STRING_EXP);		sprintf( token, "[GM]%s把你的经验设置为%d!", CHAR_getChar( charaindex, CHAR_NAME),(int)atoi(exp));		CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW );		sprintf( token, "玩家%s的经验设置为%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(exp));		CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW );	}else{		CHAR_setMaxExp( charaindex, atoi( exp ));		CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_EXP);		sprintf( token, "经验设置为%d!",(int)atoi(exp)/100);		CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW );	}}void CHAR_CHAT_DEBUG_delitem( int charindex , char *message ){	int		itemid;	if( strcmp( message, "all") == 0 ) {		int		i;		for( i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ) {		    itemid = CHAR_getItemIndex(charindex, i);			if( itemid != -1 ) {				{					LogItem(						CHAR_getChar( charindex, CHAR_NAME ),						CHAR_getChar( charindex, CHAR_CDKEY ),#ifdef _add_item_log_name  // WON ADD 在item的log中增加item名称						itemid,#else			       		ITEM_getInt( itemid, ITEM_ID ),#endif						"DelItem(删除道具GM)",						CHAR_getInt( charindex,CHAR_FLOOR),						CHAR_getInt( charindex,CHAR_X ), 			    	  	CHAR_getInt( charindex,CHAR_Y ),                        ITEM_getChar( itemid, ITEM_UNIQUECODE),						ITEM_getChar( itemid, ITEM_NAME),						ITEM_getInt( itemid, ITEM_ID)					);				}				CHAR_DelItem( charindex, i);			}		}	}else {		int		equipplace;		equipplace = atoi( message);		if( equipplace < CHAR_STARTITEMARRAY || equipplace > CHAR_MAXITEMHAVE -1 ) {			CHAR_talkToCli( charindex, -1, "号码不正确。",  CHAR_COLORWHITE);			return;		}	    itemid = CHAR_getItemIndex(charindex, equipplace);		if( itemid == -1 ) return;		{			LogItem(				CHAR_getChar( charindex, CHAR_NAME ),				CHAR_getChar( charindex, CHAR_CDKEY ),#ifdef _add_item_log_name  // WON ADD 在item的log中增加item名称				itemid,#else	       		ITEM_getInt( itemid, ITEM_ID ),#endif				"DelItem(删除道具GM)",				CHAR_getInt( charindex,CHAR_FLOOR),				CHAR_getInt( charindex,CHAR_X ), 	      		CHAR_getInt( charindex,CHAR_Y ),                ITEM_getChar( itemid, ITEM_UNIQUECODE),				ITEM_getChar( itemid, ITEM_NAME),				ITEM_getInt( itemid, ITEM_ID)			);		}		CHAR_DelItem( charindex, equipplace);	}}#ifdef _MAKE_MAPvoid CHAR_CHAT_DelMap( int charaindex, char* message ){	int   ff, x, y, xx, yy;  int		tile, obj;	ff = CHAR_getInt( charaindex, CHAR_FLOOR );		if( MAP_getFloorXY( ff, &xx, &yy) == FALSE )return;	for(x=0;x<xx;x++){		for(y=0;y<yy;y++){			if( MAP_getTileAndObjData( ff, x, y, &tile, &obj) == FALSE )continue;			printf("\nff:%d,x:%d,y:%d,tile:%d,obj:%d\n", ff, x, y, tile, obj);			if(atoi(message)==1){				MAP_setTileAndObjData( ff, x, y, tile, 0 );			}else if(atoi(message)==2){				MAP_setTileAndObjData( ff, x, y, 0, obj );			}else if(atoi(message)==3){				MAP_setTileAndObjData( ff, x, y, 0, 0 );			}		}	}}void CHAR_CHAT_GetMap( int charaindex, char* message ){	int 	dir, ff, fx, fy;  int		tile, obj;	ff = CHAR_getInt( charaindex, CHAR_FLOOR );	fx = CHAR_getInt( charaindex, CHAR_X );	fy = CHAR_getInt( charaindex, CHAR_Y );	dir = CHAR_getInt( charaindex, CHAR_DIR );	fx += CHAR_getDX(dir);	fy += CHAR_getDY(dir);	if( MAP_getTileAndObjData( ff, fx, fy, &tile, &obj)	== FALSE )return;	{			char szBuffer[64];		snprintf( szBuffer, sizeof( szBuffer ), "图片= %d; 对象= %d",			tile, obj );		CHAR_talkToCli( charaindex, -1, szBuffer,  CHAR_COLORWHITE);	}}void CHAR_CHAT_Map( int charaindex, char* message ){	int 	dir, ff, fx, fy;  int		tile, obj;  int		fixtile, fixobj;  char  buf[16];  	getStringFromIndexWithDelim( message, " ", 1, buf, sizeof( buf));	fixobj=atoi(buf);	getStringFromIndexWithDelim( message, " ", 2, buf, sizeof( buf));	fixtile=atoi(buf);	ff = CHAR_getInt( charaindex, CHAR_FLOOR );	fx = CHAR_getInt( charaindex, CHAR_X );	fy = CHAR_getInt( charaindex, CHAR_Y );	dir = CHAR_getInt( charaindex, CHAR_DIR );	fx += CHAR_getDX(dir);	fy += CHAR_getDY(dir);	if( MAP_getTileAndObjData( ff, fx, fy, &tile, &obj)	== FALSE )return;	{			char szBuffer[64];		snprintf( szBuffer, sizeof( szBuffer ), "图片:%d => %d",	tile, fixtile );		CHAR_talkToCli( charaindex, -1, szBuffer,  CHAR_COLORWHITE);		snprintf( szBuffer, sizeof( szBuffer ), "对象:%d => %d",	obj, fixobj );		CHAR_talkToCli( charaindex, -1, szBuffer,  CHAR_COLORWHITE);	}		MAP_setTileAndObjData( ff, fx, fy, fixtile, fixobj );	{		char *stringdata;		RECT seekr , retr;		seekr.x = fx;		seekr.y = fy;		seekr.width = 1;		seekr.height = 1;		stringdata = MAP_getdataFromRECT(ff,&seekr,&retr);		if( stringdata ){			if( CHAR_getInt( charaindex , CHAR_WHICHTYPE )			== CHAR_TYPEPLAYER ){				int fd = getfdFromCharaIndex( charaindex );				lssproto_M_send(fd,ff,					retr.x,retr.y,					retr.x+retr.width,retr.y+retr.height,					stringdata );			}		} else {		}	}    return ;}void CHAR_CHAT_Fixtile( int charaindex, char* message ){	int 	dir, ff, fx, fy;  int		tile, obj;  int		fixtile=atoi(message);	ff = CHAR_getInt( charaindex, CHAR_FLOOR );	fx = CHAR_getInt( charaindex, CHAR_X );	fy = CHAR_getInt( charaindex, CHAR_Y );	dir = CHAR_getInt( charaindex, CHAR_DIR );	fx += CHAR_getDX(dir);	fy += CHAR_getDY(dir);	if( MAP_getTileAndObjData( ff, fx, fy, &tile, &obj)	== FALSE )return;	{			char szBuffer[64];		snprintf( szBuffer, sizeof( szBuffer ), "图片:%d => %d",	tile, fixtile );		CHAR_talkToCli( charaindex, -1, szBuffer,  CHAR_COLORWHITE);		snprintf( szBuffer, sizeof( szBuffer ), "对象:%d => %d",	obj, obj );		CHAR_talkToCli( charaindex, -1, szBuffer,  CHAR_COLORWHITE);	}		MAP_setTileAndObjData( ff, fx, fy, fixtile, -1 );	{		char *stringdata;		RECT seekr , retr;		seekr.x = fx;		seekr.y = fy;		seekr.width = 1;		seekr.height = 1;		stringdata = MAP_getdataFromRECT(ff,&seekr,&retr);		if( stringdata ){			if( CHAR_getInt( charaindex , CHAR_WHICHTYPE )			== CHAR_TYPEPLAYER ){				int fd = getfdFromCharaIndex( charaindex );				lssproto_M_send(fd,ff,					retr.x,retr.y,					retr.x+retr.width,retr.y+retr.height,					stringdata );			}		} else {		}	}    return ;}void CHAR_CHAT_Fixobj( int charaindex, char* message ){	int 	dir, ff, fx, fy;  int		tile, obj;  int		fixobj=atoi(message);  	ff = CHAR_getInt( charaindex, CHAR_FLOOR );

⌨️ 快捷键说明

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