/*------------------------------------------------------------ * 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; if( CHAR_getFlg(index,CHAR_ISFLYING) ) /* 氏匹月支勾卞反窒手仄卅中 */ return; if( !MAP_getMapDataFromCharIndex( index , map ) ) return; for( i = 0 ; i < 2 ; i ++ ){ /* damage */ int damage; 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( damaged ) CHAR_sendStatusString(index,"M"); }
BOOL NPC_Util_moveItemToMap( int itemindex , int fl , int x , int y, BOOL net ) { int oind,cind; if( !ITEM_CHECKINDEX( itemindex ) ) return FALSE; oind = ITEM_getWorkInt( itemindex , ITEM_WORKOBJINDEX ); cind = ITEM_getWorkInt( itemindex , ITEM_WORKCHARAINDEX ); if( oind >= 0 ){ return MAP_objmove( oind , OBJECT_getFloor(oind), OBJECT_getX(oind), OBJECT_getY(oind), fl,x,y); } else if( cind >= 0 ){ int itemindexinchara = NPC_Util_SearchItemInChar(cind,itemindex); if( itemindexinchara == -1 ) return FALSE; CHAR_setItemIndex( cind , itemindexinchara , -1 ); CHAR_complianceParameter(cind); if( net ) CHAR_sendItemDataOne( cind, itemindexinchara); if( CHAR_DropItemAbsolute( itemindex, fl,x,y,TRUE) < 0 ){ return FALSE; } else { return TRUE; } } return FALSE; }
/*-- --*/ void NPC_CharmUp(int meindex,int talker) { int cost; int i; int petindex; char petsend[64]; /*--云嗯毛蛹日仄引仄斤丹--*/ cost = NPC_CharmCost( meindex, talker); CHAR_setInt( talker, CHAR_GOLD, CHAR_getInt( talker, CHAR_GOLD) - cost); CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); /*-- 互ㄠㄟㄟ动晓卞卅月桦宁反雄娄卞ㄠㄟㄟ卞允月--*/ if(CHAR_getInt( talker, CHAR_CHARM) + CHARMHEAL >= 100) { CHAR_setInt( talker, CHAR_CHARM, 100); }else{ /*-- 毛本永玄--*/ CHAR_setInt(talker, CHAR_CHARM, (CHAR_getInt( talker, CHAR_CHARM) + CHARMHEAL)); } /*--旦 □正旦及凳蕙--*/ CHAR_complianceParameter( talker ); CHAR_send_P_StatusString( talker, CHAR_P_STRING_CHARM); /*--矢永玄及由仿丢□正毛凳蕙--*/ for( i = 0 ; i < CHAR_MAXPETHAVE ; i++){ petindex = CHAR_getCharPet( talker, i); if( petindex == -1 ) continue; /* 平乓仿及 民尼永弁 */ if( !CHAR_CHECKINDEX( talker ) ) continue; /*--由仿丢□正譬帮--*/ CHAR_complianceParameter( petindex ); sprintf( petsend, "K%d", i ); CHAR_sendStatusString( talker , petsend ); } }
void NPC_reCheckMyPetUnusual( int meindex, int toindex)//¼ì²é³èÎïÒì³£ { char *buf=NULL; int petindex,i; for( i=0; i<CHAR_MAXPETHAVE; i++) { petindex = CHAR_getCharPet( toindex, i); if( !CHAR_CHECKINDEX( petindex) )continue; if( (buf=CHAR_getChar( petindex, CHAR_NAME)) == NULL || strlen( buf) <= 0 ){ char *PetNAME; int array, parry, petID; petID = CHAR_getInt( petindex, CHAR_PETID); array = ENEMY_getEnemyArrayFromTempNo( petID); if( !ENEMY_CHECKINDEX( array)){ print("ANDY Pet(ID:%d) err Array:%d (file:%s %d) !! \n", petID, array, __FILE__, __LINE__ ); continue; } parry = ENEMYTEMP_getEnemyTempArray( array); if( (PetNAME = ENEMYTEMP_getChar( parry, E_T_NAME)) == NULL || strlen( PetNAME) <= 0 ){ print("ANDY Pet(ID:%d) Array:%d err Name:%s (file:%s %d) !! \n", petID, array, (PetNAME==NULL)?"NULL":PetNAME, __FILE__, __LINE__ ); continue; } char tempname[128]; if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*")!=NULL) sprintf(tempname,"*%s",ENEMYTEMP_getChar( parry, E_T_NAME)); else sprintf(tempname,"%s",ENEMYTEMP_getChar( parry, E_T_NAME)); CHAR_setChar( petindex, CHAR_NAME, tempname); CHAR_setChar( petindex, CHAR_USERPETNAME , ""); //andy_log print("ANDY Pet(ID:%d) Name -> %s (%s:%s)(file:%s %d) !! \n", petID, PetNAME, CHAR_getUseName( toindex), CHAR_getChar( toindex, CHAR_CDKEY), __FILE__, __LINE__ ); } } for( i=0; i<CHAR_MAXPETHAVE; i++){ char szPet[256]; petindex = CHAR_getCharPet(toindex, i); if( !CHAR_CHECKINDEX( petindex) )continue; CHAR_complianceParameter( petindex ); snprintf( szPet, sizeof( szPet ), "K%d", i); CHAR_sendStatusString( toindex, szPet ); snprintf( szPet, sizeof( szPet ), "W%d", i); CHAR_sendStatusString( toindex, szPet ); } }
BOOL CHECK_PETBBI( int toindex) { int i, petindex, PetID; BOOL Finds = FALSE; char token[256]; for( i=0; i < CHAR_MAXPETHAVE; i++) { int parry, array, PetBBI; petindex = CHAR_getCharPet( toindex, i); if( !CHAR_CHECKINDEX( petindex) ) continue; PetID = CHAR_getInt( petindex, CHAR_PETID); array = ENEMY_getEnemyArrayFromTempNo( PetID); if( !ENEMY_CHECKINDEX( array)) continue; parry = ENEMYTEMP_getEnemyTempArray( array); PetBBI = ENEMYTEMP_getInt( parry, E_T_IMGNUMBER); if( CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER) != PetBBI || CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER) != PetBBI ){ CHAR_setInt( petindex, CHAR_BASEBASEIMAGENUMBER, PetBBI); CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, PetBBI); sprintf( token, "ÐÞÕý%sͼºÅ", CHAR_getUseName( petindex)); CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); Finds = TRUE; } CHAR_setInt( petindex, CHAR_EARTHAT, ENEMYTEMP_getInt( parry, E_T_EARTHAT) ); CHAR_setInt( petindex, CHAR_WATERAT, ENEMYTEMP_getInt( parry, E_T_WATERAT) ); CHAR_setInt( petindex, CHAR_FIREAT, ENEMYTEMP_getInt( parry, E_T_FIREAT) ); CHAR_setInt( petindex, CHAR_WINDAT, ENEMYTEMP_getInt( parry, E_T_WINDAT) ); char tempname[128]; if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*")!=NULL) sprintf(tempname,"*%s",ENEMYTEMP_getChar( parry, E_T_NAME)); else sprintf(tempname,"%s",ENEMYTEMP_getChar( parry, E_T_NAME)); CHAR_setChar( petindex, CHAR_NAME, tempname); CHAR_setChar( petindex, CHAR_USERPETNAME , ""); } for( i=0; i<CHAR_MAXPETHAVE; i++){ char szPet[128]; petindex = CHAR_getCharPet(toindex, i); if( !CHAR_CHECKINDEX( petindex) )continue; CHAR_complianceParameter( petindex ); snprintf( szPet, sizeof( szPet ), "K%d", i); CHAR_sendStatusString( toindex, szPet ); snprintf( szPet, sizeof( szPet ), "W%d", i); CHAR_sendStatusString( toindex, szPet ); } if( Finds == FALSE ){ sprintf( token, "ûÓдíÎóͼºÅµÄ³èÎï"); CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); } return Finds; }
BOOL NPC_Util_moveItemToChar(int charindex, int itemindex, BOOL net) { int emptyindex, oind, cind; emptyindex = CHAR_findEmptyItemBox(charindex); if (emptyindex < 0) return FALSE; if (!ITEM_CHECKINDEX(itemindex)) return FALSE; oind = ITEM_getWorkInt(itemindex, ITEM_WORKOBJINDEX); cind = ITEM_getWorkInt(itemindex, ITEM_WORKCHARAINDEX); if (oind >= 0) { CHAR_ObjectDelete(oind); CHAR_setItemIndex(charindex, emptyindex, itemindex); ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX, -1); ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, charindex); if (net) CHAR_sendItemDataOne(charindex, emptyindex); return TRUE; } else if (cind >= 0) { int itemgrp[2]; int itemindexinchara; if (cind == charindex) return FALSE; itemindexinchara = NPC_Util_SearchItemInChar(cind, itemindex); if (itemindexinchara == -1) return FALSE; CHAR_setItemIndex(cind, itemindexinchara, -1); CHAR_complianceParameter(cind); itemgrp[0] = itemindexinchara; CHAR_setItemIndex(charindex, emptyindex, itemindex); itemgrp[1] = emptyindex; if (net) CHAR_sendItemData(charindex, itemgrp, arraysizeof(itemgrp)); ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX, -1); ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, charindex); return TRUE; } return FALSE; }
/* * 地形におかれているもしくはキャラがもっているアイテム * を強制的に地形のある地点に置く。 * * int itemindex : アイテム表への index * int fl,x,y : 位置。 * BOOL net: ネットワークの処理をするかどうか * 返り値は FALSE : 失敗 TRUE : 成功 */ BOOL NPC_Util_moveItemToMap( int itemindex , int fl , int x , int y, BOOL net ) { int oind,cind; if( !ITEM_CHECKINDEX( itemindex ) ) return FALSE; oind = ITEM_getWorkInt( itemindex , ITEM_WORKOBJINDEX ); cind = ITEM_getWorkInt( itemindex , ITEM_WORKCHARAINDEX ); if( oind >= 0 ){ /* 地形におかれている場合は単に位置を変更 */ return MAP_objmove( oind , OBJECT_getFloor(oind), OBJECT_getX(oind), OBJECT_getY(oind), fl,x,y); } else if( cind >= 0 ){ /* キャラがもっている */ int itemindexinchara = NPC_Util_SearchItemInChar(cind,itemindex); if( itemindexinchara == -1 ) return FALSE; /* キャラがもっていないようにする */ CHAR_setItemIndex( cind , itemindexinchara , -1 ); if( itemindexinchara == CHAR_ARM1 && CHAR_getItemIndex( cind,CHAR_ARM2 )== -2){ CHAR_setItemIndex(cind,CHAR_ARM2,-1); } CHAR_complianceParameter(cind); if( net ) CHAR_sendStatusString( cind,"I"); /* アイテムindexから直接起く */ if( CHAR_DropItemAbsolute( itemindex, fl,x,y,TRUE) < 0 ){ return FALSE; } else { return TRUE; } } return FALSE; }
/*------------------------------------------------------------ * 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_WarpManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; char buf[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; #ifdef _NEW_WARPMAN BOOL checkp=TRUE; char buf1[1024]; int talkNo = 1; BOOL tenflg=FALSE; #else int fl,x,y; #endif char buff2[256]; int fd = getfdFromCharaIndex( talkerindex ); if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) return; if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ print("GetArgStrErr"); return ; } if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) < 1 ) { CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); return; } #ifdef _NEW_WARPMAN if( seqno == NEW_WARPMAN ) { int eqnum=0; eqnum = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT); sprintf(buf1,"%s", "NOFREE"); if( eqnum >= 0 ) { sprintf(buf1,"TALKEVENT%d", eqnum); } CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); while( getStringFromIndexWithDelim( npcarg,"OVER",talkNo,buf,sizeof( buf)) != FALSE){ if( strstr(buf, buf1) != NULL) { strcpy( npcarg , buf); tenflg = TRUE; break; } talkNo++; } if( tenflg == FALSE ) { CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); return; } }else { #endif if( select != WINDOW_BUTTONTYPE_YES ) { CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); return; } if(NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE){ NPC_ERR_DiSP( meindex, talkerindex, 1); return; } #ifdef _NEW_WARPMAN } #else NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf)); GetRand_WarpPoint( buf, &fl, &x, &y ); #endif #ifdef _NEW_WARPMAN switch( seqno) { case WARP_MAN: if( select != WINDOW_BUTTONTYPE_YES ) return; if( NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE ){ NPC_ERR_DiSP( meindex, talkerindex, 1); return; } #else if( select != WINDOW_BUTTONTYPE_YES) return; if( NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE) return; #endif #ifdef _NEW_WARPMAN break; case NEW_WARPMAN: if( select != WINDOW_BUTTONTYPE_YES ){ CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CancelMsg", buff2, sizeof( buff2) ) != NULL) { CHAR_talkToCli( talkerindex, meindex, buff2, CHAR_COLORYELLOW); } return; } checkp=TRUE; if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECKPARTY", buff2, sizeof( buff2) ) != NULL) { if( strstr( buff2, "FALSE") != NULL ) { checkp = FALSE; } } if( checkp==TRUE && NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE ) { NPC_ERR_DiSP( meindex, talkerindex, 1); CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); return; } break; case NEW_WARPMAN_END: return; break; } #endif if( Action_RunDoEventAction( meindex, talkerindex, npcarg) == FALSE ){ CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); return; } CHAR_complianceParameter( talkerindex ); CHAR_send_P_StatusString( talkerindex , CHAR_P_STRING_ATK|CHAR_P_STRING_DEF| CHAR_P_STRING_CHARM|CHAR_P_STRING_QUICK| CHAR_P_STRING_WATER|CHAR_P_STRING_FIRE| CHAR_P_STRING_WIND|CHAR_P_STRING_EARTH ); if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE){ return ; } if(CHAR_getWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTTRD) <= 0){ CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); #ifdef _NEW_WARPMAN NPC_WarpMsg( meindex, talkerindex, npcarg); #else if( fl == 0 && x == 0 && y == 0 ) { }else { CHAR_warpToSpecificPoint(talkerindex, fl, x,y); } #endif }else { if(CHAR_getInt(talkerindex,CHAR_GOLD) < CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)){ NPC_ERR_DiSP( meindex, talkerindex, 2); return ; } CHAR_DelGold( talkerindex, CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD )); CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); #ifdef _NEW_WARPMAN NPC_WarpMsg( meindex, talkerindex, npcarg); #else if( fl == 0 && x == 0 && y == 0 ) { }else { CHAR_warpToSpecificPoint(talkerindex, fl, x,y); } #endif } #ifdef _NEW_WARPMAN NPC_NpcWarpMsg( meindex, talkerindex, npcarg); #else }
//¸ü»»³èÎï BOOL CHECK_ReplacePET( int toindex) { int i, petindex; BOOL Finds = FALSE; char szPet[256]; if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) return FALSE; for( i=0; i<CHAR_MAXPETHAVE; i++) { int array, ret; petindex = CHAR_getCharPet( toindex, i); if( !CHAR_CHECKINDEX( petindex) )continue; if( CHAR_getInt( petindex, CHAR_PETID) != 1133 ) continue; if( CHAR_getInt( petindex, CHAR_SLOT) != 7 ) continue; if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION ) > 0 )continue; if( i == CHAR_getInt( toindex, CHAR_DEFAULTPET) ) { int fd = getfdFromCharaIndex( toindex); CHAR_setInt( toindex, CHAR_DEFAULTPET, -1); lssproto_KS_send( fd, -1, TRUE); } snprintf( szPet,sizeof( szPet), "½»³ö%s¡£", CHAR_getUseName( petindex) ); CHAR_talkToCli( toindex, -1, szPet, CHAR_COLORYELLOW); LogPet( CHAR_getChar( toindex, CHAR_NAME ), CHAR_getChar( toindex, CHAR_CDKEY ), CHAR_getChar( petindex, CHAR_NAME), CHAR_getInt( petindex, CHAR_LV), "TenseiDel", CHAR_getInt( toindex,CHAR_FLOOR), CHAR_getInt( toindex,CHAR_X ), CHAR_getInt( toindex,CHAR_Y ), CHAR_getChar( petindex, CHAR_UNIQUECODE) ); Finds = TRUE; CHAR_setCharPet( toindex, i, -1); CHAR_endCharOneArray( petindex ); array = ENEMY_getEnemyArrayFromTempNo( 1133); if( !ENEMY_CHECKINDEX( array)) continue; ret = ENEMY_createPetFromEnemyIndex( toindex, array); if( !CHAR_CHECKINDEX( ret ) ) continue; snprintf( szPet, sizeof( szPet), "Äõ½%s¡£", CHAR_getUseName( ret) ); CHAR_talkToCli( toindex, -1, szPet, CHAR_COLORWHITE); LogPet( CHAR_getChar( toindex, CHAR_NAME ), CHAR_getChar( toindex, CHAR_CDKEY ), CHAR_getChar( ret, CHAR_NAME), CHAR_getInt( ret, CHAR_LV), "TenseiGet", CHAR_getInt( toindex,CHAR_FLOOR), CHAR_getInt( toindex,CHAR_X ), CHAR_getInt( toindex,CHAR_Y ), CHAR_getChar( ret, CHAR_UNIQUECODE) ); } for( i=0; i<CHAR_MAXPETHAVE; i++){ petindex = CHAR_getCharPet(toindex, i); if( !CHAR_CHECKINDEX( petindex) )continue; CHAR_complianceParameter( petindex ); snprintf( szPet, sizeof( szPet ), "K%d", i); CHAR_sendStatusString( toindex, szPet ); snprintf( szPet, sizeof( szPet ), "W%d", i); CHAR_sendStatusString( toindex, szPet ); } return Finds; }
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); }
/*------------------------------------- 端卞覲菁 午竣 毛莢汊今六月午仇欠 ---------------------------------------*/ void NPC_WindowHealerAllHeal( int talker,int mode ) { int i; int petindex; char petsend[64]; char msgbuf[64]; /*--覲菁 及心莢汊--*/ if(mode==1){ /*--HP互覲菁 卅及匹丐月--*/ CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) ); }else if(mode==2){ /*--竣 及心莢汊--*/ /*--MP互竣 卅及匹丐月--*/ CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) ); }else if(mode==3){ /*--蟈莢汊---*/ CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) ); CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) ); } /*--矢永玄反雲引仃匹莢汊仄化丐僕月--*/ for(i=0;i<CHAR_MAXPETHAVE;i++){ petindex = CHAR_getCharPet(talker,i); if( petindex == -1 ) continue; /* 平乓仿及 民尼永弁 */ if( !CHAR_CHECKINDEX( talker ) ) continue; /*--莢汊--*/ CHAR_setFlg( petindex,CHAR_ISDIE,0 ); CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) ); CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) ); /*--由仿丟□正譬幫--*/ CHAR_complianceParameter( petindex ); sprintf( petsend, "K%d", i ); CHAR_sendStatusString( talker , petsend ); } /*--由仿丟□正霜曰--*/ CHAR_send_P_StatusString(talker,CHAR_P_STRING_HP); CHAR_send_P_StatusString(talker,CHAR_P_STRING_MP); /*---醮棉互中木壬醮棉卞手霜耨--*/ if(CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) { int topartyarray = -1; int oyaindex = CHAR_getWorkInt( talker , CHAR_WORKPARTYINDEX1); if( CHAR_CHECKINDEX( oyaindex )) { int i; /* 憤坌午慫仄凶支勾及醮棉及 及樺赭毛潸 */ for( i = 0; i < CHAR_PARTYMAX; i ++ ) { int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 +i); if( CHAR_CHECKINDEX( workindex) ) { if( workindex == talker ) { topartyarray = i; break; } } } for( i = 0; i < CHAR_PARTYMAX; i ++ ) { int otherindex = CHAR_getPartyIndex( talker, i); /* 醮棉由仿丟□正毛霜月 */ if( CHAR_CHECKINDEX( otherindex) ) { snprintf( msgbuf, sizeof( msgbuf), "N%d", topartyarray); if( otherindex != talker) { CHAR_sendStatusString( otherindex, msgbuf); } } } } } }
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; }
/*------------------------------------- ºÝ¤ËÂÑµ× ¤Èµ¤ ¤ò²óÉü¤µ¤»¤ë¤È¤³¤í ---------------------------------------*/ void NPC_WindowHealerAllHeal( int talker,int mode ) { int i; int petindex; char petsend[64]; char msgbuf[64]; /*--ÂÑµ× ¤Î¤ß²óÉü--*/ if(mode==1){ /*--HP¤¬ÂÑµ× ¤Ê¤Î¤Ç¤¢¤ë--*/ CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) ); }else if(mode==2){ /*--µ¤ ¤Î¤ß²óÉü--*/ /*--MP¤¬µ¤ ¤Ê¤Î¤Ç¤¢¤ë--*/ CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) ); }else if(mode==3){ /*--Á´²óÉü---*/ CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) ); CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) ); } /*--¥Ú¥Ã¥È¤Ï¶³¤Þ¤±¤Ç²óÉü¤·¤Æ¤¢¹²¤ë--*/ for(i=0;i<CHAR_MAXPETHAVE;i++){ petindex = CHAR_getCharPet(talker,i); if( petindex == -1 ) continue; /* ¥¥ã¥é¤Î ¥Á¥§¥Ã¥¯ */ if( !CHAR_CHECKINDEX( talker ) ) continue; /*--²óÉü--*/ CHAR_setFlg( petindex,CHAR_ISDIE,0 ); CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) ); CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) ); /*--¥Ñ¥é¥á¡¼¥¿Ä´À°--*/ CHAR_complianceParameter( petindex ); sprintf( petsend, "K%d", i ); CHAR_sendStatusString( talker , petsend ); } /*--¥Ñ¥é¥á¡¼¥¿Á÷¤ê--*/ CHAR_send_P_StatusString(talker,CHAR_P_STRING_HP); CHAR_send_P_StatusString(talker,CHAR_P_STRING_MP); /*---Ãç´Ö¤¬¤¤¤ì¤ÐÃç´Ö¤Ë¤âÁ÷¿®--*/ if(CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) { int topartyarray = -1; int oyaindex = CHAR_getWorkInt( talker , CHAR_WORKPARTYINDEX1); if( CHAR_CHECKINDEX( oyaindex )) { int i; /* ¼«Ê¬¤È¼£¤·¤¿¤ä¤Ä¤ÎÃç´Ö¤Î ¤Î¾ì½ê¤ò¼è */ for( i = 0; i < CHAR_PARTYMAX; i ++ ) { int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 +i); if( CHAR_CHECKINDEX( workindex) ) { if( workindex == talker ) { topartyarray = i; break; } } } for( i = 0; i < CHAR_PARTYMAX; i ++ ) { int otherindex = CHAR_getPartyIndex( talker, i); /* Ãç´Ö¥Ñ¥é¥á¡¼¥¿¤òÁ÷¤ë */ if( CHAR_CHECKINDEX( otherindex) ) { snprintf( msgbuf, sizeof( msgbuf), "N%d", topartyarray); if( otherindex != talker) { CHAR_sendStatusString( otherindex, msgbuf); } } } } } }
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 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 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); }
/* * 既存のアイテムをあるキャラに持たせる。 * もちものがいっぱいかどうか、スキルの判定、等は * この関数の中でやる。 * * int charindex:もたせるキャラのキャラindex * int itemindex:もたせるアイテムのアイテムindex * BOOL net: この関数にネットワークやらせる TRUEにする事。 * 返り値:無事持たせれたらTRUE,なんらかの原因で持たせれなかったらFALSE * * by nakamura * * この関数の中で、キャラが持っているものだったら持ちものから外す、 * 地面に置いてあるものだったら置いてなくする、という処理もしてしまう * ようにした。 * by ringo * * some bug fix.( ITEM_setWorkInt etc.) * by taka * * 現在の仕様。 * o itemindex のアイテムが自分の持っているアイテムであったら、 * return FALSE する */ BOOL NPC_Util_moveItemToChar( int charindex, int itemindex,BOOL net ) { int emptyindex, oind ,cind; emptyindex = CHAR_findEmptyItemBox( charindex ); if( emptyindex < 0 ) /* アイテム欄に空きがない */ return FALSE; if( !ITEM_CHECKINDEX( itemindex ) )return FALSE; /* 持たせる空きはある */ /* * 次に地形に落ちているアイテムか、それとも、 * 誰かが持っているアイテムかを調べる */ oind = ITEM_getWorkInt( itemindex , ITEM_WORKOBJINDEX ); cind = ITEM_getWorkInt( itemindex , ITEM_WORKCHARAINDEX ); if( oind >= 0 ){ /* 地形に置かれているものだ。 */ /* 地形から抹消 */ CHAR_ObjectDelete( oind ); /* アイテムを移動 */ CHAR_setItemIndex( charindex, emptyindex, itemindex ); /* アイテムのWork領域を書きかえる */ ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1 ); ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, charindex ); /* charindex がプレイヤーだったらアイテム変更ステータス送信 */ if( net ) CHAR_sendStatusString( charindex, "I"); return TRUE; }else if( cind >= 0 ){ /* キャラクタが持っているものだ。 */ int itemindexinchara; /* 自分が持っている場合には何もしない */ if( cind == charindex )return FALSE; /* もってるものを消す */ itemindexinchara = NPC_Util_SearchItemInChar( cind , itemindex); if( itemindexinchara == -1 )return FALSE; CHAR_setItemIndex( cind , itemindexinchara , -1 ); if( itemindexinchara == CHAR_ARM1 && CHAR_getItemIndex( cind,CHAR_ARM2 )== -2){ CHAR_setItemIndex(cind,CHAR_ARM2,-1); } CHAR_complianceParameter(cind); if( net ) CHAR_sendStatusString( cind,"I"); /* アイテムを持たせる */ CHAR_setItemIndex( charindex , emptyindex , itemindex ); if( net ) CHAR_sendStatusString( charindex,"I"); /* アイテムのWork領域を書きかえる */ ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1 ); ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, charindex ); return TRUE; /* fixed by nakamura(なんもreturnしてなかった) */ } return FALSE; }
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; }