mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-25 16:46:17 +00:00
Allow support for room / guild movement
--HG-- branch : item_group
This commit is contained in:
parent
ecf2ac530c
commit
6c9bbb8c0b
7 changed files with 81 additions and 13 deletions
|
@ -1847,7 +1847,17 @@
|
|||
name="uimMtPaMount3"
|
||||
handler="item_group_move"
|
||||
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 !-->
|
||||
|
||||
</group>
|
||||
|
|
|
@ -589,7 +589,7 @@ CClientConfig::CClientConfig()
|
|||
FollowOnAtk = true;
|
||||
AtkOnSelect = false;
|
||||
TransparentUnderCursor = false;
|
||||
|
||||
ItemGroupAllowGuild = false;
|
||||
// PREFERENCES
|
||||
FPV = false;
|
||||
CameraHeight = 2.5f;
|
||||
|
@ -1440,6 +1440,8 @@ void CClientConfig::setValues()
|
|||
READ_BOOL_FV(FollowOnAtk);
|
||||
READ_BOOL_FV(AtkOnSelect);
|
||||
READ_BOOL_DEV(TransparentUnderCursor);
|
||||
//
|
||||
READ_BOOL_FV(ItemGroupAllowGuild);
|
||||
|
||||
|
||||
/////////////////
|
||||
|
|
|
@ -571,6 +571,9 @@ struct CClientConfig
|
|||
/// Makes entities transparent if they are under cursor
|
||||
bool TransparentUnderCursor;
|
||||
|
||||
/// Allow item group to move from / to guild room
|
||||
bool ItemGroupAllowGuild;
|
||||
|
||||
|
||||
/////////////////
|
||||
// PREFERENCES //
|
||||
|
|
|
@ -209,6 +209,11 @@ NLMISC_COMMAND(who, "Display all players currently in region","[<options (GM, ch
|
|||
return true;
|
||||
}
|
||||
|
||||
NLMISC_COMMAND(listGroup, "list all available group", "")
|
||||
{
|
||||
CItemGroupManager::getInstance()->listGroup();
|
||||
return true;
|
||||
}
|
||||
|
||||
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")
|
||||
{
|
||||
if(args.empty()) return false;
|
||||
return CItemGroupManager::getInstance()->createGroup(args[0]);
|
||||
if(args.empty())
|
||||
{
|
||||
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")
|
||||
{
|
||||
if(args.empty()) return false;
|
||||
return CItemGroupManager::getInstance()->deleteGroup(args[0]);
|
||||
if(args.empty())
|
||||
{
|
||||
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 !", "")
|
||||
|
|
|
@ -1759,8 +1759,12 @@ class CHandlerItemMenuCheck : public IActionHandler
|
|||
CViewTextMenu *pMoveToRoom = dynamic_cast<CViewTextMenu*>(pMenu->getView("room"));
|
||||
CViewTextMenu *pMoveToPa[MAX_INVENTORY_ANIMAL];
|
||||
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 *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];
|
||||
|
||||
bool bIsLockedByOwner = pCS->getLockedByOwner();
|
||||
|
@ -1912,10 +1916,12 @@ class CHandlerItemMenuCheck : public IActionHandler
|
|||
|
||||
if (pMoveToGuild)
|
||||
pMoveToGuild->setActive(invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::guild));
|
||||
|
||||
if (pGroupMoveToGuild)
|
||||
pGroupMoveToGuild->setActive(ClientCfg.ItemGroupAllowGuild && invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::guild));
|
||||
if (pMoveToRoom)
|
||||
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
|
||||
if(pDrop) pDrop->setActive(invId!=INVENTORIES::guild);
|
||||
if(pDestroy) pDestroy->setActive(invId!=INVENTORIES::guild);
|
||||
|
@ -1924,20 +1930,24 @@ class CHandlerItemMenuCheck : public IActionHandler
|
|||
|
||||
// hide the move entry completely?
|
||||
bool someMovePossible= false;
|
||||
if(pMoveSubMenu)
|
||||
bool someGroupMovePossible = false;
|
||||
if(pMoveSubMenu && pGroupMoveSubMenu)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
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(pMoveToRoom) someMovePossible= someMovePossible || pMoveToRoom->getActive();
|
||||
if(pGroupMoveToGuild) someGroupMovePossible= someGroupMovePossible || pGroupMoveToGuild->getActive();
|
||||
if(pGroupMoveToRoom) someGroupMovePossible= someGroupMovePossible || (ClientCfg.ItemGroupAllowGuild && pGroupMoveToRoom->getActive());
|
||||
pMoveSubMenu->setActive(someMovePossible);
|
||||
pGroupMoveSubMenu->setActive(someGroupMovePossible);
|
||||
}
|
||||
|
||||
// Equip
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "net_manager.h"
|
||||
#include "connection.h" // Used to access PlayerSelectedFileName for xml filename
|
||||
#include "nel/gui/db_manager.h"
|
||||
|
||||
#include "interface_v3/interface_manager.h"
|
||||
CItemGroupManager *CItemGroupManager::_Instance = NULL;
|
||||
|
||||
CItemGroup::CItemGroup()
|
||||
|
@ -391,6 +391,15 @@ bool CItemGroupManager::deleteGroup(std::string name)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CItemGroupManager::listGroup()
|
||||
{
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
for(auto &group: _Groups)
|
||||
{
|
||||
pIM->displaySystemInfo(ucstring(group.name));
|
||||
}
|
||||
}
|
||||
|
||||
//Used by AH
|
||||
|
||||
std::string CItemGroupManager::getGroupName(CDBCtrlSheet* pCS)
|
||||
|
@ -428,6 +437,10 @@ std::string CItemGroupManager::toDbPath(INVENTORIES::TInventory inventory)
|
|||
return LIST_PA2_TEXT; break;
|
||||
case INVENTORIES::TInventory::pet_animal4:
|
||||
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:
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
bool equipGroup(std::string name, bool pullBefore=true);
|
||||
bool createGroup(std::string name);
|
||||
bool deleteGroup(std::string name);
|
||||
void listGroup();
|
||||
std::string getGroupName(CDBCtrlSheet *pCS);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue