mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-22 12:42:49 +00:00
feat: optional property rent
Off unless property_rent_enabled is on. Each property world's rent comes from its PropertyTemplate row (minimumPrice every rentDuration x durationType; Block Yard is free), unless the new Property Rent dashboard page sets another price or period (property_rent_manage). Rent is taken from the owner's coins shortly after their character loads, with a mail receipt; unpaid rent is mailed and, after property_rent_grace_days, makes the property private until it is paid, like live. The property management component refuses public or best friends privacy while rent is overdue and a property world that loads overdue makes itself private. Property game messages are unchanged. Fixes #943 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,11 @@ namespace HotPropertySlots {
|
||||
uint32_t id{};
|
||||
uint32_t mapId{};
|
||||
std::string spawnName;
|
||||
// Rent (PropertyRent.h) and reputation (PropertyReputation.h) of the template
|
||||
int64_t minimumPrice{};
|
||||
int32_t rentDuration{};
|
||||
int32_t durationType{};
|
||||
int32_t reputationPerMinute{};
|
||||
};
|
||||
|
||||
struct EntranceRow { // PropertyEntranceComponent
|
||||
@@ -112,6 +117,24 @@ namespace HotPropertySlots {
|
||||
return worlds;
|
||||
}
|
||||
|
||||
/**
|
||||
* The PropertyTemplate row a property world uses: the lowest id among its rows a property entrance leads to (as
|
||||
* PropertyWorlds), or its lowest id row when no entrance leads there. nullptr when the map has no row.
|
||||
*/
|
||||
inline const TemplateRow* WorldTemplate(const std::vector<TemplateRow>& templates, const std::vector<EntranceRow>& entrances, uint32_t mapId) {
|
||||
const TemplateRow* entered = nullptr;
|
||||
const TemplateRow* any = nullptr;
|
||||
for (const auto& row : templates) {
|
||||
if (row.mapId != mapId) continue;
|
||||
if (!any || row.id < any->id) any = &row;
|
||||
const bool isEntered = std::any_of(entrances.begin(), entrances.end(), [&](const EntranceRow& entrance) {
|
||||
return entrance.mapId == row.mapId && entrance.propertyName == row.spawnName;
|
||||
});
|
||||
if (isEntered && (!entered || row.id < entered->id)) entered = &row;
|
||||
}
|
||||
return entered ? entered : any;
|
||||
}
|
||||
|
||||
// A slot's location as stored (0: none) if it is still a property world, else the slot's own world
|
||||
inline uint32_t Location(uint32_t stored, const Slot& slot, const std::vector<uint32_t>& worlds) {
|
||||
return stored != 0 && std::find(worlds.begin(), worlds.end(), stored) != worlds.end() ? stored : slot.mapId;
|
||||
|
||||
Reference in New Issue
Block a user