chuyiwen_gmsv/char/char_angel.c

710 lines
22 KiB
C
Raw Normal View History

2016-12-24 08:45:52 +08:00
#include "version.h"
#ifdef _ANGEL_SUMMON
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h> // shan
#include <ctype.h>
#include <time.h>
#include <sys/time.h>
#include <errno.h>
#include "common.h"
#include "char_base.h"
#include "char_data.h"
#include "char.h"
#include "lssproto_serv.h"
#include "item.h"
#include "item_event.h"
#include "buf.h"
#include "object.h"
#include "map_deal.h"
#include "saacproto_cli.h"
#include "readmap.h"
#include "handletime.h"
#include "char_event.h"
#include "npccreate.h"
#include "addressbook.h"
#include "item_event.h"
#include "magic_base.h"
#include "magic.h"
#include "chatmagic.h"
#include "configfile.h"
#include "log.h"
#include "anim_tbl.h"
#include "encount.h"
#include "battle.h"
#include "pet_skill.h"
#include "util.h"
#include "enemy.h"
#include "npcutil.h"
#include "pet.h"
#include "family.h"
struct MissionInfo missionlist[MAXMISSION];
int mission_num =0;
struct MissionTable missiontable[MAXMISSIONTABLE];
//#define ANGELITEM 2884 //20701 //ʹ<>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>߱<EFBFBD><DFB1><EFBFBD>
//#define HEROITEM 2885 //20702 //<2F><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>߱<EFBFBD><DFB1><EFBFBD>
extern int AngelReady;
char* getMissionNameInfo( int charaindex, char* nameinfo)
{
sprintf( nameinfo, "%s:%s", CHAR_getChar( charaindex, CHAR_CDKEY), CHAR_getChar( charaindex, CHAR_NAME) );
return nameinfo;
}
int checkIfAngel( int charaindex)
{
int i;
char nameinfo[512];
//sprintf( nameinfo, "%s:%s", CHAR_getChar( charaindex, CHAR_CDKEY), CHAR_getChar( charaindex, CHAR_NAME) );
getMissionNameInfo( charaindex, nameinfo);
for( i =0; i <MAXMISSIONTABLE; i++) {
if( missiontable[i].angelinfo[0] == '\0')
continue;
if( !strcmp( nameinfo, missiontable[i].angelinfo) ) {
return i;
}
else if( !strcmp( nameinfo, missiontable[i].heroinfo) ) {
return i;
}
}
return -1;
}
int checkIfOnlyAngel( int charaindex)
{
int i;
char nameinfo[512];
//sprintf( nameinfo, "%s:%s", CHAR_getChar( charaindex, CHAR_CDKEY), CHAR_getChar( charaindex, CHAR_NAME) );
getMissionNameInfo( charaindex, nameinfo);
for( i =0; i <MAXMISSIONTABLE; i++) {
if( missiontable[i].angelinfo[0] == '\0')
continue;
if( !strcmp( nameinfo, missiontable[i].angelinfo) ) {
return i;
}
}
return -1;
}
int checkIfOnlyHero( int charaindex)
{
int i;
char nameinfo[512];
//sprintf( nameinfo, "%s:%s", CHAR_getChar( charaindex, CHAR_CDKEY), CHAR_getChar( charaindex, CHAR_NAME) );
getMissionNameInfo( charaindex, nameinfo);
for( i =0; i <MAXMISSIONTABLE; i++) {
if( missiontable[i].angelinfo[0] == '\0')
continue;
if( !strcmp( nameinfo, missiontable[i].heroinfo) ) {
return i;
}
}
return -1;
}
int checkIfAngelByName( char* nameinfo)
{
int i;
for( i =0; i <MAXMISSIONTABLE; i++) {
if( missiontable[i].angelinfo[0] == '\0')
continue;
if( !strcmp( nameinfo, missiontable[i].angelinfo) ) {
return i;
}
else if( !strcmp( nameinfo, missiontable[i].heroinfo) ) {
return i;
}
}
return -1;
}
void addAngelData( int angelindex, int heroindex, int mission, int flag)
{
char buf[1024];
char angelinfo[512];
char heroinfo[512];
//if( checkIfAngel( angelindex) != -1 || checkIfAngel( heroindex) != -1 )
// return;
//sprintf( angelinfo, "%s:%s", CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME) );
getMissionNameInfo( angelindex, angelinfo);
//sprintf( heroinfo, "%s:%s", CHAR_getChar( heroindex, CHAR_CDKEY), CHAR_getChar( heroindex, CHAR_NAME) );
getMissionNameInfo( heroindex, heroinfo);
sprintf( buf, "%s|%s|%d|%d", angelinfo, heroinfo, mission, flag );;
//saacproto_ACMissionTable_send( acfd, -1, 2, buf, angelindex);
saacproto_ACMissionTable_send( acfd, -1, 2, buf, angelinfo);
return;
}
//void selectAngel( int charaindex)
void selectAngel( int charaindex, int heroindex, int mission, int gm_cmd)
{
// gm_cmd <20><>ʾ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>GMָ<4D><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
//int heroindex =-1;
int findindex, startindex;
//char msg[1024];
int max_char;
//int mission;
if( AngelReady <= 0 && gm_cmd == FALSE)
return;
//sprintf( msg, " ʹ<><CAB9><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD>: %s %s ", CHAR_getChar( charaindex, CHAR_CDKEY), CHAR_getChar( charaindex, CHAR_NAME));
//print( msg);
//LogAngel( msg);
// <20><>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( gm_cmd == FALSE )
{
if( checkIfAngel( charaindex) != -1) // <20>Ƿ<EFBFBD><C7B7><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
//print(" ANGEL<45>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ");
return;
}
if( CHAR_getInt( charaindex, CHAR_LV) < 30 || !NPC_EventCheckFlg( charaindex, 4 ) )
{
//print(" ANGEL<45>ʸ񲻷<CAB8> ");
return;
}
srand( time(NULL));
if( rand()%3 == 0 ) // <20><>ʹ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD> 2/3
{
//print(" ANGEL<45><4C><EFBFBD>ʼ<EFBFBD><CABC>鲻ͨ<E9B2BB><CDA8> ");
return;
}
}
//print(" ANGEL<45><4C><EFBFBD><EFBFBD> ");
// <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
if( heroindex == -1 )
{
//heroindex = -1;
max_char = CHAR_getPlayerMaxNum();
startindex = RAND( 0, max_char-1);
findindex = startindex;
while(1) {
if( findindex == startindex-1) break;
findindex = (findindex+1) % max_char;
if( !CHAR_CHECKINDEX( findindex) ) continue;
if( CHAR_getInt( findindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) continue;
if( findindex == charaindex ) continue;
if( checkIfAngel( findindex) != -1) continue; // <20>Ƿ<EFBFBD><C7B7><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( CHAR_getInt( findindex, CHAR_LV) < 80 || !NPC_EventCheckFlg( findindex, 4 ) ) continue; // <20><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
if( rand()%3 == 0 ) continue; // <20><><EFBFBD>ߵĻ<DFB5><C4BB><EFBFBD> 2/3
heroindex = findindex;
//print(" ANGEL<45><4C><EFBFBD>߾<EFBFBD><DFBE><EFBFBD> ");
break;
}
if( heroindex < 0) {
// sprintf( msg, " û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ!! ");
// print( msg);
//LogAngel( msg);
return;
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( mission == -1 )
{
int mlist[MAXMISSION]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
char eventlist[1024];
char buf[64];
int i, j, mindex =0;
memset( mlist, 0, sizeof(mlist));
for( i =0; i <MAXMISSION; i++) {
int checked =TRUE;
if( missionlist[i].id <= 0) continue;
if( CHAR_getInt( heroindex, CHAR_LV) < missionlist[i].level )
continue;
strcpy( eventlist, missionlist[i].eventflag); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
j =0;
while(1) {
j++;
if( getStringFromIndexWithDelim( eventlist, ";", j, buf, sizeof(buf)) == FALSE )
break;
if( buf[0] != '!') { // <20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
if( !NPC_EventCheckFlg( heroindex, atoi(buf) )) {
checked = FALSE;
break;
}
}
else {
if( NPC_EventCheckFlg( heroindex, atoi(buf+1) )) {
checked = FALSE;
break;
}
}
}
if( checked ) {
mlist[mindex] = missionlist[i].id;
//print(" mlist[%d]=%d ", mindex, mlist[mindex]);
mindex++;
}
}
if( mindex <= 0 ) {
//sprintf( msg, " <20>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> ");
//print( msg);
//LogAngel( msg);
return;
}
mission = mlist[rand()%mindex];
}
addAngelData( charaindex, heroindex, mission, MISSION_WAIT_ANSWER); // <20><><EFBFBD><EFBFBD>AC
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> event8 224~255 Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD>ٻ<EFBFBD>ר<EFBFBD><D7A8>
CHAR_setInt( charaindex, CHAR_NOWEVENT8, 0);
CHAR_setInt( charaindex, CHAR_ENDEVENT8, 0);
CHAR_setInt( heroindex, CHAR_NOWEVENT8, 0);
CHAR_setInt( heroindex, CHAR_ENDEVENT8, 0);
if( gm_cmd == FALSE )
AngelReady = 0; // <20><><EFBFBD><EFBFBD>ȱ<EFBFBD><C8B1>
{
//sprintf( msg, " <20><><EFBFBD><EFBFBD> %s <20><>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>: %s %s Lv:%d <20><><EFBFBD>ߺ<EFBFBD><DFBA><EFBFBD>: %s %s Lv:%d <20><><EFBFBD><EFBFBD>:%d ci=%d hi=%d ",
//gm_cmd ? ("(GMָ<4D><D6B8>)") : (" "),
//CHAR_getChar( charaindex, CHAR_CDKEY), CHAR_getChar( charaindex, CHAR_NAME), CHAR_getInt( charaindex, CHAR_LV),
//CHAR_getChar( heroindex, CHAR_CDKEY), CHAR_getChar( heroindex, CHAR_NAME), CHAR_getInt( heroindex, CHAR_LV),
//mission, charaindex, heroindex);
//print( msg);
//LogAngel( msg);
}
}
void sendAngelCleanToCli( int fd)
{
lssproto_WN_send( fd, //getfdFromCharaIndex(charaindex),
WINDOW_MESSAGETYPE_ANGELMESSAGE, -1,
CHAR_WINDOWTYPE_ANGEL_CLEAN,
-1, "");
}
int AngelCreate( int angelindex)
{
int emptyitem1, emptyitem2;
int angeltokenindex, herotokenindex;
char msgbuf[1024]/*, nameinfo[1024]*/;
int mindex;
char herocdkey[64];
char heroname[64];
if( !CHAR_CHECKINDEX( angelindex)) return FALSE;
print(" <20><>ʹ<EFBFBD><CAB9>Ӧ<EFBFBD><D3A6>!! ");
mindex = checkIfAngel( angelindex);
if( mindex == -1 || missiontable[mindex].flag == MISSION_TIMEOVER ) {
//print("\n ANGEL<45><4C><EFBFBD><EFBFBD>!!Table<6C><65>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>??:%d ", angelindex );
CHAR_talkToCli( angelindex, -1, "<EFBFBD>ܱ<EFBFBD>Ǹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ˡ<EFBFBD>", CHAR_COLORYELLOW);
sprintf( msgbuf, " <20>ش<EFBFBD><D8B4><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> i:%d ʹ<><CAB9>:%s %s ", mindex, CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME));
print( msgbuf);
LogAngel( msgbuf);
return FALSE;
}
if( missiontable[mindex].flag != MISSION_WAIT_ANSWER ) {
print(" <20><><EFBFBD><EFBFBD><EAB2BB>:%d ", missiontable[mindex].flag);
return FALSE;
}
if( CHAR_findEmptyItemBoxNo( angelindex ) < 2 ){
CHAR_talkToCli( angelindex, -1, "<EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>", CHAR_COLORYELLOW);
return TRUE;
}
getStringFromIndexWithDelim( missiontable[mindex].heroinfo, ":", 1, herocdkey, sizeof(herocdkey));
getStringFromIndexWithDelim( missiontable[mindex].heroinfo, ":", 2, heroname, sizeof(heroname));
angeltokenindex = ITEM_makeItemAndRegist( ANGELITEM );
if( angeltokenindex != -1 ){
/*if( ITEM_getInt( angeltokenindex, ITEM_TYPE) != ITEM_ANGELTOKEN) {
print(" <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> ");
ITEM_endExistItemsOne( angeltokenindex);
return;
}*/
//sprintf( nameinfo, "%s:%s", CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME ) );
ITEM_setChar( angeltokenindex, ITEM_ANGELINFO, missiontable[mindex].angelinfo);
ITEM_setChar( angeltokenindex, ITEM_HEROINFO, missiontable[mindex].heroinfo);
sprintf( msgbuf, "%d", missiontable[mindex].mission);
ITEM_setChar( angeltokenindex, ITEM_ANGELMISSION, msgbuf);
//sprintf( msgbuf, "%s(%s)", ITEM_getChar( angeltokenindex, ITEM_NAME), CHAR_getChar( angelindex, CHAR_NAME ) );
//ITEM_setChar( angeltokenindex, ITEM_NAME, msgbuf);
//ITEM_setChar( angeltokenindex, ITEM_SECRETNAME, msgbuf);
//sprintf( msgbuf, "<22><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> %s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s ר<><D7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", CHAR_getChar( angelindex, CHAR_NAME), heroname );
sprintf( msgbuf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD><EFBFBD>װ<EFA3AC><D7B0><EFBFBD><EFBFBD><E1B2BB><EFBFBD>С<EFBFBD>", CHAR_getChar( angelindex, CHAR_NAME) );
ITEM_setChar( angeltokenindex, ITEM_EFFECTSTRING, msgbuf);
emptyitem1 = CHAR_addItemSpecificItemIndex( angelindex, angeltokenindex);
CHAR_sendItemDataOne( angelindex, emptyitem1);
LogItem(
CHAR_getChar( angelindex, CHAR_NAME ),
CHAR_getChar( angelindex, CHAR_CDKEY ),
angeltokenindex,
"AddItem(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)",
CHAR_getInt( angelindex,CHAR_FLOOR),
CHAR_getInt( angelindex,CHAR_X ),
CHAR_getInt( angelindex,CHAR_Y ),
ITEM_getChar( angeltokenindex, ITEM_UNIQUECODE),
ITEM_getChar( angeltokenindex, ITEM_NAME),
ITEM_getInt( angeltokenindex, ITEM_ID) );
CHAR_talkToCli( angelindex, -1,"<EFBFBD>õ<EFBFBD>ʹ<EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", CHAR_COLORYELLOW);
}else{
print("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܡ<EFBFBD>" );
return FALSE;
}
herotokenindex = ITEM_makeItemAndRegist( HEROITEM );
if( herotokenindex != -1 ){
/*if( ITEM_getInt( herotokenindex, ITEM_TYPE) != ITEM_HEROTOKEN) {
print(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> ");
ITEM_endExistItemsOne( herotokenindex);
ITEM_endExistItemsOne( angeltokenindex);
CHAR_sendItemDataOne( angelindex, emptyitem1);
return;
}*/
//sprintf( nameinfo, "%s:%s", CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME ) );
ITEM_setChar( herotokenindex, ITEM_ANGELINFO, missiontable[mindex].angelinfo);
ITEM_setChar( herotokenindex, ITEM_HEROINFO, missiontable[mindex].heroinfo);
sprintf( msgbuf, "%d", missiontable[mindex].mission);
ITEM_setChar( herotokenindex, ITEM_ANGELMISSION, msgbuf);
//sprintf( msgbuf, "%s(%s)", ITEM_getChar( herotokenindex, ITEM_NAME), heroname );
//ITEM_setChar( herotokenindex, ITEM_NAME, msgbuf);
//ITEM_setChar( herotokenindex, ITEM_SECRETNAME, msgbuf);
//sprintf( msgbuf, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><>ʹ<EFBFBD><CAB9> %s ר<><D7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", heroname, CHAR_getChar( angelindex, CHAR_NAME) );
sprintf( msgbuf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD><EFBFBD>ʹ<EFA3AC><CAB9>ʹ<EFBFBD>ÿɴ<C3BF><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߡ<EFBFBD>", heroname );
ITEM_setChar( herotokenindex, ITEM_EFFECTSTRING, msgbuf);
emptyitem2 = CHAR_addItemSpecificItemIndex( angelindex, herotokenindex);
CHAR_sendItemDataOne( angelindex, emptyitem2);
LogItem(
CHAR_getChar( angelindex, CHAR_NAME ),
CHAR_getChar( angelindex, CHAR_CDKEY ),
herotokenindex,
"AddItem(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)",
CHAR_getInt( angelindex,CHAR_FLOOR),
CHAR_getInt( angelindex,CHAR_X ),
CHAR_getInt( angelindex,CHAR_Y ),
ITEM_getChar( herotokenindex, ITEM_UNIQUECODE),
ITEM_getChar( herotokenindex, ITEM_NAME),
ITEM_getInt( herotokenindex, ITEM_ID) );
CHAR_talkToCli( angelindex, -1,"<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", CHAR_COLORYELLOW);
}else{
print("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܡ<EFBFBD>" );
ITEM_endExistItemsOne( angeltokenindex);
CHAR_sendItemDataOne( angelindex, emptyitem1);
return FALSE;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>AC Server
//sprintf( nameinfo, "%s:%s", CHAR_getChar( angelindex, CHAR_CDKEY), CHAR_getChar( angelindex, CHAR_NAME ) );
sprintf( msgbuf, "%s|%d", missiontable[mindex].angelinfo, missionlist[missiontable[mindex].mission].limittime );
saacproto_ACMissionTable_send( acfd, MISSION_DOING, 4, msgbuf, "");
//CHAR_talkToCli( angelindex, -1, "<22><>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><C7B3><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>æ<EFBFBD><C3A6><EFBFBD><EFBFBD><EFBFBD>Ҿͽ<D2BE><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBDBB><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EBBDAB><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߡ<EFBFBD>", CHAR_COLORYELLOW);
lssproto_WN_send( getfdFromCharaIndex(angelindex), WINDOW_MESSAGETYPE_MESSAGE,
WINDOW_BUTTONTYPE_YES, -1, -1,
"<EFBFBD>dz<EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>æ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҿͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߡ<EFBFBD>");
#ifdef _ANGLE_EMAIL
int maxchar = CHAR_getPlayerMaxNum();
int i;
for( i =0; i <maxchar; i++)
{
if( !CHAR_CHECKINDEX( i) ) continue;
if( CHAR_getInt( i, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) continue;
if( strcmp( herocdkey, CHAR_getChar( i, CHAR_CDKEY)) ) continue;
if( strcmp( heroname, CHAR_getChar( i, CHAR_NAME)) ) continue;
if( ADDRESSBOOK_AutoaddAddressBook( angelindex, i) == TRUE ){
char token[256];
sprintf( token, "ϵͳ<EFBFBD>Զ<EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC>", CHAR_getChar( i, CHAR_NAME ));
CHAR_talkToCli( angelindex, -1, token, CHAR_COLORRED);
}
if( ADDRESSBOOK_AutoaddAddressBook( i, angelindex) == TRUE ){
char token[256];
sprintf( token, "ϵͳ<EFBFBD>Զ<EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC>", CHAR_getChar( angelindex, CHAR_NAME ));
CHAR_talkToCli( i, -1, token, CHAR_COLORRED);
}
break;
}
#endif
sprintf( msgbuf, " ʹ<>ߴ<EFBFBD>Ӧ<EFBFBD><D3A6>æ<EFBFBD><C3A6> i:%d ʹ<><CAB9>:%s <20><><EFBFBD><EFBFBD>:%s ci=%d ", mindex, missiontable[mindex].angelinfo, missiontable[mindex].heroinfo, angelindex);
print( msgbuf);
LogAngel( msgbuf);
return FALSE;
}
// ʹ<><CAB9>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
void Use_AngelToken( int charaindex, int toindex, int haveitemindex )
{
int itemindex;
char nameinfo[1024];
int mindex;
char msg[1024];
char tokenbuf[64];
print(" ʹ<><CAB9>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ");
if( !CHAR_CHECKINDEX( charaindex) ) return;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if( !ITEM_CHECKINDEX( itemindex) ) return;
mindex = checkIfAngel( charaindex);
//sprintf( nameinfo, "%s:%s", CHAR_getChar(charaindex, CHAR_CDKEY), CHAR_getChar(charaindex, CHAR_NAME));
getMissionNameInfo( charaindex, nameinfo);
if( mindex == -1 ||
( strcmp( nameinfo, ITEM_getChar( itemindex, ITEM_ANGELINFO)) && strcmp( nameinfo, ITEM_getChar( itemindex, ITEM_HEROINFO)) ) ) {
// ·<>˼<EFBFBD>ʹ<EFBFBD><CAB9>ʱ
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>", CHAR_COLORRED);
return;
}
if( strcmp( ITEM_getChar( itemindex, ITEM_ANGELINFO), missiontable[mindex].angelinfo)
|| strcmp( ITEM_getChar( itemindex, ITEM_HEROINFO), missiontable[mindex].heroinfo) ) {
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɡ<EFBFBD>", CHAR_COLORRED);
return;
}
if( !strcmp( nameinfo, missiontable[mindex].angelinfo) ) { // ʹ<><CAB9>ʹ<EFBFBD><CAB9>ʱ
int lefttime, hour, min;
lefttime = missiontable[mindex].time + missiontable[mindex].limittime*60*60 - (int)time(NULL);
hour = lefttime / (60*60);
min = (lefttime % (60*60)) / 60;
if( missiontable[mindex].flag == MISSION_DOING ) {
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
getStringFromIndexWithDelim( missiontable[mindex].heroinfo, ":", 2, tokenbuf, sizeof(tokenbuf));
sprintf( msg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><>%s<><73>ʱ<EFBFBD>仹ʣ<E4BBB9><CAA3>%dСʱ%d<>֡<EFBFBD>",
tokenbuf, missionlist[missiontable[mindex].mission].detail, hour, min);
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED);
}
else if( missiontable[mindex].flag == MISSION_HERO_COMPLETE ) {
// <20><><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><ECBDB1>
getStringFromIndexWithDelim( missiontable[mindex].heroinfo, ":", 2, tokenbuf, sizeof(tokenbuf));
sprintf( msg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><>ʹ<EFBFBD><CAB9><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD>ˣ<EFBFBD>ʱ<EFBFBD>仹ʣ<E4BBB9><CAA3>%dСʱ%d<>֡<EFBFBD>",
tokenbuf, hour, min);
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED);
}
else if( missiontable[mindex].flag == MISSION_TIMEOVER ) {
// ʱ<><EFBFBD><E4B3AC><EFBFBD><EFBFBD>
sprintf( msg, "<EFBFBD>ܿ<EFBFBD>ϧ<EFBFBD><EFBFBD>ʹ<EFBFBD>ߺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><EFBFBD>ټ<EFBFBD><EFBFBD>Ͱɡ<EFBFBD>");
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED);
}
return;
}
else if( !strcmp( nameinfo, missiontable[mindex].heroinfo) ) { // <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ʱ
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int maxchar, i;
char cdkey[64], name[64];
int fl =0, fx =0, fy =0;
if( checkUnlawWarpFloor( CHAR_getInt( charaindex, CHAR_FLOOR) ) ) {
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵĵط<EFBFBD><EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>", CHAR_COLORYELLOW );
return;
}
getStringFromIndexWithDelim( missiontable[mindex].angelinfo, ":", 1, cdkey, sizeof(cdkey));
getStringFromIndexWithDelim( missiontable[mindex].angelinfo, ":", 2, name, sizeof(name));
maxchar = CHAR_getPlayerMaxNum();
for( i =0; i <maxchar; i++)
{
if( !CHAR_CHECKINDEX( i) ) continue;
if( CHAR_getInt( i, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) continue;
//sprintf( tempinfo, "%s:%s", CHAR_getChar( i, CHAR_CDKEY), CHAR_getChar( i, CHAR_NAME));
if( strcmp( cdkey, CHAR_getChar( i, CHAR_CDKEY)) ) continue;
if( strcmp( name, CHAR_getChar( i, CHAR_NAME)) ) continue;
fl = CHAR_getInt( i, CHAR_FLOOR);
fx = CHAR_getInt( i, CHAR_X);
fy = CHAR_getInt( i, CHAR_Y);
if( checkUnlawWarpFloor( fl) ) {
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵĵط<EFBFBD><EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>", CHAR_COLORYELLOW );
return;
}
break;
}
if( fl <= 0 )
{
sprintf( msg, "ʹ<EFBFBD><EFBFBD> %s Ŀǰ<C4BF><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>ϡ<EFBFBD>", name);
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED);
return;
}
sprintf( msg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> %s <20><><EFBFBD>ߡ<EFBFBD>", name);
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW);
CHAR_warpToSpecificPoint( charaindex, fl, fx, fy);
}
}
// ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
void Use_HeroToken( int charaindex, int toindex, int haveitemindex )
{
int itemindex;
int mindex;
char nameinfo[64];
char msg[1024];
// print(" ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ");
if( !CHAR_CHECKINDEX( charaindex) ) return;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if( !ITEM_CHECKINDEX( itemindex) ) return;
mindex = checkIfAngel( charaindex);
//sprintf( nameinfo, "%s:%s", CHAR_getChar(charaindex, CHAR_CDKEY), CHAR_getChar(charaindex, CHAR_NAME));
getMissionNameInfo( charaindex, nameinfo);
if( mindex == -1 ||
( strcmp( nameinfo, ITEM_getChar( itemindex, ITEM_ANGELINFO)) && strcmp( nameinfo, ITEM_getChar( itemindex, ITEM_HEROINFO)) ) ) {
// ·<>˼<EFBFBD>ʹ<EFBFBD><CAB9>ʱ
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>", CHAR_COLORRED);
return;
}
if( strcmp( ITEM_getChar( itemindex, ITEM_ANGELINFO), missiontable[mindex].angelinfo)
|| strcmp( ITEM_getChar( itemindex, ITEM_HEROINFO), missiontable[mindex].heroinfo) ){
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɡ<EFBFBD>", CHAR_COLORRED);
return;
}
if( !strcmp( nameinfo, missiontable[mindex].heroinfo) ) { // <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ʱ
int lefttime, hour, min;
lefttime = missiontable[mindex].time + missiontable[mindex].limittime*60*60 - (int)time(NULL);
hour = lefttime / (60*60);
min = (lefttime % (60*60)) / 60;
if( missiontable[mindex].flag == MISSION_DOING ) {
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sprintf( msg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s<><73>ʱ<EFBFBD>仹ʣ<E4BBB9><CAA3>%dСʱ%d<>֡<EFBFBD>",
missionlist[missiontable[mindex].mission].detail, hour, min);
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED);
}
else if( missiontable[mindex].flag == MISSION_HERO_COMPLETE ) {
// <20><><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><ECBDB1>
sprintf( msg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD>ˣ<EFBFBD>ʱ<EFBFBD>仹ʣ<EFBFBD><EFBFBD>%dСʱ%d<>֡<EFBFBD>",
hour, min);
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED);
}
else if( missiontable[mindex].flag == MISSION_TIMEOVER ) {
// ʱ<><EFBFBD><E4B3AC><EFBFBD><EFBFBD>
sprintf( msg, "<EFBFBD>ܿ<EFBFBD>ϧ<EFBFBD><EFBFBD>ʹ<EFBFBD>ߺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><EFBFBD>ټ<EFBFBD><EFBFBD>Ͱɡ<EFBFBD>");
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED);
}
return;
}
else if( !strcmp( nameinfo, missiontable[mindex].angelinfo) ) { // ʹ<><CAB9>ʹ<EFBFBD><CAB9>ʱ
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int maxchar, i;
char cdkey[64], name[64];
int fl =0, fx =0, fy =0;
if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) {
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>", CHAR_COLORYELLOW );
return;
}
if( checkUnlawWarpFloor( CHAR_getInt( charaindex, CHAR_FLOOR) ) ) {
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵĵط<EFBFBD><EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>", CHAR_COLORYELLOW );
return;
}
//if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE ){
if( CheckDropatLogout( charaindex) == TRUE ) {
CHAR_talkToCli( charaindex, -1, "Я<EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>޷<EFBFBD>ʹ<EFBFBD>á<EFBFBD>", CHAR_COLORYELLOW);
return;
}
getStringFromIndexWithDelim( missiontable[mindex].heroinfo, ":", 1, cdkey, sizeof(cdkey));
getStringFromIndexWithDelim( missiontable[mindex].heroinfo, ":", 2, name, sizeof(name));
maxchar = CHAR_getPlayerMaxNum();
for( i =0; i <maxchar; i++)
{
if( !CHAR_CHECKINDEX( i) ) continue;
if( CHAR_getInt( i, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) continue;
//sprintf( tempinfo, "%s:%s", CHAR_getChar( i, CHAR_CDKEY), CHAR_getChar( i, CHAR_NAME));
if( strcmp( cdkey, CHAR_getChar( i, CHAR_CDKEY)) ) continue;
if( strcmp( name, CHAR_getChar( i, CHAR_NAME)) ) continue;
fl = CHAR_getInt( i, CHAR_FLOOR);
fx = CHAR_getInt( i, CHAR_X);
fy = CHAR_getInt( i, CHAR_Y);
if( checkUnlawWarpFloor( fl) ) {
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵĵط<EFBFBD><EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹<EFBFBD>ȥ<EFBFBD><EFBFBD>", CHAR_COLORYELLOW );
return;
}
break;
}
if( fl <= 0 )
{
sprintf( msg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s Ŀǰ<C4BF><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>ϡ<EFBFBD>", name);
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED);
return;
}
sprintf( msg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><><EFBFBD>ߡ<EFBFBD>", name);
CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW);
CHAR_warpToSpecificPoint( charaindex, fl, fx, fy);
}
else { // ·<>˼<EFBFBD>ʹ<EFBFBD><CAB9>ʱ
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>", CHAR_COLORRED);
return;
}
}
void CHAR_sendAngelMark( int objindex, int flag)
{
int opt[1];
opt[0] = flag;
CHAR_sendWatchEvent( objindex,CHAR_ACTANGEL,opt,1,TRUE);
}
#endif