- added : wearable and attachments related @notify notifications
--HG-- branch : RLVameow-7.2.2
parent
f68b7bfea6
commit
363659fc22
|
|
@ -945,6 +945,30 @@ const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32
|
|||
return LLUUID();
|
||||
}
|
||||
|
||||
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
void LLAgentWearables::getWearableItemIDs(uuid_vec_t& idItems) const
|
||||
{
|
||||
for (wearableentry_map_t::const_iterator itWearableType = mWearableDatas.begin();
|
||||
itWearableType != mWearableDatas.end(); ++itWearableType)
|
||||
{
|
||||
getWearableItemIDs(itWearableType->first, idItems);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAgentWearables::getWearableItemIDs(LLWearableType::EType eType, uuid_vec_t& idItems) const
|
||||
{
|
||||
wearableentry_map_t::const_iterator itWearableType = mWearableDatas.find(eType);
|
||||
if (mWearableDatas.end() != itWearableType)
|
||||
{
|
||||
for (wearableentry_vec_t::const_iterator itWearable = itWearableType->second.begin(), endWearable = itWearableType->second.end();
|
||||
itWearable != endWearable; ++itWearable)
|
||||
{
|
||||
idItems.push_back((*itWearable)->getItemID());
|
||||
}
|
||||
}
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
||||
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
|
||||
{
|
||||
const LLWearable *wearable = getWearable(type,index);
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@ public:
|
|||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
void getWearableItemIDs(uuid_vec_t& idItems) const;
|
||||
void getWearableItemIDs(LLWearableType::EType eType, uuid_vec_t& idItems) const;
|
||||
// [/RLVa:KB]
|
||||
const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
const LLWearable* getWearableFromItemID(const LLUUID& item_id) const;
|
||||
|
|
|
|||
|
|
@ -1738,6 +1738,14 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
|
|||
lldebugs << "updateAgentWearables()" << llendl;
|
||||
LLInventoryItem::item_array_t items;
|
||||
LLDynamicArray< LLWearable* > wearables;
|
||||
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
uuid_vec_t idsCurrent; LLInventoryModel::item_array_t itemsNew;
|
||||
if (rlv_handler_t::isEnabled())
|
||||
{
|
||||
// Collect the item UUIDs of all currently worn wearables
|
||||
gAgentWearables.getWearableItemIDs(idsCurrent);
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
||||
// For each wearable type, find the wearables of that type.
|
||||
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
|
||||
|
|
@ -1773,11 +1781,39 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
|
|||
// [/RLVa:KB]
|
||||
items.put(item);
|
||||
wearables.put(wearable);
|
||||
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
if ( (rlv_handler_t::isEnabled()) && (gAgentWearables.areInitalWearablesLoaded()) )
|
||||
{
|
||||
// Remove the wearable from current item UUIDs if currently worn and requested, otherwise mark it as a new item
|
||||
uuid_vec_t::iterator itItemID = std::find(idsCurrent.begin(), idsCurrent.end(), item->getUUID());
|
||||
if (idsCurrent.end() != itItemID)
|
||||
idsCurrent.erase(itItemID);
|
||||
else
|
||||
itemsNew.push_back(item);
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
if ( (rlv_handler_t::isEnabled()) && (gAgentWearables.areInitalWearablesLoaded()) )
|
||||
{
|
||||
// We need to report removals before additions or scripts will get confused
|
||||
for (uuid_vec_t::const_iterator itItemID = idsCurrent.begin(); itItemID != idsCurrent.end(); ++itItemID)
|
||||
{
|
||||
const LLWearable* pWearable = gAgentWearables.getWearableFromItemID(*itItemID);
|
||||
if (pWearable)
|
||||
RlvBehaviourNotifyHandler::onTakeOff(pWearable->getType(), true);
|
||||
}
|
||||
for (S32 idxItem = 0, cntItem = itemsNew.count(); idxItem < cntItem; idxItem++)
|
||||
{
|
||||
RlvBehaviourNotifyHandler::onWear(itemsNew.get(idxItem)->getWearableType(), true);
|
||||
}
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
||||
if(wearables.count() > 0)
|
||||
{
|
||||
gAgentWearables.setWearableOutfit(items, wearables, !append);
|
||||
|
|
|
|||
|
|
@ -1003,6 +1003,36 @@ void RlvBehaviourNotifyHandler::sendNotification(const std::string& strText, con
|
|||
}
|
||||
}
|
||||
|
||||
// Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
void RlvBehaviourNotifyHandler::onWear(LLWearableType::EType eType, bool fAllowed)
|
||||
{
|
||||
sendNotification(llformat("worn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType).c_str()));
|
||||
}
|
||||
|
||||
// Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
void RlvBehaviourNotifyHandler::onTakeOff(LLWearableType::EType eType, bool fAllowed)
|
||||
{
|
||||
sendNotification(llformat("unworn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType).c_str()));
|
||||
}
|
||||
|
||||
// Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
void RlvBehaviourNotifyHandler::onAttach(const LLViewerJointAttachment* pAttachPt, bool fAllowed)
|
||||
{
|
||||
sendNotification(llformat("attached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str()));
|
||||
}
|
||||
|
||||
// Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
void RlvBehaviourNotifyHandler::onDetach(const LLViewerJointAttachment* pAttachPt, bool fAllowed)
|
||||
{
|
||||
sendNotification(llformat("detached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str()));
|
||||
}
|
||||
|
||||
// Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||
void RlvBehaviourNotifyHandler::onReattach(const LLViewerJointAttachment* pAttachPt, bool fAllowed)
|
||||
{
|
||||
sendNotification(llformat("reattached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str()));
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// RlvWLSnapshot
|
||||
//
|
||||
|
|
|
|||
|
|
@ -329,8 +329,18 @@ public:
|
|||
delete this; // Delete ourself if we have nothing to do
|
||||
}
|
||||
static void sendNotification(const std::string& strText, const std::string& strSuffix = LLStringUtil::null);
|
||||
|
||||
/*
|
||||
* Event handlers
|
||||
*/
|
||||
public:
|
||||
static void onWear(LLWearableType::EType eType, bool fAllowed);
|
||||
static void onTakeOff(LLWearableType::EType eType, bool fAllowed);
|
||||
static void onAttach(const LLViewerJointAttachment* pAttachPt, bool fAllowed);
|
||||
static void onDetach(const LLViewerJointAttachment* pAttachPt, bool fAllowed);
|
||||
static void onReattach(const LLViewerJointAttachment* pAttachPt, bool fAllowed);
|
||||
protected:
|
||||
void onCommand(const RlvCommand& rlvCmd, ERlvCmdRet eRet, bool fInternal);
|
||||
void onCommand(const RlvCommand& rlvCmd, ERlvCmdRet eRet, bool fInternal);
|
||||
|
||||
protected:
|
||||
struct notifyData
|
||||
|
|
|
|||
|
|
@ -574,17 +574,21 @@ void RlvAttachmentLockWatchdog::onAttach(const LLViewerObject* pAttachObj, const
|
|||
if (idAttachItem == itAttach->second.idItem)
|
||||
{
|
||||
fPendingReattach = true;
|
||||
RlvBehaviourNotifyHandler::onReattach(pAttachPt, true);
|
||||
m_PendingAttach.erase(itAttach);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!fPendingReattach)
|
||||
{
|
||||
detach(pAttachObj);
|
||||
RlvBehaviourNotifyHandler::onAttach(pAttachPt, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the attach was allowed at the time it was requested
|
||||
rlv_wear_map_t::iterator itWear = m_PendingWear.find(idAttachItem);
|
||||
rlv_wear_map_t::iterator itWear = m_PendingWear.find(idAttachItem); bool fAttachAllowed = true;
|
||||
if (itWear != m_PendingWear.end())
|
||||
{
|
||||
// We'll need to return the attachment point to its previous state if it was non-attachable
|
||||
|
|
@ -624,26 +628,27 @@ void RlvAttachmentLockWatchdog::onAttach(const LLViewerObject* pAttachObj, const
|
|||
m_PendingAttach.insert(std::pair<S32, RlvReattachInfo>(idxAttachPt, RlvReattachInfo(*itAttach)));
|
||||
}
|
||||
}
|
||||
fAttachAllowed = false;
|
||||
}
|
||||
}
|
||||
else if (RLV_WEAR_REPLACE == itWear->second.eWearAction)
|
||||
{
|
||||
// Now that we know where this attaches to check if we can actually perform a "replace"
|
||||
bool fCanReplace = true;
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itAttachObj = pAttachPt->mAttachedObjects.begin();
|
||||
((itAttachObj != pAttachPt->mAttachedObjects.end()) && (fCanReplace)); ++itAttachObj)
|
||||
((itAttachObj != pAttachPt->mAttachedObjects.end()) && (fAttachAllowed)); ++itAttachObj)
|
||||
{
|
||||
if (pAttachObj != *itAttachObj)
|
||||
fCanReplace &= !gRlvAttachmentLocks.isLockedAttachment(*itAttachObj);
|
||||
fAttachAllowed &= !gRlvAttachmentLocks.isLockedAttachment(*itAttachObj);
|
||||
}
|
||||
|
||||
if (fCanReplace)
|
||||
if (fAttachAllowed)
|
||||
detach(idxAttachPt, pAttachObj); // Replace == allowed: detach everything except the new attachment
|
||||
else
|
||||
detach(pAttachObj); // Replace != allowed: detach the new attachment
|
||||
}
|
||||
m_PendingWear.erase(itWear); // No need to start the timer since it should be running already if '!m_PendingWear.empty()'
|
||||
}
|
||||
RlvBehaviourNotifyHandler::onAttach(pAttachPt, fAttachAllowed);
|
||||
}
|
||||
|
||||
// Checked: 2010-07-28 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i
|
||||
|
|
@ -660,10 +665,12 @@ void RlvAttachmentLockWatchdog::onDetach(const LLViewerObject* pAttachObj, const
|
|||
if (itDetach != m_PendingDetach.end())
|
||||
{
|
||||
m_PendingDetach.erase(itDetach);
|
||||
RlvBehaviourNotifyHandler::onDetach(pAttachPt, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the attachment is currently "remove locked" then we should reattach it (unless it's already pending reattach)
|
||||
bool fDetachAllowed = true;
|
||||
if (gRlvAttachmentLocks.isLockedAttachment(pAttachObj))
|
||||
{
|
||||
bool fPendingAttach = false;
|
||||
|
|
@ -684,7 +691,9 @@ void RlvAttachmentLockWatchdog::onDetach(const LLViewerObject* pAttachObj, const
|
|||
m_PendingAttach.insert(std::pair<S32, RlvReattachInfo>(idxAttachPt, RlvReattachInfo(idAttachItem)));
|
||||
startTimer();
|
||||
}
|
||||
fDetachAllowed = false;
|
||||
}
|
||||
RlvBehaviourNotifyHandler::onDetach(pAttachPt, fDetachAllowed);
|
||||
}
|
||||
|
||||
// Checked: 2010-03-05 (RLVa-1.2.0a) | Modified: RLVa-1.0.5b
|
||||
|
|
|
|||
Loading…
Reference in New Issue