mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 22:01:30 +00:00
Trevius: Mercenaries can now zone once again.
This commit is contained in:
parent
0b44f58518
commit
a6b9e6cb3c
@ -1,11 +1,14 @@
|
|||||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
== 11/16/2014 ==
|
== 11/18/2014 ==
|
||||||
demonstar55: Correct OP_AugmentInfo reply. This fixes RoF display issue with Adventurer's Stone
|
Trevius: Mercenaries can now zone once again.
|
||||||
Still issues with UF/SoF/SoD though.
|
|
||||||
|
== 11/17/2014 ==
|
||||||
|
demonstar55: Correct OP_AugmentInfo reply. This fixes RoF display issue with Adventurer's Stone. Still issues with UF/SoF/SoD though.
|
||||||
|
|
||||||
== 11/16/2014 ==
|
== 11/16/2014 ==
|
||||||
demonstar55: fix size issue with ControlBoat_Struct and exploit fix in OP_BoardBoat
|
demonstar55: fix size issue with ControlBoat_Struct and exploit fix in OP_BoardBoat
|
||||||
|
|
||||||
Akkadius: Implemented Automatic Database update and versioning system
|
Akkadius: Implemented Automatic Database update and versioning system
|
||||||
Akkadius: Created database revision define, this is located in version.h in common #define CURRENT_BINARY_DATABASE_VERSION 9057
|
Akkadius: Created database revision define, this is located in version.h in common #define CURRENT_BINARY_DATABASE_VERSION 9057
|
||||||
- This revision define will need to be incremented each time a database update is made
|
- This revision define will need to be incremented each time a database update is made
|
||||||
|
|||||||
@ -7297,26 +7297,24 @@ void Client::SendMercPersonalInfo()
|
|||||||
{
|
{
|
||||||
uint32 mercTypeCount = 1;
|
uint32 mercTypeCount = 1;
|
||||||
uint32 mercCount = 1; //TODO: Un-hardcode this and support multiple mercs like in later clients than SoD.
|
uint32 mercCount = 1; //TODO: Un-hardcode this and support multiple mercs like in later clients than SoD.
|
||||||
//uint32 packetSize = 0;
|
uint32 i = 0;
|
||||||
uint32 i=0;
|
|
||||||
uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs!
|
uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs!
|
||||||
|
|
||||||
if (GetClientVersion() >= EQClientRoF)
|
|
||||||
{
|
|
||||||
MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID];
|
MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID];
|
||||||
|
|
||||||
if (mercData)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
int stancecount = 0;
|
int stancecount = 0;
|
||||||
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)
|
||||||
{
|
{
|
||||||
SendMercMerchantResponsePacket(0);
|
SendMercMerchantResponsePacket(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mercCount > 0 && mercCount)
|
|
||||||
|
if(mercData)
|
||||||
|
{
|
||||||
|
if (GetClientVersion() >= EQClientRoF)
|
||||||
|
{
|
||||||
|
if (mercCount > 0)
|
||||||
{
|
{
|
||||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(MercenaryDataUpdate_Struct));
|
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(MercenaryDataUpdate_Struct));
|
||||||
MercenaryDataUpdate_Struct* mdus = (MercenaryDataUpdate_Struct*)outapp->pBuffer;
|
MercenaryDataUpdate_Struct* mdus = (MercenaryDataUpdate_Struct*)outapp->pBuffer;
|
||||||
@ -7354,40 +7352,19 @@ void Client::SendMercPersonalInfo()
|
|||||||
|
|
||||||
mdus->MercData[i].MercUnk05 = 1;
|
mdus->MercData[i].MercUnk05 = 1;
|
||||||
FastQueuePacket(&outapp);
|
FastQueuePacket(&outapp);
|
||||||
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int stancecount = 0;
|
if(mercTypeCount > 0 && mercCount > 0)
|
||||||
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
|
|
||||||
|
|
||||||
if(mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
|
|
||||||
{
|
{
|
||||||
if (GetClientVersion() == EQClientSoD)
|
|
||||||
{
|
|
||||||
SendMercMerchantResponsePacket(0);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct));
|
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct));
|
||||||
MercenaryMerchantList_Struct* mml = (MercenaryMerchantList_Struct*)outapp->pBuffer;
|
MercenaryMerchantList_Struct* mml = (MercenaryMerchantList_Struct*)outapp->pBuffer;
|
||||||
MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID];
|
mml->MercTypeCount = mercTypeCount; //We should only have one merc entry.
|
||||||
|
|
||||||
|
|
||||||
if(mercData)
|
|
||||||
{
|
|
||||||
if(mercTypeCount > 0)
|
|
||||||
{
|
|
||||||
mml->MercTypeCount = mercTypeCount; //We only should have one merc entry.
|
|
||||||
mml->MercGrades[i] = 1;
|
mml->MercGrades[i] = 1;
|
||||||
}
|
|
||||||
mml->MercCount = mercCount;
|
mml->MercCount = mercCount;
|
||||||
if(mercCount > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
mml->Mercs[i].MercID = mercData->MercTemplateID;
|
mml->Mercs[i].MercID = mercData->MercTemplateID;
|
||||||
mml->Mercs[i].MercType = mercData->MercType;
|
mml->Mercs[i].MercType = mercData->MercType;
|
||||||
mml->Mercs[i].MercSubType = mercData->MercSubType;
|
mml->Mercs[i].MercSubType = mercData->MercSubType;
|
||||||
@ -7404,7 +7381,7 @@ void Client::SendMercPersonalInfo()
|
|||||||
mml->Mercs[i].StanceCount = zone->merc_stance_list[mercData->MercTemplateID].size();
|
mml->Mercs[i].StanceCount = zone->merc_stance_list[mercData->MercTemplateID].size();
|
||||||
mml->Mercs[i].MercUnk03 = 0;
|
mml->Mercs[i].MercUnk03 = 0;
|
||||||
mml->Mercs[i].MercUnk04 = 1;
|
mml->Mercs[i].MercUnk04 = 1;
|
||||||
//mml->Mercs[i].MercName;
|
strn0cpy(mml->Mercs[i].MercName, GetMercInfo().merc_name , sizeof(mml->Mercs[i].MercName));
|
||||||
int stanceindex = 0;
|
int stanceindex = 0;
|
||||||
if(mml->Mercs[i].StanceCount != 0)
|
if(mml->Mercs[i].StanceCount != 0)
|
||||||
{
|
{
|
||||||
@ -7418,31 +7395,12 @@ void Client::SendMercPersonalInfo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FastQueuePacket(&outapp);
|
FastQueuePacket(&outapp);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
if (GetClientVersion() == EQClientSoD)
|
|
||||||
{
|
|
||||||
SendMercMerchantResponsePacket(0);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (GetClientVersion() == EQClientSoD)
|
|
||||||
{
|
|
||||||
SendMercMerchantResponsePacket(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
safe_delete(outapp);
|
|
||||||
if (GetClientVersion() == EQClientSoD)
|
|
||||||
{
|
|
||||||
SendMercMerchantResponsePacket(0);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
SendMercMerchantResponsePacket(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::SendClearMercInfo()
|
void Client::SendClearMercInfo()
|
||||||
|
|||||||
@ -829,11 +829,11 @@ public:
|
|||||||
|
|
||||||
bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;}
|
bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;}
|
||||||
bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;}
|
bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;}
|
||||||
int32 GetHunger() const { return m_pp.hunger_level; }
|
int32 GetHunger() const { return m_pp.hunger_level; }
|
||||||
int32 GetThirst() const { return m_pp.thirst_level; }
|
int32 GetThirst() const { return m_pp.thirst_level; }
|
||||||
void SetHunger(int32 in_hunger);
|
void SetHunger(int32 in_hunger);
|
||||||
void SetThirst(int32 in_thirst);
|
void SetThirst(int32 in_thirst);
|
||||||
void SetConsumption(int32 in_hunger, int32 in_thirst);
|
void SetConsumption(int32 in_hunger, int32 in_thirst);
|
||||||
|
|
||||||
bool CheckTradeLoreConflict(Client* other);
|
bool CheckTradeLoreConflict(Client* other);
|
||||||
void LinkDead();
|
void LinkDead();
|
||||||
@ -1129,6 +1129,7 @@ public:
|
|||||||
void RemoveAutoXTargets();
|
void RemoveAutoXTargets();
|
||||||
void ShowXTargets(Client *c);
|
void ShowXTargets(Client *c);
|
||||||
void InitializeMercInfo();
|
void InitializeMercInfo();
|
||||||
|
bool CheckCanSpawnMerc(uint32 template_id);
|
||||||
bool CheckCanHireMerc(Mob* merchant, uint32 template_id);
|
bool CheckCanHireMerc(Mob* merchant, uint32 template_id);
|
||||||
bool CheckCanRetainMerc(uint32 upkeep);
|
bool CheckCanRetainMerc(uint32 upkeep);
|
||||||
bool CheckCanUnsuspendMerc();
|
bool CheckCanUnsuspendMerc();
|
||||||
@ -1142,9 +1143,11 @@ public:
|
|||||||
MercInfo& GetMercInfo() { return m_mercinfo[mercSlot]; }
|
MercInfo& GetMercInfo() { return m_mercinfo[mercSlot]; }
|
||||||
uint8 GetNumMercs();
|
uint8 GetNumMercs();
|
||||||
void SetMerc(Merc* newmerc);
|
void SetMerc(Merc* newmerc);
|
||||||
|
void SendMercResponsePackets(uint32 ResponseType);
|
||||||
void SendMercMerchantResponsePacket(int32 response_type);
|
void SendMercMerchantResponsePacket(int32 response_type);
|
||||||
void SendMercenaryUnknownPacket(uint8 type);
|
void SendMercenaryUnknownPacket(uint8 type);
|
||||||
void SendMercenaryUnsuspendPacket(uint8 type);
|
void SendMercenaryUnsuspendPacket(uint8 type);
|
||||||
|
void SendMercTimer(Merc* merc = nullptr);
|
||||||
void SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspended_time, int32 update_interval = 900000, int32 unk01 = 180000);
|
void SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspended_time, int32 update_interval = 900000, int32 unk01 = 180000);
|
||||||
void SendMercSuspendResponsePacket(uint32 suspended_time);
|
void SendMercSuspendResponsePacket(uint32 suspended_time);
|
||||||
void SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02);
|
void SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02);
|
||||||
@ -1538,4 +1541,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -9699,17 +9699,13 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app)
|
|||||||
Message(7, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command);
|
Message(7, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command);
|
||||||
|
|
||||||
// Handle the dismiss here...
|
// Handle the dismiss here...
|
||||||
if (GetMercID()) {
|
|
||||||
Merc* merc = GetMerc();
|
Merc* merc = GetMerc();
|
||||||
|
|
||||||
if (merc) {
|
if (merc) {
|
||||||
if (CheckCanDismissMerc()) {
|
if (CheckCanDismissMerc()) {
|
||||||
merc->Dismiss();
|
merc->Dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//SendMercMerchantResponsePacket(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app)
|
void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app)
|
||||||
@ -9749,21 +9745,22 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RuleB(Mercs, ChargeMercPurchaseCost)) {
|
|
||||||
uint32 cost = Merc::CalcPurchaseCost(merc_template->MercTemplateID, GetLevel()) * 100; // Cost is in gold
|
|
||||||
TakeMoneyFromPP(cost, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set time remaining to max on Hire
|
// Set time remaining to max on Hire
|
||||||
GetMercInfo().MercTimerRemaining = RuleI(Mercs, UpkeepIntervalMS);
|
GetMercInfo().MercTimerRemaining = RuleI(Mercs, UpkeepIntervalMS);
|
||||||
|
|
||||||
// Get merc, assign it to client & spawn
|
// Get merc, assign it to client & spawn
|
||||||
Merc* merc = Merc::LoadMerc(this, merc_template, merchant_id, false);
|
Merc* merc = Merc::LoadMerc(this, merc_template, merchant_id, false);
|
||||||
|
|
||||||
if (merc) {
|
if (merc)
|
||||||
|
{
|
||||||
SpawnMerc(merc, true);
|
SpawnMerc(merc, true);
|
||||||
merc->Save();
|
merc->Save();
|
||||||
|
|
||||||
|
if (RuleB(Mercs, ChargeMercPurchaseCost)) {
|
||||||
|
uint32 cost = Merc::CalcPurchaseCost(merc_template->MercTemplateID, GetLevel()) * 100; // Cost is in gold
|
||||||
|
TakeMoneyFromPP(cost, true);
|
||||||
|
}
|
||||||
|
|
||||||
// 0 is approved hire request
|
// 0 is approved hire request
|
||||||
SendMercMerchantResponsePacket(0);
|
SendMercMerchantResponsePacket(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,8 @@ bool Client::Process() {
|
|||||||
if(Connected() || IsLD())
|
if(Connected() || IsLD())
|
||||||
{
|
{
|
||||||
// try to send all packets that weren't sent before
|
// try to send all packets that weren't sent before
|
||||||
if(!IsLD() && zoneinpacket_timer.Check()){
|
if(!IsLD() && zoneinpacket_timer.Check())
|
||||||
|
{
|
||||||
SendAllPackets();
|
SendAllPackets();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +146,9 @@ bool Client::Process() {
|
|||||||
|
|
||||||
if(mana_timer.Check())
|
if(mana_timer.Check())
|
||||||
SendManaUpdatePacket();
|
SendManaUpdatePacket();
|
||||||
if(dead && dead_timer.Check()) {
|
|
||||||
|
if(dead && dead_timer.Check())
|
||||||
|
{
|
||||||
database.MoveCharacterToZone(GetName(),database.GetZoneName(m_pp.binds[0].zoneId));
|
database.MoveCharacterToZone(GetName(),database.GetZoneName(m_pp.binds[0].zoneId));
|
||||||
m_pp.zone_id = m_pp.binds[0].zoneId;
|
m_pp.zone_id = m_pp.binds[0].zoneId;
|
||||||
m_pp.zoneInstance = 0;
|
m_pp.zoneInstance = 0;
|
||||||
@ -176,14 +179,16 @@ bool Client::Process() {
|
|||||||
if(TaskPeriodic_Timer.Check() && taskstate)
|
if(TaskPeriodic_Timer.Check() && taskstate)
|
||||||
taskstate->TaskPeriodicChecks(this);
|
taskstate->TaskPeriodicChecks(this);
|
||||||
|
|
||||||
if(linkdead_timer.Check()){
|
if(linkdead_timer.Check())
|
||||||
|
{
|
||||||
|
LeaveGroup();
|
||||||
Save();
|
Save();
|
||||||
if (GetMerc())
|
if (GetMerc())
|
||||||
{
|
{
|
||||||
GetMerc()->Save();
|
GetMerc()->Save();
|
||||||
GetMerc()->Depop();
|
GetMerc()->Depop();
|
||||||
}
|
}
|
||||||
LeaveGroup();
|
|
||||||
Raid *myraid = entity_list.GetRaidByClient(this);
|
Raid *myraid = entity_list.GetRaidByClient(this);
|
||||||
if (myraid)
|
if (myraid)
|
||||||
{
|
{
|
||||||
@ -192,7 +197,8 @@ bool Client::Process() {
|
|||||||
return false; //delete client
|
return false; //delete client
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camp_timer.Check()) {
|
if (camp_timer.Check())
|
||||||
|
{
|
||||||
LeaveGroup();
|
LeaveGroup();
|
||||||
Save();
|
Save();
|
||||||
if (GetMerc())
|
if (GetMerc())
|
||||||
@ -228,7 +234,7 @@ bool Client::Process() {
|
|||||||
} else {
|
} else {
|
||||||
if(!ApplyNextBardPulse(bardsong, song_target, bardsong_slot))
|
if(!ApplyNextBardPulse(bardsong, song_target, bardsong_slot))
|
||||||
InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong);
|
InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong);
|
||||||
// SpellFinished(bardsong, bardsong_target, bardsong_slot, spells[bardsong].mana);
|
//SpellFinished(bardsong, bardsong_target, bardsong_slot, spells[bardsong].mana);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +245,9 @@ bool Client::Process() {
|
|||||||
|
|
||||||
if(GetMercInfo().MercTemplateID != 0 && GetMercInfo().IsSuspended)
|
if(GetMercInfo().MercTemplateID != 0 && GetMercInfo().IsSuspended)
|
||||||
{
|
{
|
||||||
if(p_timers.Expired(&database, pTimerMercSuspend, false)) {
|
//CheckMercSuspendTimer();
|
||||||
|
if(p_timers.Expired(&database, pTimerMercSuspend, false))
|
||||||
|
{
|
||||||
CheckMercSuspendTimer();
|
CheckMercSuspendTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -715,16 +723,13 @@ bool Client::Process() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (client_state != CLIENT_LINKDEAD && (client_state == CLIENT_ERROR || client_state == DISCONNECTED || client_state == CLIENT_KICKED || !eqs->CheckState(ESTABLISHED))) {
|
if (client_state != CLIENT_LINKDEAD && (client_state == CLIENT_ERROR || client_state == DISCONNECTED || client_state == CLIENT_KICKED || !eqs->CheckState(ESTABLISHED)))
|
||||||
|
{
|
||||||
//client logged out or errored out
|
//client logged out or errored out
|
||||||
//ResetTrade();
|
//ResetTrade();
|
||||||
if (client_state != CLIENT_KICKED) {
|
if (client_state != CLIENT_KICKED) {
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
if (GetMerc())
|
|
||||||
{
|
|
||||||
GetMerc()->Depop();
|
|
||||||
}
|
|
||||||
|
|
||||||
client_state = CLIENT_LINKDEAD;
|
client_state = CLIENT_LINKDEAD;
|
||||||
if (zoning || instalog || GetGM())
|
if (zoning || instalog || GetGM())
|
||||||
@ -732,23 +737,32 @@ bool Client::Process() {
|
|||||||
Group *mygroup = GetGroup();
|
Group *mygroup = GetGroup();
|
||||||
if (mygroup)
|
if (mygroup)
|
||||||
{
|
{
|
||||||
if (!zoning) {
|
if (!zoning)
|
||||||
|
{
|
||||||
entity_list.MessageGroup(this, true, 15, "%s logged out.", GetName());
|
entity_list.MessageGroup(this, true, 15, "%s logged out.", GetName());
|
||||||
mygroup->DelMember(this);
|
LeaveGroup();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
entity_list.MessageGroup(this, true, 15, "%s left the zone.", GetName());
|
entity_list.MessageGroup(this, true, 15, "%s left the zone.", GetName());
|
||||||
mygroup->MemberZoned(this);
|
mygroup->MemberZoned(this);
|
||||||
|
if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == mygroup)
|
||||||
|
{
|
||||||
|
mygroup->DelMember(GetMerc());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Raid *myraid = entity_list.GetRaidByClient(this);
|
Raid *myraid = entity_list.GetRaidByClient(this);
|
||||||
if (myraid)
|
if (myraid)
|
||||||
{
|
{
|
||||||
if (!zoning) {
|
if (!zoning)
|
||||||
|
{
|
||||||
//entity_list.MessageGroup(this,true,15,"%s logged out.",GetName());
|
//entity_list.MessageGroup(this,true,15,"%s logged out.",GetName());
|
||||||
//mygroup->DelMember(this);
|
|
||||||
myraid->MemberZoned(this);
|
myraid->MemberZoned(this);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//entity_list.MessageGroup(this,true,15,"%s left the zone.",GetName());
|
//entity_list.MessageGroup(this,true,15,"%s left the zone.",GetName());
|
||||||
myraid->MemberZoned(this);
|
myraid->MemberZoned(this);
|
||||||
}
|
}
|
||||||
@ -774,8 +788,14 @@ bool Client::Process() {
|
|||||||
|
|
||||||
/* Just a set of actions preformed all over in Client::Process */
|
/* Just a set of actions preformed all over in Client::Process */
|
||||||
void Client::OnDisconnect(bool hard_disconnect) {
|
void Client::OnDisconnect(bool hard_disconnect) {
|
||||||
if(hard_disconnect) {
|
if(hard_disconnect)
|
||||||
|
{
|
||||||
LeaveGroup();
|
LeaveGroup();
|
||||||
|
if (GetMerc())
|
||||||
|
{
|
||||||
|
GetMerc()->Save();
|
||||||
|
GetMerc()->Depop();
|
||||||
|
}
|
||||||
Raid *MyRaid = entity_list.GetRaidByClient(this);
|
Raid *MyRaid = entity_list.GetRaidByClient(this);
|
||||||
|
|
||||||
if (MyRaid)
|
if (MyRaid)
|
||||||
@ -791,7 +811,8 @@ void Client::OnDisconnect(bool hard_disconnect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mob *Other = trade->With();
|
Mob *Other = trade->With();
|
||||||
if(Other) {
|
if(Other)
|
||||||
|
{
|
||||||
mlog(TRADING__CLIENT, "Client disconnected during a trade. Returning their items.");
|
mlog(TRADING__CLIENT, "Client disconnected during a trade. Returning their items.");
|
||||||
FinishTrade(this);
|
FinishTrade(this);
|
||||||
|
|
||||||
|
|||||||
@ -1069,14 +1069,29 @@ void Group::GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, co
|
|||||||
void Client::LeaveGroup() {
|
void Client::LeaveGroup() {
|
||||||
Group *g = GetGroup();
|
Group *g = GetGroup();
|
||||||
|
|
||||||
if(g) {
|
if(g)
|
||||||
|
{
|
||||||
if(g->GroupCount() < 3)
|
if(g->GroupCount() < 3)
|
||||||
|
{
|
||||||
g->DisbandGroup();
|
g->DisbandGroup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
g->DelMember(this);
|
g->DelMember(this);
|
||||||
} else {
|
if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == g)
|
||||||
|
{
|
||||||
|
g->DelMember(GetMerc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//force things a little
|
//force things a little
|
||||||
database.SetGroupID(GetName(), 0, CharacterID());
|
database.SetGroupID(GetName(), 0, CharacterID());
|
||||||
|
if (GetMerc())
|
||||||
|
{
|
||||||
|
database.SetGroupID(GetMerc()->GetName(), 0, CharacterID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isgrouped = false;
|
isgrouped = false;
|
||||||
|
|||||||
1121
zone/merc.cpp
1121
zone/merc.cpp
File diff suppressed because it is too large
Load Diff
13
zone/merc.h
13
zone/merc.h
@ -10,6 +10,12 @@
|
|||||||
#define HEALER 2
|
#define HEALER 2
|
||||||
#define MELEEDPS 9
|
#define MELEEDPS 9
|
||||||
#define CASTERDPS 12
|
#define CASTERDPS 12
|
||||||
|
|
||||||
|
#define NO_MERC_ID 0
|
||||||
|
#define MERC_STATE_NORMAL 5
|
||||||
|
#define MERC_STATE_SUSPENDED 1
|
||||||
|
#define NOT_SUSPENDED_TIME 0
|
||||||
|
|
||||||
const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this
|
const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this
|
||||||
|
|
||||||
enum MercStanceType {
|
enum MercStanceType {
|
||||||
@ -126,7 +132,7 @@ public:
|
|||||||
static Merc* LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, bool updateFromDB = false);
|
static Merc* LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, bool updateFromDB = false);
|
||||||
void UpdateMercInfo(Client *c);
|
void UpdateMercInfo(Client *c);
|
||||||
void UpdateMercStats(Client *c);
|
void UpdateMercStats(Client *c);
|
||||||
void UpdateMercAppearance(Client *c);
|
void UpdateMercAppearance();
|
||||||
void AddItem(uint8 slot, uint32 item_id);
|
void AddItem(uint8 slot, uint32 item_id);
|
||||||
static const char *GetRandomName();
|
static const char *GetRandomName();
|
||||||
bool Spawn(Client *owner);
|
bool Spawn(Client *owner);
|
||||||
@ -139,8 +145,8 @@ public:
|
|||||||
bool GetDepop() { return p_depop; }
|
bool GetDepop() { return p_depop; }
|
||||||
|
|
||||||
bool IsDead() { return GetHP() < 0;};
|
bool IsDead() { return GetHP() < 0;};
|
||||||
bool IsMedding() {return _medding; };
|
bool IsMedding() { return _medding; };
|
||||||
bool IsSuspended() {return _suspended; };
|
bool IsSuspended() { return _suspended; };
|
||||||
|
|
||||||
static uint32 CalcPurchaseCost( uint32 templateID , uint8 level, uint8 currency_type = 0);
|
static uint32 CalcPurchaseCost( uint32 templateID , uint8 level, uint8 currency_type = 0);
|
||||||
static uint32 CalcUpkeepCost( uint32 templateID , uint8 level, uint8 currency_type = 0);
|
static uint32 CalcUpkeepCost( uint32 templateID , uint8 level, uint8 currency_type = 0);
|
||||||
@ -329,6 +335,7 @@ private:
|
|||||||
void GetMercSize();
|
void GetMercSize();
|
||||||
void GenerateAppearance();
|
void GenerateAppearance();
|
||||||
|
|
||||||
|
|
||||||
bool LoadMercSpells();
|
bool LoadMercSpells();
|
||||||
bool CheckStance(int16 stance);
|
bool CheckStance(int16 stance);
|
||||||
std::vector<MercSpell> GetMercSpells() { return merc_spells; }
|
std::vector<MercSpell> GetMercSpells() { return merc_spells; }
|
||||||
|
|||||||
@ -2107,9 +2107,6 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
|
|||||||
|
|
||||||
bool ZoneDatabase::LoadMercInfo(Client *client) {
|
bool ZoneDatabase::LoadMercInfo(Client *client) {
|
||||||
|
|
||||||
if(client->GetEPP().merc_name[0] == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT MercID, Slot, Name, TemplateID, SuspendedTime, "
|
std::string query = StringFormat("SELECT MercID, Slot, Name, TemplateID, SuspendedTime, "
|
||||||
"IsSuspended, TimerRemaining, Gender, StanceID, HP, Mana, "
|
"IsSuspended, TimerRemaining, Gender, StanceID, HP, Mana, "
|
||||||
"Endurance, Face, LuclinHairStyle, LuclinHairColor, "
|
"Endurance, Face, LuclinHairStyle, LuclinHairColor, "
|
||||||
@ -2120,6 +2117,9 @@ bool ZoneDatabase::LoadMercInfo(Client *client) {
|
|||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if(results.RowCount() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
uint8 slot = atoi(row[1]);
|
uint8 slot = atoi(row[1]);
|
||||||
|
|
||||||
@ -2156,9 +2156,6 @@ bool ZoneDatabase::LoadMercInfo(Client *client) {
|
|||||||
|
|
||||||
bool ZoneDatabase::LoadCurrentMerc(Client *client) {
|
bool ZoneDatabase::LoadCurrentMerc(Client *client) {
|
||||||
|
|
||||||
if(client->GetEPP().merc_name[0] == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint8 slot = client->GetMercSlot();
|
uint8 slot = client->GetMercSlot();
|
||||||
|
|
||||||
if(slot > MAXMERCS)
|
if(slot > MAXMERCS)
|
||||||
@ -2176,6 +2173,9 @@ bool ZoneDatabase::LoadCurrentMerc(Client *client) {
|
|||||||
if(!results.Success())
|
if(!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if(results.RowCount() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
client->GetMercInfo(slot).mercid = atoi(row[0]);
|
client->GetMercInfo(slot).mercid = atoi(row[0]);
|
||||||
@ -2211,9 +2211,9 @@ bool ZoneDatabase::SaveMerc(Merc *merc) {
|
|||||||
if(!owner)
|
if(!owner)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(merc->GetMercID() == 0) {
|
if(merc->GetMercID() == 0)
|
||||||
|
{
|
||||||
// New merc record
|
// New merc record
|
||||||
uint32 TempNewMercID = 0;
|
|
||||||
std::string query = StringFormat("INSERT INTO mercs "
|
std::string query = StringFormat("INSERT INTO mercs "
|
||||||
"(OwnerCharacterID, Slot, Name, TemplateID, "
|
"(OwnerCharacterID, Slot, Name, TemplateID, "
|
||||||
"SuspendedTime, IsSuspended, TimerRemaining, "
|
"SuspendedTime, IsSuspended, TimerRemaining, "
|
||||||
@ -2234,6 +2234,7 @@ bool ZoneDatabase::SaveMerc(Merc *merc) {
|
|||||||
merc->GetEyeColor2(), merc->GetBeardColor(),
|
merc->GetEyeColor2(), merc->GetBeardColor(),
|
||||||
merc->GetBeard(), merc->GetDrakkinHeritage(),
|
merc->GetBeard(), merc->GetDrakkinHeritage(),
|
||||||
merc->GetDrakkinTattoo(), merc->GetDrakkinDetails());
|
merc->GetDrakkinTattoo(), merc->GetDrakkinDetails());
|
||||||
|
|
||||||
auto results = database.QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if(!results.Success()) {
|
if(!results.Success()) {
|
||||||
owner->Message(13, results.ErrorMessage().c_str());
|
owner->Message(13, results.ErrorMessage().c_str());
|
||||||
@ -2243,7 +2244,7 @@ bool ZoneDatabase::SaveMerc(Merc *merc) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
merc->SetMercID(TempNewMercID);
|
merc->SetMercID(results.LastInsertedID());
|
||||||
merc->UpdateMercInfo(owner);
|
merc->UpdateMercInfo(owner);
|
||||||
database.SaveMercBuffs(merc);
|
database.SaveMercBuffs(merc);
|
||||||
return true;
|
return true;
|
||||||
@ -2266,6 +2267,7 @@ bool ZoneDatabase::SaveMerc(Merc *merc) {
|
|||||||
merc->GetHairColor(), merc->GetEyeColor1(), merc->GetEyeColor2(),
|
merc->GetHairColor(), merc->GetEyeColor1(), merc->GetEyeColor2(),
|
||||||
merc->GetBeardColor(), merc->GetBeard(), merc->GetDrakkinHeritage(),
|
merc->GetBeardColor(), merc->GetBeard(), merc->GetDrakkinHeritage(),
|
||||||
merc->GetDrakkinTattoo(), merc->GetDrakkinDetails(), merc->GetMercID());
|
merc->GetDrakkinTattoo(), merc->GetDrakkinDetails(), merc->GetMercID());
|
||||||
|
|
||||||
auto results = database.QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
owner->Message(13, results.ErrorMessage().c_str());
|
owner->Message(13, results.ErrorMessage().c_str());
|
||||||
@ -2388,23 +2390,25 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) {
|
|||||||
if(merc_id == 0)
|
if(merc_id == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool firstQueryWorked = false;
|
|
||||||
// TODO: These queries need to be ran together as a transaction.. ie,
|
// TODO: These queries need to be ran together as a transaction.. ie,
|
||||||
// if one or more fail then they all will fail to commit to the database.
|
// if one or more fail then they all will fail to commit to the database.
|
||||||
std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercID = '%u'", merc_id);
|
// ...Not all mercs will have buffs, so why is it required that both deletes succeed?
|
||||||
|
std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = '%u'", merc_id);
|
||||||
auto results = database.QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if(!results.Success())
|
if(!results.Success())
|
||||||
LogFile->write(EQEMuLog::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str());
|
{
|
||||||
else
|
LogFile->write(EQEMuLog::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str());
|
||||||
firstQueryWorked = true;
|
}
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id);
|
query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id);
|
||||||
if(!results.Success()) {
|
results = database.QueryDatabase(query);
|
||||||
|
if(!results.Success())
|
||||||
|
{
|
||||||
LogFile->write(EQEMuLog::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str());
|
LogFile->write(EQEMuLog::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return firstQueryWorked;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneDatabase::LoadMercEquipment(Merc *merc) {
|
void ZoneDatabase::LoadMercEquipment(Merc *merc) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user