Add config settings for the !item creditchest command

This commit is contained in:
Crypto137 2026-03-09 18:09:55 +03:00
parent 48c2ce65b2
commit 6f2ada7632
4 changed files with 23 additions and 10 deletions

View file

@ -1,6 +1,6 @@
# Server Commands
This list was automatically generated on `2026.03.08 13:37:05 UTC` using server version `1.0.0`.
This list was automatically generated on `2026.03.09 15:06:03 UTC` using server version `1.0.0`.
To see an up to date list of all commands, type !commands in the server console or the in-game chat. When invoking a command from in-game your account has to meet the user level requirement for the command.
@ -108,7 +108,7 @@ Commands for managing items.
| Command | Description | User Level | Invoker Type |
| ---------------------------- | -------------------------------------------------------------------------- | ---------- | ------------ |
| !item cleardeliverybox | Destroys all items contained in the delivery box inventory. | Any | Client |
| !item creditchest | Converts 500k credits to a sellable chest item. | Admin | Client |
| !item creditchest | Converts credits to a sellable chest item. | Any | Client |
| !item destroyindestructible | Destroys indestructible items contained in the player's general inventory. | Any | Client |
| !item drop [pattern] [count] | Creates and drops the specified item from the current avatar. | Admin | Client |
| !item give [pattern] [count] | Creates and gives the specified item to the current player. | Admin | Client |

View file

@ -11,6 +11,8 @@ namespace MHServerEmu.Games
public bool AutoUnlockTeamUps { get; private set; } = true;
public bool DisableMovementPowerChargeCost { get; private set; } = false;
public bool AllowSameGroupTalents { get; private set; } = false;
public bool EnableCreditChestConversion { get; private set; } = false;
public float CreditChestConversionMultiplier { get; private set; } = 2f;
public bool DisableInstancedLoot { get; private set; } = false;
public float LootSpawnGridCellRadius { get; private set; } = 20f;
public float TrashedItemExpirationTimeMultiplier { get; private set; } = 1f;

View file

@ -147,30 +147,37 @@ namespace MHServerEmu.Commands.Implementations
}
[Command("creditchest")]
[CommandDescription("Converts 500k credits to a sellable chest item.")]
[CommandDescription("Converts credits to a sellable chest item.")]
[CommandUsage("item creditchest")]
[CommandUserLevel(AccountUserLevel.Admin)]
[CommandInvokerType(CommandInvokerType.Client)]
public string CreditChest(string[] @params, NetClient client)
{
const PrototypeId CreditItemProtoRef = (PrototypeId)13983056721138685632;
const PrototypeId CreditItemProtoRef = (PrototypeId)13983056721138685632; // Entity/Items/Crafting/Ingredients/CreditItem500k.prototype
const int CreditItemPrice = 500000;
PlayerConnection playerConnection = (PlayerConnection)client;
Player player = playerConnection.Player;
var options = player.Game.CustomGameOptions;
if (options.EnableCreditChestConversion == false)
return "Credit chest conversion is disabled by server settings";
PropertyId creditsProperty = new(PropertyEnum.Currency, GameDatabase.CurrencyGlobalsPrototype.Credits);
int price = (int)(CreditItemPrice * options.CreditChestConversionMultiplier);
if (player.Properties[creditsProperty] < CreditItemPrice)
return "You need at least 500 000 credits to use this command.";
if (price <= 0)
return "Failed to calculate credit chest price.";
// Entity/Items/Crafting/Ingredients/CreditItem500k.prototype
player.Properties.AdjustProperty(-CreditItemPrice, creditsProperty);
if (player.Properties[creditsProperty] < price)
return $"You need at least {price} credits to use this command.";
player.Properties.AdjustProperty(-price, creditsProperty);
player.Game.LootManager.GiveItem(CreditItemProtoRef, LootContext.CashShop, player);
Logger.Trace($"CreditChest(): {player}");
return $"Converted 500 000 credits to a Credit Chest.";
return $"Converted {price} credits to a Credit Chest.";
}
[Command("cleardeliverybox")]

View file

@ -197,6 +197,8 @@ OrbisTrophiesEnabled=true
; AutoUnlockTeamUps: Automatically unlocks all team-ups for players who have finished the tutorial.
; DisableMovementPowerChargeCost: Disables charge costs for movement powers to imitate pre-BUE behavior.
; AllowSameGroupTalents: Allows mutually exclusive talents to be enabled at the same time.
; EnableCreditChestConversion: Allows conversion of credits to sellable chest items via the !item creditchest command.
; CreditChestConversionMultiplier: Cost multiplier for converting credits to chest items.
; DisableInstancedLoot: Makes loot free-for-all, Diablo 2 style.
; LootSpawnGridCellRadius: Affects the spacing of loot that drops [16-128].
; TrashedItemExpirationTimeMultiplier: Affects how long items trashed by players remain on the ground.
@ -213,6 +215,8 @@ AutoUnlockAvatars=false
AutoUnlockTeamUps=false
DisableMovementPowerChargeCost=false
AllowSameGroupTalents=false
EnableCreditChestConversion=false
CreditChestConversionMultiplier=2.0
DisableInstancedLoot=false
LootSpawnGridCellRadius=20.0
TrashedItemExpirationTimeMultiplier=1.0