mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-08 11:44:11 +00:00
implement rest of equipment scripts (#1714)
This commit is contained in:
@@ -334,6 +334,8 @@
|
||||
#include "AgSpiderBossMessage.h"
|
||||
#include "GfRaceInstancer.h"
|
||||
#include "NsRaceServer.h"
|
||||
#include "TrialFactionArmorServer.h"
|
||||
#include "ImaginationBackPack.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -700,6 +702,8 @@ namespace {
|
||||
{"scripts\\ai\\RACING\\TRACK_GF\\GF_RACE_SERVER.lua", []() {return new GfRaceServer();}},
|
||||
{"scripts\\ai\\RACING\\TRACK_FV\\FV_RACE_SERVER.lua", []() {return new FvRaceServer();}},
|
||||
{"scripts\\ai\\RACING\\OBJECTS\\VEHICLE_DEATH_TRIGGER_WATER_SERVER.lua", []() {return new VehicleDeathTriggerWaterServer();}},
|
||||
{"scripts\\equipmenttriggers\\L_TRIAL_FACTION_ARMOR_SERVER.lua", []() {return new TrialFactionArmorServer();}},
|
||||
{"scripts\\equipmenttriggers\\ImaginationBackPack.lua", []() {return new ImaginationBackPack();}},
|
||||
|
||||
};
|
||||
|
||||
|
@@ -186,6 +186,8 @@ namespace CppScripts {
|
||||
*/
|
||||
virtual void NotifyHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {};
|
||||
|
||||
virtual void NotifyPlayerResurrectionFinished(Entity& self, GameMessages::PlayerResurrectionFinished& msg) {};
|
||||
|
||||
/**
|
||||
* Invoked when a player has responsed to a mission.
|
||||
*
|
||||
|
@@ -1,5 +1,7 @@
|
||||
set(DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS
|
||||
"CoilBackpackBase.cpp")
|
||||
"CoilBackpackBase.cpp"
|
||||
"ImaginationBackPack.cpp"
|
||||
"TrialFactionArmorServer.cpp")
|
||||
|
||||
add_library(dScriptsEquipmentTriggers OBJECT ${DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS})
|
||||
target_include_directories(dScriptsEquipmentTriggers PUBLIC ".")
|
||||
|
22
dScripts/EquipmentTriggers/ImaginationBackPack.cpp
Normal file
22
dScripts/EquipmentTriggers/ImaginationBackPack.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "ImaginationBackPack.h"
|
||||
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void ImaginationBackPack::OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
||||
LOG("Subscribing to PlayerResurrectionFinished");
|
||||
itemOwner->Subscribe(itemObjId, this, "PlayerResurrectionFinished");
|
||||
}
|
||||
|
||||
void ImaginationBackPack::NotifyPlayerResurrectionFinished(Entity& self, GameMessages::PlayerResurrectionFinished& msg) {
|
||||
LOG("PlayerResurrectionFinished");
|
||||
auto* skillComponent = self.GetComponent<SkillComponent>();
|
||||
if (!skillComponent) return;
|
||||
LOG("Casting skill 1334");
|
||||
skillComponent->CastSkill(1334);
|
||||
}
|
||||
|
||||
void ImaginationBackPack::OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
||||
LOG("Unsubscribing from PlayerResurrectionFinished");
|
||||
itemOwner->Unsubscribe(itemObjId, "PlayerResurrectionFinished");
|
||||
}
|
||||
|
13
dScripts/EquipmentTriggers/ImaginationBackPack.h
Normal file
13
dScripts/EquipmentTriggers/ImaginationBackPack.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef IMAGINATIONBACKPACK_H
|
||||
#define IMAGINATIONBACKPACK_H
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class ImaginationBackPack : public CppScripts::Script {
|
||||
public:
|
||||
void OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) override;
|
||||
void NotifyPlayerResurrectionFinished(Entity& self, GameMessages::PlayerResurrectionFinished& msg) override;
|
||||
void OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) override;
|
||||
};
|
||||
|
||||
#endif //!IMAGINATIONBACKPACK_H
|
13
dScripts/EquipmentTriggers/ObyxShardPack.h
Normal file
13
dScripts/EquipmentTriggers/ObyxShardPack.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __OBYXSHARDPACK__H__
|
||||
#define __OBYXSHARDPACK__H__
|
||||
|
||||
#include "CoilBackpackBase.h"
|
||||
|
||||
class ObyxShardPack : public CoilBackpackBase {
|
||||
public:
|
||||
ObyxShardPack() : CoilBackpackBase(skillId) {};
|
||||
private:
|
||||
static const uint32_t skillId = 1751;
|
||||
};
|
||||
|
||||
#endif //!__OBYXSHARDPACK__H__
|
13
dScripts/EquipmentTriggers/RubyShardPack.h
Normal file
13
dScripts/EquipmentTriggers/RubyShardPack.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __RUBYSHARDPACK__H__
|
||||
#define __RUBYSHARDPACK__H__
|
||||
|
||||
#include "CoilBackpackBase.h"
|
||||
|
||||
class RubyShardPack : public CoilBackpackBase {
|
||||
public:
|
||||
RubyShardPack() : CoilBackpackBase(skillId) {};
|
||||
private:
|
||||
static const uint32_t skillId = 1750;
|
||||
};
|
||||
|
||||
#endif //!__RUBYSHARDPACK__H__
|
27
dScripts/EquipmentTriggers/TrialFactionArmorServer.cpp
Normal file
27
dScripts/EquipmentTriggers/TrialFactionArmorServer.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "TrialFactionArmorServer.h"
|
||||
|
||||
#include "Character.h"
|
||||
#include "ePlayerFlag.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void TrialFactionArmorServer::OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
||||
auto* character = itemOwner->GetCharacter();
|
||||
if (!character) return;
|
||||
|
||||
auto flag = character->GetPlayerFlag(ePlayerFlag::EQUPPED_TRIAL_FACTION_GEAR);
|
||||
if (!flag) {
|
||||
character->SetPlayerFlag(ePlayerFlag::EQUPPED_TRIAL_FACTION_GEAR, true);
|
||||
|
||||
// technically a TimerWithCancel but our current implementation doesnt support this.
|
||||
itemOwner->AddCallbackTimer(1.0f, [itemOwner]() {
|
||||
auto* destroyableComponent = itemOwner->GetComponent<DestroyableComponent>();
|
||||
if (!destroyableComponent) return;
|
||||
|
||||
destroyableComponent->SetHealth(destroyableComponent->GetMaxHealth());
|
||||
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor());
|
||||
destroyableComponent->SetImagination(destroyableComponent->GetMaxImagination());
|
||||
|
||||
Game::entityManager->SerializeEntity(itemOwner);
|
||||
});
|
||||
}
|
||||
}
|
11
dScripts/EquipmentTriggers/TrialFactionArmorServer.h
Normal file
11
dScripts/EquipmentTriggers/TrialFactionArmorServer.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef TRIALFACTIONARMORSERVER_
|
||||
#define TRIALFACTIONARMORSERVER_
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class TrialFactionArmorServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) override;
|
||||
};
|
||||
|
||||
#endif //!TRIALFACTIONARMORSERVER_
|
Reference in New Issue
Block a user