mirror of
https://github.com/araxiaonline/Traumas.git
synced 2026-06-13 02:12:20 -04:00
Fix proc conditions, fix aura search, improve viability search, remove multimap
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
;IdColumnIndex=0
|
||||
455001:0=455001,3=15,4=218104064,6=524288,7=262144,28=1,34=131752,35=20,40=3,71=6,72=6,73=6,75=1,76=1,81=-31,82=-201,86=1,87=1,88=1,95=42,96=54,97=290,116=455101,131=121,133=2283,136="Trauma: Eye",169=16712188,186=16712188,187="Chance to hit reduced. Cannot crit.#13#10Damage may cause blindness.",203=16712188,225=1
|
||||
455002:0=455002,3=15,4=218104064,6=524288,7=262144,28=1,34=131752,35=20,40=3,46=1,71=6,72=6,73=6,74=1,75=1,76=1,81=-36,82=-36,86=1,87=1,88=1,95=42,96=33,97=192,116=455102,131=121,133=138,136="Trauma: Limb",169=16712188,186=16712188,187="Movement speed and attack speed reduced.#13#10Damage may cause debilitation.",203=16712188,225=1
|
||||
455003:0=455003,3=15,4=218104064,5=1032,6=524288,7=262144,28=1,34=131752,35=33,40=3,46=1,71=6,72=6,73=6,74=1,75=1,76=1,81=-41,82=-31,86=1,87=1,88=1,95=42,96=33,97=133,116=455103,131=121,133=243,136="Trauma: Body",169=16712188,186=16712188,187="Maximum health and movement speed reduced.#13#10Damage may cause heavy bleeding.",203=16712188,225=1
|
||||
455004:0=455004,3=15,4=218104064,6=524288,7=262144,28=1,34=131752,35=20,40=3,46=1,71=6,72=6,73=6,74=1,75=1,76=1,81=-51,82=-51,86=1,87=1,88=1,95=42,96=33,97=252,116=455104,131=121,133=2636,136="Trauma: Head",169=16712188,186=16712188,187="All speeds reduced.#13#10Damage may cause unconsciousness.",203=16712188,225=1
|
||||
455005:0=455005,3=15,4=218104064,6=524288,7=262144,28=1,34=131752,35=50,40=3,46=1,71=6,72=6,74=1,75=1,81=9,86=1,87=1,95=42,96=87,111=127,116=455105,131=121,133=499,136="Trauma: Innards",169=16712188,186=16712188,187="Damage taken increased.#13#10Damage may cause fraility.",203=16712188,225=1
|
||||
455101:0=455101,3=12,4=1140850944,7=65536,28=1,35=101,40=35,46=1,71=6,72=6,74=1,75=1,80=-61,86=1,87=1,95=33,96=5,131=9231,133=48,136="Blindness",169=16712188,186=16712190,187="Disoriented.",203=16712190,225=1
|
||||
455102:0=455102,3=12,4=1140850944,7=65536,28=1,35=101,40=35,46=1,71=6,72=6,74=1,86=1,87=1,95=26,96=60,131=9020,133=2770,136="Debilitation",169=16712188,186=16712188,187="Cannot move, attack or cast spells.",203=16712190,225=1
|
||||
455103:0=455103,3=15,4=67108864,7=65536,28=1,35=101,40=28,46=1,49=5,71=6,74=1,86=1,95=89,98=1000,131=10808,133=500,136="Heavy Bleeding",169=16712188,170="Losing 1% health per second. Stacks.",186=16712190,187="Bleeding $s1% of maximum health per second.",203=16712190,225=1
|
||||
455104:0=455104,3=12,4=1140850944,5=394240,7=65536,9=8,28=1,35=101,40=32,46=1,71=6,72=6,74=1,80=-1,86=1,87=1,95=4,96=12,131=12600,133=15,136="Unconsciousness",169=16712188,186=16712188,187="Stunned.",203=16712188,225=1
|
||||
455105:0=455105,3=15,4=67109120,7=65536,28=1,35=101,40=9,46=1,49=20,71=6,74=1,80=4,86=1,95=87,110=127,131=10808,133=153,136="Fraility",169=16712188,186=16712190,187="All damage taken increased by $s1%.",203=16712190,225=1
|
||||
455001:0=455001,3=15,4=218104064,6=524288,28=1,34=131752,35=20,40=3,68=-1,71=6,72=6,73=6,75=1,76=1,81=-31,82=-201,86=1,87=1,88=1,95=42,96=54,97=290,116=455101,131=121,133=2283,136="Trauma: Eye",169=16712188,186=16712188,187="Chance to hit reduced. Cannot crit.#13#10Damage may cause blindness.",203=16712188,208=1,209=1073741824,225=1
|
||||
455002:0=455002,3=15,4=218104064,6=524288,28=1,34=131752,35=20,40=3,46=1,68=-1,71=6,72=6,73=6,74=1,75=1,76=1,81=-36,82=-36,86=1,87=1,88=1,95=42,96=33,97=192,116=455102,131=121,133=138,136="Trauma: Limb",169=16712188,186=16712188,187="Movement speed and attack speed reduced.#13#10Damage may cause debilitation.",203=16712188,208=1,209=1073741824,225=1
|
||||
455003:0=455003,3=15,4=218104064,5=1032,6=524288,28=1,34=131752,35=33,40=3,46=1,68=-1,71=6,72=6,73=6,74=1,75=1,76=1,81=-41,82=-31,86=1,87=1,88=1,95=42,96=33,97=133,116=455103,131=121,133=243,136="Trauma: Body",169=16712188,186=16712188,187="Maximum health and movement speed reduced.#13#10Damage may cause heavy bleeding.",203=16712188,208=1,209=1073741824,225=1
|
||||
455004:0=455004,3=15,4=218104064,6=524288,28=1,34=131752,35=20,40=3,46=1,68=-1,71=6,72=6,73=6,74=1,75=1,76=1,81=-51,82=-51,86=1,87=1,88=1,95=42,96=33,97=252,116=455104,131=121,133=2636,136="Trauma: Head",169=16712188,186=16712188,187="All speeds reduced.#13#10Damage may cause unconsciousness.",203=16712188,208=1,209=1073741824,225=1
|
||||
455005:0=455005,3=15,4=218104064,6=524288,28=1,34=131752,35=50,40=3,46=1,68=-1,71=6,72=6,74=1,75=1,81=9,86=1,87=1,95=42,96=87,111=127,116=455105,131=121,133=499,136="Trauma: Innards",169=16712188,186=16712188,187="Damage taken increased.#13#10Damage may cause fraility.",203=16712188,208=1,209=1073741824,225=1
|
||||
455101:0=455101,3=12,4=1140850944,7=65536,28=1,35=101,40=35,46=1,68=-1,71=6,72=6,74=1,75=1,80=-61,86=1,87=1,95=33,96=5,131=9231,133=48,136="Blindness",169=16712188,186=16712190,187="Disoriented.",203=16712190,225=1
|
||||
455102:0=455102,3=12,4=1140850944,7=65536,28=1,35=101,40=35,46=1,68=-1,71=6,72=6,74=1,86=1,87=1,95=26,96=60,131=9020,133=2770,136="Debilitation",169=16712188,186=16712188,187="Cannot move, attack or cast spells.",203=16712190,225=1
|
||||
455103:0=455103,3=15,4=67108864,7=65536,28=1,35=101,40=28,46=1,49=5,68=-1,71=6,74=1,86=1,95=89,98=1000,131=10808,133=500,136="Heavy Bleeding",169=16712188,170="Losing 1% health per second. Stacks.",186=16712190,187="Bleeding $s1% of maximum health per second.",203=16712190,225=1
|
||||
455104:0=455104,3=12,4=1140850944,5=394240,7=65536,9=8,28=1,35=101,40=32,46=1,68=-1,71=6,72=6,74=1,80=-1,86=1,87=1,95=4,96=12,131=12600,133=15,136="Unconsciousness",169=16712188,186=16712188,187="Stunned.",203=16712188,225=1
|
||||
455105:0=455105,3=15,4=67109120,7=65536,28=1,35=101,40=9,46=1,49=20,68=-1,71=6,74=1,80=4,86=1,95=87,110=127,131=10808,133=153,136="Fraility",169=16712188,186=16712190,187="All damage taken increased by $s1%.",203=16712190,225=1
|
||||
|
||||
244
traumas.patch
244
traumas.patch
@@ -1,23 +1,23 @@
|
||||
From 5656b9d19ebae5d1cf6c82511dab0301a8a29de6 Mon Sep 17 00:00:00 2001
|
||||
From be10315363d7f8fb01679b9f2feac4c7c67f6c73 Mon Sep 17 00:00:00 2001
|
||||
From: trickerer <onlysuffering@gmail.com>
|
||||
Date: Fri, 19 Feb 2021 19:21:09 +0700
|
||||
Subject: [PATCH] traumas
|
||||
Date: Sat, 4 Sep 2021 20:32:33 +0700
|
||||
Subject: [PATCH] Traumas
|
||||
|
||||
---
|
||||
src/server/game/Entities/Unit/Unit.cpp | 5 +
|
||||
src/server/game/Scripting/ScriptMgr.cpp | 5 +
|
||||
src/server/game/Scripting/ScriptMgr.h | 4 +
|
||||
.../scripts/Custom/custom_script_loader.cpp | 2 +
|
||||
src/server/scripts/Custom/traumas.cpp | 300 ++++++++++++++++++
|
||||
src/server/worldserver/worldserver.conf.dist | 126 ++++++++
|
||||
6 files changed, 442 insertions(+)
|
||||
src/server/scripts/Custom/traumas.cpp | 332 ++++++++++++++++++
|
||||
src/server/worldserver/worldserver.conf.dist | 126 +++++++
|
||||
6 files changed, 474 insertions(+)
|
||||
create mode 100644 src/server/scripts/Custom/traumas.cpp
|
||||
|
||||
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
|
||||
index b2fa0d6..97a09e2 100644
|
||||
index bffe3258..0e003392 100644
|
||||
--- a/src/server/game/Entities/Unit/Unit.cpp
|
||||
+++ b/src/server/game/Entities/Unit/Unit.cpp
|
||||
@@ -694,6 +694,11 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
|
||||
@@ -700,6 +700,11 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
|
||||
// Hook for OnDamage Event
|
||||
sScriptMgr->OnDamage(attacker, victim, damage);
|
||||
|
||||
@@ -30,7 +30,7 @@ index b2fa0d6..97a09e2 100644
|
||||
if (attacker != victim && damagetype != DOT)
|
||||
{
|
||||
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
|
||||
index 8019735..c1a3cea 100644
|
||||
index 80197359..c1a3ceaa 100644
|
||||
--- a/src/server/game/Scripting/ScriptMgr.cpp
|
||||
+++ b/src/server/game/Scripting/ScriptMgr.cpp
|
||||
@@ -2108,6 +2108,11 @@ void ScriptMgr::OnDamage(Unit* attacker, Unit* victim, uint32& damage)
|
||||
@@ -46,7 +46,7 @@ index 8019735..c1a3cea 100644
|
||||
{
|
||||
FOREACH_SCRIPT(UnitScript)->ModifyPeriodicDamageAurasTick(target, attacker, damage);
|
||||
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
|
||||
index 3485c3a..abf718e 100644
|
||||
index 3485c3aa..abf718e5 100644
|
||||
--- a/src/server/game/Scripting/ScriptMgr.h
|
||||
+++ b/src/server/game/Scripting/ScriptMgr.h
|
||||
@@ -403,6 +403,9 @@ class TC_GAME_API UnitScript : public ScriptObject
|
||||
@@ -68,7 +68,7 @@ index 3485c3a..abf718e 100644
|
||||
void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage);
|
||||
void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage);
|
||||
diff --git a/src/server/scripts/Custom/custom_script_loader.cpp b/src/server/scripts/Custom/custom_script_loader.cpp
|
||||
index 9e5e9ba..3a2fbb4 100644
|
||||
index 9e5e9ba2..3a2fbb44 100644
|
||||
--- a/src/server/scripts/Custom/custom_script_loader.cpp
|
||||
+++ b/src/server/scripts/Custom/custom_script_loader.cpp
|
||||
@@ -16,9 +16,11 @@
|
||||
@@ -85,10 +85,10 @@ index 9e5e9ba..3a2fbb4 100644
|
||||
}
|
||||
diff --git a/src/server/scripts/Custom/traumas.cpp b/src/server/scripts/Custom/traumas.cpp
|
||||
new file mode 100644
|
||||
index 0000000..bf2761f
|
||||
index 00000000..c8b954c9
|
||||
--- /dev/null
|
||||
+++ b/src/server/scripts/Custom/traumas.cpp
|
||||
@@ -0,0 +1,300 @@
|
||||
@@ -0,0 +1,332 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2020-2021 trickerer <https://github.com/trickerer>
|
||||
+ */
|
||||
@@ -99,32 +99,35 @@ index 0000000..bf2761f
|
||||
+#include "SpellAuraEffects.h"
|
||||
+
|
||||
+//version
|
||||
+static constexpr uint32 TRAUMAS_REVISION = 64;
|
||||
+static constexpr uint32 TRAUMAS_REVISION = 65;
|
||||
+
|
||||
+//config
|
||||
+bool _Tenabled;
|
||||
+bool _TenableDirect;
|
||||
+bool _TenablePeriodic;
|
||||
+bool _TCritsOnly;
|
||||
+float _TchanceMultCreature;
|
||||
+float _TchanceMultPlayer;
|
||||
+float _TchanceMultCrit;
|
||||
+bool _TenableCreatures;
|
||||
+bool _TenableRankNormal;
|
||||
+bool _TenableRankElite;
|
||||
+bool _TenableRankRare;
|
||||
+bool _TenableRankRareElite;
|
||||
+bool _TenableRankBoss;
|
||||
+bool _TenablePlayers;
|
||||
+bool _TenablePlayerControlled;
|
||||
+bool _TenableInPVP;
|
||||
+uint32 _ThpPctThreshold;
|
||||
+float _TtriggerHpPctThreshold;
|
||||
+bool _TenableCure;
|
||||
+float _TcureChanceMult;
|
||||
+uint32 _TdurationOverride;
|
||||
+bool _traumasEnabled;
|
||||
+bool _traumasEnableDirect;
|
||||
+bool _traumasEnablePeriodic;
|
||||
+bool _traumasCritsOnly;
|
||||
+float _traumasChanceMultCreature;
|
||||
+float _traumasChanceMultPlayer;
|
||||
+float _traumasChanceMultCrit;
|
||||
+bool _traumasEnableCreatures;
|
||||
+bool _traumasEnableRankNormal;
|
||||
+bool _traumasEnableRankElite;
|
||||
+bool _traumasEnableRankRare;
|
||||
+bool _traumasEnableRankRareElite;
|
||||
+bool _traumasEnableRankBoss;
|
||||
+bool _traumasEnablePlayers;
|
||||
+bool _traumasEnablePlayerControlled;
|
||||
+bool _traumasEnableInPVP;
|
||||
+uint32 _traumasHpPctThreshold;
|
||||
+uint32 _traumasTriggerHpPctThreshold;
|
||||
+bool _traumasEnableCure;
|
||||
+float _traumasCureChanceMult;
|
||||
+uint32 _traumasDurationOverride;
|
||||
+
|
||||
+//defs
|
||||
+static constexpr uint32 SPELLFAMILY_TRAUMA = SPELLFAMILY_UNK1;
|
||||
+static constexpr uint32 SPELLFAMILY_FLAG0_TRAUMA = 0x40000000;
|
||||
+
|
||||
+enum TraumaTypes : uint8
|
||||
+{
|
||||
+ TRAUMA_EYE = 1,
|
||||
@@ -136,6 +139,7 @@ index 0000000..bf2761f
|
||||
+
|
||||
+static constexpr uint32 TRAUMA_NONE = 0;
|
||||
+static constexpr uint32 MAX_TRAUMAS = 5;
|
||||
+static constexpr size_t TRAUMA_MAP_SIZE = size_t(CREATURE_TYPE_GAS_CLOUD);
|
||||
+
|
||||
+enum TraumaBaseSpells
|
||||
+{
|
||||
@@ -169,6 +173,9 @@ index 0000000..bf2761f
|
||||
+/*NSpecified*/ NOT_VIABLE_ALL(CREATURE_TYPE_NOT_SPECIFIED)
|
||||
+/*Totem*/ NOT_VIABLE_ALL(CREATURE_TYPE_TOTEM)
|
||||
+/*Gas Cloud*/ NOT_VIABLE_ALL(CREATURE_TYPE_GAS_CLOUD)
|
||||
+
|
||||
+template <TraumaTypes t, CreatureType c>
|
||||
+constexpr bool Is_viable_v = Is_viable<t, c>::value;
|
||||
+}
|
||||
+
|
||||
+struct TraumaViability
|
||||
@@ -177,14 +184,27 @@ index 0000000..bf2761f
|
||||
+ const bool viable;
|
||||
+};
|
||||
+
|
||||
+typedef std::multimap<const CreatureType, const TraumaViability> TraumaViabilityMap;
|
||||
+typedef std::pair<TraumaViabilityMap::const_iterator, TraumaViabilityMap::const_iterator> TraumaViabilityRange;
|
||||
+typedef TraumaViabilityMap::value_type TraumaViabilityPair;
|
||||
+typedef std::pair<const CreatureType, const TraumaViability> TraumaViabilityPair;
|
||||
+typedef std::array<TraumaViabilityPair, MAX_TRAUMAS> TraumaViabilityContainer;
|
||||
+typedef std::array<TraumaViabilityContainer, TRAUMA_MAP_SIZE> TraumaViabilityMap;
|
||||
+#define Tpair(t,c) TraumaViabilityPair{c, TraumaViability{t, trauma_traits::Is_viable_v<t, c>}}
|
||||
+#define Tpairs(c) Tpair(TRAUMA_EYE,c), Tpair(TRAUMA_LIMB,c), Tpair(TRAUMA_BODY,c), Tpair(TRAUMA_HEAD,c), Tpair(TRAUMA_INTERNAL,c)
|
||||
+
|
||||
+#define Tpair(t,c) TraumaViabilityPair(c, TraumaViability{t, trauma_traits::Is_viable<t, c>::value})
|
||||
+#define Tpairs(t) Tpair(t,CREATURE_TYPE_BEAST), Tpair(t,CREATURE_TYPE_DRAGONKIN), Tpair(t,CREATURE_TYPE_DEMON), Tpair(t,CREATURE_TYPE_ELEMENTAL), Tpair(t,CREATURE_TYPE_GIANT), Tpair(t,CREATURE_TYPE_UNDEAD), Tpair(t,CREATURE_TYPE_HUMANOID), Tpair(t,CREATURE_TYPE_CRITTER), Tpair(t,CREATURE_TYPE_MECHANICAL), Tpair(t,CREATURE_TYPE_NOT_SPECIFIED), Tpair(t,CREATURE_TYPE_TOTEM), Tpair(t,CREATURE_TYPE_NON_COMBAT_PET), Tpair(t,CREATURE_TYPE_GAS_CLOUD)
|
||||
+
|
||||
+const TraumaViabilityMap TraumasMap = { Tpairs(TRAUMA_EYE), Tpairs(TRAUMA_LIMB), Tpairs(TRAUMA_BODY), Tpairs(TRAUMA_HEAD), Tpairs(TRAUMA_INTERNAL) };
|
||||
+static constexpr TraumaViabilityMap TraumasMap = {
|
||||
+ Tpairs(CREATURE_TYPE_BEAST),
|
||||
+ Tpairs(CREATURE_TYPE_DRAGONKIN),
|
||||
+ Tpairs(CREATURE_TYPE_DEMON),
|
||||
+ Tpairs(CREATURE_TYPE_ELEMENTAL),
|
||||
+ Tpairs(CREATURE_TYPE_GIANT),
|
||||
+ Tpairs(CREATURE_TYPE_UNDEAD),
|
||||
+ Tpairs(CREATURE_TYPE_HUMANOID),
|
||||
+ Tpairs(CREATURE_TYPE_CRITTER),
|
||||
+ Tpairs(CREATURE_TYPE_MECHANICAL),
|
||||
+ Tpairs(CREATURE_TYPE_NOT_SPECIFIED),
|
||||
+ Tpairs(CREATURE_TYPE_TOTEM),
|
||||
+ Tpairs(CREATURE_TYPE_NON_COMBAT_PET),
|
||||
+ Tpairs(CREATURE_TYPE_GAS_CLOUD)
|
||||
+};
|
||||
+
|
||||
+//scripts
|
||||
+class traumas_config : public WorldScript
|
||||
@@ -198,7 +218,7 @@ index 0000000..bf2761f
|
||||
+ }
|
||||
+
|
||||
+private:
|
||||
+ void _InitTraumasSystem(bool reload)
|
||||
+ static void _InitTraumasSystem(bool reload)
|
||||
+ {
|
||||
+ if (!reload)
|
||||
+ TC_LOG_INFO("server.loading", "Loading Traumas system...");
|
||||
@@ -207,39 +227,39 @@ index 0000000..bf2761f
|
||||
+
|
||||
+ TC_LOG_INFO("server.loading", ">> Traumas config %s.", reload ? "re-loaded" : "loaded");
|
||||
+
|
||||
+ if (_Tenabled)
|
||||
+ if (_traumasEnabled)
|
||||
+ TC_LOG_INFO("server.loading", ">> Traumas system enabled (rev %u)", TRAUMAS_REVISION);
|
||||
+ }
|
||||
+
|
||||
+ void _LoadConfig()
|
||||
+ static void _LoadConfig()
|
||||
+ {
|
||||
+ _Tenabled = sConfigMgr->GetBoolDefault("Trauma.Enable", true);
|
||||
+ _traumasEnabled = sConfigMgr->GetBoolDefault("Trauma.Enable", true);
|
||||
+
|
||||
+ _TenableDirect = sConfigMgr->GetBoolDefault("Trauma.Damage.Direct", true);
|
||||
+ _TenablePeriodic = sConfigMgr->GetBoolDefault("Trauma.Damage.Periodic", true);
|
||||
+ _traumasEnableDirect = sConfigMgr->GetBoolDefault("Trauma.Damage.Direct", true);
|
||||
+ _traumasEnablePeriodic = sConfigMgr->GetBoolDefault("Trauma.Damage.Periodic", true);
|
||||
+
|
||||
+ _TenableCreatures = sConfigMgr->GetBoolDefault("Trauma.Target.Creature", true);
|
||||
+ _TenableRankNormal = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.Normal", true);
|
||||
+ _TenableRankElite = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.Elite", true);
|
||||
+ _TenableRankRare = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.Rare", true);
|
||||
+ _TenableRankRareElite = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.RareElite", true);
|
||||
+ _TenableRankBoss = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.Boss", false);
|
||||
+ _traumasEnableCreatures = sConfigMgr->GetBoolDefault("Trauma.Target.Creature", true);
|
||||
+ _traumasEnableRankNormal = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.Normal", true);
|
||||
+ _traumasEnableRankElite = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.Elite", true);
|
||||
+ _traumasEnableRankRare = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.Rare", true);
|
||||
+ _traumasEnableRankRareElite = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.RareElite", true);
|
||||
+ _traumasEnableRankBoss = sConfigMgr->GetBoolDefault("Trauma.Target.Creature.Rank.Boss", false);
|
||||
+
|
||||
+ _TenablePlayers = sConfigMgr->GetBoolDefault("Trauma.Target.Player", true);
|
||||
+ _TenablePlayerControlled = sConfigMgr->GetBoolDefault("Trauma.Target.Player.Minions", true);
|
||||
+ _TenableInPVP = sConfigMgr->GetBoolDefault("Trauma.Target.Player.PVP", false);
|
||||
+ _traumasEnablePlayers = sConfigMgr->GetBoolDefault("Trauma.Target.Player", true);
|
||||
+ _traumasEnablePlayerControlled = sConfigMgr->GetBoolDefault("Trauma.Target.Player.Minions", true);
|
||||
+ _traumasEnableInPVP = sConfigMgr->GetBoolDefault("Trauma.Target.Player.PVP", false);
|
||||
+
|
||||
+ _ThpPctThreshold = sConfigMgr->GetIntDefault("Trauma.HealthPctThreshold", 0);
|
||||
+ _TtriggerHpPctThreshold = sConfigMgr->GetFloatDefault("Trauma.TriggerHealthPctThreshold", 0.0f);
|
||||
+ _TCritsOnly = sConfigMgr->GetBoolDefault("Trauma.CritsOnly", true);
|
||||
+ _TchanceMultCreature = sConfigMgr->GetFloatDefault("Trauma.ChanceMultiplier.Creature", 1.0f);
|
||||
+ _TchanceMultPlayer = sConfigMgr->GetFloatDefault("Trauma.ChanceMultiplier.Player", 1.0f);
|
||||
+ _TchanceMultCrit = sConfigMgr->GetFloatDefault("Trauma.ChanceMultiplier.Crit", 1.0f);
|
||||
+ _traumasHpPctThreshold = sConfigMgr->GetIntDefault("Trauma.HealthPctThreshold", 0);
|
||||
+ _traumasTriggerHpPctThreshold = sConfigMgr->GetIntDefault("Trauma.TriggerHealthPctThreshold", 0);
|
||||
+ _traumasCritsOnly = sConfigMgr->GetBoolDefault("Trauma.CritsOnly", true);
|
||||
+ _traumasChanceMultCreature = sConfigMgr->GetFloatDefault("Trauma.ChanceMultiplier.Creature", 1.0f);
|
||||
+ _traumasChanceMultPlayer = sConfigMgr->GetFloatDefault("Trauma.ChanceMultiplier.Player", 1.0f);
|
||||
+ _traumasChanceMultCrit = sConfigMgr->GetFloatDefault("Trauma.ChanceMultiplier.Crit", 1.0f);
|
||||
+
|
||||
+ _TenableCure = sConfigMgr->GetBoolDefault("Trauma.Cure.Enable", true);
|
||||
+ _TcureChanceMult = sConfigMgr->GetFloatDefault("Trauma.Cure.ChanceMultiplier", 1.0f);
|
||||
+ _traumasEnableCure = sConfigMgr->GetBoolDefault("Trauma.Cure.Enable", true);
|
||||
+ _traumasCureChanceMult = sConfigMgr->GetFloatDefault("Trauma.Cure.ChanceMultiplier", 1.0f);
|
||||
+
|
||||
+ _TdurationOverride = sConfigMgr->GetIntDefault("Trauma.DurationOverride", 0);
|
||||
+ _traumasDurationOverride = sConfigMgr->GetIntDefault("Trauma.DurationOverride", 0);
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
@@ -250,88 +270,88 @@ index 0000000..bf2761f
|
||||
+
|
||||
+ void OnHeal(Unit* /*healer*/, Unit* reciever, uint32& gain) override
|
||||
+ {
|
||||
+ if (!_Tenabled)
|
||||
+ if (!_traumasEnabled)
|
||||
+ return;
|
||||
+
|
||||
+ if (!_TenableCure)
|
||||
+ if (!_traumasEnableCure)
|
||||
+ return;
|
||||
+
|
||||
+ float chance = reciever->IsFullHealth() ? 100.0f :
|
||||
+ (reciever->GetHealth() + gain >= reciever->GetMaxHealth()) ? 50.f : (gain * 100.f) / reciever->GetMaxHealth();
|
||||
+ chance *= _TcureChanceMult;
|
||||
+ chance *= _traumasCureChanceMult;
|
||||
+
|
||||
+ if (!roll_chance_f(chance))
|
||||
+ return;
|
||||
+
|
||||
+ //1 - eye
|
||||
+ if (reciever->HasAuraType(SPELL_AURA_MOD_CRIT_PCT))
|
||||
+ if (reciever->HasAuraTypeWithFamilyFlags(SPELL_AURA_MOD_CRIT_PCT, SPELLFAMILY_TRAUMA, SPELLFAMILY_FLAG0_TRAUMA))
|
||||
+ reciever->RemoveAurasDueToSpell(SPELL_TRAUMA_BASE_EYE);
|
||||
+ //2 - limb
|
||||
+ else if (reciever->HasAuraType(SPELL_AURA_MOD_MELEE_RANGED_HASTE))
|
||||
+ else if (reciever->HasAuraTypeWithFamilyFlags(SPELL_AURA_MOD_MELEE_RANGED_HASTE, SPELLFAMILY_TRAUMA, SPELLFAMILY_FLAG0_TRAUMA))
|
||||
+ reciever->RemoveAurasDueToSpell(SPELL_TRAUMA_BASE_LIMB);
|
||||
+ //3 - body
|
||||
+ else if (reciever->HasAuraType(SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT))
|
||||
+ else if (reciever->HasAuraTypeWithFamilyFlags(SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT, SPELLFAMILY_TRAUMA, SPELLFAMILY_FLAG0_TRAUMA))
|
||||
+ reciever->RemoveAurasDueToSpell(SPELL_TRAUMA_BASE_BODY);
|
||||
+ //4 - head
|
||||
+ else if (reciever->HasAuraType(SPELL_AURA_MOD_SPEED_SLOW_ALL))
|
||||
+ else if (reciever->HasAuraTypeWithFamilyFlags(SPELL_AURA_MOD_SPEED_SLOW_ALL, SPELLFAMILY_TRAUMA, SPELLFAMILY_FLAG0_TRAUMA))
|
||||
+ reciever->RemoveAurasDueToSpell(SPELL_TRAUMA_BASE_HEAD);
|
||||
+ //5 - innards
|
||||
+ else if (reciever->HasAuraType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
|
||||
+ else if (reciever->HasAuraTypeWithFamilyFlags(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELLFAMILY_TRAUMA, SPELLFAMILY_FLAG0_TRAUMA))
|
||||
+ reciever->RemoveAurasDueToSpell(SPELL_TRAUMA_BASE_INTERNAL);
|
||||
+ }
|
||||
+
|
||||
+ void OnDamageEx(Unit* attacker, Unit* victim, uint32& damage, bool crit, bool direct, uint32 /*schoolMask*/) override
|
||||
+ { /*may be NULL*/
|
||||
+ if (!_Tenabled)
|
||||
+ if (!_traumasEnabled)
|
||||
+ return;
|
||||
+
|
||||
+ if (!attacker || !damage || !victim->IsAlive() || damage >= victim->GetHealth())
|
||||
+ return;
|
||||
+
|
||||
+ if (direct ? !_TenableDirect : !_TenablePeriodic)
|
||||
+ if (direct ? !_traumasEnableDirect : !_traumasEnablePeriodic)
|
||||
+ return;
|
||||
+ if (_ThpPctThreshold && (victim->GetHealth() - damage) / victim->GetMaxHealth() > _ThpPctThreshold)
|
||||
+ if (_traumasHpPctThreshold && (victim->GetHealth() - damage) / victim->GetMaxHealth() > _traumasHpPctThreshold)
|
||||
+ return;
|
||||
+ if (_TtriggerHpPctThreshold > 0.0f && victim->GetMaxHealth() &&
|
||||
+ damage < CalculatePct(float(victim->GetMaxHealth()), _TtriggerHpPctThreshold))
|
||||
+ if (_traumasTriggerHpPctThreshold && victim->GetMaxHealth() &&
|
||||
+ damage < uint32(CalculatePct(float(victim->GetMaxHealth()), float(_traumasTriggerHpPctThreshold))))
|
||||
+ return;
|
||||
+ if (victim->IsControlledByPlayer())
|
||||
+ {
|
||||
+ if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
+ {
|
||||
+ if (!_TenablePlayers)
|
||||
+ if (!_traumasEnablePlayers)
|
||||
+ return;
|
||||
+ }
|
||||
+ else if (!_TenablePlayerControlled)
|
||||
+ else if (!_traumasEnablePlayerControlled)
|
||||
+ return;
|
||||
+ if (!_TenableInPVP && attacker && attacker->IsControlledByPlayer())
|
||||
+ if (!_traumasEnableInPVP && attacker && attacker->IsControlledByPlayer())
|
||||
+ return;
|
||||
+ }
|
||||
+ else// if (victim->GetTypeId() == TYPEID_UNIT)
|
||||
+ {
|
||||
+ if (!_TenableCreatures)
|
||||
+ if (!_traumasEnableCreatures)
|
||||
+ return;
|
||||
+
|
||||
+ uint32 rank = victim->ToCreature()->GetCreatureTemplate()->rank;
|
||||
+ if (!_TenableRankNormal && rank == CREATURE_ELITE_NORMAL)
|
||||
+ if (!_traumasEnableRankNormal && rank == CREATURE_ELITE_NORMAL)
|
||||
+ return;
|
||||
+ if (!_TenableRankElite && rank == CREATURE_ELITE_ELITE)
|
||||
+ if (!_traumasEnableRankElite && rank == CREATURE_ELITE_ELITE)
|
||||
+ return;
|
||||
+ if (!_TenableRankRare && rank == CREATURE_ELITE_RARE)
|
||||
+ if (!_traumasEnableRankRare && rank == CREATURE_ELITE_RARE)
|
||||
+ return;
|
||||
+ if (!_TenableRankRareElite && rank == CREATURE_ELITE_RAREELITE)
|
||||
+ if (!_traumasEnableRankRareElite && rank == CREATURE_ELITE_RAREELITE)
|
||||
+ return;
|
||||
+ if (!_TenableRankBoss && rank == CREATURE_ELITE_WORLDBOSS)
|
||||
+ if (!_traumasEnableRankBoss && rank == CREATURE_ELITE_WORLDBOSS)
|
||||
+ return;
|
||||
+ }
|
||||
+ if (_TCritsOnly && !crit)
|
||||
+ if (_traumasCritsOnly && !crit)
|
||||
+ return;
|
||||
+
|
||||
+ //chance is (2x hp pct damage dealt)
|
||||
+ float chance = (damage * 200.f) / victim->GetMaxHealth();
|
||||
+ chance *= victim->IsControlledByPlayer() ? _TchanceMultPlayer : _TchanceMultCreature;
|
||||
+ chance *= victim->IsControlledByPlayer() ? _traumasChanceMultPlayer : _traumasChanceMultCreature;
|
||||
+ if (crit)
|
||||
+ chance *= _TchanceMultCrit;
|
||||
+ chance *= _traumasChanceMultCrit;
|
||||
+
|
||||
+ uint32 defense = victim->GetDefenseSkillValue();
|
||||
+ if (defense > victim->GetMaxSkillValueForLevel())
|
||||
@@ -344,7 +364,7 @@ index 0000000..bf2761f
|
||||
+ if (!roll_chance_f(chance))
|
||||
+ return;
|
||||
+
|
||||
+ uint8 traumaType = _GetViableTraumaType(victim);
|
||||
+ uint8 traumaType = _GetViableTraumaType(victim->GetCreatureType());
|
||||
+ if (traumaType == TRAUMA_NONE)
|
||||
+ {
|
||||
+ //TC_LOG_ERROR("scripts", "No viable trauma type for cre type %u", victim->GetCreatureType());
|
||||
@@ -357,28 +377,40 @@ index 0000000..bf2761f
|
||||
+ args.SetOriginalCaster(attacker->GetGUID());
|
||||
+ victim->CastSpell(victim, traumaSpellId, args);
|
||||
+
|
||||
+ if (_TdurationOverride)
|
||||
+ if (_traumasDurationOverride)
|
||||
+ {
|
||||
+ if (Aura* trauma = victim->GetAura(traumaSpellId, attacker->GetGUID()))
|
||||
+ {
|
||||
+ trauma->SetDuration(int32(_TdurationOverride));
|
||||
+ trauma->SetMaxDuration(int32(_TdurationOverride));
|
||||
+ trauma->SetDuration(int32(_traumasDurationOverride));
|
||||
+ trauma->SetMaxDuration(int32(_traumasDurationOverride));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+private:
|
||||
+ uint8 _GetViableTraumaType(Unit const* unit) const
|
||||
+
|
||||
+ template<typename T = TraumaTypes, typename...Ts>
|
||||
+ inline static constexpr std::enable_if_t<std::disjunction_v<std::is_same<T,Ts>...>, std::array<T, sizeof...(Ts)>>
|
||||
+ make_arr(Ts... ts) noexcept { return { ts... }; }
|
||||
+
|
||||
+ static uint8 _GetViableTraumaType(uint32 creatureType)
|
||||
+ {
|
||||
+ std::vector<uint8> vt_types;
|
||||
+ TraumaTypes ts[MAX_TRAUMAS]{};
|
||||
+ size_t count = 0;
|
||||
+ for (auto const& p : TraumasMap[creatureType])
|
||||
+ if (p.second.viable)
|
||||
+ ts[count++] = p.second.t_type;
|
||||
+
|
||||
+ TraumaViabilityRange v_range = TraumasMap.equal_range(CreatureType(unit->GetCreatureType()));
|
||||
+ for (TraumaViabilityMap::const_iterator it = v_range.first; it != v_range.second; ++it)
|
||||
+ if (it->second.viable)
|
||||
+ vt_types.push_back(it->second.t_type);
|
||||
+
|
||||
+ if (!vt_types.empty())
|
||||
+ return vt_types.size() == 1 ? vt_types.front() : Trinity::Containers::SelectRandomContainerElement(vt_types);
|
||||
+ switch (count)
|
||||
+ {
|
||||
+ case 1: return ts[0];
|
||||
+ case 2: return Trinity::Containers::SelectRandomContainerElement(make_arr(ts[0], ts[1]));
|
||||
+ case 3: return Trinity::Containers::SelectRandomContainerElement(make_arr(ts[0], ts[1], ts[2]));
|
||||
+ case 4: return Trinity::Containers::SelectRandomContainerElement(make_arr(ts[0], ts[1], ts[2], ts[3]));
|
||||
+ case 5: return Trinity::Containers::SelectRandomContainerElement(make_arr(ts[0], ts[1], ts[2], ts[3], ts[4]));
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return uint8(TRAUMA_NONE);
|
||||
+ }
|
||||
@@ -390,10 +422,10 @@ index 0000000..bf2761f
|
||||
+ new script_traumas();
|
||||
+}
|
||||
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
|
||||
index 0a79664..e2fbc30 100644
|
||||
index 022bca30..017b8a70 100644
|
||||
--- a/src/server/worldserver/worldserver.conf.dist
|
||||
+++ b/src/server/worldserver/worldserver.conf.dist
|
||||
@@ -4089,3 +4089,129 @@ Metric.OverallStatusInterval = 1
|
||||
@@ -4117,3 +4117,129 @@ Metric.OverallStatusInterval = 1
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
REPLACE INTO `spell_proc`
|
||||
(`SpellId`,`Chance`,`Cooldown`)
|
||||
(`SpellId`,`SpellTypeMask`,`Chance`,`Cooldown`)
|
||||
VALUES
|
||||
('455001','20','4000'),
|
||||
('455002','20','4000'),
|
||||
('455003','33','1000'),
|
||||
('455004','20','4000'),
|
||||
('455005','50','250');
|
||||
('455001','1','20','4000'),
|
||||
('455002','1','20','4000'),
|
||||
('455003','1','33','1000'),
|
||||
('455004','1','20','4000'),
|
||||
('455005','1','50','250');
|
||||
|
||||
Reference in New Issue
Block a user