private static CrowdResponse DoUpgrade(CrowdRequest req, string toolName, int max = 4) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Tool tool = Game1.player.getToolFromName(toolName); if (tool == null) { status = CrowdResponse.Status.STATUS_FAILURE; message = $"{Game1.player.Name}'s {toolName} is already at the highest upgrade level"; } else { int level = tool.UpgradeLevel; if (level == max) { status = CrowdResponse.Status.STATUS_FAILURE; } else { tool.UpgradeLevel = level + 1; UI.ShowInfo($"{req.GetReqViewer()} upgraded {Game1.player.Name}'s {toolName}"); } } return(new CrowdResponse(req.GetReqID(), status, message)); }
public static CrowdResponse RemoveStardrop(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; int stamina = Game1.player.MaxStamina; if (stamina == 270) { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is already at lowest energy maximum"; } else { stamina -= 34; Game1.player.MaxStamina = stamina; if (Game1.player.Stamina > stamina) { Game1.player.Stamina = stamina; } UI.ShowInfo($"{req.GetReqViewer()} removed a Stardrop from {Game1.player.Name}"); } return(new CrowdResponse(req.GetReqID(), status, message)); }
public static CrowdResponse DowngradeBoots(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; StardewBoots boots = Game1.player.boots.Get(); if (boots == null) { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is not currently wearing Boots"; } else { boots = Boots.GetDowngrade(boots.getStatsIndex()); if (boots == null) { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + "'s Boots are already at the lowest upgrade level"; } else { Game1.player.boots.Value = boots; Game1.player.changeShoeColor(boots.indexInColorSheet); UI.ShowInfo($"{req.GetReqViewer()} downgraded {Game1.player.Name}'s Boots"); } } return(new CrowdResponse(req.GetReqID(), status, message)); }
public static CrowdResponse Kill(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Interlocked.Exchange(ref Game1.player.health, 0) == 0) { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is currently dead"; } else { UI.ShowInfo($"{req.GetReqViewer()} killed {Game1.player.Name}"); } return(new CrowdResponse(req.GetReqID(), status, message)); }
public static CrowdResponse UpgradeTrashCan(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Game1.player.trashCanLevel < 4) { Interlocked.Increment(ref Game1.player.trashCanLevel); UI.ShowInfo($"{req.GetReqViewer()} upgraded {Game1.player.Name}'s Trash Can"); } else { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + "'s Trash Can is already at the highest upgrade level"; } return(new CrowdResponse(req.GetReqID(), status, message)); }
public static CrowdResponse UpgradeBackpack(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Game1.player.items.Capacity == 36) { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + "'s Backpack is already at maximum capacity"; } else { Game1.player.increaseBackpackSize(12); UI.ShowInfo($"{req.GetReqViewer()} upgraded {Game1.player.Name}'s Backpack"); } return(new CrowdResponse(req.GetReqID(), status, message)); }
private static CrowdResponse DoSpawn(ControlClient client, CrowdRequest req, Monster monster) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (client.CanSpawn()) { Game1.player.currentLocation.addCharacter(monster); client.TrackMonster(monster); UI.ShowInfo($"{req.GetReqViewer()} spawned a {monster.Name} near {Game1.player.Name}"); } else { status = CrowdResponse.Status.STATUS_FAILURE; message = $"Cannot spawn {monster.Name} because {Game1.player.Name} is at {Game1.player.currentLocation.Name}"; } return(new CrowdResponse(req.GetReqID(), status, message)); }
private static CrowdResponse DoHurtBy(CrowdRequest req, float percent) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; int health = Game1.player.health - (int)Math.Floor(percent * Game1.player.maxHealth); if (Interlocked.Exchange(ref Game1.player.health, (health < 0) ? 0 : health) == 0) { Game1.player.health = 0; status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is already dead"; } else { UI.ShowInfo($"{req.GetReqViewer()} hurt {Game1.player.Name} by {(int)Math.Floor(100 * percent)}%"); } return(new CrowdResponse(req.GetReqID(), status, message)); }
public static CrowdResponse PassOut(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; float stamina = Game1.player.Stamina; if (stamina > -16) { Game1.player.Stamina = -16; UI.ShowInfo($"{req.GetReqViewer()} made {Game1.player.Name} pass out"); } else { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is currently passed out"; } return(new CrowdResponse(req.GetReqID(), status, message)); }
private static CrowdResponse DoTireBy(CrowdRequest req, float percent) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; float stamina = Game1.player.Stamina; if (stamina > 0) { stamina -= percent * Game1.player.MaxStamina; Game1.player.Stamina = (stamina < 0) ? 0 : stamina; UI.ShowInfo($"{req.GetReqViewer()} tired {Game1.player.Name} by {(int)Math.Floor(100 * percent)}%"); } else { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is already passed out"; } return(new CrowdResponse(req.GetReqID(), status, message)); }
private static CrowdResponse DoRemoveMoney(CrowdRequest req, int amount) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; int money = Game1.player.Money; if (money > 0) { money -= amount; Game1.player.Money = (money < 0) ? 0 : money; UI.ShowInfo($"{req.GetReqViewer()} removed {amount} coins from {Game1.player.Name}"); } else { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " currently has no money"; } return(new CrowdResponse(req.GetReqID(), status, message)); }
public static CrowdResponse EnergizeFull(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; int max = Game1.player.MaxStamina; float stamina = Game1.player.Stamina; if (stamina < max) { Game1.player.Stamina = max; UI.ShowInfo($"{req.GetReqViewer()} fully energized {Game1.player.Name}"); } else { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is already at maximum energy"; } return(new CrowdResponse(req.GetReqID(), status, message)); }
private static CrowdResponse DoEnergizeBy(CrowdRequest req, float percent) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; int max = Game1.player.MaxStamina; float stamina = Game1.player.Stamina; if (stamina < max) { stamina += percent * max; Game1.player.Stamina = (stamina > max) ? max : stamina; UI.ShowInfo($"{req.GetReqViewer()} energized {Game1.player.Name} by {(int)Math.Floor(100 * percent)}%"); } else { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is already at maximum energy"; } return(new CrowdResponse(req.GetReqID(), status, message)); }
public static CrowdResponse GiveStardrop(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; int stamina = Game1.player.MaxStamina; if (stamina == 508) { status = CrowdResponse.Status.STATUS_FAILURE; message = Game1.player.Name + " is already at the highest energy maximum"; } else { stamina += 34; Game1.player.MaxStamina = stamina; Game1.player.Stamina = stamina; UI.ShowInfo($"{req.GetReqViewer()} gave {Game1.player.Name} a Stardrop"); } return(new CrowdResponse(req.GetReqID(), status, message)); }