void PetControlDeviceImplementation::destroyObjectFromDatabase(bool destroyContainedObjects) { ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get(); if (controlledObject != NULL) { Locker locker(controlledObject); ManagedReference<CreatureObject*> object = controlledObject->getSlottedObject("rider").castTo<CreatureObject*>(); if (object != NULL) { Locker clocker(object, controlledObject); object->executeObjectControllerAction(STRING_HASHCODE("dismount")); object = controlledObject->getSlottedObject("rider").castTo<CreatureObject*>(); if (object != NULL) { controlledObject->removeObject(object, NULL, true); Zone* zone = getZone(); if (zone != NULL) zone->transferObject(object, -1, false); } } controlledObject->destroyObjectFromDatabase(true); } IntangibleObjectImplementation::destroyObjectFromDatabase(destroyContainedObjects); }
int VehicleObjectImplementation::notifyObjectDestructionObservers(TangibleObject* attacker, int condition) { unlock(); ManagedReference<CreatureObject* > linkedCreature = this->linkedCreature.get(); if (linkedCreature != NULL) { linkedCreature->sendSystemMessage("@pet/pet_menu:veh_disabled"); ManagedReference<VehicleObject*> vehicle = _this.getReferenceUnsafeStaticCast(); String vehicleName = vehicle->getDisplayedName(); if (!vehicleName.beginsWith("(disabled)")) { UnicodeString disabledName = "(disabled) " + vehicleName; vehicle->setCustomObjectName(disabledName, true); } try { if (attacker != _this.getReferenceUnsafeStaticCast()) { Locker clocker(linkedCreature, attacker); linkedCreature->updateCooldownTimer("mount_dismount", 0); linkedCreature->executeObjectControllerAction(STRING_HASHCODE("dismount")); } else { Locker locker(linkedCreature); linkedCreature->updateCooldownTimer("mount_dismount", 0); linkedCreature->executeObjectControllerAction(STRING_HASHCODE("dismount")); } } catch (Exception& e) { } } if (attacker != _this.getReferenceUnsafeStaticCast()) wlock(attacker); else wlock(); return CreatureObjectImplementation::notifyObjectDestructionObservers(attacker, condition); }