mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-23 17:38:44 +00:00
Minor item group fixes :
* Slot properly saved for right/left hand (couldn't equip 1H sword + dagger before) * Ingame macro edition for item group * Use the correct index (db index and not item list index) to autoEquip an item * non ascii characters (accentued characters and stuff like that) are now correctly displayed in interface / commands output --HG-- branch : compatibility-develop
This commit is contained in:
parent
624a0c867b
commit
79636f393d
5 changed files with 72 additions and 13 deletions
|
@ -220,6 +220,21 @@
|
|||
</parameter>
|
||||
</action>
|
||||
<action name="phrase_cancel_cast" hardtext="uiCancelCast" contexts="game, r2ed_anim_test"/>
|
||||
<action name="item_group_equip" hardtext="uiMacroItemGroupEquip" contexts="game, r2ed_anim_test">
|
||||
<parameter hardtext="uiMacroItemGroupName" type="%action_param_user_name" name="name" />
|
||||
</action>
|
||||
<action name="item_group_move" hardtext="uiMacroItemGroupMove" contexts="game, r2ed_anim_test">
|
||||
<parameter hardtext="uiMacroItemGroupName" type="%action_param_user_name" name="name" />
|
||||
<parameter hardtext="uiMacroItemGroupDestination" type="%action_param_constant" name="destination" value="bag">
|
||||
<value value="bag" hardtext="uimMtBag" />
|
||||
<value value="pet_animal1" hardtext="uimMtPaPacker0" />
|
||||
<value value="pet_animal2" hardtext="uimMtPaPacker1" />
|
||||
<value value="pet_animal3" hardtext="uimMtPaPacker2" />
|
||||
<value value="pet_animal4" hardtext="uimMtPaPacker3" />
|
||||
<value value="player_room" hardtext="uimMtRoom" />
|
||||
<value value="guild" hardtext="uimMtGuild" />
|
||||
</parameter>
|
||||
</action>
|
||||
</action_category>
|
||||
|
||||
<action_category name="chat" hardtext="uiChat" contexts="game, r2ed, r2ed_anim_test"> <!-- not available in r2ed for now -->
|
||||
|
|
|
@ -233,14 +233,20 @@ NLMISC_COMMAND(equipGroup, "equip group <name>", "name")
|
|||
if(CItemGroupManager::getInstance()->equipGroup(args[0]))
|
||||
{
|
||||
ucstring msg = CI18N::get("cmdEquipGroupSuccess");
|
||||
strFindReplace(msg, "%name", args[0]);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(args[0]);
|
||||
strFindReplace(msg, "%name", nameUC);
|
||||
pIM->displaySystemInfo(msg);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ucstring msg = CI18N::get("cmdEquipGroupError");
|
||||
strFindReplace(msg, "%name", args[0]);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(args[0]);
|
||||
strFindReplace(msg, "%name", nameUC);
|
||||
pIM->displaySystemInfo(msg);
|
||||
return false;
|
||||
}
|
||||
|
@ -261,7 +267,10 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
|
|||
if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1])))
|
||||
{
|
||||
ucstring msg = CI18N::get("cmdMoveGroupSuccess");
|
||||
strFindReplace(msg, "%name", args[0]);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(args[0]);
|
||||
strFindReplace(msg, "%name", nameUC);
|
||||
strFindReplace(msg, "%inventory", args[1]);
|
||||
pIM->displaySystemInfo(msg);
|
||||
return true;
|
||||
|
@ -269,7 +278,10 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
|
|||
else
|
||||
{
|
||||
ucstring msg = CI18N::get("cmdMoveGroupError");
|
||||
strFindReplace(msg, "%name", args[0]);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(args[0]);
|
||||
strFindReplace(msg, "%name", nameUC);
|
||||
strFindReplace(msg, "%inventory", args[1]);
|
||||
pIM->displaySystemInfo(msg);
|
||||
return false;
|
||||
|
@ -297,14 +309,20 @@ NLMISC_COMMAND(createGroup, "create group <name> [true](create a <remove> for ev
|
|||
msg = CI18N::get("cmdCreateGroupSuccess2");
|
||||
else
|
||||
msg = CI18N::get("cmdCreateGroupSuccess1");
|
||||
strFindReplace(msg, "%name", args[0]);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(args[0]);
|
||||
strFindReplace(msg, "%name", nameUC);
|
||||
pIM->displaySystemInfo(msg);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ucstring msg = CI18N::get("cmdCreateGroupError");
|
||||
strFindReplace(msg, "%name", args[0]);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(args[0]);
|
||||
strFindReplace(msg, "%name", nameUC);
|
||||
pIM->displaySystemInfo(msg);
|
||||
return false;
|
||||
}
|
||||
|
@ -325,14 +343,20 @@ NLMISC_COMMAND(deleteGroup, "delete group <name>", "name")
|
|||
if(CItemGroupManager::getInstance()->deleteGroup(args[0]))
|
||||
{
|
||||
ucstring msg = CI18N::get("cmdDeleteGroupSuccess");
|
||||
strFindReplace(msg, "%name", args[0]);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(args[0]);
|
||||
strFindReplace(msg, "%name", nameUC);
|
||||
pIM->displaySystemInfo(msg);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ucstring msg = CI18N::get("cmdDeleteGroupError");
|
||||
strFindReplace(msg, "%name", args[0]);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(args[0]);
|
||||
strFindReplace(msg, "%name", nameUC);
|
||||
pIM->displaySystemInfo(msg);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2041,7 +2041,10 @@ class CHandlerItemMenuCheck : public IActionHandler
|
|||
{
|
||||
std::string name = groupNames[i];
|
||||
std::string ahParams = "name=" + name;
|
||||
pGroupMenu->addLine(ucstring(name), "", "", name);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(name);
|
||||
pGroupMenu->addLine(nameUC, "", "", name);
|
||||
CGroupSubMenu* pNewSubMenu = new CGroupSubMenu(CViewBase::TCtorParam());
|
||||
pGroupMenu->setSubMenu(pGroupMenu->getNumLine()-1, pNewSubMenu);
|
||||
if(pNewSubMenu)
|
||||
|
|
|
@ -492,8 +492,10 @@ bool CItemGroupManager::createGroup(std::string name, bool removeUnequiped)
|
|||
{
|
||||
SLOT_EQUIPMENT::TSlotEquipment slot = (SLOT_EQUIPMENT::TSlotEquipment)i;
|
||||
//Instead of doing two separate for, just be a bit tricky for hand equipment
|
||||
if(slot == SLOT_EQUIPMENT::HANDR || slot == SLOT_EQUIPMENT::HANDL)
|
||||
pCS = CInventoryManager::getInstance()->getHandSheet((uint32)(slot - SLOT_EQUIPMENT::HANDL));
|
||||
if(slot == SLOT_EQUIPMENT::HANDR)
|
||||
pCS = CInventoryManager::getInstance()->getHandSheet(0);
|
||||
else if(slot == SLOT_EQUIPMENT::HANDL)
|
||||
pCS = CInventoryManager::getInstance()->getHandSheet(1);
|
||||
else
|
||||
pCS = CInventoryManager::getInstance()->getEquipSheet(i);
|
||||
if(!pCS) continue;
|
||||
|
@ -537,7 +539,10 @@ void CItemGroupManager::listGroup()
|
|||
{
|
||||
CItemGroup group = _Groups[i];
|
||||
ucstring msg = NLMISC::CI18N::get("cmdListGroupLine");
|
||||
NLMISC::strFindReplace(msg, "%name", group.name);
|
||||
//Use ucstring because group name can contain accentued characters (and stuff like that)
|
||||
ucstring nameUC;
|
||||
nameUC.fromUtf8(group.name);
|
||||
NLMISC::strFindReplace(msg, "%name", nameUC);
|
||||
NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size()));
|
||||
pIM->displaySystemInfo(msg);
|
||||
}
|
||||
|
@ -607,7 +612,14 @@ std::vector<CInventoryItem> CItemGroupManager::matchingItems(CItemGroup *group,
|
|||
SLOT_EQUIPMENT::TSlotEquipment slot;
|
||||
if(group->contains(pCS, slot))
|
||||
{
|
||||
out.push_back(CInventoryItem(pCS, inventory, i, slot));
|
||||
//Sometimes, index in the list differ from the index in DB, and we need the index in DB, not the one from the list
|
||||
std::string dbPath = pCS->getSheet();
|
||||
std::size_t found = dbPath.find_last_of(":");
|
||||
std::string indexS = dbPath.substr(found+1);
|
||||
uint32 index;
|
||||
NLMISC::fromString(indexS, index);
|
||||
if(i != index) nldebug("Index from list is %d, where index from DB is %d", i, index);
|
||||
out.push_back(CInventoryItem(pCS, inventory, index, slot));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13536,3 +13536,8 @@ cmdListGroupLine [* %name, with %size items inside.]
|
|||
|
||||
//interface
|
||||
uimGroup [Groups]
|
||||
//Macro edition
|
||||
uiMacroItemGroupEquip [Equip an item group]
|
||||
uiMacroItemGroupName [Item group name]
|
||||
uiMacroItemGroupMove [Move an item group]
|
||||
uiMacroItemGroupDestination [Item group destination]
|
||||
|
|
Loading…
Reference in a new issue