Default coat swap on Howrse

In April I created a Greasemonkey script to change the default coat for the Friesian breed to the v3 coat because I liked the v3 coat better.  At the time I thought the logic needed to change all of the default coats to the v3 default coats would take a lot more coding than it actually did, mostly because of how I initially wrote the script for the Friesian breed and how I wrote the script for this one.  Because the devs at Owlient kept the file names for the coat files the same and only changed the directory organization while leaving the v3 coats on the server it was a relatively simple task to create the code that would re-create the links so the page could display the v3 default coat for the breed and coat.

One of the problems I had with the Friesian script was it was unable to change the horse icons on pages like the breeding farm page.  The reason for this is due to the fact that the breeding farm is populated after the page is loaded and all GM scripts without delays are already run meaning there isn’t anything for the script to actually change at the time it runs.  To deal with this minor issue I put the part that swaps the horse icons into a function I can call using setTimeout to call the function after the breeding farm has been populated.  With the way the breeding farm page works when you switch to a different breeding farm, the page isn’t actually reloaded, the breeding farm grid is populated with horses from the selected breeding farm which means the script won’t be run again and the icons wouldn’t be switched.  This was fixed by using setInterval to have the function run every few seconds which shouldn’t cause any noticeable lag issues.  The rest of the pages that utilize horse icons won’t fire a setInterval call to the function, and will only run once when the page is initially loaded.

If you use the script you’ll notice that some of the default coats don’t swap and that is/should be some of the icons for foals.  The reason is that some aren’t tied to a specific breed but their species like “poney”.  Because of this it was easier to leave those with the v4 icons, but that should only be for the places the icons are displayed and not the horse’s page.  This is partly due to the differences in how the two parts of the script create the new image tag source.  The function that deals with icons disassembles the image tags source link while the part that deals with the default coat on the horse’s page ignores the style element that displays the horse and searches the page itself for clues to the horse’s breed and coat and uses those to put together the link to the v3 coat.

The pages that the script runs on are player presentations, EC presentations, horse pages both public and private, the player’s breeding farm page, horse description pages, safe haven, heaven and the horse sales.

Links to the script:

Userscripts:  Howrse Default Coat SwapAll

Greasy Fork:  Howrse Default Coat SwapAll

Since I only use the script on Firefox I cannot guarantee it will work on any browser other than Firefox, but it might.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s