-
Notifications
You must be signed in to change notification settings - Fork 0
/
vorago.go
148 lines (133 loc) · 3.04 KB
/
vorago.go
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
package simulations
import (
"math/rand"
"github.com/bwmarrin/discordgo"
)
var (
voragoUrl = "https://runescape.wiki/images/Vorago.png?3a75c"
voragoTables = dropTables{
commonDroptable: []Drop{
{
Name: "Grimy torstol",
AmountRange: [2]int{15, 29},
},
{
Name: "Grapevine seed",
AmountRange: [2]int{10, 36},
},
{
Name: "Raw rocktail",
AmountRange: [2]int{75, 159},
},
{
Name: "Huge plated rune salvage",
AmountRange: [2]int{3, 9},
},
{
Name: "Torstol seed",
AmountRange: [2]int{4, 10},
},
{
Name: "Banite stone spirit",
AmountRange: [2]int{15, 25},
},
{
Name: "Black dragonhide",
AmountRange: [2]int{35, 79},
},
{
Name: "Onyx bolts (e)",
AmountRange: [2]int{20, 55},
},
{
Name: "Magic logs",
AmountRange: [2]int{35, 128},
},
{
Name: "Hydrix bolt tips",
Amount: 50,
},
{
Name: "Crystal triskelion fragment 1",
Amount: 1,
Untradeable: true,
},
{
Name: "Crystal triskelion fragment 2",
Amount: 1,
Untradeable: true,
}, {
Name: "Crystal triskelion fragment 3",
Amount: 1,
Untradeable: true,
},
},
uniqueDroptable: []Drop{
{
Name: "Seismic wand",
Rate: 1.0 / 400.0,
Bold: true,
},
{
Name: "Seismic singularity",
Rate: 1.0 / 400.0,
Bold: true,
},
},
extra: Drop{
Name: "Tectonic energy",
Rate: 4.0 / 5.0,
Bold: true,
Amount: 2,
},
}
)
var VoragoCommand = &discordgo.ApplicationCommand{
Name: "vorago",
Description: "Simulate a Vorago team drop. This simulates all 5 piles.",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionInteger,
Name: "amount",
Description: "Amount of kills",
Required: false,
},
},
}
func Vorago(s *discordgo.Session, i *discordgo.InteractionCreate) {
simulateDrop(s, i, simulateDropVorago, voragoTables, voragoUrl, VoragoCommand.Name, "Vorago")
}
func simulateDropVorago(amount int64, tables dropTables, i *discordgo.InteractionCreate) map[string]*Drop {
var drops map[string]*Drop = make(map[string]*Drop)
for i := int64(0); i < amount; i++ {
var sum float64 = 0
for _, d := range tables.uniqueDroptable {
sum += d.Rate
}
rareDropped := false
// Vorago has 5 drop piles
for j := 0; j < 5; j++ {
var drop Drop
// Make copy so we don't adjust orig value
cd := tables.commonDroptable
roll := rand.Float64()
energy := tables.extra.(Drop)
// Roll for energy
if roll < energy.Rate {
// Make a copy so that we don't adjust the previous one
energy.setAmount()
addDropValueToMap(drops, energy)
}
roll = rand.Float64()
if roll < sum && !rareDropped {
drop = determineDropWithRates(rand.Float64(), tables.uniqueDroptable)
rareDropped = true
} else {
drop = cd[rand.Intn(len(cd))]
}
drop.setAmount()
addDropValueToMap(drops, drop)
}
}
return drops
}