Esempio n. 1
0
int Chat_Monitor::start_monitor_timer(void) {
	Block_Buffer buf;
	buf.make_message(TIMER_GLOBAL_MONITOR_SELF);
	buf.finish_message();
	GLOBAL_TIMER->register_loop_handler(buf, Time_Value(30, 0), unit_);

	{
	Block_Buffer buf;
	buf.make_message(TIMER_TRIGGER_DAILY_ZERO);
	buf.finish_message();
	Time_Value timeout = next_relative_time(24, 00, 00);
	GLOBAL_TIMER->register_loop_handler(buf, Time_Value(timeout), unit_);
	}
	return 0;
}
int Team_Arena_Controler::refresh_rank_list(role_id_t role_id) {
	Scene_Player *player = 0;

	if (role_id) {
		Team_Role_Score_Map::iterator find_it = team_role_score_map.find(role_id);
		if (find_it != team_role_score_map.end()) {
			player = SCENE_MONITOR->find_scene_player_by_role_id(role_id);
			if (player) {
				Block_Buffer buf;
				buf.make_message(20100312);
				buf.write_int32(find_it->second.rank);
				buf.finish_message();
				player->send_to_logic(buf);
			}
		}
	} else {
		level_team_role_score_map.clear();
		for (Team_Role_Score_Map::iterator it = team_role_score_map.begin(); it != team_role_score_map.end(); ++it) {
			if (it->second.score > 0) {
				int level = CONFIG_CACHE_TEAM->arena_multi_level(it->second.score);
				level_team_role_score_map[level].push_back(&it->second);
				it->second.change = false;
			}
		}


		for (Level_Team_Role_Score_Map::iterator it = level_team_role_score_map.begin(); it != level_team_role_score_map.end(); ++it) {
			std::sort(it->second.begin(), it->second.end(), Team_Role_Score_Greater());

			int i = 1;
			for (Team_Role_Score_Vec::iterator r_it = it->second.begin(); r_it != it->second.end(); ++r_it, ++i) {
				if ((**r_it).rank != i) {
					player = SCENE_MONITOR->find_scene_player_by_role_id((*r_it)->role_id);
					if (player) {
						Block_Buffer buf;
						buf.make_message(20100312);
						buf.write_int32(i);
						buf.finish_message();
						player->send_to_logic(buf);
					}
				}
				(**r_it).rank = i;
			}
		}
	}

	return 0;
}
Esempio n. 3
0
void Answer_Manager::save_data(Block_Buffer& buf_) {
	Block_Buffer buf;
	buf.make_message(MONGO_SAVE_ANSWER_INFO);
	buf.copy(&buf_);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
}
Esempio n. 4
0
int Record_Monitor::start_monitor_timer(void) {
	Block_Buffer buf;
	buf.make_message(TIMER_GLOBAL_MONITOR_SELF);
	buf.finish_message();
	GLOBAL_TIMER->register_loop_handler(buf, Time_Value(Time_Value::ONE_MINUTE_IN_SECS, 0), unit_);
	return 0;
}
Esempio n. 5
0
void Daemon_Record::stop(void) {
	if (is_server_running()) {
		Block_Buffer buf;
		buf.make_message(SERVER_INNER_SELF_CLOSE);
		buf.finish_message();
		RECORD_MONITOR->push_async_buff(buf);
	}
}
Esempio n. 6
0
int Chat_Player::send_err_to_client(int error_id, int source) {
	Block_Buffer buf;
	buf.make_message(80000001);
	buf.write_int32(error_id);
	buf.write_int32(source);
	buf.write_string("");
	buf.finish_message();
	return send_to_client(buf);
}
Esempio n. 7
0
void Vip::sync_vip_info_to_chat(void) {
	MSG_20200024 inner_msg;
	inner_msg.vip_level = player_self()->base_detail().vip;
	inner_msg.over_time = player_self()->base_detail().vip_over_time.sec();
	Block_Buffer buf;
	buf.make_message(inner_msg.msg_id);
	inner_msg.serialize(buf);
	buf.finish_message();
	this->send_to_local_chat(buf);
}
int Scene_Outpost_Manager::vagrant_store_trigger(Move_Scene* scene, const int point, bool is_boss, Coord point_coord){
	int scene_id = scene->scene_id();
	int monster_id = CONFIG_CACHE_NPC->vagrant_item_trigger(scene_id, point);
	if(monster_id == 0){
		return 0;
	}
	// create monster
	NPC_Addition_Info npc_add;
	npc_add.birth_coord = point_coord;
	Monster* monster = NPC_MANAGER->create_monster(monster_id, 5, scene, NULL, npc_add);
	if(!monster){
		return 0;
	}
	int64_t monster_role_id = monster->role_id();
	// 生存流浪商店物品
	Vagrant_Item_Config_Map* vic_map = CONFIG_CACHE_NPC->get_vagrant_item_config_map();
	if(!vic_map){
		return 0;
	}
	Vagrant_Item_Info_Vec vi_vec;
	Vagrant_Item_Info vi;
	for(Vagrant_Item_Config_Map::iterator it = vic_map->begin(); it != vic_map->end();
			++ it){
		if(it->second.is_valid(monster_id)){
			vi.reset();
			vi.cfg_key = it->second.key;
			vi.cfg_item_id = it->second.item_id;
			vi.cfg_cost_type = it->second.sys_sell_type;
			vi.cfg_cost = it->second.cost;
			vi.cfg_num = it->second.num;
			vi.cfg_limit_num = it->second.limit_num;
			vi_vec.push_back(vi);
		}
	}
	Vagrant_Store_Scene_Map::iterator it = vagrant_item_map_.find(scene_id);
	if(it != vagrant_item_map_.end()){
		it->second[monster_role_id] = vi_vec;
	}else{
		Vagrant_Store_Map vagrant_stroe_map;
		vagrant_stroe_map[monster_role_id] = vi_vec;
		vagrant_item_map_[scene_id] = vagrant_stroe_map;
	}
	// 飘字
	{
		int err_id = ERROR_VAGRANT_STORE_OPEN;
		Block_Buffer buf;
		buf.make_message(80000001);
		buf.write_int32(err_id);
		buf.write_int32(0);
		buf.write_string("");
		buf.finish_message();
		scene->broadcast_all(0, buf);
	}
	return 0;
}
Esempio n. 9
0
int Operating::offline_arena_seven_day_reward(role_id_t role_id, Arena_Reward_Info &info){
	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_ARENA_SEVEN_DAY_REWARD;
	buf.write_int32(type);
	buf.write_int64(role_id);
	info.serialize(buf);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Esempio n. 10
0
void Answer_Scene::send_logic_get_integral_reward(Mover *mover, const uint32_t sorce) {
	if(!mover) return;
	Block_Buffer buf;
	buf.make_message(INNER_ANSWER_DATA_CHANNEL);
	buf.write_uint8(ANSWER_DATA_CHANNLE_TYPE_SL_GET_INTEGRAL_REWARD);
	//DATA START
	buf.write_uint32(sorce);
	//DATA END
	buf.finish_message();
	mover->send_to_logic(buf);
}
Esempio n. 11
0
int Operating::offline_team_award(role_id_t role_id, int level_id) {

	Block_Buffer buf;
	buf.make_message(OPERATING_OFFLINE_TEAM_AWARD);
	buf.write_int64(role_id);
	buf.write_int32(level_id);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);

	return 0;
}
Esempio n. 12
0
int Scene_Common::req_single_dungeon_revive(int8_t type) {
    if(player_self() && player_self()->move_scene() &&
            player_self()->move_scene()->scene_type() == FuBen_Scene_Type) {
        int param1 = 0;
        int param2 = 0;
        int param3 = 0;
        player_self()->move_scene()->get_scene_param(param1, param2, param3);
        if(param1 != 1) {
            return 0;
        }
        if(type == 0) { // 免费复活
            if(param2 <= 0) { // 免费复活次数
                {
                    MSG_50200215 msg;
                    msg.result = 0;
                    THIS_SEND_TO_CLIENT(msg);
                }
                return ERROR_FB_REVIVE_NO_FREE;
            }
            param2 -= 1;
            param1 = 0;
            player_self()->move_scene()->set_scene_param(param1, param2, param3, true);
            player_self()->reset_revive_info();
            {
                MSG_81000026 msg;
                msg.role_id = player_self()->role_id();
                msg.state = 0;
                THIS_SEND_TO_CLIENT(msg);
            }
            {
                MSG_50200215 msg;
                msg.result = 1;
                THIS_SEND_TO_CLIENT(msg);
            }
        } else { // 付费复活
            if(param2 > 0) { // 免费复活次数
                {
                    MSG_50200215 msg;
                    msg.result = 0;
                    THIS_SEND_TO_CLIENT(msg);
                }
                return ERROR_FB_REVIVE_HAS_FREE;
            }
            Block_Buffer buf;
            buf.make_message(INNER_WAR_SCENE_SYNC_INFO);
            buf.write_int8(3);
            buf.write_int32(param3);
            buf.finish_message();
            this->send_to_logic(buf);
        }
    }
    return 0;
}
Esempio n. 13
0
void Answer_Manager::send_scene_open_action(void) {
	Block_Buffer buf;
	buf.make_message(INNER_ANSWER_DATA_CHANNEL);
	buf.write_uint8(ANSWER_DATA_CHANNLE_TYPE_LS_OPEN_ACTIVE);
	buf.write_int64(start_time.sec());
	//DATA START
	answer_info.serialize(buf);
	//DATA END

	buf.finish_message();
	LOGIC_MONITOR->send_to_scene(ANSWER_INNER_SCENE_ID, 0, buf);
}
Esempio n. 14
0
int Operating::offline_ganger_info_update(role_id_t role_id, Ganger_Detail& detail) {
	if ( role_id == 0 ) return 0;
	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_GANGER_INFO;
	buf.write_int32(type);
	buf.write_int64(role_id);
	detail.serialize( buf );
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Esempio n. 15
0
void Answer_Manager::send_scene_close_action(void) {
	is_close = true;
	Block_Buffer buf;
	buf.make_message(INNER_ANSWER_DATA_CHANNEL);
	buf.write_uint8(ANSWER_DATA_CHANNLE_TYPE_LS_CLOSE_ACTIVE);

	//DATA START
	buf.write_int64(end_time.sec());
	//DATA END

	buf.finish_message();
	LOGIC_MONITOR->send_to_scene(ANSWER_INNER_SCENE_ID, 0, buf);
}
Esempio n. 16
0
void Answer_Scene::send_to_logic_save_data(void) {
	//以下代码;策划要求改跨服需要特殊处理
	Block_Buffer buf;
	buf.make_message(INNER_ANSWER_DATA_CHANNEL);
	buf.write_uint8(ANSWER_DATA_CHANNLE_TYPE_SL_SAVE_DATA);

	//DATA START
	answer_info.serialize(buf);
	//DATA END

	buf.finish_message();
	SCENE_MONITOR->send_to_logic(CONFIG_CACHE->server_flag(), buf);
}
Esempio n. 17
0
int Map_Team::sync_info_logic(void) {
	MSG_20100304 inner_msg;
	Block_Buffer buf;
	Time_Value now;
	now = Time_Value::gettimeofday();
	buf.make_message(inner_msg.msg_id);
	buf.write_int64(team_id_);
	buf.write_int16(fail_times_);
	buf.write_int16(match_fail_);
	now.serialize(buf);
	buf.finish_message();
	this->info_all_online_player(inner_msg.msg_id, &buf);
	return 0;
}
Esempio n. 18
0
void Answer_Scene::send_to_logic_get_rank_reward(void) {
	refresh_rank();
	//以下代码;策划要求改跨服需要特殊处理
	Block_Buffer buf;
	buf.make_message(INNER_ANSWER_DATA_CHANNEL);
	buf.write_uint8(ANSWER_DATA_CHANNLE_TYPE_SL_GET_RANK_REWARD);
	buf.write_uint16(role_sorce_rank.size());
	for(RoleID_Data_Vec_Map::iterator iter = role_sorce_rank.begin(); iter != role_sorce_rank.end(); ++iter) {
		buf.write_uint16(iter->second.size());
		for(RoleID_Data_Vec::iterator it = iter->second.begin(); it != iter->second.end(); ++it) {
			buf.write_int64(it->role_id);
		}
	}
	SCENE_MONITOR->send_to_logic(CONFIG_CACHE->server_flag(), buf);
}
Esempio n. 19
0
int Scene_Common::req_scene_chat(std::vector<Chat_Content> &content, int32_t sys_type) {
    if(player_self() && player_self()->move_scene()) {
        MSG_83000000 msg;
        msg.chat_type = chat_scene;
        msg.system_type = sys_type;
        msg.role_type = player_self()->base_detail().role_type;
        msg.content = content;
        Block_Buffer buf;
        buf.make_message(msg.msg_id);
        msg.serialize(buf);
        buf.finish_message();
        player_self()->move_scene()->broadcast_chat_all(player_self()->mover_detail().layer_id, buf);
    }
    return 0;
}
Esempio n. 20
0
int Chat_Player::system_chat(std::vector<Chat_Content *> &contents){
	MSG_83000000 scMsg;
	scMsg.chat_type = chat_system;
	scMsg.system_type = 4;
	scMsg.role_type = player_self()->base_detail().role_type;

	for (std::vector<Chat_Content *>::iterator it = contents.begin(); it != contents.end(); ++it) {
		scMsg.content.push_back(**it);
	}
	Block_Buffer buf;
	buf.make_message(ACTIVE_CHAT_BOARD);
	scMsg.serialize(buf);
	buf.finish_message();
	return monitor()->send_to_all_players(buf);
}
Esempio n. 21
0
int Operating::offline_like_success(role_id_t role_id) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_LIKE_SUCCESS;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Esempio n. 22
0
int Operating::offline_invite_player(role_id_t role_id, const Time_Value &time) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_INVITE_PLAYER;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_int64(time.sec());
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Esempio n. 23
0
int Operating::offline_dragon_vale_special_notice(role_id_t role_id, bool is_special) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_DRAGON_VALE_SPECIAL;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_bool(is_special);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Esempio n. 24
0
int Operating::offline_mail(Mail_Send_Info &send_info) {
	if (!send_info.receiver_id) {
		MSG_USER("error receiver id");
		return -1;
	}
	MSG_DEBUG("offline_mail, role_id:%ld, mail_title:%s, mail_contents:%s", send_info.receiver_id, send_info.title.c_str(), send_info.content.c_str() );
	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_MAIL;
	buf.write_int32(type);
	send_info.serialize(buf);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);

	return 0;
}
Esempio n. 25
0
void Logic_Public::save_access_count(const Time_Value &now) {
	if(now.sec() - access_count_record_time.sec() > Time_Value::ONE_MINUTE_IN_SECS) {
		if(access_count.size() == 0) {
			access_count_record_time = now;
		}
		Block_Buffer buf;
		buf.make_message(MONGO_SACE_ACCESS_DATA_COUNT);
		buf.write_uint8(access_count.size());
		for(UInt_UInt_Map::iterator ait = access_count.begin(); ait != access_count.end(); ++ait) {
			buf.write_uint32(ait->first);
			buf.write_uint32(ait->second);
		}
		buf.finish_message();
		DB_MANAGER->push_data_block(buf, 0);
		access_count.clear();
	}
}
Esempio n. 26
0
int Operating::offline_receive_flowers(role_id_t role_id, std::string &role_name, uint32_t item_id,  uint32_t charm, uint32_t friend_num, std::string &msg, role_id_t receive_role_id) {
	if ( role_id == 0 ) return 0;
	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_RECEIVE_FLOWERS;
	buf.write_int32(type);
	buf.write_int64(role_id);
	buf.write_string(role_name);
	buf.write_uint32(item_id);
	buf.write_uint32(charm);
	buf.write_uint32(friend_num);
	buf.write_string(msg);
	buf.write_int64(receive_role_id);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Esempio n. 27
0
int Operating::offline_firend_handel(role_id_t role_id, role_id_t other_role_id, int8_t handel) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_APPLY_HANDEL;
	buf.write_int32(type);
	buf.write_int64(role_id);
	buf.write_int64(other_role_id);
	buf.write_int8(handel);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
int Scene_Outpost_Manager::req_vagrant_buy_item(Scene_Player* player, const int64_t monster_role_id, const int item_index){
	if(!player){
		return 0;
	}
	int scene_id = player->move_scene_id();
	Vagrant_Item_Info* item_info = get_vagrant_item_info(scene_id, monster_role_id, item_index);
	if(!item_info){
		return -1;
	}
	// 购买数量检测
	if(item_info->cfg_num != 0 &&
			item_info->buy_num >= item_info->cfg_num){
		//
		MSG_50211301 msg;
		msg.item_index = item_index;
		msg.result = 0;
		OBJ_SEND_TO_CLIENT(msg, (*player));
		//
		req_vagrant_item_info(player, monster_role_id);
		return ERROR_SECRET_SHOP_NUM_LIMIT;
	}
	// 限购检测
	if(item_info->cfg_limit_num != 0 &&
			item_info->player_buy_num(player->role_id()) >= item_info->cfg_limit_num){
		return ERROR_SECRET_SHOP_LIMIT_NUM_LIMIT;
	}
	{
		Block_Buffer buf;
		buf.make_message(INNER_SYNC_SCENE_OUTPOST);

		buf.write_int8(10);
		buf.write_int32(scene_id);
		buf.write_int64(monster_role_id);
		buf.write_int32(item_index);
		buf.write_int32(item_info->cfg_item_id);
		buf.write_int32(1);
		buf.write_int8(item_info->cfg_cost_type);
		buf.write_int32(item_info->cfg_cost);

		buf.finish_message();

		player->send_to_logic(buf);
	}
	return 0;
}
Esempio n. 29
0
int Operating::offline_active_content_listen_world_boss_end_info(role_id_t role_id , uint32_t damage, uint32_t rank, uint32_t damage_rate) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_ACTIVE_CONTENT_LISTEN_WORLD_BOSS_END_INFO;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_uint32(damage);
	buf.write_uint32(rank);
	buf.write_uint32(damage_rate);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Esempio n. 30
0
int Operating::offline_firend_add(role_id_t role_id, role_id_t other_role_id, Time_Value time) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_FIREND_ADD;
	buf.write_int32(type);
	buf.write_int64(role_id);
	buf.write_int64(other_role_id);
	buf.write_int64(time.sec());
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);

	return 0;
}