Lucas-Bot/dependencies/Person/Person.h

80 lines
2.2 KiB
C++

/*
* This file is part of Lucas' Bot.
*
* Lucas' Bot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
Lucas' Bot is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
for more details.
You should have received a copy of the GNU Affero General Public License along
with Lucas' Bot. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef PERSON_DEMO_PERSON_H
#define PERSON_DEMO_PERSON_H
#ifdef _MSC_VER
#ifdef EXPORT_PERSON
#define PERSON_LIB __declspec(dllexport)
#else
#define PERSON_LIB __declspec(dllimport)
#endif
#else
#define PERSON_LIB
#endif
#include <ctime>
#include "json.hpp"
#ifndef MIRAICP_PRO_PLUGINCONFIG_H
namespace MiraiCP {
using QQID = unsigned long long;
}
#endif
class Person {
private:
MiraiCP::QQID qqID;
// 上次签到时间
std::time_t lastSignOnTime;
// 连续签到天数
int signOnDays;
// 发言未被攻击累计次数
int speakCount;
// 铜钱数量
int copperCoin;
public:
// Generate ctors and dtors
// assignment operators
PERSON_LIB Person();
explicit PERSON_LIB Person(MiraiCP::QQID id);
// Deserialize from JSON
explicit PERSON_LIB Person(const nlohmann::json&);
PERSON_LIB ~Person();
PERSON_LIB Person(const Person&);
PERSON_LIB Person& operator=(const Person&);
PERSON_LIB Person(Person&&);
PERSON_LIB Person& operator=(Person&&);
[[nodiscard]] bool PERSON_LIB isSignOnToday() const;
void PERSON_LIB signOn();
[[nodiscard]] int PERSON_LIB continuousSignOnDays() const;
[[nodiscard]] bool PERSON_LIB willBeAttackNextTime() const;
void PERSON_LIB resetAttackCount();
void PERSON_LIB increaseSpeakCount();
[[nodiscard]] int PERSON_LIB getCopperCoin() const;
nlohmann::json PERSON_LIB serializeToJSON();
[[nodiscard]] MiraiCP::QQID PERSON_LIB getQQID() const;
};
#endif //PERSON_DEMO_PERSON_H