1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Antheia</title>
<link rel='icon' type="image/x-icon" href='https://raw.githubusercontent.com/squiresgrant/Antheia/main/icon.ico'></link>
<style>
.flower{
transform:scale(0.7);
color:#ff6699;
}
</style>
</head>
<body>
<script>
//set background to dark grey
var BgColor = '#222222';
document.body.style.backgroundColor = BgColor;
let ranks = {
1:"poor",
100:"painter",
500:"carpet weaver",
1000:"graffiti artist",
5000:"caricature artist",
10000:"ascii artist"
}
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
}
else {
expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
function allowDrop(ev) {
ev.preventDefault();
}
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
}
function getRank(){
bank = getCookie('bank')
for(let k in ranks){
//console.log(k)
//console.log(bank)
if(parseInt(bank)>parseInt(k)){
} else {
return(ranks[k])
}
}
}
console.log(getRank())
function rgbToHex(r, g, b) {
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}
function hexToRgb(hex) { //made by people smarter than me, ty stackoverflow!
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
function averageColor(a, b) {
// force the input as numbers *1
let e = ((a * 1 + b * 1) / 2)
if (e > 255) {e = 255}
if (e < 0) {e = 0}
return e;
}
function drag(ev, from) {
ev.dataTransfer.setData("text", ev.target.id);
ev.dataTransfer.setData("from", from);
}
function drop2(ev, index) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
storage=getCookie("storage")
storage=JSON.parse(storage)
inv=getCookie("inv")
inv=JSON.parse(inv)
console.log(storage)
storage.push(inv[data])
inv.splice(data,1)
createCookie('inv', JSON.stringify(inv))
createCookie('storage', JSON.stringify(storage))
}
function drop(ev, index, fromDrop) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
var fromDrag = ev.dataTransfer.getData("from");
console.log(fromDrag+fromDrop)
var inv = getCookie('inv');
inv = JSON.parse(inv)
var store = getCookie('storage');
store = JSON.parse(store)
if(fromDrag == 'store' && fromDrop == 'inv'){
inv.push(store[data])
store.splice(data,1)
createCookie('storage', JSON.stringify(store))
createCookie('inv', JSON.stringify(inv))
} else {
let r = averageColor(hexToRgb(inv[data].color).r, hexToRgb(inv[index].color).r)
let g = averageColor(hexToRgb(inv[data].color).g, hexToRgb(inv[index].color).g)
let b = averageColor(hexToRgb(inv[data].color).b, hexToRgb(inv[index].color).b)
if(data>index){
inv.splice(data, 1)
inv.splice(index, 1)
} else {
inv.splice(index, 1)
inv.splice(data, 1)
}
createCookie('inv', JSON.stringify(inv));
let hex = (rgbToHex(r, g, b))
hex = hex.split(".")[0]
console.log(hex)
//let v = Math.floor(((255*3)-(r+g+b))/5)
let v = 0;
let hexadecimal = {"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,"a":10,"A":10,"b":11,"B":11,"c":12,"C":12,"d":13,"D":13,"e":14,"E":14,"f":15,"F":15}
for(let letter of hex.split("#")[1].split("")){
v+= hexadecimal[letter]
}
let craft = ""
if(v==90){
craft+="pure"
} else if (v>=80){
craft+="pure-ish"
} else if(v >=70){
craft+="bright"
} else if(v >= 60){
craft+="bright-ish"
} else if(v>= 50){
craft+="normal-ish"
} else if(v>=40){
craft+="normal"
} else if(v>=20){
craft+="dirty-ish"
} else {
craft+="dirty"
}
let ne = {"color": hex, "rarity": craft + "\<font size=1>(crafted)\</font>", "value": v}
//if(data!=index && inv[data].color != inv[data].color){
var inv = getCookie('inv');
inv = JSON.parse(inv)
inv.push(ne)
createCookie('inv', JSON.stringify(inv));
//}
}
}
function s(value, index) {
var inv = getCookie('inv');
inv = JSON.parse(inv)
createCookie('bank', parseInt(getCookie('bank')) + parseInt(value));
inv.splice(index, 1)
console.log(inv)
createCookie('inv', JSON.stringify(inv));
}
function toInv(index) {
var inv = getCookie('inv');
inv = JSON.parse(inv)
var store = getCookie('storage');
store = JSON.parse(store)
inv.push(store[index])
store.splice(index, 1)
createCookie('storage', JSON.stringify(store));
createCookie('inv', JSON.stringify(inv));
updateInv()
}
function updateInv() {
var inve = document.getElementById("inv");
var store = document.getElementById("storage");
//console.log(store.innerHTML)
var inv = getCookie('inv');
inv = JSON.parse(inv)
var storage = getCookie('storage');
storage = JSON.parse(storage)
var balance = document.getElementById("balance");
balance.innerHTML = getCookie("bank") + " <font size=1.5>(" + getRank() + ")</font>"
let i = ""
for (let item of inv) {
let t = '{color:' + String(item.color) + ', rarity:' + String(item.rarity) + ', value: ' + String(item.value) + '}'
if(item.s){
i += ("<div class='shiny' ondrop=\"drop(event," + inv.indexOf(item) + ", 'inv')\" ondragstart=\"drag(event, 'inv')\" ondragover=\"allowDrop(event)\" draggable=\"true\" onclick='s(" + item.value + "," + inv.indexOf(item) + ")' onmouseout='this.innerHTML = \"" + t + "\"'onmouseover='this.innerHTML=\"sell? (or drag to combine) \"' id='" + inv.indexOf(item) + "'>" + t + " //shiny!</div>")
} else {
i += ("<div ondrop=\"drop(event," + inv.indexOf(item) + ", 'inv')\" ondragstart=\"drag(event, 'inv')\" ondragover=\"allowDrop(event)\" draggable=\"true\" onclick='s(" + item.value + "," + inv.indexOf(item) + ")' onmouseout='this.innerHTML = \"" + t + "\"'onmouseover='this.innerHTML=\"sell? (or drag to combine) \"' id='" + inv.indexOf(item) + "'style='color:" + item.color + ";'>" + t + "</div>")
}
}
inve.innerHTML = i
let s = "storage:[</br>"
for (let item of storage) {
if(item != null){
let t = '{color:' + String(item.color) + ', rarity:' + String(item.rarity) + ', value: ' + String(item.value) + '}'
if(item.s){
s += ("<div ondrop=\"drop(event," + inv.indexOf(item) + ", 'store')\" ondragstart=\"drag(event, 'store')\" ondragover=\"allowDrop(event)\" draggable=\"true\" class='shiny' onmouseout='this.innerHTML = \"" + t + "\"'onmouseover='this.innerHTML=\"click to move to inv \"' id='" + storage.indexOf(item) + "'>" + t + " //shiny!</div>")
} else {
s += ("<div ondrop=\"drop(event," + inv.indexOf(item) + ", 'store')\" ondragstart=\"drag(event, 'store')\" ondragover=\"allowDrop(event)\" draggable=\"true\" onmouseout='this.innerHTML = \"" + t + "\"'onmouseover='this.innerHTML=\"click to move to inv \"' onclick='toInv(" + storage.indexOf(item) + ");' id='" + storage.indexOf(item) + "'style='color:" + item.color + ";'>" + t + "</div>")
}
}
}
store.innerHTML = s
}
function clear() {
createCookie('inv', JSON.stringify([]))
createCookie('storage', JSON.stringify([]));
createCookie('bank', 15);
}
let file = "./crates.json"
var bank = getCookie('bank');
var inv = getCookie('inv');
var storage = getCookie('storage');
if (bank == "") {
createCookie('bank', 15);
var bank = getCookie('bank');
location.reload();
}
if (inv == "") {
createCookie('inv', JSON.stringify([]));
var inv = getCookie('inv');
location.reload();
}
if (storage == "") {
createCookie('storage', JSON.stringify([]));
var inv = getCookie('storage');
location.reload();
}
var arr = JSON.parse(inv);
var storage = JSON.parse(storage);
// console.log(arr)
// console.log(bank)
// createCookie('bank', 15);
function min(item) {
console.log(item)
x = document.getElementsByClassName(item)
//x[i].outerText="\ncontents: [ ... ] <div class='"+item+"'>";
x[0].hidden = !x[0].hidden
}
function roll(item) {
fetch(file)
.then(response => {
return response.json();
})
.then(data => {
var bank = getCookie('bank');
var inv = getCookie('inv');
var arr = JSON.parse(inv);
if (data.crates[item].price <= getCookie('bank')) {
//console.log(data.crates[item].contents[Math.floor(Math.random()*data.crates[item].contents.length)])
var x = document.getElementById("popup");
if (x.style.display != "block") { //anti spam check thingy
x.style.display = "block";
let chance = Math.floor(Math.random() * 100)
let shiny = chance > 98
let select = Math.floor(Math.random() * data.crates[item].contents.length)
if(!shiny){
x.innerHTML = "you got a:</br></br><code> >> " + (data.crates[item].contents[select].color) + (' ( r = ' + data.crates[item].contents[select].rarity + " && value = " + data.crates[item].contents[select].value + ")</code>").fontsize(1)
} else {
x.innerHTML = "you got a (shiny):</br></br><code> >> " + (data.crates[item].contents[select].color) + (' ( r = ' + data.crates[item].contents[select].rarity + " && value = " + data.crates[item].contents[select].value + ")</code>").fontsize(1)
}
x.style.background = (data.crates[item].contents[select].color)
createCookie('bank', bank - data.crates[item].price);
console.log(chance)
data.crates[item].contents[select]['storage'] = false
data.crates[item].contents[select]['s'] = shiny
arr.push(data.crates[item].contents[select])
createCookie('inv', JSON.stringify(arr));
setTimeout(function () {document.getElementById("popup").style.display = "none";}, 500);
}
} else {
var x = document.getElementById("popup");
if (x.style.display != "block") { //anti spam check thingy
x.style.display = "block";
x.innerHTML = "you can't afford this:("
x.style.background = ("#000000")
setTimeout(function () {document.getElementById("popup").style.display = "none";}, 1000);
}
}
})
}
fetch(file)
.then(response => {
return response.json();
})
.then(data => {
var intervalID = window.setInterval(myCallback, 500);
function myCallback() {
updateInv()
x = document.getElementsByClassName("shiny")
for(let i of x){
inner = i.innerHTML.split("")
//console.log(inner.split(""))
i.innerHTML = ""
for(let letter in inner){
let color = rgbToHex(Math.floor(Math.random() * 255),Math.floor(Math.random() * 255),Math.floor(Math.random() * 255))
inner[letter] = "<div style='color:"+color+";display:inline;'>" + inner[letter] + "</div>"
//console.log(inner[letter])
i.innerHTML += inner[letter]
}
}
}
document.write("<title>Antheia</title>")
function setFavicons(favImg){
let headTitle = document.querySelector('head');
let setFavicon = document.createElement('link');
setFavicon.setAttribute('rel','shortcut icon');
setFavicon.setAttribute('href',favImg);
headTitle.appendChild(setFavicon);
}
document.write("<div style='position:absolute;bottom:0%;right:0%;transform:scale(0.6);'><tt>\
<div style='display:inline;color:rgba(0, 0, 0, 0);'>_______________________</div>.-'~~~-.</br>\
<div style='display:inline;color:rgba(0, 0, 0, 0);'>_____________________</div>.'o oOOOo`.</br>\
<div style='display:inline;color:rgba(0, 0, 0, 0);'>____________________</div>:~~~-.oOo o`.</br>\
<div style='display:inline;color:rgba(0, 0, 0, 0);'>______________________</div>`. \ ~-. oOOo.</br>\
<div style='display:inline;color:rgba(0, 0, 0, 0);'>_______________________</div>`.; / ~. OO:</br>\
<div style='display:inline;color:rgba(0, 0, 0, 0);'>_______________________</div>.' ;-- `.o.'</br>\
<div style='display:inline;color:rgba(0, 0, 0, 0);'>______________________</div>,' ; ~~--'~</br>\
<div style='display:inline;color:rgba(0, 0, 0, 0);'>______________________</div>; ;</br>\
_______\|/__________\\;_\\//___\|/________ </tt></div>")
setFavicons('https://raw.githubusercontent.com/squiresgrant/Antheia/main/icon.ico');
var bank = getCookie('bank');
var inv = getCookie('inv');
var inv = getCookie('storage');
inv = JSON.parse(inv)
document.write("<div style='position:absolute;right:5%;'>")
document.write("inv:{ //<a style='color:#696969;' href = \"https://github.com/squiresgrant\">https://github.com/squiresgrant</a> <a style='color:pink;' href=\"https://github.com/squiresgrant/Antheia\">v1.3+10</a><a style='color=purple;'> \<3 "+ "dXd1IQ==".fontsize(1) +"</a></br>")
document.write("items:[</br>")
document.write("<div id='inv'>")
document.write("</div>")
document.write("],</br>")
document.write("<div id='storage' ondragover=\"allowDrop(event)\" ondrop=\"drop2(event)\">storage:[</br>")
let storage = getCookie("storage")
storage=JSON.parse(storage)
document.write("/* drag items here to prevent them from being sold! */")
document.write("</div>")
document.write("]")
document.write("bank:<div id='balance'>" + bank + " <font size=1.5> (" + getRank() + ")</font></br></div>")
document.write("}")
document.write("</div>")
for (let crate of data.crates) {
let r = averageColor(hexToRgb(crate.contents[0].color).r,hexToRgb(crate.contents[2].color).r)
let g = averageColor(hexToRgb(crate.contents[0].color).g,hexToRgb(crate.contents[2].color).g)
let b = averageColor(hexToRgb(crate.contents[0].color).b,hexToRgb(crate.contents[2].color).b)
document.write("<div style='border-radius:5px;width:25%;background-color:rgba("+r+","+g+","+b+", .2)'>")
document.write("{</br>name: " + crate.name)
document.write("</br>price: " + crate.price)
document.write("<div onclick='min(\"" + data.crates.indexOf(crate) + "\")'</br>contents: [<div class='" + data.crates.indexOf(crate) + "'>")
for (let item of crate.contents) {
if (item == crate.contents[0]) {
document.write("<div style='color:" + item.color + ";'>{color:" + item.color + ", rarity:" + item.rarity + ", value:" + item.value + "}</div>")
} else {
document.write("<div style='color:" + item.color + ";'>{color:" + item.color + ", rarity:" + item.rarity + ", value:" + item.value + "}</div>")
}
}
document.write("</div>]</div>}")
x = document.getElementsByClassName(data.crates.indexOf(crate))
x[0].hidden = true
//x[i].outerText="\ncontents: [ ... ] <div class='"+item+"'>";
document.write("<button style=' padding: 3px 13px;font-size: 14px; display: inline-block;cursor: pointer;background-color: #FAFBFC; border: 1px solid rgba(27, 31, 35, 0.15); border-radius: 3px;'onclick='roll(" + data.crates.indexOf(crate) + ")'>roll</button></br></div>")
// document.write("<button style=' padding: 6px 16px;font-size: 14px; display: inline-block;cursor: pointer;background-color: #FAFBFC; border: 1px solid rgba(27, 31, 35, 0.15); border-radius: 6px;'onclick='createCookie(\"inv\", JSON.stringify([]));updateInv()'>reset</button>")
//document.write("<p>" + d.crates[0].price + "</p>")
}
document.body.style.backgroundColor = BgColor;
return (0)
}).then((open) => {
var number = 5; //just for an example
//------------^ // Not sure but ; is a must in some places.
document.write('<div id = "popup"style="height:50%;position:absolute;width:100%;top:25%;background: #1a1a1a;color:#fff;">null</div>')
var x = document.getElementById("popup");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
})
//
</script>
if you see this;) try refreshing your page! (ctrl+r will work!)<tt><bold><div class='flower'>
______________________________....</br>
___________________________,;;'''';;,____________________,;;;;,</br>
________________,________;;'_______`;;,_______________.,;;;'___;</br>
______________,;;;_______;;_________`;;,';;;,.______,%;;'_______'</br>
____________,;;,;;_______;;_________,;`;;;, `;::. %%;'</br>
___________;;;,;;;_______`'_______,;;; ;;,;;,_`::,%%;'</br>
___________;;;,;;;,__________.,%%%%%'%_;;;;,;;___%;;;</br>
_,%,.______`;;;,;;;,____.,%%%%%%%%%'%;_;;;;;,;;__%;;;</br>
;,`%%%%%%%%%%`;;,;;'%%%%%%%%%%%%%'%%'__`;;;;;,;, %;;;</br>
;;;,`%%%%%%%%%%%,;_..`%%%%%%%%;'%%%'____`;;;;,;; %%;;</br>
_`;;;;;,`%%%%%,;;/,_.._`"""'',%%%%%______`;;;;;; %%;;,</br>
___`;;;;;;;,;;/////,._____,;%%%%%%%_______`;;;;,`%%;;</br>
__________;;;/%%%%,%///;;;';%%%%%%,__________`;;;%%;;,</br>
_________;;;/%%%,%%%%%/;;;';;'%%%%%,____________`%%;;</br>
________.;;/%%,%%%%%//;;'__;;;'%%%%%,____________%%;;,</br>
________;;//%,%%%%//;;;'___`;;;;'%%%%_____________`%;;;</br>
_________;;//%,%//;;;;'______`;;;;'%%%______________%;;;,</br>
_________`;;//,/;;;'___________`;;;'%%'______________`%;;;</br>
___________`;;;;'________________`;'%'________________`;;;;</br>
__________________________________'______.,,,.________`;;;;</br>
______________________________________,;;;;;;;;;;,_____`;;;;</br>
_____________________________________;;;'____;;;,;;,____`;;;;</br>
_____________________________________;;;______;;;;,;;.___`;;;;</br>
_____________________________________`;;______;;;;;,;;___;;;;</br>
_______________________________________`'______`;;;;,;;__;;;;</br>
__________________________________________________`;;,;,_;;;;</br>
_____________________________________________________;;,_;;;;</br>
________________________________________________________';;;;;</br>
_________________________________________________________;;;;;</br>
________________________________________________________.;;;;'</br>
_______________________________________________________.;;;;'</br>
______________________________________________________;;;;;'</br>
_____________________________________________________,;;;;' //art by susie oviatt (find it <a href="https://www.asciiart.eu/plants/flowers">here</a>)</br>
</tt></bold></div>
stuck on this page? make sure you have cookies and javascript enabled, dont know how to? goodluck (lol)
</body>
</html>
|