2020-08-24 21:04:56 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-16 23:19:40 +00:00
|
|
|
#include "core/Core.hpp"
|
|
|
|
#include "JSON.hpp"
|
|
|
|
|
2020-09-10 13:01:35 +00:00
|
|
|
#include "Player.hpp"
|
2020-08-24 21:04:56 +00:00
|
|
|
|
2022-07-16 23:19:40 +00:00
|
|
|
#include <map>
|
2020-09-09 19:09:01 +00:00
|
|
|
|
|
|
|
struct Reward {
|
|
|
|
int32_t id;
|
|
|
|
int32_t itemTypes[4];
|
|
|
|
int32_t itemIds[4];
|
|
|
|
int32_t money;
|
|
|
|
int32_t fusionmatter;
|
|
|
|
|
|
|
|
Reward(int32_t id, nlohmann::json types, nlohmann::json ids, int32_t m, int32_t fm) :
|
|
|
|
id(id), money(m), fusionmatter(fm) {
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
itemTypes[i] = types[i];
|
|
|
|
itemIds[i] = ids[i];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-09-10 16:40:38 +00:00
|
|
|
struct TaskData {
|
|
|
|
/*
|
|
|
|
* TODO: We'll probably want to keep only the data the server actually needs,
|
|
|
|
* but for now RE/development is much easier if we have everything at
|
|
|
|
* our fingertips.
|
|
|
|
*/
|
|
|
|
nlohmann::json task;
|
|
|
|
|
|
|
|
TaskData(nlohmann::json t) : task(t) {}
|
|
|
|
|
|
|
|
// convenience
|
|
|
|
auto operator[](std::string s) { return task[s]; }
|
2020-09-10 13:01:35 +00:00
|
|
|
};
|
|
|
|
|
2021-03-16 22:29:13 +00:00
|
|
|
namespace Missions {
|
2020-09-09 19:09:01 +00:00
|
|
|
extern std::map<int32_t, Reward*> Rewards;
|
2020-09-10 16:40:38 +00:00
|
|
|
extern std::map<int32_t, TaskData*> Tasks;
|
2020-09-26 01:48:45 +00:00
|
|
|
extern nlohmann::json AvatarGrowth[37];
|
2020-08-24 21:04:56 +00:00
|
|
|
void init();
|
2021-05-14 19:24:08 +00:00
|
|
|
int findQSlot(Player *plr, int id);
|
2020-08-24 21:04:56 +00:00
|
|
|
|
2020-12-22 21:18:46 +00:00
|
|
|
bool startTask(Player* plr, int TaskID);
|
2020-09-10 13:01:35 +00:00
|
|
|
|
2020-10-19 17:26:14 +00:00
|
|
|
// checks if player doesn't have n/n quest items
|
2020-09-23 21:04:58 +00:00
|
|
|
void updateFusionMatter(CNSocket* sock, int fusion);
|
2020-09-10 16:40:38 +00:00
|
|
|
|
2022-02-12 22:53:04 +00:00
|
|
|
void mobKilled(CNSocket *sock, int mobid, std::map<int, int>& rolls);
|
2020-09-13 18:45:51 +00:00
|
|
|
|
2020-10-14 18:36:38 +00:00
|
|
|
void quitTask(CNSocket* sock, int32_t taskNum, bool manual);
|
2020-10-14 04:26:30 +00:00
|
|
|
|
|
|
|
void failInstancedMissions(CNSocket* sock);
|
2020-09-09 19:09:01 +00:00
|
|
|
}
|