shop.h 1.94 KB
#pragma once

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

struct shop_element_t 
{
	std::vector<share_msg::item_t> buy_vec;
	std::vector<share_msg::item_t> buy_pet_vec;
	std::vector<share_msg::item_t> price_vec;
	float vip_price;
	bool notice;

	uint32_t type;
	uint32_t b_time;
	uint32_t e_time;
	uint32_t num;
	shop_element_t(){
		this->notice = false;
		this->type = 0;
		this->b_time = 0;
		this->e_time = 0;
		this->num = 0;
		this->vip_price = 10.000000f;
	}
};

struct shop_cfg_mgr_t
{
	bool load_cfg();
	bool check_cfg();
	void init();
	std::map<uint32_t, shop_element_t> shop_element_map;//key:id
	shop_element_t* find(uint32_t id);
};

extern shop_cfg_mgr_t* g_shop_cfg_mgr;


//////////////////////////////////////////////////////////////////////////
struct play_game_reward_element_t 
{
	uint32_t pr;
	std::vector<share_msg::item_t> reward_vec;
};

struct play_game_reward_cfg_mgr_t
{
	bool load_cfg();
	void init();
	uint32_t play_cnt;
	std::map<uint32_t, play_game_reward_element_t> play_game_reward_map;//key:id val:play_game_reward_element_t
};

extern play_game_reward_cfg_mgr_t* g_play_game_reward_cfg_mgr;

//////////////////////////////////////////////////////////////////////////
struct single_game_cfg_t
{
	uint32_t game_id;
	uint32_t need_vip;
	uint32_t key_score;
	uint32_t diamond;

	std::map<ITEM_ID, ITEM_CNT> item_map;
	uint32_t rate;
	std::map<ITEM_ID, uint32_t> key_rate_map;
	single_game_cfg_t(){
		this->game_id = 0;
		this->need_vip = 0;
		this->rate = 0;
		this->key_score = 0;
		this->diamond = 0;
	}
};

struct single_game_cfg_mgr_t
{
	bool load_cfg();
	void init();

	std::map<GAME_ID, std::map<uint32_t,single_game_cfg_t>> single_game_score_map;
	std::map<GAME_ID, uint32_t> game_id_need_vip_map;
	std::map<GAME_ID, uint32_t> game_id_need_diamond_map;
	std::map<uint32_t,single_game_cfg_t>* find(GAME_ID game_id);
	std::map<GAME_ID, std::map<GAME_LEVEL, GAME_SCORE>> game_level_score_map;
};

extern single_game_cfg_mgr_t* g_single_game_cfg_mgr;