Reformat of GameCommand.cs

This commit is contained in:
Lucca Faria Ferri 2023-01-22 10:26:35 -08:00
parent 1efa5a7624
commit 55da2d1691

View File

@ -119,6 +119,7 @@ namespace DiIiS_NA.GameServer.CommandManager
var monster = player.World.SpawnMonster((ActorSno)actorSNO, position); var monster = player.World.SpawnMonster((ActorSno)actorSNO, position);
} }
return $"Spawned {amount} mobs with ActorSNO: {actorSNO}"; return $"Spawned {amount} mobs with ActorSNO: {actorSNO}";
} }
@ -209,7 +210,8 @@ namespace DiIiS_NA.GameServer.CommandManager
} }
} }
[CommandGroup("platinum", "Platinum for your character.\nOptionally specify the number of levels: !platinum [count]")] [CommandGroup("platinum",
"Platinum for your character.\nOptionally specify the number of levels: !platinum [count]")]
public class PlatinumCommand : CommandGroup public class PlatinumCommand : CommandGroup
{ {
[DefaultCommand] [DefaultCommand]
@ -290,7 +292,8 @@ namespace DiIiS_NA.GameServer.CommandManager
} }
} }
[CommandGroup("achiplatinum", "Platinum for your character.\nOptionally specify the number of levels: !platinum [count]")] [CommandGroup("achiplatinum",
"Platinum for your character.\nOptionally specify the number of levels: !platinum [count]")]
public class PlatinumAchiCommand : CommandGroup public class PlatinumAchiCommand : CommandGroup
{ {
[DefaultCommand] [DefaultCommand]
@ -461,6 +464,7 @@ namespace DiIiS_NA.GameServer.CommandManager
var msg = new InventoryDropItemMessage { ItemID = item.DynamicID(player) }; var msg = new InventoryDropItemMessage { ItemID = item.DynamicID(player) };
player.Inventory.Consume(invokerClient.InGameClient, msg); player.Inventory.Consume(invokerClient.InGameClient, msg);
} }
return $"Dropped {bpItems.Count} Items for you"; return $"Dropped {bpItems.Count} Items for you";
} }
} }
@ -495,8 +499,10 @@ namespace DiIiS_NA.GameServer.CommandManager
invokerClient.InGameClient.Player.ChangeWorld(world, world.StartingPoints.First().Position); invokerClient.InGameClient.Player.ChangeWorld(world, world.StartingPoints.First().Position);
var proximity = new System.Drawing.RectangleF(invokerClient.InGameClient.Player.Position.X - 1f, invokerClient.InGameClient.Player.Position.Y - 1f, 2f, 2f); var proximity = new System.Drawing.RectangleF(invokerClient.InGameClient.Player.Position.X - 1f,
var scenes = invokerClient.InGameClient.Player.World.QuadTree.Query<GSSystem.MapSystem.Scene>(proximity); invokerClient.InGameClient.Player.Position.Y - 1f, 2f, 2f);
var scenes =
invokerClient.InGameClient.Player.World.QuadTree.Query<GSSystem.MapSystem.Scene>(proximity);
if (scenes.Count == 0) return ""; // cork (is it real?) if (scenes.Count == 0) return ""; // cork (is it real?)
var scene = scenes[0]; // Parent scene /fasbat var scene = scenes[0]; // Parent scene /fasbat
@ -510,18 +516,23 @@ namespace DiIiS_NA.GameServer.CommandManager
var levelArea = scene.Specification.SNOLevelAreas[0]; var levelArea = scene.Specification.SNOLevelAreas[0];
//handling quest triggers //handling quest triggers
if (invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers.ContainsKey(levelArea)) //EnterLevelArea if (invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers
.ContainsKey(levelArea)) //EnterLevelArea
{ {
var trigger = invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers[levelArea]; var trigger =
invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers[levelArea];
if (trigger.triggerType == QuestStepObjectiveType.EnterLevelArea) if (trigger.triggerType == QuestStepObjectiveType.EnterLevelArea)
{ {
try try
{ {
trigger.questEvent.Execute(invokerClient.InGameClient.Player.World); // launch a questEvent trigger.questEvent.Execute(invokerClient.InGameClient.Player.World); // launch a questEvent
} }
catch { } catch
{
} }
} }
}
foreach (var bounty in invokerClient.InGameClient.Player.World.Game.QuestManager.Bounties) foreach (var bounty in invokerClient.InGameClient.Player.World.Game.QuestManager.Bounties)
bounty.CheckLevelArea(levelArea); bounty.CheckLevelArea(levelArea);
return $"Teleported to: {MPQStorage.Data.Assets[SNOGroup.Worlds][worldId].Name} [id: {worldId}]"; return $"Teleported to: {MPQStorage.Data.Assets[SNOGroup.Worlds][worldId].Name} [id: {worldId}]";
@ -569,7 +580,8 @@ namespace DiIiS_NA.GameServer.CommandManager
return "This command can only be used in-game."; return "This command can only be used in-game.";
if (@params == null) if (@params == null)
return "Change the movement speed. Min 0 (Base), Max 2.\n You can use decimal values like 1,3 for example."; return
"Change the movement speed. Min 0 (Base), Max 2.\n You can use decimal values like 1,3 for example.";
float speedValue; float speedValue;
const float maxSpeed = 3; // 2; const float maxSpeed = 3; // 2;
@ -601,7 +613,8 @@ namespace DiIiS_NA.GameServer.CommandManager
return $"Speed changed to {speedValue}"; return $"Speed changed to {speedValue}";
} }
[CommandGroup("quest", "Retrieves information about quest states and manipulates quest progress.\n Usage: quest [triggers | trigger eventType eventValue | advance snoQuest]")] [CommandGroup("quest",
"Retrieves information about quest states and manipulates quest progress.\n Usage: quest [triggers | trigger eventType eventValue | advance snoQuest]")]
public class QuestCommand : CommandGroup public class QuestCommand : CommandGroup
{ {
[DefaultCommand] [DefaultCommand]
@ -678,13 +691,15 @@ namespace DiIiS_NA.GameServer.CommandManager
int eventId = Int32.Parse(@params[0]); int eventId = Int32.Parse(@params[0]);
int duration = Int32.Parse(@params[1]); int duration = Int32.Parse(@params[1]);
invokerClient.InGameClient.Game.QuestManager.LaunchQuestTimer(eventId, (float)duration, new Action<int>((q) => { })); invokerClient.InGameClient.Game.QuestManager.LaunchQuestTimer(eventId, (float)duration,
new Action<int>((q) => { }));
return String.Format("Message sended."); return String.Format("Message sended.");
} }
} }
[CommandGroup("lookup", "Searches in sno databases.\nUsage: lookup [actor|conv|power|scene|la|sp|weather] <pattern>")] [CommandGroup("lookup",
"Searches in sno databases.\nUsage: lookup [actor|conv|power|scene|la|sp|weather] <pattern>")]
public class LookupCommand : CommandGroup public class LookupCommand : CommandGroup
{ {
[DefaultCommand] [DefaultCommand]
@ -806,7 +821,8 @@ namespace DiIiS_NA.GameServer.CommandManager
(current, match) => current + $"[{match.SNOId.ToString("D6")}] {match.Name}\n"); (current, match) => current + $"[{match.SNOId.ToString("D6")}] {match.Name}\n");
} }
[Command("world", "Allows you to search for a world.\nUsage: lookup world <pattern> OR lookup world id <snoId>")] [Command("world",
"Allows you to search for a world.\nUsage: lookup world <pattern> OR lookup world id <snoId>")]
public string World(string[] @params, BattleClient invokerClient) public string World(string[] @params, BattleClient invokerClient)
{ {
var matches = new List<Asset>(); var matches = new List<Asset>();
@ -994,8 +1010,10 @@ namespace DiIiS_NA.GameServer.CommandManager
matches.Add(itemDefinition); matches.Add(itemDefinition);
} }
} }
return matches.Aggregate(matches.Count >= 1 ? "Item Matches:\n" : "No match found.", return matches.Aggregate(matches.Count >= 1 ? "Item Matches:\n" : "No match found.",
(current, match) => current + $"[{match.SNOActor.ToString("D6")}] {match.Name}\n"); (current, match) => current + $"[{match.SNOActor.ToString("D6")}] {match.Name}\n");
} }
} }
}
} }