Instructions Jenkins Doxygen

[Added] Droid pets and faction pets will die (rather than incap) if one 29/1429/1
authorIvojedi <ivojedi@swgemu.com>
Tue, 25 Feb 2014 17:25:58 +0000 (09:25 -0800)
committerIvojedi <ivojedi@swgemu.com>
Tue, 25 Feb 2014 17:25:58 +0000 (09:25 -0800)
of their HAM pools reaches zero
[Added] Faction pets that die will automatically delete themselves and
their control device

Change-Id: I34e1b999b4d192f2b3d0756e53928b5778204bf5

MMOCoreORB/src/server/zone/managers/creature/PetManagerImplementation.cpp

index b357211..bf62861 100644 (file)
@@ -452,7 +452,9 @@ int PetManagerImplementation::notifyDestruction(TangibleObject* destructor, AiAg
 
        destructedObject->clearDots();
 
-       if (!destructor->isKiller()) {
+       ManagedReference<PetControlDevice*> petControlDevice = destructedObject->getControlDevice().get().castTo<PetControlDevice*>();
+
+       if (!destructor->isKiller() && petControlDevice != NULL && petControlDevice->getPetType() == CREATUREPET) {
                destructedObject->setCurrentSpeed(0);
                destructedObject->setPosture(CreaturePosture::INCAPACITATED, true);
                destructedObject->updateLocomotion();
@@ -515,12 +517,23 @@ void PetManagerImplementation::killPet(TangibleObject* attacker, AiAgent* pet) {
        pet->updateTimeOfDeath();
        pet->clearBuffs(false);
 
-       if (!attacker->isPlayerCreature() && !attacker->isPet()) {
+       ManagedReference<PetControlDevice*> petControlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>();
+
+       if (petControlDevice != NULL) {
+
+               if (petControlDevice->getPetType() == FACTIONPET) {
+                       ManagedReference<CreatureObject*> owner = zoneServer->getObject(pet->getCreatureLinkID()).castTo<CreatureObject*>();
+
+                       if (owner != NULL)
+                               petControlDevice->storeObject(owner, true);
+
+                       petControlDevice->destroyObjectFromWorld(true);
+                       petControlDevice->destroyObjectFromDatabase(true);
+
+               } else if (!attacker->isPlayerCreature() && !attacker->isPet()) {
 
-               if (pet->getCooldownTimerMap() != NULL && pet->getCooldownTimerMap()->isPast("vitalityLossCooldown")) {
-                       ManagedReference<PetControlDevice*> petControlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>();
+                       if (pet->getCooldownTimerMap() != NULL && pet->getCooldownTimerMap()->isPast("vitalityLossCooldown")) {
 
-                       if (petControlDevice != NULL) {
                                petControlDevice->setVitality(petControlDevice->getVitality() - 2);
                                pet->getCooldownTimerMap()->updateToCurrentAndAddMili("vitalityLossCooldown", 300000);
                        }