Skip to content

Instantly share code, notes, and snippets.

@twilight-sparkle-irl
Last active April 26, 2024 14:26
Show Gist options
  • Save twilight-sparkle-irl/c2c0e527d7008d7c1d60a31276e50151 to your computer and use it in GitHub Desktop.
Save twilight-sparkle-irl/c2c0e527d7008d7c1d60a31276e50151 to your computer and use it in GitHub Desktop.
import/export ponies

only enable one at a time
this only works on computer. you must have tampermonkey installed on your browser

when ponies dumper is on: open console and type dumpPonies()

when ponies changer is on: open your ponies.txt, copy and paste the large chunk of data next to the pony name (and nothing else, no spaces, etc), open console, type window.ponyInfo = "[CODE STRING]", create a new pony, save it, and then type delete window.ponyInfo;

i cannot guarantee this will work cross server, as pony town has not updated the public domain release despite multiple upgrades it's had, causing other servers to need to make replica features or simply not implement them. if you need extra servers, add a // @match https://[server domain]/* line with the pony.town ones

// ==UserScript==
// @name Ponies Changer
// @run-at document-start
// @match https://pony.town/*
// @grant none
// ==/UserScript==
// magic incantation
window.XMLHttpRequest.prototype.addEventListener=((f)=>{return function(){f.apply(this,arguments)}})(window.XMLHttpRequest.prototype.addEventListener)
// actual code
var _ = window.XMLHttpRequest.prototype.send
window.XMLHttpRequest.prototype.send = function() {
var h = arguments[0]
if(this.__zone_symbol__xhrURL.match(/^\/api\/pony\/save/)) {
var x = JSON.parse(h)
if(window.ponyInfo) {
x.pony.info = window.ponyInfo
}
h = JSON.stringify(x)
}
_.apply(this,[h])
}
// ==UserScript==
// @name Ponies Dumper
// @run-at document-start
// @match https://pony.town/*
// @grant none
// ==/UserScript==
// magic incantation
window.XMLHttpRequest.prototype.addEventListener=((f)=>{return function(){f.apply(this,arguments)}})(window.XMLHttpRequest.prototype.addEventListener)
// actual code
var _ = window.XMLHttpRequest.prototype.send
window.XMLHttpRequest.prototype.send = function() {
if(this.__zone_symbol__xhrURL.match(/^\/api([0-9]+)\/account(\?t=(.+))?$/)) {
this.addEventListener('load',function(e) {
window.ponies = JSON.parse(this.responseText).ponies
})
}
_.apply(this,arguments)
}
window.dumpPonies = function dumpPonies() {
var poniesTxt = window.ponies.map(x=>`${x.name}\t${x.info}`).join`\n`
var file = new Blob([poniesTxt], {type: "text/plain"});
var a = document.createElement('a')
a.href = URL.createObjectURL(file);
a.download = "ponies.txt";
a.click()
}
@IMNEWTOGIT
Copy link

hi, im new to GitHub, i wanna know how and what should I do to use the script!! and how could I copy skins in pony town tysm!! and good work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment