Allow support for room / guild movement

--HG--
branch : item_group
This commit is contained in:
Guillaume Dupuy 2017-03-09 18:54:12 +01:00
parent ecf2ac530c
commit 6c9bbb8c0b
7 changed files with 81 additions and 13 deletions

View file

@ -1847,7 +1847,17 @@
name="uimMtPaMount3" name="uimMtPaMount3"
handler="item_group_move" handler="item_group_move"
params="pet_animal4" /> params="pet_animal4" />
</action> <!-- move !--> <action id="group_room"
name="uimMtRoom"
handler="item_group_move"
params="player_room" />
<action id="group_guild"
name="uimMtGuild"
handler="item_group_move"
params="guild" />
</action>
<!-- move !-->
</action> <!-- item_group !--> </action> <!-- item_group !-->
</group> </group>

View file

@ -589,7 +589,7 @@ CClientConfig::CClientConfig()
FollowOnAtk = true; FollowOnAtk = true;
AtkOnSelect = false; AtkOnSelect = false;
TransparentUnderCursor = false; TransparentUnderCursor = false;
ItemGroupAllowGuild = false;
// PREFERENCES // PREFERENCES
FPV = false; FPV = false;
CameraHeight = 2.5f; CameraHeight = 2.5f;
@ -1440,6 +1440,8 @@ void CClientConfig::setValues()
READ_BOOL_FV(FollowOnAtk); READ_BOOL_FV(FollowOnAtk);
READ_BOOL_FV(AtkOnSelect); READ_BOOL_FV(AtkOnSelect);
READ_BOOL_DEV(TransparentUnderCursor); READ_BOOL_DEV(TransparentUnderCursor);
//
READ_BOOL_FV(ItemGroupAllowGuild);
///////////////// /////////////////

View file

@ -571,6 +571,9 @@ struct CClientConfig
/// Makes entities transparent if they are under cursor /// Makes entities transparent if they are under cursor
bool TransparentUnderCursor; bool TransparentUnderCursor;
/// Allow item group to move from / to guild room
bool ItemGroupAllowGuild;
///////////////// /////////////////
// PREFERENCES // // PREFERENCES //

View file

@ -209,6 +209,11 @@ NLMISC_COMMAND(who, "Display all players currently in region","[<options (GM, ch
return true; return true;
} }
NLMISC_COMMAND(listGroup, "list all available group", "")
{
CItemGroupManager::getInstance()->listGroup();
return true;
}
NLMISC_COMMAND(equipGroup, "equip group <name>", "name") NLMISC_COMMAND(equipGroup, "equip group <name>", "name")
{ {
@ -225,14 +230,38 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
NLMISC_COMMAND(createGroup, "create group <name>", "name") NLMISC_COMMAND(createGroup, "create group <name>", "name")
{ {
if(args.empty()) return false; if(args.empty())
return CItemGroupManager::getInstance()->createGroup(args[0]); {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->displaySystemInfo(ucstring("Cannot create a group without name."));
return false;
}
if(!CItemGroupManager::getInstance()->createGroup(args[0]))
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
std::string msg = "A group named " + args[0] + "already exist, cannot create one with the same name.";
pIM->displaySystemInfo(ucstring(msg));
return false;
}
return true;
} }
NLMISC_COMMAND(deleteGroup, "delete group <name>", "name") NLMISC_COMMAND(deleteGroup, "delete group <name>", "name")
{ {
if(args.empty()) return false; if(args.empty())
return CItemGroupManager::getInstance()->deleteGroup(args[0]); {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->displaySystemInfo(ucstring("Cannot delete a group without name."));
return false;
}
if(!CItemGroupManager::getInstance()->deleteGroup(args[0]))
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
std::string msg = "Cannot delete group " + args[0] + " : no group with this name found.";
pIM->displaySystemInfo(msg);
return false;
}
return true;
} }
NLMISC_COMMAND(naked, "get naked !", "") NLMISC_COMMAND(naked, "get naked !", "")

View file

@ -1759,8 +1759,12 @@ class CHandlerItemMenuCheck : public IActionHandler
CViewTextMenu *pMoveToRoom = dynamic_cast<CViewTextMenu*>(pMenu->getView("room")); CViewTextMenu *pMoveToRoom = dynamic_cast<CViewTextMenu*>(pMenu->getView("room"));
CViewTextMenu *pMoveToPa[MAX_INVENTORY_ANIMAL]; CViewTextMenu *pMoveToPa[MAX_INVENTORY_ANIMAL];
CViewTextMenu *pGroupSubMenu = dynamic_cast<CViewTextMenu*>(pMenu->getView("item_group")); CViewTextMenu *pGroupSubMenu = dynamic_cast<CViewTextMenu*>(pMenu->getView("item_group"));
CViewTextMenu *pGroupMoveToBag = dynamic_cast<CViewTextMenu*>(pMenu->getView("group_bag"));
CViewTextMenu *pGroupName = dynamic_cast<CViewTextMenu*>(pMenu->getView("group_name")); CViewTextMenu *pGroupName = dynamic_cast<CViewTextMenu*>(pMenu->getView("group_name"));
CViewTextMenu *pGroupMoveSubMenu = dynamic_cast<CViewTextMenu*>(pMenu->getView("group_move"));
CViewTextMenu *pGroupMoveToBag = dynamic_cast<CViewTextMenu*>(pMenu->getView("group_bag"));
CViewTextMenu *pGroupMoveToGuild = dynamic_cast<CViewTextMenu*>(pMenu->getView("group_guild"));
CViewTextMenu *pGroupMoveToRoom = dynamic_cast<CViewTextMenu*>(pMenu->getView("group_room"));
CViewTextMenu *pGroupMoveToPa[MAX_INVENTORY_ANIMAL]; CViewTextMenu *pGroupMoveToPa[MAX_INVENTORY_ANIMAL];
bool bIsLockedByOwner = pCS->getLockedByOwner(); bool bIsLockedByOwner = pCS->getLockedByOwner();
@ -1912,10 +1916,12 @@ class CHandlerItemMenuCheck : public IActionHandler
if (pMoveToGuild) if (pMoveToGuild)
pMoveToGuild->setActive(invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::guild)); pMoveToGuild->setActive(invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::guild));
if (pGroupMoveToGuild)
pGroupMoveToGuild->setActive(ClientCfg.ItemGroupAllowGuild && invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::guild));
if (pMoveToRoom) if (pMoveToRoom)
pMoveToRoom->setActive(invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::player_room)); pMoveToRoom->setActive(invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::player_room));
if (pGroupMoveToRoom)
pGroupMoveToRoom->setActive(invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::player_room));
// std case: can drop / destroy // std case: can drop / destroy
if(pDrop) pDrop->setActive(invId!=INVENTORIES::guild); if(pDrop) pDrop->setActive(invId!=INVENTORIES::guild);
if(pDestroy) pDestroy->setActive(invId!=INVENTORIES::guild); if(pDestroy) pDestroy->setActive(invId!=INVENTORIES::guild);
@ -1924,20 +1930,24 @@ class CHandlerItemMenuCheck : public IActionHandler
// hide the move entry completely? // hide the move entry completely?
bool someMovePossible= false; bool someMovePossible= false;
if(pMoveSubMenu) bool someGroupMovePossible = false;
if(pMoveSubMenu && pGroupMoveSubMenu)
{ {
if(pMoveToBag) someMovePossible= someMovePossible || pMoveToBag->getActive(); if(pMoveToBag) someMovePossible= someMovePossible || pMoveToBag->getActive();
if(pGroupMoveToBag) someMovePossible= someMovePossible || pGroupMoveToBag->getActive(); if(pGroupMoveToBag) someGroupMovePossible= someGroupMovePossible || pGroupMoveToBag->getActive();
for(i=0;i<MAX_INVENTORY_ANIMAL;i++) for(i=0;i<MAX_INVENTORY_ANIMAL;i++)
{ {
if(pMoveToPa[i]) someMovePossible= someMovePossible || pMoveToPa[i]->getActive(); if(pMoveToPa[i]) someMovePossible= someMovePossible || pMoveToPa[i]->getActive();
if(pGroupMoveToPa[i]) someMovePossible= someMovePossible || pGroupMoveToPa[i]->getActive(); if(pGroupMoveToPa[i]) someGroupMovePossible= someGroupMovePossible || pGroupMoveToPa[i]->getActive();
} }
if(pMoveToGuild) someMovePossible= someMovePossible || pMoveToGuild->getActive(); if(pMoveToGuild) someMovePossible= someMovePossible || pMoveToGuild->getActive();
if(pMoveToRoom) someMovePossible= someMovePossible || pMoveToRoom->getActive(); if(pMoveToRoom) someMovePossible= someMovePossible || pMoveToRoom->getActive();
if(pGroupMoveToGuild) someGroupMovePossible= someGroupMovePossible || pGroupMoveToGuild->getActive();
if(pGroupMoveToRoom) someGroupMovePossible= someGroupMovePossible || (ClientCfg.ItemGroupAllowGuild && pGroupMoveToRoom->getActive());
pMoveSubMenu->setActive(someMovePossible); pMoveSubMenu->setActive(someMovePossible);
pGroupMoveSubMenu->setActive(someGroupMovePossible);
} }
// Equip // Equip

View file

@ -27,7 +27,7 @@
#include "net_manager.h" #include "net_manager.h"
#include "connection.h" // Used to access PlayerSelectedFileName for xml filename #include "connection.h" // Used to access PlayerSelectedFileName for xml filename
#include "nel/gui/db_manager.h" #include "nel/gui/db_manager.h"
#include "interface_v3/interface_manager.h"
CItemGroupManager *CItemGroupManager::_Instance = NULL; CItemGroupManager *CItemGroupManager::_Instance = NULL;
CItemGroup::CItemGroup() CItemGroup::CItemGroup()
@ -391,6 +391,15 @@ bool CItemGroupManager::deleteGroup(std::string name)
return true; return true;
} }
void CItemGroupManager::listGroup()
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
for(auto &group: _Groups)
{
pIM->displaySystemInfo(ucstring(group.name));
}
}
//Used by AH //Used by AH
std::string CItemGroupManager::getGroupName(CDBCtrlSheet* pCS) std::string CItemGroupManager::getGroupName(CDBCtrlSheet* pCS)
@ -428,6 +437,10 @@ std::string CItemGroupManager::toDbPath(INVENTORIES::TInventory inventory)
return LIST_PA2_TEXT; break; return LIST_PA2_TEXT; break;
case INVENTORIES::TInventory::pet_animal4: case INVENTORIES::TInventory::pet_animal4:
return LIST_PA3_TEXT; break; return LIST_PA3_TEXT; break;
case INVENTORIES::TInventory::player_room:
return LIST_ROOM_TEXT;break;
case INVENTORIES::TInventory::guild:
return ClientCfg.ItemGroupAllowGuild ? LIST_GUILD_TEXT : ""; break;
default: default:
return ""; return "";
} }

View file

@ -83,6 +83,7 @@ public:
bool equipGroup(std::string name, bool pullBefore=true); bool equipGroup(std::string name, bool pullBefore=true);
bool createGroup(std::string name); bool createGroup(std::string name);
bool deleteGroup(std::string name); bool deleteGroup(std::string name);
void listGroup();
std::string getGroupName(CDBCtrlSheet *pCS); std::string getGroupName(CDBCtrlSheet *pCS);
private: private: