mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Implement the Imaginite Backpack and Shard armor scripts (#886)
* Imaginite Pack now works * Remove unused params * Address issues * Add TeslaPack script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
This commit is contained in:
3
dScripts/EquipmentTriggers/CMakeLists.txt
Normal file
3
dScripts/EquipmentTriggers/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
set(DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS
|
||||
"CoilBackpackBase.cpp"
|
||||
PARENT_SCOPE)
|
25
dScripts/EquipmentTriggers/CoilBackpackBase.cpp
Normal file
25
dScripts/EquipmentTriggers/CoilBackpackBase.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "CoilBackpackBase.h"
|
||||
|
||||
#include "Entity.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void CoilBackpackBase::OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
||||
itemOwner->Subscribe(itemObjId, this, "HitOrHealResult");
|
||||
itemOwner->SetVar<uint8_t>(u"coilCount", 0);
|
||||
}
|
||||
|
||||
void CoilBackpackBase::NotifyHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
if (damage > 0) {
|
||||
self->SetVar<uint8_t>(u"coilCount", self->GetVar<uint8_t>(u"coilCount") + 1);
|
||||
if (self->GetVar<uint8_t>(u"coilCount") > 4) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) return;
|
||||
skillComponent->CalculateBehavior(m_SkillId, m_BehaviorId, self->GetObjectID());
|
||||
self->SetVar<uint8_t>(u"coilCount", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CoilBackpackBase::OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
||||
itemOwner->Unsubscribe(itemObjId, "HitOrHealResult");
|
||||
}
|
21
dScripts/EquipmentTriggers/CoilBackpackBase.h
Normal file
21
dScripts/EquipmentTriggers/CoilBackpackBase.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef __GemPackBase__H__
|
||||
#define __GemPackBase__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class CoilBackpackBase: public CppScripts::Script {
|
||||
public:
|
||||
CoilBackpackBase(uint32_t skillId, uint32_t behaviorId) {
|
||||
m_SkillId = skillId;
|
||||
m_BehaviorId = behaviorId;
|
||||
};
|
||||
|
||||
void OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) override;
|
||||
void NotifyHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
|
||||
void OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) override;
|
||||
private:
|
||||
uint32_t m_SkillId = 0;
|
||||
uint32_t m_BehaviorId = 0;
|
||||
};
|
||||
|
||||
#endif //!__GemPackBase__H__
|
14
dScripts/EquipmentTriggers/GemPack.h
Normal file
14
dScripts/EquipmentTriggers/GemPack.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef __GEMPACK__H__
|
||||
#define __GEMPACK__H__
|
||||
|
||||
#include "CoilBackpackBase.h"
|
||||
|
||||
class GemPack : public CoilBackpackBase {
|
||||
public:
|
||||
GemPack() : CoilBackpackBase(skillId, behaviorId) {};
|
||||
private:
|
||||
static const uint32_t skillId = 1488;
|
||||
static const uint32_t behaviorId = 36779;
|
||||
};
|
||||
|
||||
#endif //!__GEMPACK__H__
|
14
dScripts/EquipmentTriggers/ShardArmor.h
Normal file
14
dScripts/EquipmentTriggers/ShardArmor.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef __SHARDARMOR__H__
|
||||
#define __SHARDARMOR__H__
|
||||
|
||||
#include "CoilBackpackBase.h"
|
||||
|
||||
class ShardArmor : public CoilBackpackBase {
|
||||
public:
|
||||
ShardArmor() : CoilBackpackBase(skillId, behaviorId) {};
|
||||
private:
|
||||
static const uint32_t skillId = 1249;
|
||||
static const uint32_t behaviorId = 29086;
|
||||
};
|
||||
|
||||
#endif //!__SHARDARMOR__H__
|
14
dScripts/EquipmentTriggers/TeslaPack.h
Normal file
14
dScripts/EquipmentTriggers/TeslaPack.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef __TESLAPACK__H__
|
||||
#define __TESLAPACK__H__
|
||||
|
||||
#include "CoilBackpackBase.h"
|
||||
|
||||
class TeslaPack : public CoilBackpackBase {
|
||||
public:
|
||||
TeslaPack() : CoilBackpackBase(skillId, behaviorId) {};
|
||||
private:
|
||||
static const uint32_t skillId = 1001;
|
||||
static const uint32_t behaviorId = 20917;
|
||||
};
|
||||
|
||||
#endif //!__TESLAPACK__H__
|
Reference in New Issue
Block a user