Added new commands, added option to spawnrandomequip to generate with a biased toonclass, added some minrank requirements to some commands

This commit is contained in:
Lucca Faria Ferri 2023-01-26 09:15:38 -08:00
parent 5c2ae9e897
commit 4043e01339
5 changed files with 145 additions and 58 deletions

View File

@ -44,7 +44,22 @@ using static DiIiS_NA.Core.MPQ.FileFormats.GameBalance;
namespace DiIiS_NA.GameServer.CommandManager
{
[CommandGroup("invulnerable", "Makes you invulnerable")]
[CommandGroup("heal", "Heals yourself", Account.UserLevels.Tester)]
public class HealCommand : CommandGroup
{
[DefaultCommand]
public string Heal(string[] @params, BattleClient invokerClient)
{
if (invokerClient?.InGameClient?.Player is not {} player)
return "You are not in game";
player.Heal();
return "You have been healed";
}
}
[CommandGroup("invulnerable", "Makes you invulnerable", Account.UserLevels.GM)]
public class InvulnerableCommand : CommandGroup
{
[DefaultCommand]
@ -68,7 +83,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
}
[CommandGroup("spawn", "Spawns a mob.\nUsage: spawn [actorSNO] [amount]")]
[CommandGroup("spawn", "Spawns a mob.\nUsage: spawn [actorSNO] [amount]", Account.UserLevels.GM)]
public class SpawnCommand : CommandGroup
{
[DefaultCommand]
@ -124,7 +139,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
[CommandGroup("levelup", "Levels your character.\nOptionally specify the number of levels: !levelup [count]")]
[CommandGroup("levelup", "Levels your character.\nOptionally specify the number of levels: !levelup [count]", Account.UserLevels.GM)]
public class LevelUpCommand : CommandGroup
{
[DefaultCommand]
@ -172,7 +187,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
}
[CommandGroup("unlockart", "Unlock all artisans: !unlockart")]
[CommandGroup("unlockart", "Unlock all artisans: !unlockart", Account.UserLevels.Tester)]
public class UnlockArtCommand : CommandGroup
{
[DefaultCommand]
@ -210,7 +225,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
[CommandGroup("platinum",
"Platinum for your character.\nOptionally specify the number of levels: !platinum [count]")]
"Platinum for your character.\nOptionally specify the number of levels: !platinum [count]", Account.UserLevels.Tester)]
public class PlatinumCommand : CommandGroup
{
[DefaultCommand]
@ -244,7 +259,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
}
[CommandGroup("stashup", "Upgrade Stash.\n !stashup")]
[CommandGroup("stashup", "Upgrade Stash.\n !stashup", Account.UserLevels.Tester)]
public class StashUpCommand : CommandGroup
{
[DefaultCommand]
@ -264,7 +279,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
}
[CommandGroup("gold", "Gold for your character.\nOptionally specify the number of gold: !gold [count]")]
[CommandGroup("gold", "Gold for your character.\nOptionally specify the number of gold: !gold [count]", Account.UserLevels.GM)]
public class GoldCommand : CommandGroup
{
[DefaultCommand]
@ -292,7 +307,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
[CommandGroup("achiplatinum",
"Platinum for your character.\nOptionally specify the number of levels: !platinum [count]")]
"Platinum for your character.\nOptionally specify the number of levels: !platinum [count]", Account.UserLevels.GM)]
public class PlatinumAchiCommand : CommandGroup
{
[DefaultCommand]
@ -330,7 +345,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
}
[CommandGroup("eff", "Platinum for your character.\nOptionally specify the number of levels: !eff [count]")]
[CommandGroup("eff", "Platinum for your character.\nOptionally specify the number of levels: !eff [count]", Account.UserLevels.GM)]
public class PlayEffectGroup : CommandGroup
{
[DefaultCommand]
@ -357,7 +372,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
}
[CommandGroup("item", "Spawns an item (with a name or type).\nUsage: item [type <type>|<name>] [amount]")]
[CommandGroup("item", "Spawns an item (with a name or type).\nUsage: item [type <type>|<name>] [amount]", Account.UserLevels.GM)]
public class ItemCommand : CommandGroup
{
[DefaultCommand]
@ -467,6 +482,41 @@ namespace DiIiS_NA.GameServer.CommandManager
}
}
[CommandGroup("drop", "Drops an epic item for your class.\nOptionally specify the number of items: !drop [1-20]", Account.UserLevels.Owner)]
public class DropCommand : CommandGroup
{
[DefaultCommand]
public string Drop(string[] @params, BattleClient invokerClient)
{
if (invokerClient?.InGameClient?.Player is not {} player)
return "You can only invoke from the client.";
var amount = 1;
if (@params != null && @params.Any())
if (!Int32.TryParse(@params[0], out amount)) amount = 1;
amount = amount switch
{
< 1 => 1,
> 20 => 20,
_ => amount
};
try
{
for (int i = 0; i < amount; i++)
player.World.SpawnRandomEquip(player, player, 11, player.Level, toonClass: player.Toon.Class);
}
catch
{
for (int i = 0; i < amount; i++)
player.World.SpawnRandomEquip(player, player, 8, player.Level, toonClass: player.Toon.Class);
}
return $"Dropped {amount} random equipment.";
}
}
[CommandGroup("tp", "Transfers your character to another world.")]
public class TeleportCommand : CommandGroup
{
@ -692,7 +742,23 @@ namespace DiIiS_NA.GameServer.CommandManager
invokerClient.InGameClient.Game.QuestManager.LaunchQuestTimer(eventId, (float)duration,
new Action<int>((q) => { }));
return String.Format("Message sended.");
return String.Format("Message sent.");
}
[Command("info", "Retrieves information about quest states.\n Usage: info")]
public string Info(string[] @params, BattleClient invokerClient)
{
var questManager = invokerClient.InGameClient.Game.QuestManager;
var act = questManager.CurrentAct;
var quest = questManager.Game.CurrentQuest;
var questStep = questManager.Game.CurrentStep;
var currentSideQuest = questManager.Game.CurrentSideQuest;
var currentSideQuestStep = questManager.Game.CurrentSideStep;
return $"Act: {act}\n" +
$"Quest: {quest}\n" +
$"Quest Step: {questStep}\n" +
$"Side Quest: {currentSideQuest}\n" +
$"Side Quest Step: {currentSideQuestStep}";
}
}

View File

@ -51,13 +51,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public Game Game { get; set; }
public int CurrentAct
{
get
{
return Game.CurrentAct;
}
}
public int CurrentAct => Game.CurrentAct;
public delegate void QuestProgressDelegate();
public event QuestProgressDelegate OnQuestProgress = delegate { };

View File

@ -6,7 +6,6 @@ using DiIiS_NA.D3_GameServer.Core.Types.SNO;
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.Math;
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.Misc;
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.QuadTrees;
//Blizzless Project 2022
@ -50,6 +49,12 @@ using System.Linq;
using System.Text;
//Blizzless Project 2022
using System.Threading.Tasks;
using DiIiS_NA.Core.MPQ.FileFormats;
using DiIiS_NA.LoginServer.Toons;
using Actor = DiIiS_NA.GameServer.GSSystem.ActorSystem.Actor;
using Circle = DiIiS_NA.GameServer.Core.Types.Misc.Circle;
using Monster = DiIiS_NA.GameServer.GSSystem.ActorSystem.Monster;
using ResolvedPortalDestination = DiIiS_NA.GameServer.MessageSystem.Message.Fields.ResolvedPortalDestination;
namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
@ -790,18 +795,33 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
}, actor);
}
public void SpawnRandomEquip(Actor source, Player player, int forceQuality = -1, int forceLevel = -1)
public Item SpawnRandomEquip(Actor source, Player player, int forceQuality = -1, int forceLevel = -1, GameBalance.ItemTypeTable type = null, ToonClass toonClass = ToonClass.Unknown)
{
//Logger.Debug("SpawnRandomEquip(): quality {0}", forceQuality);
if (player != null)
{
int level = (forceLevel > 0 ? forceLevel : source.Attributes[GameAttribute.Level]);
var item = ItemGenerator.GenerateRandomEquip(player, level, forceQuality);
if (item == null) return;
player.GroundItems[item.GlobalID] = item;
if (toonClass == ToonClass.Unknown && type == null)
{
var item = ItemGenerator.GenerateRandomEquip(player, level, forceQuality, forceQuality);
if (item == null) return null;
player.GroundItems[item.GlobalID] = item;
DropItem(source, null, item);
DropItem(source, null, item);
return item;
}
else
{
var item = ItemGenerator.GenerateRandomEquip(player, level, forceQuality, forceQuality, type: type,owner_class: toonClass);
if (item == null) return null;
player.GroundItems[item.GlobalID] = item;
DropItem(source, null, item);
return item;
}
}
return null;
}
public void SpawnRandomLegOrSetEquip(Actor source, Player player)
{

View File

@ -4896,86 +4896,86 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
};
public static void GeneratePLB()
{
long PreviosExp = 7200000;
long previousExp = 7200000;
ParagonLevelBorders.Add(7200000);
for (int i = 0; i < 59; i++)
{
PreviosExp += 1440000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 1440000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 10; i++)
{
PreviosExp += 2880000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 2880000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 3; i++)
{
PreviosExp += 5040000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 5040000;
ParagonLevelBorders.Add(previousExp);
}
PreviosExp += 3660000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 3660000;
ParagonLevelBorders.Add(previousExp);
for (int i = 0; i < 75; i++)
{
PreviosExp += 1020000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 1020000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 101; i++)
{
PreviosExp += 2040000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 2040000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 100; i++)
{
PreviosExp += 4080000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 4080000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 99; i++)
{
PreviosExp += 6120000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 6120000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 51; i++)
{
PreviosExp += 8160000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 8160000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 50; i++)
{
PreviosExp += 20400000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 20400000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 50; i++)
{
PreviosExp += 40800000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 40800000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 50; i++)
{
PreviosExp += 61200000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 61200000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 50; i++)
{
PreviosExp += 81600000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 81600000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 50; i++)
{
PreviosExp += 102000000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 102000000;
ParagonLevelBorders.Add(previousExp);
}
for (int i = 0; i < 1500; i++)
{
PreviosExp += 122400000;
ParagonLevelBorders.Add(PreviosExp);
previousExp += 122400000;
ParagonLevelBorders.Add(previousExp);
}
long boosterofup = 229500000;
for (int i = 0; i < 17750; i++)
{
boosterofup += 102000;
PreviosExp += boosterofup;
ParagonLevelBorders.Add(PreviosExp);
previousExp += boosterofup;
ParagonLevelBorders.Add(previousExp);
}
}
//public static List<long> ParagonLevelBorders = ((GameBalance)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.GameBalance][252616].Data).Experience.Select(row => row.DeltaXP).ToList();
@ -6020,5 +6020,12 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
}
#endregion
public void Heal()
{
Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total];
Attributes[GameAttribute.Hitpoints_Total_From_Level] = Attributes[GameAttribute.Hitpoints_Max_Total];
Attributes.BroadcastChangedIfRevealed();
}
}
}

View File

@ -118,7 +118,7 @@ namespace DiIiS_NA
{
try
{
var uptime = (DateTime.Now - StartupTime).ToText();
var uptime = (DateTime.Now - StartupTime).ToSmallText();
// get total memory from process
var totalMemory =
(double)((double)Process.GetCurrentProcess().WorkingSet64 / 1024 / 1024 / 1024);