Пример #1
0
static BOOL ADDRESSBOOK_makeEntryFromCharaindex( int charaindex,
												 ADDRESSBOOK_entry* ae)
{
	char *cdkey;

	if( !CHAR_CHECKINDEX(charaindex) ) return FALSE;

	memset( ae,0,sizeof(ADDRESSBOOK_entry) );
	cdkey = CHAR_getChar( charaindex, CHAR_CDKEY);
	if( cdkey == NULL ){
		print( "ADDRESSBOOK_makeEntryFromCharaindex:"
			   " strange! getcdkeyFromCharaIndex returns NULL!"
			   " charaindex: %d\n" , charaindex );
		return FALSE;
	}
	strcpysafe( ae->cdkey , sizeof( ae->cdkey ),cdkey);

	strcpysafe( ae->charname,sizeof( ae->charname),
				CHAR_getChar(charaindex,CHAR_NAME) );
	ae->level       = CHAR_getInt( charaindex , CHAR_LV );
	ae->duelpoint   = CHAR_getInt( charaindex, CHAR_DUELPOINT);
	ae->graphicsno  = CHAR_getInt( charaindex , CHAR_FACEIMAGENUMBER );
	ae->online = getServernumber();
	ae->use = TRUE;
	ae->transmigration = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION);

	return TRUE;
}
Пример #2
0
int init(int argc, char **argv, char **env) {
#ifdef _ITEM_QUITPARTY
  FILE *f;
  int i;
  char line[256];
#endif
  srand(getpid());
  print("This Program is compiled at %s %s by gcc %s\n",
        __DATE__, __TIME__, __VERSION__);

  defaultConfig(argv[0]);
  signalset();

  GOTORETURNFALSEIFFALSE(parseCommandLine(argc, argv));
  GOTORETURNFALSEIFFALSE(parseEnvironment(env));

  {
    Char aho;
    debug(sizeof(aho), d);
    debug(sizeof(aho.data), d);
    debug(sizeof(aho.string), d);
    debug(sizeof(aho.flg), d);
    debug(sizeof(aho.indexOfExistItems), d);
    debug(sizeof(aho.haveSkill), d);
    debug(sizeof(aho.indexOfHaveTitle), d);
    debug(sizeof(aho.addressBook), d);
    debug(sizeof(aho.workint), d);
    debug(sizeof(aho.workchar), d);
  }

  print("配置文件: %s\n", getConfigfilename());

  GOTORETURNFALSEIFFALSE(readconfigfile(getConfigfilename()));

  nice(getrunlevel());
  {
    int iWork = setAcWBSize();
    if(iWork == 0) {
      printf("----------------------------------------\n");
      printf("-------------[AC缓冲] 无法设置 %s\n", getConfigfilename());
      printf("----------------------------------------\n");
      exit(1);
    } else {
      printf("AC缓冲 = %d\n", iWork);
    }
  }

  if(getDebuglevel() >= 1) {
    print("调试等级: %d\n", getDebuglevel());
    print("运行等级: %d\n", getrunlevel());
    print("接收缓冲: %d\n", getrecvbuffer() * 1024);
    print("发送缓冲: %d\n", getsendbuffer() * 1024);
    print("接收缓冲下限: %d\n", getrecvlowatbuffer());
    print("内存单元大小: %d\n", getMemoryunit());
    print("内存单元数量: %d\n", getMemoryunitnum());

    print("账号服务器地址: %s\n", getAccountservername());
    print("账号服务器端口: %d\n", getAccountserverport());
    print("登陆服务器名称: %s\n", getGameservername());
    print("登陆服务器密码: %s\n", getAccountserverpasswd());

    print("等待连接端口: %d\n", getPortnumber());

    print("服务端序列号: %d\n", getServernumber());

    print("重复地址使用: %d\n", getReuseaddr());


    print("最大在线人数: %d\n", getFdnum());
    print("最大在线宠数: %d\n", getPetcharnum());
    print("最大其他数目: %d\n", getOtherscharnum());
    print("最大对象数目: %d\n", getObjnum());
    print("最大物品数目: %d\n", getItemnum());
    print("最大战斗数目: %d\n", getBattlenum());
    print("顶层文件目录: %s\n", getTopdir());
    print("地图文件目录: %s\n", getMapdir());
    print("地图标识文件: %s\n", getMaptilefile());
    print("物品配置文件: %s\n", getItemfile());
    print("不可战斗文件: %s\n", getInvfile());
    print("显示位置文件: %s\n", getAppearfile());
    print("头衔名称文件: %s\n", getTitleNamefile());
    print("头衔配置文件: %s\n", getTitleConfigfile());
    print("遇敌坐标文件: %s\n", getEncountfile());
    print("遇敌组群文件: %s\n", getGroupfile());
    print("宠物基本文件: %s\n", getEnemyBasefile());
    print("创建宠物文件: %s\n", getEnemyfile());
    print("精灵魔法文件: %s\n", getMagicfile());

#ifdef _ATTACK_MAGIC
    print("攻击魔法文件: %s\n", getAttMagicfileName());
#endif

    print("宠物技能文件: %s\n", getPetskillfile());
    print("物品成份文件: %s\n", getItematomfile());
    print("猜迷问题文件: %s\n", getQuizfile());
#ifdef _GMRELOAD
    print("G M 配置文件: %s\n", getGMSetfile());
#endif
    print("日志记录文件: %s\n", getLsgenlogfilename());
    print("还原资料目录: %s\n", getStoredir());
    print("NPC 配置目录: %s\n", getNpcdir());
    print("日志记载文件: %s\n", getLogdir());
    print("日志配置文件: %s\n", getLogconffile());
    print("GM的指命密码: %s\n", getChatMagicPasswd());
    print("使用GM的权限: %d\n", getChatMagicCDKeyCheck());

    print("NPC 模板数目: %d\n", getNpctemplatenum());
    print("NPC 最大数目: %d\n", getNpccreatenum());

    print("走路时间间隔: %d\n", getWalksendinterval());
    print("清除所有间隔: %d\n", getCAsendinterval_ms());
    print("清除目标间隔: %d\n", getCDsendinterval_ms());
    print("执行一次时间: %d\n", getOnelooptime_ms());
    print("宠物清除时间: %d\n", getPetdeletetime());
    print("道具清除时间: %d\n", getItemdeletetime());
#ifdef _DEL_DROP_GOLD
    print("石器清除时间: %d\n", getGolddeletetime());
#endif
    print("数据保存间隔: %d\n", getCharSavesendinterval());

    print("名片最大数目: %d\n", getAddressbookoffmsgnum());
    print("读取频率协议: %d\n", getProtocolreadfrequency());

    print("连接错误上限: %d\n", getAllowerrornum());
#ifdef _GET_BATTLE_EXP
    print("战斗经验倍数: %d倍\n", getBattleexp() );
#endif
#ifdef _NEW_PLAYER_CF
    print("出生人物转数: %d转\n", getNewplayertrans());
    print("出生人物等级: %d级\n", getNewplayerlv());
    print("出生人物金钱: %d S\n", getNewplayergivegold());
    print("出生宠物等级: %d级\n", getNewplayerpetlv());
#ifdef _VIP_SERVER
    print("出生拥有点数: %d点\n", getNewplayergivevip());
#endif
    print("出生能骑等级: %d\n", getRidePetLevel());
#ifdef _NEW_PLAYER_RIDE
    print("出生配套骑宠: %s\n", getPlayerRide());
#endif
    print("出生拥有宠物: NO1:%d NO2:%d NO3:%d NO4:%d NO5:%d\n", getNewplayergivepet(0),
          getNewplayergivepet(1),
          getNewplayergivepet(2),
          getNewplayergivepet(3),
          getNewplayergivepet(4));
    print("出生拥有物品: ITEM1:%d ITEM2:%d ITEM3:%d ITEM4:%d ITEM5:%d\n"
              "       ITEM1:%d ITEM2:%d ITEM3:%d ITEM4:%d ITEM5:%d\n"
              "       ITEM1:%d ITEM2:%d ITEM3:%d ITEM4:%d ITEM5:%d\n", getNewplayergiveitem(0), getNewplayergiveitem(1),
          getNewplayergiveitem(2), getNewplayergiveitem(3), getNewplayergiveitem(4), getNewplayergiveitem(5),
          getNewplayergiveitem(6), getNewplayergiveitem(7), getNewplayergiveitem(8), getNewplayergiveitem(9),
          getNewplayergiveitem(10), getNewplayergiveitem(11), getNewplayergiveitem(12), getNewplayergiveitem(13),
          getNewplayergiveitem(14));
#endif
#ifdef _UNREG_NEMA
    print("禁止人物名称: 名字1:%s 名字2:%s 名字3:%s 名字4:%s 名字5:%s\n", getUnregname(0),
          getUnregname(1),
          getUnregname(2),
          getUnregname(3),
          getUnregname(4));
#endif
#ifdef _UNLAW_WARP_FLOOR
    print("禁止传送地图: 地图1:%d 地图2:%d 地图3:%d 地图4:%d 地图5:%d\n"
              "              地图1:%d 地图2:%d 地图3:%d 地图4:%d 地图5:%d\n", getUnlawwarpfloor(0),
          getUnlawwarpfloor(1),
          getUnlawwarpfloor(2),
          getUnlawwarpfloor(3),
          getUnlawwarpfloor(4),
          getUnlawwarpfloor(5),
          getUnlawwarpfloor(6),
          getUnlawwarpfloor(7),
          getUnlawwarpfloor(8),
          getUnlawwarpfloor(9));
#endif
#ifdef _WATCH_FLOOR
    print("是否全图观战: %s\n",getWatchFloorCF());
    if(strcmp(getWatchFloorCF(),"是"))
      print("允许观战地图: 地图1:%d 地图2:%d 地图3:%d 地图4:%d 地图5:%d\n",getWatchFloor(1),
                                                                    getWatchFloor(2),
                                                                    getWatchFloor(3),
                                                                    getWatchFloor(4),
                                                                    getWatchFloor(5));
#endif

#ifdef _BATTLE_FLOOR
    print("是否强制战斗: %s\n",getBattleFloorCF());
    if(strcmp(getBattleFloorCF(),"是"))
      print("强制战斗地图: 地图1:%d 地图2:%d 地图3:%d 地图4:%d 地图5:%d\n",getBattleFloor(1),
                                                                    getBattleFloor(2),
                                                                    getBattleFloor(3),
                                                                    getBattleFloor(4),
                                                                    getBattleFloor(5));
#endif

#ifdef _TRANS_LEVEL_CF
    print("人物等级转数: %d级\n", getChartrans());
    print("宠物等级转数: %d级\n", getPettrans());
#endif

#ifdef _POINT
    print("禁止点数上限: %s\n", getPoint());
    if(strcmp(getPoint(), "是"))
      print("每转点数上限: 0转:%d 1转:%d 2转:%d 3转:%d 4转:%d 5转:%d 6转:%d\n", getTransPoint(0),
            getTransPoint(1),
            getTransPoint(2),
            getTransPoint(3),
            getTransPoint(4),
            getTransPoint(5),
            getTransPoint(6));
#endif
#ifdef _PET_UP
    print("宠物能否捡获: %s\n", getPetup());
#endif
#ifdef _LOOP_ANNOUNCE
    print("循环公告路径: %s\n",getLoopAnnouncePath());
    print("循环时间间隔: %d分钟\n",getLoopAnnounceTime());
#endif
#ifdef _SKILLUPPOINT_CF
    print("每级升级点数: %d\n",getSkup());
#endif

#ifdef _RIDELEVEL
    print("骑宠等级相差: %d级\n",getRideLevel());
#endif
#ifdef _REVLEVEL
    print("还原上限等级: %s级\n",getRevLevel());
#endif
#ifdef _TRANS_LEVEL_CF
    print("一般等级上限: %d级\n", getYBLevel());
    print("最高等级上限: %d级\n", getMaxLevel());
#endif
#ifdef _FIX_CHARLOOPS
    print("恶魔时间倍数: %d倍\n", getCharloops());
#endif
#ifdef _PLAYER_ANNOUNCE
    if(getPAnnounce() == -1)
      print("喇叭消耗点数: 关闭使用\n");
    else
      print("喇叭消耗点数: %d点\n", getPAnnounce());
#endif
#ifdef _PLAYER_MOVE
    if(getPMove() == -1)
      print("顺移消耗点数: 关闭使用\n");
    else
      print("顺移消耗点数: %d点\n", getPMove());
#endif
#ifdef _BATTLE_GOLD
    print("战斗获得金钱: %d%\n", getBattleGold());
#endif
#ifdef _ANGEL_TIME
    print("精灵召唤时间: (%d人/在线人数)分\n", getAngelPlayerTime());
    print("精灵召唤人数: %d人\n", getAngelPlayerMun());
#endif
#ifdef _RIDEMODE_20
    print("2.0 骑宠模式: %d\n", getRideMode());
#endif
#ifdef _FM_POINT_PK
    print("庄园互抢模式: %s\n", getFmPointPK());
#endif
  }

  {  //andy_add 2003/05/05 check GameServer Name
    char *GameServerName;
    GameServerName = getGameserverID();
    if(GameServerName == NULL || strlen(GameServerName) <= 0)
      return FALSE;
    print("\n游戏服务器ID: %s\n", GameServerName);
  }
  print("开始初始化\n");

//#define DEBUG1( arg... ) if( getDebuglevel()>1 ){##arg}
  print("建立内存空间...");
  GOTORETURNFALSEIFFALSE(configmem(getMemoryunit(),
                                   getMemoryunitnum()));
  GOTORETURNFALSEIFFALSE(memInit());
  print("完成\n");

  print("始终化连接空间...");
  if(!initConnect(getFdnum()))
    goto MEMEND;
  print("完成\n");
  while(1) {
    print("尝试绑定本地端口 %d... ", getPortnumber());
    bindedfd = bindlocalhost(getPortnumber());
    if(bindedfd == -1)
      sleep(10);
    else
      break;
  }
  print("完成\n");

  print("建立对象...");
  if(!initObjectArray(getObjnum()))
    goto CLOSEBIND;
  print("完成\n");

  print("建立人物...");
  if(!CHAR_initCharArray(getFdnum(), getPetcharnum(), getOtherscharnum()))
    goto CLOSEBIND;
  print("完成\n");
  print("建立物品...");
  if(!ITEM_readItemConfFile(getItemfile()))
    goto CLOSEBIND;
  if(!ITEM_initExistItemsArray(getItemnum()))
    goto CLOSEBIND;
  print("完成\n");

  print("建立战斗...");
  if(!BATTLE_initBattleArray(getBattlenum()))
    goto CLOSEBIND;
  print("完成\n");

  print("建立功能模块...");
  if(!initFunctionTable())
    goto CLOSEBIND;
  print("完成\n");

  print("初始化邮件...");
  if(!PETMAIL_initOffmsgBuffer(getAddressbookoffmsgnum()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取不可战斗文件...");
  if(!CHAR_initInvinciblePlace(getInvfile()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取显示位置文件...");
  if(!CHAR_initAppearPosition(getAppearfile()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取头衔名称文件...");
  if(!TITLE_initTitleName(getTitleNamefile()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取头衔配置文件...");
  if(!TITLE_initTitleConfig(getTitleConfigfile()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取遇敌坐标文件...");
  if(!ENCOUNT_initEncount(getEncountfile()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取宠物基本文件...");
  if(!ENEMYTEMP_initEnemy(getEnemyBasefile()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取创建宠物文件...");
  if(!ENEMY_initEnemy(getEnemyfile()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取遇敌组群文件...");
  if(!GROUP_initGroup(getGroupfile()))
    goto CLOSEBIND;
  print("完成\n");
  print("读取魔法文件...");
  if(!MAGIC_initMagic(getMagicfile()))
    goto CLOSEBIND;
  print("完成\n");

#ifdef _ATTACK_MAGIC

  print("读取魔法攻击文件...");

  if(!ATTMAGIC_initMagic(getAttMagicfileName()))
//		if( !ATTMAGIC_initMagic( getMagicfile() ) )
    goto CLOSEBIND;

  print("魔法攻击文件 -->%s...", getAttMagicfileName());
  print("完成\n");

#endif

  print("读取宠物技能文件...");
  if(!PETSKILL_initPetskill(getPetskillfile()))
    goto CLOSEBIND;
  print("完成\n");

  print("读取物品成份文件...");
  if(!ITEM_initItemAtom(getItematomfile()))
    goto CLOSEBIND;
  print("完成\n");

  print("初始化料理合成物品...");
  if(!ITEM_initItemIngCache())
    goto CLOSEBIND;
  print("完成\n");

  print("初始料理合成随机设定...");
  if(!ITEM_initRandTable())
    goto CLOSEBIND;
  print("完成\n");

  print("读取猜迷问题文件...");
  if(!QUIZ_initQuiz(getQuizfile()))
    goto CLOSEBIND;
  print("完成\n");
#ifdef _GMRELOAD
  print("读取GM配置文件...");
  if(!LoadGMSet(getGMSetfile()))
    goto CLOSEBIND;
  print("完成\n");
#endif

#ifdef _USER_EXP_CF
  print( "读取经验配置文件..." );
  if ( !LoadEXP( getEXPfile() ) )
    goto CLOSEBIND;
  print("最高等级: %d...",getMaxLevel());
  print("一般等级: %d...",getYBLevel());
  print( "完成\n" );
#endif

#ifdef _LOOP_ANNOUNCE
  print("读取循环公告文件...");
  if(!loadLoopAnnounce())
    print("...失败\n");
  else
   print("完成\n");
#endif
#ifdef _RIDE_CF
  print("读取自定义骑宠文件...");
  if(!CHAR_Ride_CF_init())
    print("...失败\n");
  print("完成\n");
#endif
#ifdef _FM_LEADER_RIDE
  print("读取庄园族长专用骑宠文件...");
  if(!CHAR_FmLeaderRide_init())
    print("...失败\n");
  print("完成\n");
#endif
#ifdef _NEED_ITEM_ENEMY
  print("读取融合宠配置文件...");
  if(!need_item_eneny_init())
    print("...失败\n");
  print("完成\n");
#endif

  print("建立地图...");
  if(!MAP_initReadMap(getMaptilefile(), getMapdir()))
    goto CLOSEBIND;
  print("完成\n");
  print("读取NPC文件...");
  if(!NPC_readNPCSettingFiles(getNpcdir(), getNpctemplatenum(),
                              getNpccreatenum()))
    goto CLOSEBIND;
  print("完成\n");
  print("初始化 NPC 服务器... ");
  if(lssproto_InitServer(lsrpcClientWriteFunc, LSGENWORKINGBUFFER) < 0)
    goto CLOSEBIND;
  print("完成\n");
  print("尝试连接账号服务器... ");
  acfd = connectHost(getAccountservername(), getAccountserverport());
  if(acfd == -1)
    goto CLOSEBIND;

  print("完成\n");
  initConnectOne(acfd, NULL, 0);
  if(!CONNECT_acfdInitRB(acfd)) goto CLOSEAC;
  if(!CONNECT_acfdInitWB(acfd)) goto CLOSEAC;
  CONNECT_setCtype(acfd, AC);

  print("初始化 NPC 客户端 ... ");
  if(saacproto_InitClient(lsrpcClientWriteFunc, LSGENWORKINGBUFFER, acfd) < 0)
    goto CLOSEAC;
  print("完成\n");

  print("向账号服务器发送登陆请求... ");
  saacproto_ACServerLogin_send(acfd, getGameservername(), getAccountserverpasswd());

  print("完成\n");

  if(isExistFile(getLsgenlogfilename())) {
    lssproto_SetServerLogFiles(getLsgenlogfilename(), getLsgenlogfilename());
    saacproto_SetClientLogFiles(getLsgenlogfilename(), getLsgenlogfilename());
  }


  print("初始化已完成\n");

  print("开始记始日志\n");
  {
    if(!initLog(getLogconffile()))
      goto CLOSEAC;
  }
#ifdef _ITEM_QUITPARTY
  print("读取队伍解散物品消失文件...");

  //读取档案
  f = fopen(getitemquitparty(), "r");
  if(f != NULL) {
    while(fgets(line, sizeof(line), f)) {
      if(line[0] == '#')continue;
      if(line[0] == '\n')continue;
      chomp(line);
      itemquitparty_num++;
    }
    if(fseek(f, 0, SEEK_SET) == -1) {
      print("物品录找错误\n");
      fclose(f);
      goto CLOSEAC;
    }
    //配记忆体
    Disappear_Item = allocateMemory(sizeof(struct tagDisappearItem) * itemquitparty_num);
    if(Disappear_Item == NULL) {
      print("无法分配内存 %d\n", sizeof(struct tagDisappearItem) * itemquitparty_num);
      fclose(f);
      goto CLOSEAC;
    }

    i = 0;
    //将道具编号存入 Disappear_Item.string
    while(fgets(line, sizeof(line), f)) {
      if(line[0] == '#')continue;
      if(line[0] == '\n')continue;
      chomp(line);
      sprintf(Disappear_Item[i].string, "%s", line);
      print("\n道具编号:%s", Disappear_Item[i].string);
      i++;
    }
    fclose(f);
  }
#endif

  DEBUG_ADJUSTTIME = 0;
  return TRUE;

  CLOSEAC:
  close(acfd);
  CLOSEBIND:
  close(bindedfd);
  endConnect();
  MEMEND:
  memEnd();
  RETURNFALSE:
  return FALSE;
}
Пример #3
0
void ADDRESSBOOK_DispatchMessage( char *cd, char *nm, char *value, int mode)
{
	int		i;
	char work[256];
	int	online,level,duelpoint, faceimagenumber, transmigration;
	int	playernum = CHAR_getPlayerMaxNum();
	int ret;

	getStringFromIndexWithDelim( value, "|" , 1 , work , sizeof( work ));
	online = atoi( work);
	getStringFromIndexWithDelim( value, "|" , 2 , work , sizeof( work ));
	level = atoi( work);
	getStringFromIndexWithDelim( value, "|" , 3 , work , sizeof( work ));
	duelpoint = atoi( work);
	getStringFromIndexWithDelim( value, "|" , 4 , work , sizeof( work ));
	faceimagenumber = atoi( work);
	ret = getStringFromIndexWithDelim( value, "|" , 5 , work , sizeof( work ));
	if( ret ) {
		transmigration = atoi( work);
	}
	else {
		transmigration = 0;
	}

	if( online == getServernumber()) {
		for( i = 0 ; i < playernum ; i++) {
			if( CHAR_CHECKINDEX( i )) {
				char *c = CHAR_getChar( i, CHAR_CDKEY);
				char *n = CHAR_getChar( i, CHAR_NAME);
				if( c == NULL || n == NULL ) continue;
				if( strcmp( c , cd ) == 0 && strcmp( n, nm ) == 0 )  {
					break;
				}
			}
		}
		if( i == playernum ) {
			online = 0;
			saacproto_Broadcast_send( acfd,cd, nm, "offline", 1);
		}
	}

	for( i = 0 ; i < playernum ; i++) {
		if( CHAR_CHECKINDEX( i )) {
			int j;
			for( j = 0 ; j < ADDRESSBOOK_MAX ; j++) {
				ADDRESSBOOK_entry *ae;
				ae = CHAR_getAddressbookEntry( i ,j );
				if( ae && ae->use == TRUE &&
					strcmp( ae->cdkey , cd ) == 0 &&
					strcmp( ae->charname, nm ) == 0 )
				{
					if( mode == 0 ) {
						ae->use = FALSE;
					}else {
						ae->online = online;
						ae->level = level;
						ae->duelpoint = duelpoint;
						ae->graphicsno = faceimagenumber;
						ae->transmigration = transmigration;
					}
					ADDRESSBOOK_sendAddressbookTableOne( i,j );

					break;
				}
			}
		}
	}
}
Пример #4
0
void ADDRESSBOOK_notifyLoginLogout( int cindex , int flg )
{
	int i;
	char *cd=NULL;
	char *nm = CHAR_getChar( cindex , CHAR_NAME );
	int     playernum = CHAR_getPlayerMaxNum();
	
	if( !CHAR_CHECKINDEX( cindex ) )return;
	cd = CHAR_getChar( cindex, CHAR_CDKEY);

	CHAR_send_DpDBUpdate_AddressBook( cindex, flg );

	for( i = 0 ; i < playernum ; i++){
		if( CHAR_CHECKINDEX( i) && i != cindex ) {
			int j;
			for( j = 0 ; j<ADDRESSBOOK_MAX ; j++){
				ADDRESSBOOK_entry *ae;
				ae = CHAR_getAddressbookEntry( i , j );
				if( ae && ae->use == TRUE &&
					strcmp( ae->cdkey , cd ) == 0 &&
					strcmp( ae->charname, nm ) == 0 ){

					ae->online = (flg == 0 ) ? 0: getServernumber();
					ae->level = CHAR_getInt( cindex , CHAR_LV );
					ae->duelpoint = CHAR_getInt( cindex, CHAR_DUELPOINT);
					ae->graphicsno = CHAR_getInt( cindex, CHAR_FACEIMAGENUMBER );
					ae->transmigration = CHAR_getInt( cindex, CHAR_TRANSMIGRATION);
				
					ADDRESSBOOK_sendAddressbookTableOne( i,j );

					break;
				}
			}
		}
	}

	if( flg == 0 ){
		saacproto_Broadcast_send( acfd,cd, nm, "offline", 1);
	}else if( flg == 1 ) {
		for( i = 0 ; i < ADDRESSBOOK_MAX; i++ ){
			int j;
			ADDRESSBOOK_entry* ae;
			ae = CHAR_getAddressbookEntry( cindex, i );
			if( ae->use == 0 )continue;
			ae->online = 0;
			for( j=0 ; j < playernum ; j++ ) {
				if( CHAR_CHECKINDEX( j) &&
					strcmp( ae->cdkey, CHAR_getChar( j, CHAR_CDKEY)) == 0 &&
					strcmp( ae->charname, CHAR_getChar( j, CHAR_NAME) )== 0){
					ae->level = CHAR_getInt( j, CHAR_LV );
					ae->graphicsno = CHAR_getInt( j, CHAR_FACEIMAGENUMBER );
					ae->online = getServernumber();
					ae->transmigration = CHAR_getInt( j, CHAR_TRANSMIGRATION);
					break;
				}
			}
			if( j == playernum) {
#ifndef _DEATH_CONTEND
				char buff[512];
				char escapebuf[1024];
				ae->online = 0;
				snprintf( buff, sizeof(buff), "%s_%s", ae->cdkey, ae->charname);
				makeEscapeString( buff, escapebuf, sizeof(escapebuf));
				saacproto_DBGetEntryString_send( acfd, DB_ADDRESSBOOK, escapebuf, 0,0);
#endif
			}
		}
		ADDRESSBOOK_sendAddressbookTable(cindex);
		saacproto_Broadcast_send( acfd,cd, nm, "online", 1);
		saacproto_MessageFlush_send( acfd, cd, nm);
	}
}