use of gartham.c10ver.economy.items.utility.foodstuffs.Hamburger in project c10ver by Gartham.
the class VoteManager method handleVoteRoleAdded.
public void handleVoteRoleAdded(Member member) {
Instant voteTime = Instant.now();
List<ItemBunch<?>> items = new ArrayList<>();
items.add(new ItemBunch<>(new WeeklyCrate(), Math.random() > 0.5 ? 3 : 2));
if (Math.random() > 0.5)
items.add(new ItemBunch<>(new MonthlyCrate()));
if (Math.random() > 0.95)
items.add(new ItemBunch<>(new DailyCrate(), 50));
items.add(new ItemBunch<>(new NormalCrate(), (long) (Math.random() * 5 + 3)));
items.add(new ItemBunch<>(new Pizza(), (long) (Math.random() * 5 + 3)));
items.add(new ItemBunch<>(new Sandwich(), (long) (Math.random() * 7 + 3)));
items.add(new ItemBunch<>(new Hamburger(), (long) (Math.random() * 2 + 4)));
items.add(new ItemBunch<>(new VoteToken(Type.NORMAL), 5));
Map<AbstractMultiplier, Integer> multipliers = new HashMap<>();
if (Math.random() > 0.2)
multipliers.put(AbstractMultiplier.ofHr(12, BigDecimal.valueOf(2, 1)), 1);
if (Math.random() > 0.3)
multipliers.put(AbstractMultiplier.ofHr(12, BigDecimal.valueOf(3, 1)), 1);
if (Math.random() > 0.5)
multipliers.put(AbstractMultiplier.ofHr(12, BigDecimal.valueOf(5, 1)), 1);
EconomyUser u = clover.getEconomy().getUser(member.getId());
u.incrementVoteCount();
var rec = u.reward(RewardsOperation.build(u, member.getGuild(), BigInteger.valueOf((long) (Math.random() * 3000 + 5000)), multipliers, items));
var s = clover.getEconomy().getServer(member.getGuild().getId());
EmbedBuilder embed = new EmbedBuilder().setAuthor(member.getUser().getAsTag() + " just voted!", null, member.getUser().getEffectiveAvatarUrl()).setDescription(member.getUser().getAsMention() + " just voted and received:\n" + Utilities.listRewards(rec) + "\n\nYou can [vote on top.gg by clicking me](https://top.gg/servers/" + member.getGuild().getId() + "/vote).");
MessageChannel channel = s.getVoteChannel() != null ? member.getGuild().getTextChannelById(s.getVoteChannel()) : member.getUser().openPrivateChannel().complete();
if (u.getSettings().isVoteRemindersEnabled()) {
scheduleReminder(member, s, voteTime);
channel.sendMessageEmbeds(embed.setFooter("----> You currently have vote reminders enabled. Disable them with: ~settings vr false <----").build()).queue();
} else
channel.sendMessageEmbeds(embed.setFooter("You can automatically be reminded when it's time to vote by reacting to this message! (Click the alarm clock.)").build()).queue((Consumer<? super Message>) t -> {
t.addReaction("\u23F0").queue();
clover.getEventHandler().getReactionAdditionProcessor().registerInputConsumer(((MessageReactionInputConsumer<MessageReactionAddEvent>) (event, b, consumer) -> {
if (event.getReactionEmote().isEmoji() && event.getReactionEmote().getEmoji().equals("\u23F0")) {
clover.getEventHandler().getReactionAdditionProcessor().removeInputConsumer(consumer);
channel.sendMessage(member.getAsMention() + " vote reminders are now enabled for you! To turn them off, run the command: `~settings vr false`.").queue();
scheduleReminder(member, s, voteTime);
setVotingRemindersEnabled(u, s.getServerID(), true);
return true;
} else
return false;
}).expires(Instant.now().plusSeconds(180)).filter(member.getUser(), channel));
});
}
use of gartham.c10ver.economy.items.utility.foodstuffs.Hamburger in project c10ver by Gartham.
the class MonthlyCrate method open.
@Override
public RewardsOperation open() {
List<ItemBunch<?>> items = new ArrayList<>();
double rand = Math.random();
items.add(new ItemBunch<>(new Hamburger(), BigInteger.valueOf((long) (rand * 3 + 1))));
if (Math.random() < 0.2)
items.add(new ItemBunch<>(new Pizza()));
if (Math.random() < 0.15)
items.add(new ItemBunch<>(new DailyCrate(), BigInteger.valueOf((long) (Math.random() * 3 + 1))));
if (Math.random() < 0.1)
items.add(new ItemBunch<>(new MonthlyCrate()));
return new RewardsOperation().with(BigInteger.valueOf((long) (Math.random() * 800 + 450))).with(items);
}
Aggregations