[Feature] Update Raid Functions for Titanium and Underfoot (#3524)

* Update Raid Functions

Updated various raid features for:
Titanium
- Raid window now functional, including with BOTS
- Raid delegate assist/mark work
- Raid notes work
- Raid /rmark, /clearmarks work
Underfoot
- Raid window was already functional
- Raid delegate assist/mark work
- Raid notes work
- Raid /rmark, /clearmarks work

* Updates to resolve feedback

* Slight update for overlooked case in encode for RaidUpdate for clients above Ti.

* Updates to further address feedback.  Only updated translators for Ti/RoF2.  Once ok, I will update the others.

* Update linux-build.sh

* Final updates for other translators and the strncpy_s issue.

* Fix for strn0cpy in raids.cpp, translators, and defines.  Updated all in raids.cpp as well.

* Reveted defines change.

* Reverted accidental change

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Mitch Freeman
2023-10-13 23:42:27 -03:00
committed by GitHub
parent 166c87c931
commit f5e4c6a127
23 changed files with 1041 additions and 551 deletions
+31 -23
View File
@@ -20,6 +20,8 @@
#include "../common/events/player_event_logs.h"
#include "../common/repositories/raid_details_repository.h"
#include "../common/repositories/raid_members_repository.h"
#include "../common/raid.h"
#include "client.h"
#include "entity.h"
@@ -1547,21 +1549,22 @@ void Raid::SendRaidGroupRemove(const char *who, uint32 gid)
void Raid::SendRaidMOTD(Client *c)
{
if (!c || motd.empty()) {
if (!c || motd.empty() || c->IsBot()) {
return;
}
if (entity_list.GetBotByBotName(c->GetName())) {
return;
}
auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidMOTD_Struct));
auto data = (RaidMOTD_Struct*)outapp->pBuffer;
size_t size = motd.size() + 1;
auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidMOTD_Struct) + size);
auto rmotd = (RaidMOTD_Struct *)outapp->pBuffer;
rmotd->general.action = raidSetMotd;
strn0cpy(rmotd->general.player_name, c->GetName(), 64);
strn0cpy(rmotd->motd, motd.c_str(), size);
c->FastQueuePacket(&outapp);
data->general.action = raidSetMotd;
data->general.parameter = 0;
data->general.unknown1 = 0;
strn0cpy(data->general.leader_name, c->GetName(), sizeof(c->GetName()));
strn0cpy(data->general.player_name, GetLeaderName().c_str(), 64);
strn0cpy(data->motd, motd.c_str(), sizeof(data->motd));
c->QueuePacket(outapp);
safe_delete(outapp);
}
void Raid::SendRaidMOTD()
@@ -1587,11 +1590,10 @@ void Raid::SendRaidMOTDToWorld()
return;
}
size_t size = motd.size() + 1;
auto pack = new ServerPacket(ServerOP_RaidMOTD, sizeof(ServerRaidMOTD_Struct) + size);
auto pack = new ServerPacket(ServerOP_RaidMOTD, sizeof(ServerRaidMOTD_Struct));
auto smotd = (ServerRaidMOTD_Struct *)pack->pBuffer;
smotd->rid = GetID();
strn0cpy(smotd->motd, motd.c_str(), size);
strn0cpy(smotd->motd, motd.c_str(), sizeof(smotd->motd));
worldserver.SendPacket(pack);
safe_delete(pack);
}
@@ -1730,7 +1732,8 @@ bool Raid::LearnMembers()
members[i].member = nullptr;
strn0cpy(members[i].member_name, row[0], sizeof(members[i].member_name));
strn0cpy(members[i].note, row[10], sizeof(members[i].note));
// strn0cpy(members[i].note, row[10], sizeof(members[i].note));
members[i].note = std::string(row[10]);
uint32 group_id = Strings::ToUnsignedInt(row[1]);
if (group_id >= MAX_RAID_GROUPS) {
@@ -2275,7 +2278,7 @@ std::vector<RaidMember> Raid::GetMembersWithNotes()
{
std::vector<RaidMember> raid_members;
for (const auto& m : members) {
if (strlen(m.note) != 0) {
if (!m.note.empty()) {
raid_members.emplace_back(m);
}
}
@@ -2288,12 +2291,17 @@ void Raid::SendRaidNotes()
VerifyRaid();
for (const auto& c : GetMembersWithNotes()) {
auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct));
auto note = (RaidGeneral_Struct*)outapp->pBuffer;
note->action = raidSetNote;
strn0cpy(note->leader_name, c.member_name, 64);
strn0cpy(note->player_name, GetLeaderName().c_str(), 64);
strn0cpy(note->note, c.note, 64);
auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidNote_Struct));
auto data = (RaidNote_Struct*)outapp->pBuffer;
data->general.action = raidSetNote;
data->general.parameter = 0;
data->general.unknown1 = 0;
strn0cpy(data->general.leader_name, c.member_name, sizeof(c.member_name));
strn0cpy(data->general.player_name, GetLeaderName().c_str(), GetLeaderName().length());
strn0cpy(data->note, c.note.c_str(), sizeof(data->note));
QueuePacket(outapp);
safe_delete(outapp);
}
@@ -2552,7 +2560,7 @@ void Raid::UpdateXTargetType(XTargetType Type, Mob *m, const char *name)
}
if (name) {
strncpy(rm.member->XTargets[i].Name, name, 64);
strn0cpy(rm.member->XTargets[i].Name, name, 64);
}
rm.member->SendXTargetPacket(i, m);