Introduction & History
I was introduced to Dransik by a friend, who asked me for some help with his auto-looter. I figured
it would be a nice game to see how the D Programming Language
stands up for writing cheats. D's awesomeness and Dransik's simplicity
quickly got me addicted to writing more and more complex features.
"DrunkSick" was my idea of how to name this little add-on (a
bastardization of the game's name), everything else (the website name
& address, the "DrunkSickGuy" handle) is derived from that.
The
first approach I did was an external process that uses
ReadProcessMemory/WriteProcessMemory to poke with the game's data, and
sent events using Windows messages. As the tool progressed to
automation features, it became obvious that this approach is extremely inefficient for any kind of unattended automation, since there's too
much space for errors - timing and synchronization errors, heuristic
control, etc. Thus, at one point I rewrote the entire back-end and
entry point stuff, to turn it into an injected DLL. This allowed me to
hook game code, and call other game code directly (which is useful for
reading protected variables). RPM/WPM were changed to direct memory reads/writes, and Windows messages were converted to calling game code directly. Polling code was converted to hooks (e.g. message log).
About the game and its security (at the time of writing this): there's nearly none. Aside the spyware
I brought to light earlier, the game also periodically checks if some
known hacks are running (by looking at the process list). It does that
by comparing to EXE names. The list goes: "collector(p).exe", "Dransik
mini macro(p).exe", "Dransik stat(p).exe", "Fast Fingers(p).exe",
"Pots(p).exe", "Bandages.exe", "Dransik all(p).exe". The strings are in
clear text in client.exe. Clearly this can be bypassed by simply renaming the file. The game also encrypts some important values, like current position on the map. The game keeps two copies of the map
Add-on Features
I will categorize the add-on's features into cheat and utility functions, depending on how evil they are.
• OmniVision™ (cheat)
OmniVision, or more commonly called "wall hax" or (in the context of this game) "tree hax", allows you to see through walls, basically. No part of the view is obscured, however the parts of the screen that you wouldn't normally see directly are dimmed (as if they were dark). This overrides the night lighting effects.
Aside being able to just see people out of trees and sneak up on them, follow them through forests, etc., this feature also allows you to access your bank account through the bank's back wall, and manipulate other NPCs through walls (like shopkeepers). Pretty nifty.
• Chunk lines (utility)
As you may know, a Dransik map is composed out of 16x16 "chunks". DrunkSick shows the edges of those chucks using faint grey lines, allowing you to understand the game world better.
• Cavern Auto-map (cheat)
This is just what's on the can - it enables the auto-map window for the underground plane. Dungeon exploring has never been easier.
Note: the underground map data isn't cached between sessions. Instead, see the Online Map Sync feature.
• AutoTarget (cheat)
One of the first things I implemented. It basically targets the closest monster automatically. In most cases it makes manual targeting unnecessary, except in cases you need to attack a stronger monster first. It's only enabled when in attack mode ("a").
• AutoGrabber (cheat)
Automatic item grabber. It's configurable, so you can manually select what items would you like to automatically pick up. Also features a "hax" mode, that allows to pick up needed items from under other items and mobs (even players). This allows you to steal an item that another player is "sitting" on. It will wait a little before picking something up after you stopped moving, to make it look realistic & to get around a server-side limitation designed to thwart more primitive similar hacks.
• AutoHeal (cheat)
I believe this is also called "pots hack" among the community. When you are hurt, it uses potions from your backpack. The speed it tries to use potions, and the kind of potions it tries to use, depends on how hurt you are. It will also use cure and greater cure potions when appropriate.
• AutoEater (cheat)
A simple passive feature which feeds your PC (eats some food from the backpack) when Stamina falls lower than 15. Great for unattended/semi-attended macroing.
• Programs (cheat)
One of the most important features! DrunkSick has a few "programs" (like scripts, but not editable without recompilation) to control your PC for you. Most programs are designed to train certain trade skills. List of programs at time of writing this article:
- Cook - when near a stove, it roasts items designated as cookable. Simple as that.
- Eater - a script to quickly chug down edible items in your inventory until you're full. It's so fast, it could win a speed-eating contest!
- Planter - a script which will plant seeds from the backpack while moving down. To use, position yourself at the top of some workable earth field, and between two lanes. Be sure to have seeds and a shovel in your backpack.
- Planter2 - an improved version of Planter, which will plant seeds more efficiently (by seeking out and positioning on tiles surrounded by more unused workable earth patches, close to the starting location).
- Plant+Harvest - same as Planter2, but will also automatically harvest your crop. Cereals and such will be automatically harvested (you need to have a farm scythe). (Bug: it will also try to harvest crop that's not yours, so try to use it further from other players.)
- Weaver - simple script to weave cotton into strings. Use near a spinning wheel. (Warning: don't overburden yourself, as strings weight more than cotton!)
- Mixer: this dandy script will automatically attempt to mix plain bread. That is, repeat this sequence: pour water from bucket into a measuring cup, pour water from the cup into the mixing bowl, pour flour into the measuring cup, pour flour into mixing bowl, use mixing spoon on bowl. If you're standing near a well and your bucket runs out of water, it will also automatically refill your bucket. It can't mix other breads, but it was designed to get your skill up.
- Egg collector: a simple script that "double-clicks" (uses) nearby chicken. Just put it in a farm and leave it there, for some easy egg income.
- Lumberjack: give it a lumberjack axe and put it in a forest to get some easy logs.
- Miller: use saw on log. Repeat.
- Carpenter: makes wooden clubs out of planks. Didn't get around customizing it.
- Miner: give it a pick-axe and put it at the base of a mountain to get some easy ore.
- Smelter: smelts ore at a forge. Heats up the forge automatically, etc.
- Smith: makes battle axes out of iron ore. Didn't get around customizing it / adding support for other metals.
- Fisher: give it a fishing pole and put it near water to get some easy fish. As a bonus, if you have some stings in your backpack and the fishing pole breaks, it will automatically tie a new string to the pole and continue.


GoldPrinter: quickly draw a pattern on the ground using gold coins.- BarrelPainter: draws a pattern using gold coins in a container. Due to the lack of a server-side check (at the time of writing this page), allows drawing outside the bounds of the container. Only up to 200 items are visible in a container (server doesn't send more).
- GrabAll: instantly grabs all the items from a container. It's been dubbed as "loot hack" in the community, and can be activated by a hot-key.
- Pathfinder: see below.
• PathFinder (utility/cheat)
The Pathfinder is probably the most technologically superior feature of this add-on. This is not just any path-finder - it's a precise, global, buffer-ahead, auto-correcting pathfinder. To use it, just double-click where you want to go. That includes on the auto-map (one click is enough if it's expanded by holding the right mouse button) - as you hold the last click, a sexy red cross-hair will appear to allow you to enhance the precision. Thus, it will always pick the shortest route to the destination, it will automatically send commands ahead (it doesn't wait for one move to complete to send another), it will automatically correct the trajectory when new obstacles appear in its path, and it doesn't lose face even when the PC ends up somewhere off-track, away from the designated trajectory. It can also open doors. Face it - it's pure awesome!
Note that awesomeness comes at a price - this feature needs a lot of RAM (about 200 MB), and a relatively fast CPU for longer distances.
Note that you may need to train the PathFinder for it to work properly. The game client doesn't have data on which tiles are solid and which you can walk through. Although I mapped some, it's likely you'll face new blocks in areas I've never been to. If the PathFinder tries to walk through walls or other solid objects, you need to train it. To do that, hold Alt and Shift and click the solid tile. A red block should appear on top of it (which is visible for as long as you hold Alt+Shift). Holding Shift by itself shows some PathFinder debug info.
I marked this both as a utility and cheat because it would be nice (and not harmful) if a screen-range simpler pathfinder was implemented in the game, but travelling large distances on the optimal route can get you quite an edge in some events/contests.
• Snooper (cheat)
This just shows the mobs/items at the cursor. If you check the check-box below it, you can middle-click things to make them vanish (only from your screen), thus allowing you to interact with stuff below it. Use this to (manually) snatch items from under players, for example. It's also used to display the error state, if any.
• Speed setting
The speed setting affects passive features ("automates") and scripts. Use with care.
• Sounds (utility)
Dransik now has sounds! With DrunkSick's help, you can now have sounds for important events - such as: low health/stamina, death, skill/PC level up, crop ready to be harvested, and more. Some sounds, like that of an incoming message (could it be a mod checking if you're "macroing"?), are only sounded when the Dransik window is unfocused.
• Online Map Synchronization (utility/cheat)
This awesome feature will synchronize your map data with an Internet server. This means that all users of DrunkSick with this feature enabled automatically share all map data, including explored underground areas.
It's possible to export all map data to create pixel-perfect maps (as seen on my maps page).
• Exact mob HP (utility)
You can now see the exact maximum and remaining HP of the targeted mob. The colour is also chosen relative to your own max HP - so mobs with the HP in green should be easy to defeat, while those with a red one most likely mean imminent death!
• HP bar (utility)
"A bar at the top of the screen, graphically representing your HP? How more pointless and redundant can it get?", you may think. However, by my experience it really helps - you don't have to read to know your approximate HP any more. The bar also changes colour (green to yellow to red), depending on how much health your PC has left - so you don't even need to look to see how close to death you are.
• NPC double-click (utility)
This feature gets rid of the annoying target-protection message. Now, when you click or double-click an NPC while in attack mode and having target protection turned on, the same happens as if you weren't in attack mode. This way there's no reason to switch attack mode off at all!
• Exact game time (utility)
Ever fancied a digital clock with the exact Dransik time?
• Mouse cursor on window caption (utility)
Don't you think that it's annoying that the mouse cursor disappears when you move your mouse cursor on the window title - and you have to guess when you try to close or minimize the game? Well, no longer! DrunkSick automatically shows the mouse cursor when you move it out of the game area.
• Disappearing items bug-fix (utility)
I managed to work around the bug that causes inventory items to disappear until you restart the game. The side effect of the work-around is items that you begin to drag & drop will re-appear at their original position until you drop them somewhere else (thus you will see the same item twice while you're dragging).
• Hotkeys
Some actions, like enabling/disabling automations, launching some programs, stopping the current program, etc. can be done with hotkeys. I also added some basic clipboard operations to text boxes: Ctrl+Insert or Ctrl+C to copy current contents to clipboard, Shift+Insert or Ctrl+V to paste. You can also insert a newline in the text box by pressing Ctrl+Enter. With some coloring, this allows you to fake messages as if they were said by someone else.
• Safety precautions
To minimise the risk of getting caught in unattended automated actions (macroing), if the Dransik window is disabled DrunkSick will stop any running program as well as most automations when someone on the screen says something, or when it receives an unknown message.
• Security
Since the latest version of DrunkSick uses DLL injection, it is invisible from Dransik's process scanner (because it is injected into Dransik itself). Nevertheless, DrunkSick hides some additional processes from Dransik and its staff's eyes. Also, when a Dransik mod attempts to perform a process scan on you (see the list of running programs on your computer), you're notified by a sound and a message in the log. Note that if you ever get scanned without a warning, that would mean Iron Will Games will violate their own End-User License Agreement, which mentions process scanning only for trouble-shooting purposes.
DrunkSick internals
Source code layout:
- loader.d - source of DrunkSick2.exe, the DLL injector
- dllmain.d - entry point; initializes D internals and calls main code in mainui.d
- mainui.d - the UI and control code (hooks, event processing, sounds, etc.)
- dransik.d - the "back-end" of the utility, it holds all the offsets and data types, as well as code for working with them
- codetools.d - code that works with code - patches, hooks and interop mixins
- commondata.d - some utility functions for working with the game data
- messagelog.d - code for analyzing text messages
- customGC.d - some code related to the garbage collector
- customMM.d - manual memory management code for the pathfinder
- mapsync.d - code for synchronizing the map with the online database
- timing.d - timing code
- gametime.d - keep track of the Dransik time
- dranscript.d - base code for "scripting" ("programs"), as well as utility functions for programs
- autoeater.d, autograbber.d, autograbbercfg.d, autoheal.d, autotarget.d, bpbugfix.d, mapsync.d - passive functions ("automates") described above
- graphics.d - has the overlay tile graphics used for PathFinder training and debug info
- pathfinder.d, programs\*.d - the various programs
- objtypes.d - list of object types used by DrunkSick
- utils.d - miscellaneous utility code
DrunkSick lives in the same thread as Dransik, for perfect synchronization. The game's main loop is hooked.
Conclusion
What I learned by writing DrunkSick?
D's flexibility allowed to easily integrate with the game code, hooking into it and calling it for my own purposes. After the mixins were written, adding OOP functionality to a data structure is as easy as:
struct SecureDataManager
{
mixin(mixMethod("SecureDataManager", "WriteValue", ["uint", "uint"]));
mixin(mixMethod("SecureDataManager", "ReadValue", ["uint"], "uint"));
}
The offsets are declared in an enum separately. After that, I can do stuff like:
auto x = secureDataManager.ReadValue(camera.XSecureIndex);
Hooking:
hooks ~= Hook(cast(void*)Offsets.MessageLoop, 6, &hkMessageLoop);
and other nifty stuff.
Getting the GC (garbage collector) to accept the situation (DLL injected in a non-D EXE, running in a thread not created by D's runtime) was somewhat of a pain. Luckily, with some support from the Tango team and a few tweaks, it's pretty stable now. I had to manage memory manually for the PathFinder, because at that time Tango did not deallocate GC-managed memory when the DLL unloaded. DFL and the Entice designer are a nice lightweight choice of a GUI library and RAD GUI design studio. Despite the (now-solved) GC troubles, it was a pleasure to write this in D - the most usually-tedious part, integrating with external code, was greatly simplified by D's string mixins and CTFE (compile-time function execution).
If you have any inquiries, feel free to contact me at drunksick@gmail.com. I will treat all conversations as private and won't disclose them to 3rd parties.