From 428b73391c2100291937acb3e79b7bf87d218b72 Mon Sep 17 00:00:00 2001 From: Emagi Date: Sat, 23 Nov 2024 09:24:41 -0500 Subject: [PATCH] Omit bank/shared-bank from selling at a merchant, additionally prevent weight calculation for banked items on players weight --- source/WorldServer/Commands/Commands.cpp | 2 ++ source/WorldServer/Items/Items.cpp | 3 ++- source/WorldServer/LuaInterface.cpp | 14 ++++++++++---- source/WorldServer/client.cpp | 4 ++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/source/WorldServer/Commands/Commands.cpp b/source/WorldServer/Commands/Commands.cpp index caeb25a..308bc7e 100644 --- a/source/WorldServer/Commands/Commands.cpp +++ b/source/WorldServer/Commands/Commands.cpp @@ -7032,6 +7032,8 @@ void Commands::Command_Inventory(Client* client, Seperator* sep, EQ2_RemoteComma if(outapp) client->QueuePacket(outapp); } + + client->GetPlayer()->CalculateApplyWeight(); } else if(sep->arg[1][0] && strncasecmp("equip", sep->arg[0], 5) == 0 && sep->IsNumber(1)) { diff --git a/source/WorldServer/Items/Items.cpp b/source/WorldServer/Items/Items.cpp index b982b7d..47cd3a8 100644 --- a/source/WorldServer/Items/Items.cpp +++ b/source/WorldServer/Items/Items.cpp @@ -3422,7 +3422,8 @@ int32 PlayerItemList::GetWeight(){ for(int16 i = 0; i < indexed_items.size(); i++){ Item* item = indexed_items[i]; if (item) { - ret += item->generic_info.weight; + if(item->details.inv_slot_id != -3 && item->details.inv_slot_id != -4) + ret += item->generic_info.weight; } } MPlayerItems.releasereadlock(__FUNCTION__, __LINE__); diff --git a/source/WorldServer/LuaInterface.cpp b/source/WorldServer/LuaInterface.cpp index 5d840ce..a7634ee 100644 --- a/source/WorldServer/LuaInterface.cpp +++ b/source/WorldServer/LuaInterface.cpp @@ -1614,16 +1614,22 @@ void LuaInterface::DeletePendingSpells(bool all) { spell = *del_itr; if(!all) { - if (spell->caster && spell->caster->GetZone()) { - spell->caster->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell, true); + if (spell->caster) { + ZoneServer* curZone = spell->caster->GetZone(); + if(curZone) + curZone->GetSpellProcess()->DeleteActiveSpell(spell, true); } - else if(spell->targets.size() > 0 && spell->caster && spell->caster->GetZone()) { + if(spell->targets.size() > 0) { spell->MSpellTargets.readlock(__FUNCTION__, __LINE__); for (int8 i = 0; i < spell->targets.size(); i++) { Spawn* target = spell->caster->GetZone()->GetSpawnByID(spell->targets.at(i)); if (!target || !target->IsEntity()) continue; - target->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell, true); + ZoneServer* targetZone = target->GetZone(); + if(!targetZone) + continue; + + targetZone->GetSpellProcess()->DeleteActiveSpell(spell, true); } spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__); } diff --git a/source/WorldServer/client.cpp b/source/WorldServer/client.cpp index f381e25..3c33069 100644 --- a/source/WorldServer/client.cpp +++ b/source/WorldServer/client.cpp @@ -8842,6 +8842,10 @@ void Client::SendSellMerchantList(bool sell) { map::iterator test_itr; for (test_itr = items->begin(); test_itr != items->end(); test_itr++) { bool isbagwithitems = false; + + if(test_itr->second && (test_itr->second->details.inv_slot_id == -3 || test_itr->second->details.inv_slot_id == -4)) + continue; // omit bank/shared-bank + if (test_itr->second && test_itr->second->IsBag() && (test_itr->second->details.num_slots - test_itr->second->details.num_free_slots != test_itr->second->details.num_slots)) isbagwithitems = true;