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 Watering Can Training #62

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add water training
lperniciaro committed Nov 28, 2024
commit 0df3718b9f7a01992ecf62a28f9138a8f8eb978a
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Text;

using TTMouseClickSimulator.Core.Actions;
using TTMouseClickSimulator.Core.Environment;

namespace TTMouseClickSimulator.Core.Toontown.Actions.Gardening;

/// <summary>
/// An action which plants a cupcake tree.
/// </summary>
public class PlantTreeAction : AbstractAction
{


public PlantTreeAction()
{

}

public override SimulatorCapabilities RequiredCapabilities
{
get => SimulatorCapabilities.MouseInput;
}

public override sealed void Run(IInteractionProvider provider)
{
provider.ThrowIfNotToontownRewritten(nameof(PlantTreeAction));

// Click on the "Plant Flower" button.
MouseHelpers.DoSimpleMouseClick(
provider,
new Coordinates(76, 264),
HorizontalScaleAlignment.Left);

provider.Wait(200);

// Click on the cupcake
// Reference size is the Client window coordinates on Auto Hot Key Window Spy
Size newSize = new(1920, 1003);
MouseHelpers.ChangeReferenceSize(newSize);
MouseHelpers.DoSimpleMouseClick(
provider,
new Coordinates(640, 550),
HorizontalScaleAlignment.NoAspectRatio);
// Reset to default scale so other actions still work
MouseHelpers.SetDefaultReferenceSize();

provider.Wait(200);

}

public override string ToString()
{

return $"Planting cupcake tree";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.Text;

using TTMouseClickSimulator.Core.Actions;
using TTMouseClickSimulator.Core.Environment;

namespace TTMouseClickSimulator.Core.Toontown.Actions.Gardening;

/// <summary>
/// An action which removes a flower and confirms.
/// </summary>
public class RemovePlantAction : AbstractAction
{

public RemovePlantAction()
{

}

public override SimulatorCapabilities RequiredCapabilities
{
get => SimulatorCapabilities.MouseInput;
}

public override sealed void Run(IInteractionProvider provider)
{
provider.ThrowIfNotToontownRewritten(nameof(RemovePlantAction));

// Click on the "Remove Flower" button.
MouseHelpers.DoSimpleMouseClick(
provider,
new Coordinates(76, 264),
HorizontalScaleAlignment.Left);

provider.Wait(200);

// Click yes
Size newSize = new(1920, 1003);
MouseHelpers.ChangeReferenceSize(newSize);
MouseHelpers.DoSimpleMouseClick(
provider,
new Coordinates(900, 680),
HorizontalScaleAlignment.NoAspectRatio);


MouseHelpers.SetDefaultReferenceSize();

provider.Wait(200);

}

public override string ToString()
{
return $"Removing Flower";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Text;

using TTMouseClickSimulator.Core.Actions;
using TTMouseClickSimulator.Core.Environment;

namespace TTMouseClickSimulator.Core.Toontown.Actions.Gardening;

/// <summary>
/// An action which plants a flower.
/// </summary>
public class RemoveTreeAction : AbstractAction
{

public RemoveTreeAction()
{

}

public override SimulatorCapabilities RequiredCapabilities
{
get => SimulatorCapabilities.MouseInput;
}

public override sealed void Run(IInteractionProvider provider)
{
provider.ThrowIfNotToontownRewritten(nameof(RemoveTreeAction));

// Click on the "Remove Flower" button.
MouseHelpers.DoSimpleMouseClick(
provider,
new Coordinates(76, 264),
HorizontalScaleAlignment.Left);

provider.Wait(200);

// Click yes
Size newSize = new(1920, 1003);
MouseHelpers.ChangeReferenceSize(newSize);
MouseHelpers.DoSimpleMouseClick(
provider,
new Coordinates(900, 630),
HorizontalScaleAlignment.NoAspectRatio);

MouseHelpers.SetDefaultReferenceSize();

provider.Wait(200);

}

public override string ToString()
{
return $"Removing Tree";
}
}
3 changes: 3 additions & 0 deletions TTMouseclickSimulator/Project/XmlProjectDeserializer.cs
Original file line number Diff line number Diff line change
@@ -45,6 +45,9 @@ static XmlProjectDeserializer()
actionTypes.Add("DoodlePanel", typeof(DoodlePanelAction));

actionTypes.Add("PlantFlower", typeof(PlantFlowerAction));
actionTypes.Add("PlantTree", typeof(PlantTreeAction));
actionTypes.Add("RemoveTree", typeof(RemoveTreeAction));
actionTypes.Add("RemovePlant", typeof(RemovePlantAction));
actionTypes.Add("Water", typeof(WaterAction));
actionTypes.Add("ConfirmFlowerPlantedDialog", typeof(ConfirmFlowerPlantedDialogAction));

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<SimulatorProject xmlns="https://github.com/TTExtensions/MouseClickSimulator">
<Title>Water Training - Plant</Title>
<Description>
This project replants and waters a plant to train the watering can. Stand in front of an empty pot.
</Description>

<QuickAction title="Plant farm">
<Compound loop="True">
<PlantFlower jellybeanCombination="1" />
<Pause duration="6200" />
<ConfirmFlowerPlantedDialog />
<Pause duration="300" />
<Water />
<Pause duration="3600" />
<Water />
<Pause duration="3600" />
<RemovePlant />
<Pause duration="6000" />
<Compound type="Sequential" minimumPause="50" maximumPause="300" loop="false">
<PressKey key="Down" duration="100" />
<Pause duration="100" />

<PressKey key="Up" duration="100" />
<Pause duration="200" />
</Compound>
</Compound>
</QuickAction>

</SimulatorProject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<SimulatorProject xmlns="https://github.com/TTExtensions/MouseClickSimulator">
<Title>Gardening – 1 Jellybean Combinations</Title>
<Description>
This project plants a cupcake tree and replants to train the watering can. Stand in front of an empty pot.
</Description>

<QuickAction title="Plant farm">
<Compound loop="True">
<PlantTree />
<Pause duration="6200" />
<ConfirmFlowerPlantedDialog />
<Pause duration="300" />
<Water />
<Pause duration="3600" />
<Water />
<Pause duration="3600" />
<RemoveTree />
<Pause duration="6000" />
<Compound type="Sequential" minimumPause="50" maximumPause="300" loop="false">
<PressKey key="Down" duration="100" />
<Pause duration="100" />

<PressKey key="Up" duration="100" />
<Pause duration="200" />
</Compound>
</Compound>
</QuickAction>

</SimulatorProject>