182 lines
4.4 KiB
C
182 lines
4.4 KiB
C
![]() |
#include "version.h"
|
|||
|
#include <stdio.h>
|
|||
|
#include <string.h>
|
|||
|
#include <ctype.h>
|
|||
|
|
|||
|
#include "object.h"
|
|||
|
#include "char_base.h"
|
|||
|
#include "char.h"
|
|||
|
#include "util.h"
|
|||
|
#include "npcutil.h"
|
|||
|
#include "item.h"
|
|||
|
#include "readmap.h"
|
|||
|
|
|||
|
|
|||
|
#define RANGE 2
|
|||
|
void NPC_HealerSpeak( int index, int talker);
|
|||
|
void NPC_HealerAllHeal( int talker );
|
|||
|
BOOL NPC_MoneyCheck(int meindex,int talker);
|
|||
|
int NPC_CostCheck(int talker);
|
|||
|
void NPC_CharCheckPoint(int meindex,int talker);
|
|||
|
int NPC_WorkInput(int meindex,int talker);
|
|||
|
|
|||
|
|
|||
|
/**********************************
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
************************************/
|
|||
|
BOOL NPC_HealerInit( int meindex )
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD>ס<EFBFBD><D7A1>¡<EFBFBD><C2A1><EFBFBD>ɬ<EFBFBD><C9AC>
|
|||
|
CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEHEALER );
|
|||
|
// <20><>ƥ<EFBFBD><C6A5>ئ<EFBFBD><D8A6> ۢئ<DBA2>о<EFBFBD><D0BE><EFBFBD>
|
|||
|
CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 );
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľئ<C4BE><D8A6>
|
|||
|
// CHAR_setFlg( meindex , CHAR_ISOVERED , 0 );
|
|||
|
|
|||
|
return TRUE;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*-------------------------------------------
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD>HP,MPë<EFBFBD>巰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
--------------------------------------------*/
|
|||
|
void NPC_HealerTalked( int meindex , int talker , char *msg ,int color )
|
|||
|
{
|
|||
|
|
|||
|
char* npcarg;
|
|||
|
char token[32];
|
|||
|
int msgNo;
|
|||
|
|
|||
|
|
|||
|
npcarg = CHAR_getChar(meindex,CHAR_NPCARGUMENT);
|
|||
|
|
|||
|
getStringFromIndexWithDelim( npcarg, "|", 1, token,sizeof( token));
|
|||
|
msgNo = atoi( token );
|
|||
|
|
|||
|
/*---<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>帲<EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD> ɱ<><C9B1><EFBFBD><EFBFBD>---*/
|
|||
|
if( CHAR_getInt( talker , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return;
|
|||
|
|
|||
|
/*--- <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>---*/
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
|||
|
if( NPC_Util_CharDistance( talker, meindex ) > 2) return;
|
|||
|
|
|||
|
if( (CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) == 0)
|
|||
|
|| (CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) == 2) )
|
|||
|
{
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽﵤ--*/
|
|||
|
NPC_HealerAllHeal( talker);
|
|||
|
if(msgNo == 1) {
|
|||
|
CHAR_talkToCli( talker, meindex,
|
|||
|
"<EFBFBD>Ѿ<EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´εı<EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD><EFBFBD>ࡣ<EFBFBD>",CHAR_COLORWHITE);
|
|||
|
|
|||
|
}else if(msgNo == 2) {
|
|||
|
CHAR_talkToCli( talker, meindex,
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD>ɣ<EFBFBD>",CHAR_COLORWHITE);
|
|||
|
}
|
|||
|
|
|||
|
}else{
|
|||
|
int i = 0;
|
|||
|
int otherindex;
|
|||
|
|
|||
|
for( i=0 ; i < CHAR_PARTYMAX ; i++)
|
|||
|
{
|
|||
|
otherindex = CHAR_getWorkInt( talker, CHAR_WORKPARTYINDEX1 + i);
|
|||
|
if(otherindex != -1){
|
|||
|
|
|||
|
NPC_HealerAllHeal( otherindex);
|
|||
|
if(msgNo == 1) {
|
|||
|
CHAR_talkToCli( otherindex, meindex,
|
|||
|
"<EFBFBD>Ѿ<EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´εı<EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD><EFBFBD>ࡣ<EFBFBD>",CHAR_COLORWHITE);
|
|||
|
|
|||
|
}else if(msgNo == 2) {
|
|||
|
CHAR_talkToCli( otherindex, meindex,
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD>ɣ<EFBFBD>",CHAR_COLORWHITE);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*----------------------*/
|
|||
|
/* <20><><EFBFBD><EFBFBD> */
|
|||
|
/*-----------------------*/
|
|||
|
void NPC_HealerAllHeal( int talker )
|
|||
|
{
|
|||
|
int i;
|
|||
|
int petindex;
|
|||
|
char petsend[3];
|
|||
|
char msgbuf[5];
|
|||
|
|
|||
|
CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) );
|
|||
|
CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) );
|
|||
|
|
|||
|
|
|||
|
|
|||
|
for(i = 0 ; i < CHAR_MAXPETHAVE; i ++) {
|
|||
|
petindex = CHAR_getCharPet( talker, i);
|
|||
|
|
|||
|
if( petindex == -1 ) continue;
|
|||
|
|
|||
|
/* ƽ<>ҷ¼<D2B7> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
if( !CHAR_CHECKINDEX( talker ) ) continue;
|
|||
|
|
|||
|
/* ʸ<><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>index<65><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD> */
|
|||
|
if( CHAR_CHECKINDEX( petindex) == FALSE ) continue;
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>--*/
|
|||
|
CHAR_setFlg( petindex, CHAR_ISDIE, 0);
|
|||
|
CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) );
|
|||
|
CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) );
|
|||
|
|
|||
|
/*--<2D>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>Ʃ<EFBFBD><C6A9>--*/
|
|||
|
CHAR_complianceParameter( petindex );
|
|||
|
sprintf( petsend, "K%d", i );
|
|||
|
CHAR_sendStatusString( talker , petsend );
|
|||
|
}
|
|||
|
|
|||
|
/*---<2D><><EFBFBD><EFBFBD><DEBB><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><DEB1><EFBFBD>˪<EFBFBD><CBAA>--*/
|
|||
|
if(CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE )
|
|||
|
{
|
|||
|
int topartyarray = -1;
|
|||
|
int oyaindex = CHAR_getWorkInt( talker , CHAR_WORKPARTYINDEX1);
|
|||
|
|
|||
|
if( CHAR_CHECKINDEX( oyaindex )) {
|
|||
|
int i;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB> */
|
|||
|
for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
|
|||
|
int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 + i);
|
|||
|
if( CHAR_CHECKINDEX( workindex) ) {
|
|||
|
if( workindex == talker ) {
|
|||
|
topartyarray = i;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
|
|||
|
int otherindex = CHAR_getPartyIndex( talker, i);
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>ë˪<C3AB><CBAA> */
|
|||
|
if( CHAR_CHECKINDEX( otherindex) ) {
|
|||
|
snprintf( msgbuf, sizeof( msgbuf), "N%d", topartyarray);
|
|||
|
if( otherindex != talker) {
|
|||
|
CHAR_sendStatusString( otherindex, msgbuf);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*--<2D>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>˪Ի--*/
|
|||
|
CHAR_send_P_StatusString( talker, CHAR_P_STRING_HP);
|
|||
|
CHAR_send_P_StatusString( talker, CHAR_P_STRING_MP);
|
|||
|
|
|||
|
}
|
|||
|
|