diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index cd79f0192..070aafd55 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -1907,8 +1907,8 @@ void getItemText (CDBCtrlSheet *item, string &itemText, const CItemSheet*pIS) const CClientItemInfo &itemInfo = getInventory().getItemInfo(getInventory().getItemSlotId(item) ); if (!itemInfo.CustomText.empty()) { - strFindReplace(itemText, "%custom_text", "\n@{FFFF}" + itemInfo.CustomText.toUtf8() + "\n"); - string itemMFC = CI18N::get("uiItemTextMessageFromCrafter"); + strFindReplace(itemText, "%custom_text", "\n@{FFFF}" + itemInfo.CustomText + "\n"); + const string &itemMFC = CI18N::get("uiItemTextMessageFromCrafter"); strFindReplace(itemText, "%mfc", itemMFC); } else diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 85e4cb180..e6218121a 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -130,7 +130,7 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() { if ( pIS->Family == ITEMFAMILY::SCROLL) { - editBoxLarge->setInputString(itemInfo.CustomText.toUtf8()); // TODO: UTF-8 (serial) + editBoxLarge->setInputString(itemInfo.CustomText); // TODO: UTF-8 (serial) editLarge->setActive(true); editBoxLarge->setActive(true); @@ -144,7 +144,7 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() string customText; if (!itemInfo.CustomText.empty()) { - customText = itemInfo.CustomText.toUtf8(); // TODO: UTF-8 (serial) + customText = itemInfo.CustomText; // TODO: UTF-8 (serial) strFindReplace(customText, "%mfc", string()); } @@ -244,7 +244,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() // If we already have item info if ( pIS->Family == ITEMFAMILY::SCROLL) { - editBoxLarge->setInputString(itemInfo.CustomText.toUtf8()); // TODO: UTF-8 (serial) + editBoxLarge->setInputString(itemInfo.CustomText); // TODO: UTF-8 (serial) editLarge->setActive(true); editBoxLarge->setActive(true); @@ -259,7 +259,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() string customText; if (!itemInfo.CustomText.empty()) { - customText = itemInfo.CustomText.toUtf8(); + customText = itemInfo.CustomText; strFindReplace(customText, "%mfc", string()); } @@ -304,7 +304,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() display->setTextFormatTaged(localDesc); else { - string text = itemInfo.CustomText.toUtf8(); + string text = itemInfo.CustomText; string::size_type delimiter = text.find(' '); if(text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') { @@ -407,19 +407,18 @@ void CInterfaceItemEdition::CItemEditionWindow::validate() if (textValid) { CBitMemStream out; - const char *msgName = "EVENT:SET_ITEM_CUSTOM_TEXT"; + const char *msgName = "ITEM:WRITE"; if (!GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { nlwarning ("don't know message name %s", msgName); } else { - uint32 uiInventory = (uint32)pCSItem->getInventoryIndex(); - out.serial(uiInventory); - uint32 uiSlot = (uint32)pCSItem->getIndexInDB(); - out.serial(uiSlot); - ucstring ucText = ucstring::makeFromUtf8(text); // TODO: UTF-8 (serial) - out.serial(ucText); + INVENTORIES::TInventory inventory = (INVENTORIES::TInventory)pCSItem->getInventoryIndex(); + out.serialShortEnum(inventory); + uint16 slot = (uint16)pCSItem->getIndexInDB(); + out.serial(slot); + out.serial(text); NetMngr.push(out); //nlinfo("impulseCallBack : %s %s %d \"%s\" sent", msgName.c_str(), INVENTORIES::toString((INVENTORIES::TInventory)pCSItem->getInventoryIndex()).c_str(), pCSItem->getIndexInDB(), text.toUtf8().c_str()); } diff --git a/ryzom/common/data_common/msg.xml b/ryzom/common/data_common/msg.xml index 4fd5657fb..3c0d19a3c 100644 --- a/ryzom/common/data_common/msg.xml +++ b/ryzom/common/data_common/msg.xml @@ -166,9 +166,9 @@ - - - + + + @@ -349,6 +349,7 @@ + @@ -462,10 +463,12 @@ + diff --git a/ryzom/common/src/game_share/utils.h b/ryzom/common/src/game_share/utils.h index eb527162f..7d2fe02c8 100644 --- a/ryzom/common/src/game_share/utils.h +++ b/ryzom/common/src/game_share/utils.h @@ -60,6 +60,17 @@ inline ucstring capitalize(const ucstring & s) return ucstring::makeFromUtf8(capitalize(s.toUtf8())); } +inline std::string capitalizeFirst(const std::string &s) +{ + if (s.empty()) + return s; + + std::string res; + res.reserve(4); + ptrdiff_t i = 0; + NLMISC::appendToUpper(res, s, i); + return res + s.substr(i); +} //------------------------------------------------------------------------------------------------- // HANDY MACROS - For forcing the pre-preprocessor to evaluate concatenation operations nicely diff --git a/ryzom/server/src/entities_game_service/client_messages.cpp b/ryzom/server/src/entities_game_service/client_messages.cpp index e7a3566c1..3a6e0269e 100644 --- a/ryzom/server/src/entities_game_service/client_messages.cpp +++ b/ryzom/server/src/entities_game_service/client_messages.cpp @@ -351,6 +351,171 @@ void cbClientItemStopUseXpCat( CMessage& msgin, const std::string &serviceName, character->stopUseItem( isRingCatalyser ); } +void cbClientItemLock(NLNET::CMessage &msgin, const std::string &serviceName, NLNET::TServiceId serviceId) +{ + CEntityId eid; + INVENTORIES::TInventory inventory; + uint16 slot; + bool lock; + msgin.serial(eid); + msgin.serialShortEnum(inventory); + msgin.serial(slot); + msgin.serial(lock); + + CCharacter *character = PlayerManager.getChar(eid); + DROP_IF(!character, "Character not found", return); + DROP_IF(inventory == INVENTORIES::UNDEFINED, "Inventory is undefined", return); + + CInventoryPtr invent = character->getInventory(inventory); + DROP_IF(slot >= invent->getSlotCount(), "Invalid slot specified", return); + CGameItemPtr item = invent->getItem(slot); + DROP_IF(item == NULL, "Item does not exist", return); + + item->setLockedByOwner(lock); +} + +void cbClientItemRename(NLNET::CMessage &msgin, const std::string &serviceName, NLNET::TServiceId serviceId) +{ + CEntityId eid; + INVENTORIES::TInventory inventory; + uint16 slot; + bool literal; + string text; + msgin.serial(eid); + msgin.serialShortEnum(inventory); + msgin.serial(slot); + msgin.serial(literal); + msgin.serial(text); + + CCharacter *character = PlayerManager.getChar(eid); + DROP_IF(!character, "Character not found", return); + DROP_IF(inventory == INVENTORIES::UNDEFINED, "Inventory is undefined", return); + + CInventoryPtr invent = character->getInventory(inventory); + DROP_IF(slot >= invent->getSlotCount(), "Invalid slot specified", return); + CGameItemPtr item = invent->getItem(slot); + DROP_IF(item == NULL, "Item does not exist", return); + + if (!character->havePriv(":DEV:SGM:GM:EM:")) + { + // TODO: Some special rights to name items :) + const NLMISC::CEntityId &crafterEId = item->getCreator(); + const NLMISC::CEntityId &userEId = character->getId(); + DROP_IF(crafterEId != userEId, "Item name can only be set by the crafter", return); + } + + /* + const CStaticItem *form = item->getStaticForm(); + DROP_IF(!form, "Item does not have a static form", return); + ITEMFAMILY::EItemFamily family = form->Family; + DROP_IF(!ITEMFAMILY::isTextCustomizable(family), "Item text cannot be changed", return); + */ + + if (literal) + { + text = capitalizeFirst(text); // Require first character to be capitalized + + if (text.size() >= 255) // Limit literal text length + text = text.substr(0, 255); + } + + item->setPhraseId(text, literal); + +} + +/// returns 0 on success, anything else is error: +/// -1: Invalid inventory +/// -2: Invalid slot +/// -3: Empty slot +sint32 cbClientItemWrite(CCharacter* character, INVENTORIES::TInventory inventory, uint32 slot, ucstring const& text) +{ + if (inventory==INVENTORIES::UNDEFINED) + { + return -1; + } + CInventoryPtr invent = character->getInventory(inventory); + if (slot >= invent->getSlotCount()) + { + return -2; + } + if (invent->getItem(slot) == NULL) + { + return -3; + } + + CGameItemPtr item = invent->getItem(slot); + item->setCustomText(text.toUtf8()); + // Following line was commented out by trap, reason unknown + character->incSlotVersion(inventory, slot); // this ensures re-fetch of info window, unusual case + + return 0; +} + +void cbClientItemWrite( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId ) +{ + CEntityId eid; + INVENTORIES::TInventory inventory; + uint16 slot; + string text; + msgin.serial(eid); + msgin.serialShortEnum(inventory); + msgin.serial(slot); + msgin.serial(text); + + CCharacter* character = PlayerManager.getChar(eid); + if(!character) return; + + if (!character->havePriv(":DEV:SGM:GM:EM:")) + { + // it should be the crafter of the item, check + if (inventory==INVENTORIES::UNDEFINED) return; + CInventoryPtr invent = character->getInventory(inventory); + if (slot >= invent->getSlotCount()) return; + if (invent->getItem(slot) == NULL) return; + CGameItemPtr item = invent->getItem(slot); + + const NLMISC::CEntityId &crafterEId = item->getCreator(); + const NLMISC::CEntityId &userEId = character->getId(); + + if(crafterEId != userEId) + { + string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString(); + nlwarning("HACK: %s %s tries to set custom text on an item he didn't crafted", userEId.toString().c_str(), name.c_str()); + return; + } + + // text must not be too big + if(text.size() > 256) + { + string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString(); + nlwarning("HACK: %s %s tries to set custom text of a size > 256 (%d)", userEId.toString().c_str(), name.c_str(), text.size()); + return; + } + + // the item must have the good family + const CStaticItem * form = item->getStaticForm(); + if (!form) return; + ITEMFAMILY::EItemFamily family = form->Family; + if (!ITEMFAMILY::isTextCustomizable(family)) + { + string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString(); + nlwarning("HACK: %s %s tries to set custom text on a item that is not text customizable (%s)", userEId.toString().c_str(), name.c_str(), ITEMFAMILY::toString(family).c_str()); + return; + } + + // prevent use of @WEB at begin + if (text.size() >= 4 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') + text = text.substr(4, text.size() - 4); + + // force that the begin of the text for non admin is %mfc + if(!text.empty() && text.substr(0, 4) != string("%mfc")) + { + text = string("%mfc") + text; + } + } + + cbClientItemWrite(character, inventory, slot, text); +} /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -2647,6 +2812,7 @@ void cbClientGuildQuit( NLNET::CMessage& msgin, const std::string & serviceName, void cbClientGuildPutMoney( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId ); /// money : guild to bag void cbClientGuildTakeMoney( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId ); +void cbClientGuildItemAccess( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId ); /// outpost callbacks (implemented in guild_client_callbacks.cpp) void cbClientOutpostSetSquad(NLNET::CMessage & msgin, const std::string & serviceName, NLNET::TServiceId serviceId); @@ -3135,110 +3301,6 @@ void cbClientReturnToMainland( NLNET::CMessage& msgin, const std::string & servi } -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -// CLIENT:EVENT -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -/// returns 0 on success, anything else is error: -/// -1: Invalid inventory -/// -2: Invalid slot -/// -3: Empty slot -sint32 clientEventSetItemCustomText(CCharacter* character, INVENTORIES::TInventory inventory, uint32 slot, ucstring const& text) -{ - if (inventory==INVENTORIES::UNDEFINED) - { - return -1; - } - CInventoryPtr invent = character->getInventory(inventory); - if (slot >= invent->getSlotCount()) - { - return -2; - } - if (invent->getItem(slot) == NULL) - { - return -3; - } - - CGameItemPtr item = invent->getItem(slot); - item->setCustomText(text.toUtf8()); - // Following line was commented out by trap, reason unknown - character->incSlotVersion(inventory, slot); - - return 0; -} - -void cbClientEventSetItemCustomText( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId ) -{ - CEntityId eid; - INVENTORIES::TInventory inventory; - uint32 uiInventory; - uint32 slot; - ucstring text; - msgin.serial(eid); - msgin.serial(uiInventory); - inventory = (INVENTORIES::TInventory)uiInventory; - msgin.serial(slot); - msgin.serial(text); - - CCharacter* character = PlayerManager.getChar(eid); - if(!character) return; - - if (!character->havePriv(":DEV:SGM:GM:EM:")) - { - // it should be the crafter of the item, check - if (inventory==INVENTORIES::UNDEFINED) return; - CInventoryPtr invent = character->getInventory(inventory); - if (slot >= invent->getSlotCount()) return; - if (invent->getItem(slot) == NULL) return; - CGameItemPtr item = invent->getItem(slot); - - const NLMISC::CEntityId &crafterEId = item->getCreator(); - const NLMISC::CEntityId &userEId = character->getId(); - - if(crafterEId != userEId) - { - string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString(); - nlwarning("HACK: %s %s tries to set custom text on an item he didn't crafted", userEId.toString().c_str(), name.c_str()); - return; - } - - // text must not be too big - if(text.size() > 256) - { - string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString(); - nlwarning("HACK: %s %s tries to set custom text of a size > 256 (%d)", userEId.toString().c_str(), name.c_str(), text.size()); - return; - } - - // the item must have the good family - const CStaticItem * form = item->getStaticForm(); - if (!form) return; - ITEMFAMILY::EItemFamily family = form->Family; - if (!ITEMFAMILY::isTextCustomizable(family)) - { - string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString(); - nlwarning("HACK: %s %s tries to set custom text on a item that is not text customizable (%s)", userEId.toString().c_str(), name.c_str(), ITEMFAMILY::toString(family).c_str()); - return; - } - - // prevent use of @WEB at begin - if (text.size() >= 4 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') - text = text.substr(4, text.size() - 4); - - // force that the begin of the text for non admin is %mfc - if(!text.empty() && text.substr(0, 4) != ucstring("%mfc")) - { - text = ucstring("%mfc") + text; - } - } - - clientEventSetItemCustomText(character, inventory, slot, text); -} - - - /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// // CLIENT:TOTEM @@ -3420,6 +3482,9 @@ TUnifiedCallbackItem CbClientArray[]= { "CLIENT:ITEM:ENCHANT", cbClientItemEnchant }, { "CLIENT:ITEM:USE_ITEM", cbClientItemUseItem }, { "CLIENT:ITEM:STOP_USE_XP_CAT", cbClientItemStopUseXpCat }, + { "CLIENT:ITEM:LOCK", cbClientItemLock }, + { "CLIENT:ITEM:RENAME", cbClientItemRename }, + { "CLIENT:ITEM:WRITE", cbClientItemWrite }, { "CLIENT:ITEM_INFO:GET", cbClientItemInfos }, @@ -3589,6 +3654,7 @@ TUnifiedCallbackItem CbClientArray[]= //{ "CLIENT:GUILD:GUILD_TO_BAG", cbClientGuildToBag }, { "CLIENT:GUILD:PUT_MONEY", cbClientGuildPutMoney }, { "CLIENT:GUILD:TAKE_MONEY", cbClientGuildTakeMoney }, + { "CLIENT:GUILD:ITEM_ACCESS", cbClientGuildItemAccess }, // outpost related messages { "CLIENT:OUTPOST:SET_SQUAD", cbClientOutpostSetSquad }, @@ -3641,7 +3707,7 @@ TUnifiedCallbackItem CbClientArray[]= { "CLIENT:MISSION:WAKE", cbClientMissionWake }, { "CLIENT:MISSION:GROUP_WAKE", cbClientMissionGroupWake }, - { "CLIENT:EVENT:SET_ITEM_CUSTOM_TEXT", cbClientEventSetItemCustomText }, + // { "CLIENT:EVENT:SET_ITEM_CUSTOM_TEXT", cbClientEventSetItemCustomText }, { "CLIENT:TOTEM:BUILD", cbTotemBuild }, diff --git a/ryzom/server/src/entities_game_service/database_plr.cpp b/ryzom/server/src/entities_game_service/database_plr.cpp index 5389fde9d..5174a43bb 100644 --- a/ryzom/server/src/entities_game_service/database_plr.cpp +++ b/ryzom/server/src/entities_game_service/database_plr.cpp @@ -1204,6 +1204,10 @@ void CBankAccessor_PLR::TEXCHANGE::TGIVE::TArray::init(ICDBStructNode *parent, u nlassert(node != NULL); _USER_COLOR = node; + node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false ); + nlassert(node != NULL); + _CHARAC_BUFFS = node; + node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false ); nlassert(node != NULL); _WEIGHT = node; @@ -1287,6 +1291,10 @@ void CBankAccessor_PLR::TEXCHANGE::TRECEIVE::TArray::init(ICDBStructNode *parent nlassert(node != NULL); _USER_COLOR = node; + node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false ); + nlassert(node != NULL); + _CHARAC_BUFFS = node; + node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false ); nlassert(node != NULL); _WEIGHT = node; @@ -1498,6 +1506,10 @@ void CBankAccessor_PLR::TINVENTORY::TTEMP::TArray::init(ICDBStructNode *parent, nlassert(node != NULL); _USER_COLOR = node; + node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false ); + nlassert(node != NULL); + _CHARAC_BUFFS = node; + node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false ); nlassert(node != NULL); _WEIGHT = node; @@ -1592,6 +1604,10 @@ void CBankAccessor_PLR::TINVENTORY::TSHARE::TArray::init(ICDBStructNode *parent, nlassert(node != NULL); _USER_COLOR = node; + node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false ); + nlassert(node != NULL); + _CHARAC_BUFFS = node; + node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false ); nlassert(node != NULL); _WEIGHT = node; @@ -2144,6 +2160,10 @@ void CBankAccessor_PLR::TTRADING::TArray::init(ICDBStructNode *parent, uint inde nlassert(node != NULL); _USER_COLOR = node; + node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false ); + nlassert(node != NULL); + _CHARAC_BUFFS = node; + node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false ); nlassert(node != NULL); _WEIGHT = node; diff --git a/ryzom/server/src/entities_game_service/database_plr.h b/ryzom/server/src/entities_game_service/database_plr.h index 123e3170a..2861112c1 100644 --- a/ryzom/server/src/entities_game_service/database_plr.h +++ b/ryzom/server/src/entities_game_service/database_plr.h @@ -2785,6 +2785,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C ICDBStructNode *_QUALITY; ICDBStructNode *_QUANTITY; ICDBStructNode *_USER_COLOR; + ICDBStructNode *_CHARAC_BUFFS; ICDBStructNode *_WEIGHT; ICDBStructNode *_NAMEID; ICDBStructNode *_ENCHANT; @@ -2894,6 +2895,26 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C return _USER_COLOR; } + void setCHARAC_BUFFS(CCDBSynchronised &dbGroup, uint8 value, bool forceSending = false) + { + + + _setProp(dbGroup, _CHARAC_BUFFS, value, forceSending); + } + + uint8 getCHARAC_BUFFS(const CCDBSynchronised &dbGroup) + { + uint8 value; + _getProp(dbGroup, _CHARAC_BUFFS, value); + + return value; + } + + ICDBStructNode *getCHARAC_BUFFSCDBNode() + { + return _CHARAC_BUFFS; + } + void setWEIGHT(CCDBSynchronised &dbGroup, uint16 value, bool forceSending = false) { @@ -3105,6 +3126,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C ICDBStructNode *_QUALITY; ICDBStructNode *_QUANTITY; ICDBStructNode *_USER_COLOR; + ICDBStructNode *_CHARAC_BUFFS; ICDBStructNode *_WEIGHT; ICDBStructNode *_NAMEID; ICDBStructNode *_ENCHANT; @@ -3214,6 +3236,26 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C return _USER_COLOR; } + void setCHARAC_BUFFS(CCDBSynchronised &dbGroup, uint8 value, bool forceSending = false) + { + + + _setProp(dbGroup, _CHARAC_BUFFS, value, forceSending); + } + + uint8 getCHARAC_BUFFS(const CCDBSynchronised &dbGroup) + { + uint8 value; + _getProp(dbGroup, _CHARAC_BUFFS, value); + + return value; + } + + ICDBStructNode *getCHARAC_BUFFSCDBNode() + { + return _CHARAC_BUFFS; + } + void setWEIGHT(CCDBSynchronised &dbGroup, uint16 value, bool forceSending = false) { @@ -3758,6 +3800,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C ICDBStructNode *_QUALITY; ICDBStructNode *_QUANTITY; ICDBStructNode *_USER_COLOR; + ICDBStructNode *_CHARAC_BUFFS; ICDBStructNode *_WEIGHT; ICDBStructNode *_NAMEID; ICDBStructNode *_ENCHANT; @@ -3867,6 +3910,26 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C return _USER_COLOR; } + void setCHARAC_BUFFS(CCDBSynchronised &dbGroup, uint8 value, bool forceSending = false) + { + + + _setProp(dbGroup, _CHARAC_BUFFS, value, forceSending); + } + + uint8 getCHARAC_BUFFS(const CCDBSynchronised &dbGroup) + { + uint8 value; + _getProp(dbGroup, _CHARAC_BUFFS, value); + + return value; + } + + ICDBStructNode *getCHARAC_BUFFSCDBNode() + { + return _CHARAC_BUFFS; + } + void setWEIGHT(CCDBSynchronised &dbGroup, uint16 value, bool forceSending = false) { @@ -4120,6 +4183,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C ICDBStructNode *_QUALITY; ICDBStructNode *_QUANTITY; ICDBStructNode *_USER_COLOR; + ICDBStructNode *_CHARAC_BUFFS; ICDBStructNode *_WEIGHT; ICDBStructNode *_NAMEID; ICDBStructNode *_ENCHANT; @@ -4231,6 +4295,26 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C return _USER_COLOR; } + void setCHARAC_BUFFS(CCDBSynchronised &dbGroup, uint8 value, bool forceSending = false) + { + + + _setProp(dbGroup, _CHARAC_BUFFS, value, forceSending); + } + + uint8 getCHARAC_BUFFS(const CCDBSynchronised &dbGroup) + { + uint8 value; + _getProp(dbGroup, _CHARAC_BUFFS, value); + + return value; + } + + ICDBStructNode *getCHARAC_BUFFSCDBNode() + { + return _CHARAC_BUFFS; + } + void setWEIGHT(CCDBSynchronised &dbGroup, uint16 value, bool forceSending = false) { @@ -5763,6 +5847,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C ICDBStructNode *_QUALITY; ICDBStructNode *_QUANTITY; ICDBStructNode *_USER_COLOR; + ICDBStructNode *_CHARAC_BUFFS; ICDBStructNode *_WEIGHT; ICDBStructNode *_NAMEID; ICDBStructNode *_ENCHANT; @@ -5883,6 +5968,26 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C return _USER_COLOR; } + void setCHARAC_BUFFS(CCDBSynchronised &dbGroup, uint8 value, bool forceSending = false) + { + + + _setProp(dbGroup, _CHARAC_BUFFS, value, forceSending); + } + + uint8 getCHARAC_BUFFS(const CCDBSynchronised &dbGroup) + { + uint8 value; + _getProp(dbGroup, _CHARAC_BUFFS, value); + + return value; + } + + ICDBStructNode *getCHARAC_BUFFSCDBNode() + { + return _CHARAC_BUFFS; + } + void setWEIGHT(CCDBSynchronised &dbGroup, uint16 value, bool forceSending = false) { diff --git a/ryzom/server/src/entities_game_service/game_item_manager/player_inventory.cpp b/ryzom/server/src/entities_game_service/game_item_manager/player_inventory.cpp index df028744b..38812d67c 100644 --- a/ryzom/server/src/entities_game_service/game_item_manager/player_inventory.cpp +++ b/ryzom/server/src/entities_game_service/game_item_manager/player_inventory.cpp @@ -1089,7 +1089,7 @@ void CCharacterInvView::updateClientSlot(uint32 slot, const CGameItemPtr item) itemSlot.setItemProp( INVENTORIES::UserColor, item->color() ); itemSlot.setItemProp( INVENTORIES::Buffs, item->buffFlags() ); itemSlot.setItemProp( INVENTORIES::Locked, item->getLockCount() ); - itemSlot.setItemProp( INVENTORIES::Access, item->getAccessGrade() ); + itemSlot.setItemProp( INVENTORIES::Access, 0 ); // don't care here itemSlot.setItemProp( INVENTORIES::Weight, item->weight() / 10 ); itemSlot.setItemProp( INVENTORIES::NameId, item->sendNameId(getCharacter()) ); itemSlot.setItemProp( INVENTORIES::Enchant, item->getClientEnchantValue() ); diff --git a/ryzom/server/src/entities_game_service/guild_manager/guild_client_callbacks.cpp b/ryzom/server/src/entities_game_service/guild_manager/guild_client_callbacks.cpp index 449a8a786..b0e85e8c4 100644 --- a/ryzom/server/src/entities_game_service/guild_manager/guild_client_callbacks.cpp +++ b/ryzom/server/src/entities_game_service/guild_manager/guild_client_callbacks.cpp @@ -237,6 +237,33 @@ void cbClientGuildTakeMoney( NLNET::CMessage& msgin, const std::string & service guild->takeMoney( character, money ,session ); } +void cbClientGuildItemAccess(NLNET::CMessage &msgin, const std::string &serviceName, NLNET::TServiceId serviceId) +{ + CEntityId eid; + // INVENTORIES::TInventory inventory; + uint16 slot; + EGSPD::CGuildGrade::TGuildGrade grade; + msgin.serial(eid); + // msgin.serialShortEnum(inventory); + msgin.serial(slot); + msgin.serialShortEnum(grade); + + CCharacter *character = PlayerManager.getChar(eid); + DROP_IF(!character, "Character not found", return); + // DROP_IF(inventory == INVENTORIES::UNDEFINED, "Inventory is undefined", return); + + CInventoryPtr invent = character->getInventory(INVENTORIES::guild); + DROP_IF(slot >= invent->getSlotCount(), "Invalid slot specified", return); + CGameItemPtr item = invent->getItem(slot); + DROP_IF(item == NULL, "Item does not exist", return); + + CGuild *guild = CGuildManager::getInstance()->getGuildFromId(character->getGuildId()); + bool hasAccess = guild->getMemberFromEId(eid)->getGrade() <= item->getAccessGrade(); + DROP_IF(!hasAccess, "Character does not have the right grade to change access rights on this item", return); + + item->setAccessGrade(grade); +} + #undef GET_CHAR #undef GET_GUILD_MODULE