From ad6dfdcf435eef7e47a10ef1abdb86dfd83ded8b Mon Sep 17 00:00:00 2001 From: Nuno Date: Thu, 5 Oct 2023 12:44:46 +0200 Subject: [PATCH] Added spawnCrystalItem --- .../src/interface_v3/action_handler_game.cpp | 2 +- .../mission_manager/missions_commands.cpp | 75 +++++++++++++++++++--- 2 files changed, 67 insertions(+), 10 deletions(-) diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 790c8b13d..1d1f78e1d 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2500,7 +2500,7 @@ class CAHTarget : public IActionHandler if (preferCompleteMatch) { // Try to get the entity with complete match first - entity = EntitiesMngr.getEntityByName (entityName, false, true); + entity = EntitiesMngr.getEntityByName(entityName, false, true); } if (entity == NULL && !keywords.empty()) diff --git a/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp b/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp index c2827f029..ef0b2d2aa 100644 --- a/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp +++ b/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp @@ -38,10 +38,12 @@ #include "weather_everywhere.h" #include "death_penalties.h" #include "harvest_source.h" + #include "mission_manager/mission_team.h" #include "mission_manager/mission_step_ai.h" #include "mission_manager/mission_guild.h" #include "shop_type/named_items.h" +#include "modules/client_command_forwarder.h" #include "guild_manager/guild_manager.h" #include "guild_manager/guild.h" #include "guild_manager/guild_member_module.h" @@ -622,11 +624,11 @@ NLMISC_COMMAND(getEid, "get entitiy id of entity", "") NLMISC_COMMAND(spawnItem, "Spawn a new Item", " [|=,*]") { - GET_ACTIVE_CHARACTER - if (args.size() < 6) return false; + GET_ACTIVE_CHARACTER + string selected_inv = args[1]; CInventoryPtr inventory = getInventory(c, selected_inv); @@ -731,11 +733,11 @@ NLMISC_COMMAND(spawnItem, "Spawn a new Item", " < NLMISC_COMMAND(spawnNamedItem, "Spawn a named Item", " ") { - GET_ACTIVE_CHARACTER - if (args.size() < 4) return false; + GET_ACTIVE_CHARACTER + string selected_inv = args[1]; CInventoryPtr inventory = getInventory(c, selected_inv); @@ -763,6 +765,66 @@ NLMISC_COMMAND(spawnNamedItem, "Spawn a named Item", " [,,...]") +{ + + GET_ACTIVE_CHARACTER + + if (args.size() < 5) + return false; + + string selected_inv = args[1]; + + CInventoryPtr inventory = getInventory(c, selected_inv); + if (inventory == NULL) + { + log.displayNL("ERR: invalid inventory"); + return true; + } + + bool isSpell = args[2] == "spell"; + + CSheetId sheet; + if (isSpell) + sheet = CSheetId("crystalized_spell.sitem"); + else + sheet = CSheetId("crystalized_allegory.sitem"); + + uint16 sap_charge; + NLMISC::fromString(args[3], sap_charge); + + // Get Sbricks + std::vector sheets; + std::vector sheet_names; + NLMISC::splitString(args[4], ",", sheet_names); + for (uint32 i=0; iaddItemToInventory(getTInventory(selected_inv), item)) + { + item->recommended(sap_charge); + item->applyEnchantment(sheets); + + log.displayNL("OK"); + return true; + } + item.deleteItem(); + } + + log.displayNL("ERR: adding item"); + return true; +} + + //---------------------------------------------------------------------------- NLMISC_COMMAND(getItemList, "get list of items of character by filter", " [bag sheet quantity_min quantity_max quality_min quality_max extra_infos]") @@ -2583,11 +2645,6 @@ NLMISC_COMMAND(spawn, "spawn entity", " quantity sheet dispersion spawnbot uint32 nbBots; fromString(args[1], nbBots); - if (nbBots<=0) - { - log.displayNL("ERR: invalid bot count"); - return false; - } NLMISC::CSheetId sheetId(args[2]); if (sheetId == NLMISC::CSheetId::Unknown) -- 2.11.4.GIT