Merge git://github.com/EQEmu/Server into Development

This commit is contained in:
KayenEQ 2014-11-20 05:05:29 -05:00
commit 96a0cc37e0
12 changed files with 253 additions and 63 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 11/19/2014 ==
Trevius: Mercenaries now Dismiss, Suspend, Unsuspend, and Die correctly.
== 11/18/2014 ==
Trevius: Mercenaries can now zone once again.

View File

@ -514,8 +514,8 @@ OP_LFGAppearance=0x0000
OP_LFGResponse=0x0000
# Raid Opcodes
OP_RaidInvite=0x1bd1
OP_RaidUpdate=0x548e
OP_RaidInvite=0x5fb2
OP_RaidUpdate=0x1bd1
OP_RaidJoin=0x0000
# Button-push commands

View File

@ -43,7 +43,8 @@ if($OS eq "Windows"){
@mysql = split(';', $has_mysql_path);
foreach my $v (@mysql){
if($v=~/MySQL|MariaDB/i){
$path = $v . "/mysql";
$v =~s/\n//g;
$path = trim($v) . "/mysql";
last;
}
}
@ -106,8 +107,6 @@ if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_world"){
exit;
}
if(!$bin_db_ver){ $bin_db_ver = 9100; }
print "Retrieving latest database manifest...\n";
GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt");
# GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt");
@ -129,6 +128,7 @@ sub ShowMenuPrompt {
1 => \&database_dump,
2 => \&database_dump_compress,
3 => \&Run_Database_Check,
4 => \&AA_Fetch,
0 => \&Exit,
);
@ -163,10 +163,10 @@ sub ShowMenuPrompt {
sub MenuOptions {
if(@total_updates){
$option[3] = "Run pending updates... (" . scalar (@total_updates) . ")";
$option[3] = "Run pending REQUIRED updates... (" . scalar (@total_updates) . ")";
}
else{
$option[3] = "Check for pending Database updates
$option[3] = "Check for pending REQUIRED Database updates
Stages updates for automatic upgrade...";
}
@ -177,6 +177,7 @@ Database Management Menu (Please Select):
2) Backup Database Compressed - (Saves to Backups folder)
Ideal to perform before performing updates
3) $option[3]
4) AAs - Get Latest AA's from PEQ (This deletes AA's already in the database)
0) Exit
EO_MENU
@ -269,6 +270,15 @@ sub trim {
return $string;
}
#::: Fetch Latest PEQ AA's
sub AA_Fetch{
print "Pulling down PEQ AA Tables...\n";
GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/peq_aa_tables.sql", "db_update/peq_aa_tables.sql");
print "\n\nInstalling AA Tables...\n";
print GetMySQLResultFromFile("db_update/peq_aa_tables.sql");
print "\nDone...\n\n";
}
#::: Responsible for Database Upgrade Routines
sub Run_Database_Check{
#::: Run 2 - Running pending updates...
@ -313,14 +323,14 @@ sub Run_Database_Check{
push(@total_updates, $i);
}
else{
print "DB up to date with: " . $i . " '" . $file_name . "' \n";
print "DB up to date with: " . $i . " - '" . $file_name . "' \n";
}
print_match_debug();
print_break();
}
if($match_type eq "missing"){
if(GetMySQLResult($query_check)=~/$match_text/i){
print "DB up to date with: " . $i . " '" . $file_name . "' \n";
print "DB up to date with: " . $i . " - '" . $file_name . "' \n";
next;
}
else{
@ -338,7 +348,7 @@ sub Run_Database_Check{
push(@total_updates, $i);
}
else{
print "DB up to date with: " . $i . " '" . $file_name . "' \n";
print "DB up to date with: " . $i . " - '" . $file_name . "' \n";
}
print_match_debug();
print_break();
@ -350,13 +360,19 @@ sub Run_Database_Check{
push(@total_updates, $i);
}
else{
print "DB up to date with: " . $i . " '" . $file_name . "' \n";
print "DB up to date with: " . $i . " - '" . $file_name . "' \n";
}
print_match_debug();
print_break();
}
}
print "\n\n";
print "\n";
if(scalar (@total_updates) == 0){
print "No updates need to be run...\n";
print "Setting Database to Binary Version (" . $bin_db_ver . ") if not already...\n\n";
GetMySQLResult("UPDATE db_version SET version = $bin_db_ver");
}
}
sub FetchMissingUpdate{

View File

@ -261,7 +261,7 @@
9001|2013_02_25_Impr_HT_LT.sql|SHOW TABLES LIKE 'merc_inventory'|empty|
9002|2013_03_1_Merc_Rules_and_Equipment.sql|SHOW TABLES LIKE 'merc_inventory'|empty|
# 9003|2013_03_23_Escape_FadingMemories.sql
9004|2013_04_04_NaturesBounty.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '1230' AND `slot` = '1' AND `effectid` = '313' AND `base1` = '15' AND `base2` = '0'|empty|
# 9004|2013_04_04_NaturesBounty.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '1230' AND `slot` = '1' AND `effectid` = '313' AND `base1` = '15' AND `base2` = '0'|empty|
9005|2013_04_08_Salvage.sql|SHOW COLUMNS FROM `tradeskill_recipe_entries` LIKE 'salvagecount'|empty|
9006|2013_05_05_Account_Flags.sql|SHOW TABLES LIKE 'account_flags'|empty|
9007|2013_05_05_Item_Tick.sql|SHOW TABLES LIKE 'item_tick'|empty|
@ -270,31 +270,31 @@
# 9010|2013_10_12_Merc_vwMercNpcTypes.sql
9011|2013_10_31_Recipe_disabling.sql|SHOW COLUMNS FROM `tradeskill_recipe` LIKE 'enabled'|empty|
9012|2013_11_07_BaseData.sql|SHOW TABLES LIKE 'base_data'|empty|
9013|2013_11_13_Instrument_Singing_Mastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '213' AND `slot` = '1' AND `effectid` = '260' AND `base1` = '2' AND `base2` = '23'|empty|
# 9013|2013_11_13_Instrument_Singing_Mastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '213' AND `slot` = '1' AND `effectid` = '260' AND `base1` = '2' AND `base2` = '23'|empty|
9014|2013_11_18_AssistRadius.sql|SHOW COLUMNS FROM `npc_types` LIKE 'assistradius'|empty|
9015|2013_12_26_MerchantList_Class_Required.sql|SHOW COLUMNS FROM `merchantlist` LIKE 'classes_required'|empty|
9016|2014_01_04_SongModCapAAs.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '571' AND `slot` = '1' AND `effectid` = '261'|empty|
# 9016|2014_01_04_SongModCapAAs.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '571' AND `slot` = '1' AND `effectid` = '261'|empty|
9017|2014_01_08_SpellsNewAdditions.sql|SHOW COLUMNS FROM `spells_new` LIKE 'persistdeath'|empty|
9018|2014_01_09_PreservePetSize.sql|SHOW COLUMNS FROM `character_pet_info` LIKE 'size'|empty|
9019|2014_01_20_MezMastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '781' AND `slot` = '1' AND `effectid` = '287'|empty|
# 9019|2014_01_20_MezMastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '781' AND `slot` = '1' AND `effectid` = '287'|empty|
9020|2014_01_20_Not_Extendable.sql|SHOW COLUMNS FROM `spells_new` LIKE 'not_extendable'|empty|
9021|2014_01_20_SpellCastingReinforcement.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '86' AND `slot` = '1' AND `effectid` = '128'|empty|
# 9021|2014_01_20_SpellCastingReinforcement.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '86' AND `slot` = '1' AND `effectid` = '128'|empty|
9022|2014_01_20_Weather.sql|SHOW COLUMNS FROM `zone` LIKE 'rain_chance1'|empty|
9023|2014_01_27_CritcalMendAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '230' AND `slot` = '1' AND `effectid` = '275'|empty
9024|2014_02_02_SpellCriticalsAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '4755' AND `slot` = '1' AND `effectid` = '294'|empty
# 9023|2014_01_27_CritcalMendAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '230' AND `slot` = '1' AND `effectid` = '275'|empty
# 9024|2014_02_02_SpellCriticalsAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '4755' AND `slot` = '1' AND `effectid` = '294'|empty
9025|2014_02_13_Rename_instance_lockout_tables.sql|SHOW TABLES LIKE 'instance_list'|empty|
9026|2014_02_13_spells_new_update.sql|SHOW COLUMNS FROM `spells_new` LIKE 'ConeStartAngle'|empty|
9027|2014_02_20_buff_update.sql|SHOW COLUMNS FROM `character_buffs` LIKE 'caston_y'|empty|
9028|2014_02_26_roambox_update.sql|SHOW COLUMNS FROM `spawngroup` LIKE 'mindelay'|empty|
9029|2014_02_26_virulentvenomAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '888' AND `slot` = '1' AND `effectid` = '250'|empty|
# 9029|2014_02_26_virulentvenomAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '888' AND `slot` = '1' AND `effectid` = '250'|empty|
9030|2014_04_04_PhysicalResist.sql|SHOW COLUMNS FROM `npc_types` LIKE 'PhR'|empty|
9031|2014_04_10_No_Target_With_Hotkey.sql|SHOW COLUMNS FROM `npc_types` LIKE 'no_target_hotkey'|empty|
9032|2014_04_12_SlowMitigation.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|contains|float
9034|2014_04_25_spawn_events.sql|SHOW COLUMNS FROM `spawn_events` LIKE 'strict'|empty|
9035|2014_04_27_AISpellEffects.sql|SHOW COLUMNS FROM `npc_types` LIKE 'npc_spells_effects_id'|empty|
9036|2014_05_04_SlowMitigationFix.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|contains|float
9038|2014_06_25_AA_Updates.sql|SELECT * FROM `altadv_vars` WHERE `skill_id` = '1604'|empty
9039|2014_07_04_AA_Updates.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '158' AND `slot` = '1' AND `effectid` = '238'|empty
# 9038|2014_06_25_AA_Updates.sql|SELECT * FROM `altadv_vars` WHERE `skill_id` = '1604'|empty
# 9039|2014_07_04_AA_Updates.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '158' AND `slot` = '1' AND `effectid` = '238'|empty
9040|2014_07_10_npc_spells.sql|SHOW COLUMNS FROM `npc_spells` LIKE 'engaged_no_sp_recast_min'|empty|
9041|2014_08_02_spells_new.sql|SHOW COLUMNS FROM `spells_new` LIKE 'viral_range'|empty|
9042|2014_08_12_NPC_raid_targets.sql|SHOW COLUMNS FROM `npc_types` LIKE 'raid_target'|empty|

File diff suppressed because one or more lines are too long

View File

@ -7315,6 +7315,8 @@ void Client::SendMercPersonalInfo()
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
{
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercPersonalInfo Cancelled: (%i) (%i) (%i)", stancecount, mercCount, mercTypeCount);
SendMercMerchantResponsePacket(0);
return;
}
@ -7408,6 +7410,13 @@ void Client::SendMercPersonalInfo()
return;
}
}
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercPersonalInfo Send Successful");
}
else
{
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercPersonalInfo Send Failed Due to no MercData for %i", GetMercInfo().MercTemplateID);
}
SendMercMerchantResponsePacket(0);
}

View File

@ -1098,12 +1098,13 @@ void SetConsumption(int32 in_hunger, int32 in_thirst);
void RemoveGroupXTargets();
void RemoveAutoXTargets();
void ShowXTargets(Client *c);
void InitializeMercInfo();
bool CheckCanSpawnMerc(uint32 template_id);
bool CheckCanHireMerc(Mob* merchant, uint32 template_id);
bool CheckCanRetainMerc(uint32 upkeep);
bool CheckCanUnsuspendMerc();
bool CheckCanDismissMerc();
bool DismissMerc(uint32 MercID);
inline uint32 GetMercID() const { return mercid; }
inline uint8 GetMercSlot() const { return mercSlot; }
void SetMercID( uint32 newmercid) { mercid = newmercid; }
@ -1130,6 +1131,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst);
void UpdateMercLevel();
void CheckMercSuspendTimer();
Timer* GetMercTimer() { return &merc_timer; };
const char* GetRacePlural(Client* client);
const char* GetClassPlural(Client* client);
void SendWebLink(const char* website);

View File

@ -9557,6 +9557,17 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
if (merchant_id == 0) {
//send info about your current merc(s)
if (GetMercInfo().mercid)
{
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercPersonalInfo Request");
SendMercPersonalInfo();
}
else
{
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercPersonalInfo Not Sent - MercID (%i)", GetMercInfo().mercid);
}
}
if (!RuleB(Mercs, AllowMercs)) {
@ -9699,12 +9710,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app)
Message(7, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command);
// Handle the dismiss here...
Merc* merc = GetMerc();
if (merc) {
if (CheckCanDismissMerc()) {
merc->Dismiss();
}
}
DismissMerc(GetMercInfo().mercid); // GetMercID()
}

View File

@ -2960,7 +2960,8 @@ bool EntityList::MakeTrackPacket(Client *client)
Group *g = client->GetGroup();
for (auto it = mob_list.cbegin(); it != mob_list.cend(); ++it) {
if (!it->second || it->second == client || !it->second->IsTrackable())
if (!it->second || it->second == client || !it->second->IsTrackable() ||
it->second->IsInvisible(client))
continue;
MobDistance = it->second->DistNoZ(*client);

View File

@ -5098,6 +5098,9 @@ bool Merc::Spawn(Client *owner) {
entity_list.AddMerc(this, true, true);
SendPosition();
if (MERC_DEBUG > 0)
owner->Message(7, "Mercenary Debug: Spawn.");
//UpdateMercAppearance();
@ -5244,6 +5247,8 @@ void Client::SendMercResponsePackets(uint32 ResponseType)
SendMercMerchantResponsePacket(3);
break;
}
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercResponsePackets %i.", ResponseType);
}
void Client::UpdateMercTimer()
@ -5283,6 +5288,9 @@ void Client::UpdateMercTimer()
{
SendMercResponsePackets(16);
}
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: UpdateMercTimer Complete.");
// 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));
@ -5334,6 +5342,9 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) {
return false;
}
}
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: CheckCanHireMerc True.");
return true;
}
@ -5398,6 +5409,9 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) {
SendMercResponsePackets(9);
return false;
}
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: CheckCanSpawnMerc True.");
return true;
}
@ -5418,17 +5432,9 @@ bool Client::CheckCanUnsuspendMerc() {
Message(0, "You must wait %i seconds before unsuspending your mercenary.", GetPTimers().GetRemainingTime(pTimerMercSuspend));
return false;
}
return true;
}
bool Client::CheckCanDismissMerc() {
if(!GetMercID())
{
Message(7, "You have no mercenary to dismiss.");
return false;
}
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: CheckCanUnsuspendMerc True.");
return true;
}
@ -5441,19 +5447,24 @@ void Client::CheckMercSuspendTimer() {
{
GetMercInfo().SuspendedTime = 0;
SendMercResponsePackets(0);
SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: CheckMercSuspendTimer Ready.");
}
}
}
void Client::SuspendMercCommand() {
bool ExistsMerc = GetMercInfo().MercTemplateID != 0;
if(ExistsMerc == true)
if(GetMercInfo().MercTemplateID != 0)
{
if(GetMercInfo().IsSuspended)
{
if(!CheckCanUnsuspendMerc())
{
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SuspendMercCommand Unable to Unsuspend.");
return;
}
@ -5462,11 +5473,15 @@ void Client::SuspendMercCommand() {
if(merc)
{
SpawnMerc(merc, true);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SuspendMercCommand Successful Unsuspend.");
}
else
{
//merc failed to spawn
SendMercResponsePackets(3);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SuspendMercCommand Failed to Spawn Merc.");
}
}
else
@ -5476,6 +5491,8 @@ void Client::SuspendMercCommand() {
if(CurrentMerc && GetMercID())
{
CurrentMerc->Suspend();
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SuspendMercCommand Successful Suspend.");
}
}
}
@ -5510,16 +5527,27 @@ void Client::SpawnMercOnZone() {
{
SpawnMerc(merc, false);
}
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SpawnMercOnZone Normal Merc.");
}
else
{
int32 TimeDiff = GetMercInfo().SuspendedTime + RuleI(Mercs, SuspendIntervalS) - time(nullptr);
if (TimeDiff > 0)
{
if (!GetPTimers().Enabled(pTimerMercSuspend))
{
// Start the timer to send the packet that refreshes the Unsuspend Button
GetPTimers().Start(pTimerMercSuspend, TimeDiff);
}
}
// Send Mercenary Status/Timer packet
SendMercTimer(GetMerc());
SendMercPersonalInfo();
//SendMercPersonalInfo();
CheckMercSuspendTimer();
SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SpawnMercOnZone Suspended Merc.");
}
}
}
@ -5528,21 +5556,28 @@ void Client::SendMercTimer(Merc* merc) {
if (GetMercInfo().mercid == 0)
{
//return;
return;
}
if (!merc)
{
SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercTimer No Merc.");
}
else if (merc->IsSuspended())
{
SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercTimer Suspended Merc.");
}
else
{
SendMercTimerPacket(merc->GetID(), MERC_STATE_NORMAL, NOT_SUSPENDED_TIME, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercTimer Normal Merc.");
}
}
void Client::SpawnMerc(Merc* merc, bool setMaxStats) {
@ -5559,7 +5594,10 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) {
merc->SetStance(GetMercInfo().Stance);
GetMercInfo().SuspendedTime = 0;
SendMercTimer(merc);
//SendMercTimer(merc);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SpawnMerc Success.");
return;
@ -5589,6 +5627,9 @@ bool Merc::Suspend() {
// Start the timer to send the packet that refreshes the Unsuspend Button
mercOwner->GetPTimers().Start(pTimerMercSuspend, RuleI(Mercs, SuspendIntervalS));
if (MERC_DEBUG > 0)
mercOwner->Message(7, "Mercenary Debug: Suspend Complete.");
return true;
}
@ -5622,7 +5663,7 @@ bool Merc::Unsuspend(bool setMaxStats) {
if(!mercOwner->GetPTimers().Expired(&database, pTimerMercSuspend, false))
mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend);
mercOwner->SendMercPersonalInfo();
//mercOwner->SendMercPersonalInfo();
Group* g = entity_list.GetGroupByClient(mercOwner);
//nobody from our group is here... start a new group
@ -5694,30 +5735,41 @@ bool Merc::Unsuspend(bool setMaxStats) {
if(cost > 0 && !mercOwner->HasMoney(cost))
{
mercOwner->SendMercResponsePackets(1);
Suspend();
return false;
}
}
Save();
}
}
return true;
}
bool Merc::Dismiss() {
bool Client::DismissMerc(uint32 MercID) {
Client* mercOwner = GetMercOwner();
database.DeleteMerc(GetMercID());
if(mercOwner)
bool Dismissed = true;
if (!database.DeleteMerc(MercID))
{
mercOwner->SendClearMercInfo();
mercOwner->SetMerc(0);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: Dismiss Failed for MercID %i", MercID);
Dismissed = false;
}
else
{
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: Dismiss Successful.");
}
Depop();
if (GetMerc())
{
GetMerc()->Depop();
}
return true;
SendClearMercInfo();
SetMerc(nullptr);
return Dismissed;
}
void Merc::Zone() {
@ -5842,6 +5894,8 @@ Merc* Client::GetMerc() {
if(GetMercID() == 0)
{
if (MERC_DEBUG > 0)
//Message(7, "Mercenary Debug: GetMerc 0.");
return (nullptr);
}
@ -5849,14 +5903,21 @@ Merc* Client::GetMerc() {
if(tmp == nullptr)
{
SetMercID(0);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: GetMerc No Merc.");
return (nullptr);
}
if(tmp->GetOwnerID() != GetID())
{
SetMercID(0);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: GetMerc Owner Mismatch.");
return (nullptr);
}
if (MERC_DEBUG > 0)
//Message(7, "Mercenary Debug: GetMerc Success.");
return (tmp);
}
@ -5872,6 +5933,8 @@ uint8 Client::GetNumMercs() {
numMercs++;
}
}
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: GetNumMercs %i.", numMercs);
return numMercs;
}
@ -5912,6 +5975,8 @@ void Client::SetMerc(Merc* newmerc) {
GetMercInfo().Gender = 0;
GetMercInfo().State = 0;
memset(GetMercInfo().merc_name, 0, 64);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SetMerc No Merc.");
}
else
{
@ -5928,6 +5993,8 @@ void Client::SetMerc(Merc* newmerc) {
GetMercInfo().Gender = newmerc->GetGender();
//GetMercInfo().State = newmerc->GetStance();
snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName());
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SetMerc New Merc.");
}
}
@ -5947,6 +6014,8 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) {
MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer;
mmr->ResponseType = response_type; // send specified response type
FastQueuePacket(&outapp);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: Sent SendMercMerchantResponsePacket %i.", response_type);
}
}
@ -5955,6 +6024,8 @@ void Client::SendMercenaryUnknownPacket(uint8 type) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1);
outapp->WriteUInt8(type);
FastQueuePacket(&outapp);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: Sent SendMercenaryUnknownPacket %i.", type);
}
@ -5963,6 +6034,8 @@ void Client::SendMercenaryUnsuspendPacket(uint8 type) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1);
outapp->WriteUInt8(type);
FastQueuePacket(&outapp);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: Sent SendMercenaryUnsuspendPacket %i.", type);
}
@ -5972,6 +6045,8 @@ void Client::SendMercSuspendResponsePacket(uint32 suspended_time) {
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
FastQueuePacket(&outapp);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: Sent SendMercSuspendResponsePacket %i.", suspended_time);
}
@ -5986,6 +6061,8 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen
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
FastQueuePacket(&outapp);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: Sent SendMercTimerPacket %i, %i, %i, %i, %i.", entity_id, merc_state, suspended_time, update_interval, unk01);
}
@ -5996,6 +6073,8 @@ void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) {
mas->MercUnk01 = unk01;
mas->MercUnk02 = unk02;
FastQueuePacket(&outapp);
if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: Sent SendMercAssignPacket %i, %i, %i.", entityID, unk01, unk02);
}
void NPC::LoadMercTypes() {

View File

@ -4,8 +4,8 @@
#include "zonedb.h"
#include "npc.h"
#define MAXMERCS 1
#define MERC_DEBUG 0
#define MAXMERCS 1
#define TANK 1
#define HEALER 2
#define MELEEDPS 9
@ -136,7 +136,6 @@ public:
void AddItem(uint8 slot, uint32 item_id);
static const char *GetRandomName();
bool Spawn(Client *owner);
bool Dismiss();
bool Suspend();
bool Unsuspend(bool setMaxStats);
void Zone();

View File

@ -1226,7 +1226,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
"WHERE tre.recipe_id IN (%s) "
"GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u "
"AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum);
auto results = QueryDatabase(query);
results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str());
LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str());