Compare commits

..

10 Commits

Author SHA1 Message Date
Nuno Gonçalves (Ulukyn) 7df9b2f255 Merge branch '58-add-rotz-roty-and-dist-reflect-lua-to-3dcamera-of-a-scene' into 'main/gingo-test'
Resolve "Add rotz roty and dist reflect lua to 3DCamera of a scene"

See merge request ryzom/ryzom-core!48
3 years ago
Nuno Gonçalves (Ulukyn) 8697553956 Resolve "Add rotz roty and dist reflect lua to 3DCamera of a scene" 3 years ago
nimetu d2508c8b15 Update hunter to 0.23.321 3 years ago
Nuno Gonçalves (Ulukyn) d385dedabc Merge branch '56-message-bubble-is-very-high-on-fh-alarm-plants' into 'main/gingo-test'
Resolve "Message bubble is very high on FH alarm plants"

See merge request ryzom/ryzom-core!45
3 years ago
Nuno Gonçalves (Ulukyn) ae33eb99bf Resolve "Message bubble is very high on FH alarm plants" 3 years ago
Nuno Gonçalves (Ulukyn) 2b88fd66ba Merge branch '46-rework-item-buff-icon-placement' into 'main/gingo-test'
Hide 1x quantity for equipable items, dynamic buff icon placement

See merge request ryzom/ryzom-core!43
3 years ago
Ben Saine be5bfd992c Hide 1x quantity for equipable items, dynamic buff icon placement 3 years ago
Nuno Gonçalves (Ulukyn) 9a24e7557f Merge branch '54-improve-the-way-to-reskin-ryzhome-items-and-preview' into 'main/gingo-test'
Resolve "Improve the way to reskin ryzhome items and preview"

See merge request ryzom/ryzom-core!44
3 years ago
Nuno Gonçalves (Ulukyn) 8708fd74c6 Resolve "Improve the way to reskin ryzhome items and preview" 3 years ago
Nuno db86219eab Added NL_NO_ASSERT to remove asserts in server 3 years ago

@ -41,8 +41,8 @@ OPTION(HUNTER_ENABLED "Enable Hunter package manager" OFF)
IF(HUNTER_ENABLED) IF(HUNTER_ENABLED)
INCLUDE("CMakeModules/HunterGate.cmake") INCLUDE("CMakeModules/HunterGate.cmake")
HunterGate( HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.317.tar.gz" URL "https://github.com/cpp-pm/hunter/archive/v0.23.321.tar.gz"
SHA1 "fbdd94b1966d351384e27b02c8d134915b1131d6" SHA1 "5e53cbb0429037ea8e2592bfd92704b8ff3ab492"
FILEPATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules/HunterConfig.cmake" FILEPATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules/HunterConfig.cmake"
) )

@ -380,7 +380,7 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
#define nlassume(exp) do { } while (0) #define nlassume(exp) do { } while (0)
#endif #endif
#ifdef NL_NO_DEBUG #ifdef NL_NO_ASSERT
# define nlassert(exp) nlassume(exp) # define nlassert(exp) nlassume(exp)
# define nlassertonce(exp) nlassume(exp) # define nlassertonce(exp) nlassume(exp)
# define nlassertex(exp, str) nlassume(exp) # define nlassertex(exp, str) nlassume(exp)

@ -274,7 +274,7 @@
//#define NL_NO_DEBUG //#define NL_NO_DEBUG
#undef NL_NO_DEBUG #undef NL_NO_DEBUG
#define NL_NO_ASSERT
// Standard types // Standard types

@ -6274,6 +6274,11 @@ void CCharacterCL::updateVisiblePostPos(const NLMISC::TTime &currentTimeInMs, CE
pos = (box().getMin() + box().getMax())/2; pos = (box().getMin() + box().getMax())/2;
pos.z = box().getMax().z; pos.z = box().getMax().z;
} }
CRaceStatsSheet *sheet = const_cast<CRaceStatsSheet*>(UserEntity->playerSheet());
float namePosZ = sheet->GenderInfos[UserEntity->getGender()].NamePosZNormal;
if (pos.z > box().getMin().z + namePosZ)
pos.z = box().getMin().z + namePosZ;
nlassert(isValidDouble(pos.x) && isValidDouble(pos.y) && isValidDouble(pos.z)); nlassert(isValidDouble(pos.x) && isValidDouble(pos.y) && isValidDouble(pos.z));
_CurrentBubble->Position = pos; _CurrentBubble->Position = pos;
} }

@ -1079,6 +1079,7 @@ class CCanDropToExchange : public IActionHandler
}; };
REGISTER_ACTION_HANDLER (CCanDropToExchange, "can_drop_to_exchange"); REGISTER_ACTION_HANDLER (CCanDropToExchange, "can_drop_to_exchange");
// ********************************************************************************************************** // **********************************************************************************************************
/** Clear the selected sheet /** Clear the selected sheet
@ -2461,57 +2462,6 @@ class CHandlerRingXpCatalyserStopUse : public IActionHandler
}; };
REGISTER_ACTION_HANDLER( CHandlerRingXpCatalyserStopUse, "ring_xp_catalyser_stop_use" ); REGISTER_ACTION_HANDLER( CHandlerRingXpCatalyserStopUse, "ring_xp_catalyser_stop_use" );
// ***************************************************************************
class CHandlerUseHotbarItem : public IActionHandler
{
void execute(CCtrlBase * /* pCaller */, const std::string &sParams)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
sint64 slot;
if (!CInterfaceExpr::evalAsInt(getParam(sParams, "slot"), slot))
{
nlwarning("<CHandlerUseHotbarItem::execute> Can't retrieve counter.");
return;
}
if (slot > INVENTORIES::NbHotbarSlots) {
nlwarning("<CHandlerUseHotbarItem::execute> Slot out of range.");
return;
}
CDBCtrlSheet *pCS = getInventory().getHotbarSheet(slot);
if (!pCS)
{
nlwarning("<CHandlerUseHotbarItem::execute> Can't retrieve sheet.");
return;
}
const CItemSheet *pIS = pCS->asItemSheet();
if (!pIS)
{
nlwarning("<CHandlerUseHotbarItem::execute> Can't retrieve item.");
return;
}
ITEMFAMILY::EItemFamily fam = pIS->Family;
if (!getInventory().isUsableItem(pCS->getSheetId())) {
nlwarning("<CHandlerUseHotbarItem::execute> Item is not usable.");
return;
}
if (fam == ITEMFAMILY::ITEM_SAP_RECHARGE || fam == ITEMFAMILY::CRYSTALLIZED_SPELL)
{
sendToServerEnchantMessage((uint8)pCS->getInventoryIndex(), (uint16)pCS->getIndexInDB());
}
else if (fam == ITEMFAMILY::CONSUMABLE || fam == ITEMFAMILY::XP_CATALYSER)
{
sendMsgUseItem(uint16(pCS->getIndexInDB()));
}
}
};
REGISTER_ACTION_HANDLER( CHandlerUseHotbarItem, "use_hotbar_item" );
// *************************************************************************** // ***************************************************************************
// item groups // item groups

@ -309,7 +309,6 @@ CCtrlSheetInfo::CCtrlSheetInfo()
_InterfaceColor= true; _InterfaceColor= true;
_SheetSelectionGroup = -1; _SheetSelectionGroup = -1;
_UseQuality = true; _UseQuality = true;
_DisplayItemQuality = true;
_UseQuantity = true; _UseQuantity = true;
_DuplicateOnDrag = false; _DuplicateOnDrag = false;
_ItemSlot= SLOTTYPE::UNDEFINED; _ItemSlot= SLOTTYPE::UNDEFINED;
@ -1277,6 +1276,9 @@ void CDBCtrlSheet::setupItem ()
sint32 sheet = _SheetId.getSInt32(); sint32 sheet = _SheetId.getSInt32();
_DispQuality = -1;
_DispQuantity = -1;
// If this is the same sheet, need to resetup // If this is the same sheet, need to resetup
if (_LastSheetId != sheet || _NeedSetup) if (_LastSheetId != sheet || _NeedSetup)
{ {
@ -1290,13 +1292,6 @@ void CDBCtrlSheet::setupItem ()
{ {
_ItemSheet = (CItemSheet*)pES; _ItemSheet = (CItemSheet*)pES;
// Display the item quality?
_DisplayItemQuality= _UseQuality &&
_ItemSheet->Family != ITEMFAMILY::COSMETIC &&
_ItemSheet->Family != ITEMFAMILY::TELEPORT &&
_ItemSheet->Family != ITEMFAMILY::SERVICE
;
_DispSheetBmpId = rVR.getTextureIdFromName (_ItemSheet->getIconMain()); _DispSheetBmpId = rVR.getTextureIdFromName (_ItemSheet->getIconMain());
// if file not found or empty, replace by default icon // if file not found or empty, replace by default icon
if( _DispSheetBmpId == -1) if( _DispSheetBmpId == -1)
@ -1350,21 +1345,11 @@ void CDBCtrlSheet::setupItem ()
_DispQuantity = _Quantity.getSInt32(); _DispQuantity = _Quantity.getSInt32();
} }
} }
else
// do not display any number
_DispQuantity = -1;
} }
else _DispQuantity = -1;
// Setup quality // Setup quality
if(_DisplayItemQuality) if(_UseQuality)
{
_DispQuality= _Quality.getSInt32(); _DispQuality= _Quality.getSInt32();
}
else
{
_DispQuality= -1;
}
// special icon text // special icon text
if( _NeedSetup || _ItemSheet->getIconText() != _OptString ) if( _NeedSetup || _ItemSheet->getIconText() != _OptString )
@ -1403,7 +1388,7 @@ void CDBCtrlSheet::setupItem ()
} }
// update quality. NB: if quality change, the must updateItemCharacRequirement // update quality. NB: if quality change, the must updateItemCharacRequirement
if(_DisplayItemQuality) if(_UseQuality)
{ {
sint32 newQuality= _Quality.getSInt32(); sint32 newQuality= _Quality.getSInt32();
if(newQuality!=_DispQuality) if(newQuality!=_DispQuality)
@ -1412,10 +1397,6 @@ void CDBCtrlSheet::setupItem ()
updateItemCharacRequirement(_LastSheetId); updateItemCharacRequirement(_LastSheetId);
} }
} }
else
{
_DispQuality= -1;
}
// update armour color (if USER_COLOR db change comes after SHEET change) // update armour color (if USER_COLOR db change comes after SHEET change)
if(_ArmourColorFromDB && _UserColor) if(_ArmourColorFromDB && _UserColor)
@ -1428,6 +1409,31 @@ void CDBCtrlSheet::setupItem ()
} }
} }
if (_ItemSheet != NULL)
{
switch(_ItemSheet->Family)
{
case ITEMFAMILY::ARMOR:
case ITEMFAMILY::MELEE_WEAPON:
case ITEMFAMILY::RANGE_WEAPON:
case ITEMFAMILY::SHIELD:
case ITEMFAMILY::JEWELRY:
case ITEMFAMILY::CRAFTING_TOOL:
case ITEMFAMILY::HARVEST_TOOL:
case ITEMFAMILY::TAMING_TOOL:
case ITEMFAMILY::TRAINING_TOOL:
// hide 'x0' and 'x1' stack count for equipable items
if (_DispQuantity < 2)
_DispQuantity = -1;
break;
default:
// hide 'q0'and 'q1' quality for every other item
if (_DispQuality < 2)
_DispQuality = -1;
break;
}
}
// at each frame, must test for grayed. // at each frame, must test for grayed.
if(_AutoGrayed) if(_AutoGrayed)
{ {
@ -1893,8 +1899,6 @@ void CDBCtrlSheet::setupOutpostBuilding()
{ {
COutpostBuildingSheet *pOBSheet = (COutpostBuildingSheet*)pES; COutpostBuildingSheet *pOBSheet = (COutpostBuildingSheet*)pES;
_DisplayItemQuality = false;
_DispSheetBmpId = rVR.getTextureIdFromName (pOBSheet->getIconMain()); _DispSheetBmpId = rVR.getTextureIdFromName (pOBSheet->getIconMain());
// if file not found or empty, replace by default icon // if file not found or empty, replace by default icon
if( _DispSheetBmpId == -1) if( _DispSheetBmpId == -1)
@ -2535,7 +2539,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
sint32 hArea = (hSheet / 4); sint32 hArea = (hSheet / 4);
sint32 xIcon = x; sint32 xIcon = x;
// move buff icons up a row, quantity text is displayed on bottom-left corner // move buff icons up a row, quantity text is displayed on bottom-left corner
sint32 yIcon = y + hArea; sint32 yIcon = y + (_DispQuantity > 0 ? hArea : 0);
for (uint i = 0; i < _BuffIcons.size(); ++i) for (uint i = 0; i < _BuffIcons.size(); ++i)
{ {
sint32 wIcon = _BuffIcons[i].IconW; sint32 wIcon = _BuffIcons[i].IconW;

@ -164,7 +164,6 @@ public:
bool _UseQuantity : 1; // is the quantity read and displayed ? bool _UseQuantity : 1; // is the quantity read and displayed ?
bool _ReadQuantityFromSheet : 1; // Read quantity from sheet rather than from database bool _ReadQuantityFromSheet : 1; // Read quantity from sheet rather than from database
bool _UseQuality : 1; // is the quality read and displayed ? bool _UseQuality : 1; // is the quality read and displayed ?
bool _DisplayItemQuality : 1; // Do we have to display the quality for the item (false for Cosmetics and Teleport and if _UseQuality==fasle)?
bool _DuplicateOnDrag : 1; // when dragged, the item is shown twice : one version at the mouse position. bool _DuplicateOnDrag : 1; // when dragged, the item is shown twice : one version at the mouse position.
// and another in the source slot. Useful for items to buy that are in infinite quantity. // and another in the source slot. Useful for items to buy that are in infinite quantity.
bool _AutoGrayed : 1; // if true then gray the ctrlSheeet if: 1/ Items: Is the Item Locked. 2/ Bricks: is the brick Latent. bool _AutoGrayed : 1; // if true then gray the ctrlSheeet if: 1/ Items: Is the Item Locked. 2/ Bricks: is the brick Latent.

@ -1437,6 +1437,34 @@ void CInterface3DShape::setName (const std::string &ht)
} }
} }
std::string CInterface3DShape::getTextures() const
{
return _Textures;
}
void CInterface3DShape::setTextures(const std::string &textures)
{
if (textures.empty())
return;
_Textures = textures;
vector<string> texList;
splitString(textures, " ", texList);
for(uint j=0;j<_Instance.getNumMaterials();j++)
{
sint numStages = _Instance.getMaterial(j).getLastTextureStage() + 1;
for(sint l = 0; l < numStages; l++)
{
if (_Instance.getMaterial(j).isTextureFile((uint) l))
{
_Instance.getMaterial(j).setTextureFileName(texList[std::min((int)j, (int)texList.size()-1)], (uint) l);
}
}
}
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// CInterface3DCamera // CInterface3DCamera
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

@ -265,11 +265,15 @@ public:
std::string getName() const; std::string getName() const;
void setName (const std::string &ht); void setName (const std::string &ht);
std::string getTextures() const;
void setTextures (const std::string &textures);
float getBBoxSizeX () const; float getBBoxSizeX () const;
float getBBoxSizeY () const; float getBBoxSizeY () const;
float getBBoxSizeZ () const; float getBBoxSizeZ () const;
REFLECT_EXPORT_START(CInterface3DShape, CInterfaceElement) REFLECT_EXPORT_START(CInterface3DShape, CInterfaceElement)
REFLECT_FLOAT("getBBoxSizeX", getBBoxSizeX, setPosX); REFLECT_FLOAT("getBBoxSizeX", getBBoxSizeX, setPosX);
REFLECT_FLOAT("getBBoxSizeY", getBBoxSizeY, setPosX); REFLECT_FLOAT("getBBoxSizeY", getBBoxSizeY, setPosX);
@ -281,6 +285,7 @@ public:
REFLECT_FLOAT ("roty", getRotY, setRotY); REFLECT_FLOAT ("roty", getRotY, setRotY);
REFLECT_FLOAT ("rotz", getRotZ, setRotZ); REFLECT_FLOAT ("rotz", getRotZ, setRotZ);
REFLECT_STRING ("name", getName, setName); REFLECT_STRING ("name", getName, setName);
REFLECT_STRING("textures", getTextures, setTextures);
REFLECT_EXPORT_END REFLECT_EXPORT_END
protected: protected:
@ -289,6 +294,7 @@ protected:
NLMISC::CVector _Pos; NLMISC::CVector _Pos;
NLMISC::CVector _Rot; NLMISC::CVector _Rot;
std::string _Name; std::string _Name;
std::string _Textures;
}; };
/** /**
@ -397,6 +403,15 @@ public:
float getTgtY() const { return _Target.y; } float getTgtY() const { return _Target.y; }
float getTgtZ() const { return _Target.z; } float getTgtZ() const { return _Target.z; }
float getRotZ() const { return _Rot.z; }
void setRotZ(float f) { _Rot.z = f; }
float getRotY() const { return _Rot.y; }
void setRotY(float f) { _Rot.y = f; }
float getDist() const { return _Dist; }
void setDist(float f) { _Dist = f; }
REFLECT_EXPORT_START(CInterface3DCamera, CInterfaceElement) REFLECT_EXPORT_START(CInterface3DCamera, CInterfaceElement)
REFLECT_FLOAT ("posx", getPosX, setPosX); REFLECT_FLOAT ("posx", getPosX, setPosX);
REFLECT_FLOAT ("posy", getPosY, setPosY); REFLECT_FLOAT ("posy", getPosY, setPosY);
@ -404,19 +419,13 @@ public:
REFLECT_FLOAT ("tgtx", getTgtX, setTgtX); REFLECT_FLOAT ("tgtx", getTgtX, setTgtX);
REFLECT_FLOAT ("tgty", getTgtY, setTgtY); REFLECT_FLOAT ("tgty", getTgtY, setTgtY);
REFLECT_FLOAT ("tgtz", getTgtZ, setTgtZ); REFLECT_FLOAT ("tgtz", getTgtZ, setTgtZ);
REFLECT_FLOAT ("rotz", getRotZ, setRotZ);
REFLECT_FLOAT ("roty", getRotY, setRotY);
REFLECT_FLOAT ("dist", getDist, setDist);
REFLECT_FLOAT ("fov", getFOV, setFOV); REFLECT_FLOAT ("fov", getFOV, setFOV);
REFLECT_FLOAT ("roll", getRoll, setRoll); REFLECT_FLOAT ("roll", getRoll, setRoll);
REFLECT_EXPORT_END REFLECT_EXPORT_END
float getRotZ() const { return _Rot.z; }
void setRotZ(float f) { _Rot.z = f; }
float getRotY() const { return _Rot.y; }
void setRotY(float f) { _Rot.y = f; }
float getDist() const { return _Dist; }
void setDist(float f) { _Dist = f; }
void reset(); // Reset user interaction void reset(); // Reset user interaction
protected: protected:

@ -74,7 +74,6 @@ CInventoryManager *CInventoryManager::_Instance = NULL;
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetBag, std::string, "list_sheet_bag"); NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetBag, std::string, "list_sheet_bag");
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupIconListBag, std::string, "list_icon_bag"); NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupIconListBag, std::string, "list_icon_bag");
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetFilterCLMSlot, std::string, "list_sheet_filter_clm_slot"); NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetFilterCLMSlot, std::string, "list_sheet_filter_clm_slot");
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetFilterHotbarSlot, std::string, "list_sheet_filter_hotbar_slot");
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetFilterExchangeable, std::string, "list_sheet_filter_exchangeable"); NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetFilterExchangeable, std::string, "list_sheet_filter_exchangeable");
// *************************************************************************** // ***************************************************************************
@ -315,8 +314,6 @@ CInventoryManager::CInventoryManager()
{ {
Hands[i] = ServerHands[i] = 0; Hands[i] = ServerHands[i] = 0;
UIHands[i] = NULL; UIHands[i] = NULL;
UIHands2[i] = NULL;
UIHands3[i] = NULL;
} }
for (i = 0; i < MAX_EQUIPINV_ENTRIES; ++i) for (i = 0; i < MAX_EQUIPINV_ENTRIES; ++i)
@ -326,14 +323,6 @@ CInventoryManager::CInventoryManager()
UIEquip2[i] = NULL; UIEquip2[i] = NULL;
} }
for (i = 0; i < MAX_HOTBARINV_ENTRIES; ++i)
{
Hotbar[i] = ServerHotbar[i] = 0;
UIHotbar[i] = NULL;
UIHotbar2[i] = NULL;
UIHotbar3[i] = NULL;
}
for (i = 0; i < MAX_BAGINV_ENTRIES; i++) for (i = 0; i < MAX_BAGINV_ENTRIES; i++)
{ {
BagItemEquipped[i]= false; BagItemEquipped[i]= false;
@ -401,16 +390,6 @@ CItemImage *CInventoryManager::getEquipItem(uint index)
return NULL; return NULL;
} }
// *************************************************************************************************
CItemImage *CInventoryManager::getHotbarItem(uint index)
{
nlassert(index < MAX_HOTBARINV_ENTRIES);
if (Hotbar[index] != 0)
return &Bag[Hotbar[index]];
else
return NULL;
}
// ************************************************************************************************* // *************************************************************************************************
CDBCtrlSheet *CInventoryManager::getHandSheet(uint index) CDBCtrlSheet *CInventoryManager::getHandSheet(uint index)
{ {
@ -423,11 +402,6 @@ CDBCtrlSheet *CInventoryManager::getEquipSheet(uint index)
return UIEquip[index]; return UIEquip[index];
} }
// *************************************************************************************************
CDBCtrlSheet *CInventoryManager::getHotbarSheet(uint index)
{
return UIHotbar[index];
}
// ************************************************************************************************* // *************************************************************************************************
CItemImage &CInventoryManager::getServerBagItem(uint index) CItemImage &CInventoryManager::getServerBagItem(uint index)
@ -506,7 +480,6 @@ void CInventoryManager::init()
Money = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":MONEY"); Money = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":MONEY");
initIndirection (LOCAL_INVENTORY ":HAND:", Hands, MAX_HANDINV_ENTRIES, true); initIndirection (LOCAL_INVENTORY ":HAND:", Hands, MAX_HANDINV_ENTRIES, true);
initIndirection (LOCAL_INVENTORY ":EQUIP:", Equip, MAX_EQUIPINV_ENTRIES, true); initIndirection (LOCAL_INVENTORY ":EQUIP:", Equip, MAX_EQUIPINV_ENTRIES, true);
initIndirection (LOCAL_INVENTORY ":HOTBAR:", Hotbar, MAX_HOTBARINV_ENTRIES, true);
// Init observers for auto equipment // Init observers for auto equipment
{ {
for (uint i = 0; i < MAX_BAGINV_ENTRIES; ++i) for (uint i = 0; i < MAX_BAGINV_ENTRIES; ++i)
@ -554,15 +527,6 @@ void CInventoryManager::init()
UIEquip[SLOT_EQUIPMENT::LEGS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_LEGS)); UIEquip[SLOT_EQUIPMENT::LEGS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_LEGS));
UIEquip[SLOT_EQUIPMENT::HANDS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_HANDS)); UIEquip[SLOT_EQUIPMENT::HANDS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_HANDS));
UIHotbar[0] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR_1));
UIHotbar[1] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR_2));
UIHotbar[2] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR_3));
UIHotbar[3] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR_4));
UIHotbar[4] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR_5));
UIHands2[0] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND2_RIGHT));
UIHands2[1] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND2_LEFT));
UIEquip2[SLOT_EQUIPMENT::HEADDRESS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_HEADDRESS)); UIEquip2[SLOT_EQUIPMENT::HEADDRESS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_HEADDRESS));
UIEquip2[SLOT_EQUIPMENT::EARL] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_EARING_LEFT)); UIEquip2[SLOT_EQUIPMENT::EARL] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_EARING_LEFT));
UIEquip2[SLOT_EQUIPMENT::EARR] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_EARING_RIGHT)); UIEquip2[SLOT_EQUIPMENT::EARR] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_EARING_RIGHT));
@ -581,20 +545,6 @@ void CInventoryManager::init()
UIEquip2[SLOT_EQUIPMENT::LEGS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_LEGS)); UIEquip2[SLOT_EQUIPMENT::LEGS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_LEGS));
UIEquip2[SLOT_EQUIPMENT::HANDS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_HANDS)); UIEquip2[SLOT_EQUIPMENT::HANDS] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_HANDS));
UIHotbar2[0] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR2_1));
UIHotbar2[1] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR2_2));
UIHotbar2[2] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR2_3));
UIHotbar2[3] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR2_4));
UIHotbar2[4] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR2_5));
UIHands3[0] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND3_RIGHT));
UIHands3[1] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND3_LEFT));
UIHotbar3[0] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR3_1));
UIHotbar3[1] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR3_2));
UIHotbar3[2] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR3_3));
UIHotbar3[3] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR3_4));
UIHotbar3[4] = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HOTBAR3_5));
// Init ItemInfoObservers // Init ItemInfoObservers
{ {
@ -708,14 +658,6 @@ std::string CInventoryManager::getDBIndexPath(CDBCtrlSheet *pCS)
{ {
return string(LOCAL_INVENTORY) + ":HAND:" + toString(i); return string(LOCAL_INVENTORY) + ":HAND:" + toString(i);
} }
if (UIHands2[i] == pCS)
{
return string(LOCAL_INVENTORY) + ":HAND:" + toString(i);
}
if (UIHands3[i] == pCS)
{
return string(LOCAL_INVENTORY) + ":HAND:" + toString(i);
}
} }
for (i = 0; i < MAX_EQUIPINV_ENTRIES; ++i) for (i = 0; i < MAX_EQUIPINV_ENTRIES; ++i)
@ -729,23 +671,6 @@ std::string CInventoryManager::getDBIndexPath(CDBCtrlSheet *pCS)
return string(LOCAL_INVENTORY) + ":EQUIP:" + toString(i); return string(LOCAL_INVENTORY) + ":EQUIP:" + toString(i);
} }
} }
for (i = 0; i < MAX_HOTBARINV_ENTRIES; ++i)
{
if (UIHotbar[i] == pCS)
{
return string(LOCAL_INVENTORY) + ":HOTBAR:" + toString(i);
}
if (UIHotbar2[i] == pCS)
{
return string(LOCAL_INVENTORY) + ":HOTBAR:" + toString(i);
}
if (UIHotbar3[i] == pCS)
{
return string(LOCAL_INVENTORY) + ":HOTBAR:" + toString(i);
}
}
return ""; return "";
} }
@ -833,20 +758,6 @@ bool CInventoryManager::isForageToolItem(uint32 sheetID)
return result; return result;
} }
// ***************************************************************************
bool CInventoryManager::isUsableItem(uint32 sheetID)
{
bool result = false;
CEntitySheet *sheet= SheetMngr.get(CSheetId(sheetID));
if(sheet && sheet->type()== CEntitySheet::ITEM)
{
CItemSheet *item= (CItemSheet*)sheet;
if( ITEMFAMILY::isUsable(item->Family) )
result = true;
}
return result;
}
// *************************************************************************** // ***************************************************************************
uint32 CInventoryManager::getHandItemSheet( bool rightHand ) const uint32 CInventoryManager::getHandItemSheet( bool rightHand ) const
{ {
@ -1046,11 +957,6 @@ void CInventoryManager::equip(const std::string &bagPath, const std::string &inv
inventory = INVENTORIES::equipment; inventory = INVENTORIES::equipment;
fromString(invPath.substr(22,invPath.size()), invSlot); fromString(invPath.substr(22,invPath.size()), invSlot);
} }
else if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0)
{
inventory = INVENTORIES::hotbar;
fromString(invPath.substr(23,invPath.size()), invSlot);
}
// Hands management : check if we have to unequip left hand because of incompatibility with right hand item // Hands management : check if we have to unequip left hand because of incompatibility with right hand item
sint16 oldRightIndexInBag = NLGUI::CDBManager::getInstance()->getDbProp(invPath + ":INDEX_IN_BAG")->getValue16(); sint16 oldRightIndexInBag = NLGUI::CDBManager::getInstance()->getDbProp(invPath + ":INDEX_IN_BAG")->getValue16();
@ -1184,11 +1090,6 @@ void CInventoryManager::unequip(const std::string &invPath)
inventory = INVENTORIES::equipment; inventory = INVENTORIES::equipment;
fromString(invPath.substr(22,invPath.size()), invSlot); fromString(invPath.substr(22,invPath.size()), invSlot);
} }
else if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0)
{
inventory = INVENTORIES::hotbar;
fromString(invPath.substr(23,invPath.size()), invSlot);
}
// Hands management : check if we have to unequip left hand because of incompatibility with right hand item // Hands management : check if we have to unequip left hand because of incompatibility with right hand item
if (inventory == INVENTORIES::handling && invSlot == 0) if (inventory == INVENTORIES::handling && invSlot == 0)
@ -1275,7 +1176,7 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
string sTmp = node->getFullName(); string sTmp = node->getFullName();
string sIE, sIE2, sIE3; // Interface Element string sIE, sIE2; // Interface Element
CCDBNodeLeaf *pNL = dynamic_cast<CCDBNodeLeaf*>(node); CCDBNodeLeaf *pNL = dynamic_cast<CCDBNodeLeaf*>(node);
if (pNL == NULL) return; if (pNL == NULL) return;
if (strnicmp(sTmp.c_str(),"LOCAL:INVENTORY:HAND",20) == 0) if (strnicmp(sTmp.c_str(),"LOCAL:INVENTORY:HAND",20) == 0)
@ -1285,16 +1186,10 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node)
sTmp = sTmp.substr(0,sTmp.rfind(':')); sTmp = sTmp.substr(0,sTmp.rfind(':'));
sint index; sint index;
fromString(sTmp, index); fromString(sTmp, index);
if (index == 0) { if (index == 0)
sIE = CTRL_HAND_RIGHT; sIE = CTRL_HAND_RIGHT;
sIE2 = CTRL_HAND2_RIGHT; else
sIE3 = CTRL_HAND3_RIGHT;
}
else {
sIE = CTRL_HAND_LEFT; sIE = CTRL_HAND_LEFT;
sIE2 = CTRL_HAND2_LEFT;
sIE3 = CTRL_HAND3_LEFT;
}
// update Hands. // update Hands.
getInventory().Hands[index]= pNL->getValue16(); getInventory().Hands[index]= pNL->getValue16();
} }
@ -1350,49 +1245,11 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node)
// update Equips. // update Equips.
getInventory().Equip[index]= pNL->getValue16(); getInventory().Equip[index]= pNL->getValue16();
} }
else if (strnicmp(sTmp.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0)
{
// Coming from hand
sTmp = sTmp.substr(23,sTmp.size());
sTmp = sTmp.substr(0,sTmp.rfind(':'));
sint index;
fromString(sTmp, index);
switch (index) {
case 0:
sIE = CTRL_HOTBAR_1;
sIE2 = CTRL_HOTBAR2_1;
sIE3 = CTRL_HOTBAR3_1;
break;
case 1:
sIE = CTRL_HOTBAR_2;
sIE2 = CTRL_HOTBAR2_2;
sIE3 = CTRL_HOTBAR3_2;
break;
case 2:
sIE = CTRL_HOTBAR_3;
sIE2 = CTRL_HOTBAR2_3;
sIE3 = CTRL_HOTBAR3_3;
break;
case 3:
sIE = CTRL_HOTBAR_4;
sIE2 = CTRL_HOTBAR2_4;
sIE3 = CTRL_HOTBAR3_4;
break;
case 4:
sIE = CTRL_HOTBAR_5;
sIE2 = CTRL_HOTBAR2_5;
sIE3 = CTRL_HOTBAR3_5;
break;
}
// update Hotbar.
getInventory().Hotbar[index]= pNL->getValue16();
}
else return; else return;
// Set database for wearing the right item // Set database for wearing the right item
CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(sIE)); CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(sIE));
CDBCtrlSheet *pCS2 = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(sIE2)); CDBCtrlSheet *pCS2 = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(sIE2));
CDBCtrlSheet *pCS3 = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(sIE3));
// Remove Last reference and update database // Remove Last reference and update database
sint16 oldVal = pNL->getOldValue16(); sint16 oldVal = pNL->getOldValue16();
@ -1411,14 +1268,12 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node)
{ {
if (pCS != NULL) pCS->setSheet(""); if (pCS != NULL) pCS->setSheet("");
if (pCS2 != NULL) pCS2->setSheet(""); if (pCS2 != NULL) pCS2->setSheet("");
if (pCS3 != NULL) pCS3->setSheet("");
} }
} }
else else
{ {
if (pCS != NULL) pCS->setSheet(LOCAL_INVENTORY ":BAG:"+ toString(newVal-1)); if (pCS != NULL) pCS->setSheet(LOCAL_INVENTORY ":BAG:"+ toString(newVal-1));
if (pCS2 != NULL) pCS2->setSheet(LOCAL_INVENTORY ":BAG:"+ toString(newVal-1)); if (pCS2 != NULL) pCS2->setSheet(LOCAL_INVENTORY ":BAG:"+ toString(newVal-1));
if (pCS3 != NULL) pCS3->setSheet(LOCAL_INVENTORY ":BAG:"+ toString(newVal-1));
} }
// Hands management // Hands management
@ -1550,7 +1405,6 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node)
{ {
if (pCS != NULL) pCS->setSheet(""); if (pCS != NULL) pCS->setSheet("");
if (pCS2 != NULL) pCS2->setSheet(""); if (pCS2 != NULL) pCS2->setSheet("");
if (pCS3 != NULL) pCS3->setSheet("");
} }
} }
} }
@ -2754,42 +2608,6 @@ bool CDBGroupListSheetFilterCLMSlot::CSheetChildFilter::isSheetValid(CDBGroupLis
return false; return false;
} }
// ***************************************************************************
// CDBGroupListSheetFilterHotbarSlot
// ***************************************************************************
// ***************************************************************************
bool CDBGroupListSheetFilterHotbarSlot::CSheetChildFilter::isSheetValid(CDBGroupListSheet *pFather)
{
if (CSheetChild::isSheetValid(pFather))
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CDBCtrlSheet *clmCtrl = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCtrlLaunchingModal());
if (!clmCtrl || !Ctrl) return false;
if (clmCtrl->getInventoryIndex() == INVENTORIES::exchange &&
Ctrl->getInventoryIndex() == INVENTORIES::exchange)
{
return false;
}
if ((clmCtrl->getType() == CCtrlSheetInfo::SheetType_Item) &&
(Ctrl->getType() == CCtrlSheetInfo::SheetType_Item) )
{
// Ok if we can put in the slot Ctrl in clmCtrl
if ( clmCtrl->canDropItem(Ctrl))
{
string sTmp = Ctrl->getSheet();
// Look if the source is locked
sTmp = sTmp.substr(sTmp.rfind(':')+1,sTmp.size());
sint32 nTmp;
fromString(sTmp, nTmp);
if (!getInventory().isBagItemWeared(nTmp) && getInventory().isUsableItem(Ctrl->getSheetId()) && Ctrl->getLockedByOwner() == 0)
return true;
}
}
}
return false;
}
// *************************************************************************** // ***************************************************************************
// CDBGroupListSheetFilterExchangeable // CDBGroupListSheetFilterExchangeable
// *************************************************************************** // ***************************************************************************
@ -3142,7 +2960,7 @@ class CHandlerInvDropTo : public IActionHandler
{ {
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getModalWindow(); CInterfaceGroup *pIG = CWidgetManager::getInstance()->getModalWindow();
if (pIG == NULL) return; if (pIG == NULL) return;
if (pIG->getId() != "ui:interface:bag_choose" && pIG->getId() != "ui:interface:hotbar_choose") return; if (pIG->getId() != "ui:interface:bag_choose") return;
getInventory().beginDrag(NULL, CInventoryManager::TextList); getInventory().beginDrag(NULL, CInventoryManager::TextList);
// Special case for choose in bag dialog // Special case for choose in bag dialog
@ -3303,6 +3121,7 @@ class CHandlerInvCannotDrop : public IActionHandler
// Is the dragged sheet comes from a slot // Is the dragged sheet comes from a slot
if (!getInventory().isDraggingFromTextList()) if (!getInventory().isDraggingFromTextList())
{ {
// Unequip
CDBCtrlSheet *pCSDst = dynamic_cast<CDBCtrlSheet*>(pCaller); CDBCtrlSheet *pCSDst = dynamic_cast<CDBCtrlSheet*>(pCaller);
string invPath = getInventory().getDBIndexPath(pCSDst); string invPath = getInventory().getDBIndexPath(pCSDst);
getInventory().unequip(invPath); getInventory().unequip(invPath);
@ -3312,75 +3131,6 @@ class CHandlerInvCannotDrop : public IActionHandler
}; };
REGISTER_ACTION_HANDLER( CHandlerInvCannotDrop, "inv_cannot_drop" ); REGISTER_ACTION_HANDLER( CHandlerInvCannotDrop, "inv_cannot_drop" );
// **********************************************************************************************************
class CCanDropToHotbar : public IActionHandler
{
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string src = getParam(Params, "src");
CInterfaceElement *pElt = CWidgetManager::getInstance()->getElementFromId(src);
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(pElt);
CDBCtrlSheet *pCSDst = dynamic_cast<CDBCtrlSheet*>(pCaller);
if (!pCSSrc || !pCSDst) return;
// Exchange can only be done from bag to exchange inventories
uint32 srcInventory = pCSSrc->getSecondIndexInDB();
if (
srcInventory == INVENTORIES::bag
&& getInventory().isInventoryAvailable((INVENTORIES::TInventory) pCSSrc->getSecondIndexInDB())
&& getInventory().isUsableItem(pCSSrc->getSheetId())
)
{
pCSDst->setCanDrop ( true );
}
}
};
REGISTER_ACTION_HANDLER (CCanDropToHotbar, "can_drop_to_hotbar");
// **********************************************************************************************************
class CHotbarLeftClickOnSlotHandler : public IActionHandler
{
virtual void execute (CCtrlBase *pCaller, const string &/* Params */)
{
CDBCtrlSheet *sheet = dynamic_cast<CDBCtrlSheet *>(pCaller);
if (!sheet) return;
if (sheet->getSheetId() == 0)
{
// is there's no item that is not worn, can't choose any item)
bool isThereObjectNotWorn = false;
for(uint k = 0; k < MAX_BAGINV_ENTRIES; ++k)
{
uint32 sheetid = getInventory().getBagItem(k).getSheetID();
if (sheetid != 0)
{
if (!getInventory().isBagItemWeared(k))
{
CEntitySheet *pES = SheetMngr.get(CSheetId(sheetid));
if (pES && pES->type()== CEntitySheet::ITEM)
{
CItemSheet *pIS = (CItemSheet*)pES;
if (getInventory().isUsableItem(sheetid))
{
isThereObjectNotWorn = true;
break;
}
}
}
}
}
if (!isThereObjectNotWorn)
{
// every object are worn, so there's no use to display an empty list -> no-op
return;
}
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CWidgetManager::getInstance()->pushModalWindow(pCaller, "ui:interface:hotbar_choose");
}
};
REGISTER_ACTION_HANDLER(CHotbarLeftClickOnSlotHandler, "hotbar_left_click_on_slot");
// *************************************************************************** // ***************************************************************************
class CHandlerInvAutoEquip : public IActionHandler class CHandlerInvAutoEquip : public IActionHandler

@ -41,7 +41,6 @@ const uint MAX_TEMPINV_ENTRIES = INVENTORIES::NbTempInvSlots;
const uint MAX_BAGINV_ENTRIES = INVENTORIES::NbBagSlots; const uint MAX_BAGINV_ENTRIES = INVENTORIES::NbBagSlots;
const uint MAX_HANDINV_ENTRIES = 2; const uint MAX_HANDINV_ENTRIES = 2;
const uint MAX_EQUIPINV_ENTRIES = 19; const uint MAX_EQUIPINV_ENTRIES = 19;
const uint MAX_HOTBARINV_ENTRIES = INVENTORIES::NbHotbarSlots;
const uint MAX_ANIMALINV_ENTRIES = INVENTORIES::NbPackerSlots; const uint MAX_ANIMALINV_ENTRIES = INVENTORIES::NbPackerSlots;
const uint MAX_GUILDINV_ENTRIES = INVENTORIES::NbGuildSlots; const uint MAX_GUILDINV_ENTRIES = INVENTORIES::NbGuildSlots;
const uint MAX_ROOMINV_ENTRIES = INVENTORIES::NbRoomSlots; const uint MAX_ROOMINV_ENTRIES = INVENTORIES::NbRoomSlots;
@ -194,14 +193,10 @@ public:
CItemImage *getHandItem(uint index); CItemImage *getHandItem(uint index);
// get equip item (local inventory) // get equip item (local inventory)
CItemImage *getEquipItem(uint index); CItemImage *getEquipItem(uint index);
// get hotbar item (local inventory)
CItemImage *getHotbarItem(uint index);
// get hand item (local inventory) // get hand item (local inventory)
CDBCtrlSheet *getHandSheet(uint index); CDBCtrlSheet *getHandSheet(uint index);
// get equip item (local inventory) // get equip item (local inventory)
CDBCtrlSheet *getEquipSheet(uint index); CDBCtrlSheet *getEquipSheet(uint index);
// get hotbar item (local inventory)
CDBCtrlSheet *getHotbarSheet(uint index);
// get/set money // get/set money
uint64 getMoney() const; uint64 getMoney() const;
void setMoney(uint64 value); void setMoney(uint64 value);
@ -255,8 +250,6 @@ public:
bool isSword(uint32 sheetID); bool isSword(uint32 sheetID);
// Check if an item is a forage tool // Check if an item is a forage tool
bool isForageToolItem(uint32 sheetID); bool isForageToolItem(uint32 sheetID);
// Check if an item is usable
bool isUsableItem(uint32 sheetID);
// Get the Hand item sheet // Get the Hand item sheet
uint32 getRightHandItemSheet() const { return getHandItemSheet(true); } uint32 getRightHandItemSheet() const { return getHandItemSheet(true); }
uint32 getLeftHandItemSheet() const { return getHandItemSheet(false); } uint32 getLeftHandItemSheet() const { return getHandItemSheet(false); }
@ -340,15 +333,9 @@ private:
CItemImage TempInv[MAX_TEMPINV_ENTRIES]; CItemImage TempInv[MAX_TEMPINV_ENTRIES];
sint32 Hands[MAX_HANDINV_ENTRIES]; sint32 Hands[MAX_HANDINV_ENTRIES];
CDBCtrlSheet *UIHands[MAX_HANDINV_ENTRIES]; CDBCtrlSheet *UIHands[MAX_HANDINV_ENTRIES];
CDBCtrlSheet *UIHands2[MAX_HANDINV_ENTRIES];
CDBCtrlSheet *UIHands3[MAX_HANDINV_ENTRIES];
sint32 Equip[MAX_EQUIPINV_ENTRIES]; sint32 Equip[MAX_EQUIPINV_ENTRIES];
CDBCtrlSheet *UIEquip[MAX_EQUIPINV_ENTRIES]; CDBCtrlSheet *UIEquip[MAX_EQUIPINV_ENTRIES];
CDBCtrlSheet *UIEquip2[MAX_EQUIPINV_ENTRIES]; CDBCtrlSheet *UIEquip2[MAX_EQUIPINV_ENTRIES];
sint32 Hotbar[MAX_HOTBARINV_ENTRIES];
CDBCtrlSheet *UIHotbar[MAX_HOTBARINV_ENTRIES];
CDBCtrlSheet *UIHotbar2[MAX_HOTBARINV_ENTRIES];
CDBCtrlSheet *UIHotbar3[MAX_HOTBARINV_ENTRIES];
NLMISC::CCDBNodeLeaf *Money; NLMISC::CCDBNodeLeaf *Money;
CItemImage PAInv[MAX_INVENTORY_ANIMAL][MAX_ANIMALINV_ENTRIES]; CItemImage PAInv[MAX_INVENTORY_ANIMAL][MAX_ANIMALINV_ENTRIES];
// SERVER INVENTORY // SERVER INVENTORY
@ -356,7 +343,6 @@ private:
CItemImage ServerTempInv[MAX_TEMPINV_ENTRIES]; CItemImage ServerTempInv[MAX_TEMPINV_ENTRIES];
sint32 ServerHands[MAX_HANDINV_ENTRIES]; sint32 ServerHands[MAX_HANDINV_ENTRIES];
sint32 ServerEquip[MAX_EQUIPINV_ENTRIES]; sint32 ServerEquip[MAX_EQUIPINV_ENTRIES];
sint32 ServerHotbar[MAX_EQUIPINV_ENTRIES];
NLMISC::CCDBNodeLeaf *ServerMoney; NLMISC::CCDBNodeLeaf *ServerMoney;
CItemImage ServerPAInv[MAX_INVENTORY_ANIMAL][MAX_ANIMALINV_ENTRIES]; CItemImage ServerPAInv[MAX_INVENTORY_ANIMAL][MAX_ANIMALINV_ENTRIES];
// Drag'n'Drop // Drag'n'Drop
@ -759,25 +745,6 @@ public:
}; };
}; };
// ***************************************************************************
/**
* Special list for filtering items which are usable
*/
class CDBGroupListSheetFilterHotbarSlot : public CDBGroupListSheet
{
public:
CDBGroupListSheetFilterHotbarSlot (const TCtorParam &param)
: CDBGroupListSheet(param)
{}
virtual CSheetChild *createSheetChild() { return new CSheetChildFilter; }
// A child node
struct CSheetChildFilter : public CDBGroupListSheet::CSheetChild
{
virtual bool isSheetValid(CDBGroupListSheet *pFather);
};
};
// *************************************************************************** // ***************************************************************************
/** /**
@ -873,6 +840,8 @@ private:
#define CTRL_HAND_RIGHT "ui:interface:gestionsets:hands:handr" #define CTRL_HAND_RIGHT "ui:interface:gestionsets:hands:handr"
#define CTRL_HAND_LEFT "ui:interface:gestionsets:hands:handl" #define CTRL_HAND_LEFT "ui:interface:gestionsets:hands:handl"
#define CTRL_HAND_LEFT_2HAND "ui:interface:gestionsets:hands:handl_2h"
#define CTRL_HAND_LEFT_AMMO "ui:interface:gestionsets:hands:handl_ammo"
#define CTRL_JEWEL_EARING_LEFT "ui:interface:inv_equip:content:equip:jewelry:earing_l" #define CTRL_JEWEL_EARING_LEFT "ui:interface:inv_equip:content:equip:jewelry:earing_l"
#define CTRL_JEWEL_BRACELET_LEFT "ui:interface:inv_equip:content:equip:jewelry:bracelet_l" #define CTRL_JEWEL_BRACELET_LEFT "ui:interface:inv_equip:content:equip:jewelry:bracelet_l"
@ -892,15 +861,6 @@ private:
#define CTRL_ARMOR_ARMS "ui:interface:inv_equip:content:equip:armors:arms" #define CTRL_ARMOR_ARMS "ui:interface:inv_equip:content:equip:armors:arms"
#define CTRL_ARMOR_HANDS "ui:interface:inv_equip:content:equip:armors:hands" #define CTRL_ARMOR_HANDS "ui:interface:inv_equip:content:equip:armors:hands"
#define CTRL_HOTBAR_1 "ui:interface:inv_equip:content:equip:hotbar_c:hotbar:hotbar1"
#define CTRL_HOTBAR_2 "ui:interface:inv_equip:content:equip:hotbar_c:hotbar:hotbar2"
#define CTRL_HOTBAR_3 "ui:interface:inv_equip:content:equip:hotbar_c:hotbar:hotbar3"
#define CTRL_HOTBAR_4 "ui:interface:inv_equip:content:equip:hotbar_c:hotbar:hotbar4"
#define CTRL_HOTBAR_5 "ui:interface:inv_equip:content:equip:hotbar_c:hotbar:hotbar5"
#define CTRL_HAND2_RIGHT "ui:interface:inv_equip:content:equip:hands:handr"
#define CTRL_HAND2_LEFT "ui:interface:inv_equip:content:equip:hands:handl"
#define CTRL_JEWL2_EARING_LEFT "ui:interface:inventory:content:equip:jewelry:earing_l" #define CTRL_JEWL2_EARING_LEFT "ui:interface:inventory:content:equip:jewelry:earing_l"
#define CTRL_JEWL2_BRACELET_LEFT "ui:interface:inventory:content:equip:jewelry:bracelet_l" #define CTRL_JEWL2_BRACELET_LEFT "ui:interface:inventory:content:equip:jewelry:bracelet_l"
#define CTRL_JEWL2_RING_LEFT "ui:interface:inventory:content:equip:jewelry:ring_l" #define CTRL_JEWL2_RING_LEFT "ui:interface:inventory:content:equip:jewelry:ring_l"
@ -919,21 +879,6 @@ private:
#define CTRL_ARMR2_ARMS "ui:interface:inventory:content:equip:armors:arms" #define CTRL_ARMR2_ARMS "ui:interface:inventory:content:equip:armors:arms"
#define CTRL_ARMR2_HANDS "ui:interface:inventory:content:equip:armors:hands" #define CTRL_ARMR2_HANDS "ui:interface:inventory:content:equip:armors:hands"
#define CTRL_HOTBAR2_1 "ui:interface:inventory:content:equip:hotbar_c:hotbar:hotbar1"
#define CTRL_HOTBAR2_2 "ui:interface:inventory:content:equip:hotbar_c:hotbar:hotbar2"
#define CTRL_HOTBAR2_3 "ui:interface:inventory:content:equip:hotbar_c:hotbar:hotbar3"
#define CTRL_HOTBAR2_4 "ui:interface:inventory:content:equip:hotbar_c:hotbar:hotbar4"
#define CTRL_HOTBAR2_5 "ui:interface:inventory:content:equip:hotbar_c:hotbar:hotbar5"
#define CTRL_HAND3_RIGHT "ui:interface:inventory:content:equip:hands:handr"
#define CTRL_HAND3_LEFT "ui:interface:inventory:content:equip:hands:handl"
#define CTRL_HOTBAR3_1 "ui:interface:inv_hotbar:content:hot:hotbar:hotbar1"
#define CTRL_HOTBAR3_2 "ui:interface:inv_hotbar:content:hot:hotbar:hotbar2"
#define CTRL_HOTBAR3_3 "ui:interface:inv_hotbar:content:hot:hotbar:hotbar3"
#define CTRL_HOTBAR3_4 "ui:interface:inv_hotbar:content:hot:hotbar:hotbar4"
#define CTRL_HOTBAR3_5 "ui:interface:inv_hotbar:content:hot:hotbar:hotbar5"
#endif // RY_INVENTORY_MANAGER_H #endif // RY_INVENTORY_MANAGER_H
/* End of inventory_manager.h */ /* End of inventory_manager.h */

@ -2420,15 +2420,13 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
texture = ""; texture = "";
} }
std::vector<string>texList;
if (!texture.empty())
splitString(texture, " ", texList);
for(uint j=0;j<instance.getNumMaterials();j++) for(uint j=0;j<instance.getNumMaterials();j++)
{ {
if (!highlight) if (highlight)
{
/*instance.getMaterial(j).setAmbient(CRGBA(0,0,0,255));
instance.getMaterial(j).setEmissive(CRGBA(255,255,255,255));
instance.getMaterial(j).setShininess(10.0f);*/
}
else
{ {
instance.getMaterial(j).setAmbient(CRGBA(0,0,0,255)); instance.getMaterial(j).setAmbient(CRGBA(0,0,0,255));
instance.getMaterial(j).setEmissive(CRGBA(255,0,0,255)); instance.getMaterial(j).setEmissive(CRGBA(255,0,0,255));
@ -2441,9 +2439,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
for(sint l = 0; l < numStages; l++) for(sint l = 0; l < numStages; l++)
{ {
if (instance.getMaterial(j).isTextureFile((uint) l)) if (instance.getMaterial(j).isTextureFile((uint) l))
{ instance.getMaterial(j).setTextureFileName(texList[std::min((int)j, (int)texList.size()-1)], (uint) l);
instance.getMaterial(j).setTextureFileName(texture, (uint) l);
}
} }
} }
} }

@ -46,43 +46,14 @@ CItemGroup::CItemGroup()
bool CItemGroup::contains(CDBCtrlSheet *other) bool CItemGroup::contains(CDBCtrlSheet *other)
{ {
SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::UNDEFINED; SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::UNDEFINED;
return contains(other, slot) || contains(other, -1); return contains(other, slot);
} }
// TODO: review redundancy of slot parameter
bool CItemGroup::contains(CDBCtrlSheet *other, SLOT_EQUIPMENT::TSlotEquipment &slot) bool CItemGroup::contains(CDBCtrlSheet *other, SLOT_EQUIPMENT::TSlotEquipment &slot)
{ {
slot = SLOT_EQUIPMENT::UNDEFINED; slot = SLOT_EQUIPMENT::UNDEFINED;
for(int i=0;i<EquipItems.size();i++) for(int i=0;i<Items.size();i++)
{
CItem item = EquipItems[i];
if(item.useCreateTime() && item.createTime == other->getItemCreateTime() && item.serial == other->getItemSerial())
{
slot = item.slot;
return true;
}
// Present for compatibility reasons
NLMISC::CSheetId sheet = NLMISC::CSheetId(other->getSheetId());
if (sheet.toString() == item.sheetName && other->getQuality() == item.quality &&
other->getItemWeight() == item.weight && other->getItemColor() == item.color &&
(!item.usePrice || (other->getItemPrice() >= item.minPrice && other->getItemPrice() <= item.maxPrice))
)
{ {
slot = item.slot; CItem item = Items[i];
return true;
}
}
return false;
}
// TODO: review redundancy of slot parameter
bool CItemGroup::contains(CDBCtrlSheet *other, uint16 &slot)
{
slot = -1;
for(int i=0;i<HotbarItems.size();i++)
{
CItem item = HotbarItems[i];
if(item.useCreateTime() && item.createTime == other->getItemCreateTime() && item.serial == other->getItemSerial()) if(item.useCreateTime() && item.createTime == other->getItemCreateTime() && item.serial == other->getItemSerial())
{ {
slot = item.slot; slot = item.slot;
@ -108,25 +79,19 @@ void CItemGroup::addItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlot
//Don't add an item if it already exists, this could cause issue //Don't add an item if it already exists, this could cause issue
// It's happening either if we are creating a group with a 2 hands items (and the item is found both in handR and handL) // It's happening either if we are creating a group with a 2 hands items (and the item is found both in handR and handL)
// Or if an user incorrectly edit his group file // Or if an user incorrectly edit his group file
for(int i=0; i<EquipItems.size(); i++) for(int i=0; i<Items.size(); i++)
{ {
if( EquipItems[i].createTime == createTime && EquipItems[i].serial == serial) if( Items[i].createTime == createTime && Items[i].serial == serial)
{ {
nldebug("Not adding duplicate item, createTime: %d, serial: %d", createTime, serial); nldebug("Not adding duplicate item, createTime: %d, serial: %d", createTime, serial);
//In this case, we are adding the duplicate item for a 2 hands item //In this case, we are adding the duplicate item for a 2 hands item
//If it's saved as a left hand item, save it as a right hand item instead (so we have only 1 correct item) //If it's saved as a left hand item, save it as a right hand item instead (so we have only 1 correct item)
if(EquipItems[i].slot == SLOT_EQUIPMENT::HANDL && slot == SLOT_EQUIPMENT::HANDR) if(Items[i].slot == SLOT_EQUIPMENT::HANDL && slot == SLOT_EQUIPMENT::HANDR)
EquipItems[i].slot = SLOT_EQUIPMENT::HANDR; Items[i].slot = SLOT_EQUIPMENT::HANDR;
return; return;
} }
} }
EquipItems.push_back(CEquipItem(createTime, serial, slot)); Items.push_back(CItem(createTime, serial, slot));
}
// used for hotbar
void CItemGroup::addItem(sint32 createTime, sint32 serial, uint16 slot)
{
HotbarItems.push_back(CHotbarItem(createTime, serial, slot));
} }
void CItemGroup::addRemove(std::string slotName) void CItemGroup::addRemove(std::string slotName)
@ -141,19 +106,13 @@ void CItemGroup::addRemove(SLOT_EQUIPMENT::TSlotEquipment slot)
removeBeforeEquip.push_back(slot); removeBeforeEquip.push_back(slot);
} }
// used for hotbar
void CItemGroup::addRemove(uint16 slot)
{
removeHotbar.push_back(slot);
}
void CItemGroup::writeTo(xmlNodePtr node) void CItemGroup::writeTo(xmlNodePtr node)
{ {
xmlNodePtr groupNode = xmlNewChild (node, NULL, (const xmlChar*)"group", NULL ); xmlNodePtr groupNode = xmlNewChild (node, NULL, (const xmlChar*)"group", NULL );
xmlSetProp(groupNode, (const xmlChar*)"name", (const xmlChar*)name.c_str()); xmlSetProp(groupNode, (const xmlChar*)"name", (const xmlChar*)name.c_str());
for(int i=0;i<EquipItems.size();i++) for(int i=0;i<Items.size();i++)
{ {
CItem item = EquipItems[i]; CItem item = Items[i];
xmlNodePtr itemNode = xmlNewChild(groupNode, NULL, (const xmlChar*)"item", NULL); xmlNodePtr itemNode = xmlNewChild(groupNode, NULL, (const xmlChar*)"item", NULL);
if(item.useCreateTime()) if(item.useCreateTime())
{ {
@ -174,37 +133,11 @@ void CItemGroup::writeTo(xmlNodePtr node)
//if(item.slot == SLOT_EQUIPMENT::HANDL || item.slot == SLOT_EQUIPMENT::HANDR) //if(item.slot == SLOT_EQUIPMENT::HANDL || item.slot == SLOT_EQUIPMENT::HANDR)
xmlSetProp(itemNode, (const xmlChar*)"slot", (const xmlChar*)SLOT_EQUIPMENT::toString(item.slot).c_str()); xmlSetProp(itemNode, (const xmlChar*)"slot", (const xmlChar*)SLOT_EQUIPMENT::toString(item.slot).c_str());
} }
for(int i=0;i<HotbarItems.size();i++)
{
CItem item = HotbarItems[i];
xmlNodePtr itemNode = xmlNewChild(groupNode, NULL, (const xmlChar*)"hotbar_item", NULL);
if(item.useCreateTime())
{
xmlSetProp (itemNode, (const xmlChar*)"createTime", (const xmlChar*)NLMISC::toString(item.createTime).c_str());
xmlSetProp (itemNode, (const xmlChar*)"serial", (const xmlChar*)NLMISC::toString(item.serial).c_str());
}
// Present for compatibility reasons
else
{
xmlSetProp (itemNode, (const xmlChar*)"sheetName", (const xmlChar*)item.sheetName.c_str());
xmlSetProp (itemNode, (const xmlChar*)"quality", (const xmlChar*)NLMISC::toString(item.quality).c_str());
xmlSetProp (itemNode, (const xmlChar*)"weight", (const xmlChar*)NLMISC::toString(item.weight).c_str());
xmlSetProp (itemNode, (const xmlChar*)"color", (const xmlChar*)NLMISC::toString(item.color).c_str());
xmlSetProp (itemNode, (const xmlChar*)"minPrice", (const xmlChar*)NLMISC::toString(item.minPrice).c_str());
xmlSetProp (itemNode, (const xmlChar*)"maxPrice", (const xmlChar*)NLMISC::toString(item.maxPrice).c_str());
}
xmlSetProp(itemNode, (const xmlChar*)"slot", (const xmlChar*)NLMISC::toString(item.slot).c_str());
}
for(int i=0;i<removeBeforeEquip.size();i++) for(int i=0;i<removeBeforeEquip.size();i++)
{ {
xmlNodePtr removeNode = xmlNewChild(groupNode, NULL, (const xmlChar*)"remove", NULL); xmlNodePtr removeNode = xmlNewChild(groupNode, NULL, (const xmlChar*)"remove", NULL);
xmlSetProp(removeNode, (const xmlChar*)"slot", (xmlChar*)SLOT_EQUIPMENT::toString(removeBeforeEquip[i]).c_str()); xmlSetProp(removeNode, (const xmlChar*)"slot", (xmlChar*)SLOT_EQUIPMENT::toString(removeBeforeEquip[i]).c_str());
} }
for(int i=0;i<removeHotbar.size();i++)
{
xmlNodePtr removeNode = xmlNewChild(groupNode, NULL, (const xmlChar*)"hotbar_remove", NULL);
xmlSetProp(removeNode, (const xmlChar*)"slot", (xmlChar*)NLMISC::toString(removeHotbar[i]).c_str());
}
} }
@ -219,7 +152,8 @@ void CItemGroup::readFrom(xmlNodePtr node)
{ {
if (strcmp((char*)curNode->name, "item") == 0) if (strcmp((char*)curNode->name, "item") == 0)
{ {
CEquipItem item;
CItem item;
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"createTime"); ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"createTime");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.createTime); if (ptrName) NLMISC::fromString((const char*)ptrName, item.createTime);
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"serial"); ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"serial");
@ -249,40 +183,7 @@ void CItemGroup::readFrom(xmlNodePtr node)
// Old load : keep for compatibility / migration reasons // Old load : keep for compatibility / migration reasons
else else
{ {
EquipItems.push_back(item); Items.push_back(item);
}
}
if (strcmp((char*)curNode->name, "hotbar_item") == 0)
{
CHotbarItem item;
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"createTime");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.createTime);
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"serial");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.serial);
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"slot");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.slot);
// Old read, keep for compatibility reasons
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"sheetName");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.sheetName);
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"quality");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.quality);
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"weight");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.weight);
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"color");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.color);
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"minPrice");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.minPrice);
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"maxPrice");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.maxPrice);
item.usePrice = (item.minPrice != 0 || item.maxPrice != std::numeric_limits<uint32>::max());
if(item.createTime != 0)
{
addItem(item.createTime, item.serial, item.slot);
}
// Old load : keep for compatibility / migration reasons
else
{
HotbarItems.push_back(item);
} }
} }
if (strcmp((char*)curNode->name, "remove") == 0) if (strcmp((char*)curNode->name, "remove") == 0)
@ -292,13 +193,6 @@ void CItemGroup::readFrom(xmlNodePtr node)
if (ptrName) NLMISC::fromString((const char*)ptrName, slot); if (ptrName) NLMISC::fromString((const char*)ptrName, slot);
addRemove(slot); addRemove(slot);
} }
if (strcmp((char*)curNode->name, "hotbar_remove") == 0)
{
uint16 slot;
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"slot");
if (ptrName) NLMISC::fromString((const char*)ptrName, slot);
addRemove(slot);
}
curNode = curNode->next; curNode = curNode->next;
} }
@ -487,7 +381,7 @@ bool CItemGroupManager::migrateGroups()
{ {
CItemGroup group = _Groups[i]; CItemGroup group = _Groups[i];
//Migrate the group only if there is items inside, and the first one hasn't been migrated //Migrate the group only if there is items inside, and the first one hasn't been migrated
bool needMigration = group.EquipItems.size() > 0 && !group.EquipItems[0].useCreateTime(); bool needMigration = group.Items.size() > 0 && !group.Items[0].useCreateTime();
if(!needMigration) if(!needMigration)
{ {
newGroups.push_back(group); newGroups.push_back(group);
@ -661,13 +555,6 @@ bool CItemGroupManager::equipGroup(std::string name, bool pullBefore)
dbPath = "LOCAL:INVENTORY:EQUIP:" + NLMISC::toString((uint32)slot); dbPath = "LOCAL:INVENTORY:EQUIP:" + NLMISC::toString((uint32)slot);
CInventoryManager::getInstance()->unequip(dbPath); CInventoryManager::getInstance()->unequip(dbPath);
} }
// unequip hotbar
for(int i=0; i < group->removeHotbar.size(); i++)
{
uint16 slot = group->removeHotbar[i];
std::string dbPath = "LOCAL:INVENTORY:HOTBAR:" + NLMISC::toString(slot);
CInventoryManager::getInstance()->unequip(dbPath);
}
uint32 maxEquipTime = 0; uint32 maxEquipTime = 0;
@ -782,19 +669,6 @@ bool CItemGroupManager::createGroup(std::string name, bool removeUnequiped)
group.addRemove(slot); group.addRemove(slot);
} }
} }
for (i = 0; i < MAX_HOTBARINV_ENTRIES; ++i)
{
pCS = CInventoryManager::getInstance()->getHotbarSheet(i);
if(!pCS) continue;
if(pCS->isSheetValid())
{
group.addItem(pCS->getItemCreateTime(), pCS->getItemSerial(), (uint16) i);
}
else if(removeUnequiped)
{
group.addRemove(i);
}
}
_Groups.push_back(group); _Groups.push_back(group);
return true; return true;
@ -827,7 +701,7 @@ void CItemGroupManager::listGroup()
//Use utf-8 string because group name can contain accentued characters (and stuff like that) //Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = group.name; string nameUC = group.name;
NLMISC::strFindReplace(msg, "%name", nameUC); NLMISC::strFindReplace(msg, "%name", nameUC);
NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.EquipItems.size() + group.HotbarItems.size())); NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size()));
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
} }
} }
@ -905,22 +779,12 @@ bool CItemGroupManager::isItemReallyEquipped(CDBCtrlSheet* item)
{ {
return true; return true;
} }
}
for (uint32 i = 0; i < MAX_HOTBARINV_ENTRIES; ++i)
{
pCS = CInventoryManager::getInstance()->getHotbarSheet(i);
if(!pCS) continue;
if((pCS->getInventoryIndex() == item->getInventoryIndex())
&& (pCS->getIndexInDB() == item->getIndexInDB()))
{
return true;
}
} }
return false; return false;
} }
// TODO: review this function
std::vector<CInventoryItem> CItemGroupManager::matchingItems(CItemGroup *group, INVENTORIES::TInventory inventory) std::vector<CInventoryItem> CItemGroupManager::matchingItems(CItemGroup *group, INVENTORIES::TInventory inventory)
{ {
//Not very clean, but no choice, it's ugly time //Not very clean, but no choice, it's ugly time

@ -37,6 +37,7 @@ public:
class CItemGroup { class CItemGroup {
public: public:
struct CItem { struct CItem {
SLOT_EQUIPMENT::TSlotEquipment slot; // Used only for dagger (right/left hand slot)
sint32 createTime; sint32 createTime;
sint32 serial; sint32 serial;
// Old variables, present for compatibility reasons // Old variables, present for compatibility reasons
@ -47,53 +48,32 @@ public:
uint32 minPrice; uint32 minPrice;
uint32 maxPrice; uint32 maxPrice;
bool usePrice; bool usePrice;
CItem(sint32 createTime, sint32 serial) : CItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::UNDEFINED) :
createTime(createTime), serial(serial), slot(slot) {} createTime(createTime), serial(serial), slot(slot) {}
//Old constructor, present for compatibility reasons //Old constructor, present for compatibility reasons
CItem(std::string sheetName = "", uint16 quality = 0, uint32 weight = 0, uint8 color = 0, sint32 createTime = 0, sint32 serial = 0, uint32 minPrice = 0, uint32 maxPrice = std::numeric_limits<uint32>::max(), bool usePrice = false) : CItem(std::string sheetName = "", uint16 quality = 0, uint32 weight = 0, uint8 color = 0, sint32 createTime = 0, sint32 serial = 0, SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::UNDEFINED, uint32 minPrice = 0, uint32 maxPrice = std::numeric_limits<uint32>::max(), bool usePrice = false) :
sheetName(sheetName), quality(quality), weight(weight), color(color), createTime(createTime), serial(serial), slot(slot), minPrice(minPrice), maxPrice(maxPrice), usePrice(usePrice) {} sheetName(sheetName), quality(quality), weight(weight), color(color), createTime(createTime), serial(serial), slot(slot), minPrice(minPrice), maxPrice(maxPrice), usePrice(usePrice) {}
//present for compatibility reasons //present for compatibility reasons
bool useCreateTime() const { return createTime != 0 && serial != 0;} bool useCreateTime() const { return createTime != 0 && serial != 0;}
}; };
struct CEquipItem : CItem {
SLOT_EQUIPMENT::TSlotEquipment slot; // Used only for dagger (right/left hand slot)
CEquipItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::UNDEFINED) :
CItem(createTime, serial), slot(slot) {}
CEquipItem(std::string sheetName = "", uint16 quality = 0, uint32 weight = 0, uint8 color = 0, sint32 createTime = 0, sint32 serial = 0, SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::UNDEFINED, uint32 minPrice = 0, uint32 maxPrice = std::numeric_limits<uint32>::max(), bool usePrice = false) :
CItem(sheetName, quality, weight, color, createTime, slot, minPrice, maxPrice, usePrice), slot(slot) {}
};
struct CHotbarItem : CItem {
SLOT_EQUIPMENT::TSlotEquipment slot; // Used only for dagger (right/left hand slot)
CHotbarItem(sint32 createTime, sint32 serial, uint16 slot) :
CItem(createTime, serial), slot(slot) {}
CHotbarItem(std::string sheetName = "", uint16 quality = 0, uint32 weight = 0, uint8 color = 0, sint32 createTime = 0, sint32 serial = 0, uint16 slot, uint32 minPrice = 0, uint32 maxPrice = std::numeric_limits<uint32>::max(), bool usePrice = false) :
CItem(sheetName, quality, weight, color, createTime, slot, minPrice, maxPrice, usePrice), slot(slot) {}
};
public: public:
CItemGroup(); CItemGroup();
// return true if any item in the group match the parameter ; slot is UNDEFINED unless the item has been found in the group // return true if any item in the group match the parameter ; slot is UNDEFINED unless the item has been found in the group
bool contains(CDBCtrlSheet *other); bool contains(CDBCtrlSheet *other);
bool contains(CDBCtrlSheet* other, SLOT_EQUIPMENT::TSlotEquipment &slot); bool contains(CDBCtrlSheet* other, SLOT_EQUIPMENT::TSlotEquipment &slot);
bool contains(CDBCtrlSheet* other, uint16 &slot);
void addItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlotEquipment slot); void addItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlotEquipment slot);
void addItem(sint32 createTime, sint32 serial, uint16 slot);
void addRemove(std::string slotName); void addRemove(std::string slotName);
void addRemove(SLOT_EQUIPMENT::TSlotEquipment slot); void addRemove(SLOT_EQUIPMENT::TSlotEquipment slot);
void addRemove(uint16 slot);
void writeTo(xmlNodePtr node); void writeTo(xmlNodePtr node);
void readFrom(xmlNodePtr node); void readFrom(xmlNodePtr node);
// return true if no item inside // return true if no item inside
bool empty() const { return EquipItems.size() == 0 && HotbarItems.size() == 0;} bool empty() const { return Items.size() == 0;}
std::string name; std::string name;
std::vector<CEquipItem> EquipItems; std::vector<CItem> Items;
std::vector<CHotbarItem> HotbarItems;
std::vector<SLOT_EQUIPMENT::TSlotEquipment> removeBeforeEquip; std::vector<SLOT_EQUIPMENT::TSlotEquipment> removeBeforeEquip;
std::vector<uint16> removeHotbar;
}; };
class CItemGroupManager { class CItemGroupManager {

@ -33,7 +33,6 @@ namespace INVENTORIES
NL_STRING_CONVERSION_TABLE_ENTRY(handling) NL_STRING_CONVERSION_TABLE_ENTRY(handling)
NL_STRING_CONVERSION_TABLE_ENTRY(temporary) NL_STRING_CONVERSION_TABLE_ENTRY(temporary)
NL_STRING_CONVERSION_TABLE_ENTRY(equipment) NL_STRING_CONVERSION_TABLE_ENTRY(equipment)
NL_STRING_CONVERSION_TABLE_ENTRY(hotbar)
NL_STRING_CONVERSION_TABLE_ENTRY(bag) NL_STRING_CONVERSION_TABLE_ENTRY(bag)
NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal1) NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal1)
NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal2) NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal2)
@ -95,7 +94,6 @@ namespace INVENTORIES
"TEMP", // temporary "TEMP", // temporary
// "", // pick-up // "", // pick-up
"EQUIP", // equipment "EQUIP", // equipment
"HOTBAR", // hotbar
"", // bag "", // bag
"", // pack_animal1 "", // pack_animal1
"", // pack_animal2 "", // pack_animal2

@ -158,9 +158,8 @@ namespace INVENTORIES
handling = 0, handling = 0,
temporary, // 1 temporary, // 1
equipment, // 2 equipment, // 2
hotbar, // 3 bag, // 3
bag, // 4 pet_animal, // 4 Character can have 7 pack animal
pet_animal, // 5 Character can have 7 pack animal
pet_animal1 = pet_animal, // for toString => TInventory convertion pet_animal1 = pet_animal, // for toString => TInventory convertion
pet_animal2, pet_animal2,
pet_animal3, pet_animal3,
@ -168,17 +167,17 @@ namespace INVENTORIES
pet_animal5, pet_animal5,
pet_animal6, pet_animal6,
pet_animal7, pet_animal7,
max_pet_animal, // 12 max_pet_animal, // 11
NUM_INVENTORY = max_pet_animal, // 12 NUM_INVENTORY = max_pet_animal, // 11
UNDEFINED = NUM_INVENTORY, // 12 UNDEFINED = NUM_INVENTORY, // 11
exchange, // 13 This is not a bug : exchange is a fake inventory exchange, // 12 This is not a bug : exchange is a fake inventory
exchange_proposition, // 14 and should not count in the number of inventory exchange_proposition, // 13 and should not count in the number of inventory
// same for botChat trading. // same for botChat trading.
trading, // 15 trading, // 14
reward_sharing, // 16 fake inventory, not in database.xml. Used by the item info protocol only reward_sharing, // 15 fake inventory, not in database.xml. Used by the item info protocol only
guild, // 17 (warning: number stored in guild saved file) guild, // 16 (warning: number stored in guild saved file)
player_room, // 18 player_room, // 17
NUM_ALL_INVENTORY // warning: distinct from NUM_INVENTORY NUM_ALL_INVENTORY // warning: distinct from NUM_INVENTORY
}; };
@ -263,7 +262,6 @@ namespace INVENTORIES
const uint NbRoomSlots = 1000; const uint NbRoomSlots = 1000;
const uint NbGuildSlots = 1000; const uint NbGuildSlots = 1000;
const uint NbTempInvSlots = 16; const uint NbTempInvSlots = 16;
const uint NbHotbarSlots = 5;
enum TItemPropId enum TItemPropId
{ {

@ -124,16 +124,6 @@ namespace ITEMFAMILY
} }
bool isUsable( EItemFamily fam )
{
return
fam == ITEM_SAP_RECHARGE ||
fam == CRYSTALLIZED_SPELL ||
fam == CONSUMABLE ||
fam == XP_CATALYSER;
}
/** /**
* returns true if items of this family are destroyed when they are completely worned out * returns true if items of this family are destroyed when they are completely worned out
*/ */

@ -95,8 +95,6 @@ namespace ITEMFAMILY
bool isResellable( EItemFamily fam ); bool isResellable( EItemFamily fam );
/// return true if this family of item can display a custom text /// return true if this family of item can display a custom text
bool isTextCustomizable( EItemFamily fam ); bool isTextCustomizable( EItemFamily fam );
/// return true if this family of item can use item (consume, execute, open, etc)
bool isUsable( EItemFamily fam );
/// is craftable /// is craftable
}; // ITEMFAMILY }; // ITEMFAMILY

Loading…
Cancel
Save