blob: f8f184da659fb00ca43479f53ba5cd8a4bf00b2f (
plain)
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
|
package tf2crates.crate;
import java.util.ArrayList;
import java.util.List;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.crafting.ToolRecipe;
import tlhpoeCore.util.MathUtil;
/**
* Get random instances of random loot :)
*
* @author ben
*
*/
public class RandomRandomLoot {
private static List<RandomLoot> loot;
public static void init() {
loot = new ArrayList<RandomLoot>();
// Tool loot
addToolLoot();
// Weapon loot
addWeaponLoot();
// Armor loot
addArmorLoot();
// Potion loot
addPotionLoot();
// Plant loot
addPlantLoot();
addPlantLoot();
// Dye loot
addDyeLoot();
addDyeLoot();
// Decorative loot
addDecorativeLoot();
addDecorativeLoot();
// Valuble loot
addValubleLoot();
// Bauble loot
addBaubleLoot();
// Misc Loot
addMiscLoot();
addMiscLoot();
addTinkersLoot();
}
private static void addTinkersLoot() {
List<ToolRecipe> combos = ToolBuilder.instance.combos;
for (ToolRecipe toolRecipe : combos) {
boolean isLegendary;
if (MathUtil.nextDouble() > .8) {
isLegendary = true;
} else {
isLegendary = false;
}
loot.add(new RandomTinkersTool(isLegendary, toolRecipe));
}
}
private static void addToolLoot() {
loot.add(new RandomLoot.Pickaxe(false));
loot.add(new RandomLoot.Pickaxe(true));
loot.add(new RandomLoot.Shovel(false));
loot.add(new RandomLoot.Shovel(true));
loot.add(new RandomLoot.Axe(false));
loot.add(new RandomLoot.Axe(true));
loot.add(new RandomLoot.Hoe(false));
loot.add(new RandomLoot.Hoe(true));
loot.add(new RandomLoot.ToolHead());
}
private static void addWeaponLoot() {
loot.add(new RandomLoot.Sword(false));
loot.add(new RandomLoot.Sword(true));
loot.add(new RandomLoot.Bow(false));
loot.add(new RandomLoot.Bow(true));
loot.add(new RandomLoot.Arrow());
}
private static void addArmorLoot() {
loot.add(new RandomLoot.Helmet(false));
loot.add(new RandomLoot.Helmet(true));
loot.add(new RandomLoot.Chestplate(false));
loot.add(new RandomLoot.Chestplate(true));
loot.add(new RandomLoot.Legging(false));
loot.add(new RandomLoot.Legging(true));
loot.add(new RandomLoot.Boot(false));
loot.add(new RandomLoot.Boot(true));
}
private static void addPotionLoot() {
loot.add(new RandomLoot.Potion());
loot.add(new RandomLoot.SplashPotion());
}
private static void addPlantLoot() {
loot.add(new RandomLoot.Food());
loot.add(new RandomLoot.Seed());
loot.add(new RandomLoot.Crop());
loot.add(new RandomLoot.Saplings());
loot.add(new RandomLoot.Logs());
loot.add(new RandomLoot.Planks());
}
private static void addDyeLoot() {
loot.add(new RandomLoot.Paint());
loot.add(new RandomLoot.Dye());
}
private static void addDecorativeLoot() {
loot.add(new RandomLoot.Slab());
loot.add(new RandomLoot.Stair());
loot.add(new RandomLoot.Fence());
loot.add(new RandomLoot.Glass());
loot.add(new RandomLoot.Stone());
}
private static void addValubleLoot() {
loot.add(new RandomLoot.Dust());
loot.add(new RandomLoot.Block());
loot.add(new RandomLoot.Crate());
loot.add(new RandomLoot.Gem());
loot.add(new RandomLoot.Ingot());
loot.add(new RandomLoot.Ore());
}
private static void addBaubleLoot() {
loot.add(new RandomLoot.Amulet());
loot.add(new RandomLoot.Belt());
loot.add(new RandomLoot.Ring());
}
private static void addMiscLoot() {
loot.add(new RandomLoot.EnchantedBook());
loot.add(new RandomLoot.FishingRod());
loot.add(new RandomLoot.Record());
}
public static RandomLoot getRandomLoot() {
return loot
.get(MathUtil.getRandomIntegerBetween(0, loot.size() - 1));
}
}
|