#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( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold ) { char buf2[512]; sprintf( buf2, "\n很抱歉喔!你的学费不足!\n学习骑乘宠物初级班需要%d石币。", w.takegold); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( buf2, buf, sizeof(buf))); return; } CHAR_DelGold( talkerindex, w.takegold ); CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 40 ); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD ); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE ); //sprintf( buf, "R|L|1" ); //lssproto_FM_send( fd, buf ); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n恭喜你!你已经完成骑乘初级班了。\n可以骑乘 Lv40 以下的宠物,\n请小心骑乘喔!", buf, sizeof(buf))); // 家族收入 { int fmindex, fmindexi, village, i; char fmname[256], token[256], buf2[64]; sprintf( buf2, "%d", w.takegold/5 ); 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( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold ) { char buf2[512]; sprintf( buf2, "\n很抱歉喔!你的学费不足!\n学习骑乘宠物中级班需要%d石币", w.takegold); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( buf2, buf, sizeof(buf))); return; } CHAR_DelGold( talkerindex, w.takegold ); CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 80 ); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD ); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE ); //sprintf( buf, "R|L|1" ); //lssproto_FM_send( fd, buf ); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n恭喜你!你已经完成骑乘中级班了。\n可以骑乘 Lv80 以下的宠物,\n请小心骑乘喔!", buf, sizeof(buf))); // 家族收入 { int fmindex, fmindexi, village, i; char fmname[256], token[256], buf2[64]; sprintf( buf2, "%d", w.takegold/5 ); 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( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold ) { char buf2[512]; sprintf( buf2, "\n很抱歉喔!你的学费不足!\n学习骑乘宠物高级班需要%d石币", w.takegold); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( buf2, buf, sizeof(buf))); return; } CHAR_DelGold( talkerindex, w.takegold ); CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 120 ); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD ); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE ); //sprintf( buf, "R|L|1" ); //lssproto_FM_send( fd, buf ); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n恭喜你!你已经完成骑乘高级班了。\n可以骑乘 Lv120 以下的宠物,\n请小心骑乘喔!", buf, sizeof(buf))); // 家族收入 { int fmindex, fmindexi, village, i; char fmname[256], token[256], buf2[64]; sprintf( buf2, "%d", w.takegold/5 ); for( i=0 ; i 199 ) { 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( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold ) { char buf2[512]; sprintf( buf2, "\n很抱歉喔!你的学费不足!\n学习骑乘宠物特级班需要%d石币", w.takegold); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( buf2, buf, sizeof(buf))); return; } CHAR_DelGold( talkerindex, w.takegold ); CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 200 ); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD ); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE ); //sprintf( buf, "R|L|1" ); //lssproto_FM_send( fd, buf ); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( "\n\n恭喜你!你已经完成骑乘特级班了。\n可以骑乘所有等级的宠物,\n请小心骑乘喔!", buf, sizeof(buf))); // 家族收入 { int fmindex, fmindexi, village, i; char fmname[256], token[256], buf2[64]; sprintf( buf2, "%d", w.takegold/5 ); for( i=0 ; i