mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 16:28:28 +00:00
[Bug Fix] Fix Item Discovery (#4663)
* [Bug Fix] Fix Item Discovery for Pickups, Evolving, Fishing, and Forage * Push * Caching * Update tradeskills.cpp * Update task_client_state.cpp
This commit is contained in:
+43
-8
@@ -4785,18 +4785,32 @@ bool Client::ChangePetName(std::string new_name)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Client::IsDiscovered(uint32 item_id) {
|
||||
const auto& l = DiscoveredItemsRepository::GetWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"item_id = {}",
|
||||
bool Client::IsDiscovered(uint32 item_id)
|
||||
{
|
||||
if (
|
||||
std::find(
|
||||
zone->discovered_items.begin(),
|
||||
zone->discovered_items.end(),
|
||||
item_id
|
||||
)
|
||||
);
|
||||
if (l.empty()) {
|
||||
) != zone->discovered_items.end()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
DiscoveredItemsRepository::GetWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"`item_id` = {} LIMIT 1",
|
||||
item_id
|
||||
)
|
||||
).empty()
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
zone->discovered_items.emplace_back(item_id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13562,3 +13576,24 @@ void Client::SendMerchantEnd()
|
||||
EQApplicationPacket empty(OP_ShopEndConfirm);
|
||||
QueuePacket(&empty);
|
||||
}
|
||||
|
||||
void Client::CheckItemDiscoverability(uint32 item_id)
|
||||
{
|
||||
if (!RuleB(Character, EnableDiscoveredItems) || IsDiscovered(item_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetGM()) {
|
||||
const std::string& item_link = database.CreateItemLink(item_id);
|
||||
Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Your GM flag prevents {} from being added to discovered items.",
|
||||
item_link
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
DiscoverItem(item_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user