1534 lines
40 KiB
C
1534 lines
40 KiB
C
![]() |
//krynn 2001/12/6
|
|||
|
//PKPetShop
|
|||
|
|
|||
|
#include "version.h"
|
|||
|
#include <string.h>
|
|||
|
#include "char.h"
|
|||
|
#include "object.h"
|
|||
|
#include "char_base.h"
|
|||
|
#include "npcutil.h"
|
|||
|
#include "lssproto_serv.h"
|
|||
|
#include "pet_skill.h"
|
|||
|
#include "readmap.h"
|
|||
|
#include "log.h"
|
|||
|
#include "enemy.h"
|
|||
|
#include "npc_pkpetshop.h"
|
|||
|
#include "battle.h"
|
|||
|
|
|||
|
#ifdef _PKPETSHOP
|
|||
|
#define MAXSHOPPET 33
|
|||
|
|
|||
|
static void NPC_PKPetShop_selectWindow( int meindex, int talker, int num,int select);
|
|||
|
void NPC_PKPetShop_BuyMain(int meindex,int talker,int before );
|
|||
|
void NPC_PKPetShop_GetPetList(char *argstr,char * argtoken2);
|
|||
|
BOOL NPC_PKPetShop_SetNewPet(int meindex,int talker,char *data);
|
|||
|
BOOL NPC_PKPetShop_SellNewPet(int meindex,int talker,char *data);
|
|||
|
|
|||
|
void NPC_PKPetShop_Menu(int meindex,int talker);
|
|||
|
int NPC_PKPetShop_GetLimtPetList(int talker,char *argstr,char *token2,int sell);
|
|||
|
void NPC_PKPetShop_SellMain(int meindex,int talker,int select);
|
|||
|
int NPC_GetSellPetList(int itemindex,int flg,char *argstr,char *argtoken,int select,int sell);
|
|||
|
BOOL NPC_AddPetBuy(int meindex, int talker,int petID,int kosuu,double rate);
|
|||
|
void NPC_PetStrStr(int petID,double rate,char *name,char *token2, int index);
|
|||
|
int NPC_SellPetstrsStr(int itemindex,int flg,double rate,char *argtoken,int select,int sell);
|
|||
|
void NPC_LimitPetShop(int meindex,int talker,int select);
|
|||
|
void NPC_PKPetShop_ExpressmanCheck(int meindex,int talker);
|
|||
|
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>--*/
|
|||
|
enum{
|
|||
|
NPC_PKPETSHOP_WORK_NO = CHAR_NPCWORKINT1,
|
|||
|
NPC_PKPETSHOP_WORK_EV = CHAR_NPCWORKINT2,
|
|||
|
NPC_PKPETSHOP_WORK_EXPRESS = CHAR_NPCWORKINT3,
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
typedef struct {
|
|||
|
char arg[32];
|
|||
|
int type;
|
|||
|
}PKPETSHOP_NPC_Shop;
|
|||
|
|
|||
|
|
|||
|
static PKPETSHOP_NPC_Shop TypeTable[] = {
|
|||
|
{ "FIST", 0 },
|
|||
|
{ "AXE", 1 },
|
|||
|
{ "CLUB", 2 },
|
|||
|
{ "SPEAR", 3},
|
|||
|
{ "BOW", 4},
|
|||
|
{ "SHIELD", 5},
|
|||
|
{ "HELM", 6 },
|
|||
|
{ "ARMOUR", 7 },
|
|||
|
{ "BRACELET", 8},
|
|||
|
{ "ANCLET", 9 },
|
|||
|
{ "NECKLACE", 10},
|
|||
|
{ "RING", 11},
|
|||
|
{ "BELT", 12},
|
|||
|
{ "EARRING", 13},
|
|||
|
{ "NOSERING", 14},
|
|||
|
{ "AMULET", 15},
|
|||
|
{ "OTHER", 16},
|
|||
|
{ "BOOMERANG", 17},
|
|||
|
{ "BOUNDTHROW", 18},
|
|||
|
{ "BREAKTHROW", 19},
|
|||
|
#ifdef _ITEM_TYPETABLE
|
|||
|
{ "DISH", 20},
|
|||
|
{ "METAL", 21},
|
|||
|
{ "JEWEL", 22},
|
|||
|
{ "WARES", 23},
|
|||
|
{ "WBELT", 24},
|
|||
|
{ "WSHIELD", 25},
|
|||
|
{ "WSHOES", 26},
|
|||
|
{ "WGLOVE", 27},
|
|||
|
{ "ANGELTOKEN", 28},
|
|||
|
{ "HEROTOKEN", 29},
|
|||
|
#endif
|
|||
|
{ "ACCESSORY", 30},
|
|||
|
{ "OFFENCE", 40},
|
|||
|
{ "DEFENCE", 50},
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
/*********************************
|
|||
|
* <EFBFBD><EFBFBD>ʼ
|
|||
|
*********************************/
|
|||
|
BOOL NPC_PKPetShopInit( int meindex )
|
|||
|
{
|
|||
|
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɬ<EFBFBD><C9AC>--*/
|
|||
|
CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEPKPetShop );
|
|||
|
|
|||
|
if( NPC_Util_GetArgStr(meindex, argstr, sizeof(argstr)) == NULL )
|
|||
|
{
|
|||
|
print("NPC_PKPetShopInit_GetArgStrErr");
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
if(strstr(argstr,"LIMITSHOP") != NULL)
|
|||
|
{ /*- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>ðº<D7B7>--*/
|
|||
|
CHAR_setWorkInt( meindex, NPC_PKPETSHOP_WORK_NO, 1);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CHAR_setWorkInt( meindex, NPC_PKPETSHOP_WORK_NO, 0);
|
|||
|
}
|
|||
|
|
|||
|
if(strstr( argstr, "EVENT") != NULL)
|
|||
|
{ /*- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>ðº<D7B7>--*/
|
|||
|
CHAR_setWorkInt( meindex, NPC_PKPETSHOP_WORK_EV, 1);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CHAR_setWorkInt( meindex, NPC_PKPETSHOP_WORK_EV, 0);
|
|||
|
}
|
|||
|
|
|||
|
if(strstr( argstr, "EXPRESS") != NULL)
|
|||
|
{ /*-<2D><>˪<EFBFBD>аº<D7B7>--*/
|
|||
|
CHAR_setWorkInt( meindex, NPC_PKPETSHOP_WORK_EXPRESS, 1);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CHAR_setWorkInt( meindex, NPC_PKPETSHOP_WORK_EXPRESS, 0);
|
|||
|
}
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*********************************
|
|||
|
* <EFBFBD>ƾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*********************************/
|
|||
|
void NPC_PKPetShopTalked( int meindex , int talker , char *szMes ,int color )
|
|||
|
{
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char buff[1024];
|
|||
|
char buf2[256];
|
|||
|
char token[1024];
|
|||
|
int i = 1;
|
|||
|
BOOL sellonlyflg = FALSE;
|
|||
|
char sellmsg[1024];
|
|||
|
|
|||
|
/* <20><><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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if(NPC_Util_isFaceToFace( meindex, talker, 2) == FALSE)
|
|||
|
{ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
|||
|
if( NPC_Util_CharDistance( talker, meindex ) > 1) return;
|
|||
|
}
|
|||
|
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL)
|
|||
|
{
|
|||
|
print("NPC_PKPetShopInit_GetArgStrErr");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if( NPC_Util_GetStrFromStrWithDelim( argstr, "sellonly_msg",
|
|||
|
token, sizeof( token))
|
|||
|
!= NULL)
|
|||
|
{
|
|||
|
sellonlyflg = TRUE;
|
|||
|
strcpysafe(sellmsg, sizeof( sellmsg), token);
|
|||
|
}
|
|||
|
|
|||
|
/*-- <20><> <20><><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if( NPC_Util_GetStrFromStrWithDelim( argstr, "buy_msg",
|
|||
|
buff, sizeof( buff)) != NULL )
|
|||
|
{
|
|||
|
while(getStringFromIndexWithDelim(buff,",",i,buf2,sizeof(buf2)) != FALSE)
|
|||
|
{
|
|||
|
i++;
|
|||
|
if( strstr( szMes, buf2) != NULL) {
|
|||
|
if( CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_EV) == 0) {
|
|||
|
/*- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if( CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_NO) == 1) {
|
|||
|
if( sellonlyflg ) {
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talker, 3, -1);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
else{
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talker, 1, -1);
|
|||
|
return;
|
|||
|
}
|
|||
|
}else{
|
|||
|
if(CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_NO) == 1) {
|
|||
|
if( sellonlyflg) {
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talker, 3, -1);
|
|||
|
return;
|
|||
|
}
|
|||
|
}else{
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talker, 1, -1);
|
|||
|
return;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
i=1;
|
|||
|
|
|||
|
/*-- <20><> <20><><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if( NPC_Util_GetStrFromStrWithDelim( argstr, "sell_msg",
|
|||
|
buff, sizeof( buff)) != NULL )
|
|||
|
{
|
|||
|
while( getStringFromIndexWithDelim(buff,",", i,buf2,sizeof(buf2))
|
|||
|
!= FALSE )
|
|||
|
{
|
|||
|
i++;
|
|||
|
if(strstr(szMes,buf2) != NULL) {
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talker, 2, -1);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
i = 1;
|
|||
|
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><D7BC><EFBFBD>ë<EFBFBD><C3AB>ľ<EFBFBD><C4BE><EFBFBD>ɺ<EFBFBD>ƥ <20>ƾ<EFBFBD><C6BE><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if( NPC_Util_GetStrFromStrWithDelim( argstr, "other_msg",
|
|||
|
buff, sizeof( buff)) != NULL )
|
|||
|
{
|
|||
|
while(getStringFromIndexWithDelim( buff, ",", i, buf2, sizeof( buf2))
|
|||
|
!=FALSE)
|
|||
|
{
|
|||
|
i++;
|
|||
|
if(strstr(szMes,buf2) != NULL) {
|
|||
|
/*--<2D><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr, "hint_msg",
|
|||
|
token, sizeof( token)) != NULL)
|
|||
|
{
|
|||
|
CHAR_talkToCli( talker, meindex, token, CHAR_COLORWHITE);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if(CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_NO) == 1)
|
|||
|
{
|
|||
|
if(CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_EV) == 1)
|
|||
|
{
|
|||
|
if( sellonlyflg)
|
|||
|
{
|
|||
|
CHAR_talkToCli( talker, meindex, sellmsg, CHAR_COLORWHITE);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{ /*-- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if( sellonlyflg)
|
|||
|
{
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talker, 3, -1);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_EV) == 1) {
|
|||
|
if( sellonlyflg) {
|
|||
|
CHAR_talkToCli( talker, meindex, sellmsg, CHAR_COLORWHITE);
|
|||
|
return;
|
|||
|
}
|
|||
|
}else{
|
|||
|
|
|||
|
if(CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_EXPRESS) == 1) {
|
|||
|
NPC_PKPetShop_ExpressmanCheck( meindex, talker);
|
|||
|
}else{
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɧ<EFBFBD><C9A7><EFBFBD>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>ب<EFBFBD><D8A8>) <20><>--*/
|
|||
|
/*-- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB> ƥئ<C6A5>ʻ<EFBFBD> ɧ<><C9A7><EFBFBD><EFBFBD>ئ<EFBFBD>ն<EFBFBD><D5B6><EFBFBD>ب<EFBFBD><D8A8> <20><>--*/
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talker, 0, -1);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
static void NPC_PKPetShop_selectWindow( int meindex, int talker, int num,int select)
|
|||
|
{
|
|||
|
|
|||
|
print("\n NPC_PKPetShop_selectWindow()");
|
|||
|
print("\n num = %d ", num);
|
|||
|
switch( num) {
|
|||
|
case 0:
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>ب<EFBFBD><D8A8> --*/
|
|||
|
/*--<2D>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>˪Ի--*/
|
|||
|
CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);
|
|||
|
|
|||
|
if(CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_EXPRESS) == 1 )
|
|||
|
{
|
|||
|
if(CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_NO) ==0 )
|
|||
|
{
|
|||
|
NPC_PKPetShop_ExpressmanCheck( meindex, talker);
|
|||
|
}
|
|||
|
}
|
|||
|
else if(CHAR_getWorkInt( meindex, NPC_PKPETSHOP_WORK_NO) == 1)
|
|||
|
{
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
NPC_PKPetShop_Menu( meindex, talker);
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case 1:
|
|||
|
/*-- <20><> --*/
|
|||
|
NPC_PKPetShop_BuyMain( meindex, talker, select);
|
|||
|
break;
|
|||
|
|
|||
|
case 2:
|
|||
|
/*-- <20><> --*/
|
|||
|
NPC_PKPetShop_SellMain( meindex, talker, select);
|
|||
|
break;
|
|||
|
|
|||
|
case 3:
|
|||
|
/*-- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB> ƥ<>ʷ<EFBFBD> --*/
|
|||
|
NPC_LimitPetShop( meindex, talker, select);
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*-----------------------------------------
|
|||
|
* <EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߯<EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD>£<EFBFBD>
|
|||
|
*
|
|||
|
-------------------------------------------*/
|
|||
|
void NPC_PKPetShopWindowTalked( int meindex, int talkerindex,
|
|||
|
int seqno, int select, char *data)
|
|||
|
{
|
|||
|
/*-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4> --*/
|
|||
|
if( NPC_Util_CharDistance( talkerindex, meindex ) > 3) {
|
|||
|
/*--<2D>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>˪Ի--*/
|
|||
|
CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
makeStringFromEscaped( data);
|
|||
|
switch( seqno){
|
|||
|
|
|||
|
case CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG:
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ب<EFBFBD><D8A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>--*/
|
|||
|
/*-- <20><>--*/
|
|||
|
if(atoi( data) == 1 ) NPC_PKPetShop_selectWindow(meindex, talkerindex, 1, -1);
|
|||
|
|
|||
|
/*-- <20><>--*/
|
|||
|
if(atoi( data) == 2) NPC_PKPetShop_selectWindow(meindex, talkerindex, 2, -1);
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>--*/
|
|||
|
if(atoi( data) == 3) return;/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6>--*/
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
case CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG:
|
|||
|
/*--ʧ<><CAA7> ة<><D8A9>ܰ<EFBFBD><DCB0>--*/
|
|||
|
if(NPC_PKPetShop_SetNewPet(meindex , talkerindex, data) == TRUE) {
|
|||
|
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talkerindex, 1, 0);
|
|||
|
|
|||
|
}else{
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talkerindex ,0, -1);
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
case CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG:
|
|||
|
/*--ʧ<><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if(NPC_PKPetShop_SellNewPet(meindex , talkerindex, data) == TRUE) {
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talkerindex, 2, 0);
|
|||
|
|
|||
|
}else{
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talkerindex, 0, -1);
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT:
|
|||
|
if(select == WINDOW_BUTTONTYPE_YES) {
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talkerindex ,2, -1);
|
|||
|
|
|||
|
}else if(select == WINDOW_BUTTONTYPE_NO) {
|
|||
|
return;
|
|||
|
}else if(select == WINDOW_BUTTONTYPE_OK) {
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talkerindex, 2, -1);
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS:
|
|||
|
if(atoi(data) == 2) {
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talkerindex, 1, -1);
|
|||
|
}else if(atoi( data) == 4) {
|
|||
|
NPC_PKPetShop_selectWindow( meindex, talkerindex, 2, -1);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*-----------------------------------------
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD>(<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˪<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
*krynn 2001/12/9 <EFBFBD>ӵ<EFBFBD>ע<EFBFBD><EFBFBD>
|
|||
|
*before == -1
|
|||
|
*before <> -1
|
|||
|
*krynn end
|
|||
|
*-----------------------------------------*/
|
|||
|
void NPC_PKPetShop_BuyMain(int meindex,int talker,int before )
|
|||
|
{
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char token[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
int fd = getfdFromCharaIndex( talker);
|
|||
|
|
|||
|
/*
|
|||
|
Ի <EFBFBD>аº<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>º<EFBFBD> <EFBFBD>Ҽ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>| <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ì<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Իئ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ئ<EFBFBD>аº<EFBFBD> ʧ<EFBFBD><EFBFBD> ة<EFBFBD><EFBFBD>ì<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> į <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ئ<EFBFBD>аº<EFBFBD> ʧ<EFBFBD><EFBFBD> ة<EFBFBD><EFBFBD>ì<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> į <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <20><><EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD><EFBFBD>̻ﻥ<CCBB><EFBBA5><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4> --*/
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) {
|
|||
|
print("itemshop_GetArgStr_Err");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---*/
|
|||
|
if(before != -1)
|
|||
|
{ /*--<2D><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD>¼<EFBFBD>ƥְ<C6A5><D6B0><EFBFBD><EFBFBD> <20><>˪<EFBFBD><CBAA>ئ<EFBFBD><D8A6> --*/
|
|||
|
sprintf(token,"0|0");
|
|||
|
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN,
|
|||
|
WINDOW_BUTTONTYPE_NONE,
|
|||
|
CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
}else{
|
|||
|
|
|||
|
char token2[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char buff2[256];
|
|||
|
char buff[256];
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB> <20>ƻ<EFBFBD><C6BB>ͷ<EFBFBD><CDB7><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˪<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>-*/
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>֧Ի <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD>о<EFBFBD><D0BE><EFBFBD>--*/
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff));
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "buy_main", buff2, sizeof( buff2));
|
|||
|
sprintf(token,"0|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG,
|
|||
|
CHAR_getChar( meindex, CHAR_NAME), buff, buff2);
|
|||
|
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "what_msg", buff, sizeof( buff));
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "level_msg", buff2, sizeof( buff));
|
|||
|
snprintf( token2, sizeof( token2), "%s|%s", buff, buff2);
|
|||
|
|
|||
|
/*-- ٯ <20><> --*/
|
|||
|
strncat( token, token2, sizeof( token));
|
|||
|
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "realy_msg", buff, sizeof( buff));
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "itemfull_msg", buff2, sizeof( buff2));
|
|||
|
sprintf( token2, "|%s|%s", buff, buff2);
|
|||
|
|
|||
|
/*-- ٯ <20><>--*/
|
|||
|
strncat(token , token2,sizeof(token));
|
|||
|
strcpy(token2, "|");
|
|||
|
|
|||
|
/*--ʧ<><CAA7> ة<><D8A9> <20><> --*/
|
|||
|
NPC_PKPetShop_GetPetList( argstr, token2 );
|
|||
|
// krynn 2001/12/12 bebug <20><>
|
|||
|
print("%s",token2);
|
|||
|
// end krynn
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> <20><><EFBFBD><EFBFBD> --*/
|
|||
|
strncat( token, token2, sizeof( token));
|
|||
|
}
|
|||
|
|
|||
|
/*-- ٯ ë<><EFBFBD><DEB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
// makeEscapeString( token, escapedname, sizeof(escapedname));
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>ƥ˪<C6A5><CBAA>--*/
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN,
|
|||
|
WINDOW_BUTTONTYPE_NONE,
|
|||
|
CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/*------------------------------------------------------
|
|||
|
*ʧ<EFBFBD><EFBFBD> ة<EFBFBD><EFBFBD><EFBFBD>缰 ٯ ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD>( <EFBFBD><EFBFBD>
|
|||
|
*------------------------------------------------------*/
|
|||
|
void NPC_PKPetShop_GetPetList(char *argstr,char *argtoken)
|
|||
|
{
|
|||
|
|
|||
|
int i = 1;
|
|||
|
int tmp;
|
|||
|
int EnemyCnt;
|
|||
|
char *name ;
|
|||
|
char buff2[256];
|
|||
|
char buff[NPC_UTIL_GETARGSTR_LINEMAX];
|
|||
|
char token2[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
double rate = 1.0;
|
|||
|
int loopcnt = 0;
|
|||
|
|
|||
|
/*-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë <20>£<EFBFBD> <20><>ľ<EFBFBD>ɨ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>--*/
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr, "buy_rate", buff2, sizeof( buff2))
|
|||
|
!= NULL){
|
|||
|
rate = atof( buff2);
|
|||
|
}
|
|||
|
|
|||
|
/*- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ë<><C3AB> --*/
|
|||
|
if( NPC_Util_GetStrFromStrWithDelim( argstr, "PetList", buff, sizeof( buff))
|
|||
|
!= NULL )
|
|||
|
{
|
|||
|
while( getStringFromIndexWithDelim(buff,",",i,buff2,sizeof(buff2))
|
|||
|
!=FALSE )
|
|||
|
{
|
|||
|
i++;
|
|||
|
/*--ɬ<>ð<EFBFBD><C3B0><EFBFBD><EFBFBD>̻Pʧ<EFBCB0><CAA7> ة<><D8A9> "-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if(strstr( buff2, "-") == NULL) {
|
|||
|
/*--<2D><><EFBFBD><EFBFBD> <20><> --*/
|
|||
|
// krynn 2001/12/10
|
|||
|
EnemyCnt = ENEMY_getEnemyNum();
|
|||
|
for( tmp=0 ; tmp < EnemyCnt ; tmp++ )
|
|||
|
{
|
|||
|
if( ENEMY_getInt( tmp , ENEMY_ID ) == atoi( buff2 ) )
|
|||
|
{
|
|||
|
print("\nNPC_PKPetShop_GetPetList: tmp = %d", tmp);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
if( tmp == EnemyCnt )
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
name = ENEMY_getChar( tmp , ENEMY_NAME );
|
|||
|
// krynn end
|
|||
|
/*-- ئ<>գ<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD>м<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD> į<><C4AF> <20><>--*/
|
|||
|
if(name == NULL) continue;
|
|||
|
|
|||
|
loopcnt++;
|
|||
|
if(loopcnt == MAXSHOPPET) break;
|
|||
|
|
|||
|
/*-- <20>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﹴ<EFBFBD><EFB9B4>Ի--*/
|
|||
|
NPC_PetStrStr( atoi( buff2), rate, name, token2, tmp);
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ٯ <20><> <20><>--*/
|
|||
|
strncat( argtoken, token2, sizeof(token2));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return;
|
|||
|
/*krynn 2001/12/13 <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD> mark<72><6B><EFBFBD><EFBFBD>Ϊֱ<CEAA><D6B1> return
|
|||
|
--ʧ<EFBFBD><EFBFBD> ة<EFBFBD><EFBFBD> 15-25 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--
|
|||
|
int start;
|
|||
|
int end;
|
|||
|
|
|||
|
//-"-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>炙<EFBFBD><EFA7BB><EFBFBD><EFBFBD>Ѱ<EFBFBD><D1B0><EFBFBD> <20><><EFBFBD>Ѱ<EFBFBD>ë<EFBFBD><C3AB> --
|
|||
|
getStringFromIndexWithDelim( buff2, "-", 1, token2, sizeof(token2));
|
|||
|
start = atoi( token2);
|
|||
|
getStringFromIndexWithDelim( buff2, "-", 2 ,token2, sizeof(token2));
|
|||
|
end = atoi( token2);
|
|||
|
|
|||
|
//-- į<><C4AF><EFBFBD>ѱ<EFBFBD>ئ<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD> ľ<C4BE><D7B8><EFBFBD><EFBFBD>
|
|||
|
if(start > end)
|
|||
|
{
|
|||
|
tmp = start;
|
|||
|
start = end;
|
|||
|
end = tmp;
|
|||
|
}
|
|||
|
|
|||
|
end++;
|
|||
|
|
|||
|
//--"-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> ë <20><>--
|
|||
|
for(; start < end ; start++ )
|
|||
|
{
|
|||
|
//--<2D><><EFBFBD><EFBFBD> <20><> --
|
|||
|
|
|||
|
name = ITEM_getNameFromNumber( start );
|
|||
|
//-- ئ<>գ<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD>м<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD> į<><C4AF> <20><>--
|
|||
|
if(name == NULL) continue;
|
|||
|
|
|||
|
loopcnt++;
|
|||
|
if(loopcnt == MAXSHOPPET) break;
|
|||
|
|
|||
|
//-- <20>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﹴ<EFBFBD><EFB9B4>Ի--
|
|||
|
NPC_PetStrStr( start, rate, name, token2, tmp);
|
|||
|
|
|||
|
//--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ٯ <20><> <20><>--
|
|||
|
strncat( argtoken, token2, sizeof(token2));
|
|||
|
}*/
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*-----------------------------------------------------------------
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
-------------------------------------------------------------------*/
|
|||
|
void NPC_PetStrStr(int petID,double rate,char *name,char *token2,int index)
|
|||
|
{
|
|||
|
int i;
|
|||
|
int gold;
|
|||
|
int level;
|
|||
|
int graNo;
|
|||
|
int TempNo;
|
|||
|
int EnemyTempNum;
|
|||
|
char info[1024];
|
|||
|
//char tryItem[256]; // krynn 2001/12/12 ֻ<><D6BB>Ҫ<EFBFBD><D2AA> getItemInfoFromNumber <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ʲ<EFBFBD><CAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char escape[256] = {"PK Server <20><>"};
|
|||
|
|
|||
|
//krynn 2001/12/10 try
|
|||
|
//gold = ITEM_getcostFromITEMtabl( itemID);
|
|||
|
//level = ITEM_getlevelFromITEMtabl( itemID);
|
|||
|
//graNo = ITEM_getgraNoFromITEMtabl( itemID);
|
|||
|
TempNo = ENEMY_getInt( index , ENEMY_TEMPNO );
|
|||
|
EnemyTempNum = ENEMYTEMP_getEnemyNum();
|
|||
|
for( i=0 ; i < EnemyTempNum ; i++ )
|
|||
|
{
|
|||
|
if( ENEMYTEMP_getInt( i , E_T_TEMPNO ) == TempNo )
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
if( i == EnemyTempNum )
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
gold = RAND(0,20);
|
|||
|
level = 0;
|
|||
|
graNo = ENEMYTEMP_getInt( i , E_T_IMGNUMBER );
|
|||
|
//print("\nPKPetShop::NPC_PetStrStr(): TempNo = %d ; graNo = %d",TempNo,graNo);
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
gold=(int)(gold * rate);
|
|||
|
|
|||
|
//strcpy( tryItem,ITEM_getItemInfoFromNumber( 10 ) );
|
|||
|
//print("PKPetShop::NPC_PetStrStr(): try = %s\n",tryItem);
|
|||
|
//krynn end
|
|||
|
|
|||
|
makeEscapeString( escape, info, sizeof( info));
|
|||
|
|
|||
|
makeEscapeString( name, escape, sizeof( escape));
|
|||
|
|
|||
|
sprintf( token2, "%s|0|%d|%d|%d|%s|", escape, level, gold, graNo, info);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*-------------------------------------------
|
|||
|
*( <EFBFBD><EFBFBD>)
|
|||
|
*<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë <EFBFBD>ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
*------------------------------------------*/
|
|||
|
BOOL NPC_PKPetShop_SetNewPet(int meindex,int talker,char *data)
|
|||
|
{
|
|||
|
|
|||
|
char buf[1024];
|
|||
|
char buff2[128];
|
|||
|
int i = 1, j = 1;
|
|||
|
int select;
|
|||
|
int kosuu = 0;
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
double rate = 1.0;
|
|||
|
int gold = 0;
|
|||
|
int EmptyPetCnt=0;
|
|||
|
|
|||
|
/*--߯<>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD>ݩ--*/
|
|||
|
print("\nNPC_PKPetShop_SetNewPet: data = %s",data);
|
|||
|
getStringFromIndexWithDelim( data, "|", 1, buf, sizeof( buf));
|
|||
|
select=atoi(buf); // krynn 2001/12/10 select <20><><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ĵڼ<C4B5><DABC><EFBFBD>
|
|||
|
print("\nNPC_PKPetShop_SetNewPet: select = %d",select);
|
|||
|
if(select == 0) return FALSE;
|
|||
|
getStringFromIndexWithDelim( data, "|", 2, buf, sizeof( buf));
|
|||
|
kosuu=atoi(buf);
|
|||
|
print("\nNPC_PKPetShop_SetNewPet: kosuu(<28><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) = %d",kosuu);
|
|||
|
|
|||
|
if( kosuu <= 0 ) return FALSE;
|
|||
|
|
|||
|
/* <20><>DZ<EFBFBD><C7B1> <20><>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD> */
|
|||
|
if( !CHAR_CHECKINDEX(talker) )
|
|||
|
{
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
for( i=0 ; i < CHAR_MAXPETHAVE ; i++ )
|
|||
|
{
|
|||
|
if( CHAR_getCharPet( talker,i) == -1 )
|
|||
|
{
|
|||
|
EmptyPetCnt++;
|
|||
|
}
|
|||
|
}
|
|||
|
// <20><> EmptyPetCnt <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
|||
|
/* <20><><EFBFBD>廥 <20><> */
|
|||
|
print("\nNPC_PKPetShop_SetNewPet:EmptyPetCnt(<28><><EFBFBD><EFBFBD><EFBFBD>еĿ<D0B5>λ) = %d",EmptyPetCnt);
|
|||
|
if( EmptyPetCnt <= 0 ) return FALSE;
|
|||
|
if( EmptyPetCnt > CHAR_MAXPETHAVE )
|
|||
|
{
|
|||
|
EmptyPetCnt = CHAR_MAXPETHAVE;
|
|||
|
}
|
|||
|
if( kosuu > EmptyPetCnt )
|
|||
|
{
|
|||
|
kosuu = EmptyPetCnt;
|
|||
|
}
|
|||
|
|
|||
|
// krynn 2001/12/10
|
|||
|
// Ӧ<><D3A6><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> mark <20><><EFBFBD><EFBFBD>
|
|||
|
/*--<2D><><EFBFBD>Ѽ<EFBFBD><D1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>¾<EFBFBD><C2BE><EFBFBD>
|
|||
|
for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) {
|
|||
|
itemindex = CHAR_getItemIndex( talker , i );
|
|||
|
|
|||
|
if( !ITEM_CHECKINDEX( itemindex) ) {
|
|||
|
kosuucnt++;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
--߯<EFBFBD>Ȼ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>˼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ӡ<EFBFBD><EFBFBD>ﴡ <EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ƥ
|
|||
|
--<EFBFBD>ӡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ë ľ<EFBFBD><EFBFBD>
|
|||
|
if( kosuucnt < kosuu){
|
|||
|
kosuu = kosuucnt;
|
|||
|
}
|
|||
|
--δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¡<EFBFBD>
|
|||
|
if(kosuucnt == 0 ){
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
krynn end */
|
|||
|
|
|||
|
i = 1;
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <20><><EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD><EFBFBD>̻ﻥ<CCBB><EFBBA5><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4> --*/
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) {
|
|||
|
print("shop_GetArgStr_Err");
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
|
|||
|
/*---<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB> ئ<><D8A6>ľ<EFBFBD><C4BE>1.0)-*/
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr, "buy_rate", buf, sizeof( buf))
|
|||
|
!= NULL) {
|
|||
|
rate= atof( buf);
|
|||
|
}
|
|||
|
|
|||
|
/*--ʧ<><CAA7> ة<><D8A9>ܰ<EFBFBD><DCB0>ë<EFBFBD>浤<EFBFBD><E6B5A4><EFBFBD><EFBFBD>Ƿ-*/
|
|||
|
if( NPC_Util_GetStrFromStrWithDelim( argstr, "PetList",
|
|||
|
buf, sizeof( buf)) != NULL )
|
|||
|
{
|
|||
|
while(getStringFromIndexWithDelim(buf , "," , j, buff2, sizeof(buff2))
|
|||
|
!= FALSE )
|
|||
|
{
|
|||
|
j++;
|
|||
|
/*-- "-"<22><>ֳ<EFBFBD><D6B3>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if(strstr( buff2, "-") == NULL)
|
|||
|
{ // krynn 2001/12/10 try
|
|||
|
//if( ITEM_getcostFromITEMtabl(atoi(buff2)) !=-1) {
|
|||
|
//
|
|||
|
if ( i == select)
|
|||
|
{
|
|||
|
/*---ʧ<><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---*/
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if(NPC_AddPetBuy(meindex, talker,atoi(buff2),kosuu,rate) != TRUE)
|
|||
|
{
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
i++;
|
|||
|
// krynn end}
|
|||
|
}else{
|
|||
|
/*--ʧ<><CAA7> ة<><D8A9> 15-25 <20><><EFBFBD><EFBFBD>ƥ˪<C6A5><CBAA>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
int start;
|
|||
|
int end;
|
|||
|
|
|||
|
/* "-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>炙<EFBFBD><EFA7BB><EFBFBD><EFBFBD>Ѱ<EFBFBD><D1B0><EFBFBD> <20><><EFBFBD>Ѱ<EFBFBD>ë<EFBFBD><C3AB> --*/
|
|||
|
getStringFromIndexWithDelim( buff2, "-", 1, argstr, sizeof(argstr));
|
|||
|
start = atoi( argstr);
|
|||
|
getStringFromIndexWithDelim( buff2, "-", 2 ,argstr, sizeof(argstr));
|
|||
|
end = atoi( argstr);
|
|||
|
end++;
|
|||
|
|
|||
|
/*-- į<><C4AF><EFBFBD>ѱ<EFBFBD>ئ<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD> ľ<C4BE><D7B8><EFBFBD><EFBFBD>**/
|
|||
|
if(start > end){
|
|||
|
gold = start;
|
|||
|
start = end;
|
|||
|
end = gold;
|
|||
|
}
|
|||
|
|
|||
|
/*--"-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB> ë <20><>--*/
|
|||
|
for(; start < end ; start++ ) {
|
|||
|
if( ITEM_getcostFromITEMtabl( start) != -1) {
|
|||
|
if ( i == select) {
|
|||
|
/*---ʧ<><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---*/
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if(NPC_AddPetBuy(meindex, talker, start, kosuu, rate) != TRUE)
|
|||
|
{
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
i++;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return FALSE;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*---------------------------------------------
|
|||
|
*ʧ<EFBFBD><EFBFBD> ة<EFBFBD><EFBFBD>ܰ<EFBFBD><EFBFBD>ë<EFBFBD>浤
|
|||
|
*--------------------------------------------*/
|
|||
|
BOOL NPC_AddPetBuy(int meindex, int talker,int petID,int kosuu,double rate)
|
|||
|
{
|
|||
|
int i,j,k,index,EnemyCnt,UpLevel;
|
|||
|
int gold;
|
|||
|
int ret;
|
|||
|
int maxgold;
|
|||
|
int Grade=0;
|
|||
|
char buf[1024];
|
|||
|
char msgbuf[64];
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
|
|||
|
// krynn 2001/12/15 get get's grade of this PKPetShop
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) {
|
|||
|
print("shop_GetArgStr_Err");
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr, "Grade", buf, sizeof( buf))
|
|||
|
!= NULL)
|
|||
|
{
|
|||
|
Grade = atoi( buf );
|
|||
|
}
|
|||
|
// end krynn
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
// krynn 2001/12/11 mark and change
|
|||
|
//gold = ITEM_getcostFromITEMtabl( itemID);
|
|||
|
gold = 4;
|
|||
|
// krynn end
|
|||
|
gold = (int)(gold * rate);
|
|||
|
maxgold = gold * kosuu;
|
|||
|
|
|||
|
if(CHAR_getInt( talker, CHAR_GOLD) < maxgold ) return FALSE;
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>ëӼ<C3AB><D3BC><EFBFBD><EFBFBD>--*/
|
|||
|
CHAR_setInt( talker, CHAR_GOLD,CHAR_getInt( talker, CHAR_GOLD) - maxgold);
|
|||
|
|
|||
|
EnemyCnt = ENEMY_getEnemyNum();
|
|||
|
for( index=0 ; index < EnemyCnt ; index++ )
|
|||
|
{
|
|||
|
if( ENEMY_getInt( index , ENEMY_ID ) == petID )
|
|||
|
{
|
|||
|
print("\nNPC_AddPetBuy: index = %d", index);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
if( index == EnemyCnt )
|
|||
|
{
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
for(i = 0 ; i < kosuu ; i++)
|
|||
|
{
|
|||
|
if( (ret = ENEMY_createPetFromEnemyIndex( talker , index )) == -1 )
|
|||
|
{
|
|||
|
return FALSE;
|
|||
|
};
|
|||
|
/******************/
|
|||
|
/* ʸ<><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ˪<><CBAA> */
|
|||
|
/******************/
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ
|
|||
|
for( j = 0 ; j < CHAR_MAXPETHAVE ; j++ )
|
|||
|
{
|
|||
|
if( CHAR_getCharPet( talker , j ) == ret )
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
if( j == CHAR_MAXPETHAVE ){
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
if( CHAR_CHECKINDEX( ret ) == TRUE ){
|
|||
|
CHAR_setMaxExpFromLevel( ret, Grade);
|
|||
|
UpLevel = CHAR_LevelUpCheck( ret , talker);
|
|||
|
for( k = 0; k < UpLevel; k ++ ){
|
|||
|
CHAR_PetLevelUp( ret );
|
|||
|
CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP );
|
|||
|
}
|
|||
|
CHAR_complianceParameter( ret );
|
|||
|
CHAR_setInt( ret , CHAR_HP , CHAR_getWorkInt( ret , CHAR_WORKMAXHP ) );
|
|||
|
|
|||
|
snprintf( msgbuf, sizeof( msgbuf ), "K%d", j );
|
|||
|
CHAR_sendStatusString( talker, msgbuf );
|
|||
|
|
|||
|
snprintf( msgbuf, sizeof( msgbuf ), "W%d", j );
|
|||
|
CHAR_sendStatusString( talker, msgbuf );
|
|||
|
}
|
|||
|
}
|
|||
|
CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*----------------------------------------
|
|||
|
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ب<EFBFBD><EFBFBD>
|
|||
|
*----------------------------------------*/
|
|||
|
void NPC_PKPetShop_Menu(int meindex,int talker)
|
|||
|
{
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char token[NPC_UTIL_GETARGSTR_LINEMAX];
|
|||
|
char buff[256];
|
|||
|
int fd = getfdFromCharaIndex( talker);
|
|||
|
|
|||
|
/* <20>Ҽ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>| */
|
|||
|
/*--<2D><><EFBFBD>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <20><><EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD><EFBFBD>̻ﻥ<CCBB><EFBBA5><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4> --*/
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) {
|
|||
|
print("shop_GetArgStr_Err");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff));
|
|||
|
snprintf(token, sizeof(token),"%s|%s",CHAR_getChar( meindex, CHAR_NAME), buff);
|
|||
|
|
|||
|
// print("%s",escapedname);
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>ƥ˪<C6A5><CBAA>--*/
|
|||
|
//krynn 2001/12/10 <09><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>ƺ<EFBFBD><C6BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ItemShop <20><> code<64><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMENU,
|
|||
|
WINDOW_BUTTONTYPE_NONE,
|
|||
|
CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
//krynn end
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*-------------------------------------------
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
*-------------------------------------------*/
|
|||
|
void NPC_PKPetShop_SellMain(int meindex,int talker,int before)
|
|||
|
{
|
|||
|
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char token[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
int fd = getfdFromCharaIndex( talker);
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
Ի <EFBFBD>аº<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>º<EFBFBD> <EFBFBD>Ҽ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>| <EFBFBD>¶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>Ż<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ئ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD> ľ<EFBFBD><EFBFBD> ľئ<EFBFBD>аº<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> į <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʧ<EFBFBD><EFBFBD> ة į <EFBFBD>ྮ<EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD> ľ<EFBFBD><EFBFBD> ľئ<EFBFBD>аº<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> į <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʧ<EFBFBD><EFBFBD> ة į <EFBFBD>ྮ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <20><><EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD><EFBFBD>̻ﻥ<CCBB><EFBBA5><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4> --*/
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) {
|
|||
|
print("shop_GetArgStr_Err");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---*/
|
|||
|
if(before != -1) {
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD>¼<EFBFBD>ƥְ<C6A5><D6B0><EFBFBD><EFBFBD> <20><>˪<EFBFBD><CBAA>ئ<EFBFBD><D8A6> --*/
|
|||
|
sprintf(token,"1|0");
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN
|
|||
|
+CHAR_getWorkInt(meindex,NPC_PKPETSHOP_WORK_NO),
|
|||
|
WINDOW_BUTTONTYPE_NONE,
|
|||
|
CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
|
|||
|
}else{
|
|||
|
|
|||
|
char token2[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char buff2[256];
|
|||
|
char buff[256];
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB> <20>ƻ<EFBFBD><C6BB>ͷ<EFBFBD><CDB7><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˪<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD>-*/
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>֧Ի <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD>о<EFBFBD><D0BE><EFBFBD>--*/
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff));
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "sell_main", buff2, sizeof( buff));
|
|||
|
sprintf( token, "1|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG,
|
|||
|
CHAR_getChar( meindex, CHAR_NAME), buff, buff2);
|
|||
|
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "stone_msg", buff, sizeof( buff));
|
|||
|
|
|||
|
if(CHAR_getWorkInt(meindex,NPC_PKPETSHOP_WORK_EXPRESS) == 1 ) {
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "exrealy_msg", buff2, sizeof(buff2));
|
|||
|
}else{
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "realy_msg", buff2, sizeof( buff2));
|
|||
|
}
|
|||
|
sprintf( token2,"%s|%s|", buff, buff2);
|
|||
|
|
|||
|
/*--ʧ<><CAA7> ة<><D8A9> <20><> --*/
|
|||
|
NPC_PKPetShop_GetLimtPetList( talker,argstr, token2, -1);
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> <20><><EFBFBD><EFBFBD> --*/
|
|||
|
strncat( token, token2, sizeof( token));
|
|||
|
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>ƥ˪<C6A5><CBAA>--*/
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN+
|
|||
|
CHAR_getWorkInt(meindex,NPC_PKPETSHOP_WORK_NO),
|
|||
|
WINDOW_BUTTONTYPE_NONE,
|
|||
|
CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*--------------------------------
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD> <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD> ة<EFBFBD><EFBFBD> ٯ ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
*-------------------------------*/
|
|||
|
int NPC_PKPetShop_GetLimtPetList(int talker, char *argstr, char* token2,int sell)
|
|||
|
{
|
|||
|
|
|||
|
char token[NPC_UTIL_GETARGSTR_LINEMAX];
|
|||
|
char buff[NPC_UTIL_GETARGSTR_LINEMAX];
|
|||
|
char token3[NPC_UTIL_GETARGSTR_LINEMAX];
|
|||
|
int k = 0 , i = 1 , j = 0;
|
|||
|
int imax;
|
|||
|
int itemtype = 0;
|
|||
|
int itemindex;
|
|||
|
int okflg = 0;
|
|||
|
char buf[256];
|
|||
|
int flg=0;
|
|||
|
int cost;
|
|||
|
|
|||
|
|
|||
|
if(sell == -1 ){
|
|||
|
i = CHAR_STARTITEMARRAY;
|
|||
|
imax = CHAR_MAXITEMHAVE;
|
|||
|
flg = -1;
|
|||
|
}else{
|
|||
|
i= sell;
|
|||
|
imax= sell + 1;
|
|||
|
flg = 1;
|
|||
|
}
|
|||
|
|
|||
|
/*--- ľ<><C4BE>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB> <20><><EFBFBD>£<EFBFBD>--*/
|
|||
|
/** <20><>ʸ<EFBFBD><CAB8><EFBFBD>һ<EFBFBD>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>ң--*/
|
|||
|
/*-- <20><>ʸ<EFBFBD><CAB8><EFBFBD>һ<EFBFBD><D2BB><EFBFBD> ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ة<EFBFBD><D8A9> --*/
|
|||
|
|
|||
|
for( ; i < imax ; i++ ){
|
|||
|
okflg=0;
|
|||
|
itemindex = CHAR_getItemIndex( talker , i );
|
|||
|
|
|||
|
if( ITEM_CHECKINDEX( itemindex) ){
|
|||
|
|
|||
|
/*--ʧ<><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD> ľ<><C4BE>--*/
|
|||
|
if( NPC_Util_GetStrFromStrWithDelim( argstr,"LimitItemType",
|
|||
|
buff, sizeof( buff))
|
|||
|
!= NULL )
|
|||
|
{
|
|||
|
k = 1;
|
|||
|
while(getStringFromIndexWithDelim(buff , "," , k, token, sizeof(token))
|
|||
|
!= FALSE )
|
|||
|
{
|
|||
|
#ifdef _ITEM_TYPETABLE
|
|||
|
int cmpmaxitem = sizeof(TypeTable)/sizeof(TypeTable[0]);
|
|||
|
#endif
|
|||
|
k++;
|
|||
|
#ifdef _ITEM_TYPETABLE
|
|||
|
for(j = 0 ; j < cmpmaxitem ; j++){
|
|||
|
#else
|
|||
|
for(j = 0 ; j < ITEM_CATEGORYNUM+3 ; j++){
|
|||
|
#endif
|
|||
|
if(strcmp( TypeTable[ j].arg , token) == 0 ) {
|
|||
|
itemtype = TypeTable[ j].type;
|
|||
|
if(ITEM_getInt(itemindex,ITEM_TYPE) == itemtype) {
|
|||
|
|
|||
|
/*-- ٯ <20><><EFBFBD><EFBFBD>--*/
|
|||
|
cost = NPC_GetSellPetList(itemindex,0,argstr,token3,i,sell);
|
|||
|
if(cost != -1) return cost;
|
|||
|
strncat( token2, token3, sizeof( token3));
|
|||
|
okflg = 1;
|
|||
|
}else if(itemtype == 30){
|
|||
|
if( 8 <= ITEM_getInt(itemindex,ITEM_TYPE)
|
|||
|
&& (ITEM_getInt(itemindex,ITEM_TYPE) <= 15) ){
|
|||
|
/*-- ٯ <20><><EFBFBD><EFBFBD>--*/
|
|||
|
cost = NPC_GetSellPetList(itemindex,0,argstr,token3,i,sell);
|
|||
|
if(cost != -1) return cost;
|
|||
|
strncat(token2,token3,sizeof(token3));
|
|||
|
okflg = 1;
|
|||
|
}
|
|||
|
}else if(itemtype == 40){
|
|||
|
if(( 0 <= ITEM_getInt(itemindex,ITEM_TYPE)
|
|||
|
&& (ITEM_getInt(itemindex,ITEM_TYPE) <= 4))
|
|||
|
|| (17 <= ITEM_getInt(itemindex,ITEM_TYPE)
|
|||
|
&& (ITEM_getInt(itemindex,ITEM_TYPE) <= 19))
|
|||
|
) {
|
|||
|
/*-- ٯ <20><><EFBFBD><EFBFBD>--*/
|
|||
|
cost = NPC_GetSellPetList(itemindex,0,argstr,token3,i,sell);
|
|||
|
if(cost != -1) return cost;
|
|||
|
strncat(token2,token3,sizeof(token3));
|
|||
|
okflg = 1;
|
|||
|
}
|
|||
|
}else if(itemtype == 50){
|
|||
|
if( 5 <= ITEM_getInt(itemindex,ITEM_TYPE)
|
|||
|
&& (ITEM_getInt(itemindex,ITEM_TYPE) <= 7) ){
|
|||
|
/*-- ٯ <20><><EFBFBD><EFBFBD>--*/
|
|||
|
cost = NPC_GetSellPetList(itemindex,0,argstr,token3,i,sell);
|
|||
|
if(cost != -1) return cost;
|
|||
|
strncat(token2,token3,sizeof(token3));
|
|||
|
okflg = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if(okflg == 1) break;
|
|||
|
}
|
|||
|
}
|
|||
|
/*--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD>ʻ<EFBFBD> <20><> į<>ƻ<EFBFBD> ľ<><C4BE>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if( (NPC_Util_GetStrFromStrWithDelim( argstr, "LimitItemNo",
|
|||
|
buff,sizeof( buff))
|
|||
|
!= NULL)
|
|||
|
&& okflg == 0 )
|
|||
|
{
|
|||
|
k = 1;
|
|||
|
while(getStringFromIndexWithDelim(buff , "," , k, token, sizeof(token))
|
|||
|
!= FALSE )
|
|||
|
{
|
|||
|
k++;
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>ɬ<EFBFBD>ý<EFBFBD>ľ<EFBFBD><C4BE>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-*/
|
|||
|
if(strstr( token, "-")==NULL && strcmp(token,"") != 0) {
|
|||
|
if(ITEM_getInt(itemindex,ITEM_ID) == atoi(token)) {
|
|||
|
/*-- ٯ <20><><EFBFBD><EFBFBD>--*/
|
|||
|
cost = NPC_GetSellPetList(itemindex,0,argstr,token3,i,sell);
|
|||
|
if(cost != -1) return cost;
|
|||
|
strncat(token2,token3,sizeof(token3));
|
|||
|
okflg=1;
|
|||
|
}
|
|||
|
}else if (strstr( token, "-") != NULL){
|
|||
|
int start;
|
|||
|
int end;
|
|||
|
int work;
|
|||
|
|
|||
|
/*-- ٯ <20><><EFBFBD><EFBFBD>--*/
|
|||
|
/* "-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>炙<EFBFBD><EFA7BB><EFBFBD><EFBFBD>Ѱ<EFBFBD><D1B0><EFBFBD> <20><><EFBFBD>Ѱ<EFBFBD>ë<EFBFBD><C3AB> --*/
|
|||
|
getStringFromIndexWithDelim( token, "-", 1, buf, sizeof(buf));
|
|||
|
start = atoi( buf);
|
|||
|
getStringFromIndexWithDelim( token, "-", 2 ,buf, sizeof(buf));
|
|||
|
end = atoi( buf);
|
|||
|
|
|||
|
/*-- į<><C4AF><EFBFBD>ѱ<EFBFBD>ئ<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD> ľ<C4BE><D7B8><EFBFBD><EFBFBD>**/
|
|||
|
if(start > end){
|
|||
|
work = start;
|
|||
|
start = end;
|
|||
|
end = work;
|
|||
|
}
|
|||
|
|
|||
|
end++;
|
|||
|
/*--"-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB> ë <20><>--*/
|
|||
|
if( (start <= ITEM_getInt(itemindex,ITEM_ID))
|
|||
|
&& (ITEM_getInt(itemindex,ITEM_ID) < end) )
|
|||
|
{
|
|||
|
/*-- ٯ <20><><EFBFBD><EFBFBD>--*/
|
|||
|
cost = NPC_GetSellPetList(itemindex,0,argstr,token3,i,sell);
|
|||
|
if(cost != -1) return cost;
|
|||
|
strncat(token2,token3,sizeof(token3));
|
|||
|
okflg = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*-- <20>³<EFBFBD><C2B3>绥ƥ<E7BBA5><C6A5>ئ<EFBFBD><D8A6>--*/
|
|||
|
if(okflg == 0) {
|
|||
|
cost = NPC_GetSellPetList(itemindex, 1, argstr, token3, i, sell);
|
|||
|
if(sell != -1) return -1;
|
|||
|
strncat( token2, token3, sizeof( token3));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
return -1;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*----------------------------------------------------------
|
|||
|
|
|||
|
<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˪<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>P<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
*----------------------------------------------------------*/
|
|||
|
int NPC_GetSellPetList(int itemindex,int flg, char *argstr,char *argtoken,int select,int sell)
|
|||
|
{
|
|||
|
|
|||
|
char buff[256];
|
|||
|
double rate = 0.2;
|
|||
|
char buff2[256];
|
|||
|
char buff3[64];
|
|||
|
int k = 1;
|
|||
|
int cost = -1;
|
|||
|
|
|||
|
/*--<2D><>ʸ<EFBFBD><CAB8><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--**/
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr,"special_item",buff, sizeof( buff))
|
|||
|
!= NULL)
|
|||
|
{
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr,"special_rate",buff2, sizeof( buff2))
|
|||
|
!= NULL )
|
|||
|
{
|
|||
|
rate = atof(buff2);
|
|||
|
}else{
|
|||
|
rate = 1.2;
|
|||
|
}
|
|||
|
|
|||
|
while(getStringFromIndexWithDelim(buff , "," , k, buff2, sizeof(buff2)) !=FALSE )
|
|||
|
{
|
|||
|
k++;
|
|||
|
|
|||
|
if(strstr( buff2, "-") == NULL && strcmp(buff2,"") != 0) {
|
|||
|
if(ITEM_getInt(itemindex,ITEM_ID) == atoi(buff2)){
|
|||
|
cost = NPC_SellPetstrsStr( itemindex,0, rate, argtoken,select,sell);
|
|||
|
return cost;
|
|||
|
}
|
|||
|
}else if (strstr( buff2, "-") != NULL){
|
|||
|
int start;
|
|||
|
int end;
|
|||
|
int work;
|
|||
|
|
|||
|
/*-- ٯ <20><><EFBFBD><EFBFBD>--*/
|
|||
|
/* "-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>炙<EFBFBD><EFA7BB><EFBFBD><EFBFBD>Ѱ<EFBFBD><D1B0><EFBFBD> <20><><EFBFBD>Ѱ<EFBFBD>ë<EFBFBD><C3AB> --*/
|
|||
|
getStringFromIndexWithDelim( buff2, "-", 1, buff3, sizeof(buff3));
|
|||
|
start = atoi( buff3);
|
|||
|
getStringFromIndexWithDelim( buff2, "-", 2 ,buff3, sizeof(buff3));
|
|||
|
end = atoi( buff3);
|
|||
|
|
|||
|
/*-- į<><C4AF><EFBFBD>ѱ<EFBFBD>ئ<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD> ľ<C4BE><D7B8><EFBFBD><EFBFBD>**/
|
|||
|
if(start > end){
|
|||
|
work = start;
|
|||
|
start = end;
|
|||
|
end = work;
|
|||
|
}
|
|||
|
end++;
|
|||
|
|
|||
|
/*--"-"ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB> ë <20><>--*/
|
|||
|
if( (start <= ITEM_getInt(itemindex,ITEM_ID))
|
|||
|
&& (ITEM_getInt(itemindex,ITEM_ID) < end)
|
|||
|
){
|
|||
|
|
|||
|
cost = NPC_SellPetstrsStr( itemindex,0, rate, argtoken,select,sell);
|
|||
|
return cost;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*--<2D>á<EFBFBD>Ѩ<EFBFBD><D1A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--*/
|
|||
|
if( NPC_Util_GetStrFromStrWithDelim( argstr,"sell_rate",buff, sizeof( buff))
|
|||
|
!= NULL )
|
|||
|
{
|
|||
|
rate = atof(buff);
|
|||
|
cost = NPC_SellPetstrsStr( itemindex, flg ,rate, argtoken,select,sell);
|
|||
|
return cost;
|
|||
|
}
|
|||
|
|
|||
|
return cost;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*------------------------------------------
|
|||
|
|
|||
|
ٯ ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD>)
|
|||
|
|
|||
|
*------------------------------------------*/
|
|||
|
int NPC_SellPetstrsStr(int itemindex,int flg,double rate,char *argtoken,int select,int sell)
|
|||
|
{
|
|||
|
int cost;
|
|||
|
char escapedname[256];
|
|||
|
char name[256];
|
|||
|
char *eff;
|
|||
|
|
|||
|
|
|||
|
cost = ITEM_getInt( itemindex, ITEM_COST);
|
|||
|
cost = (int)(cost * rate);
|
|||
|
|
|||
|
if(sell != -1) return cost;
|
|||
|
|
|||
|
|
|||
|
//strcpy( escapedname, ITEM_getChar( itemindex, ITEM_NAME));
|
|||
|
strcpy( escapedname, ITEM_getChar( itemindex, ITEM_SECRETNAME));
|
|||
|
makeEscapeString( escapedname, name, sizeof( name));
|
|||
|
eff=ITEM_getChar(itemindex, ITEM_EFFECTSTRING);
|
|||
|
makeEscapeString( eff, escapedname, sizeof(escapedname));
|
|||
|
|
|||
|
|
|||
|
|
|||
|
sprintf(argtoken,"%s|%d|%d|%d|%s|%d|",
|
|||
|
name,
|
|||
|
flg,
|
|||
|
cost,
|
|||
|
ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER),
|
|||
|
escapedname,
|
|||
|
select
|
|||
|
);
|
|||
|
|
|||
|
return -1;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/*--------------------------------------------
|
|||
|
*
|
|||
|
*<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߯<EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
*-------------------------------------------*/
|
|||
|
BOOL NPC_PKPetShop_SellNewPet(int meindex,int talker,char *data)
|
|||
|
{
|
|||
|
int select;
|
|||
|
int cost;
|
|||
|
int oldcost;
|
|||
|
char token[32];
|
|||
|
int k;
|
|||
|
int itemindex;
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char token2[256];
|
|||
|
|
|||
|
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) {
|
|||
|
print("GetArgStrErr");
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*--߯<>Ȼ<EFBFBD> <20><EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݩ--*/
|
|||
|
getStringFromIndexWithDelim(data , "|" ,1, token, sizeof( token));
|
|||
|
select = atoi(token);
|
|||
|
getStringFromIndexWithDelim(data , "|" ,2, token, sizeof( token));
|
|||
|
oldcost = atoi(token);
|
|||
|
|
|||
|
if(select == 0) return FALSE;
|
|||
|
|
|||
|
cost = NPC_PKPetShop_GetLimtPetList( talker,argstr, token2,select);
|
|||
|
|
|||
|
|
|||
|
/*--ਵ<><E0A8B5>ּ<EFBFBD>ë<EFBFBD><C3AB>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>弰<EFBFBD>¡<DEB7>--*/
|
|||
|
if(oldcost != cost || cost == -1)
|
|||
|
{
|
|||
|
int fd = getfdFromCharaIndex( talker);
|
|||
|
char token[256];
|
|||
|
|
|||
|
sprintf(token,"\n\n<EFBFBD><EFBFBD>ѽ!<21>Բ<EFBFBD><D4B2><EFBFBD>"
|
|||
|
"\n\n<EFBFBD>Բ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ! <20>ɲ<EFBFBD><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡһ<D1A1><D2BB><EFBFBD>أ<EFBFBD>"
|
|||
|
);
|
|||
|
|
|||
|
k = select;
|
|||
|
itemindex = CHAR_getItemIndex( talker ,k);
|
|||
|
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>뼰<EFBFBD><EBBCB0> --*/
|
|||
|
if(itemindex != -1) {
|
|||
|
print("\n%s(%d,%d,%d):<3A><>ѡ<EFBFBD><D1A1><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>ͬerror([%s(%d)]Ҫ<><D2AA>ʧ<EFBFBD>ˣ<EFBFBD>",
|
|||
|
CHAR_getChar(talker, CHAR_NAME),
|
|||
|
CHAR_getInt( talker, CHAR_FLOOR),
|
|||
|
CHAR_getInt( talker, CHAR_X ),
|
|||
|
CHAR_getInt( talker, CHAR_Y ),
|
|||
|
ITEM_getChar(itemindex, CHAR_NAME),
|
|||
|
ITEM_getInt( itemindex, ITEM_ID )
|
|||
|
);
|
|||
|
LogItem(
|
|||
|
CHAR_getChar( talker, CHAR_NAME ), /* ƽ<>ҷ<EFBFBD> */
|
|||
|
CHAR_getChar( talker, CHAR_CDKEY ),
|
|||
|
#ifdef _add_item_log_name // WON ADD <20><>item<65><6D>log<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD>
|
|||
|
itemindex,
|
|||
|
#else
|
|||
|
ITEM_getInt( itemindex, ITEM_ID ), /* ʧ<><CAA7> ة į */
|
|||
|
#endif
|
|||
|
"SellErr",
|
|||
|
CHAR_getInt( talker, CHAR_FLOOR),
|
|||
|
CHAR_getInt( talker, CHAR_X ),
|
|||
|
CHAR_getInt( talker, CHAR_Y ),
|
|||
|
ITEM_getChar( itemindex, ITEM_UNIQUECODE),
|
|||
|
ITEM_getChar( itemindex, ITEM_NAME),
|
|||
|
ITEM_getInt( itemindex, ITEM_ID)
|
|||
|
);
|
|||
|
}else{
|
|||
|
print("\n%s(%d,%d,%d):<3A><>ѡ<EFBFBD><D1A1><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>ͬerror(û<><C3BB><EFBFBD>κ<EFBFBD>item<65><6D><EFBFBD>ڣ<EFBFBD>",
|
|||
|
CHAR_getChar(talker, CHAR_NAME),
|
|||
|
CHAR_getInt( talker, CHAR_FLOOR),
|
|||
|
CHAR_getInt( talker, CHAR_X ),
|
|||
|
CHAR_getInt( talker, CHAR_Y )
|
|||
|
);
|
|||
|
LogItem(
|
|||
|
CHAR_getChar( talker, CHAR_NAME ), /* ƽ<>ҷ<EFBFBD> */
|
|||
|
CHAR_getChar( talker, CHAR_CDKEY ),
|
|||
|
-1, /* ʧ<><CAA7> ة į */
|
|||
|
"SellErr",
|
|||
|
CHAR_getInt( talker, CHAR_FLOOR),
|
|||
|
CHAR_getInt( talker, CHAR_X ),
|
|||
|
CHAR_getInt( talker, CHAR_Y ),
|
|||
|
"-1", "NULL", -1 );
|
|||
|
}
|
|||
|
/*--<2D><><EFBFBD><EFBFBD>ƥ˪<C6A5><CBAA>--*/
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
|
|||
|
WINDOW_BUTTONTYPE_OK,
|
|||
|
CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
|
|||
|
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
|
|||
|
k = select;
|
|||
|
itemindex=CHAR_getItemIndex( talker ,k);
|
|||
|
|
|||
|
if(itemindex != -1) {
|
|||
|
{
|
|||
|
LogItem(
|
|||
|
CHAR_getChar( talker, CHAR_NAME ), /* ƽ<>ҷ<EFBFBD> */
|
|||
|
CHAR_getChar( talker, CHAR_CDKEY ),
|
|||
|
#ifdef _add_item_log_name // WON ADD <20><>item<65><6D>log<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD>
|
|||
|
itemindex,
|
|||
|
#else
|
|||
|
ITEM_getInt( itemindex, ITEM_ID ), /* ʧ<><CAA7> ة į */
|
|||
|
#endif
|
|||
|
"Sell",
|
|||
|
CHAR_getInt( talker,CHAR_FLOOR),
|
|||
|
CHAR_getInt( talker,CHAR_X ),
|
|||
|
CHAR_getInt( talker,CHAR_Y ),
|
|||
|
ITEM_getChar( itemindex, ITEM_UNIQUECODE),
|
|||
|
ITEM_getChar( itemindex, ITEM_NAME),
|
|||
|
ITEM_getInt( itemindex, ITEM_ID)
|
|||
|
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
CHAR_DelItem( talker, k);
|
|||
|
CHAR_AddGold( talker, cost);
|
|||
|
CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);
|
|||
|
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void NPC_LimitPetShop(int meindex,int talker,int select)
|
|||
|
{
|
|||
|
|
|||
|
int fd = getfdFromCharaIndex( talker);
|
|||
|
char token[NPC_UTIL_GETARGSTR_LINEMAX];
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char buf[1024];
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <20><><EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD><EFBFBD>̻ﻥ<CCBB><EFBBA5><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4> --*/
|
|||
|
if( NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) {
|
|||
|
print("shop_GetArgStr_Err");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
/*-- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB> <20><>ƥ<EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-*/
|
|||
|
if(NPC_Util_GetStrFromStrWithDelim( argstr, "sellonly_msg", buf, sizeof( buf))
|
|||
|
!=NULL)
|
|||
|
{
|
|||
|
sprintf(token,"\n\n%s", buf);
|
|||
|
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
|
|||
|
WINDOW_BUTTONTYPE_YESNO,
|
|||
|
CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
|
|||
|
}else{
|
|||
|
CHAR_talkToCli( talker, meindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ר<EFBFBD>ŵꡣ",CHAR_COLORWHITE);
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*--<2D><>˪<EFBFBD>н<EFBFBD><D0BD><EFBFBD>--*/
|
|||
|
void NPC_PKPetShop_ExpressmanCheck(int meindex,int talker)
|
|||
|
{
|
|||
|
int fd = getfdFromCharaIndex( talker);
|
|||
|
char token[1024];
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char buf[1024];
|
|||
|
|
|||
|
/*--<2D><><EFBFBD>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <20><><EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD><EFBFBD>̻ﻥ<CCBB><EFBBA5><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巴<EFBFBD><E5B7B4> --*/
|
|||
|
if( NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) {
|
|||
|
print("shop_GetArgStr_Err");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*-- <20><><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB> <20><>ƥ<EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-*/
|
|||
|
NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buf, sizeof( buf));
|
|||
|
sprintf(token,"4\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n\n%s"
|
|||
|
"\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|||
|
"\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|||
|
,CHAR_getChar(meindex,CHAR_NAME),buf);
|
|||
|
|
|||
|
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT,
|
|||
|
WINDOW_BUTTONTYPE_CANCEL,
|
|||
|
CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
|
|||
|
token);
|
|||
|
|
|||
|
return;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endif
|
|||
|
// _PKPETSHOP
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|