more work on end game update

This commit is contained in:
nossr50
2024-01-14 09:43:30 -08:00
parent 9cbe10827f
commit efabaf1466
15 changed files with 99 additions and 118 deletions

View File

@@ -19,7 +19,6 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Set;
import java.util.UUID;
public final class ExperienceAPI {

View File

@@ -2,26 +2,24 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.archery.Archery;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.*;
public class CrossbowsCommand extends SkillCommand {
private boolean canSSG;
private boolean canTrickShot;
private boolean canPoweredShot;
private int bounceCount;
public CrossbowsCommand() {
super(PrimarySkillType.CROSSBOWS);
@@ -34,13 +32,13 @@ public class CrossbowsCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canSSG = RankUtils.hasUnlockedSubskill(player, SubSkillType.CROSSBOWS_SUPER_SHOTGUN)
&& Permissions.superShotgun(player);
// canSSG = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_SUPER_SHOTGUN)
// && Permissions.superShotgun(player);
canTrickShot = RankUtils.hasUnlockedSubskill(player, SubSkillType.CROSSBOWS_TRICK_SHOT)
canTrickShot = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_TRICK_SHOT)
&& Permissions.trickShot(player);
canPoweredShot = RankUtils.hasUnlockedSubskill(player, SubSkillType.CROSSBOWS_POWERED_SHOT)
canPoweredShot = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_POWERED_SHOT)
&& Permissions.poweredShot(player);
}
@@ -53,23 +51,26 @@ public class CrossbowsCommand extends SkillCommand {
return messages;
}
messages.add(ChatColor.DARK_AQUA + "Reminder: " + ChatColor.GOLD + "This is a BETA version of mcMMO, please report any bugs you find!");
messages.add(ChatColor.GOLD + "Crossbows is a " + ChatColor.RED + "WIP" +ChatColor.GOLD + " skill that is still being developed, please leave feedback in our discord!");
if (canPoweredShot) {
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, percent.format(mmoPlayer.getCrossbowsManager().getDamageBonusPercent(player))));
messages.add(getStatMessage(ARCHERY_SKILL_SHOT, percent.format(mmoPlayer.getCrossbowsManager().getDamageBonusPercent(player))));
}
if (canSSG) {
messages.add("Super Shotgun");
//TODO: Implement SSG
}
// if (canSSG) {
// messages.add("Super Shotgun");
// //TODO: Implement SSG
// }
if (canTrickShot) {
messages.add(getStatMessage(SubSkillType.CROSSBOWS_TRICK_SHOT,
messages.add(getStatMessage(CROSSBOWS_TRICK_SHOT,
String.valueOf(mmoPlayer.getCrossbowsManager().getTrickShotMaxBounceCount())));
}
if(Permissions.canUseSubSkill(player, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
if(Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
messages.add(getStatMessage(CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
}
return messages;

View File

@@ -24,6 +24,8 @@ public class HerbalismCommand extends SkillCommand {
private int farmersDietRank;
private String doubleDropChance;
private String doubleDropChanceLucky;
private String tripleDropChance;
private String tripleDropChanceLucky;
private String hylianLuckChance;
private String hylianLuckChanceLucky;
private String shroomThumbChance;
@@ -54,8 +56,8 @@ public class HerbalismCommand extends SkillCommand {
if (canTripleDrop) {
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_VERDANT_BOUNTY);
doubleDropChance = tripleDropStrings[0];
doubleDropChanceLucky = tripleDropStrings[1];
tripleDropChance = tripleDropStrings[0];
tripleDropChanceLucky = tripleDropStrings[1];
}
// FARMERS DIET
@@ -113,11 +115,16 @@ public class HerbalismCommand extends SkillCommand {
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
}
if (canTripleDrop) {
messages.add(getStatMessage(SubSkillType.HERBALISM_VERDANT_BOUNTY, tripleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
}
if (canFarmersDiet) {
messages.add(getStatMessage(false, true, SubSkillType.HERBALISM_FARMERS_DIET, String.valueOf(farmersDietRank)));
}
if (canGreenTerra) {
messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_TERRA, greenTerraLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : ""));

View File

@@ -10,6 +10,7 @@ import com.gmail.nossr50.commands.CommandManager;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@@ -28,14 +29,18 @@ public class PowerLevelCommand extends BaseCommand {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
Player player = bukkitCommandIssuer.getPlayer();
McMMOPlayer mmoPlayer = UserManager.getPlayer(player); //Should never be null at this point because its caught in an ACF validation
if (mmoPlayer == null) {
return;
}
int powerLevel = mmoPlayer.getPowerLevel();
//TODO: impl
mmoPlayer.getPlayer().sendMessage("Your power level is: "+powerLevel); //This is not gonna stay, just to show that the command executes in debug
mmoPlayer.getPlayer().sendMessage(ChatColor.DARK_AQUA + "Your " + ChatColor.GOLD + "[mcMMO]" + ChatColor.DARK_AQUA + " power level is: " + ChatColor.GREEN + powerLevel); //This is not gonna stay, just to show that the command executes in debug
//Send the players a few blank lines to make finding the top of the skill command easier
if (mcMMO.p.getAdvancedConfig().doesSkillCommandSendBlankLines()) {
for (int i = 0; i < 2; i++) {
for (int i = 0; i < 1; i++) {
player.sendMessage("");
}
}

View File

@@ -62,6 +62,12 @@ public abstract class SkillCommand implements TabExecutor {
return true;
}
// Tridents skill is not ready yet
if (skill == PrimarySkillType.TRIDENTS) {
sender.sendMessage(ChatColor.RED + "Tridents will come in a future version!");
return true;
}
if (args.length == 0) {
boolean isLucky = Permissions.lucky(player, skill);
boolean hasEndurance = PerksUtils.handleActivationPerks(player, 0, 0) != 0;

View File

@@ -69,7 +69,6 @@ import org.jetbrains.annotations.NotNull;
import java.util.EnumMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
public class McMMOPlayer implements Identified {

View File

@@ -14,7 +14,10 @@ import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.EnumMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.DelayQueue;
public class PlayerProfile {

View File

@@ -1,40 +0,0 @@
//package com.gmail.nossr50.listeners;
//
//import com.gmail.nossr50.datatypes.player.McMMOPlayer;
//import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
//import com.gmail.nossr50.mcMMO;
//import com.gmail.nossr50.util.player.UserManager;
//import com.gmail.nossr50.util.skills.SkillUtils;
//import org.bukkit.Bukkit;
//import org.bukkit.entity.Player;
//import org.bukkit.event.EventHandler;
//import org.bukkit.event.EventPriority;
//import org.bukkit.event.Listener;
//import org.bukkit.event.player.PlayerCommandPreprocessEvent;
//
//public class CommandListener implements Listener {
//
// private final mcMMO pluginRef;
//
// public CommandListener(mcMMO plugin) {
// this.pluginRef = plugin;
// }
//
// @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
// public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
// Player player = event.getPlayer();
//
// SkillUtils.removeAbilityBoostsFromInventory(player);
//
// McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
//
// if(mmoPlayer == null)
// return;
//
// Bukkit.getServer().getScheduler().runTaskLater(pluginRef, () -> {
// if(mmoPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER) || mmoPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER)) {
// SkillUtils.handleAbilitySpeedIncrease(player);
// }
// }, 5);
// }
//}

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.skills.crossbows;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;

View File

@@ -11,7 +11,6 @@ import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
@@ -21,8 +20,6 @@ import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import static com.gmail.nossr50.util.random.ProbabilityUtil.isStaticSkillRNGSuccessful;
public class CrossbowsManager extends SkillManager {
public CrossbowsManager(McMMOPlayer mmoPlayer) {
super(mmoPlayer, PrimarySkillType.CROSSBOWS);

View File

@@ -166,7 +166,14 @@ public final class Permissions {
* SKILLS
*/
public static boolean skillEnabled(Permissible permissible, PrimarySkillType skill) {return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase(Locale.ENGLISH)); }
public static boolean skillEnabled(Permissible permissible, PrimarySkillType skill) {
// hack to disable tridents for now
if (skill == PrimarySkillType.TRIDENTS)
return false;
return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase(Locale.ENGLISH));
}
public static boolean vanillaXpBoost(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase(Locale.ENGLISH) + ".vanillaxpboost"); }
public static boolean isSubSkillEnabled(Permissible permissible, SubSkillType subSkillType) {
// hack to disable supers that aren't coded yet
@@ -286,6 +293,10 @@ public final class Permissions {
* @return true if the player has permission and has the skill unlocked
*/
public static boolean canUseSubSkill(@NotNull Player player, @NotNull SubSkillType subSkillType) {
// Hack to disable tridents for now
if (subSkillType.getParentSkill() == PrimarySkillType.TRIDENTS)
return false;
return isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
}
}

View File

@@ -84,11 +84,10 @@ public class ProbabilityUtil {
if (player != null) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer != null) {
xPos = mmoPlayer.getSkillLevel(subSkillType.getParentSkill());
} else {
xPos = 0;
if (mmoPlayer == null) {
return Probability.ofPercent(0);
}
xPos = mmoPlayer.getSkillLevel(subSkillType.getParentSkill());
} else {
xPos = 0;
}

View File

@@ -440,7 +440,7 @@ Crossbows.SubSkill.CrossbowsLimitBreak.Description=Breaking your limits. Increas
Crossbows.SubSkill.CrossbowsLimitBreak.Stat=Limit Break Max DMG
Crossbows.SubSkill.TrickShot.Name=Trick Shot
Crossbows.SubSkill.TrickShot.Description=Richochet arrows with steep angles
Crossbows.SubSkill.TrickShot.Stat=Trick Shot Chance
Crossbows.SubSkill.TrickShot.Stat=Trick Shot Max Bounces
Crossbows.SubSkill.TrickShot.Stat.Extra=Trick Shot Max Bounces: &a{0}
Crossbows.SubSkill.TrickShot.Stat.Extra2=Trick Shot Reduced DMG per Bounce: &a{0}
Crossbows.Listener=Crossbows:
@@ -454,7 +454,7 @@ Tridents.Skills.TA.Other.On=&a{0}&2 used Trident &Super!
Tridents.SubSkill.SuperAbility.Name=Tridents Super Ability
Tridents.SubSkill.SuperAbility.Description=N/A
Tridents.SubSkill.SuperAbility.Stat=N/A
Trients.SubSkill.Impale.Name=Impale
Tridents.SubSkill.Impale.Name=Impale
Tridents.SubSkill.Impale.Description=Increases damage done with tridents
Tridents.SubSkill.Impale.Stat=Impale Bonus Damage
Tridents.SubSkill.TridentsLimitBreak.Name=Tridents Limit Break
@@ -1033,6 +1033,13 @@ Guides.Woodcutting.Section.0=&3About Woodcutting:\n&eWoodcutting is all about ch
Guides.Woodcutting.Section.1=&3How does Tree Feller work?\n&eTree Feller is an active ability, you can right-click\n&ewhile holding an ax to activate Tree Feller. This will\n&ecause the entire tree to break instantly, dropping all\n&eof its logs at once.
Guides.Woodcutting.Section.2=&3How does Leaf Blower work?\n&eLeaf Blower is a passive ability that will cause leaf\n&eblocks to break instantly when hit with an axe. By default,\n&ethis ability unlocks at level 100.
Guides.Woodcutting.Section.3=&3How do Double Drops work?\n&eThis passive ability gives you a chance to obtain an extra\n&eblock for every log you chop.
# Crossbows
Guides.Crossbows.Section.0=&3About Crossbows:\n&eCrossbows is all about shooting with your crossbow.\n\n&3XP GAIN:\n&eXP is gained whenever you shoot mobs with a crossbow.
Guides.Crossbows.Section.1=&3How does Trickshot work?\n&eTrickshot is an passive ability, you shoot your bolts at a shallow angle with a crossbow to attempt a Trickshot. This will cause the arrow to ricochet off of blocks and potentially hit a target. The number of potential bounces from a ricochet depend on the rank of Trickshot.
# Tridents
Guides.Tridents.Section.0=&3About Tridents:\n&eTridents skill involves impaling foes with your trident.\n\n&3XP GAIN:\n&eXP is gained whenever you hit mobs with a trident.
#INSPECT
Inspect.Offline= &cYou do not have permission to inspect offline players!
Inspect.OfflineStats=mcMMO Stats for Offline Player &e{0}