mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-23 05:53:34 +00:00
added tracking of Pet Excavator achievement (#213)
* added tracking of the Pet Excavator achievement * make Pet Extractor Progress Zone specific * added tracking of Pet Excavator Achievement using player flags
This commit is contained in:
parent
84cf79906b
commit
f7009b499b
@ -91,7 +91,7 @@ void PetDigServer::OnDie(Entity* self, Entity* killer)
|
||||
PetDigServer::HandleBouncerDig(self, owner);
|
||||
}
|
||||
|
||||
PetDigServer::ProgressCanYouDigIt(owner);
|
||||
PetDigServer::ProgressPetDigMissions(owner, self);
|
||||
|
||||
self->SetNetworkVar<bool>(u"treasure_dug", true);
|
||||
// TODO: Reset other pets
|
||||
@ -157,19 +157,36 @@ void PetDigServer::HandleBouncerDig(const Entity *self, const Entity *owner) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Progresses the Can You Dig It mission if the player has never completed it yet
|
||||
* Progresses the Can You Dig It mission and the Pet Excavator Achievement if the player has never completed it yet
|
||||
* \param owner the owner that just made a pet dig something up
|
||||
*/
|
||||
void PetDigServer::ProgressCanYouDigIt(const Entity* owner) {
|
||||
void PetDigServer::ProgressPetDigMissions(const Entity* owner, const Entity* chest) {
|
||||
auto* missionComponent = owner->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr)
|
||||
{
|
||||
// Can You Dig It progress
|
||||
const auto digMissionState = missionComponent->GetMissionState(843);
|
||||
if (digMissionState == MissionState::MISSION_STATE_ACTIVE)
|
||||
{
|
||||
missionComponent->ForceProgress(843, 1216, 1);
|
||||
}
|
||||
|
||||
// Pet Excavator progress
|
||||
const auto excavatorMissionState = missionComponent->GetMissionState(505);
|
||||
if (excavatorMissionState == MissionState::MISSION_STATE_ACTIVE)
|
||||
{
|
||||
if (chest->HasVar(u"PetDig")) {
|
||||
int32_t playerFlag = 1260 + chest->GetVarAs<int32_t>(u"PetDig");
|
||||
Character* player = owner->GetCharacter();
|
||||
|
||||
// check if player flag is set
|
||||
if (!player->GetPlayerFlag(playerFlag)) {
|
||||
missionComponent->ForceProgress(505, 767, 1);
|
||||
player->SetPlayerFlag(playerFlag, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
static Entity* GetClosestTresure(NiPoint3 position);
|
||||
|
||||
private:
|
||||
static void ProgressCanYouDigIt(const Entity* owner);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user