2020-12-18 20:15:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "dolphin_deed.h"
|
2021-01-08 04:42:48 +00:00
|
|
|
#include <stdbool.h>
|
2020-12-18 20:15:29 +00:00
|
|
|
#include <stdint.h>
|
2021-10-07 13:32:37 +00:00
|
|
|
#include <rtc.h>
|
|
|
|
#include <time.h>
|
2020-12-18 20:15:29 +00:00
|
|
|
|
|
|
|
typedef struct DolphinState DolphinState;
|
2021-11-24 16:21:12 +00:00
|
|
|
typedef struct {
|
|
|
|
uint32_t limit_ibutton;
|
|
|
|
uint32_t limit_nfc;
|
|
|
|
uint32_t limit_ir;
|
|
|
|
uint32_t limit_rfid;
|
|
|
|
|
|
|
|
uint32_t flags;
|
|
|
|
uint32_t icounter;
|
|
|
|
uint32_t butthurt;
|
|
|
|
uint64_t timestamp;
|
|
|
|
} DolphinStoreData;
|
|
|
|
|
|
|
|
struct DolphinState {
|
|
|
|
DolphinStoreData data;
|
|
|
|
bool dirty;
|
|
|
|
};
|
2020-12-18 20:15:29 +00:00
|
|
|
|
|
|
|
DolphinState* dolphin_state_alloc();
|
|
|
|
|
2021-04-13 18:06:25 +00:00
|
|
|
void dolphin_state_free(DolphinState* dolphin_state);
|
2020-12-18 20:15:29 +00:00
|
|
|
|
2021-01-08 04:42:48 +00:00
|
|
|
bool dolphin_state_save(DolphinState* dolphin_state);
|
2020-12-18 20:15:29 +00:00
|
|
|
|
2021-01-08 04:42:48 +00:00
|
|
|
bool dolphin_state_load(DolphinState* dolphin_state);
|
2020-12-18 20:15:29 +00:00
|
|
|
|
|
|
|
void dolphin_state_clear(DolphinState* dolphin_state);
|
|
|
|
|
2021-10-07 13:32:37 +00:00
|
|
|
uint64_t dolphin_state_timestamp();
|
|
|
|
|
2021-11-24 16:21:12 +00:00
|
|
|
bool dolphin_state_on_deed(DolphinState* dolphin_state, DolphinDeed deed);
|
2020-12-18 20:15:29 +00:00
|
|
|
|
2021-10-07 13:32:37 +00:00
|
|
|
void dolphin_state_butthurted(DolphinState* dolphin_state);
|
|
|
|
|
2021-11-24 16:21:12 +00:00
|
|
|
uint32_t dolphin_state_xp_to_levelup(uint32_t icounter);
|
2020-12-18 20:15:29 +00:00
|
|
|
|
2021-11-24 16:21:12 +00:00
|
|
|
bool dolphin_state_is_levelup(uint32_t icounter);
|
2021-03-25 17:48:58 +00:00
|
|
|
|
2021-11-24 16:21:12 +00:00
|
|
|
void dolphin_state_increase_level(DolphinState* dolphin_state);
|
2021-10-07 13:32:37 +00:00
|
|
|
|
2021-11-24 16:21:12 +00:00
|
|
|
uint8_t dolphin_get_level(uint32_t icounter);
|