mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-08 01:42:26 +00:00
Crash fix for Swarm Pets.
This commit is contained in:
parent
1ca397f426
commit
79a70271d5
@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
|||||||
== 11/22/2014 ==
|
== 11/22/2014 ==
|
||||||
Trevius: Grouping with Mercenaries is now considerably less buggy.
|
Trevius: Grouping with Mercenaries is now considerably less buggy.
|
||||||
Trevius: Fixed an issue with Spell Globals related to high Character IDs.
|
Trevius: Fixed an issue with Spell Globals related to high Character IDs.
|
||||||
|
Trevius: Crash fix for Swarm Pets.
|
||||||
|
|
||||||
== 11/19/2014 ==
|
== 11/19/2014 ==
|
||||||
Trevius: Mercenaries now Dismiss, Suspend, Unsuspend, and Die correctly.
|
Trevius: Mercenaries now Dismiss, Suspend, Unsuspend, and Die correctly.
|
||||||
|
|||||||
45
zone/npc.cpp
45
zone/npc.cpp
@ -1848,47 +1848,58 @@ void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
|||||||
void NPC::PetOnSpawn(NewSpawn_Struct* ns)
|
void NPC::PetOnSpawn(NewSpawn_Struct* ns)
|
||||||
{
|
{
|
||||||
//Basic settings to make sure swarm pets work properly.
|
//Basic settings to make sure swarm pets work properly.
|
||||||
if (GetSwarmOwner()) {
|
Mob *swarmOwner = nullptr;
|
||||||
|
if (GetSwarmOwner())
|
||||||
|
{
|
||||||
|
Mob *swarmOwner = entity_list.GetMobID(GetSwarmOwner());
|
||||||
|
}
|
||||||
|
|
||||||
Mob *m = entity_list.GetMobID(GetSwarmOwner());
|
if (swarmOwner != nullptr)
|
||||||
|
{
|
||||||
if(m->IsClient()) {
|
if(swarmOwner->IsClient())
|
||||||
|
{
|
||||||
SetPetOwnerClient(true); //Simple flag to determine if pet belongs to a client
|
SetPetOwnerClient(true); //Simple flag to determine if pet belongs to a client
|
||||||
SetAllowBeneficial(1);//Allow temp pets to receive buffs and heals if owner is client.
|
SetAllowBeneficial(1);//Allow temp pets to receive buffs and heals if owner is client.
|
||||||
//This is a hack to allow CLIENT swarm pets NOT to be targeted with F8. Warning: Will turn name 'Yellow'!
|
//This is a hack to allow CLIENT swarm pets NOT to be targeted with F8. Warning: Will turn name 'Yellow'!
|
||||||
if (RuleB(Pets, SwarmPetNotTargetableWithHotKey))
|
if (RuleB(Pets, SwarmPetNotTargetableWithHotKey))
|
||||||
ns->spawn.IsMercenary = 1;
|
ns->spawn.IsMercenary = 1;
|
||||||
}
|
}
|
||||||
//NPC cast swarm pets should still be targetable with F8.
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
//NPC cast swarm pets should still be targetable with F8.
|
||||||
ns->spawn.IsMercenary = 0;
|
ns->spawn.IsMercenary = 0;
|
||||||
|
}
|
||||||
|
|
||||||
SetTempPet(true); //Simple mob flag for checking if temp pet
|
SetTempPet(true); //Simple mob flag for checking if temp pet
|
||||||
m->SetTempPetsActive(true); //Neccessary fail safe flag set if mob ever had a swarm pet to ensure they are removed.
|
swarmOwner->SetTempPetsActive(true); //Necessary fail safe flag set if mob ever had a swarm pet to ensure they are removed.
|
||||||
m->SetTempPetCount(m->GetTempPetCount() + 1);
|
swarmOwner->SetTempPetCount(swarmOwner->GetTempPetCount() + 1);
|
||||||
|
|
||||||
//Not recommended if using above (However, this will work better on older clients).
|
//Not recommended if using above (However, this will work better on older clients).
|
||||||
if (RuleB(Pets, UnTargetableSwarmPet)) {
|
if (RuleB(Pets, UnTargetableSwarmPet))
|
||||||
|
{
|
||||||
ns->spawn.bodytype = 11;
|
ns->spawn.bodytype = 11;
|
||||||
if(!IsCharmed() && m->IsClient())
|
if(!IsCharmed() && swarmOwner->IsClient())
|
||||||
sprintf(ns->spawn.lastName, "%s's Pet", m->GetName());
|
sprintf(ns->spawn.lastName, "%s's Pet", swarmOwner->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(GetOwnerID())
|
||||||
else if(GetOwnerID()) {
|
{
|
||||||
ns->spawn.is_pet = 1;
|
ns->spawn.is_pet = 1;
|
||||||
if (!IsCharmed() && GetOwnerID()) {
|
if (!IsCharmed())
|
||||||
Client *c = entity_list.GetClientByID(GetOwnerID());
|
{
|
||||||
if(c){
|
Client *client = entity_list.GetClientByID(GetOwnerID());
|
||||||
|
if(client)
|
||||||
|
{
|
||||||
SetPetOwnerClient(true);
|
SetPetOwnerClient(true);
|
||||||
sprintf(ns->spawn.lastName, "%s's Pet", c->GetName());
|
sprintf(ns->spawn.lastName, "%s's Pet", client->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ns->spawn.is_pet = 0;
|
ns->spawn.is_pet = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NPC::SetLevel(uint8 in_level, bool command)
|
void NPC::SetLevel(uint8 in_level, bool command)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user