[WIP] Incremental mission save 2

This commit (and the previous one) exist to document the first approach I
took to storing mission data. It's only here for posterity. This comment
was added while rebasing.
This commit is contained in:
2020-09-10 15:01:35 +02:00
parent ae654f996c
commit 3665dc2c93
7 changed files with 147 additions and 62 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include "CNShardServer.hpp"
#include "Player.hpp"
#include "contrib/JSON.hpp"
@@ -42,14 +43,29 @@ struct QuestDropSet {
}
};
struct ItemCleanup {
int32_t itemIds[4];
ItemCleanup(nlohmann::json ids) {
for (int i = 0; i < 4; i++) {
itemIds[i] = ids[i];
}
}
};
namespace MissionManager {
extern std::map<int32_t, Reward*> Rewards;
extern std::map<int32_t, SUItem*> SUItems;
extern std::map<int32_t, QuestDropSet*> QuestDropSets;
extern std::map<int32_t, ItemCleanup*> ItemCleanups;
void init();
void acceptMission(CNSocket* sock, CNPacketData* data);
void completeTask(CNSocket* sock, CNPacketData* data);
void setMission(CNSocket* sock, CNPacketData* data);
void quitMission(CNSocket* sock, CNPacketData* data);
int findFreeQSlot(Player *plr);
void dropQuestItem(CNSocket *sock, int task, int count, int id, int mobid);
void giveMissionReward(CNSocket *sock, int task);
}