feat. First version of the functional mod (#12)

* feat. First version of the functional mod

* Misc. Fixes

* Finish
This commit is contained in:
Walter Pagani
2023-06-24 11:43:47 -03:00
committed by GitHub
parent 4887f1db67
commit cb2324fecd
12 changed files with 68 additions and 48 deletions

13
.github/README.md vendored
View File

@@ -10,14 +10,19 @@
## Important notes
The module is currently not working. We are still working to finish it. We have made some progress, but it still needs to be functional. Do not use it, because it will give you failures. If you want to collaborate with it, you can open a pull request or an issue by completing the requested data.
There may still be some improvements to be made to the module, but you could say that it is pretty good. However, we are still going to continue working and trying to revise what is needed, as long as tests are performed and it can be determined that the reports are valid.
For the module to work, 4 things are needed.
- [x] Create the `CanSendErrorArleadyLooted` hook. (created)
- [x] Create the `CanSendErrorAlreadyLooted` hook. (created)
- [x] Create the hook `CanSendCreatureLoot` (created)
- [x] Create the hook `OnBeforeCreatureLootMoney` (created)
- [ ] The module works, if the player takes an object from the loot. If the player selects gold, it does not run. So we want to check that and also correct to be able to add up the total amount of gold obtained.
- [x] The module works, if the player takes an object from the loot. If the player selects gold, it does not run. So we want to check that and also correct to be able to add up the total amount of gold obtained.
- [x] If the creature can be skinned, the body remains for a while, and when it is skinned, it automatically disappears to avoid being skinned again.
This module requires the following pull request
https://github.com/azerothcore/azerothcore-wotlk/pull/16589
## Description
The objective of this module is to allow players to obtain all items from various npc's within a certain distance range. It is currently under development and is not finished yet. If you want to collaborate with it, you can do it by creating a pull request.
The objective of this module is to allow players to obtain all items from various npc's within a certain distance range.

13
.github/README_ES.md vendored
View File

@@ -10,14 +10,19 @@
## Notas importantes
El módulo no funciona actualmente. Seguimos trabajando para terminarlo. Hemos hecho algunos progresos, pero todavía tiene que ser funcional. No lo utilices, porque te dará fallos. Si quieres colaborar con él, puedes abrir un pull request o una issue completando los datos solicitados.
Puede que todavia, haya que hacerle alguna mejora al modulo, pero se podria decir que esta bastante bien. Sin embargo, aun se va a seguir trabajando y tratando de revisar lo que haga falta, en la medida, en la que se realicen pruebas y se pueda determinar, que los reportes son validos.
Para que el módulo funcione, se necesitan 4 cosas.
- [x] Crear el hook `CanSendErrorArleadyLooted`. (creado)
- [x] Crear el hook `CanSendErrorAlreadyLooted`. (creado)
- [x] Crear el hook `CanSendCreatureLoot` (creado)
- [x] Crear el hook `OnBeforeCreatureLootMoney` (creado)
- [ ] El módulo funciona, si el jugador toma un objeto del botín. Si el jugador selecciona oro, no funciona. Así que queremos comprobar que funcione y también poder sumar la cantidad total de oro obtenida.
- [x] El módulo funciona, si el jugador toma un objeto del botín. Si el jugador selecciona oro, no funciona. Así que queremos comprobar que funcione y también poder sumar la cantidad total de oro obtenida.
- [x] Si la criatura, puede ser desollada, el cuerpo, permanece por un tiempo, y cuando el mismo es desollado, automáticamente desaparece, para evitar ser desollado nuevamente.
Este módulo requiere el siguiente pull request
https://github.com/azerothcore/azerothcore-wotlk/pull/16589
## Descripción
El objetivo de este módulo es permitir a los jugadores obtener todos los objetos de varios npc's dentro de un cierto rango de distancia. Actualmente está en desarrollo y aún no está terminado. Si quieres colaborar con él, puedes hacerlo creando un pull request.
El objetivo de este módulo es permitir a los jugadores obtener todos los objetos de varios npc's dentro de un cierto rango de distancia.

View File

@@ -23,4 +23,4 @@
# 1 - (Enabled)
#
AOELoot.Enable = 0
AOELoot.Enable = 1

0
data/.gitkeep Normal file
View File

View File

View File

View File

View File

View File

View File

@@ -0,0 +1,5 @@
SET @ENTRY:=50000;
DELETE FROM `acore_string` WHERE `entry` IN (@ENTRY+0, @ENTRY+1);
INSERT INTO `acore_string` (`entry`, `content_default`, `locale_koKR`, `locale_frFR`, `locale_deDE`, `locale_zhCN`, `locale_zhTW`, `locale_esES`, `locale_esMX`, `locale_ruRU`) VALUES
(@ENTRY+0, 'This server is running the |cff4CFF00Loot aoe|r module.', '', '', '', '', '', 'Este servidor está ejecutando el módulo |cff4CFF00Loot aoe|r.', 'Este servidor está ejecutando el módulo |cff4CFF00Loot aoe|r.', ''),
(@ENTRY+1, '|cff4CFF00[Loot aoe]|r Your items has been mailed to you.', '', '', '', '', '', '|cff4CFF00[Loot aoe]|r Sus artículos le han sido enviados por correo.', '|cff4CFF00[Loot aoe]|r Sus artículos le han sido enviados por correo.', '');

View File

View File

@@ -22,6 +22,12 @@
#include "Player.h"
#include "ScriptedGossip.h"
enum AoeLootString
{
AOE_ACORE_STRING_MESSAGE = 50000,
AOE_ITEM_IN_THE_MAIL
};
class AoeLoot_Player : public PlayerScript
{
public:
@@ -29,23 +35,23 @@ public:
void OnLogin(Player* player) override
{
if (sConfigMgr->GetOption<bool>("AOELoot.Enable", false))
if (sConfigMgr->GetOption<bool>("AOELoot.Enable", true))
{
ChatHandler(player->GetSession()).PSendSysMessage("This server is running the |cff4CFF00Loot aoe |r module.");
ChatHandler(player->GetSession()).PSendSysMessage(AOE_ACORE_STRING_MESSAGE);
}
}
bool CanSendErrorArleadyLooted(Player* /*player*/) override
bool CanSendErrorAlreadyLooted(Player* /*player*/) override
{
return true;
}
bool CanSendCreatureLoot(Creature* creature, Player* player) override
void OnCreatureLootAOE(Player* player)
{
bool _Enable = sConfigMgr->GetOption<bool>("AOELoot.Enable", true);
bool _enable = sConfigMgr->GetOption<bool>("AOELoot.Enable", true);
if (player->GetGroup() || !creature || !_Enable)
return true;
if (player->GetGroup() || !_enable)
return;
float range = 30.0f;
uint32 gold = 0;
@@ -55,12 +61,11 @@ public:
for (auto const& _creature : creaturedie)
{
auto loot = &_creature->loot;
Loot* loot = &_creature->loot;
gold += loot->gold;
loot->gold = 0;
uint8 lootSlot = 0;
uint8 maxSlot = loot->GetMaxSlotInLootFor(player);
uint32 maxSlot = loot->GetMaxSlotInLootFor(player);
for (uint32 i = 0; i < maxSlot; ++i)
{
@@ -74,48 +79,48 @@ public:
else
{
player->SendItemRetrievalMail(item->itemid, item->count);
ChatHandler(player->GetSession()).SendSysMessage("Your items has been mailed to you.");
ChatHandler(player->GetSession()).SendSysMessage(AOE_ITEM_IN_THE_MAIL);
}
}
}
loot->clear();
if (!loot->empty())
{
if (!_creature->IsAlive())
{
_creature->AllLootRemovedFromCorpse();
_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
loot->clear();
if (loot->isLooted() && loot->empty())
if (_creature->HasUnitFlag(UNIT_FLAG_SKINNABLE))
{
_creature->RemoveUnitFlag(UNIT_FLAG_SKINNABLE);
}
}
}
else
{
_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
_creature->AllLootRemovedFromCorpse();
}
loot->gold = gold;
player->ModifyMoney(loot->gold);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, loot->gold);
}
return true;
player->ModifyMoney(gold);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, gold);
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1);
data << uint32(gold);
data << uint8(1);
player->GetSession()->SendPacket(&data);
}
void OnBeforeCreatureLootMoney(Player* player) override
void OnAfterCreatureLoot(Player* player) override
{
bool _Enable = sConfigMgr->GetOption<bool>("AOELoot.Enable", true);
OnCreatureLootAOE(player);
}
Creature* creature = nullptr;
if (player->GetGroup() || !creature || !_Enable)
return;
float range = 30.0f;
uint32 gold = 0;
Loot* loot = nullptr;
std::list<Creature*> creaturedie;
player->GetDeadCreatureListInGrid(creaturedie, range);
for (auto const& _creature : creaturedie)
{
loot = &_creature->loot;
gold += loot->gold;
loot->gold = 0;
}
loot->gold = gold;
void OnAfterCreatureLootMoney(Player* player) override
{
OnCreatureLootAOE(player);
}
};