public void addBonusSetTemplate(BonusSetTemplate bonusSet) { bonusSetTemplates.put(bonusSet.getName(), bonusSet); }
public void processItemAtrributes(CreatureObject creature, SWGObject item, boolean equipping) { // TODO: crit enhancement from crafted weapons // TODO: check for armor category in order to add resistance to certain DoT types Map<String, Object> attributes = new TreeMap<String, Object>(item.getAttributes()); if (equipping) { if (item.getStringAttribute("cat_wpn_damage.wpn_category") != null) creature.addSkillMod("display_only_critical", getWeaponCriticalChance(creature, item)); if (item.getStringAttribute("proc_name") != null) core.buffService.addBuffToCreature( creature, item.getStringAttribute("proc_name").replace("@ui_buff:", ""), creature); for (Entry<String, Object> e : attributes.entrySet()) { if (e.getKey().startsWith("cat_skill_mod_bonus.@stat_n:")) { core.skillModService.addSkillMod( creature, e.getKey().replace("cat_skill_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue())); } if (e.getKey().startsWith("cat_stat_mod_bonus.@stat_n:")) { core.skillModService.addSkillMod( creature, e.getKey().replace("cat_stat_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue())); } if (e.getKey().startsWith("cat_attrib_mod_bonus.attr_health")) { creature.setMaxHealth(creature.getMaxHealth() + Integer.parseInt((String) e.getValue())); } if (e.getKey().startsWith("cat_attrib_mod_bonus.attr_action")) { creature.setMaxAction(creature.getMaxAction() + Integer.parseInt((String) e.getValue())); } } } else { if (item.getStringAttribute("cat_wpn_damage.wpn_category") != null) creature.deductSkillMod("display_only_critical", getWeaponCriticalChance(creature, item)); if (item.getStringAttribute("proc_name") != null) core.buffService.removeBuffFromCreatureByName( creature, item.getStringAttribute("proc_name").replace("@ui_buff:", "")); for (Entry<String, Object> e : attributes.entrySet()) { if (e.getKey().startsWith("cat_skill_mod_bonus.@stat_n:")) { core.skillModService.deductSkillMod( creature, e.getKey().replace("cat_skill_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue())); } if (e.getKey().startsWith("cat_stat_mod_bonus.@stat_n:")) { core.skillModService.deductSkillMod( creature, e.getKey().replace("cat_stat_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue())); } if (e.getKey().startsWith("cat_attrib_mod_bonus.attr_health")) { creature.setMaxHealth(creature.getMaxHealth() - Integer.parseInt((String) e.getValue())); } if (e.getKey().startsWith("cat_attrib_mod_bonus.attr_action")) { creature.setMaxAction(creature.getMaxAction() - Integer.parseInt((String) e.getValue())); } } } calculateArmorProtection(creature, equipping); if (item.getAttachment("setBonus") != null) { BonusSetTemplate bonus = bonusSetTemplates.get((String) item.getAttachment("setBonus")); bonus.callScript(creature); } }