Exemplo n.º 1
0
  public void equip(CreatureObject actor, SWGObject item) {
    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");
    if (func != null) func.__call__(Py.java2py(core), Py.java2py(actor), Py.java2py(item));

    // TODO: bio-link (assign it by objectID with setAttachment and then just display the customName
    // for that objectID).

    if (!actor.getEquipmentList().contains(item)) {
      actor.addObjectToEquipList(item);
      processItemAtrributes(actor, item, true);
    }
  }
Exemplo n.º 2
0
  public void unequip(CreatureObject actor, SWGObject item) {
    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],
            "unequip");
    if (func != null) func.__call__(Py.java2py(core), Py.java2py(actor), Py.java2py(item));

    if (actor.getEquipmentList().contains(item)) {
      actor.removeObjectFromEquipList(item);
      processItemAtrributes(actor, item, false);
    }
  }