updated gitignore to include modules
This commit is contained in:
21
modules/mod-leech/LICENSE
Normal file
21
modules/mod-leech/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 AzerothCore
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
2
modules/mod-leech/README.md
Normal file
2
modules/mod-leech/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# mod-leech
|
||||
An AzerothCore module that heals players when dealing damage.
|
||||
32
modules/mod-leech/conf/leech.conf.dist
Normal file
32
modules/mod-leech/conf/leech.conf.dist
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
#
|
||||
|
||||
[worldserver]
|
||||
|
||||
########################################
|
||||
# Leech Config
|
||||
########################################
|
||||
#
|
||||
# Leech.Enable
|
||||
# Description: Enable the module
|
||||
# Default: 0 - Disabled
|
||||
# 1 - Enabled
|
||||
#
|
||||
|
||||
Leech.Enable = 1
|
||||
#
|
||||
# Leech.DungeonsOnly
|
||||
# Description: Enable leeching only in content that would normally be group content (ie, dungeons and raids)
|
||||
# Default: 1 - Enabled
|
||||
# 0 - Disabled
|
||||
#
|
||||
|
||||
Leech.DungeonsOnly = 1
|
||||
#
|
||||
# Leech.Amount
|
||||
# Description: Amount of damage dealt that will be applied as a heal on the player. 0 is none, 0.5 is 50%, 1 is 100%, 2 is 200%, etc.
|
||||
# Default: 0.05 - 5%
|
||||
#
|
||||
|
||||
Leech.Amount = 0.05
|
||||
42
modules/mod-leech/src/Leech.cpp
Normal file
42
modules/mod-leech/src/Leech.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
#include "Leech.h"
|
||||
|
||||
class Leech_UnitScript : public UnitScript
|
||||
{
|
||||
public:
|
||||
Leech_UnitScript() : UnitScript("Leech_UnitScript") { }
|
||||
|
||||
void OnDamage(Unit* attacker, Unit* victim, uint32& damage) override
|
||||
{
|
||||
if (!sConfigMgr->GetOption<bool>("Leech.Enable", true) || !attacker)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool isPet = attacker->GetOwner() && attacker->GetOwner()->GetTypeId() == TYPEID_PLAYER;
|
||||
if (!isPet && attacker->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player* player = isPet ? attacker->GetOwner()->ToPlayer() : attacker->ToPlayer();
|
||||
|
||||
if (sConfigMgr->GetOption<bool>("Leech.DungeonsOnly", true) && !(player->GetMap()->IsDungeon()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto leechAmount = sConfigMgr->GetOption<float>("Leech.Amount", 0.05f);
|
||||
auto bp1 = static_cast<int32>(leechAmount * float(damage));
|
||||
player->CastCustomSpell(attacker, SPELL_HEAL, &bp1, nullptr, nullptr, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Add all scripts in one
|
||||
void AddSC_mod_leech()
|
||||
{
|
||||
new Leech_UnitScript();
|
||||
}
|
||||
15
modules/mod-leech/src/Leech.h
Normal file
15
modules/mod-leech/src/Leech.h
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
#ifndef AZEROTHCORE_LEECH_H
|
||||
#define AZEROTHCORE_LEECH_H
|
||||
#include "ScriptMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Config.h"
|
||||
#include <map>
|
||||
|
||||
enum LeechSpells
|
||||
{
|
||||
SPELL_HEAL = 18984
|
||||
};
|
||||
|
||||
|
||||
#endif //AZEROTHCORE_LEECH_H
|
||||
14
modules/mod-leech/src/Leech_loader.cpp
Normal file
14
modules/mod-leech/src/Leech_loader.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
// From SC
|
||||
void AddSC_mod_leech();
|
||||
|
||||
// Add all
|
||||
// cf. the naming convention https://github.com/azerothcore/azerothcore-wotlk/blob/master/doc/changelog/master.md#how-to-upgrade-4
|
||||
// additionally replace all '-' in the module folder name with '_' here
|
||||
void Addmod_leechScripts()
|
||||
{
|
||||
AddSC_mod_leech();
|
||||
}
|
||||
Reference in New Issue
Block a user