-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvillagerTrades.js
119 lines (107 loc) · 2.99 KB
/
villagerTrades.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
const villagerTrades = {
john: [
{
item: new classes.string(4),
price: { rottenflesh: 2, coins: 100}
},
{
item: new classes.intimidationtalisman(1),
price: { rottenflesh: 64, coins: 10000}
},
{
item: new classes.villagetalisman(1),
price: { coins: 5000}
},
{
item: new classes.steak(1),
price: { coins: 2000}
},
],
}
const LootTable = {
treeoak: [
new Loot("logoak",100,"foraging",4,4,"charcoal","","logoak",function(){ return !steve.getTool().match1word("shears")}),
new Loot("steeleaf",100,"foraging",1,4,"none","shears"),
new Loot("treetalisman",1)
],
sugarcane: [
new Loot("sugarcane",100,"farming")
],
stone: [
new Loot("cobblestone",100,"mining",1,1,"stone")
],
ironore: [
new Loot("ironore",100,"mining",1,1,"ironingot","","ironingot")
],
coalore: [
new Loot("coal",100,"mining")
],
redstoneore: [
new Loot("redstone",100,"mining",3,6)
],
diamondore:[
new Loot("diamond",100,"mining")
],
cactus: [
new Loot("cactus",100,"farming",1,1,"dyegreen")
],
zombie: [
new Loot("rottenflesh",100,"combat",1,4),
new Loot("zombiefang",20,"combat",1,3),
],
cow: [
new Loot("leather",80,"combat",1,4),
new Loot("beef",100,"combat",1,3,"steak")
],
chicken: [
new Loot("feather",80,"combat",1,4),
new Loot("rawchicken",100,"combat",1,3,"cookedchicken")
],
brutezombie: [
new Loot("rottenflesh",100,"combat",4,8),
new Loot("zombiefang",60,"combat",2,4),
],
grass:[
new Loot("dirt",100,"mining")
]
}
const villagerGuiSlots = []
/** @type {Gui} */
let villagerGui
function buildvillagerGui(){
for(const key in villagerTrades){
villagerTrades[key].forEach(x => {
let slot = new Slot(undefined,2,undefined,{
isLclickSpecial:true,
isRclickSpecial:true,
canPutItems:false,
})
slot.properties.onPostClick = buyItem
x.item.price = x.price
x.item.oldDescription2 = x.item.description2
x.item.description2 += x.item.description2 ? br+br : ""
x.item.description2 += formPriceString(x.price)
slot.setVisualItem(x.item)
slot.villagerType = key
e.villagerGui.appendChild(slot.getTag())
villagerGuiSlots.push(slot)
});
}
villagerGui = new Gui("villager",[e.villagerGui,e.inventory,e.hotbar,e.coins],undefined,{
onopen: function(Data){
isGuiOpen = true
e.coins.style.top = "42vh"
e.villagerName.innerText = getName(Data.villagerType)
villagerGuiSlots.forEach(x=>{
if(x.villagerType == Data.villagerType){
x.show()
}
else
x.hide()
})
},
onclose: function(Data){
e.coins.style.top = "30vh"
}
})
}