task.h
1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <common.h>
#include <share_msg.pb.h>
class user_t;
class task_mgr_t
{
public:
user_t* user;
task_mgr_t();
void listen_daily_task(TASK_ID task_id, uint32_t param1);
std::set<TASK_ID> do_task_set;// 执行中的任务
std::set<TASK_ID> finish_task_set;// 已完成的任务
void update();
void create();
void notify_all();
bool is_finish(TASK_ID task_id, STEP_ID step_id);
};
struct task_daily_step_cfg_t{
STEP_ID step;
std::map<ITEM_ID, ITEM_CNT> reward_map;
task_daily_step_cfg_t();
};
struct task_daily_cfg_t
{
public:
task_daily_cfg_t();
TASK_ID id;//task id
std::map<STEP_ID, task_daily_step_cfg_t> step_map;//key:step_id
STEP_ID step_id_max;
task_daily_step_cfg_t* find(STEP_ID step_id);
};
class task_cfg_mgr_t
{
public:
task_cfg_mgr_t(){
this->init();
}
void init(){
this->daily_cfg_map.clear();
this->daily_task_cnt_max = 0;
}
bool load_cfg();
uint32_t daily_task_cnt_max;
std::map<TASK_ID, task_daily_cfg_t> daily_cfg_map;
task_daily_step_cfg_t* find_daily_step(TASK_ID task_id, STEP_ID step_id);
task_daily_cfg_t* find_daily(TASK_ID task_id);
};
extern task_cfg_mgr_t* g_task_cfg_mgr;