From cf2bf5629f6d7ab8c34105f6d804ac03d913de40 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 26 Jun 2021 04:33:07 +0800 Subject: [PATCH] Move item rename to be an admin command, not for player use --- ryzom/common/data_common/msg.xml | 3 +- .../game_share/ring_session_manager_itf.cpp | 3 - .../src/game_share/ring_session_manager_itf.h | 5 +- .../egs/client_commands_privileges.txt | 5 +- .../egs/client_commands_privileges_open.txt | 5 +- .../src/entities_game_service/admin.cpp | 60 ++++++++++++++++++- .../entities_game_service/client_messages.cpp | 50 ---------------- .../entities_game_service/database_guild.cpp | 5 +- .../entities_game_service/database_guild.h | 7 +-- .../database_outpost.cpp | 3 - .../entities_game_service/database_outpost.h | 3 - .../entities_game_service/database_plr.cpp | 3 - .../src/entities_game_service/database_plr.h | 3 - .../database_mapping.cpp | 3 - .../shard_unifier_service/database_mapping.h | 3 - 15 files changed, 69 insertions(+), 92 deletions(-) diff --git a/ryzom/common/data_common/msg.xml b/ryzom/common/data_common/msg.xml index f4f001629..97ddc9bec 100644 --- a/ryzom/common/data_common/msg.xml +++ b/ryzom/common/data_common/msg.xml @@ -167,8 +167,7 @@ - - + diff --git a/ryzom/common/src/game_share/ring_session_manager_itf.cpp b/ryzom/common/src/game_share/ring_session_manager_itf.cpp index 1ee2d3bf5..584a68566 100644 --- a/ryzom/common/src/game_share/ring_session_manager_itf.cpp +++ b/ryzom/common/src/game_share/ring_session_manager_itf.cpp @@ -2,9 +2,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) -// // 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 diff --git a/ryzom/common/src/game_share/ring_session_manager_itf.h b/ryzom/common/src/game_share/ring_session_manager_itf.h index f1b4e6e98..19a261fbf 100644 --- a/ryzom/common/src/game_share/ring_session_manager_itf.h +++ b/ryzom/common/src/game_share/ring_session_manager_itf.h @@ -2,9 +2,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) -// // 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); diff --git a/ryzom/server/data_shard/egs/client_commands_privileges.txt b/ryzom/server/data_shard/egs/client_commands_privileges.txt index b9f28f95f..d315bcccd 100644 --- a/ryzom/server/data_shard/egs/client_commands_privileges.txt +++ b/ryzom/server/data_shard/egs/client_commands_privileges.txt @@ -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: eventSetBotFameByKill :DEV:SGM:GM:EM: // Changes the amount of fame earned for bot faction when killing it: 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 diff --git a/ryzom/server/data_shard/egs/client_commands_privileges_open.txt b/ryzom/server/data_shard/egs/client_commands_privileges_open.txt index 33272aada..3e89f1f44 100644 --- a/ryzom/server/data_shard/egs/client_commands_privileges_open.txt +++ b/ryzom/server/data_shard/egs/client_commands_privileges_open.txt @@ -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: eventSetBotFameByKill :: audit // Changes the amount of fame earned for bot faction when killing it: 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 diff --git a/ryzom/server/src/entities_game_service/admin.cpp b/ryzom/server/src/entities_game_service/admin.cpp index e25e30b3d..27e36489e 100644 --- a/ryzom/server/src/entities_game_service/admin.cpp +++ b/ryzom/server/src/entities_game_service/admin.cpp @@ -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)", " ") +{ + 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", " " ) { if ( args.size() < 1 ) diff --git a/ryzom/server/src/entities_game_service/client_messages.cpp b/ryzom/server/src/entities_game_service/client_messages.cpp index 3124ef6ea..7bedf0bf5 100644 --- a/ryzom/server/src/entities_game_service/client_messages.cpp +++ b/ryzom/server/src/entities_game_service/client_messages.cpp @@ -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 }, diff --git a/ryzom/server/src/entities_game_service/database_guild.cpp b/ryzom/server/src/entities_game_service/database_guild.cpp index 1872c355c..c79d41e7e 100644 --- a/ryzom/server/src/entities_game_service/database_guild.cpp +++ b/ryzom/server/src/entities_game_service/database_guild.cpp @@ -2,9 +2,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) -// // 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) diff --git a/ryzom/server/src/entities_game_service/database_guild.h b/ryzom/server/src/entities_game_service/database_guild.h index 1d6047ed4..b9b28b7a2 100644 --- a/ryzom/server/src/entities_game_service/database_guild.h +++ b/ryzom/server/src/entities_game_service/database_guild.h @@ -3,9 +3,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) -// // 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) { diff --git a/ryzom/server/src/entities_game_service/database_outpost.cpp b/ryzom/server/src/entities_game_service/database_outpost.cpp index b5e3dfce2..2ec9f5e71 100644 --- a/ryzom/server/src/entities_game_service/database_outpost.cpp +++ b/ryzom/server/src/entities_game_service/database_outpost.cpp @@ -2,9 +2,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) -// // 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 diff --git a/ryzom/server/src/entities_game_service/database_outpost.h b/ryzom/server/src/entities_game_service/database_outpost.h index 58bc0bb76..4e649a6db 100644 --- a/ryzom/server/src/entities_game_service/database_outpost.h +++ b/ryzom/server/src/entities_game_service/database_outpost.h @@ -3,9 +3,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) -// // 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 diff --git a/ryzom/server/src/entities_game_service/database_plr.cpp b/ryzom/server/src/entities_game_service/database_plr.cpp index e37308361..5bd93c07d 100644 --- a/ryzom/server/src/entities_game_service/database_plr.cpp +++ b/ryzom/server/src/entities_game_service/database_plr.cpp @@ -2,9 +2,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2014-2020 Jan BOON (Kaetemi) -// // 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 diff --git a/ryzom/server/src/entities_game_service/database_plr.h b/ryzom/server/src/entities_game_service/database_plr.h index edc3957bb..837ffae6d 100644 --- a/ryzom/server/src/entities_game_service/database_plr.h +++ b/ryzom/server/src/entities_game_service/database_plr.h @@ -3,9 +3,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2014-2020 Jan BOON (Kaetemi) -// // 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 diff --git a/ryzom/server/src/shard_unifier_service/database_mapping.cpp b/ryzom/server/src/shard_unifier_service/database_mapping.cpp index 798603533..48b3a97b4 100644 --- a/ryzom/server/src/shard_unifier_service/database_mapping.cpp +++ b/ryzom/server/src/shard_unifier_service/database_mapping.cpp @@ -2,9 +2,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) -// // 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 diff --git a/ryzom/server/src/shard_unifier_service/database_mapping.h b/ryzom/server/src/shard_unifier_service/database_mapping.h index 926cc031b..631447946 100644 --- a/ryzom/server/src/shard_unifier_service/database_mapping.h +++ b/ryzom/server/src/shard_unifier_service/database_mapping.h @@ -2,9 +2,6 @@ // Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // -// This source file has been modified by the following contributors: -// Copyright (C) 2019 Jan BOON (Kaetemi) -// // 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