фикс aoe loot
This commit is contained in:
+4
-4
@@ -86,10 +86,10 @@ AOELoot.Enable = 1
|
|||||||
#
|
#
|
||||||
# AOELoot.Range
|
# AOELoot.Range
|
||||||
# Description: Maximum distance (in yards) to collect loot from nearby corpses
|
# Description: Maximum distance (in yards) to collect loot from nearby corpses
|
||||||
# Default: 30.0
|
# Default: 55.0
|
||||||
# Range: 5.0 - 100.0
|
# Range: 5.0 - 100.0
|
||||||
|
|
||||||
AOELoot.Range = 30.0
|
AOELoot.Range = 55.0
|
||||||
|
|
||||||
#
|
#
|
||||||
# AOELoot.Group
|
# AOELoot.Group
|
||||||
@@ -160,7 +160,7 @@ The module can be controlled through configuration file settings (see Configurat
|
|||||||
| Option | Type | Default | Description |
|
| Option | Type | Default | Description |
|
||||||
|--------|------|---------|-------------|
|
|--------|------|---------|-------------|
|
||||||
| `AOELoot.Enable` | Boolean | 1 | Enable/disable module globally |
|
| `AOELoot.Enable` | Boolean | 1 | Enable/disable module globally |
|
||||||
| `AOELoot.Range` | Float | 30.0 | Maximum loot collection radius (5.0 - 100.0) |
|
| `AOELoot.Range` | Float | 55.0 | Maximum loot collection radius (5.0 - 100.0) |
|
||||||
| `AOELoot.Group` | Boolean | 1 | Allow AOE loot in groups |
|
| `AOELoot.Group` | Boolean | 1 | Allow AOE loot in groups |
|
||||||
| `AOELoot.Message` | Boolean | 1 | Show login message |
|
| `AOELoot.Message` | Boolean | 1 | Show login message |
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ The module uses `acore_string` entries 50000-50007:
|
|||||||
**Solutions:**
|
**Solutions:**
|
||||||
- Verify module is enabled: `AOELoot.Enable = 1`
|
- Verify module is enabled: `AOELoot.Enable = 1`
|
||||||
- Check if you disabled it personally: use `.aoeloot on`
|
- Check if you disabled it personally: use `.aoeloot on`
|
||||||
- Ensure you're within range (default 30 yards)
|
- Ensure you're within range (default 55 yards)
|
||||||
- If in group, check `AOELoot.Group` setting
|
- If in group, check `AOELoot.Group` setting
|
||||||
|
|
||||||
### Issue: Corpses not disappearing
|
### Issue: Corpses not disappearing
|
||||||
|
|||||||
+4
-4
@@ -86,10 +86,10 @@ AOELoot.Enable = 1
|
|||||||
#
|
#
|
||||||
# AOELoot.Range
|
# AOELoot.Range
|
||||||
# Descripción: Distancia máxima (en yardas) para recolectar botín de cadáveres cercanos
|
# Descripción: Distancia máxima (en yardas) para recolectar botín de cadáveres cercanos
|
||||||
# Por defecto: 30.0
|
# Por defecto: 55.0
|
||||||
# Rango: 5.0 - 100.0
|
# Rango: 5.0 - 100.0
|
||||||
|
|
||||||
AOELoot.Range = 30.0
|
AOELoot.Range = 55.0
|
||||||
|
|
||||||
#
|
#
|
||||||
# AOELoot.Group
|
# AOELoot.Group
|
||||||
@@ -160,7 +160,7 @@ El módulo puede controlarse a través de la configuración del archivo (ver sec
|
|||||||
| Opción | Tipo | Por Defecto | Descripción |
|
| Opción | Tipo | Por Defecto | Descripción |
|
||||||
|--------|------|-------------|-------------|
|
|--------|------|-------------|-------------|
|
||||||
| `AOELoot.Enable` | Booleano | 1 | Habilitar/deshabilitar módulo globalmente |
|
| `AOELoot.Enable` | Booleano | 1 | Habilitar/deshabilitar módulo globalmente |
|
||||||
| `AOELoot.Range` | Decimal | 30.0 | Radio máximo de recolección de botín (5.0 - 100.0) |
|
| `AOELoot.Range` | Decimal | 55.0 | Radio máximo de recolección de botín (5.0 - 100.0) |
|
||||||
| `AOELoot.Group` | Booleano | 1 | Permitir saqueo AOE en grupos |
|
| `AOELoot.Group` | Booleano | 1 | Permitir saqueo AOE en grupos |
|
||||||
| `AOELoot.Message` | Booleano | 1 | Mostrar mensaje de inicio de sesión |
|
| `AOELoot.Message` | Booleano | 1 | Mostrar mensaje de inicio de sesión |
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ El módulo utiliza las entradas `acore_string` 50000-50007:
|
|||||||
**Soluciones:**
|
**Soluciones:**
|
||||||
- Verifica que el módulo esté habilitado: `AOELoot.Enable = 1`
|
- Verifica que el módulo esté habilitado: `AOELoot.Enable = 1`
|
||||||
- Comprueba si lo desactivaste personalmente: usa `.aoeloot on`
|
- Comprueba si lo desactivaste personalmente: usa `.aoeloot on`
|
||||||
- Asegúrate de estar dentro del rango (30 yardas por defecto)
|
- Asegúrate de estar dentro del rango (55 yardas por defecto)
|
||||||
- Si estás en grupo, verifica la configuración `AOELoot.Group`
|
- Si estás en grupo, verifica la configuración `AOELoot.Group`
|
||||||
|
|
||||||
### Problema: Los cadáveres no desaparecen
|
### Problema: Los cadáveres no desaparecen
|
||||||
|
|||||||
@@ -19,17 +19,17 @@
|
|||||||
#
|
#
|
||||||
# AOELoot.Enable
|
# AOELoot.Enable
|
||||||
# Description: Enables Module
|
# Description: Enables Module
|
||||||
# Default: 0 - (Disabled)
|
# Default: 1 - (Enabled)
|
||||||
# 1 - (Enabled)
|
# 0 - (Disabled)
|
||||||
#
|
#
|
||||||
|
|
||||||
AOELoot.Enable = 1
|
AOELoot.Enable = 1
|
||||||
|
|
||||||
#
|
#
|
||||||
# AOELoot.Message
|
# AOELoot.Message
|
||||||
# Description: Enable message on login
|
# Description: Enables area loot if the player is in a group
|
||||||
# Default: 0 - (Disabled)
|
# Default: 1 - (Enabled)
|
||||||
# 1 - (Enabled)
|
# 0 - (Disabled)
|
||||||
#
|
#
|
||||||
|
|
||||||
AOELoot.Message = 1
|
AOELoot.Message = 1
|
||||||
@@ -38,6 +38,7 @@ AOELoot.Message = 1
|
|||||||
# AOELoot.Range
|
# AOELoot.Range
|
||||||
# Description: Maximum reach range search loot.
|
# Description: Maximum reach range search loot.
|
||||||
# Default: 55.0
|
# Default: 55.0
|
||||||
|
# Range: 5.0 - 100.0
|
||||||
#
|
#
|
||||||
|
|
||||||
AOELoot.Range = 55.0
|
AOELoot.Range = 55.0
|
||||||
@@ -45,9 +46,8 @@ AOELoot.Range = 55.0
|
|||||||
#
|
#
|
||||||
# AOELoot.Group
|
# AOELoot.Group
|
||||||
# Description: Enables area loot if the player is in a group
|
# Description: Enables area loot if the player is in a group
|
||||||
# Default: 1 (Enabled)
|
# Default: 1 - (Enabled)
|
||||||
# Possible values: 0 - (Disabled)
|
# 0 - (Disabled)
|
||||||
# 1 - (Enabled)
|
|
||||||
#
|
#
|
||||||
|
|
||||||
AOELoot.Group = 1
|
AOELoot.Group = 1
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "aoe_loot.h"
|
#include "aoe_loot.h"
|
||||||
|
#include "ObjectMgr.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ bool AOELootServer::CanPacketReceive(WorldSession* session, WorldPacket& packet)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Get configured loot range
|
// Get configured loot range
|
||||||
float range = sConfigMgr->GetOption<float>("AOELoot.Range", 30.0f);
|
float range = sConfigMgr->GetOption<float>("AOELoot.Range", 55.0f);
|
||||||
|
|
||||||
// Limit range to reasonable values
|
// Limit range to reasonable values
|
||||||
if (range < 5.0f)
|
if (range < 5.0f)
|
||||||
@@ -145,20 +146,69 @@ bool AOELootServer::CanPacketReceive(WorldSession* session, WorldPacket& packet)
|
|||||||
for (size_t i = 0; i < loot->items.size(); ++i)
|
for (size_t i = 0; i < loot->items.size(); ++i)
|
||||||
{
|
{
|
||||||
// Check if there's still space
|
// Check if there's still space
|
||||||
if ((mainLoot->items.size() + itemsToAdd.size() + mainLoot->quest_items.size() + questItemsToAdd.size()) >= 15)
|
if ((mainLoot->items.size() + itemsToAdd.size() + mainLoot->quest_items.size() + questItemsToAdd.size()) >= MAX_LOOT_ITEMS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
itemsToAdd.push_back(loot->items[i]);
|
itemsToAdd.push_back(loot->items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect quest items
|
// Collect quest items (only for active quests, limited to needed count)
|
||||||
for (size_t i = 0; i < loot->quest_items.size(); ++i)
|
for (size_t i = 0; i < loot->quest_items.size(); ++i)
|
||||||
{
|
{
|
||||||
// Check if there's still space
|
// Check if there's still space
|
||||||
if ((mainLoot->items.size() + itemsToAdd.size() + mainLoot->quest_items.size() + questItemsToAdd.size()) >= 15)
|
if ((mainLoot->items.size() + itemsToAdd.size() + mainLoot->quest_items.size() + questItemsToAdd.size()) >= MAX_LOOT_ITEMS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
questItemsToAdd.push_back(loot->quest_items[i]);
|
LootItem const& questItem = loot->quest_items[i];
|
||||||
|
|
||||||
|
// Skip items the player doesn't need for any active quest
|
||||||
|
if (!player->HasQuestForItem(questItem.itemid))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Calculate how many the player still needs across all active quests
|
||||||
|
uint32 maxNeeded = 0;
|
||||||
|
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
||||||
|
{
|
||||||
|
uint32 questId = player->GetQuestSlotQuestId(slot);
|
||||||
|
if (!questId)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||||
|
if (!quest)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
|
||||||
|
{
|
||||||
|
if (quest->RequiredItemId[j] == questItem.itemid && quest->RequiredItemCount[j] > maxNeeded)
|
||||||
|
maxNeeded = quest->RequiredItemCount[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxNeeded == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Count how many the player already has, plus pending adds
|
||||||
|
// and quest items already in the main loot window
|
||||||
|
uint32 ownedCount = player->GetItemCount(questItem.itemid, true);
|
||||||
|
for (auto const& pending : questItemsToAdd)
|
||||||
|
{
|
||||||
|
if (pending.itemid == questItem.itemid)
|
||||||
|
ownedCount += pending.count;
|
||||||
|
}
|
||||||
|
for (auto const& mainQuestItem : mainLoot->quest_items)
|
||||||
|
{
|
||||||
|
if (mainQuestItem.itemid == questItem.itemid)
|
||||||
|
ownedCount += mainQuestItem.count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ownedCount >= maxNeeded)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
uint32 stillNeeded = maxNeeded - ownedCount;
|
||||||
|
LootItem cappedItem = questItem;
|
||||||
|
cappedItem.count = std::min(static_cast<uint32>(questItem.count), stillNeeded);
|
||||||
|
|
||||||
|
questItemsToAdd.push_back(cappedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear source loot (but don't modify vector directly)
|
// Clear source loot (but don't modify vector directly)
|
||||||
@@ -176,13 +226,16 @@ bool AOELootServer::CanPacketReceive(WorldSession* session, WorldPacket& packet)
|
|||||||
// Add regular items
|
// Add regular items
|
||||||
for (const auto& item : itemsToAdd)
|
for (const auto& item : itemsToAdd)
|
||||||
{
|
{
|
||||||
if (mainLoot->items.size() < 15)
|
if (mainLoot->items.size() < MAX_LOOT_ITEMS)
|
||||||
mainLoot->items.push_back(item);
|
mainLoot->items.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add quest items to player inventory
|
// Add quest items directly to player inventory
|
||||||
for (const auto& item : questItemsToAdd)
|
for (const auto& item : questItemsToAdd)
|
||||||
{
|
{
|
||||||
|
if (!player->HasQuestForItem(item.itemid))
|
||||||
|
continue;
|
||||||
|
|
||||||
player->AddItem(item.itemid, item.count);
|
player->AddItem(item.itemid, item.count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user