use of gartham.c10ver.economy.AbstractMultiplier in project c10ver by Gartham.
the class Dungeon method generateRandomRoom.
public static DungeonRoom generateRandomRoom() {
var rand = Math.random();
if (rand < .7)
return new EmptyRoom();
else if (rand < 0.8) {
List<Creature> creechurrs = new ArrayList<>();
var enemy = new Nymph();
if (Math.random() < 0.3)
creechurrs.add(new Nymph());
GarmonTeam team = new GarmonTeam("Wilderness", new GarmonFighter(enemy));
return new EnemyRoom(team);
} else if (rand < 0.95)
return new LootRoom(new RewardsOperation().setCloves(BigInteger.valueOf((long) (Math.random() * 158 + 32))));
else {
var ro = new RewardsOperation();
ro.getMults().put(generateRandomMultiplier(), 1);
if (Math.random() < .2) {
AbstractMultiplier val = generateRandomMultiplier();
if (ro.getMults().containsKey(val))
ro.getMults().put(val, ro.getMults().get(val) + 1);
}
return new LootRoom(ro);
}
}
use of gartham.c10ver.economy.AbstractMultiplier 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));
});
}
Aggregations