-
Notifications
You must be signed in to change notification settings - Fork 11
Update with more commands, some more functionality, some fixes #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f52adfe
0ea5623
ecc3766
3de7716
2a86899
095edf4
82e6e80
1091413
3d9beab
5edebd3
1867d7d
262dcb1
1334a37
4332549
21945d5
6d824ec
dd6328b
8372c1c
b0bd155
ee40a41
f4fc38c
03c08d3
eece426
95d97ba
364caaa
c792d56
7644540
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using DebugToolkit.Commands; | ||
|
|
||
| namespace DebugToolkit | ||
| { | ||
|
|
@@ -69,18 +70,29 @@ internal static void RegisterAutoCompleteCommands() | |
| var parser = new AutoCompleteParser(); | ||
| parser.RegisterStaticVariable("0", "0"); | ||
| parser.RegisterStaticVariable("1", "1"); | ||
| parser.RegisterStaticVariable("count", "count"); | ||
| parser.RegisterStaticVariable("droneTier", "droneTier"); | ||
| parser.RegisterStaticVariable("duration", "duration"); | ||
| parser.RegisterStaticVariable("skill_slot", "skill_slot"); | ||
| parser.RegisterStaticVariable("skill_variant", "skill_variant"); | ||
|
Comment on lines
71
to
+77
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason why |
||
| parser.RegisterStaticVariable("ai", MasterCatalog.allAiMasters.Select(i => $"{(int)i.masterIndex}|{i.name}|{StringFinder.GetLangInvar(StringFinder.GetMasterName(i))}"), 1); | ||
| parser.RegisterStaticVariable("artifact", ArtifactCatalog.artifactDefs.Select(i => $"{(int)i.artifactIndex}|{i.cachedName}|{StringFinder.GetLangInvar(i.nameToken)}"), 1); | ||
| parser.RegisterStaticVariable("difficulty", R2API.DifficultyAPI.difficultyDefinitions.Select(i => $"{(int)i.Key}|{StringFinder.GetLangInvar(i.Value.nameToken)}"), 1); | ||
| parser.RegisterStaticVariable("body", BodyCatalog.allBodyPrefabBodyBodyComponents.Select(i => $"{(int)i.bodyIndex}|{i.name}|{StringFinder.GetLangInvar(i.baseNameToken)}"), 1); | ||
| parser.RegisterStaticVariable("buff", BuffCatalog.buffDefs.Select(i => $"{(int)i.buffIndex}|{StringFinder.GetLangInvar(i.name)}"), 1); | ||
| parser.RegisterStaticVariable("droptable", ItemTierCatalog.allItemTierDefs.OrderBy(i => i.tier).Select(i => $"{(int)i.tier}|{i.name}"), 1); | ||
| parser.RegisterStaticVariable("itemTier", ItemTierCatalog.allItemTierDefs.OrderBy(i => i.tier).Select(i => $"{(int)i.tier}|{i.name}"), 1); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we rename this to |
||
| parser.RegisterStaticVariable("dot", DotController.dotDefs.Select((d, i) => $"{i}|{(DotController.DotIndex)i}"), 1); | ||
| parser.RegisterStaticVariable("elite", new string[] { "-1|None" }. | ||
| Concat(EliteCatalog.eliteDefs.Select(i => $"{(int)i.eliteIndex}|{i.name}|{StringFinder.GetLangInvar(i.modifierToken)}")), | ||
| 1 | ||
| ); | ||
| parser.RegisterStaticVariable("equip", EquipmentCatalog.equipmentDefs.Select(i => $"{(int)i.equipmentIndex}|{i.name}|{StringFinder.GetLangInvar(i.nameToken)}"), 1); | ||
| parser.RegisterStaticVariable("equip", new string[] { "-1|None" }. | ||
| Concat(EquipmentCatalog.equipmentDefs.Select(i => $"{(int)i.equipmentIndex}|{i.name}|{StringFinder.GetLangInvar(i.nameToken)}")), | ||
| 1 | ||
| ); | ||
| parser.RegisterStaticVariable("item", ItemCatalog.allItemDefs.Select(i => $"{(int)i.itemIndex}|{i.name}|{StringFinder.GetLangInvar(i.nameToken)}"), 1); | ||
| parser.RegisterStaticVariable("drone", DroneCatalog.allDroneDefs.Select(i => $"{(int)i.droneIndex}|{i.name}|{StringFinder.GetLangInvar(i.nameToken)}"), 1); | ||
| parser.RegisterStaticVariable("specific_stage", SceneCatalog.allSceneDefs.Where(i => !i.isOfflineScene).Select(i => $"{(int)i.sceneDefIndex}|{i.cachedName}|{StringFinder.GetLangInvar(i.nameToken)}"), 1); | ||
| parser.RegisterStaticVariable("team", new string[] { "-1|None" }. | ||
| Concat(TeamCatalog.teamDefs.Select((t, i) => $"{i}|{(TeamIndex)i}")), | ||
|
|
@@ -89,10 +101,18 @@ internal static void RegisterAutoCompleteCommands() | |
|
|
||
| parser.RegisterStaticVariable("permission_level", CollectEnumNames(typeof(Permissions.Level), typeof(int)), 1); | ||
|
|
||
| parser.RegisterDynamicVariable("director_card", StringFinder.Instance.DirectorCards, "spawnCard", autocompleteIndex: 1); | ||
| parser.RegisterDynamicVariable("interactable", StringFinder.Instance.InteractableSpawnCards, autocompleteIndex: 1); | ||
| parser.RegisterStaticVariable("director_card", StringFinder.Instance.DirectorCards.Select(i => $"{i}|{i.GetSpawnCard().name}"), autocompleteIndex: 1); | ||
| parser.RegisterStaticVariable("interactable", StringFinder.Instance.InteractableSpawnCards.Select(i => $"{StringFinder.Instance.InteractableSpawnCards.IndexOf(i)}|{i.name}|{StringFinder.GetLangInvar(i.prefab?.GetComponent<IDisplayNameProvider>()?.GetDisplayName())}"), autocompleteIndex: 1); | ||
|
|
||
| parser.RegisterDynamicVariable("player", NetworkUser.instancesList, "userName"); | ||
|
|
||
| parser.RegisterStaticVariable("item_type", CollectEnumNames(typeof(Items.ItemType), typeof(int)), 1); | ||
| parser.RegisterStaticVariable("pickup_type", CollectEnumNames(typeof(Items.PickupType), typeof(int)), 1); | ||
| parser.RegisterStaticVariable("search", CollectEnumNames(typeof(Items.PickupSearch), typeof(int)), 1); | ||
|
|
||
| parser.RegisterStaticVariable("stat", CollectEnumNames(typeof(PlayerCommands.Stat), typeof(int)), 1); | ||
| parser.RegisterStaticVariable("portal", Spawners.portals.Select(i => $"{i.Key}"), 1); | ||
|
|
||
| parser.Scan(System.Reflection.Assembly.GetExecutingAssembly()); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,7 +90,8 @@ private static void CCGiveBuff(ConCommandArgs args) | |
| } | ||
| if (iCount < 0) | ||
| { | ||
| Log.MessageNetworked(String.Format(Lang.NEGATIVE_ARG, "count"), args, LogLevel.MessageClientOnly); | ||
| args.userArgs[1] = (-iCount).ToString(); | ||
| CCRemoveBuff(args); | ||
|
Comment on lines
-93
to
+94
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| return; | ||
| } | ||
|
|
||
|
|
@@ -147,7 +148,7 @@ private static void CCGiveBuff(ConCommandArgs args) | |
| { | ||
| body.AddTimedBuff(buff, duration); | ||
| } | ||
| Log.MessageNetworked($"Gave {iCount} {name} to {target.name} for {duration} seconds", args); | ||
| Log.MessageNetworked($"Gave {iCount} {name} to {target.name} for <color=#53E9FF>{duration} seconds</color>", args); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should avoid colors in logs as much as possible. The main reason I've used green/red for enabled/disabled is because for toggle commands it's very easy to not notice if you're toggling it to the wrong value. |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -175,7 +176,8 @@ private static void CCRemoveBuff(ConCommandArgs args) | |
| } | ||
| if (iCount < 0) | ||
| { | ||
| Log.MessageNetworked(String.Format(Lang.NEGATIVE_ARG, "count"), args, LogLevel.MessageClientOnly); | ||
| args.userArgs[1] = (-iCount).ToString(); | ||
| CCGiveBuff(args); | ||
|
Comment on lines
-178
to
+180
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same argument as above. Negative stacks for |
||
| return; | ||
| } | ||
|
|
||
|
|
@@ -615,7 +617,7 @@ internal static CommandTarget ParseTarget(ConCommandArgs args, int index) | |
| target = targetMaster?.GetBody(); | ||
| } | ||
| } | ||
| if (target == null) | ||
| if (target == null && failMessage == null) | ||
| { | ||
| failMessage = Lang.PLAYER_NOTFOUND; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a reminder that whatever changes to commands are made as a result of this review the changelog should be updated appropriately. Obviously leave this as a last thing and make sure to also update the readme.