⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 px_ls_init.c

📁 MMORPG游戏服务器端架构及函数
💻 C
📖 第 1 页 / 共 5 页
字号:
		return;
	}
	g_stat->num_entity_base_trap = nconfig;
	trap_base_head = (LPTRAP_BASE)ms_malloc(nconfig*sizeof(TRAP_BASE));
	memset(trap_base_head,0,sizeof(TRAP_BASE)*nconfig);
	ptb = trap_base_head;
	for(i = 0;i < nlines;i++){
		pstr = pcfg_buf[i];
		if (pstr[0] == '\0') {
			continue;
		}
		PopLeftString(pstr,cache);
		ptb->index = atoi(cache);
		PopLeftString(pstr,cache);
		ptb->trap_type = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		ptb->distance = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		ptb->delay_frame = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		ptb->damage = atof(cache);
		PopLeftString(pstr,cache);
		ptb->damage_base = (byte)atoi(cache);
		ptb++;
	}
	init_free_cache(nlines);
	return;
}

/* 怪物 */
void init_read_entity_monster(){
	char				filename[FILENAME_MAX];
	char				cache[FILENAME_MAX];
	char			*	pstr;
	MONSTER_BASE	*	pmb;
	int					nlines;
	int					nconfig;
	int					i;
	filename[0] = '\0';
	strcpy(filename,base_path);
	strcat(filename,"\\configuration\\entity_monster.txt");
	nlines = GetnLinesOfFile(filename);
	init_read_specify_file(filename,nlines);
	nconfig = init_get_valid_num_config(nlines);
	if (nconfig <= 0) {
		return;
	}
	g_stat->num_entity_base_monster = nconfig;
	monster_base_head = (LPMONSTER_BASE)ms_malloc(nconfig*sizeof(MONSTER_BASE));
	memset(monster_base_head,0,nconfig*sizeof(MONSTER_BASE));
	pmb = monster_base_head;
	for(i = 0;i < nlines;i++){
		pstr = pcfg_buf[i];
		if (pstr[0] == '\0') {
			continue;
		}
		PopLeftString(pstr,cache);
		pmb->baseid = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		strcpy(pmb->name,cache);
		PopLeftString(pstr,cache);
		pmb->level = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->drop_ratio_money = atof(cache);
		PopLeftString(pstr,cache);
		pmb->drop_ratio_otheritem = atof(cache);
		PopLeftString(pstr,cache);
		pmb->max_num_drop_item = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		if (strcmp(cache,"TRUE") == 0) {
			pmb->active_attack = TRUE;
		}else{
			pmb->active_attack = FALSE;
		}
		PopLeftString(pstr,cache);
		pmb->hp = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->mana = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->damage_min = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->damage_max = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->defence = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->attack_veracity = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->move_range = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->exp_give = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->item_task = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->item_task = atoi(cache);
		PopLeftString(pstr,cache);
		pmb->ratio_item_task = atof(cache);
		PopLeftString(pstr,cache);
		pmb->physic_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->magic_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->cold_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->poison_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->ligthing_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fire_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fbs = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fce = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fcm = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fcp = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fcr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fhr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->flr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fmr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fms = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fpr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fsr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->fss = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[0].skill_id = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[0].ratio = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[1].skill_id = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[1].ratio = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[2].skill_id = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[2].ratio = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[3].skill_id = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[3].ratio = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[4].skill_id = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pmb->monster_skill[4].ratio = (byte)atoi(cache);
		pmb++;
	}
	init_free_cache(nlines);
	return;
}

/* npc */
void init_read_entity_npc(){
	char				filename[FILENAME_MAX];
	char				cache[FILENAME_MAX];
	char			*	pstr;
	NPC_BASE		*	pnb;
	int					nlines;
	int					nconfig;
	int					i;
	filename[0] = '\0';
	strcpy(filename,base_path);
	strcat(filename,"\\configuration\\entity_npc.txt");
	nlines = GetnLinesOfFile(filename);
	init_read_specify_file(filename,nlines);
	nconfig = init_get_valid_num_config(nlines);
	if (nconfig <= 0) {
		return;
	}
	g_stat->num_entity_base_npc = nconfig;
	npc_base_head = (LPNPC_BASE)ms_malloc(nconfig*sizeof(NPC_BASE));
	memset(npc_base_head,0,nconfig*sizeof(NPC_BASE));
	pnb = npc_base_head;
	for(i = 0;i < nlines;i++){
		pstr = pcfg_buf[i];
		if (pstr[0] == '\0') {
			continue;
		}
		PopLeftString(pstr,cache);
		pnb->index = atoi(cache);
		PopLeftString(pstr,cache);
		strcpy(pnb->name,cache);
		PopLeftString(pstr,cache);
		pnb->level = atoi(cache);
		PopLeftString(pstr,cache);
		pnb->drop_money = atof(cache);
		PopLeftString(pstr,cache);
		pnb->hp = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->mana = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->damage_min = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->damage_max = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->defence = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->attack_veracity = (WORD)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->move_range = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->exp_give = atoi(cache);
		PopLeftString(pstr,cache);
		pnb->physic_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->magic_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->cold_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->poison_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->ligthing_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fire_resist = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fbs = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fce = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fcm = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fcp = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fcr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fhr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->flr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fmr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fms = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fpr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fsr = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->fss = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		pnb->skill[0] = atoi(cache);
		PopLeftString(pstr,cache);
		pnb->skill[1] = atoi(cache);
		PopLeftString(pstr,cache);
		pnb->skill[2] = atoi(cache);
		pnb++;
	}
	init_free_cache(nlines);
	return;
}

/* gm */
void init_read_entity_gm(){
	/*
	*	current no specify support for gm
	*	just use common define gived
	*	no special config need been maked
	*/
	return;
}

/* 地图上的传送点标志 */
void init_read_entity_teleport_point(){
	char					filename[FILENAME_MAX];
	char					cache[FILENAME_MAX];
	char				*	pstr;
	TELEPORT_POINT_BASE *	ptpb;
	int						nlines;
	int						nconfig;
	int						i;
	filename[0] = '\0';
	strcpy(filename,base_path);
	strcat(filename,"\\configuration\\entity_teleport_point.txt");
	nlines = GetnLinesOfFile(filename);
	init_read_specify_file(filename,nlines);
	nconfig = init_get_valid_num_config(nlines);
	if (nconfig <= 0) {
		return;
	}
	g_stat->num_refresh_teleport_point = nconfig;
	teleport_point_base_head = (LPTELEPORT_POINT_BASE)ms_malloc(nconfig*sizeof(TELEPORT_POINT_BASE));
	memset(teleport_point_base_head,0,nconfig*sizeof(TELEPORT_POINT_BASE));
	ptpb = teleport_point_base_head;
	for(i = 0;i < nlines;i++){
		pstr = pcfg_buf[i];
		if (pstr[0] == '\0') {
			continue;
		}
		PopLeftString(pstr,cache);
		ptpb->index = atoi(cache);
		PopLeftString(pstr,cache);
		ptpb->src_mapid = atoi(cache);
		PopLeftString(pstr,cache);
		ptpb->src_mapx = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		ptpb->src_mapy = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		ptpb->dest_mapid = atoi(cache);
		PopLeftString(pstr,cache);
		ptpb->dest_mapx = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		ptpb->dest_mapy = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		ptpb->teleport_range = (byte)atoi(cache);
		PopLeftString(pstr,cache);
		ptpb++;
	}
	init_free_cache(nlines);
	return;
}			

/* 读取与帧数相关的配置 */
void init_read_frame(){
	init_read_frame_fbs();								
	init_read_frame_fce();								
	init_read_frame_fcm();								
	init_read_frame_fcp();									
	init_read_frame_fcr();								
	init_read_frame_fhr();								
	init_read_frame_flr();								
	init_read_frame_fmr();								
	init_read_frame_fms();								
	init_read_frame_fpr();								
	init_read_frame_fsr();							
	init_read_frame_fss();
	return;
}	

/* fbs */
void init_read_frame_fbs(){
	char					filename[FILENAME_MAX];
	char					cache[FILENAME_MAX];
	char				*	pstr;
	FRAME_FBS_BASE		*	pf;
	int						nlines;
	int						nconfig;
	int						i;
	filename[0] = '\0';
	strcpy(filename,base_path);
	strcat(filename,"\\configuration\\frame_fbs.txt");
	nlines = GetnLinesOfFile(filename);
	init_read_specify_file(filename,nlines);
	nconfig = init_get_valid_num_config(nlines);
	if (nconfig <= 0) {
		return;
	}
	g_stat->num_speed_frame_base_fbs = nconfig;
	frame_fbs_base_head = (LPFRAME_FBS_BASE)ms_malloc(nconfig*sizeof(FRAME_FBS_BASE));
	memset(frame_fbs_base_head,0,nconfig*sizeof(FRAME_FBS_BASE));
	pf = frame_fbs_base_head;
	for(i = 0;i < nlines;i++){
		pstr = pcfg_buf[i];
		if (pstr[0] == '\0') {
			continue;
		}
		PopLeftString(pstr,cache);
		pf->frame = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_human_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_hun_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_sorcer_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_genius_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_bowman_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_taoist_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_nodead_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_craftsman_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->class_knight_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->monster_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->genius_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->beastie_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->machine_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->country_guarder_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->country_aggresser_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->funner_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->card_tour_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->npc_req = atoi(cache);
		PopLeftString(pstr,cache);
		pf->dragon_req = atoi(cache);
		pf++;
	}
	init_free_cache(nlines);
	return;
}		

/* fce */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -