chuyiwen_gmsv/npc/npc_oldman.c

111 lines
3.4 KiB
C
Raw Normal View History

2016-12-24 08:45:52 +08:00
#include "version.h"
#include "object.h"
#include "char_base.h"
#include "char.h"
#include "util.h"
#include "npcutil.h"
#include "npc_oldman.h"
#include "title.h"
#include "char_data.h"
#include "readmap.h"
/* hoge */
BOOL NPC_OldmanInit( int meindex )
{
return FALSE;
}
/*
*
2017-01-13 23:37:03 +08:00
*
2016-12-24 08:45:52 +08:00
*
2017-01-13 23:37:03 +08:00
*
*
2016-12-24 08:45:52 +08:00
* * by ringo
*/
void NPC_OldmanTalked( int meindex , int talkerindex , char *msg , int color )
{
char message[1024];
char *n = CHAR_getChar( talkerindex , CHAR_NAME );
int title_change = 0;
2017-01-13 23:37:03 +08:00
/* 反卅仄井仃凶蛊卞愤坌及ID毛筏盛今六月 */
2016-12-24 08:45:52 +08:00
CHAR_setInt( talkerindex, CHAR_LASTTALKELDER ,
CHAR_getWorkInt( meindex, CHAR_WORKOLDMANID ) );
/*
2017-01-13 23:37:03 +08:00
if( title_change == 0 && strcmp( n , "苹果" ) == 0 ){
2016-12-24 08:45:52 +08:00
if( NPC_Util_HaveTitle( talkerindex , 3 ) == 0 ){
char *ts;
NPC_Util_AddOneTitle( talkerindex , 3 );
ts = TITLE_makeTitleStatusString( talkerindex , 3 );
snprintf( message , sizeof(message),
2017-01-13 23:37:03 +08:00
"那是个不错的名字, 就叫%s吧",
2016-12-24 08:45:52 +08:00
ts );
title_change = 1;
}
}
*/
{
int addcnt,delcnt;
title_change = TITLE_TitleCheck_Nomsg( talkerindex, 0, &addcnt, &delcnt);
if( !title_change){
snprintf( message, sizeof( message ) ,
2017-01-13 23:37:03 +08:00
"来的好%s在给你称号时"
"不是还没来吗?" , n );
2016-12-24 08:45:52 +08:00
CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE );
}
else {
#define NPC_OLDMAN_TITLE_UNIT1 "TSU"
#define NPC_OLDMAN_TITLE_UNIT2 "KO"
2017-01-13 23:37:03 +08:00
snprintf( message, sizeof( message ) ,"来的好%s",n );
2016-12-24 08:45:52 +08:00
CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE );
if( delcnt > 0 && addcnt > 0 ) {
snprintf( message, sizeof( message ) ,
2017-01-13 23:37:03 +08:00
"你丧失了%d%s 称号的资格。"
"不是得到了%d%s 的称号资格吗?"
2016-12-24 08:45:52 +08:00
, delcnt,
delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2,
addcnt,
addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2
);
CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE );
}
else if( delcnt > 0 ) {
snprintf( message, sizeof( message ) ,
2017-01-13 23:37:03 +08:00
"你已丧失得到%d%s称号的资格。", delcnt,
2016-12-24 08:45:52 +08:00
delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2);
CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE );
}
else if( addcnt > 0 ) {
snprintf( message, sizeof( message ) ,
2017-01-13 23:37:03 +08:00
"给你%d%s的称号吧", addcnt, // CoolFish: d%s -> %d%s 2001/4/18
2016-12-24 08:45:52 +08:00
addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2);
CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE );
}
if( delcnt > 0 ) {
snprintf( message, sizeof( message),
2017-01-13 23:37:03 +08:00
"失去%d%s 称号!", delcnt,
2016-12-24 08:45:52 +08:00
delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2);
CHAR_talkToCli( talkerindex, -1, message, CHAR_COLORYELLOW);
}
if( addcnt > 0 ) {
snprintf( message, sizeof( message),
2017-01-13 23:37:03 +08:00
"获得%d%s 称号!", addcnt,
2016-12-24 08:45:52 +08:00
addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2);
CHAR_talkToCli( talkerindex, -1, message, CHAR_COLORYELLOW);
}
}
}
if( title_change ) CHAR_sendStatusString( talkerindex , "T" );
}