亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? npcserver.c

?? 石器時(shí)代8.0服務(wù)端完整源代碼。可以直接編譯
?? C
字號(hào):
#include <stdio.h>#include <strings.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/time.h>#include <sys/stat.h>#include <netinet/in.h>#include <arpa/inet.h>#include <stdlib.h>#include <unistd.h>#include <fcntl.h>#include <netdb.h>#include <errno.h>#include "autil.h"#include "util.h"#include "net.h"#include "char.h"#include "char_base.h"#include "log.h"#include "handletime.h"#include "npcserver.h"#include "lssproto_serv.h"//#include "chatmagic.h"#include "lssproto_util.h"#ifdef _NPCSERVER_NEW#include "npcshandle.h"#define SEPARATOR ";"NPCMessC *NPCMess;static int AskListOK = 0;//Mserver NETProcint NSproto_DispatchMessage(int fd,char* encoded){	char funcname[1024];	if( NPCMESS_setChar( encoded) == FALSE )		return -1;	memset( funcname, 0, sizeof( funcname));	if( NPCMESS_getChar( funcname, sizeof( funcname)) == FALSE )	{		return 0;	}	if( !strcmp( funcname , "TEST" )){		char buf1[1024],buf2[1024],buf3[1024];		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		if( NPCMESS_getChar( buf2, sizeof( buf2)) == FALSE ) return 0;		if( NPCMESS_getChar( buf3, sizeof( buf3)) == FALSE ) return 0;		return 0;	}else if( !strcmp( funcname , "NPC_LOGIN" )){		char buf1[256];		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		NPCS_NpcSLogin_recv( fd, buf1);	}else if( !strcmp( funcname , "NPC_ASKLIST" )){		char buf1[4096];		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		NPCS_AskNpcList_recv( fd, buf1);		return 0;	}else if( !strcmp( funcname , "NPCS_CREATE" )){		int dir, floor, x, y, image, npcsindex;		char Name[256], buf1[256];		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		npcsindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		memcpy( Name, buf1, strlen( buf1)+1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		dir = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		image = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		floor = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		x = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		y = atoi( buf1);		if( NPCSERVER_CreateObjindexFromServer( fd, npcsindex, Name, image, dir, floor, x, y) == FALSE ){		}		return 0;	}else if( !strcmp( funcname , "NPC_TALKMESS" )){		char TalkMess[1024], buf1[1024];		int npcobjindex, charaindex, charobjindex, Color;		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		npcobjindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		charaindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		charobjindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		memcpy( TalkMess, buf1, strlen( buf1)+1 );		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		Color = atoi( buf1);		NPCS_NpcTalkMess_recv( npcobjindex, charaindex, charobjindex, TalkMess, Color);	}else if( !strcmp( funcname , "NPC_WINMESS") ){		int charaindex, charobjindex, npcobjindex;		int seqno, windowtype, buttontype, page;		char Token[1024], buf1[1024];		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		npcobjindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		charaindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		charobjindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		memcpy( Token, buf1, strlen( buf1)+1);		Token[ strlen( Token)+1] = 0;		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		seqno = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		windowtype = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		buttontype = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		page = atoi( buf1);		NPCS_NpcWinMess_recv( npcobjindex, charaindex, charobjindex, Token,						  seqno, windowtype, buttontype, page);	}else if( !strcmp( funcname , "NPC_CHECKFREE") ){		int charaindex, charobjindex, npcobjindex;		char buf1[4096], freeMess1[4096];		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		npcobjindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		charaindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		charobjindex = atoi( buf1);		if( NPCMESS_getChar( buf1, sizeof( buf1)) == FALSE ) return 0;		memcpy( freeMess1, buf1, strlen( buf1)+1);		NPCS_NpcCheckFreeMess_recv( npcobjindex, charaindex, charobjindex, freeMess1);	}else{	}	return 0;}void NPCS_NpcCheckFreeMess_recv( int npcobjindex, int charaindex, int charobjindex,								char *CheckfreeMess){	if( NPCS_HandleCheckFreeMess( npcobjindex, charaindex, charobjindex,			CheckfreeMess) == TRUE ){	}else {	}}void NPCS_NpcWinMess_recv( int npcobjindex, int charaindex, int charobjindex, char *WinMess,						  int seqno, int windowtype, int buttontype, int page){	int fd = getfdFromCharaIndex( charaindex);	if( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX) != charobjindex )		return;	CHAR_setWorkInt( charaindex, CHAR_WORKSHOPRELEVANT, page);	lssproto_WN_send( fd, windowtype, buttontype, seqno, npcobjindex, WinMess);}void NPCS_NpcWinMess_send( int npcobjindex, int npcindex, int charaindex, char *WinMess,						  int seqno, int select){	char buf[4096];	int charobjindex, page;	memset( buf, 0, sizeof( buf));	charobjindex = CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX);	page = CHAR_getWorkInt( charaindex, CHAR_WORKSHOPRELEVANT);	sprintf( buf, "NPC_WINMESS %d %d %d %d %s %d %d %d\n", npcindex, npcobjindex, charaindex, charobjindex,			WinMess, seqno, select, page);	lssproto_Send( npcfd, buf);}void NPCS_AskNpcTalk_send( int objindex, int npcsindex, int charaindex, char *Nlist){//NPCS_TALK	char buf[4096];	int charobjindex;	if( !CHAR_CHECKINDEX( charaindex) ) return;	memset( buf, 0, sizeof( buf));	charobjindex = CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX);	sprintf( buf, "NPCS_TALK %d %d %d %d %s\n", npcsindex, objindex, charaindex, charobjindex, Nlist);	lssproto_Send( npcfd, buf);}void NPCS_AskNpcList_recv( int fd, char *Nlist){	char Npclist[256];	int i=1, createnpc = 0;	while( getStringFromIndexWithDelim( Nlist, "|", i, Npclist,sizeof(Npclist) ) != FALSE ){		char buf1[256], NpcName[256];		int npcsindex, dir, floor, x, y, image;		i++;		if( getStringFromIndexWithDelim( Npclist, ",", 1, buf1, sizeof( buf1)) == FALSE ) continue;		npcsindex = atoi( buf1);		if( getStringFromIndexWithDelim( Npclist, ",", 2, buf1, sizeof( buf1)) == FALSE ) continue;		memcpy( NpcName, buf1, strlen( buf1)+1);		if( getStringFromIndexWithDelim( Npclist, ",", 3, buf1, sizeof( buf1)) == FALSE ) continue;		dir = atoi( buf1);		if( getStringFromIndexWithDelim( Npclist, ",", 4, buf1, sizeof( buf1)) == FALSE ) continue;		image = atoi( buf1);		if( getStringFromIndexWithDelim( Npclist, ",", 5, buf1, sizeof( buf1)) == FALSE ) continue;		floor = atoi( buf1);		if( getStringFromIndexWithDelim( Npclist, ",", 6, buf1, sizeof( buf1)) == FALSE ) continue;		x = atoi( buf1);		if( getStringFromIndexWithDelim( Npclist, ",", 7, buf1, sizeof( buf1)) == FALSE ) continue;		y = atoi( buf1);		NpcName[ strlen( NpcName)+1] = 0;		if( NPCSERVER_CreateObjindexFromServer( fd, npcsindex, NpcName, image, dir, floor, x, y) == FALSE ){		}else{			createnpc++;		}	}}void NPCS_AskNpcList_send( int fd){	char buf[4096];	memset( buf, 0, sizeof( buf));	sprintf( buf, "NPC_ASKLIST\n");	lssproto_Send(fd, buf);}void NPCS_NpcSLogin_recv( int fd, char *Mess){	if( !strcmp( Mess, "OK") ){		if( AskListOK == 0 ){			NPCS_AskNpcList_send( fd);			AskListOK = 1;		}	}else {	}}void NPCS_NpcSLogin_send( int fd){	char buf[4096];	memset( buf, 0, sizeof( buf));	sprintf( buf, "NPC_LOGIN ABC\n");	lssproto_Send(fd, buf);}void NPCS_NpcTalkMess_recv( int npcobjindex, int charaindex, int charobjindex, char *TalkMess, int Color){	NPCS_NpcstalkToCli( charaindex, npcobjindex, TalkMess, Color);}int connectNpcServer(char* hostname,unsigned short port){	struct sockaddr_in sock;    struct hostent* hoste;    int     fd,lr;    fd_set  fdset,fde;    struct timeval tmv;    memset( &sock ,  0 , sizeof( struct sockaddr_in ) );    sock.sin_family = AF_INET;    sock.sin_port = htons( port );    sock.sin_addr.s_addr = inet_addr( hostname );    if( sock.sin_addr.s_addr == -1 ){        hoste = gethostbyname( hostname );        if( hoste == NULL ){            print( "獲取主機(jī)名: %s\n", hostname);            return -1;        }        memcpy((void*)&sock.sin_addr.s_addr , hoste->h_addr , sizeof(struct in_addr) );    }    fd = socket( AF_INET, SOCK_STREAM , 0 );    if( fd == -1 ){        print("Cannot Create Socket( errno:%d)\n",errno );        return -1;    }    //set the no block	if ( fcntl(fd,F_SETFL,O_NONBLOCK) == -1 ){		print("set noblock error!\n");		return -1;	}	lr = connect(fd,(struct sockaddr*)&sock,sizeof(struct sockaddr_in));    if( lr != 0 ){        if ( errno != EINPROGRESS ){            print("Cannot connect. (errno:%d)\n",errno );            close(fd);            return -1;        }    }    FD_ZERO(&fdset);    FD_SET(fd,&fdset);    FD_SET(fd,&fde);    tmv.tv_sec =3;    tmv.tv_usec = 0;    lr=select(fd+1,NULL,&fdset,&fde,&tmv);    if (FD_ISSET(fd,&fde)){            print("connectNPCS fde\n");            close(fd);   //add more            return -1;    }    if ( lr > 0 && FD_ISSET(fd,&fdset)){            int errorcode;            int errorcodelen;            errorcode=1;            errorcodelen=sizeof(errorcode);            getsockopt(fd,SOL_SOCKET,SO_ERROR,&errorcode,&errorcodelen);            if (errorcode == 0 ){                    fcntl(fd,F_SETFL,0);                    print("connectNPCS return fd=%d\n",fd);                    return fd;            }else{                    print("connectNPCS errorcode error\n");                                            close(fd);                    return -1;            }    }else{            close(fd);            return -1;    }}void NPCS_SendProbe( int fd){	char buf[65535];	int i;	memset( buf, 0, sizeof( buf));	sprintf( buf, "TEST %d,%d,%s,%s", 99999, 99999,		"1234567891012345678901234567890", "1234567891012345678901234567890" );	strcat( buf, " ");	for( i=0; i<5; i++)	{		if( i==0 ) strcat( buf, "99999");		else strcat( buf, ",99999");	}	strcat( buf, " ");	for( i=0; i<15; i++)	{		if( i==0 ) strcat( buf, "99999");		strcat( buf, ",99999");	}	strcat( buf, "\n");	lssproto_Send(fd, buf);}BOOL NPCMESS_setChar( char *buf){	char Mbuf[4096];	int i=0,j=0;	int len=0;	NPCMessC *Works;	NPCMessC *point;	point = NULL;	memset( Mbuf, 0, sizeof( Mbuf));	sprintf( Mbuf, "%s", buf);	NPCMess = NULL;	while( Mbuf[i] != '\0' )	{		if( Mbuf[i] == '\n' )			Mbuf[i] = '\0';		i++;	}	i=0;	len = 0;	while( Mbuf[i] != '\0' && Mbuf[j] != '\0' )	{		j=i;		len = 0;		while( Mbuf[j] != ' ' && Mbuf[j] != '\0')	{			len++;			j++;		}		Works = MESS_getNew();		if( Works == NULL )			return FALSE;		memcpy( Works->buf, &Mbuf[i], len);		Works->len = len;		if( NPCMess == NULL )	{			NPCMess = Works;			point = Works;		}else	{			point->next = Works;			point = point->next;		}		i = (j+1);	}	return TRUE;}BOOL NPCMESS_getChar( char *buf, int len){	NPCMessC *Works;	Works = NPCMess;	if( Works == NULL )		return FALSE;	memcpy( buf, Works->buf, len);	buf[ strlen( buf)+1] = 0;	NPCMess = Works->next;	free( Works);	return TRUE;}NPCMessC *MESS_getNew(){	NPCMessC *MBUF=NULL;	MBUF = (NPCMessC *) calloc( 1, sizeof( struct _NPCMessCommand) );	if( MBUF == NULL )		return NULL;	memset( MBUF->buf, 0, sizeof( MBUF->buf));	MBUF->len = 0;	MBUF->next = NULL;	return MBUF;}#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人午夜电影| 亚洲色图视频免费播放| 99国内精品久久| 美女脱光内衣内裤视频久久影院| 欧美激情一区三区| 日韩一级片网址| 91久久香蕉国产日韩欧美9色| 国产一区二区三区最好精华液| 亚洲成人精品一区| 最好看的中文字幕久久| www国产亚洲精品久久麻豆| 欧美色欧美亚洲另类二区| 从欧美一区二区三区| 国内精品国产三级国产a久久| 天天免费综合色| 亚洲精品免费在线观看| 国产精品视频免费| 国产午夜精品一区二区| 欧美成人国产一区二区| 91精品国产免费久久综合| 欧美亚洲国产一区在线观看网站| 丁香天五香天堂综合| 国产乱子轮精品视频| 日韩不卡一区二区| 午夜精品爽啪视频| 亚洲网友自拍偷拍| 亚洲成人先锋电影| 亚洲综合视频网| 一区二区欧美在线观看| 最新欧美精品一区二区三区| 国产精品久久久久久久久搜平片 | 国内精品写真在线观看| 另类小说图片综合网| 另类的小说在线视频另类成人小视频在线| 图片区日韩欧美亚洲| 香蕉成人伊视频在线观看| 亚洲国产成人va在线观看天堂 | 激情综合一区二区三区| 青娱乐精品视频| 美女在线一区二区| 麻豆国产一区二区| 国产一区二区三区免费看| 国产精品99久久久久久宅男| 国产成人精品免费| 成人激情文学综合网| 91在线看国产| 欧美亚洲一区二区在线观看| 欧美日韩1234| 精品国产91九色蝌蚪| 久久色在线观看| 国产精品久久久久精k8 | 亚洲美女屁股眼交| 一区二区三区精品视频在线| 午夜伦欧美伦电影理论片| 美女网站在线免费欧美精品| 国产高清不卡一区| 99精品黄色片免费大全| 欧美亚洲高清一区| 日韩免费看的电影| 中文字幕乱码日本亚洲一区二区| 成人免费在线播放视频| 亚洲一区日韩精品中文字幕| 麻豆一区二区在线| 9i看片成人免费高清| 欧美写真视频网站| 久久综合色天天久久综合图片| 国产精品女主播在线观看| 亚洲精品五月天| 久久超级碰视频| av不卡一区二区三区| 欧美精品自拍偷拍| 中文字幕av在线一区二区三区| 夜色激情一区二区| 激情文学综合丁香| 91蜜桃网址入口| 日韩视频免费观看高清完整版在线观看 | 99久久精品情趣| 欧美另类一区二区三区| 国产日韩欧美综合在线| 亚洲综合激情另类小说区| 国产一级精品在线| 欧美亚洲动漫另类| 中文一区在线播放| 日韩av网站在线观看| 91小视频在线免费看| 欧美成人vr18sexvr| 一区二区三区在线播放| 国产一区二区美女诱惑| 欧美在线影院一区二区| 久久精品在线免费观看| 亚洲一区二区高清| 国产99久久久国产精品潘金 | 精品一区二区三区在线播放| 91国产丝袜在线播放| 国产亚洲精品中文字幕| 丝瓜av网站精品一区二区| eeuss鲁一区二区三区| 欧美电影免费观看高清完整版在| 亚洲欧美日韩人成在线播放| 国产一区二区三区电影在线观看 | 成人avav影音| 精品久久久网站| 日韩av电影一区| 欧美做爰猛烈大尺度电影无法无天| 久久精品欧美一区二区三区麻豆| 五月天久久比比资源色| 色综合久久久久综合体| 国产欧美日本一区二区三区| 久久国产福利国产秒拍| 欧美二区三区的天堂| 一区二区三区日韩| 91视频在线观看| 国产精品久久久久久久久久久免费看 | 日韩影院精彩在线| 欧美在线免费观看视频| 亚洲少妇中出一区| 成人激情免费视频| 国产日韩精品一区| 国产精品99久久久久久似苏梦涵| 日韩免费视频一区| 日本vs亚洲vs韩国一区三区二区 | 亚洲成a人v欧美综合天堂| 色呦呦日韩精品| 中文字幕一区视频| 91亚洲精品一区二区乱码| 国产精品女人毛片| 99re成人精品视频| 亚洲欧洲www| 91在线云播放| 亚洲影院在线观看| 欧美老人xxxx18| 丝袜脚交一区二区| 欧美成人一区二区三区| 国内精品免费在线观看| 国产日韩精品视频一区| 国产成人免费9x9x人网站视频| 欧美激情在线观看视频免费| av亚洲精华国产精华精| 亚洲欧美综合色| 91福利国产精品| 日韩影院精彩在线| 精品久久久久久久人人人人传媒| 精品一区二区三区影院在线午夜| 久久久91精品国产一区二区精品| 国精产品一区一区三区mba视频| 2020国产精品自拍| 欧美精品在线视频| 尤物视频一区二区| 欧美日韩国产高清一区二区三区 | 久久精品72免费观看| 久久女同性恋中文字幕| 成人毛片视频在线观看| 亚洲伦理在线精品| 7799精品视频| 国产一本一道久久香蕉| 国产精品麻豆久久久| 欧美丝袜第三区| 久久99精品久久只有精品| 亚洲国产精品二十页| 欧美视频精品在线| 久久99国产精品免费| 中文字幕一区二区在线播放| 欧美日韩在线播| 精品在线视频一区| 亚洲免费观看高清| 日韩欧美的一区| 91在线视频免费观看| 免费不卡在线视频| √…a在线天堂一区| 欧美一区二区三区在线电影| 国产成人午夜电影网| 一区二区三区久久| 久久久精品综合| 在线观看av一区二区| 狠狠色综合播放一区二区| 亚洲精品久久久蜜桃| 精品欧美乱码久久久久久| 99re这里只有精品6| 蜜臀久久99精品久久久久久9| 国产精品初高中害羞小美女文| 欧美精品在线观看播放| www.日本不卡| 激情综合网av| 亚洲国产日韩精品| 国产欧美一区二区三区在线看蜜臀| 在线观看av不卡| 国产91丝袜在线播放九色| 午夜精品福利在线| 中文字幕综合网| 2023国产精品视频| 欧美日韩日本视频| 色综合久久中文综合久久牛| 九色综合狠狠综合久久| 亚洲午夜精品在线| 亚洲欧洲精品成人久久奇米网| 精品国产精品一区二区夜夜嗨| 欧美午夜精品久久久久久超碰| 国产激情一区二区三区桃花岛亚洲| 亚洲成av人影院| 亚洲天堂av老司机|