/*------------------------------------------------------------ * °ÜÆ°¤¹¤ë¡£ * °ú¿ô * index int ¥¥ã¥é¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ * dir int Êý¸þ * ÊÖ¤êÃÍ * CHAR_WALKRET ------------------------------------------------------------*/ static CHAR_WALKRET CHAR_walk_move( int charaindex, int dir ) { int i; int fx,fy,ff; int ox,oy,of; int objbuf[128]; int objbufindex=0; int notover=FALSE; int retvalue=CHAR_WALKSUCCESSED; if( !CHAR_CHECKINDEX( charaindex )) return CHAR_WALKSYSTEMERROR; ox = CHAR_getInt(charaindex,CHAR_X); oy = CHAR_getInt(charaindex,CHAR_Y); of = CHAR_getInt(charaindex,CHAR_FLOOR); CHAR_getCoordinationDir( dir,ox,oy,1,&fx,&fy); ff = of; if( CHAR_getInt( charaindex,CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ RECT walkr; POINT nextp; int npccreateindex; npccreateindex = CHAR_getInt( charaindex,CHAR_NPCCREATEINDEX ); if( CHAR_isInvincibleArea( ff,fx,fy)) { CHAR_setInt(charaindex,CHAR_DIR,dir); retvalue = CHAR_WALKEXTEND; goto CHAR_AFTERWALK; } if( NPC_isBoundarySet( npccreateindex ) && NPC_createGetRECT( npccreateindex,&walkr ) == TRUE ) { nextp.x = fx; nextp.y = fy; if( PointInRect( &walkr,&nextp ) == FALSE ){ CHAR_setInt(charaindex,CHAR_DIR,dir); retvalue = CHAR_WALKEXTEND; goto CHAR_AFTERWALK; } }else{ ; } } if( CHAR_getFlg( charaindex, CHAR_ISBIG ) == 1 ){ static POINT offset[5]={ { 0,-1}, {-1, 0}, { 0, 0}, { 1, 0}, { 0, 1}, }; int k; for( k=0 ; k<5; k++ ){ if( !MAP_walkAble( charaindex, ff, fx+offset[k].x, fy+offset[k].y )){ CHAR_setInt(charaindex,CHAR_DIR,dir); retvalue = CHAR_WALK1357; goto CHAR_AFTERWALK; } } }else{ if( CHAR_getDX(dir)*CHAR_getDY(dir) == 0 ){ if( !MAP_walkAble( charaindex,ff, fx, fy ) ){ CHAR_setInt(charaindex,CHAR_DIR,dir); retvalue = CHAR_WALK1357; goto CHAR_AFTERWALK; } }else{ int xflg,yflg; if( !MAP_walkAble( charaindex,ff, fx, fy ) ){ CHAR_setInt(charaindex,CHAR_DIR,dir); retvalue = CHAR_WALK1357; goto CHAR_AFTERWALK; } xflg = MAP_walkAble( charaindex,of, ox+CHAR_getDX(dir), oy ); yflg = MAP_walkAble( charaindex,of, ox, oy+CHAR_getDY(dir) ); if( !xflg || !yflg ) { CHAR_setInt(charaindex,CHAR_DIR,dir); retvalue = CHAR_WALK1357; goto CHAR_AFTERWALK; } } } objbufindex = CHAR_getSameCoordinateObjects( objbuf, arraysizeof( objbuf ), ff,fx,fy ); for( i = 0 ; i < objbufindex ; i ++ ){ int objindex= objbuf[i]; switch( OBJECT_getType(objindex) ){ case OBJTYPE_CHARA: if( !CHAR_getFlg( OBJECT_getIndex(objindex),CHAR_ISOVERED) ) notover= TRUE; break; case OBJTYPE_ITEM: if( !ITEM_getInt( OBJECT_getIndex(objindex), ITEM_ISOVERED ) ) notover= TRUE; break; case OBJTYPE_GOLD: break; default: break; } } if( notover == TRUE ){ CHAR_setInt(charaindex,CHAR_DIR,dir); retvalue = CHAR_WALKHITOBJECT; }else{ for( i = 0 ; i < objbufindex ; i ++ ){ typedef void (*PREOFUNC)(int,int); PREOFUNC pfunc=NULL; int objindex=objbuf[i]; switch( OBJECT_getType(objindex) ){ case OBJTYPE_CHARA: pfunc = (PREOFUNC)CHAR_getFunctionPointer( OBJECT_getIndex(objindex), CHAR_PREOVERFUNC); break; case OBJTYPE_ITEM: pfunc = (PREOFUNC)ITEM_getFunctionPointer( OBJECT_getIndex(objindex), ITEM_PREOVERFUNC); break; case OBJTYPE_GOLD: break; default: break; } if( pfunc )pfunc( OBJECT_getIndex(objindex),charaindex ); } CHAR_setInt(charaindex,CHAR_X,fx); CHAR_setInt(charaindex,CHAR_Y,fy); CHAR_setInt(charaindex,CHAR_FLOOR,ff); CHAR_setInt(charaindex,CHAR_DIR,dir); { int objindex; int ox,oy,of; objindex = CHAR_getWorkInt( charaindex,CHAR_WORKOBJINDEX ); of = OBJECT_setFloor(objindex, CHAR_getInt(charaindex,CHAR_FLOOR)); ox = OBJECT_setX(objindex,CHAR_getInt(charaindex,CHAR_X)); oy = OBJECT_setY(objindex,CHAR_getInt(charaindex,CHAR_Y)); if( !MAP_objmove( objindex, of,ox,oy,ff,fx,fy ) ){ /* ¤³¤ó¤Ê¤ó¤É¤¦¤·¤è¤¦¤â¤Ê¤¤ */ fprint( "ERROR MAP_OBJMOVE objindex=%d(%s)\n",objindex, CHAR_getUseName( charaindex ) ); } } CHAR_setInt(charaindex,CHAR_WALKCOUNT, CHAR_getInt(charaindex,CHAR_WALKCOUNT) + 1 ); for( i = 0 ; i < objbufindex ; i ++ ){ typedef void (*POSTOFUNC)(int,int); POSTOFUNC pfunc=NULL; int objindex=objbuf[i]; switch( OBJECT_getType(objindex) ){ case OBJTYPE_CHARA: pfunc = (POSTOFUNC)CHAR_getFunctionPointer( OBJECT_getIndex(objindex), CHAR_POSTOVERFUNC); break; case OBJTYPE_ITEM: pfunc = (POSTOFUNC)ITEM_getFunctionPointer( OBJECT_getIndex(objindex), ITEM_POSTOVERFUNC); break; case OBJTYPE_GOLD: break; default: break; } if( pfunc )pfunc( OBJECT_getIndex(objindex),charaindex ); } objbufindex = CHAR_getSameCoordinateObjects(objbuf, arraysizeof(objbuf), of, ox, oy ); for( i=0 ;i<objbufindex;i++){ typedef void (*OFFFUNC)(int,int); OFFFUNC ofunc=NULL; int objindex = objbuf[i]; switch( OBJECT_getType( objindex ) ){ case OBJTYPE_CHARA: ofunc = (OFFFUNC)CHAR_getFunctionPointer( OBJECT_getIndex(objindex), CHAR_OFFFUNC); break; case OBJTYPE_ITEM: /* Ê̤˲¿¤â¤·¤Ê¤¤ */ break; case OBJTYPE_GOLD: /* Ê̤˲¿¤â¤·¤Ê¤¤ */ break; default: break; } if( ofunc )ofunc( OBJECT_getIndex(objindex), charaindex ); } } CHAR_AFTERWALK: if( retvalue == CHAR_WALK1357 || retvalue == CHAR_WALKHITOBJECT ){ { int opt[2] = { ox, oy}; CHAR_sendWatchEvent( CHAR_getWorkInt(charaindex, CHAR_WORKOBJINDEX), CHAR_ACTWALK,opt,2,TRUE ); } CHAR_setWorkChar( charaindex, CHAR_WORKWALKARRAY, ""); if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { CHAR_sendWatchEvent( CHAR_getWorkInt(charaindex, CHAR_WORKOBJINDEX), CHAR_ACTWARP,NULL,0,TRUE); } }else if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ BOOL flg = FALSE; int par; int count; CHAR_setWorkInt( charaindex, CHAR_WORKACTION, -1 ); if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ){ CHAR_sendCharaAtWalk( charaindex, of,ox,oy,CHAR_getDX(dir), CHAR_getDY(dir)); } { int opt[2] = { ox, oy}; CHAR_sendWatchEvent( CHAR_getWorkInt(charaindex, CHAR_WORKOBJINDEX), CHAR_ACTWALK,opt,2,TRUE ); } if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) { CHAR_sendMapAtWalk( charaindex, of, ox,oy, CHAR_getInt( charaindex, CHAR_X), CHAR_getInt( charaindex, CHAR_Y)); } count = CHAR_getWorkInt( charaindex, CHAR_WORK_TOHELOS_COUNT); if( count > 0 ) { CHAR_setWorkInt( charaindex, CHAR_WORK_TOHELOS_COUNT, count -1); if( count -1 == 0 ) { CHAR_talkToCli( charaindex, -1, "¹D¨ãªº®Ä¤O¤w¨ì¡C", CHAR_COLORWHITE); } } par = ENCOUNT_getEncountPercentMin( charaindex, of,ox,oy); if( par != -1 ) { if( CHAR_getWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN) != par ){ flg = TRUE; CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN, par); } } par = ENCOUNT_getEncountPercentMax( charaindex, of,ox,oy); if( par != -1 ) { if( CHAR_getWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX) != par ){ flg = TRUE; CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX, par); } } // Arminius 7.12 login announce /* { int enfd = getfdFromCharaIndex( charaindex ); if (CONNECT_get_announced(enfd)==0) { // Robin 0720 //AnnounceToPlayer(charaindex); AnnounceToPlayerWN( enfd ); CONNECT_set_announced(enfd,1); } } */ // Arminius 6.22 check Encounter // Nuke 0622: Provide No Enemy function { int enfd = getfdFromCharaIndex( charaindex ); int eqen = getEqNoenemy( enfd ); // Arminius 7.2: Ra's amulet int noen = getNoenemy(enfd); // Arminius 7.31 cursed stone if (getStayEncount(enfd)>0) { #ifdef _ESCAPE_RESET // ´cÄ_¸Ñ°£«á°k¶]®É¶¡«·sÂk¹s CHAR_setWorkInt( charaindex, CHAR_WORKLASTESCAPE, 0); #endif clearStayEncount(enfd); } //print("\n enfd=%d,eqen=%d,noen=%d", enfd, eqen, noen); // Arminius 7.2 Ra's amulet if (eqen>=200) { noen=1; } else if (eqen>=120) { if ((ff==100)||(ff==200)||(ff==300)||(ff==400)||(ff==500)) noen=1; } else if (eqen>=80) { if ((ff==100)||(ff==200)||(ff==300)||(ff==400)) noen=1; } else if (eqen>=40) { if ((ff==100)||(ff==200)) noen=1; } //print("\n noen=%d", noen); if (noen==0) { int maxep = CHAR_getWorkInt(charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX); int minep = CHAR_getWorkInt(charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN); int cep = CONNECT_get_CEP(enfd); #ifdef _PROFESSION_SKILL // WON ADD ¤Hª«Â¾·~§Þ¯à int temp=0; int p_cep = CHAR_getWorkInt(charaindex, CHAR_ENCOUNT_FIX); if( p_cep != 0 ){ if( CHAR_getWorkInt( charaindex, CHAR_ENCOUNT_NUM) < (int)time(NULL) ){ CHAR_talkToCli( charaindex, -1, "§Þ¯à®Ä¥Îµ²§ô¡C", CHAR_COLORYELLOW); CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_FIX, 0); CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_NUM, 0); } temp = cep * (100 + p_cep ) / 100; }else{ temp = cep; } #endif if (cep<minep) cep=minep; if (cep>maxep) cep=maxep; if (CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE)==BATTLE_CHARMODE_NONE) { int entflag; entflag=1; { int objindex,index; OBJECT obj; for ( obj = MAP_getTopObj( ff, fx, fy); obj; obj = NEXT_OBJECT( obj)) { objindex = GET_OBJINDEX( obj); if (OBJECT_getType( objindex) == OBJTYPE_CHARA) { int etype; index = OBJECT_getIndex( objindex); if (!CHAR_CHECKINDEX( index)) continue; if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPENPCENEMY && CHAR_getWorkInt( index, CHAR_WORKEVENTTYPE) == CHAR_EVENT_ENEMY ) { CHAR_setInt( charaindex, CHAR_X, ox); CHAR_setInt( charaindex, CHAR_Y, oy); lssproto_XYD_send( getfdFromCharaIndex(charaindex), CHAR_getInt( charaindex, CHAR_X ), CHAR_getInt( charaindex, CHAR_Y ), CHAR_getInt( charaindex, CHAR_DIR ) ); break; } etype = CHAR_getWorkInt( index, CHAR_WORKEVENTTYPE); if (etype!=CHAR_EVENT_NONE) { if (etype==CHAR_EVENT_WARP) entflag=0; } } } } #ifdef _PROFESSION_SKILL // WON ADD ¤Hª«Â¾·~§Þ¯à if( rand()%120 < temp ){ #else if (rand()%120<cep){ // Arminius 6.28 lower encounter prob. #endif if (entflag) { #ifdef _Item_MoonAct if( getEqRandenemy( enfd) > 0 ) { int Rnum=0; int RandEnemy = getEqRandenemy( enfd); Rnum = RAND(0,100); if( Rnum > RandEnemy ) { #endif //encounter!! cep = minep; lssproto_EN_recv(enfd, CHAR_getInt(charaindex,CHAR_X), CHAR_getInt(charaindex,CHAR_Y)); #ifdef _Item_MoonAct } }else{ cep = minep; lssproto_EN_recv(enfd, CHAR_getInt(charaindex,CHAR_X), CHAR_getInt(charaindex,CHAR_Y)); } #endif } } else { if (cep<maxep) cep++; } } CONNECT_set_CEP(enfd, cep); } } if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE )!= CHAR_PARTY_CLIENT ){ CHAR_setFlg( charaindex, CHAR_ISWARP, 0); } } else if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ||
void ITEM_contractSign( int fd, int itemindex, int signindex) { int charaindex; int i; int conIndex; int complete =0; int item_id; char contractSignData[512]; contractSignTag contractSign[4]; print("\n contractSign:%d:%d ", itemindex, signindex); charaindex = CONNECT_getCharaindex( fd ); if( !CHAR_CHECKINDEX(charaindex)) return; if( signindex <0 || signindex >=4) return; for( i=0 ; i<CHAR_MAXITEMHAVE ; i++ ){ if( CHAR_getItemIndex( charaindex,i ) == itemindex ) break; } if( i >= CHAR_MAXITEMHAVE ) return; if( strcmp( ITEM_getChar( itemindex, ITEM_USEFUNC), "ITEM_contract") ) return; conIndex = atoi( ITEM_getChar( itemindex, ITEM_ARGUMENT)); if( signindex >= ITEM_contractTbl[conIndex].argnum ) return; strcpy( contractSignData, ITEM_getChar( itemindex, ITEM_CONTRACTARG) ); for( i=0; i<4; i++) contractSign[i].used = FALSE; for( i=0; i<4; i++) { int index; char buf[512]; char token[32]; if( getStringFromIndexWithDelim( contractSignData, ",", i+1, buf, sizeof( buf )-1) == FALSE ) break; if( strlen( buf) == 0) break; getStringFromIndexWithDelim( buf, ":", 1, token, sizeof( token )-1 ); index = atoi( token); if( index <0 || index >=4) break; getStringFromIndexWithDelim( buf, ":", 2, contractSign[index].name, sizeof( contractSign[index].name )-1 ); getStringFromIndexWithDelim( buf, ":", 3, contractSign[index].fmname, sizeof( contractSign[index].fmname )-1 ); contractSign[index].used = TRUE; } if( contractSign[signindex].used == TRUE) return; strcpy( contractSign[signindex].name, CHAR_getChar( charaindex, CHAR_NAME) ); strcpy( contractSign[signindex].fmname, CHAR_getChar( charaindex, CHAR_FMNAME) ); contractSign[signindex].used = TRUE; // 檢查是否完成契約 for( i =0; i<4; i++) { if( contractSign[i].used == TRUE) complete++; } if( complete >= ITEM_contractTbl[conIndex].argnum ) { char buf[512]; if( CHAR_findEmptyItemBoxNo( charaindex ) < ITEM_contractTbl[conIndex].argnum -1 ) { sprintf( buf, "要完成這個契約,請先準備%d個空道具欄位。", ITEM_contractTbl[conIndex].argnum -1); CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); return; } } strcpy( contractSignData, ""); for( i=0; i<4; i++) { char buf[512]; if( contractSign[i].used == FALSE) continue; sprintf( buf, "%d:%s:%s,", i, contractSign[i].name, contractSign[i].fmname); strcat( contractSignData, buf); } ITEM_setChar( itemindex, ITEM_CONTRACTARG, contractSignData); CHAR_talkToCli( charaindex, -1, "完成契約簽名。", CHAR_COLORYELLOW); // 完成契約 if( complete >= ITEM_contractTbl[conIndex].argnum ) { struct tm *nowtime; char timebuf[512]; // 紀錄日期 nowtime = localtime( (time_t *)&NowTime.tv_sec ); sprintf( timebuf, "%04d年%02d月%02d日", nowtime->tm_year +1900, nowtime->tm_mon+1, nowtime->tm_mday); ITEM_setChar( itemindex, ITEM_CONTRACTTIME, timebuf); CHAR_talkToCli( charaindex, -1, "完成所有簽名,契約成立!", CHAR_COLORYELLOW); // 複製契約 item_id = ITEM_getInt( itemindex, ITEM_ID); for( i =0 ; i < ITEM_contractTbl[conIndex].argnum -1 ; i++) { int emptyindex; int newitemindex; emptyindex = CHAR_findEmptyItemBox( charaindex ); if( emptyindex < 0 ){ CHAR_talkToCli( charaindex, -1, "空間欄位不足。", CHAR_COLORYELLOW); break; } newitemindex = ITEM_makeItemAndRegist( item_id ); if( newitemindex != -1 ){ CHAR_setItemIndex( charaindex, emptyindex, newitemindex ); ITEM_setWorkInt( newitemindex, ITEM_WORKOBJINDEX, -1); ITEM_setWorkInt( newitemindex, ITEM_WORKCHARAINDEX, charaindex); CHAR_sendItemDataOne( charaindex, emptyindex); ITEM_setChar( newitemindex, ITEM_CONTRACTARG, contractSignData); ITEM_setChar( newitemindex, ITEM_CONTRACTTIME, timebuf); } CHAR_talkToCli( charaindex, -1, "複製契約書。", CHAR_COLORYELLOW); } } }
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 )); } }
void CHAR_Talk(int fd, int index, char *message, int color, int area) { char firstToken[64]; char messageeraseescape[512]; char *messagebody; int mesgvolume = 0; int lastvolume = 0; int fl, x, y; int stringlen; int micflg = 0; int fmindexi = CHAR_getWorkInt(index, CHAR_WORKFMINDEXI); int channel = CHAR_getWorkInt(index, CHAR_WORKFMCHANNEL); int quickchannel = CHAR_getWorkInt(index, CHAR_WORKFMCHANNELQUICK); { char *cdkey = CHAR_getChar(index, CHAR_CDKEY); char *charname = CHAR_getChar(index, CHAR_NAME); if(strlen(message) > 3) { if(CHAR_getWorkInt(index, CHAR_WORKFLG) & WORKFLG_DEBUGMODE) { // shan begin if(strstr(message, "[") && strstr(message, "]")) { } else { // original LogTalk(charname, cdkey, CHAR_getInt(index, CHAR_FLOOR), CHAR_getInt(index, CHAR_X), CHAR_getInt(index, CHAR_Y), message); } // end } } } //bg|0|r0|fc|d4B8|p0|bn|10|bt|10| // Nuke +1 08/27: For invalid message attack if(*message == 0) return; CHAR_getMessageBody(message, firstToken, sizeof(firstToken), &messagebody); // Nuke +1: For invalid message attack if(!messagebody) return; strcpysafe(messageeraseescape, sizeof(messageeraseescape), messagebody); makeStringFromEscaped(messageeraseescape); stringlen = strlen(messageeraseescape); if(stringlen <= 0) return; if(messageeraseescape[0] == '[' && messageeraseescape[stringlen - 1] == ']') { char gm[128]; char *pass = strstr(messageeraseescape + 1, getChatMagicPasswd()); // Arminius: limit ip +2 char* ip = CONNECT_get_userip(fd); messageeraseescape[stringlen - 1] = '\0'; // Arminius: limit ip if(pass == messageeraseescape + 1) { if(CHAR_useChatMagic(index, messageeraseescape + 1 + strlen(getChatMagicPasswd()) + 1, TRUE)) { print("\n账号:%s 名字:%s\n来自ip:%s\n使用GM命令%s]\n", CHAR_getChar(index, CHAR_CDKEY), CHAR_getChar(index, CHAR_NAME), ip, messageeraseescape); sprintf(gm, "您使用GM命令%s]已成功", messageeraseescape); CHAR_talkToCli(index, -1, gm, CHAR_COLORYELLOW); } } else { if(CHAR_getWorkInt(index, CHAR_WORKFLG) & WORKFLG_DEBUGMODE) { if(CHAR_useChatMagic(index, messageeraseescape + 1, TRUE)) { print("\n账号:%s 名字:%s\n来自ip:%s\n使用GM命令%s]\n", CHAR_getChar(index, CHAR_CDKEY), CHAR_getChar(index, CHAR_NAME), ip, messageeraseescape); sprintf(gm, "您使用GM命令%s]已成功", messageeraseescape); CHAR_talkToCli(index, -1, gm, CHAR_COLORYELLOW); } } else { #ifdef _GM_ITEM if(CHAR_getInt( index, CHAR_GMTIME)>0){ char magicname[32]; char token[64]; getStringFromIndexWithDelim( messageeraseescape + 1, " ", 1, magicname, sizeof( magicname)); if(!strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), magicname)){ player_useChatMagic( index,messageeraseescape + 1,TRUE); print( "\n账号:%s 名字:%s\n来自ip:%d.%d.%d.%d\n使用物品命令%s]次数剩下%d\n", CHAR_getChar( index, CHAR_CDKEY), CHAR_getChar( index, CHAR_NAME), a, b, c, d,messageeraseescape, CHAR_getInt( index, CHAR_GMTIME) - 1); CHAR_setInt( index , CHAR_GMTIME, CHAR_getInt( index, CHAR_GMTIME) - 1 ); if(CHAR_getInt( index, CHAR_GMTIME) > 0){ sprintf( token, "你还能使用%s权限%d次!", CHAR_getChar( index, CHAR_GMFUNCTION),CHAR_getInt( index, CHAR_GMTIME)); CHAR_talkToCli( index, -1,token, CHAR_COLORRED ); }else{ sprintf( token, "你已经没有使用%s权限了!", CHAR_getChar( index, CHAR_GMFUNCTION)); CHAR_talkToCli( index, -1,token, CHAR_COLORRED ); } }else if(!strcmp( "help", magicname) || !strcmp( "帮助", magicname)){ getStringFromIndexWithDelim( messageeraseescape + 1, " ", 2, magicname, sizeof( magicname)); if(!strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), magicname)){ player_useChatMagic( index,messageeraseescape + 1,TRUE); print( "\n账号:%s 名字:%s\n来自ip:%d.%d.%d.%d\n使用帮助命令%s]\n", CHAR_getChar( index, CHAR_CDKEY), CHAR_getChar( index, CHAR_NAME), a, b, c, d,messageeraseescape); } } }else #endif CHAR_useChatMagic(index, messageeraseescape + 1, FALSE); } } messageeraseescape[stringlen - 1] = ']'; return; } else { if(CHAR_getWorkInt(index, CHAR_WORKFLG) & WORKFLG_DEBUGMODE) { if(strstr(messageeraseescape, "[") != NULL || strstr(messageeraseescape, "]") != NULL) { return; } } } #ifdef _PLAYER_MOVE if(getPMove() != -1) { if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'g' && messageeraseescape[2] == 'o') { int point = CHAR_getInt(index, CHAR_AMPOINT); if(point > getPMove() || getPMove() == 0) { char x[4], y[4]; easyGetTokenFromString(messageeraseescape, 2, x, sizeof(x)); easyGetTokenFromString(messageeraseescape, 3, y, sizeof(y)); CHAR_warpToSpecificPoint(index, CHAR_getInt(index, CHAR_FLOOR), atoi(x), atoi(y)); CHAR_setInt(index, CHAR_AMPOINT, point - getPMove()); } else CHAR_talkToCli(index, -1, "你已经没有足够的会员点数顺移了!", CHAR_COLORRED); return; } } #endif #ifdef _PLAYER_ANNOUNCE if(getPAnnounce() != -1) { if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'g' && messageeraseescape[2] == 'g') { int point = CHAR_getInt(index, CHAR_AMPOINT); if(point > getPAnnounce() || getPAnnounce() == 0) { int i; int playernum = CHAR_getPlayerMaxNum(); char buff[255]; char xlbmsg[255]; char *MyName = CHAR_getChar(index, CHAR_NAME); easyGetTokenFromString(messageeraseescape, 2, buff, sizeof(buff)); for(i = 0; i < playernum; i++) { if(CHAR_getCharUse(i) != FALSE) sprintf(xlbmsg, "<小喇叭>%s说:%s", MyName, buff); CHAR_talkToCli(i, -1, xlbmsg, CHAR_COLORGREEN); } CHAR_setInt(index, CHAR_AMPOINT, point - getPAnnounce()); } else CHAR_talkToCli(index, -1, "你已经没有足够的会员点数小喇叭了!", CHAR_COLORRED); return; } } #endif #ifdef _TALK_ACTION TalkAction(index, messageeraseescape); #endif mesgvolume = CHAR_getVolume(messageeraseescape); if(area == 0) area = 3; if(mesgvolume == -1) lastvolume = -1; else lastvolume = area - 1 + mesgvolume; if(CHAR_getWorkInt(index, CHAR_WORKFLG) & WORKFLG_MICMODE) { lastvolume = 15; micflg = 1; } fl = CHAR_getInt(index, CHAR_FLOOR); x = CHAR_getInt(index, CHAR_X); y = CHAR_getInt(index, CHAR_Y); // Robin 0705 channel if(messageeraseescape[0] == ':') { if((channel == -1) && (quickchannel != -1)) channel = quickchannel; else if(channel != -1) channel = -1; } { typedef void (*TALKF)(int, int, char *, int, int); TALKF talkedfunc = NULL; talkedfunc = (TALKF) CHAR_getFunctionPointer(index, CHAR_TALKEDFUNC); if(talkedfunc) { talkedfunc(index, index, messageeraseescape, color, channel); } } if(lastvolume == -1) { int j; int xx[2] = {x, x + CHAR_getDX(CHAR_getInt(index, CHAR_DIR))}; int yy[2] = {y, y + CHAR_getDY(CHAR_getInt(index, CHAR_DIR))}; int talk = FALSE; for(j = 0; j < 2; j++) { OBJECT object; for(object = MAP_getTopObj(fl, xx[j], yy[j]); object; object = NEXT_OBJECT(object)) { int objindex = GET_OBJINDEX(object); int toindex = OBJECT_getIndex(objindex); if(OBJECT_getType(objindex) == OBJTYPE_CHARA && toindex != index) { if(CHAR_Talk_check(index, toindex, 0)) { typedef void (*TALKF)(int, int, char *, int, int); TALKF talkedfunc = NULL; talkedfunc = (TALKF) CHAR_getFunctionPointer(toindex, CHAR_TALKEDFUNC); if(talkedfunc) { talkedfunc(toindex, index, messageeraseescape, color, -1); } if(CHAR_getInt(toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { talk = TRUE; } } } } } if(talk)CHAR_setInt(index, CHAR_TALKCOUNT, CHAR_getInt(index, CHAR_TALKCOUNT) + 1); } else { int range = CHAR_getRangeFromVolume(lastvolume); int i, j; int talk = FALSE; int channelTalk = FALSE; int partyindex[CHAR_PARTYMAX]; for(i = 0; i < CHAR_PARTYMAX; i++) { partyindex[i] = -1; } if(CHAR_getWorkInt(index, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) { for(i = 0; i < CHAR_PARTYMAX; i++) { int toindex = CHAR_getPartyIndex(index, i); if(CHAR_CHECKINDEX(toindex) && toindex != index) { typedef void (*TALKF)(int, int, char *, int, int); TALKF talkedfunc = NULL; talkedfunc = (TALKF) CHAR_getFunctionPointer(toindex, CHAR_TALKEDFUNC); if(talkedfunc) talkedfunc(toindex, index, messageeraseescape, color, -1); talk = TRUE; partyindex[i] = toindex; } } } if(channel > -1 && fmindexi >= 0) { int i, tindex; channelTalk = TRUE; i = 0; #ifdef _FMVER21 if(channel == FAMILY_MAXCHANNEL && CHAR_getInt(index, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER) #else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( index, CHAR_FMLEADERFLAG ) == 1) #endif { char buf[512]; sprintf(buf, "[族长广播]%s: %s", CHAR_getChar(index, CHAR_NAME), messageeraseescape); saacproto_ACFMAnnounce_send(acfd, CHAR_getChar(index, CHAR_FMNAME), CHAR_getInt(index, CHAR_FMINDEX), CHAR_getWorkInt(index, CHAR_WORKFMINDEXI), buf, color ); return; } else for(i = 0; i < FAMILY_MAXMEMBER; i++) { tindex = channelMember[fmindexi][channel][i]; if(!CHAR_CHECKINDEX(tindex)) continue; if(tindex >= 0 && tindex != index) { typedef void (*TALKF)(int, int, char *, int, int); TALKF talkedfunc = NULL; talkedfunc = (TALKF) CHAR_getFunctionPointer(tindex, CHAR_TALKEDFUNC); if(talkedfunc) talkedfunc(tindex, index, messageeraseescape, color, channel); } } talk = TRUE; } else { for(i = x - range / 2; i <= x + range / 2; i++) { for(j = y - range / 2; j <= y + range / 2; j++) { OBJECT object; for(object = MAP_getTopObj(fl, i, j); object; object = NEXT_OBJECT(object)) { int objindex = GET_OBJINDEX(object); int toindex = OBJECT_getIndex(objindex); if(OBJECT_getType(objindex) == OBJTYPE_CHARA && toindex != index) { int k; for(k = 0; k < CHAR_PARTYMAX; k++) { if(toindex == partyindex[k]) { break; } } if(k != CHAR_PARTYMAX) continue; if(CHAR_Talk_check(index, toindex, micflg)) { typedef void (*TALKF)(int, int, char *, int, int); TALKF talkedfunc = NULL; talkedfunc = (TALKF) CHAR_getFunctionPointer(toindex, CHAR_TALKEDFUNC); if(talkedfunc) { talkedfunc(toindex, index, messageeraseescape, color, -1); } if(CHAR_getInt(toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { talk = TRUE; } } } } } } } if(talk) { CHAR_setInt(index, CHAR_TALKCOUNT, CHAR_getInt(index, CHAR_TALKCOUNT) + 1); } if(CHAR_getInt(index, CHAR_POPUPNAMECOLOR) != color) { CHAR_setInt(index, CHAR_POPUPNAMECOLOR, color); if(talk) { int opt[1]; opt[0] = color; CHAR_sendWatchEvent(CHAR_getWorkInt(index, CHAR_WORKOBJINDEX), CHAR_ACTPOPUPNAME, opt, 1, FALSE); } } } }
void NPC_OldmanTalked( int meindex , int talkerindex , char *msg , int color ) { char message[1024]; char *n = CHAR_getChar( talkerindex , CHAR_NAME ); int title_change = 0; /* 反卅仄井仃凶蠱卞}憤坌及ID毛筏盛今六月 */ CHAR_setInt( talkerindex, CHAR_LASTTALKELDER , CHAR_getWorkInt( meindex, CHAR_WORKOLDMANID ) ); /* if( title_change == 0 && strcmp( n , "蘋果" ) == 0 ){ if( NPC_Util_HaveTitle( talkerindex , 3 ) == 0 ){ char *ts; NPC_Util_AddOneTitle( talkerindex , 3 ); ts = TITLE_makeTitleStatusString( talkerindex , 3 ); snprintf( message , sizeof(message), "那是個不錯的名字, 就叫%s吧!", ts ); title_change = 1; } } */ { int addcnt,delcnt; title_change = TITLE_TitleCheck_Nomsg( talkerindex, 0, &addcnt, &delcnt); if( !title_change){ snprintf( message, sizeof( message ) , "來的好%s在給你稱號時" "不是還沒來嗎?" , n ); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); } else { #define NPC_OLDMAN_TITLE_UNIT1 "TSU" #define NPC_OLDMAN_TITLE_UNIT2 "KO" snprintf( message, sizeof( message ) ,"來的好%s",n ); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); if( delcnt > 0 && addcnt > 0 ) { snprintf( message, sizeof( message ) , "你喪失了%d%s 稱號的資格。" "不是得到了%d%s 的稱號資格嗎?" , delcnt, delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2, addcnt, addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2 ); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); } else if( delcnt > 0 ) { snprintf( message, sizeof( message ) , "你已喪失得到%d%s稱號的資格。", delcnt, delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); } else if( addcnt > 0 ) { snprintf( message, sizeof( message ) , "給你%d%s的稱號吧!", addcnt, // CoolFish: d%s -> %d%s 2001/4/18 addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); } if( delcnt > 0 ) { snprintf( message, sizeof( message), "失去%d%s 稱號!", delcnt, delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); CHAR_talkToCli( talkerindex, -1, message, CHAR_COLORYELLOW); } if( addcnt > 0 ) { snprintf( message, sizeof( message), "獲得%d%s 稱號!", addcnt, addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); CHAR_talkToCli( talkerindex, -1, message, CHAR_COLORYELLOW); } } } if( title_change ) CHAR_sendStatusString( talkerindex , "T" ); }
static void NPC_MakePair_selectWindow( int meindex, int toindex, int num,int select) { 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( Action_PartyCheck( meindex, toindex) == FALSE) { CHAR_talkToCli( toindex, meindex, "請一個一個來!", CHAR_COLORYELLOW); return; } memset( npcarg, 0, sizeof( npcarg)); if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ print("err NPC_MakePairMan: GetArgStrErr!!"); return; } memset( token, 0, sizeof( token)); switch( num) { case WINDOW_START: { char buf1[256]; if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf1, sizeof( buf1) ) != NULL) { if( NPC_ActionPassCheck( meindex, toindex, buf1) == FALSE ){ CHAR_talkToCli( toindex, meindex, "條件不足!", CHAR_COLORYELLOW); return; } } if( MakePairMan_GetMenuStr( meindex, toindex, npcarg, token) == FALSE ) { print( "err MakePairMan GetMenu ERROR !!\n"); return; } CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 1); windowtype = WINDOW_MESSAGETYPE_SELECT; buttontype = WINDOW_BUTTONTYPE_CANCEL; windowno = WINDOW_TALKSTART; } break; case WINDOW_USER: { int male=0, female=0; CheckPairUsers( &male, &female); sprintf( token, "目前登錄急尋找對象的人數為:\n男生為 %d,女生為 %d。\n目前配對已有 %d對。", male, female, CHAR_getWorkInt( meindex, NPC_WORK_PAIRTEAMS)); buttontype = WINDOW_BUTTONTYPE_OKCANCEL; windowno = WINDOW_RETURN; } break; case WINDOW_SELECT://心理測驗 { int title = CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT); int type; type = NPC_getTitleMsg( meindex, toindex, npcarg, token, title); if( type == 1 ){ buttontype = WINDOW_BUTTONTYPE_YESNO; windowno = WINDOW_TALKSELECT; }else if( type == 2 ){ buttontype = WINDOW_BUTTONTYPE_OK; windowno = WINDOW_TALKEND; }else{ return; } } break; case WINDOW_PAIR: { if( CHAR_getWorkInt( toindex, CHAR_MYPAIRFLG) > 0){ CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, -1); sprintf( token, "取消前一次的邀請。"); }else { char buf1[256]; if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf1, sizeof( buf1) ) != NULL) { if( NPC_ActionPassCheck( meindex, toindex, buf1) == FALSE ){ CHAR_talkToCli( toindex, meindex, "條件不足!", CHAR_COLORYELLOW); return; } } NPC_PairForage( meindex, toindex, npcarg, token); } buttontype = WINDOW_BUTTONTYPE_OK; windowno = WINDOW_TALKEND; } break; case WINDOW_PAIROK: //同意 if( CHAR_getWorkInt( toindex, CHAR_MYPAIRFLG) > 0){ int forindex = CHAR_getWorkInt( toindex, CHAR_MYPAIRINDEX); NPC_PairUserAndWarp( meindex, toindex, forindex, npcarg); } return; case WINDOW_PAIRNO://不同意 { int forindex = CHAR_getWorkInt( toindex, CHAR_MYPAIRINDEX); if( CHAR_CHECKINDEX( forindex) ){ if( CHAR_getWorkInt( forindex, CHAR_MYPAIRFLG) > 0 ){ CHAR_talkToCli( forindex, meindex, "對方拒絕邀請。", CHAR_COLORYELLOW); CHAR_setWorkInt( forindex, CHAR_MYPAIRINDEX, -1); CHAR_setWorkInt( forindex, CHAR_MYPAIRFLG, -1); } } CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, -1); CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, -1); CHAR_talkToCli( toindex, meindex, "拒絕對方邀請。", CHAR_COLORYELLOW); return; } break; case WINDOW_WARP: break; case WINDOW_END: break; } lssproto_WN_send( fd, windowtype, buttontype, windowno, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); }
void PET_Watchfunc( int objmeindex, int objmoveindex, CHAR_ACTION act, int x, int y, int dir, int* opt, int optlen ) { int pindex; int petindex; int petputtime; if( OBJECT_getType(objmoveindex) != OBJTYPE_CHARA ) return; pindex = OBJECT_getIndex( objmoveindex); if( CHAR_getInt( pindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return; petindex = OBJECT_getIndex( objmeindex); petputtime = CHAR_getInt( petindex, CHAR_PUTPETTIME); if( CHAR_getInt( petindex, CHAR_MAILMODE) != CHAR_PETMAIL_NONE) { //宠邮不处理 }else if( CHAR_getWorkInt( petindex, CHAR_WORKPETFOLLOWMODE) == CHAR_PETFOLLOW_NOW ){ if( NowTime.tv_sec >= (petputtime + 60*60) ) { int ownerindex = CHAR_getWorkInt( petindex, CHAR_WORKPLAYERINDEX); if( CHAR_CHECKINDEX( ownerindex) ){ if( CHAR_pickupFollowPet( ownerindex, petindex ) ) { return; } CHAR_talkToCli( ownerindex, -1, "溜宠太久,宠物走失了!!", CHAR_COLORYELLOW ); } #ifdef _PET_LOSTPET CHAR_CharSaveLostPet( petindex, 1); LogPet( "系统", "Watchfunc", CHAR_getChar( petindex, CHAR_NAME), CHAR_getInt( petindex, CHAR_LV), "timeout_lost(系统扣留-溜宠自由宠)", CHAR_getInt( petindex, CHAR_FLOOR), CHAR_getInt( petindex,CHAR_X ), CHAR_getInt( petindex,CHAR_Y ), CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 ); print("系统扣留-溜宠自由宠:%s\n", CHAR_getUseName( petindex)); CHAR_CharaDelete( petindex); #else CHAR_setInt( petindex, CHAR_PUTPETTIME, NowTime.tv_sec); CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWMODE, CHAR_PETFOLLOW_NONE); LogPet( CHAR_getChar( pindex, CHAR_NAME ), CHAR_getChar( pindex, CHAR_CDKEY ), CHAR_getChar( petindex, CHAR_NAME), CHAR_getInt( petindex, CHAR_LV), "timeout_lost(溜宠太久,宠物走失))", CHAR_getInt( pindex,CHAR_FLOOR), CHAR_getInt( pindex,CHAR_X ), CHAR_getInt( pindex,CHAR_Y ), CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 ); #endif return; } }else{ PET_CHECKFreePetIsIt( petindex); } if( CHAR_getInt( petindex, CHAR_MAILMODE) == CHAR_PETMAIL_IDLE3 || CHAR_getInt( petindex, CHAR_MAILMODE) == CHAR_PETMAIL_IDLE2){ if( act == CHAR_ACTATTACK) { if( NPC_Util_isFaceToChara( pindex,petindex,1 ) == TRUE ) { int action[2] = { CHAR_ACTDAMAGE, CHAR_ACTGUARD}; CHAR_sendWatchEvent( objmeindex, action[RAND(0,1)], NULL,0,FALSE); CHAR_setWorkInt( petindex, CHAR_WORKACTION, act); } } }else if( CHAR_getInt( petindex, CHAR_MAILMODE) != CHAR_PETMAIL_NONE) { ; }else if( CHAR_getWorkInt( petindex, CHAR_WORKFIXAI) >= 100 ) { int workpindex = CHAR_getWorkInt( petindex, CHAR_WORKPLAYERINDEX); if( act == CHAR_ACTWALK && CHAR_CHECKINDEX( workpindex) && workpindex == pindex ){ dir = NPC_Util_GetDirCharToChar( petindex, pindex, 0); if( dir != -1 ) { if( CHAR_getInt( petindex, CHAR_DIR) != dir ) { CHAR_setInt( petindex, CHAR_DIR, dir); CHAR_sendWatchEvent( CHAR_getWorkInt( petindex, CHAR_WORKOBJINDEX), CHAR_ACTTURN,NULL,0,TRUE); } } }else if( NPC_Util_isFaceToFace( petindex, pindex, 2 ) == TRUE ) { switch( act) { case CHAR_ACTATTACK: case CHAR_ACTDAMAGE: case CHAR_ACTDOWN: case CHAR_ACTSTAND: case CHAR_ACTACTIONWALK: case CHAR_ACTGUARD: case CHAR_ACTACTIONSTAND: CHAR_sendWatchEvent( objmeindex, act, NULL,0,FALSE); CHAR_setWorkInt( petindex, CHAR_WORKACTION, act); break; default: break; } } }else { } return; }
int NPC_Lua_NLG_TalkToCli(lua_State *_NLL) { CheckEx2(_NLL, 2, 5); CheckIndexNull(_NLL, 1); int TM_Top = lua_gettop(_NLL); int TM_toindex = (int)lua_tointeger(_NLL, 1); char *TM_Msg = lua_tostring(_NLL, 2); if(TM_Msg == NULL) { LRetErrInt(_NLL , -1, "说话内容不能为nil。"); } int TM_color = CHAR_COLORWHITE; int TM_fontsize = 0; int TM_Talkindex = -1; if(TM_Top >= 3) { TM_color = (int)lua_tointeger(_NLL, 3); } if(TM_Top >= 4) { TM_fontsize = (int)lua_tointeger(_NLL, 4); } if(TM_Top == 5) { CheckIndexNull(_NLL, 5); TM_Talkindex = (int)lua_tointeger(_NLL, 5); } BOOL TM_Ret = FALSE; if(TM_toindex == -1) { //对全服务器说话 int TM_playernum = CHAR_getPlayerMaxNum(); int i = 0; for( i = 0 ; i < TM_playernum ; i++) { if( CHAR_getCharUse(i) != FALSE ) { #ifdef _FONT_SIZE TM_Ret |= CHAR_talkToCliExt( i, TM_Talkindex, TM_Msg, TM_color, TM_fontsize); #else TM_Ret |= CHAR_talkToCli( i, TM_Talkindex, TM_Msg, TM_color); #endif } } }else { //对指定玩家说话 #ifdef _FONT_SIZE TM_Ret = CHAR_talkToCliExt(TM_toindex, TM_Talkindex, TM_Msg, TM_color, TM_fontsize); #else TM_Ret = CHAR_talkToCli(TM_toindex, TM_Talkindex, TM_Msg, TM_color); #endif } if(TM_Ret == TRUE) { LRetInt(_NLL, 0); }else { LRetErrInt(_NLL , -2, "未知原因导致发送说话失败。"); } }
void NPC_FmLetterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { int button = -1; char buf[512]; /* £±¥°¥ê¥Ã¥É°Ê ¤Î¤ß */ if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; /* ¤³¤Î¥¦¥£¥ó¥É¥¦ ¹æ¤Î¥Ç¡¼¥¿¤ò ¤ß ¤à */ if( !NPC_FmLetter_readData( meindex, seqno - 100, FALSE) ) { print( "fmletter:readdata error\n"); return; } /* ²¡¤·¤¿¥Ü¥¿¥ó¤òÄ´¤Ù¤ë */ if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) { button = atoi( data)+5; if( button > 12 ) { print( "fmletter:invalid button[%d]\n", button); return; } } else if( select & WINDOW_BUTTONTYPE_OK) button = 0; else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1; else if( select & WINDOW_BUTTONTYPE_YES) button = 2; else if( select & WINDOW_BUTTONTYPE_NO) button = 3; else if( select & WINDOW_BUTTONTYPE_PREV) button = 4; else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5; else { print( "fmletter:invalid button[%d]\n", select); return; } if( buttonproc[button].use == TRUE ) { int fd; int newwin = -1; fd = getfdFromCharaIndex( talkerindex); /* ¥Ü¥¿¥ó¤Ë¤è¤Ã¤Æ½è ¤ò¤Õ¤ê¤ï¤±¤ë */ if( newwin == -1 ) { newwin = buttonproc[button].gotowin; } // Robin if( newwin == 5 ) { int emptyitemindexinchara = CHAR_findEmptyItemBox( talkerindex ); int itemindex = ITEM_makeItemAndRegist( w.letter ); if( emptyitemindexinchara < 0 ) return; if( itemindex != -1 ){ char msgbuf[128]; CHAR_setItemIndex( talkerindex, emptyitemindexinchara, itemindex ); /* Work¥Ç¡¼¥¿¤òÀßÄê */ ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, talkerindex); CHAR_sendItemDataOne( talkerindex, emptyitemindexinchara); LogItem( CHAR_getChar( talkerindex, CHAR_NAME ), /* ¥¥ã¥é */ CHAR_getChar( talkerindex, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD ¦bitemªºlog¤¤¼W¥[item¦WºÙ itemindex, #else ITEM_getInt( itemindex, ITEM_ID ), /* ¥¢¥¤ ¥à ¹æ */ #endif "AddLetter(»s§@ÁܽШç)", CHAR_getInt( talkerindex,CHAR_FLOOR), CHAR_getInt( talkerindex,CHAR_X ), CHAR_getInt( talkerindex,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); snprintf( msgbuf, sizeof( msgbuf), "»s§@%s¦¨¥\\¡C", ITEM_getChar( itemindex, ITEM_NAME)); CHAR_talkToCli( talkerindex, -1,msgbuf, CHAR_COLORWHITE); } } // Robin if( newwin == 6 ) { int emptyitemindexinchara = CHAR_findEmptyItemBox( talkerindex ); int itemindex = ITEM_makeItemAndRegist( w.letter ); if( emptyitemindexinchara < 0 ) return; if( itemindex != -1 ){ char msgbuf[128]; CHAR_setItemIndex( talkerindex, emptyitemindexinchara, itemindex ); /* Work¥Ç¡¼¥¿¤òÀßÄê */ ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, talkerindex); CHAR_sendItemDataOne( talkerindex, emptyitemindexinchara); LogItem( CHAR_getChar( talkerindex, CHAR_NAME ), /* ¥¥ã¥é */ CHAR_getChar( talkerindex, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD ¦bitemªºlog¤¤¼W¥[item¦WºÙ itemindex, #else ITEM_getInt( itemindex, ITEM_ID ), /* ¥¢¥¤ ¥à ¹æ */ #endif "AddLetter(»s§@ÁܽШç)", CHAR_getInt( talkerindex,CHAR_FLOOR), CHAR_getInt( talkerindex,CHAR_X ), CHAR_getInt( talkerindex,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); snprintf( msgbuf, sizeof( msgbuf), "»s§@%s¦¨¥\\¡C", ITEM_getChar( itemindex, ITEM_NAME)); CHAR_talkToCli( talkerindex, -1,msgbuf, CHAR_COLORWHITE); } } if( !NPC_FmLetter_readData( meindex, newwin, FALSE) ) { print( "fmletter:readdata error\n"); return; } //fd = getfdFromCharaIndex( talkerindex); if( fd != -1 ) { lssproto_WN_send( fd, w.windowtype, w.buttontype, w.windowno+100, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), makeEscapeString( w.message, buf, sizeof(buf))); } } }
void PET_Talkfunc( int meindex, int talkerindex, char *msg, int color) { char buf2[1024], buf3[256]; char TalkType[][16]={"TALKRUN","EVENTRUN","BOTH"}; char AllTalk[PETTALK_MAXID][1024]; int Type=0,j,i; int talkNo=0; BOOL FREEs=FALSE; int buttontype = 0; int windowtype = 0; #ifdef _PET_TALKPRO int tPage=-1; #else int petid=-1; char tempNo[32], buf1[10240]; #endif int fd = getfdFromCharaIndex( talkerindex); #define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) windowtype = WINDOW_MESSAGETYPE_MESSAGE; buttontype = WINDOW_BUTTONTYPE_OK; if( NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { if( NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; } for( i = 0 ; i < 5 ; i++ ) { strcpy( AllTalk[i], "\0" ); } #ifdef _PET_TALKPRO for( i=0;i<PETTALK_MAXID;i++) { if( pettalktext[i].ID >=0 && pettalktext[i].ID == CHAR_getInt(meindex, CHAR_PETID) ) { if( strcmp( pettalktext[i].DATA, "\0") && strlen( pettalktext[i].DATA) > 0 ) { //snprintf( buf1, sizeof(buf1), pettalktext[i].DATA); tPage=i; break; } } } if( i == PETTALK_MAXID ) return; #else sprintf(tempNo,"%d", CHAR_getInt(meindex, CHAR_PETID)); petid = CHAR_getInt(meindex, CHAR_PETID); if( Pet_TalkGetFunStr( tempNo , buf1 , sizeof( buf1) ) == NULL ) { return; } #endif if( CHAR_getInt( meindex, CHAR_LV ) >= CHAR_getInt( meindex, CHAR_LIMITLEVEL) ) { Type = 1; } //设定为非主人不得与PET互动 if( strcmp( CHAR_getChar( meindex, CHAR_OWNERCDKEY), CHAR_getChar( talkerindex, CHAR_CDKEY) ) || strcmp( CHAR_getChar( meindex, CHAR_OWNERCHARANAME), CHAR_getChar( talkerindex, CHAR_NAME) )){ #ifdef _PET_TALKPRO if( NPC_Util_GetStrFromStrWithDelim( pettalktext[tPage].DATA, "NoPlayerMsg", buf3, sizeof( buf3)) != NULL ) { #else if( NPC_Util_GetStrFromStrWithDelim( buf1, "NoPlayerMsg", buf3, sizeof( buf3)) != NULL ) { #endif }else { sprintf(buf3,"陌生人?我不认识你呀!你是坏人!"); } CHAR_talkToCli( talkerindex, meindex, buf3, color); return; } j=0; #ifdef _PET_TALKPRO while( getStringFromIndexWithDelim( pettalktext[tPage].DATA,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE){ #else while( getStringFromIndexWithDelim( buf1,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE){ #endif talkNo++; if( ( strstr( buf2, TalkType[Type]) == NULL ) && ( strstr( buf2, TalkType[2]) == NULL ) )continue; if( NPC_Util_GetStrFromStrWithDelim( buf2, "FLOOR", buf3, sizeof( buf3)) != NULL ) {//判断房间号 if( PetTalk_CheckMyFloor( meindex, talkerindex, buf3, 0) == FALSE )continue; } if( NPC_Util_GetStrFromStrWithDelim( buf2, "PET", buf3, sizeof( buf3)) != NULL ) {//判断宠物FREE条件 if( PetTalk_CheckFree( meindex, meindex, buf3) != TRUE ) continue; } if( NPC_Util_GetStrFromStrWithDelim( buf2, "FREE", buf3, sizeof( buf3) ) == NULL)continue; if( NPC_ActionPassCheck( meindex, talkerindex, buf3) == FALSE ) continue;//判断玩家FREE条件 // if( ActionNpc_CheckFree( meindex, talkerindex, buf2, 0) == FALSE ) continue; if( PetTalk_CheckPetEvent( meindex, talkerindex, buf2) == FALSE )continue; FREEs = TRUE; //条件成立 strcpy( AllTalk[j++], buf2 ); if( j > PETTALK_MAXID-1 ) break; } talkNo = 0; if( FREEs == FALSE) { //如果全部条件都不成立 j=0; #ifdef _PET_TALKPRO while( getStringFromIndexWithDelim( pettalktext[tPage].DATA,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE ){ #else while( getStringFromIndexWithDelim( buf1,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE ){ #endif talkNo ++; if( strstr( buf2, "OTHER") == NULL ) continue; if( NPC_Util_GetStrFromStrWithDelim( buf2, "TalkMsg", buf3, sizeof( buf3)) == NULL) continue; while( getStringFromIndexWithDelim( buf3,",",j+1, AllTalk[j], sizeof( AllTalk[j]) ) != FALSE ){ j++; } break; } } if( j > 0 ) { strcpy( buf2, AllTalk[ RAND( 0, (j-1) ) ] ); if( PetTalk_RunEvent( meindex, talkerindex, buf2) == FALSE ) { sprintf( buf3,"....!"); CHAR_talkToCli( talkerindex, meindex, buf3, color); return; } if( NPC_Util_GetStrFromStrWithDelim( buf2, "TalkMsg", buf3, sizeof( buf3)) == NULL) { //sprintf( buf3,"主人,我们去逛逛吧!"); strcpy( buf3, buf2); } lssproto_WN_send( fd, windowtype, buttontype, 0, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf3 ); } } BOOL PetTalk_CheckMyFloor( int meindex, int talker, char *buf, int flg) { char buf1[16]; int Myfloor=-1; Myfloor = CHAR_getInt( talker, CHAR_FLOOR); if( strstr( buf, "!") != NULL ) { getStringFromIndexWithDelim( buf,"!", 2, buf1, sizeof( buf1) ); if( Myfloor == atoi( buf1) ) { return FALSE; } }else { if( Myfloor != atoi( buf) ) { return FALSE; } } return TRUE; } BOOL PetTalk_RunEvent( int meindex, int talker, char *buf) { char buf1[256]; int LimitLevel = -1; if( Action_RunDoEventAction( meindex, talker, buf) == FALSE ) return FALSE; if( NPC_Util_GetStrFromStrWithDelim( buf, "RandItem", buf1, sizeof( buf1)) != NULL ){ if( RAND( 0, 10) > 9 ) { PetTalk_AddItem( meindex, talker, buf1); }else { return FALSE; } } if( NPC_Util_GetStrFromStrWithDelim( buf, "LimitLevel", buf1, sizeof( buf1)) != NULL ){ LimitLevel = atoi( buf1); CHAR_setInt( meindex, CHAR_LIMITLEVEL, LimitLevel); } return TRUE; } BOOL PetTalk_DelItem(int meindex,int talker,char *buf) { int i = 1, j = 1,k = 1; char buff3[128]; char buf2[32]; int itemindex; while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ) { k++; if(strstr(buff3,"*")!=NULL){ int itemno; int kosuu; int id; int cnt=0; getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); itemno = atoi(buf2); getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); kosuu = atoi(buf2); for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ itemindex=CHAR_getItemIndex( talker , i ); if( ITEM_CHECKINDEX(itemindex) ){ id=ITEM_getInt(itemindex ,ITEM_ID ); if(itemno==id){ cnt++; LogItem( CHAR_getChar( talker, CHAR_NAME ), /* 平乓仿 */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD 在item的log中增加item名称 itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* 失奶 丞 寞 */ #endif "WarpManDelItem(NPC收道具後传至某点)", CHAR_getInt( talker, CHAR_FLOOR), CHAR_getInt( talker, CHAR_X ), CHAR_getInt( talker, CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, i); if(cnt == kosuu){ break; } } } } }else{ /*--蓟氏分 寞及失奶 丞毛蓟请---*/ for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ itemindex = CHAR_getItemIndex( talker ,j); if( ITEM_CHECKINDEX(itemindex) ){ if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)){ LogItem( CHAR_getChar( talker, CHAR_NAME ), /* 平乓仿 */ CHAR_getChar( talker, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD 在item的log中增加item名称 itemindex, #else ITEM_getInt( itemindex, ITEM_ID), /* 失奶 丞 寞 */ #endif "WarpManDelItem(NPC收道具後传至某点)", CHAR_getInt( talker,CHAR_FLOOR), CHAR_getInt( talker,CHAR_X ), CHAR_getInt( talker,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); CHAR_DelItem( talker, j); } } } } } return TRUE; }
//¸ü»»³èÎï 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); cost = cost + (ltime*10000); 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_PoolItemShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) return; //print("\n NPC_PoolItemShopWindowTalked: seq:%d sel:%d data:%s", seqno, select, data); switch( seqno ) { case CHAR_WINDOWTYPE_POOLITEMSHOP_START: switch( atoi( data)) { case 1: if( CHAR_getCharPoolItemIndexElement( talkerindex) != -1 ) { NPC_PoolItemShop_printWindow_Pool( meindex, talkerindex); }else { NPC_PoolItemShop_printWindow_Full( meindex, talkerindex); } break; case 2: if( CHAR_findEmptyItemBox( talkerindex) != -1 ) { NPC_PoolItemShop_printWindow_Draw( meindex, talkerindex); }else { NPC_PoolItemShop_printWindow_HaveItemFull( meindex, talkerindex); } break; #ifdef _NPC_DEPOTITEM case 3: if( !CHAR_CheckDepotItem( talkerindex) ){ CHAR_GetDepotItem( meindex, talkerindex); CHAR_talkToCli( talkerindex, -1, "取得道具,请稍後!", CHAR_COLORYELLOW); }else{ NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); } break; #endif } break; case CHAR_WINDOWTYPE_POOLITEMSHOP_POOL_MSG: if( atoi( data) == 0){ NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); }else { NPC_PoolItemShop_PoolItem( meindex, talkerindex, atoi(data)-1); } break; case CHAR_WINDOWTYPE_POOLITEMSHOP_DRAW_MSG: if( atoi( data) == 0){ NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); }else { NPC_PoolItemShop_DrawItem( meindex, talkerindex, atoi(data)-1); } break; case CHAR_WINDOWTYPE_POOLITEMSHOP_FULL_MSG: NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); break; case CHAR_WINDOWTYPE_POOLITEMSHOP_HAVEITEMFULL_MSG: NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); break; #ifdef _NPC_DEPOTITEM case CHAR_WINDOWTYPE_DEPOTITEMSHOP_MENU: if( !CHAR_CheckDepotItem( talkerindex) ){ CHAR_GetDepotItem( meindex, talkerindex); return; }else{ NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); } break; case CHAR_WINDOWTYPE_DEPOTITEMSHOP_HANDLE: if( !CHAR_CheckDepotItem( talkerindex) ) return ; switch( atoi( data)) { case 1://放入 if( CHAR_findEmptyDepotItem( talkerindex) == -1 ){ CHAR_talkToCli( talkerindex, -1, "仓库已满!", CHAR_COLORYELLOW); return; } NPC_DepotItem_Item_printWindow( meindex, talkerindex); break; case 2: if( CHAR_findEmptyItemBox( talkerindex) == -1 ) { CHAR_talkToCli( talkerindex, -1, "身上道具栏位已满!", CHAR_COLORYELLOW); return; } NPC_DepotItem_Depot_printWindow( meindex, talkerindex); break; } break; case CHAR_WINDOWTYPE_DEPOTITEMSHOP_ADD://放入 if( !CHAR_CheckDepotItem( talkerindex) ) return ; if( atoi( data) == 0){ NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); }else { if( NPC_DepotItem_InsertItem( meindex, talkerindex, atoi( data)-1) == FALSE ){ NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); CHAR_talkToCli( talkerindex, -1, "存放道具失败,请稍後再试!", CHAR_COLORYELLOW); } } break; case CHAR_WINDOWTYPE_DEPOTITEMSHOP_GET: if( !CHAR_CheckDepotItem( talkerindex) ) return ; if( atoi( data) == 0){ NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); }else { if( NPC_DepotItem_gettItem( meindex, talkerindex, atoi( data)-1) == FALSE ){ NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); CHAR_talkToCli( talkerindex, -1, "取出道具失败,请稍後再试!", CHAR_COLORYELLOW); } } break; #endif default: break; } }
static void NPC_MemberMan_selectWindow( int meindex, int toindex, int num,int select) { char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; char token[256]; int buttontype = 0, windowtype = 0, windowno = 0; int fd = getfdFromCharaIndex( toindex); int runint; 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){ print("TRANSER_MAN: GetArgStrErr!!"); return; } memset( token, 0, sizeof( token)); switch( num) { case WINDOW_START: if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { print("MemberMan Get START_MSG ERROR !"); return; } CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); buttontype = WINDOW_BUTTONTYPE_YESNO; windowno = NPC_TRANSERMAN_SELECT; break; case WINDOW_SELECT: runint = MemberMan_GetMenuStr( meindex, toindex, npcarg, token,WINDOW_SELECT); if( runint == 0 ) { print( "MemberMan GetMenu ERROR !!"); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; if (runint == 2)buttontype = WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL; if (runint == 1)buttontype = WINDOW_BUTTONTYPE_CANCEL; windowno = CHAR_WINDOWTYPE_MEMBER_NEXT; break; case WINDOW_NEXT: runint = MemberMan_GetMenuStr( meindex, toindex, npcarg, token,WINDOW_NEXT); if( runint == 0 ) { print( "MemberMan GetMenu ERROR !!"); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; if (runint == 2)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL; if (runint == 1)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; windowno = CHAR_WINDOWTYPE_MEMBER_NEXT1; break; case WINDOW_NEXT1: runint = MemberMan_GetMenuStr( meindex, toindex, npcarg, token,WINDOW_NEXT1); if( runint == 0 ) { print( "MemberMan GetMenu ERROR !!"); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; if (runint == 2)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL; if (runint == 1)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; windowno = CHAR_WINDOWTYPE_MEMBER_NEXT2; break; case WINDOW_NEXT2: runint = MemberMan_GetMenuStr( meindex, toindex, npcarg, token,WINDOW_NEXT2); if( runint == 0 ) { print( "MemberMan GetMenu ERROR !!"); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; if (runint == 2)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL; if (runint == 1)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; windowno = CHAR_WINDOWTYPE_MEMBER_NEXT3; break; case WINDOW_NEXT3: runint = MemberMan_GetMenuStr( meindex, toindex, npcarg, token,WINDOW_NEXT3); if( runint == 0 ) { print( "MemberMan GetMenu ERROR !!"); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; if (runint == 2)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL; if (runint == 1)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; windowno = CHAR_WINDOWTYPE_MEMBER_NEXT4; break; case WINDOW_NEXT4: runint = MemberMan_GetMenuStr( meindex, toindex, npcarg, token,WINDOW_NEXT4); if( runint == 0 ) { print( "MemberMan GetMenu ERROR !!"); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; if (runint == 2)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL; if (runint == 1)buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; windowno = CHAR_WINDOWTYPE_MEMBER_NEXT5; break; case WINDOW_NEXT5: runint = MemberMan_GetMenuStr( meindex, toindex, npcarg, token,WINDOW_NEXT5); if( runint == 0 ) { print( "MemberMan GetMenu ERROR !!"); return; } windowtype = WINDOW_MESSAGETYPE_SELECT; buttontype = WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; windowno = NPC_TRANSERMAN_WARP; break; case WINDOW_WARP: if( ActionNpc_CheckMenuFree( meindex, toindex, npcarg, select) == FALSE ){ memset( token, 0, sizeof( token)); if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FAIL_MSG", token, sizeof( token) ) != NULL) { CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); } } return; case WINDOW_END: break; } lssproto_WN_send( fd, windowtype, buttontype, windowno, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); }
void NPC_FreePetSkillShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { int skill; int pet; int slot; int cost; int skillID=0; int petskillindex; char buf[64]; char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; char msg[512]; int petindex; char msgbuf[128]; double rate= 1.0; //#ifdef _STONEAGEA8XXX_S int petskCostFametemp=-1; //#endif if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ print("GetArgStrErr"); return; } if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { return; } if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; } if( CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ; switch( seqno) { case SELECTSKILL_START: if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 2 ) { CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); return; } NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, SKILL_WINDOW, -1); break; case SELECTSKILL_TEACH: if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 3 ) { CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); return; } makeStringFromEscaped( data); getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf)); skill=atoi(buf); getStringFromIndexWithDelim(data,"|",2,buf,sizeof(buf)); pet=atoi(buf); getStringFromIndexWithDelim(data,"|",3,buf,sizeof(buf)); slot=atoi(buf); getStringFromIndexWithDelim(data,"|",4,buf,sizeof(buf)); cost=atoi(buf); if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){ getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf)); skillID=atoi(buf); } slot--; if( slot < 0 ) return; petindex = CHAR_getCharPet( talkerindex, pet-1); if( !CHAR_CHECKINDEX(petindex) ){ CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); return ; } if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){ rate = atof( msg); } #ifdef _STONEAGEA8XXX_S if( NPC_Util_GetStrFromStrWithDelim( argstr, "petskCostFame", msg, sizeof( msg)) != NULL){ getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf)); petskCostFametemp = atoi(buf); } #endif petskillindex = PETSKILL_getPetskillArray( skillID ); if( !PETSKILL_CHECKINDEX( petskillindex)){ CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); return ; } cost = PETSKILL_getInt( petskillindex, PETSKILL_COST ); cost = cost * rate; //条件判断 if(CHAR_getInt(talkerindex,CHAR_GOLD) < cost && CHAR_getInt(talkerindex,CHAR_FAME)< petskCostFametemp){ CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); return; } if( NPC_CHECKFREEPETSKILL( talkerindex, petindex, skillID ) == TRUE ){ if( Action_RunDoEventAction( meindex, talkerindex, argstr) == FALSE ){ CHAR_talkToCli( talkerindex, -1, "所需物品不足!!", CHAR_COLORYELLOW); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); return; } CHAR_setPetSkill( petindex, slot, skillID); CHAR_setInt( talkerindex, CHAR_GOLD, ( CHAR_getInt( talkerindex, CHAR_GOLD) - cost) ); #ifdef _STONEAGEA8XXX_S if (petskCostFametemp!=-1 && petskCostFametemp!=0){ CHAR_setInt( talkerindex, CHAR_FAME, ( CHAR_getInt( talkerindex, CHAR_FAME) - petskCostFametemp) ); snprintf( msgbuf, sizeof( msgbuf ), "扣除声望点数:%4.2f",petskCostFametemp/100); } #endif CHAR_talkToCli( talkerindex, -1, msgbuf, CHAR_COLORYELLOW); snprintf( msgbuf, sizeof( msgbuf ), "W%d",pet-1); CHAR_sendStatusString( talkerindex, msgbuf ); CHAR_sendStatusString( talkerindex, "P"); CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); //WARP if( NPC_SkillShopWarp( meindex, talkerindex) == TRUE ) return; }else { CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); CHAR_talkToCli( talkerindex, -1, "条件不足!!", CHAR_COLORYELLOW); } //ADD NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, SKILL_WINDOW, -1); break; case SELECTSKILL_END: break; } return; }
int NPC_Lua_NLG_GiveRandItem(lua_State *_NLL) { CheckEx2(_NLL, 2, 3); CheckIndexNull(_NLL, 1); int TM_Index = (int)lua_tointeger(_NLL, 1); char *TM_ItemIdData = lua_tostring(_NLL, 2); int TM_Num = 1; int TM_ItemIndex = -1; int TM_Int = -1; int TM_Type = 0; int TM_ItemId = -1; if(lua_gettop(_NLL) == 3) { TM_Type = (int)lua_tointeger(_NLL, 3); } int TM_ItemIdStart = -1; int TM_ItemIdEnd = -1; char ItemIdBuf[32]; if(getStringFromIndexWithDelim(TM_ItemIdData,",", 2, ItemIdBuf, sizeof(ItemIdBuf)) != FALSE){ int TM_ItemNum = 0; while(1){ if(getStringFromIndexWithDelim(TM_ItemIdData,",", TM_ItemNum+1, ItemIdBuf, sizeof(ItemIdBuf)) == FALSE) break; TM_ItemNum++; } TM_ItemNum = RAND(1,TM_ItemNum); getStringFromIndexWithDelim(TM_ItemIdData,",", TM_ItemNum, ItemIdBuf, sizeof(ItemIdBuf)); char ItemIdBuf2[16]; if( getStringFromIndexWithDelim(ItemIdBuf,"-", 2, ItemIdBuf2, sizeof(ItemIdBuf2)) != FALSE){ int TM_ItemIdStart,TM_ItemIdEnd; getStringFromIndexWithDelim(ItemIdBuf,"-", 1, ItemIdBuf2, sizeof(ItemIdBuf2)); TM_ItemIdStart = atoi(ItemIdBuf2); getStringFromIndexWithDelim(ItemIdBuf,"-", 2, ItemIdBuf2, sizeof(ItemIdBuf2)); TM_ItemIdEnd = atoi(ItemIdBuf2); TM_ItemId = RAND(TM_ItemIdStart,TM_ItemIdEnd); }else{ TM_ItemId = atoi(ItemIdBuf); } }else if(getStringFromIndexWithDelim(TM_ItemIdData,"-", 2, ItemIdBuf, sizeof(ItemIdBuf)) != FALSE){ if(getStringFromIndexWithDelim(TM_ItemIdData,"-", 1, ItemIdBuf, sizeof(ItemIdBuf)) != FALSE) TM_ItemIdStart = atoi(ItemIdBuf); if(getStringFromIndexWithDelim(TM_ItemIdData,"-", 2, ItemIdBuf, sizeof(ItemIdBuf)) != FALSE) TM_ItemIdEnd = atoi(ItemIdBuf); if(TM_ItemIdStart<=TM_ItemIdEnd){ TM_ItemId = RAND(TM_ItemIdStart,TM_ItemIdEnd); } }else{ TM_ItemId = atoi(TM_ItemIdData); } if(TM_ItemId>-1){ TM_Int = NPC_GiveItem( TM_Index, TM_ItemId); } if(TM_Int>=0){ char TM_Buff[256]; snprintf(TM_Buff, sizeof(TM_Buff), "获得 %s。", ITEM_getChar( TM_Int, ITEM_NAME)); CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); if(TM_Type>0){ time_t timep; struct tm *p; time(&timep); p=localtime(&timep); timep = mktime(p); TM_Type = timep + TM_Type; ITEM_setInt(TM_Int,ITEM_TIME,TM_Type); sprintf(TM_Buff,"[限时]%s",ITEM_getChar(TM_Int,ITEM_NAME)); ITEM_setChar(TM_Int,ITEM_NAME,TM_Buff); ITEM_setChar(TM_Int,ITEM_SECRETNAME,TM_Buff); CHAR_sendStatusString(TM_Index,"I"); // timep = TM_Type; // p=localtime(&timep); // int year=1900+p->tm_year; // int mon=1+p->tm_mon; // int date=p->tm_mday; // int hour=p->tm_hour; // int min=p->tm_min; // int sec=p->tm_sec; // char monbuf[5],datebuf[5],hourbuf[5],minbuf[5],secbuf[5]; // if(mon<10) sprintf(monbuf,"0%d",mon); // else sprintf(monbuf,"%d",mon); // if(date<10) sprintf(datebuf,"0%d",date); // else sprintf(datebuf,"%d",date); // if(hour<10) sprintf(hourbuf,"0%d",hour); // else sprintf(hourbuf,"%d",hour); // if(min<10) sprintf(minbuf,"0%d",min); // else sprintf(minbuf,"%d",min); // if(sec<10) sprintf(secbuf,"0%d",sec); // else sprintf(secbuf,"%d",sec); // sprintf(TM_Buff,"有效期:%d.%s.%s/%s:%s:%s %s",year,monbuf,datebuf,hourbuf,minbuf,secbuf,ITEM_getChar(TM_Int,ITEM_EFFECTSTRING)); // ITEM_setChar(TM_Int,ITEM_EFFECTSTRING,TM_Buff); } } LRetInt(_NLL, TM_Int); }
void NPC_WarpManTalked( int meindex , int talkerindex , char *szMes ,int color ) { char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *npcarg; char token[256]; int RunType=-1; CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { return; } if(NPC_Util_isFaceToFace( meindex ,talkerindex ,2)==FALSE){ if(NPC_Util_isFaceToChara(talkerindex,meindex,1 )==FALSE) return; } if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==NULL){ print("GetArgStrErr"); return ; } #ifdef _NEW_WARPMAN if( strstr( npcarg,"NEWWARPMAN") ) { #ifdef _TREASURE_BOX if( CHAR_getWorkInt( meindex, NPC_TIME_EVENTMODE) == NPC_EVENTMODE_OPEN ) return; #endif NPC_NewWarpMan_selectWindow( meindex ,talkerindex, 0, -1, szMes); return; }else { if(NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE) {//有組隊 NPC_ERR_DiSP( meindex, talkerindex, 1); return; } RunType = CheckWarpMsg( meindex, talkerindex, npcarg , szMes); if( RunType !=0 ) { if( RunType == 1 ) { if( NPC_Util_GetStrFromStrWithDelim( npcarg, "nomal_msg", token, sizeof(token)) != NULL) { CHAR_talkToCli( talkerindex, meindex,token,CHAR_COLORWHITE); } } return; } } #else if(NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE) {//有組隊 NPC_ERR_DiSP( meindex, talkerindex, 1); return; } RunType = CheckWarpMsg( meindex, talkerindex, npcarg , szMes); if( RunType !=0 ) { if( RunType == 1 ) { if( NPC_Util_GetStrFromStrWithDelim( npcarg, "nomal_msg", token, sizeof(token)) != NULL) { CHAR_talkToCli( talkerindex, meindex,token,CHAR_COLORWHITE); } } return; } #endif CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); CHAR_setWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTTRD , 0 ); if(strstr(npcarg,"DR")!=NULL) { CHAR_setWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTSEC , -1 ); if(NPC_GetDuelPointCheck(meindex,talkerindex)==FALSE) return; }else{ NPC_WarpMan_selectWindow( meindex, talkerindex,0,-1); } }
void NPC_AlldomanWindowTalked(int meindex, int talkerindex, int seqno, int select,char *data) { char buf2[256]; char buf[256]; int i; int playernum = CHAR_getPlayerMaxNum(); //andy_log print( "seqno:%d\n", seqno); switch(seqno) { case NPC_ALLDOMAN_MAIN_WND: if ( select == WINDOW_BUTTONTYPE_NEXT ) { showpage ++ ; NPC_Alldoman_selectWindow(meindex , talkerindex , 4 ,""); } if ( select == WINDOW_BUTTONTYPE_OK ) { //CHAR_talkToCli(talkerindex,meindex,"看清楚了!",CHAR_COLORRED); showpage = 1 ; NPC_Alldoman_selectWindow(meindex , talkerindex, 5 ,""); } break; case NPC_ALLDOMAN_SELECT_WND: if(atoi(data)==2) { //CHAR_talkToCli(talkerindex,meindex,"1!",CHAR_COLORRED); if ( CHAR_getInt( talkerindex , CHAR_FLOOR ) != 8200 ) { CHAR_talkToCli(talkerindex,-1,"这里只能给真正的英雄刻写!",CHAR_COLORRED); break; } if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) > 132 || CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) <= 0 ) { CHAR_setWorkInt( talkerindex , CHAR_WORKHEROFLOOR , 0 ) ; CHAR_talkToCli(talkerindex,-1,"这里只能给真正的英雄刻写!",CHAR_COLORRED); break; } sprintf( buf2 , "你拿出了打败守灵者%3d的证明,试图将自己的姓名刻上石碑!" , CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) ); CHAR_talkToCli(talkerindex,-1,buf2,CHAR_COLORRED); if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) == 132 ) { sprintf( buf2 , "%s" , "尼斯大陆英雄" ) ; //到达顶层对全星系广播 sprintf( buf , "%s征服了英雄战场,由风之精灵将这个消息通知全世界,新的英雄诞生了!!" , CHAR_getChar( talkerindex, CHAR_NAME ) ); for( i = 0 ; i < playernum ; i++) { if( CHAR_getCharUse(i) != FALSE ) { CHAR_talkToCli( i, -1, buf, CHAR_COLORBLUE2); } } } else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 130 ) sprintf( buf2 , "%s" , "尼斯大陆战士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 125 ) sprintf( buf2 , "%s" , "尼斯大陆勇士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 120 ) sprintf( buf2 , "%s" , "萨伊那斯英雄" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 115 ) sprintf( buf2 , "%s" , "斯巴达战士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 110 ) sprintf( buf2 , "%s" , "萨姆吉尔战士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 100 ) sprintf( buf2 , "%s" , "玛丽那丝战士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 80 ) sprintf( buf2 , "%s" , "卡坦战士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 60 ) sprintf( buf2 , "%s" , "霍特尔战士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 40 ) sprintf( buf2 , "%s" , "降魔勇士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 20 ) sprintf( buf2 , "%s" , "圣灵勇士" ) ; else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 1 ) sprintf( buf2 , "%s" , "初犊勇士" ) ; else sprintf( buf2 , " " ); saacproto_UpdataStele_send ( acfd , CHAR_getChar( talkerindex , CHAR_CDKEY ), CHAR_getChar( talkerindex , CHAR_NAME ) , buf2 , CHAR_getInt( talkerindex , CHAR_LV ) , CHAR_getInt( talkerindex , CHAR_TRANSMIGRATION) , 10 , CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) ) ; //清除WorkFloor CHAR_setWorkInt( talkerindex , CHAR_WORKHEROFLOOR , 0 ) ; } if(atoi(data)==4) { //CHAR_talkToCli(talkerindex,meindex,"2!",CHAR_COLORRED); showpage = 1 ; NPC_Alldoman_selectWindow(meindex , talkerindex, 6 ,""); } if(atoi(data)==6) { //CHAR_talkToCli(talkerindex,meindex,"3!",CHAR_COLORRED); } break; case NPC_ALLDOMAN_LIST_WND: if( select == WINDOW_BUTTONTYPE_OK ){ print("\nSyu log FloorWorkint => %d" , CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR )); } if( select == WINDOW_BUTTONTYPE_PREV && showpage > 1 ) { showpage -- ; NPC_Alldoman_selectWindow(meindex , talkerindex, 6 ,"" ); } if( select == WINDOW_BUTTONTYPE_NEXT && showpage < totalpage ) { showpage ++ ; NPC_Alldoman_selectWindow(meindex , talkerindex, 6 ,""); } break; } }
void NPC_WarpManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE]; char *npcarg; char buf[NPC_UTIL_GETARGSTR_BUFSIZE]; #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((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==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( npcarg1 , buf); npcarg = (char *)npcarg1; 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 }
void NPC_DoormanTalked( int meindex , int talkerindex , char *msg , int color ) { char mode[128]; char opt[256]; char arg[NPC_UTIL_GETARGSTR_BUFSIZE]; /* 皿伊奶乩□互玉失穴件及1弘伉永玉动 卅日反氏及丹 */ if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return; NPC_Util_GetArgStr( meindex, arg, sizeof( arg)); if( !getStringFromIndexWithDelim( arg, "|", 1, mode, sizeof( mode ))) return; if( !getStringFromIndexWithDelim( arg, "|", 2, opt, sizeof( opt ) )) return; if( strcmp( mode , "gold" ) == 0 ){ int g = atoi( opt ); int yn = NPC_Util_YN( msg ); /*char *nm = CHAR_getChar( meindex , CHAR_NAME );*/ char msg[256]; if( g > 0 && yn < 0 ){ snprintf( msg ,sizeof( msg ) , "打开门需要给我%d的金子这样可以吗?", g ); CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE ); } else if( g > 0 && yn == 0 ){ snprintf( msg , sizeof( msg ), "打开门 %d的金子是必要的。", g ); } else if( g > 0 && yn == 1 ){ int now_g = CHAR_getInt( talkerindex, CHAR_GOLD ); if( now_g < g ){ snprintf( msg , sizeof( msg ) , "打开门 %d的金子是必要的。", g ); CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE ); } else { snprintf( msg , sizeof( msg ), "%d 收到金子了。现在就来开门。", g ); CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE ); /* 云嗯毛必永玄 */ now_g -= g; CHAR_setInt( talkerindex , CHAR_GOLD , now_g ); /* 丐凶日仄中旦 □正旦毛霜耨 */ CHAR_send_P_StatusString(talkerindex, CHAR_P_STRING_GOLD); /* 玉失夫日仁 */ NPC_DoormanOpenDoor( CHAR_getWorkChar( meindex, CHAR_WORKDOORMANDOORNAME)); } } } else if( strcmp( mode , "item" ) == 0 ){ CHAR_talkToCli( talkerindex, meindex , "尚在未支援模式。", CHAR_COLORWHITE); } else if( strcmp( mode , "itemhave" ) == 0 ){ CHAR_talkToCli( talkerindex, meindex , "尚在未支援模式。", CHAR_COLORWHITE); } else if( strcmp( mode , "itemnothave" ) == 0 ){ CHAR_talkToCli( talkerindex, meindex , "尚在未支援模式。", CHAR_COLORWHITE); } else if( strcmp( mode , "titlehave" ) == 0 ){ CHAR_talkToCli( talkerindex, meindex , "尚在未支援模式。", CHAR_COLORWHITE); } else if( strcmp( mode , "roomlimit" ) == 0 ){ /* 盒及谛醒孺蜃互丐月桦宁 */ char szOk[256], szNg[256], szBuf[32]; int checkfloor; int maxnum, i, iNum; if( !getStringFromIndexWithDelim( arg, "|", 2, szBuf, sizeof( szBuf ) )) return; /* 譬屯月白夫失午 谛醒 */ if( sscanf( szBuf, "%d:%d", &checkfloor, &maxnum ) != 2 ){ return; } for( iNum = 0,i = 0; i < getFdnum(); i ++ ){ /* 皿伊奶乩□动陆卞反饬 互 中 */ if( CHAR_getCharUse( i ) == FALSE )continue; if( CHAR_getInt( i, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue; /* 隙烂及白夫失动陆卞饬 互 中 */ if( CHAR_getInt( i, CHAR_FLOOR ) != checkfloor )continue; iNum++; } if( !getStringFromIndexWithDelim( arg, "|", 5, szNg, sizeof( szNg ))){ strcpy( szNg, "。。。。" ); /* 凤伞卅仄及本伉白 */ } if( !getStringFromIndexWithDelim( arg, "|", 4, szOk, sizeof( szOk ))){ strcpy( szOk, "开门吧。。。" ); /* 凤伞丐曰及本伉白 */ } if( iNum >= maxnum ){ /* 毛译尹化中月桦宁 */ CHAR_talkToCli( talkerindex, meindex ,szNg, CHAR_COLORWHITE); }else{ /* 卞 凶卅中桦宁 */ CHAR_talkToCli( talkerindex, meindex ,szOk, CHAR_COLORWHITE); NPC_DoormanOpenDoor( CHAR_getWorkChar( meindex, CHAR_WORKDOORMANDOORNAME)); } } else if( strcmp( mode , "titlenothave" ) == 0 ){ CHAR_talkToCli( talkerindex, meindex , "尚在未支援模式。", CHAR_COLORWHITE); } }
void NPC_OldmanTalked( int meindex , int talkerindex , char *msg , int color ) { char message[1024]; char *n = CHAR_getChar( talkerindex , CHAR_NAME ); int title_change = 0; /* ·´Ø¦Øƾ®ØêÐ׹Ʊå£ý·ßÛм°ID뷤ʢ½ñÁùÔ */ CHAR_setInt( talkerindex, CHAR_LASTTALKELDER , CHAR_getWorkInt( meindex, CHAR_WORKOLDMANID ) ); /* if( title_change == 0 && strcmp( n , "Æ»¹û" ) == 0 ){ if( NPC_Util_HaveTitle( talkerindex , 3 ) == 0 ){ char *ts; NPC_Util_AddOneTitle( talkerindex , 3 ); ts = TITLE_makeTitleStatusString( talkerindex , 3 ); snprintf( message , sizeof(message), "ÄÇÊǸö²»´íµÄÃû×Ö, ¾Í½Ð%s°É£¡", ts ); title_change = 1; } } */ { int addcnt,delcnt; title_change = TITLE_TitleCheck_Nomsg( talkerindex, 0, &addcnt, &delcnt); if( !title_change){ snprintf( message, sizeof( message ) , "À´µÄºÃ%sÔÚ¸øÄã³ÆºÅʱ" "²»ÊÇ»¹Ã»À´Âð£¿" , n ); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); } else { #define NPC_OLDMAN_TITLE_UNIT1 "TSU" #define NPC_OLDMAN_TITLE_UNIT2 "KO" snprintf( message, sizeof( message ) ,"À´µÄºÃ%s",n ); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); if( delcnt > 0 && addcnt > 0 ) { snprintf( message, sizeof( message ) , "ÄãɥʧÁË%d%s ³ÆºÅµÄ×ʸñ¡£" "²»Êǵõ½ÁË%d%s µÄ³ÆºÅ×ʸñÂð£¿" , delcnt, delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2, addcnt, addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2 ); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); } else if( delcnt > 0 ) { snprintf( message, sizeof( message ) , "ÄãÒÑɥʧµÃµ½%d%s³ÆºÅµÄ×ʸñ¡£", delcnt, delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); } else if( addcnt > 0 ) { snprintf( message, sizeof( message ) , "¸øÄã%d%sµÄ³ÆºÅ°É£¡", addcnt, // CoolFish: d%s -> %d%s 2001/4/18 addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); } if( delcnt > 0 ) { snprintf( message, sizeof( message), "ʧȥ%d%s ³ÆºÅ£¡", delcnt, delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); CHAR_talkToCli( talkerindex, -1, message, CHAR_COLORYELLOW); } if( addcnt > 0 ) { snprintf( message, sizeof( message), "»ñµÃ%d%s ³ÆºÅ£¡", addcnt, addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); CHAR_talkToCli( talkerindex, -1, message, CHAR_COLORYELLOW); } } } if( title_change ) CHAR_sendStatusString( talkerindex , "T" ); }
void NPC_FmLetterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { int button = -1; char buf[512]; /* ㄠ弘伉永玉動 及心 */ if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; /* 仇及它奴件玉它 寞及犯□正毛 心 戈 */ if( !NPC_FmLetter_readData( meindex, seqno - 100, FALSE) ) { print( "fmletter:readdata error\n"); return; } /* 瓷仄凶示正件毛譬屯月 */ if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) { button = atoi( data)+5; if( button > 12 ) { print( "fmletter:invalid button[%d]\n", button); return; } } else if( select & WINDOW_BUTTONTYPE_OK) button = 0; else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1; else if( select & WINDOW_BUTTONTYPE_YES) button = 2; else if( select & WINDOW_BUTTONTYPE_NO) button = 3; else if( select & WINDOW_BUTTONTYPE_PREV) button = 4; else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5; else { print( "fmletter:invalid button[%d]\n", select); return; } if( buttonproc[button].use == TRUE ) { int fd; int newwin = -1; fd = getfdFromCharaIndex( talkerindex); /* 示正件卞方勻化質 毛孔曰歹仃月 */ if( newwin == -1 ) { newwin = buttonproc[button].gotowin; } // Robin if( newwin == 5 ) { int emptyitemindexinchara = CHAR_findEmptyItemBox( talkerindex ); int itemindex = ITEM_makeItemAndRegist( w.letter ); if( emptyitemindexinchara < 0 ) return; if( itemindex != -1 ){ char msgbuf[128]; CHAR_setItemIndex( talkerindex, emptyitemindexinchara, itemindex ); /* Work犯□正毛澀爛 */ ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, talkerindex); CHAR_sendItemDataOne( talkerindex, emptyitemindexinchara); LogItem( CHAR_getChar( talkerindex, CHAR_NAME ), /* 平乓仿 */ CHAR_getChar( talkerindex, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD 在item的log中增加item名稱 itemindex, #else ITEM_getInt( itemindex, ITEM_ID ), /* 失奶 丞 寞 */ #endif "AddLetter(製作邀請函)", CHAR_getInt( talkerindex,CHAR_FLOOR), CHAR_getInt( talkerindex,CHAR_X ), CHAR_getInt( talkerindex,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); snprintf( msgbuf, sizeof( msgbuf), "製作%s成功\。", ITEM_getChar( itemindex, ITEM_NAME)); CHAR_talkToCli( talkerindex, -1,msgbuf, CHAR_COLORWHITE); } } // Robin if( newwin == 6 ) { int emptyitemindexinchara = CHAR_findEmptyItemBox( talkerindex ); int itemindex = ITEM_makeItemAndRegist( w.letter ); if( emptyitemindexinchara < 0 ) return; if( itemindex != -1 ){ char msgbuf[128]; CHAR_setItemIndex( talkerindex, emptyitemindexinchara, itemindex ); /* Work犯□正毛澀爛 */ ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, talkerindex); CHAR_sendItemDataOne( talkerindex, emptyitemindexinchara); LogItem( CHAR_getChar( talkerindex, CHAR_NAME ), /* 平乓仿 */ CHAR_getChar( talkerindex, CHAR_CDKEY ), #ifdef _add_item_log_name // WON ADD 在item的log中增加item名稱 itemindex, #else ITEM_getInt( itemindex, ITEM_ID ), /* 失奶 丞 寞 */ #endif "AddLetter(製作邀請函)", CHAR_getInt( talkerindex,CHAR_FLOOR), CHAR_getInt( talkerindex,CHAR_X ), CHAR_getInt( talkerindex,CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), ITEM_getChar( itemindex, ITEM_NAME), ITEM_getInt( itemindex, ITEM_ID) ); snprintf( msgbuf, sizeof( msgbuf), "製作%s成功\。", ITEM_getChar( itemindex, ITEM_NAME)); CHAR_talkToCli( talkerindex, -1,msgbuf, CHAR_COLORWHITE); } } if( !NPC_FmLetter_readData( meindex, newwin, FALSE) ) { print( "fmletter:readdata error\n"); return; } //fd = getfdFromCharaIndex( talkerindex); if( fd != -1 ) { lssproto_WN_send( fd, w.windowtype, w.buttontype, w.windowno+100, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), makeEscapeString( w.message, buf, sizeof(buf))); } } }
void NPC_DepotPet_Add( int meindex, int talker, int select, char *token) { int petindex; int selectpet; int emptyindex; char szPet[128]; int fd = getfdFromCharaIndex( talker ); if( fd == -1 ) { fprint( "err\n"); return; } // ʸÓÀÐþ·¸¡õÕý µÊ£ÛʸÓÀÐþ Øê ľ selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) -1; //print("\n selectpet:%d ", selectpet); petindex = CHAR_getCharPet( talker, selectpet); if( !CHAR_CHECKINDEX( petindex) ) return; // Robin 0725 if (CHAR_getInt( talker, CHAR_RIDEPET ) == selectpet ) { sprintf(token,"\n\nÆï³ËÖеijèÎïÎÞ·¨´æÈë²Ö¿âร¡"); return; } if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1 ) { sprintf(token,"\n\n¼Ò×åÊØ»¤ÊÞÎÞ·¨´æÈë²Ö¿âร¡"); return; } #ifdef _CHECK_ENEMY_PET { int j; for( j=0;j<ENEMYTEMP_getEnemyNum();j++ ) {//ENEMY_getEnemyNum() if( CHAR_getInt( petindex, CHAR_PETID) == ENEMYTEMP_getInt( j, E_T_TEMPNO ) ) {//ENEMY_getInt( j, ENEMY_TEMPNO) if( ENEMYTEMP_getInt( j, E_T_PETFLG ) == 0 ){//ENEMY_getInt( j, ENEMY_PETFLG) sprintf(token,"\n\nÕâÊDz»ÄܳÖÓеijèÎïร¡"); return; } } } } #endif // ÎëÎåë¼ëÔÊ£Ûó¡±å¼ëØÆ»¯ÃñÄáÓÀÛÍØÆ»¯ÖÐÔ¼°Æ¥£Ý³ð³ðÆ¥ÎëÖл¯ÖÐئÖм°·´Ôƾ®ØÆÖÐ emptyindex = CHAR_getCharDepotPetElement( talker); if( emptyindex == -1 ) { fprint( "err\n"); return; } // ¾ô ÉÍ åÃʸÓÀÐþئÈգݹ«Ä¾¼°è¶ ëÛÕÔÊ£Û if( CHAR_getInt( talker, CHAR_DEFAULTPET) == selectpet) { CHAR_setInt( talker, CHAR_DEFAULTPET, -1); lssproto_KS_send( fd, -1, TRUE); } // Øê ľ ±å£ÝʸÓÀÐþ¼°Ä̼þ·¸ÓÀÛ͵©Ã«Îìñâ¡õ CHAR_setDepotPetIndex( talker, emptyindex, petindex); // ʸÓÀÐþ ¾®ÈÕÛÕÔÊ CHAR_setCharPet( talker, selectpet, -1); // ¶ªÓÀ±¾¡õ³âäú NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token); // ÔÆàÅÓ¼ÈÕÔÊ CHAR_DelGold( talker, NPC_GETPOOLCOST( talker) ); // ÔÆàÅ·¸¡õÕý˪Ô CHAR_send_P_StatusString(talker,CHAR_P_STRING_GOLD); snprintf( szPet, sizeof( szPet ), "K%d", selectpet); // Þ¥ØÆÖÐʸÓÀÐþµ© ¡õÕýµ©ËªÔ»¹´ØêÔ CHAR_sendStatusString( talker, szPet ); // ʸÓÀÐþë ØêÐ×·òºë if( NPC_DepotPet_CheckRepeat( talker) == 0) // ¼ì²é±àÂëÖظ´³è { LogPet( CHAR_getChar( talker, CHAR_NAME ), /* ƽÅÒ·Â */ CHAR_getChar( talker, CHAR_CDKEY ), CHAR_getChar( petindex, CHAR_NAME), CHAR_getInt( petindex, CHAR_LV), "pool(´æÈë³èÎï²Ö¿â)", CHAR_getInt( talker,CHAR_FLOOR), CHAR_getInt( talker,CHAR_X ), CHAR_getInt( talker,CHAR_Y ), CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 ); } else { CHAR_talkToCli( talker, -1, "ÕâÊÇ·Ç·¨µÄ³èÎïà¸!!", CHAR_COLORYELLOW); } }
void NPC_EventSetFlg(int talker,int shiftbit) { int point=0; int array; int shift; #ifdef _TEACHER_SYSTEM int iGetFame = 0; #endif /*-- -1���º�����绥ئ����ì���� -*/ if(shiftbit==-1) return; if(shiftbit<=255){ array = shiftbit / 32; shift = shiftbit % 32; point = CHAR_getInt( talker, CHAR_ENDEVENT+array); // Arminius 8.24 prevent wash dp if (!(point & (1 << shift))) { // CoolFish: Family Adv 2001/8/4 AddFMAdv(talker, shiftbit); #ifdef _TEACHER_SYSTEM if(shiftbit < arraysizeof(FMAdvTbl)) iGetFame = FMAdvTbl[shiftbit]; #endif } #ifdef _TEACHER_SYSTEM iGetFame /= 20; // ��ʦ���ѧ������������ 5% (1/20) // ������õ�������û�д��0 if(iGetFame > 0){ // �����û�е�ʦ if(strlen(CHAR_getChar(talker,CHAR_TEACHER_ID)) > 0 && strlen(CHAR_getChar(talker,CHAR_TEACHER_NAME)) > 0){ int iPlayernum = CHAR_getPlayerMaxNum(),i; char szMsg[128]; // ��鵼ʦ�ڲ������� for(i=0;i<iPlayernum;i++){ if(CHAR_getCharUse(i) == FALSE) continue; if(strcmp(CHAR_getChar(talker,CHAR_TEACHER_ID),CHAR_getChar(i,CHAR_CDKEY)) == 0 && strcmp(CHAR_getChar(talker,CHAR_TEACHER_NAME),CHAR_getChar(i,CHAR_NAME)) == 0){ float fGetFame = (float)iGetFame/100; // ��ʦ������ CHAR_setWorkInt(i,CHAR_WORK_GET_TEACHER_FAME,CHAR_getWorkInt(i,CHAR_WORK_GET_TEACHER_FAME) + iGetFame); sprintf(szMsg,"���ѧ�� %s %.2f ������",CHAR_getChar(talker,CHAR_NAME),fGetFame); CHAR_talkToCli(i,-1,szMsg,CHAR_COLORYELLOW); break; } } } } #endif point = point | (1 << shift); CHAR_setInt( talker, CHAR_ENDEVENT+array, point); } else if(shiftbit<=510){ array = (shiftbit-255) / 32; shift = (shiftbit-255) % 32; point = CHAR_getInt( talker, CHAR_ENDEVENT9+array); point = point | (1 << shift); CHAR_setInt( talker, CHAR_ENDEVENT9+array, point); } }
void NPC_PetShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { int datanum = -1; if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { return; } //print("\n NPC_PetShopWindowTalked: data:%s seq:%d sel:%d ", data, seqno, select); makeStringFromEscaped( data); datanum = atoi( data); switch( seqno){ case CHAR_WINDOWTYPE_WINDOWPETSHOP_START: { int poolflg = CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG); if( ( datanum == 3 && poolflg) || // Âô³èÎï ( datanum == 2 && !poolflg ) ){ // ÁìÈ¡³èÎï NPC_PetShop_selectWindow( meindex, talkerindex, 1, -1 ); }else if( datanum == 1 && poolflg) { // ¼Ä·Å³èÎï if( CHAR_getCharPoolPetElement( talkerindex) != -1 ) { NPC_PetShop_selectWindow( meindex, talkerindex, 5, -1 ); } else { NPC_PetShop_selectWindow( meindex, talkerindex, 8, -1 ); } }else if( datanum == 2 && poolflg ) { // ÁìÈ¡³èÎï if( CHAR_getCharPetElement( talkerindex) != -1 ) { CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); NPC_PetShop_selectWindow( meindex, talkerindex, 9, 0); }else { NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); } } #ifdef _NPC_DEPOTPET else if( datanum == 4 ) { // ʹÓóèÎï²Ö¿â //print(" ʹÓóèÎï²Ö¿â "); CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); if( !CHAR_CheckDepotPet( talkerindex) ){ CHAR_GetDepotPet( meindex, talkerindex); CHAR_talkToCli( talkerindex, -1, "È¡µÃ³èÎÇëÉÔáᣡ", CHAR_COLORYELLOW); }else{ NPC_PoolPetShop_DepotPet_Menu( meindex, talkerindex); } } #endif } break; case CHAR_WINDOWTYPE_WINDOWPETSHOP_PETSELECT: if(select==WINDOW_BUTTONTYPE_CANCEL){ NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); }else{ NPC_PetShop_selectWindow( meindex, talkerindex, 2, datanum ); } break; case CHAR_WINDOWTYPE_WINDOWPETSHOP_PETSELECT2: if(select==WINDOW_BUTTONTYPE_CANCEL){ NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); }else{ NPC_PetShop_selectWindow( meindex, talkerindex, 6, datanum ); } break; case CHAR_WINDOWTYPE_WINDOWPETSHOP_MAIN: if(select==WINDOW_BUTTONTYPE_YES){ NPC_PetShop_selectWindow( meindex, talkerindex, 3,-1 ); }else{ NPC_PetShop_selectWindow( meindex, talkerindex,1,-1); } break; case CHAR_WINDOWTYPE_WINDOWPETSHOP_MAIN2: if(select==WINDOW_BUTTONTYPE_YES){ NPC_PetShop_selectWindow( meindex, talkerindex, 7,-1 ); }else { NPC_PetShop_selectWindow( meindex, talkerindex,5,-1); } break; case CHAR_WINDOWTYPE_WINDOWPETSHOP_ASKDRAW: if( select == WINDOW_BUTTONTYPE_YES){ if( CHAR_getCharPetElement( talkerindex) != -1 ) { NPC_PetShop_selectWindow( meindex, talkerindex, 11,-1 ); }else { NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); } }else { CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); NPC_PetShop_selectWindow( meindex, talkerindex, 9, 0); } break; case CHAR_WINDOWTYPE_WINDOWPETSHOP_GOLDOVER: if( select == WINDOW_BUTTONTYPE_YES){ NPC_PetShop_selectWindow( meindex, talkerindex, 4,-1 ); }else{ NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); } break; case CHAR_WINDOWTYPE_WINDOWPETSHOP_DRAWSELECT: if( select == WINDOW_BUTTONTYPE_PREV){ NPC_PetShop_selectWindow( meindex, talkerindex, 9, -1); }else if( select == WINDOW_BUTTONTYPE_NEXT) { NPC_PetShop_selectWindow( meindex, talkerindex, 9, 1); }else if( select != WINDOW_BUTTONTYPE_CANCEL) { if( CHAR_getCharPetElement( talkerindex) != -1 ) { NPC_PetShop_selectWindow( meindex, talkerindex, 10, datanum); }else { NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); } }else { NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); } break; #ifdef _NPC_DEPOTPET case CHAR_WINDOWTYPE_DEPOTPETSHOP_HANDLE: if( !CHAR_CheckDepotPet( talkerindex) ) return ; switch( datanum ) { case 1://·ÅÈë if( CHAR_findEmptyDepotPet( talkerindex) == -1 ){ CHAR_talkToCli( talkerindex, -1, "³èÎï²Ö¿âÒÑÂú£¡", CHAR_COLORYELLOW); return; } //NPC_DepotPet_Pet_printWindow( meindex, talkerindex); NPC_PetShop_selectWindow( meindex, talkerindex, 13, -1 ); break; case 2://È¡³ö if( CHAR_getCharPetElement( talkerindex) < 0 ) { CHAR_talkToCli( talkerindex, -1, "ÉíÉϳèÎïÀ¸Î»ÒÑÂú£¡", CHAR_COLORYELLOW); return; } NPC_PetShop_selectWindow( meindex, talkerindex, 14, 0); break; case 0: NPC_PetShop_selectWindow( meindex, talkerindex, 0, -1); break; } break; case CHAR_WINDOWTYPE_DEPOTPETSHOP_ADD: if(select==WINDOW_BUTTONTYPE_CANCEL){ NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); }else{ NPC_PetShop_selectWindow( meindex, talkerindex, 15, datanum ); } break; case CHAR_WINDOWTYPE_DEPOTPETSHOP_GET: if( select == WINDOW_BUTTONTYPE_PREV){ NPC_PetShop_selectWindow( meindex, talkerindex, 14, -1); }else if( select == WINDOW_BUTTONTYPE_NEXT) { NPC_PetShop_selectWindow( meindex, talkerindex, 14, 1); }else if( select != WINDOW_BUTTONTYPE_CANCEL) { if( CHAR_getCharPetElement( talkerindex) != -1 ) { NPC_PetShop_selectWindow( meindex, talkerindex, 16, datanum); }else { NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); } }else { NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); } break; case CHAR_WINDOWTYPE_DEPOTPETSHOP_ASKADD: // È·ÈÏ´æÈë²Ö¿â if(select==WINDOW_BUTTONTYPE_YES){ NPC_PetShop_selectWindow( meindex, talkerindex, 17,-1 ); }else { NPC_PetShop_selectWindow( meindex, talkerindex,13,-1); } break; case CHAR_WINDOWTYPE_DEPOTPETSHOP_ASKGET: // È·ÈÏÈ¡³ö²Ö¿â if( select == WINDOW_BUTTONTYPE_YES){ if( CHAR_getCharPetElement( talkerindex) != -1 ) { NPC_PetShop_selectWindow( meindex, talkerindex, 18,-1 ); }else { NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); } }else { CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); NPC_PetShop_selectWindow( meindex, talkerindex, 14, 0); } break; #endif case CHAR_WINDOWTYPE_WINDOWPETSHOP_END: if( select == WINDOW_BUTTONTYPE_OK){ NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); } break; // CoolFish: Add 2001/7/4 default: break; } }
/*---------------------------------------------------------------------- * Ö°ÚÐë¼Ôãâ * ¦ÐÑ * charaindex int ·ßÛм°index * toindex int ¼ÔãâÔÊÔÂÚм°index * magicindex int Ü·¼°index *---------------------------------------------------------------------*/ int MAGIC_OtherRecovery_Field( int charaindex, int toindex, int magicindex) { char *magicarg; float power; int workhp; int prevhp; char msgbuf[64]; #ifdef _TYPE_TOXICATION if( CHAR_CanCureFlg( charaindex, "HP") == FALSE )return FALSE; #endif magicarg = MAGIC_getChar( magicindex, MAGIC_OPTION ); power = atoi( magicarg ); power = RAND( (power*0.9), (power*1.1) ); #ifndef _MAGIC_REHPAI power *= GetRecoveryRate( toindex ); #endif prevhp = CHAR_getInt( toindex, CHAR_HP ); workhp = prevhp + (int)power; CHAR_setInt( toindex, CHAR_HP, min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { if( charaindex != toindex ) { CHAR_send_P_StatusString( toindex, CHAR_P_STRING_HP); } } CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_HP|CHAR_P_STRING_MP); if( charaindex != toindex) { CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MP); CHAR_PartyUpdate( toindex, CHAR_N_STRING_HP); } else { CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MP|CHAR_N_STRING_HP); } if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ){ int i; for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { int workindex = CHAR_getCharPet( charaindex, i ); if( workindex == toindex ){ CHAR_send_K_StatusString( charaindex, i, CHAR_K_STRING_HP); } } } if( charaindex != toindex) { snprintf( msgbuf, sizeof( msgbuf), "%sµÄÄ;ÃÁ¦»Ø¸´%d", CHAR_getUseName( toindex ), min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) - prevhp); CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE); if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { snprintf( msgbuf, sizeof( msgbuf), "½åÓÉ%sÄ;ÃÁ¦»Ø¸´%d", CHAR_getUseName( charaindex ), min( workhp,CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) - prevhp); CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORWHITE); } } else { snprintf( msgbuf, sizeof( msgbuf), "Ä;ÃÁ¦»Ø¸´%d", min( workhp,CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP)) - prevhp); CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE); } return TRUE; }
void NPC_PetDel3( int meindex, int talker, int select, char *token) { int petindex; int selectpet; int emptyindex; char szPet[128]; int workindex[CHAR_MAXPOOLPETHAVE]; int i; int cnt; selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) ; petindex = CHAR_getCharPoolPet( talker, selectpet); if( !CHAR_CHECKINDEX( petindex) ) return; emptyindex = CHAR_getCharPetElement( talker); if( emptyindex == -1 ) { fprint( "err\n"); return; } // Èç¹ûÊÇÊØ»¤ÊÞ¸ÄΪÆÕͨÊÞ if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1 && CHAR_getInt( talker, CHAR_FMLEADERFLAG) != 3 ) { CHAR_setInt( petindex, CHAR_PETFAMILY, 0); CHAR_talkToCli( talker, -1, "ÊØ»¤ÊÞ¸ÄΪÆÕͨÊÞ", CHAR_COLORYELLOW); } CHAR_setCharPet( talker, emptyindex, petindex); CHAR_setCharPoolPet( talker, selectpet, -1); NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token); snprintf( szPet, sizeof( szPet ), "K%d", emptyindex); CHAR_sendStatusString( talker, szPet ); snprintf( szPet, sizeof( szPet), "W%d",emptyindex); CHAR_sendStatusString( talker, szPet ); for( i = 0; i < CHAR_MAXPOOLPETHAVE; i ++ ) { workindex[i] = -1; } cnt = 0; for( i = 0; i < CHAR_MAXPOOLPETHAVE; i ++ ) { int petindex = CHAR_getCharPoolPet( talker, i); if( CHAR_CHECKINDEX( petindex) ) { workindex[cnt++] = petindex; } } for( i = 0; i < CHAR_MAXPOOLPETHAVE; i ++ ) { CHAR_setCharPoolPet( talker, i, workindex[i]); } LogPet( CHAR_getChar( talker, CHAR_NAME ), CHAR_getChar( talker, CHAR_CDKEY ), CHAR_getChar( petindex, CHAR_NAME), CHAR_getInt( petindex, CHAR_LV), "draw(ÁìÈ¡³èÎïµê)", CHAR_getInt( talker,CHAR_FLOOR), CHAR_getInt( talker,CHAR_X ), CHAR_getInt( talker,CHAR_Y ), CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 ); #ifdef _PET_EVOLUTION if( CHAR_getInt( petindex, CHAR_FUSIONBEIT) == 1 && CHAR_getInt( petindex, CHAR_FUSIONRAISE) > 0 ){//¼ì²éÊÇ·ñΪÈںϳè CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, (int)time( NULL)); } #endif }
BOOL NPC_AirCheckJoinParty( int meindex, int charaindex, BOOL msgflg) { //int fd; char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; int ret; NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); /* ��������� ���� */ if( !NPC_Util_charIsInFrontOfChar( charaindex, meindex, 1 )) return FALSE; /* ��ַ��� ���� */ if( CHAR_getWorkInt( meindex, NPC_WORK_MODE) != 0 ) { if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_GETTINGON); return FALSE; } /* ��������������շֻ� */ if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) != CHAR_PARTY_NONE) { if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_NOTPARTY); return FALSE; } /* �ɡ� ū������ë������������ */ if( CHAR_getEmptyPartyArray( meindex) == -1 ) { if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_OVERPARTY); return FALSE; } /* ʧ�� ة����������ë����(���ʧ�� ة) */ if( !NPC_AirCheckDeniedItem( meindex, charaindex, argstr)) { if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_DENIEDITEM); return FALSE; } #ifdef _ITEM_CHECKWARES if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE ) { CHAR_talkToCli( charaindex, -1, "��Я�������ϻ���", CHAR_COLORYELLOW); return FALSE; } #endif /* ʧ�� ة����������ë����( ۢʧ�� ة) */ if( !NPC_AirCheckAllowItem( meindex, charaindex, FALSE)) { if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_ALLOWITEM); return FALSE; } /* ��ì�P��������ë���� */ if( !NPC_AirCheckLevel( meindex, charaindex, argstr)) { if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_LEVEL); return FALSE; } /* ��ì���� �������������� */ // if( CHAR_getInt( charaindex, CHAR_NOWEVENT) != 0 || // CHAR_getInt( charaindex, CHAR_NOWEVENT2) != 0 || // CHAR_getInt( charaindex, CHAR_NOWEVENT3) != 0 ) // { // if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_EVENT); // return FALSE; // } /* ���ż���������ë���� ����ë���¼�ƥ�� ���������ͱ����³���� */ ret = NPC_AirCheckStone( meindex, charaindex, argstr); if( ret == -1 ) { if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_GOLD); return FALSE; } if( ret != 0 ) { char msgbuf[128]; /* ����ë���� */ CHAR_setInt( charaindex, CHAR_GOLD, CHAR_getInt( charaindex, CHAR_GOLD) - ret); /* ˪�� */ CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); snprintf( msgbuf, sizeof( msgbuf), "֧����%d Stone��", ret); CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); } /* �ɡ� ū�� �� */ //CHAR_JoinParty_Main( charaindex, meindex); //fd = getfdFromCharaIndex( charaindex ); //lssproto_PR_send( fd, 1, 1); return TRUE; }
void NPC_FmRankWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) { int myfmindex=-1; if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) return; switch( seqno) { case NPC_FMRANK_START: break; case NPC_FMRANK_SELECT: NPC_FmRank_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); break; case NPC_FMRANK_ADDPOINT: if(atoi(data)<1000 || atoi(data)>1000000){ CHAR_talkToCli( talkerindex, -1,"您追加的点数小于1000积分或大于100W积分!",CHAR_COLORRED); return; } if(sasql_ampoint(CHAR_getChar(talkerindex,CHAR_CDKEY),0,0)<atoi(data)){ CHAR_talkToCli( talkerindex, -1,"您的《个人积分》少于竞价的点数!",CHAR_COLORRED); return; } myfmindex = CHAR_getInt(talkerindex, CHAR_FMINDEX); if(myfmindex>0){ int myfmpoint = sasql_fmpoint_query(myfmindex); if(myfmpoint>0){ if(sasql_fmpoint_add(myfmindex,(myfmpoint+atoi(data)))==1){ sasql_ampoint(CHAR_getChar(talkerindex,CHAR_CDKEY),-atoi(data),1); CHAR_talkToCli( talkerindex, -1,"您已给自己的家族竞价点数成功!",CHAR_COLORRED); return; } } } break; case NPC_FMRANK_ADDFM: if(atoi(data)<5000 || atoi(data)>1000000){ CHAR_talkToCli( talkerindex, -1,"您首次竞价点数小于5000积分或大于100W积分!",CHAR_COLORRED); return; } if(sasql_ampoint(CHAR_getChar(talkerindex,CHAR_CDKEY),0,0)<atoi(data)){ CHAR_talkToCli( talkerindex, -1,"您的《个人积分》少于竞价的点数!",CHAR_COLORRED); return; } myfmindex = CHAR_getInt(talkerindex, CHAR_FMINDEX); if(myfmindex>0){ int myfmpoint = sasql_fmpoint_query(myfmindex); char* fmname = CHAR_getChar(talkerindex,CHAR_FMNAME); if(myfmpoint<=0){ if(sasql_fmindex_add(myfmindex,fmname,atoi(data))==1){ sasql_ampoint(CHAR_getChar(talkerindex,CHAR_CDKEY),-atoi(data),1); CHAR_talkToCli( talkerindex, -1,"您已给自己的家族竞价点数成功!",CHAR_COLORRED); return; } } } break; case NPC_FMRANK_TOP20: if( select == WINDOW_BUTTONTYPE_CANCEL ) return; if( select == WINDOW_BUTTONTYPE_NEXT ) { if(fmrankcnt>7){ NPC_FmRank_selectWindow( meindex, talkerindex, WINDOW_FMRANKTOP_NEXT, atoi( data)); return; } } if( select == WINDOW_BUTTONTYPE_PREV ) { if(fmrankcnt>7){ NPC_FmRank_selectWindow( meindex, talkerindex, WINDOW_FMRANKTOP_PREV, atoi( data)); return; } } break; } }