Examples of GameObject


Examples of lineage2.gameserver.model.GameObject

 
  @Override
  public void onSocialActionUse(QuestState st, int actionId)
  {
    Player player = st.getPlayer();
    GameObject npc1 = player.getTarget();
    if ((player.getTarget() == null) || !player.getTarget().isNpc() || ((NpcInstance) npc1).isDead())
    {
      return;
    }
    int target = ((NpcInstance) npc1).getNpcId();
    double dist = player.getDistance(npc1);
    int cond = st.getCond();
    if (actionId == SocialAction.SORROW)
    {
      if ((dist < 70) && ((target == corps1) || (target == corps2) || (target == corps3) || (target == corps4)))
      {
        if (cond == 1)
        {
          player.sendPacket(new ExShowScreenMessage(NpcString.YOU_SHOWN_YOUR_CONDOLENCES_TO_ONE_CORPSE, 4500, ScreenMessageAlign.TOP_CENTER));
          st.setCond(2);
          st.playSound(SOUND_MIDDLE);
          ((NpcInstance) npc1).doDie(player);
        }
        else if (cond == 2)
        {
          player.sendPacket(new ExShowScreenMessage(NpcString.YOU_SHOWN_YOUR_CONDOLENCES_TO_SECOND_CORPSE, 4500, ScreenMessageAlign.TOP_CENTER));
          st.setCond(3);
          st.playSound(SOUND_MIDDLE);
          ((NpcInstance) npc1).doDie(player);
        }
        else if (cond == 3)
        {
          player.sendPacket(new ExShowScreenMessage(NpcString.YOU_SHOWN_YOUR_CONDOLENCES_TO_THIRD_CORPSE, 4500, ScreenMessageAlign.TOP_CENTER));
          st.setCond(4);
          st.playSound(SOUND_MIDDLE);
          ((NpcInstance) npc1).doDie(player);
        }
        else if (cond == 4)
        {
          player.sendPacket(new ExShowScreenMessage(NpcString.YOU_SHOWN_YOUR_CONDOLENCES_TO_FOURTH_CORPSE, 4500, ScreenMessageAlign.TOP_CENTER));
          st.setCond(5);
          st.playSound(SOUND_MIDDLE);
          ((NpcInstance) npc1).doDie(player);
        }
        else if (cond == 5)
        {
          player.sendPacket(new ExShowScreenMessage(NpcString.YOU_SHOWN_YOUR_CONDOLENCES_TO_FIFTH_CORPSE, 4500, ScreenMessageAlign.TOP_CENTER));
          st.setCond(6);
          st.playSound(SOUND_MIDDLE);
          ((NpcInstance) npc1).doDie(player);
        }
        if (cond == 6)
        {
          player.sendPacket(new ExShowScreenMessage(NpcString.GRUDGE_OF_YE_SAGIRA_VICTIMS_HAVE_BEEN_RELIEVED_WITH_YOUR_TEARS, 4500, ScreenMessageAlign.TOP_CENTER));
          npc1.deleteMe();
        }
      }
      else if ((dist >= 70) && ((target == corps1) || (target == corps2) || (target == corps3) || (target == corps4)))
      {
        player.sendPacket(new ExShowScreenMessage(NpcString.YOU_ARE_TOO_FAR_FROM_CORPSE_TO_SHOW_YOUR_CONDOLENCES, 4500, ScreenMessageAlign.TOP_CENTER));
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

    if (activeChar.getAlliance().getMembersCount() >= Config.ALT_MAX_ALLY_SIZE)
    {
      activeChar.sendPacket(Msg.YOU_HAVE_FAILED_TO_INVITE_A_CLAN_INTO_THE_ALLIANCE);
      return;
    }
    GameObject obj = activeChar.getVisibleObject(_objectId);
    if ((obj == null) || !obj.isPlayer() || (obj == activeChar))
    {
      activeChar.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
      return;
    }
    Player target = (Player) obj;
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

    }
    final Skill skill = info.getSkill();
    Creature target = null;
    if (player.isInCombat())
    {
      GameObject object = player.getTarget();
      target = (object != null) && object.isCreature() ? (Creature) object : null;
    }
    if ((target == null) || target.isDead() || (target.isDoor() && !info.isCanAttackDoor()) || !player.isInRangeZ(target, skill.getCastRange()) || !target.isAutoAttackable(player))
    {
      return;
    }
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

    }
    final Skill skill = info.getSkill();
    Creature target = null;
    if (player.isInCombat())
    {
      GameObject object = player.getTarget();
      target = (object != null) && object.isCreature() ? (Creature) object : null;
    }
    if ((target == null) || target.isDead() || (target.isDoor() && !info.isCanAttackDoor()) || !player.isInRangeZ(target, skill.getCastRange()) || !target.isAutoAttackable(player))
    {
      return;
    }
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

    {
      return false;
    }
    Skill skill;
    Creature target;
    GameObject object;
    switch (nextAction)
    {
      case ATTACK:
        if (nextAction_arg0 == null)
        {
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

   * Method thinkInteract.
   */
  protected void thinkInteract()
  {
    Playable actor = getActor();
    GameObject target = (GameObject) _intention_arg0;
    if (target == null)
    {
      setIntention(AI_INTENTION_ACTIVE);
      return;
    }
    int range = (int) (Math.max(30, actor.getMinDistance(target)) + 20);
    if (actor.isInRangeZ(target, range))
    {
      if (actor.isPlayer())
      {
        //((Player) actor).doInteract(target);
        target.onActionSelect((Player) actor, false);
      }
      setIntention(AI_INTENTION_ACTIVE);
    }
    else
    {
      actor.moveToLocation(target.getLoc(), 40, true);
      setNextAction(nextAction.INTERACT, target, null, false, false);
    }
  }
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

   * Method thinkPickUp.
   */
  protected void thinkPickUp()
  {
    final Playable actor = getActor();
    final GameObject target = (GameObject) _intention_arg0;
    if (target == null)
    {
      setIntention(AI_INTENTION_ACTIVE);
      return;
    }
    if (actor.isInRange(target, 30) && (Math.abs(actor.getZ() - target.getZ()) < 50))
    {
      if (actor.isPlayer() || actor.isPet())
      {
        actor.doPickupItem(target);
      }
      setIntention(AI_INTENTION_ACTIVE);
    }
    else
    {
      ThreadPoolManager.getInstance().execute(new RunnableImpl()
      {
        @Override
        public void runImpl()
        {
          actor.moveToLocation(target.getLoc(), 10, true);
          setNextAction(nextAction.PICKUP, target, null, false, false);
        }
      });
    }
  }
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

      return;
    }
    final boolean usePet = action.type == PET_ACTION;
    final boolean useServitor = action.type == SERVITOR_ACTION;
    final boolean useServitorGroup = action.type == SERVITOR_GROUP_ACTION;
    final GameObject target = activeChar.getTarget();
    final Summon pet = activeChar.getSummonList().getPet();
    final Summon servitor = activeChar.getSummonList().getFirstServitor();
    final List<Summon> servitors = activeChar.getSummonList().getServitors();
    if (activeChar.isGM() && activeChar.isDebug())
    {
      activeChar.sendMessage("ActionId:" + action.id + " useServitor:" + useServitor + " useServitorGroup:" + useServitorGroup);
    }
    if (!usePet && !useServitor && !useServitorGroup && (activeChar.isOutOfControl() || activeChar.isActionsDisabled()) && !(activeChar.isFakeDeath() && (_actionId == 0)))
    {
      activeChar.sendActionFailed();
      return;
    }
    if ((activeChar.getTransformation() != 0) && (action.transform > 0))
    {
      activeChar.sendActionFailed();
      return;
    }
    switch (action.type)
    {
      case PLAYER_ACTION:
        switch (action.id)
        {
          case 0:
            if (activeChar.isMounted())
            {
              activeChar.sendActionFailed();
              break;
            }
            if (activeChar.isFakeDeath())
            {
              activeChar.breakFakeDeath();
              activeChar.updateEffectIcons();
              break;
            }
            if (!activeChar.isSitting())
            {
              if ((target != null) && (target instanceof StaticObjectInstance) && (((StaticObjectInstance) target).getType() == 1) && (activeChar.getDistance3D(target) <= Creature.INTERACTION_DISTANCE))
              {
                activeChar.sitDown((StaticObjectInstance) target);
              }
              else
              {
                activeChar.sitDown(null);
              }
            }
            else
            {
              activeChar.standUp();
            }
            break;
          case 1:
            if (activeChar.isRunning())
            {
              activeChar.setWalking();
            }
            else
            {
              activeChar.setRunning();
            }
            break;
          case 10:
          case 61:
          {
            if (activeChar.getSittingTask())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInStoreMode())
            {
              activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
              activeChar.standUp();
              activeChar.broadcastCharInfo();
            }
            else if (!TradeHelper.checksIfCanOpenStore(activeChar, _actionId == 61 ? Player.STORE_PRIVATE_SELL_PACKAGE : Player.STORE_PRIVATE_SELL))
            {
              activeChar.sendActionFailed();
              return;
            }
            activeChar.sendPacket(new PrivateStoreManageListSell(activeChar, _actionId == 61));
            break;
          }
          case 28:
          {
            if (activeChar.getSittingTask())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInStoreMode())
            {
              activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
              activeChar.standUp();
              activeChar.broadcastCharInfo();
            }
            else if (!TradeHelper.checksIfCanOpenStore(activeChar, Player.STORE_PRIVATE_BUY))
            {
              activeChar.sendActionFailed();
              return;
            }
            activeChar.sendPacket(new PrivateStoreManageListBuy(activeChar));
            break;
          }
          case 51:
          {
            if (activeChar.getSittingTask())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInStoreMode())
            {
              activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
              activeChar.standUp();
              activeChar.broadcastCharInfo();
            }
            else if (!TradeHelper.checksIfCanOpenStore(activeChar, Player.STORE_PRIVATE_MANUFACTURE))
            {
              activeChar.sendActionFailed();
              return;
            }
            activeChar.sendPacket(new RecipeShopManageList(activeChar, true));
            break;
          }
          case 38:
            if (activeChar.getTransformation() != 0)
            {
              activeChar.sendPacket(SystemMsg.YOU_CANNOT_BOARD_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isMounted())
            {
              if (activeChar.isFlying() && !activeChar.checkLandingState())
              {
                activeChar.sendPacket(Msg.YOU_ARE_NOT_ALLOWED_TO_DISMOUNT_AT_THIS_LOCATION, ActionFail.STATIC);
                activeChar.sendActionFailed();
                return;
              }
              activeChar.setMount(0, 0, 0);
            }
            else if (activeChar.isMounted() || activeChar.isInBoat())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isDead())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isInDuel())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isFishing())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isSitting())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isCursedWeaponEquipped())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.getActiveWeaponFlagAttachment() != null)
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isCastingNow())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (activeChar.isParalyzed())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if ((pet == null) || activeChar.isInCombat() || pet.isInCombat())
            {
              activeChar.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
            }
            else if (pet.isDead())
            {
              activeChar.sendPacket(Msg.A_DEAD_PET_CANNOT_BE_RIDDEN);
            }
            else if ((pet != null) && pet.isMountable())
            {
              activeChar.getEffectList().stopEffect(Skill.SKILL_EVENT_TIMER);
              activeChar.setMount(pet.getTemplate().npcId, pet.getObjectId(), pet.getLevel());
              activeChar.getSummonList().unsummonPet(false);
            }
            break;
          case 37:
          {
            if (activeChar.getSittingTask())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInStoreMode())
            {
              activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
              activeChar.standUp();
              activeChar.broadcastCharInfo();
            }
            else if (!TradeHelper.checksIfCanOpenStore(activeChar, Player.STORE_PRIVATE_MANUFACTURE))
            {
              activeChar.sendActionFailed();
              return;
            }
            activeChar.sendPacket(new RecipeShopManageList(activeChar, false));
            break;
          }
          case 67:
            if (activeChar.isInBoat() && activeChar.getBoat().isClanAirShip() && !activeChar.getBoat().isMoving)
            {
              ClanAirShip boat = (ClanAirShip) activeChar.getBoat();
              if (boat.getDriver() == null)
              {
                boat.setDriver(activeChar);
              }
              else
              {
                activeChar.sendPacket(SystemMsg.ANOTHER_PLAYER_IS_PROBABLY_CONTROLLING_THE_TARGET);
              }
            }
            break;
          case 68:
            if (activeChar.isClanAirShipDriver())
            {
              ClanAirShip boat = (ClanAirShip) activeChar.getBoat();
              boat.setDriver(null);
              activeChar.broadcastCharInfo();
            }
            break;
          case 69:
            if (activeChar.isClanAirShipDriver() && activeChar.getBoat().isDocked())
            {
              activeChar.sendPacket(new ExAirShipTeleportList((ClanAirShip) activeChar.getBoat()));
            }
            break;
          case 70:
            if (activeChar.isInBoat() && activeChar.getBoat().isAirShip() && activeChar.getBoat().isDocked())
            {
              activeChar.getBoat().oustPlayer(activeChar, activeChar.getBoat().getReturnLoc(), true);
            }
            break;
          case 78:
            TacticalSignManager.setTacticalSign(activeChar, target, 1);
            break;
          case 79:
            TacticalSignManager.setTacticalSign(activeChar, target, 2);
            break;
          case 80:
            TacticalSignManager.setTacticalSign(activeChar, target, 3);
            break;
          case 81:
            TacticalSignManager.setTacticalSign(activeChar, target, 4);
            break;
          case 82:
            TacticalSignManager.getTargetOnTacticalSign(activeChar, 1);
            break;
          case 83:
            TacticalSignManager.getTargetOnTacticalSign(activeChar, 2);
            break;
          case 84:
            TacticalSignManager.getTargetOnTacticalSign(activeChar, 3);
            break;
          case 85:
            TacticalSignManager.getTargetOnTacticalSign(activeChar, 4);
            break;
          case 96:
            _log.info("96 Accessed");
            break;
          case 97:
            _log.info("97 Accessed");
            break;
        }
        break;
      case PET_ACTION:
        if ((pet == null) || pet.isOutOfControl())
        {
          activeChar.sendActionFailed();
          return;
        }
        if (pet.isDepressed())
        {
          activeChar.sendPacket(SystemMsg.YOUR_PETSERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
          return;
        }
        switch (action.id)
        {
          case 15:
            pet.setFollowMode(!pet.isFollowMode());
            break;
          case 16:
            pet.setFollowMode(!pet.isFollowMode());
            if ((target == null) || !target.isCreature() || (pet == target) || pet.isDead())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInOlympiadMode() && !activeChar.isOlympiadCompStart())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (pet.getTemplate().getNpcId() == PetDataTable.SIN_EATER_ID)
            {
              activeChar.sendActionFailed();
              return;
            }
            if (!_ctrlPressed && target.isCreature() && !((Creature) target).isAutoAttackable(pet))
            {
              activeChar.sendActionFailed();
              return;
            }
            if (_ctrlPressed && !target.isAttackable(pet))
            {
              activeChar.sendPacket(SystemMsg.INVALID_TARGET);
              activeChar.sendActionFailed();
              return;
            }
            if (!target.isMonster() && (pet.isInZonePeace() || (target.isCreature() && ((Creature) target).isInZonePeace())))
            {
              activeChar.sendPacket(SystemMsg.YOU_MAY_NOT_ATTACK_THIS_TARGET_IN_A_PEACEFUL_ZONE);
              activeChar.sendActionFailed();
              return;
            }
            if ((activeChar.getLevel() + 20) <= pet.getLevel())
            {
              activeChar.sendPacket(SystemMsg.YOUR_PET_IS_TOO_HIGH_LEVEL_TO_CONTROL);
              activeChar.sendActionFailed();
              return;
            }
            pet.getAI().Attack(target, _ctrlPressed, _shiftPressed);
            break;
          case 17:
            pet.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
            break;
          case 19:
            if (pet.isDead())
            {
              activeChar.sendPacket(SystemMsg.DEAD_PETS_CANNOT_BE_RETURNED_TO_THEIR_SUMMONING_ITEM, ActionFail.STATIC);
              return;
            }
            if (pet.isInCombat())
            {
              activeChar.sendPacket(SystemMsg.A_PET_CANNOT_BE_UNSUMMONED_DURING_BATTLE, ActionFail.STATIC);
              return;
            }
            if (!PetDataTable.isVitaminPet(pet.getNpcId()) && pet.isPet() && (pet.getCurrentFed() < (0.55 * pet.getMaxFed())))
            {
              activeChar.sendPacket(SystemMsg.YOU_MAY_NOT_RESTORE_A_HUNGRY_PET, ActionFail.STATIC);
              return;
            }
            activeChar.getSummonList().unsummonPet(false);
            break;
          case 54:
            if ((target != null) && (pet != target) && !pet.isMovementDisabled())
            {
              pet.setFollowMode(false);
              pet.moveToLocation(target.getLoc(), 100, true);
            }
            break;
          case 1070:
            if (pet instanceof PetBabyInstance)
            {
              ((PetBabyInstance) pet).triggerBuff();
            }
            break;
        }
        if (action.value > 0)
        {
          UseSkill(action.value, pet);
          activeChar.sendActionFailed();
          return;
        }
        break;
      case SERVITOR_ACTION:
        if (servitor == null)
        {
          activeChar.sendActionFailed();
          return;
        }
        switch (action.id)
        {
          case 21:
            servitor.setFollowMode(!servitor.isFollowMode());
            break;
          case 22:
            if ((target == null) || !target.isCreature())
            {
              activeChar.sendActionFailed();
              return;
            }
            if ((servitor == target) || servitor.isDead())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInOlympiadMode() && !activeChar.isOlympiadCompStart())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (_ctrlPressed)
            {
              if (!target.isAttackable(servitor))
              {
                activeChar.sendPacket(SystemMsg.INVALID_TARGET);
                activeChar.sendActionFailed();
                return;
              }
            }
            else if (!_ctrlPressed && target.isCreature())
            {
              if (!((Creature) target).isAutoAttackable(servitor))
              {
                activeChar.sendActionFailed();
                return;
              }
            }
            if (!target.isMonster() && (target.isCreature() && ((Creature) target).isInZonePeace()))
            {
              if (servitor.isInZonePeace())
              {
                activeChar.sendPacket(SystemMsg.YOU_MAY_NOT_ATTACK_THIS_TARGET_IN_A_PEACEFUL_ZONE);
                activeChar.sendActionFailed();
                return;
              }
            }
            servitor.setFollowMode(!servitor.isFollowMode());
            servitor.getAI().Attack(target, _ctrlPressed, _shiftPressed);
            break;
          case 23:
            servitor.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
            break;
          case 52:
            if (servitor.isInCombat())
            {
              activeChar.sendPacket(SystemMsg.A_PET_CANNOT_BE_UNSUMMONED_DURING_BATTLE);
              activeChar.sendActionFailed();
            }
            else
            {
              servitor.saveEffects();
              activeChar.getSummonList().unsummonAllServitors();
            }
            break;
          case 53:
            if ((target != null) && (servitor != target) && !servitor.isMovementDisabled())
            {
              servitor.setFollowMode(false);
              servitor.moveToLocation(target.getLoc(), 100, true);
            }
            break;
          case 1000:
            if ((target != null) && !target.isDoor())
            {
              activeChar.sendActionFailed();
              return;
            }
            break;
          case 1039:
          case 1040:
            if (target.isDoor() || (target instanceof SiegeFlagInstance))
            {
              activeChar.sendActionFailed();
              return;
            }
            break;
        }
        if (action.value > 0)
        {
          UseSkill(action.value, servitor);
          activeChar.sendActionFailed();
          return;
        }
        break;
      case SERVITOR_GROUP_ACTION:
        if (servitors.isEmpty())
        {
          activeChar.sendActionFailed();
          return;
        }
        switch (action.id)
        {
          case 1099//Attack
            if ((target == null) || !target.isCreature())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (activeChar.isInOlympiadMode() && !activeChar.isOlympiadCompStart())
            {
              activeChar.sendActionFailed();
              return;
            }
            if (servitors.contains(target))
            {
              activeChar.sendActionFailed();
              return;
            }
            for (Summon summon : servitors)
            {
              if (_ctrlPressed)
              {
                if (!target.isAttackable(summon))
                {
                  activeChar.sendPacket(SystemMsg.INVALID_TARGET);
                  activeChar.sendActionFailed();
                  return;
                }
              }
              else if (!_ctrlPressed && target.isCreature())
              {
                if (!((Creature) target).isAutoAttackable(summon))
                {
                  activeChar.sendActionFailed();
                  return;
                }
              }
              if (!target.isMonster() && (target.isCreature() && ((Creature) target).isInZonePeace()))
              {
                if (summon.isInZonePeace())
                {
                  activeChar.sendPacket(SystemMsg.YOU_MAY_NOT_ATTACK_THIS_TARGET_IN_A_PEACEFUL_ZONE);
                  activeChar.sendActionFailed();
                  return;
                }
              }
            }
            for (Summon summon : servitors)
            {
              if (!summon.isDead())
              {
                summon.setFollowMode(true);
                summon.getAI().Attack(target, _ctrlPressed, _shiftPressed);
              }
            }
            break;
          case 1100//Move
            if ((target != null) && !servitors.contains(target))
            {
              for (Summon summon : servitors)
              {
                if (!summon.isMovementDisabled())
                {
                  summon.setFollowMode(false);
                  summon.moveToLocation(target.getLoc(), 100, true);
                }
              }
            }
            break;
          case 1101//Pause
            for (Summon summon : servitors)
            {
              summon.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
            }
            break;
          case 1102//Cancel the Summoning
            if (activeChar.getSummonList().isInCombat())
            {
              activeChar.sendPacket(SystemMsg.A_PET_CANNOT_BE_UNSUMMONED_DURING_BATTLE);
              activeChar.sendActionFailed();
            }
            else
            {
              activeChar.getSummonList().unsummonAllServitors();
            }
            break;
          case 1103//Passive
            for (Summon summon : servitors)
            {
              summon.setDefendMode(false);
            }
            break;
          case 1104//Defend
            for (Summon summon : servitors)
            {
              summon.setDefendMode(true);
            }
            break;
        }
        if (action.value > 0)
        {
          UseSkill(action.value, servitors.toArray(new Summon[servitors.size()]));
          activeChar.sendActionFailed();
          return;
        }
        break;
      case SOCIAL_ACTION:
        if (activeChar.isOutOfControl() || (activeChar.getTransformation() != 0) || activeChar.isActionsDisabled() || activeChar.isSitting() || (activeChar.getPrivateStoreType() != Player.STORE_PRIVATE_NONE) || activeChar.isProcessingRequest())
        {
          activeChar.sendActionFailed();
          return;
        }
        if (activeChar.isFishing())
        {
          activeChar.sendPacket(SystemMsg.YOU_CANNOT_DO_THAT_WHILE_FISHING_2);
          activeChar.sendActionFailed();
          return;
        }
        activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), action.value));
        for (QuestState state : activeChar.getAllQuestsStates())
        {
          state.getQuest().notifySocialActionUse(state, action.value);
        }
        if (Config.ALT_SOCIAL_ACTION_REUSE)
        {
          ThreadPoolManager.getInstance().schedule(new SocialTask(activeChar), 2600);
          activeChar.startParalyzed();
        }
        activeChar.getListeners().onSocialAction(action); // DynamicQuest
        break;
      case COUPLE_ACTION:
        if (activeChar.isOutOfControl() || activeChar.isActionsDisabled() || activeChar.isSitting())
        {
          activeChar.sendActionFailed();
          return;
        }
        if ((target == null) || !target.isPlayer())
        {
          activeChar.sendActionFailed();
          return;
        }
        final Player pcTarget = target.getPlayer();
        if (pcTarget.isProcessingRequest() && pcTarget.getRequest().isTypeOf(L2RequestType.COUPLE_ACTION))
        {
          activeChar.sendPacket(new SystemMessage2(SystemMsg.C1_IS_ALREADY_PARTICIPATING_IN_A_COUPLE_ACTION_AND_CANNOT_BE_REQUESTED_FOR_ANOTHER_COUPLE_ACTION).addName(pcTarget));
          return;
        }
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

    if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (activeChar.getKarma() < 0) && !activeChar.isGM())
    {
      activeChar.sendActionFailed();
      return;
    }
    GameObject target = activeChar.getTarget();
    ManorManagerInstance manor = (target != null) && (target instanceof ManorManagerInstance) ? (ManorManagerInstance) target : null;
    if (!activeChar.isGM() && ((manor == null) || !activeChar.isInRange(manor, Creature.INTERACTION_DISTANCE)))
    {
      activeChar.sendActionFailed();
      return;
View Full Code Here

Examples of lineage2.gameserver.model.GameObject

   * @param activeChar Player
   * @param targetName String
   */
  private void handleCancel(Player activeChar, String targetName)
  {
    GameObject obj = activeChar.getTarget();
    if (targetName != null)
    {
      Player plyr = World.getPlayer(targetName);
      if (plyr != null)
      {
        obj = plyr;
      }
      else
      {
        try
        {
          int radius = Math.max(Integer.parseInt(targetName), 100);
          for (Creature character : activeChar.getAroundCharacters(radius, 200))
          {
            character.getEffectList().stopAllEffects();
          }
          activeChar.sendMessage("Apply Cancel within " + radius + " unit radius.");
          return;
        }
        catch (NumberFormatException e)
        {
          activeChar.sendMessage("Enter valid player name or radius");
          return;
        }
      }
    }
    if (obj == null)
    {
      obj = activeChar;
    }
    if (obj.isCreature())
    {
      ((Creature) obj).getEffectList().stopAllEffects();
    }
    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.