@Override
 public String onTalk(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   String htmltext = "noquest";
   int cond = st.getCond();
   if (npcId == NANARIN) {
     if (cond == 0) {
       if (st.getPlayer().getLevel() < 15) {
         htmltext = "30956-00.htm";
         st.exitCurrentQuest(true);
       } else {
         htmltext = "30956_1.htm";
       }
     } else if (cond == 1) {
       htmltext = "30956_8.htm";
     } else if (cond == 2) {
       htmltext = "30956_3.htm";
     } else if (cond == 3) {
       htmltext = "30956_6.htm";
     } else if (cond == 4) {
       htmltext = "30956_5.htm";
     }
   } else if (npcId == BARBADO) {
     if (cond == 3) {
       if (st.getQuestItemsCount(EVENT_CLOTHES) > 0) {
         st.takeItems(EVENT_CLOTHES, -1);
         htmltext = "30959_2.htm";
         st.exitCurrentQuest(true);
       } else if (st.getQuestItemsCount(SABRINS_BLACK_BEER) > 0) {
         st.takeItems(SABRINS_BLACK_BEER, -1);
         htmltext = "30959_2.htm";
         st.exitCurrentQuest(true);
       } else {
         st.takeItems(NANARINS_FLUTE, -1);
         st.setCond(4);
         st.playSound(SOUND_MIDDLE);
         htmltext = "30959_1.htm";
       }
     } else if (cond == 4) {
       htmltext = "30959_3.htm";
     }
   } else if (npcId == HOLVAS && (cond == 1 || cond == 2)) {
     st.setCond(2);
     if (Rnd.chance(60)) {
       htmltext = "30058_2.htm";
     } else {
       htmltext = "30058_1.htm";
     }
   } else if (npcId == POITAN && (cond == 1 || cond == 2)) {
     st.setCond(2);
     if (Rnd.chance(60)) {
       htmltext = "30458_2.htm";
     } else {
       htmltext = "30458_1.htm";
     }
   }
   return htmltext;
 }
示例#2
0
  @Override
  public void onEvtAttacked(Creature attacker, int damage) {
    NpcInstance actor = getActor();

    super.onEvtAttacked(attacker, damage);

    if (PositionUtils.calculateDistance(attacker, actor, false) > 300. && Rnd.chance(0.13)) {
      addTaskCast(attacker, DRAIN_SKILL);
    }

    Creature target = actor.getAggroList().getMostHated();
    if (target == attacker && Rnd.chance(0.3)) {
      addTaskCast(attacker, DAMAGE_SKILL);
    }
  }
示例#3
0
 @Override
 protected void onEvtDead(Creature killer) {
   NpcInstance actor = getActor();
   if (killer != null) {
     Player player = killer.getPlayer();
     if (player != null && player.getEffectList().containEffectFromSkills(KISS_OF_EVA)) {
       actor.dropItem(player, Rnd.chance(50) ? Red_Coral : Crystal_Fragment, 1);
     }
   }
   super.onEvtDead(killer);
 }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   Player player = st.getPlayer();
   int npcId = npc.getNpcId();
   int refId = player.getReflectionId();
   if (npcId == KAMS && st.getQuestItemsCount(KDROP) == 0) {
     st.giveItems(KDROP, 1);
   } else if (npcId == ALKASO && st.getQuestItemsCount(ADROP) == 0) {
     st.giveItems(ADROP, 1);
   } else if (npcId == LEMATAN) {
     st.setCond(4);
     st.playSound(SOUND_MIDDLE);
     addSpawnToInstance(DADVENTURER2, new Location(84990, -208376, -3342, 55000), 0, refId);
   } else if (ArrayUtils.contains(Pailaka2nd, npcId)) {
     if (Rnd.get(100) < 80) {
       st.dropItem(npc, HERBS[Rnd.get(HERBS.length)], Rnd.get(1, 2));
     }
   } else if (npcId == CHEST) {
     if (Rnd.get(100) < 80) {
       st.dropItem(npc, CHESTDROP[Rnd.get(CHESTDROP.length)], Rnd.get(1, 10));
     }
   }
   // TODO вернуть когда будут работать двери
   // else
   //	dropItem(npc, KEY, 1);
   return null;
 }
示例#5
0
 @Override
 public boolean checkCondition() {
   return Rnd.chance(_template.chance(100));
 }
  @Override
  protected boolean thinkActive() {
    NpcInstance actor = getActor();
    if (actor.isDead()) {
      return true;
    }

    if (_def_think) {
      doTask();
      return true;
    }

    if (actor.isMoving) {
      return true;
    }

    if (System.currentTimeMillis() > wait_timeout && (current_point > -1 || Rnd.chance(5))) {
      if (!wait) {
        switch (current_point) {
          case 0:
            wait_timeout = System.currentTimeMillis() + 30000;
            wait = true;
            return true;
          case 2:
            wait_timeout = System.currentTimeMillis() + 30000;
            wait = true;
            return true;
          case 14:
            wait_timeout = System.currentTimeMillis() + 60000;
            wait = true;
            return true;
          case 26:
            wait_timeout = System.currentTimeMillis() + 30000;
            wait = true;
            return true;
          case 28:
            wait_timeout = System.currentTimeMillis() + 30000;
            wait = true;
            return true;
        }
      }

      wait_timeout = 0;
      wait = false;
      current_point++;

      if (current_point >= points.length) {
        current_point = 0;
      }

      addTaskMove(points[current_point], false);
      doTask();
      return true;
    }

    if (randomAnimation()) {
      return true;
    }

    return false;
  }