Skip to content
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

Add /playerxp command. #16471

Merged
merged 1 commit into from May 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion OpenRA.Mods.Common/Commands/DevCommands.cs
Expand Up @@ -53,7 +53,8 @@ public void WorldLoaded(World w, WorldRenderer wr)
register("all", "toggles all cheats and gives you some cash for your trouble.");
register("crash", "crashes the game.");
register("levelup", "adds a specified number of levels to the selected actors.");
register("poweroutage", "causes owners of selected actors to have a 5 second power outage.");
register("playerexperience", "adds a specified amount of player experience to the owner(s) of selected actors.");
register("poweroutage", "causes owner(s) of selected actors to have a 5 second power outage.");
register("kill", "kills selected actors.");
register("dispose", "disposes selected actors.");
}
Expand Down Expand Up @@ -127,6 +128,14 @@ public void InvokeCommand(string name, string arg)

break;

case "playerexperience":
var experience = 0;
int.TryParse(arg, out experience);

foreach (var player in world.Selection.Actors.Select(a => a.Owner.PlayerActor).Distinct())
world.IssueOrder(new Order("DevPlayerExperience", player, false) { ExtraData = (uint)experience });
break;

case "poweroutage":
foreach (var player in world.Selection.Actors.Select(a => a.Owner.PlayerActor).Distinct())
world.IssueOrder(new Order("PowerOutage", player, false) { ExtraData = 250 });
Expand Down
9 changes: 9 additions & 0 deletions OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs
Expand Up @@ -214,6 +214,15 @@ public void ResolveOrder(Actor self, Order order)
break;
}

case "DevPlayerExperience":
{
var playerExperience = self.Owner.PlayerActor.TraitOrDefault<PlayerExperience>();
if (playerExperience != null)
playerExperience.GiveExperience((int)order.ExtraData);

break;
}

case "DevKill":
{
if (order.Target.Type != TargetType.Actor)
Expand Down