Move item rename to be an admin command, not for player use

merge/2021-11-19
kaetemi 3 years ago
parent ec6b13a88b
commit cf2bf5629f
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -167,8 +167,7 @@
<leaf name="USE_ITEM" sendto="EGS" format="u16" description="client wants to use teleport in the specified bag slot or consume an item to trigger its effect" />
<leaf name="STOP_USE_XP_CAT" sendto="EGS" format="b" description="client wants to stop using xp catalyser" />
<leaf name="LOCK" sendto="EGS" format="u8 u16 b" description="lock or unlock an item. inventory, slot, lock" />
<leaf name="RENAME" sendto="EGS" format="u8 u16 b s" description="change an item name to a phrase or literal. inventory, slot, literal, name" />
<leaf name="WRITE" sendto="EGS" format="u8 u16 s" description="wrrite a crafter's message. inventory, slot, text" />
<leaf name="WRITE" sendto="EGS" format="u8 u16 s" description="write a crafter's message. inventory, slot, text" />
</branch>
<branch name="TP">
<leaf name="RESPAWN" sendto="EGS" format="" description="teleport the player to his respawn point" />

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -2530,7 +2527,7 @@ namespace RSMGR
{
H_AUTO(invokeResult_invokeResult);
#ifdef NL_DEBUG
nldebug("CRingSessionManagerWeb::invokeResult called (%s)", resultString.c_str());
nldebug("CRingSessionManagerWeb::invokeResult called");
#endif
NLNET::CMessage message("RET");
nlWrite(message, serial, userId);

@ -165,13 +165,14 @@ eventSetNpcGroupEmote :DEV:SGM:GM:EM: // Set the emote for the NPC group to
eventSetFaunaBotAggroRange :DEV:SGM:GM:EM: // Set the aggro ranges (not hungry, hungry and hunting) of a fauna creature
eventResetFaunaBotAggroRange :DEV:SGM:GM:EM: // Reset the aggro range of a fauna creature to sheet values
eventSetBotCanAggro :DEV:SGM:GM:EM: // Define if a creature can take aggro for another entity
eventSetItemCustomText :DEV:SGM:GM:EM: // Set the custom text of an item. For scroll-like items it's the text displayed in the help window.
eventResetItemCustomText :DEV:SGM:GM:EM: // Reset the custom text of an item to an empty string.
eventSetBotSheet :DEV:SGM:GM:EM: // Changes the sheet of a bot: <.creature sheet>
eventSetBotFaction :DEV:SGM:GM:EM: // Changes the faction of a bot: <faction name>
eventSetBotFameByKill :DEV:SGM:GM:EM: // Changes the amount of fame earned for bot faction when killing it: <fame value>
eventSetBotURL :DEV:SGM:GM:EM: // Set the url of a bot
eventSetBotURLName :DEV:SGM:GM:EM: // Set the url name of a bot
eventSetItemCustomText :DEV:SGM:GM:EM: // Set the custom text of an item. For scroll-like items it's the text displayed in the help window.
eventResetItemCustomText :DEV:SGM:GM:EM: // Reset the custom text of an item to an empty string.
eventSetItemName :DEV:SGM:GM:EM: // Set a name on an item. Can be a literal or a phrase from translation
eventSpawnToxic :DEV:SGM:GM:EM: // Add toxic cloud
eventNpcSay :DEV:SGM:GM:EM: // Have an NPC say a text
eventSetBotFacing :DEV:SGM:GM:EM: // Set the direction in which a bot faces

@ -165,13 +165,14 @@ eventSetNpcGroupEmote :: audit // Set the emote for the NPC group to execute
eventSetFaunaBotAggroRange :: audit // Set the aggro ranges (not hungry, hungry and hunting) of a fauna creature
eventResetFaunaBotAggroRange :: audit // Reset the aggro range of a fauna creature to sheet values
eventSetBotCanAggro :: audit // Define if a creature can take aggro for another entity
eventSetItemCustomText :: audit // Set the custom text of an item. For scroll-like items it's the text displayed in the help window.
eventResetItemCustomText :: audit // Reset the custom text of an item to an empty string.
eventSetBotSheet :: audit // Changes the sheet of a bot: <.creature sheet>
eventSetBotFaction :: audit // Changes the faction of a bot: <faction name>
eventSetBotFameByKill :: audit // Changes the amount of fame earned for bot faction when killing it: <fame value>
eventSetBotURL :: audit // Set the url of a bot
eventSetBotURLName :: audit // Set the url name of a bot
eventSetItemCustomText :: audit // Set the custom text of an item. For scroll-like items it's the text displayed in the help window.
eventResetItemCustomText :: audit // Reset the custom text of an item to an empty string.
eventSetItemName :: audit // Set a name on an item. Can be a literal or a phrase from translation
eventSpawnToxic :: audit // Add toxic cloud
eventNpcSay :: audit // Have an NPC say a text
eventSetBotFacing :: audit // Set the direction in which a bot faces

@ -387,11 +387,14 @@ AdminCommandsInit[] =
"eventSetFaunaBotAggroRange", true,
"eventResetFaunaBotAggroRange", true,
"eventSetBotCanAggro", true,
"eventSetItemCustomText", true,
"eventResetItemCustomText", true,
"eventSetBotSheet", true,
"eventSetBotFaction", true,
"eventSetBotFameByKill", true,
"eventSetItemCustomText", true,
"eventResetItemCustomText", true,
"eventSetItemName", true,
"dssTarget", true, //ring stuff
"forceMissionProgress", true,
"eventSetBotURL", true,
@ -8419,7 +8422,60 @@ NLMISC_COMMAND(eventResetItemCustomText, "set an item custom text, which replace
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(eventSetItemName, "change an item name to a phrase or literal (e.g.: /a eventSetItemName bag 5 1 \"Shield of Destruction\", /a eventSetItemName bag 5 0 shield_ep2_kami250_1)", "<eId> <inventory> <slot in inventory> <literal> <name>")
{
if (args.size() < 5)
return false;
GET_CHARACTER;
if (!c)
{
log.displayNL("Invalid character '%s'", args[0].c_str());
return false;
}
INVENTORIES::TInventory inventory = INVENTORIES::toInventory(args[1]);
if (inventory == INVENTORIES::UNDEFINED)
{
log.displayNL("Inventory is undefined");
return false;
}
uint32 slot;
if (!NLMISC::fromString(args[2], slot))
{
log.displayNL("Slot '%s' is not a valid integer", args[2].c_str());
return false;
}
bool literal = NLMISC::toBool(args[3]);
string name = args[4];
CInventoryPtr invent = c->getInventory(inventory);
if (slot >= invent->getSlotCount())
{
log.displayNL("Invalid slot specified");
return false;
}
CGameItemPtr item = invent->getItem(slot);
if (item == NULL)
{
log.displayNL("Item does not exist");
return false;
}
if (literal)
{
name = capitalizeFirst(name); // Require first character to be capitalized
if (name.size() >= 255) // Limit literal text length
name = name.substr(0, 255);
}
item->setPhraseId(name, literal);
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(eventSpawnToxic, "Spawn a toxic cloud", "<player eid> <posXm> <posYm> <iRadius{0,1,2}=0> <dmgPerHit=0> <updateFrequency=ToxicCloudUpdateFrequency> <lifetimeInTicks=ToxicCloudDefaultLifetime>" )
{
if ( args.size() < 1 )

@ -377,55 +377,6 @@ void cbClientItemLock(NLNET::CMessage &msgin, const std::string &serviceName, NL
item->setLockedByOwner(lock);
}
void cbClientItemRename(NLNET::CMessage &msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
{
CEntityId eid;
INVENTORIES::TInventory inventory;
uint16 slot;
bool literal;
string text;
msgin.serial(eid);
msgin.serialShortEnum(inventory);
msgin.serial(slot);
msgin.serial(literal);
msgin.serial(text);
CCharacter *character = PlayerManager.getChar(eid);
DROP_IF(!character, "Character not found", return);
DROP_IF(inventory == INVENTORIES::UNDEFINED, "Inventory is undefined", return);
CInventoryPtr invent = character->getInventory(inventory);
DROP_IF(slot >= invent->getSlotCount(), "Invalid slot specified", return);
CGameItemPtr item = invent->getItem(slot);
DROP_IF(item == NULL, "Item does not exist", return);
if (!character->havePriv(":DEV:SGM:GM:EM:"))
{
// TODO: Some special rights to name items :)
const NLMISC::CEntityId &crafterEId = item->getCreator();
const NLMISC::CEntityId &userEId = character->getId();
DROP_IF(crafterEId != userEId, "Item name can only be set by the crafter", return);
}
/*
const CStaticItem *form = item->getStaticForm();
DROP_IF(!form, "Item does not have a static form", return);
ITEMFAMILY::EItemFamily family = form->Family;
DROP_IF(!ITEMFAMILY::isTextCustomizable(family), "Item text cannot be changed", return);
*/
if (literal)
{
text = capitalizeFirst(text); // Require first character to be capitalized
if (text.size() >= 255) // Limit literal text length
text = text.substr(0, 255);
}
item->setPhraseId(text, literal);
}
/// returns 0 on success, anything else is error:
/// -1: Invalid inventory
/// -2: Invalid slot
@ -3486,7 +3437,6 @@ TUnifiedCallbackItem CbClientArray[]=
{ "CLIENT:ITEM:USE_ITEM", cbClientItemUseItem },
{ "CLIENT:ITEM:STOP_USE_XP_CAT", cbClientItemStopUseXpCat },
{ "CLIENT:ITEM:LOCK", cbClientItemLock },
{ "CLIENT:ITEM:RENAME", cbClientItemRename },
{ "CLIENT:ITEM:WRITE", cbClientItemWrite },

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -514,7 +511,7 @@ void CBankAccessor_GUILD::TGUILD::TOUTPOST::TO::TSQUADS::init(ICDBStructNode *pa
{
node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("SP%u", i)), false );
nlassert(node != NULL);
C_SP[i].init(node, i);
_SP[i].init(node, i);
}
for (uint i=0; i<24; ++i)

@ -3,9 +3,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -970,7 +967,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
private:
ICDBStructNode *_BranchNode;
TSP C_SP[24];
TSP _SP[24];
TT _T[24];
@ -986,7 +983,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
TSP &getSP(uint32 index)
{
nlassert(index < 24);
return C_SP[index];
return _SP[index];
}
TT &getT(uint32 index)
{

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the

@ -3,9 +3,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2014-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the

@ -3,9 +3,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2014-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the

Loading…
Cancel
Save