mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-28 03:29:00 +00:00
[Crash] Fix for crash in Raid::QueuePacket (#3145)
* [Crash] Fix for crash in Raid::QueuePacket * bots can't be a part of BalanceMana * corrected additions * adding additional is_bot gates * updating raid for loops to be range based. * typo * formatting * formatting
This commit is contained in:
+43
-4
@@ -611,9 +611,8 @@ void Raid::RaidGroupSay(const char *msg, Client *c, uint8 language, uint8 lang_s
|
||||
|
||||
uint32 Raid::GetPlayerIndex(const char *name)
|
||||
{
|
||||
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
|
||||
{
|
||||
if(strcmp(name, members[x].member_name) == 0) {
|
||||
for (int x = 0; x < MAX_RAID_MEMBERS; x++) {
|
||||
if (strcmp(name, members[x].member_name) == 0) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
@@ -832,6 +831,10 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int3
|
||||
manataken /= numMem;
|
||||
|
||||
for (const auto& m : members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.member && m.group_number == gid) {
|
||||
distance = DistanceSquared(caster->GetPosition(), m.member->GetPosition());
|
||||
|
||||
@@ -875,6 +878,10 @@ void Raid::SplitMoney(uint32 gid, uint32 copper, uint32 silver, uint32 gold, uin
|
||||
|
||||
uint8 member_count = 0;
|
||||
for (const auto& m : members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.member && m.group_number == gid && m.member->IsClient()) {
|
||||
member_count++;
|
||||
}
|
||||
@@ -914,6 +921,10 @@ void Raid::SplitMoney(uint32 gid, uint32 copper, uint32 silver, uint32 gold, uin
|
||||
auto platinum_split = platinum / member_count;
|
||||
|
||||
for (const auto& m : members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.member && m.group_number == gid && m.member->IsClient()) { // If Group Member is Client
|
||||
m.member->AddMoneyToPP(
|
||||
copper_split,
|
||||
@@ -952,6 +963,10 @@ void Raid::SplitMoney(uint32 gid, uint32 copper, uint32 silver, uint32 gold, uin
|
||||
void Raid::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float x, float y, float z, float heading, uint32 gid)
|
||||
{
|
||||
for (const auto& m : members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.member && m.group_number == gid && m.member->IsClient()) {
|
||||
m.member->MovePC(zoneID, instance_id, x, y, z, heading, 0, ZoneSolicited);
|
||||
}
|
||||
@@ -961,6 +976,10 @@ void Raid::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float x
|
||||
void Raid::TeleportRaid(Mob* sender, uint32 zoneID, uint16 instance_id, float x, float y, float z, float heading)
|
||||
{
|
||||
for (const auto& m : members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.member && m.member->IsClient()) {
|
||||
m.member->MovePC(zoneID, instance_id, x, y, z, heading, 0, ZoneSolicited);
|
||||
}
|
||||
@@ -981,6 +1000,10 @@ void Raid::AddRaidLooter(const char* looter)
|
||||
auto results = database.QueryDatabase(query);
|
||||
|
||||
for (auto& m : members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(looter, m.member_name) == 0) {
|
||||
m.is_looter = true;
|
||||
break;
|
||||
@@ -1002,6 +1025,10 @@ void Raid::RemoveRaidLooter(const char* looter)
|
||||
auto results = database.QueryDatabase(query);
|
||||
|
||||
for (auto& m: members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(looter, m.member_name) == 0) {
|
||||
m.is_looter = false;
|
||||
break;
|
||||
@@ -1258,6 +1285,10 @@ void Raid::SendBulkRaid(Client *to)
|
||||
void Raid::QueuePacket(const EQApplicationPacket *app, bool ack_req)
|
||||
{
|
||||
for (const auto& m : members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.member && m.member->IsClient()) {
|
||||
m.member->QueuePacket(app, ack_req);
|
||||
}
|
||||
@@ -1332,7 +1363,7 @@ void Raid::SendGroupUpdate(Client *to)
|
||||
gu->action = groupActUpdate;
|
||||
int i = 0;
|
||||
uint32 grp = GetGroup(to->GetName());
|
||||
if (grp >= MAX_RAID_MEMBERS) {
|
||||
if (grp >= MAX_RAID_GROUPS) {
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
@@ -1502,6 +1533,10 @@ void Raid::SendRaidMOTD()
|
||||
}
|
||||
|
||||
for (const auto& m: members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.member) {
|
||||
SendRaidMOTD(m.member);
|
||||
}
|
||||
@@ -1911,6 +1946,10 @@ const char *Raid::GetClientNameByIndex(uint8 index)
|
||||
void Raid::RaidMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2,const char* message3,const char* message4,const char* message5,const char* message6,const char* message7,const char* message8,const char* message9, uint32 distance)
|
||||
{
|
||||
for (const auto& m : members) {
|
||||
if (m.is_bot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.member && m.member->IsClient() && m.member != sender) {
|
||||
m.member->MessageString(type, string_id, message, message2, message3, message4, message5, message6,
|
||||
message7, message8, message9, distance);
|
||||
|
||||
Reference in New Issue
Block a user