void NPC_BlackMarketWindowTalked( int index, int talker, int seqno, int select, char *data) { int i; char sBuf[1024]="", sBuf1[256]=""; if(!CHAR_CHECKINDEX( talker)) return; if(getfdFromCharaIndex( talker)==-1) return; if(CHAR_getInt( talker, CHAR_WHICHTYPE)!=CHAR_TYPEPLAYER) return; if(NPC_Util_isFaceToFace( talker, index, 1)!=TRUE) return; if( seqno == CHAR_WINDOWTYPE_BLACKMARKET){ for(i=0; i<12; i++){ CONNECT_set_BMList( getfdFromCharaIndex( talker), i, BMSellList[i]); sprintf( sBuf1, "%d|%d|%s\n", BMSellList[i], BMItem[BMSellList[i]].iGraphicsNum, BMItem[BMSellList[i]].iName); strcat( sBuf, sBuf1); } lssproto_WN_send( getfdFromCharaIndex( talker), WINDOW_MESSAGETYPE_BLACKMARKET, WINDOW_BUTTONTYPE_NONE, CHAR_WINDOWTYPE_BLACKMARKET, CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), sBuf ); } }
void ITEM_contract( int charaindex, int toindex, int haveitemindex) { int itemindex; int conindex; char data[2048+1024]; if( !CHAR_CHECKINDEX( charaindex ) ) return; itemindex = CHAR_getItemIndex( charaindex, haveitemindex); if( !ITEM_CHECKINDEX(itemindex) ) return; //conindex = atoi( ITEM_getChar( itemundex, ITEM_CONTRACTNUM)); conindex = atoi( ITEM_getChar( itemindex, ITEM_ARGUMENT)); sprintf( data, "%s|%d|%s|%s", ITEM_contractTbl[conindex].detail, ITEM_contractTbl[conindex].argnum, ITEM_getChar( itemindex, ITEM_CONTRACTARG), ITEM_getChar( itemindex, ITEM_CONTRACTTIME) ); print("\n contract_send:%s\n", data); lssproto_WN_send( getfdFromCharaIndex( charaindex), WINDOW_MESSAGETYPE_CONTRACT, WINDOW_BUTTONTYPE_YESNO, CHAR_WINDOWTYPE_CONTRACT_ANSWER, itemindex, data ); }
void NPC_DepotItem_Item_printWindow( int meindex, int talkerindex) { char itemstring[65536-1024]; char sendstring[65536]; char argstr1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *argstr; char buff2[1024]; char buff3[1024]; char buff4[1024]; int fd; if( (fd = getfdFromCharaIndex( talkerindex)) == -1 ){ fprint( "err\n"); return; } argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1)); snprintf( sendstring, sizeof( sendstring), "0|%d|%s|%s|%s|%s|", CHAR_getfindEmptyDepotItem( talkerindex), CHAR_getChar( meindex, CHAR_NAME), NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_POOL, argstr, buff2, sizeof( buff2)), NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_POOLFULL, argstr, buff3, sizeof( buff3)), NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_REALY, argstr, buff4, sizeof( buff4)) ); NPC_DepotItem_MakeItemString( meindex, talkerindex, itemstring, sizeof( itemstring)); strcat( sendstring, itemstring); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN, WINDOW_BUTTONTYPE_NONE, CHAR_WINDOWTYPE_DEPOTITEMSHOP_ADD, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), sendstring); }
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_PoolItemShop_printWindow_Start( int meindex, int talkerindex) { int fd; fd = getfdFromCharaIndex( talkerindex); if( fd != -1 ) { char message[1024]; char buf[2048]; #ifdef _NPC_DEPOTITEM strcpy( message, "3\n\n" " 歡迎光臨\n\n" " <寄放道具>\n" " <取回道具>\n" " <使用倉庫>\n\n" " < 離開 >" ); #else strcpy( message, "3\n\n" " 歡迎光臨\n\n" " <寄放道具>\n" " <取回道具>\n\n\n" " < 離開 >" ); #endif lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, WINDOW_BUTTONTYPE_NONE, CHAR_WINDOWTYPE_POOLITEMSHOP_START, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), makeEscapeString( message, buf, sizeof(buf))); } }
int CHAR_talkToCli(int talkedcharaindex, int talkcharaindex, char *message, CHAR_COLOR color) { static char lastbuf[2048]; static char escapebuf[2048]; static char mesgbuf[1024]; int fd; if(!CHAR_CHECKINDEX(talkedcharaindex)) return FALSE; if(CHAR_getInt(talkedcharaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) { print("err CHAR_talkToCli CHAR_WHICHTYPE != CHAR_TYPEPLAYER\n"); return FALSE; } fd = getfdFromCharaIndex(talkedcharaindex); if(fd == -1) { print("err CHAR_talkToCli can't get fd from:%d \n", talkedcharaindex); return FALSE; } if(color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2) { print("CHAR_talkToCli color err\n"); return FALSE; } snprintf(lastbuf, sizeof(lastbuf), "P|%s", makeEscapeString(CHAR_appendNameAndTitle(talkcharaindex, message, mesgbuf, sizeof(mesgbuf)), escapebuf, sizeof(escapebuf))); int talkchar = -1; if(talkcharaindex != -1) talkchar = CHAR_getWorkInt(talkcharaindex, CHAR_WORKOBJINDEX); lssproto_TK_send(fd, talkchar, lastbuf, color); return TRUE; }
static void NPC_Duelranking_selectWindow( int meindex, int toindex, int num, int select) { int fd; if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { return; } if( NPC_Util_CharDistance( toindex, meindex ) > 1) return; if( (fd = getfdFromCharaIndex( toindex)) == -1 ) return; switch( num){ case 1: { char message[1024]; char buf[2048]; strcpy( message, "1\n" " 要看哪一个? \n\n\n" " <强者们> \n\n" " < 自己 > \n\n" " <都不看> \n\n" ); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, WINDOW_BUTTONTYPE_NONE, CHAR_WINDOWTYPE_DUELRANKING_START, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), makeEscapeString( message, buf, sizeof(buf))); } break; } }
void NPC_DepotItem_Depot_printWindow( int meindex, int talkerindex) { char itemstring[65536-1024]; char sendstring[65536]; char argstr1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *argstr; char buff[1024]; char buff2[1024]; char buff3[1024]; int fd; if( (fd = getfdFromCharaIndex( talkerindex)) == -1 )return; argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1)); snprintf( sendstring, sizeof( sendstring), "1|%s|%s|%s|%s|", CHAR_getChar( meindex, CHAR_NAME), NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_DRAW, argstr, buff2, sizeof( buff2)), NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_ITEMFULL, argstr, buff, sizeof( buff)), NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_REALY, argstr, buff3, sizeof( buff3)) ); NPC_DepotItem_MakeDepotString( meindex, talkerindex, itemstring, sizeof( itemstring)); strcat( sendstring, itemstring); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN, WINDOW_BUTTONTYPE_NONE, CHAR_WINDOWTYPE_DEPOTITEMSHOP_GET, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), sendstring); //print("\n NPC_DepotItem_Depot_printWindow:%s size:%d ", sendstring, strlen(sendstring)); }
void ChatRoom_Refresh ( int Num ) { int fd , i , RoomLeader = -1 ; char token[2048] ; char token2[2096] ; char buf[64] ; if ( ChatRoom[ Num ].useFlag == TRUE ) { sprintf ( token , "R|r%d|%s|%d|%s|p%d|" , Num , ChatRoom[ Num ].RoomName , ChatRoom[ Num ].Maker , CHAR_getChar ( ChatRoom[ Num ].Maker , CHAR_NAME ) , ChatRoom[ Num ].NowPeople ); for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { if ( ChatRoom[ Num ].MemberList[ i ] != -1 ) { sprintf( buf , "I%d|%s|%s|" , ChatRoom[ Num ].MemberList[ i ] , CHAR_getChar ( ChatRoom[ Num ].MemberList[ i ] , CHAR_NAME ) , CHAR_getChar ( ChatRoom[ Num ].MemberList[ i ] , CHAR_OWNTITLE ) ); strncat ( token , buf , sizeof ( buf ) ) ; } } } for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { if ( ChatRoom[ Num ].MemberList[ i ] != -1 ) { if ( CHAR_getWorkInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_WORKCHATROOMTYPE ) == 1 ) RoomLeader = 1; else RoomLeader = 0 ; sprintf ( token2 , "%s%d|" , token , RoomLeader ) ; fd= getfdFromCharaIndex ( ChatRoom[ Num ].MemberList[ i ] ); lssproto_CHATROOM_send ( fd , token2 ) ; } } }
BOOL ChatRoom_Destroy ( int myindex ) { int i , j ; int fd ;/*= getfdFromCharaIndex(myindex);*/ char buf[16]; if ( !CHAR_CHECKINDEX ( myindex ) ) return FALSE; if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) { i = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ) ; ChatRoom[ i ].useFlag = FALSE ; ChatRoom[ i ].Maker = -1 ; ChatRoom[ i ].NowPeople = -1 ; // WON FIX memset( ChatRoom[ i ].RoomName, 0 , sizeof(ChatRoom[ i ].RoomName) ); //sprintf ( ChatRoom[ i ].RoomName , " " ) ; for ( j = 0 ; j < MAX_PPLINROOM ; j ++ ) { if ( !CHAR_CHECKINDEX ( ChatRoom[ i ].MemberList[ j ] ) ) { ChatRoom[ i ].MemberList[ j ] = -1 ; continue; } CHAR_setWorkInt ( ChatRoom[ i ].MemberList[ j ] , CHAR_WORKCHATROOMTYPE , 0 ) ; CHAR_setWorkInt ( ChatRoom[ i ].MemberList[ j ] , CHAR_WORKCHATROOMNUM , 0 ) ; fd = getfdFromCharaIndex( ChatRoom[ i ].MemberList[ j ] ); sprintf ( buf , "D|%d" , i ) ; lssproto_CHATROOM_send ( fd , buf ) ; ChatRoom[ i ].MemberList[ j ] = -1 ; } return TRUE; } return FALSE; }
void ChatRoom_Kick ( int myindex , int toindex ) { int i , fd ; int Num = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ); if ( !CHAR_CHECKINDEX ( myindex ) ) return ; if ( !CHAR_CHECKINDEX ( toindex ) ) return ; if ( myindex == toindex ) return; if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) { if ( Num != CHAR_getWorkInt ( toindex , CHAR_WORKCHATROOMNUM ) ) return; else { CHAR_setWorkInt ( toindex , CHAR_WORKCHATROOMTYPE , 0 ) ; CHAR_setWorkInt ( toindex , CHAR_WORKCHATROOMNUM , -1) ; //CHAR_talkToCli ( toindex , -1 , "室长将你踢出聊天室!" , CHAR_COLORRED ) ; fd = getfdFromCharaIndex( toindex ); lssproto_CHATROOM_send ( fd , "K|" ) ; ChatRoom[ Num ].NowPeople --; for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { if ( ChatRoom[ Num ].MemberList[ i ] == toindex ) { ChatRoom[ Num ].MemberList[ i ] = -1 ; break; } } } } ChatRoom_Refresh ( Num ) ; }
int NPC_Lua_NLG_ShowWindowTalked(lua_State *_NLL) { CheckEx2(_NLL, 5, 6); CheckIndexNull(_NLL, 1); int TM_Top = lua_gettop(_NLL); int TM_index = (int)lua_tointeger(_NLL, 1); int TM_windowtype = (int)lua_tointeger(_NLL, 2); int TM_buttontype = (int)lua_tointeger(_NLL, 3); int TM_seqno = (int)lua_tointeger(_NLL, 4); char *TM_data = lua_tostring(_NLL, 5); if(TM_data == NULL) { LRetErrInt(_NLL , -1, "对话框内容不能为nil"); } int TM_MeIndex = -1; int TM_fd = getfdFromCharaIndex(TM_index); if(TM_Top == 6) { CheckIndexNull(_NLL, 6); TM_MeIndex = (int)lua_tointeger(_NLL, 6); } lssproto_WN_send(TM_fd, TM_windowtype, TM_buttontype, TM_seqno, CHAR_getWorkInt( TM_MeIndex, CHAR_WORKOBJINDEX), TM_data); LRetInt(_NLL, 0); }
void NPC_PoolPetShop_DepotPet_Menu( int meindex, int talkerindex) { int fd; //print(" NPC_PoolPetShop_DepotPet_Menu "); fd = getfdFromCharaIndex( talkerindex); if( fd != -1 ) { char message[1024]; char buf[2048]; strcpy( message, "3\n\n" " ʹÓóèÎï²Ö¿â\n\n" " £¼´æ·Å³èÎ\n" " £¼È¡»Ø³èÎ\n" ); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, WINDOW_BUTTONTYPE_CANCEL, CHAR_WINDOWTYPE_DEPOTPETSHOP_HANDLE, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), makeEscapeString( message, buf, sizeof(buf))); } }
static void NPC_FmLetter_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_FmLetter_readData( meindex, num, FALSE) ) { print( "fmletter: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 CHAR_playerTalkedfunc( int charaindex, int talkindex,char* message, int color, int channel ) { int fd; char lastbuf[4096]; char mesgbuf[4096]; char escapebuf[4096]; int fmindex = CHAR_getInt( charaindex, CHAR_FMINDEX ); fd = getfdFromCharaIndex( charaindex ); if( fd == -1 )return; if( (channel>-1) && (fmindex>0) ) { if( channel == 0 ) { snprintf( lastbuf,sizeof(lastbuf),"P|[×å]%s", makeEscapeString( CHAR_appendNameAndTitle(talkindex, message, mesgbuf,sizeof(mesgbuf)), escapebuf,sizeof(escapebuf) )); } #ifdef _FMVER21 else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ) { #else else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == 1 ) { #endif snprintf( lastbuf,sizeof(lastbuf),"P|[×峤¹ã²¥]%s", makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), escapebuf,sizeof(escapebuf) )); } else { snprintf( lastbuf,sizeof(lastbuf),"P|[%d]%s",channel, makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), escapebuf,sizeof(escapebuf) )); } } else { snprintf( lastbuf,sizeof(lastbuf),"P|%s", makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), escapebuf,sizeof(escapebuf) )); } lssproto_TK_send( fd, CHAR_getWorkInt( talkindex, CHAR_WORKOBJINDEX ),lastbuf, color); }
/*---------------------------------------- * 穴永皿犯□正毛 月〔 * 婁醒 * charaindex int 平乓仿及奶件犯永弁旦 * 忒曰襖 * 岳 TRUE(1) * 撩 FALSE(0) ----------------------------------------*/ BOOL MAP_sendArroundChar(int charaindex) { int fd; fd = getfdFromCharaIndex( charaindex ); if( fd == -1 )return FALSE; return MAP_sendArroundCharNeedFD(fd, charaindex); }
static void NPC_TranserMan_selectWindow( int meindex, int toindex, int num,int select) { char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *npcarg; char token[256]; int buttontype = 0, windowtype = 0, windowno = 0; int fd = getfdFromCharaIndex( toindex); windowtype = WINDOW_MESSAGETYPE_MESSAGE; if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) return; } //memset( npcarg, 0, sizeof( npcarg)); if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==NULL){ print("TRANSER_MAN: GetArgStrErr!!"); return; } memset( token, 0, sizeof( token)); switch( num) { case WINDOW_START: if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { print("TranserMan Get START_MSG ERROR !"); return; } CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); buttontype = WINDOW_BUTTONTYPE_YESNO; windowno = NPC_TRANSERMAN_SELECT; break; case WINDOW_SELECT: if( TranserMan_GetMenuStr( meindex, toindex, npcarg, token) == FALSE ) { print( "TranserMan GetMenu ERROR !!"); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; buttontype = WINDOW_BUTTONTYPE_CANCEL; windowno = NPC_TRANSERMAN_WARP; break; case WINDOW_WARP: if( ActionNpc_CheckMenuFree( meindex, toindex, npcarg, select) == FALSE ){ memset( token, 0, sizeof( token)); if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FAIL_MSG", token, sizeof( token) ) != NULL) { CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); } } return; case WINDOW_END: break; } lssproto_WN_send( fd, windowtype, buttontype, windowno, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); }
BOOL NPC_PairForage( int meindex, int toindex, char *arg, char *token) { char buf1[256]; int i; int codes = CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE); int Psex = CHAR_getSexInt( CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) ); Psex = (Psex==1)?1:0; for( i=0; i<MAXPAIRNUMS; i++) {//forindex char *name; char *cdKey; int fd; char buf[256]; if( PairList[Psex][i].use <= 0 ) continue; if( !CHAR_CHECKINDEX( PairList[Psex][i].pindex) ) continue; if( CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) continue; if( codes != CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRCODE) ) continue; if( CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG) > 0 ) continue; name = CHAR_getChar( PairList[Psex][i].pindex, CHAR_NAME); cdKey = CHAR_getChar( PairList[Psex][i].pindex, CHAR_CDKEY); if( strcmp( PairList[Psex][i].name, name) || strcmp( PairList[Psex][i].cdKey, cdKey) ){ PairList[Psex][i].use = -1; PairList[Psex][i].forindex = -1; continue; } sprintf( token, "你的配对对象为: %s\n已送出邀请,请等候对方回应。", name); if( NPC_Util_GetStrFromStrWithDelim( arg, "InviteMsg", buf1, sizeof( buf1) ) == NULL){ break; } PairList[Psex][i].forindex = toindex; fd = getfdFromCharaIndex( PairList[Psex][i].pindex); CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, 1); CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, PairList[Psex][i].pindex); CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG, 2); CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRINDEX, toindex); name = CHAR_getChar( toindex, CHAR_NAME); sprintf( buf, "%s:\n玩家%s\n%s", CHAR_getChar( meindex, CHAR_NAME),name, buf1); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OKCANCEL, WINDOW_TALKPAIR, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf); break; } if( i>= MAXPAIRNUMS ) { if( NPC_Util_GetStrFromStrWithDelim( arg, "NoPairMsg", buf1, sizeof( buf1) ) != NULL){ sprintf( token, "%s",buf1); }else { sprintf( token, "没有找到对象。"); } if( CHAR_getWorkInt( toindex, CHAR_MYPAIRFLG) <= 0 ) { NPC_PairRegister( toindex); } return FALSE; } return TRUE; }
void NPC_BlackMarketTalked( int meindex, int talker, char *msg, int color) { char sBuf[512]="", tBuf[512]=""; if(!CHAR_CHECKINDEX( talker)) return; if(getfdFromCharaIndex( talker)==-1) return; if(CHAR_getInt( talker, CHAR_WHICHTYPE)!=CHAR_TYPEPLAYER) return; if(NPC_Util_isFaceToFace( talker, meindex, 1)!=TRUE) return; sprintf( tBuf, "嘿嘿....\n在我这边有各式各样的武器、防具及道具,你想要跟我交换吗?换好了可就不能反悔喔~"); lssproto_WN_send(getfdFromCharaIndex( talker), WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, CHAR_WINDOWTYPE_BLACKMARKET, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), makeEscapeString( tBuf, sBuf, sizeof(sBuf))); return; }
static void NPC_FreePetSkillShop_selectWindow( int meindex, int toindex, int num,int select) { char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *npcarg; char token[1024]; int fd = getfdFromCharaIndex( toindex); int buttontype = 0, windowtype = 0, windowno = 0; char buf1[256]; if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==NULL){ print("GetArgStrErr"); return ; } switch(num) { case START_WINDOW: { BOOL Evflg = TRUE; if( NPC_Util_GetStrFromStrWithDelim( npcarg, "start_msg", token, sizeof( token)) == NULL) { CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); return; } if( CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT) != 1 ) { CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); return; } //玩家條件判斷 if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf1, sizeof( buf1)) != NULL ) { if( NPC_ActionPassCheck( meindex, toindex, buf1) == FALSE ) { Evflg = FALSE; } } if( Evflg == FALSE) { CHAR_talkToCli( toindex, -1, "你想讓寵物學特殊技能?可你的條件還不夠喔!", CHAR_COLORYELLOW); CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); return; }else { windowtype = WINDOW_MESSAGETYPE_MESSAGE; buttontype = WINDOW_BUTTONTYPE_NEXT; windowno = SELECTSKILL_START; CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 2); lssproto_WN_send( fd, windowtype, buttontype, windowno, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token ); } } break; case SKILL_WINDOW: if( NPC_FreePetSkillMakeStr( meindex, toindex, select) == FALSE ) { print("\n npc_freepetskillshop.c 錯誤"); } break; case MEEND_WINDOW: break; } }
/* * int meindex:·ßÛм°(÷Ò¼°)Ä̼þ·¸Û͵© * int cliindex:Ýμ°Ä̼þ·¸Û͵© */ static void NPC_SimpleShopOpenShopWindow( int meindex, int cliindex, char *npcarg ) { int fd; int objindex; char tmp[1024*12], itemstr[1024 * 8]; char maincaption[SIMPLESHOPTALKBUFSIZE]; char buycaption[SIMPLESHOPTALKBUFSIZE]; char okbuycaption[SIMPLESHOPTALKBUFSIZE]; char sellcaption[SIMPLESHOPTALKBUFSIZE]; char oksellcaption[SIMPLESHOPTALKBUFSIZE]; char poorcaption[SIMPLESHOPTALKBUFSIZE]; char itemfullcaption[SIMPLESHOPTALKBUFSIZE]; getStringFromIndexWithDelim( npcarg,"|",MAINTOKEN, maincaption,sizeof(maincaption) ); getStringFromIndexWithDelim( npcarg,"|",BUYTOKEN, buycaption,sizeof(buycaption) ); getStringFromIndexWithDelim( npcarg,"|",OKBUYTOKEN, okbuycaption,sizeof(okbuycaption) ); getStringFromIndexWithDelim( npcarg,"|",SELLTOKEN, sellcaption,sizeof(sellcaption) ); getStringFromIndexWithDelim( npcarg,"|",OKSELLTOKEN, oksellcaption,sizeof(oksellcaption) ); getStringFromIndexWithDelim( npcarg,"|",POORTOKEN, poorcaption,sizeof(poorcaption)); getStringFromIndexWithDelim( npcarg,"|",ITEMFULLTOKEN, itemfullcaption,sizeof(itemfullcaption)); tmp[0] = 0; NPC_SimpleShopGetEscapedItemString( meindex, cliindex, itemstr ); objindex = CHAR_getWorkInt( meindex,CHAR_WORKOBJINDEX ); snprintf( tmp,sizeof(tmp),"S|%d|%s|%s|%s|" "%s|%s|%s|%s|" "-1|%d%s", objindex, maincaption, buycaption, okbuycaption, sellcaption, oksellcaption, poorcaption, itemfullcaption, NPC_SimpleShopGetItemNum( meindex ), itemstr ); fd = getfdFromCharaIndex( cliindex ); if( fd == -1 )return; lssproto_TK_send(fd, -1 ,tmp, CHAR_COLORWHITE ); }
BOOL ADDRESSBOOK_sendAddressbookTable( int cindex ) { int stringlen=0; int i; if( !CHAR_CHECKINDEX( cindex ) )return FALSE; for( i=0 ; i<ADDRESSBOOK_MAX ; i++){ ADDRESSBOOK_entry *ae; ae = CHAR_getAddressbookEntry( cindex , i ); if( ae && ae->use ){ char tmp[CHARNAMELEN+32]; char charname_escaped[CHARNAMELEN*2]; makeEscapeString( ae->charname, charname_escaped , sizeof(charname_escaped )); /* »ÈÍѥե饰| Á°|¥ì¥Ù¥ë|¥é¥¤¥Õ|¥Õ¥é¥° */ snprintf( tmp , sizeof( tmp ), "%d|%s|%d|%d|%d|%d|%d|" , ae->use, charname_escaped , ae->level , ae->duelpoint,ae->online,ae->graphicsno, ae->transmigration); strcpysafe ( ADDRESSBOOK_returnstring + stringlen , sizeof(ADDRESSBOOK_returnstring) - stringlen, tmp ); stringlen += strlen( tmp ); if( stringlen >= sizeof(ADDRESSBOOK_returnstring) ) { break; } }else{ /*»È¤Ã¤Æ¤Ê¤¤¥Ç¡¼¥¿¤â¨R«à¤Î¤ß¤ÇÁ÷¤ë */ char tmp[32]; snprintf( tmp , sizeof( tmp ), "|||||||" ); strcpysafe ( ADDRESSBOOK_returnstring + stringlen , sizeof(ADDRESSBOOK_returnstring) - stringlen, tmp ); stringlen += strlen( tmp ); if( stringlen >= sizeof(ADDRESSBOOK_returnstring)) { break; } } } dchop( ADDRESSBOOK_returnstring, "|" ); { int fd; fd = getfdFromCharaIndex( cindex ); if( fd == -1 ) return FALSE; lssproto_AB_send( fd, ADDRESSBOOK_returnstring ); } return TRUE; }
void CHAR_sendWallDamage( int charaindex,int x, int y, int damage ) { int fd; char cabuf[256]=""; fd = getfdFromCharaIndex(charaindex); if( fd == -1 )return; CHAR_makeCADAMAGEStringFromSpecifiedCoordinate( x,y,cabuf,sizeof(cabuf),SPR_kmydam,damage ); CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); }
static void NPC_PetFusion_selectWindow( int meindex, int toindex, int num,int select) { char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *npcarg; char token[256]; int buttontype = 0, windowtype = 0, windowno = 0; int fd = getfdFromCharaIndex( toindex); windowtype = WINDOW_MESSAGETYPE_MESSAGE; if( Action_PartyCheck( meindex, toindex) == FALSE) { CHAR_talkToCli( toindex, meindex, "請一個一個來!", CHAR_COLORYELLOW); return; } //memset( npcarg, 0, sizeof( npcarg)); if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==NULL){ print("err NPC_MakePairMan: GetArgStrErr!!"); return; } memset( token, 0, sizeof( token)); switch( num){ case WINDOW_START: if( NPC_Util_GetStrFromStrWithDelim( npcarg, "StartMsg", token, sizeof( token) ) == NULL){ return; } buttontype = WINDOW_BUTTONTYPE_YESNO; windowno = WINDOW_TALKSTART; break; case WINDOW_SELECT: if( ActionNpc_CheckFree( meindex, toindex, npcarg) == FALSE ) { buttontype = WINDOW_BUTTONTYPE_OK; windowno = WINDOW_TALKEND; }else { if( NPC_Util_GetStrFromStrWithDelim( npcarg, "SelectMsg", token, sizeof( token) ) == NULL){ return; } windowtype = WINDOWS_MESSAGETYPE_PETFUSION; buttontype = WINDOW_BUTTONTYPE_YESNO; windowno = WINDOW_TALKSELECT; } break; case WINDOW_FUSION: //融合處理 break; case WINDOW_WARP: break; case WINDOW_END: break; } CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, windowno); lssproto_WN_send( fd, windowtype, buttontype, windowno, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); }
/* * int meindex : ÷Ò¼°index * int playerindex : ËüÄ̼þÓñËüëÇëÔÊÃóÒÁÄÌØÀ¡õ¼°index * char *str : */ static void NPC_SimpleShopNormalWindow( int meindex, int playerindex, char *str ) { int fd; int objindex; char tmp[512], *name; objindex = CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX); name = CHAR_getChar( meindex, CHAR_NAME ); snprintf(tmp,sizeof(tmp),"W|%d|N|%s|123|%s", objindex, name, str ); fd = getfdFromCharaIndex(playerindex); if( fd == -1 ) return; lssproto_TK_send(fd,-1,tmp,CHAR_COLORWHITE ); }
// CoolFish: Family Adv 2001/7/29 void AddFMAdv(int talker, int shiftbit) { int fmadv = 0; char buf[256]; #ifdef _FMVER21 #else if (CHAR_getInt(talker, CHAR_FMINDEX) < 0) return; if (CHAR_getInt(talker, CHAR_FMLEADERFLAG) <= 0) return; if (strcmp(CHAR_getChar(talker, CHAR_FMNAME), "") == 0) return; #endif if (shiftbit >= arraysizeof(FMAdvTbl)) return; else fmadv = FMAdvTbl[shiftbit]; if (fmadv <= 0) return; sprintf(buf, "%d", fmadv); #ifdef _PERSONAL_FAME // Arminius 8.30: 家族个人声望 CHAR_earnFame(talker, fmadv); #endif #ifdef _FMVER21 if (CHAR_getInt(talker, CHAR_FMLEADERFLAG) > 0 && CHAR_getInt(talker, CHAR_FMLEADERFLAG) != FMMEMBER_APPLY) { // CoolFish: 2001/10/03 int fd = getfdFromCharaIndex(talker); saacproto_ACFixFMData_send(acfd, CHAR_getChar(talker, CHAR_FMNAME), CHAR_getInt(talker, CHAR_FMINDEX), CHAR_getWorkInt(talker, CHAR_WORKFMINDEXI), FM_FIX_FMADV, buf, "", // CoolFish: 2001/10/03 CHAR_getWorkInt(talker, CHAR_WORKFMCHARINDEX), CONNECT_getFdid(fd)); // CHAR_getWorkInt(talker, CHAR_WORKFMCHARINDEX), 0); } #else saacproto_ACFixFMData_send(acfd, CHAR_getChar(talker, CHAR_FMNAME), CHAR_getInt(talker, CHAR_FMINDEX), CHAR_getWorkInt(talker, CHAR_WORKFMINDEXI), FM_FIX_FMADV, buf, "", CHAR_getWorkInt(talker, CHAR_WORKFMCHARINDEX), 0); #endif }
// shan add errNO=1(���) void NPC_ERR_DiSP1(int meindex,int talker,int errNO) { char token[1024]; int i=0; int otherindex; int fd = getfdFromCharaIndex( talker); char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL) { print("GetArgStrErr"); return ; } if(errNO==1) { if(NPC_Util_GetStrFromStrWithDelim( npcarg, "PartyMsg",token, sizeof( token))==NULL) { sprintf(token, "�����Ŷ��볡��\n\n����Ŷӽ�ɢ֮���ٸ���\n�볡��"); } if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE)==CHAR_PARTY_CLIENT) { } else { for( i=0 ; i < CHAR_PARTYMAX ; i++) { otherindex=CHAR_getWorkInt(talker,CHAR_WORKPARTYINDEX1+i); if(otherindex != -1) { fd = getfdFromCharaIndex( otherindex); lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, CHAR_WINDOWTYPE_WINDOWWARPMAN_ERR, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); } } return ; } } }
BOOL ADDRESSBOOK_sendAddressbookTableOne( int cindex, int num ) { int stringlen=0; ADDRESSBOOK_entry *ae; if( !CHAR_CHECKINDEX( cindex ) )return FALSE; if( num < 0 || num > ADDRESSBOOK_MAX) return FALSE; ae = CHAR_getAddressbookEntry( cindex , num ); if( ae && ae->use ){ char tmp[CHARNAMELEN+32]; char charname_escaped[CHARNAMELEN*2]; makeEscapeString( ae->charname, charname_escaped , sizeof(charname_escaped )); snprintf( tmp , sizeof( tmp ), "%d|%s|%d|%d|%d|%d|%d|" , ae->use, charname_escaped , ae->level , ae->duelpoint,ae->online,ae->graphicsno, ae->transmigration); strcpysafe ( ADDRESSBOOK_returnstring + stringlen , sizeof(ADDRESSBOOK_returnstring) - stringlen, tmp ); stringlen += strlen( tmp ); if( stringlen >= sizeof(ADDRESSBOOK_returnstring) ) { return FALSE; } }else{ char tmp[32]; snprintf( tmp , sizeof( tmp ), "|||||||" ); strcpysafe ( ADDRESSBOOK_returnstring + stringlen , sizeof(ADDRESSBOOK_returnstring) - stringlen, tmp ); stringlen += strlen( tmp ); if( stringlen >= sizeof(ADDRESSBOOK_returnstring)) { return FALSE; } } { int fd; fd = getfdFromCharaIndex( cindex ); if( fd == -1 ) return FALSE; lssproto_ABI_send( fd, num, ADDRESSBOOK_returnstring ); } return TRUE; }
void ChatRoom_Join ( int myindex , int num ) { int fd ; char buf[64]; if ( !CHAR_CHECKINDEX ( myindex ) ) return ; if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) != 0 ) return ; if ( ChatRoom[ num ].useFlag == TRUE && ChatRoom[ num ].NowPeople < MAX_PPLINROOM ) { sprintf ( buf , "J|%s|%d" , CHAR_getChar( myindex , CHAR_NAME ) , myindex ) ; fd = getfdFromCharaIndex( ChatRoom[ num ].Maker ); lssproto_CHATROOM_send ( fd , buf ); }else if ( ChatRoom[ num ].NowPeople >= MAX_PPLINROOM ) CHAR_talkToCli ( myindex , -1 , "聊天室人数已满!" , CHAR_COLORRED ) ; }
static void NPC_LuckyMan_selectWindow( int meindex, int toindex, int num,char *msg) { int fd = getfdFromCharaIndex( toindex); char token[1024]; int buttontype = 0,windowtype = 0,windowno = 0; switch( num){ case 1: sprintf(token ," ¡î½ñÈÕµÄÔËÊÆ¡î " "\n\n%s",msg ); buttontype = WINDOW_BUTTONTYPE_OK; windowtype = WINDOW_MESSAGETYPE_MESSAGE; windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; break; case 2: sprintf(token, " ¡îÕ¼²·Ê¦¡î " "\n\n%s",msg ); buttontype = WINDOW_BUTTONTYPE_YESNO; windowtype = WINDOW_MESSAGETYPE_MESSAGE; windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; break; case 3: sprintf(token, " ¡îÕ¼²·Ê¦¡î " "\n\n%s",msg ); buttontype = WINDOW_BUTTONTYPE_OK; windowtype = WINDOW_MESSAGETYPE_MESSAGE; windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; break; } /*--˪ññ--*/ lssproto_WN_send( fd, windowtype, buttontype, windowno, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); }