use of gartham.c10ver.economy.items.utility.foodstuffs.Sandwich 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.Sandwich in project c10ver by Gartham.
the class DailyCrate method open.
@Override
public RewardsOperation open() {
List<ItemBunch<?>> items = new ArrayList<>();
if (Math.random() < 0.05)
items.add(new ItemBunch<>(new Sandwich(), Math.random() < 0.2 ? BigInteger.TWO : BigInteger.ONE));
if (Math.random() < 0.3)
items.add(new ItemBunch<>(new DailyCrate()));
else if (Math.random() < 0.007)
items.add(new ItemBunch<>(new WeeklyCrate()));
BigInteger cloves = BigInteger.valueOf((long) (Math.random() * 250 + 100));
return new RewardsOperation().with(items).with(cloves);
}
use of gartham.c10ver.economy.items.utility.foodstuffs.Sandwich in project c10ver by Gartham.
the class WeeklyCrate method open.
@Override
public RewardsOperation open() {
List<ItemBunch<?>> items = new ArrayList<>();
items.add(new ItemBunch<>(new Sandwich(), BigInteger.valueOf((long) (Math.random() * 4 + 2))));
if (Math.random() > 0.8)
items.add(new ItemBunch<>(new DailyCrate(), BigInteger.valueOf((long) (2 + Math.random() * 2))));
if (Math.random() > 0.4)
items.add(new ItemBunch<>(new Sandwich()));
if (Math.random() > 0.98)
items.add(new ItemBunch<>(new MonthlyCrate(), BigInteger.ONE));
return new RewardsOperation().with(BigInteger.valueOf((long) (350 + Math.random() * 150))).with(items);
}
use of gartham.c10ver.economy.items.utility.foodstuffs.Sandwich in project c10ver by Gartham.
the class ExploreCommand method handle.
private void handle(CommandInvocation inv, boolean safari) {
if (Math.random() < 0.3) {
int rand = (int) (Math.random() * 5);
String msg;
RewardsOperation op;
EconomyUser user = clover.getEconomy().getUser(inv.event.getAuthor().getId());
switch(rand) {
case 0:
var cloves = Utilities.randBIFromMean(32, 15);
msg = inv.event.getAuthor().getAsMention() + ", you found " + Utilities.format(cloves) + " hidden in a bush.";
op = RewardsOperation.build(user, inv.event.getGuild(), cloves);
break;
case 1:
cloves = Utilities.randBIFromMean(75, 15);
msg = inv.event.getAuthor().getAsMention() + ", you found a wallet in the woods with " + Utilities.format(cloves) + " in it.";
op = RewardsOperation.build(user, inv.event.getGuild(), cloves);
break;
case 2:
cloves = Utilities.randBIFromMean(82, 15);
msg = inv.event.getAuthor().getAsMention() + ", you stumble upon a cave with a chest in it full of " + Utilities.format(cloves) + '.';
op = RewardsOperation.build(user, inv.event.getGuild(), cloves);
break;
case 3:
cloves = Utilities.randBIFromMean(64, 15);
msg = inv.event.getAuthor().getAsMention() + ", you stole " + Utilities.format(cloves) + " from an unsuspecting politican's mailbox.";
op = RewardsOperation.build(user, inv.event.getGuild(), cloves);
break;
case 4:
cloves = Utilities.randBIFromMean(73, 15);
msg = inv.event.getAuthor().getAsMention() + ", you purchased a sandwich but used so many coupons that the store paid you " + Utilities.format(cloves) + " back.";
op = RewardsOperation.build(user, inv.event.getGuild(), cloves, new ItemBunch<>(new Sandwich()));
break;
default:
assert false : "Random value not handled by switch.";
msg = null;
op = null;
}
assert msg != null && op != null : "Values were assigned null by switch.";
inv.event.getChannel().sendMessage(msg + "\n\n" + Utilities.listRewards(user.reward(op))).queue();
} else {
}
}
Aggregations