mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-12 15:54:34 +01:00
fixes and improvements to give command
This commit is contained in:
@@ -7,7 +7,7 @@ namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("give", "<sel> [#] [id]", CommandType.Player,
|
||||
//example commands list
|
||||
"gold 123456789","stigs 1", "weaps", "mats 999 2008", "valks", "outfits"
|
||||
"gold 123456789", "stigs 1", "weaps", "mats 999 2008", "valks", "outfits"
|
||||
)]
|
||||
internal class GiveCommand : Command
|
||||
{
|
||||
@@ -22,7 +22,7 @@ namespace PemukulPaku.GameServer.Commands
|
||||
public override void Run(Player player, string[] args)
|
||||
{
|
||||
string action = args[0];
|
||||
int value = (args.Length > 1 && args[1] is not null) ? int.Parse(args[1]) : -1;
|
||||
int? value = (args.Length >= 2 && args[1] is not null) ? int.Parse(args[1]) : null;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
@@ -91,14 +91,18 @@ namespace PemukulPaku.GameServer.Commands
|
||||
case "mats":
|
||||
case "matz":
|
||||
foreach (MaterialDataExcel materialData in MaterialData.GetInstance().All)
|
||||
{
|
||||
player.Equipment.AddMaterial(materialData.Id, value > 0 || value < -1 ? value : 9999);
|
||||
{
|
||||
player.Equipment.AddMaterial(materialData.Id, value is not null && value != 0 ? (int)value : materialData.QuantityLimit);
|
||||
}
|
||||
break;
|
||||
case "material-id":
|
||||
case "gold":
|
||||
int materialId = args[2] is not null ? int.Parse(args[2]) : 100;
|
||||
player.Equipment.AddMaterial(materialId, value > 0 || value < -1 ? value : 9999);
|
||||
int materialId = args.Length >= 3 && args[2] is not null ? int.Parse(args[2]) : 100;
|
||||
int? quantityLimit = MaterialData.GetInstance().All.FirstOrDefault(m => m.Id == materialId)?.QuantityLimit;
|
||||
if (quantityLimit is not null)
|
||||
{
|
||||
player.Equipment.AddMaterial(materialId, value is not null && value != 0 ? (int)value : (int)quantityLimit);
|
||||
}
|
||||
break;
|
||||
case "dress":
|
||||
case "outfits":
|
||||
|
||||
Reference in New Issue
Block a user