chuyiwen_gmsv/npc/npc_manorsman.c

1334 lines
47 KiB
C
Raw Normal View History

2016-12-24 08:45:52 +08:00
#include "version.h"
#include <time.h>
#include "char.h"
#include "object.h"
#include "lssproto_serv.h"
#include "npcutil.h"
#include "handletime.h"
#include "npc_scheduleman.h"
#include "family.h"
#include "npc_manorsman.h"
#include "saacproto_cli.h"
#include "net.h"
#include "configfile.h"
#include "log.h"
/*
* ׯ԰ PK <EFBFBD>Ǽ<EFBFBD>Ա
*
*/
int manorflag[10] = {0,0,0,0,0,0,0,0,0,0};
char manorname[10][32] = {"\O","\O","\O","\O","\O","\O","\O","\O","\O","\O"};
#define MAX_MANORSMAN 22
static int FMPK_ManorsmanList[MAX_MANORSMAN]={
-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,
-1,-1 };
enum {
NPC_WORK_ID = CHAR_NPCWORKINT1, // <20>Ǽ<EFBFBD>Ա ID, <20><> 0 <20><>ʼ
NPC_WORK_MANORID = CHAR_NPCWORKINT2, // ׯ԰<D7AF><D4B0><EFBFBD><EFBFBD>
NPC_WORK_CHALLENGEWAIT = CHAR_NPCWORKINT3, // <20><>ս<EFBFBD>ȴ<EFBFBD>ʱ<EFBFBD><CAB1>
NPC_WORK_PEACEWAIT = CHAR_NPCWORKINT4, // <20><>սʱ<D5BD><CAB1>
NPC_WORK_PREVLOOPTIME = CHAR_NPCWORKINT5, // ǰһ<C7B0>δ<EFBFBD><CEB4><EFBFBD> Loop <20><>ʱ<EFBFBD><CAB1>
#ifdef _NEW_MANOR_LAW
NPC_WORK_BETTLETIME = CHAR_NPCWORKINT6 // <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#endif
};
#define SCHEDULEFILEDIR "./Schedule/"
#ifdef _FIX_FAMILY_PK_LIMIT // WON ADD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սׯ԰<D7AF><D4B0><EFBFBD><EFBFBD>ǰʮ<C7B0><CAAE><EFBFBD><EFBFBD>Ϊǰ<CEAA><C7B0>ʮ<EFBFBD><CAAE>
#define PK_LIMIT 20
#endif
extern struct FM_POINTLIST fmpointlist;
extern void NPC_talkToFloor(int floor, int index1, int index2, char *data);
#ifdef _MANOR_PKRULE
extern struct FMS_DPTOP fmdptop;
#endif
void NPC_ManorLoadPKSchedule(int meindex); // Load schedule from disk
#ifdef _NEW_MANOR_LAW
void SortManorSchedule();
int SortManorScheduleMomentum(const void *indexa, const void *indexb);
extern int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER];
int g_iSortManor;
#endif
int NPC_getManorsmanListIndex( int ID)
{
if( ID < 0 || ID >= MAX_MANORSMAN ){
return FMPK_ManorsmanList[ ID];
}
return -1;
}
BOOL NPC_ManorSmanInit( int meindex )
{
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
int meid;
int a;
CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEMANORSCHEDULEMAN );
// <20><><EFBFBD><EFBFBD>
NPC_Util_GetArgStr(meindex, argstr, sizeof(argstr));
meid = NPC_Util_GetNumFromStrWithDelim(argstr, "id" );
if ((meid<0) || (meid>=MAX_SCHEDULEMAN)) {
print("MANORSMAN init error: invalid ID(%d)\n",meid);
meid=0;
}
CHAR_setWorkInt(meindex, NPC_WORK_ID, meid);
a = NPC_Util_GetNumFromStrWithDelim(argstr, "loop" );
if ((a<100) || (a>10000)) a=1000;
CHAR_setInt(meindex, CHAR_LOOPINTERVAL, a);
a = NPC_Util_GetNumFromStrWithDelim(argstr, "manorid" );
if ((a<1) || (a>/*4*/MANORNUM)) {// CoolFish 2002/2/25
print("MANORSMAN init error: invalid manor id(%d).", a);
a=1;
}
CHAR_setWorkInt(meindex, NPC_WORK_MANORID, a);
a = NPC_Util_GetNumFromStrWithDelim(argstr, "challengewait");
if ((a<1) || (a>259200)) {
print("MANORSMAN init error: invalid challengewait(%d).",a);
a=259200;
}
CHAR_setWorkInt(meindex, NPC_WORK_CHALLENGEWAIT, a);
a = NPC_Util_GetNumFromStrWithDelim(argstr, "peacewait");
if ((a<0) || (a>432000)) {
print("MANORSMAN init error: invalid peacewait(%d).",a);
a=604800;
}
CHAR_setWorkInt(meindex, NPC_WORK_PEACEWAIT, a);
NPC_ManorLoadPKSchedule(meindex);
CHAR_setWorkInt(meindex, NPC_WORK_PREVLOOPTIME, NowTime.tv_sec);
#ifdef _NEW_MANOR_LAW
CHAR_setWorkInt(meindex,NPC_WORK_BETTLETIME,0);
#endif
if( CHAR_getWorkInt( meindex, NPC_WORK_ID) >= 0 &&
CHAR_getWorkInt( meindex, NPC_WORK_ID) <MAX_MANORSMAN ){
FMPK_ManorsmanList[ CHAR_getWorkInt( meindex, NPC_WORK_ID)] = meindex;
}
return TRUE;
}
#ifndef _NEW_MANOR_LAW
void NPC_ManorSmanTalked(int meindex, int talkerindex, char *msg, int color)
{
char buf[4096];
int fd;
int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE;
if (NPC_Util_CharDistance(meindex, talkerindex) > 2) return;
if (!NPC_Util_isFaceToFace(meindex, talkerindex, 2)) return;
fd = getfdFromCharaIndex(talkerindex);
if (fd == -1) return;
switch (fmpks[fmpks_pos+1].flag) {
case FMPKS_FLAG_NONE:
// û<><C3BB>Լ<EFBFBD><D4BC>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>
saacproto_ACFMPointList_send(acfd);
#ifdef _MANOR_PKRULE
sprintf(buf, "ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ʸ<EFBFBD>\n\n"
"һ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD>ׯ԰<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\n"
#ifdef _FIX_FAMILY_PK_LIMIT // WON ADD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սׯ԰<D7AF><D4B0><EFBFBD><EFBFBD>ǰʮ<C7B0><CAAE><EFBFBD><EFBFBD>Ϊǰ<CEAA><C7B0>ʮ<EFBFBD><CAAE>
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>Ϊǰ<EFBFBD><EFBFBD>ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n"
#else
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>Ϊǰʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n"
#endif
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߹<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>賿<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n"
"<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD>");
#else
sprintf(buf, "ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ʸ<EFBFBD>\n\n"
"һ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD>ׯ԰<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n"
"<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD>");
#endif
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_YESNO,
CHAR_WINDOWTYPE_CHECKMAN_START,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
break;
case FMPKS_FLAG_MANOR_PREPARE:
// Ŀǰ<C4BF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>
{
int timeleft=fmpks[fmpks_pos+1].dueltime-NowTime.tv_sec;
int dd,hh,mm;
char buf2[4096];
dd = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 86400;
hh = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 3600 - dd*24;
mm = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 60 - dd*24*60 - hh*60;
memset(buf2,0,sizeof(buf2));
if (dd>0) sprintf(buf, " %d <20><>", dd); else strcpy(buf, "");
strcat(buf2, buf);
if (hh>0) sprintf(buf, " %d Сʱ", hh); else strcpy(buf, "");
strcat(buf2, buf);
if (mm>0) sprintf(buf, " %d <20><><EFBFBD><EFBFBD>", mm); else strcpy(buf, "");
strcat(buf2, buf);
if (strlen(buf2)==0)
sprintf(buf, "ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n<EFBFBD><EFBFBD>%s <20>֣<EFBFBD> %s<><73>\n\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
fmpks[fmpks_pos+1].guest_name,
fmpks[fmpks_pos+1].host_name);
else
sprintf(buf, "ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n<EFBFBD><EFBFBD>%s <20>֣<EFBFBD> %s<><73>\n\n"
"Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s<>ʼ<E1BFAA><CABC>",
fmpks[fmpks_pos+1].guest_name,
fmpks[fmpks_pos+1].host_name,
buf2);
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
}
break;
case FMPKS_FLAG_MANOR_PEACE:
// ս<><D5BD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ƽʱ<C6BD><CAB1>
{
int timeleft=fmpks[fmpks_pos+1].dueltime-NowTime.tv_sec;
int dd,hh,mm;
char buf2[4096];
dd = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 86400;
hh = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 3600 - dd*24;
mm = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 60 - dd*24*60 - hh*60;
strcpy(buf2,"");
if (dd>0) sprintf(buf, " %d <20><>", dd); else strcpy(buf, "");
strcat(buf2, buf);
if (hh>0) sprintf(buf, " %d Сʱ", hh); else strcpy(buf, "");
strcat(buf2, buf);
if (mm>0) sprintf(buf, " %d <20><><EFBFBD><EFBFBD>", mm); else strcpy(buf, "");
strcat(buf2, buf);
if (strlen(buf2)==0)
strcpy(buf, "<EFBFBD><EFBFBD><EFBFBD>Եȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߹ݵı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
else
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սʱ<EFBFBD>ڣ<EFBFBD>Ҫ<EFBFBD>߹ݵĻ<EFBFBD>\n<EFBFBD><EFBFBD>%s<><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",buf2);
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), buf);
}
break;
case FMPKS_FLAG_MANOR_BATTLEBEGIN:
// Ŀǰ<C4BF><C7B0><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD>߹<EFBFBD>
sprintf(buf, "ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n<EFBFBD><EFBFBD>%s <20>֣<EFBFBD> %s<><73>\n\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޡ<EFBFBD>\n<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɡ<EFBFBD>",
fmpks[fmpks_pos+1].guest_name,
fmpks[fmpks_pos+1].host_name);
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
break;
case FMPKS_FLAG_MANOR_OTHERPLANET:
// <20>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>
sprintf(buf, "ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n<EFBFBD><EFBFBD>%s <20>֣<EFBFBD> %s<><73>\n\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD> %s <20><>",
fmpks[fmpks_pos+1].guest_name,
fmpks[fmpks_pos+1].host_name,
fmpks[fmpks_pos+2].host_name);
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
break;
}
}
#else
void NPC_ManorSmanTalked(int meindex, int talkerindex, char *msg, int color)
{
char buf[4096];
int fd;
int fmpks_pos = CHAR_getWorkInt(meindex,NPC_WORK_ID)*MAX_SCHEDULE;
int manorid = CHAR_getWorkInt(meindex,NPC_WORK_MANORID);
if(CHAR_CHECKINDEX(meindex) == FALSE){
printf("\nNPC_ManorSmanTalked error!(meindex:%d)",meindex);
return;
}
if(NPC_Util_CharDistance(meindex,talkerindex) > 2) return;
if(!NPC_Util_isFaceToFace(meindex,talkerindex,2)) return;
fd = getfdFromCharaIndex(talkerindex);
if(fd == -1) return;
if(fmpks[fmpks_pos+1].flag == FMPKS_FLAG_CHALLENGE) fmpks[fmpks_pos+1].flag = FMPKS_FLAG_NONE;
switch(fmpks[fmpks_pos+1].flag){
// <20><>ս<EFBFBD><D5BD> 1800~2200
case FMPKS_FLAG_NONE:
case FMPKS_FLAG_WAIT:
saacproto_ACFMPointList_send(acfd);
sprintf(buf,"ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ʸ<EFBFBD>\n\n"
"һ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>ׯ԰<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լսʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>߻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ʸ<EFBFBD>\n"
"<EFBFBD>ġ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>߻<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD>\n"
"<EFBFBD><EFBFBD> OK <20>ҽ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ񣬰<CAB8> NO <20>ۿ<EFBFBD><DBBF><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>");
lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_YESNO,CHAR_WINDOWTYPE_CHECKMAN_START,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),buf);
if(fmpointlist.fm_momentum[manorid-1] <= -1){
int hadfmindex,index;
char token[256];
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",5,token,sizeof(token));
hadfmindex = atoi(token);
if(hadfmindex != -1){
for(index=0;index<FAMILY_MAXNUM;index++){
// <20>ҳ<EFBFBD><D2B3><EFBFBD>ׯ<EFBFBD><D7AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(fmdptop.fmtopid[index] == (hadfmindex - 1)) break;
}
if(index >= FAMILY_MAXNUM){
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",6,token,sizeof(token));
printf("\nNPC_ManorSmanTalked():save fm_momentum error(%d:%s)",hadfmindex,token);
break;
}
// <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ׯ<EFBFBD><D7AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
else fmpointlist.fm_momentum[manorid-1] = fmdptop.fmMomentum[index];
}
}
SortManorSchedule();
break;
// <20><>ս׼<D5BD><D7BC><EFBFBD><EFBFBD> 2200~ȡ<><C8A1><EFBFBD><EFBFBD>ս<EFBFBD>ʸ<EFBFBD><CAB8>ļ<EFBFBD><C4BC>嵱ʱ<E5B5B1><CAB1>ս<EFBFBD><D5BD>ʱ<EFBFBD><CAB1>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1800~2200 ֮<><D6AE>)
case FMPKS_FLAG_MANOR_PREPARE:
// Ŀǰ<C4BF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>
{
int timeleft = fmpks[fmpks_pos+1].dueltime - NowTime.tv_sec;
int mm,hh,dd;
char buf2[4096];
dd = timeleft / 86400;
hh = timeleft / 3600 - dd * 24;
mm = timeleft / 60 - dd * 24 * 60 - hh * 60;
memset(buf2,0,sizeof(buf2));
if(dd > 0) sprintf(buf," %d <20><>",dd); else strcpy(buf,"");
strcat(buf2,buf);
if(hh > 0) sprintf(buf," %d Сʱ",hh); else strcpy(buf,"");
strcat(buf2,buf);
if(mm > 0) sprintf(buf," %d <20><><EFBFBD><EFBFBD>",mm); else strcpy(buf,"");
strcat(buf2,buf);
if(strlen(buf2) == 0)
sprintf(buf,"ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n<EFBFBD><EFBFBD>%s <20>֣<EFBFBD> %s<><73>\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
fmpks[fmpks_pos+1].guest_name,fmpks[fmpks_pos+1].host_name);
else
sprintf(buf,"ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n<EFBFBD><EFBFBD>%s <20>֣<EFBFBD> %s<><73>\n\nԤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s<>ʼ<E1BFAA><CABC>",
fmpks[fmpks_pos+1].guest_name,fmpks[fmpks_pos+1].host_name,buf2);
lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX),buf);
}
break;
// <20><>ս<EFBFBD>ڼ<EFBFBD>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>
case FMPKS_FLAG_MANOR_PEACE:
case FMPKS_FLAG_MANOR_PEACE_SAVE:
{
int timeleft = fmpks[fmpks_pos+1].dueltime-NowTime.tv_sec;
int dd,hh,mm;
char buf2[4096];
dd = timeleft / 86400;
hh = timeleft / 3600 - dd*24;
mm = timeleft / 60 - dd*24*60 - hh*60;
memset(buf2,0,sizeof(buf2));
if(dd > 0) sprintf(buf," %d <20><>",dd); else strcpy(buf,"");
strcat(buf2,buf);
if(hh > 0) sprintf(buf," %d Сʱ",hh); else strcpy(buf,"");
strcat(buf2,buf);
if(mm > 0) sprintf(buf," %d <20><><EFBFBD><EFBFBD>",mm); else strcpy(buf,"");
strcat(buf2,buf);
if(strlen(buf2) == 0) strcpy(buf, "<EFBFBD><EFBFBD><EFBFBD>Եȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߹ݵı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
else sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><EFBFBD><EFBFBD>սʱ<EFBFBD>ڣ<EFBFBD>Ҫ<EFBFBD><EFBFBD>ս<EFBFBD>Ļ<EFBFBD>\n<EFBFBD><EFBFBD>%s<><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",buf2);
lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),buf);
}
break;
// <20><>ս<EFBFBD><D5BD>
case FMPKS_FLAG_MANOR_BATTLEBEGIN:
sprintf(buf,"ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n<EFBFBD><EFBFBD>%s <20>֣<EFBFBD> %s<><73>\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޡ<EFBFBD>\n<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɡ<EFBFBD>",
fmpks[fmpks_pos+1].guest_name,fmpks[fmpks_pos+1].host_name);
lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),buf);
break;
case FMPKS_FLAG_MANOR_OTHERPLANET:
// <20>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>
sprintf(buf,"ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n<EFBFBD><EFBFBD>%s <20>֣<EFBFBD> %s<><73>\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD> %s <20><>",
fmpks[fmpks_pos+1].guest_name,fmpks[fmpks_pos+1].host_name,fmpks[fmpks_pos+2].host_name);
lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX),buf);
break;
}
}
#endif
void NPC_ManorSmanWindowTalked(int meindex, int talkerindex, int seqno, int select, char *data)
{
int fd, fmpks_pos, manorid, tkfmindex, tkfmdp;
char buf[4096],token[256];
int hadfmindex;
#ifndef _ACFMPK_LIST
char hadfmname[256];
#endif
int hadfmpopular;
if (NPC_Util_CharDistance(meindex,talkerindex) > 2) return;
if (!NPC_Util_isFaceToFace(meindex, talkerindex, 2)) return;
fd = getfdFromCharaIndex(talkerindex);
if (fd == -1) return;
fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE;
manorid = CHAR_getWorkInt(meindex, NPC_WORK_MANORID);
tkfmindex = CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI);
tkfmdp = CHAR_getWorkInt(talkerindex, CHAR_WORKFMDP);
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1], "|", 5, token, sizeof(token));
hadfmindex = atoi(token);
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1], "|", 7, token, sizeof(token));
hadfmpopular = atoi(token);
switch (seqno){
case CHAR_WINDOWTYPE_CHECKMAN_START:
if (select==WINDOW_BUTTONTYPE_YES){
#ifdef _FMVER21
if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==FMMEMBER_LEADER) &&
#else
if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==1) &&
#endif
(CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)==1)){
if (hadfmindex != -1) {
if (hadfmindex-1 != tkfmindex){
int check=0,i;
#ifdef _FM_POINT_PK
if(strcmp(getFmPointPK(),"<EFBFBD><EFBFBD>")){
// Arminius 2.25 fix: fmpks <20>е<EFBFBD> 1~"MANORNUM" <20><>һ<EFBFBD><D2BB>Ҫ<EFBFBD><D2AA> manorsman
for (i=0; i<=/*3*/MANORNUM-1; i++) { // 9<><39>ׯ԰
getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 5, token, sizeof(token));
if (tkfmindex==atoi(token)-1) check=1;
}
}
#else
// Arminius 2.25 fix: fmpks <20>е<EFBFBD> 1~"MANORNUM" <20><>һ<EFBFBD><D2BB>Ҫ<EFBFBD><D2AA> manorsman
for (i=0; i<MANORNUM; i++) { // 9<><39>ׯ԰
getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 5, token, sizeof(token));
if (tkfmindex==atoi(token)-1) check=1;
}
#endif
for (i=1; i<=/*4*/MANORNUM; i++) { // <20>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>ׯ԰
if ((fmpks[i*MAX_SCHEDULE+1].guest_index==tkfmindex) &&
(strcmp(fmpks[i*MAX_SCHEDULE+1].guest_name,
CHAR_getChar(talkerindex, CHAR_FMNAME))==0)
) {
check=2;
}
}
if (check==0){
int won1;
#ifdef _MANOR_PKRULE // WON ADD 2002/01/22
#ifdef _NEW_MANOR_LAW
//-----------------------------------------
int index;
won1 = 1;
for(index=0;index<FAMILY_MAXNUM;index++){
// <20>ҳ<EFBFBD><D2B3><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(fmdptop.fmtopid[index] == tkfmindex) break;
}
if(index >= FAMILY_MAXNUM){
printf("\nNPC_ManorSmanWindowTalked():find tkfmIndex error (%d)",tkfmindex);
}
else
#ifdef _CAX_FM_QISHINUM
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD>ׯ<EFBFBD><D7AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>5<EFBFBD><35>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս
if(fmdptop.fmMomentum[index] < fmpointlist.fm_momentum[manorid-1]*0.5) won1 = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0.5
#else
//<2F><>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>Ϊ 5
if(fmdptop.fmMomentum[index] < 500 ) won1 = 0;
#endif
//-----------------------------------------
#else
//-----------------------------------------
int i;
char won2[256];
won1 = 0;
#ifdef _FIX_FAMILY_PK_LIMIT // WON ADD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սׯ԰<D7AF><D4B0><EFBFBD><EFBFBD>ǰʮ<C7B0><CAAE><EFBFBD><EFBFBD>Ϊǰ<CEAA><C7B0>ʮ<EFBFBD><CAAE>
for(i=0; i< PK_LIMIT; i++){
#else
for(i=0; i<10; i++){
#endif
if( getStringFromIndexWithDelim( fmdptop.topmemo[i], "|", 3, won2, sizeof(won2)) == FALSE ) {
print("err Get fmdptop.topmemo[%d] if FALSE !!\n", i);
break;
}
if( strcmp(CHAR_getChar(talkerindex, CHAR_FMNAME) ,won2) == 0 ){
won1= 1;
break;
}
//-----------------------------------------
}
#endif
if(won1 == 1){
// WON END
#ifdef _NEW_MANOR_LAW
sprintf(buf,"ȷ<EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD>ս<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>֪ʣ<EFBFBD>µ<EFBFBD>ʱ<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ڽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n\n"
"<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
#else
sprintf(buf,"ׯ԰<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>֪ʣ<EFBFBD>µ<EFBFBD>ʱ<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD>ս<EFBFBD>ڼ䲻<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n\n"
"<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
#endif
#else
if(tkfmdp >= hadfmpopular){
sprintf(buf,"ׯ԰<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>֪ʣ<EFBFBD>µ<EFBFBD>ʱ<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD>ս<EFBFBD>ڼ䲻<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n\n"
"<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
#endif
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_YESNO,
CHAR_WINDOWTYPE_CHECKMAN_MAIN,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
}
else{
#ifdef _NEW_MANOR_LAW
#ifdef _CAX_FM_QISHINUM
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><EFBFBD>͡<EFBFBD>");
#else
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 <20><><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><D9BC>͡<EFBFBD>");
#endif
#else
#ifdef _MANOR_PKRULE
#ifdef _FIX_FAMILY_PK_LIMIT // WON ADD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սׯ԰<D7AF><D4B0><EFBFBD><EFBFBD>ǰʮ<C7B0><CAAE><EFBFBD><EFBFBD>Ϊǰ<CEAA><C7B0>ʮ<EFBFBD><CAAE>
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><EFBFBD>͡<EFBFBD>");
#else
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><EFBFBD>͡<EFBFBD>");
#endif
#else
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս\n"
"ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><EFBFBD>͡<EFBFBD>");
#endif
#endif
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
}
}
else if(check == 2){
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD>ѻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>");
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
}
else{
sprintf(buf, "һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>д<EFBFBD>\n"
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У˳<EFBFBD><EFBFBD><EFBFBD>");
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
}
}
else{
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
}
}
else{
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>û<EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD>\n"
"ֱ<EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǩ<EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><EFBFBD>");
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
}
}
else{
sprintf(buf, "ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD>");
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
}
}
#ifdef _NEW_MANOR_LAW
else if(select == WINDOW_BUTTONTYPE_NO){
int i,index,manorindex;
char szMsg[3072];
sprintf(buf," ׯ԰<D7AF><D4B0>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʱ<><CAB1> <20><><EFBFBD><EFBFBD>\n");
manorindex = CHAR_getWorkInt(meindex,NPC_WORK_MANORID) - 1;
// <20>ͳ<EFBFBD><CDB3><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>
for(i=0;i<10;i++){
index = ManorSchedule[manorindex].iSort[i];
if(ManorSchedule[manorindex].iFmIndex[index] != -1){
sprintf(szMsg,"%2d %s\n",i+1,ManorSchedule[manorindex].szMemo[index]);
strcat(buf,szMsg);
}
}
lssproto_WN_send(fd,WINDOW_FMMESSAGETYPE_MANOR_SCHEDULE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX),buf);
}
#endif
break;
case CHAR_WINDOWTYPE_CHECKMAN_MAIN:
if (select==WINDOW_BUTTONTYPE_YES) {
#ifdef _FMVER21
if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==FMMEMBER_LEADER) &&
#else
if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==1) &&
#endif
(CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)==1) &&
(hadfmindex != -1) &&
(hadfmindex - 1 != tkfmindex)
#ifndef _MANOR_PKRULE
&& (tkfmdp >= hadfmpopular)
#endif
){
#ifndef _ACFMPK_LIST
struct tm tm1;
#endif
#ifndef _NEW_MANOR_LAW
#ifdef _MANOR_PKRULE
time_t timep;
struct tm *p;
time(&timep);
p = gmtime(&timep);
if( p->tm_hour+8 > 24)
p->tm_hour = p->tm_hour-16;
else
p->tm_hour = p->tm_hour+8;
#ifdef _YUANGUSA
if(p->tm_hour<18 && p->tm_hour>20){
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6:00<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8:00<30><30><EFBFBD><EFBFBD>Լս<D4BC>ɣ<EFBFBD>");
#else
if(p->tm_hour<18 && p->tm_hour>1){
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6:00<30><30><EFBFBD>賿1:00<30><30><EFBFBD><EFBFBD>Լս<D4BC>ɣ<EFBFBD>");
#endif
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
break;
}
#endif
// WON ADD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pk<70><6B><EFBFBD><EFBFBD>Լս<D4BC><D5BD><EFBFBD><EFBFBD>
if( fmpks[fmpks_pos+1].flag != FMPKS_FLAG_NONE ){
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լս<EFBFBD><EFBFBD><EFBFBD>");
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
return;
}
#endif
if(manorflag[manorid-1]==1){
sprintf(buf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD>[%s]<5D>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>Լս<D4BC><D5BD><EFBFBD>",manorname[manorid-1]);
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
return;
}
#ifdef _ACFMPK_LIST
#ifndef _NEW_MANOR_LAW
NPC_ManorSavePKSchedule(meindex, talkerindex, 0);
sprintf( buf, "ׯ԰<EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD>½ȷ<EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
CHAR_talkToCli( talkerindex, meindex, buf, CHAR_COLORYELLOW);
#else
NPC_ManorAddToSchedule(meindex,talkerindex);
#endif
#else
memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1));
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1], "|", 6, token, sizeof(token));
strcpy(hadfmname, token);
fmpks[fmpks_pos+1].dueltime = CHAR_getWorkInt(meindex, NPC_WORK_CHALLENGEWAIT) + NowTime.tv_sec
- tm1.tm_min*60 + 1800; // Arminius 11.1 <20>ij<EFBFBD>һ<EFBFBD><D2BB> xx:30 <20><><EFBFBD><EFBFBD>
fmpks[fmpks_pos+1].host_index = hadfmindex-1;
strcpy(fmpks[fmpks_pos+1].host_name, hadfmname);
fmpks[fmpks_pos+1].guest_index = tkfmindex;
strcpy(fmpks[fmpks_pos+1].guest_name, CHAR_getChar(talkerindex, CHAR_FMNAME));
fmpks[fmpks_pos+1].prepare_time = 15;
#ifdef _FMWAR_PLAYERNUM
fmpks[fmpks_pos+1].max_player = getFmWarPlayerNum();
#else
fmpks[fmpks_pos+1].max_player = 50;
#endif
fmpks[fmpks_pos+1].win = -1;
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_OTHERPLANET;
strcpy(fmpks[fmpks_pos+2].host_name, getGameserverID());
#ifndef _NEW_MANOR_LAW
NPC_ManorSavePKSchedule(meindex, talkerindex, 0);
sprintf(buf, "ׯ԰<EFBFBD><EFBFBD>ս<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_OK,
CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
buf);
#else
NPC_ManorAddToSchedule(meindex,talkerindex);
#endif
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_PREPARE;
#endif
}
}
break;
}
}
void NPC_CleanPkList( int ti)
{
// Terry fix Ҫ<><D2AA>Ϊ-1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
/* fmpks[ ti+1 ].host_index = 0;
fmpks[ ti+1].guest_index=0;
fmpks[ ti].host_index=0;
fmpks[ ti].guest_index=0;*/
fmpks[ ti+1 ].host_index = -1;
fmpks[ ti+1].guest_index=-1;
fmpks[ ti].host_index=-1;
fmpks[ ti].guest_index=-1;
strcpy(fmpks[ ti+1].host_name,"");
strcpy(fmpks[ ti+1].guest_name,"");
strcpy(fmpks[ ti].host_name,"");
strcpy(fmpks[ ti].guest_name,"");
strcpy(fmpks[ ti+2].host_name,"");
}
void NPC_ManorSmanLoop(int meindex)
{
struct tm tm1;
int fmpks_pos;
#ifdef _NEW_MANOR_LAW
int iOffsetTime;
#endif
if(CHAR_CHECKINDEX(meindex) == FALSE){
printf("\nNPC_ManorSmanLoop error!(meindex:%d)",meindex);
return;
}
fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE;
memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1));
switch (fmpks[fmpks_pos+1].flag) {
case FMPKS_FLAG_NONE:
#ifdef _NEW_MANOR_LAW
{
int hadfmindex,index,manorid;
char token[256];
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD>Կ<EFBFBD>ʼ<EFBFBD><CABC>ս
manorid = CHAR_getWorkInt(meindex,NPC_WORK_MANORID);
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",5,token,sizeof(token));
hadfmindex = atoi(token);
if(hadfmindex != -1){
for(index=0;index<FAMILY_MAXNUM;index++){
// <20>ҳ<EFBFBD><D2B3><EFBFBD>ׯ<EFBFBD><D7AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(fmdptop.fmtopid[index] == (hadfmindex - 1)) break;
}
if(index >= FAMILY_MAXNUM){
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",6,token,sizeof(token));
//printf("\nNPC_ManorSmanLoop():save fm_momentum error(%d:%s)",hadfmindex,token);
break;
}
// <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ׯ<EFBFBD><D7AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
else fmpointlist.fm_momentum[manorid-1] = fmdptop.fmMomentum[index];
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>״̬
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_WAIT;
// <20><>ս<EFBFBD>ڹ<EFBFBD>4Сʱ(1800~2200)
fmpks[fmpks_pos+1].dueltime = NowTime.tv_sec + 3600 * 4;
NPC_ManorSavePKSchedule(meindex, -1, FMPKS_FLAG_WAIT,fmpks[fmpks_pos+1].dueltime,tm1);
}
SortManorSchedule();
}
#endif
break;
#ifdef _NEW_MANOR_LAW
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>,<2C>Ѽ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>ȴ<EFBFBD><C8B4><EFBFBD>ս<EFBFBD>ų<EFBFBD>
case FMPKS_FLAG_WAIT:
{
int manorid,i,iPlayerNum = CHAR_getPlayerMaxNum();
char szMsg[256];
manorid = CHAR_getWorkInt(meindex,NPC_WORK_MANORID);
if(manorflag[manorid-1] == 1){
break;
}
// <20><>û<EFBFBD><C3BB><EFBFBD><EFBFBD>,<2C><><EFBFBD>Ƹı<C6B8>Ҫȥ<D2AA><C8A5>ACҪ<43><D2AA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
//fmpointlist.fm_inwar[manorid-1] = TRUE;
fmpointlist.fm_inwar[manorid-1] = FALSE; //<2F><><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD>ACҪ<43><D2AA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
if(fmpks[fmpks_pos+1].dueltime <= NowTime.tv_sec){
// <20><>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵĻ<DFB5><C4BB><EFBFBD><EFBFBD><EFBFBD>սȨ
int manorindex = CHAR_getWorkInt(meindex,NPC_WORK_MANORID) - 1;
int iNo1FmIndexSort = ManorSchedule[manorindex].iSort[0];
if(ManorSchedule[manorindex].iFmIndex[iNo1FmIndexSort]>=0){
for (i=1; i<=/*4*/MANORNUM; i++) { // <20>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>ׯ԰
if ((fmpks[i*MAX_SCHEDULE+1].guest_index==ManorSchedule[manorindex].iFmIndex[iNo1FmIndexSort]) &&
(strcmp(fmpks[i*MAX_SCHEDULE+1].guest_name,
ManorSchedule[manorindex].szFmName[iNo1FmIndexSort])==0)
) {
ManorSchedule[manorindex].iSort[0] = ManorSchedule[manorindex].iSort[1];
//ManorSchedule[manorindex].iFmIndex[iNo1FmIndexSort] = ManorSchedule[manorindex].iFmIndex[iNo2FmIndexSort];
iNo1FmIndexSort = ManorSchedule[manorindex].iSort[0];
}
}
}
int index = ManorSchedule[manorindex].iFmIndex[iNo1FmIndexSort],iFmIndex1,iCharindex;
//Logfmpk_war(iNo1FmIndexSort,manorindex,index);
char token[256],fmname[256];
// û<><C3BB><EFBFBD><EFBFBD>ս
if(index < 0){
// ֱ<>ӽ<EFBFBD><D3BD><EFBFBD><EBB5BD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_BATTLEEND;
CHAR_setWorkInt(meindex,NPC_WORK_BETTLETIME,tm1.tm_mday);
// ֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for(i=0;i<iPlayerNum;i++){
if(CHAR_getCharUse(i) != FALSE){
CHAR_talkToCli(i,-1,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սׯ԰<EFBFBD><EFBFBD>ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սʱ<EFBFBD><EFBFBD>",CHAR_COLORBLUE2);
}
}
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",5,token,sizeof(token));
iFmIndex1 = atoi(token) - 1;
if(iFmIndex1 != -1){
getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",6,fmname,sizeof(token));
saacproto_ACFixFMPoint_send(acfd,fmname,iFmIndex1 + 1,iFmIndex1,
fmname,iFmIndex1 + 1,iFmIndex1,CHAR_getWorkInt(meindex,NPC_WORK_ID));
// <20><><EFBFBD><EFBFBD>ׯ԰սʤ<D5BD><CAA4>Log
sprintf(token," (%d:%d) %d/%d/%d",tm1.tm_hour,tm1.tm_min,tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday);
Logfmpk(fmname,iFmIndex1,-1,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս",-1,-1,token,"","",2);
// ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ס<EFBFBD><D7A1>ׯ԰,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>ɵõ<C9B5>ʯ<EFBFBD><CAAF>
for(i=0;i<FAMILY_MAXMEMBER;i++){
iCharindex = familyMemberIndex[iFmIndex1][i];
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲŸ<CFB2>Ǯ
if(iCharindex >= 0 && CHAR_getCharUse(iCharindex)){
// <20><><EFBFBD>ý<EFBFBD>Ǯ = <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * 5000
int iAddGold = ((float)CHAR_getInt(iCharindex,CHAR_MOMENTUM)/100.0f) * 5000.0f;
int iGold = CHAR_getInt(iCharindex,CHAR_BANKGOLD),iMaxGold;
// <20>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(iGold + iAddGold > CHAR_MAXBANKGOLDHAVE){
CHAR_setInt(iCharindex,CHAR_BANKGOLD,CHAR_MAXBANKGOLDHAVE);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>зŲ<D0B7><C5B2><EFBFBD><EFBFBD><EFBFBD>,<2C>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
iAddGold = iGold + iAddGold - CHAR_MAXBANKGOLDHAVE;
iGold = CHAR_getInt(iCharindex,CHAR_GOLD);
iMaxGold = CHAR_getMaxHaveGold(iCharindex);
if(iGold + iAddGold > iMaxGold) CHAR_setInt(iCharindex,CHAR_GOLD,iMaxGold);
else CHAR_setInt(iCharindex,CHAR_GOLD,iGold + iAddGold);
LogFMPKGetMomey(CHAR_getChar(iCharindex,CHAR_FMNAME),
CHAR_getChar(iCharindex,CHAR_CDKEY),
CHAR_getChar(iCharindex,CHAR_NAME),
CHAR_getInt(iCharindex,CHAR_MOMENTUM),iAddGold,0);
}
else{
CHAR_setInt(iCharindex,CHAR_BANKGOLD,iGold + iAddGold);
LogFMPKGetMomey(CHAR_getChar(iCharindex,CHAR_FMNAME),
CHAR_getChar(iCharindex,CHAR_CDKEY),
CHAR_getChar(iCharindex,CHAR_NAME),
CHAR_getInt(iCharindex,CHAR_MOMENTUM),iAddGold,1);
}
CHAR_talkToCli(iCharindex,-1,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!<21>ػ<EFBFBD>סׯ԰<D7AF>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD>ѻ<EFBFBD><D1BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",CHAR_COLORRED);
// <20><><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
CHAR_setInt(iCharindex,CHAR_MOMENTUM,0);
CHAR_talkToCli(iCharindex,-1,"ׯ԰ս<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD><EFBFBD><EFBFBD>",CHAR_COLORRED);
}
}
}
}
else{
// <20><>սʱ<D5BD><CAB1><EFBFBD>ѹ<EFBFBD>,ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ<EFBFBD><D7AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լһ<D4BC><D2BB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><D7BC>
NPC_ManorSavePKSchedule(meindex,index,0,-1,ManorSchedule[manorindex].tm1[iNo1FmIndexSort]);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>Ƹı<C6B8>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>ACҪ<43><D2AA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fmpointlist.fm_inwar[manorid-1] = FALSE;
// ֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sprintf(szMsg,"%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սׯ԰<D7AF>ʸ<EFBFBD>",ManorSchedule[manorindex].szFmName[iNo1FmIndexSort]);
for(i=0;i<iPlayerNum;i++){
if(CHAR_getCharUse(i) != FALSE){
CHAR_talkToCli(i,-1,szMsg,CHAR_COLORBLUE2);
}
}
}
}else{
Logfmpk_war(fmpks[fmpks_pos+1].dueltime,NowTime.tv_sec);
}
}
break;
#endif
case FMPKS_FLAG_MANOR_PREPARE:
if(fmpks[fmpks_pos+1].dueltime <= NowTime.tv_sec){
memcpy(&fmpks[fmpks_pos], &fmpks[fmpks_pos+1], sizeof(FamilyPKSchedule));
fmpks[fmpks_pos].dueltime = tm1.tm_hour * 100 + tm1.tm_min;
fmpks[fmpks_pos].flag = FMPKS_FLAG_SCHEDULED;
fmpks[fmpks_pos+1].dueltime = 0;
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_BATTLEBEGIN;
NPC_talkToFloor(CHAR_getInt(meindex, CHAR_FLOOR) , fmpks[fmpks_pos].host_index,
fmpks[fmpks_pos].guest_index, "ׯ԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
#ifdef _NEW_MANOR_LAW
CHAR_setWorkInt(meindex,NPC_WORK_BETTLETIME,tm1.tm_mday);
#endif
}
break;
case FMPKS_FLAG_MANOR_PEACE:
if(manorflag[CHAR_getWorkInt(meindex,NPC_WORK_MANORID)-1]==1)
break;
saacproto_ACFmPkOnlineSn_send(acfd,CHAR_getWorkInt(meindex,NPC_WORK_MANORID)-1,0);
if (fmpks[fmpks_pos+1].dueltime <= NowTime.tv_sec) {
fmpks[fmpks_pos+1].dueltime = 0;
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_NONE;
#ifndef _NEW_MANOR_LAW
NPC_ManorSavePKSchedule(meindex, -1, FMPKS_FLAG_NONE);
#else
NPC_ManorSavePKSchedule(meindex, -1, FMPKS_FLAG_NONE,fmpks[fmpks_pos+1].dueltime,tm1);
#endif
}
break;
case FMPKS_FLAG_MANOR_BATTLEBEGIN:
break;
case FMPKS_FLAG_MANOR_BATTLEEND:
{
#ifdef _NEW_MANOR_LAW
int manorindex = CHAR_getWorkInt(meindex,NPC_WORK_MANORID) - 1;
#endif
saacproto_ACFmPkOnlineSn_send(acfd,manorindex,0);
fmpks[fmpks_pos].flag = FMPKS_FLAG_NONE;
#ifndef _NEW_MANOR_LAW
fmpks[fmpks_pos+1].dueltime = CHAR_getWorkInt(meindex, NPC_WORK_PEACEWAIT) + NowTime.tv_sec;
#else
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ٹ<EFBFBD><D9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ںͽ<DABA><CDBD><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD>򳬹<EFBFBD><F2B3ACB9><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
if(CHAR_getWorkInt(meindex,NPC_WORK_BETTLETIME) != tm1.tm_mday){
iOffsetTime = tm1.tm_hour * 3600 * -1; // <20>ۻ<EFBFBD>00:00
}
else{ // ս<><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱδ<CAB1><CEB4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
iOffsetTime = (24 - tm1.tm_hour) * 3600; // <20><><EFBFBD><EFBFBD>00:00
}
//#ifdef _75_TEST
//fmpks[fmpks_pos+1].dueltime = NowTime.tv_sec - tm1.tm_min*60 + iOffsetTime + 172800 + (20 * 3600); // <20><><EFBFBD><EFBFBD>
fmpks[fmpks_pos+1].dueltime = NowTime.tv_sec - tm1.tm_min*60 + iOffsetTime + CHAR_getWorkInt(meindex, NPC_WORK_PEACEWAIT) + (18 * 3600);
//#else
// fmpks[fmpks_pos+1].dueltime = NowTime.tv_sec - tm1.tm_min*60 + iOffsetTime + 432000 + (20 * 3600);
// |-----------ȡ<><C8A1><EFBFBD><EFBFBD>------------| |-<2D><><EFBFBD><EFBFBD>00:00-| |-<2D><><EFBFBD><EFBFBD>-| |20:00<30><30>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>|
//#endif
#endif
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_PEACE_SAVE;
NPC_CleanPkList( fmpks_pos);
#ifndef _NEW_MANOR_LAW
NPC_ManorSavePKSchedule(meindex, -1, FMPKS_FLAG_MANOR_PEACE_SAVE);
#else
NPC_ManorSavePKSchedule(meindex, -1, FMPKS_FLAG_MANOR_PEACE_SAVE,fmpks[fmpks_pos+1].dueltime,tm1);
// <20><><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD>
memset(&ManorSchedule[manorindex],0,sizeof(ManorSchedule[manorindex]));
{
int i;
for(i=0;i<10;i++) ManorSchedule[manorindex].iSort[i] = ManorSchedule[manorindex].iFmIndex[i] = -1;
for(i=0;i<FAMILY_MAXHOME;i++) fmpointlist.fm_momentum[i] = -1;
}
}
#endif
break;
case FMPKS_FLAG_MANOR_PEACE_SAVE:
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_PEACE;
break;
case FMPKS_FLAG_MANOR_OTHERPLANET:
break;
case FMPKS_FLAG_MANOR_READYTOFIGHT:
case FMPKS_FLAG_MANOR_CLEANFLAG:
if(manorflag[CHAR_getWorkInt(meindex,NPC_WORK_MANORID)-1]==1)
break;
saacproto_ACFmPkOnlineSn_send(acfd,CHAR_getWorkInt(meindex,NPC_WORK_MANORID)-1,0);
fmpks[fmpks_pos].flag = FMPKS_FLAG_NONE;
fmpks[fmpks_pos+1].dueltime = CHAR_getWorkInt(meindex, NPC_WORK_PEACEWAIT) + NowTime.tv_sec;
fmpks[fmpks_pos+1].flag = FMPKS_FLAG_NONE;
NPC_CleanPkList( fmpks_pos);
#ifndef _NEW_MANOR_LAW
NPC_ManorSavePKSchedule(meindex, -1, FMPKS_FLAG_NONE);
#else
NPC_ManorSavePKSchedule(meindex, -1, FMPKS_FLAG_NONE,fmpks[fmpks_pos+1].dueltime,tm1);
#endif
break;
}
CHAR_setWorkInt(meindex, NPC_WORK_PREVLOOPTIME, NowTime.tv_sec);
}
void NPC_ManorLoadPKSchedule(int meindex)
{
#ifdef _ACFMPK_LIST
int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID);
saacproto_ACLoadFmPk_send(acfd, fmpks_pos);
#else
char filename[256], tmp[4096], token[256];
FILE *f;
int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE;
snprintf(filename,sizeof(filename), "%s%d_%d_%d",
SCHEDULEFILEDIR, CHAR_getInt(meindex, CHAR_FLOOR),
CHAR_getInt(meindex, CHAR_X),
CHAR_getInt(meindex, CHAR_Y) );
if( ! (f=fopen( filename, "r" )) ){ // create new schedule file
f = fopen( filename, "w" );
if( !f ){
print( "ERROR:Can't create Schedule file %s!\n",filename );
return;
}
strcpy(tmp,"0|-1|-1|-1|-1|-1|-1|-1|-1\n");
fwrite(tmp, strlen(tmp), 1, f);
}
fseek(f, 0, SEEK_SET); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
fgets(tmp, sizeof(tmp), f);
fmpks[fmpks_pos].flag=-1;
// ʱ<><CAB1>
if (getStringFromIndexWithDelim(tmp,"|",1,token,sizeof(token))) {
fmpks[fmpks_pos+1].dueltime=atoi(token);
}
// <20><><EFBFBD><EFBFBD> familyindex
if (getStringFromIndexWithDelim(tmp,"|",2,token,sizeof(token))) {
fmpks[fmpks_pos+1].host_index=atoi(token);
}
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (getStringFromIndexWithDelim(tmp,"|",3,token,sizeof(token))) {
strcpy(fmpks[fmpks_pos+1].host_name,makeStringFromEscaped(token));
}
// <20>Ͷ<EFBFBD> familyindex
if (getStringFromIndexWithDelim(tmp,"|",4,token,sizeof(token))) {
fmpks[fmpks_pos+1].guest_index=atoi(token);
}
// <20>Ͷ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (getStringFromIndexWithDelim(tmp,"|",5,token,sizeof(token))) {
strcpy(fmpks[fmpks_pos+1].guest_name,makeStringFromEscaped(token));
}
// ׼<><D7BC>ʱ<EFBFBD><CAB1>
if (getStringFromIndexWithDelim(tmp,"|",6,token,sizeof(token))) {
fmpks[fmpks_pos+1].prepare_time=atoi(token);
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (getStringFromIndexWithDelim(tmp,"|",7,token,sizeof(token))) {
fmpks[fmpks_pos+1].max_player=atoi(token);
}
// <20><><EFBFBD><EFBFBD>
if (getStringFromIndexWithDelim(tmp,"|",8,token,sizeof(token))) {
fmpks[fmpks_pos+1].flag=atoi(token);
}
// <20><>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>
if (getStringFromIndexWithDelim(tmp,"|",9,token,sizeof(token))) {
strcpy(fmpks[fmpks_pos+2].host_name,makeStringFromEscaped(token));
}
// no schedule
fmpks[fmpks_pos].flag=-1;
// prepare time expired?
if ((fmpks[fmpks_pos+1].flag==FMPKS_FLAG_MANOR_PREPARE) &&
(fmpks[fmpks_pos+1].dueltime<NowTime.tv_sec)) {
fmpks[fmpks_pos].flag=-1;
// Terry fix Ҫ<><D2AA>Ϊ-1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
// fmpks[fmpks_pos].host_index=0;
fmpks[fmpks_pos].host_index=-1;
strcpy(fmpks[fmpks_pos].host_name,"");
// Terry fix Ҫ<><D2AA>Ϊ-1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
// fmpks[fmpks_pos].guest_index=0;
fmpks[fmpks_pos].guest_index=-1;
strcpy(fmpks[fmpks_pos].guest_name,"");
fmpks[fmpks_pos+1].flag=-1;
fmpks[fmpks_pos+1].dueltime=0;
// fmpks[fmpks_pos+1].dueltime=NowTime.tv_sec+30*60; // add more 30 minutes
}
fclose(f);
#endif // end AC_SEND_FM_PK
}
#ifdef _ACFMPK_LIST
#ifndef _NEW_MANOR_LAW
void NPC_ManorSavePKSchedule(int meindex, int toindex, int flg)
#else
void NPC_ManorSavePKSchedule(int meindex, int toindex, int flg,int setTime,struct tm tm2)
#endif
{
int fmpks_pos, manorid, dueltime;
char msg[1024], n1[256], n2[256], n3[256];
char token[256], hadfmname[256];
int hadfmindex=0, hadfmpopular=0, tkfmindex=0;
int PkFlg=0;
if( toindex == -1 ){
#ifndef _NEW_MANOR_LAW
dueltime = CHAR_getWorkInt(meindex, NPC_WORK_PEACEWAIT) + NowTime.tv_sec;
sprintf(msg, "%d|%d|%s|%d|%s|%d|%d|%d|%s",
dueltime, 0, "", 0, "", 0, 0, flg, "");
#else
sprintf(msg, "%d|%d|%s|%d|%s|%d|%d|%d|%s",
setTime, 0, "", 0, "", 0, 0, flg, "");
#endif
PkFlg = 0;
}else{
struct tm tm1;
int index;
#ifndef _NEW_MANOR_LAW
tkfmindex = CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI);
#else
// toindex <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>index
tkfmindex = toindex;
#endif
fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID) * MAX_SCHEDULE;
manorid = CHAR_getWorkInt(meindex, NPC_WORK_MANORID);
memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1));
#ifndef _NEW_MANOR_LAW
dueltime = CHAR_getWorkInt(meindex, NPC_WORK_CHALLENGEWAIT) + NowTime.tv_sec - tm1.tm_min*60 + 1800;
#else
// <20><><EFBFBD><EFBFBD>սʱ<D5BD><CAB1>ʱ<EFBFBD><CAB1>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>,<2C>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>Ϊ׼<CEAA><D7BC>ʱ<EFBFBD><CAB1>
dueltime = NowTime.tv_sec - tm1.tm_min * 60 + ((24 - tm1.tm_hour) * 3600) + 3600 * tm2.tm_hour;
// |-------------ȡ<><C8A1><EFBFBD><EFBFBD>-------------| |--------<2D>ӵ<EFBFBD>0000ʱ-------| |<7C><>սʱ<D5BD><CAB1>ʱ<EFBFBD><CAB1>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)|
#endif
//print("\ndueltime=%d",dueltime);
int i;
for (i=1; i<=/*4*/MANORNUM; i++) { // ʱ<><CAB1><EFBFBD>ظ<EFBFBD><D8B8>Ƴ<EFBFBD>3600
if(CHAR_getWorkInt( meindex, NPC_WORK_ID)==i) continue;
if(strlen(fmpks[i*MAX_SCHEDULE+1].guest_name)<=0) continue;
//time_t timep = (time_t *)fmpks[i*MAX_SCHEDULE+1].dueltime;
//long pktimetmp = fmpks[i*MAX_SCHEDULE+1].dueltime;
struct tm p1;
struct tm p2;
memcpy(&p1, localtime((time_t *)&fmpks[i*MAX_SCHEDULE+1].dueltime), sizeof(p1));
memcpy(&p2, localtime((time_t *)&dueltime), sizeof(p2));
//p=localtime(&pktimetmp);
//int dueltimetmp = NowTime.tv_sec - tm1.tm_min * 60 + ((24 - tm1.tm_hour) * 3600) + 3600 * p->tm_hour;
// if (dueltimetmp==dueltime && tm2.tm_hour<22)
// {
// dueltime = dueltime + 3600;
// }
if(p2.tm_hour<23 && p2.tm_hour>19 && p1.tm_mon == p2.tm_mon && p1.tm_mday == p2.tm_mday && p1.tm_hour == p2.tm_hour)
{
if(p2.tm_hour==20){
int tmpnum = RAND(1,100);
if(tmpnum<=33)
dueltime = dueltime + 1800;
else if(tmpnum<=66)
dueltime = dueltime + 3600;
else
dueltime = dueltime + 5400;
}else if(p2.tm_hour==21){
int tmpnum = RAND(1,100);
if(tmpnum<=25)
dueltime = dueltime + 1800;
else if(tmpnum<=50)
dueltime = dueltime + 3600;
else if(tmpnum<=75)
dueltime = dueltime + 5400;
else
dueltime = dueltime - 1800;
}else if(p2.tm_hour==22){
int tmpnum = RAND(1,100);
if(tmpnum<=50)
dueltime = dueltime - 1800;
else
dueltime = dueltime + 1800;
}
}
if(p2.tm_hour>17 && p2.tm_hour<20 ){
dueltime = dueltime + 3600*(20-p2.tm_hour);
}
}
getStringFromIndexWithDelim( fmpointlist.pointlistarray[manorid-1], "|", 5, token, sizeof(token));
hadfmindex = atoi( token);
getStringFromIndexWithDelim( fmpointlist.pointlistarray[manorid-1], "|", 7, token, sizeof(token));
hadfmpopular = atoi( token);
getStringFromIndexWithDelim( fmpointlist.pointlistarray[manorid-1], "|", 6, token, sizeof(token));
strcpy( hadfmname, token);
makeEscapeString( hadfmname, n1, sizeof(n1));
#ifndef _NEW_MANOR_LAW
makeEscapeString( CHAR_getChar(toindex, CHAR_FMNAME), n2, sizeof(n2));
#else
// <20>ҳ<EFBFBD><D2B3><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
index = ManorSchedule[manorid-1].iSort[0];
makeEscapeString(ManorSchedule[manorid-1].szFmName[index],n2,sizeof(n2));
#endif
makeEscapeString( getGameserverID(), n3, sizeof(n3));
sprintf(msg, "%d|%d|%s|%d|%s|%d|%d|%d|%s",
dueltime, hadfmindex-1, n1, tkfmindex, n2, 15, 50, FMPKS_FLAG_MANOR_OTHERPLANET, n3);
PkFlg = 1;
{
char buf1[256];
sprintf( buf1,"%d", CHAR_getWorkInt( meindex, NPC_WORK_ID) );
Logfmpk(
n1, hadfmindex-1, 0,
n2, tkfmindex, 0,
"", buf1, n3, 1);
}
}
#ifndef _NEW_MANOR_LAW
saacproto_ACSendFmPk_send( acfd, toindex, PkFlg, CHAR_getWorkInt( meindex, NPC_WORK_ID), msg);
#else
// toindex <20>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>Ϊ -1
saacproto_ACSendFmPk_send( acfd, -1, PkFlg, CHAR_getWorkInt( meindex, NPC_WORK_ID), msg);
#endif
}
#endif
#ifdef _NEW_MANOR_LAW
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ų<EFBFBD>
void NPC_ManorAddToSchedule(int meindex,int charaindex)
{
int i,j,iEmpty = -1,iFmIndex,manorindex = CHAR_getWorkInt(meindex,NPC_WORK_MANORID) - 1;
struct tm tm1;
iFmIndex = CHAR_getWorkInt(charaindex,CHAR_WORKFMINDEXI);
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ׯ԰Լս
for(j=0;j<MANORNUM;j++){
for(i=0;i<10;i++){
if(ManorSchedule[j].iFmIndex[i] != -1){
if(ManorSchedule[j].iFmIndex[i] == iFmIndex){
lssproto_WN_send(getfdFromCharaIndex(charaindex),WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),"<EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սׯ԰<EFBFBD><EFBFBD><EFBFBD>");
return;
}
}
else{
if(j == manorindex) iEmpty = i; // <20><>¼<EFBFBD>յ<EFBFBD>λ<EFBFBD><CEBB>
}
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽִ<CABD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>,<2C><>ʾû<CABE>м<EFBFBD><D0BC><EFBFBD><EFBFBD>ų<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>пյ<D0BF>λ<EFBFBD><CEBB>
if(iEmpty != -1){ // <20>п<EFBFBD>λ<EFBFBD><CEBB>,<2C>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD>߼<EFBFBD><DFBC><EFBFBD>
// <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ManorSchedule[manorindex].iFmIndex[iEmpty] = iFmIndex;
// <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sprintf(ManorSchedule[manorindex].szFmName[iEmpty],"%s",CHAR_getChar(charaindex,CHAR_FMNAME));
// <20><>¼<EFBFBD><C2BC>սʱ<D5BD><CAB1>
memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1));
memset(ManorSchedule[manorindex].szMemo[iEmpty],0,sizeof(ManorSchedule[manorindex].szMemo[iEmpty]));
memcpy(&ManorSchedule[manorindex].tm1[iEmpty],&tm1,sizeof(tm1));
lssproto_WN_send(getfdFromCharaIndex(charaindex),WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ų<EFBFBD>");
}
// <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ս<EFBFBD>ų̵<C5B3><CCB5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>,<2C><EFBFBD><E6BBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>,<2C><><EFBFBD><EFBFBD>֪ͨĿǰ<C4BF><C7B0><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD>
else{
// ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ManorSchedule<6C><65>λ<EFBFBD><CEBB>
int index = ManorSchedule[manorindex].iSort[9];
for(i=0;i<FAMILY_MAXNUM;i++){
// <20>ҳ<EFBFBD><D2B3><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(fmdptop.fmtopid[i] == iFmIndex) break;
}
// <20>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD>
if(i >= FAMILY_MAXNUM){
lssproto_WN_send(getfdFromCharaIndex(charaindex),WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),"<EFBFBD><EFBFBD>Ǹ<EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
return;
}
// <20>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>
if(ManorSchedule[manorindex].iFmMomentum[index] < fmdptop.fmMomentum[i]){
int fmpks_pos,iPlayerNum = CHAR_getPlayerMaxNum();
char szMsg[256];
// ֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fmpks_pos = CHAR_getWorkInt(meindex,NPC_WORK_ID) * MAX_SCHEDULE;
sprintf(szMsg,"%s <20><><EFBFBD>屻 %s <20><><EFBFBD><EFBFBD><E5BCB7><EFBFBD><EFBFBD>ս<EFBFBD>ų<EFBFBD>",ManorSchedule[manorindex].szFmName[index],CHAR_getChar(charaindex,CHAR_FMNAME));
for(i=0;i<iPlayerNum;i++){
if(CHAR_getCharUse(i) != FALSE){
CHAR_talkToCli(i,-1,szMsg,CHAR_COLORBLUE2);
}
}
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ManorSchedule[manorindex].iFmIndex[index] = iFmIndex;
// <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sprintf(ManorSchedule[manorindex].szFmName[index],"%s",CHAR_getChar(charaindex,CHAR_FMNAME));
// <20><>¼<EFBFBD><C2BC>սʱ<D5BD><CAB1>
memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1));
memcpy(&ManorSchedule[manorindex].tm1[index],&tm1,sizeof(tm1));
lssproto_WN_send(getfdFromCharaIndex(charaindex),WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ų<EFBFBD>");
}
else{
lssproto_WN_send(getfdFromCharaIndex(charaindex),WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END,
CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),"<EFBFBD><EFBFBD>Ǹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ž<EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ų<EFBFBD>");
return;
}
}
saacproto_ACFmPkOnlineSn_send(acfd,manorindex,1); //<2F><><EFBFBD><EFBFBD>ֵΪ1<CEAA>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD>SAAC<41><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>
// <20><><EFBFBD><EFBFBD>
SortManorSchedule();
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD>ų<EFBFBD>
void SortManorSchedule()
{
int i,j,k;
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for(k=0;k<MANORNUM;k++){
for(i=0;i<10;i++){
ManorSchedule[k].iSort[i] = i;
if(ManorSchedule[k].iFmIndex[i] != -1){
for(j=0;j<FAMILY_MAXNUM;j++){
// <20>ҳ<EFBFBD><D2B3><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(fmdptop.fmtopid[j] == ManorSchedule[k].iFmIndex[i]){
// ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
ManorSchedule[k].iFmMomentum[i] = fmdptop.fmMomentum[j];
// <20><><EFBFBD><EFBFBD>memo
sprintf(ManorSchedule[k].szMemo[i],"%-16s %2d:%2d %12d",
ManorSchedule[k].szFmName[i],ManorSchedule[k].tm1[i].tm_hour,ManorSchedule[k].tm1[i].tm_min,
ManorSchedule[k].iFmMomentum[i]/100);
break;
}
}
}
}
}
// <20><><EFBFBD><EFBFBD>
for(i=0;i<MANORNUM;i++){
g_iSortManor = i;
qsort(&ManorSchedule[g_iSortManor].iSort,10,sizeof(int),&SortManorScheduleMomentum);
}
}
int SortManorScheduleMomentum(const void *indexa, const void *indexb)
{
int momentumA,momentumB;
momentumA = ManorSchedule[g_iSortManor].iFmMomentum[*(int*)indexa];
momentumB = ManorSchedule[g_iSortManor].iFmMomentum[*(int*)indexb];
return (momentumA > momentumB) ? -1:1;
}
#endif