/** * Is called when this object has been inserted with an object * @param object object that has been inserted */ int PlayerContainerComponent::notifyObjectInserted(SceneObject* sceneObject, SceneObject* object) { CreatureObject* creo = dynamic_cast<CreatureObject*>(sceneObject); if (object->isArmorObject()) { PlayerManager* playerManager = sceneObject->getZoneServer()->getPlayerManager(); playerManager->applyEncumbrancies(creo, cast<ArmorObject*>(object)); } if (object->isTangibleObject()) { TangibleObject* tano = cast<TangibleObject*>(object); tano->applySkillModsTo(creo); } if (object->isInstrument() && creo->isEntertaining()) creo->stopEntertaining(); //this it to update the equipment list //we need a DeltaVector with all the slotted objects it seems /*CreatureObjectMessage6* msg6 = new CreatureObjectMessage6(creo); creo->broadcastMessage(msg6, true, true);*/ if (object->isTangibleObject() && object->getArrangementDescriptorSize() != 0 && object->getArrangementDescriptor(0)->size() != 0) { const String& arrangement = object->getArrangementDescriptor(0)->get(0); if (arrangement != "mission_bag" && arrangement != "ghost" && arrangement != "bank") { creo->addWearableObject(object->asTangibleObject(), true); } } if (object->isTangibleObject()) { ManagedReference<TangibleObject*> tano = object->asTangibleObject(); tano->addTemplateSkillMods(creo); } // Jedi stuff below. PlayerObject* ghost = creo->getPlayerObject(); if (ghost && ghost->isJedi()) { if (object->isRobeObject()) { ghost->setForcePowerMax(creo->getSkillMod("jedi_force_power_max")); } else if (object->isWeaponObject()) { WeaponObject* weaponObject = cast<WeaponObject*>(object); if (weaponObject->isJediWeapon()) { VisibilityManager::instance()->increaseVisibility(creo, VisibilityManager::SABERVISMOD); } } } return ContainerComponent::notifyObjectInserted(sceneObject, object); }
/** * Is called when an object was removed * @param object object that has been inserted */ int PlayerContainerComponent::notifyObjectRemoved(SceneObject* sceneObject, SceneObject* object, SceneObject* destination) { CreatureObject* creo = dynamic_cast<CreatureObject*>(sceneObject); if (object->isArmorObject()) { PlayerManager* playerManager = creo->getZoneServer()->getPlayerManager(); playerManager->removeEncumbrancies(creo, cast<ArmorObject*>(object)); } if (object->isTangibleObject()) { TangibleObject* tano = cast<TangibleObject*>(object); tano->removeSkillModsFrom(creo); } if (object->isInstrument()) { if (creo->isPlayingMusic()) creo->stopEntertaining(); } //this it to update the equipment list //we need a DeltaVector with all the slotted objects it seems /*CreatureObjectMessage6* msg6 = new CreatureObjectMessage6(creo); creo->broadcastMessage(msg6, true, true);*/ if (object->isTangibleObject() && object->getArrangementDescriptorSize() != 0 && object->getArrangementDescriptor(0)->size() != 0) { const String& arrangement = object->getArrangementDescriptor(0)->get(0); //CHK if (arrangement != "mission_bag" && arrangement != "ghost" && arrangement != "bank") { creo->removeWearableObject(object->asTangibleObject(), true); } } if (object->isTangibleObject()) { ManagedReference<TangibleObject*> tano = object->asTangibleObject(); tano->removeTemplateSkillMods(creo); } // Jedi stuff below. PlayerObject* ghost = creo->getPlayerObject(); if (ghost && ghost->isJedi()) { if (object->isRobeObject()) { ghost->setForcePowerMax(creo->getSkillMod("jedi_force_power_max")); } } return ContainerComponent::notifyObjectRemoved(sceneObject, object, destination); }