StoneAge/gmsv/npc/npc_verywelfare.c

101 lines
3.0 KiB
C
Raw Normal View History

2018-08-07 15:51:35 +08:00
#include "version.h"
#include <string.h>
#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_verywelfare.h"
#ifdef _NPC_VERYWELFARE
static void NPC_VeryWelfare_selectWindow(int meindex, int toindex, int num, int select);
//<2F><><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><C7B3>ÿ<EFBFBD>NPC<50>ij<EFBFBD>ʼ<EFBFBD><CABC>
BOOL NPC_VeryWelfareInit( int meindex )
{
CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEVERYWELFARE);
print("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n",CHAR_getChar( meindex, CHAR_NAME));
return TRUE;
}
//<2F>Ի<EFBFBD>ʱ<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
void NPC_VeryWelfareTalked( int meindex , int talkerindex , char *szMes ,int color )
{
if( NPC_Util_isFaceToFace( talkerindex, meindex , 1 ) == FALSE )
return;
//<2F><>ʼ<EFBFBD><CABC>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
NPC_VeryWelfare_selectWindow( meindex, talkerindex, 0, -1);
}
static void NPC_VeryWelfare_selectWindow( int meindex, int toindex, int num,int select)
{
int buttontype = 0,windowtype = 0,windowno = 0;
char buf[256];
int fd = getfdFromCharaIndex( toindex);
char token[256];
if( fd == -1 )
return;
switch(num)
{
case 0:
sprintf(token,"%s","<EFBFBD><EFBFBD><EFBFBD>Ƿdz<EFBFBD><EFBFBD>ÿ<EFBFBD>A<EFBFBD><EFBFBD>NPC<EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>A<EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
windowtype = WINDOW_MESSAGETYPE_MESSAGE;
windowno = NPC_VERYWELFARE_START;
lssproto_WN_send( fd, windowtype, WINDOW_BUTTONTYPE_OK, windowno,
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),token);
break;
case 1:
sprintf(token,"%s","2\n<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>ѡ<EFBFBD><EFBFBD>\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ħ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
windowtype = WINDOW_MESSAGETYPE_SELECT;
windowno = NPC_VERYWELFARE_NO1;
lssproto_WN_send( fd, windowtype, buttontype, windowno,
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
makeEscapeString( token, buf, sizeof(buf)));
break;
case 2:
sprintf(token,"%s","<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
windowtype = WINDOW_MESSAGETYPE_MESSAGE;
windowno = NPC_VERYWELFARE_NO2;
lssproto_WN_send( fd, windowtype, buttontype, windowno,
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
makeEscapeString( token, buf, sizeof(buf)));
break;
case 3:
sprintf(token,"%s","<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ħ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
windowtype = WINDOW_MESSAGETYPE_MESSAGE;
windowno = NPC_VERYWELFARE_NO3;
lssproto_WN_send( fd, windowtype, buttontype, windowno,
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
makeEscapeString( token, buf, sizeof(buf)));
break;
}
}
void NPC_VeryWelfareWindowTalked( int meindex, int talkerindex,
int seqno, int select, char *data)
{
print("\nѡ:%d",select);
//int datanum = atoi( data);
switch( seqno){
case NPC_VERYWELFARE_START:
NPC_VeryWelfare_selectWindow(meindex, talkerindex, 1, 0);
break;
case NPC_VERYWELFARE_NO1:
NPC_VeryWelfare_selectWindow(meindex, talkerindex, 2, 1);
break;
case NPC_VERYWELFARE_NO2:
NPC_VeryWelfare_selectWindow(meindex, talkerindex, 3, 1);
break;
default:
break;
}
}
#endif