コード例 #1
0
ファイル: char_event.c プロジェクト: chenmingbiao/stone-age
void CHAR_playerTalkedfunc( int charaindex, int talkindex,char* message, int color, int channel )
{
    int     fd;
    char    lastbuf[4096];
    char    mesgbuf[4096];
    char    escapebuf[4096];
    int fmindex = CHAR_getInt( charaindex, CHAR_FMINDEX );
    fd = getfdFromCharaIndex( charaindex );
    if( fd == -1 )return;
    if( (channel>-1) && (fmindex>0) ) {
        if( channel == 0 ) {
            snprintf( lastbuf,sizeof(lastbuf),"P|[×å]%s",
                      makeEscapeString( CHAR_appendNameAndTitle(talkindex, message, mesgbuf,sizeof(mesgbuf)),
                                        escapebuf,sizeof(escapebuf) ));
        }
#ifdef _FMVER21
        else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ) {
#else
        else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == 1 ) {
#endif
            snprintf( lastbuf,sizeof(lastbuf),"P|[×峤¹ã²¥]%s",
                      makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)),
                                       escapebuf,sizeof(escapebuf) ));
        } else {
            snprintf( lastbuf,sizeof(lastbuf),"P|[%d]%s",channel,
                      makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)),
                                       escapebuf,sizeof(escapebuf) ));
        }
    } else {
        snprintf( lastbuf,sizeof(lastbuf),"P|%s",
                  makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)),
                                   escapebuf,sizeof(escapebuf) ));
    }
    lssproto_TK_send( fd, CHAR_getWorkInt( talkindex, CHAR_WORKOBJINDEX ),lastbuf, color);
}
コード例 #2
0
int NPC_PAGetMyLimtItem(int talker, char *argstr, char* token, int sizes)
{
	char token2[NPC_UTIL_GETARGSTR_LINEMAX];
	int i=1;

	int itemindex;
	int flg=0;
	flg = 0;
	for( i=CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE ; i++ ){

		itemindex = CHAR_getItemIndex( talker , i );
		if( ITEM_CHECKINDEX( itemindex) ){
//==
			char escapedname[256];
			char *eff;
			char name[256];
			int cost = ITEM_getInt( itemindex, ITEM_COST);
			//int rate = 1;
			//cost = (int)(cost * rate);
			strcpy( escapedname, ITEM_getChar( itemindex, ITEM_SECRETNAME));
			makeEscapeString( escapedname, name, sizeof( name));
			eff=ITEM_getChar(itemindex, ITEM_EFFECTSTRING);
			makeEscapeString( eff, escapedname, sizeof(escapedname));
			sprintf(token2,"%s|%d|%d|%d|%s|%d|",
					name, flg, cost, ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER),
					escapedname, i
			);
//==
			strncat( token, token2, sizeof( token2));
		}
	}
	return 1;
}
コード例 #3
0
ファイル: char.c プロジェクト: ChowZenki/Long-Sa-Source
static int makeSaveCharString( char *out , int outlen ,
															char *nm , char *opt , char *info )
{
	char nmwork[CHARDATASIZE];
	char optwork[CHARDATASIZE];
	char infowork[CHARDATASIZE];
	char outwork[CHARDATASIZE];
	char *nmwork_p , *optwork_p , *infowork_p;
	int l;
	
	/* Îìñâ¡õØÆ»¯ */
	
	strncpy( nmwork , nm , sizeof( nmwork ));
	nmwork[strlen( nm)]=0;
	
	strncpy( optwork , opt , sizeof( optwork ));
	optwork[strlen(opt)]=0;
	
	strncpy( infowork , info , sizeof( infowork ));
	infowork[strlen(info)]=0;
	
	/* ¾Þµ©¸¥¡õÃóØÆ */
	/*    if ( esc ) {
	nmwork_p = makeEscapeString1( nm , nmwork ,sizeof( nmwork ));
	optwork_p = makeEscapeString1( opt , optwork , sizeof( optwork ));
	infowork_p = makeEscapeString1( info , infowork , sizeof( infowork ));
} else {*/

	nmwork_p = makeEscapeString( nm , nmwork ,sizeof( nmwork ));
	optwork_p = makeEscapeString( opt , optwork , sizeof( optwork ));
	infowork_p = makeEscapeString( info , infowork , sizeof( infowork ));

	//    }
	/* ¹´Ø¦ÆÍÔ£ÛÔÞÖл¥¾Þ·Â¡õ¸¹Çë¼°Ð×»§±åÓò¼Ô·¥¡õÛͱåÖÐľÔÂ£Û */
	snprintf( outwork ,sizeof( outwork ) ,
		"%s" SPACESTRING "%s" SPACESTRING "%s" ,
		nmwork_p , optwork_p , infowork_p );
	
	l = strlen( outwork );
	if( l >= (outlen-1)){
		return -1;
	}
	
	/* NULL   Ù¯»¥    ±åؤÔ¾®ÈÕ0ëÖÐľÊÏÎçÖо®Êϼ°·Ö£Û */
	memcpy( out , outwork , l + 1);
	
	return 0;
}
コード例 #4
0
void NPC_PoolItemShop_printWindow_Start( int meindex, int talkerindex)
{
	int fd;
	
	fd = getfdFromCharaIndex( talkerindex);
	if( fd != -1 ) {
		char	message[1024];
		char	buf[2048];

#ifdef _NPC_DEPOTITEM
		strcpy( message, 
			"3\n\n"
			"            歡迎光臨\n\n"
			"          <寄放道具>\n"
			"          <取回道具>\n"
			"          <使用倉庫>\n\n"
			"          <  離開  >"
		);
#else
		strcpy( message, 
			"3\n\n"
			"            歡迎光臨\n\n"
			"          <寄放道具>\n"
			"          <取回道具>\n\n\n"
			"          <  離開  >"
		);
#endif

		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, 
						WINDOW_BUTTONTYPE_NONE,
						CHAR_WINDOWTYPE_POOLITEMSHOP_START,
						CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
						makeEscapeString( message, buf, sizeof(buf)));
	}
}
コード例 #5
0
static void NPC_FmLetter_selectWindow( int meindex, int toindex, int num)
{

	int		fd;
	char	buf[256];
	
	/* ¥×¥ì¥¤¥ä¡¼¤ËÂФ·¤Æ¤À¤±  ±þ¤¹¤ë */
	if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
		return;
	}
	/* £±¥°¥ê¥Ã¥É°Ê  ¤Î¤ß */
	if( !NPC_Util_charIsInFrontOfChar( toindex, meindex, 1 )) return; 

	if( !NPC_FmLetter_readData( meindex, num, FALSE) ) {
		print( "fmletter:readdata error\n");
		return;
	}
	
	fd = getfdFromCharaIndex( toindex);
	if( fd != -1 ) {
		lssproto_WN_send( fd, w.windowtype, 
						w.buttontype,
						w.windowno+100,
						CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
						makeEscapeString( w.message, buf, sizeof(buf)));
	}
}
コード例 #6
0
static void NPC_Duelranking_selectWindow( int meindex, int toindex, int num, int select)
{
	
	int		fd;
	if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
		return;
	}
	if( NPC_Util_CharDistance( toindex, meindex ) > 1) return;
	if( (fd = getfdFromCharaIndex( toindex)) == -1 ) return;

	switch( num){
	case 1:
		{
			char	message[1024];
			char	buf[2048];
			strcpy( message, 
				"1\n"
				"             要看哪一个?              \n\n\n"
				"             <强者们>              \n\n"
				"             < 自己 >              \n\n"
				"             <都不看>              \n\n" );
			lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, 
							WINDOW_BUTTONTYPE_NONE,
							CHAR_WINDOWTYPE_DUELRANKING_START,
							CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
							makeEscapeString( message, buf, sizeof(buf)));
		}
		break;
	}
}
コード例 #7
0
ファイル: char_talk.c プロジェクト: beijunyi/custom-sa
int 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;

  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)));
  int talkchar = -1;
  if(talkcharaindex != -1)
    talkchar = CHAR_getWorkInt(talkcharaindex, CHAR_WORKOBJINDEX);
  lssproto_TK_send(fd, talkchar, lastbuf, color);
  return TRUE;
}
コード例 #8
0
ファイル: npc_petshop.c プロジェクト: BlueKarl/gmsv
void NPC_PoolPetShop_DepotPet_Menu( int meindex, int talkerindex)
{
	int fd;
	
	//print(" NPC_PoolPetShop_DepotPet_Menu ");

	fd = getfdFromCharaIndex( talkerindex);
	if( fd != -1 ) {
		char	message[1024];
		char	buf[2048];

		strcpy( message, 
			"3\n\n"
			"          ʹÓóèÎï²Ö¿â\n\n"
			"          £¼´æ·Å³èÎ\n"
			"          £¼È¡»Ø³èÎ\n"
		);

		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, 
						WINDOW_BUTTONTYPE_CANCEL,
						CHAR_WINDOWTYPE_DEPOTPETSHOP_HANDLE,
						CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
						makeEscapeString( message, buf, sizeof(buf)));
	}
}
コード例 #9
0
ファイル: npc_riderman.c プロジェクト: darciusal/stoneagecode
static void NPC_Riderman_selectWindow( int meindex, int toindex, int num)
{

    int		fd;
    char	buf[256];

    if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
        return;
    }
    if( !NPC_Util_charIsInFrontOfChar( toindex, meindex, 1 )) return;

    if( !NPC_Riderman_readData( meindex, num, FALSE) ) {
        print( "riderman:readdata error\n");
        return;
    }

    fd = getfdFromCharaIndex( toindex);
    if( fd != -1 ) {
        lssproto_WN_send( fd, w.windowtype,
                          w.buttontype,
                          w.windowno+100,
                          CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
                          makeEscapeString( w.message, buf, sizeof(buf)));
    }
}
コード例 #10
0
ファイル: npc_verywelfare.c プロジェクト: BlueKarl/gmsv
static void NPC_VeryWelfare_selectWindow( int meindex, int toindex, int num,int select)
{
	int buttontype = 0,windowtype = 0,windowno = 0;
	char	buf[256];
    int fd = getfdFromCharaIndex( toindex);
    char token[256];
	if( fd == -1 )
        return;
	switch(num)
	{
	    case 0:
            sprintf(token,"%s","我是非常好康A的NPC,我将提供最好康A的服务。");
			windowtype = WINDOW_MESSAGETYPE_MESSAGE;
		    windowno = NPC_VERYWELFARE_START;
		    lssproto_WN_send( fd, windowtype, WINDOW_BUTTONTYPE_OK, windowno,	
			CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),token);
		    break;
	    case 1:
		    sprintf(token,"%s","2\n请选择以下的选项\n\n提升生命力\n提升魔法力");
			windowtype = WINDOW_MESSAGETYPE_SELECT;
		    windowno = NPC_VERYWELFARE_NO1;
		    lssproto_WN_send( fd, windowtype, buttontype, windowno,	
			CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
			makeEscapeString( token, buf, sizeof(buf)));
		    break;
	    case 2:
		    sprintf(token,"%s","我要提高生命力");
			windowtype = WINDOW_MESSAGETYPE_MESSAGE;
		    windowno = NPC_VERYWELFARE_NO2;
		    lssproto_WN_send( fd, windowtype, buttontype, windowno,	
			CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
			makeEscapeString( token, buf, sizeof(buf)));
		    break;
		case 3:
		    sprintf(token,"%s","我要提高魔法力");
			windowtype = WINDOW_MESSAGETYPE_MESSAGE;
		    windowno = NPC_VERYWELFARE_NO3;
		    lssproto_WN_send( fd, windowtype, buttontype, windowno,	
			CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
			makeEscapeString( token, buf, sizeof(buf)));
		    break;
    }

}
コード例 #11
0
ファイル: addressbook.c プロジェクト: ChowZenki/SMO-Sa-Source
/*------------------------------------------------------------
 * ¤Ò¤È¤Ä¤Î¥¢¥É¥ì¥¹¥Ö¥Ã¥¯¥¨¥ó¥È¥ê¤ò¡b  »ú  ¤Ë¤Ê¶³¤¹¡e
 * ¤³¤ì¤Ï¥­¥ã¥éÊݸÍѤʤΤǥ¯¥é¥¤¥¢¥ó¥È¤ËÁ÷¿®¤¹¤ë¤è¤ê¤âÀµ³Î
 * ¤Ê¤â¤Î¤Ç¤¢¤ë  Íפ¬¤¢¤ë¡e
 * °ú¿ô
 *  a   ADDRESSBOOK_entry*    »ú  ¤Ë¤·¤¿¤¤¹½Â¤  ¤Ø¤Î¥Ý¥¤¥ó¥¿
 * ÊÖ¤êÃÍ
 *  char *
 ------------------------------------------------------------*/
char *ADDRESSBOOK_makeAddressbookString( ADDRESSBOOK_entry *a )
{
	char work1[256], work2[256];

	if( a->use == 0 ){
		/* ¶õ¥¨¥ó¥È¥ê¤À¤Ã¤¿¤é¶õ  »ú   */
		ADDRESSBOOK_returnstring[0] = '\0';
		return ADDRESSBOOK_returnstring;
	}
	
	makeEscapeString( a->cdkey, work1, sizeof( work1 ));
	makeEscapeString( a->charname , work2 , sizeof( work2 ));
	snprintf( ADDRESSBOOK_returnstring,
			  sizeof(  ADDRESSBOOK_returnstring ),
			  "%s|%s|%d|%d|%d|%d",
			  work1, work2, a->level, a->duelpoint, a->graphicsno,a->transmigration);

	return ADDRESSBOOK_returnstring;

}
コード例 #12
0
ファイル: addressbook.c プロジェクト: ChowZenki/SMO-Sa-Source
BOOL ADDRESSBOOK_sendAddressbookTable( int cindex )
{
	int stringlen=0;
	int i;

	if( !CHAR_CHECKINDEX( cindex ) )return FALSE;
	
	for( i=0 ; i<ADDRESSBOOK_MAX ; i++){
		ADDRESSBOOK_entry *ae;
		ae = CHAR_getAddressbookEntry( cindex , i );
		if( ae && ae->use ){
			char tmp[CHARNAMELEN+32];
			char charname_escaped[CHARNAMELEN*2];
			makeEscapeString( ae->charname, charname_escaped ,
							  sizeof(charname_escaped  ));
			/*  »ÈÍѥե饰|  Á°|¥ì¥Ù¥ë|¥é¥¤¥Õ|¥Õ¥é¥°   */
			snprintf( tmp , sizeof( tmp ),
					  "%d|%s|%d|%d|%d|%d|%d|" ,
					  ae->use,
					  charname_escaped , ae->level , 
					  ae->duelpoint,ae->online,ae->graphicsno,
					  ae->transmigration);
			strcpysafe  ( ADDRESSBOOK_returnstring + stringlen ,
						  sizeof(ADDRESSBOOK_returnstring) - stringlen,
						  tmp );
			stringlen += strlen( tmp );
			if( stringlen >= sizeof(ADDRESSBOOK_returnstring) ) {
				break;
			}
		}else{
			/*»È¤Ã¤Æ¤Ê¤¤¥Ç¡¼¥¿¤â¨R«à¤Î¤ß¤ÇÁ÷¤ë  */
			char    tmp[32];
			snprintf( tmp , sizeof( tmp ), "|||||||"  );
			strcpysafe  ( ADDRESSBOOK_returnstring + stringlen ,
						  sizeof(ADDRESSBOOK_returnstring) - stringlen,
						  tmp );
			stringlen += strlen( tmp );
			if( stringlen >= sizeof(ADDRESSBOOK_returnstring)) {
				break;
			}
		}
	}
	
	dchop( ADDRESSBOOK_returnstring, "|" );

	{
		int fd;
		fd = getfdFromCharaIndex( cindex );
		if( fd == -1 ) return FALSE;
		lssproto_AB_send( fd, ADDRESSBOOK_returnstring );
	}
	return TRUE;
}
コード例 #13
0
/*
 * TK¤ÇÁ÷¤ë¤¿¤á¤Î  »ú  ¤ò¤Ä¤¯¤ë¡e
 */
static void NPC_SimpleShopGetEscapedItemString( int shopindex,
                                                int cliindex, char *str )
{
    int i, cost, cl, imageno, itemindex;
    char *itemname;
    char tmp[1024];
    char escapedname[256];
//    char *oli; /* oli means onelineinfo */

    str[0] = '\0';

    /* ¤Þ¤ºÅ¹¤Î  ¤Á  ¤Î¥ê¥¹¥È */
    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex( shopindex , i );
        if( ITEM_CHECKINDEX(itemindex) ){
            itemname = ITEM_getChar( itemindex, ITEM_SECRETNAME );
            makeEscapeString( itemname, escapedname, sizeof(escapedname));
            cost = ITEM_getInt( itemindex, ITEM_COST );
            /* ¶â³Û¤ÎÄ´À°¡eMERCHANTLEVEL¤Ë¤è¤Ã¤Æ  ¤ï¤ë¡e */
            cost *= NPC_Util_buyRate(cliindex);
            cl = ITEM_getInt( itemindex, ITEM_LEVEL );
            imageno = ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER );
            //oli =  ITEM_getMemo( itemindex );
#if 0
            snprintf( tmp, sizeof(tmp), "|%s|%d|%d|%d|%s",
                      escapedname, cost, cl, imageno, oli );
#endif
            snprintf( tmp, sizeof(tmp), "|%s|%d|%d|%d|",
                      escapedname, cost, cl, imageno );
            strcat( str, tmp );
        }
    }

    /* ±­¤Ë¡bµÒ¤Î  ¤Á  ¤Î¥ê¥¹¥È */
    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex( cliindex , i );
        if( ITEM_CHECKINDEX(itemindex) ){
            cost = ITEM_getInt( itemindex, ITEM_COST );
            /* ¶â³Û¤ÎÄ´À°¡eMERCHANTLEVEL¤Ë¤è¤Ã¤Æ  ¤ï¤ë¡e */
            cost *=NPC_Util_sellRate(cliindex);
            snprintf( tmp, sizeof(tmp), "|%d", cost );
            strcat( str, tmp );
        }else{
            /* ¥¢¥¤  ¥à¤ò  ¤Ã¤Æ¤Ê¤¤¾ì½ê¤Ë¤Ï0¤ò¤¤¤ì¤ë     */
            strcat( str, "|0" );
        }
    }

}
コード例 #14
0
/*-----------------------------------------------
 * ´ÉÍý¿ÍÍѤΥե¡¥¤¥ë¤Ë¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤à
 *
 * ¥Õ¥¡¥¤¥ë̾¤Ï"©Ð¶¡ªº¦W¦r.room"
 * ¤ò»È¤¦¡£
 *
 * ¥Õ¥¡¥¤¥ë¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï¡¤
 * cdkey|charaname|passwd|expiretime
 *
 *
 * °ú¿ô¤Îflg ¤¬£±¤À¤Ã¤¿¤é½ñ¤­¹þ¤ß¡¤£°¤À¤Ã¤¿¤é¥Õ¥¡¥¤¥ëºï½ü
 * Ìá¤êÃÍ¡§TRUE¡§À®¸ù
 *         FALSE:²¿¤é¤«¤Î¼ºÇÔ
 *----------------------------------------------*/
static BOOL NPC_RoomAdminNew_WriteDataFile( int meindex, int pindex, 
											char *roomname,
											char *passwd, int flg)
{
	char    *cdkey;
	char    charaname[32*2];
	char    expiretime[64];
	char    filename[128];
	char    outbuf[1024];
	FILE    *fp_src;
	
	/* ¥Õ¥¡¥¤¥ë̾¤òÀ¸À® */
	strcpy( filename, NPC_ROOMADMINNEW_DATADIR);
	/*strcat( filename, CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM));*/
	strcat( filename, roomname);
	strcat( filename, NPC_ROOMADMINNEW_EXTENSION);

	if( flg) {
		/* Í¤·¤¿¿Í¤Î£Ã£Ä¥­¡¼ */
        //getcdkeyFromCharaIndex( pindex, cdkey, sizeof(cdkey ));
		cdkey = CHAR_getChar( pindex, CHAR_CDKEY);
		/* Í¤·¤¿¿Í¤Î¥­¥ã¥é̾ */
		makeEscapeString(  CHAR_getChar( pindex, CHAR_NAME),
							charaname, sizeof( charaname));
		/* ´ü¸ÂÀÚ¤ì»þ´Ö */
		snprintf( expiretime, sizeof( expiretime), "%d", 
					CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME)
					+ NPC_ROOMADMINNEW_2WEEK   /* £²½µ´Ö¸å */
					);

		/* ¥Ç¥ê¥ß¥¿¤Ç¤¯¤¯¤ë */
		snprintf( outbuf, sizeof( outbuf), "%s|%s|%s|%s|",
					cdkey, charaname, passwd, expiretime);
		fp_src = fopen( filename, "w");
		if( !fp_src) {
			print( "[%s:%d] File Open Error\n", __FILE__, __LINE__);
			return FALSE;
		}
		fputs( outbuf, fp_src);
		fclose( fp_src);
	}
	else {
		unlink( filename);
	}
	
	return TRUE;
	
}
コード例 #15
0
ファイル: addressbook.c プロジェクト: ChowZenki/SMO-Sa-Source
BOOL ADDRESSBOOK_sendAddressbookTableOne( int cindex, int num )
{
	int stringlen=0;
	ADDRESSBOOK_entry *ae;

	if( !CHAR_CHECKINDEX( cindex ) )return FALSE;
	if( num < 0 || num > ADDRESSBOOK_MAX) return FALSE;
	
	ae = CHAR_getAddressbookEntry( cindex , num );
	
	if( ae && ae->use ){
		char tmp[CHARNAMELEN+32];
		char charname_escaped[CHARNAMELEN*2];
		makeEscapeString( ae->charname, charname_escaped ,
						  sizeof(charname_escaped  ));
		snprintf( tmp , sizeof( tmp ),
				  "%d|%s|%d|%d|%d|%d|%d|" ,
				  ae->use,
				  charname_escaped , ae->level , 
				  ae->duelpoint,ae->online,ae->graphicsno,
				  ae->transmigration);
		strcpysafe  ( ADDRESSBOOK_returnstring + stringlen ,
					  sizeof(ADDRESSBOOK_returnstring) - stringlen,
					  tmp );
		stringlen += strlen( tmp );
		if( stringlen >= sizeof(ADDRESSBOOK_returnstring) ) {
			return FALSE;
		}
	}else{
		char    tmp[32];
		snprintf( tmp , sizeof( tmp ), "|||||||"  );
		strcpysafe  ( ADDRESSBOOK_returnstring + stringlen ,
					  sizeof(ADDRESSBOOK_returnstring) - stringlen,
					  tmp );
		stringlen += strlen( tmp );
		if( stringlen >= sizeof(ADDRESSBOOK_returnstring)) {
			return FALSE;
		}
	}

	{
		int fd;
		fd = getfdFromCharaIndex( cindex );
		if( fd == -1 ) return FALSE;
		lssproto_ABI_send( fd, num, ADDRESSBOOK_returnstring );
	}
	return TRUE;
}
コード例 #16
0
ファイル: npc_blackmarket.c プロジェクト: BlueKarl/gmsv
void NPC_BlackMarketTalked( int meindex, int talker, char *msg, int color)
{		
	char sBuf[512]="", tBuf[512]="";
	if(!CHAR_CHECKINDEX( talker)) return;	
    if(getfdFromCharaIndex( talker)==-1) return;
	if(CHAR_getInt( talker, CHAR_WHICHTYPE)!=CHAR_TYPEPLAYER) return;    
    if(NPC_Util_isFaceToFace( talker, meindex, 1)!=TRUE) return;
		
	sprintf( tBuf, "嘿嘿....\n在我这边有各式各样的武器、防具及道具,你想要跟我交换吗?换好了可就不能反悔喔~");

	lssproto_WN_send(getfdFromCharaIndex( talker), 
	                 WINDOW_MESSAGETYPE_MESSAGE,
        	         WINDOW_BUTTONTYPE_OK,
                     CHAR_WINDOWTYPE_BLACKMARKET,
 		             CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
		             makeEscapeString( tBuf, sBuf, sizeof(sBuf)));   	
	return;
}
コード例 #17
0
static void NPC_PoolItemShop_printWindow_HaveItemFull( int meindex, int talkerindex)
{
	int fd;
	
	fd = getfdFromCharaIndex( talkerindex);
	if( fd != -1 ) {
		char	message[1024];
		char	buf[2048];
		
		strcpy( message, 
			"\n\n    道具不是已經滿了嗎"
				);
		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, 
						WINDOW_BUTTONTYPE_OK,
						CHAR_WINDOWTYPE_POOLITEMSHOP_HAVEITEMFULL_MSG,
						CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
						makeEscapeString( message, buf, sizeof(buf)));
	}
}
コード例 #18
0
void NPC_CallFMMember(int meindex, int floor, int fmindex, char *fmname, int index)
{
	int i, charindex;
	char buf[256];
	extern int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER];
	print("CallFMMember_NPC_meindex:%d\n", meindex);
        for( i = 0; i < FAMILY_MAXMEMBER; i++)
        {
           charindex = familyMemberIndex[index][i];
           if( charindex >= 0 ) {
              if( CHAR_getCharUse(charindex) )
	      {
	      	 print("charindex:%d name:%s\n", charindex, CHAR_getChar(charindex, CHAR_NAME));
	         if (CHAR_getInt(charindex, CHAR_FLOOR) == floor)	continue;
	         if (CHAR_getWorkInt(charindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE)
	         {
	            int fd = getfdFromCharaIndex(charindex);
	            int charfloor = CHAR_getInt(charindex, CHAR_FLOOR);
	            int j = 0, checkflag = 0;
	            if (fd == -1)	continue;
#ifdef _FMVER21	            
	            if (CHAR_getInt(charindex, CHAR_FMLEADERFLAG) < 0 ||
	                CHAR_getInt(charindex, CHAR_FMLEADERFLAG) == FMMEMBER_APPLY)	continue;
#else
	            if (CHAR_getInt(charindex, CHAR_FMLEADERFLAG) <= 0 )	continue;
#endif	                
	            for (j = 0; j < FAMILY_FMPKFLOOR; j++)
	            {
	            	if (charfloor == fmpkflnum[j].fl)
	            		checkflag = 1;
	            }
	            if (checkflag != 1)
	            	lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE,
	            		WINDOW_BUTTONTYPE_YESNO, CHAR_WINDOWTYPE_FMPKCALLMAN_COME,
	            		CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
	            		makeEscapeString("\n家族已经在PK罗~要不要加入呢?\n不过若是在组队状态中,将会脱离团队唷!", buf, sizeof(buf)));
	         }
	      }	 
	      else
	         familyMemberIndex[index][i] = -1;
	   }
	}                                                                                                                                    
}
コード例 #19
0
ファイル: npcshandle.c プロジェクト: ChowZenki/SMO-Sa-Source
BOOL NPCS_NpcstalkToCli( int charaindex,int npcobjindex, char* message, CHAR_COLOR color )
{
	static char    lastbuf[2048];
	static char    escapebuf[2048];
	int fd;

	if( !CHAR_CHECKINDEX(charaindex) ) return FALSE;
	if( CHAR_getInt( charaindex,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER) return FALSE;
	if( (fd=getfdFromCharaIndex( charaindex )) == -1 ) return FALSE;
	if( color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2 )return FALSE;
#ifndef _CHANNEL_MODIFY    
	snprintf( lastbuf, sizeof(lastbuf), "P|%s:%s",
#else
	snprintf( lastbuf, sizeof(lastbuf), "P|P|%s:%s",
#endif
			makeEscapeString( OBJECT_getName( npcobjindex), escapebuf, sizeof(escapebuf)), message);

	lssproto_TK_send( fd, npcobjindex, lastbuf, color);
	return TRUE;
}
コード例 #20
0
ファイル: char_event.c プロジェクト: Nurarihyo/smo-sa
void CHAR_playerTalkedfunc( int charaindex, int talkindex,char* message, int color, int channel )
{
    int     fd;
    char    lastbuf[4096];
    char    mesgbuf[4096];
    char    escapebuf[4096];
    int fmindex = CHAR_getInt( charaindex, CHAR_FMINDEX );
    fd = getfdFromCharaIndex( charaindex );
    if( fd == -1 )return;
    if( (channel>-1) && (fmindex>0) ){
		if( channel == 0 ){
#ifndef _CHANNEL_MODIFY
			snprintf( lastbuf,sizeof(lastbuf),"P|[族]%s",
#else
			snprintf( lastbuf,sizeof(lastbuf),"P|F|[族]%s",
#endif
				makeEscapeString( CHAR_appendNameAndTitle(talkindex, message, mesgbuf,sizeof(mesgbuf)),
				escapebuf,sizeof(escapebuf) ));
		}
#ifdef _FMVER21	                  
		else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ){
コード例 #21
0
ファイル: npc_fmletter.c プロジェクト: Nurarihyo/smo-sa
/*********************************
*   仄井仃日木凶凜及質  
*********************************/
void NPC_FmLetterTalked( int meindex , int talkerindex , char *szMes ,int color )
{
	//print(" FmLetter_fmindex:%d ", CHAR_getInt( meindex, CHAR_FMINDEX) );
	

	int /*fmindex = 0, village,*/ i;
	char token[256];
	char buf[256];
/*	for( i=0 ; i<FMPOINTNUM ; i++ ) {
		getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 9, token, sizeof(token));
		village = atoi(token);
		if( village == CHAR_getInt( meindex, CHAR_FMINDEX ) ) {
			getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 5, token, sizeof(token));
			fmindex = atoi(token);
			break;
		}
	}
#ifdef _FMVER21
	if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ){}
#else
#endif 
*/
	for( i=0 ; i<FMPOINTNUM ; i++ ) {
		getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 5, token, sizeof(token));
	if( CHAR_getInt( talkerindex, CHAR_FMINDEX ) == atoi(token) ) {
			
		if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ){
			NPC_FmLetter_selectWindow( meindex, talkerindex, 1 );
			return;
		}
		else
			goto NEXT;
	}
}
NEXT:
			lssproto_WN_send( getfdFromCharaIndex( talkerindex ), WINDOW_MESSAGETYPE_MESSAGE,
				WINDOW_BUTTONTYPE_OK,
				-1, -1,
				makeEscapeString( "\n只有本莊園的族長才能製作邀請函及同意書!", buf, sizeof(buf)));
}
コード例 #22
0
static void NPC_SimpleShopGetEscapedItemString( int shopindex,
                                                int cliindex, char *str )
{
    int i, cost, cl, imageno, itemindex;
    char *itemname;
    char tmp[1024];
    char escapedname[256];
//    char *oli; /* oli means onelineinfo */

    str[0] = '\0';

    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex( shopindex , i );
        if( ITEM_CHECKINDEX(itemindex) ){
            itemname = ITEM_getChar( itemindex, ITEM_SECRETNAME );
            makeEscapeString( itemname, escapedname, sizeof(escapedname));
            cost = ITEM_getInt( itemindex, ITEM_COST );
            cost *= NPC_Util_buyRate(cliindex);
            cl = ITEM_getInt( itemindex, ITEM_LEVEL );
            imageno = ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER );
            //oli =  ITEM_getMemo( itemindex );
            snprintf( tmp, sizeof(tmp), "|%s|%d|%d|%d|",
                      escapedname, cost, cl, imageno );
            strcat( str, tmp );
        }
    }

    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex( cliindex , i );
        if( ITEM_CHECKINDEX(itemindex) ){
            cost = ITEM_getInt( itemindex, ITEM_COST );
            cost *=NPC_Util_sellRate(cliindex);
            snprintf( tmp, sizeof(tmp), "|%d", cost );
            strcat( str, tmp );
        }else{
            strcat( str, "|0" );
        }
    }

}
コード例 #23
0
ファイル: npc_dengon.c プロジェクト: BlueKarl/gmsv
void NPC_DengonLooked( int meindex, int lookedindex )
{
    int maxid;
    char	buf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW*2];
	if( NPC_Util_CharDistance( lookedindex, meindex ) > 1) return;
    maxid = CHAR_getWorkInt( meindex, CHAR_WORKDENGONMAXID );
    if( NPC_DengonReadString( meindex, maxid, NPC_sendbuf ) ){
        int fd;
        fd = getfdFromCharaIndex( lookedindex );
        if( fd == -1 )return;
        lssproto_WN_send(fd, WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT,
        					WINDOW_BUTTONTYPE_OKCANCEL|
        					WINDOW_BUTTONTYPE_PREV,
        					CHAR_WINDOWTYPE_DENGON,
							CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
							makeEscapeString( NPC_sendbuf, buf, sizeof(buf)));
        					
        CHAR_setWorkInt( lookedindex, CHAR_WORKSHOPRELEVANT, maxid);
        
    }
    
}
コード例 #24
0
void NPC_PoolItemShop_DepotItem_Menu( int meindex, int talkerindex)
{
	int fd;
	
	fd = getfdFromCharaIndex( talkerindex);
	if( fd != -1 ) {
		char	message[1024];
		char	buf[2048];

		strcpy( message, 
			"3\n\n"
			"          使用道具倉庫\n\n"
			"          <存放道具>\n"
			"          <取回道具>\n"
		);

		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, 
						WINDOW_BUTTONTYPE_CANCEL,
						CHAR_WINDOWTYPE_DEPOTITEMSHOP_HANDLE,
						CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
						makeEscapeString( message, buf, sizeof(buf)));
	}
}
コード例 #25
0
ファイル: npc_windowhealer.c プロジェクト: Nurarihyo/smo-sa
static void NPC_WindowHealer_selectWindow( int meindex, int toindex, int num)
{

	char token[1024];
	char escapedname[1024];
	int fd = getfdFromCharaIndex( toindex);
	int buttontype=0;
	int windowtype=0;
	int windowno=0;

	/*--它奶件玉它正奶皿丟永本□斥互云云中及匹燮卞澀爛--*/
  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;

	switch( num){
	  case 0:
  		/*--薊      --*/
		sprintf(token,"       哎呀!你受傷了嗎?   "
				  "\n\n             < 耐久力回復>           "
					"\n             <  氣力回復  >           "
					"\n          < 耐久力.氣力回復 >     "
				  "\n\n           <寵物回復(免費)>         "
			);

	  	buttontype=WINDOW_BUTTONTYPE_CANCEL;
	  	windowtype=WINDOW_MESSAGETYPE_SELECT;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_STARTMSG; 
	  	break;


	  case 1:
		if( CHAR_getInt(toindex,CHAR_HP) ==CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)){
			if(NPC_PetHealerCheck(toindex)==FALSE){
				sprintf(token,
				"             <  耐久力回復  >"
				"\n\n\n\n        似乎沒有必要回復唷!  ");
		  	}else{
		  		sprintf(token,
				"             <  耐久力回復  >"
				"\n\n              似乎沒有必要回復唷!  "
					  "\n\n      因為寵物好像也受傷了!"
					  "\n                            先幫他回復吧!");
		  	
		  		NPC_WindowHealerAllHeal(toindex,0 );
		  	}

		  	buttontype=WINDOW_BUTTONTYPE_OK;
		  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_HPMSG; 
			break;
		}else if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){
			sprintf(token,"             <  耐久力回復  >"
					"\n\n\n              是要回復耐久力沒錯吧!       "
					"\n\n  現在的等級可以免費幫你回復唷!");
		
		}else{
			int gold;
			gold=NPC_WindowCostCheck(meindex,toindex);
			sprintf(token,"             <  耐久力回復  >"
				"\n\n\n              是要回復耐久力沒錯吧!       "
				 "\n\n          收您%d的STONE 。"
				 ,gold);
		}

	  	buttontype=WINDOW_BUTTONTYPE_YESNO;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_HPMSG; 
	  	break;

	  case 2:
		if( CHAR_getInt(toindex,CHAR_MP) ==CHAR_getWorkInt( toindex, CHAR_WORKMAXMP)){
			if(NPC_PetHealerCheck(toindex)==FALSE){
				sprintf(token,  "              <  氣力回復  >"
					"\n\n\n\n        似乎沒有必要回復唷!  ");
			}else{
			sprintf(token,  "              <  氣力回復  >"
					"\n\n              似乎沒有必要回復唷!  "
					  "\n\n      因為寵物好像也受傷了!"
					  "\n                            先幫他回復吧!");
				NPC_WindowHealerAllHeal(toindex,0 );
			}
		  	buttontype=WINDOW_BUTTONTYPE_OK;
		  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; 
			break;
		}

		if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){
			sprintf(token,"              < 氣力回復>"
					  "\n\n              是要回復氣力沒錯吧!         "
					  "\n\n 現在的等級可以免費幫你回復唷!");
		}else{
			int cost;
			cost=NPC_WindowCostCheckMp(meindex,toindex);
			sprintf(token,"              < 氣力回復>"
					"\n\n\n              是要回復氣力沒錯吧! "
 					  "\n\n        收您%d的STONE 。",
					cost);
		}
	  	buttontype=WINDOW_BUTTONTYPE_YESNO;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; 
	  	break;


	  case 3:
		sprintf(token,	    "\n            <耐久力已回復>"
						    "\n      <寵物也已回復一般狀態>"
						"\n\n\n            這樣子就沒問題了!        ");

		/*--覲菁  及心莢汊今六月--*/
	  	NPC_WindowHealerAllHeal( toindex ,1 );
	  	buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; 
	  	break;


	  case 4:
		sprintf(token,	    "\n            <氣力已回復>"
						    "\n     <寵物也已回復一般狀態>"
						"\n\n\n           這樣子就沒問題了!       ");
		/*--竣  及心莢汊今六月---*/
	  	NPC_WindowHealerAllHeal( toindex ,2 );
	 	buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKSPIRITMSG; 
	  	break;


	  case 6:
		{
			int cost=0;

			if(CHAR_getInt(toindex,CHAR_HP) < CHAR_getWorkInt( toindex, CHAR_WORKMAXHP))
			{
				cost+=NPC_WindowCostCheck(meindex,toindex);
			}

			if( CHAR_getInt(toindex,CHAR_MP) < CHAR_getWorkInt( toindex, CHAR_WORKMAXMP))
			{
				cost=cost+NPC_WindowCostCheckMp(meindex,toindex);
			}
		
			if(cost==0) {
				if(NPC_PetHealerCheck(toindex)==FALSE){
				sprintf(token,
						"          <  耐久力氣力回復  >"
				"\n\n\n\n        似乎沒有必要回復唷!  ");
				}else{
				sprintf(token,"          <  耐久力氣力回復  >"
					"\n\n              似乎沒有必要回復唷!  "
					  "\n\n      因為寵物好像也受傷了!"
					  "\n                            先幫他回復吧!");
				NPC_WindowHealerAllHeal(toindex,0 );
			}
		
				
				
			  	buttontype=WINDOW_BUTTONTYPE_OK;
			  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
			  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; 
				break;

			}else{
				sprintf(token,"        <  耐久力氣力回復  >"
						"\n\n\n         是要回復耐久力氣力沒錯吧!"
						"\n\n          收您%d的STONE 。",cost);
			}
		}

		if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){
			sprintf(token,"          <  耐久力氣力回復  >"
					"\n\n\n           是要回復耐久力氣力沒錯吧!"
					"\n\n  現在的等級可以免費幫你回復唷!");
		}
	
	  	buttontype=WINDOW_BUTTONTYPE_YESNO;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_ALLMSG; 
	  	break;


	  case 7:
		sprintf(token,"         <耐久力氣力已回復>"
				  "\n      <寵物也已回復一般狀態>"
				  "\n\n\n        這樣一來就回復健康了!");
	  	
	  	NPC_WindowHealerAllHeal( toindex ,3 );
		buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKALLMSG; 
	  	break;


	  case 8:
		sprintf(token,"\n\n\n\n     真可惜似乎所帶的金錢不夠唷!");

		buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; 
	  	break;

	  case 9:
		sprintf(token,"              <寵物回復>            "
				"\n\n\n              已經沒問題了啦!          "
				  "\n\n    但是太勉強的話也不行唷!    ");
		NPC_WindowHealerAllHeal(toindex,0 );
		buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; 
	  	break;

	  case 10:
		sprintf(token,"              <寵物回復>            "
				"\n\n\n   似乎沒有必要回復寵物的樣子。  "
				  "\n\n    但是太勉強的話也不行唷!    ");
		buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; 
	  	break;


	}


	makeEscapeString( token, escapedname, sizeof(escapedname));
	/*-仇仇匹霜耨允月--*/
	lssproto_WN_send( fd, windowtype, 
					buttontype, 
					windowno,
					CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
					escapedname);

}
コード例 #26
0
ファイル: npc_npcenemy.c プロジェクト: Nurarihyo/smo-sa
int NPC_NPCEnemy_Encount( int meindex, int charaindex, int mode)
{

	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char	buf[512];
	BOOL	flg = TRUE;
	int		battlemax = getBattlenum();
	int		i;
	if( CHAR_getInt( meindex, CHAR_BASEIMAGENUMBER) == 0 ) {
		return FALSE;
	}
	if( mode == 0 ) {
		if( CHAR_getWorkInt( meindex, CHAR_WORK_ENCOUNTTYPE) == 1 ) {
			flg = FALSE;
		}
	}else if( mode == 1 ) {
		if( CHAR_getWorkInt( meindex, CHAR_WORK_ENCOUNTTYPE) == 0 ) {
			flg = FALSE;
		}
	}

	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));

	if( !flg) {
		if( NPC_Util_GetStrFromStrWithDelim( argstr, "deniedmsg", buf, sizeof( buf)) != NULL )	{
			CHAR_talkToCliAndParty( charaindex, meindex ,buf , CHAR_COLORYELLOW );
		}
		return FALSE;
	}
	flg = FALSE;
	while( 1 ) {
		char	buf[1024];
		if( NPC_Util_GetStrFromStrWithDelim( argstr, "item", buf, sizeof( buf)) != NULL ) {
			char	data[128];
			BOOL	found = FALSE;

			for( i = 0; i < CHAR_MAXITEMHAVE; i ++ ) {
				int		j;
				int		itemid;
				int ret = getStringFromIndexWithDelim( buf,",", i + 1,data, sizeof(data));
				if( ret == FALSE)
					break;
				found = FALSE;
				itemid = atoi( data);
				for( j = 0; j < CHAR_MAXITEMHAVE; j ++ ) {
					int itemindex = CHAR_getItemIndex( charaindex, j);
					if( ITEM_CHECKINDEX( itemindex)) {
						if( ITEM_getInt( itemindex, ITEM_ID) == itemid ) {
							found = TRUE;
							break;
						}
					}
				}
				if( !found )
					break;
			}
			if( !found )
				break;
		}
#ifdef _ADD_NOITEM_BATTLE
		if(NPC_Util_GetStrFromStrWithDelim(argstr,"noitem",buf,sizeof(buf)) != NULL){
			char data[128];
			BOOL found = FALSE;

			for(i=0;i<CHAR_MAXITEMHAVE;i++){
				int j;
				int itemid;
				int ret = getStringFromIndexWithDelim(buf,",",i + 1,data,sizeof(data));
				if(ret == FALSE) break;
				found = TRUE;
				itemid = atoi(data);
				for(j=0;j<CHAR_MAXITEMHAVE;j++){
					int itemindex = CHAR_getItemIndex(charaindex,j);
					if(ITEM_CHECKINDEX( itemindex)){
						if(ITEM_getInt(itemindex,ITEM_ID) == itemid){
							found = FALSE;
							break;
						}
					}
				}
				if(!found) break;
			}
			if(!found) break;
		}
#endif

		{
			char data[256];

			BOOL Evflg=TRUE;
			if( NPC_Util_GetStrFromStrWithDelim( argstr, "B_evend", buf, sizeof( buf)) != NULL ) {
				int i=1, event=-1;;
				while( getStringFromIndexWithDelim( buf,",", i, data, sizeof( data)) ){
					i++;
					event=atoi( data);
					if( NPC_EventCheckFlg( charaindex, event) == FALSE )	{
						Evflg = FALSE;
						break;
					}
				}
			}
			if( Evflg == FALSE )
				break;
			i=1;
			if( NPC_Util_GetStrFromStrWithDelim( argstr, "B_evnow", buf, sizeof( buf)) != NULL ) {
				int i=1, event=-1;;
				while( getStringFromIndexWithDelim( buf,",", i, data, sizeof( data)) ){
					i++;
					event=atoi( data);
					if( NPC_NowEventCheckFlg( charaindex, event) == FALSE )	{
						Evflg = FALSE;
						break;
					}
				}
			}
			if( Evflg == FALSE )
				break;
		}

		if( CHAR_getWorkInt( meindex, CHAR_WORK_ONEBATTLE ) == 1 ) {
			for( i = 0; i < battlemax; i ++ ) {
				if( BattleArray[i].use ) {
					if( BattleArray[i].createindex == meindex ) {
						break;
					}
				}
			}
			if( i != battlemax ) {
				if( NPC_Util_GetStrFromStrWithDelim( argstr, "alreadymsg", buf, sizeof( buf))
					!= NULL )
				{
					CHAR_talkToCliAndParty( charaindex, meindex ,buf , CHAR_COLORYELLOW );
				}
				return FALSE;
			}
		}
		flg = TRUE;
		break;
	}

	if( flg ) {
		/* 閡及凜反  骰允月 */
		if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_CLIENT) {
			char	config[32];
			snprintf( config, sizeof( config), "askbattlemsg1");
			/* 爵  互銨引月蟆卞撙  丟永本□斥 */
			
			
			if( NPC_Util_GetStrFromStrWithDelim( argstr, config,  buf, sizeof( buf))
				!= NULL )
			{
				int	len = strlen( buf);
				char	escapebuf[1024];
				int fd = getfdFromCharaIndex( charaindex);
				char	buf2[256];
				/* askbattlemsg? 互丐木壬  醒墊卞允月  "\n"戊□玉毛  木月)*/
				for( i = 2; i < 7; i ++ ) {
					snprintf( config, sizeof( config), "askbattlemsg%d", i);
					if( NPC_Util_GetStrFromStrWithDelim( argstr, config, buf2, sizeof( buf2))
						!= NULL )
					{
						strcpysafe( &buf[len], sizeof( buf)-len, "\n" );
						len++;
						strcpysafe( &buf[len], sizeof( buf)-len, buf2 );
						len += strlen( buf2);
						if( len >= sizeof( buf) ) {
							print( "buffer over\n");
							return FALSE;
						}
					}
					else {
						strcpysafe( &buf[len], sizeof( buf)-len, "\n" );
						len++;
						if( len >= sizeof( buf) ) {
							print( "buffer over\n");
							return FALSE;
						}
					}
				}

				if( fd != -1 ) {
					lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
									WINDOW_BUTTONTYPE_YESNO,
									CHAR_WINDOWTYPE_NPCENEMY_START,
									CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
									makeEscapeString( buf, escapebuf,sizeof(escapebuf)));
				}
				/* 仇仇分仃    卞伉正□件 */
				return FALSE;
			}else {
				/* 爵  卞  日六月 */
				flg = NPC_NPCEnemy_BattleIn( meindex, charaindex);
			}
		}
	}
	if( !flg) {
		if( NPC_Util_GetStrFromStrWithDelim( argstr, "deniedmsg", buf, sizeof( buf))
			!= NULL )
		{
			CHAR_talkToCliAndParty( charaindex, meindex ,buf , CHAR_COLORYELLOW );
		}
	}
	return flg;
}
コード例 #27
0
/*
 * ±Є÷   ±еџ–Ўк‘¬
 */
static void NPC_CheckMan_selectWindow( int meindex, int talker, int num)
{

	char token[1024];
	char work[256];
	char work2[512];

	char escapedname[1024];
	int fd = getfdFromCharaIndex( talker);
	int buttontype = 0;
	int windowtype = 0;
	int windowno = 0;
	int now[MAXEVENTFLG];
	int nowindex;
	int i;	
	int page;
	
	work[0] = 0;
	work2[0] = 0;
	token[0] = 0;

	now[0] =0;
	
	/*--ЋьƒћЉю”сЋь’эƒћ√у∂™”ј±Њ°х≥вї•‘∆‘∆÷–Љ∞∆•џ∆±е…ђј√--*/
  	windowtype = WINDOW_MESSAGETYPE_MESSAGE;

	switch( num) {
	
	  case 0:
		CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,0);
		CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,0);
		
  		/*--Љї      --*/
		sprintf(token,"3\n £ы£ы£ы£ы£Њ£Њ£ы√сƒб”јџЌ—®Љю£ы£Њ£Њ "
				  "\n£ы£ы£ытЎїюЉ∞∞„Ј¬Їл√сƒб”јџЌ√ЂЎ∆“э°х‘ "
				  "\n"
				  "\n£ы£ы£ы£ы £’£ыNOW∞„Ј¬Їл√сƒб”јџЌ£ы£÷ "
				  "\n£ы£ы£ы£ы £’£ыEND∞„Ј¬Їл√сƒб”јџЌ£ы£÷ "
				  "\n\n£ы£ы £’£ыNOW∞„Ј¬Їл√сƒб”јџЌ  ‘с≥∆  £÷ "
				  "\n£ы£ы £’£ыEND∞„Ј¬Їл√сƒб”јџЌ  ‘с≥∆  £÷ "
		);

	  	buttontype = WINDOW_BUTTONTYPE_CANCEL;
	  	windowtype = WINDOW_MESSAGETYPE_SELECT;
	  	windowno = CHAR_WINDOWTYPE_CHECKMAN_START; 
	  	break;

	//NOW∞„Ј¬ЇлЉ∞њ√«©  ‘ч
	  case 1:
	  	
	  	//NOW∞„Ј¬ЇлЉ∞√сƒб”јџЌ
		nowindex = NPC_NowFlgCheck( meindex, talker, now);

		//÷ѕ Є°х≥в  ЊЃ
		page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ;
		
		if(page == 0 || page == 1){
			i = 0;
		}else{
			i = 83;
		}
		
		// Є°х≥в
		for(; i < nowindex ; i++)
		{
			sprintf(work,"%d,",now[ i]);
			strcat(work2,work);
		}
		
		sprintf(token,"£ы£ы£ы£ы£ы£Њ£Њ£ы√сƒб”јџЌ—®Љю£ы£Њ£Њ "
					"\n£ы£ытЎїюЉ∞÷ю  Љ∞  ‘»їѓ÷–‘¬ NOWƒћ√ђЉю–ю"
					"\n%s"
			 	,work2);	
	  	
	  	if(page != 2 && nowindex > 83)
	  	{
	  		//∆є°х”с
	  		CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,1);
	  		// Є°х≥в
	  		CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,2);

			buttontype = WINDOW_BUTTONTYPE_NEXT;
			windowtype = WINDOW_MESSAGETYPE_MESSAGE;
		  	windowno = CHAR_WINDOWTYPE_CHECKMAN_MAIN; 

		}else{
			buttontype = WINDOW_BUTTONTYPE_OK;
			windowtype = WINDOW_MESSAGETYPE_MESSAGE;
		}
		
		break;


	//END∞„Ј¬ЇлЉ∞њ√«©  ‘ч
	  case 2:
		//±ќ  ∞„Ј¬ЇлЉ∞√сƒб”јџЌ
		nowindex = NPC_EndFlgCheck( meindex, talker, now);
		
		//÷ѕ Є°х≥в  ЊЃ
		page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ;
		
		if(page == 0 || page == 1){
			i = 0;
		}else{
			i = 83;
		}
		work2[0]=0;
		
		// Є°х≥в
		for(; i < nowindex ; i++)
		{
			sprintf(work,"%d,",now[ i]);
			strcat(work2,work);
		}
		sprintf(token,"£ы£ы£ы£ы£ы£Њ£Њ£ы√сƒб”јџЌ—®Љю£ы£Њ£Њ "
					"\n£ы£ытЎїюЉ∞÷ю  Љ∞  ‘»їѓ÷–‘¬ ENDƒћ√ђЉю–ю"
					"\n%s"
			 	,work2);	
	  	
	  	if(page != 2 && nowindex > 83)
	  	{
	  		//∆є°х”с
	  		CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,2);
	  		// Є°х≥в
	  		CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,2);

			buttontype = WINDOW_BUTTONTYPE_NEXT;
			windowtype = WINDOW_MESSAGETYPE_MESSAGE;
		  	windowno = CHAR_WINDOWTYPE_CHECKMAN_MAIN; 

		}else{
			buttontype = WINDOW_BUTTONTYPE_OK;
			windowtype = WINDOW_MESSAGETYPE_MESSAGE;
		}
		
		break;
		
	
	// NOW∞„Ј¬ЇлЉ∞‘с≥∆  ‘ч
	  case 4:
		{
			
			//NOW∞„Ј¬Їл√сƒб”јџЌ
			nowindex = NPC_NowFlgCheck( meindex, talker, now);

			if(NPC_FlgCheckMain( meindex, talker, nowindex,now,work2)
			 == FALSE)
			 {
			 	return;
			 }
			

			sprintf(token,"£ы£ы£ы£ы£ы£Њ£Њ£ы√сƒб”јџЌ—®Љю£ы£Њ£Њ "
						"\n£ы£ытЎїюЉ∞÷ю  Љ∞  ‘»їѓ÷–‘¬ NOWƒћ√ђЉю–ю"
						"\n%s"
				 	,work2);	

			page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ;
		  	nowindex = (nowindex / ((6*page)+1));

		  	if(page != 16 &&  nowindex != 0)
		  	{
		  		//∆є°х”с
		  		CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,4);
		  		// Є°х≥в
		  		page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC);
		  		page++;
		  		CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,page);
			
				buttontype = WINDOW_BUTTONTYPE_NEXT;
				windowtype = WINDOW_MESSAGETYPE_MESSAGE;
			  	windowno = CHAR_WINDOWTYPE_CHECKMAN_MAIN; 
			}else{
				buttontype = WINDOW_BUTTONTYPE_OK;
				windowtype = WINDOW_MESSAGETYPE_MESSAGE;
			}

		}
	break;

	// END∞„Ј¬ЇлЉ∞‘с≥∆  ‘ч
	  case 5:
		{
			//END∞„Ј¬ЇлЉ∞√сƒб”јџЌ
			nowindex = NPC_EndFlgCheck( meindex, talker, now);
			
			
			if(NPC_FlgCheckMain( meindex, talker, nowindex, now, work2)
			 == FALSE)
			 {
			 	return;
			 }

			sprintf(token,"£ы£ы£ы£ы£ы£Њ£Њ£ы√сƒб”јџЌ—®Љю£ы£Њ£Њ "
						"\n£ы£ытЎїюЉ∞÷ю  Љ∞  ‘»їѓ÷–‘¬ ENDƒћ√ђЉю–ю"
						"\n%s"
				 	,work2);	

			page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ;

		  	nowindex = (nowindex / ((6*page)+1));

		  	if(page != 16 &&  nowindex != 0)
		  	{
		  		//∆є°х”с
		  		CHAR_setWorkInt(talker, CHAR_WORKSHOPRELEVANT, 5);
		  		// Є°х≥в
		  		page = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC);
		  		page++;
		  		CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, page);
			
				buttontype = WINDOW_BUTTONTYPE_NEXT;
				windowtype = WINDOW_MESSAGETYPE_MESSAGE;
			  	windowno = CHAR_WINDOWTYPE_CHECKMAN_MAIN; 
			}else{
				buttontype = WINDOW_BUTTONTYPE_OK;
				windowtype = WINDOW_MESSAGETYPE_MESSAGE;
			}

		}
	}
	
	makeEscapeString( token, escapedname, sizeof( escapedname));
	/*-≥р≥р∆•Ћ™сс‘ ‘¬--*/
	lssproto_WN_send( fd, windowtype, 
					buttontype, 
					windowno,
					CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
					escapedname);

}
コード例 #28
0
ファイル: char_party.c プロジェクト: ChowZenki/SMO-Sa-Source
/*------------------------------------------------------------
 * ¥Ñ¡¼  ¥£¤Ë  ¤í¤¦¤È¤¹¤ë¡e
 ------------------------------------------------------------*/
BOOL CHAR_JoinParty( int charaindex )
{

	int     result = -1;
	int     x,y;
	OBJECT  object;
	int     found = FALSE;
	int     fd;
	int		cnt;
	int	i;
	fd = getfdFromCharaIndex( charaindex );
	if( fd == -1 ) {
		print( "%s : %d err\n", __FILE__, __LINE__);
		return FALSE;
	}
        /* ¼«Ê¬¤¬¥Ñ¡¼  ¥£ÁȤó¤Ç¤¿¤éÂÌ   */
	if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) {
		lssproto_PR_send( fd, 1, FALSE);
		return FALSE;
	}
	/*   ¤ÎÁ°¤ÎºÂ  ¤ò  ¤ë */
	CHAR_getCoordinationDir( CHAR_getInt( charaindex, CHAR_DIR ) ,
							 CHAR_getInt( charaindex , CHAR_X ),
							 CHAR_getInt( charaindex , CHAR_Y ) ,
							 1 , &x , &y );

	/* ½é´ü²½¤¹¤ë */
	for( i = 0; i < CONNECT_WINDOWBUFSIZE; i ++ ) {
        CONNECT_setJoinpartycharaindex(fd,i,-1);
    }
	cnt = 0;

	/*¼«Ê¬¤Î  ¤ÎÁ°¤Î¥­¥ã¥é¤ò¼è  ¤¹¤ë */
	for( object = MAP_getTopObj( CHAR_getInt( charaindex, CHAR_FLOOR),x,y) ;
		 object ;
		 object = NEXT_OBJECT(object ) )
	{
		int toindex;
		int parray;
		int objindex = GET_OBJINDEX(object);
		int targetindex = -1;
		/* ¥­¥ã¥é¥¯¥¿¡¼¤¸¤ã¤Ê¤¤ */
		if( OBJECT_getType( objindex) != OBJTYPE_CHARA) continue;
		toindex = OBJECT_getIndex( objindex);
	
                // shan begin
                if( CHAR_getInt(charaindex, CHAR_FMINDEX) > 0 && CHAR_getInt(toindex, CHAR_FMINDEX) >0){
                    for( i = 0; i < FAMILY_FMPKFLOOR; i++){
                        if( fmpkflnum[i].fl == CHAR_getInt( charaindex, CHAR_FLOOR) )
                            if( CHAR_getInt(charaindex, CHAR_FMINDEX) != CHAR_getInt(toindex, CHAR_FMINDEX) ){
                                lssproto_PR_send( fd, 1, FALSE);
                                return FALSE;
                            }
                    }
                }
                // shan end
	
		/* ¥×¥ì¥¤¥ä¡¼¤Î»þ */
		if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){
			found = TRUE;
			/* Áê¼ê¤¬»Ò¤À¤Ã¤¿¤é¿Æ¤ò°ú¤ÃÄ¥¤ê½Ð¤¹ */
			if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) {
				targetindex = CHAR_getWorkInt( toindex, CHAR_WORKPARTYINDEX1);
				if( !CHAR_CHECKINDEX( targetindex) ) {
					print( " %s:%d err\n", __FILE__, __LINE__);
					continue;
				}
				if( CHAR_getInt( targetindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS) {
					continue;
				}
			}
			else {
				targetindex = toindex;
			}
			/*   ¿Æ¤È  £±¬¤°Ê  ¤Ë¤¤¤ë¤« */
			if( NPC_Util_CharDistance( charaindex, targetindex ) > 1) {
				continue;
			}

			/* Àï    ¤Ï¤Ç¤Ê¤¤»ö¡e*/
			if( CHAR_getWorkInt( targetindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ){
				continue;
			}
			/* Ãç´Öµö²Ä¥â¡¼¥É¤« */
			if( !CHAR_getFlg( targetindex, CHAR_ISPARTY) ) continue;

#ifdef _ANGEL_SUMMON
			if( CHAR_getWorkInt( targetindex, CHAR_WORKANGELMODE) == TRUE) {
				CHAR_talkToCli( charaindex, -1, "¨ÏªÌ¤£¥i¥H·í»â¶¤¡C", CHAR_COLORYELLOW);
				continue;
			}
#endif
#ifdef _ESCAPE_RESET // ¨Ï¥Î´cÄ_°k¶]«áx¤ÀÄÁ¤º¤£¥i»P¤H²Õ¶¤
			if( getStayEncount( getfdFromCharaIndex(targetindex) ) ) {
				//print(" ´cÄ_¤¤²Õ¶¤ ");
				if( time(NULL) - CHAR_getWorkInt( targetindex, CHAR_WORKLASTESCAPE) < 5*60 ) {
					//print(" ´cÄ_°k¶]«á²Õ¶¤ ");
					CHAR_talkToCli( charaindex, -1, "¦¹¤H¼È®É¤£¥i¥H·í»â¶¤¡C", CHAR_COLORYELLOW);
					continue;
				}
			}
#endif
		}
		/* ¥Þ¥ó¥â¥¹¥Ð¥¹¤¬¤¤¤ë»þ¤Ï¡f¿Í´Ö¤è¤êÍ¥À褹¤ë¡e */
		else if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) {
			targetindex = toindex;
			cnt = 0;
			if( !NPC_BusCheckJoinParty( toindex, charaindex, TRUE)) {
				/* ¾ò·ï¤ò  ¤¿¤µ¤Ê¤«¤Ã¤¿¡eÃç´Ö  ¤ë¤Î¤Ï½ª¤ï¤ë¡e¿Í´Ö¤Î½è  ¤â¤·¤Ê¤¤¡e
				 * ¤ä¤ä¤³¤·¤¤¤Î¤Ç¡e
				 */
				break;
			}
			{	// Arminius 7.10 Airplane
			  int busimg=CHAR_getInt(toindex, CHAR_BASEIMAGENUMBER);
		          if ((busimg!=100355) && (busimg!=100461)) {
		            CHAR_setInt(charaindex,CHAR_BASEIMAGENUMBER,busimg);
			    CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex ,
				CHAR_WORKOBJINDEX ));
				// Robin debug 01/11/21
				if( CHAR_getInt( charaindex, CHAR_RIDEPET) != -1 ) {
					CHAR_setInt( charaindex, CHAR_RIDEPET, -1);
					CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_RIDEPET);
				}
			/*
			    CHAR_sendPMEToArroundCharacterFLXY(charaindex,
			        CHAR_getInt( charaindex, CHAR_FLOOR),
			        CHAR_getInt( charaindex, CHAR_X),
			        CHAR_getInt( charaindex, CHAR_Y),
			        0,1,CHAR_getInt( charaindex, CHAR_PETMAILEFFECT)
			        );
			*/
		          }
		        }
		}
		/* ¥×¥ì¥¤¥ä¡¼Ëô¤Ï¥Þ¥ó¥â¥¹¥Ð¥¹°Ê³°¤Ï  »ë¤¹¤ë */
		else {
			continue;
		}
		/* Áê¼ê¥Ñ¡¼  ¥£¤Î¿Í¿ô¤Ï    ¤«¡ª */
		parray = CHAR_getEmptyPartyArray( targetindex) ;
		if( parray == -1 ) continue;

		/* ¤³¤³¤Þ¤Ç¤¯¤ì¤Ð     */
        CONNECT_setJoinpartycharaindex( fd,cnt,toindex);
		cnt++;
		if( cnt == CONNECT_WINDOWBUFSIZE ) break;
		
		/* ¥Þ¥ó¥â¥¹¥Ð¥¹  ¸«¤·¤À¤¤¡f¥ë¡¼¥×¤ò  ¤±¤ë¡e */
		if( CHAR_getInt( targetindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) break;

	}
	if( cnt == 0 ) {
		if( found == TRUE) {
			CHAR_talkToCli( charaindex, -1, "µLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW);
		}
		result = FALSE;
	}else if( cnt == 1 ) {
#ifdef _DEATH_CONTEND
		int toindex = CONNECT_getJoinpartycharaindex( fd, 0);
		if(CHAR_getInt(toindex,CHAR_PKLISTTEAMNUM) == -1 && CHAR_getInt(charaindex,CHAR_PKLISTTEAMNUM) == -1){
		}else if( CHAR_getInt( charaindex, CHAR_PKLISTLEADER ) > 0 ||
			CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) < 0 ||
			CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) < 0 ||
			CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) != CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) ||
			CHAR_getInt(toindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){

			CHAR_talkToCli( charaindex, -1, "¶¤¥î¤£¦P¡AµLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW);
			result = FALSE;
		}else{
#endif
			CHAR_JoinParty_Main( charaindex, CONNECT_getJoinpartycharaindex(fd,0));
			result = TRUE;
#ifdef _DEATH_CONTEND
		}
#endif
	}else {
		int		strlength;
		char	msgbuf[1024];
		char	escapebuf[2048];
#ifdef _DEATH_CONTEND
		int toindex = CONNECT_getJoinpartycharaindex( fd, 0);
		if(CHAR_getInt(toindex,CHAR_PKLISTTEAMNUM) == -1 && CHAR_getInt(charaindex,CHAR_PKLISTTEAMNUM) == -1){
		}else if( CHAR_getInt( charaindex, CHAR_PKLISTLEADER ) > 0 ||
			CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) < 0 ||
			CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) < 0 ||
			CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) != CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) ||
			CHAR_getInt(toindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){

			CHAR_talkToCli( charaindex, -1, "¶¤¥î¤£¦P¡AµLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW);
			result = FALSE;
		}
#endif
		strcpy( msgbuf, "1\n©M½Ö²Õ¦¨¹Î¶¤©O¡H\n");
		strlength = strlen( msgbuf);
		for( i = 0;
             CONNECT_getJoinpartycharaindex( fd,i ) != -1
			&& i< CONNECT_WINDOWBUFSIZE;
			i ++ ){
			char	*a = CHAR_getChar(
                CONNECT_getJoinpartycharaindex(fd,i) , CHAR_NAME);
			char	buf[256];
			snprintf( buf, sizeof( buf),"%s\n", a);
			if( strlength + strlen( buf) > arraysizeof( msgbuf)){
				print( "%s:%dµøµ¡°T®§buffer¤£¨¬¡C\n",
						__FILE__,__LINE__);
				break;
			}
			strcpy( &msgbuf[strlength], buf);
			strlength += strlen(buf);
		}
		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT,
						WINDOW_BUTTONTYPE_CANCEL,
						CHAR_WINDOWTYPE_SELECTPARTY,
						-1,
					makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf)));


	}

	if( result != -1 ) {
		lssproto_PR_send( fd, 1, result);
	}
	return result;
}
コード例 #29
0
static void NPC_WindowHealer_selectWindow( int meindex, int toindex, int num)
{

	char token[1024];
	char escapedname[1024];
	int fd = getfdFromCharaIndex( toindex);
	int buttontype=0;
	int windowtype=0;
	int windowno=0;

	/*--¥¦¥¤¥ó¥É¥¦¥¿¥¤¥×¥á¥Ã¥»¡¼¥¸¤¬¤ª¤ª¤¤¤Î¤ÇÀè¤ËÀßÄê--*/
  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;

	switch( num){
	  case 0:
  		/*--Áª      --*/
		sprintf(token,"       «u§r¡I§A¨ü¶Ë¤F¶Ü¡H   "
				  "\n\n             ¡Õ ­@¤[¤O¦^´_¡Ö           "
					"\n             ¡Õ  ®ð¤O¦^´_  ¡Ö           "
					"\n          ¡Õ ­@¤[¤O.®ð¤O¦^´_ ¡Ö     "
				  "\n\n           ¡ÕÃdª«¦^´_(§K¶O)¡Ö         "
			);

	  	buttontype=WINDOW_BUTTONTYPE_CANCEL;
	  	windowtype=WINDOW_MESSAGETYPE_SELECT;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_STARTMSG; 
	  	break;


	  case 1:
		if( CHAR_getInt(toindex,CHAR_HP) ==CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)){
			if(NPC_PetHealerCheck(toindex)==FALSE){
				sprintf(token,
				"             ¡Õ  ­@¤[¤O¦^´_  ¡Ö"
				"\n\n\n\n        ¦ü¥G¨S¦³¥²­n¦^´_­ò¡I  ");
		  	}else{
		  		sprintf(token,
				"             ¡Õ  ­@¤[¤O¦^´_  ¡Ö"
				"\n\n              ¦ü¥G¨S¦³¥²­n¦^´_­ò¡I  "
					  "\n\n      ¦]¬°Ãdª«¦n¹³¤]¨ü¶Ë¤F¡I"
					  "\n                            ¥ýÀ°¥L¦^´_§a¡I");
		  	
		  		NPC_WindowHealerAllHeal(toindex,0 );
		  	}

		  	buttontype=WINDOW_BUTTONTYPE_OK;
		  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_HPMSG; 
			break;
		}else if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){
			sprintf(token,"             ¡Õ  ­@¤[¤O¦^´_  ¡Ö"
					"\n\n\n              ¬O­n¦^´_­@¤[¤O¨S¿ù§a¡I       "
					"\n\n  ²{¦bªºµ¥¯Å¥i¥H§K¶OÀ°§A¦^´_­ò¡I");
		
		}else{
			int gold;
			gold=NPC_WindowCostCheck(meindex,toindex);
			sprintf(token,"             ¡Õ  ­@¤[¤O¦^´_  ¡Ö"
				"\n\n\n              ¬O­n¦^´_­@¤[¤O¨S¿ù§a¡I       "
				 "\n\n          ¦¬±z%dªºSTONE ¡C"
				 ,gold);
		}

	  	buttontype=WINDOW_BUTTONTYPE_YESNO;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_HPMSG; 
	  	break;

	  case 2:
		if( CHAR_getInt(toindex,CHAR_MP) ==CHAR_getWorkInt( toindex, CHAR_WORKMAXMP)){
			if(NPC_PetHealerCheck(toindex)==FALSE){
				sprintf(token,  "              ¡Õ  ®ð¤O¦^´_  ¡Ö"
					"\n\n\n\n        ¦ü¥G¨S¦³¥²­n¦^´_­ò¡I  ");
			}else{
			sprintf(token,  "              ¡Õ  ®ð¤O¦^´_  ¡Ö"
					"\n\n              ¦ü¥G¨S¦³¥²­n¦^´_­ò¡I  "
					  "\n\n      ¦]¬°Ãdª«¦n¹³¤]¨ü¶Ë¤F¡I"
					  "\n                            ¥ýÀ°¥L¦^´_§a¡I");
				NPC_WindowHealerAllHeal(toindex,0 );
			}
		  	buttontype=WINDOW_BUTTONTYPE_OK;
		  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; 
			break;
		}

		if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){
			sprintf(token,"              ¡Õ ®ð¤O¦^´_¡Ö"
					  "\n\n              ¬O­n¦^´_®ð¤O¨S¿ù§a¡I         "
					  "\n\n ²{¦bªºµ¥¯Å¥i¥H§K¶OÀ°§A¦^´_­ò¡I");
		}else{
			int cost;
			cost=NPC_WindowCostCheckMp(meindex,toindex);
			sprintf(token,"              ¡Õ ®ð¤O¦^´_¡Ö"
					"\n\n\n              ¬O­n¦^´_®ð¤O¨S¿ù§a¡I "
 					  "\n\n        ¦¬±z%dªºSTONE ¡C",
					cost);
		}
	  	buttontype=WINDOW_BUTTONTYPE_YESNO;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; 
	  	break;


	  case 3:
		sprintf(token,	    "\n            ¡Õ­@¤[¤O¤w¦^´_¡Ö"
						    "\n      ¡ÕÃdª«¤]¤w¦^´_¤@¯ëª¬ºA¡Ö"
						"\n\n\n            ³o¼Ë¤l´N¨S°ÝÃD¤F¡I        ");

		/*--ÂÑµ×  ¤Î¤ß²óÉü¤µ¤»¤ë--*/
	  	NPC_WindowHealerAllHeal( toindex ,1 );
	  	buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; 
	  	break;


	  case 4:
		sprintf(token,	    "\n            ¡Õ®ð¤O¤w¦^´_¡Ö"
						    "\n     ¡ÕÃdª«¤]¤w¦^´_¤@¯ëª¬ºA¡Ö"
						"\n\n\n           ³o¼Ë¤l´N¨S°ÝÃD¤F¡I       ");
		/*--µ¤  ¤Î¤ß²óÉü¤µ¤»¤ë---*/
	  	NPC_WindowHealerAllHeal( toindex ,2 );
	 	buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKSPIRITMSG; 
	  	break;


	  case 6:
		{
			int cost=0;

			if(CHAR_getInt(toindex,CHAR_HP) < CHAR_getWorkInt( toindex, CHAR_WORKMAXHP))
			{
				cost+=NPC_WindowCostCheck(meindex,toindex);
			}

			if( CHAR_getInt(toindex,CHAR_MP) < CHAR_getWorkInt( toindex, CHAR_WORKMAXMP))
			{
				cost=cost+NPC_WindowCostCheckMp(meindex,toindex);
			}
		
			if(cost==0) {
				if(NPC_PetHealerCheck(toindex)==FALSE){
				sprintf(token,
						"          ¡Õ  ­@¤[¤O®ð¤O¦^´_  ¡Ö"
				"\n\n\n\n        ¦ü¥G¨S¦³¥²­n¦^´_­ò¡I  ");
				}else{
				sprintf(token,"          ¡Õ  ­@¤[¤O®ð¤O¦^´_  ¡Ö"
					"\n\n              ¦ü¥G¨S¦³¥²­n¦^´_­ò¡I  "
					  "\n\n      ¦]¬°Ãdª«¦n¹³¤]¨ü¶Ë¤F¡I"
					  "\n                            ¥ýÀ°¥L¦^´_§a¡I");
				NPC_WindowHealerAllHeal(toindex,0 );
			}
		
				
				
			  	buttontype=WINDOW_BUTTONTYPE_OK;
			  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
			  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; 
				break;

			}else{
				sprintf(token,"        ¡Õ  ­@¤[¤O®ð¤O¦^´_  ¡Ö"
						"\n\n\n         ¬O­n¦^´_­@¤[¤O®ð¤O¨S¿ù§a¡I"
						"\n\n          ¦¬±z%dªºSTONE ¡C",cost);
			}
		}

		if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){
			sprintf(token,"          ¡Õ  ­@¤[¤O®ð¤O¦^´_  ¡Ö"
					"\n\n\n           ¬O­n¦^´_­@¤[¤O®ð¤O¨S¿ù§a¡I"
					"\n\n  ²{¦bªºµ¥¯Å¥i¥H§K¶OÀ°§A¦^´_­ò¡I");
		}
	
	  	buttontype=WINDOW_BUTTONTYPE_YESNO;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_ALLMSG; 
	  	break;


	  case 7:
		sprintf(token,"         ¡Õ­@¤[¤O®ð¤O¤w¦^´_¡Ö"
				  "\n      ¡ÕÃdª«¤]¤w¦^´_¤@¯ëª¬ºA¡Ö"
				  "\n\n\n        ³o¼Ë¤@¨Ó´N¦^´_°·±d¤F¡I");
	  	
	  	NPC_WindowHealerAllHeal( toindex ,3 );
		buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKALLMSG; 
	  	break;


	  case 8:
		sprintf(token,"\n\n\n\n     ¯u¥i±¤¦ü¥G©Ò±aªºª÷¿ú¤£°÷­ò¡I");

		buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; 
	  	break;

	  case 9:
		sprintf(token,"              ¡ÕÃdª«¦^´_¡Ö            "
				"\n\n\n              ¤w¸g¨S°ÝÃD¤F°Õ¡I          "
				  "\n\n    ¦ý¬O¤Ó«j±jªº¸Ü¤]¤£¦æ­ò¡I    ");
		NPC_WindowHealerAllHeal(toindex,0 );
		buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; 
	  	break;

	  case 10:
		sprintf(token,"              ¡ÕÃdª«¦^´_¡Ö            "
				"\n\n\n   ¦ü¥G¨S¦³¥²­n¦^´_Ãdª«ªº¼Ë¤l¡C  "
				  "\n\n    ¦ý¬O¤Ó«j±jªº¸Ü¤]¤£¦æ­ò¡I    ");
		buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; 
	  	break;


	}


	makeEscapeString( token, escapedname, sizeof(escapedname));
	/*-¤³¤³¤ÇÁ÷¿®¤¹¤ë--*/
	lssproto_WN_send( fd, windowtype, 
					buttontype, 
					windowno,
					CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
					escapedname);

}
コード例 #30
0
// Select Event
void NPC_FmDengonWindowTalked( int index, int talker, int seqno, int select, char *data)
{
//    char buf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW*2];
    char buf[4096];
    int  buttonevent;
    int  buttontype = 0;
    struct timeval recvtime;
    
    if (!CHAR_CHECKINDEX(talker)) return;
    
    CONNECT_getLastrecvtime_D( getfdFromCharaIndex( talker), &recvtime);
    if( time_diff( NowTime, recvtime) < 0.5 ){
        return;
    }
    
    CONNECT_setLastrecvtime_D( getfdFromCharaIndex( talker), &NowTime);
#ifndef _FM_MODIFY
    // 距離超出 DENGONDISTANCE 的範圍內時,即取消動作
#define DENGONDISTANCE 3	
    if( CHAR_getInt(index, CHAR_FLOOR) != 777 )
        if(NPC_Util_CharDistance( index, talker) > DENGONDISTANCE) return;
#endif
    
    // 家族留言板
    if( seqno == CHAR_WINDOWTYPE_FM_DENGON)
    {
			int dengonindex;
			int fmindex_wk;
			char tmp_buffer[4096],tmp[4096];
			
			getStringFromIndexWithDelim(data,"|",1,tmp_buffer,sizeof(tmp_buffer));
			dengonindex = atoi(tmp_buffer);
			
			fmindex_wk = CHAR_getWorkInt( talker, CHAR_WORKFMINDEXI);
			
			if( fmindex_wk < 0 || fmindex_wk >= FMMAXNUM) return;
			
			switch( select){
			case WINDOW_BUTTONTYPE_NEXT:
			case WINDOW_BUTTONTYPE_PREV:
				{
					int fd,i;
					fd = getfdFromCharaIndex( talker);
					if( fd == -1) return;
					
					dengonindex += 7 * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1);
					if( dengonindex > memberlist[fmindex_wk].memoindex && memberlist[fmindex_wk].memonum < DENGONFILELINENUM)
						dengonindex = memberlist[fmindex_wk].memoindex;
					else if( dengonindex < 6 && memberlist[fmindex_wk].memonum < DENGONFILELINENUM) 
						dengonindex = 6;
					else if( dengonindex < 1 && memberlist[fmindex_wk].memonum >= DENGONFILELINENUM)
						dengonindex = memberlist[fmindex_wk].memonum+dengonindex;
					else if( dengonindex > memberlist[fmindex_wk].memonum && memberlist[fmindex_wk].memonum >= DENGONFILELINENUM)
						dengonindex -= memberlist[fmindex_wk].memonum;
					
					buttontype = WINDOW_BUTTONTYPE_OKCANCEL;
					if( dengonindex==memberlist[fmindex_wk].memoindex && memberlist[fmindex_wk].memonum >= DENGONFILELINENUM) 
						buttontype |= WINDOW_BUTTONTYPE_PREV;
					else if( (dengonindex - 7)<=memberlist[fmindex_wk].memoindex && (dengonindex - 7)>=(memberlist[fmindex_wk].memoindex - 7) &&
						memberlist[fmindex_wk].memonum >= DENGONFILELINENUM) 
						buttontype |= WINDOW_BUTTONTYPE_NEXT;
					else if( dengonindex==memberlist[fmindex_wk].memoindex) 
						buttontype |= WINDOW_BUTTONTYPE_PREV;    
					else if( dengonindex == 6) buttontype |= WINDOW_BUTTONTYPE_NEXT;
					else{
						buttontype |= WINDOW_BUTTONTYPE_PREV;
						buttontype |= WINDOW_BUTTONTYPE_NEXT;
					}
					if(dengonindex >= 6){
						strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[dengonindex - 6]);
						strcat( NPC_sendbuf, "\n");
						for( i=(dengonindex - 5); i<=dengonindex; i++){
							strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						sprintf(tmp, "%d\n", dengonindex);
						strcat( NPC_sendbuf, tmp);
					}
					if(dengonindex < 6){
						strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[memberlist[fmindex_wk].memonum+(dengonindex - 6)]);
						strcat( NPC_sendbuf, "\n");
						for( i=memberlist[fmindex_wk].memonum+(dengonindex - 5); i<memberlist[fmindex_wk].memonum; i++){
							strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						for( i=0; i<=dengonindex; i++){
							strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						sprintf(tmp, "%d\n", dengonindex);
						strcat( NPC_sendbuf, tmp);
					}
					
					lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DENGON,
						buttontype,
						CHAR_WINDOWTYPE_FM_DENGON,
#ifndef _FM_MODIFY
						CHAR_getWorkInt( index, CHAR_WORKOBJINDEX),
#else
						-1,
#endif
						makeEscapeString( NPC_sendbuf, buf, sizeof(buf)));
				}
				break;
			case WINDOW_BUTTONTYPE_OK:
				{
					int    fd,i;
					struct tm tm1;
					char   m_buf[4096];
					
					fd = getfdFromCharaIndex( talker);
					if( fd == -1 ) return;
					if( strlen(data) == 0 ) break;
					
					memberlist[fmindex_wk].memonum++;
					if( memberlist[fmindex_wk].memonum > DENGONFILELINENUM) 
						memberlist[fmindex_wk].memonum = DENGONFILELINENUM;
					
					memberlist[fmindex_wk].memoindex++;
					if( memberlist[fmindex_wk].memoindex >= DENGONFILELINENUM) 
						memberlist[fmindex_wk].memoindex=0;
					
					dengonindex = memberlist[fmindex_wk].memoindex;
					
					if( dengonindex < 6 && memberlist[fmindex_wk].memonum<DENGONFILELINENUM)
						dengonindex = 6;
					
					memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof(struct tm));
					getStringFromIndexWithDelim(data,"|",2,tmp_buffer,sizeof(tmp_buffer));
					sprintf( m_buf,"%s|%2d/%02d %2d:%02d %s",
						tmp_buffer,
						tm1.tm_mon +1, tm1.tm_mday, tm1.tm_hour, tm1.tm_min,
						CHAR_getChar( talker, CHAR_NAME));
					strcpy(memberlist[fmindex_wk].memo[memberlist[fmindex_wk].memoindex], m_buf);
					
					// send acsv 
					saacproto_ACFMWriteMemo_send( acfd, CHAR_getChar( talker, CHAR_FMNAME), 
						CHAR_getInt(talker, CHAR_FMINDEX),
						makeEscapeString( memberlist[fmindex_wk].memo[memberlist[fmindex_wk].memoindex], buf, sizeof(buf)),
						fmindex_wk);
					
					if( dengonindex >= 6){
						strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[dengonindex - 6]);
						strcat( NPC_sendbuf, "\n");
						for( i=(dengonindex-5); i<=dengonindex; i++){
							strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						sprintf(tmp, "%d\n", dengonindex);
						strcat( NPC_sendbuf, tmp);
					}
					if( dengonindex < 6){
						strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[memberlist[fmindex_wk].memonum+(dengonindex - 6)]);
						strcat( NPC_sendbuf, "\n");
						for( i=memberlist[fmindex_wk].memonum+(dengonindex - 5); i<memberlist[fmindex_wk].memonum; i++){
							strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						for( i=0; i<=dengonindex; i++){
							strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						sprintf(tmp, "%d\n", dengonindex);
						strcat( NPC_sendbuf, tmp);
					}
					lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DENGON,
						WINDOW_BUTTONTYPE_OKCANCEL|
						WINDOW_BUTTONTYPE_PREV,
						CHAR_WINDOWTYPE_FM_DENGON,
#ifndef _FM_MODIFY
						CHAR_getWorkInt( index, CHAR_WORKOBJINDEX),
#else
						-1,
#endif
						makeEscapeString( NPC_sendbuf, buf, sizeof(buf)));
				}
				break;
			default:
				break;
      }  // Switch End
    }  // If End
        
    // 家族之間留言板
    else if(seqno == CHAR_WINDOWTYPE_FM_FMSDENGON)
    {
			int dengonindex;
			char tmp_buffer[4096],tmp[4096];
			getStringFromIndexWithDelim(data,"|",1,tmp_buffer,sizeof(tmp_buffer));
			dengonindex = atoi(tmp_buffer);
			
			switch( select ){
			case WINDOW_BUTTONTYPE_NEXT:
			case WINDOW_BUTTONTYPE_PREV:
				{
					int fd,i;
					fd = getfdFromCharaIndex( talker);
					if( fd == -1 ) return;
					
					dengonindex += 7 * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1);
					if( dengonindex > fmsmemo.memoindex && fmsmemo.memonum < FMSDENGONFILELINENUM)
						dengonindex = fmsmemo.memoindex;
					else if( dengonindex < 6 && fmsmemo.memonum < FMSDENGONFILELINENUM) 
						dengonindex = 6;
					else if( dengonindex < 1 && fmsmemo.memonum >= FMSDENGONFILELINENUM)
						dengonindex = fmsmemo.memonum+dengonindex;
					else if( dengonindex > fmsmemo.memonum && fmsmemo.memonum >= FMSDENGONFILELINENUM)
						dengonindex -= fmsmemo.memonum;
					
					buttontype = WINDOW_BUTTONTYPE_OKCANCEL;
					if( dengonindex==fmsmemo.memoindex && fmsmemo.memonum >= FMSDENGONFILELINENUM) 
						buttontype |= WINDOW_BUTTONTYPE_PREV;
					else if( (dengonindex-7)<=fmsmemo.memoindex && (dengonindex - 7)>=(fmsmemo.memoindex - 7) &&
						fmsmemo.memonum >= FMSDENGONFILELINENUM) 
						buttontype |= WINDOW_BUTTONTYPE_NEXT;
					else if( dengonindex == fmsmemo.memoindex) 
						buttontype |= WINDOW_BUTTONTYPE_PREV;    
					else if( dengonindex == 6 ) 
						buttontype |= WINDOW_BUTTONTYPE_NEXT;
					else{
						buttontype |= WINDOW_BUTTONTYPE_PREV;
						buttontype |= WINDOW_BUTTONTYPE_NEXT;
					}
					
					if( dengonindex >= 6 ){
						if( (dengonindex - 6)  >= 140 ) return;
						strcpy( NPC_sendbuf, fmsmemo.memo[dengonindex - 6]);
						strcat( NPC_sendbuf, "\n");
						for( i=(dengonindex - 5); i<=dengonindex; i++){
							strcat( NPC_sendbuf, fmsmemo.memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						sprintf(tmp, "%d\n", dengonindex);
						strcat( NPC_sendbuf, tmp);
					}
					if(dengonindex < 6){
						if( (fmsmemo.memonum+(dengonindex - 6))  >= 140 ||
							(fmsmemo.memonum+(dengonindex - 6))  < 0 ) return;
						
						strcpy( NPC_sendbuf, fmsmemo.memo[fmsmemo.memonum+(dengonindex - 6)]);
						
						strcat( NPC_sendbuf, "\n");
						for( i=fmsmemo.memonum+(dengonindex - 5); i<fmsmemo.memonum; i++){
							strcat( NPC_sendbuf, fmsmemo.memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						for( i=0; i<=dengonindex; i++){
							strcat( NPC_sendbuf, fmsmemo.memo[i]);
							strcat( NPC_sendbuf, "\n");
						}
						sprintf(tmp, "%d\n", dengonindex);
						strcat( NPC_sendbuf, tmp);
					}
					lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_FMSDENGON,
						buttontype,
						CHAR_WINDOWTYPE_FM_FMSDENGON,
#ifndef _FM_MODIFY
						CHAR_getWorkInt( index, CHAR_WORKOBJINDEX),
#else
						-1,
#endif
						makeEscapeString( NPC_sendbuf, buf, sizeof(buf)));
				}
				break;
			case WINDOW_BUTTONTYPE_OK:
				{
					int    fd,i;
					struct tm tm1;
					char   m_buf[4096];
					
					fd = getfdFromCharaIndex( talker );
					if( fd == -1 )  return;
					
#ifdef _FMVER21  
					if( CHAR_getInt( talker, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER){              
#else
					if( CHAR_getInt( talker, CHAR_FMLEADERFLAG) != 1){              
#endif              
							sprintf( NPC_sendbuf, "              『警       告』\n 抱歉!你不是族長,所以僅能查看。");
							lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
								WINDOW_BUTTONTYPE_OK,
								-1,
								-1,
								makeEscapeString( NPC_sendbuf, buf, sizeof(buf)));
							return;
						}
						
						if( strlen( data) == 0 )  break;
						
						fmsmemo.memonum++;
						if( fmsmemo.memonum > FMSDENGONFILELINENUM) 
							fmsmemo.memonum = FMSDENGONFILELINENUM;
            
						fmsmemo.memoindex++;
						if( fmsmemo.memoindex >= FMSDENGONFILELINENUM) 
							fmsmemo.memoindex = 0;
						
						dengonindex = fmsmemo.memoindex;
						if( dengonindex < 6 && fmsmemo.memonum<FMSDENGONFILELINENUM)
							dengonindex = 6;
						
						memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1));
						getStringFromIndexWithDelim(data,"|",2,tmp_buffer,sizeof(tmp_buffer));
						sprintf( m_buf,"%s|%2d/%02d %2d:%02d %s",
							tmp_buffer,
							tm1.tm_mon +1, tm1.tm_mday, tm1.tm_hour, tm1.tm_min,
							CHAR_getChar( talker, CHAR_NAME));
						strcpy( fmsmemo.memo[fmsmemo.memoindex], m_buf);
						
						// send acsv 
						saacproto_ACFMWriteMemo_send( acfd, "FMS", 
							FMSDENGON_SN,
							makeEscapeString( fmsmemo.memo[fmsmemo.memoindex], buf, sizeof(buf)),
							FMSDENGON_SN);
						
						if( dengonindex >= 6){
							strcpy( NPC_sendbuf, fmsmemo.memo[dengonindex - 6]);
							strcat( NPC_sendbuf, "\n");
							for( i=(dengonindex - 5); i<=dengonindex; i++){
								strcat( NPC_sendbuf, fmsmemo.memo[i]);
								strcat( NPC_sendbuf, "\n");
							}
							sprintf(tmp, "%d\n", dengonindex);
							strcat( NPC_sendbuf, tmp);
						}
						if(dengonindex < 6){
							strcpy( NPC_sendbuf, fmsmemo.memo[fmsmemo.memonum+(dengonindex - 6)]);
							strcat( NPC_sendbuf, "\n");
							for( i=fmsmemo.memonum+(dengonindex - 5); i<fmsmemo.memonum; i++){
								strcat( NPC_sendbuf, fmsmemo.memo[i]);
								strcat( NPC_sendbuf, "\n");
							}
							for( i=0; i<=dengonindex; i++){
								strcat( NPC_sendbuf, fmsmemo.memo[i]);
								strcat( NPC_sendbuf, "\n");
							}
							sprintf(tmp, "%d\n", dengonindex);
							strcat( NPC_sendbuf, tmp);
						}
						lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_FMSDENGON,
							WINDOW_BUTTONTYPE_OKCANCEL|
							WINDOW_BUTTONTYPE_PREV,
							CHAR_WINDOWTYPE_FM_FMSDENGON,
#ifndef _FM_MODIFY
							CHAR_getWorkInt( index, CHAR_WORKOBJINDEX),
#else
							-1,
#endif
							makeEscapeString( NPC_sendbuf, buf, sizeof(buf)));
					}
					break;
				default: break;
      }  // Switch End
    }  // If End
        
    // 說明視窗(家族據點)
    else if( seqno == CHAR_WINDOWTYPE_FM_MESSAGE1)