513 lines
12 KiB
C
513 lines
12 KiB
C
![]() |
#include "version.h"
|
|||
|
#include <string.h>
|
|||
|
#include "common.h"
|
|||
|
#include "char_base.h"
|
|||
|
#include "npc_janken.h"
|
|||
|
#include "npcutil.h"
|
|||
|
#include "char.h"
|
|||
|
#include "lssproto_serv.h"
|
|||
|
#include "buf.h"
|
|||
|
#include "function.h"
|
|||
|
#include "readmap.h"
|
|||
|
#include "object.h"
|
|||
|
#include "log.h"
|
|||
|
|
|||
|
/*
|
|||
|
*Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
static void NPC_Janken_selectWindow( int meindex, int talker, int num);
|
|||
|
void NPC_JnakenJudge(int meindex,int talker,int sel);
|
|||
|
BOOL NPC_JankenEntryItemCheck(int talker,char *buf);
|
|||
|
BOOL NPC_JankenEntryItemDel(int talker,char *buf);
|
|||
|
void NPC_WarpPointGet(int meindex,int talker,int *fl,int *x,int *y,int judge);
|
|||
|
|
|||
|
|
|||
|
/*********************************
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*********************************/
|
|||
|
BOOL NPC_JankenInit( int meindex )
|
|||
|
{
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEJANKEN );
|
|||
|
|
|||
|
return TRUE;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*********************************
|
|||
|
* <EFBFBD>ƾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*********************************/
|
|||
|
void NPC_JankenTalked( int meindex , int talkerindex , char *szMes ,
|
|||
|
int color )
|
|||
|
{
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>帲<EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD> ɱ<><C9B1><EFBFBD><EFBFBD> */
|
|||
|
if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
|||
|
if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return;
|
|||
|
|
|||
|
NPC_Janken_selectWindow(meindex, talkerindex, 0);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/******************************
|
|||
|
* <EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
******************************/
|
|||
|
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];
|
|||
|
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⻥<EFBFBD><E2BBA5><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ƥ<EFBFBD>Ʊ<EFBFBD>ɬ<EFBFBD><C9AC>--*/
|
|||
|
windowtype=WINDOW_MESSAGETYPE_MESSAGE;
|
|||
|
|
|||
|
/*--ɬ<>ð<EFBFBD><C3B0><EFBFBD><EFBFBD>̻<EFBFBD>ë <20><> <20><>--*/
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
|
|||
|
print("NPC_janken Init: GetArgStrErr");
|
|||
|
return ;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
switch( num)
|
|||
|
{
|
|||
|
case 0:
|
|||
|
|
|||
|
/*-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⻥ <20><>ľ<EFBFBD>ɾ¡<DEB7> <20><> --*/
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr, "MainMsg", token, sizeof( token)) == NULL)
|
|||
|
{
|
|||
|
print("Janken:MainMsg:%s", CHAR_getChar( meindex, CHAR_NAME));
|
|||
|
return ;
|
|||
|
}
|
|||
|
|
|||
|
/*--<2D><> --*/
|
|||
|
buttontype = WINDOW_BUTTONTYPE_YESNO;
|
|||
|
windowtype = WINDOW_MESSAGETYPE_MESSAGE;
|
|||
|
windowno = CHAR_WINDOWTYPE_JANKEN_START;
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
case 1:
|
|||
|
|
|||
|
//ʧ<><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr, "EntryItem", buf, sizeof( buf))!= NULL) {
|
|||
|
|
|||
|
if(NPC_JankenEntryItemCheck(talker,buf) == FALSE)
|
|||
|
{
|
|||
|
NPC_Janken_selectWindow(meindex, talker, 3);
|
|||
|
}
|
|||
|
|
|||
|
//<2F><EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB><EFBFBD><EFBFBD>
|
|||
|
if(NPC_JankenEntryItemDel(talker,buf) == FALSE){
|
|||
|
print("Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ERR:ʧ<><CAA7> ة<><D8A9><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*--<2D><> --*/
|
|||
|
sprintf(token," <20><><EFBFBD><EFBFBD>ʯͷ<CAAF><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n"
|
|||
|
"\n\n <20><> ʯͷ <20><>"
|
|||
|
"\n\n <20><> <20><><EFBFBD><EFBFBD> <20><>"
|
|||
|
"\n\n <20><> <20><> <20><>"
|
|||
|
);
|
|||
|
|
|||
|
buttontype=WINDOW_BUTTONTYPE_NONE;
|
|||
|
windowtype=WINDOW_MESSAGETYPE_SELECT;
|
|||
|
windowno=CHAR_WINDOWTYPE_JANKEN_MAIN;
|
|||
|
break;
|
|||
|
|
|||
|
case 2:
|
|||
|
/*--ؤ<>г<EFBFBD><D0B3><EFBFBD> --*/
|
|||
|
//sprintf(token," ؤ<>г<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>\n"
|
|||
|
sprintf(token," ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n"
|
|||
|
"\n\n <20><> ʯͷ <20><>"
|
|||
|
"\n\n <20><> <20><><EFBFBD><EFBFBD> <20><>"
|
|||
|
"\n\n <20><> <20><> <20><>"
|
|||
|
);
|
|||
|
|
|||
|
buttontype=WINDOW_BUTTONTYPE_NONE;
|
|||
|
windowtype=WINDOW_MESSAGETYPE_SELECT;
|
|||
|
windowno=CHAR_WINDOWTYPE_JANKEN_MAIN;
|
|||
|
break;
|
|||
|
|
|||
|
case 3:
|
|||
|
/*-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⻥ <20><>ľ<EFBFBD>ɾ¡<DEB7> <20><> --*/
|
|||
|
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));
|
|||
|
/*-<2D><><EFBFBD><EFBFBD>ƥ˪<C6A5><CBAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
lssproto_WN_send( fd, windowtype,
|
|||
|
buttontype,
|
|||
|
windowno,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*********************************
|
|||
|
* <EFBFBD><EFBFBD>ū<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>帲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*********************************/
|
|||
|
void NPC_JankenWindowTalked( int meindex, int talkerindex,
|
|||
|
int seqno, int select, char *data)
|
|||
|
{
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
|||
|
if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return;
|
|||
|
|
|||
|
switch( seqno){
|
|||
|
case CHAR_WINDOWTYPE_JANKEN_START:
|
|||
|
|
|||
|
if(select==WINDOW_BUTTONTYPE_YES){
|
|||
|
NPC_Janken_selectWindow(meindex, talkerindex, 1);
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case CHAR_WINDOWTYPE_JANKEN_MAIN:
|
|||
|
if (atoi(data) >= 3){
|
|||
|
NPC_JnakenJudge(meindex,talkerindex,atoi(data) );
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
*<EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void NPC_JnakenJudge(int meindex,int talker,int sel)
|
|||
|
{
|
|||
|
int player=-1;
|
|||
|
int jankenman;
|
|||
|
char j_char[3][8]={" ʯͷ "," <20><><EFBFBD><EFBFBD> "," <20><> "};
|
|||
|
char token[1024];
|
|||
|
int shouhai = 0;
|
|||
|
int fd = getfdFromCharaIndex( talker);
|
|||
|
int fl=0,x=0,y=0;
|
|||
|
|
|||
|
|
|||
|
if(sel == 3) player = 0; //<2F><><EFBFBD><EFBFBD>
|
|||
|
if(sel == 5) player = 1; //<2F><><EFBFBD><EFBFBD>ƽ
|
|||
|
if(sel == 7) player = 2; //<2F>ɡ<EFBFBD>
|
|||
|
|
|||
|
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 <20><><EFBFBD>Ҳ<EFBFBD>ʤ<EFBFBD>˸<EFBFBD><CBB8>ĵ<EFBFBD><C4B5><EFBFBD>
|
|||
|
NPC_JankenItemGet( meindex, talker, "WinItem" );
|
|||
|
|
|||
|
NPC_WarpPointGet(meindex, talker, &fl, &x, &y, 0);
|
|||
|
|
|||
|
snprintf( token, sizeof( token ) ,
|
|||
|
" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \n\n"
|
|||
|
" %16s %-16s\n"
|
|||
|
" [%s] VS [%s]\n\n\n"
|
|||
|
" %-16s ʤ<><CAA4>",
|
|||
|
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 );
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
CHAR_warpToSpecificPoint(talker, fl, x, y);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4><EFBFBD><EFBFBD><EFBFBD>٣<EFBFBD><D9A3><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD>£<EFBFBD>
|
|||
|
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 <20><><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>˸<EFBFBD><CBB8>ĵ<EFBFBD><C4B5><EFBFBD>
|
|||
|
NPC_JankenItemGet( meindex, talker, "LoseItem" );
|
|||
|
|
|||
|
NPC_WarpPointGet(meindex, talker, &fl, &x, &y, 1);
|
|||
|
snprintf( token, sizeof( token ) ,
|
|||
|
" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \n\n"
|
|||
|
" %16s %-16s\n"
|
|||
|
" [%s] VS [%s]\n\n\n"
|
|||
|
" %-16s <20><><EFBFBD><EFBFBD>",
|
|||
|
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 );
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
CHAR_warpToSpecificPoint(talker, fl, x, y);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4> <20><><EFBFBD>У<EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>
|
|||
|
CHAR_sendWatchEvent( CHAR_getWorkInt( talker, CHAR_WORKOBJINDEX), CHAR_ACTSAD,NULL,0,TRUE);
|
|||
|
CHAR_setWorkInt( talker, CHAR_WORKACTION, CHAR_ACTSAD);
|
|||
|
|
|||
|
|
|||
|
}else{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؤ<EFBFBD>г<EFBFBD>
|
|||
|
NPC_Janken_selectWindow( meindex, talker, 2);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
//˪<><CBAA>
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
|
|||
|
WINDOW_BUTTONTYPE_OK,
|
|||
|
CHAR_WINDOWTYPE_JANKEN_END,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ëGET<EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|||
|
*/
|
|||
|
void NPC_WarpPointGet(int meindex,int talker,int *fl,int *x,int *y,int judge)
|
|||
|
{
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char *strbuf[2] = {"WinWarp","LoseWarp"};
|
|||
|
char buf[64];
|
|||
|
char buf2[32];
|
|||
|
|
|||
|
/*--ɬ<>ð<EFBFBD><C3B0><EFBFBD><EFBFBD>̻<EFBFBD>ë <20><> <20><>--*/
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
|
|||
|
print("NPC_janken Init: GetArgStrErr");
|
|||
|
return ;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB> --*/
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, strbuf[judge], buf, sizeof( buf));
|
|||
|
getStringFromIndexWithDelim(buf,",",1,buf2,sizeof(buf2));
|
|||
|
*fl=atoi(buf2);
|
|||
|
getStringFromIndexWithDelim(buf,",",2,buf2,sizeof(buf2));
|
|||
|
*x=atoi(buf2);
|
|||
|
getStringFromIndexWithDelim(buf,",",3,buf2,sizeof(buf2));
|
|||
|
*y=atoi(buf2);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
*--ʧ<EFBFBD><EFBFBD> ة<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD>浤
|
|||
|
*/
|
|||
|
BOOL NPC_JankenEntryItemCheck(int talker,char *buf)
|
|||
|
{
|
|||
|
|
|||
|
char buf2[512];
|
|||
|
char buf3[256];
|
|||
|
int id=0;
|
|||
|
BOOL flg = FALSE;
|
|||
|
int i;
|
|||
|
int itemindex;
|
|||
|
int itemno;
|
|||
|
int kosuu;
|
|||
|
int cnt=0;
|
|||
|
int k=1;
|
|||
|
|
|||
|
while(getStringFromIndexWithDelim(buf , "," , k, buf2, sizeof(buf2))
|
|||
|
!=FALSE )
|
|||
|
{
|
|||
|
flg = FALSE;
|
|||
|
k++;
|
|||
|
|
|||
|
if(strstr(buf2,"*") != NULL){
|
|||
|
cnt = 0;
|
|||
|
getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3));
|
|||
|
itemno = atoi(buf3);
|
|||
|
getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3));
|
|||
|
kosuu = atoi(buf3);
|
|||
|
|
|||
|
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++;
|
|||
|
if(cnt == kosuu){
|
|||
|
flg = TRUE;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if(flg == FALSE)
|
|||
|
{
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
}else{
|
|||
|
itemno = 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){
|
|||
|
flg = TRUE;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if(flg == FALSE)
|
|||
|
{
|
|||
|
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 ), /* ƽ<>ҷ<EFBFBD> */
|
|||
|
CHAR_getChar( talker, CHAR_CDKEY ),
|
|||
|
#ifdef _add_item_log_name // WON ADD <20><>item<65><6D>log<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD>
|
|||
|
itemindex,
|
|||
|
#else
|
|||
|
ITEM_getInt( itemindex, ITEM_ID), /* ʧ<><CAA7> ة į */
|
|||
|
#endif
|
|||
|
"QuizDelItem(<28><><EFBFBD><EFBFBD>-><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)",
|
|||
|
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{
|
|||
|
/*--<2D><><EFBFBD>Ϸ<EFBFBD> į<><C4AF>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB><EFBFBD><EFBFBD>---*/
|
|||
|
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 ), /* ƽ<>ҷ<EFBFBD> */
|
|||
|
CHAR_getChar( talker, CHAR_CDKEY ),
|
|||
|
#ifdef _add_item_log_name // WON ADD <20><>item<65><6D>log<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD>
|
|||
|
itemindex,
|
|||
|
#else
|
|||
|
ITEM_getInt( itemindex, ITEM_ID), /* ʧ<><CAA7> ة į */
|
|||
|
#endif
|
|||
|
"QuizDelItem(<28><><EFBFBD><EFBFBD>-><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)",
|
|||
|
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_JankenItemGet(int meindex,int talker, char *wl)
|
|||
|
{
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char buf[64];
|
|||
|
|
|||
|
/*--ɬ<>ð<EFBFBD><C3B0><EFBFBD><EFBFBD>̻<EFBFBD>ë <20><> <20><>--*/
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
|
|||
|
print("NPC_janken ItemGet: GetArgStrErr");
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr, wl, buf, sizeof( buf) ) !=NULL){
|
|||
|
NPC_EventAddItem( meindex, talker, buf);
|
|||
|
}
|
|||
|
}
|
|||
|
|