mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-03-30 08:16:25 +02:00

General Added Crossbows Skill, this skill is a WIP and feedback on discord is appreciated. Added Tridents Skill, this skill is a WIP and feedback on discord is appreciated. Added the "endgame" triple drop subskill 'Mother Lode' to Mining Added the "endgame" triple drop subskill 'Clean Cuts' to Woodcutting Added the "endgame" triple drop subskill 'Verdant Bounty' to Herbalism Added /mmopower command which simply shows your power level (aliases /mmopowerlevel /powerlevel) Config Added 'Send_To_Console' settings to chat.yml to toggle sending party or admin chat messages to console. Replaced 'Experience_Formula.Modifier' in experience.yml with 'Experience_Formula.Skill_Multiplier' which is easier to understand and less prone to divide by zero bugs. child.yml config is gone now, feel free to delete it. Tweaks Tree Feller now drops 90% less non-wood block rewards (leaves/etc) on average from Knock on Wood. Treasure drop rate from Shake, Fishing, Hylian, and Excavation now benefit from the Luck perk. Updated advanced.yml with entries for the new skills Permission nodes Added 'mcmmo.commands.mmopower' permission node for the new /mmopower command Added 'mcmmo.commands.crossbows' permission node Added 'mcmmo.ability.crossbows.crossbowslimitbreak' permission node Added 'mcmmo.ability.crossbows.trickshot' permission node Added 'mcmmo.ability.herbalism.verdantbounty' permission node Added 'mcmmo.ability.mining.motherlode' permission node Added 'mcmmo.ability.woodcutting.cleancuts' permission node Locale Added locale entries for motherlode, cleancuts, and verdant bounty. Codebase Major rewrite for how random chance was handled in the code. Many skills with RNG elements now send out a SubSkillEvent (which can be used to modify probability or cancel the results), some skills without RNG still send out this event when activated, this event is cancellable so it can be used to make a skill fail. A lot of new unit tests were added to help keep mcMMO stable as part of this update, of course, more could always be added. NOTES: One feature of this update is to provide an endgame benefits to some skills that you can grind for a long time, ideally for a long while. I will likely expand upon this idea in future updates. A few skills have these endgame-oriented subskills, these new subskills provide a small benefit at first that grows and scales up to level 10,000 (or 1,000 for Standard mode which no one uses) and does not have ranks (other than the initial rank to unlock it). These endgame sub skills unlock at level 1000 for users with default mcMMO settings, or 100 for those using the optional Standard scaling. You can tweak the benefits of these skills in advanced.yml, the default settings are meant to be a good starting point. Crossbows and Tridents are WIP skills, I would like feedback on discord about them. More info on the new Triple Drop skills (Mother Lode, Clean Cuts, Verdant Bounty): Currently these start at about 5% chance and can reach a maximum 50% chance if a player acquired 10,000 skill, you can adjust this in advanced.yml These skills respect double drop settings from config.yml just like the corresponding Double Drop skills do, if a double drop is disabled for an item, then it's disabled for triple drops too. I added a new Power Level Command, for now this just shows you your current power level. If I ever add features based on power level, this command will likely display output related to those features. Regarding Maces, I will likely add that as a WIP skill when the next Minecraft update drops.
123 lines
5.0 KiB
Java
123 lines
5.0 KiB
Java
package com.gmail.nossr50.database.flatfile;
|
|
|
|
import com.gmail.nossr50.database.FlatFileDataFlag;
|
|
import com.gmail.nossr50.database.FlatFileDatabaseManager;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import static com.gmail.nossr50.database.FlatFileDatabaseManager.*;
|
|
|
|
public class FlatFileDataUtil {
|
|
|
|
public static @Nullable String[] getPreparedSaveDataLine(@NotNull FlatFileDataContainer dataContainer) {
|
|
if(dataContainer.getDataFlags() == null) {
|
|
return dataContainer.getSplitData();
|
|
}
|
|
|
|
//Data of this type is not salvageable
|
|
//TODO: Test that we ignore the things we are supposed to ignore
|
|
//TODO: Should we even keep track of the bad data or just not even build data containers for it? Making containers for it is only really useful for debugging.. well I suppose operations are typically async so it shouldn't matter
|
|
if(dataContainer.getDataFlags().contains(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE)
|
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.DUPLICATE_UUID) //For now we will not try to fix any issues with UUIDs
|
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.BAD_UUID_DATA) //For now we will not try to fix any issues with UUIDs
|
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.TOO_INCOMPLETE)) {
|
|
return null;
|
|
}
|
|
|
|
String[] splitData;
|
|
|
|
/*
|
|
* First fix the bad data values if they exist
|
|
*/
|
|
if(dataContainer instanceof BadCategorizedFlatFileData badData) {
|
|
splitData = repairBadData(dataContainer.getSplitData(), badData.getBadDataIndexes());
|
|
} else {
|
|
splitData = dataContainer.getSplitData();
|
|
}
|
|
|
|
//Make sure we have as many values as we are supposed to
|
|
assert splitData.length == FlatFileDatabaseManager.DATA_ENTRY_COUNT;
|
|
return splitData;
|
|
}
|
|
|
|
public static @NotNull String[] repairBadData(@NotNull String[] splitData, boolean[] badDataValues) {
|
|
for(int i = 0; i < FlatFileDatabaseManager.DATA_ENTRY_COUNT; i++) {
|
|
if(badDataValues[i]) {
|
|
//This data value was marked as bad so we zero initialize it
|
|
splitData[i] = getZeroInitialisedData(i, 0);
|
|
}
|
|
}
|
|
|
|
return splitData;
|
|
}
|
|
|
|
/**
|
|
* @param index "zero" Initialization will depend on what the index is for
|
|
* @return the "zero" initialized data corresponding to the index
|
|
*/
|
|
public static @NotNull String getZeroInitialisedData(int index, int startingLevel) throws IndexOutOfBoundsException {
|
|
switch(index) {
|
|
case USERNAME_INDEX:
|
|
return LEGACY_INVALID_OLD_USERNAME; //We'll keep using this value for legacy compatibility reasons (not sure if needed but don't care)
|
|
case 2: //Assumption: Used to be for something, no longer used
|
|
case 3: //Assumption: Used to be for something, no longer used
|
|
case 23: //Assumption: Used to be used for something, no longer used
|
|
case 33: //Assumption: Used to be used for something, no longer used
|
|
case LEGACY_LAST_LOGIN:
|
|
case HEALTHBAR:
|
|
return "IGNORED";
|
|
case SKILLS_MINING:
|
|
case SKILLS_REPAIR:
|
|
case SKILLS_UNARMED:
|
|
case SKILLS_HERBALISM:
|
|
case SKILLS_EXCAVATION:
|
|
case SKILLS_ARCHERY:
|
|
case SKILLS_SWORDS:
|
|
case SKILLS_AXES:
|
|
case SKILLS_WOODCUTTING:
|
|
case SKILLS_ACROBATICS:
|
|
case SKILLS_TAMING:
|
|
case SKILLS_FISHING:
|
|
case SKILLS_ALCHEMY:
|
|
case SKILLS_CROSSBOWS:
|
|
case SKILLS_TRIDENTS:
|
|
return String.valueOf(startingLevel);
|
|
case OVERHAUL_LAST_LOGIN:
|
|
return String.valueOf(-1L);
|
|
case COOLDOWN_BERSERK:
|
|
case COOLDOWN_GIGA_DRILL_BREAKER:
|
|
case COOLDOWN_TREE_FELLER:
|
|
case COOLDOWN_GREEN_TERRA:
|
|
case COOLDOWN_SERRATED_STRIKES:
|
|
case COOLDOWN_SKULL_SPLITTER:
|
|
case COOLDOWN_SUPER_BREAKER:
|
|
case COOLDOWN_BLAST_MINING:
|
|
case COOLDOWN_SUPER_SHOTGUN:
|
|
case COOLDOWN_TRIDENTS:
|
|
case COOLDOWN_ARCHERY:
|
|
case SCOREBOARD_TIPS:
|
|
case COOLDOWN_CHIMAERA_WING:
|
|
case EXP_MINING:
|
|
case EXP_WOODCUTTING:
|
|
case EXP_REPAIR:
|
|
case EXP_UNARMED:
|
|
case EXP_HERBALISM:
|
|
case EXP_EXCAVATION:
|
|
case EXP_ARCHERY:
|
|
case EXP_SWORDS:
|
|
case EXP_AXES:
|
|
case EXP_ACROBATICS:
|
|
case EXP_TAMING:
|
|
case EXP_FISHING:
|
|
case EXP_ALCHEMY:
|
|
case EXP_CROSSBOWS:
|
|
case EXP_TRIDENTS:
|
|
return "0";
|
|
case UUID_INDEX:
|
|
throw new IndexOutOfBoundsException(); //TODO: Add UUID recovery? Might not even be worth it.
|
|
}
|
|
|
|
throw new IndexOutOfBoundsException();
|
|
}
|
|
}
|