void CHAR_recoveryStatus( int charaindex ) { int i; int cure=FALSE; if( !CHAR_CHECKINDEX(charaindex) )return; for( i=0 ; i < arraysizeof(pShow) ; i ++ ) { if( CHAR_getInt(charaindex,pShow[i].paramindex) > 0 ) { int old; old = CHAR_setInt(charaindex,pShow[i].paramindex, CHAR_getInt(charaindex, pShow[i].paramindex) - 1 ); if( old == 1 ) { if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { CHAR_talkToCli( charaindex,-1, pShow[i].offmessage, CHAR_COLORWHITE ); } cure = TRUE; } } } if( cure ) { CHAR_sendStatusString( charaindex, "P" ); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX) ); } }
void NPC_NPCEnemyWatch( int meobjindex, int objindex, CHAR_ACTION act, int x,int y,int dir, int* opt,int optlen ) { int born, dead; int meindex, index; char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *npcarg; if( OBJECT_getType( objindex) != OBJTYPE_CHARA) return; index = OBJECT_getIndex( objindex); if( !CHAR_CHECKINDEX( index) ) return; if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return; meindex = OBJECT_getIndex( meobjindex); if( !CHAR_CHECKINDEX( meindex) ) return; if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1))) == NULL ){ print("WarpMan:GetArgStrErr"); return; } if( !strstr( npcarg,"NEWNPCENEMY") ) return; if( NPC_getTimeData( meindex, npcarg, &born, &dead, 200) == FALSE ) return; NPC_TimeDefineDo( meindex, born, dead, NPC_TIME_MODE); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); }
void NPC_DoorClose(int meindex , int doindex) { CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , CHAR_getWorkInt( meindex,CHAR_WORKDOORCLOSEG )); NPC_DoorRefreshOverFlg( meindex ); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex , CHAR_WORKOBJINDEX )); if( doindex >= 0 ) CHAR_talkToCli( doindex , -1 , NPC_DOOR_CLOSEMSG, CHAR_COLORWHITE ); CHAR_setInt( meindex , CHAR_TALKCOUNT, 0 ); }
void Check_EnemyWarpMe( int meindex, char *args ) { char buf1[256]; int objindex,index; int nfl, nx, ny; OBJECT obj; memset( buf1, 0, sizeof( buf1)); if( NPC_Util_GetStrFromStrWithDelim( args, "REPLACEMENT", buf1, sizeof( buf1)) == NULL ) { return; } GetRand_WarpPoint( buf1, &nfl, &nx, &ny ); if( MAP_IsValidCoordinate( nfl, nx, ny ) == FALSE ){ char filename[256]; NPC_Util_CheckAssignArgFile( meindex, filename); print( "NPCENEMY REPLACEMENT: %s .Invalid POINT( %d, %d, %d)\n", filename, nfl, nx, ny ); return; } { int ofl, ox, oy; ofl = CHAR_getInt( meindex, CHAR_FLOOR ); ox = CHAR_getInt( meindex, CHAR_X ); oy = CHAR_getInt( meindex, CHAR_Y ); for ( obj=MAP_getTopObj( nfl, nx, ny); obj; obj=NEXT_OBJECT( obj) ) { objindex = GET_OBJINDEX( obj); if (OBJECT_getType( objindex) != OBJTYPE_CHARA) continue; index = OBJECT_getIndex( objindex); if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER && CHAR_getWorkInt( index, CHAR_WORKEVENTTYPE) != CHAR_TYPEPET ) { CHAR_warpToSpecificPoint( index, ofl, ox, oy); CHAR_sendCToArroundCharacter( objindex); break; } } } objindex = CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX); CHAR_warpToSpecificPoint( meindex, nfl, nx, ny); CHAR_sendCToArroundCharacter( objindex); }
void NPC_DoorOpen(int meindex , int doindex ) { CHAR_setWorkInt( meindex , CHAR_WORKDOORCLOSETIME, NowTime.tv_sec + CHAR_getInt( meindex , CHAR_MERCHANTLEVEL)); CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , CHAR_getWorkInt( meindex,CHAR_WORKDOOROPENG )); NPC_DoorRefreshOverFlg( meindex ); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX )); if( doindex >= 0 ) CHAR_talkToCli( doindex , -1, NPC_DOOR_OPENMSG ,CHAR_COLORWHITE); }
/************************************** * route į���գ� ؤ�����չ�ľë * ��į�����屾�������£� **************************************/ static void NPC_BusSetDestPoint( int meindex, char *argstr) { char buf[256]; char routename[256]; snprintf( routename, sizeof( routename), "routename%d", CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); if( NPC_Util_GetStrFromStrWithDelim( argstr, routename, buf, sizeof( buf)) != NULL ) { CHAR_setChar( meindex, CHAR_OWNTITLE, buf); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); } }
int NPC_DoorSetRopeFlag(int fl,int x,int y, int flag ) { int ind = NPC_DoorSearchByPosition( fl,x,y ); if( ind < 0 ) return FALSE; if( flag ){ CHAR_setInt( ind , CHAR_BASEIMAGENUMBER , ROPEGRAPHIC ); } else { CHAR_setInt(ind , CHAR_BASEIMAGENUMBER , 0 ); } NPC_DoorRefreshOverFlg( ind ); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( ind , CHAR_WORKOBJINDEX )); return TRUE; }
/*------------------------------------------------------------ * Map 奶矛件玄及 pre post毛質 允月 * 婁醒 * index int 曇欠丹午仄化中月平乓仿及奶件犯永弁旦 * mode BOOL TRUE及凜反}in FALSE及凜反 out 卞覆殺 * 忒曰襖卅仄 ------------------------------------------------------------*/ static void MAP_dealprepostevent( int index, BOOL mode ) { int map[2]; int i; int damaged=FALSE,statuschange=FALSE; if( CHAR_getFlg(index,CHAR_ISFLYING) ) /* 氏匹月支勾卞反窒手仄卅中 */ return; if( !MAP_getMapDataFromCharIndex( index , map ) ) return; /* damage */ int damage; for( i = 0 ; i < 2 ; i ++ ){ damage = MAP_getImageInt(map[i], mode ? MAP_INTODAMAGE : MAP_OUTOFDAMAGE); if( damage != 0 ){ /* 母丟□斥洶毛懇匹 蜇允月及匹 寞 木贅尹 */ int opt[2]={SPR_kmydamY,-damage}; damaged=TRUE; CHAR_setInt(index, CHAR_HP, CHAR_getInt(index,CHAR_HP) + damage ); CHAR_complianceParameter(index); /* 母丟□斥熬仃凶巨白尼弁玄請允 */ CHAR_sendWatchEvent(CHAR_getWorkInt(index,CHAR_WORKOBJINDEX), CHAR_ACTDAMAGE,opt,2,TRUE); } if( MAP_changeCharStatusFromMapDataAndTime( index,map[i], mode ? TRUE : FALSE ) ) statuschange=TRUE; } if( damaged ) CHAR_sendStatusString(index,"M"); if( statuschange ){ CHAR_sendCToArroundCharacter(index); CHAR_sendStatusString(index,"P"); } }
void NPC_NPCEnemyLoop( int meindex ) { if( NowTime.tv_sec > CHAR_getWorkInt( meindex, CHAR_WORK_DIETIME) + CHAR_getWorkInt( meindex, CHAR_WORK_REVIVALTIME)){ Char *ch; CHAR_setInt( meindex, CHAR_BASEIMAGENUMBER, CHAR_getWorkInt( meindex, CHAR_WORK_BASEIMGBAK)); print("bbi---->bi11"); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); CHAR_setWorkInt( meindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_ENEMY); MAP_sendAroundMapdata( CHAR_getInt( meindex, CHAR_FLOOR), CHAR_getInt( meindex, CHAR_X), CHAR_getInt( meindex, CHAR_Y)); ch = CHAR_getCharPointer( meindex); if( ch != NULL ) { strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, sizeof( ch->charfunctable[CHAR_LOOPFUNC]), ""); CHAR_constructFunctable( meindex); // CHAR_setInt( meindex, CHAR_LOOPINTERVAL, 0); } } }
static BOOL CHAR_DischargePartySub( int charaindex, int msgflg) { char buf[64], c[3]; int toindex,flg,i; #ifdef _ITEM_QUITPARTY int j = 0,k; #endif if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ) { int pindex, airplaneflag=0; // Arminius 7.10 Airplane if( CHAR_getInt(charaindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) { if ((CHAR_getInt(charaindex, CHAR_BASEIMAGENUMBER) !=100355) && (CHAR_getInt(charaindex, CHAR_BASEIMAGENUMBER) !=100461)){ airplaneflag=1; } } for( i = 0; i < CHAR_PARTYMAX; i ++ ) { pindex = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1); if( CHAR_CHECKINDEX( pindex) ) { int fd = getfdFromCharaIndex( pindex ); CHAR_setWorkInt( pindex, CHAR_WORKPARTYINDEX1, -1); CHAR_setWorkInt( pindex, CHAR_WORKPARTYMODE, CHAR_PARTY_NONE); if( msgflg ){ CHAR_talkToCli( pindex, -1, "¹Î¶¤¤w¸Ñ´²¡I", CHAR_COLORYELLOW); #ifdef _ITEM_QUITPARTY // won fix for( j=0;j<CHAR_MAXITEMHAVE;j++ ){ int del_item_index = CHAR_getItemIndex( pindex , j ); if( ITEM_CHECKINDEX(del_item_index) ){ //®æ¤l¤º¦³¹D¨ã for( k=0;k<itemquitparty_num;k++ ){ if( ITEM_getInt( del_item_index, ITEM_ID) == atoi(Disappear_Item[k].string) ){ //Yµ¥©ó©Ò³]©wªº¹D¨ãID CHAR_setItemIndex( pindex, j, -1); //®æ¤l¤º¹D¨ã®ø¥¢ ITEM_endExistItemsOne( del_item_index ); CHAR_sendItemDataOne( pindex, j); } } } } #endif } if( fd != -1 ) { lssproto_PR_send( fd, 0, 1); } // Arminius 7.10 Airplane if (airplaneflag && (CHAR_getInt(pindex,CHAR_WHICHTYPE)!=CHAR_TYPEBUS)) { int bi,bbi,ii,category; bbi=CHAR_getInt(pindex,CHAR_BASEBASEIMAGENUMBER); ii=CHAR_getItemIndex(pindex,CHAR_ARM); if (!ITEM_CHECKINDEX(ii)) category=ITEM_FIST; else category=ITEM_getInt(ii,ITEM_TYPE); bi=CHAR_getNewImagenumberFromEquip(bbi,category); if (bi==-1) bi=bbi; CHAR_setInt(pindex,CHAR_BASEIMAGENUMBER,bi); // Robin 0810 debug CHAR_complianceParameter( pindex ); CHAR_sendCToArroundCharacter(CHAR_getWorkInt(pindex , CHAR_WORKOBJINDEX)); } } CHAR_setWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1, -1); } CHAR_sendLeader( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), 0); }else if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) { int myarray = -1; int fd = getfdFromCharaIndex( charaindex ); CHAR_setWorkInt( charaindex, CHAR_WORKPARTYMODE, CHAR_PARTY_NONE); toindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1); if( !CHAR_CHECKINDEX(toindex ) ) return FALSE; if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) { NPC_BusCheckAllowItem( toindex, charaindex, TRUE); // Arminius 7.9 Airplane if ((CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) !=100355) && (CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) !=100461)){ int bi,bbi,ii,category; bbi=CHAR_getInt(charaindex,CHAR_BASEBASEIMAGENUMBER); ii=CHAR_getItemIndex(charaindex,CHAR_ARM); if (!ITEM_CHECKINDEX(ii)) category=ITEM_FIST; else category=ITEM_getInt(ii,ITEM_TYPE); bi=CHAR_getNewImagenumberFromEquip(bbi,category); if (bi==-1) bi=bbi; CHAR_setInt(charaindex,CHAR_BASEIMAGENUMBER,bi); // Robin 0810 debug CHAR_complianceParameter( charaindex ); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); if(CHAR_getWorkInt(toindex,CHAR_NPCWORKINT5)==1) { if( CHAR_getInt( charaindex, CHAR_LASTTALKELDER)>=0){ int fl,x,y; CHAR_getElderPosition( CHAR_getInt( charaindex, CHAR_LASTTALKELDER), &fl, &x, &y ); CHAR_warpToSpecificPoint(charaindex, fl, x, y); } } } } CHAR_setWorkInt( charaindex, CHAR_WORKPARTYINDEX1, -1); for( i = 0; i < CHAR_PARTYMAX; i ++ ) { int index = CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1); if( CHAR_CHECKINDEX(index) ){ if( index == charaindex) { myarray = i; break; } } } if( myarray == CHAR_PARTYMAX) { print( "DischargeParty(): ¯u©_©Ç¡I"); return FALSE; } CHAR_setWorkInt( toindex, CHAR_WORKPARTYINDEX1 + myarray, -1); snprintf( buf,sizeof( buf), "%s ²æÂ÷¹Î¶¤¡I", CHAR_getChar( charaindex, CHAR_NAME)); if( msgflg ){ CHAR_talkToCli( charaindex, -1, "²æÂ÷¹Î¶¤¡I", CHAR_COLORYELLOW); #ifdef _ITEM_QUITPARTY // won fix for( i=0;i<CHAR_MAXITEMHAVE;i++ ){ int del_item_index = CHAR_getItemIndex( charaindex , j ); if( ITEM_CHECKINDEX(del_item_index) ){ //®æ¤l¤º¦³¹D¨ã for( j=0;j<itemquitparty_num;j++ ){ if( ITEM_getInt( del_item_index, ITEM_ID) == atoi(Disappear_Item[j].string) ){ //Yµ¥©ó©Ò³]©wªº¹D¨ãID CHAR_setItemIndex( charaindex, i, -1); //®æ¤l¤º¹D¨ã®ø¥¢ ITEM_endExistItemsOne( del_item_index ); CHAR_sendItemDataOne( charaindex, i); } } } } #endif } snprintf( c, sizeof(c), "N%d", myarray); if( fd != -1 ) { lssproto_PR_send( fd, 0, 1); } for( i = 0; i < CHAR_PARTYMAX; i ++ ) { int index = CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1); if( CHAR_CHECKINDEX(index) ){ #ifdef _ITEM_QUITPARTY // won fix for( j=0;j<CHAR_MAXITEMHAVE;j++ ){ int del_item_index = CHAR_getItemIndex( index , j ); if( ITEM_CHECKINDEX(del_item_index) ){ //®æ¤l¤º¦³¹D¨ã for( k=0;k<itemquitparty_num;k++ ){ if( ITEM_getInt( del_item_index, ITEM_ID) == atoi(Disappear_Item[k].string) ){ //Yµ¥©ó©Ò³]©wªº¹D¨ãID CHAR_setItemIndex( index, j, -1); //®æ¤l¤º¹D¨ã®ø¥¢ ITEM_endExistItemsOne( del_item_index ); CHAR_sendItemDataOne( index, j); } } } } #endif if( msgflg ){ CHAR_talkToCli( index, -1, buf, CHAR_COLORYELLOW); } CHAR_sendStatusString( index, c); } } flg = FALSE; for( i = 1; i < CHAR_PARTYMAX; i ++ ) { int index = CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1); if( CHAR_CHECKINDEX(index) ){ flg = TRUE; break; } } if( !flg) { CHAR_setWorkInt( toindex, CHAR_WORKPARTYMODE, CHAR_PARTY_NONE); CHAR_sendLeader( CHAR_getWorkInt( toindex, CHAR_WORKOBJINDEX), 0); }else { POINT start,end; int previndex = toindex; end.x = CHAR_getInt( charaindex, CHAR_X); end.y = CHAR_getInt( charaindex, CHAR_Y); for( i = 1; i < CHAR_PARTYMAX; i ++ ) { int index = CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1); if( CHAR_CHECKINDEX( index) ) { if( NPC_Util_CharDistance( index, previndex) > 1) { int parent_dir; start.x = CHAR_getInt( index, CHAR_X); start.y = CHAR_getInt( index, CHAR_Y); parent_dir = NPC_Util_getDirFromTwoPoint( &start,&end ); end = start; if( parent_dir != -1 ) { CHAR_walk( index, parent_dir, 0); } } previndex = index; } } } } return TRUE; }
/*------------------------------------------------------------ * ¥Ñ¡¼ ¥£¤Ë ¤í¤¦¤È¤¹¤ë¡e ------------------------------------------------------------*/ BOOL CHAR_JoinParty( int charaindex ) { int result = -1; int x,y; OBJECT object; int found = FALSE; int fd; int cnt; int i; fd = getfdFromCharaIndex( charaindex ); if( fd == -1 ) { print( "%s : %d err\n", __FILE__, __LINE__); return FALSE; } /* ¼«Ê¬¤¬¥Ñ¡¼ ¥£ÁȤó¤Ç¤¿¤éÂÌ */ if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) { lssproto_PR_send( fd, 1, FALSE); return FALSE; } /* ¤ÎÁ°¤ÎºÂ ¤ò ¤ë */ CHAR_getCoordinationDir( CHAR_getInt( charaindex, CHAR_DIR ) , CHAR_getInt( charaindex , CHAR_X ), CHAR_getInt( charaindex , CHAR_Y ) , 1 , &x , &y ); /* ½é´ü²½¤¹¤ë */ for( i = 0; i < CONNECT_WINDOWBUFSIZE; i ++ ) { CONNECT_setJoinpartycharaindex(fd,i,-1); } cnt = 0; /*¼«Ê¬¤Î ¤ÎÁ°¤Î¥¥ã¥é¤ò¼è ¤¹¤ë */ for( object = MAP_getTopObj( CHAR_getInt( charaindex, CHAR_FLOOR),x,y) ; object ; object = NEXT_OBJECT(object ) ) { int toindex; int parray; int objindex = GET_OBJINDEX(object); int targetindex = -1; /* ¥¥ã¥é¥¯¥¿¡¼¤¸¤ã¤Ê¤¤ */ if( OBJECT_getType( objindex) != OBJTYPE_CHARA) continue; toindex = OBJECT_getIndex( objindex); // shan begin if( CHAR_getInt(charaindex, CHAR_FMINDEX) > 0 && CHAR_getInt(toindex, CHAR_FMINDEX) >0){ for( i = 0; i < FAMILY_FMPKFLOOR; i++){ if( fmpkflnum[i].fl == CHAR_getInt( charaindex, CHAR_FLOOR) ) if( CHAR_getInt(charaindex, CHAR_FMINDEX) != CHAR_getInt(toindex, CHAR_FMINDEX) ){ lssproto_PR_send( fd, 1, FALSE); return FALSE; } } } // shan end /* ¥×¥ì¥¤¥ä¡¼¤Î»þ */ if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ found = TRUE; /* Áê¼ê¤¬»Ò¤À¤Ã¤¿¤é¿Æ¤ò°ú¤ÃÄ¥¤ê½Ð¤¹ */ if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) { targetindex = CHAR_getWorkInt( toindex, CHAR_WORKPARTYINDEX1); if( !CHAR_CHECKINDEX( targetindex) ) { print( " %s:%d err\n", __FILE__, __LINE__); continue; } if( CHAR_getInt( targetindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS) { continue; } } else { targetindex = toindex; } /* ¿Æ¤È £±¬¤°Ê ¤Ë¤¤¤ë¤« */ if( NPC_Util_CharDistance( charaindex, targetindex ) > 1) { continue; } /* Àï ¤Ï¤Ç¤Ê¤¤»ö¡e*/ if( CHAR_getWorkInt( targetindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ){ continue; } /* Ãç´Öµö²Ä¥â¡¼¥É¤« */ if( !CHAR_getFlg( targetindex, CHAR_ISPARTY) ) continue; #ifdef _ANGEL_SUMMON if( CHAR_getWorkInt( targetindex, CHAR_WORKANGELMODE) == TRUE) { CHAR_talkToCli( charaindex, -1, "¨ÏªÌ¤£¥i¥H·í»â¶¤¡C", CHAR_COLORYELLOW); continue; } #endif #ifdef _ESCAPE_RESET // ¨Ï¥Î´cÄ_°k¶]«áx¤ÀÄÁ¤º¤£¥i»P¤H²Õ¶¤ if( getStayEncount( getfdFromCharaIndex(targetindex) ) ) { //print(" ´cÄ_¤¤²Õ¶¤ "); if( time(NULL) - CHAR_getWorkInt( targetindex, CHAR_WORKLASTESCAPE) < 5*60 ) { //print(" ´cÄ_°k¶]«á²Õ¶¤ "); CHAR_talkToCli( charaindex, -1, "¦¹¤H¼È®É¤£¥i¥H·í»â¶¤¡C", CHAR_COLORYELLOW); continue; } } #endif } /* ¥Þ¥ó¥â¥¹¥Ð¥¹¤¬¤¤¤ë»þ¤Ï¡f¿Í´Ö¤è¤êÍ¥À褹¤ë¡e */ else if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) { targetindex = toindex; cnt = 0; if( !NPC_BusCheckJoinParty( toindex, charaindex, TRUE)) { /* ¾ò·ï¤ò ¤¿¤µ¤Ê¤«¤Ã¤¿¡eÃç´Ö ¤ë¤Î¤Ï½ª¤ï¤ë¡e¿Í´Ö¤Î½è ¤â¤·¤Ê¤¤¡e * ¤ä¤ä¤³¤·¤¤¤Î¤Ç¡e */ break; } { // Arminius 7.10 Airplane int busimg=CHAR_getInt(toindex, CHAR_BASEIMAGENUMBER); if ((busimg!=100355) && (busimg!=100461)) { CHAR_setInt(charaindex,CHAR_BASEIMAGENUMBER,busimg); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); // Robin debug 01/11/21 if( CHAR_getInt( charaindex, CHAR_RIDEPET) != -1 ) { CHAR_setInt( charaindex, CHAR_RIDEPET, -1); CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_RIDEPET); } /* CHAR_sendPMEToArroundCharacterFLXY(charaindex, CHAR_getInt( charaindex, CHAR_FLOOR), CHAR_getInt( charaindex, CHAR_X), CHAR_getInt( charaindex, CHAR_Y), 0,1,CHAR_getInt( charaindex, CHAR_PETMAILEFFECT) ); */ } } } /* ¥×¥ì¥¤¥ä¡¼Ëô¤Ï¥Þ¥ó¥â¥¹¥Ð¥¹°Ê³°¤Ï »ë¤¹¤ë */ else { continue; } /* Áê¼ê¥Ñ¡¼ ¥£¤Î¿Í¿ô¤Ï ¤«¡ª */ parray = CHAR_getEmptyPartyArray( targetindex) ; if( parray == -1 ) continue; /* ¤³¤³¤Þ¤Ç¤¯¤ì¤Ð */ CONNECT_setJoinpartycharaindex( fd,cnt,toindex); cnt++; if( cnt == CONNECT_WINDOWBUFSIZE ) break; /* ¥Þ¥ó¥â¥¹¥Ð¥¹ ¸«¤·¤À¤¤¡f¥ë¡¼¥×¤ò ¤±¤ë¡e */ if( CHAR_getInt( targetindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) break; } if( cnt == 0 ) { if( found == TRUE) { CHAR_talkToCli( charaindex, -1, "µLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW); } result = FALSE; }else if( cnt == 1 ) { #ifdef _DEATH_CONTEND int toindex = CONNECT_getJoinpartycharaindex( fd, 0); if(CHAR_getInt(toindex,CHAR_PKLISTTEAMNUM) == -1 && CHAR_getInt(charaindex,CHAR_PKLISTTEAMNUM) == -1){ }else if( CHAR_getInt( charaindex, CHAR_PKLISTLEADER ) > 0 || CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) < 0 || CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) < 0 || CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) != CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) || CHAR_getInt(toindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){ CHAR_talkToCli( charaindex, -1, "¶¤¥î¤£¦P¡AµLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW); result = FALSE; }else{ #endif CHAR_JoinParty_Main( charaindex, CONNECT_getJoinpartycharaindex(fd,0)); result = TRUE; #ifdef _DEATH_CONTEND } #endif }else { int strlength; char msgbuf[1024]; char escapebuf[2048]; #ifdef _DEATH_CONTEND int toindex = CONNECT_getJoinpartycharaindex( fd, 0); if(CHAR_getInt(toindex,CHAR_PKLISTTEAMNUM) == -1 && CHAR_getInt(charaindex,CHAR_PKLISTTEAMNUM) == -1){ }else if( CHAR_getInt( charaindex, CHAR_PKLISTLEADER ) > 0 || CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) < 0 || CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) < 0 || CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) != CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) || CHAR_getInt(toindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){ CHAR_talkToCli( charaindex, -1, "¶¤¥î¤£¦P¡AµLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW); result = FALSE; } #endif strcpy( msgbuf, "1\n©M½Ö²Õ¦¨¹Î¶¤©O¡H\n"); strlength = strlen( msgbuf); for( i = 0; CONNECT_getJoinpartycharaindex( fd,i ) != -1 && i< CONNECT_WINDOWBUFSIZE; i ++ ){ char *a = CHAR_getChar( CONNECT_getJoinpartycharaindex(fd,i) , CHAR_NAME); char buf[256]; snprintf( buf, sizeof( buf),"%s\n", a); if( strlength + strlen( buf) > arraysizeof( msgbuf)){ print( "%s:%dµøµ¡°T®§buffer¤£¨¬¡C\n", __FILE__,__LINE__); break; } strcpy( &msgbuf[strlength], buf); strlength += strlen(buf); } lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, WINDOW_BUTTONTYPE_CANCEL, CHAR_WINDOWTYPE_SELECTPARTY, -1, makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf))); } if( result != -1 ) { lssproto_PR_send( fd, 1, result); } return result; }
/** まわりに何かが起こったときに呼ばれる*/ void NPC_TimeManWatch( int meobjindex, int objindex, CHAR_ACTION act, int x,int y,int dir, int* opt,int optlen ) { int meindex=0; int index; LSTIME nowlstime; int born; int dead; if( OBJECT_getType( objindex) != OBJTYPE_CHARA) return; index = OBJECT_getIndex( objindex); /* プレイヤーにのみ反応する */ if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return; meindex = OBJECT_getIndex( meobjindex); born = CHAR_getWorkInt( meindex , E_INT_BORN ); dead = CHAR_getWorkInt( meindex , E_INT_DEAD ); // print("now_hour=%d",nowlstime.hour); /* 時間を見て状態を決める */ if(born < dead){ RealTimeToLSTime( NowTime.tv_sec, &nowlstime); if( (born < nowlstime.hour) && (dead > nowlstime.hour) ){ if(CHAR_getWorkInt(meindex,E_INT_NOWGRAPHIC) ==CHAR_getWorkInt( meindex, E_INT_GRAPHIC)) return; CHAR_setInt(meindex,CHAR_BASEIMAGENUMBER, CHAR_getWorkInt( meindex, E_INT_GRAPHIC)); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); CHAR_setWorkInt(meindex,E_INT_MODE,0); CHAR_setWorkInt(meindex,E_INT_NOWGRAPHIC, CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)); }else{ /*-消えている--*/ if(CHAR_getWorkInt(meindex,E_INT_NOWGRAPHIC) ==CHAR_getWorkInt( meindex, E_INT_GRAPHIC2)) return; CHAR_setInt(meindex,CHAR_BASEIMAGENUMBER, CHAR_getWorkInt( meindex, E_INT_GRAPHIC2)); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); CHAR_setWorkInt(meindex,E_INT_MODE,1); CHAR_setWorkInt(meindex,E_INT_NOWGRAPHIC, CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)); } }else{ RealTimeToLSTime( NowTime.tv_sec, &nowlstime); if( (born < nowlstime.hour && 1024 > nowlstime.hour) || ( 0 < nowlstime.hour && dead > nowlstime.hour) ){ if(CHAR_getWorkInt(meindex,E_INT_NOWGRAPHIC) ==CHAR_getWorkInt( meindex, E_INT_GRAPHIC)) return; CHAR_setInt(meindex,CHAR_BASEIMAGENUMBER, CHAR_getWorkInt( meindex, E_INT_GRAPHIC)); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); CHAR_setWorkInt(meindex,E_INT_MODE,0); CHAR_setWorkInt(meindex,E_INT_NOWGRAPHIC, CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)); }else{ if(CHAR_getWorkInt(meindex,E_INT_NOWGRAPHIC) ==CHAR_getWorkInt( meindex, E_INT_GRAPHIC2)) return; CHAR_setInt(meindex,CHAR_BASEIMAGENUMBER, CHAR_getWorkInt( meindex, E_INT_GRAPHIC2)); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); CHAR_setWorkInt(meindex,E_INT_MODE,1); CHAR_setWorkInt(meindex,E_INT_NOWGRAPHIC, CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)); } } }
void NPC_WelfareWindowTalked2( int meindex, int talkerindex, int seqno, int select, char *data) { int skill, i, j; int skillID = -1, skillid = -1; int ENDEV = -1, NOWEV = -1; char buf[64]; char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; char msg[512]; int fd = getfdFromCharaIndex( talkerindex ); double rate= 1.0; int skillarray; CHAR_HaveSkill* hskill; char err_msg[128] = {0}; if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { return; } if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ print("GetArgStrErr"); return; } if( NPC_Util_GetStrFromStrWithDelim( argstr, "ENDEV:", msg, sizeof( msg)) != NULL){ ENDEV=atof(msg); } if( NPC_Util_GetStrFromStrWithDelim( argstr, "NOWEV:", msg, sizeof( msg)) != NULL){ NOWEV=atof(msg); } if( NPC_Util_GetStrFromStrWithDelim( argstr, "err_msg:", err_msg, sizeof( msg)) == NULL){ print("GetArgStrErr"); return; } if( ENDEV > 0 ){ if( NPC_EventCheckFlg( talkerindex, ENDEV ) != TRUE ){ CHAR_talkToCli( talkerindex, -1, err_msg, CHAR_COLORYELLOW); return; } }else if( NOWEV > 0 ){ if( NPC_EventCheckFlg( talkerindex, NOWEV ) != TRUE ){ CHAR_talkToCli( talkerindex, -1, err_msg, CHAR_COLORYELLOW); return; } } makeStringFromEscaped( data); getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf)); skill=atoi(buf); // 技能id skillid = CHAR_getCharSkill( talkerindex, skill - 1 ); skillID = skillid; if(skillID <= 0) return ; if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ; if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){ rate = atof( msg); } // 不扣钱 CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); skillarray = PROFESSION_SKILL_getskillArray( skillID ); // 检查是否有不能删除的技能 for( i=0; i<CHAR_SKILLMAXHAVE; i++ ){ int limit = -1, skillid = -1, skillarray_temp = -1; // 技能ID skillid = CHAR_getCharSkill( talkerindex, i); if( skillid <= 0 ) continue; skillarray_temp = PROFESSION_SKILL_getskillArray( skillid ); for( j=0; j<4; j++){ limit = PROFESSION_SKILL_getInt( skillarray_temp, PROFESSION_SKILL_LIMIT1+j*2 ); if( limit > 0 && limit == skillID ){ char token[256] = {0}; sprintf( token, "需先遗忘%s,才可删除此技能", PROFESSION_SKILL_getChar( skillarray_temp, PROFESSION_SKILL_NAME ) ); CHAR_talkToCli( talkerindex, -1, token, CHAR_COLORYELLOW); return; } } } // 遗忘技能 { int skill_level = -1; int count = 0; int skill_id[CHAR_SKILLMAXHAVE] = {0}; int skill_temp[CHAR_SKILLMAXHAVE] = {0}; // 取熟练度 for( i=0; i<CHAR_SKILLMAXHAVE; i++ ){ int skillid = -1; // 技能ID skillid = CHAR_getCharSkill( talkerindex, i); // 不储存需遗忘的技能 if( skillid <= 0 || skillid == skillID ) continue; // 技能等级 hskill = CHAR_getCharHaveSkill( talkerindex, i ); skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); skill_id[count] = skillid; skill_temp[count] = skill_level; count++; } // 删除所有技能 CHAR_CHAT_DEBUG_delsk( talkerindex, "all" ); // 还原技能 for( i=0; i<count; i++ ){ PROFESSION_SKILL_ADDSK( talkerindex, skill_id[i], skill_temp[i] ); } CHAR_sendStatusString( talkerindex , "S"); NPC_Welfare_selectWindow2( meindex, talkerindex,0,-1); } // 传送讯息 { char token[256]; int next_profession_skill_point = 0; next_profession_skill_point = CHAR_getInt( talkerindex, PROFESSION_SKILL_POINT ) + 1; CHAR_setInt( talkerindex, PROFESSION_SKILL_POINT, next_profession_skill_point ); memset(token, -1, sizeof(token) ); sprintf( token, "您遗忘了 %s,剩馀学习点数增加一点" ,PROFESSION_SKILL_getChar( skillarray, PROFESSION_SKILL_NAME ) ); CHAR_talkToCli( talkerindex, -1, token, CHAR_COLORYELLOW); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( talkerindex , CHAR_WORKOBJINDEX )); } }
int CHAR_die( int charaindex ) { CHAR_DischargeParty( charaindex, 0); { int bymonster = 0; int attackindex = CHAR_getWorkInt(charaindex, CHAR_WORKLASTATTACKCHARAINDEX); if( attackindex == -2 ) bymonster = 0; else if( CHAR_CHECKINDEX(attackindex) == TRUE ) { if( CHAR_getInt(attackindex,CHAR_WHICHTYPE) == CHAR_TYPEENEMY ) { bymonster = 1; } else { bymonster = 2; } } if( bymonster == 0 || bymonster == 1 ) { int i; for( i=0 ; i<CHAR_EQUIPPLACENUM ; i++ ) CHAR_DropItem(charaindex,i); } else { int eqindex[CHAR_EQUIPPLACENUM]; int itemhavenum=0; int i; for( i=0 ; i<CHAR_EQUIPPLACENUM ; i++ ) if( ITEM_CHECKINDEX(CHAR_getItemIndex(charaindex,i)) ) eqindex[itemhavenum++] = i; if( itemhavenum >= 1 ) { int randomindex = RAND(0,itemhavenum-1); CHAR_DropItem(charaindex,eqindex[randomindex]); } } CHAR_DropMoney(charaindex, CHAR_getInt(charaindex,CHAR_GOLD)/2 ); CHAR_setInt(charaindex,CHAR_GOLD,0); } CHAR_complianceParameter(charaindex); CHAR_sendCToArroundCharacter( CHAR_getWorkInt(charaindex, CHAR_WORKOBJINDEX) ); CHAR_setInt(charaindex,CHAR_DEADCOUNT, CHAR_getInt(charaindex,CHAR_DEADCOUNT)+1); { int i; BOOL old=FALSE; for( i=0 ; i<arraysizeof(pShow); i++) if( CHAR_setInt( charaindex, pShow[i].paramindex, 0 ) > 0 ) { old = TRUE; } if( CHAR_setInt( charaindex, CHAR_POISON, 0 ) > 0 )old=TRUE; if( old ) CHAR_sendCToArroundCharacter( CHAR_getInt(charaindex, CHAR_WORKOBJINDEX)); } CHAR_sendStatusString( charaindex, "P"); CHAR_sendStatusString( charaindex, "I"); CHAR_setFlg(charaindex,CHAR_ISDIE,1); CHAR_setFlg(charaindex,CHAR_ISATTACKED,0); return 0; }
int MAGIC_Metamo( int charaindex, int toindex, int marray, int mp ) { int battlemode, haveindex, power, i; char msg[128]; if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE; battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); // ¾ô ·°ï§ÁÝ·´ ÷»ÔÊÔ if( battlemode == BATTLE_CHARMODE_INIT ) { return FALSE; } // ¾ô ·ÖÔÈÐ×ÈÕ if( IsBATTLING( charaindex ) == TRUE ) { //MAGIC_Recovery_Battle( charaindex, toindex, marray, mp ); //return FALSE; toindex = BATTLE_No2Index( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toindex ); //print(" battle_metamo:%d ", toindex); } if( CHAR_CHECKINDEX( toindex ) == FALSE ) return FALSE; if( CHAR_getInt( charaindex, CHAR_RIDEPET ) != -1 ) { CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬Æï³ËÖв»ÄܱäÉí£¡", CHAR_COLORWHITE ); return FALSE; } #ifdef _FIX_METAMORIDE if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ) { CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬´î³ËÖв»ÄܱäÉí£¡", CHAR_COLORYELLOW ); return FALSE; } #else if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == 100259 ) { CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬´î³ËÖв»ÄܱäÉí£¡", CHAR_COLORWHITE ); return FALSE; } #endif #ifdef _FIXBUG_ATTACKBOW { int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM); if( ITEM_CHECKINDEX( armindex) == TRUE ) { int armtype = BATTLE_GetWepon( charaindex); if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW || armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG) { CHAR_talkToCli( charaindex, -1, "ʹÓÃÔ¶¾àÀëÎäÆ÷ÎÞ·¨±äÉí£¡", CHAR_COLORYELLOW ); return FALSE; } } } #endif haveindex = -1; for( i = 0; i < 5; i++ ) { if( CHAR_getCharPet( charaindex, i) == toindex ) { haveindex = i; break; } } if( haveindex == -1 && charaindex != toindex ) { CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬Ö»Äܱä³É×Ô¼ºµÄ³èÎ", CHAR_COLORWHITE ); return FALSE; } if( CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) == 100259 ) { CHAR_talkToCli( charaindex, -1, "²»ÄܱäÉí³É¼ÓÃÀ£¡", CHAR_COLORWHITE ); return FALSE; } power = atoi(MAGIC_getChar( marray, MAGIC_OPTION )); if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp ); CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_MP); if( toindex != charaindex ) { CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec +power); sprintf( msg, "±äÉí³É%s£¡", CHAR_getChar( toindex, CHAR_NAME) ); } else { CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0); sprintf( msg, "±ä»Ø×Ô¼º£¡"); } CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORWHITE ); CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) ); CHAR_complianceParameter( charaindex); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); //#endif return TRUE; }
int NPC_NPCEnemy_Dying( int battleindex, int meindex ) { char argstr1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *argstr; char buf[64]; int i,toindex=-1; int tmp=-1; if( !CHAR_CHECKINDEX( meindex)) { return FALSE; } argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1)); #ifdef _NEW_WARPMAN if( strstr( argstr, "NEWNPCENEMY") ) { }else { #endif /* 蠅 及陲太 */ if( NPC_Util_GetStrFromStrWithDelim( argstr, "endmsg", buf, sizeof( buf)) != NULL ) { for( i = 0; i < 5; i ++ ) { /* 爵 卞輔笛仄化中月蟈夠卞丟永本□斥 */ int toindex = BattleArray[battleindex].Side[0].Entry[i].charaindex; if( CHAR_CHECKINDEX( toindex) ) { CHAR_talkToCli( toindex, meindex ,buf , CHAR_COLORYELLOW ); } } } #ifdef _NEW_WARPMAN } #endif if( NPC_Util_GetStrFromStrWithDelim( argstr, "steal", buf, sizeof( buf)) != NULL ) { print("\n steal TRUE !!"); if( atoi( buf) == 1 ) { int charaindex = BattleArray[battleindex].Side[0].Entry[0].charaindex; NPC_NPCEnemy_StealItem( argstr, meindex, charaindex); } } #ifdef _ALLDOMAN // (不可開) Syu ADD 排行榜NPC if( NPC_Util_GetStrFromStrWithDelim( argstr, "herobattlefield", buf, sizeof( buf)) != NULL ) { int charaindex = BattleArray[battleindex].Side[0].Entry[0].charaindex; CHAR_setWorkInt ( charaindex , CHAR_WORKHEROFLOOR , atoi ( buf ) ) ; // Syu ADD if ( atoi ( buf ) > CHAR_getInt ( charaindex , CHAR_HEROFLOOR ) ) CHAR_setInt ( charaindex , CHAR_HEROFLOOR , atoi( buf ) ) ; } #endif tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "dieact"); if( tmp != 1 ) tmp = 0; CHAR_setWorkInt( meindex, CHAR_WORK_DIEACT, tmp); if( CHAR_getWorkInt( meindex, CHAR_WORK_DIEACT) == 0 ) { Char *ch; CHAR_setInt( meindex, CHAR_BASEIMAGENUMBER, 0); print("bbi---->bi10"); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); CHAR_setWorkInt( meindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_ALTERRATIVE); MAP_sendAroundMapdata( CHAR_getInt( meindex, CHAR_FLOOR), CHAR_getInt( meindex, CHAR_X), CHAR_getInt( meindex, CHAR_Y)); ch = CHAR_getCharPointer( meindex); if( ch != NULL ) { strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, sizeof( ch->charfunctable[CHAR_LOOPFUNC]), "NPCEnemyLoop"); CHAR_constructFunctable( meindex); CHAR_setInt( meindex, CHAR_LOOPINTERVAL, 5000); CHAR_setWorkInt( meindex, CHAR_WORK_DIETIME, NowTime.tv_sec); }else { print( "NPCENEMY:err\n"); } }else { for( i = 0; i < 5; i ++ ) { toindex = BattleArray[battleindex].Side[0].Entry[i].charaindex; if( CHAR_CHECKINDEX( toindex) ) { #ifdef _NEW_WARPMAN if( strstr( argstr, "NEWNPCENEMY") ) { BOOL Party=TRUE; if( NPC_NPCEnemy_CheckFree( meindex, toindex , &Party) == FALSE ) { continue; } if( Party == TRUE ) { }else { if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ) { if( NPC_WarpAllMsg( meindex, toindex ) == TRUE ) { return TRUE; } } continue; } } CHAR_DischargeParty( toindex, 0); // 拆隊 CHAR_warpToSpecificPoint( toindex, CHAR_getWorkInt( meindex, CHAR_WORK_WARP_FLOOR), CHAR_getWorkInt( meindex, CHAR_WORK_WARP_X), CHAR_getWorkInt( meindex, CHAR_WORK_WARP_Y) ); #else CHAR_warpToSpecificPoint( toindex, CHAR_getWorkInt( meindex, CHAR_WORK_WARP_FLOOR), CHAR_getWorkInt( meindex, CHAR_WORK_WARP_X), CHAR_getWorkInt( meindex, CHAR_WORK_WARP_Y) ); #endif #ifdef _NPC_REPLACEMENT Check_EnemyWarpMe( meindex, argstr); #endif } } } return TRUE; }
int MAGIC_Metamo( int charaindex, int toindex, int marray, int mp ) { int battlemode, haveindex, power, i; char msg[128]; if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE; battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); // 爵 釩銨凜反 骰允月 if( battlemode == BATTLE_CHARMODE_INIT ){ return FALSE; } // 爵 分勻凶日 if( IsBATTLING( charaindex ) == TRUE ){ //MAGIC_Recovery_Battle( charaindex, toindex, marray, mp ); //return FALSE; toindex = BATTLE_No2Index( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toindex ); //print(" battle_metamo:%d ", toindex); } if( CHAR_CHECKINDEX( toindex ) == FALSE ) return FALSE; if( CHAR_getInt( charaindex, CHAR_RIDEPET ) != -1 ){ CHAR_talkToCli( charaindex, -1, "無法變身,騎乘中不能變身!", CHAR_COLORWHITE ); return FALSE; } #ifdef _FIX_METAMORIDE if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ){ CHAR_talkToCli( charaindex, -1, "無法變身,搭乘中不能變身!", CHAR_COLORYELLOW ); return FALSE; } #else if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == 100259 ){ CHAR_talkToCli( charaindex, -1, "無法變身,搭乘中不能變身!", CHAR_COLORWHITE ); return FALSE; } #endif #ifdef _FIXBUG_ATTACKBOW { int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM); if( ITEM_CHECKINDEX( armindex) == TRUE ) { int armtype = BATTLE_GetWepon( charaindex); if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW || armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG) { CHAR_talkToCli( charaindex, -1, "使用遠距離武器無法變身!", CHAR_COLORYELLOW ); return FALSE; } } } #endif haveindex = -1; for( i = 0; i < 5; i++ ) { if( CHAR_getCharPet( charaindex, i) == toindex ) { haveindex = i; break; } } if( haveindex == -1 && charaindex != toindex ) { CHAR_talkToCli( charaindex, -1, "無法變身,只能變成自己的寵物!", CHAR_COLORWHITE ); return FALSE; } if( CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) == 100259 ){ CHAR_talkToCli( charaindex, -1, "不能變身成加美!", CHAR_COLORWHITE ); return FALSE; } power = atoi(MAGIC_getChar( marray, MAGIC_OPTION )); if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp ); CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_MP); if( toindex != charaindex ) { CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec +power); sprintf( msg, "變身成%s!", CHAR_getChar( toindex, CHAR_NAME) ); } else { CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0); sprintf( msg, "變回自己!"); } CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORWHITE ); CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) ); CHAR_complianceParameter( charaindex); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); //#endif return TRUE; }
static void NPC_NewNpcMan_selectWindow( int meindex, int toindex, int num, int flg) { char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; char token[256]; int buttontype = 0, windowtype = 0, windowno = 0; int fd = getfdFromCharaIndex( toindex); windowtype = WINDOW_MESSAGETYPE_MESSAGE; if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) return; } memset( npcarg, 0, sizeof( npcarg)); if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ return; } memset( token, 0, sizeof( token)); switch( num) { case WINDOW_START: if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { return; } buttontype = WINDOW_BUTTONTYPE_YESNO; windowno = NPC_PROGRAMEGINEER_DEFIND; break; case WINDOW_SELECT1: sprintf(token," ÇëÑ¡Ôñ" "\n ¡¶ÐÞÕý³èÎïÒì³£¡·" "\n ¡¶ÐÞÕý³èÎïͼºÅ¡·" "\n ¡¶¸ü»»ÁéÁ¦îø¡·" #ifdef _PET_LOSTPET "\n ¡¶Áì»ØÒÅʧ³èÎï¡·" #endif // "\n ¡¶»¹ÔÌúǹÈþ¶Ñµþ¡·" ); windowtype = WINDOW_MESSAGETYPE_SELECT; buttontype = WINDOW_BUTTONTYPE_CANCEL; windowno = NPC_PROGRAMEGINEER_SELECT2; break; case WINDOW_SELECT2: switch( flg){ case 1://ÐÞÕý³èÎïÒì³£ NPC_reCheckMyPetUnusual( meindex, toindex); CHAR_talkToCli( toindex, -1, "ÉíÉϳèÎï¼ì²éÍê±Ï!", CHAR_COLORYELLOW); return; break; case 2://ÐÞÕý³èÎïͼºÅ CHECK_PETBBI( toindex); return; break; case 3://¸ü»»ÁéÁ¦îø if( CHECK_ITEMEQUIT( toindex) == TRUE ){ CHAR_talkToCli( toindex, -1, "¼ì²éÍê±Ï!", CHAR_COLORYELLOW); } return; break; case 4: #ifdef _PET_LOSTPET if( NPC_reFindMyLostPet( meindex, toindex, token) == FALSE ){ CHAR_talkToCli( toindex, -1, "²éÎÞ×ÊÁÏ£¡", CHAR_COLORYELLOW); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; buttontype = WINDOW_BUTTONTYPE_CANCEL; windowno = NPC_PROGRAMEGINEER_SELECTLOSTPET; #endif break; case 5: //»¹ÔÌúǹÈþ¶Ñµþ // NPC_reCheckItemPilenum( meindex, toindex); return; break; } break; /* case WINDOW_SELECT3: { int petnum, petindex; petnum = atoi( data)-1; if( petnum >= CHAR_MAXPETHAVE || petnum < 0 ) return; petindex = CHAR_getCharPet( talker, petsel); if( !CHAR_CHECKINDEX(petindex) ) return; break; } */ case WINDOW_SELECTLOSTPET: #ifdef _PET_LOSTPET { int ret, i, ti, ltime, cost; Char ch; char msgbuf[256]; char petstring1[2048]; int havepetelement = CHAR_getCharPetElement( toindex); ti = flg; if( havepetelement < 0 ){ CHAR_talkToCli( toindex, -1, "³èÎïÀ¸Î»ÒÑÂú£¡", CHAR_COLORYELLOW); return; } if( NPC_getLostPetString( meindex, toindex) == FALSE ) { CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW); return; } if( getStringFromIndexWithDelim( petstring[ti-1], "#", 2, petstring1, sizeof( petstring1)) == FALSE ){ CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW); return; }else{ char buf1[256]; if( getStringFromIndexWithDelim( petstring[ti-1], "|", 6, buf1, sizeof( buf1)) == FALSE ) return; ltime = atoi(buf1); ltime = time( NULL) - ltime; ltime = ltime/(60*60*24); if( getStringFromIndexWithDelim( petstring[ti-1], "|", 4, buf1, sizeof( buf1)) == FALSE ) return; cost = atoi( buf1); #if 0 // ÐÞÕý±£Êͽð cost = cost + (ltime*100); cost = (cost>10000)?10000:cost; #else cost = cost + (ltime*10000); #endif if( CHAR_getInt( toindex, CHAR_GOLD) < cost ) { sprintf( buf1, "³èÎïÒѼķÅ%dÌ죬¹²Ðè%dʯ±Ò²Å¿ÉÁì»Ø¡£", ltime, cost); CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); return; } } ret = CHAR_makePetFromStringToArg( petstring1, &ch, -2); strcpy( petstring[ti-1], ""); if( ret ) { char buf1[256]; int petindex = PET_initCharOneArray( &ch ); if( !CHAR_CHECKINDEX( petindex) ){ CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW); return; } print("ANDY petindex:%d[%s]\n", petindex, CHAR_getChar( petindex, CHAR_NAME) ); CHAR_complianceParameter( petindex ); CHAR_setInt( petindex, CHAR_HP, CHAR_getWorkInt( petindex, CHAR_WORKMAXHP)); CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, toindex); CHAR_setCharPet( toindex, havepetelement, petindex); CHAR_setChar( petindex, CHAR_OWNERCDKEY, CHAR_getChar( toindex, CHAR_CDKEY)); CHAR_setChar( petindex, CHAR_OWNERCHARANAME, CHAR_getChar( toindex, CHAR_NAME)); if( NPC_backupLostPetString( toindex) == FALSE ){ print("ANDY err backup petstring !!\n"); return; } sprintf( buf1, "LostPGet:%d", cost); LogPet( CHAR_getChar( toindex, CHAR_NAME ), CHAR_getChar( toindex, CHAR_CDKEY ), CHAR_getChar( petindex, CHAR_NAME), CHAR_getInt( petindex, CHAR_LV), buf1, CHAR_getInt( toindex,CHAR_FLOOR), CHAR_getInt( toindex,CHAR_X ), CHAR_getInt( toindex,CHAR_Y ), CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 ); sprintf( buf1, "ÁìÈ¡³èÎï%s¡£", CHAR_getUseName( petindex)); CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); for( i = 0; i < CHAR_MAXPETHAVE; i++){ int petindex = CHAR_getCharPet( toindex, i); if( !CHAR_CHECKINDEX( petindex) ) continue; CHAR_complianceParameter( petindex ); snprintf( msgbuf, sizeof( msgbuf ), "K%d", i ); CHAR_sendStatusString( toindex, msgbuf ); snprintf( msgbuf, sizeof( msgbuf ), "W%d", i ); CHAR_sendStatusString( toindex, msgbuf ); } CHAR_DelGold( toindex, cost); }else{ CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW); return; } return; } #endif return; break; case WINDOW_DEFIND: { int i; int face = CHAR_getInt( toindex, CHAR_FACEIMAGENUMBER); if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECK_MSG", token, sizeof( token) ) == NULL) { return; } for( i=0; i<48; i++){ if( face >= checkPc[i][0] && face < checkPc[i][1] ) break; } if( i >= 48 )return; CHAR_setWorkInt( toindex, CHAR_WORKNPCMETAMO, meindex); CHAR_setInt( toindex, CHAR_BASEIMAGENUMBER, checkPc[i][2]); CHAR_complianceParameter( toindex ); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); buttontype = WINDOW_BUTTONTYPE_YESNO; windowno = NPC_PROGRAMEGINEER_END; } break; case WINDOW_END: { CHAR_setWorkInt( toindex, CHAR_WORKNPCMETAMO, -1); CHAR_setInt( toindex, CHAR_BASEBASEIMAGENUMBER, CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) ); CHAR_complianceParameter( toindex ); CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); return; } break; } lssproto_WN_send( fd, windowtype, buttontype, windowno, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); }
int NPC_Lua_NLG_UpChar(lua_State *_NLL) { CheckEx(_NLL, 1); CheckIndexNull(_NLL, 1); int TM_Index = (int)lua_tointeger(_NLL, 1); if(!CHAR_CHECKINDEX(TM_Index)) { LRetErrInt(_NLL, -1, "传入的索引是无效的。"); } CHAR_complianceParameter( TM_Index ); if(CHAR_getInt(TM_Index,CHAR_WHICHTYPE)==CHAR_TYPEPET){ int playindex = CHAR_getWorkInt(TM_Index,CHAR_WORKPLAYERINDEX); if(!CHAR_CHECKINDEX(playindex)){ LRetErrInt(_NLL, -1, "传入的索引是无效的。"); }else{ int i; for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { int workindex = CHAR_getCharPet( playindex, i ); if( workindex == TM_Index ){ CHAR_send_K_StatusString( playindex, i, CHAR_K_STRING_BASEIMAGENUMBER| CHAR_K_STRING_HP| CHAR_K_STRING_MAXHP| CHAR_K_STRING_MP| CHAR_K_STRING_MAXMP| CHAR_K_STRING_EXP| CHAR_K_STRING_NEXTEXP| CHAR_K_STRING_LV| CHAR_K_STRING_ATK| CHAR_K_STRING_DEF| CHAR_K_STRING_QUICK| CHAR_K_STRING_AI| CHAR_K_STRING_EARTH| CHAR_K_STRING_WATER| CHAR_K_STRING_FIRE| CHAR_K_STRING_WIND| CHAR_K_STRING_SLOT| CHAR_K_STRING_CHANGENAMEFLG| CHAR_K_STRING_NAME| CHAR_K_STRING_USERPETNAME); char msgbuf[128]; snprintf( msgbuf, sizeof( msgbuf ), "W%d",i); CHAR_sendStatusString( playindex, msgbuf ); CHAR_sendStatusString( playindex, "P"); break; } } } }else if(CHAR_getInt(TM_Index,CHAR_WHICHTYPE)==CHAR_TYPEPLAYER){ CHAR_send_P_StatusString( TM_Index, CHAR_P_STRING_GOLD ); } if(CHAR_getFlg(TM_Index, CHAR_ISVISIBLE) == FALSE) { int TM_objindex = CHAR_getWorkInt(TM_Index,CHAR_WORKOBJINDEX); CHAR_sendCDArroundChar ( OBJECT_getFloor(TM_objindex), OBJECT_getX(TM_objindex), OBJECT_getY(TM_objindex), TM_objindex ); }else { CHAR_sendCToArroundCharacter( CHAR_getWorkInt( TM_Index , CHAR_WORKOBJINDEX )); } LRetNull(_NLL); }