void PetMenuComponent::fillObjectMenuResponse(SceneObject* sceneObject, ObjectMenuResponse* menuResponse, CreatureObject* player) { if (!sceneObject->isPet()) return; AiAgent* pet = cast<AiAgent*>(sceneObject); if (pet->getGroup() != NULL) { ManagedReference<GroupObject*> group = player->getGroup(); if (group == pet->getGroup()) { if (group->getLeader() == player) { menuResponse->addRadialMenuItem(40, 3, "@ui_radial:group_kick"); // Kick from Group menuResponse->addRadialMenuItemToRadialID(40, 41, 3, "@ui_radial:group_disband" ); // Disband Group } else { menuResponse->addRadialMenuItem(39, 3, "@ui_radial:group_leave"); // Leave Group } } } if (pet->isIncapacitated() && pet->isAttackableBy(player)) menuResponse->addRadialMenuItem(6, 3, "@ui_radial:combat_death_blow"); // Death Blow if (!player->getPlayerObject()->isPrivileged() && pet->getLinkedCreature() != player) { return; } menuResponse->addRadialMenuItem(59, 3, "@pet/pet_menu:menu_store"); // Store if (pet->getLinkedCreature().get() != player) return; ManagedReference<PetControlDevice*> controlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>(); if( controlDevice == NULL ) return; PetManager* petManager = pet->getZoneServer()->getPetManager(); if (petManager == NULL) return; // DROIDS if( controlDevice->getPetType() == PetManager::DROIDPET ){ ManagedReference<DroidObject*> droidObject = dynamic_cast<DroidObject*>(controlDevice->getControlledObject()); bool conversingDroid = (pet->getOptionsBitmask() & OptionBitmask::CONVERSE); if(conversingDroid) { menuResponse->addRadialMenuItem(132, 3, "@pet/pet_menu:droid_options"); // SERVER_ITEM_OPTIONS menuResponse->addRadialMenuItemToRadialID(132, 234, 3, "@pet/pet_menu:menu_recharge" ); // PET_FEED // convsering droids have less re-programmable commands } else { menuResponse->addRadialMenuItem(132, 3, "@pet/pet_menu:droid_options"); // SERVER_ITEM_OPTIONS menuResponse->addRadialMenuItemToRadialID(132, 234, 3, "@pet/pet_menu:menu_recharge" ); // PET_FEED menuResponse->addRadialMenuItem(141, 3, "@pet/pet_menu:menu_command_droid"); // PET_COMMAND menuResponse->addRadialMenuItemToRadialID(141, 142, 3, "@pet/pet_menu:menu_follow" ); // PET_FOLLOW menuResponse->addRadialMenuItemToRadialID(141, 143, 3, "@pet/pet_menu:menu_stay" ); // PET_STAY if (droidObject != NULL && droidObject->isCombatDroid()) menuResponse->addRadialMenuItemToRadialID(141, 144, 3, "@pet/pet_menu:menu_guard" ); // PET_GUARD menuResponse->addRadialMenuItemToRadialID(141, 145, 3, "@pet/pet_menu:menu_friend" ); // PET_FRIEND if (droidObject != NULL && droidObject->isCombatDroid()) menuResponse->addRadialMenuItemToRadialID(141, 146, 3, "@pet/pet_menu:menu_attack" ); // PET_ATTACK menuResponse->addRadialMenuItemToRadialID(141, 147, 3, "@pet/pet_menu:menu_patrol" ); // PET_PATROL menuResponse->addRadialMenuItemToRadialID(141, 148, 3, "@pet/pet_menu:menu_get_patrol_point" ); // PET_GET_PATROL_POINT menuResponse->addRadialMenuItemToRadialID(141, 149, 3, "@pet/pet_menu:menu_clear_patrol_points" ); // PET_CLEAR_PATROL_POINTS menuResponse->addRadialMenuItemToRadialID(141, 150, 3, "@pet/pet_menu:menu_assume_formation_1" ); // PET_ASSUME_FORMATION_1 menuResponse->addRadialMenuItemToRadialID(141, 151, 3, "@pet/pet_menu:menu_assume_formation_2" ); // PET_ASSUME_FORMATION_2 menuResponse->addRadialMenuItemToRadialID(141, 158, 3, "@pet/pet_menu:menu_group" ); // PET_GROUP if (droidObject != NULL && droidObject->isCombatDroid() && droidObject->hasRangedWeapon()) menuResponse->addRadialMenuItemToRadialID(141, 163, 3, "@pet/pet_menu:menu_ranged_attack" ); menuResponse->addRadialMenuItemToRadialID(141, 164, 3, "@pet/pet_menu:menu_store" ); menuResponse->addRadialMenuItemToRadialID(141, 165, 3, "@pet/pet_menu:menu_follow_other" ); if( droidObject != NULL && droidObject->isPowerDroid() ){ menuResponse->addRadialMenuItemToRadialID(141, 235, 3, "@pet/pet_menu:menu_recharge_other" ); } } if( pet->isIncapacitated() ){ menuResponse->addRadialMenuItem(166, 3, "@pet/pet_menu:awaken" ); } } // FACTION else if( controlDevice->getPetType() == PetManager::FACTIONPET ){ // future, if conversion do as droid objects above and not add this menu at all. //bool conversingPet = (pet->getOptionsBitmask() & OptionBitmask::CONVERSE); menuResponse->addRadialMenuItem(141, 3, "@pet/pet_menu:menu_command"); // PET_COMMAND menuResponse->addRadialMenuItemToRadialID(141, 142, 3, "@pet/pet_menu:menu_follow" ); // PET_FOLLOW menuResponse->addRadialMenuItemToRadialID(141, 143, 3, "@pet/pet_menu:menu_stay" ); // PET_STAY menuResponse->addRadialMenuItemToRadialID(141, 144, 3, "@pet/pet_menu:menu_guard" ); // PET_GUARD menuResponse->addRadialMenuItemToRadialID(141, 145, 3, "@pet/pet_menu:menu_friend" ); // PET_FRIEND menuResponse->addRadialMenuItemToRadialID(141, 146, 3, "@pet/pet_menu:menu_attack" ); // PET_ATTACK menuResponse->addRadialMenuItemToRadialID(141, 147, 3, "@pet/pet_menu:menu_patrol" ); // PET_PATROL menuResponse->addRadialMenuItemToRadialID(141, 148, 3, "@pet/pet_menu:menu_get_patrol_point" ); // PET_GET_PATROL_POINT menuResponse->addRadialMenuItemToRadialID(141, 149, 3, "@pet/pet_menu:menu_clear_patrol_points" ); // PET_CLEAR_PATROL_POINTS menuResponse->addRadialMenuItemToRadialID(141, 150, 3, "@pet/pet_menu:menu_assume_formation_1" ); // PET_ASSUME_FORMATION_1 menuResponse->addRadialMenuItemToRadialID(141, 151, 3, "@pet/pet_menu:menu_assume_formation_2" ); // PET_ASSUME_FORMATION_2 menuResponse->addRadialMenuItemToRadialID(141, 158, 3, "@pet/pet_menu:menu_group" ); // PET_GROUP menuResponse->addRadialMenuItemToRadialID(141, 163, 3, "@pet/pet_menu:menu_ranged_attack" ); menuResponse->addRadialMenuItemToRadialID(141, 164, 3, "@pet/pet_menu:menu_store" ); menuResponse->addRadialMenuItemToRadialID(141, 165, 3, "@pet/pet_menu:menu_follow_other" ); if( pet->isIncapacitated() ){ menuResponse->addRadialMenuItem(166, 3, "@pet/pet_menu:awaken" ); } } // CREATURES else if( controlDevice->getPetType() == PetManager::CREATUREPET ){ menuResponse->addRadialMenuItem(234, 3, "@pet/pet_menu:menu_feed" ); // PET_FEED menuResponse->addRadialMenuItem(141, 3, "@pet/pet_menu:menu_command"); // PET_COMMAND if( player->hasSkill( "outdoors_creaturehandler_novice" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 142, 3, "@pet/pet_menu:menu_follow" ); // PET_FOLLOW menuResponse->addRadialMenuItemToRadialID(141, 146, 3, "@pet/pet_menu:menu_attack" ); // PET_ATTACK menuResponse->addRadialMenuItemToRadialID(141, 164, 3, "@pet/pet_menu:menu_store" ); } if( player->hasSkill( "outdoors_creaturehandler_training_01" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 143, 3, "@pet/pet_menu:menu_stay" ); // PET_STAY } if( player->hasSkill( "outdoors_creaturehandler_training_02" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 144, 3, "@pet/pet_menu:menu_guard" ); // PET_GUARD } if( player->hasSkill( "outdoors_creaturehandler_training_03" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 147, 3, "@pet/pet_menu:menu_patrol" ); // PET_PATROL menuResponse->addRadialMenuItemToRadialID(141, 148, 3, "@pet/pet_menu:menu_get_patrol_point" ); // PET_GET_PATROL_POINT menuResponse->addRadialMenuItemToRadialID(141, 149, 3, "@pet/pet_menu:menu_clear_patrol_points" ); // PET_CLEAR_PATROL_POINTS } if( player->hasSkill( "outdoors_creaturehandler_training_04" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 150, 3, "@pet/pet_menu:menu_assume_formation_1" ); // PET_ASSUME_FORMATION_1 menuResponse->addRadialMenuItemToRadialID(141, 151, 3, "@pet/pet_menu:menu_assume_formation_2" ); // PET_ASSUME_FORMATION_2 } if( player->hasSkill( "outdoors_creaturehandler_healing_01" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 154, 3, "@pet/pet_menu:menu_trick_1" ); // PET_TRICK_1 } if( player->hasSkill( "outdoors_creaturehandler_healing_03" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 155, 3, "@pet/pet_menu:menu_trick_2" ); // PET_TRICK_2 } if( player->hasSkill( "outdoors_creaturehandler_support_01" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 158, 3, "@pet/pet_menu:menu_group" ); // PET_GROUP } if( player->hasSkill( "outdoors_creaturehandler_support_02" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 165, 3, "@pet/pet_menu:menu_follow_other" ); } if( player->hasSkill( "outdoors_creaturehandler_support_03" ) ){ menuResponse->addRadialMenuItemToRadialID(141, 145, 3, "@pet/pet_menu:menu_friend" ); // PET_FRIEND } if( player->hasSkill( "outdoors_creaturehandler_taming_03" ) && pet->hasSpecialAttack(1) ){ menuResponse->addRadialMenuItemToRadialID(141, 161, 3, "@pet/pet_menu:menu_specialattack_one" ); // PET_SPECIAL_ATTACK_ONE } if( player->hasSkill( "outdoors_creaturehandler_taming_04" ) && pet->hasSpecialAttack(2) ){ menuResponse->addRadialMenuItemToRadialID(141, 162, 3, "@pet/pet_menu:menu_specialattack_two" ); // PET_SPECIAL_ATTACK_TWO } if( player->hasSkill( "outdoors_creaturehandler_master" ) ){ if (pet->hasRangedWeapon()) { menuResponse->addRadialMenuItemToRadialID(141, 163, 3, "@pet/pet_menu:menu_ranged_attack" ); } menuResponse->addRadialMenuItemToRadialID(141, 152, 3, "@pet/pet_menu:menu_transfer" ); // PET_TRANSFER } if( player->hasSkill( "outdoors_creaturehandler_support_04") && !controlDevice->isTrainedAsMount() && petManager->checkMountEligibility(controlDevice) == PetManager::CANBEMOUNTTRAINED){ menuResponse->addRadialMenuItemToRadialID(141, 207, 3, "@pet/pet_menu:menu_train_mount" ); // Train Pet As A Mount } if( pet->isIncapacitated() ){ menuResponse->addRadialMenuItem(166, 3, "@pet/pet_menu:awaken" ); } if (controlDevice->isTrainedAsMount() && !pet->isDead() && !pet->isIncapacitated()) { Reference<SceneObject*> rider = pet->getSlottedObject("rider"); if (rider == NULL) { menuResponse->addRadialMenuItem(205, 3, "@pet/pet_menu:menu_mount"); // Climb Aboard Pet } else { menuResponse->addRadialMenuItem(206, 3, "@pet/pet_menu:menu_dismount"); // Climb Off Of Pet } } } }
int ContainerImplementation::canAddObject(SceneObject* object, int containmentType, String& errorDescription) { // if (locked) // return TransferErrorCode::CONTAINERLOCKED; if ((object->isIntangibleObject() && getContainerType() != 3) || (getContainerType() == 3 && !object->isIntangibleObject())) { errorDescription = "@container_error_message:container07"; // You cannot put that kind of item in that kind of container. return TransferErrorCode::INVALIDTYPE; } if (containmentType == -1) { if ((gameObjectType == SceneObjectType::WEARABLECONTAINER && object->getGameObjectType() == SceneObjectType::WEARABLECONTAINER)) { errorDescription = "@container_error_message:container12"; // This item is too bulky to fit inside this container. return TransferErrorCode::CANTNESTOBJECT; } if (object->isContainerObject() && getArrangementDescriptorSize() == 0) { errorDescription = "@container_error_message:container12"; // This item is too bulky to fit inside this container. return TransferErrorCode::CANTNESTOBJECT; } // Find out how much room we need int objectSize; if (object->isContainerObject()) objectSize = object->getContainerObjectsSize() + 1; else objectSize = 1; // Return if there's not enough room in the container if (getContainerVolumeLimit() < getCountableObjectsRecursive() + objectSize) { errorDescription = "@container_error_message:container03"; // This container is full. return TransferErrorCode::CONTAINERFULL; } ManagedReference<SceneObject*> wearableParent = getParentRecursively(SceneObjectType::WEARABLECONTAINER); ManagedReference<SceneObject*> playerParent = getParentRecursively(SceneObjectType::PLAYERCREATURE); // If there's a wearable container parent, return if it doesn't have enough room if (wearableParent != NULL) { if (wearableParent->getContainerVolumeLimit() < wearableParent->getCountableObjectsRecursive() + objectSize) { errorDescription = "@container_error_message:container03"; // This container is full. return TransferErrorCode::CONTAINERFULL; } // It has room. Check if it's not equipped and on a player. ManagedReference<WearableContainerObject*> wearable = cast<WearableContainerObject*>(wearableParent.get()); if (!wearable->isEquipped() && playerParent != NULL) { SceneObject* inventory = playerParent->getSlottedObject("inventory"); SceneObject* bank = playerParent->getSlottedObject("bank"); SceneObject* parentOfWearableParent = wearable->getParent().get(); // Return if it's in a player inventory which doesn't have room if (parentOfWearableParent == inventory) { if (inventory->getContainerVolumeLimit() < inventory->getCountableObjectsRecursive() + objectSize) { errorDescription = "@error_message:inv_full"; // Your inventory is full. return TransferErrorCode::CONTAINERFULL; } // Return if it's in a player bank that doesn't have room } else if (parentOfWearableParent == bank) { if (bank->getContainerVolumeLimit() < bank->getCountableObjectsRecursive() + objectSize) { errorDescription = "@container_error_message:container03"; // This container is full. return TransferErrorCode::CONTAINERFULL; } } } } else { // There's no parent that's a wearable container. Check if this is if (gameObjectType == SceneObjectType::WEARABLECONTAINER) { WearableContainerObject* pack = cast<WearableContainerObject*>(_this.getReferenceUnsafeStaticCast()); if (pack != NULL && !pack->isEquipped()) { // This is a wearable container, and it's not equipped. if (playerParent != NULL ) { SceneObject* inventory = playerParent->getSlottedObject("inventory"); SceneObject* bank = playerParent->getSlottedObject("bank"); SceneObject* thisParent = getParent().get(); // Return if the container is in a player inventory without room if (thisParent == inventory) { if (inventory->getContainerVolumeLimit() < inventory->getCountableObjectsRecursive() + objectSize) { errorDescription = "@error_message:inv_full"; // Your inventory is full. return TransferErrorCode::CONTAINERFULL; } // Return if it's in a player bank that doesn't have room } else if (thisParent == bank) { if (bank->getContainerVolumeLimit() < bank->getCountableObjectsRecursive() + objectSize) { errorDescription = "@container_error_message:container03"; // This container is full. return TransferErrorCode::CONTAINERFULL; } } } } } else { // This is a non-wearable container. if (playerParent != NULL ) { SceneObject* inventory = playerParent->getSlottedObject("inventory"); SceneObject* bank = playerParent->getSlottedObject("bank"); SceneObject* thisParent = getParent().get(); // Return if the container is in a player inventory without room if (thisParent == inventory) { if (inventory->getContainerVolumeLimit() < inventory->getCountableObjectsRecursive() + objectSize) { errorDescription = "@error_message:inv_full"; // Your inventory is full. return TransferErrorCode::CONTAINERFULL; } // Return if it's in a player bank that doesn't have room } else if (thisParent == bank) { if (bank->getContainerVolumeLimit() < bank->getCountableObjectsRecursive() + objectSize) { errorDescription = "@container_error_message:container03"; // This container is full. return TransferErrorCode::CONTAINERFULL; } } } } } // Check if the container is in a building or factory ingredient hopper if (playerParent == NULL) { ManagedReference<SceneObject*> rootParent = getRootParent(); if (rootParent != NULL) { if (rootParent->isBuildingObject()) { BuildingObject* building = rootParent.castTo<BuildingObject*>(); if (!building->isStaticBuilding() && (building->getCurrentNumberOfPlayerItems() + objectSize > building->getMaximumNumberOfPlayerItems())) { errorDescription = "@container_error_message:container13"; // This house has too many items in it return TransferErrorCode::TOOMANYITEMSINHOUSE; } } else if (rootParent->isFactory()) { FactoryObject* factory = rootParent.castTo<FactoryObject*>(); SceneObject* hopper = factory->getSlottedObject("ingredient_hopper"); if (hopper->getContainerVolumeLimit() < hopper->getCountableObjectsRecursive() + objectSize) { errorDescription = "@container_error_message:container03"; // This container is full. return TransferErrorCode::CONTAINERFULL; } } } } ManagedReference<SceneObject*> myParent = getParent(); ManagedReference<SceneObject*> otherParent = object->getParent(); if (myParent != NULL && otherParent != NULL) { if (otherParent->isCreatureObject()) { AiAgent* ai = dynamic_cast<AiAgent*>(otherParent.get()); if (ai != NULL) { SceneObject* creatureInventory = ai->getSlottedObject("inventory"); if (creatureInventory != NULL) { uint64 lootOwnerID = creatureInventory->getContainerPermissions()->getOwnerID(); if (lootOwnerID != myParent->getObjectID()) { errorDescription = "@group:no_loot_permission"; return TransferErrorCode::NOLOOTPERMISSION; } } } } } } return TangibleObjectImplementation::canAddObject(object, containmentType, errorDescription); }