Exemple #1
0
void create()
{
#ifdef WEATHER
        day_phase = read_table("/adm/etc/nature/day_phase");
        init_day_phase();

        weather = read_table("/adm/etc/nature/weather");
        init_weather();
#endif
#ifdef SEND_MONEY
        send_money();
#endif
        clan();
        init_mail();
        auto_reboot();
	war_start();
	// do_full();
        sp_boss();
        sys_init();
        call_out( "check_heart_beat", 10 );
}
Exemple #2
0
int  init_service(int isparent)
{

	if (!isparent) {

        DEBUG_LOG("INIT_SERVICE");
	    const char *ip= get_ip_ex(0x01);
	    if ( strncmp( ip,"10.",3 )==0 ) {
	        g_is_test_env=true;
			DEBUG_LOG("=============TEST ENV TRUE =============");
	    }else{
	        g_is_test_env=false;
			DEBUG_LOG("=============TEST ENV FALSE =============");
	    }

		g_log_send_buf_hex_flag=g_is_test_env?1:0;
	



		if (sizeof(sprite_t) >= SPRITE_STRUCT_LEN - 800 || sizeof(grp_loop_t) != VIP_BUFF_LEN) {
			ERROR_RETURN(("sprite struct not big enough\t[%lu %u]", sizeof(sprite_t), SPRITE_STRUCT_LEN), -1);
		}
		srand(time(0) * get_server_id());
		setup_timer();
		INIT_LIST_HEAD(&(g_events.timer_list));
		INIT_LIST_HEAD(&active_box_list);
		if ( config_get_strval("_use_lua_config") ==NULL  ){
			config_init("./conf/common.conf");
		}

		statistic_logfile = config_get_strval("statistic_file");
		if (!statistic_logfile)
			return -1;
		if ((init_cli_proto_handles(0) == -1)	|| 
			(init_db_proto_handles(0) == -1)		||
			(init_home_handle_funs() == -1)		||
			(init_switch_handle_funs() == -1)		||
			(init_all_timer_type() == -1)			||
			(init_magic_code_proto_handles(0) == -1) ||
			(init_spacetime_code_proto_handles(0) == -1) ||
			(init_mall_proto_handles(0) == -1)
			) {
			return -1;
		}
		init_sprites();
		init_exp_lv();
		init_home_maps();
		init_all_items();
		init_beast_grp();
		init_rand_infos();
		init_npcs();
		init_all_skills();
		init_all_clothes();
		init_sys_info();
		init_all_tasks();
		init_mail();
		init_shops();
		init_vip_items();
		init_products();

		idc_type = config_get_intval("idc_type" ,1);
		KDEBUG_LOG(0, "ONLINE START\t[%lu %d]", sizeof(sprite_t), idc_type);

		if (
			//11
			(load_xmlconf("./conf/items.xml", load_items) == -1)
			|| (load_xmlconf("./conf/clothes.xml", load_clothes) == -1)
			|| (load_xmlconf("./conf/beasts.xml", load_beasts) == -1)
			//
			|| (load_xmlconf("./conf/pet_exchange.xml", load_pet_exchange) == -1)//3M
			|| (load_xmlconf("./conf/pet_exchange_egg.xml", load_pet_exchange_egg) == -1)
			//62
			|| (load_xmlconf("./conf/gplan.xml", load_rare_beasts) == -1)
			|| (load_xmlconf("./conf/titles.xml", load_honor_titles) == -1)
			|| (load_xmlconf("./conf/picsrv.xml", load_picsrv_config) == -1)
			) {
			return -1;
		}
		if (
				load_xmlconf("./conf/beastgrp.xml", load_beast_grp) == -1 
				|| (load_xmlconf("./conf/handbook.xml", load_handbook) == -1)
				|| (load_xmlconf("./conf/suits.xml", load_suit) == -1)
				|| ( load_xmlconf("./conf/maps.xml", load_maps) == -1)
				|| (load_xmlconf("./conf/rand_item.xml", load_rand_item) == -1)
				|| (load_xmlconf("./conf/vip_item.xml", load_vip_item) == -1)
				|| (load_xmlconf("./conf/commodity.xml", load_products) == -1)
				|| (load_xmlconf("./conf/skills_price.xml", load_all_skills) == -1)
				|| (load_xmlconf("./conf/tasks_new.xml", load_tasks) == -1)//task:12M
				|| (load_xmlconf("./conf/tasks_new.xml", load_task_loops) == -1)
				|| (load_xmlconf("./conf/holiday.xml", load_holiday_factor) == -1)
				|| (load_xmlconf("./conf/box.xml", load_box) == -1)
				|| (load_xmlconf("./conf/exchanges.xml", load_exchange_info) == -1)
				|| (load_xmlconf("./conf/npc.xml", load_npc) == -1)
				|| (load_xmlconf("./conf/npcSkills.xml", load_shop_skill) == -1)
				|| (load_xmlconf("./conf/npcShop.xml", load_shop_item) == -1)
				|| (load_xmlconf("./conf/mail.xml", load_sys_mail) == -1)
				|| (load_xmlconf("./conf/sysinfo.xml", load_sys_info) == -1)
				|| (load_xmlconf("./conf/fishGame.xml", load_fish_info) == -1)
				|| (load_xmlconf("./conf/professtion.xml", load_init_prof_info) == -1)
				|| (load_xmlconf("./conf/maze.xml", load_maze_xml) == -1)
				|| (load_xmlconf("./conf/mapcopy.xml", load_map_copy) == -1)
			)

			return -1;

	//	sleep(1000);
		activate_boxes();
		start_maze_timer();

		/*
		if(tm_load_dirty("./data/tm_dirty.dat") < 0){
			KERROR_LOG(0, "Failed to load drity word file!");
			return -1;
		}
		*/
		
		init_batter_teams();
		init_batter_infos();
		connect_to_switch_timely(0, 0);
		regist_timers();
		udp_report_fd = create_udp_socket(&udp_report_addr, config_get_strval("report_svr_ip"), config_get_intval("report_svr_port", 0));
		udp_post_fd = create_udp_socket(&udp_post_addr, config_get_strval("post_svr_ip"), config_get_intval("post_svr_port", 0));
		switch (idc_type) {
		case idc_type_dx:
			chat_svr_fd = create_udp_socket(&udp_chat_svr_addr, config_get_strval("dx_chat_svr_ip"), config_get_intval("chat_svr_port", 0));
			break;
		case idc_type_wt:
			chat_svr_fd = create_udp_socket(&udp_chat_svr_addr, config_get_strval("wt_chat_svr_ip"), config_get_intval("chat_svr_port", 0));
			break;
		case idc_type_internal:
		case idc_type_internal + 1:
			chat_svr_fd = create_udp_socket(&udp_chat_svr_addr, config_get_strval("in_chat_svr_ip"), config_get_intval("chat_svr_port", 0));
			break;
		default:
			return -1;
		}
	}

	return 0;
}