Levels now start at 1 (configurable advanced.yml)

This commit is contained in:
nossr50 2019-01-18 13:10:45 -08:00
parent 9ae58fd2f7
commit 43da10a855
6 changed files with 39 additions and 28 deletions

View File

@ -63,6 +63,7 @@ Version 2.1.0
+ (Party) Parties can now have size limits (configurable in config.yml), party size is unlimited by default
! (Deaths) Fixed the bug where mob names would be replaced by hearts
! (Experience) The XP values of fish are now based on their rarity and have been drastically changed
! (Experience) Skills now start at level 1 (configurable in advanced.yml)
! (Item) Improved some of the messages sent to the player regarding the Chimaera Wing
! (Party) Party member list will only include members of the party that you can see (aren't vanished)
! (Skills) Some skill level rank requirements have changed

View File

@ -675,6 +675,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
protected void loadKeys() {}
/* GENERAL */
public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 1); }
public int getAbilityLengthStandard() { return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5); }
public int getAbilityLengthRetro() { return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50); }
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.database;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.database.DatabaseType;
@ -385,22 +386,24 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
// Open the file to write the player
out = new BufferedWriter(new FileWriter(mcMMO.getUsersFilePath(), true));
String startingLevel = AdvancedConfig.getInstance().getStartingLevel() + ":";
// Add the player to the end
out.append(playerName).append(":");
out.append("0:"); // Mining
out.append(startingLevel); // Mining
out.append(":");
out.append(":");
out.append("0:"); // Xp
out.append("0:"); // Woodcutting
out.append(startingLevel); // Woodcutting
out.append("0:"); // WoodCuttingXp
out.append("0:"); // Repair
out.append("0:"); // Unarmed
out.append("0:"); // Herbalism
out.append("0:"); // Excavation
out.append("0:"); // Archery
out.append("0:"); // Swords
out.append("0:"); // Axes
out.append("0:"); // Acrobatics
out.append(startingLevel); // Repair
out.append(startingLevel); // Unarmed
out.append(startingLevel); // Herbalism
out.append(startingLevel); // Excavation
out.append(startingLevel); // Archery
out.append(startingLevel); // Swords
out.append(startingLevel); // Axes
out.append(startingLevel); // Acrobatics
out.append("0:"); // RepairXp
out.append("0:"); // UnarmedXp
out.append("0:"); // HerbalismXp
@ -410,7 +413,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
out.append("0:"); // AxesXp
out.append("0:"); // AcrobaticsXp
out.append(":");
out.append("0:"); // Taming
out.append(startingLevel); // Taming
out.append("0:"); // TamingXp
out.append("0:"); // DATS
out.append("0:"); // DATS
@ -420,12 +423,12 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
out.append("0:"); // DATS
out.append("0:"); // DATS
out.append(":");
out.append("0:"); // Fishing
out.append(startingLevel); // Fishing
out.append("0:"); // FishingXp
out.append("0:"); // Blast Mining
out.append(String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)).append(":"); // LastLogin
out.append(Config.getInstance().getMobHealthbarDefault().toString()).append(":"); // Mob Healthbar HUD
out.append("0:"); // Alchemy
out.append(startingLevel); // Alchemy
out.append("0:"); // AlchemyXp
out.append(uuid != null ? uuid.toString() : "NULL").append(":"); // UUID
out.append("0:"); // Scoreboard tips shown

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.database;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.database.DatabaseType;
import com.gmail.nossr50.datatypes.database.PlayerStat;
@ -839,23 +841,25 @@ public final class SQLDatabaseManager implements DatabaseManager {
statement.setString(2, tablePrefix + "skills");
resultSet = statement.executeQuery();
if (!resultSet.next()) {
String startingLevel = "'" + AdvancedConfig.getInstance().getStartingLevel() + "'";
String totalLevel = "'" + (AdvancedConfig.getInstance().getStartingLevel() * (PrimarySkillType.values().length - PrimarySkillType.CHILD_SKILLS.size())) + "'";
createStatement = connection.createStatement();
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` ("
+ "`user_id` int(10) unsigned NOT NULL,"
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`fishing` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`total` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`taming` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`mining` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`repair` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`excavation` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`archery` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`swords` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`axes` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`fishing` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
+ "`total` int(10) unsigned NOT NULL DEFAULT "+totalLevel+","
+ "PRIMARY KEY (`user_id`)) "
+ "DEFAULT CHARSET=latin1;");
tryClose(createStatement);

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.datatypes.player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.MobHealthbarType;
@ -56,7 +57,7 @@ public class PlayerProfile {
}
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
skills.put(primarySkillType, 0);
skills.put(primarySkillType, AdvancedConfig.getInstance().getStartingLevel());
skillsXp.put(primarySkillType, 0F);
}

View File

@ -74,6 +74,7 @@ Feedback:
SendCopyOfMessageToChat: true
Skills:
General:
StartingLevel: 1
Ability:
Length:
Standard: