/**
   * Searches for the ActionCallback represented by the id string.
   *
   * @param id
   */
  public static ActionCallback find(String id) {

    if (id == null) return null;

    Scene s = World.getInstance().getCurrentScene();

    String[] split = id.split(SEPARATION_SYMBOL);

    if (split.length < 2) return null;

    String actorId = split[0];
    String verbId = split[1];
    int actionPos = -1;

    if (split.length > 2) actionPos = Integer.parseInt(split[2]);

    Verb v = null;

    if (actorId.equals("DEFAULT_VERB")) {
      v = World.getInstance().getVerbManager().getVerb(verbId, null, null);
    } else {

      InteractiveActor a;

      if (actorId.equals(s.getId())) {
        v = s.getVerbManager().getVerbs().get(verbId);
      } else {
        a = (InteractiveActor) s.getActor(actorId, true);

        if (a == null) return null;

        v = a.getVerbManager().getVerbs().get(verbId);
      }
    }

    if (v == null) return null;

    if (split.length == 2) return v;

    Action action = v.getActions().get(actionPos);

    if (action instanceof ActionCallback) return (ActionCallback) action;

    return null;
  }
  private static String find(ActionCallback cb, Scene s) {
    if (s == null) return null;

    String id = s.getId();

    for (Verb v : s.getVerbManager().getVerbs().values()) {
      String result = find(cb, v);

      if (result != null) {
        StringBuilder stringBuilder = new StringBuilder(id);
        stringBuilder.append(SEPARATION_SYMBOL).append(result);

        return stringBuilder.toString();
      }
    }

    return null;
  }
  /**
   * Generates a String for serialization that allows locate the ActionCallback
   *
   * @param cb The ActionCallback to serialize
   * @return The generated location string
   */
  public static String find(ActionCallback cb) {
    String id = null;

    if (cb == null) return null;

    // search in scene verbs
    Scene s = World.getInstance().getCurrentScene();

    id = find(cb, s);

    if (id != null) return id;

    id = find(cb, s.getPlayer());
    if (id != null) return id;

    // search in actors
    for (BaseActor a : s.getActors().values()) {
      if (!(a instanceof InteractiveActor)) continue;

      id = find(cb, (InteractiveActor) a);
      if (id != null) return id;
    }

    // search in worldVerbs
    for (Verb v : World.getInstance().getVerbManager().getVerbs().values()) {
      id = find(cb, v);
      if (id != null) {
        StringBuilder stringBuilder = new StringBuilder("DEFAULT_VERB");
        stringBuilder.append(SEPARATION_SYMBOL).append(id);

        return stringBuilder.toString();
      }
    }

    return null;
  }