kpreisser / MouseClickSimulator

Mouse Click Simulator for Toontown Rewritten and Corporate Clash
MIT License
26 stars 17 forks source link
corporate-clash simulating-mouse-clicks simulator toontown toontown-rewritten

# Mouse Click Simulator for Toontown Rewritten and Corporate Clash

This is a new implementation of the older "TT-Mausklick" simulator, intended to work with Toontown Rewritten and Corporate Clash. It is implemented in C# (.NET 8.0) and runs on Windows.

The TT Mouse Click Simulator is able to automatically fish in specific locations like Punchline Place, TTC. To accomplish this, it scans the screen to detect fish bubbles, calculates how far the rod must be cast to catch the fish, and moves the Toon to the fisherman to sell the fish.

Additionally, for Toontown Rewritten, the simulator can plant and water flowers using 1 to 8 jellybean combinations, which is implemented using "Quick Actions". By clicking on a button with the flower's name, the Mouse Click Simulator will plant the flower by selecting the correct jellybean combination, and then water it.

You can watch a video of the Automatic Fishing Function for Tenor Terrace and Punchline Place.

Note: This Simulator does not inject code into or otherwise manipulate the game. It only interacts with TT by taking screenshots to analyze the window content (for the fishing action) and simulating mouse clicks/movements and pressing keys.

When enabling Background Mode, the simulator directly sends mouse and keyboard inputs to the Toontown window (instead of simulating gobal inputs), so you can do other work while the simulator is running.

WARNING

Use this program at your own risk! Toontown Rewritten and Corporate Clash state in their Terms of Use that you should not use automation software, so you might risk a ban if you use this program.

Running the Mouse Click Simulator

Please see the topic Running the Simulator for guidance how to download, build and run the Mouse Click Simulator on your computer.

Release Notes

2024-04-14 (Commit f8f8996)

2023-11-16 (Commit 4ed3512)

2022-01-24 (Commit db8435c)

2022-01-23 (Commit e8cb4a8)

2022-01-15 (Commit 834a4ca)

2022-01-10 (Commit bcec185)

Click to expand older release notes **2018-08-12** (Commit [67c4a87](https://github.com/kpreisser/MouseClickSimulator/commit/67c4a87c1db7fd906f3dfc88aa6cc26c51dc6d4f)) - The simulator now detects when multiple TT Rewritten windows are open, and allows to select the one that should be used ([#27](https://github.com/kpreisser/MouseClickSimulator/issues/27)).

Development

Currently, the implementation contains actions for pressing keys, writing text, SpeedChat, Doodle Interaction Panel and the Automatic Fishing Function. Furthermore, an action for planting a flower is supported.

The GUI allows to load projects from an XML file. There are some predefined projects included in the SampleProjects folder but you can also create your own XML Simulator Project files. You can use the Sample Actions.xml as a template for creating your own project.

When opening a project, the GUI shows the actions which the project contains in a tree-like structure. When the Simulator is running, actions that are currently active are marked blue.

In addition to a "Main Action" which usually runs in a loop and can be started by clicking on the generic "Start" button (e.g. the fishing function), the Mouse Click Simulator supports "Quick Actions" that can be short and non-repeating, e.g. actions to plant specific flowers. For each Quick Action, a button is created which will start the corresponsing Quick Action when clicking on it.

Specifying Mouse Coordinates

Currently, mouse coordinates used in the simulator (e.g. in the scan1 and scan2 attributes of the <AutomaticFishing> element in the XML files, and in the source code calling IInteractionProvider.MoveMouse() or MouseHelpers.DoSimpleMouseClickAsync()) are interpreted for a window with an inner (client area) size of 1600 × 1151 using a 4:3 aspect ratio. These values were kept from the legacy TT mouse click simulator.

To specify mouse coordinates for Toontown, you can do the following to get the resulting coordinates that can be used in the simulator:

In the C# code, you have then also specify the horizontal alignment (which is needed when the current window aspect ratio is greater than 4:3). To determine this, for Toontown Rewritten, resize your Toontown window to increase the width (or decrease the height). Or, for Corporate Clash, reset the aspect ratio to Adaptive.

You can find an example for this in issue #24.

TODOs: