1094 lines
33 KiB
C
1094 lines
33 KiB
C
![]() |
#include "version.h"
|
|||
|
|
|||
|
#include <stdio.h>
|
|||
|
#include <time.h>
|
|||
|
#include <string.h>
|
|||
|
#include <unistd.h>
|
|||
|
#include <math.h>
|
|||
|
|
|||
|
#include "object.h"
|
|||
|
#include "char.h"
|
|||
|
#include "char_base.h"
|
|||
|
#include "char_data.h"
|
|||
|
#include "net.h"
|
|||
|
#include "npcutil.h"
|
|||
|
#include "handletime.h"
|
|||
|
#include "readmap.h"
|
|||
|
#include "npc_roomadminnew.h"
|
|||
|
#include "npc_door.h"
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
* <EFBFBD><EFBFBD> Dz֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD> By Kawata
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ̤<EFBFBD><EFBFBD>ئ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
|
|||
|
|
|||
|
enum{
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> */
|
|||
|
CHAR_WORKINT_RANGE = CHAR_NPCWORKINT1,
|
|||
|
/* <20>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_WORKINT_NEXTTIME = CHAR_NPCWORKINT2,
|
|||
|
/* <20><><EFBFBD>ã<EFBFBD><C3A3><EFBFBD>婣<EFBFBD><E5A9A3><EFBFBD> */
|
|||
|
CHAR_WORKINT_PRINTCLOSETIME = CHAR_NPCWORKINT3,
|
|||
|
/* <20>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> */
|
|||
|
CHAR_WORKINT_SEARCHROOMTIME = CHAR_NPCWORKINT4,
|
|||
|
|
|||
|
};
|
|||
|
enum {
|
|||
|
/* <20><><EFBFBD>м<EFBFBD> <20><> */
|
|||
|
CHAR_WORKCHAR_MYNAME = CHAR_NPCWORKCHAR1,
|
|||
|
/* <20>ݼ<EFBFBD> <20><> */
|
|||
|
CHAR_WORKCHAR_NEXTROOM = CHAR_NPCWORKCHAR2,
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
/* <20>¼<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD> <20><> <20>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
enum {
|
|||
|
/* <20><> <20>м<EFBFBD> <20><> */
|
|||
|
CHAR_WORKCHAR_ADMNAME = CHAR_NPCWORKCHAR1,
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>ëɡ <20><><EFBFBD>·<EFBFBD>ū<EFBFBD><C5AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ls2/src/lss <20><><EFBFBD>ռ<EFBFBD><D5BC>¸<EFBFBD>϶<EFBFBD><CFB6> */
|
|||
|
#define NPC_ROOMADMINNEW_DATADIR "roomadmin/"
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻P<CCBB><EFBCB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
#define NPC_ROOMADMINNEW_EXTENSION ".room"
|
|||
|
/* <20>¼<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD>뷸<EFBFBD><EBB7B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻P<CCBB><EFBCB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̷<EFBFBD><CCB7><EFBFBD> */
|
|||
|
#define NPC_ROOMADMINNEW_RANKING_EXTENSION ".score"
|
|||
|
#define NPC_ROOMADMINNEW_RANKING_EXTENSION_TMP ".score.tmp"
|
|||
|
/* <20><> ڿ<><DABF><EFBFBD>¼<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> */
|
|||
|
#define NPC_ROOMADMINNEW_SCOREFILE ".score"
|
|||
|
/* <><F3BBBBA7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD><D5B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
#define NPC_ROOMADMINNEW_PRINTCLOSETIME_DEFAULT 5
|
|||
|
|
|||
|
#define NPC_ROOMADMINNEW_MSG_CLOSE_BEFORE \
|
|||
|
"%s %s %s<>Ļ<C4BB><EEB6AF><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>%d<><64>ǰ<EFBFBD><C7B0>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_CLOSE \
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѽ<EFBFBD>ֹ<EFBFBD><EFBFBD>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_NONE \
|
|||
|
"<EFBFBD>ܿ<EFBFBD>ϧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_CONGRATULATION \
|
|||
|
"<EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s<><73><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>%s<>Ľ<EFBFBD>Ǯȫ<C7AE><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>%s<><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Աѯ<D4B1>ʷ<EFBFBD><CAB7>䰵<EFBFBD>š<EFBFBD>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_PRINTPASSWD_NONE \
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>а<EFBFBD><EFBFBD>š<EFBFBD>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_DSPPASSWD1 \
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s %s %s<><73>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_DSPPASSWD2 \
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>%s <20><><EFBFBD><EFBFBD>ֻҪ<D6BB>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>β<EFBFBD><CEB2><EFBFBD>ϡ<EFBFBD>...<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾Ϳ<CBBE><CDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ࡣ<EFBFBD>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION_NONE \
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD>յĻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION1 \
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s %s %s<><73>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION2 \
|
|||
|
"<EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d:%d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>Ϊֹ<CEAA><D6B9><EFBFBD><EFBFBD>%2dСʱ%02d<32>֡<EFBFBD>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION3 \
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD>͵ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><>"
|
|||
|
|
|||
|
#define NPC_ROOMADMINNEW_MSG_RANKING_INFO \
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD>Ǹ߶<EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><EFBFBD><EFBFBD>"
|
|||
|
#define NPC_ROOMADMINNEW_MSG_RANKING \
|
|||
|
"Rank %2d:%4d/%02d/%02d %8d GOLD %s%s "
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD>NPC<50><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
#define NPC_ROOMADMINNEW_MSGCOLOR CHAR_COLORWHITE
|
|||
|
#define NPC_RANKING_MSGCOLOR CHAR_COLORWHITE
|
|||
|
#define NPC_ROOMADMINNEW_2WEEK 60*60*24*14
|
|||
|
|
|||
|
static void NPC_RoomAdminNew_DspNextAuction( int meindex, int talkerindex);
|
|||
|
static void NPC_RoomAdminNew_DspRoomPasswd( int meindex, int adminindex, int talkerindex);
|
|||
|
static BOOL NPC_RoomAdminNew_SetNextAuction( int meindex);
|
|||
|
static BOOL NPC_RoomAdminNew_WriteDataFile( int meindex, int pindex, char *roomname,
|
|||
|
char *passwd, BOOL flg);
|
|||
|
static void NPC_RoomAdminNew_CreatePasswd( char *passwd, int passlen);
|
|||
|
static void NPC_RoomAdminNew_SendMsgThisFloor( int index, char *buff);
|
|||
|
static int NPC_RoomAdminNew_SearchPlayerHasMostMoney( int meindex);
|
|||
|
static void NPC_RoomAdminNew_CloseProc( int meindex);
|
|||
|
static int NPC_RoomAdminNew_WriteScoreFile( int meindex, int pindex);
|
|||
|
static void NPC_RoomAdminNew_ReadScoreFile( int meindex, int talkerindex,
|
|||
|
char *admname);
|
|||
|
|
|||
|
/************************************************
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
************************************************/
|
|||
|
BOOL NPC_RoomAdminNewInit( int meindex )
|
|||
|
{
|
|||
|
int i;
|
|||
|
char buf[256];
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
|
|||
|
/* <20><><EFBFBD>м<EFBFBD><D0BC><EFBFBD>଼<EFBFBD><E0ACBC><EFBFBD> <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>NPC<50><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľئ<C4BE><D8A6> */
|
|||
|
for( i = 3; ; i ++ ) {
|
|||
|
if( getStringFromIndexWithDelim(argstr, "|" , i , buf,sizeof(buf) )) {
|
|||
|
if( NPC_DoorSearchByName( buf) < 0 ) {
|
|||
|
print( "admin not created.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<D6AE>ȵȴ<C8B5><C8B4><EFBFBD>\n");
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
}
|
|||
|
else{
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
|||
|
/* type<70><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEROOMADMIN);
|
|||
|
/* <20><> <20><><EFBFBD><EFBFBD> */
|
|||
|
getStringFromIndexWithDelim(argstr, "|" , 1 , buf,sizeof(buf) );
|
|||
|
CHAR_setWorkInt( meindex , CHAR_WORKINT_RANGE , atoi( buf ));
|
|||
|
/* <20><><EFBFBD>м<EFBFBD> <20><><EFBFBD><EFBFBD> */
|
|||
|
if( !getStringFromIndexWithDelim(argstr, "|" , 2 , buf,sizeof(buf) )) {
|
|||
|
print( "arg err.admin not created.\n");
|
|||
|
return( FALSE);
|
|||
|
}
|
|||
|
CHAR_setWorkChar( meindex , CHAR_WORKCHAR_MYNAME , buf);
|
|||
|
|
|||
|
/* <20><><EFBFBD>ã<EFBFBD><C3A3><EFBFBD>婣<EFBFBD><E5A9A3><EFBFBD><EFBFBD><F3A1A3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_setWorkInt( meindex, CHAR_WORKINT_PRINTCLOSETIME, 0);
|
|||
|
|
|||
|
/* <20>ݼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
NPC_RoomAdminNew_SetNextAuction( meindex);
|
|||
|
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
/************************************************
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD><EFBFBD><EFBFBD> պ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD><EFBFBD> ƥئ<EFBFBD>ʻ<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_RoomAdminNewLoop( int meindex )
|
|||
|
{
|
|||
|
int hun;
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD> */
|
|||
|
if( CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME) == 0 ) {
|
|||
|
/* <20><><EFBFBD>Ը<EFBFBD><D4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɸ<EFBFBD><C9B8><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD> */
|
|||
|
struct tm tm1,tm2;
|
|||
|
time_t t;
|
|||
|
memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1));
|
|||
|
t = CHAR_getWorkInt( meindex, CHAR_WORKINT_SEARCHROOMTIME);
|
|||
|
memcpy( &tm2, localtime( &t),
|
|||
|
sizeof( tm2));
|
|||
|
if( tm1.tm_year != tm2.tm_year ||
|
|||
|
tm1.tm_mday != tm2.tm_mday ||
|
|||
|
tm1.tm_mon != tm2.tm_mon )
|
|||
|
{
|
|||
|
NPC_RoomAdminNew_SetNextAuction( meindex);
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
hun = ceil((double)(CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME) -
|
|||
|
NowTime.tv_sec) / 60.0);
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD><D6BC>ݼ<EFBFBD><DDBC>б<EFBFBD>hun<75><6E>Ѩ<EFBFBD>̹ϵ<CCB9><CFB5><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7>߱<EFBFBD> <20><> */
|
|||
|
if( hun < 0 ) hun = 0;
|
|||
|
|
|||
|
if( hun < NPC_ROOMADMINNEW_PRINTCLOSETIME_DEFAULT ) {
|
|||
|
/* <><F3BBBBA7>Ի<EFBFBD><D4BB><EFBFBD>ʱ<EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD><EFBFBD><F3BBBBA7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4><EFBFBD> */
|
|||
|
if( hun != CHAR_getWorkInt( meindex, CHAR_WORKINT_PRINTCLOSETIME)) {
|
|||
|
char buff[256];
|
|||
|
if( hun != 0 ) {
|
|||
|
char buf2[1024];
|
|||
|
char msgbuff[16];
|
|||
|
char argstr2[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
int doorindex;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD> <20><> */
|
|||
|
doorindex = NPC_DoorSearchByName( CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM));
|
|||
|
NPC_Util_GetArgStr( doorindex, argstr2, sizeof( argstr2));
|
|||
|
getStringFromIndexWithDelim( argstr2, "|" , 9 ,
|
|||
|
buf2,sizeof(buf2) );
|
|||
|
/* <20><><EFBFBD><EFBFBD> */
|
|||
|
if( strlen(CHAR_getChar( doorindex, CHAR_NAME) ) != 0 ) {
|
|||
|
strcpy( msgbuff, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
}
|
|||
|
else {
|
|||
|
msgbuff[0] = '\0';
|
|||
|
}
|
|||
|
/* <20><><EFBFBD><F3BBBBA7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD>ʣ<EFBFBD> */
|
|||
|
snprintf( buff, sizeof(buff),
|
|||
|
NPC_ROOMADMINNEW_MSG_CLOSE_BEFORE,
|
|||
|
buf2,
|
|||
|
CHAR_getChar( doorindex, CHAR_NAME),
|
|||
|
msgbuff,
|
|||
|
hun);
|
|||
|
|
|||
|
CHAR_setWorkInt( meindex, CHAR_WORKINT_PRINTCLOSETIME, hun);
|
|||
|
}
|
|||
|
else {
|
|||
|
/* <20><><EFBFBD><F3BBBBA7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD>ף<EFBFBD> */
|
|||
|
strcpy( buff, NPC_ROOMADMINNEW_MSG_CLOSE);
|
|||
|
CHAR_setWorkInt( meindex, CHAR_WORKINT_PRINTCLOSETIME, 0);
|
|||
|
}
|
|||
|
/* <20><F0BCB0B0>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>幻<EFBFBD><E5B9BB>˪<EFBFBD><CBAA> */
|
|||
|
NPC_RoomAdminNew_SendMsgThisFloor( meindex, buff);
|
|||
|
}
|
|||
|
}
|
|||
|
/* <><F3BBBBA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD> */
|
|||
|
if( hun == 0 ) {
|
|||
|
NPC_RoomAdminNew_CloseProc( meindex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/************************************************
|
|||
|
* <EFBFBD>ƾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
************************************************/
|
|||
|
void NPC_RoomAdminNewTalked( int meindex , int talkerindex , char *msg ,
|
|||
|
int color )
|
|||
|
{
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧѨ<CAA7><D1A8><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ئ<><D8A6> ɱ<><C9B1><EFBFBD>£<EFBFBD> */
|
|||
|
if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return;
|
|||
|
|
|||
|
/* <20>ƾ<EFBFBD><C6BE><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>л<EFBFBD> <20><>ëŷԻ<C5B7><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
/*NPC_RoomAdminNew_DspRoomPasswd( meindex, talkerindex);*/
|
|||
|
|
|||
|
/* <20>ݼԷ<DDBC><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޣ<EFBFBD> <20><>ë<EFBFBD>ɵ<EFBFBD> */
|
|||
|
NPC_RoomAdminNew_DspNextAuction( meindex, talkerindex);
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*----------------------------------------------*/
|
|||
|
static void NPC_RoomAdminNew_CloseProc( int meindex)
|
|||
|
{
|
|||
|
int pindex;
|
|||
|
char buff[256];
|
|||
|
char pname[32];
|
|||
|
int failed = TRUE;
|
|||
|
|
|||
|
/* <20><> <20><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD> <20>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD> */
|
|||
|
pindex = NPC_RoomAdminNew_SearchPlayerHasMostMoney( meindex);
|
|||
|
/* <20><>ʧ<F1B2B7AE><CAA7> */
|
|||
|
if( pindex != -1) {
|
|||
|
/* <20><><EFBFBD><EFBFBD>ƥ <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5> */
|
|||
|
while( 1) {
|
|||
|
char passwd[9];
|
|||
|
int doorindex;
|
|||
|
doorindex = NPC_DoorSearchByName(
|
|||
|
CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM));
|
|||
|
/* <20>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ëϷ<C3AB><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
NPC_RoomAdminNew_CreatePasswd( passwd, sizeof( passwd));
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD> ƽ<><C6BD><EFBFBD><EFBFBD>ƽ<EFBFBD>ҷ<EFBFBD> <20><> <20><> <20><><EFBFBD>ɵ<EFBFBD>ë̤<C3AB><CCA4> <20><> */
|
|||
|
if( NPC_RoomAdminNew_WriteDataFile( meindex, pindex,
|
|||
|
CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM),
|
|||
|
passwd, 1)
|
|||
|
== FALSE)
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
/* <20><>ʧ<EFBFBD><CAA7><EFBFBD>ɵ<EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
if( NPC_DoorSetPasswd( doorindex, passwd) == -1 ) {
|
|||
|
break;
|
|||
|
}
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_setWorkInt( doorindex, CHAR_WORKDOOREXPIRETIME,
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME)
|
|||
|
+ NPC_ROOMADMINNEW_2WEEK);
|
|||
|
/* ڿ<><DABF><EFBFBD>¼<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD><CDA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>̤<EFBFBD><CCA4> <20><> */
|
|||
|
NPC_RoomAdminNew_WriteScoreFile( meindex, pindex);
|
|||
|
|
|||
|
CHAR_setInt( pindex, CHAR_GOLD, 0);
|
|||
|
|
|||
|
CHAR_send_P_StatusString( pindex , CHAR_P_STRING_GOLD);
|
|||
|
|
|||
|
/* <20>ƻ<EFBFBD>ƥ<EFBFBD>絤<EFBFBD>嶪<EFBFBD><E5B6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
strcpy( pname, CHAR_getChar( pindex, CHAR_NAME));
|
|||
|
snprintf( buff, sizeof(buff),
|
|||
|
NPC_ROOMADMINNEW_MSG_CONGRATULATION, pname, pname, pname);
|
|||
|
failed = FALSE;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/* <20><><EFBFBD><F1B2B7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B7><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> */
|
|||
|
if( failed) {
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>̻ᆴ<CCBB>ճ<EFBFBD><D5B3><EFBFBD> <20>м<EFBFBD><D0BC><EFBFBD> ë<><C3AB><EFBFBD><EFBFBD> */
|
|||
|
NPC_RoomAdminNew_WriteDataFile( meindex, -1,
|
|||
|
CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM),
|
|||
|
NULL, 0);
|
|||
|
/* <20><><EFBFBD><F1B2B7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
snprintf( buff, sizeof(buff),
|
|||
|
NPC_ROOMADMINNEW_MSG_NONE);
|
|||
|
}
|
|||
|
/* <20><F0BCB0B0>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>幻<EFBFBD><E5B9BB>˪<EFBFBD><CBAA> */
|
|||
|
NPC_RoomAdminNew_SendMsgThisFloor( meindex, buff);
|
|||
|
|
|||
|
/* <20>ݼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
NPC_RoomAdminNew_SetNextAuction( meindex);
|
|||
|
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*----------------------------------------------*/
|
|||
|
static int NPC_RoomAdminNew_SearchPlayerHasMostMoney( int meindex)
|
|||
|
{
|
|||
|
int i,j, range;
|
|||
|
int fl,x,y, gold;
|
|||
|
int doorindex;
|
|||
|
int topindex;
|
|||
|
|
|||
|
fl = CHAR_getInt( meindex, CHAR_FLOOR);
|
|||
|
x = CHAR_getInt( meindex, CHAR_X);
|
|||
|
y = CHAR_getInt( meindex, CHAR_Y);
|
|||
|
range = CHAR_getWorkInt( meindex , CHAR_WORKINT_RANGE);
|
|||
|
topindex = -1;
|
|||
|
|
|||
|
/* <20>м<EFBFBD> <><F3A1BEAE> <20><> ڿ<>ź<EFBFBD>ëƩ<C3AB><C6A9><EFBFBD><EFBFBD> */
|
|||
|
doorindex = NPC_DoorSearchByName( CHAR_getWorkChar( meindex,
|
|||
|
CHAR_WORKCHAR_NEXTROOM));
|
|||
|
gold = atoi( CHAR_getWorkChar( doorindex, CHAR_WORKDOORGOLDLIMIT));
|
|||
|
/* <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD>ҷ¼<D2B7><C2BC><EFBFBD>ëƩ<C3AB><C6A9><EFBFBD><EFBFBD> */
|
|||
|
for( i = x-range ; i <= x+range ; i++ ){
|
|||
|
for( j = y-range ; j <= y+range ; j ++ ){
|
|||
|
OBJECT object;
|
|||
|
for( object = MAP_getTopObj( fl, i,j); object;
|
|||
|
object = NEXT_OBJECT(object) )
|
|||
|
{
|
|||
|
int objindex = GET_OBJINDEX( object);
|
|||
|
if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){
|
|||
|
int index;
|
|||
|
index = OBJECT_getIndex(objindex);
|
|||
|
if( CHAR_getInt( index,
|
|||
|
CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER )
|
|||
|
{
|
|||
|
if( CHAR_getInt( index, CHAR_GOLD) >= gold ) {
|
|||
|
if( topindex == -1 ) {
|
|||
|
topindex = index;
|
|||
|
}
|
|||
|
else {
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʤ */
|
|||
|
int nowgold,topgold;
|
|||
|
nowgold = CHAR_getInt( index, CHAR_GOLD );
|
|||
|
topgold = CHAR_getInt( topindex, CHAR_GOLD);
|
|||
|
if( nowgold > topgold ) {
|
|||
|
topindex = index;
|
|||
|
}
|
|||
|
else if( nowgold == topgold ) {
|
|||
|
/* <20><><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD>ì<EFBFBD>ﻥ<EFBFBD><EFBBA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
int nowlv, toplv;
|
|||
|
nowlv = CHAR_getInt( index, CHAR_LV );
|
|||
|
toplv = CHAR_getInt( topindex, CHAR_LV);
|
|||
|
if( nowlv < toplv ) {
|
|||
|
topindex = index;
|
|||
|
}
|
|||
|
/* <20><>ľƥ<C4BE><C6A5>ݩ<EFBFBD><DDA9><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD>ئ<EFBFBD>շ¼<D5B7>ĸةԪ<D8A9><D4AA>*/
|
|||
|
/* index<65><78><EFBFBD>Ƽ<EFBFBD><C6BC>л<EFBFBD><D0BB>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
else if( nowlv == toplv ) {
|
|||
|
if( RAND( 0,1)) {
|
|||
|
topindex = index;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return( topindex);
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* ϶<EFBFBD>ý<EFBFBD>ľ<EFBFBD><EFBFBD>index<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>幻<EFBFBD><EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë˪<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|||
|
*----------------------------------------------*/
|
|||
|
static void NPC_RoomAdminNew_SendMsgThisFloor( int index, char *buff)
|
|||
|
{
|
|||
|
int i, fl;
|
|||
|
int playernum = CHAR_getPlayerMaxNum();
|
|||
|
|
|||
|
fl = CHAR_getInt( index, CHAR_FLOOR);
|
|||
|
for( i = 0; i < playernum; i ++ ) {
|
|||
|
if( CHAR_getInt( i, CHAR_FLOOR) == fl ) {
|
|||
|
/* <20><><EFBFBD><EFBFBD><D7BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
if( CHAR_getInt( i, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) {
|
|||
|
CHAR_talkToCli( i, index, buff, NPC_ROOMADMINNEW_MSGCOLOR);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* <EFBFBD>ɵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ëϷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>passlen<EFBFBD><EFBFBD>-1 ٯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD>£<EFBFBD>
|
|||
|
* makecdn.c<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD>
|
|||
|
*----------------------------------------------*/
|
|||
|
static void NPC_RoomAdminNew_CreatePasswd( char *passwd, int passlen)
|
|||
|
{
|
|||
|
#define NPC_ROOMADMINNEW_RAND() ( (rand() /256) % 32768 ) /* 256ƥ<36><C6A5><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD> ߤ<><DFA4><EFBFBD><EFBFBD> */
|
|||
|
int i;
|
|||
|
char *candidates[]= {
|
|||
|
"A","B","D", "E","F","G","H", "J","K","L","M", "N","P","Q","R",
|
|||
|
"T","W","X","Y", "a","b","d","e", "f","g","m","n", "q","r","t",
|
|||
|
"0","1","2", "3","4","5","6", "7","8","9"
|
|||
|
};
|
|||
|
strcpy( passwd , "");
|
|||
|
for(i = 0;i < passlen -1 ; i++){
|
|||
|
strcat( passwd , candidates[ NPC_ROOMADMINNEW_RAND() % (sizeof( candidates)/sizeof(candidates[0])) ] );
|
|||
|
}
|
|||
|
#undef NPC_ROOMADMINNEW_RAND
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD><EFBFBD>巸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë̤<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <EFBFBD><EFBFBD>"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.room"
|
|||
|
* ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻P<EFBFBD><EFBFBD><EFBFBD>ɡ<EFBFBD>Ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* cdkey|charaname|passwd|expiretime
|
|||
|
*
|
|||
|
*
|
|||
|
* ¦<EFBFBD>Ѽ<EFBFBD>flg <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><EFBFBD> <EFBFBD>ģݨ߷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>հ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* Ի<EFBFBD><EFBFBD><EFBFBD><EFBFBD>TRUE<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* FALSE:<EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*----------------------------------------------*/
|
|||
|
static BOOL NPC_RoomAdminNew_WriteDataFile( int meindex, int pindex,
|
|||
|
char *roomname,
|
|||
|
char *passwd, int flg)
|
|||
|
{
|
|||
|
char *cdkey;
|
|||
|
char charaname[32*2];
|
|||
|
char expiretime[64];
|
|||
|
char filename[128];
|
|||
|
char outbuf[1024];
|
|||
|
FILE *fp_src;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> ëϷ<C3AB><CFB7> */
|
|||
|
strcpy( filename, NPC_ROOMADMINNEW_DATADIR);
|
|||
|
/*strcat( filename, CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM));*/
|
|||
|
strcat( filename, roomname);
|
|||
|
strcat( filename, NPC_ROOMADMINNEW_EXTENSION);
|
|||
|
|
|||
|
if( flg) {
|
|||
|
/* ڿ<><DABF><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD> ƽ<><C6BD> */
|
|||
|
//getcdkeyFromCharaIndex( pindex, cdkey, sizeof(cdkey ));
|
|||
|
cdkey = CHAR_getChar( pindex, CHAR_CDKEY);
|
|||
|
/* ڿ<><DABF><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ƽ<EFBFBD>ҷ<EFBFBD> */
|
|||
|
makeEscapeString( CHAR_getChar( pindex, CHAR_NAME),
|
|||
|
charaname, sizeof( charaname));
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD> */
|
|||
|
snprintf( expiretime, sizeof( expiretime), "%d",
|
|||
|
CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME)
|
|||
|
+ NPC_ROOMADMINNEW_2WEEK /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
);
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
snprintf( outbuf, sizeof( outbuf), "%s|%s|%s|%s|",
|
|||
|
cdkey, charaname, passwd, expiretime);
|
|||
|
fp_src = fopen( filename, "w");
|
|||
|
if( !fp_src) {
|
|||
|
print( "[%s:%d] File Open Error\n", __FILE__, __LINE__);
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
fputs( outbuf, fp_src);
|
|||
|
fclose( fp_src);
|
|||
|
}
|
|||
|
else {
|
|||
|
unlink( filename);
|
|||
|
}
|
|||
|
|
|||
|
return TRUE;
|
|||
|
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>ë <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_RoomAdminNew_ReadFile( char *roomname, NPC_ROOMINFO *data)
|
|||
|
{
|
|||
|
FILE *fp;
|
|||
|
char line[1024];
|
|||
|
char buf2[128];
|
|||
|
char filename[128];
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> ëϷ<C3AB><CFB7> */
|
|||
|
strcpy( filename, NPC_ROOMADMINNEW_DATADIR);
|
|||
|
strcat( filename, roomname);
|
|||
|
strcat( filename, NPC_ROOMADMINNEW_EXTENSION);
|
|||
|
|
|||
|
fp = fopen( filename, "r");
|
|||
|
if( !fp) return FALSE;
|
|||
|
fgets( line, sizeof( line), fp);
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
getStringFromIndexWithDelim( line, "|" , 1 , buf2,sizeof(buf2) );
|
|||
|
strcpy( data->cdkey, buf2);
|
|||
|
getStringFromIndexWithDelim( line, "|" , 2 , buf2,sizeof(buf2) );
|
|||
|
strcpy( data->charaname, makeStringFromEscaped( buf2));
|
|||
|
getStringFromIndexWithDelim( line, "|" , 3 , buf2,sizeof(buf2) );
|
|||
|
strcpy( data->passwd, buf2);
|
|||
|
getStringFromIndexWithDelim( line, "|" , 4 , buf2,sizeof(buf2) );
|
|||
|
if( strcmp( buf2, "max") == 0 ) {
|
|||
|
data->expire = 0xffffffff;
|
|||
|
}
|
|||
|
else {
|
|||
|
data->expire = atoi( buf2);
|
|||
|
}
|
|||
|
fclose( fp);
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* <EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ屾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*----------------------------------------------*/
|
|||
|
static BOOL NPC_RoomAdminNew_SetNextAuction( int meindex)
|
|||
|
{
|
|||
|
int i, j;
|
|||
|
int hitindex = -1;
|
|||
|
int charnum = CHAR_getCharNum();
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
struct tm tmwk;
|
|||
|
|
|||
|
/* ئ<><D8A6>ë<EFBFBD><C3AB> <20><><EFBFBD><EFBFBD>*/
|
|||
|
memcpy( &tmwk, localtime( ( time_t *)&NowTime.tv_sec), sizeof( tmwk));
|
|||
|
|
|||
|
NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));
|
|||
|
|
|||
|
/* <20><>ʧë<CAA7><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>NPC_DoorSearchByName()ë<><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئԻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD>
|
|||
|
*/
|
|||
|
for( i = CHAR_getPlayerMaxNum()+ CHAR_getPetMaxNum();
|
|||
|
i < charnum;
|
|||
|
i ++ )
|
|||
|
{
|
|||
|
if( CHAR_getInt( i, CHAR_WHICHTYPE) != CHAR_TYPEDOOR) {
|
|||
|
continue;
|
|||
|
}
|
|||
|
if( CHAR_getWorkInt( i, CHAR_WORKDOORPASSFLG) == 0 ) {
|
|||
|
continue;
|
|||
|
}
|
|||
|
/* <><F3A1BBA5>଼<EFBFBD><E0ACBC>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
for( j = 3; ; j ++ ) {
|
|||
|
int rc;
|
|||
|
char *doorname;
|
|||
|
char buf[256];
|
|||
|
int dataexist;
|
|||
|
NPC_ROOMINFO data;
|
|||
|
|
|||
|
rc = getStringFromIndexWithDelim( argstr, "|" , j,
|
|||
|
buf,sizeof(buf) );
|
|||
|
if( rc != TRUE ) {
|
|||
|
break;
|
|||
|
}
|
|||
|
doorname = CHAR_getWorkChar( i, CHAR_WORKDOORNAME);
|
|||
|
/* <20><>ʧ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
if( strcmp( buf, doorname ) != 0 ) {
|
|||
|
continue;
|
|||
|
}
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
if( atoi( CHAR_getWorkChar( i, CHAR_WORKDOORWEEK)) != tmwk.tm_wday) {
|
|||
|
break;
|
|||
|
}
|
|||
|
/* <20><>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
memset( &data, 0, sizeof( data));
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻ᆴ<CCBB>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD>ë <20><> */
|
|||
|
if( NPC_RoomAdminNew_ReadFile( doorname, &data) ) {
|
|||
|
struct tm tmdoor;
|
|||
|
/* <20><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë֧<C3AB>Ȼ<EFBFBD>֧<EFBFBD>£<EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>հ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>ë<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><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( data.expire < NowTime.tv_sec) {
|
|||
|
NPC_RoomAdminNew_WriteDataFile( meindex, -1,doorname, NULL, 0);
|
|||
|
/* <20><>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>ľ<EFBFBD>б<EFBFBD>*/
|
|||
|
NPC_DoorSetPasswd( i, "8hda8iauia90494jasd9asodfasdf89");
|
|||
|
CHAR_setWorkInt( i, CHAR_WORKDOOREXPIRETIME, 0xffffffff);
|
|||
|
|
|||
|
break;
|
|||
|
}
|
|||
|
/* <20><> ƥ<><C6A5>ľ<EFBFBD><C4BE> <20><>ئ<EFBFBD><D8A6> */
|
|||
|
memcpy( &tmdoor, localtime( ( time_t *)&data.expire), sizeof( tmdoor));
|
|||
|
if( tmdoor.tm_mon != tmwk.tm_mon ||
|
|||
|
tmdoor.tm_mday != tmwk.tm_mday)
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
dataexist = TRUE;
|
|||
|
}
|
|||
|
else {
|
|||
|
dataexist = FALSE;
|
|||
|
}
|
|||
|
/* <20>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի ƥؤ<C6A5><D8A4><EFBFBD>ǣ<EFBFBD> */
|
|||
|
if( tmwk.tm_hour > atoi( CHAR_getWorkChar( i, CHAR_WORKDOORHOUR))){
|
|||
|
break;
|
|||
|
}
|
|||
|
if( tmwk.tm_hour == atoi( CHAR_getWorkChar( i, CHAR_WORKDOORHOUR))) {
|
|||
|
if( tmwk.tm_min >= atoi( CHAR_getWorkChar( i, CHAR_WORKDOORMINUTE))) {
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Իؤ<D4BB><D8A4><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>ɡ<EFBFBD><C9A1>
|
|||
|
* ؤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><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( hitindex == -1 ) {
|
|||
|
hitindex = i;
|
|||
|
}
|
|||
|
else {
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEBB><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3>ػ<EFBFBD>ŷԻ<C5B7><D4BB>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD><C6B4><EFBFBD> */
|
|||
|
if( atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORHOUR))
|
|||
|
> atoi( CHAR_getWorkChar( i, CHAR_WORKDOORHOUR)))
|
|||
|
{
|
|||
|
hitindex = i;
|
|||
|
}
|
|||
|
else if( atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORHOUR))
|
|||
|
== atoi( CHAR_getWorkChar( i, CHAR_WORKDOORHOUR)))
|
|||
|
{
|
|||
|
if( atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORMINUTE))
|
|||
|
> atoi( CHAR_getWorkChar( i, CHAR_WORKDOORMINUTE)))
|
|||
|
{
|
|||
|
hitindex = i;
|
|||
|
}
|
|||
|
else if( atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORMINUTE))
|
|||
|
== atoi( CHAR_getWorkChar( i, CHAR_WORKDOORMINUTE)))
|
|||
|
{
|
|||
|
NPC_ROOMINFO datawk;
|
|||
|
int hitindexdataexist;
|
|||
|
hitindexdataexist = NPC_RoomAdminNew_ReadFile(
|
|||
|
CHAR_getWorkChar( hitindex, CHAR_WORKDOORNAME),
|
|||
|
&datawk);
|
|||
|
if( hitindexdataexist < dataexist ) {
|
|||
|
hitindex = i;
|
|||
|
}
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ <20>·<EFBFBD><C2B7><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD>Ƽ<EFBFBD>index<65><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>*/
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if( hitindex > 0 ) {
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
tmwk.tm_sec = 0;
|
|||
|
tmwk.tm_min = atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORMINUTE));
|
|||
|
tmwk.tm_hour = atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORHOUR));
|
|||
|
CHAR_setWorkInt( meindex, CHAR_WORKINT_NEXTTIME, mktime( &tmwk));
|
|||
|
/* <20><> ë<><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_setWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM,
|
|||
|
CHAR_getWorkChar( hitindex, CHAR_WORKDOORNAME));
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
CHAR_setWorkInt( meindex, CHAR_WORKINT_NEXTTIME, 0);
|
|||
|
/* <20><> ë<><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_setWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM,"" );
|
|||
|
|
|||
|
}
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_setWorkInt( meindex, CHAR_WORKINT_SEARCHROOMTIME, NowTime.tv_sec);
|
|||
|
return( TRUE);
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* <EFBFBD>ƾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>л<EFBFBD> <EFBFBD><EFBFBD>ëŷԻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*----------------------------------------------*/
|
|||
|
static void NPC_RoomAdminNew_DspRoomPasswd( int index, int adminindex, int talkerindex)
|
|||
|
{
|
|||
|
int i, rc, flg = FALSE;
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char argstr2[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char *cdkey;
|
|||
|
char buf[128];
|
|||
|
char buff[16];
|
|||
|
char buf2[1024];
|
|||
|
|
|||
|
NPC_ROOMINFO info;
|
|||
|
|
|||
|
//getcdkeyFromCharaIndex( talkerindex, cdkey, sizeof(cdkey));
|
|||
|
cdkey = CHAR_getChar( talkerindex, CHAR_CDKEY);
|
|||
|
|
|||
|
NPC_Util_GetArgStr( adminindex, argstr, sizeof( argstr));
|
|||
|
for( i = 3; ; i ++ ) {
|
|||
|
if( getStringFromIndexWithDelim(argstr, "|" , i , buf,sizeof(buf) )) {
|
|||
|
rc = NPC_RoomAdminNew_ReadFile( buf, &info);
|
|||
|
if( rc == TRUE ) {
|
|||
|
/* CDKEY <20><>ƽ<EFBFBD>ҷ¼<D2B7> <><F3A1BBA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
if( strcmp( info.cdkey, cdkey) == 0 &&
|
|||
|
strcmp( info.charaname,
|
|||
|
CHAR_getChar( talkerindex, CHAR_NAME)) == 0 )
|
|||
|
{
|
|||
|
int doorindex;
|
|||
|
char msgbuf[256];
|
|||
|
/* <20><><EFBFBD><EFBFBD> <20><> */
|
|||
|
doorindex = NPC_DoorSearchByName( buf);
|
|||
|
NPC_Util_GetArgStr( doorindex, argstr2, sizeof( argstr2));
|
|||
|
getStringFromIndexWithDelim( argstr2, "|" , 9 ,
|
|||
|
buf2,sizeof(buf2) );
|
|||
|
/* <20><><EFBFBD><EFBFBD> */
|
|||
|
if( strlen(CHAR_getChar( doorindex, CHAR_NAME) ) != 0 ) {
|
|||
|
strcpy( buff, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
}
|
|||
|
else {
|
|||
|
buff[0] = '\0';
|
|||
|
}
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȿ<EFBFBD><E2B1BE><EFBFBD><EFBFBD> */
|
|||
|
snprintf( msgbuf, sizeof( msgbuf),
|
|||
|
NPC_ROOMADMINNEW_MSG_DSPPASSWD1,
|
|||
|
buf2,
|
|||
|
CHAR_getChar( doorindex, CHAR_NAME),
|
|||
|
buff
|
|||
|
);
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˪<EFBFBD><CBAA> */
|
|||
|
CHAR_talkToCli( talkerindex, index,msgbuf,
|
|||
|
NPC_ROOMADMINNEW_MSGCOLOR);
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȿ<EFBFBD><E2B1BE><EFBFBD><EFBFBD> */
|
|||
|
snprintf( msgbuf, sizeof( msgbuf),
|
|||
|
NPC_ROOMADMINNEW_MSG_DSPPASSWD2,
|
|||
|
CHAR_getWorkChar(doorindex, CHAR_WORKDOORPASSWD)
|
|||
|
);
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˪<EFBFBD><CBAA> */
|
|||
|
CHAR_talkToCli( talkerindex, index,msgbuf,
|
|||
|
NPC_ROOMADMINNEW_MSGCOLOR);
|
|||
|
flg = TRUE;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
if( !flg) {
|
|||
|
CHAR_talkToCli( talkerindex, index,
|
|||
|
NPC_ROOMADMINNEW_MSG_PRINTPASSWD_NONE,
|
|||
|
NPC_ROOMADMINNEW_MSGCOLOR);
|
|||
|
}
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* <EFBFBD>ݼԷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޣ<EFBFBD> <EFBFBD><EFBFBD>ë<EFBFBD>ɵ<EFBFBD>
|
|||
|
*----------------------------------------------*/
|
|||
|
static void NPC_RoomAdminNew_DspNextAuction( int meindex, int talkerindex)
|
|||
|
{
|
|||
|
char msgbuf[2048];
|
|||
|
time_t closetime;
|
|||
|
|
|||
|
closetime = CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME);
|
|||
|
/* <20>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ئ<EFBFBD><D8A6>ľ<EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣۣ<CFA3><DBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
if( closetime == 0 ) {
|
|||
|
snprintf( msgbuf, sizeof( msgbuf),
|
|||
|
NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION_NONE
|
|||
|
);
|
|||
|
CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR);
|
|||
|
}
|
|||
|
else {
|
|||
|
int doorindex;
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
char explain[1024]; /* */
|
|||
|
char buff[16];
|
|||
|
struct tm tmwk;
|
|||
|
int difftime;
|
|||
|
/* <20><><EFBFBD><EFBFBD> ë<><C3AB> */
|
|||
|
doorindex = NPC_DoorSearchByName(
|
|||
|
CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM));
|
|||
|
NPC_Util_GetArgStr( doorindex, argstr, sizeof( argstr));
|
|||
|
getStringFromIndexWithDelim(argstr, "|" , 9 , explain,sizeof(explain));
|
|||
|
/* <20><><EFBFBD><EFBFBD> */
|
|||
|
if( strlen(CHAR_getChar( doorindex, CHAR_NAME) ) != 0 ) {
|
|||
|
strcpy( buff, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
}
|
|||
|
else {
|
|||
|
buff[0] = '\0';
|
|||
|
}
|
|||
|
snprintf( msgbuf, sizeof( msgbuf),
|
|||
|
NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION1,
|
|||
|
explain,
|
|||
|
CHAR_getChar( doorindex, CHAR_NAME),
|
|||
|
buff
|
|||
|
);
|
|||
|
CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR);
|
|||
|
/* <><F3BBBBA7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD> */
|
|||
|
memcpy( &tmwk, localtime( &closetime), sizeof( tmwk));
|
|||
|
difftime = closetime - NowTime.tv_sec;
|
|||
|
snprintf( msgbuf, sizeof( msgbuf),
|
|||
|
NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION2,
|
|||
|
tmwk.tm_hour,
|
|||
|
tmwk.tm_min,
|
|||
|
difftime / 3600,
|
|||
|
(difftime % 3600) / 60
|
|||
|
);
|
|||
|
CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR);
|
|||
|
|
|||
|
/* Ʊ<><C6B1><EFBFBD>ź<EFBFBD> */
|
|||
|
snprintf( msgbuf, sizeof( msgbuf),
|
|||
|
NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION3,
|
|||
|
CHAR_getWorkChar( doorindex, CHAR_WORKDOORGOLDLIMIT)
|
|||
|
);
|
|||
|
CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* ڿ<EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>̤<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <EFBFBD><EFBFBD>"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.score"
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <EFBFBD><EFBFBD>"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.score.tmp"
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɡ<EFBFBD>Ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* gold|time|cdkey|charaname|owntitle
|
|||
|
* ƥ<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* Ի<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾<EFBFBD>߯<EFBFBD>ʣ۷¼<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ئ<EFBFBD><EFBFBD>ľ<EFBFBD>ɨߣ<EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>-1
|
|||
|
*----------------------------------------------*/
|
|||
|
static int NPC_RoomAdminNew_WriteScoreFile( int meindex, int pindex)
|
|||
|
{
|
|||
|
#define NPC_RANKING_DEFAULT 10
|
|||
|
int ret = 0;
|
|||
|
char *cdkey;
|
|||
|
char charaname[32*2],owntitle[32*2];
|
|||
|
char filename_dest[128],filename[128];
|
|||
|
char outbuf[1024], line[1024];
|
|||
|
FILE *fp_src, *fp_dest;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> ëϷ<C3AB><CFB7> */
|
|||
|
strcpy( filename, NPC_ROOMADMINNEW_DATADIR);
|
|||
|
strcat( filename, CHAR_getWorkChar( meindex, CHAR_WORKCHAR_MYNAME));
|
|||
|
strcpy( filename_dest, filename);
|
|||
|
strcat( filename, NPC_ROOMADMINNEW_RANKING_EXTENSION);
|
|||
|
strcat( filename_dest, NPC_ROOMADMINNEW_RANKING_EXTENSION_TMP);
|
|||
|
|
|||
|
/* ڿ<><DABF><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD> ƽ<><C6BD> */
|
|||
|
//getcdkeyFromCharaIndex( pindex , cdkey , sizeof(cdkey ));
|
|||
|
cdkey = CHAR_getChar( pindex, CHAR_CDKEY);
|
|||
|
|
|||
|
/* ڿ<><DABF><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ƽ<EFBFBD>ҷ<EFBFBD> */
|
|||
|
makeEscapeString( CHAR_getChar( pindex, CHAR_NAME),
|
|||
|
charaname, sizeof( charaname));
|
|||
|
|
|||
|
/* ڿ<><DABF><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD>į */
|
|||
|
makeEscapeString( CHAR_getChar( pindex, CHAR_OWNTITLE),
|
|||
|
owntitle, sizeof( owntitle));
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
snprintf( outbuf, sizeof( outbuf), "%d|%d|%s|%s|%s|\n",
|
|||
|
CHAR_getInt( pindex, CHAR_GOLD),
|
|||
|
CHAR_getWorkInt( meindex,CHAR_WORKINT_NEXTTIME),
|
|||
|
cdkey, charaname, owntitle );
|
|||
|
|
|||
|
|
|||
|
fp_dest = fopen( filename_dest, "w");
|
|||
|
if( !fp_dest) return -1;
|
|||
|
|
|||
|
fp_src = fopen( filename, "r");
|
|||
|
if( !fp_src ) {
|
|||
|
/* <20>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD>ئ<EFBFBD><D8A6>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD>л<EFBFBD><D0BB>δ<EFBFBD>Ի */
|
|||
|
fclose( fp_dest);
|
|||
|
fp_src = fopen( filename, "w");
|
|||
|
if( !fp_src) return -1;
|
|||
|
fputs( outbuf, fp_src);
|
|||
|
fclose( fp_src);
|
|||
|
return 1;
|
|||
|
}
|
|||
|
else {
|
|||
|
int cnt = 1;
|
|||
|
char buf[128];
|
|||
|
while( fgets( line, sizeof( line), fp_src)) {
|
|||
|
getStringFromIndexWithDelim( line, "|" , 1 , buf,sizeof(buf) );
|
|||
|
if( ret == 0 ) {
|
|||
|
/* ڿ<>ź<EFBFBD> ʤ */
|
|||
|
if( atoi( buf) < CHAR_getInt( pindex, CHAR_GOLD) ) {
|
|||
|
/* <20>ź<EFBFBD><C5BA><EFBFBD> <20>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD>¼<EFBFBD>ƥ<EFBFBD><C6A5> */
|
|||
|
fputs( outbuf, fp_dest);
|
|||
|
fputs( line, fp_dest);
|
|||
|
ret = cnt;
|
|||
|
cnt ++;
|
|||
|
}
|
|||
|
else {
|
|||
|
/* <20><>ľ<EFBFBD><C4BE>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><CCA4> */
|
|||
|
fputs( line, fp_dest);
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
/* <20><>ľ<EFBFBD><C4BE>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><CCA4> */
|
|||
|
fputs( line, fp_dest);
|
|||
|
}
|
|||
|
cnt ++;
|
|||
|
if( cnt > NPC_RANKING_DEFAULT ) break;
|
|||
|
}
|
|||
|
/* <20>¼<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD>뻥<EFBFBD><EBBBA5><EFBFBD><EFBFBD><EFBFBD>۹<EFBFBD>Ƿ<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ئ<EFBFBD><D8A6><EFBFBD><EFBFBD> */
|
|||
|
if( ret == 0 && cnt <= NPC_RANKING_DEFAULT ) {
|
|||
|
fputs( outbuf, fp_dest);
|
|||
|
ret = cnt;
|
|||
|
}
|
|||
|
}
|
|||
|
fclose( fp_src);
|
|||
|
fclose( fp_dest);
|
|||
|
/* <20><> ľ<><C4BE><EFBFBD><EFBFBD> */
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD>ǩئ ܷ<><DCB7><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>У<EFBFBD> */
|
|||
|
fp_src = fopen( filename_dest, "r");
|
|||
|
if( !fp_src) return -1;
|
|||
|
fp_dest = fopen( filename, "w");
|
|||
|
if( !fp_dest) {
|
|||
|
fclose( fp_src);
|
|||
|
return -1;
|
|||
|
}
|
|||
|
while( fgets( line, sizeof( line), fp_src)) {
|
|||
|
fputs( line, fp_dest);
|
|||
|
}
|
|||
|
fclose( fp_dest);
|
|||
|
fclose( fp_src);
|
|||
|
return( ret);
|
|||
|
#undef NPC_RANKING_DEFAULT
|
|||
|
}
|
|||
|
/*-----------------------------------------------
|
|||
|
* ڿ<EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>ġ<EFBFBD> <EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* ¦<EFBFBD><EFBFBD> meindex ƽ<EFBFBD>ҷ<EFBFBD><EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD>۷¼<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>NPC<EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* talkerindex <EFBFBD>ƾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>index<EFBFBD>۳<EFBFBD>ľ<EFBFBD><EFBFBD>talkë˪<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|||
|
* admname <EFBFBD><EFBFBD> Dz<EFBFBD>н<EFBFBD><EFBFBD>ϼ<EFBFBD> <EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
*----------------------------------------------*/
|
|||
|
static void NPC_RoomAdminNew_ReadScoreFile( int meindex, int talkerindex,
|
|||
|
char *admname)
|
|||
|
{
|
|||
|
int cnt;
|
|||
|
char filename[128];
|
|||
|
char line[1024];
|
|||
|
FILE *fp;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> ëϷ<C3AB><CFB7> */
|
|||
|
strcpy( filename, NPC_ROOMADMINNEW_DATADIR);
|
|||
|
strcat( filename, admname);
|
|||
|
strcat( filename, NPC_ROOMADMINNEW_RANKING_EXTENSION);
|
|||
|
|
|||
|
fp = fopen( filename, "r");
|
|||
|
if( !fp) return;
|
|||
|
cnt = 1;
|
|||
|
while( fgets( line, sizeof( line), fp)) {
|
|||
|
int gold,bidtime;
|
|||
|
char charaname[32],owntitle[32];
|
|||
|
char tmp[64];
|
|||
|
char outbuf[1024], buf[256];
|
|||
|
struct tm tmwk;
|
|||
|
|
|||
|
getStringFromIndexWithDelim( line, "|" , 1 , buf,sizeof(buf) );
|
|||
|
gold = atoi(buf);
|
|||
|
getStringFromIndexWithDelim( line, "|" , 2 , buf,sizeof(buf) );
|
|||
|
bidtime = atoi(buf);
|
|||
|
getStringFromIndexWithDelim( line, "|" , 4 , buf,sizeof(buf) );
|
|||
|
strcpy( charaname, makeStringFromEscaped( buf));
|
|||
|
getStringFromIndexWithDelim( line, "|" , 5 , buf,sizeof(buf) );
|
|||
|
strcpy( owntitle, makeStringFromEscaped( buf));
|
|||
|
if( strlen( owntitle) != 0 ) {
|
|||
|
strcpy( tmp, "[");
|
|||
|
strcat( tmp, owntitle);
|
|||
|
strcat( tmp, "] ");
|
|||
|
strcpy( owntitle, tmp);
|
|||
|
}
|
|||
|
else {
|
|||
|
strcpy( owntitle, " ");
|
|||
|
}
|
|||
|
memcpy( &tmwk, localtime( (time_t *)&bidtime), sizeof( tmwk));
|
|||
|
|
|||
|
snprintf( outbuf, sizeof( outbuf),
|
|||
|
NPC_ROOMADMINNEW_MSG_RANKING,
|
|||
|
cnt,
|
|||
|
tmwk.tm_year + 1900,
|
|||
|
tmwk.tm_mon+1,
|
|||
|
tmwk.tm_mday,
|
|||
|
gold,charaname,owntitle
|
|||
|
);
|
|||
|
CHAR_talkToCli( talkerindex, meindex,outbuf,
|
|||
|
NPC_RANKING_MSGCOLOR);
|
|||
|
cnt ++;
|
|||
|
}
|
|||
|
fclose( fp);
|
|||
|
|
|||
|
}
|
|||
|
/************************************************
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
************************************************/
|
|||
|
BOOL NPC_RankingInit( int meindex )
|
|||
|
{
|
|||
|
char buf[256];
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
|
|||
|
NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
|||
|
/* type<70><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPERANKING);
|
|||
|
/* <20><> <20>м<EFBFBD> <20><><EFBFBD><EFBFBD> */
|
|||
|
if( !getStringFromIndexWithDelim(argstr, "|" , 1 , buf,sizeof(buf) )) {
|
|||
|
print( "arg err.rankingNPC not created.\n");
|
|||
|
return( FALSE);
|
|||
|
}
|
|||
|
CHAR_setWorkChar( meindex , CHAR_WORKCHAR_ADMNAME , buf);
|
|||
|
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
/************************************************
|
|||
|
* <EFBFBD>ƾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
************************************************/
|
|||
|
void NPC_RankingTalked( int meindex , int talkerindex , char *msg ,
|
|||
|
int color )
|
|||
|
{
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧѨ<CAA7><D1A8><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ئ<><D8A6> ɱ<><C9B1><EFBFBD>£<EFBFBD> */
|
|||
|
if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return;
|
|||
|
|
|||
|
CHAR_talkToCli( talkerindex, meindex,
|
|||
|
NPC_ROOMADMINNEW_MSG_RANKING_INFO,
|
|||
|
NPC_RANKING_MSGCOLOR);
|
|||
|
|
|||
|
NPC_RoomAdminNew_ReadScoreFile( meindex, talkerindex,
|
|||
|
CHAR_getWorkChar( meindex, CHAR_WORKCHAR_ADMNAME));
|
|||
|
|
|||
|
}
|
|||
|
/************************************************
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
************************************************/
|
|||
|
BOOL NPC_PrintpassmanInit( int meindex )
|
|||
|
{
|
|||
|
char buf[256];
|
|||
|
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
|
|||
|
|
|||
|
NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
|||
|
/* type<70><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEPRINTPASSMAN);
|
|||
|
/* <20><> <20>м<EFBFBD> <20><><EFBFBD><EFBFBD> */
|
|||
|
if( !getStringFromIndexWithDelim(argstr, "|" , 1 , buf,sizeof(buf) )) {
|
|||
|
print( "arg err.passmanNPC not created.\n");
|
|||
|
return( FALSE);
|
|||
|
}
|
|||
|
CHAR_setWorkChar( meindex , CHAR_WORKCHAR_ADMNAME , buf);
|
|||
|
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
/************************************************
|
|||
|
* <EFBFBD>ƾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
************************************************/
|
|||
|
void NPC_PrintpassmanTalked( int meindex , int talkerindex , char *msg ,
|
|||
|
int color )
|
|||
|
{
|
|||
|
int i;
|
|||
|
int charnum;
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧѨ<CAA7><D1A8><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ئ<><D8A6> ɱ<><C9B1><EFBFBD>£<EFBFBD> */
|
|||
|
if(NPC_Util_CharDistance( talkerindex, meindex ) > 2)return;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD> <20>м<EFBFBD> <20><>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
charnum = CHAR_getCharNum();
|
|||
|
for(i= CHAR_getPlayerMaxNum() +CHAR_getPetMaxNum();
|
|||
|
i<charnum;
|
|||
|
i++){
|
|||
|
|
|||
|
if( CHAR_getCharUse(i) &&
|
|||
|
CHAR_getInt( i ,CHAR_WHICHTYPE) == CHAR_TYPEROOMADMIN ){
|
|||
|
if( strcmp( CHAR_getWorkChar(i,CHAR_WORKCHAR_MYNAME),
|
|||
|
CHAR_getWorkChar( meindex, CHAR_WORKCHAR_ADMNAME))
|
|||
|
==0 )
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if( i < charnum ) {
|
|||
|
NPC_RoomAdminNew_DspRoomPasswd( meindex, i, talkerindex);
|
|||
|
}
|
|||
|
else {
|
|||
|
CHAR_talkToCli( talkerindex, meindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", NPC_RANKING_MSGCOLOR);
|
|||
|
}
|
|||
|
}
|
|||
|
/* end of roomadminnew */
|