Merge pull request #144 from nossr50/master

Fixed a major problem with my changes to PlayerProfile, however the refresh bug still exists.
This commit is contained in:
Grant 2012-02-09 18:14:24 -08:00
commit 02a728bdea
8 changed files with 20 additions and 19 deletions

View File

@ -69,7 +69,6 @@ public class PlayerProfile
//Time to HashMap this shiz
HashMap<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); //Skills and XP
HashMap<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); //Skills and XP
HashMap<AbilityType, Integer> skillsATS = new HashMap<AbilityType, Integer>(); //Skill ATS
HashMap<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); //Skill ATS
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
@ -77,6 +76,12 @@ public class PlayerProfile
public PlayerProfile(Player player)
{
hud = LoadProperties.defaulthud;
//Setup the HashMap for ability ATS & DATS
for(AbilityType abilityType : AbilityType.values())
{
skillsDATS.put(abilityType, 0);
}
//Setup the HashMap for the skills
for(SkillType skillType : SkillType.values())
{
@ -817,22 +822,17 @@ public class PlayerProfile
{
skills.put(skillType, 0);
}
public int getSkillATS(AbilityType abilityType)
{
return skillsATS.get(abilityType);
}
public void setSkillATS(AbilityType abilityType, int ticks)
{
skillsATS.put(abilityType, (int) System.currentTimeMillis()/1000);
setSkillDATS(abilityType, ticks);
}
public int getSkillDATS(AbilityType abilityType)
{
return skillsDATS.get(abilityType);
}
private void setSkillDATS(AbilityType abilityType, int ticks)
public void setSkillDATS(AbilityType abilityType, long value)
{
skillsDATS.put(abilityType, (int) (System.currentTimeMillis() + (ticks * 1000))/1000);
System.out.println("Storing to DATS: "+value);
int wearsOff = (int) (value * .001D);
System.out.println("After dividing by 1000: "+wearsOff);
skillsDATS.put(abilityType, wearsOff);
System.out.println("Should be the same as the above value: "+skillsDATS.get(abilityType));
}
public void resetCooldowns()
{

View File

@ -60,7 +60,7 @@ public class Axes {
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SkullSplitterPlayer", new Object[] {player.getName()}));
}
PP.setSkillATS(AbilityType.SKULL_SPLIITER, ticks);
PP.setSkillDATS(AbilityType.SKULL_SPLIITER, System.currentTimeMillis()+(ticks*1000));
PP.setSkullSplitterMode(true);
}
if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown)){

View File

@ -69,7 +69,7 @@ public class Excavation
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerPlayer", new Object[] {player.getName()}));
}
PP.setSkillATS(AbilityType.GIGA_DRILL_BREAKER, ticks);
PP.setSkillDATS(AbilityType.GIGA_DRILL_BREAKER, System.currentTimeMillis()+(ticks*1000));
PP.setGigaDrillBreakerMode(true);
}

View File

@ -66,7 +66,7 @@ public class Herbalism
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.GreenTerraPlayer", new Object[] {player.getName()}));
}
PP.setSkillATS(AbilityType.GREEN_TERRA, ticks);
PP.setSkillDATS(AbilityType.GREEN_TERRA, System.currentTimeMillis()+(ticks*1000));
PP.setGreenTerraMode(true);
}

View File

@ -70,7 +70,7 @@ public class Mining
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SuperBreakerPlayer", new Object[] {player.getName()}));
}
PP.setSkillATS(AbilityType.SUPER_BREAKER, ticks);
PP.setSkillDATS(AbilityType.SUPER_BREAKER, System.currentTimeMillis()+(ticks*1000));
PP.setSuperBreakerMode(true);
}

View File

@ -59,7 +59,7 @@ public class Swords
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SerratedStrikesPlayer", new Object[] {player.getName()}));
}
PP.setSkillATS(AbilityType.SERRATED_STRIKES, ticks);
PP.setSkillDATS(AbilityType.SERRATED_STRIKES, System.currentTimeMillis()+(ticks*1000));
PP.setSerratedStrikesMode(true);
}

View File

@ -53,7 +53,8 @@ public class Unarmed {
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()}));
}
PP.setSkillATS(AbilityType.BERSERK, ticks);
PP.setSkillDATS(AbilityType.BERSERK, System.currentTimeMillis()+(ticks*1000));
System.out.println("getSkillDATS(): "+PP.getSkillDATS(AbilityType.BERSERK));
PP.setBerserkMode(true);
}
}

View File

@ -90,7 +90,7 @@ public class WoodCutting
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.TreeFellerPlayer", new Object[] {player.getName()}));
}
PP.setSkillATS(AbilityType.TREE_FELLER, ticks);
PP.setSkillDATS(AbilityType.TREE_FELLER, System.currentTimeMillis()+(ticks*1000));
PP.setTreeFellerMode(true);
}
if(!PP.getTreeFellerMode() && !Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000), LoadProperties.treeFellerCooldown)){