Rename and clean up MapleFamilyEntitlement

This commit is contained in:
P0nk
2021-09-09 21:17:31 +02:00
parent 3370152d58
commit 0c8bef6842
5 changed files with 29 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
package client;
public enum MapleFamilyEntitlement {
public enum FamilyEntitlement {
FAMILY_REUINION(1, 300, "Family Reunion", "[Target] Me\\n[Effect] Teleport directly to the Family member of your choice."),
SUMMON_FAMILY(1, 500, "Summon Family", "[Target] 1 Family member\\n[Effect] Summon a Family member of choice to the map you're in."),
SELF_DROP_1_5(1, 700, "My Drop Rate 1.5x (15 min)", "[Target] Me\\n[Time] 15 min.\\n[Effect] Monster drop rate will be increased #c1.5x#.\\n* If the Drop Rate event is in progress, this will be nullified."),
@@ -12,29 +12,29 @@ public enum MapleFamilyEntitlement {
SELF_EXP_2_30MIN(1, 2500, "My EXP 2x (30 min)", "[Target] Me\\n[Time] 30 min.\\n[Effect] EXP earned from hunting will be increased #c2x#. \\n* If the EXP event is in progress, this will be nullified."),
PARTY_DROP_2_30MIN(1, 4000, "My Party Drop Rate 2x (30 min)", "[Target] My party\\n[Time] 30 min.\\n[Effect] Monster drop rate will be increased #c2x#.\\n* If the Drop Rate event is in progress, this will be nullified."),
PARTY_EXP_2_30MIN(1, 5000, "My Party EXP 2x (30 min)", "[Target] My party\\n[Time] 30 min.\\n[Effect] EXP earned from hunting will be increased #c2x#.\\n* If the EXP event is in progress, this will be nullified.");
private final int usageLimit, repCost;
private final String name, description;
private MapleFamilyEntitlement(int usageLimit, int repCost, String name, String description) {
FamilyEntitlement(int usageLimit, int repCost, String name, String description) {
this.usageLimit = usageLimit;
this.repCost = repCost;
this.name = name;
this.description = description;
}
public int getUsageLimit() {
return usageLimit;
}
public int getRepCost() {
return repCost;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}

View File

@@ -471,7 +471,7 @@ public class MapleFamilyEntry {
return new Pair<>(highestGeneration, juniorCount); //creating new objects to return is a bit inefficient, but cleaner than packing into a long
}
public boolean useEntitlement(MapleFamilyEntitlement entitlement) {
public boolean useEntitlement(FamilyEntitlement entitlement) {
int id = entitlement.ordinal();
if(entitlements[id] >= 1) return false;
try(Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO family_entitlement (entitlementid, charid, timestamp) VALUES (?, ?, ?)")) {
@@ -487,7 +487,7 @@ public class MapleFamilyEntry {
return true;
}
public boolean refundEntitlement(MapleFamilyEntitlement entitlement) {
public boolean refundEntitlement(FamilyEntitlement entitlement) {
int id = entitlement.ordinal();
try(Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("DELETE FROM family_entitlement WHERE entitlementid = ? AND charid = ?")) {
ps.setInt(1, id);
@@ -501,11 +501,11 @@ public class MapleFamilyEntry {
return true;
}
public boolean isEntitlementUsed(MapleFamilyEntitlement entitlement) {
public boolean isEntitlementUsed(FamilyEntitlement entitlement) {
return entitlements[entitlement.ordinal()] >= 1;
}
public int getEntitlementUsageCount(MapleFamilyEntitlement entitlement) {
public int getEntitlementUsageCount(FamilyEntitlement entitlement) {
return entitlements[entitlement.ordinal()];
}
@@ -514,7 +514,7 @@ public class MapleFamilyEntry {
}
public void resetEntitlementUsages() {
for(MapleFamilyEntitlement entitlement : MapleFamilyEntitlement.values()) {
for(FamilyEntitlement entitlement : FamilyEntitlement.values()) {
entitlements[entitlement.ordinal()] = 0;
}
}