#include "version.h" #include #include "char.h" #include "object.h" #include "char_base.h" #include "npcutil.h" #include "configfile.h" #include "lssproto_serv.h" #include "saacproto_cli.h" #include "npc_riderman.h" #include "family.h" #include "log.h" extern int familyNumTotal; extern char familyListBuf[MAXFAMILYLIST]; extern tagRidePetTable ridePetTable[296]; extern struct FM_POINTLIST fmpointlist; char sendbuf[1024]; char buf[1024]; char subbuf[128]; int i, j; /* * 涩烂今木凶它奴件玉它毛请允NPC * 棵哑 平旦玄失玉矛件民乓□仁日中卅日综木月井手[ * */ struct { int windowno; int windowtype; int buttontype; int takeitem; int giveitem; int takegold; char message[4096]; int letter[4]; }w; struct { BOOL use; int checkhaveitem; int checkhaveitemgotowin; int checkdonthaveitem; int checkdonthaveitemgotowin; int warp; int battle; int gotowin; }buttonproc[13]; /* ok,cancel, yes,no,prev,next 及凛及质 */ enum { CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT1, }; static void NPC_Riderman_selectWindow( int meindex, int toindex, int num); static BOOL NPC_Riderman_readData( int meindex, int windowno, BOOL chkflg); static int NPC_Riderman_restoreButtontype( char *data ); // static BOOL getLetter(int meindex,int talker ); // static BOOL checkLetter(int meindex,int talker ); /********************************* * 赓渝质 *********************************/ BOOL NPC_RidermanInit( int meindex ) { char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; char buf[1024]; //int i; //char secondToken[1024]; // Robin test // print(" riderman_Init "); NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf)) == NULL ) { print( "riderman:没有指定设定的档案 。\n"); return FALSE; } /* 赓渝凛卞涩烂犯□正毛民尼永弁仄化支月 */ if( !NPC_Riderman_readData( meindex, -1, TRUE) ) { return FALSE; } CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN ); return TRUE; } /********************************* * 仄井仃日木凶凛及质 *********************************/ void NPC_RidermanTalked( int meindex , int talkerindex , char *szMes ,int color ) { //print(" Rideman_fmindex:%d ", CHAR_getInt( meindex, CHAR_FMINDEX) ); NPC_Riderman_selectWindow( meindex, talkerindex, 1 ); } /********************************* * 苇日木凶凛及质 *********************************/ void NPC_RidermanLooked( int meindex , int lookedindex) { //print(" Look:me:%d,looked:%d ",meindex,lookedindex); NPC_Riderman_selectWindow( meindex, lookedindex,1 ); } static void NPC_Riderman_selectWindow( int meindex, int toindex, int num) { int fd; char buf[256]; /* 皿伊奶乩□卞覆仄化分仃 杀允月 */ if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { return; } /* ㄠ弘伉永玉动 及心 */ if( !NPC_Util_charIsInFrontOfChar( toindex, meindex, 1 )) return; if( !NPC_Riderman_readData( meindex, num, FALSE) ) { print( "riderman:readdata error\n"); return; } fd = getfdFromCharaIndex( toindex); if( fd != -1 ) { lssproto_WN_send( fd, w.windowtype, w.buttontype, w.windowno+100, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), makeEscapeString( w.message, buf, sizeof(buf))); } } void NPC_RidermanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { int button = -1; char buf[512]; /* ㄠ弘伉永玉动 及心 */ if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; /* 仇及它奴件玉它 寞及犯□正毛 心 戈 */ if( !NPC_Riderman_readData( meindex, seqno - 100, FALSE) ) { print( "riderman:readdata error\n"); return; } /* 瓷仄凶示正件毛譬屯月 */ if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) { button = atoi( data)+5; if( button > 12 ) { print( "riderman:invalid button[%d]\n", button); return; } } else if( select & WINDOW_BUTTONTYPE_OK) button = 0; else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1; else if( select & WINDOW_BUTTONTYPE_YES) button = 2; else if( select & WINDOW_BUTTONTYPE_NO) button = 3; else if( select & WINDOW_BUTTONTYPE_PREV) button = 4; else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5; else { print( "riderman:invalid button[%d]\n", select); return; } if( buttonproc[button].use == TRUE ) { int fd; int newwin = -1; fd = getfdFromCharaIndex( talkerindex); /* 示正件卞方匀化质 毛孔曰歹仃月 */ if( newwin == -1 ) { newwin = buttonproc[button].gotowin; } //print(" takegold:%d ", w.takegold ); // Robin // 学习 Lv 40 if( newwin == 6 ) { int charImg; // int i, petindex, bFind = 0; charImg = CHAR_getInt( talkerindex, CHAR_BASEBASEIMAGENUMBER); if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) >= 40 ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n你已经学会初级班了呀。\n不需要再学了。", buf, sizeof(buf))); return; } #if 0 if( !checkLetter( meindex, talkerindex) ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n很抱歉喔!\n学习骑乘宠物需要本庄园族长的同意书。", buf, sizeof(buf))); return; } for( i=0; i= 80 ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n你已经学会中级班了呀。\n不需要再学了。", buf, sizeof(buf))); return; } else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 40 ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n你必须先学过初级班才能来中级班唷。", buf, sizeof(buf))); return; } #if 0 if( !checkLetter( meindex, talkerindex) ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n很抱歉喔!\n学习骑乘宠物需要本庄园族长的同意书。", buf, sizeof(buf))); return; } for( i=0; i= 120 ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n你已经学会高级班了呀。\n不需要再学了。", buf, sizeof(buf))); return; } else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 80 ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n你必须先学过中级班才能来高级班唷。", buf, sizeof(buf))); return; } #if 0 if( !checkLetter( meindex, talkerindex) ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n很抱歉喔!\n学习骑乘宠物需要本庄园族长的同意书。", buf, sizeof(buf))); return; } for( i=0; i 120 ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n你已经学会特级班了呀。\n不需要再学了。", buf, sizeof(buf))); return; } else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 120 ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n你必须先学过高级班才能来特级班唷。", buf, sizeof(buf))); return; } #if 0 if( !checkLetter( meindex, talkerindex) ) { lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n很抱歉喔!\n学习骑乘宠物需要本庄园族长的同意书。", buf, sizeof(buf))); return; } for( i=0; i