Update client inventory when item name is changed

ryzomclassic-develop
kaetemi 4 years ago
parent be28e102ec
commit f203559ecb

@ -46,6 +46,9 @@ public:
NL_FORCE_INLINE bool operator==(const T *p) const { return (m == p) || (m && p && *m == *p); }
NL_FORCE_INLINE bool operator!=(const T *p) const { return !(*this == p); }
NL_FORCE_INLINE bool operator==(const T &p) const { return (m == &p) || (m && *m == p); }
NL_FORCE_INLINE bool operator!=(const T &p) const { return !(*this == p); }
NL_FORCE_INLINE bool operator==(long int p) const { return (*this == (const T *)(ptrdiff_t)p); } //< == NULL
NL_FORCE_INLINE bool operator!=(long int p) const { return (*this != (const T *)(ptrdiff_t)p); } //< != NULL

@ -125,3 +125,5 @@ namespace INVENTORIES
{ "SHEET", "QUALITY", "QUANTITY", "USER_COLOR", "BUFFS", "LOCKED", "ACCESS", "WEIGHT", "NAMEID", "ENCHANT", "RM_CLASS_TYPE", "RM_FABER_STAT_TYPE", "PREREQUISIT_VALID", "PRICE", "RESALE_FLAG", "WORNED" };
const uint CItemSlot::DataBitSize [NbItemPropId] =
{ 32, 10, 10, 3, 8, 10, 2, 16, 32, 10, 3, 5, 1, 32, 2, 1, };
}

@ -482,6 +482,9 @@ enum TItemChange
itc_lock_state = 1<<6,
itc_info_version = 1<<7,
itc_worned = 1<<8,
itc_owner_locked = itc_lock_state,
itc_access_grade = itc_lock_state,
itc_name = itc_lock_state,
};
typedef NLMISC::CEnumBitset<TItemChange> TItemChangeFlags;

@ -1151,7 +1151,7 @@ void CGameItem::setLockedByOwner(bool value)
if (value != _LockedByOwner)
{
_LockedByOwner = value;
callItemChanged(INVENTORIES::TItemChangeFlags(INVENTORIES::itc_lock_state));
callItemChanged(INVENTORIES::TItemChangeFlags(INVENTORIES::itc_owner_locked));
}
}
@ -1160,7 +1160,16 @@ void CGameItem::setAccessGrade(EGSPD::CGuildGrade::TGuildGrade value)
if (value != _AccessGrade)
{
_AccessGrade = value;
callItemChanged(INVENTORIES::TItemChangeFlags(INVENTORIES::itc_lock_state));
callItemChanged(INVENTORIES::TItemChangeFlags(INVENTORIES::itc_access_grade));
}
}
void CGameItem::setPhraseId(const std::string &str, bool literal = false)
{
if (literal != _PhraseLiteral || _PhraseId != str)
{
setPhraseIdInternal(str, literal);
callItemChanged(INVENTORIES::TItemChangeFlags(INVENTORIES::itc_name));
}
}

@ -489,7 +489,8 @@ public :
/// accessors to the item phrase
const std::string &getPhraseId() const { static const std::string empty; return _PhraseId ? *_PhraseId : empty; }
bool isPhraseLiteral() const { return _PhraseLiteral; }
void setPhraseId(const std::string &str, bool literal = false) { if (!_PhraseId) _PhraseId = new std::string(); *_PhraseId = str; _PhraseLiteral = literal; }
void setPhraseIdInternal(const std::string &str, bool literal = false) { if (!_PhraseId) _PhraseId = new std::string(); *_PhraseId = str; _PhraseLiteral = literal; }
void setPhraseId(const std::string &str, bool literal = false);
// return the enchantment value to be displayed in the client
uint16 getClientEnchantValue() const;

@ -466,7 +466,7 @@ CGameItemPtr CGameItemManager::createInGameItem( uint16 quality, uint32 quantity
item = sellingItem->getItemCopy();
item->quality( quality );
if ( phraseId )
item->setPhraseId(*phraseId);
item->setPhraseIdInternal(*phraseId);
}
else if (sheet == preorderSheetId)
{

@ -141,11 +141,11 @@ void CGuildInventoryView::updateClientSlot(uint32 slot)
itemSlot.setItemProp( INVENTORIES::Locked, 0 );
itemSlot.setItemProp( INVENTORIES::Access, item->getAccessGrade() );
itemSlot.setItemProp( INVENTORIES::Weight, item->weight() / 10 );
itemSlot.setItemProp( INVENTORIES::NameId, 0 ); // TODO: name of guild (item->sendNameId())
itemSlot.setItemProp( INVENTORIES::NameId, 0 ); // TODO: send name to all guild members (item->sendNameId())
itemSlot.setItemProp( INVENTORIES::Enchant, item->getClientEnchantValue() );
itemSlot.setItemProp( INVENTORIES::ItemClass, item->getItemClass() );
itemSlot.setItemProp( INVENTORIES::ItemBestStat, item->getCraftParameters() == 0 ? RM_FABER_STAT_TYPE::Unknown : item->getCraftParameters()->getBestItemStat() );
itemSlot.setItemProp( INVENTORIES::PrerequisitValid, 1 ); // TODO: per user prereq
itemSlot.setItemProp( INVENTORIES::PrerequisitValid, 1 ); // TODO: can we send prereq per user?
itemSlot.setItemProp( INVENTORIES::Price, 0 );
itemSlot.setItemProp( INVENTORIES::ResaleFlag, 0 );
_GuildInvUpdater.setItemProps( INVENTORIES::CInventoryCategoryForGuild::GuildInvId, itemSlot );

@ -18765,7 +18765,7 @@ uint32 CPetAnimal::initLinkAnimalToTicket( CCharacter * c, uint8 index )
// Slot = ItemPtr->getLocSlot();
ItemPtr->setPetIndex(index);
#ifdef RYZOM_FORGE_PET_NAME
ItemPtr->setPhraseId(CustomName, true);
ItemPtr->setPhraseIdInternal(CustomName, true);
#endif
Slot = ItemPtr->getInventorySlot();
return Slot;
@ -18781,7 +18781,7 @@ uint32 CPetAnimal::initLinkAnimalToTicket( CCharacter * c, uint8 index )
Slot = ItemPtr->getInventorySlot();
ItemPtr->setPetIndex(index);
#ifdef RYZOM_FORGE_PET_NAME
ItemPtr->setPhraseId(CustomName, true);
ItemPtr->setPhraseIdInternal(CustomName, true);
#endif
return Slot;
}

@ -1637,7 +1637,7 @@ CGameItemPtr CCharacter::createItem(uint16 obtainedQuality, uint32 quantity, con
item = sellingItem->getItemCopy();
item->quality(obtainedQuality);
if (phraseId)
item->setPhraseId(*phraseId);
item->setPhraseIdInternal(*phraseId);
}
else if (obtainedItem == preorderSheetId)
{
@ -2442,8 +2442,6 @@ void CCharacter::sendItemInfos( uint16 slotId )
infos.TypeSkillMods = item->getTypeSkillMods();
infos.AccessGrade = item->getAccessGrade();
infos.CustomText = item->getCustomText();
CMessage msgout( "IMPULSION_ID" );

@ -1343,7 +1343,7 @@ private:
PROP2(_HP, uint32, _HP, _HP=val)\
PROP2(_Recommended, uint32, _Recommended, _Recommended=val)\
PROP2(_CreatorId, CEntityId, _CreatorId, _CreatorId=val)\
PROP2(_PhraseId, string, getPhraseId(), setPhraseId(val))\
PROP2(_PhraseId, string, getPhraseId(), setPhraseIdInternal(val))\
LPROP2(_PhraseLiteral, bool, if (_PhraseLiteral), _PhraseLiteral, _PhraseLiteral=val)\
LSTRUCT2(_CraftParameters, if (_CraftParameters), _CraftParameters->store(pdr), _CraftParameters = new CItemCraftParameters; _CraftParameters->apply(pdr))\
LPROP2(_SlotImage, uint16, if (0), 0xffff, slotImage=val) /* Very old version compatibility */ \
@ -1363,7 +1363,7 @@ private:
STRUCT_VECT(_TypeSkillMods)\
LPROP_VECT(CSheetId, _Enchantment, VECT_LOGIC(_Enchantment) if (_Enchantment[i]!=CSheetId::Unknown))\
PROP2(_CustomText, string, getCustomText(), setCustomText(val))\
LPROP2(_CustomName, string, if (false), string(), setPhraseId(val, true)) /* Ryzom Forge compatibility, replaced by _PhraseLiteral */ \
LPROP2(_CustomName, string, if (false), string(), setPhraseIdInternal(val, true)) /* Ryzom Forge compatibility, replaced by _PhraseLiteral */ \
PROP(bool, _Movable)\
PROP(bool, _UnMovable)\
PROP(bool, _LockedByOwner)\

Loading…
Cancel
Save