-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitemdetails.js
171 lines (159 loc) · 5.79 KB
/
itemdetails.js
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
var item1 = {
name: "Credit Stick",
value: 50, // this is the range of price this can be.
amount: 10, // this is the range of items this can be.
dvalue: 50, // default
damount: 1, // default
sell: false
};
var item2 = {
name: "Cyber Wares",
value: 1000, // this is the range of price this can be.
amount: 10, // this is the range of items this can be.
dvalue: 1000, // default
damount: 1, // default
sell: false
};
var item3 = {
name: "Pills",
value: 2500, // this is the range of price this can be.
amount: 5, // this is the range of items this can be.
dvalue: 2500, // default
damount: 1, // default
sell: false
};
var item4 = {
name: "Injector",
value: 5000, // this is the range of price this can be.
amount: 10, // this is the range of items this can be.
dvalue: 5000, // default
damount: 1, // default
sell: false
};
var item5 = {
name: "Surplus Electronics",
value: 10000, // this is the range of price this can be.
amount: 10, // this is the range of items this can be.
dvalue: 10000, // default
damount: 1, // default
sell: false
};
// / WHERE ITEMS LAY get buy names for function show, buy and sell---- sets the
// item 1
var buyn1 = document.getElementById("buyName1");
var buyp1 = document.getElementById("buyPrice1");
var buya1 = document.getElementById("buynum1");
buyn1.innerText = item1.name + " -- ";
buyp1.innerText = "Price: " + item1.value;
buya1.innerText = "Available: " + item1.amount;
var buyName1 = document.getElementById("buyName1").textContent;
// item 2
var buyn2 = document.getElementById("buyName2");
var buyp2 = document.getElementById("buyPrice2");
var buya2 = document.getElementById("buynum2");
buyn2.innerText = item2.name + " -- ";
buyp2.innerText = "Price: " + item2.value;
buya2.innerText = "Available: " + item2.amount;
var buyName2 = document.getElementById("buyName2").textContent;
// item 3
var buyn3 = document.getElementById("buyName3");
var buyp3 = document.getElementById("buyPrice3");
var buya3 = document.getElementById("buynum3");
buyn3.innerText = item3.name + " -- ";
buyp3.innerText = "Price: " + item3.value;
buya3.innerText = "Available: " + item3.amount;
var buyName3 = document.getElementById("buyName3").textContent;
// item 4
var buyn4 = document.getElementById("buyName4");
var buyp4 = document.getElementById("buyPrice4");
var buya4 = document.getElementById("buynum4");
buyn4.innerText = item4.name + " -- ";
buyp4.innerText = "Price: " + item4.value;
buya4.innerText = "Available: " + item4.amount;
var buyName4 = document.getElementById("buyName4").textContent;
// item 5
var buyn5 = document.getElementById("buyName5");
var buyp5 = document.getElementById("buyPrice5");
var buya5 = document.getElementById("buynum5");
buyn5.innerText = item5.name + " -- ";
buyp5.innerText = "Price: " + item5.value;
buya5.innerText = "Available: " + item5.amount;
var buyName5 = document.getElementById("buyName5").textContent;
function updateMerch() {
//update the items in the merchant
// / WHERE ITEMS LAY get buy names for function show, buy and sell---- sets the
// item 1
var buyn1 = document.getElementById("buyName1");
var buyp1 = document.getElementById("buyPrice1");
var buya1 = document.getElementById("buynum1");
buyn1.innerText = item1.name + " -- ";
buyp1.innerText = "$: " + item1.value;
buya1.innerText = "x " + item1.amount;
var buyName1 = document.getElementById("buyName1").textContent;
// item 2
var buyn2 = document.getElementById("buyName2");
var buyp2 = document.getElementById("buyPrice2");
var buya2 = document.getElementById("buynum2");
buyn2.innerText = item2.name + " -- ";
buyp2.innerText = "$: " + item2.value;
buya2.innerText = "x " + item2.amount;
var buyName2 = document.getElementById("buyName2").textContent;
// item 3
var buyn3 = document.getElementById("buyName3");
var buyp3 = document.getElementById("buyPrice3");
var buya3 = document.getElementById("buynum3");
buyn3.innerText = item3.name + " -- ";
buyp3.innerText = "$: " + item3.value;
buya3.innerText = "x " + item3.amount;
var buyName3 = document.getElementById("buyName3").textContent;
// item 4
var buyn4 = document.getElementById("buyName4");
var buyp4 = document.getElementById("buyPrice4");
var buya4 = document.getElementById("buynum4");
buyn4.innerText = item4.name + " -- ";
buyp4.innerText = "$: " + item4.value;
buya4.innerText = "x " + item4.amount;
var buyName4 = document.getElementById("buyName4").textContent;
// item 5
var buyn5 = document.getElementById("buyName5");
var buyp5 = document.getElementById("buyPrice5");
var buya5 = document.getElementById("buynum5");
buyn5.innerText = item5.name + " -- ";
buyp5.innerText = "$: " + item5.value;
buya5.innerText = "x " + item5.amount;
var buyName5 = document.getElementById("buyName5").textContent;
}
//change locations for buttons
function changeLocation() {
item1.value = item1.dvalue;
item1.amount = item1.damount;
item2.value = item2.dvalue;
item2.amount = item2.damount;
item3.value = item3.dvalue;
item3.amount = item3.damount;
item4.value = item4.dvalue;
item4.amount = item4.damount;
item5.value = item4.dvalue;
item5.amount = item4.damount;
var modifier1 = getRandomNum(1, 10);
var modifier2 = getRandomNum(1, 10);
item1.value *= modifier1;
item1.amount *= modifier2;
var modifier3 = getRandomNum(1, 10);
var modifier4 = getRandomNum(1, 10);
item2.value *= modifier3;
item2.amount *= modifier4;
var modifier5 = getRandomNum(1, 10);
var modifier6 = getRandomNum(1, 10);
item3.value *= modifier5;
item3.amount *= modifier6;
var modifier7 = getRandomNum(1, 10);
var modifier8 = getRandomNum(1, 10);
item4.value *= modifier7;
item4.amount *= modifier8;
var modifier9 = getRandomNum(1, 10);
var modifier10 = getRandomNum(1, 10);
item5.value *= modifier9;
item5.amount *= modifier10;
updateMerch();
}