/************************************************
 * Ïä·¤«¤±¤é¤ì¤¿»þ¤Î½èÍý
 ************************************************/
void NPC_PrintpassmanTalked( int meindex , int talkerindex , char *msg ,
							 int color )
{
	int i;
	int charnum;
	/* ¥×¥ì¥¤¥ä¡¼¤¬¥É¥¢¥Þ¥ó¤Î2¥°¥ê¥Ã¥É°ÊÆâ¤Ê¤éÈ¿±þ¤¹¤ë¡£ */
	if(NPC_Util_CharDistance( talkerindex, meindex ) > 2)return;
	
	/* ¼«Ê¬ÍѤδÉÍý¿Í¤Î̾Á°¤ò¸¡º÷¤¹¤ë*/
	charnum  = CHAR_getCharNum();
	for(i= CHAR_getPlayerMaxNum() +CHAR_getPetMaxNum();
		i<charnum;
		i++){

		if( CHAR_getCharUse(i) &&
			CHAR_getInt( i ,CHAR_WHICHTYPE) == CHAR_TYPEROOMADMIN ){
			if( strcmp( CHAR_getWorkChar(i,CHAR_WORKCHAR_MYNAME),
						CHAR_getWorkChar( meindex, CHAR_WORKCHAR_ADMNAME))
				==0 )
			{
				break;
			}
		}
	}
	if( i < charnum ) {
		NPC_RoomAdminNew_DspRoomPasswd( meindex, i, talkerindex);
	}
	else {
		CHAR_talkToCli( talkerindex, meindex, "¡C¡C¡C", NPC_RANKING_MSGCOLOR);
	}
}
Exemplo n.º 2
0
BOOL NPC_reloadNPC(void)
{
	int i;
	int charnum = getFdnum()+ getPetcharnum()+getOtherscharnum();
	for(i=0;i<charnum;i++){
		if(!CHAR_CHECKINDEX(i)) continue;
		if(CHAR_getWorkInt(i,CHAR_WORKNPCTYPE)==1){
			NPC_Util_NPCDelete(i);
		}
	}
	if(NPC_readNPCSettingFiles( getNpcdir(), getNpctemplatenum(),
                                  getNpccreatenum() )==TRUE)
  	NPC_generateLoop( 1 );
  if(getReloadNpcType()==1){
  	int j;
  	int playernum = CHAR_getPlayerMaxNum();
  	for(j=0;j<playernum;j++){
  		if( CHAR_getCharUse(j) != FALSE ) {
  			if(CHAR_getWorkInt(j,CHAR_WORK_OFFLINE)==0 && CHAR_getWorkInt(j,CHAR_WORKBATTLEMODE)==BATTLE_CHARMODE_NONE){
  				CHAR_warpToSpecificPoint(j,CHAR_getInt(j,CHAR_FLOOR),CHAR_getInt(j,CHAR_X),CHAR_getInt(j,CHAR_Y));
  			}
  		}
  	}
  }
  return TRUE;
}
Exemplo n.º 3
0
int NPC_Lua_NLG_TalkToFloor(lua_State *_NLL)
{
	CheckEx2(_NLL, 2, 5);
	
	int TM_Top = lua_gettop(_NLL);
	int TM_floor = (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;
	int TM_playernum = CHAR_getPlayerMaxNum();
	int i = 0;

	for( i = 0 ; i < TM_playernum ; i++)
	{
		if( CHAR_getCharUse(i) != FALSE )
		{
			if (CHAR_getInt(i, CHAR_FLOOR) == TM_floor)
			{
			#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
				
			}
		}
	}

	if(TM_Ret == TRUE)
	{
		LRetInt(_NLL, 0);
	}else
	{
		LRetErrInt(_NLL , -2, "未知原因导致发送说话失败。");
	}
}
Exemplo n.º 4
0
/* 奶矛件玄蔽  
 * 申永玄白仿弘毛  化月分仃及質  
 */
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;

	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);
}
Exemplo n.º 5
0
static void sendmsg_toall( char *msg )
{
    int     i;
    int     playernum = CHAR_getPlayerMaxNum();

    for( i = 0 ; i < playernum ; i++) {
        if( CHAR_getCharUse(i) != FALSE ) {
			CHAR_talkToCli( i, -1, msg, CHAR_COLORYELLOW);
		}
	}
}
Exemplo n.º 6
0
/*------------------------------------------------------------------------
 * 蟈化及諦卞丟永本□斥毛霜月〔
 *----------------------------------------------------------------------*/
static void NPC_Sysinfo_SendMsgToAll( int meindex, char *msg)
{
    int     i;
    int     playernum = CHAR_getPlayerMaxNum();

    for( i = 0 ; i < playernum ; i++) {
        if( CHAR_getCharUse(i) != FALSE ) {
			CHAR_talkToCli( i, meindex, msg,
						CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR));
        }
	}
}
Exemplo n.º 7
0
/*
 * フロアを指定して、そのフロアにいるキャラ全員に同じメッセージ
 * を送信する関数。船面とかに使うのだ
 *
 *
 *
 *
 */
void NPC_Util_AnnounceFloor( int floorid , char *msg )
{
    int i;
    int charnum = CHAR_getCharNum();
    
    for(i=0;i<charnum;i++){
        if( CHAR_getCharUse(i) &&
            CHAR_getInt( i , CHAR_WHICHTYPE)  == CHAR_TYPEPLAYER  &&
            CHAR_getInt( i , CHAR_FLOOR ) == floorid  ){
            CHAR_talkToCli( i  , -1 , msg , CHAR_COLORWHITE );
        }
    }
}
Exemplo n.º 8
0
void CHAR_talkToFloor(int floor, int talkindex, char *message, CHAR_COLOR color) {
  int i = 0;
  int playernum = CHAR_getPlayerMaxNum();
  for(i = 0; i < playernum; i++) {
    if(CHAR_getCharUse(i) == FALSE) continue;
    if(!CHAR_CHECKINDEX(i))
      continue;
    if(CHAR_getInt(i, CHAR_FLOOR) == floor) {
      if(CHAR_getWorkInt(i, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE)
        CHAR_talkToCli(i, talkindex, message, color);
    }
  }
}
Exemplo n.º 9
0
//GM广播
void mproto_GMTalk_Recv(int fd,char* uid,int ntime,char* data)
{
    char    message[65530];
    int     i;
    int     playernum = CHAR_getPlayerMaxNum();
    if (uid == NULL || data == NULL ) return ;
    strcpy(message,"");
    sprintf(message,"GM[%s]:%s",uid,data);
    for( i = 0 ; i < playernum ; i++) {
        if( CHAR_getCharUse(i) != FALSE ) {
			CHAR_talkToCli( i, -1, message, CHAR_COLORWHITE);
        }
    }
}
Exemplo n.º 10
0
/*------------------------------------------------------------------------
 * 皿伊奶乩□及醒毛譬屯月
 *----------------------------------------------------------------------*/
static void NPC_Sysinfo_Msg_Player( int meindex, int tindex, char *msg)
{
    int     i, cnt = 0;
    int     playernum=CHAR_getPlayerMaxNum();
    char	buff[64];
    for( i=0 ; i<playernum ; i++ ){
        if( CHAR_getCharUse(i) != FALSE ) {
        	if( CHAR_getInt( i, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) {
        		cnt ++;
        	}
        }
	}
	snprintf( buff, sizeof( buff), "玩家有%d人。", cnt);
	CHAR_talkToCli( tindex, meindex, buff,
					CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR));

}
Exemplo n.º 11
0
int NPC_DoorSearchByName( char *name )
{
    int i;
    int charnum = CHAR_getCharNum();

    for(i= CHAR_getPlayerMaxNum()  + CHAR_getPetMaxNum();
        i<charnum;
        i++){

        if( CHAR_getCharUse(i) &&
            CHAR_getInt( i ,CHAR_WHICHTYPE) == CHAR_TYPEDOOR ){
            if( strcmp( CHAR_getWorkChar(i,CHAR_WORKDOORNAME),name)==0 ){
                return i;
            }
        }
    }
    return -1;
}
Exemplo n.º 12
0
static void ShutdownProc( void)
{
#define		SYSINFO_SHUTDOWN_MSG		"%d 分钟后开始进行系统停机维护, 请大家提前下线以免数据丢失。"
#define		SYSINFO_SHUTDOWN_MSG_COMP	"服务器已关闭。"
	int diff,hun;

	diff = NowTime.tv_sec - SERVSTATE_getShutdown();
	hun = SERVSTATE_getLimittime() - (diff/60);
	if( hun != SERVSTATE_getDsptime() ){
		char	buff[256];
		if( hun != 0 ) {
			snprintf( buff, sizeof(buff), SYSINFO_SHUTDOWN_MSG, hun);
		}
		else {
			strcpy( buff, SYSINFO_SHUTDOWN_MSG_COMP);
		}
		sendmsg_toall( buff);
		SERVSTATE_setDsptime(hun);
		if( hun == 1 ) {
			  int i=0;
    		unsigned int MAX_USER=0;
    
    		MAX_USER=getPlayercharnum();
    		for(i=0;i<MAX_USER;i++){
        	if( CHAR_getCharUse( i ) == FALSE )continue;
#ifdef _OFFLINE_SYSTEM
					if(CHAR_getWorkInt( i, CHAR_WORK_OFFLINE )!=0){
						CHAR_logout(i,TRUE);
					}else
#endif
          	CONNECT_setCloseRequest( getfdFromCharaIndex(i) , 1 );
    		}//for i
		    SERVSTATE_SetAcceptMore( 0 );
		}
	}
	/* closesallsockets */
	if( hun == 0) {
    	closeAllConnectionandSaveData();
		SERVSTATE_setShutdown(0);
		SERVSTATE_setDsptime(0);
		SERVSTATE_setLimittime(0);
	}
	
}
Exemplo n.º 13
0
int NPC_DoorSearchByPosition( int fl , int x, int y )
{
    int i;
    int charnum = CHAR_getCharNum();

    for(i=CHAR_getPlayerMaxNum() + CHAR_getPetMaxNum();
        i<charnum;
        i++)
    {
        if( CHAR_getCharUse(i) &&
            CHAR_getInt( i , CHAR_WHICHTYPE) == CHAR_TYPEDOOR &&
            CHAR_getInt( i , CHAR_FLOOR ) == fl &&
            CHAR_getInt( i , CHAR_X ) == x &&
            CHAR_getInt( i , CHAR_Y ) == y          ){
            return i;
        }
    }
    return -1;
}
Exemplo n.º 14
0
void NPC_CallFMMember(int meindex, int floor, int fmindex, char *fmname, int index)
{
	int i, charindex;
	char buf[256];
	extern int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER];
	print("CallFMMember_NPC_meindex:%d\n", meindex);
        for( i = 0; i < FAMILY_MAXMEMBER; i++)
        {
           charindex = familyMemberIndex[index][i];
           if( charindex >= 0 ) {
              if( CHAR_getCharUse(charindex) )
	      {
	      	 print("charindex:%d name:%s\n", charindex, CHAR_getChar(charindex, CHAR_NAME));
	         if (CHAR_getInt(charindex, CHAR_FLOOR) == floor)	continue;
	         if (CHAR_getWorkInt(charindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE)
	         {
	            int fd = getfdFromCharaIndex(charindex);
	            int charfloor = CHAR_getInt(charindex, CHAR_FLOOR);
	            int j = 0, checkflag = 0;
	            if (fd == -1)	continue;
#ifdef _FMVER21	            
	            if (CHAR_getInt(charindex, CHAR_FMLEADERFLAG) < 0 ||
	                CHAR_getInt(charindex, CHAR_FMLEADERFLAG) == FMMEMBER_APPLY)	continue;
#else
	            if (CHAR_getInt(charindex, CHAR_FMLEADERFLAG) <= 0 )	continue;
#endif	                
	            for (j = 0; j < FAMILY_FMPKFLOOR; j++)
	            {
	            	if (charfloor == fmpkflnum[j].fl)
	            		checkflag = 1;
	            }
	            if (checkflag != 1)
	            	lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE,
	            		WINDOW_BUTTONTYPE_YESNO, CHAR_WINDOWTYPE_FMPKCALLMAN_COME,
	            		CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),
	            		makeEscapeString("\n家族已经在PK罗~要不要加入呢?\n不过若是在组队状态中,将会脱离团队唷!", buf, sizeof(buf)));
	         }
	      }	 
	      else
	         familyMemberIndex[index][i] = -1;
	   }
	}                                                                                                                                    
}
Exemplo n.º 15
0
void NPC_DoormanTalked( int meindex , int talkerindex , char *msg ,
                     int color )
{
    char mode[128];
    char opt[256];
    char	arg1[NPC_UTIL_GETARGSTR_BUFSIZE];
    char *arg;

    /* ¥×¥ì¥¤¥ä¡¼¤¬¥É¥¢¥Þ¥ó¤Î1¥°¥ê¥Ã¥É°Ê  ¤Ê¤é¤Ï¤ó¤Î¤¦ */
    if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return;

	arg = NPC_Util_GetArgStr( meindex, arg1, sizeof( arg1));

    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 ) ,
                      "¥´¶}ªù»Ý­nµ¹§Ú%dªºª÷¤l³o¼Ë¥i¥H¶Ü¡H", g );
            CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE );
        } else if( g > 0 && yn == 0 ){
            snprintf( msg , sizeof( msg ),
                      "¥´¶}ªù %dªºª÷¤l¬O¥²­nªº¡C", g );
        } else if( g > 0 && yn == 1 ){
            int now_g = CHAR_getInt( talkerindex, CHAR_GOLD );
            if( now_g < g ){
                snprintf( msg , sizeof( msg ) ,
                          "¥´¶}ªù %dªºª÷¤l¬O¥²­nªº¡C", g );
            	CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE );
            } else {
                snprintf( msg , sizeof( msg ),
                          "%d ¦¬¨ìª÷¤l¤F¡C²{¦b´N¨Ó¶}ªù¡C", 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 ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "itemhave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "itemnothave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "titlehave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        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, "¡C¡C¡C¡C" );	/* »ñ³Ê¤Ê¤·¤Î¥»¥ê¥Õ */
		}
    	if( !getStringFromIndexWithDelim( arg, "|", 4, szOk, sizeof( szOk ))){
   			strcpy( szOk, "¶}ªù§a¡C¡C¡C" );	/* »ñ³Ê¤¢¤ê¤Î¥»¥ê¥Õ */
   		}

		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 ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);
    }
}
Exemplo n.º 16
0
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;
	}
}
Exemplo n.º 17
0
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);
    }
}
Exemplo n.º 18
0
void NPC_MicTalked( int meindex , int talkerindex , char *msg ,int color )
{

	int	i;
    	int     playernum;
	int	x,y;
	char	message[4096];
	char	buf[2048];	

   	if( CHAR_getInt(talkerindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return;
	if(CHAR_getWorkInt(meindex,CHAR_WORK_TYPE) == 0){
		if(NPC_Util_isFaceToChara(talkerindex,meindex,1 ) ==FALSE) return;
	}
		
	snprintf( buf, sizeof( buf), "%s\n%s",
				CHAR_getChar( talkerindex, CHAR_NAME),
				msg);
	
	// Robin 0621 族長廣播
	print(" MIC_FL:%d ", CHAR_getWorkInt( meindex, CHAR_WORK_FMFL ));
	if( CHAR_getWorkInt( meindex, CHAR_WORK_FMFL ) != 0 )
	{
#ifdef _FMVER21	
		if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER) 
#else
		if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == 1) 
#endif		
		    // && ( CHAR_getWorkInt( talkerindex, CHAR_WORKFMFLOOR) == CHAR_getWorkInt( meindex, CHAR_WORK_FLOOR ) ) )
		{
			print(" FMLeaderTalk_send:%s,%d,%d,%s ",
				CHAR_getChar( talkerindex, CHAR_FMNAME), CHAR_getInt( talkerindex, CHAR_FMINDEX),
				CHAR_getWorkInt( talkerindex, CHAR_WORKFMINDEXI), buf);
			
			sprintf(message, "[族長廣播]%s", buf);
			saacproto_ACFMAnnounce_send( acfd, 
						CHAR_getChar( talkerindex, CHAR_FMNAME), 
						CHAR_getInt( talkerindex, CHAR_FMINDEX),
						CHAR_getWorkInt( talkerindex, CHAR_WORKFMINDEXI),
						message,
						color
					);
			return;
		}
	    	
	}
	    	
	makeEscapeString( buf, message, sizeof(buf));

	playernum = CHAR_getPlayerMaxNum();

	for( i = 0; i < playernum; i ++ ) {
		BOOL flg = FALSE;
	        if( CHAR_getCharUse(i) == FALSE ) continue;
            	if( CHAR_getInt( i, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) continue;
		if( CHAR_getInt( i, CHAR_FLOOR) != CHAR_getWorkInt( meindex, CHAR_WORK_FLOOR) ){
			continue;
		}
		if( CHAR_getWorkInt( meindex, CHAR_WORK_MODE) == 0 ) {
			x = CHAR_getInt( i, CHAR_X);
			y = CHAR_getInt( i, CHAR_Y);
			if( x >= CHAR_getWorkInt( meindex, CHAR_WORK_LX) && 
				x <= CHAR_getWorkInt( meindex, CHAR_WORK_RX) &&
				y >= CHAR_getWorkInt( meindex, CHAR_WORK_LY) &&
				y <= CHAR_getWorkInt( meindex, CHAR_WORK_RY)){
				flg = TRUE;
			}
		}else {
			flg = TRUE;
		}
		if( flg) {
			CHAR_talkToCli( i, talkerindex, msg, CHAR_COLORYELLOW);
			if( CHAR_getWorkInt( meindex, CHAR_WORK_WIND) == 1 ) {
				if( CHAR_getWorkInt( i, CHAR_WORKBATTLEMODE) 
					== BATTLE_CHARMODE_NONE) 
				{
					int fd = getfdFromCharaIndex( i);
					if( fd != -1 ) {
						lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
										WINDOW_BUTTONTYPE_OK, 
										CHAR_WINDOWTYPE_MICMESSAGE,
										CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
										message);
					}
				}
			}
		}
	}
}
Exemplo n.º 19
0
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);
	}

}
Exemplo n.º 20
0
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);
      }
    }
  }
}