Examples of IfElseAction


Examples of lineage2.gameserver.model.entity.events.actions.IfElseAction

  {
    if (element == null)
    {
      return Collections.emptyList();
    }
    IfElseAction lastIf = null;
    List<EventAction> actions = new ArrayList<>(0);
    for (Iterator<?> iterator = element.elementIterator(); iterator.hasNext();)
    {
      Element actionElement = (Element) iterator.next();
      if (actionElement.getName().equalsIgnoreCase("start"))
      {
        String name = actionElement.attributeValue("name");
        StartStopAction startStopAction = new StartStopAction(name, true);
        actions.add(startStopAction);
      }
      else if (actionElement.getName().equalsIgnoreCase("stop"))
      {
        String name = actionElement.attributeValue("name");
        StartStopAction startStopAction = new StartStopAction(name, false);
        actions.add(startStopAction);
      }
      else if (actionElement.getName().equalsIgnoreCase("spawn"))
      {
        String name = actionElement.attributeValue("name");
        SpawnDespawnAction spawnDespawnAction = new SpawnDespawnAction(name, true);
        actions.add(spawnDespawnAction);
      }
      else if (actionElement.getName().equalsIgnoreCase("despawn"))
      {
        String name = actionElement.attributeValue("name");
        SpawnDespawnAction spawnDespawnAction = new SpawnDespawnAction(name, false);
        actions.add(spawnDespawnAction);
      }
      else if (actionElement.getName().equalsIgnoreCase("open"))
      {
        String name = actionElement.attributeValue("name");
        OpenCloseAction a = new OpenCloseAction(true, name);
        actions.add(a);
      }
      else if (actionElement.getName().equalsIgnoreCase("close"))
      {
        String name = actionElement.attributeValue("name");
        OpenCloseAction a = new OpenCloseAction(false, name);
        actions.add(a);
      }
      else if (actionElement.getName().equalsIgnoreCase("active"))
      {
        String name = actionElement.attributeValue("name");
        ActiveDeactiveAction a = new ActiveDeactiveAction(true, name);
        actions.add(a);
      }
      else if (actionElement.getName().equalsIgnoreCase("deactive"))
      {
        String name = actionElement.attributeValue("name");
        ActiveDeactiveAction a = new ActiveDeactiveAction(false, name);
        actions.add(a);
      }
      else if (actionElement.getName().equalsIgnoreCase("refresh"))
      {
        String name = actionElement.attributeValue("name");
        RefreshAction a = new RefreshAction(name);
        actions.add(a);
      }
      else if (actionElement.getName().equalsIgnoreCase("init"))
      {
        String name = actionElement.attributeValue("name");
        InitAction a = new InitAction(name);
        actions.add(a);
      }
      else if (actionElement.getName().equalsIgnoreCase("npc_say"))
      {
        int npc = Integer.parseInt(actionElement.attributeValue("npc"));
        ChatType chat = ChatType.valueOf(actionElement.attributeValue("chat"));
        int range = Integer.parseInt(actionElement.attributeValue("range"));
        NpcString string = NpcString.valueOf(actionElement.attributeValue("text"));
        NpcSayAction action = new NpcSayAction(npc, range, chat, string);
        actions.add(action);
      }
      else if (actionElement.getName().equalsIgnoreCase("play_sound"))
      {
        int range = Integer.parseInt(actionElement.attributeValue("range"));
        String sound = actionElement.attributeValue("sound");
        PlaySound.Type type = PlaySound.Type.valueOf(actionElement.attributeValue("type"));
        PlaySoundAction action = new PlaySoundAction(range, sound, type);
        actions.add(action);
      }
      else if (actionElement.getName().equalsIgnoreCase("give_item"))
      {
        int itemId = Integer.parseInt(actionElement.attributeValue("id"));
        long count = Integer.parseInt(actionElement.attributeValue("count"));
        GiveItemAction action = new GiveItemAction(itemId, count);
        actions.add(action);
      }
      else if (actionElement.getName().equalsIgnoreCase("announce"))
      {
        String val = actionElement.attributeValue("val");
        if ((val == null) && (time == Integer.MAX_VALUE))
        {
          info("Can't get announce time." + getCurrentFileName());
          continue;
        }
        int val2 = val == null ? time : Integer.parseInt(val);
        EventAction action = new AnnounceAction(val2);
        actions.add(action);
      }
      else if (actionElement.getName().equalsIgnoreCase("if"))
      {
        String name = actionElement.attributeValue("name");
        IfElseAction action = new IfElseAction(name, false);
        action.setIfList(parseActions(actionElement, time));
        actions.add(action);
        lastIf = action;
      }
      else if (actionElement.getName().equalsIgnoreCase("ifnot"))
      {
        String name = actionElement.attributeValue("name");
        IfElseAction action = new IfElseAction(name, true);
        action.setIfList(parseActions(actionElement, time));
        actions.add(action);
        lastIf = action;
      }
      else if (actionElement.getName().equalsIgnoreCase("else"))
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.