mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-10 16:54:21 +00:00
* feat: implement missing precondition types (20, 21, 23) and pet checks Add DoesNotHaveFlag (23), NotFreeTrial (20), and MissionActive (21) to PreconditionType and implement their checks. Also implement PetDeployed and IsPetTaming using PetComponent static helpers, matching client behavior — both are simple boolean checks with no LOT comparison. LegoClubMember is set to always pass as DLU has no membership concept. * fix: update TODO comments for team check and racing licence preconditions * type Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
85 lines
1.4 KiB
C++
85 lines
1.4 KiB
C++
#pragma once
|
|
#include <vector>
|
|
|
|
#include "Entity.h"
|
|
|
|
|
|
enum class PreconditionType
|
|
{
|
|
ItemEquipped,
|
|
ItemNotEquipped,
|
|
HasItem,
|
|
DoesNotHaveItem,
|
|
HasAchievement,
|
|
MissionAvailable,
|
|
OnMission,
|
|
MissionComplete,
|
|
PetDeployed,
|
|
HasFlag,
|
|
WithinShape,
|
|
InBuild,
|
|
TeamCheck,
|
|
IsPetTaming,
|
|
HasFaction,
|
|
DoesNotHaveFaction,
|
|
HasRacingLicence,
|
|
DoesNotHaveRacingLicence,
|
|
LegoClubMember,
|
|
NoInteraction,
|
|
NotFreeTrial,
|
|
MissionActive,
|
|
HasLevel,
|
|
DoesNotHaveFlag = 23
|
|
};
|
|
|
|
|
|
class Precondition final
|
|
{
|
|
public:
|
|
explicit Precondition(uint32_t condition);
|
|
|
|
bool Check(Entity* player, bool evaluateCosts = false) const;
|
|
|
|
private:
|
|
bool CheckValue(Entity* player, uint32_t value, bool evaluateCosts = false) const;
|
|
|
|
PreconditionType type;
|
|
|
|
std::vector<uint32_t> values;
|
|
|
|
uint32_t count;
|
|
};
|
|
|
|
|
|
class PreconditionExpression final
|
|
{
|
|
public:
|
|
explicit PreconditionExpression(const std::string& conditions);
|
|
|
|
bool Check(Entity* player, bool evaluateCosts = false) const;
|
|
|
|
~PreconditionExpression();
|
|
|
|
private:
|
|
uint32_t condition = 0;
|
|
|
|
bool m_or = false;
|
|
|
|
bool empty = false;
|
|
|
|
PreconditionExpression* next = nullptr;
|
|
};
|
|
|
|
class Preconditions final
|
|
{
|
|
public:
|
|
static bool Check(Entity* player, uint32_t condition, bool evaluateCosts = false);
|
|
|
|
static PreconditionExpression CreateExpression(const std::string& conditions);
|
|
|
|
~Preconditions();
|
|
|
|
private:
|
|
static std::map<uint32_t, Precondition*> cache;
|
|
};
|