Conflicts:
	changelog.txt
This commit is contained in:
Uleat 2015-01-27 18:34:43 -05:00
commit dd9f419735
5 changed files with 91 additions and 81 deletions

View File

@ -1,6 +1,10 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 01/27/2015 == == 01/27/2015 ==
Trevius: Removed "Mercenary Debug:" from the Mercenary Log entries.
Trevius: Resolved duplicate "You have no Mercenaries" messages when zoning without owning a Mercenary.
Trevius: Mercenaries should now always be able to unsuspend if the timer is up.
Trevius: More work on Mercenaries and Grouping to reduce bugs and redundant queries.
Uleat: Finished ClientVersion update to include patch file and namespace updates - don't forget to copy the renamed 'patch_UF.conf' into your eqemu directory.) Uleat: Finished ClientVersion update to include patch file and namespace updates - don't forget to copy the renamed 'patch_UF.conf' into your eqemu directory.)
== 01/26/2015 == == 01/26/2015 ==

View File

@ -7275,7 +7275,7 @@ void Client::SendMercPersonalInfo()
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
{ {
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo canceled: (%i) (%i) (%i)", stancecount, mercCount, mercTypeCount); Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo canceled: (%i) (%i) (%i)", stancecount, mercCount, mercTypeCount);
SendMercMerchantResponsePacket(0); SendMercMerchantResponsePacket(0);
return; return;
} }
@ -7369,13 +7369,13 @@ void Client::SendMercPersonalInfo()
return; return;
} }
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo Send Successful"); Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Successful");
SendMercMerchantResponsePacket(0); SendMercMerchantResponsePacket(0);
} }
else else
{ {
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo Send Failed Due to no MercData for %i", GetMercInfo().MercTemplateID); Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Failed Due to no MercData for %i", GetMercInfo().MercTemplateID);
} }
} }

View File

@ -1169,7 +1169,6 @@ void Client::Handle_Connect_OP_SendExpZonein(const EQApplicationPacket *app)
//No idea why live sends this if even were not in a guild //No idea why live sends this if even were not in a guild
SendGuildMOTD(); SendGuildMOTD();
SpawnMercOnZone();
return; return;
} }
@ -1227,8 +1226,7 @@ void Client::Handle_Connect_OP_WearChange(const EQApplicationPacket *app)
void Client::Handle_Connect_OP_WorldObjectsSent(const EQApplicationPacket *app) void Client::Handle_Connect_OP_WorldObjectsSent(const EQApplicationPacket *app)
{ {
//This is a copy of SendExpZonein created for SoF due to packet order change //This is a copy of SendExpZonein created for SoF+ due to packet order change
//This does not affect clients other than SoF
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Spawn Appearance Packet // Spawn Appearance Packet
@ -1295,7 +1293,10 @@ void Client::Handle_Connect_OP_WorldObjectsSent(const EQApplicationPacket *app)
//No idea why live sends this if even were not in a guild //No idea why live sends this if even were not in a guild
SendGuildMOTD(); SendGuildMOTD();
if (RuleB(Mercs, AllowMercs))
{
SpawnMercOnZone(); SpawnMercOnZone();
}
return; return;
} }
@ -9314,7 +9315,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app)
uint32 merc_command = mc->MercCommand; // Seen 0 (zone in with no merc or suspended), 1 (dismiss merc), 5 (normal state), 20 (unknown), 36 (zone in with merc) uint32 merc_command = mc->MercCommand; // Seen 0 (zone in with no merc or suspended), 1 (dismiss merc), 5 (normal state), 20 (unknown), 36 (zone in with merc)
int32 option = mc->Option; // Seen -1 (zone in with no merc), 0 (setting to passive stance), 1 (normal or setting to balanced stance) int32 option = mc->Option; // Seen -1 (zone in with no merc), 0 (setting to passive stance), 1 (normal or setting to balanced stance)
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Command %i, Option %i received.", merc_command, option); Log.Out(Logs::General, Logs::Mercenaries, "Command %i, Option %i received.", merc_command, option);
if (!RuleB(Mercs, AllowMercs)) if (!RuleB(Mercs, AllowMercs))
return; return;
@ -9348,7 +9349,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app)
merc->SetStance(mercTemplate->Stances[option]); merc->SetStance(mercTemplate->Stances[option]);
GetMercInfo().Stance = mercTemplate->Stances[option]; GetMercInfo().Stance = mercTemplate->Stances[option];
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Set Stance: %u", merc->GetStance()); Log.Out(Logs::General, Logs::Mercenaries, "Set Stance: %u", merc->GetStance());
} }
} }
} }
@ -9371,7 +9372,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
uint32 merchant_id = mmsr->MercMerchantID; uint32 merchant_id = mmsr->MercMerchantID;
uint32 altCurrentType = 19; uint32 altCurrentType = 19;
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Data Request for Merchant ID (%i)", merchant_id); Log.Out(Logs::General, Logs::Mercenaries, "Data Request for Merchant ID (%i)", merchant_id);
//client is requesting data about currently owned mercenary //client is requesting data about currently owned mercenary
if (merchant_id == 0) { if (merchant_id == 0) {
@ -9379,12 +9380,12 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
//send info about your current merc(s) //send info about your current merc(s)
if (GetMercInfo().mercid) if (GetMercInfo().mercid)
{ {
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo Request"); Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Request");
SendMercPersonalInfo(); SendMercPersonalInfo();
} }
else else
{ {
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo Not Sent - MercID (%i)", GetMercInfo().mercid); Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Not Sent - MercID (%i)", GetMercInfo().mercid);
} }
} }
@ -9497,7 +9498,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app
return; return;
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Data Update Request Received."); Log.Out(Logs::General, Logs::Mercenaries, "Data Update Request Received.");
if (GetMercID()) if (GetMercID())
{ {
@ -9523,7 +9524,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app)
Command = VARSTRUCT_DECODE_TYPE(uint8, InBuffer); Command = VARSTRUCT_DECODE_TYPE(uint8, InBuffer);
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command); Log.Out(Logs::General, Logs::Mercenaries, "Dismiss Request ( %i ) Received.", Command);
// Handle the dismiss here... // Handle the dismiss here...
DismissMerc(GetMercInfo().mercid); DismissMerc(GetMercInfo().mercid);
@ -9548,7 +9549,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app)
uint32 merc_unk1 = mmrq->MercUnk01; uint32 merc_unk1 = mmrq->MercUnk01;
uint32 merc_unk2 = mmrq->MercUnk02; uint32 merc_unk2 = mmrq->MercUnk02;
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Template ID (%i), Merchant ID (%i), Unknown1 (%i), Unknown2 (%i)", merc_template_id, merchant_id, merc_unk1, merc_unk2); Log.Out(Logs::General, Logs::Mercenaries, "Template ID (%i), Merchant ID (%i), Unknown1 (%i), Unknown2 (%i)", merc_template_id, merchant_id, merc_unk1, merc_unk2);
//HirePending = true; //HirePending = true;
SetHoTT(0); SetHoTT(0);
@ -9614,7 +9615,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app)
SuspendMercenary_Struct* sm = (SuspendMercenary_Struct*)app->pBuffer; SuspendMercenary_Struct* sm = (SuspendMercenary_Struct*)app->pBuffer;
uint32 merc_suspend = sm->SuspendMerc; // Seen 30 for suspending or unsuspending uint32 merc_suspend = sm->SuspendMerc; // Seen 30 for suspending or unsuspending
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Suspend ( %i ) received.", merc_suspend); Log.Out(Logs::General, Logs::Mercenaries, "Suspend ( %i ) received.", merc_suspend);
if (!RuleB(Mercs, AllowMercs)) if (!RuleB(Mercs, AllowMercs))
return; return;
@ -9634,7 +9635,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app)
return; return;
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Timer Request received."); Log.Out(Logs::General, Logs::Mercenaries, "Timer Request received.");
if (!RuleB(Mercs, AllowMercs)) { if (!RuleB(Mercs, AllowMercs)) {
return; return;

View File

@ -4938,7 +4938,7 @@ bool Merc::Spawn(Client *owner) {
SendPosition(); SendPosition();
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Spawn."); Log.Out(Logs::General, Logs::Mercenaries, "Spawn Mercenary.");
//UpdateMercAppearance(); //UpdateMercAppearance();
@ -5084,7 +5084,7 @@ void Client::SendMercResponsePackets(uint32 ResponseType)
SendMercMerchantResponsePacket(3); SendMercMerchantResponsePacket(3);
break; break;
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercResponsePackets %i.", ResponseType); Log.Out(Logs::General, Logs::Mercenaries, "SendMercResponsePackets %i.", ResponseType);
} }
void Client::UpdateMercTimer() void Client::UpdateMercTimer()
@ -5125,7 +5125,7 @@ void Client::UpdateMercTimer()
SendMercResponsePackets(16); SendMercResponsePackets(16);
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: UpdateMercTimer Complete."); Log.Out(Logs::General, Logs::Mercenaries, "UpdateMercTimer Complete.");
// Normal upkeep charge message // Normal upkeep charge message
//Message(7, "You have been charged a mercenary upkeep cost of %i plat, and %i gold and your mercenary upkeep cost timer has been reset to 15 minutes.", upkeep_plat, upkeep_gold, (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60)); //Message(7, "You have been charged a mercenary upkeep cost of %i plat, and %i gold and your mercenary upkeep cost timer has been reset to 15 minutes.", upkeep_plat, upkeep_gold, (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60));
@ -5178,7 +5178,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) {
} }
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: CheckCanHireMerc True."); Log.Out(Logs::General, Logs::Mercenaries, "CheckCanHireMerc True.");
return true; return true;
} }
@ -5251,7 +5251,7 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) {
return false; return false;
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: CheckCanSpawnMerc True."); Log.Out(Logs::General, Logs::Mercenaries, "CheckCanSpawnMerc True.");
return true; return true;
} }
@ -5273,7 +5273,7 @@ bool Client::CheckCanUnsuspendMerc() {
return false; return false;
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: CheckCanUnsuspendMerc True."); Log.Out(Logs::General, Logs::Mercenaries, "CheckCanUnsuspendMerc True.");
return true; return true;
} }
@ -5288,7 +5288,7 @@ void Client::CheckMercSuspendTimer() {
GetMercInfo().SuspendedTime = 0; GetMercInfo().SuspendedTime = 0;
SendMercResponsePackets(0); SendMercResponsePackets(0);
SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime); SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: CheckMercSuspendTimer Ready."); Log.Out(Logs::General, Logs::Mercenaries, "CheckMercSuspendTimer Ready.");
} }
} }
} }
@ -5301,7 +5301,7 @@ void Client::SuspendMercCommand() {
{ {
if(!CheckCanUnsuspendMerc()) if(!CheckCanUnsuspendMerc())
{ {
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SuspendMercCommand Unable to Unsuspend."); Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Unable to Unsuspend.");
return; return;
} }
@ -5311,13 +5311,13 @@ void Client::SuspendMercCommand() {
if(merc) if(merc)
{ {
SpawnMerc(merc, true); SpawnMerc(merc, true);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SuspendMercCommand Successful Unsuspend."); Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Successful Unsuspend.");
} }
else else
{ {
//merc failed to spawn //merc failed to spawn
SendMercResponsePackets(3); SendMercResponsePackets(3);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SuspendMercCommand Failed to Spawn Merc."); Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Failed to Spawn Merc.");
} }
} }
else else
@ -5327,7 +5327,17 @@ void Client::SuspendMercCommand() {
if(CurrentMerc && GetMercID()) if(CurrentMerc && GetMercID())
{ {
CurrentMerc->Suspend(); CurrentMerc->Suspend();
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SuspendMercCommand Successful Suspend."); Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Successful Suspend.");
}
else
{
GetMercInfo().IsSuspended = true;
//GetMercInfo().SuspendedTime = time(nullptr) + RuleI(Mercs, SuspendIntervalS);
//GetMercInfo().MercTimerRemaining = GetMercTimer()->GetRemainingTime();
//GetMercInfo().Stance = GetStance();
GetMercTimer()->Disable();
SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime);
SendMercTimer(nullptr);
} }
} }
} }
@ -5362,7 +5372,7 @@ void Client::SpawnMercOnZone() {
{ {
SpawnMerc(merc, false); SpawnMerc(merc, false);
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SpawnMercOnZone Normal Merc."); Log.Out(Logs::General, Logs::Mercenaries, "SpawnMercOnZone Normal Merc.");
} }
else else
{ {
@ -5378,13 +5388,14 @@ void Client::SpawnMercOnZone() {
// Send Mercenary Status/Timer packet // Send Mercenary Status/Timer packet
SendMercTimer(GetMerc()); SendMercTimer(GetMerc());
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SpawnMercOnZone Suspended Merc."); Log.Out(Logs::General, Logs::Mercenaries, "SpawnMercOnZone Suspended Merc.");
} }
} }
else else
{ {
// No Merc Hired // No Merc Hired
SendClearMercInfo(); // RoF+ displays a message from the following packet, which seems useless
//SendClearMercInfo();
} }
} }
@ -5398,17 +5409,17 @@ void Client::SendMercTimer(Merc* merc) {
if (!merc) if (!merc)
{ {
SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercTimer No Merc."); Log.Out(Logs::General, Logs::Mercenaries, "SendMercTimer No Merc.");
} }
else if (merc->IsSuspended()) else if (merc->IsSuspended())
{ {
SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercTimer Suspended Merc."); Log.Out(Logs::General, Logs::Mercenaries, "SendMercTimer Suspended Merc.");
} }
else else
{ {
SendMercTimerPacket(merc->GetID(), MERC_STATE_NORMAL, NOT_SUSPENDED_TIME, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); SendMercTimerPacket(merc->GetID(), MERC_STATE_NORMAL, NOT_SUSPENDED_TIME, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercTimer Normal Merc."); Log.Out(Logs::General, Logs::Mercenaries, "SendMercTimer Normal Merc.");
} }
} }
@ -5430,7 +5441,7 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) {
merc->Unsuspend(setMaxStats); merc->Unsuspend(setMaxStats);
merc->SetStance(GetMercInfo().Stance); merc->SetStance(GetMercInfo().Stance);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SpawnMerc Success."); Log.Out(Logs::General, Logs::Mercenaries, "SpawnMerc Success.");
return; return;
@ -5459,7 +5470,7 @@ bool Merc::Suspend() {
// Start the timer to send the packet that refreshes the Unsuspend Button // Start the timer to send the packet that refreshes the Unsuspend Button
mercOwner->GetPTimers().Start(pTimerMercSuspend, RuleI(Mercs, SuspendIntervalS)); mercOwner->GetPTimers().Start(pTimerMercSuspend, RuleI(Mercs, SuspendIntervalS));
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Suspend Complete."); Log.Out(Logs::General, Logs::Mercenaries, "Suspend Complete.");
return true; return true;
} }
@ -5545,12 +5556,12 @@ bool Client::DismissMerc(uint32 MercID) {
bool Dismissed = true; bool Dismissed = true;
if (!database.DeleteMerc(MercID)) if (!database.DeleteMerc(MercID))
{ {
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Dismiss Failed for MercID %i", MercID); Log.Out(Logs::General, Logs::Mercenaries, "Dismiss Failed for MercID %i", MercID);
Dismissed = false; Dismissed = false;
} }
else else
{ {
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Dismiss Successful."); Log.Out(Logs::General, Logs::Mercenaries, "Dismiss Successful.");
} }
if (GetMerc()) if (GetMerc())
@ -5603,24 +5614,24 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) {
if(merc && group) if(merc && group)
{ {
uint32 groupID = group->GetID();
if(merc->HasGroup()) if(merc->HasGroup())
{ {
if(!group->IsLeader(merc)) if(!group->IsLeader(merc))
{ {
merc->SetFollowID(0); merc->SetFollowID(0);
if(group->DelMember(merc, true)) if (group->GroupCount() <= 2 && merc->GetGroup() == group && ZoneLoaded)
{
group->DisbandGroup();
}
else if(group->DelMember(merc, true))
{ {
if(merc->GetMercCharacterID() != 0) if(merc->GetMercCharacterID() != 0)
{ {
database.SetGroupID(merc->GetName(), 0, merc->GetMercCharacterID(), true); database.SetGroupID(merc->GetName(), 0, merc->GetMercCharacterID(), true);
} }
} }
if(group->GroupCount() <= 1 && ZoneLoaded)
{
group->DisbandGroup();
}
} }
else else
{ {
@ -5633,20 +5644,19 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) {
if(!group->members[i]->IsClient()) if(!group->members[i]->IsClient())
continue; continue;
group->members[i]->CastToClient()->LeaveGroup(); Client *groupMember = group->members[i]->CastToClient();
} groupMember->LeaveGroup();
for(int i = 0; i < MAX_GROUP_MEMBERS; i++) if (groupMember->GetMerc())
{ {
if(!group->members[i]) groupMember->GetMerc()->MercJoinClientGroup();
continue; }
if(!group->members[i]->IsMerc())
continue;
group->members[i]->CastToMerc()->MercJoinClientGroup();
} }
// Group should be removed by now, but just in case: // Group should be removed by now, but just in case:
group->DisbandGroup(); Group *oldGroup = entity_list.GetGroupByID(groupID);
if (oldGroup != nullptr)
{
oldGroup->DisbandGroup();
}
} }
Result = true; Result = true;
@ -5696,45 +5706,40 @@ bool Merc::MercJoinClientGroup() {
if(g->GetID() == 0) if(g->GetID() == 0)
{ {
delete g; delete g;
g = nullptr; g = nullptr;
return false; return false;
} }
if(AddMercToGroup(this, g)) if (AddMercToGroup(this, g))
{ {
entity_list.AddGroup(g, g->GetID());
database.SetGroupLeaderName(g->GetID(), mercOwner->GetName());
database.SetGroupID(mercOwner->GetName(), g->GetID(), mercOwner->CharacterID(), false); database.SetGroupID(mercOwner->GetName(), g->GetID(), mercOwner->CharacterID(), false);
database.SetGroupID(this->GetName(), g->GetID(), mercOwner->CharacterID(), true); database.SetGroupLeaderName(g->GetID(), mercOwner->GetName());
database.RefreshGroupFromDB(mercOwner); database.RefreshGroupFromDB(mercOwner);
g->SaveGroupLeaderAA(); g->SaveGroupLeaderAA();
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Mercenary joined new group."); Log.Out(Logs::General, Logs::Mercenaries, "Mercenary joined new group.");
} }
else else
{ {
g->DisbandGroup(); g->DisbandGroup();
Suspend(); Suspend();
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary disbanded new group.");
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Mercenary disbanded new group.");
} }
} }
else if (AddMercToGroup(this, mercOwner->GetGroup())) else if (AddMercToGroup(this, mercOwner->GetGroup()))
{ {
// Group already exists // Group already exists
database.SetGroupID(GetName(), mercOwner->GetGroup()->GetID(), mercOwner->CharacterID(), true);
database.RefreshGroupFromDB(mercOwner); database.RefreshGroupFromDB(mercOwner);
// Update members that are out of zone // Update members that are out of zone
GetGroup()->SendGroupJoinOOZ(this); GetGroup()->SendGroupJoinOOZ(this);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary joined existing group.");
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Mercenary joined existing group.");
} }
else else
{ {
Suspend(); Suspend();
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary failed to join the group - Suspending");
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Mercenary failed to join the group - Suspending");
} }
} }
@ -5785,7 +5790,7 @@ Merc* Client::GetMerc() {
if(GetMercID() == 0) if(GetMercID() == 0)
{ {
Log.Out(Logs::Detail, Logs::Mercenaries, "Mercenary Debug: GetMerc 0."); Log.Out(Logs::Detail, Logs::Mercenaries, "GetMerc 0.");
return (nullptr); return (nullptr);
} }
@ -5793,14 +5798,14 @@ Merc* Client::GetMerc() {
if(tmp == nullptr) if(tmp == nullptr)
{ {
SetMercID(0); SetMercID(0);
Log.Out(Logs::Detail, Logs::Mercenaries, "Mercenary Debug: GetMerc No Merc."); Log.Out(Logs::Detail, Logs::Mercenaries, "GetMerc No Merc.");
return (nullptr); return (nullptr);
} }
if(tmp->GetOwnerID() != GetID()) if(tmp->GetOwnerID() != GetID())
{ {
SetMercID(0); SetMercID(0);
Log.Out(Logs::Detail, Logs::Mercenaries, "Mercenary Debug: GetMerc Owner Mismatch."); Log.Out(Logs::Detail, Logs::Mercenaries, "GetMerc Owner Mismatch.");
return (nullptr); return (nullptr);
} }
@ -5818,7 +5823,7 @@ uint8 Client::GetNumMercs() {
numMercs++; numMercs++;
} }
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: GetNumMercs %i.", numMercs); Log.Out(Logs::General, Logs::Mercenaries, "GetNumMercs %i.", numMercs);
return numMercs; return numMercs;
} }
@ -5859,7 +5864,7 @@ void Client::SetMerc(Merc* newmerc) {
GetMercInfo().Gender = 0; GetMercInfo().Gender = 0;
GetMercInfo().State = 0; GetMercInfo().State = 0;
memset(GetMercInfo().merc_name, 0, 64); memset(GetMercInfo().merc_name, 0, 64);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SetMerc No Merc."); Log.Out(Logs::General, Logs::Mercenaries, "SetMerc No Merc.");
} }
else else
{ {
@ -5876,7 +5881,7 @@ void Client::SetMerc(Merc* newmerc) {
GetMercInfo().Gender = newmerc->GetGender(); GetMercInfo().Gender = newmerc->GetGender();
GetMercInfo().State = newmerc->IsSuspended() ? MERC_STATE_SUSPENDED : MERC_STATE_NORMAL; GetMercInfo().State = newmerc->IsSuspended() ? MERC_STATE_SUSPENDED : MERC_STATE_NORMAL;
snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName()); snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName());
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SetMerc New Merc."); Log.Out(Logs::General, Logs::Mercenaries, "SetMerc New Merc.");
} }
} }
@ -5896,7 +5901,7 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) {
MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer; MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer;
mmr->ResponseType = response_type; // send specified response type mmr->ResponseType = response_type; // send specified response type
FastQueuePacket(&outapp); FastQueuePacket(&outapp);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercMerchantResponsePacket %i.", response_type); Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercMerchantResponsePacket %i.", response_type);
} }
} }
@ -5905,7 +5910,7 @@ void Client::SendMercenaryUnknownPacket(uint8 type) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1); EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1);
outapp->WriteUInt8(type); outapp->WriteUInt8(type);
FastQueuePacket(&outapp); FastQueuePacket(&outapp);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercenaryUnknownPacket %i.", type); Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnknownPacket %i.", type);
} }
@ -5914,7 +5919,7 @@ void Client::SendMercenaryUnsuspendPacket(uint8 type) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1); EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1);
outapp->WriteUInt8(type); outapp->WriteUInt8(type);
FastQueuePacket(&outapp); FastQueuePacket(&outapp);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercenaryUnsuspendPacket %i.", type); Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnsuspendPacket %i.", type);
} }
@ -5924,7 +5929,7 @@ void Client::SendMercSuspendResponsePacket(uint32 suspended_time) {
SuspendMercenaryResponse_Struct* smr = (SuspendMercenaryResponse_Struct*)outapp->pBuffer; SuspendMercenaryResponse_Struct* smr = (SuspendMercenaryResponse_Struct*)outapp->pBuffer;
smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp
FastQueuePacket(&outapp); FastQueuePacket(&outapp);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercSuspendResponsePacket %i.", suspended_time); Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercSuspendResponsePacket %i.", suspended_time);
} }
@ -5939,7 +5944,7 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen
mss->UpdateInterval = update_interval; // Seen 900000 - 15 minutes in ms mss->UpdateInterval = update_interval; // Seen 900000 - 15 minutes in ms
mss->MercUnk01 = unk01; // Seen 180000 - 3 minutes in ms - Used for the unsuspend button refresh timer mss->MercUnk01 = unk01; // Seen 180000 - 3 minutes in ms - Used for the unsuspend button refresh timer
FastQueuePacket(&outapp); FastQueuePacket(&outapp);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercTimerPacket %i, %i, %i, %i, %i.", entity_id, merc_state, suspended_time, update_interval, unk01); Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercTimerPacket %i, %i, %i, %i, %i.", entity_id, merc_state, suspended_time, update_interval, unk01);
} }
@ -5950,7 +5955,7 @@ void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) {
mas->MercUnk01 = unk01; mas->MercUnk01 = unk01;
mas->MercUnk02 = unk02; mas->MercUnk02 = unk02;
FastQueuePacket(&outapp); FastQueuePacket(&outapp);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercAssignPacket %i, %i, %i.", entityID, unk01, unk02); Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercAssignPacket %i, %i, %i.", entityID, unk01, unk02);
} }
void NPC::LoadMercTypes() { void NPC::LoadMercTypes() {

View File

@ -656,7 +656,7 @@ void Zone::LoadMercSpells(){
merc_spells_list[classid].push_back(tempMercSpellEntry); merc_spells_list[classid].push_back(tempMercSpellEntry);
} }
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); Log.Out(Logs::General, Logs::Mercenaries, "Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size());
} }