pet.h 1.64 KB
#pragma once

#include <common.h>
#include <common_msg.pb.h>

class user_t;

class pet_mgr_t
{
public:
	pet_mgr_t();
	user_t* user;
	std::map<PET_ID, share_msg::pet_t> pet_map;
	void add( share_msg::pet_t& pet );
	void update( share_msg::pet_t& pet );
	share_msg::pet_t* find(PET_ID pet_id);
};

struct pet_lv_data_t {
	uint32_t ack;
	uint32_t def;
	uint32_t ai;
	pet_lv_data_t(){
		this->ack = 0;
		this->def = 0;
		this->ai = 0;
	}
};
struct pet_cfg_t{
	PET_ID id;
	uint32_t star;
	uint32_t attr;
	uint32_t hide_turntable;
	SKILL_ID skill_id;
	std::map<uint32_t, pet_lv_data_t> pet_lv_data_map;
	pet_cfg_t();
};

struct pet_cfg_mgr_t
{
	bool load_cfg();
	void init();
	bool check_cfg();
	


	std::map<PET_ID, pet_cfg_t> pet_cfg_map;//key:id

	std::map<uint32_t, std::map<uint32_t, uint32_t>> exp_level_val_map;
	std::map<uint32_t, uint32_t> exp_max_map;

	std::map<PET_STAR, PET_CNT> star_pet_cnt_map;

	std::map<uint32_t, uint32_t> duanwei_exp_level_map;
	std::map<uint32_t, uint32_t> chenghao_exp_level_map;
	std::map<uint32_t, std::vector<share_msg::item_t>> duanwei_lv_reward_map;
	std::map<uint32_t, std::vector<share_msg::item_t>> chenghao_lv_reward_map;
	uint32_t btl_cnt;
	std::vector<uint32_t> cd_vec;
	pet_cfg_t* find(PET_ID id);
	std::map<uint32_t, uint32_t>* find_exp(uint32_t star); 
	uint32_t find_exp_max(  PET_ID id  );
	PET_CNT find_pet_cnt(PET_STAR star);
	uint32_t gen_level(PET_ID id, uint32_t exp_val);
	uint32_t max_level();
	uint32_t get_duanwei_level(uint32_t exp);
	uint32_t get_chenghao_level(uint32_t pet_cnt);

	std::map<uint32_t, std::vector<share_msg::item_t>> no_reward_map;
};

extern pet_cfg_mgr_t* g_pet_cfg_mgr;

extern uint32_t g_pet_max_level;