/************************************** * 隙爛今木凶失奶 丞毛 勻化中月井民尼永弁允月 * 勻化中卅中午分戶 **************************************/ BOOL NPC_AirCheckAllowItem( int meindex, int charaindex, BOOL pickupmode) { char buf[1024]; BOOL found = TRUE; BOOL pickup = FALSE; char argstr1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *argstr; argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1)); if( NPC_Util_GetStrFromStrWithDelim( argstr, "pickupitem", buf, sizeof( buf)) != NULL ) { pickup = TRUE; } if( NPC_Util_GetStrFromStrWithDelim( argstr, "allowitem", buf, sizeof( buf)) != NULL ) { int i; int ret; for( i = 1; ; i ++) { int itemid; char buf2[64]; int j; BOOL getflg; ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2)); if( ret == FALSE ) break; itemid = atoi( buf2); getflg = FALSE; for( j = 0; j < CHAR_MAXITEMHAVE; j ++) { int itemindex = CHAR_getItemIndex( charaindex, j); if( ITEM_CHECKINDEX( itemindex)) { if( ITEM_getInt( itemindex, ITEM_ID) == itemid) { /* 橢瘀互繚勻化中月井日〕公及失奶 丞毛潸月 */ if( pickupmode && pickup && !getflg) { CHAR_DelItem( charaindex, j); getflg = TRUE; } break; } } } if( j == CHAR_MAXITEMHAVE) { found = FALSE; break; } } } return found; }
BOOL CHECK_ITEMEQUIT( int toindex) { int i, itemindex; char token[256]; for (i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++) { itemindex = CHAR_getItemIndex( toindex, i); if( ITEM_getInt( itemindex, ITEM_ID) == 19646 ){ CHAR_DelItem( toindex, i); itemindex = -1; itemindex = ITEM_makeItemAndRegist( 1292); if( !ITEM_CHECKINDEX( itemindex) ){ }else{ int ret = CHAR_addItemSpecificItemIndex( toindex, itemindex); if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { ITEM_endExistItemsOne( itemindex); continue; } sprintf( token,"Äõ½%s", ITEM_getChar( itemindex, ITEM_NAME)); CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW ); CHAR_sendItemDataOne( toindex, ret); continue; } } if( ITEM_getInt( itemindex, ITEM_ID) == 1292 && ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE) > 0 ){ ITEM_setInt( itemindex, ITEM_MAXDAMAGECRUSHE, 0); ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, 0); sprintf(token,"ÐÞÕý%sË𻵶È", ITEM_getChar( itemindex, ITEM_NAME)); CHAR_sendItemDataOne( toindex, i); CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); } } // ¼Ä·Åµê for (i = 0; i < CHAR_MAXPOOLITEMHAVE; i++) { if( ITEM_getInt( itemindex, ITEM_ID) == 1292 && ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE) > 0 ){ ITEM_setInt( itemindex, ITEM_MAXDAMAGECRUSHE, 0); ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, 0); sprintf(token,"ÐÞÕý¼Ä·ÅµêÖÐ%sË𻵶È", ITEM_getChar( itemindex, ITEM_NAME)); CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); } } return TRUE; }
BOOL NPC_PAItemShop_SellDo( int meindex, int toindex, char *npcarg, int select) { int itemindex = CHAR_getItemIndex( toindex , select ); if( ITEM_CHECKINDEX( itemindex) ){ int cost = ITEM_getInt( itemindex, ITEM_COST); saacproto_ACItemAuction_send( acfd, ITEM_getChar( itemindex, ITEM_NAME), "TEST嘿嘿嘿", ITEM_getInt( itemindex, ITEM_ID), 0/*ret*/,AUCTION_ADD); CHAR_DelItem( toindex, select); CHAR_AddGold( toindex, cost); }else { CHAR_talkToCli( toindex, -1, "沒有這樣物品!", CHAR_COLORYELLOW); return FALSE; } return TRUE; }
BOOL NPC_JankenEntryItemDel(int talker,char *buf) { int i = 1, j = 1,k = 1; char buff3[128]; char buf2[32]; int itemindex; while(getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ k++; if(strstr(buff3, "*") !=NULL){ int itemno; int kosuu; int id; int cnt=0; getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); itemno = atoi(buf2); getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); kosuu = atoi(buf2); for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ itemindex = CHAR_getItemIndex( talker , i ); if( ITEM_CHECKINDEX(itemindex) ){ id=ITEM_getInt(itemindex ,ITEM_ID ); if(itemno==id){ cnt++; LogItem( CHAR_getChar( talker, CHAR_NAME ), /* ƽ�ҷ� */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD ��item��log������item���� itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* ʧ�� ة į */ #endif "QuizDelItem(����->��������)", CHAR_getInt( talker, CHAR_FLOOR), CHAR_getInt( talker, CHAR_X ), CHAR_getInt( talker, CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, i); if(cnt == kosuu){ break; } } } } }else{ /*--���Ϸ� į��ʧ�� ةë����---*/ for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ itemindex = CHAR_getItemIndex( talker ,j); if( ITEM_CHECKINDEX(itemindex) ){ if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)){ LogItem( CHAR_getChar( talker, CHAR_NAME ), /* ƽ�ҷ� */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD ��item��log������item���� itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* ʧ�� ة į */ #endif "QuizDelItem(����->��������)", CHAR_getInt( talker,CHAR_FLOOR), CHAR_getInt( talker,CHAR_X ), CHAR_getInt( talker,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, j); } } } } } return TRUE; }
/* *еведе╞ердЄ║я╜№д╣ды */ BOOL NPC_EntryItemDel(int talker,char *buf) { int i = 1, j = 1,k = 1; char buff3[128]; char buf2[32]; int itemindex; while(getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ k++; if(strstr(buff3, "*") !=NULL){ int itemno; int kosuu; int id; int cnt=0; getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); itemno = atoi(buf2); getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); kosuu = atoi(buf2); for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ itemindex = CHAR_getItemIndex( talker , i ); if( ITEM_CHECKINDEX(itemindex) ){ id=ITEM_getInt(itemindex ,ITEM_ID ); if(itemno==id){ cnt++; LogItem( CHAR_getChar( talker, CHAR_NAME ), /* енеуещ╠╛ */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD жbitemк║logдд╝Wе[itemжW║┘ itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* еведе╞ер╚╓╣ц */ #endif "QuizDelItem(▓q┴╝->ецеXк║╣Dиу)", CHAR_getInt( talker, CHAR_FLOOR), CHAR_getInt( talker, CHAR_X ), CHAR_getInt( talker, CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, i); if(cnt == kosuu){ break; } } } } }else{ /*--┴кдєд└╚╓╣цд╬еведе╞ердЄ┴к╜╨---*/ for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ itemindex = CHAR_getItemIndex( talker ,j); if( ITEM_CHECKINDEX(itemindex) ){ if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)){ LogItem( CHAR_getChar( talker, CHAR_NAME ), /* енеуещ╠╛ */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD жbitemк║logдд╝Wе[itemжW║┘ itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* еведе╞ер╚╓╣ц */ #endif "QuizDelItem(▓q┴╝->╗тиьк║╣Dиу)", CHAR_getInt( talker,CHAR_FLOOR), CHAR_getInt( talker,CHAR_X ), CHAR_getInt( talker,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, j); } } } } } return TRUE; }
BOOL NPC_EntryItemDel(int talker,char *buf) { int i = 1, j = 1,k = 1; char buff3[128]; char buf2[32]; int itemindex; while(getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ) { k++; if(strstr(buff3, "*") !=NULL) { int itemno; int kosuu; int id; int cnt=0; getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); itemno = atoi(buf2); getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); kosuu = atoi(buf2); for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ) { itemindex = CHAR_getItemIndex( talker , i ); if( ITEM_CHECKINDEX(itemindex) ) { id=ITEM_getInt(itemindex ,ITEM_ID ); if(itemno==id) { cnt++; LogItem( CHAR_getChar( talker, CHAR_NAME ), /* ƽÅÒ·Â’o */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD ÔÚitemµÄlogÖÐÔö¼ÓitemÃû³Æ itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* ʧÄÌ·ºØ©?į */ #endif "QuizDelItem(²ÂÃÕ->½»³öµÄµÀ¾ß)", CHAR_getInt( talker, CHAR_FLOOR), CHAR_getInt( talker, CHAR_X ), CHAR_getInt( talker, CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, i); if(cnt == kosuu) { break; } } } } } else { for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++) { itemindex = CHAR_getItemIndex( talker ,j); if( ITEM_CHECKINDEX(itemindex) ) { if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)) { LogItem( CHAR_getChar( talker, CHAR_NAME ), /* ƽÅÒ·Â’o */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD ÔÚitemµÄlogÖÐÔö¼ÓitemÃû³Æ itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* ʧÄÌ·ºØ©?į */ #endif "QuizDelItem(²ÂÃÕ->Áìµ½µÄµÀ¾ß)", CHAR_getInt( talker,CHAR_FLOOR), CHAR_getInt( talker,CHAR_X ), CHAR_getInt( talker,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, j); } } } } } return TRUE; }
void PET_Talkfunc( int meindex, int talkerindex, char *msg, int color) { char buf2[1024], buf3[256]; char TalkType[][16]={"TALKRUN","EVENTRUN","BOTH"}; char AllTalk[PETTALK_MAXID][1024]; int Type=0,j,i; int talkNo=0; BOOL FREEs=FALSE; int buttontype = 0; int windowtype = 0; #ifdef _PET_TALKPRO int tPage=-1; #else int petid=-1; char tempNo[32], buf1[10240]; #endif int fd = getfdFromCharaIndex( talkerindex); #define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) windowtype = WINDOW_MESSAGETYPE_MESSAGE; buttontype = WINDOW_BUTTONTYPE_OK; if( NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { if( NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; } for( i = 0 ; i < 5 ; i++ ) { strcpy( AllTalk[i], "\0" ); } #ifdef _PET_TALKPRO for( i=0;i<PETTALK_MAXID;i++) { if( pettalktext[i].ID >=0 && pettalktext[i].ID == CHAR_getInt(meindex, CHAR_PETID) ) { if( strcmp( pettalktext[i].DATA, "\0") && strlen( pettalktext[i].DATA) > 0 ) { //snprintf( buf1, sizeof(buf1), pettalktext[i].DATA); tPage=i; break; } } } if( i == PETTALK_MAXID ) return; #else sprintf(tempNo,"%d", CHAR_getInt(meindex, CHAR_PETID)); petid = CHAR_getInt(meindex, CHAR_PETID); if( Pet_TalkGetFunStr( tempNo , buf1 , sizeof( buf1) ) == NULL ) { return; } #endif if( CHAR_getInt( meindex, CHAR_LV ) >= CHAR_getInt( meindex, CHAR_LIMITLEVEL) ) { Type = 1; } //设定为非主人不得与PET互动 if( strcmp( CHAR_getChar( meindex, CHAR_OWNERCDKEY), CHAR_getChar( talkerindex, CHAR_CDKEY) ) || strcmp( CHAR_getChar( meindex, CHAR_OWNERCHARANAME), CHAR_getChar( talkerindex, CHAR_NAME) )){ #ifdef _PET_TALKPRO if( NPC_Util_GetStrFromStrWithDelim( pettalktext[tPage].DATA, "NoPlayerMsg", buf3, sizeof( buf3)) != NULL ) { #else if( NPC_Util_GetStrFromStrWithDelim( buf1, "NoPlayerMsg", buf3, sizeof( buf3)) != NULL ) { #endif }else { sprintf(buf3,"陌生人?我不认识你呀!你是坏人!"); } CHAR_talkToCli( talkerindex, meindex, buf3, color); return; } j=0; #ifdef _PET_TALKPRO while( getStringFromIndexWithDelim( pettalktext[tPage].DATA,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE){ #else while( getStringFromIndexWithDelim( buf1,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE){ #endif talkNo++; if( ( strstr( buf2, TalkType[Type]) == NULL ) && ( strstr( buf2, TalkType[2]) == NULL ) )continue; if( NPC_Util_GetStrFromStrWithDelim( buf2, "FLOOR", buf3, sizeof( buf3)) != NULL ) {//判断房间号 if( PetTalk_CheckMyFloor( meindex, talkerindex, buf3, 0) == FALSE )continue; } if( NPC_Util_GetStrFromStrWithDelim( buf2, "PET", buf3, sizeof( buf3)) != NULL ) {//判断宠物FREE条件 if( PetTalk_CheckFree( meindex, meindex, buf3) != TRUE ) continue; } if( NPC_Util_GetStrFromStrWithDelim( buf2, "FREE", buf3, sizeof( buf3) ) == NULL)continue; if( NPC_ActionPassCheck( meindex, talkerindex, buf3) == FALSE ) continue;//判断玩家FREE条件 // if( ActionNpc_CheckFree( meindex, talkerindex, buf2, 0) == FALSE ) continue; if( PetTalk_CheckPetEvent( meindex, talkerindex, buf2) == FALSE )continue; FREEs = TRUE; //条件成立 strcpy( AllTalk[j++], buf2 ); if( j > PETTALK_MAXID-1 ) break; } talkNo = 0; if( FREEs == FALSE) { //如果全部条件都不成立 j=0; #ifdef _PET_TALKPRO while( getStringFromIndexWithDelim( pettalktext[tPage].DATA,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE ){ #else while( getStringFromIndexWithDelim( buf1,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE ){ #endif talkNo ++; if( strstr( buf2, "OTHER") == NULL ) continue; if( NPC_Util_GetStrFromStrWithDelim( buf2, "TalkMsg", buf3, sizeof( buf3)) == NULL) continue; while( getStringFromIndexWithDelim( buf3,",",j+1, AllTalk[j], sizeof( AllTalk[j]) ) != FALSE ){ j++; } break; } } if( j > 0 ) { strcpy( buf2, AllTalk[ RAND( 0, (j-1) ) ] ); if( PetTalk_RunEvent( meindex, talkerindex, buf2) == FALSE ) { sprintf( buf3,"....!"); CHAR_talkToCli( talkerindex, meindex, buf3, color); return; } if( NPC_Util_GetStrFromStrWithDelim( buf2, "TalkMsg", buf3, sizeof( buf3)) == NULL) { //sprintf( buf3,"主人,我们去逛逛吧!"); strcpy( buf3, buf2); } lssproto_WN_send( fd, windowtype, buttontype, 0, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf3 ); } } BOOL PetTalk_CheckMyFloor( int meindex, int talker, char *buf, int flg) { char buf1[16]; int Myfloor=-1; Myfloor = CHAR_getInt( talker, CHAR_FLOOR); if( strstr( buf, "!") != NULL ) { getStringFromIndexWithDelim( buf,"!", 2, buf1, sizeof( buf1) ); if( Myfloor == atoi( buf1) ) { return FALSE; } }else { if( Myfloor != atoi( buf) ) { return FALSE; } } return TRUE; } BOOL PetTalk_RunEvent( int meindex, int talker, char *buf) { char buf1[256]; int LimitLevel = -1; if( Action_RunDoEventAction( meindex, talker, buf) == FALSE ) return FALSE; if( NPC_Util_GetStrFromStrWithDelim( buf, "RandItem", buf1, sizeof( buf1)) != NULL ){ if( RAND( 0, 10) > 9 ) { PetTalk_AddItem( meindex, talker, buf1); }else { return FALSE; } } if( NPC_Util_GetStrFromStrWithDelim( buf, "LimitLevel", buf1, sizeof( buf1)) != NULL ){ LimitLevel = atoi( buf1); CHAR_setInt( meindex, CHAR_LIMITLEVEL, LimitLevel); } return TRUE; } BOOL PetTalk_DelItem(int meindex,int talker,char *buf) { int i = 1, j = 1,k = 1; char buff3[128]; char buf2[32]; int itemindex; while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ) { k++; if(strstr(buff3,"*")!=NULL){ int itemno; int kosuu; int id; int cnt=0; getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); itemno = atoi(buf2); getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); kosuu = atoi(buf2); for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ itemindex=CHAR_getItemIndex( talker , i ); if( ITEM_CHECKINDEX(itemindex) ){ id=ITEM_getInt(itemindex ,ITEM_ID ); if(itemno==id){ cnt++; LogItem( CHAR_getChar( talker, CHAR_NAME ), /* 平乓仿 */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD 在item的log中增加item名称 itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* 失奶 丞 寞 */ #endif "WarpManDelItem(NPC收道具後传至某点)", CHAR_getInt( talker, CHAR_FLOOR), CHAR_getInt( talker, CHAR_X ), CHAR_getInt( talker, CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, i); if(cnt == kosuu){ break; } } } } }else{ /*--蓟氏分 寞及失奶 丞毛蓟请---*/ for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ itemindex = CHAR_getItemIndex( talker ,j); if( ITEM_CHECKINDEX(itemindex) ){ if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)){ LogItem( CHAR_getChar( talker, CHAR_NAME ), /* 平乓仿 */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD 在item的log中增加item名称 itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* 失奶 丞 寞 */ #endif "WarpManDelItem(NPC收道具後传至某点)", CHAR_getInt( talker,CHAR_FLOOR), CHAR_getInt( talker,CHAR_X ), CHAR_getInt( talker,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, j); } } } } } return TRUE; }