void NPC_EndEventSetFlgCls(int talker,int shiftbit) { int point=0; int array; int shift; if(shiftbit==-1) return; if(shiftbit<=255){ array = shiftbit / 32; shift = shiftbit % 32; if(NPC_NowEventCheckFlg(talker,shiftbit)==TRUE){ point = CHAR_getInt( talker, CHAR_NOWEVENT+array); point = point ^ (1<<shift); CHAR_setInt(talker,CHAR_NOWEVENT+array,point); } if(NPC_EventCheckFlg(talker,shiftbit)==TRUE){ point = CHAR_getInt( talker, CHAR_ENDEVENT+array); point = point ^ (1<<shift); CHAR_setInt(talker,CHAR_ENDEVENT+array,point); } } else if(shiftbit<=510){ array = (shiftbit-255) / 32; shift = (shiftbit-255) % 32; if(NPC_NowEventCheckFlg(talker,shiftbit)==TRUE){ point = CHAR_getInt( talker, CHAR_NOWEVENT9+array); point = point ^ (1<<shift); CHAR_setInt(talker,CHAR_NOWEVENT9+array,point); } if(NPC_EventCheckFlg(talker,shiftbit)==TRUE){ point = CHAR_getInt( talker, CHAR_ENDEVENT9+array); point = point ^ (1<<shift); CHAR_setInt(talker,CHAR_ENDEVENT9+array,point); } } }
BOOL NPCS_ArgumentFreeCheck( int charaindex, char* Argument, int amount, int temp, int probjID) {//amount 數量 Argument 參數 int MyPoint=0, reAmount; reAmount = 0; if( strcmp( Argument, "LV") == 0) {//等級 MyPoint = CHAR_getInt( charaindex, CHAR_LV); }else if( strcmp( Argument, "GOLD") == 0) {//石幣 MyPoint = CHAR_getInt( charaindex, CHAR_GOLD); }else if( strcmp( Argument, "TRANS") == 0) {//轉生次數 MyPoint = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION); }else if( strcmp( Argument, "PET") == 0) {//寵物 ID 數量 MyPoint = NPCS_getUserPetAmount( charaindex, probjID, 1); }else if( strcmp( Argument, "ITEM") == 0) {//道具 ID 數量 MyPoint = NPCS_getUserItemAmount( charaindex, probjID, 1); }else if( strcmp( Argument, "ENDEV") == 0) {//結束旗標 return NPC_EventCheckFlg( charaindex, amount); }else if( strcmp( Argument, "NOWEV") == 0) {//開啟旗標 return NPC_NowEventCheckFlg( charaindex, amount); }else if( strcmp( Argument, "PARTY") == 0) {//檢查團隊人數 MyPoint = NPCS_getUserPartyAmount( charaindex ); }else if( strcmp( Argument, "reITEM")== 0) {//剩餘道具欄位 NPCS_getUserItemAmount( charaindex, probjID, 0); MyPoint = reAmount; }else if( strcmp( Argument, "rePET") == 0) {//剩餘寵物欄位 NPCS_getUserPetAmount( charaindex, probjID, 0); MyPoint = reAmount; }else { } return NPCS_ArgumentBigSmallCheck( amount, MyPoint, temp); }
void PetTalk_RequestMain(int meindex,int talker,char *buf) { int shiftbit; char buf2[128]; if( NPC_Util_GetStrFromStrWithDelim( buf,"EventNo", buf2,sizeof( buf2) ) == NULL ) { print("\n pet_event.c err:NOT FIND [EventNo] !!"); return; } shiftbit = atoi( buf2); if( NPC_NowEventCheckFlg( talker, shiftbit) != TRUE ) { NPC_NowEventSetFlg( talker, shiftbit); } }
BOOL PetTalk_FreeIfCheck(int meindex,int talker,char* buf,int kosuu,int flg, int temp) { int Type = -1; if(strcmp(buf,"LV")==0){ if(PetTalk_LevelCheck(meindex,talker,kosuu,flg)==TRUE){ return TRUE; } } if( strcmp( buf, "TRANS") == 0 ) { if( PetTalk_CheckTrans( meindex, talker, kosuu, flg) == TRUE ) return TRUE; } if( strcmp( buf, "PET") == 0 ) { if( temp > 0 ) { if( PetTalk_CheckMyPet( meindex, talker, kosuu, flg, temp) == TRUE ) return TRUE; }else return FALSE; } if(strcmp( buf, "ITEM")==0){ if(PetTalk_ItemCheck(meindex,talker,kosuu,flg)==TRUE){ return TRUE; } } if(strcmp( buf, "ENDEV")==0){ if(NPC_EventCheckFlg( talker, kosuu)==TRUE){ return TRUE; } } if(strcmp( buf, "NOWEV")==0){ if(NPC_NowEventCheckFlg( talker, kosuu)==TRUE){ return TRUE; } } if(strcmp( buf, "HP" ) == 0 ) { Type = 0; if( PetTalk_CheckMyType( meindex, talker, kosuu, flg, Type ) == TRUE ) { return TRUE; } } #ifdef _PET_TALKBBI if(strcmp( buf, "BBI" ) == 0 ) { if( PET_CheckPlayerBBI( meindex, talker, kosuu, flg)== TRUE) { return TRUE; } } #endif return FALSE; }
/* *£ыƒћ√ђЉю–ю ∞„Ј¬Їл√Ђ√сƒб”јџЌ‘ ‘¬ */ int NPC_NowFlgCheck(int meindex,int talker ,int nowflg[MAXEVENTFLG]) { int i = 0; int j = 0; for(i= 0; i < MAXEVENTFLG ; i++){ if(NPC_NowEventCheckFlg( talker, i) == TRUE) { nowflg[j] = i; j++; } } return j; }
BOOL NPCEnemy_FreeIfCheck(int meindex,int talker,char* buf,int kosuu,int flg, int temp) { if(strcmp(buf,"LV")==0){ if(NPCEnemy_LevelCheck(meindex,talker,kosuu,flg)==TRUE){ return TRUE; } } if( strcmp(buf,"TRANS") == 0 ) { if( NPCEnemy_CheckTrans( meindex, talker, kosuu, flg) == TRUE ) return TRUE; } if( strcmp( buf, "PET") == 0 ) { if( temp > 0 ) { if( NPCEnemy_CheckMyPet( meindex, talker, kosuu, flg, temp) == TRUE ) return TRUE; }else return FALSE; } if(strcmp(buf,"ITEM")==0){ if(NPCEnemy_ItemCheck(meindex,talker,kosuu,flg)==TRUE){ return TRUE; } } if(strcmp(buf,"ENDEV")==0){ if(NPC_EventCheckFlg( talker, kosuu)==TRUE){ return TRUE; } } if(strcmp(buf,"NOWEV")==0){ if(NPC_NowEventCheckFlg( talker, kosuu)==TRUE){ return TRUE; } } return FALSE; }
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; }