🗺 Dofus-Map FlatyCreator
quick route creation
quick route creation
Hello!
I've written a simple, quick browser script to allow the creation of Flatybot scripts via the popular Ce lien n'est pas visible, veuillez vous connecter pour l'afficher. Je m'inscris! website.
The pros and cons of using this tool instead of FlatyCreator are:
Pros:
- much faster route creation
- easy to see where the resources you need are
- it will not break when Dofus has an update
Cons:
- there are bugs!
- you cannot edit routes
- you cannot load routes
- you can only create harvest routes (no banking, no lost, no phoenix)
- you cannot use all available functions (e.g. move in a random direction)
The script was written very quickly and is not a finished product, thus you need to use it exactly as intended!
Instructions:
1. Open up the website Ce lien n'est pas visible, veuillez vous connecter pour l'afficher. Je m'inscris!
2. Select any resources you might need
3. Open up the javascript console (on Google Chrome you must press F12)
4. Copy the script into the console and press enter
5. Press on the cell where you would like to begin your route
6. Use W,A,S,D to add paths
7. Once you are happy with the route, press F. The lua script will be printed to the browser console - make sure you are focused on the document and not the console when you press F! Copy the script into a .lua file and make any necessary modifications
Notes:
- do NOT zoom in or out once you've begun creating your route. This will mess up the interface. This may be fixed in the future...
- if you make any mistakes during your creation process you must unfortunately start over.
- I've not put in any time into making the UI look nice, so sorry about that c;
Copy this into your browser console:
JavaScript:
var cellElement
var coord = []
var path = ''
let ups = 0
let lefts = 0
document.onkeydown = checkKey;
function checkKey(e) {
let str = ''
let changeMap = ''
e = e || window.event;
let newCoord = coord.slice();
if (e.key == 'w') {
ups++
newCoord[1]--;
str = '▲'
changeMap = 'top'
}
else if (e.key == 's') {
ups--
newCoord[1]++;
str = '▼'
changeMap = 'bottom'
}
else if (e.key == 'a') {
lefts++
newCoord[0]--;
str = '◄'
changeMap = 'left'
}
else if (e.key == 'd') {
lefts--
newCoord[0]++;
str = '►'
changeMap = 'right'
}
else if (e.key == 'f') {
console.log(`MAX_PODS = 95\nELEMENTS_TO_GATHER = {}\n\nfunction move()\n\treturn {\n\t`+path+`}\nend`)
}
path += '\t{ map = "'+coord[0]+','+coord[1]+'", gather = true, changeMap = "'+changeMap+'" },\n\t'
if (cellElement) {
cellElement.style.borderColor = 'green'
let prev = cellElement
cellElement = prev.cloneNode(true)
cellElement.style.borderColor = 'green';
cellElement.style.marginLeft = -(prev.offsetWidth * lefts) + 'px'
cellElement.style.marginTop = -(prev.offsetHeight * ups) + 'px'
prev.innerHTML = str
prev.style.display = 'flex'
prev.style.alignItems = 'center'
prev.style.justifyContent = 'center'
prev.style.color = 'green'
prev.style.zIndex = 99999
prev.parentNode.appendChild(cellElement)
}
coord = newCoord
}
function selectCoord() {
console.log(document.getElementById('mapContainer').dataset)
if (coord.length > 0) return
let zoom = document.getElementById('mapContainer').getAttribute('data-zoom')
console.log('zoom: ' + zoom)
let curr = document.querySelector('.leaflet-marker-icon.rectangleOnMap')
if (!cellElement) {
cellElement = curr.cloneNode(true)
cellElement.style.borderColor = 'red';
curr.parentNode.appendChild(cellElement)
}
return coord = document.getElementById('mapCoordinates').innerHTML.split(', ').map(num => parseInt(num))
}
document.getElementById('mapContainer').addEventListener('click', () => selectCoord())
console.log('> Flatybot route creation tool loaded successfully!')
I very much advise you to use this tool in conjunction with FlatyCreator.
I have written it because I feel these features need to be added to FlatyCreator as they greatly improve efficiency.