Skip to content

Instantly share code, notes, and snippets.

@Tibowl
Last active April 5, 2022 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tibowl/0529a89f9f9a2b35235a37fc36687a8a to your computer and use it in GitHub Desktop.
Save Tibowl/0529a89f9f9a2b35235a37fc36687a8a to your computer and use it in GitHub Desktop.
Treasure Compass range
Chest 1
OUT
-4543.81298828125, 201.03250122070312, -4694.38330078125
-4543.736328125, 201.36880493164062, -4468.32958984375
-4716.44091796875, 242.9683380126953, -4455.87060546875
-4805.1796875, 201.4721221923828, -4455.810546875
(-4908.53955078125, 353.1675720214844, -4628.1318359375)
-4903.96728515625, 234.48011779785156, -4647.8310546875
-4543.32275390625, 200.91842651367188, -4693.05859375
-4840.84228515625, 203.57199096679688, -4822.76904296875
IN
-4544.3154296875, 200.9452362060547, -4694.28759765625
-4544.25341796875, 201.37911987304688, -4468.7763671875
-4716.07470703125, 242.77450561523438, -4456.103515625
-4805.072265625, 201.46624755859375, -4456.07958984375
(-4777.640625, 442.21502685546875, -4463.5048828125)
-4903.82861328125, 234.3595733642578, -4647.82666015625
-4544.49853515625, 200.61578369140625, -4692.01708984375
(-4798.25537109375, 406.5186462402344, -4660.81884765625)
-4841.15771484375, 203.51817321777344, -4816.03173828125
FRONT
-4710.21435546875, 200.90989685058594, -4627.7890625
LEFT
-4710.48046875, 200.8995819091797, -4627.11376953125
BACK
-4709.62060546875, 200.9040069580078, -4627.24560546875
RIGHT
-4709.39990234375, 200.90428161621094, -4627.8662109375
TOP
-4710.00341796875, 201.88290405273438, -4627.5166015625
Chest 2
OUT
-4964.32275390625, 199.85888671875, -4725.42724609375
IN
-4963.78955078125, 199.88763427734375, -4725.75927734375
IN FRONT
-4867.40966796875, 203.25177001953125, -4777.2099609375
BACK
-4866.48486328125, 203.25656127929688, -4777.12451171875
MIDDLE-ish
-4866.87890625, 203.2467041015625, -4777.1669921875
Chest 3
OUT
-4863.80517578125, 204.1114044189453, -4618.7744140625
IN
-4864.16259765625, 204.0640869140625, -4618.763671875
MIDDLE-ish
-4954.66064453125, 203.2974395751953, -4602.01513671875
Chest 4
OUT
-4823.3896484375, 221.09954833984375, -4182.80712890625
-4823.6787109375, 204.1625213623047, -4408.02490234375
(-4920.4716796875, 199.65908813476562, -4417.90869140625)
-5021.8837890625, 203.3462677001953, -4053.02294921875
IN
-4824.15234375, 220.88916015625, -4183.0224609375
-4824.2841796875, 204.33642578125, -4407.3701171875
(-4921.212890625, 199.65943908691406, -4415.5)
-5021.58154296875, 199.5970916748047, -4056.3779296875
MIDDLE-ish
-5002.44140625, 205.38668823242188, -4221.095703125
const { loadImage, createCanvas } = require("node-canvas")
const fs = require("fs/promises")
const bad = [
[-4543.81298828125, 201.03250122070312, -4694.38330078125],
[-4543.736328125, 201.36880493164062, -4468.32958984375],
[-4716.44091796875, 242.9683380126953, -4455.87060546875],
[-4805.1796875, 201.4721221923828, -4455.810546875],
[-4903.96728515625, 234.48011779785156, -4647.8310546875],
[-4840.84228515625, 203.57199096679688, -4822.76904296875],
[-4840.6064453125, 203.5794677734375, -4821.8125],
[ -4840.48876953125, 203.6475830078125, -4819.95068359375],
[-4908.53955078125, 353.1675720214844, -4628.1318359375],
]
const good = [
[-4544.3154296875, 200.9452362060547, -4694.28759765625],
[-4544.25341796875, 201.37911987304688, -4468.7763671875],
[-4716.07470703125, 242.77450561523438, -4456.103515625],
[-4805.072265625, 201.46624755859375, -4456.07958984375],
[-4903.82861328125, 234.3595733642578, -4647.82666015625],
[-4841.15771484375, 203.51817321777344, -4816.03173828125],
[-4840.232421875, 203.2837677001953, -4814.1416015625],
[-4777.640625, 442.21502685546875, -4463.5048828125],
[-4798.25537109375, 406.5186462402344, -4660.81884765625],
]
const sides = [
[-4710.21435546875, 200.90989685058594, -4627.7890625],
[-4710.48046875, 200.8995819091797, -4627.11376953125],
[-4709.62060546875, 200.9040069580078, -4627.24560546875],
[-4709.39990234375, 200.90428161621094, -4627.8662109375],
[-4710.00341796875, 201.88290405273438, -4627.5166015625],
]
async function main() {
const img = await loadImage("./-5_-5.png") // https://i.imgur.com/5FYP4SI.png
const ca = createCanvas(img.width, img.height)
const ctx = ca.getContext("2d")
ctx.drawImage(img, 0, 0)
ctx.antialias = "none"
const center = [-4710.0, 200.9, -4627.5]
ctx.fillStyle = "#ff0000ff"
for (const [x, y, z] of bad) {
console.log(`Bad ${(x - center[0]).toFixed(3).padStart(8)} - ${(z - center[2]).toFixed(3).padStart(8)}`)
ctx.fillRect(Math.round(-z - 4096) - 1, Math.round(-x - 4096) - 1, 2, 2)
}
ctx.fillStyle = "#00ff00ff"
for (const [x, y, z] of good) {
console.log(`Good ${(x - center[0]).toFixed(3).padStart(8)} - ${(z - center[2]).toFixed(3).padStart(8)}`)
ctx.fillRect(Math.round(-z - 4096) - 1, Math.round(-x - 4096) - 1, 2, 2)
}
ctx.fillStyle = "#0000ffff"
for (const [x, y, z] of sides)
ctx.fillRect(Math.round(-z - 4096) - 1, Math.round(-x - 4096) - 1, 2, 2)
ctx.fillStyle = "#ffffff25"
// const range = [166, 193, 171, 190]
// for (const dist of range)
// ctx.fillRect(Math.round(-center[2] - 4096) - dist, Math.round(-center[0] - 4096) - dist, dist * 2, dist * 2)
ctx.fillStyle = "#ffffff60"
ctx.fillRect(Math.round(-center[2] - 4096) - 172, Math.round(-center[0] - 4096) - 166, 172+191, 166+193)
fs.writeFile("out.png", ca.toBuffer("image/png"))
}
main()
/**
Chest 1:
Output:
Bad 166.187 - -66.883
Bad 166.264 - 159.170
Bad -6.441 - 171.629
Bad -95.180 - 171.689
Bad -193.967 - -20.331
Bad -130.842 - -195.269
Bad -130.606 - -194.313
Bad -130.489 - -192.451
Bad -198.540 - -0.632
Good 165.685 - -66.788
Good 165.747 - 158.724
Good -6.075 - 171.396
Good -95.072 - 171.420
Good -193.829 - -20.327
Good -131.158 - -188.532
Good -130.232 - -186.642
Good -67.641 - 163.995
Good -88.255 - -33.319
https://i.imgur.com/qG2yWEF.png
Chest 2:
Output:
Bad -97.444 - 51.740
Good -96.911 - 51.408
https://i.imgur.com/MHbA2cT.png
Chest 3:
| Chest 3 | Chest 1
Bad | 90.855 | -16.759 | -153.805 | 8.726
Good | 90.498 | -16.749 | -154.163 | 8.736
Chest 4:
Bad 179.052 - 38.289
Bad 178.763 - -186.929
Bad 81.970 - -196.813
Bad -19.442 - 168.073
Good 178.289 - 38.073
Good 178.157 - -186.274
Good 81.229 - -194.404
Good -19.140 - 164.718
https://i.imgur.com/ZBffFHV.png - using same rectangle as chest 1, missing east location due to -5/-5 map cut-off
*/
// ==UserScript==
// @name Extract coordinates from feedback page
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Improve extraction of coordinates from feedback page
// @author You
// @match https://webstatic-sea.hoyoverse.com/ys/event/im-service/index.html?*
// @icon https://www.google.com/s2/favicons?domain=hoyoverse.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const { loc } = JSON.parse(decodeURIComponent(new URLSearchParams(window.location.search).get('ext')))
console.log(loc)
const div = document.createElement("div")
div.innerText = `Current coordinates: ${loc.x}, ${loc.y}, ${loc.z}`
div.style = "position: absolute; top: 20px; right: 20px; background-color: white; font-size: 1em; padding: 1em"
document.body.appendChild(div)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment