mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
pet_names gets a pet_lot column (mysql 80, sqlite 63). The world writes it whenever it saves a pet name, from the pet entity's LOT, and fills it in for older rows when the owner loads into a world (from the pets the game loads for that character, only where it is still missing). The dashboard's pet name tables read pet_lot instead of scanning the owner's character XML; pets without it yet show as Unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.6 KiB
C++
47 lines
1.6 KiB
C++
#ifndef __IPETNAMES__H__
|
|
#define __IPETNAMES__H__
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
#include "dCommonVars.h"
|
|
|
|
class IPetNames {
|
|
public:
|
|
struct Info {
|
|
std::string petName;
|
|
int32_t approvalStatus{};
|
|
// The character that owns the pet (0 when not known). Saving with 0 keeps the owner already stored.
|
|
LWOOBJID ownerId{};
|
|
// The pet's LOT (0 when not known). Saving with 0 keeps the LOT already stored.
|
|
LOT petLot{};
|
|
};
|
|
|
|
// Set the pet name moderation status for the given pet id.
|
|
virtual void SetPetNameModerationStatus(const LWOOBJID& petId, const IPetNames::Info& info) = 0;
|
|
|
|
// Get pet info for the given pet id.
|
|
virtual std::optional<IPetNames::Info> GetPetNameInfo(const LWOOBJID& petId) = 0;
|
|
|
|
// Get paginated pet names data for DataTables display
|
|
virtual std::string GetPetNamesTable(uint32_t start, uint32_t length, const std::string_view search = "", uint32_t orderColumn = 0, bool orderAsc = true, bool pendingOnly = false) = 0;
|
|
|
|
// Approve a pet name by id
|
|
virtual void ApprovePetName(const int64_t id) = 0;
|
|
|
|
// Reject (delete) a pet name by id
|
|
virtual void RejectPetName(const int64_t id) = 0;
|
|
|
|
// Pets whose owner was never recorded (named before owners were saved), and recording one (0: nobody has it)
|
|
virtual std::vector<LWOOBJID> GetPetsWithUnknownOwner() = 0;
|
|
virtual void SetPetOwner(const LWOOBJID petId, const LWOOBJID ownerId) = 0;
|
|
|
|
// Record the pet's LOT on its pet_names row, only when the row has none yet (NULL or 0). Does nothing without a row.
|
|
virtual void SetPetLotIfMissing(const LWOOBJID petId, const LOT petLot) = 0;
|
|
};
|
|
|
|
#endif //!__IPETNAMES__H__
|