Fixes for Skill level desc.

Fix for level staying same across skill changes.
Removed logging statements in ClientClass
This commit is contained in:
Jonathan Williams 2014-03-29 02:49:57 -04:00
parent f4e8879d55
commit b7857ef20c
3 changed files with 9 additions and 36 deletions

View File

@ -135,8 +135,6 @@ public class ClientClass
{ {
_savingCustomBuild.PlayerName = _client.GetPlayerName(); _savingCustomBuild.PlayerName = _client.GetPlayerName();
System.out.println("Custom build saving: ");
_savingCustomBuild.printInfo();
_classFactory.GetRepository().SaveCustomBuild(_savingCustomBuild); _classFactory.GetRepository().SaveCustomBuild(_savingCustomBuild);
_savingCustomBuild = null; _savingCustomBuild = null;
} }
@ -331,21 +329,8 @@ public class ClientClass
AddSkill(cur, _gameClass.GetDefaultSkills().get(cur)); AddSkill(cur, _gameClass.GetDefaultSkills().get(cur));
} }
System.out.println("Adding back skills");
for (Entry<ISkill, Integer> skill : _lastSkillMap.values()) for (Entry<ISkill, Integer> skill : _lastSkillMap.values())
{ {
if (skill == null)
System.out.println("Skill is null in ClientClass.ClearSkills()");
if (skill.getKey() == null)
System.out.println("Skill key is null in ClientClass.ClearSkills()");
if (skill.getValue() == null)
System.out.println("Skill value is null in ClientClass.ClearSkills()");
System.out.println("Key : " + skill.getKey());
System.out.println("Value : " + skill.getValue());
AddSkill(skill.getKey(), skill.getValue()); AddSkill(skill.getKey(), skill.getValue());
} }
} }
@ -356,18 +341,7 @@ public class ClientClass
{ {
for (ISkill skill : _skillMap.values()) for (ISkill skill : _skillMap.values())
{ {
if (skill == null) skill.RemoveUser(_client.GetPlayer());
{
System.out.println("Skill is null in ClientClass.ClearSkills()");
}
else if (_client == null)
{
System.out.println("Client is null in ClientClass.ClearSkills()");
}
else
{
skill.RemoveUser(_client.GetPlayer());
}
} }
} }

View File

@ -136,9 +136,6 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
clientClass.EquipCustomBuild(customBuild, false); clientClass.EquipCustomBuild(customBuild, false);
clientClass.SetSavingCustomBuild(_pvpClass, customBuild); clientClass.SetSavingCustomBuild(_pvpClass, customBuild);
System.out.println("Custom build editing: ");
customBuild.printInfo();
Shop.OpenPageForPlayer(Player, new SkillPage(Plugin, Shop, ClientManager, DonationManager, Player, _pvpClass)); Shop.OpenPageForPlayer(Player, new SkillPage(Plugin, Shop, ClientManager, DonationManager, Player, _pvpClass));
} }

View File

@ -130,30 +130,32 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
List<String> skillLore = new ArrayList<String>(); List<String> skillLore = new ArrayList<String>();
boolean locked = isSkillLocked(skill.GetSalesPackageId(), skill); boolean locked = isSkillLocked(skill.GetSalesPackageId(), skill);
Material material = locked ? Material.EMERALD : (clientClass.GetSavingCustomBuild().hasSkill(skill) ? Material.WRITTEN_BOOK : Material.BOOK);
boolean hasSkill = clientClass.GetSavingCustomBuild().hasSkill(skill);
int level = hasSkill ? clientClass.GetSavingCustomBuild().getLevel(skill) : 1;
String name = (locked ? ChatColor.RED + skill.GetName() + " (Locked)" : skill.GetName() + " Lvl " + level);
System.out.println(name);
if (locked) if (locked)
{ {
skillLore.add(C.cYellow + skill.GetCost() + " Gems"); skillLore.add(C.cYellow + skill.GetCost() + " Gems");
skillLore.add(C.cBlack); skillLore.add(C.cBlack);
} }
skillLore.addAll(java.util.Arrays.asList(skill.GetDesc(0))); skillLore.addAll(java.util.Arrays.asList(skill.GetDesc(level)));
for (int i = 0; i < skillLore.size(); i++) for (int i = 0; i < skillLore.size(); i++)
{ {
skillLore.set(i, C.cGray + skillLore.get(i)); skillLore.set(i, C.cGray + skillLore.get(i));
} }
Material material = locked ? Material.EMERALD : (clientClass.GetSavingCustomBuild().hasSkill(skill) ? Material.WRITTEN_BOOK : Material.BOOK);
int level = clientClass.GetSavingCustomBuild().hasSkill(skill) ? clientClass.GetSavingCustomBuild().getLevel(skill) : 1;
String name = (locked ? ChatColor.RED + skill.GetName() + " (Locked)" : skill.GetName() + " Lvl " + level);
ShopItem skillItem = new ShopItem(material, name, skillLore.toArray(new String[skillLore.size()]), level, locked, true); ShopItem skillItem = new ShopItem(material, name, skillLore.toArray(new String[skillLore.size()]), level, locked, true);
if (locked) if (locked)
AddButton(slotNumber, skillItem, new PurchaseSkillButton(this, skill)); AddButton(slotNumber, skillItem, new PurchaseSkillButton(this, skill));
else else
AddButton(slotNumber, skillItem, new SelectSkillButton(this, skill, Math.min(clientClass.GetSavingCustomBuild().getLevel(skill) + 1, skill.getMaxLevel()))); AddButton(slotNumber, skillItem, new SelectSkillButton(this, skill, Math.min((hasSkill ? level + 1 : level), skill.getMaxLevel())));
} }
/* /*