diff --git a/common/crash.cpp b/common/crash.cpp index 226f37bb4..33878bc77 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -243,13 +243,26 @@ void set_exception_handler() { #include #include -#ifdef __FreeBSD__ #include +#ifdef __FreeBSD__ #include #endif +static volatile sig_atomic_t crash_in_progress = 0; + void print_trace() { + // The dump below is not async-signal-safe (popen, malloc, logging). If the crash came from heap + // corruption inside malloc, it can deadlock on the allocator lock and the process never exits, holding + // its launcher slot. So: a second fault while dumping exits at once, and an alarm kills the process + // if the dump has not finished in time. + if (crash_in_progress) { + _exit(1); + } + crash_in_progress = 1; + signal(SIGALRM, SIG_DFL); + alarm(60); + bool does_gdb_exist = Strings::Contains(Process::execute("gdb -v"), "GNU"); if (!does_gdb_exist) { LogCrash( diff --git a/common/database/database_update.cpp b/common/database/database_update.cpp index a3d3c1f5a..e00ef9c3f 100644 --- a/common/database/database_update.cpp +++ b/common/database/database_update.cpp @@ -85,7 +85,7 @@ void DatabaseUpdate::CheckDbUpdates() } int custom_database_version = UpdateManifest(manifest_entries_custom, v.custom_database_version, b.custom_database_version); - if (custom_database_version > v.server_database_version) { + if (custom_database_version > v.custom_database_version) { LogInfo( "Updates ran successfully, setting database version to [{}] from [{}]", custom_database_version, diff --git a/common/item_instance.cpp b/common/item_instance.cpp index 39271ba8e..d2e666f23 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -313,9 +313,9 @@ int8 EQ::ItemInstance::AvailableAugmentSlot(int32 augment_type) const return INVALID_INDEX; } -bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augment_type, uint8 slot) const +bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augment_type, uint8 slot, bool allow_occupied) const { - if (!m_item || !m_item->IsClassCommon() || GetItem(slot)) { + if (!m_item || !m_item->IsClassCommon() || (!allow_occupied && GetItem(slot))) { return false; } diff --git a/common/item_instance.h b/common/item_instance.h index 96934e35c..067a55aa6 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -105,7 +105,7 @@ namespace EQ bool IsAugmentable() const; bool AvailableWearSlot(uint32 aug_wear_slots) const; int8 AvailableAugmentSlot(int32 augment_type) const; - bool IsAugmentSlotAvailable(int32 augment_type, uint8 slot) const; + bool IsAugmentSlotAvailable(int32 augment_type, uint8 slot, bool allow_occupied = false) const; inline int GetAugmentType() const { return m_item ? m_item->AugType : 0; } inline uint32 GetAugmentRestriction() const { return m_item ? m_item->AugRestrict : 0; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 783fc1c1b..5d52f7595 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3221,8 +3221,10 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) break; } + // a swap targets a filled slot; the old augment comes out below + const bool is_swap = in_augment->augment_action == AugmentActions::Swap; if ( - tobe_auged->IsAugmentSlotAvailable(new_aug->GetAugmentType(), static_cast(in_augment->augment_index)) && + tobe_auged->IsAugmentSlotAvailable(new_aug->GetAugmentType(), static_cast(in_augment->augment_index), is_swap) && tobe_auged->AvailableWearSlot(new_aug->GetItem()->Slots) ) { old_aug = tobe_auged->RemoveAugment(static_cast(in_augment->augment_index)); @@ -11861,6 +11863,9 @@ void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; Petition* pet = PetitionList::Instance()->GetPetitionByID(inpet->petnumber); + if (!pet) { + return; + } //if (inpet->urgency != pet->GetUrgency()) pet->SetUrgency(inpet->urgency); pet->SetLastGM(GetName()); diff --git a/zone/string_ids.h b/zone/string_ids.h index 540b745cb..33ef196d0 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -123,7 +123,7 @@ #define DISARMED_TRAP 305 //You have disarmed the trap. #define LDON_SENSE_TRAP1 306 //You do not Sense any traps. #define TRADESKILL_NOCOMBINE 334 //You cannot combine these items in this container type! -#define TRADESKILL_FAILED 336 //You lacked the skills to fashion the items together. // TODO: TOB - 336 You lacked the skills to fashion %1. +#define TRADESKILL_FAILED 336 //You lacked the skills to fashion the items together. (ToB: ...to fashion %1.) #define TRADESKILL_TRIVIAL 338 //You can no longer advance your skill from making this item. #define TRADESKILL_SUCCEED 339 //You have fashioned the items together to create something new! // TODO: TOB - 339 You have %2fashioned the items together to create something new: %1. #define EVADE_SUCCESS 343 //You have momentarily ducked away from the main combat. diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index a58f0575a..c69ebd782 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1199,7 +1199,12 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { if(over_trivial < 0) CheckIncreaseTradeskill(bonusstat, stat_modifier, skillup_modifier, success_modifier, spec->tradeskill); - MessageString(Chat::Emote,TRADESKILL_FAILED); + // ToB's text names the recipe (%1); the argument overload sends Emote as type 4, so older clients keep the plain one + if (ClientVersion() >= EQ::versions::ClientVersion::TOB) { + MessageString(Chat::Emote, TRADESKILL_FAILED, spec->name.c_str()); + } else { + MessageString(Chat::Emote, TRADESKILL_FAILED); + } LogTradeskills("Tradeskill failed"); if (GetGroup()) diff --git a/zone/tribute.cpp b/zone/tribute.cpp index da09bba5b..ea8bf9ca6 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -396,7 +396,7 @@ void Client::SendGuildTributes() gtas->ability.tiers[ti].tribute_item_id = htonl(t.second.tiers[ti].tribute_item_id); gtas->ability.tiers[ti].level = htonl(t.second.tiers[ti].level); } - strn0cpy(gtas->ability.name, t.second.name.data(), t.second.name.length()); + strn0cpy(gtas->ability.name, t.second.name.data(), len); FastQueuePacket(&outapp); } } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index a314936ca..87652631d 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -871,7 +871,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) ServerMultiLineMsg_Struct* mlm = (ServerMultiLineMsg_Struct*)pack->pBuffer; Client* client = entity_list.GetClientByName(mlm->to); if (client) { - auto outapp = new EQApplicationPacket(OP_MultiLineMsg, strlen(mlm->message)); + auto outapp = new EQApplicationPacket(OP_MultiLineMsg, strlen(mlm->message) + 1); strcpy((char*)outapp->pBuffer, mlm->message); client->QueuePacket(outapp); safe_delete(outapp);