Items - Profession restrictions

This commit is contained in:
Ziggeh
2013-12-24 00:23:17 +01:00
parent 9b87d4b91c
commit b26374faf7
4 changed files with 53 additions and 9 deletions
+3
View File
@@ -4,6 +4,9 @@ def setup():
return
def run(core, actor, target, commandString):
if core.equipmentService.canEquip(actor, target) is False:
return
parsedMsg = commandString.split(' ', 3)
objService = core.objectService
containerID = long(parsedMsg[1])
+3
View File
@@ -4,6 +4,9 @@ def setup():
return
def run(core, actor, target, commandString):
if core.equipmentService.canEquip(actor, target) is False:
return
parsedMsg = commandString.split(' ', 3)
objService = core.objectService
containerID = long(parsedMsg[1])
+3
View File
@@ -4,6 +4,9 @@ def setup():
return
def run(core, actor, target, commandString):
if core.equipmentService.canEquip(actor, target) is False:
return
parsedMsg = commandString.split(' ', 3)
objService = core.objectService
containerID = long(parsedMsg[1])
+44 -9
View File
@@ -33,6 +33,7 @@ import main.NGECore;
import engine.resources.objects.SWGObject;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
import resources.objects.player.PlayerObject;
public class EquipmentService implements INetworkDispatch {
@@ -88,11 +89,42 @@ public class EquipmentService implements INetworkDispatch {
}
}
public String getFormalProfessionName(String stfName) {
String formalName = "";
switch (stfName) {
case "force_sensitive_1a": formalName = "Jedi"; break;
case "bounty_hunter_1a": formalName = "Bounty Hunter"; break;
case "officer_1a": formalName = "Officer"; break;
case "smuggler_1a": formalName = "Smuggler"; break;
case "entertainer_1a": formalName = "Entertainer"; break;
case "spy_1a": formalName = "Spy"; break;
case "medic_1a": formalName = "Medic"; break;
case "commando_1a": formalName = "Commando"; break;
default: formalName = "Trader"; break; // Ziggy: Trader profession names are a bit irregular, so this is used.
}
return formalName;
}
public boolean canEquip(CreatureObject actor, SWGObject item) {
boolean result = true;
if (item.getStringAttribute("class_required") != null) {
String profession = ((PlayerObject) actor.getSlottedObject("ghost")).getProfession();
if (item.getStringAttribute("class_required").contentEquals(getFormalProfessionName(profession))) {
result = true;
} else{
return false;
}
}
return result;
}
public void equip(CreatureObject actor, SWGObject item) {
//if(replacedItem != null)
// unequip(actor, replacedItem);
String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff"));
String serverTemplate = template.replace(".iff", "");
PyObject func = core.scriptService.getMethod("scripts/" + serverTemplate.split("shared_" , 2)[0].replace("shared_", ""), serverTemplate.split("shared_" , 2)[1], "equip");
@@ -100,14 +132,18 @@ public class EquipmentService implements INetworkDispatch {
func.__call__(Py.java2py(core), Py.java2py(actor), Py.java2py(item));
// TODO: add health/action bonus from crafted weapon with augmentations (also seen with cybernetics)
// TODO: faction restrictions
// TODO: Species restrictions?
// TODO: Gender restrictions?
// TODO: faction restrictions - You had to be a Combatant as minimum in order to EQUIP an item.
// TODO: Species restrictions
// TODO: Gender restrictions
// TODO: crit enhancement from crafted weapons
// TODO: Jedi robes Force Protection Intensity
// TODO: check for armor category in order to add resistance to certain DoT types
// TODO: if weapon, add the weapon specific crit to display_only_critical
// TODO: bio-link
// TODO: Calculate actual armor values (REMINDER: Check if the player is wearing a jedi robe/cloak (look for force protection intensity). If they are, they shouldn't receive any additional protection from other items with armour.)
// TODO: bio-link (assign it by objectID with setAttachment and then just display it as a character name).
// TODO: item level requirement. if actorLevel >= itemLevel
// TODO: refactor equipable items that grant buffs. use setAttachment("itemBuff", "buffname") - example: object.setAttachment("itemBuff", "fs_buff_def_1_1")
// if(item.getAttachment("itemBuff") != null )
// core.buffService.addBuffToCreature(actor, item.getAttachment("itemBuff"));
if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true)
weaponCriticalToDisplay(actor, item, true);
@@ -115,7 +151,6 @@ public class EquipmentService implements INetworkDispatch {
Map<String, Object> attributes = new TreeMap<String, Object>(item.getAttributes());
for(Entry<String, Object> e : attributes.entrySet()) {
if(e.getKey().startsWith("cat_skill_mod_bonus.@stat_n:")) {
core.skillModService.addSkillMod(actor, e.getKey().replace("cat_skill_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue()));
}