mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
Add an easy way to pull item saylinks
This commit is contained in:
parent
94d87584aa
commit
0e31302a7d
@ -29,6 +29,7 @@
|
||||
#include "base_data.h"
|
||||
#include "fixed_memory_hash_set.h"
|
||||
#include "fixed_memory_variable_hash_set.h"
|
||||
#include "say_link.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
@ -189,6 +190,14 @@ public:
|
||||
void LoadBaseData(void *data, int max_level);
|
||||
const BaseDataStruct *GetBaseData(int lvl, int cl);
|
||||
|
||||
std::string CreateItemLink(uint32 item_id) {
|
||||
EQ::SayLinkEngine linker;
|
||||
linker.SetLinkType(EQ::saylink::SayLinkItemData);
|
||||
const EQ::ItemData *item = GetItem(item_id);
|
||||
linker.SetItemData(item);
|
||||
return linker.GenerateLink();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
std::unique_ptr<EQ::MemoryMappedFile> skill_caps_mmf;
|
||||
|
||||
@ -132,7 +132,8 @@ void ZoneDatabase::AddLootDropToNPC(NPC *npc, uint32 lootdrop_id, ItemList *item
|
||||
for (uint32 i = 0; i < loot_drop->NumEntries; ++i) {
|
||||
int charges = loot_drop->Entries[i].multiplier;
|
||||
for (int j = 0; j < charges; ++j) {
|
||||
if (zone->random.Real(0.0, 100.0) <= loot_drop->Entries[i].chance && npc->MeetsLevelRequirements(loot_drop->Entries[i])) {
|
||||
if (zone->random.Real(0.0, 100.0) <= loot_drop->Entries[i].chance &&
|
||||
npc->MeetsLootDropLevelRequirements(loot_drop->Entries[i])) {
|
||||
const EQ::ItemData *database_item = GetItem(loot_drop->Entries[i].item_id);
|
||||
npc->AddLootDrop(
|
||||
database_item,
|
||||
@ -176,7 +177,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC *npc, uint32 lootdrop_id, ItemList *item
|
||||
for (uint32 j = 0; j < loot_drop->NumEntries; ++j) {
|
||||
const EQ::ItemData *db_item = GetItem(loot_drop->Entries[j].item_id);
|
||||
if (db_item) {
|
||||
if (roll < loot_drop->Entries[j].chance && npc->MeetsLevelRequirements(loot_drop->Entries[j])) {
|
||||
if (roll < loot_drop->Entries[j].chance && npc->MeetsLootDropLevelRequirements(loot_drop->Entries[j])) {
|
||||
npc->AddLootDrop(
|
||||
db_item,
|
||||
item_list,
|
||||
@ -212,7 +213,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC *npc, uint32 lootdrop_id, ItemList *item
|
||||
for (uint32 j = 0; j < loot_drop->NumEntries; ++j) {
|
||||
const EQ::ItemData *db_item = GetItem(loot_drop->Entries[j].item_id);
|
||||
if (db_item) {
|
||||
if (roll < loot_drop->Entries[j].chance && npc->MeetsLevelRequirements(loot_drop->Entries[j])) {
|
||||
if (roll < loot_drop->Entries[j].chance && npc->MeetsLootDropLevelRequirements(loot_drop->Entries[j])) {
|
||||
npc->AddLootDrop(
|
||||
db_item,
|
||||
item_list,
|
||||
@ -249,13 +250,27 @@ void ZoneDatabase::AddLootDropToNPC(NPC *npc, uint32 lootdrop_id, ItemList *item
|
||||
// npc->SendAppearancePacket(AT_Light, npc->GetActiveLightValue());
|
||||
}
|
||||
|
||||
bool NPC::MeetsLevelRequirements(LootDropEntries_Struct loot_drop)
|
||||
bool NPC::MeetsLootDropLevelRequirements(LootDropEntries_Struct loot_drop)
|
||||
{
|
||||
if (loot_drop.npc_min_level > 0 && GetLevel() < loot_drop.npc_min_level) {
|
||||
LogLootDetail(
|
||||
"NPC [{}] does not meet loot_drop level requirements (min_level) level [{}] current [{}] for item [{}]",
|
||||
GetCleanName(),
|
||||
loot_drop.npc_min_level,
|
||||
GetLevel(),
|
||||
database.CreateItemLink(loot_drop.item_id)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (loot_drop.npc_max_level > 0 && GetLevel() > loot_drop.npc_max_level) {
|
||||
LogLootDetail(
|
||||
"NPC [{}] does not meet loot_drop level requirements (max_level) level [{}] current [{}] for item [{}]",
|
||||
GetCleanName(),
|
||||
loot_drop.npc_max_level,
|
||||
GetLevel(),
|
||||
database.CreateItemLink(loot_drop.item_id)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -306,7 +306,7 @@ public:
|
||||
uint32 aug6 = 0
|
||||
);
|
||||
|
||||
bool MeetsLevelRequirements(LootDropEntries_Struct loot_drop);
|
||||
bool MeetsLootDropLevelRequirements(LootDropEntries_Struct loot_drop);
|
||||
|
||||
virtual void DoClassAttacks(Mob *target);
|
||||
void CheckSignal();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user