From 9e255408ce20ff8e82700f11cf6c753161b86e3e Mon Sep 17 00:00:00 2001 From: Emagi Date: Tue, 29 Jul 2025 18:44:34 -0400 Subject: [PATCH] misc cleanup --- source/WorldServer/Broker/BrokerManager.cpp | 2 +- source/WorldServer/Items/Items.cpp | 5 ++++- source/WorldServer/Items/Items.h | 3 ++- source/WorldServer/LuaInterface.cpp | 1 + source/WorldServer/client.cpp | 2 +- source/WorldServer/zoneserver.cpp | 4 ++-- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/source/WorldServer/Broker/BrokerManager.cpp b/source/WorldServer/Broker/BrokerManager.cpp index 862f6c2..84a7e53 100644 --- a/source/WorldServer/Broker/BrokerManager.cpp +++ b/source/WorldServer/Broker/BrokerManager.cpp @@ -572,7 +572,7 @@ vector* BrokerManager::GetItems( "--GetItemsPass: %u (selling: %u), allowinv: %u", itm.unique_id, itm.for_sale, allowInv ); - ret->push_back(new Item(def, itm.unique_id, itm.creator, pit_player->second.seller_name, cid, itm.cost_copper, itm.count, pit_player->second.house_id)); + ret->push_back(new Item(def, itm.unique_id, itm.creator, pit_player->second.seller_name, cid, itm.cost_copper, itm.count, pit_player->second.house_id, itm.from_inventory)); } } return ret; diff --git a/source/WorldServer/Items/Items.cpp b/source/WorldServer/Items/Items.cpp index 6b6f5bc..98c4d36 100644 --- a/source/WorldServer/Items/Items.cpp +++ b/source/WorldServer/Items/Items.cpp @@ -912,6 +912,7 @@ Item::Item(){ seller_char_id = 0; seller_house_id = 0; is_search_store_item = false; + is_search_in_inventory = false; item_script = ""; broker_price = 0; sell_price = 0; @@ -948,6 +949,7 @@ Item::Item(Item* in_item){ seller_char_id = 0; seller_house_id = 0; is_search_store_item = false; + is_search_in_inventory = false; needs_deletion = false; broker_price = 0; sell_price = in_item->sell_price; @@ -971,7 +973,7 @@ Item::Item(Item* in_item){ details.item_locked = false; } -Item::Item(Item* in_item, int64 unique_id, std::string in_creator, std::string in_seller_name, int32 in_seller_char_id, int64 in_broker_price, int16 count, int64 in_seller_house_id){ +Item::Item(Item* in_item, int64 unique_id, std::string in_creator, std::string in_seller_name, int32 in_seller_char_id, int64 in_broker_price, int16 count, int64 in_seller_house_id, bool search_in_inventory){ is_search_store_item = true; broker_price = in_broker_price; needs_deletion = false; @@ -999,6 +1001,7 @@ Item::Item(Item* in_item, int64 unique_id, std::string in_creator, std::string i seller_house_id = in_seller_house_id; details.lock_flags = 0; details.item_locked = false; + is_search_in_inventory = search_in_inventory; } Item::~Item(){ diff --git a/source/WorldServer/Items/Items.h b/source/WorldServer/Items/Items.h index 6c200fd..ed64701 100644 --- a/source/WorldServer/Items/Items.h +++ b/source/WorldServer/Items/Items.h @@ -978,7 +978,7 @@ public: #pragma pack() Item(); Item(Item* in_item); - Item(Item* in_item, int64 unique_id, std::string in_creator, std::string in_seller_name, int32 in_seller_char_id, int64 in_broker_price, int16 count, int64 in_seller_house_id); + Item(Item* in_item, int64 unique_id, std::string in_creator, std::string in_seller_name, int32 in_seller_char_id, int64 in_broker_price, int16 count, int64 in_seller_house_id, bool search_in_inventory); ~Item(); string lowername; @@ -990,6 +990,7 @@ public: int32 max_sell_value; int64 broker_price; bool is_search_store_item; + bool is_search_in_inventory; bool save_needed; int8 weapon_type; string adornment; diff --git a/source/WorldServer/LuaInterface.cpp b/source/WorldServer/LuaInterface.cpp index 1f96097..2e09737 100644 --- a/source/WorldServer/LuaInterface.cpp +++ b/source/WorldServer/LuaInterface.cpp @@ -1022,6 +1022,7 @@ void LuaInterface::RemoveSpawnFromSpell(LuaSpell* spell, Spawn* spawn) { ((Entity*)spawn)->RemoveSpellBonus(spell); ((Entity*)spawn)->RemoveEffectsFromLuaSpell(spell); ((Entity*)spawn)->RemoveWard(spell); + ((Entity*)spawn)->RemoveMaintainedSpell(spell); if(spell->spell && spell->spell->GetSpellData() && spell->spell->GetSpellData()->det_type > 0 && (spell->spell->GetSpellDuration() > 0 || spell->spell->GetSpellData()->duration_until_cancel)) ((Entity*)spawn)->RemoveDetrimentalSpell(spell); diff --git a/source/WorldServer/client.cpp b/source/WorldServer/client.cpp index ba94b3e..26372cf 100644 --- a/source/WorldServer/client.cpp +++ b/source/WorldServer/client.cpp @@ -10620,7 +10620,7 @@ void Client::SearchStore(int32 page) { packet->setArrayDataByName("item_id2", item->details.unique_id, i); packet->setArrayDataByName("sell_price", item->broker_price, i); packet->setArrayDataByName("quantity", item->details.count, i); - if(item->seller_house_id) { + if(item->seller_house_id && !item->is_search_in_inventory) { HouseZone* hz = world.GetHouseZone(item->seller_house_id); if(hz && item->seller_name.size() > 0) { string name; diff --git a/source/WorldServer/zoneserver.cpp b/source/WorldServer/zoneserver.cpp index 8b87ea3..0077b09 100644 --- a/source/WorldServer/zoneserver.cpp +++ b/source/WorldServer/zoneserver.cpp @@ -1535,7 +1535,6 @@ void ZoneServer::DeleteSpawns(bool delete_all) { } MPendingSpawnRemoval.releasereadlock(__FUNCTION__, __LINE__); - MSpawnList.writelock(__FUNCTION__, __LINE__); lua_interface->SetLuaUserDataStale(spawn); if (spellProcess) { @@ -1553,6 +1552,7 @@ void ZoneServer::DeleteSpawns(bool delete_all) { tmpNPC->SetBrain(nullptr); } + MSpawnList.writelock(__FUNCTION__, __LINE__); std::map::iterator sitr = spawn_list.find(spawn->GetID()); if(sitr != spawn_list.end()) { spawn_list.erase(sitr); @@ -2010,7 +2010,7 @@ bool ZoneServer::SpawnProcess(){ // Delete unused spawns, do this last - if(!zoneShuttingDown) + if(!zoneShuttingDown && checkRemove) DeleteSpawns(false); // Nothing should come after this