OpenFusion/src/Player.hpp

93 lines
2.0 KiB
C++
Raw Normal View History

2020-08-25 18:42:52 +00:00
#pragma once
2020-08-18 20:42:30 +00:00
#include <string>
#include <cstring>
#include "core/Core.hpp"
#include "Chunking.hpp"
2020-08-18 20:42:30 +00:00
#define ACTIVE_MISSION_COUNT 6
#define PC_MAXHEALTH(level) (925 + 75 * (level))
2020-08-18 20:42:30 +00:00
struct Player {
int accountId;
int accountLevel; // permission level (see CN_ACCOUNT_LEVEL enums)
2020-08-18 20:42:30 +00:00
int64_t SerialKey;
int32_t iID;
uint64_t FEKey;
int level;
int HP;
int slot; // player slot, not nano slot
Database saving update (#104) * implemented saving BatteryN and BatteryW * implemented saving mentor * moved int64->blob parsing to a separate function * moved parsing blob->int64 to a separate function * added functions for parsing int32->blob and vice versa * added functions for parsing int16->blob and vice versa * WIP saving quest items and active tasks * Quest items are stored in inventory table instead of blob * added sanity check for missionId * saving active missions works * removed unneccesary include * implemented saving warplocationflag, skywaylocationflag and currentmissionid in database * INFO DB message now shows how many accounts and player characters are in the database * fixed dbsaveinterval being in [login] instead of [shard] * fixed mission quit: - fixed wrong json name, causing qitems not deleting properly - quitting mission now resets npc kill count * adjusted saving active missions * removed blob parsing functions that ended up being unused * removed accidentaly added include * removed sending PCStyle2 on Player Enter * added a sanity check in itemMoveHandler * removed MapNum from PCLoad, as client doesn't even read it * set BuddyWarpCooldown to 60s on PCLoad * fixed a bug causing EXIT DUPLICATE not working * added creation and last login timestamps to accounts and players * added a sanity check for P_CL2LS_REQ_PC_EXIT_DUPLICATE * implemented web api support, toggled by new setting (off by default) * add usewebapi to config Co-authored-by: Gent <gentsemaj@live.com>
2020-09-21 19:43:53 +00:00
int16_t mentor;
int32_t money;
int32_t fusionmatter;
int32_t batteryW;
int32_t batteryN;
2020-08-18 20:42:30 +00:00
sPCStyle PCStyle;
sPCStyle2 PCStyle2;
sNano Nanos[NANO_COUNT]; // acquired nanos
int equippedNanos[3];
int activeNano; // active nano (index into Nanos)
int8_t iPCState;
int32_t iWarpLocationFlag;
int64_t aSkywayLocationFlag[2];
2020-09-18 07:10:30 +00:00
int32_t iConditionBitFlag;
int32_t iSelfConditionBitFlag;
int8_t iSpecialState;
2020-08-18 20:42:30 +00:00
2020-10-12 16:55:41 +00:00
int x, y, z, angle;
int lastX, lastY, lastZ, lastAngle;
int recallX, recallY, recallZ, recallInstance; // also Lair entrances
2020-10-12 16:55:41 +00:00
uint64_t instanceID;
2020-08-18 20:42:30 +00:00
sItemBase Equip[AEQUIP_COUNT];
sItemBase Inven[AINVEN_COUNT];
2020-12-03 23:58:10 +00:00
sItemBase Bank[ABANK_COUNT];
sItemTrade Trade[12];
int32_t moneyInTrade;
bool isTrading;
bool isTradeConfirm;
bool inCombat;
2020-11-26 15:01:48 +00:00
bool onMonkey;
int nanoDrainRate;
int healCooldown;
int pointDamage;
int groupDamage;
2020-12-31 05:54:57 +00:00
int fireRate;
int defense;
2020-09-13 18:45:51 +00:00
int64_t aQuestFlag[16];
int tasks[ACTIVE_MISSION_COUNT];
Database saving update (#104) * implemented saving BatteryN and BatteryW * implemented saving mentor * moved int64->blob parsing to a separate function * moved parsing blob->int64 to a separate function * added functions for parsing int32->blob and vice versa * added functions for parsing int16->blob and vice versa * WIP saving quest items and active tasks * Quest items are stored in inventory table instead of blob * added sanity check for missionId * saving active missions works * removed unneccesary include * implemented saving warplocationflag, skywaylocationflag and currentmissionid in database * INFO DB message now shows how many accounts and player characters are in the database * fixed dbsaveinterval being in [login] instead of [shard] * fixed mission quit: - fixed wrong json name, causing qitems not deleting properly - quitting mission now resets npc kill count * adjusted saving active missions * removed blob parsing functions that ended up being unused * removed accidentaly added include * removed sending PCStyle2 on Player Enter * added a sanity check in itemMoveHandler * removed MapNum from PCLoad, as client doesn't even read it * set BuddyWarpCooldown to 60s on PCLoad * fixed a bug causing EXIT DUPLICATE not working * added creation and last login timestamps to accounts and players * added a sanity check for P_CL2LS_REQ_PC_EXIT_DUPLICATE * implemented web api support, toggled by new setting (off by default) * add usewebapi to config Co-authored-by: Gent <gentsemaj@live.com>
2020-09-21 19:43:53 +00:00
int RemainingNPCCount[ACTIVE_MISSION_COUNT][3];
sItemBase QInven[AQINVEN_COUNT];
Database saving update (#104) * implemented saving BatteryN and BatteryW * implemented saving mentor * moved int64->blob parsing to a separate function * moved parsing blob->int64 to a separate function * added functions for parsing int32->blob and vice versa * added functions for parsing int16->blob and vice versa * WIP saving quest items and active tasks * Quest items are stored in inventory table instead of blob * added sanity check for missionId * saving active missions works * removed unneccesary include * implemented saving warplocationflag, skywaylocationflag and currentmissionid in database * INFO DB message now shows how many accounts and player characters are in the database * fixed dbsaveinterval being in [login] instead of [shard] * fixed mission quit: - fixed wrong json name, causing qitems not deleting properly - quitting mission now resets npc kill count * adjusted saving active missions * removed blob parsing functions that ended up being unused * removed accidentaly added include * removed sending PCStyle2 on Player Enter * added a sanity check in itemMoveHandler * removed MapNum from PCLoad, as client doesn't even read it * set BuddyWarpCooldown to 60s on PCLoad * fixed a bug causing EXIT DUPLICATE not working * added creation and last login timestamps to accounts and players * added a sanity check for P_CL2LS_REQ_PC_EXIT_DUPLICATE * implemented web api support, toggled by new setting (off by default) * add usewebapi to config Co-authored-by: Gent <gentsemaj@live.com>
2020-09-21 19:43:53 +00:00
int32_t CurrentMissionID;
sTimeLimitItemDeleteInfo2CL toRemoveVehicle;
int32_t iIDGroup;
int groupCnt;
int32_t groupIDs[4];
int32_t iGroupConditionBitFlag;
bool notify;
bool hidden;
bool unwarpable;
bool buddiesSynced;
int64_t buddyIDs[50];
2020-12-05 00:29:08 +00:00
bool isBuddyBlocked[50];
2020-11-17 23:16:16 +00:00
2020-12-07 18:01:29 +00:00
uint64_t iFirstUseFlag[2];
2020-11-19 01:37:58 +00:00
ChunkPos chunkPos;
std::set<Chunk*> *viewableChunks;
2020-11-17 23:16:16 +00:00
time_t lastHeartbeat;
2020-12-31 05:54:57 +00:00
int suspicionRating;
time_t lastShot;
std::vector<sItemBase> *buyback;
2020-08-18 20:42:30 +00:00
};