2016-12-24 08:45:52 +08:00
|
|
|
|
#include "version.h"
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include "char.h"
|
|
|
|
|
#include "object.h"
|
|
|
|
|
#include "char_base.h"
|
|
|
|
|
#include "npcutil.h"
|
|
|
|
|
#include "lssproto_serv.h"
|
|
|
|
|
#include "npc_charm.h"
|
|
|
|
|
|
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
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
//荚汊汹反{ㄤ匹允[
|
2016-12-24 08:45:52 +08:00
|
|
|
|
/*
|
2017-01-13 23:37:03 +08:00
|
|
|
|
#define RATE 4 //伊□玄"
|
|
|
|
|
#define CHARMHEAL 5 // 及荚汊汹
|
|
|
|
|
#define WARU 3 // 毛喃月袄
|
2016-12-24 08:45:52 +08:00
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
#define RATE 10 //伊□玄"
|
|
|
|
|
#define CHARMHEAL 5 // 及荚汊汹
|
|
|
|
|
#define WARU 3 // 毛喃月袄
|
2016-12-24 08:45:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void NPC_Charm_selectWindow( int meindex, int toindex, int num);
|
|
|
|
|
int NPC_CharmCost(int meindex,int talker);
|
|
|
|
|
void NPC_CharmUp(int meindex,int talker);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************
|
2017-01-13 23:37:03 +08:00
|
|
|
|
* 赓渝质
|
2016-12-24 08:45:52 +08:00
|
|
|
|
*********************************/
|
|
|
|
|
BOOL NPC_CharmInit( int meindex )
|
|
|
|
|
{
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--平乓仿及正奶皿毛涩烂--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPECHARM );
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************
|
2017-01-13 23:37:03 +08:00
|
|
|
|
* 仄井仃日木凶凛及质
|
2016-12-24 08:45:52 +08:00
|
|
|
|
*********************************/
|
|
|
|
|
void NPC_CharmTalked( int meindex , int talkerindex , char *szMes ,int color )
|
|
|
|
|
{
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/* 皿伊奶乩□卞覆仄化分仃 杀允月 */
|
2016-12-24 08:45:52 +08:00
|
|
|
|
if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*-- 及蟆卞中月井升丹井"--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) {
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/* ㄠ弘伉永玉动 及心 */
|
2016-12-24 08:45:52 +08:00
|
|
|
|
if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NPC_Charm_selectWindow( meindex, talkerindex, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2017-01-13 23:37:03 +08:00
|
|
|
|
* 备质 卞坌仃月
|
2016-12-24 08:45:52 +08:00
|
|
|
|
*/
|
|
|
|
|
static void NPC_Charm_selectWindow( int meindex, int toindex, int num)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
char token[1024];
|
|
|
|
|
char escapedname[1024];
|
|
|
|
|
int fd = getfdFromCharaIndex( toindex);
|
|
|
|
|
int buttontype = 0;
|
|
|
|
|
int windowtype = 0;
|
|
|
|
|
int windowno = 0;
|
|
|
|
|
int cost = 0;
|
|
|
|
|
int chartype;
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--它奶件玉它正奶皿丢永本□斥互云云中及匹燮卞涩烂--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
windowtype = WINDOW_MESSAGETYPE_MESSAGE;
|
|
|
|
|
|
|
|
|
|
switch( num) {
|
|
|
|
|
case 0:
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--蓟 --*/
|
|
|
|
|
sprintf(token,"4\n 美容师 "
|
|
|
|
|
"\n\n 欢迎光临,今天要做什麽呢?"
|
2016-12-24 08:45:52 +08:00
|
|
|
|
"\n "
|
2017-01-13 23:37:03 +08:00
|
|
|
|
"\n\n 《 给我魅力 》 "
|
|
|
|
|
"\n\n 《 什麽也不做 》 "
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
buttontype = WINDOW_BUTTONTYPE_NONE;
|
|
|
|
|
windowtype = WINDOW_MESSAGETYPE_SELECT;
|
|
|
|
|
windowno = CHAR_WINDOWTYPE_CHARM_START;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
cost = NPC_CharmCost( meindex, toindex);
|
|
|
|
|
if(cost == -1){
|
2017-01-13 23:37:03 +08:00
|
|
|
|
sprintf(token," 美容师 "
|
|
|
|
|
"\n\n 你的魅力真是完美"
|
|
|
|
|
"\n\n 请永远保持你的魅力唷。"
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
buttontype = WINDOW_BUTTONTYPE_OK;
|
|
|
|
|
}else{
|
2017-01-13 23:37:03 +08:00
|
|
|
|
sprintf(token," 美容师 "
|
|
|
|
|
"\n 现在,千禧特惠价实施中??"
|
|
|
|
|
"\n\n 要将你的魅力上升五点的话"
|
|
|
|
|
"\n 需要%6d的stone唷!"
|
|
|
|
|
"\n\n 即使这样也可以吗?",cost
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
buttontype = WINDOW_BUTTONTYPE_YESNO;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
windowtype = WINDOW_MESSAGETYPE_MESSAGE;
|
|
|
|
|
windowno = CHAR_WINDOWTYPE_CHARM_END;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
cost = NPC_CharmCost( meindex, toindex);
|
|
|
|
|
chartype = CHAR_getInt( toindex, CHAR_IMAGETYPE);
|
|
|
|
|
|
|
|
|
|
if(cost > CHAR_getInt( toindex, CHAR_GOLD)) {
|
2017-01-13 23:37:03 +08:00
|
|
|
|
sprintf(token," 美容师 "
|
|
|
|
|
"\n\n 哎呀!你的钱不够唷!"
|
|
|
|
|
"\n 先去存好钱下次再来吧!"
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
NPC_CharmUp( meindex, toindex);
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--平乓仿及正奶皿卞方匀化丢永本□斥毛 尹化心凶--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
switch( chartype) {
|
|
|
|
|
case CHAR_IMAGETYPE_GIRL:
|
2017-01-13 23:37:03 +08:00
|
|
|
|
sprintf(token," 美容师 "
|
|
|
|
|
"\n\n 嗯,这样你的魅力就上升罗!"
|
|
|
|
|
"\n\n 愈来愈可爱了呢!"
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case CHAR_IMAGETYPE_BOY:
|
2017-01-13 23:37:03 +08:00
|
|
|
|
sprintf(token," 美容师 "
|
|
|
|
|
"\n\n 嗯,这样你的魅力就上升罗!"
|
|
|
|
|
"\n\n 是不是比刚才要帅多了呢?"
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CHAR_IMAGETYPE_CHILDBOY:
|
|
|
|
|
case CHAR_IMAGETYPE_CHILDGIRL:
|
2017-01-13 23:37:03 +08:00
|
|
|
|
sprintf(token," 美容师 "
|
|
|
|
|
"\n\n 嗯,这样你的魅力就上升罗!"
|
|
|
|
|
"\n\n 真的变得好可爱唷!"
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CHAR_IMAGETYPE_MAN:
|
2017-01-13 23:37:03 +08:00
|
|
|
|
sprintf(token," 美容师 "
|
|
|
|
|
"\n\n 嗯,这样你的魅力就上升罗!"
|
|
|
|
|
"\n\n 变得更酷了呢!"
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CHAR_IMAGETYPE_WOMAN:
|
2017-01-13 23:37:03 +08:00
|
|
|
|
sprintf(token," 美容师 "
|
|
|
|
|
"\n\n 嗯,这样你的魅力就上升罗!"
|
|
|
|
|
"\n\n 可真是变得愈来愈美了呢!"
|
2016-12-24 08:45:52 +08:00
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buttontype = WINDOW_BUTTONTYPE_OK;
|
|
|
|
|
windowtype = WINDOW_MESSAGETYPE_MESSAGE;
|
|
|
|
|
windowno = CHAR_WINDOWTYPE_CHARM_END;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
makeEscapeString( token, escapedname, sizeof( escapedname));
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*-仇仇匹霜耨允月--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
lssproto_WN_send( fd, windowtype,
|
|
|
|
|
buttontype,
|
|
|
|
|
windowno,
|
|
|
|
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|
|
|
|
escapedname);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------
|
2017-01-13 23:37:03 +08:00
|
|
|
|
弁仿奶失件玄井日忒匀化五凶凛卞裟太请今木月[
|
2016-12-24 08:45:52 +08:00
|
|
|
|
-------------------------------------------*/
|
|
|
|
|
void NPC_CharmWindowTalked( int meindex, int talkerindex,
|
|
|
|
|
int seqno, int select, char *data)
|
|
|
|
|
{
|
|
|
|
|
if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) return;
|
|
|
|
|
|
|
|
|
|
switch( seqno){
|
|
|
|
|
case CHAR_WINDOWTYPE_CHARM_START:
|
|
|
|
|
if(atoi( data) == 2) {
|
|
|
|
|
NPC_Charm_selectWindow( meindex, talkerindex, 1 );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CHAR_WINDOWTYPE_CHARM_END:
|
|
|
|
|
if(select == WINDOW_BUTTONTYPE_YES) {
|
|
|
|
|
NPC_Charm_selectWindow( meindex, talkerindex, 2 );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-- --*/
|
|
|
|
|
void NPC_CharmUp(int meindex,int talker)
|
|
|
|
|
{
|
|
|
|
|
int cost;
|
|
|
|
|
int i;
|
|
|
|
|
int petindex;
|
|
|
|
|
char petsend[64];
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--云嗯毛蛹日仄引仄斤丹--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
cost = NPC_CharmCost( meindex, talker);
|
|
|
|
|
CHAR_setInt( talker, CHAR_GOLD,
|
|
|
|
|
CHAR_getInt( talker, CHAR_GOLD) - cost);
|
|
|
|
|
CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*-- 互ㄠㄟㄟ动晓卞卅月桦宁反雄娄卞ㄠㄟㄟ卞允月--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
if(CHAR_getInt( talker, CHAR_CHARM) + CHARMHEAL >= 100) {
|
|
|
|
|
CHAR_setInt( talker, CHAR_CHARM, 100);
|
|
|
|
|
}else{
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*-- 毛本永玄--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
CHAR_setInt(talker, CHAR_CHARM,
|
|
|
|
|
(CHAR_getInt( talker, CHAR_CHARM) + CHARMHEAL));
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--旦 □正旦及凳蕙--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
CHAR_complianceParameter( talker );
|
|
|
|
|
CHAR_send_P_StatusString( talker, CHAR_P_STRING_CHARM);
|
|
|
|
|
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--矢永玄及由仿丢□正毛凳蕙--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
for( i = 0 ; i < CHAR_MAXPETHAVE ; i++){
|
|
|
|
|
petindex = CHAR_getCharPet( talker, i);
|
|
|
|
|
|
|
|
|
|
if( petindex == -1 ) continue;
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/* 平乓仿及 民尼永弁 */
|
2016-12-24 08:45:52 +08:00
|
|
|
|
if( !CHAR_CHECKINDEX( talker ) ) continue;
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--由仿丢□正譬帮--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
CHAR_complianceParameter( petindex );
|
|
|
|
|
sprintf( petsend, "K%d", i );
|
|
|
|
|
CHAR_sendStatusString( talker , petsend );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*--云嗯及煌遥--*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
int NPC_CharmCost(int meindex,int talker)
|
|
|
|
|
{
|
|
|
|
|
int cost;
|
|
|
|
|
int level;
|
|
|
|
|
int charm;
|
|
|
|
|
int trans;
|
|
|
|
|
|
|
|
|
|
level = CHAR_getInt( talker, CHAR_LV);
|
|
|
|
|
charm = CHAR_getInt( talker, CHAR_CHARM);
|
|
|
|
|
trans = CHAR_getInt( talker, CHAR_TRANSMIGRATION);
|
|
|
|
|
|
|
|
|
|
if(charm >= 100) return -1;
|
|
|
|
|
|
|
|
|
|
if(charm <= 1) charm = WARU;
|
|
|
|
|
|
2017-01-13 23:37:03 +08:00
|
|
|
|
/*-- 煌遥挚 --*/
|
2016-12-24 08:45:52 +08:00
|
|
|
|
cost = level * RATE * (charm / WARU) * (trans+1);
|
|
|
|
|
|
|
|
|
|
return cost;
|
|
|
|
|
|
|
|
|
|
}
|