starting playing the wherigo
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
66
main/include/lua/wherigo_completion.h
Normal file
66
main/include/lua/wherigo_completion.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#ifndef WHERIGO_COMPLETION_H
|
||||
#define WHERIGO_COMPLETION_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
|
||||
extern "C" {
|
||||
struct lua_State;
|
||||
}
|
||||
|
||||
namespace wherigo {
|
||||
|
||||
struct CompletionData {
|
||||
std::string cartridgeName;
|
||||
std::string cartridgeGUID;
|
||||
std::string playerName;
|
||||
std::string completionCode;
|
||||
time_t startTime;
|
||||
time_t endTime;
|
||||
int duration; // seconds
|
||||
|
||||
struct TaskCompletion {
|
||||
std::string name;
|
||||
bool completed;
|
||||
time_t completionTime;
|
||||
};
|
||||
std::vector<TaskCompletion> tasks;
|
||||
|
||||
struct ItemFound {
|
||||
std::string name;
|
||||
time_t foundTime;
|
||||
};
|
||||
std::vector<ItemFound> items;
|
||||
|
||||
struct ZoneVisited {
|
||||
std::string name;
|
||||
time_t visitTime;
|
||||
};
|
||||
std::vector<ZoneVisited> zones;
|
||||
};
|
||||
|
||||
class WherigoCompletion {
|
||||
public:
|
||||
// Generate completion log from current Lua state
|
||||
static bool generateCompletionLog(lua_State* L, const std::string& filePath,
|
||||
const std::string& playerName = "Player");
|
||||
|
||||
// Extract completion data from Lua state
|
||||
static CompletionData extractCompletionData(lua_State* L, const std::string& playerName);
|
||||
|
||||
// Generate .gwl XML file
|
||||
static bool writeGWLFile(const CompletionData& data, const std::string& filePath);
|
||||
|
||||
// Generate completion code (hash/signature)
|
||||
static std::string generateCompletionCode(const CompletionData& data);
|
||||
|
||||
private:
|
||||
static std::string escapeXML(const std::string& str);
|
||||
static std::string formatTime(time_t t);
|
||||
};
|
||||
|
||||
} // namespace wherigo
|
||||
|
||||
#endif // WHERIGO_COMPLETION_H
|
||||
|
||||
Reference in New Issue
Block a user