Added component-based patch system (#5070)
Build / Linux (push) Has been cancelled
Build / Windows (push) Has been cancelled

This commit is contained in:
dannuic
2026-04-26 00:29:12 -06:00
committed by GitHub
parent 0ada77f340
commit 743fd45b17
30 changed files with 955 additions and 352 deletions
+19 -56
View File
@@ -82,6 +82,7 @@
#include "common/strings.h"
#include "zone/bot.h"
#include "zone/client.h"
#include "zone/client_version.h"
#include "zone/fastmath.h"
#include "zone/lua_parser.h"
#include "zone/mob_movement_manager.h"
@@ -95,7 +96,6 @@
#include <cassert>
#include "common/links.h"
#include "common/packet_dump.h"
extern Zone *zone;
extern volatile bool is_zone_loaded;
@@ -335,35 +335,21 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
Mob::SetMana(GetMana() - use_mana); // We send StopCasting which will update mana
StopCasting();
// TODO: can handle spell name overrides here
std::string spell_name(GetSpellName(spell_id));
std::string spell_link = Links::FormatSpellLink(spell_id, spell_name);
char spell_link[Links::MAX_LINK_SIZE];
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spell_id);
// pre-TOB clients will just discard the extra argument here, so don't worry about patching them out in patches
MessageString(Chat::SpellFailure, fizzle_msg, spell_link.c_str());
if (IsClient())
Message::MessageString(CastToClient(), Chat::SpellFailure, fizzle_msg, spell_link);
/**
* Song Failure message
* pre-TOB clients will just discard the extra argument here, so don't worry about patching them out in patches
*/
entity_list.FilteredMessageCloseString(
this,
true,
RuleI(Range, SpellMessages),
Chat::SpellFailure,
(IsClient() ? FilterPCSpells : FilterNPCSpells),
(fizzle_msg == MISS_NOTE ? MISSED_NOTE_OTHER : SPELL_FIZZLE_OTHER),
0,
/*
MessageFormat: A missed note brings %1's song to a close! (TOB: A missed note brings %1's %2 to a close!)
MessageFormat: %1's spell fizzles! (TOB: %1's %2 spell fizzles!)
*/
GetName(),
spell_link.c_str()
);
Message::CloseMessageString(this, true, RuleI(Range, SpellMessages),
nullptr, true, IsClient() ? FilterPCSpells : FilterNPCSpells)(
Chat::SpellFailure, fizzle_msg == MISS_NOTE ? MISSED_NOTE_OTHER : SPELL_FIZZLE_OTHER, GetName(), spell_link);
TryTriggerOnCastRequirement();
return(false);
return false;
}
SaveSpellLoc();
@@ -1254,7 +1240,6 @@ void Mob::InterruptSpell(uint16 spellid)
// color not used right now
void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid)
{
EQApplicationPacket *outapp = nullptr;
uint16 message_other;
bool bard_song_mode = false; //has the bard song gone to auto repeat mode
@@ -1312,24 +1297,13 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid)
if(!message)
message = IsBardSong(spellid) ? SONG_ENDS_ABRUPTLY : INTERRUPT_SPELL;
// TODO: can handle spell name overrides here
std::string spellname(GetSpellName(spellid));
std::string spelllink = Links::FormatSpellLink(spellid, spellname);
// clients need some packets
if (IsClient() && message != SONG_ENDS)
{
// the interrupt message
outapp = new EQApplicationPacket(OP_InterruptCast, sizeof(InterruptCast_Struct) + spelllink.size() + 1);
InterruptCast_Struct* ic = (InterruptCast_Struct*) outapp->pBuffer;
ic->messageid = message;
ic->spawnid = GetID();
// pre-TOB clients will just discard the extra argument here, so don't worry about patching them out in patches
fmt::format_to_n(ic->message, spelllink.size(), "{}", spelllink);
outapp->priority = 5;
CastToClient()->QueuePacket(outapp);
safe_delete(outapp);
char spell_link[Links::MAX_LINK_SIZE];
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spellid);
Message::InterruptSpell(CastToClient(), message, GetID(), spell_link);
SendSpellBarEnable(spellid);
}
@@ -1355,15 +1329,9 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid)
}
// this is the actual message, it works the same as a formatted message
outapp = new EQApplicationPacket(OP_InterruptCast, sizeof(InterruptCast_Struct) + strlen(GetCleanName()) + spelllink.size() + 2);
InterruptCast_Struct* ic = (InterruptCast_Struct*) outapp->pBuffer;
ic->messageid = message_other;
ic->spawnid = GetID();
// pre-TOB clients will just discard the extra argument here, so don't worry about patching them out in patches
fmt::format_to_n(ic->message, sizeof(GetCleanName()) + spelllink.size() + 1, "{}\x00{}", GetCleanName(), spelllink);
entity_list.QueueCloseClients(this, outapp, true, RuleI(Range, SongMessages), 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells);
safe_delete(outapp);
char spell_link[Links::MAX_LINK_SIZE];
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spellid);
Message::InterruptSpellOther(this, message_other, GetID(), GetCleanName(), spell_link);
}
// this is like interrupt, just it doesn't spam interrupt packets to everyone
@@ -7299,16 +7267,11 @@ void Mob::DoBardCastingFromItemClick(bool is_casting_bard_song, uint32 cast_time
Known bug: When a bard uses an augment with a clicky that has a cast time, the cast won't display. This issue only affects bards.
*/
if (is_casting_bard_song) {
//For spells with cast times. Cancel song cast, stop pusling and start item cast.
//For spells with cast times. Cancel song cast, stop pulsing and start item cast.
if (cast_time != 0) {
EQApplicationPacket *outapp = nullptr;
outapp = new EQApplicationPacket(OP_InterruptCast, sizeof(InterruptCast_Struct));
InterruptCast_Struct* ic = (InterruptCast_Struct*)outapp->pBuffer;
ic->messageid = SONG_ENDS;
ic->spawnid = GetID();
outapp->priority = 5;
CastToClient()->QueuePacket(outapp);
safe_delete(outapp);
char spell_link[Links::MAX_LINK_SIZE];
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spell_id);
Message::InterruptSpell(CastToClient(), SONG_ENDS, GetID(), spell_link);
ZeroCastingVars();
ZeroBardPulseVars();