A Bot for The Lost Runes written in Typescript as a Chrome Extension

A Bot for The Lost Runes written in Typescript as a Chrome Extension

I’ve spent some time and created a bot for The Lost Runes written in Typescript as a Chrome Extension.  All you have to do is navigate to the chrome web store page and install it.  It’s free and open source.

Features

  • Automatically attacks for you.
  • Automatically performs tradeskills for you.
  • Automatically walks you to a destination.
  • Alerts you when a quest has been completed.(audio and title bar)
  • Alerts you when a captcha is present. (audio and title bar)
  • Alerts you when you receive a private message (audio only)
  • Alerts you when a new Game Event is detected, such as a boss (audio only)
  • Optionally wait a random period of time before each action, minimizing risk of detection.
  • Minimalistic User Interface.  It won’t bother you or get in your way.

Why a new bot?

The truth is, the first time I do a project, it works but turns out being non-optimal.  The second time around, I expect to fix almost all of the major design flaws and I am pleased with the design.  If there is a third rewrite, it is because further requirements have been introduced that weren’t there initially.  It’s the same for a lot of software development in real life also.  The customer simply doesn’t know what they want until they see what you give them and try to apply it to their actual needs that initiated the project.  This is the second revision of the bot, so we will see what happens in the future.

Why Typescript?

I’ve spent the last few days rewriting my bot for the lost runes in typescript. I’ve decided to go a step further than I have in previous articles by walking you through how it was built.  I’ve chosen to write the new bot in typescript because it allows me to easily segregate the logic in my code into their own file.  It could of course have just been written in JavaScript, but I thought it would be the perfect time to try a new language if for no reason than to see if I enjoy it.

Another very nice side-effects of writing the bot in typescript is that it will allow me to make changes to the bot much easier in the future.  It is very likely that The Lost Runes will change at some point in time, breaking my bot.  That’s unfortunate, but unavoidable.  By using typescript, I have narrowed the scope of everything, allowing me to quickly identify what needs changing and change it without worrying about affecting other code as much.  It is much less like spaghetti code.

Environment

You can view the entire source code for my bot at bitbucket HERE.

I chose to avoid Visual Studio for this project, because I know how being locked into windows can feel.  Instead, I take advantage of the typescript compiler that you get with npm and a few other packages that watch my project hierarchy for changes and invoke the compiler when necessary. To build my project, all you need to do is cd to the project directory and run npm link.  This will go download all of the development dependencies.  Once finished, simply running ‘grunt typescript’ will build a new tlrbot.js and put it inside the dist directory.

The dist directory is what is packaged up as a chrome extension.  Google provides quite good documentation for how to build a chrome extension, it really only depends on you having a manifest.json file that tells chrome what your extension is all about.

The modules directory contains typescript definitions for non-typescript types.  For example, you will see a jquery.d.ts file as well as a chrome.d.ts file in there.  The chrome.d.ts file was made by me, so you may not find it elsewhere.  It allows me to tell Typescript about the chrome.exension.getURL() method.

The app directory contains the actual code for the bot, and the AppConfig.ts file is our entry point.  It is not wrapped in any kind of module and is very much just plain JavaScript with the exception of the first two lines. It allows us to kick-start our bot after making sure that all dependencies have been loaded with the help of require.js. All of these classes will be compiled down to a single JavaScript file that chrome uses.

Basic Design

The basic idea behind the new design was to abstract away the portion of code that gathered information from the game from the logic that performs actions based upon that information.  In order to accomplish this, I created first, a StateManager class whose responsibility is simply gather information and fire ‘events’ when information we care about changes.  A majority of the ugly code that has to rely upon screen-scraping the game data is inside the StateManager class.

I created different ‘Bot’ classes for each of the major functions of the bot (BattleBot, TradeskillBot, WalkBot, and NotifyBot).  Each of them registers for events from the StateManager and handle them accordingly.  You should be able to see the benefit now of organizing the code this way.

I would say the only other portion worth pointing out is the UserInterface class, which is responsible for creating the bar across the top of the page and for handling user input.  This class also exposes some events such as when the bot is paused or the Walk button is pressed.

TL;DR

If you’re just here for the download and don’t really care about anything else I have to say, the link to the chrome web store page is right HERE.  I have to warn you again, however, that you may very well get banned for using this.  I’ve made every effort on my part to help make the bot as inconspicuous as possible to help minimize the risk that you will be caught, but that is no guarantee.

 

 

 

 

 

An Updated Bot for The Lost Runes

An Updated Bot for the Lost Runes

A while back I posted about a small bot that I wrote for a game called The Lost Runes.  I have had requests to add some features to it, such as adding support for automatically doing trade-skills.  I have released a new version of my chrome extension that now provides the following features:

  • It will continuously fight battles for you if you are on the battle screen.
  • It will continuously do the quickest trade-skill for you for whichever trade-skill page you are on.
  • It will alert you via the title bar when you complete a trade-skill quest or a battle quest.
  • It will alert you via the title bar when a captcha window appears.
  • It can also optionally alert you via audio when a quest is complete or a captcha window appears.
  • It provides a place for you to type coordinates to walk to, and it will automatically walk there as quickly as possible.

I would like to point out, you will likely get banned for using this if you are discovered.  Use it at your own risk.  I have heard from several people that claim to be using it without any trouble, so I am under the impression that it is difficult to detect.  I have had nobody complaining about their account being banned to me at least, so if you get caught – it’s likely that you made a glaring mistake by divulging too much information to your friends in-game.

Another important change I made from the previous version is that I added it to the chrome store to make it easier for people to install.  You know longer have to download a file and then manually install it into chrome.  All you have to do is click on the install button from the extension’s chrome store page.

It’s unlikely that I will post another article about this unless I hear overwhelming feedback, so if you use this extension, please let me know.  I enjoyed making it, but I see no reason to continue working on it unless I know a decent user-base exists for it.

TL;DR

You will get banned, but install it from the Extensions Chrome Store Page

 

 

A Bot for The Lost Runes

A Bot for The Lost Runes

This is going to be pretty short and sweet.  I had a cousin introduce me to http://www.thelostrunes.com and I wanted to play with making a chrome extension. This gave me the perfect opportunity to create a bot for The Lost Runes.

Installing this extension will add a new bar along the top of the game page. This controls the bot.

Please note that using any kind of script while playing this game is highly frowned upon and you will most certainly get banned if you get caught.  That being said, as of this post, I haven’t been banned.  Chances are highly probable that I will be banned when I announce it in the game chat, however.  Truth be told, I wasn’t going to announce this for fear of getting banned – but after seeing that it’s a real time waster I decided I should probably do something better with my time anyway.

batmanbar

Anyway, the result was that I ended up making a simple bot that has 4 main features:

  • When enabled, it will automatically continuously battle for you.
  • If a captcha is detected, it will automatically pause itself and alert you by changing the title and (optionally) playing a notification sound.
  • It will automatically detect when a quest is complete and alert you by changing the title and (optionally) playing a notification sound.
  • It allows you to type in destination coordinates and it will automatically ‘walk’ there for you.

It turns out that making a chrome extension is pretty damn easy.  It also turns out that you can do a lot of cool stuff from within a chrome extension.  This particular extension registers itself as a content_script, allowing itself to modify the page that it runs on.  If you take apart this extension and find that the Javascript code is horrible, you are probably right.  I whipped this up in a very short timespan and it works, but isn’t pretty.

TL;DR  

You might get banned, but here you go.

  1. Download HERE
  2. Navigate to chrome://extensions
  3. Drag the file (tlr.crx) onto your browser window and tell chrome you want to install it.
  4. Go play the game

First chapter Initial Revision complete?

It appears I may be getting close to having the first chapter’s initial revision done. If you get a minute and feel like critiquing my work and letting me know what you think, it would be appreciated.  Just head over to the Literary Works page and you will be able to see the entire work in progress for free.

I’ve attempted to set myself up with multiple routes the story could take.  Leave a comment if you have ideas that you’d like to see realized.

Introducing Myself

I’m a programmer by trade, but truthfully I can’t confine myself to just that category of knowledge.  I frequently enjoy switching hobbies and trying new things, so don’t be too surprised when you find seemingly random content all over the place.  Whether you care or not, introducing myself seems like a good idea.

First of all, my name is Brad.  As I’ve said, I enjoy switching hobbies, but a lot of my hobbies revolve around figuring out how something works, or how best to do something.  I switch back and forth between problem-solving hobbies and creative hobbies – that seems to suit me pretty well.  I tend to be pretty OK at a lot of things, but rarely am able to actually stick with one activity for long enough to become a master.  For the longest time I viewed this as a weakness of character, and it may very well be still, but recently I’ve been trying to come to terms with it so I can discover the root of it.  I have a common tendency to not finish projects after I have figured out exactly how to solve all of the problems  - I simply lose interest at that point.

I have created this site as a personal stress-relief device for myself.  This, to me, is a project that has no goal, so I am not worried about ‘finishing’ it.  I may put some interesting/useful things on here, but I’m not guaranteeing it.  If you enjoy reading anything, please take a moment to comment – it will make my day.

If you have any more questions about myself, feel free to ask.  You can either post a comment here, or send an email to brad@theportablecoder.com.  I look forward to hearing from you!

That’s about all I’ve got, so for now, here’s a picture of a road.

Kruger Road

A road I once saw.