-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup
125 lines (104 loc) · 2.59 KB
/
backup
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
body {
background-color: rgb(24, 24, 24);
}
.worldWrapper {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-auto-rows: 150px;
width: 800px;
margin: 0 auto;
padding: 10px;
justify-content: center;
}
.worldBox {
grid-column: 1 / 3;
grid-row: 1 / 3;
border: 3px solid black;
background-color: white;
}
.menuBox {
grid-column: 1 / 3;
grid-row: 3 / 3;
border: 3px solid black;
background-color: grey;
font-family: Verdana,
Geneva,
Tahoma,
sans-serif;
}
.menuWrapper {
display: grid;
grid-template-rows: 1fr;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
}
.menuButton {
padding-top: 10px;
padding-bottom: 10px;
background-color: rgb(149, 112, 152);
border: 3px solid black;
font-size: 20px;
width: 100%;
font-family: Verdana, Geneva, Tahoma, sans-serif;
transition-duration: 0.4s;
}
.menuButton:hover {
background-color: #4CAF50;
color: white;
}
---
// This doesnt work properly, needs rewrite.
// make sure only one item can be selected (color coding not working!)
/*
window.onclick = e => {
if (e.target.id.includes("item")) {
if (currentlySelected == null) {
document.getElementById(e.target.id).style.color = "blue"
currentlySelected = e.target.id
}
else {
document.getElementById(currentlySelected).style.color = "black"
currentlySelected = e.target.id
document.getElementById(e.target.id).style.color = "blue"
console.log(currentlySelected)
}
} else {
e = null
currentlySelected = null
}
}
*/
// Drop item in invBox (NOTE: HAS TO HAVE LIMIT)
document.getElementById('invGrid1b_invBox').onclick = e => {
if (currentlySelected != null) {
let dropItem = document.getElementById(currentlySelected)
let currentBox = document.getElementById('invGrid1b_invBox')
currentBox.appendChild(dropItem)
}
}
// Drop item in weaponBox
let weaponBoxOccupied = false
document.getElementById('invGrid1b_weaponBox').onclick = e => {
if (currentlySelected != null && weaponBoxOccupied == false) {
let dropItem = document.getElementById(currentlySelected)
let currentBox = document.getElementById('invGrid1b_weaponBox')
currentBox.appendChild(dropItem)
weaponBoxOccupied = true
}
}
// Drop item in buffBox
let buffBoxOccupied = false
document.getElementById('invGrid1b_buffBox').onclick = e => {
if (currentlySelected != null && buffBoxOccupied == false) {
let dropItem = document.getElementById(currentlySelected)
let currentBox = document.getElementById('invGrid1b_buffBox')
currentBox.appendChild(dropItem)
buffBoxOccupied = true
}
}
// Drop item in discardBox
document.getElementById('invGrid1b_discardBox').onclick = e => {
if (currentlySelected != null) {
let tossItem = document.getElementById(currentlySelected)
tossItem.remove()
}
}