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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? npcserver.c

?? 最新主流石器時代源代碼,包含諸多目前流行功能代碼.
?? C
字號:
#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( "獲取主機名: %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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久9999亚洲精品| 欧美午夜精品一区二区三区| 亚洲蜜臀av乱码久久精品| 久久久久久久免费视频了| 精品久久久久久久人人人人传媒| 99久精品国产| 国产毛片精品一区| 国产一区91精品张津瑜| 国产酒店精品激情| 国产成a人亚洲精| 丁香婷婷综合五月| 成人免费va视频| 99精品视频免费在线观看| 色婷婷综合久久久久中文| 在线视频观看一区| 欧美高清hd18日本| 精品国产乱子伦一区| 日本一区二区不卡视频| 国产精品国产成人国产三级| 亚洲在线成人精品| 日本sm残虐另类| 国产精品一线二线三线精华| 国产成人免费视| 91精品福利在线| 337p亚洲精品色噜噜| 久久先锋资源网| 亚洲天堂中文字幕| 日本伊人色综合网| 国产精品夜夜爽| 色av综合在线| 精品99久久久久久| 亚洲欧美一区二区不卡| 日韩中文字幕亚洲一区二区va在线 | 菠萝蜜视频在线观看一区| 99视频有精品| 制服丝袜亚洲精品中文字幕| 久久精品视频一区二区三区| 国产精品乱码一区二三区小蝌蚪| 欧美日韩国产高清一区二区| 精品国精品国产尤物美女| 国产欧美中文在线| 亚洲电影在线播放| 经典三级视频一区| 欧洲生活片亚洲生活在线观看| 国产成人在线观看| 欧美精品久久一区| 成人免费在线播放视频| 日本欧洲一区二区| 91久久精品一区二区| 日韩精品一区二区三区视频播放| 在线成人免费视频| 国产精品毛片大码女人| 青青草国产成人99久久| 91麻豆国产精品久久| 欧美变态凌虐bdsm| 天天综合色天天| 91麻豆免费看片| 国产午夜亚洲精品羞羞网站| 日韩av不卡在线观看| 欧美午夜精品一区| 亚洲人吸女人奶水| 成人免费av资源| 26uuu精品一区二区在线观看| 欧美一区二区三区婷婷月色| 伊人色综合久久天天| 成人午夜免费视频| 久久精品在线观看| 国产一区日韩二区欧美三区| 欧美精品tushy高清| 亚洲综合免费观看高清完整版在线| 亚洲一区欧美一区| 色吊一区二区三区| 一区二区三区精品| 色琪琪一区二区三区亚洲区| 国产精品久久久久久久久果冻传媒 | 91国偷自产一区二区开放时间| 成人一级视频在线观看| 日韩一区二区三区av| 奇米色一区二区三区四区| 欧美电影在哪看比较好| 日韩精品欧美精品| 欧美一区二区播放| 捆绑调教美女网站视频一区| 91麻豆精品91久久久久久清纯| 久久亚洲一区二区三区四区| 免费欧美日韩国产三级电影| 制服丝袜日韩国产| 国产一区二区调教| 欧美极品xxx| 日本道免费精品一区二区三区| 欧美mv和日韩mv的网站| 国产一区在线视频| 国产精品免费免费| 在线观看网站黄不卡| 丝袜美腿亚洲色图| 久久综合色婷婷| 99久久精品国产观看| 亚洲成va人在线观看| 91精品国产综合久久久久| 久久电影网电视剧免费观看| 日本一区二区视频在线| 色偷偷久久人人79超碰人人澡| 精品999久久久| yourporn久久国产精品| 亚洲成a人v欧美综合天堂下载| 国产另类ts人妖一区二区| 日本一区二区成人在线| 欧美网站一区二区| 国产精品一区二区久久不卡 | 成人av网址在线观看| 亚洲欧美区自拍先锋| 欧美日韩国产高清一区二区| 国产一区二区剧情av在线| 亚洲免费在线视频一区 二区| 久久精品99国产精品日本| 国产精品福利av| 日韩欧美一区中文| 一本久久精品一区二区| 久久成人免费网| 亚洲视频在线观看一区| 精品粉嫩aⅴ一区二区三区四区| 日本亚洲欧美天堂免费| 中文字幕永久在线不卡| 欧美精品v日韩精品v韩国精品v| 亚洲精品国产无套在线观| 欧美不卡123| 欧美精品亚洲一区二区在线播放| 亚洲欧洲精品一区二区精品久久久 | 成人午夜免费视频| 蜜臀久久99精品久久久画质超高清| 色婷婷综合久久久中文一区二区 | 国产精品国产三级国产普通话99| 美腿丝袜亚洲色图| 亚洲精品国产精品乱码不99| 久久久五月婷婷| 欧美一区2区视频在线观看| 91浏览器打开| 国产精品一区二区久久不卡| 日韩国产在线观看| 亚洲国产精品一区二区尤物区| 欧美一区二区日韩| 色综合久久中文字幕| 大白屁股一区二区视频| 国产精一品亚洲二区在线视频| 国产精品久久久久久久久免费相片| 成人av在线资源网站| 成人免费视频app| 国产九色sp调教91| 国产精品2024| 国产成人av影院| 久久99这里只有精品| 美国一区二区三区在线播放| 美女看a上一区| 午夜影院在线观看欧美| 亚洲韩国精品一区| 三级一区在线视频先锋| 五月天久久比比资源色| 一区二区三区四区精品在线视频 | 国产高清不卡一区| 九九九久久久精品| 国产自产视频一区二区三区| 久久se精品一区精品二区| 国产在线播放一区二区三区| 国产一区二区导航在线播放| 国产美女娇喘av呻吟久久| 久久97超碰色| 国产成人亚洲综合a∨婷婷图片| 亚洲激情在线激情| 亚洲gay无套男同| 日韩高清不卡在线| 免费成人在线观看视频| 久久精品国产免费看久久精品| 中文字幕一区在线观看视频| 国产精品高潮久久久久无| 亚洲伦理在线免费看| 午夜国产精品一区| 韩国成人福利片在线播放| 成人一区二区三区视频在线观看| 日韩电影免费一区| 韩国女主播成人在线| 91蜜桃在线免费视频| 欧美精品v国产精品v日韩精品| 成人免费毛片a| 色老综合老女人久久久| 91精品国产乱| 中文字幕精品在线不卡| 亚洲自拍都市欧美小说| 精一区二区三区| 91麻豆高清视频| 日韩精品一区二区三区swag| 国产精品视频麻豆| 日本免费新一区视频| 99久久婷婷国产综合精品| 欧美精三区欧美精三区| 欧美激情一区不卡| 日韩一区精品视频| 不卡一卡二卡三乱码免费网站| 免费观看在线色综合| bt7086福利一区国产| 91精品国产欧美一区二区成人|