-
Notifications
You must be signed in to change notification settings - Fork 182
Expand file tree
/
Copy pathPetDigServer.h
More file actions
37 lines (32 loc) · 1.36 KB
/
PetDigServer.h
File metadata and controls
37 lines (32 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "CppScripts.h"
struct DigInfo {
LOT digLot; // The lot of the chest
LOT spawnLot; // Option lot of pet to spawn
int32_t requiredMission; // Optional mission required before pet can be spawned, if < 0 == don't use
bool specificPet; // This treasure requires a specific pet to be dug up
bool xBuild; // This treasure is retrieved from a buildable cross
bool bouncer; // This treasure spawns a bouncer
bool builderOnly; // Only the builder of this diggable may access the rewards, for example with crosses
};
class PetDigServer : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override;
/**
* Invoked when a player interacts with treasure.
* @param self the entity the script belongs to
* @param user the entity that used the treasure
*/
void OnUse(Entity* self, Entity* user) override;
static Entity* GetClosestTresure(NiPoint3 position);
private:
static void ProgressPetDigMissions(const Entity* owner, const Entity* chest);
static void SpawnPet(Entity* self, const Entity* owner, DigInfo digInfo);
static void HandleXBuildDig(const Entity* self, Entity* owner, Entity* pet);
static void HandleBouncerDig(const Entity* self, const Entity* owner);
static std::vector<LWOOBJID> treasures;
static const DigInfo defaultDigInfo;
static const std::map<LOT, DigInfo> digInfoMap;
};