예제 #1
0
static void NPC_TranserMan_selectWindow( int meindex, int toindex, int num,int select)
{
	char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *npcarg;
	char token[256];

	int buttontype = 0, windowtype = 0, windowno = 0;
	int fd = getfdFromCharaIndex( toindex);

	windowtype = WINDOW_MESSAGETYPE_MESSAGE;

	if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) {
		if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE)
			return;
	}

	//memset( npcarg, 0, sizeof( npcarg));
	if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==NULL){
		print("TRANSER_MAN: GetArgStrErr!!");
		return;
	}
	memset( token, 0, sizeof( token));

	switch( num)	{
	case WINDOW_START:
		if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) {
			print("TranserMan Get START_MSG ERROR !");
			return;
		}
		CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START);
		buttontype = WINDOW_BUTTONTYPE_YESNO;
		windowno = NPC_TRANSERMAN_SELECT;
		break;
	case WINDOW_SELECT:
		if( TranserMan_GetMenuStr( meindex, toindex, npcarg, token) == FALSE )	{
			print( "TranserMan GetMenu ERROR !!");
			return;
		}
		windowtype = WINDOW_MESSAGETYPE_SELECT;
		buttontype = WINDOW_BUTTONTYPE_CANCEL;
		windowno = NPC_TRANSERMAN_WARP;
		break;
	case WINDOW_WARP:
		if( ActionNpc_CheckMenuFree( meindex, toindex, npcarg, select) == FALSE ){
			memset( token, 0, sizeof( token));
			if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FAIL_MSG", token, sizeof( token) ) != NULL) {
				CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW);
			}
		}
		return;

	case WINDOW_END:
		break;
	}

	lssproto_WN_send( fd, windowtype, buttontype, windowno,
		CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token);
}
예제 #2
0
BOOL NPC_PairForage( int meindex, int toindex, char *arg, char *token)
{
	char buf1[256];
	int i;
	int codes = CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE);
	int Psex = CHAR_getSexInt( CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) );
	Psex = (Psex==1)?1:0;


	for( i=0; i<MAXPAIRNUMS; i++)	{//forindex
		char *name;
		char *cdKey;
		int fd;
		char buf[256];
		if( PairList[Psex][i].use <= 0 ) continue;
		if( !CHAR_CHECKINDEX( PairList[Psex][i].pindex) ) continue;
		if( CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE )
			continue;
		if( codes != CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRCODE) ) continue;
		if( CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG) > 0 ) continue;
		name = CHAR_getChar( PairList[Psex][i].pindex, CHAR_NAME);
		cdKey = CHAR_getChar( PairList[Psex][i].pindex, CHAR_CDKEY);
		if( strcmp( PairList[Psex][i].name, name) || strcmp( PairList[Psex][i].cdKey, cdKey) ){
			PairList[Psex][i].use = -1;
			PairList[Psex][i].forindex = -1;
			continue;
		}
		sprintf( token, "你的配對對象為: %s\n已送出邀請,請等候對方回應。", name);
		if( NPC_Util_GetStrFromStrWithDelim( arg, "InviteMsg", buf1, sizeof( buf1) ) == NULL){
			break;
		}
		PairList[Psex][i].forindex = toindex;
		fd = getfdFromCharaIndex( PairList[Psex][i].pindex);

		CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, 1);
		CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, PairList[Psex][i].pindex);
		CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG, 2);
		CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRINDEX, toindex);

		name = CHAR_getChar( toindex, CHAR_NAME);
		sprintf( buf, "%s:\n玩家%s\n%s", CHAR_getChar( meindex, CHAR_NAME),name, buf1);
		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OKCANCEL, WINDOW_TALKPAIR,
				CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf);
		break;
	}
	if( i>= MAXPAIRNUMS )	{
		if( NPC_Util_GetStrFromStrWithDelim( arg, "NoPairMsg", buf1, sizeof( buf1) ) != NULL){
			sprintf( token, "%s",buf1);
		}else	{
			sprintf( token, "沒有找到對象。");
		}
		if( CHAR_getWorkInt( toindex, CHAR_MYPAIRFLG) <= 0 )	{
			NPC_PairRegister( toindex);
		}
		return FALSE;
	}
	return TRUE;
}
예제 #3
0
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;
    }

}
예제 #4
0
static void NPC_FreePetSkillShop_selectWindow( int meindex, int toindex, int num,int select)
{
	char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *npcarg;
	char token[1024];
	int fd = getfdFromCharaIndex( toindex);
	int buttontype = 0, windowtype = 0, windowno = 0;
	char buf1[256];
	
	if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==NULL){
		print("GetArgStrErr");
		return ;
	}

	switch(num)	{
	  case START_WINDOW:
		  {
		  BOOL Evflg = TRUE;
		if( NPC_Util_GetStrFromStrWithDelim( npcarg, "start_msg", token, sizeof( token)) == NULL)	{
			CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0);
			return;
		}
		if( CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT) != 1 )	{
			CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0);
			return;
		}
		//玩家條件判斷
		if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf1, sizeof( buf1)) != NULL ) {
			if( NPC_ActionPassCheck( meindex, toindex, buf1) == FALSE )	{
				 Evflg = FALSE;
			}
		}
		if( Evflg == FALSE)	{
			CHAR_talkToCli( toindex, -1, "你想讓寵物學特殊技能?可你的條件還不夠喔!", CHAR_COLORYELLOW);
			CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0);
			return;
		}else	{
			windowtype = WINDOW_MESSAGETYPE_MESSAGE;
			buttontype = WINDOW_BUTTONTYPE_NEXT;
			windowno = SELECTSKILL_START;
			CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 2);
			lssproto_WN_send( fd, windowtype, buttontype, windowno,
					CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token	);
		}
		  }
		break;
	  case SKILL_WINDOW:
		  if( NPC_FreePetSkillMakeStr( meindex, toindex, select) == FALSE )	{
			print("\n npc_freepetskillshop.c 錯誤");
		  }
		break;
	  case MEEND_WINDOW:
		break;
	}
}
예제 #5
0
static void NPC_PetFusion_selectWindow( int meindex, int toindex, int num,int select)
{
	char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *npcarg;
	char token[256];
	int buttontype = 0, windowtype = 0, windowno = 0;
	int fd = getfdFromCharaIndex( toindex);
	windowtype = WINDOW_MESSAGETYPE_MESSAGE;
	if( Action_PartyCheck( meindex, toindex) == FALSE)	{
		CHAR_talkToCli( toindex, meindex, "請一個一個來!", CHAR_COLORYELLOW);
		return;
	}
	//memset( npcarg, 0, sizeof( npcarg));
	if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==NULL){
		print("err NPC_MakePairMan: GetArgStrErr!!");
		return;
	}
	memset( token, 0, sizeof( token));

	switch( num){
	case WINDOW_START:
		if( NPC_Util_GetStrFromStrWithDelim( npcarg, "StartMsg", token, sizeof( token) ) == NULL){
			return;
		}
		buttontype = WINDOW_BUTTONTYPE_YESNO;
		windowno = WINDOW_TALKSTART;
		break;
	case WINDOW_SELECT:
		if( ActionNpc_CheckFree( meindex, toindex, npcarg) == FALSE )	{
			buttontype = WINDOW_BUTTONTYPE_OK;
			windowno = WINDOW_TALKEND;
		}else	{
			if( NPC_Util_GetStrFromStrWithDelim( npcarg, "SelectMsg", token, sizeof( token) ) == NULL){
				return;
			}
			windowtype = WINDOWS_MESSAGETYPE_PETFUSION;
			buttontype = WINDOW_BUTTONTYPE_YESNO;
			windowno = WINDOW_TALKSELECT;
		}
		break;
	case WINDOW_FUSION:
		//融合處理
		break;
	case WINDOW_WARP:
		break;
	case WINDOW_END:
		break;
	}
	CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, windowno);
	lssproto_WN_send( fd, windowtype, buttontype, windowno,
		CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token);
}
예제 #6
0
static void NPC_LuckyMan_selectWindow( int meindex, int toindex, int num,char *msg)
{

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


	switch( num){
		case 1:
			sprintf(token ,"              ¡î½ñÈÕµÄÔËÊÆ¡î  "
					"\n\n%s",msg
				);
				buttontype = WINDOW_BUTTONTYPE_OK;
				windowtype = WINDOW_MESSAGETYPE_MESSAGE;
				windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; 
		break;
	
		case 2:
			sprintf(token, "                ¡îÕ¼²·Ê¦¡î  "
					"\n\n%s",msg
				);
				buttontype = WINDOW_BUTTONTYPE_YESNO;
				windowtype = WINDOW_MESSAGETYPE_MESSAGE;
				windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; 
		break;

		case 3:
			sprintf(token, "                ¡îÕ¼²·Ê¦¡î  "
					"\n\n%s",msg
				);
				buttontype = WINDOW_BUTTONTYPE_OK;
				windowtype = WINDOW_MESSAGETYPE_MESSAGE;
				windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; 
		break;
	}


	/*--˪ññ--*/
	lssproto_WN_send( fd, windowtype, 
				buttontype, 
				windowno,
				CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
				token);


}	
예제 #7
0
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;
}
예제 #8
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;
	   }
	}                                                                                                                                    
}
예제 #9
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)));
	}
}
예제 #10
0
/*********************************
*   仄井仃日木凶凜及質  
*********************************/
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)));
}
예제 #11
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);
        
    }
    
}
예제 #12
0
static void NPC_PoolItemShop_printWindow_Pool( int meindex, int talkerindex)
{
	char	itemstring[65536-1024];
	char	sendstring[65536];
	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char	buff2[1024];
	char	buff3[1024];
	char	buff4[1024];
	int fd;
	
	fd = getfdFromCharaIndex( talkerindex);
	if( fd == -1 ) {
		fprint( "err\n");
		return;
	}

	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
	
	snprintf( sendstring, sizeof( sendstring), "0|%d|%s|%s|%s|%s|",
			CHAR_getEmptyCharPoolItemIndexNum( talkerindex),
			CHAR_getChar( meindex, CHAR_NAME),
			NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_POOL, 
										argstr, buff2, sizeof( buff2)),
			NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_POOLFULL, 
										argstr, buff3, sizeof( buff3)),
			NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_REALY, 
										argstr, buff4, sizeof( buff4))
			);
	
	NPC_PoolItemShop_MakeItemString_Pool( meindex, talkerindex, itemstring, sizeof( itemstring));
	strcat( sendstring, itemstring);
	lssproto_WN_send( fd, WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN,
				WINDOW_BUTTONTYPE_NONE, 
				CHAR_WINDOWTYPE_POOLITEMSHOP_POOL_MSG,
				CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
				sendstring);
	
}
예제 #13
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)));
	}
}
예제 #14
0
static void NPC_PoolItemShop_printWindow_Draw( int meindex, int talkerindex)
{
	char	itemstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20];
	char	sendstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20];
	char	argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20];
	char	buff[1024];
	char	buff2[1024];
	char	buff3[1024];
	int fd;
	
	fd = getfdFromCharaIndex( talkerindex);
	if( fd == -1 ) {
		fprint( "err\n");
		return;
	}

	NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));
	
	snprintf( sendstring, sizeof( sendstring), "1|%s|%s|%s|%s|",
			CHAR_getChar( meindex, CHAR_NAME),
			NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_DRAW, 
										argstr, buff2, sizeof( buff2)),
			NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_ITEMFULL, 
										argstr, buff, sizeof( buff)),
			NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_REALY, 
										argstr, buff3, sizeof( buff3))
			);
	NPC_PoolItemShop_MakeItemString_Draw( meindex, talkerindex, 
									itemstring, sizeof( itemstring));
	strcat( sendstring, itemstring);
	lssproto_WN_send( fd, WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN,
				WINDOW_BUTTONTYPE_NONE, 
				CHAR_WINDOWTYPE_POOLITEMSHOP_DRAW_MSG,
				CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
				sendstring);
	
}
예제 #15
0
// shan add  errNO=1(���)
void NPC_ERR_DiSP1(int meindex,int talker,int errNO)
{
    char token[1024];
    int  i=0;
    int  otherindex;
    int  fd = getfdFromCharaIndex( talker);
    char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];

    if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL) {
        print("GetArgStrErr");
        return ;
    }

    if(errNO==1) {
        if(NPC_Util_GetStrFromStrWithDelim( npcarg, "PartyMsg",token, sizeof( token))==NULL) {
            sprintf(token, "�޷����Ŷ��볡��\n\n����Ŷӽ�ɢ֮���ٸ���\n�볡��");
        }

        if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE)==CHAR_PARTY_CLIENT) {

        } else {
            for( i=0 ; i < CHAR_PARTYMAX ; i++) {
                otherindex=CHAR_getWorkInt(talker,CHAR_WORKPARTYINDEX1+i);
                if(otherindex != -1) {
                    fd = getfdFromCharaIndex( otherindex);
                    lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                      WINDOW_BUTTONTYPE_OK,
                                      CHAR_WINDOWTYPE_WINDOWWARPMAN_ERR,
                                      CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
                                      token);
                }
            }
            return ;
        }
    }
}
예제 #16
0
/******************************
 *	��ľ��ľ����  ��������
 ******************************/
static void NPC_Janken_selectWindow( int meindex, int talker, int num)
{

	char token[1024];
	char buf[32];
	int fd = getfdFromCharaIndex( talker);
	int buttontype=0;
	int windowtype=0;
	int windowno=0;
   	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	

	/*--���̼������������������⻥�����м�ƥ�Ʊ�ɬ��--*/
  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;

	/*--ɬ�ð����̻�ë  ��  ��--*/
	if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
		print("NPC_janken Init: GetArgStrErr");
		return ;
	}


	switch( num)
	{
	  case 0:

	  	/*-- �������������������⻥  ��ľ�ɾ޷¡�  �� --*/
		if(NPC_Util_GetStrFromStrWithDelim( argstr, "MainMsg", token, sizeof( token))	== NULL)
		{
			print("Janken:MainMsg:%s", CHAR_getChar( meindex, CHAR_NAME));
			return ;
		}

  		/*--��      --*/
	  	buttontype = WINDOW_BUTTONTYPE_YESNO;
	  	windowtype = WINDOW_MESSAGETYPE_MESSAGE;
	  	windowno = CHAR_WINDOWTYPE_JANKEN_START; 
	  	break;
	
	
	case 1:
		
		//ʧ��  ة����������
		if(NPC_Util_GetStrFromStrWithDelim( argstr, "EntryItem", buf, sizeof( buf))!= NULL) {
	
			if(NPC_JankenEntryItemCheck(talker,buf) == FALSE)
			{
				NPC_Janken_selectWindow(meindex, talker, 3);
			}

			//�޼������ü�ʧ��  ةë����
			if(NPC_JankenEntryItemDel(talker,buf) == FALSE){
				print("Ԫ��������ERR:ʧ��  ة���Ʊ���������");
			}
		}


		/*--��      --*/
		sprintf(token,"              ����ʯͷ������\n"
			      "\n\n               ��  ʯͷ  ��"
			      "\n\n               ��  ����  ��"
				  "\n\n               ��  ��  ��"
		);

		buttontype=WINDOW_BUTTONTYPE_NONE;
		windowtype=WINDOW_MESSAGETYPE_SELECT;
	  	windowno=CHAR_WINDOWTYPE_JANKEN_MAIN; 
	  break;

	case 2:
		/*--ؤ�г�      --*/
		//sprintf(token,"              ؤ�г�ƥ���\n"
		sprintf(token,"              ƽ����������\n"
			      "\n\n               ��  ʯͷ  ��"
			      "\n\n               ��  ����  ��"
				  "\n\n               ��  ��  ��"
		);

	  	buttontype=WINDOW_BUTTONTYPE_NONE;
	  	windowtype=WINDOW_MESSAGETYPE_SELECT;
 		windowno=CHAR_WINDOWTYPE_JANKEN_MAIN; 
	  	break;

  	case 3:
	  	/*-- �������������������⻥  ��ľ�ɾ޷¡�  �� --*/
		NPC_Util_GetStrFromStrWithDelim( argstr, "NoItem", token, sizeof( token));

	  	buttontype=WINDOW_BUTTONTYPE_OK;
	  	windowtype=WINDOW_MESSAGETYPE_MESSAGE;
  		windowno=CHAR_WINDOWTYPE_JANKEN_END; 

  	break;

	}


//	makeEscapeString( token, escapedname, sizeof(escapedname));
	/*-���ƥ˪������--*/
	lssproto_WN_send( fd, windowtype, 
					buttontype, 
					windowno,
					CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
					token);



}
예제 #17
0
파일: npc_mic.c 프로젝트: Nurarihyo/smo-sa
void NPC_MicTalked( int meindex , int talkerindex , char *msg ,int color )
{

	int	i;
    	int     playernum;
	int	x,y;
	char	message[4096];
	char	buf[2048];	

   	if( CHAR_getInt(talkerindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return;
	if(CHAR_getWorkInt(meindex,CHAR_WORK_TYPE) == 0){
		if(NPC_Util_isFaceToChara(talkerindex,meindex,1 ) ==FALSE) return;
	}
		
	snprintf( buf, sizeof( buf), "%s\n%s",
				CHAR_getChar( talkerindex, CHAR_NAME),
				msg);
	
	// Robin 0621 族長廣播
	print(" MIC_FL:%d ", CHAR_getWorkInt( meindex, CHAR_WORK_FMFL ));
	if( CHAR_getWorkInt( meindex, CHAR_WORK_FMFL ) != 0 )
	{
#ifdef _FMVER21	
		if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER) 
#else
		if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == 1) 
#endif		
		    // && ( CHAR_getWorkInt( talkerindex, CHAR_WORKFMFLOOR) == CHAR_getWorkInt( meindex, CHAR_WORK_FLOOR ) ) )
		{
			print(" FMLeaderTalk_send:%s,%d,%d,%s ",
				CHAR_getChar( talkerindex, CHAR_FMNAME), CHAR_getInt( talkerindex, CHAR_FMINDEX),
				CHAR_getWorkInt( talkerindex, CHAR_WORKFMINDEXI), buf);
			
			sprintf(message, "[族長廣播]%s", buf);
			saacproto_ACFMAnnounce_send( acfd, 
						CHAR_getChar( talkerindex, CHAR_FMNAME), 
						CHAR_getInt( talkerindex, CHAR_FMINDEX),
						CHAR_getWorkInt( talkerindex, CHAR_WORKFMINDEXI),
						message,
						color
					);
			return;
		}
	    	
	}
	    	
	makeEscapeString( buf, message, sizeof(buf));

	playernum = CHAR_getPlayerMaxNum();

	for( i = 0; i < playernum; i ++ ) {
		BOOL flg = FALSE;
	        if( CHAR_getCharUse(i) == FALSE ) continue;
            	if( CHAR_getInt( i, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) continue;
		if( CHAR_getInt( i, CHAR_FLOOR) != CHAR_getWorkInt( meindex, CHAR_WORK_FLOOR) ){
			continue;
		}
		if( CHAR_getWorkInt( meindex, CHAR_WORK_MODE) == 0 ) {
			x = CHAR_getInt( i, CHAR_X);
			y = CHAR_getInt( i, CHAR_Y);
			if( x >= CHAR_getWorkInt( meindex, CHAR_WORK_LX) && 
				x <= CHAR_getWorkInt( meindex, CHAR_WORK_RX) &&
				y >= CHAR_getWorkInt( meindex, CHAR_WORK_LY) &&
				y <= CHAR_getWorkInt( meindex, CHAR_WORK_RY)){
				flg = TRUE;
			}
		}else {
			flg = TRUE;
		}
		if( flg) {
			CHAR_talkToCli( i, talkerindex, msg, CHAR_COLORYELLOW);
			if( CHAR_getWorkInt( meindex, CHAR_WORK_WIND) == 1 ) {
				if( CHAR_getWorkInt( i, CHAR_WORKBATTLEMODE) 
					== BATTLE_CHARMODE_NONE) 
				{
					int fd = getfdFromCharaIndex( i);
					if( fd != -1 ) {
						lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
										WINDOW_BUTTONTYPE_OK, 
										CHAR_WINDOWTYPE_MICMESSAGE,
										CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
										message);
					}
				}
			}
		}
	}
}
예제 #18
0
static void NPC_NewNpcMan_selectWindow( int meindex, int toindex, int num, int flg)
{
	char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];
	char token[256];

	int buttontype = 0, windowtype = 0, windowno = 0;
	int fd = getfdFromCharaIndex( toindex);

	windowtype = WINDOW_MESSAGETYPE_MESSAGE;

	if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) {
		if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE)
			return;
	}

	memset( npcarg, 0, sizeof( npcarg));
	if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){
		return;
	}

	memset( token, 0, sizeof( token));
	switch( num)	{
	case WINDOW_START:
		if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) {
			return;
		}
		buttontype = WINDOW_BUTTONTYPE_YESNO;
		windowno = NPC_PROGRAMEGINEER_DEFIND;
		break;
	case WINDOW_SELECT1:
		sprintf(token,"              ÇëÑ¡Ôñ"
			      "\n             ¡¶ÐÞÕý³èÎïÒì³£¡·"
				  "\n             ¡¶ÐÞÕý³èÎïͼºÅ¡·"
			      "\n              ¡¶¸ü»»ÁéÁ¦îø¡·"
#ifdef _PET_LOSTPET
				  "\n             ¡¶Áì»ØÒÅʧ³èÎï¡·"
#endif
//				  "\n            ¡¶»¹Ô­ÌúǹÈþ¶Ñµþ¡·"

				  );
		windowtype = WINDOW_MESSAGETYPE_SELECT;
		buttontype = WINDOW_BUTTONTYPE_CANCEL;
		windowno = NPC_PROGRAMEGINEER_SELECT2;
		break;
	case WINDOW_SELECT2:
		switch( flg){
		case 1://ÐÞÕý³èÎïÒì³£
			NPC_reCheckMyPetUnusual( meindex, toindex);
			CHAR_talkToCli( toindex, -1, "ÉíÉϳèÎï¼ì²éÍê±Ï!", CHAR_COLORYELLOW);
			return;
			break;
		case 2://ÐÞÕý³èÎïͼºÅ
			CHECK_PETBBI( toindex);
			return;
			break;
		case 3://¸ü»»ÁéÁ¦îø
			if( CHECK_ITEMEQUIT( toindex) == TRUE ){
				CHAR_talkToCli( toindex, -1, "¼ì²éÍê±Ï!", CHAR_COLORYELLOW);
			}
			return;
			break;

		case 4:
#ifdef _PET_LOSTPET
			if( NPC_reFindMyLostPet( meindex, toindex, token) == FALSE ){
				CHAR_talkToCli( toindex, -1, "²éÎÞ×ÊÁÏ£¡", CHAR_COLORYELLOW);
				return;
			}
			windowtype = WINDOW_MESSAGETYPE_SELECT;
			buttontype = WINDOW_BUTTONTYPE_CANCEL;
			windowno = NPC_PROGRAMEGINEER_SELECTLOSTPET;
#endif
			break;
		case 5: //»¹Ô­ÌúǹÈþ¶Ñµþ
//			NPC_reCheckItemPilenum( meindex, toindex);
			return;
			break;
		}
		break;
/*
	case WINDOW_SELECT3:
			{
				int petnum, petindex;
				petnum = atoi( data)-1;
				if( petnum >= CHAR_MAXPETHAVE || petnum < 0 ) return;
				petindex = CHAR_getCharPet( talker, petsel);
				if( !CHAR_CHECKINDEX(petindex) ) return;
				break;
			}
*/
	case WINDOW_SELECTLOSTPET:
#ifdef _PET_LOSTPET
		{
			int ret, i, ti, ltime, cost;
			Char ch;
			char msgbuf[256];
			char petstring1[2048];

			int havepetelement = CHAR_getCharPetElement( toindex);
			ti = flg;
			if( havepetelement < 0 ){
				CHAR_talkToCli( toindex, -1, "³èÎïÀ¸Î»ÒÑÂú£¡", CHAR_COLORYELLOW);
				return;
			}
			if( NPC_getLostPetString( meindex, toindex) == FALSE ) {
				CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW);
				return;
			}

			if( getStringFromIndexWithDelim( petstring[ti-1], "#", 2, petstring1, sizeof( petstring1)) == FALSE ){
				CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW);
				return;	
			}else{
				char buf1[256];
				if( getStringFromIndexWithDelim( petstring[ti-1], "|", 6, buf1, sizeof( buf1)) == FALSE ) return;
					ltime = atoi(buf1);
					ltime = time( NULL) - ltime;
					ltime = ltime/(60*60*24);
				if( getStringFromIndexWithDelim( petstring[ti-1], "|", 4, buf1, sizeof( buf1)) == FALSE ) return;
					cost = atoi( buf1);
#if 0	// ÐÞÕý±£Êͽð
				cost = cost + (ltime*100);
				cost = (cost>10000)?10000:cost;
#else
				cost = cost + (ltime*10000);
#endif
				if( CHAR_getInt( toindex, CHAR_GOLD) < cost ) {
					sprintf( buf1, "³èÎïÒѼķÅ%dÌ죬¹²Ðè%dʯ±Ò²Å¿ÉÁì»Ø¡£", ltime, cost);
					CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW);
					return;	
				}
			}


			ret = CHAR_makePetFromStringToArg( petstring1, &ch, -2);
			strcpy( petstring[ti-1], "");
			if( ret ) {
				char buf1[256];
				int petindex = PET_initCharOneArray( &ch );
				if( !CHAR_CHECKINDEX( petindex) ){
					CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW);
					return;
				}
				print("ANDY petindex:%d[%s]\n", petindex, CHAR_getChar( petindex, CHAR_NAME) );

				CHAR_complianceParameter( petindex );
				CHAR_setInt( petindex, CHAR_HP, CHAR_getWorkInt( petindex, CHAR_WORKMAXHP));
				CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, toindex);
				CHAR_setCharPet( toindex, havepetelement, petindex);
				CHAR_setChar( petindex, CHAR_OWNERCDKEY,
							CHAR_getChar( toindex, CHAR_CDKEY));
				CHAR_setChar( petindex, CHAR_OWNERCHARANAME,
							CHAR_getChar( toindex, CHAR_NAME));

				if( NPC_backupLostPetString( toindex) == FALSE ){
					print("ANDY err backup petstring !!\n");
					return;
				}
				
				sprintf( buf1, "LostPGet:%d", cost);
				LogPet(
					CHAR_getChar( toindex, CHAR_NAME ),
					CHAR_getChar( toindex, CHAR_CDKEY ),
					CHAR_getChar( petindex, CHAR_NAME),
					CHAR_getInt( petindex, CHAR_LV),
					buf1,
					CHAR_getInt( toindex,CHAR_FLOOR),
					CHAR_getInt( toindex,CHAR_X ),
					CHAR_getInt( toindex,CHAR_Y ),
					CHAR_getChar( petindex, CHAR_UNIQUECODE)   // shan 2001/12/14
				);
				sprintf( buf1, "ÁìÈ¡³èÎï%s¡£", CHAR_getUseName( petindex));
				CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW);
				for( i = 0; i < CHAR_MAXPETHAVE; i++){
					int petindex = CHAR_getCharPet( toindex, i);
					if( !CHAR_CHECKINDEX( petindex) )
						continue;
					CHAR_complianceParameter( petindex );
					snprintf( msgbuf, sizeof( msgbuf ), "K%d", i );
					CHAR_sendStatusString( toindex, msgbuf );
					snprintf( msgbuf, sizeof( msgbuf ), "W%d", i );
					CHAR_sendStatusString( toindex, msgbuf );
				}
				CHAR_DelGold( toindex, cost);
			}else{
					CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW);
					return;
			}
			return;
 		}
#endif
		return;
		break;
	case WINDOW_DEFIND:
		{
			int i;
			int face = CHAR_getInt( toindex, CHAR_FACEIMAGENUMBER);
			if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECK_MSG", token, sizeof( token) ) == NULL) {
				return;
			}
			for( i=0; i<48; i++){
				if( face >= checkPc[i][0] && face < checkPc[i][1] )
					break;
			}
			if( i >= 48 )return;
			CHAR_setWorkInt( toindex, CHAR_WORKNPCMETAMO, meindex);
			CHAR_setInt( toindex, CHAR_BASEIMAGENUMBER, checkPc[i][2]);
			CHAR_complianceParameter( toindex );
			CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX ));
			CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER);

			buttontype = WINDOW_BUTTONTYPE_YESNO;
			windowno = NPC_PROGRAMEGINEER_END;
		}
		break;
	case WINDOW_END:
		{
			CHAR_setWorkInt( toindex, CHAR_WORKNPCMETAMO, -1);
			CHAR_setInt( toindex, CHAR_BASEBASEIMAGENUMBER,
				CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) );

			CHAR_complianceParameter( toindex );
			CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX ));
			CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER);
			return;
		}
		break;
	}

	lssproto_WN_send( fd, windowtype, buttontype, windowno,
		CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token);
}
예제 #19
0
/*
 *���Ҽ�������  ��
 */
void NPC_JnakenJudge(int meindex,int talker,int sel)
{
	int player=-1;
	int jankenman;
	char j_char[3][8]={" ʯͷ "," ���� ","  ��  "};
	char token[1024];
	int shouhai = 0;
	int fd = getfdFromCharaIndex( talker);
	int fl=0,x=0,y=0;
	
	
	if(sel == 3) player = 0; //���
	if(sel == 5) player = 1; //����ƽ
	if(sel == 7) player = 2; //�ɡ�

	jankenman = rand()%3;

	switch(jankenman){
		case 0:
			if(player == 2){
				shouhai = 1;
			}else if(player == 1){
				shouhai = 2;
			}
		break;
		
		case 1:
			if(player == 0){
				shouhai = 1;
			}else if(player == 2){
				shouhai = 2;
			}
		break;
		
		case 2:
			if(player == 1){
				shouhai = 1;
			}else if(player == 0){
				shouhai = 2;
			}
		break;
	}

	if(shouhai == 1){
		//Change add ��Ҳ�ʤ�˸��ĵ���
		NPC_JankenItemGet( meindex, talker, "WinItem" );

		 NPC_WarpPointGet(meindex, talker, &fl, &x, &y, 0);
		
		snprintf( token, sizeof( token ) ,
						"              ������  ������      \n\n"
						"  %16s      %-16s\n"
						"        [%s]    VS    [%s]\n\n\n"
						"      %-16s ʤ��",
						 CHAR_getChar(meindex,CHAR_NAME),CHAR_getChar(talker,CHAR_NAME),
						 j_char[jankenman],j_char[player],
						 CHAR_getChar(talker,CHAR_NAME)
						);

//			    CHAR_talkToCli( talker , -1 ,token , CHAR_COLORCYAN );

				//������
			    CHAR_warpToSpecificPoint(talker, fl, x, y);
			    
			    //  �������巴�����٣���ʧ�������ë���£�
			    CHAR_sendWatchEvent( CHAR_getWorkInt( talker, CHAR_WORKOBJINDEX),	CHAR_ACTPLEASURE,NULL,0,TRUE);
				CHAR_setWorkInt( talker, CHAR_WORKACTION, CHAR_ACTPLEASURE);

	}else if(shouhai == 2){

		//Change add ��Ҳ����˸��ĵ���
		NPC_JankenItemGet( meindex, talker, "LoseItem" );

		 NPC_WarpPointGet(meindex, talker, &fl, &x, &y, 1);
		snprintf( token, sizeof( token ) ,
						"              ������  ������      \n\n"
						"  %16s      %-16s\n"
						"        [%s]    VS    [%s]\n\n\n"
						"      %-16s ����",
						 CHAR_getChar(meindex,CHAR_NAME),CHAR_getChar(talker,CHAR_NAME),
						 j_char[jankenman],j_char[player],
						 CHAR_getChar(talker,CHAR_NAME)
						);
//			    CHAR_talkToCli( talker , -1 ,token , CHAR_COLORCYAN );

				//������
				CHAR_warpToSpecificPoint(talker, fl, x, y);

				//  �������巴��  ���У�ʧ�������ë����
			    CHAR_sendWatchEvent( CHAR_getWorkInt( talker, CHAR_WORKOBJINDEX),	CHAR_ACTSAD,NULL,0,TRUE);
				CHAR_setWorkInt( talker, CHAR_WORKACTION, CHAR_ACTSAD);


	}else{
		//����������ؤ�г�
		NPC_Janken_selectWindow( meindex, talker, 2);
		return;
	}
	
	//˪��
	lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, 
					WINDOW_BUTTONTYPE_OK, 
					CHAR_WINDOWTYPE_JANKEN_END,
					CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
					token);


	
}
예제 #20
0
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;
}
예제 #21
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,"       哎呀!你受傷了嗎?   "
				  "\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);

}
예제 #22
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);

}
예제 #23
0
static void NPC_VipShop_selectWindow( int meindex, int toindex, int num,int select)
{
	char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];
	char token[256];
	char buf1[256];
	char buf2[256];
	char buf3[256];
	int buttontype = 0, windowtype = 0, windowno = 0;
	int fd = getfdFromCharaIndex( toindex);
	static int select1;
	windowtype = WINDOW_MESSAGETYPE_MESSAGE;

	if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) {
		if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE)
			return;
	}

	memset( npcarg, 0, sizeof( npcarg));
	if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){
		print("VipShop_MAN: GetArgStrErr!!");
		return;
	}
	memset( token, 0, sizeof( token));

	switch( num)	{
	case WINDOW_START:
		if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) {
			print("VipShop Get START_MSG ERROR !");
			return;
		}
		CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START);
		buttontype = WINDOW_BUTTONTYPE_YESNO;
		windowno = NPC_TRANSERMAN_SELECT;
		break;
	case WINDOW_SELECT:
		CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, 0);
		page=VipShop_ShowMenulist(npcarg);
		if( VipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE )	{
			print( "VipShop GetMenu ERROR !!");
			return;
		}
		windowtype = WINDOW_MESSAGETYPE_SELECT;
		if(page>1)
			buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT;
		else
			buttontype = WINDOW_BUTTONTYPE_CANCEL;
		windowno = NPC_TRANSERMAN_WARP;
		break;
	case WINDOW_NEXT:
		if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)<=page)
			CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1);
		if( VipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE )	{
			print( "VipShop GetMenu ERROR !!");
			return;
		}
		windowtype = WINDOW_MESSAGETYPE_SELECT;
		if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1==page)
			buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV;
		else
			buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT;
		windowno = NPC_TRANSERMAN_WARP;
		break;
	case WINDOW_PREV:
		if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)>0)
			CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)-1);
		if( VipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE )	{
			print( "VipShop GetMenu ERROR !!");
			return;
		}
		windowtype = WINDOW_MESSAGETYPE_SELECT;
		if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)==0)
			buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT;
		else
			buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT;
		windowno = NPC_TRANSERMAN_WARP;
		break;
	case WINDOW_WARP:
		select1=CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)*7+select;
		CHAR_setWorkInt( toindex, CHAR_WORKLISTSELECT , select1);
		if( NPC_Util_GetStrFromStrWithDelim( npcarg, "END_MSG", buf1, sizeof( buf1) ) == NULL) {
			print("VipShop Get START_MSG ERROR !");
			return;
		}
		if(getStringFromIndexWithDelim( npcarg,"}",select1, buf2, sizeof( buf2)) != FALSE)
			NPC_Util_GetStrFromStrWithDelim( buf2, "MenuStr", buf3, sizeof( buf3));
		sprintf( token, "\n%s\n\n        %s\n",buf1, buf3);
		
		windowtype = WINDOW_MESSAGETYPE_MESSAGE;
		buttontype = WINDOW_BUTTONTYPE_YESNO;
		windowno = NPC_TRANSERMAN_END;
		break;
	case WINDOW_END:
		ActionNpc_CheckMenuFree( meindex, toindex, npcarg, CHAR_getWorkInt( toindex, CHAR_WORKLISTSELECT ));
		return;
		break;
	}

	lssproto_WN_send( fd, windowtype, buttontype, windowno,
		CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token);
}
예제 #24
0
/*------------------------------------------------------------
 * ¥Ñ¡¼  ¥£¤Ë  ¤í¤¦¤È¤¹¤ë¡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;
}
예제 #25
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);

}
예제 #26
0
파일: char_angel.c 프로젝트: BlueKarl/gmsv
int AngelCreate( int angelindex)
{
	int emptyitem1, emptyitem2;
	int angeltokenindex, herotokenindex;
	char msgbuf[1024]/*, nameinfo[1024]*/;
	int mindex, mission;
	char heroname[64];

	if( !CHAR_CHECKINDEX( angelindex))	return FALSE;

	print(" 天使答应了!! ");

	mindex = checkIfAngel( angelindex);
	if( mindex == -1 || missiontable[mindex].flag == MISSION_TIMEOVER ) {
		//print("\n ANGEL错误!!Table逾时或无资料??:%d ", angelindex );
		CHAR_talkToCli( angelindex, -1, "很抱歉,你太晚回答,已经逾时了。", CHAR_COLORYELLOW);

		sprintf( msgbuf, " 回答逾时或无资料 i:%d 使者:%s %s ", mindex, CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME));
		print( msgbuf);
		LogAngel( msgbuf);

		return FALSE;
	}

	if( missiontable[mindex].flag != MISSION_WAIT_ANSWER ) {
		print(" 旗标不符:%d ", missiontable[mindex].flag);
		return FALSE;
	}

	if( CHAR_findEmptyItemBoxNo( angelindex ) < 2 ){
		CHAR_talkToCli( angelindex, -1, "空间栏位不足。至少要有两个空道具栏位。", CHAR_COLORYELLOW);
		return TRUE;
	}

	getStringFromIndexWithDelim( missiontable[mindex].heroinfo, ":", 2, heroname, sizeof(heroname));

	angeltokenindex = ITEM_makeItemAndRegist( ANGELITEM );
	if( angeltokenindex != -1 ){
		/*if( ITEM_getInt( angeltokenindex, ITEM_TYPE) != ITEM_ANGELTOKEN) {
			print(" 制作使者信物失败 ");
			ITEM_endExistItemsOne( angeltokenindex);
			return;
		}*/

		//sprintf( nameinfo, "%s:%s", CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME ) );
		ITEM_setChar( angeltokenindex, ITEM_ANGELINFO, missiontable[mindex].angelinfo);
		ITEM_setChar( angeltokenindex, ITEM_HEROINFO, missiontable[mindex].heroinfo);
		sprintf( msgbuf, "%d", missiontable[mindex].mission);
		ITEM_setChar( angeltokenindex, ITEM_ANGELMISSION, msgbuf);
		//sprintf( msgbuf, "%s(%s)", ITEM_getChar( angeltokenindex, ITEM_NAME), CHAR_getChar( angelindex, CHAR_NAME ) );
		//ITEM_setChar( angeltokenindex, ITEM_NAME, msgbuf);
		//ITEM_setChar( angeltokenindex, ITEM_SECRETNAME, msgbuf);
		//sprintf( msgbuf, "这是使者 %s 与勇者 %s 专属的信物", CHAR_getChar( angelindex, CHAR_NAME), heroname );
		sprintf( msgbuf, "精灵使者 %s 的信物,装备後不遇敌。", CHAR_getChar( angelindex, CHAR_NAME) );
		ITEM_setChar( angeltokenindex, ITEM_EFFECTSTRING, msgbuf);

		emptyitem1 = CHAR_addItemSpecificItemIndex( angelindex, angeltokenindex);
		CHAR_sendItemDataOne( angelindex, emptyitem1);
		LogItem(
			CHAR_getChar( angelindex, CHAR_NAME ),
			CHAR_getChar( angelindex, CHAR_CDKEY ),
			angeltokenindex,
			"AddItem(制作道具 使者信物)",
			CHAR_getInt( angelindex,CHAR_FLOOR),
			CHAR_getInt( angelindex,CHAR_X ),
			CHAR_getInt( angelindex,CHAR_Y ),
			ITEM_getChar( angeltokenindex, ITEM_UNIQUECODE),
			ITEM_getChar( angeltokenindex, ITEM_NAME),
			ITEM_getInt( angeltokenindex, ITEM_ID) );
		CHAR_talkToCli( angelindex, -1,"得到使者的信物。", CHAR_COLORYELLOW);
	}else{
		print("制作使者的信物失败。" );
		return FALSE;
	}

	herotokenindex = ITEM_makeItemAndRegist( HEROITEM );
	if( herotokenindex != -1 ){
		/*if( ITEM_getInt( herotokenindex, ITEM_TYPE) != ITEM_HEROTOKEN) {
			print(" 制作勇者信物失败 ");
			ITEM_endExistItemsOne( herotokenindex);
			ITEM_endExistItemsOne( angeltokenindex);
			CHAR_sendItemDataOne( angelindex, emptyitem1);
			return;
		}*/
		//sprintf( nameinfo, "%s:%s", CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME ) );
		ITEM_setChar( herotokenindex, ITEM_ANGELINFO, missiontable[mindex].angelinfo);
		ITEM_setChar( herotokenindex, ITEM_HEROINFO, missiontable[mindex].heroinfo);
		sprintf( msgbuf, "%d", missiontable[mindex].mission);
		ITEM_setChar( herotokenindex, ITEM_ANGELMISSION, msgbuf);
		//sprintf( msgbuf, "%s(%s)", ITEM_getChar( herotokenindex, ITEM_NAME), heroname );
		//ITEM_setChar( herotokenindex, ITEM_NAME, msgbuf);
		//ITEM_setChar( herotokenindex, ITEM_SECRETNAME, msgbuf);
		//sprintf( msgbuf, "这是勇者 %s 与使者 %s 专属的信物", heroname, CHAR_getChar( angelindex, CHAR_NAME) );
		sprintf( msgbuf, "勇者 %s 的信物,使者使用可传送至勇者身边。", heroname );
		ITEM_setChar( herotokenindex, ITEM_EFFECTSTRING, msgbuf);

		emptyitem2 = CHAR_addItemSpecificItemIndex( angelindex, herotokenindex);
		CHAR_sendItemDataOne( angelindex, emptyitem2);
		LogItem(
			CHAR_getChar( angelindex, CHAR_NAME ),
			CHAR_getChar( angelindex, CHAR_CDKEY ),
			herotokenindex,
			"AddItem(制作道具 勇者信物)",
			CHAR_getInt( angelindex,CHAR_FLOOR),
			CHAR_getInt( angelindex,CHAR_X ),
			CHAR_getInt( angelindex,CHAR_Y ),
			ITEM_getChar( herotokenindex, ITEM_UNIQUECODE),
			ITEM_getChar( herotokenindex, ITEM_NAME),
			ITEM_getInt( herotokenindex, ITEM_ID) );
		CHAR_talkToCli( angelindex, -1,"得到勇者的信物。", CHAR_COLORYELLOW);
	}else{
		print("制作勇者的信物失败。" );
		ITEM_endExistItemsOne( angeltokenindex);
		CHAR_sendItemDataOne( angelindex, emptyitem1);
		return FALSE;
	}

	// 更新至AC Server
	//sprintf( nameinfo, "%s:%s", CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME ) );
	sprintf( msgbuf, "%s|%d", missiontable[mindex].angelinfo, missionlist[missiontable[mindex].mission].limittime );
	saacproto_ACMissionTable_send( acfd, MISSION_DOING, 4, msgbuf, "");

	//CHAR_talkToCli( angelindex, -1, "天之声:非常感谢你答应帮忙,那我就将信物交给你了,请将勇者的信物转交给勇者。", CHAR_COLORYELLOW);

	lssproto_WN_send( getfdFromCharaIndex(angelindex), WINDOW_MESSAGETYPE_MESSAGE,
			WINDOW_BUTTONTYPE_YES, -1, -1,
			"非常感谢你答应帮忙,那我就将信物交给你了,请将勇者的信物转交给勇者。");

	sprintf( msgbuf, " 使者答应帮忙了 i:%d 使者:%s 勇者:%s ci=%d ", mindex, missiontable[mindex].angelinfo, missiontable[mindex].heroinfo, angelindex);
	print( msgbuf);
	LogAngel( msgbuf);

	return FALSE;
}
예제 #27
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)
예제 #28
0
static void NPC_FMPKMan_selectWindow( int meindex, int toindex, int num,int select)
{
    char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];
    char token[1024], buf[256], buf2[256];
    int buttontype = 0, windowtype = 0, windowno = 0;
    int fd = getfdFromCharaIndex(toindex);
    int num1 = 0, num2 = 0;
    int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID) * MAX_SCHEDULE;

    if( fd == -1 ) {
        print( "getfd err\n");
        return;
    }

    if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL) {
        print("GetArgStrErr");
        return ;
    }
    /*--ɬ�ð����̻P  ��׷�ʧ���ѻ�϶�ý�ľ�����¾���ľ����ľ�ɰ׷�ʧ���Ѽ��Ի����*/
    if(strstr(npcarg,"%4d")!=NULL) {
        int work;
        NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf));
        getStringFromIndexWithDelim(buf,",",1,buf2,sizeof(buf2));
        work = atoi( buf2);
    }

    token[0] = '\0';

    switch(num) {
    //   �ټ���ū������
    case 0:
        if(NPC_Util_GetStrFromStrWithDelim( npcarg, "MainMsg", buf,
                                            sizeof( buf)) == NULL)
            return;
        sprintf(token, "3\n����    ���������У˳���\n"
                "%s"
                "\n           �� �쿴˫������ ��"
                "\n            �� �뿪�У˳� ��",
                buf);
        buttontype = WINDOW_BUTTONTYPE_NONE;
        windowtype = WINDOW_MESSAGETYPE_SELECT;
        windowno = CHAR_WINDOWTYPE_FMPKMAN_START;
        break;
    case 1:
        if(NPC_Util_GetStrFromStrWithDelim(npcarg, "ViewMsg", buf,
                                           sizeof(token)) == NULL)
            return;
        NPC_GetPKFMNum(CHAR_getInt(toindex, CHAR_FLOOR),
                       fmpks[fmpks_pos].host_index,
                       fmpks[fmpks_pos].guest_index,
                       &num1, &num2);
        /*
        	  	print("host:%s guest:%s hostindex:%d guestindex:%d\n",
        	  		fmpks[fmpks_pos].host_name,
        	  		fmpks[fmpks_pos].guest_name,
        	  		fmpks[fmpks_pos].host_index,
        	  		fmpks[fmpks_pos].guest_index);
        */
        sprintf(token, "\n%s\n\n%s:%4d��\n\n%s:%4d��", buf,
                fmpks[fmpks_pos].host_name, num1,
                fmpks[fmpks_pos].guest_name, num2);
        buttontype = WINDOW_BUTTONTYPE_OK;
        windowtype = WINDOW_MESSAGETYPE_MESSAGE;
        windowno =  CHAR_WINDOWTYPE_FMPKMAN_VIEW;
        break;
    case 2:
        if(NPC_Util_GetStrFromStrWithDelim(npcarg, "LeavepkMsg", token,
                                           sizeof(token)) == NULL)
            return;

        buttontype = WINDOW_BUTTONTYPE_YESNO;
        windowtype = WINDOW_MESSAGETYPE_MESSAGE;
        windowno =  CHAR_WINDOWTYPE_FMPKMAN_LEAVEPK;
        break;
    default:
        break;
    }

    /*--�޵�������--*/
    //makeEscapeString( token, escapedname, sizeof(escapedname));


    /*--˪��--*/
    lssproto_WN_send( fd, windowtype,
                      buttontype,
                      windowno,
                      CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
                      token);

}
예제 #29
0
static void NPC_WarpMan_selectWindow( int meindex, int toindex, int num,int select)
{
	
	char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20];
	char token[1024];
	char buf[256];
	char buf2[1024];
	char buf3[256];
	int fl=0	;
	int money=100	;
	int fd = getfdFromCharaIndex( toindex);
	char tmp[64];

	if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){
		print("GetArgStrErr");
		CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0);
		return ;
	}

        if(NPC_PARTY_CHAECK( meindex, toindex) == FALSE)	{
		    NPC_ERR_DiSP( meindex, toindex, 1);
		    return;
		}


	if( CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT) != 0 )	{
		return;
	}else	{
		CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 1);
	}

	if(strstr(npcarg,"%4d")!=NULL){
		int flwork = 0;
		int work;
		NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf));
		getStringFromIndexWithDelim(buf,",",1,buf3,sizeof(buf3));
		work = atoi( buf3);
		fl = NPC_FloorUse( toindex, atoi(buf3));		

		if(NPC_Util_GetStrFromStrWithDelim( npcarg, "Floor", buf3, sizeof( buf3)) != NULL){
			flwork = NPC_FloorUseOtherFloor(work, buf3);
		}
		fl = fl +flwork;
	}

	NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf, sizeof( buf));

	if( (NPC_ActionPassCheck(meindex,toindex,buf)==TRUE) || (strstr(buf,"ALLFREE")!=NULL) ){
		if(NPC_Util_GetStrFromStrWithDelim( npcarg, "FreeMsg", buf2, sizeof( buf2))==NULL) return;
		      CONNECT_set_pass(fd,TRUE);
		      CONNECT_set_first_warp(fd,TRUE);
		if(strstr(buf2,"%4d") != NULL){
			sprintf(token,buf2,fl);
		}else{
			strcpy(token,buf2);
		}
		CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANTTRD , -1 );
		CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 2);
	}else	{
		if(NPC_Util_GetStrFromStrWithDelim( npcarg, "PayMsg", buf2, sizeof( buf2)) != NULL){
		       CONNECT_set_pass(fd,FALSE);
		       CONNECT_set_first_warp(fd,FALSE);
			if(strstr(buf2,"%8d") != NULL){
				NPC_Util_GetStrFromStrWithDelim( npcarg, "MONEY", tmp, sizeof( tmp));
				if(strstr(tmp,"LV")!=NULL){
					int level;
					char buff2[32];
						
					level = CHAR_getInt(toindex,CHAR_LV);
					getStringFromIndexWithDelim(tmp,"*",2,buff2,sizeof(buff2));
					money = level*atoi(buff2);
				}else{
					money=atoi(tmp);
				}
				if(strstr(buf2,"%4d") != NULL){
					sprintf(token,buf2,fl,money);
				}else{
					sprintf(token,buf2,money);
				}
			}else if(strstr(buf2,"%4d") != NULL){
				sprintf(token,buf2,fl);
				NPC_Util_GetStrFromStrWithDelim( npcarg, "MONEY", tmp, sizeof( tmp));
				if( strstr( tmp,"-" ) != NULL){
					money=10000001;
					lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
								WINDOW_BUTTONTYPE_OK,
								CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, 
								CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
								token);
					return ;
				}
			}else{
				strcpy(token,buf2);
				NPC_Util_GetStrFromStrWithDelim( npcarg, "MONEY", tmp, sizeof( tmp));
				if( strstr( tmp,"-" ) != NULL){
					money=10000001;
					lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
								WINDOW_BUTTONTYPE_OK,
								CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, 
								CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
								token);
					return ;
				}else{
					money = atoi(tmp);
				}
			}
			if(CHAR_getInt(toindex,CHAR_FLOOR)==117){
			   money=CHAR_getInt(toindex,CHAR_GOLD);
			   if (money>=10) money*=0.9; 
			   else if( money == 0 ) {
				   CHAR_warpToSpecificPoint(toindex,117,225,13);
				   return;
			   }
			}
			CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANTTRD , money );
			CONNECT_set_pass(fd,TRUE);
			CONNECT_set_first_warp(fd,TRUE);
		
		}else if(NPC_Util_GetStrFromStrWithDelim( npcarg, "NomalMsg", token,sizeof(token)) !=NULL){
			CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANTTRD , -2 );
			CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, -1);
			lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
								WINDOW_BUTTONTYPE_OK,
								CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, 
								CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
								token);
		}
	}
	lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
						WINDOW_BUTTONTYPE_YESNO,
						CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, 
						CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
						token);
}
예제 #30
0
BOOL NPC_PetSkillMakeStr(int meindex,int toindex,int select)
{

	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char msg[256];
	double rate=1.0;
	int i=0;
	char token[NPC_UTIL_GETARGSTR_LINEMAX];
	int fd = getfdFromCharaIndex( toindex);

	if(select==0){
		sprintf(token,"0|0");
		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_PETSKILLSHOP, 
			WINDOW_BUTTONTYPE_NONE, 
			CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP,
			CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
			token);
		
	}

	if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
		print("GetArgStrErr");
		return FALSE;
	}

	if( NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", msg, sizeof( msg)) == NULL){
		print("mainERR");
		return FALSE;
	}

	sprintf(token,"1|%s|%s",
	CHAR_getChar(meindex,CHAR_NAME),msg);
		
	if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){
		rate=atof(msg);
	}

		
	if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg) ) != NULL){
		int skillarray;
		int skillID;
		int cost;
		char token2[265];
		char buf[64];

		i=1;
	    while( getStringFromIndexWithDelim(msg,",",i,buf,sizeof(buf)) !=FALSE ){
			i++;
			skillID=atoi(buf);
			skillarray = PETSKILL_getPetskillArray( skillID);

			if( PETSKILL_CHECKINDEX( skillarray) == FALSE )
				continue;
			if( PETSKILL_getInt( skillarray, PETSKILL_ILLEGAL) == 1) continue;
			cost = PETSKILL_getInt(skillarray,PETSKILL_COST);
			cost = (int)cost*rate;
#ifdef _SA80
			sprintf(token2,"|%s|%d|%s|0",	PETSKILL_getChar(skillarray, PETSKILL_NAME), 
															cost, PETSKILL_getChar(skillarray, PETSKILL_COMMENT));
#else
			sprintf(token2,"|%s|%d|%s",	PETSKILL_getChar(skillarray, PETSKILL_NAME), 
															cost, PETSKILL_getChar(skillarray, PETSKILL_COMMENT));
#endif
			strcat(token,token2);
			}
		}
		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_PETSKILLSHOP, 
				WINDOW_BUTTONTYPE_NONE, 
				CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP,
				CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
				token);
	return TRUE;
}