use of delta.games.lotro.common.CharacterClass in project lotro-tools by dmorcellet.
the class TulkasItemsLoader2 method buildItem.
private Item buildItem(Integer id, HashMap<Object, Object> map) {
/*
[1879300219]={
[1]={[1]="Thirteenth Exquisite Captain's Earring of Glittering Caves";[2]="";[3]="";[4]="";};
[2]=85;[3]=136;[4]=5;[5]=1;
[6]={[12]=435;[9]=161;[1]=140;[7]=184;[14]=435;};
[14]=24;
[15]={[1]=
{[1]="Stalwart Captain's Jewelry of Helm's Deep";[2]="";[3]="";[4]="";};
[2]={1879294461,1879295053,1879299996,1879300219};};};
*/
@SuppressWarnings("unchecked") HashMap<Object, Object> map1 = (HashMap<Object, Object>) map.get(Integer.valueOf(1));
// label US
String name = (String) map1.get(Integer.valueOf(1));
WeaponType weaponType = null;
EquipmentLocation loc = null;
// slot
Integer locValue = (Integer) map.get(Integer.valueOf(5));
// 5=armor piece: 12=boots, 11=leggings, 10=gauntlets, 8=cloak, 7=shoulders, 6=Head
if (locValue != null) {
switch(locValue.intValue()) {
// Jewels
case 1:
loc = EquipmentLocation.EAR;
break;
case 2:
loc = EquipmentLocation.NECK;
break;
case 3:
loc = EquipmentLocation.POCKET;
break;
case 4:
loc = EquipmentLocation.WRIST;
break;
case 5:
loc = EquipmentLocation.FINGER;
break;
// Armours
case 6:
loc = EquipmentLocation.HEAD;
break;
case 7:
loc = EquipmentLocation.SHOULDER;
break;
case 8:
loc = EquipmentLocation.BACK;
break;
case 9:
loc = EquipmentLocation.CHEST;
break;
case 10:
loc = EquipmentLocation.HAND;
break;
case 11:
loc = EquipmentLocation.LEGS;
break;
case 12:
loc = EquipmentLocation.FEET;
break;
// Weapons/tools/class items
case 13:
loc = EquipmentLocation.MAIN_HAND;
break;
case 14:
loc = EquipmentLocation.OFF_HAND;
break;
case 15:
loc = EquipmentLocation.RANGED_ITEM;
break;
// Rune-stone
case 16:
{
loc = EquipmentLocation.MAIN_HAND;
weaponType = WeaponType.RUNE_STONE;
}
break;
default:
{
_logger.warn("Unmanaged loc value: " + locValue);
}
}
}
Item ret = null;
if (TulkasConstants.isArmor(loc)) {
Armour a = new Armour();
// 8=armour value
Integer armourValue = (Integer) map.get(Integer.valueOf(8));
if (armourValue != null) {
a.setArmourValue(armourValue.intValue());
} else {
_logger.warn("No armour value!");
}
// 7=armor type: 1=light, 2=medium, 3=heavy
Integer armourTypeInt = (Integer) map.get(Integer.valueOf(7));
ArmourType armourType = null;
if (armourTypeInt != null) {
switch(armourTypeInt.intValue()) {
case 1:
armourType = ArmourType.LIGHT;
break;
case 2:
armourType = ArmourType.MEDIUM;
break;
case 3:
armourType = ArmourType.HEAVY;
break;
default:
{
_logger.warn("Unmanaged armour type : " + armourTypeInt);
}
}
}
armourTypeInt = (Integer) map.get(Integer.valueOf(9));
if (armourTypeInt != null) {
switch(armourTypeInt.intValue()) {
case 14:
armourType = ArmourType.SHIELD;
break;
case 15:
armourType = ArmourType.HEAVY_SHIELD;
break;
case 16:
armourType = ArmourType.WARDEN_SHIELD;
break;
default:
{
_logger.warn("Unmanaged armour type : " + armourTypeInt);
}
}
}
if (loc == EquipmentLocation.BACK) {
armourType = ArmourType.LIGHT;
}
if (armourType == null) {
_logger.warn("Unknown armour type: [" + armourTypeInt + "] (name=" + name + ")");
}
a.setArmourType(armourType);
ret = a;
} else {
Integer weaponTypeInt = (Integer) map.get(Integer.valueOf(9));
if (weaponTypeInt != null) {
switch(weaponTypeInt.intValue()) {
case 1:
weaponType = WeaponType.ONE_HANDED_AXE;
loc = EquipmentLocation.MAIN_HAND;
break;
case 2:
weaponType = WeaponType.TWO_HANDED_AXE;
loc = EquipmentLocation.MAIN_HAND;
break;
case 3:
weaponType = WeaponType.ONE_HANDED_CLUB;
loc = EquipmentLocation.MAIN_HAND;
break;
case 4:
weaponType = WeaponType.TWO_HANDED_CLUB;
loc = EquipmentLocation.MAIN_HAND;
break;
case 5:
weaponType = WeaponType.DAGGER;
loc = EquipmentLocation.MAIN_HAND;
break;
case 6:
weaponType = WeaponType.HALBERD;
loc = EquipmentLocation.MAIN_HAND;
break;
case 7:
weaponType = WeaponType.ONE_HANDED_HAMMER;
loc = EquipmentLocation.MAIN_HAND;
break;
case 8:
weaponType = WeaponType.TWO_HANDED_HAMMER;
loc = EquipmentLocation.MAIN_HAND;
break;
case 9:
weaponType = WeaponType.ONE_HANDED_MACE;
loc = EquipmentLocation.MAIN_HAND;
break;
case 10:
weaponType = WeaponType.SPEAR;
loc = EquipmentLocation.MAIN_HAND;
break;
case 11:
weaponType = WeaponType.STAFF;
loc = EquipmentLocation.MAIN_HAND;
break;
case 12:
weaponType = WeaponType.ONE_HANDED_SWORD;
loc = EquipmentLocation.MAIN_HAND;
break;
case 13:
weaponType = WeaponType.TWO_HANDED_SWORD;
loc = EquipmentLocation.MAIN_HAND;
break;
case 17:
weaponType = WeaponType.BOW;
loc = EquipmentLocation.RANGED_ITEM;
break;
case 18:
weaponType = WeaponType.CROSSBOW;
loc = EquipmentLocation.RANGED_ITEM;
break;
case 19:
weaponType = WeaponType.JAVELIN;
loc = EquipmentLocation.RANGED_ITEM;
break;
// Instrument
case 20:
weaponType = null;
loc = EquipmentLocation.RANGED_ITEM;
break;
// Chisel
case 21:
weaponType = null;
loc = EquipmentLocation.RANGED_ITEM;
break;
// Riffler
case 22:
weaponType = null;
loc = EquipmentLocation.RANGED_ITEM;
break;
default:
_logger.warn("ID=" + id + ": unmanaged weapon type: " + weaponTypeInt.intValue());
}
}
if (weaponType != null) {
// weapon:
Weapon w = new Weapon();
w.setWeaponType(weaponType);
// [10]=Min damage;
Integer minDMG = (Integer) map.get(Integer.valueOf(10));
if (minDMG != null) {
w.setMinDamage(minDMG.intValue());
}
// [11]=Max damage;
Integer maxDMG = (Integer) map.get(Integer.valueOf(11));
if (maxDMG != null) {
w.setMaxDamage(maxDMG.intValue());
}
// [12]=DPS;
Object dpsValue = map.get(Integer.valueOf(12));
if (dpsValue instanceof Float) {
w.setDPS(((Float) dpsValue).floatValue());
} else if (dpsValue instanceof Integer) {
w.setDPS(((Integer) dpsValue).floatValue());
}
// Damage type
DamageType type = null;
Integer damageTypeInt = (Integer) map.get(Integer.valueOf(13));
if (damageTypeInt != null) {
switch(damageTypeInt.intValue()) {
case 1:
type = DamageType.COMMON;
break;
case 2:
type = DamageType.BELERIAND;
break;
case 3:
type = DamageType.WESTERNESSE;
break;
case 4:
type = DamageType.ANCIENT_DWARF;
break;
case 5:
type = DamageType.FIRE;
break;
case 6:
type = DamageType.LIGHT;
break;
case 7:
type = DamageType.LIGHTNING;
break;
case 8:
type = DamageType.FROST;
break;
}
}
if (type == null) {
type = DamageType.COMMON;
_logger.warn("Unmanaged damage type [" + damageTypeInt + "]");
}
w.setDamageType(type);
ret = w;
}
if (ret == null) {
ret = new Item();
}
}
// Name
ret.setName(name);
// Slot
ret.setEquipmentLocation(loc);
// Required level
Integer requiredLevel = (Integer) map.get(Integer.valueOf(2));
if ((requiredLevel != null) && (requiredLevel.intValue() > 0)) {
ret.setMinLevel(requiredLevel);
}
// Item level
Integer itemLevel = (Integer) map.get(Integer.valueOf(3));
if ((itemLevel != null) && (itemLevel.intValue() > 0)) {
ret.setItemLevel(itemLevel);
}
// Class
CharacterClass cClass = null;
Integer classInt = (Integer) map.get(Integer.valueOf(14));
if (classInt != null) {
switch(classInt.intValue()) {
case 40:
cClass = CharacterClass.BURGLAR;
break;
case 24:
cClass = CharacterClass.CAPTAIN;
break;
case 172:
cClass = CharacterClass.CHAMPION;
break;
case 23:
cClass = CharacterClass.GUARDIAN;
break;
case 162:
cClass = CharacterClass.HUNTER;
break;
case 185:
cClass = CharacterClass.LORE_MASTER;
break;
case 31:
cClass = CharacterClass.MINSTREL;
break;
case 193:
cClass = CharacterClass.RUNE_KEEPER;
break;
case 194:
cClass = CharacterClass.WARDEN;
break;
default:
{
_logger.warn("Unmanaged class [" + classInt + "]");
}
}
}
if (cClass != null) {
ret.setRequiredClass(cClass);
}
// Quality
ItemQuality quality = ItemQuality.COMMON;
Integer qualityInt = (Integer) map.get(Integer.valueOf(4));
if (qualityInt != null) {
switch(qualityInt.intValue()) {
case 1:
quality = ItemQuality.COMMON;
break;
case 2:
quality = ItemQuality.UNCOMMON;
break;
case 3:
quality = ItemQuality.RARE;
break;
case 4:
quality = ItemQuality.INCOMPARABLE;
break;
case 5:
quality = ItemQuality.LEGENDARY;
break;
default:
{
_logger.warn("ID: " + id + ": unmanaged quality [" + qualityInt + "]");
}
}
} else {
_logger.warn("ID: " + id + ": no quality!");
}
ret.setQuality(quality);
// Bonus
@SuppressWarnings("unchecked") HashMap<Integer, Object> bonuses = (HashMap<Integer, Object>) map.get(Integer.valueOf(6));
if (bonuses != null) {
BasicStatsSet stats = ret.getStats();
List<Integer> keys = new ArrayList<Integer>(bonuses.keySet());
Collections.sort(keys);
for (Integer key : keys) {
int index = key.intValue();
if ((index >= 0) && (index < TulkasConstants.BONUS_NAMES.length)) {
String bonusName = TulkasConstants.BONUS_NAMES[index];
Object bonusValue = bonuses.get(key);
STAT stat = TulkasConstants.STATS[index];
if (stat != null) {
FixedDecimalsInteger value = TulkasValuesUtils.fromObjectValue(bonusValue);
stats.setStat(stat, value);
} else {
_logger.warn("No stat associated to bonus: " + bonusName);
/*
BonusType type=BonusType.getByName(bonusName);
Bonus bonus=new Bonus(type,BONUS_OCCURRENCE.ALWAYS);
Object value=type.buildValue(bonusValue);
bonus.setValue(value);
bonusMgr.add(bonus);
ret.getBonus().add(bonusName+" : "+bonuses.get(key));
*/
}
bonuses.remove(key);
} else {
_logger.warn("Unmanaged index: " + index);
}
}
if (bonuses.size() > 0) {
_logger.warn("Unmanaged bonuses: " + bonuses);
}
}
return ret;
}
use of delta.games.lotro.common.CharacterClass in project lotro-tools by dmorcellet.
the class LotroWikiDeedPageParser method handleCategories.
private void handleCategories(DeedDescription deed, String deedType, String deedSubType, String regionalSub) {
DeedType type = null;
String category = null;
// Fixes
if ("Halls of Crafting".equals(deedSubType))
deedType = "Instances";
if ("Instance".equals(deedType))
deedType = "Instances";
if ("the Wastes".equals(deedSubType))
deedSubType = "The Wastes";
if ("meta".equals(deedType))
deedType = "Meta";
if ("quest".equals(deedType))
deedType = "Quest";
if ("Racial".equals(deedType))
deedType = "Race";
if ("Tower of Orthanc".equals(regionalSub))
regionalSub = "The Tower of Orthanc";
if ("The Tower of Orthanc".equals(regionalSub))
deedType = "Instances";
if ("Skirmish".equals(deedSubType)) {
deedType = "Skirmish";
deedSubType = "";
}
// Class deeds
CharacterClass requiredClass = null;
if ("Class".equals(deedType)) {
type = DeedType.CLASS;
category = deedSubType;
requiredClass = extractClass(category);
}
// Type
if ("Slayer".equals(regionalSub))
type = DeedType.SLAYER;
else if ("Explorer".equals(regionalSub))
type = DeedType.EXPLORER;
else if ("Lore".equals(regionalSub))
type = DeedType.LORE;
else if ("Quest".equals(regionalSub))
type = DeedType.QUEST;
else if ("Event".equals(regionalSub))
type = DeedType.EVENT;
else if ("Reputation".equals(regionalSub))
type = DeedType.REPUTATION;
else if ("Meta".equals(regionalSub))
type = null;
if ("Exploration".equals(deedType))
type = DeedType.EXPLORER;
else if ("Slayer".equals(deedType))
type = DeedType.SLAYER;
else if ("Race".equals(deedType))
category = "Racial";
else if ("Lore".equals(deedType))
type = DeedType.LORE;
else if ("Epic".equals(deedType))
category = "Epic";
else if ("Skirmish".equals(deedType))
category = "Skirmish";
else if ("Skirmish Instances".equals(deedType))
category = "Skirmish";
else if ("Summer Festival".equals(deedType))
category = "Event:Summer Festival";
else if ("Hidden".equals(deedType))
category = "Hidden";
if ("Epic".equals(deedSubType))
category = "Epic";
else if ("Event".equals(deedSubType))
type = DeedType.EVENT;
else if ("LOTRO Anniversary".equals(deedSubType)) {
category = "Event:LOTRO Anniversary";
deedType = "";
}
if ("Regional".equals(deedType)) {
if ((deedSubType != null) && (deedSubType.length() > 0)) {
category = "Region:" + deedSubType;
}
} else if (("Meta".equals(deedType)) || ("Slayer".equals(deedType)) || ("Social".equals(deedType)) || ("Quest".equals(deedType)) || ("Quest".equals(deedType))) {
// Special
if ("Host of the West (Faction)".equals(deedSubType))
deedSubType = "The Wastes";
category = getPrefixForZone(deedSubType);
if (category != null) {
category = category + ":" + deedSubType;
}
if ("Western Gondor City Watch".equals(deedSubType)) {
type = DeedType.QUEST;
category = "Region:Dol Amroth:City Watch";
}
} else if ("Instances".equals(deedType)) {
category = "Instances:" + deedSubType;
} else if ("Hobby".equals(deedType)) {
type = DeedType.HOBBY;
category = regionalSub;
} else if ("Gorgoroth Meta".equals(deedType)) {
type = null;
category = "Region:Gorgoroth";
}
if ((("".equals(deedType)) && ("Reputation".equals(regionalSub))) || ("Reputation".equals(deedType))) {
type = DeedType.REPUTATION;
}
if ((type != null) || (category != null)) {
deed.setType(type);
deed.setCategory(category);
}
deed.setRequiredClass(requiredClass);
}
use of delta.games.lotro.common.CharacterClass in project lotro-companion by dmorcellet.
the class DeedFilterController method setFilter.
private void setFilter() {
// Name
DeedNameFilter nameFilter = _filter.getNameFilter();
String contains = nameFilter.getPattern();
if (contains != null) {
_contains.setText(contains);
}
// Type
DeedTypeFilter typeFilter = _filter.getTypeFilter();
DeedType type = typeFilter.getDeedType();
_type.selectItem(type);
// Category
DeedCategoryFilter categoryFilter = _filter.getCategoryFilter();
String category = categoryFilter.getDeedCategory();
_category.selectItem(category);
// Requirements:
// - class
DeedClassRequirementFilter classFilter = _filter.getClassFilter();
CharacterClass requiredClass = classFilter.getCharacterClass();
_class.selectItem(requiredClass);
// - race
DeedRaceRequirementFilter raceFilter = _filter.getRaceFilter();
Race requiredRace = raceFilter.getRace();
_race.selectItem(requiredRace);
// Rewards:
// Reputation
ReputationRewardFilter factionFilter = _filter.getReputationFilter();
Faction faction = factionFilter.getFaction();
_reputation.selectItem(faction);
// LOTRO points
LotroPointsRewardFilter lotroPointsFilter = _filter.getLotroPointsFilter();
Boolean lotroPoints = lotroPointsFilter.getHasLotroPointsFlag();
_lotroPoints.selectItem(lotroPoints);
// Class point
ClassPointRewardFilter classPointFilter = _filter.getClassPointsFilter();
Boolean classPoint = classPointFilter.getHasClassPointFlag();
_classPoints.selectItem(classPoint);
// Trait
TraitRewardFilter traitFilter = _filter.getTraitFilter();
String trait = traitFilter.getTrait();
_trait.selectItem(trait);
// Skill
SkillRewardFilter skillFilter = _filter.getSkillFilter();
String skill = skillFilter.getSkill();
_skill.selectItem(skill);
// Title
TitleRewardFilter titleFilter = _filter.getTitleFilter();
String title = titleFilter.getTitle();
_title.selectItem(title);
// Virtue
VirtueRewardFilter virtueFilter = _filter.getVirtueFilter();
VirtueId virtueId = virtueFilter.getVirtueId();
_virtue.selectItem(virtueId);
// Emote
EmoteRewardFilter emoteFilter = _filter.getEmoteFilter();
String emote = emoteFilter.getEmote();
_emote.selectItem(emote);
// Item
ItemRewardFilter itemFilter = _filter.getItemFilter();
Integer itemId = itemFilter.getItemId();
_item.selectItem(itemId);
}
use of delta.games.lotro.common.CharacterClass in project lotro-companion by dmorcellet.
the class DeedFilterController method buildCharacterClassCombobox.
private ComboBoxController<CharacterClass> buildCharacterClassCombobox() {
ComboBoxController<CharacterClass> combo = CharacterUiUtils.buildClassCombo(true);
ItemSelectionListener<CharacterClass> listener = new ItemSelectionListener<CharacterClass>() {
@Override
public void itemSelected(CharacterClass requiredClass) {
DeedClassRequirementFilter filter = _filter.getClassFilter();
filter.setCharacterClass(requiredClass);
filterUpdated();
}
};
combo.addListener(listener);
return combo;
}
use of delta.games.lotro.common.CharacterClass in project lotro-companion by dmorcellet.
the class DeedDisplayPanelController method buildRequirementString.
/**
* Build a requirement string.
* @return A string, empty if no requirement.
*/
private String buildRequirementString() {
CharacterClass requiredClass = _deed.getRequiredClass();
Race requiredRace = _deed.getRequiredRace();
Integer minLevel = _deed.getMinLevel();
StringBuilder sb = new StringBuilder();
if (requiredClass != null) {
if (sb.length() > 0)
sb.append(", ");
sb.append(requiredClass.getLabel());
}
if (requiredRace != null) {
if (sb.length() > 0)
sb.append(", ");
sb.append(requiredRace.getLabel());
}
if (minLevel != null) {
if (sb.length() > 0)
sb.append(", ");
if (minLevel.intValue() == 1000) {
sb.append("level cap");
} else {
sb.append("level>=").append(minLevel);
}
}
String ret = sb.toString();
if (ret.isEmpty()) {
ret = "-";
}
return ret;
}
Aggregations