Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Object


   
    // by Azagthtot
    PowerPak.getInstance().chatHandler(activeChar, _type, _text);
    //CreatureSay cs = new CreatureSay(activeChar.getObjectId(),_type, activeChar.getName(), _text);

    L2Object saymode = activeChar.getSayMode();
    if(saymode != null)
    {
      String name = saymode.getName();
      int actor = saymode.getObjectId();
      _type = 0;
      Collection<L2Object> list = saymode.getKnownList().getKnownObjects().values();

      CreatureSay cs = new CreatureSay(actor, _type, name, _text);
      for(L2Object obj : list)
      {
        if(obj == null || !(obj instanceof L2Character))
View Full Code Here


    if(activeChar == null)
      return false;

    if(command.startsWith("admin_setdonator"))
    {
      L2Object target = activeChar.getTarget();

      if(target instanceof L2PcInstance)
      {
        L2PcInstance targetPlayer = (L2PcInstance) target;
        boolean newDonator = !targetPlayer.isDonator();
View Full Code Here

    return ADMIN_COMMANDS;
  }

  private void spawnMonster(L2PcInstance activeChar, String monsterId, int respawnTime, int mobCount, boolean permanent)
  {
    L2Object target = activeChar.getTarget();
    if(target == null)
      target = activeChar;
    if(target != activeChar && activeChar.getAccessLevel().isGm())
      target = activeChar;
   
    L2NpcTemplate template1;
    if(monsterId.matches("[0-9]*"))
    {
      //First parameter was an ID number
      int monsterTemplate = Integer.parseInt(monsterId);
      template1 = NpcTable.getInstance().getTemplate(monsterTemplate);
    }
    else
    {
      //First parameter wasn't just numbers so go by name not ID
      monsterId = monsterId.replace('_', ' ');
      template1 = NpcTable.getInstance().getTemplateByName(monsterId);
    }

    if(template1 == null){
      activeChar.sendMessage("Attention, wrong NPC ID/Name");
      return;
    }
   
    try
    {
      L2Spawn spawn = new L2Spawn(template1);
      if(Config.SAVE_GMSPAWN_ON_CUSTOM)
        spawn.setCustom(true);
      spawn.setLocx(target.getX());
      spawn.setLocy(target.getY());
      spawn.setLocz(target.getZ());
      spawn.setAmount(mobCount);
      spawn.setHeading(activeChar.getHeading());
      spawn.setRespawnDelay(respawnTime);
     
      if(RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcid()) || GrandBossManager.getInstance().isDefined(spawn.getNpcid()))
      {
        activeChar.sendMessage("Another instance of " + template1.name + " already present into database:");
        activeChar.sendMessage("It will be spawned but not saved on Database");
        activeChar.sendMessage("After server restart or raid dead, the spawned npc will desappear");
        permanent=false;
        spawn.set_customBossInstance(true); //for raids, this value is used in order to segnalate to not save respawn time - status for custom instance

      }
      //else
      //{
        if(RaidBossSpawnManager.getInstance().getValidTemplate(spawn.getNpcid()) != null)
        {
          RaidBossSpawnManager.getInstance().addNewSpawn(spawn, 0, template1.getStatsSet().getDouble("baseHpMax"), template1.getStatsSet().getDouble("baseMpMax"), permanent);
        }
        else
        {
          SpawnTable.getInstance().addNewSpawn(spawn, permanent);
        }

        spawn.init();

        if(!permanent)
        {
          spawn.stopRespawn();
        }

        activeChar.sendMessage("Created " + template1.name + " on " + target.getObjectId());
      //}

      spawn = null;
    }
    catch(Exception e)
View Full Code Here

              return;
      }
     
      if (activeChar.isMoving() && activeChar.isAttackingNow() && (bodyPart == L2Item.SLOT_LR_HAND || bodyPart == L2Item.SLOT_L_HAND || bodyPart == L2Item.SLOT_R_HAND))
      {
        L2Object target = activeChar.getTarget();
        activeChar.setTarget(null);
        activeChar.stopMove(null);
        activeChar.setTarget(target);
        activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK);
      }
View Full Code Here

    // If Alternate rule Karma punishment is set to true, forbid Wear to player with Karma
    if(!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
      return;

    // Check current target of the player and the INTERACTION_DISTANCE
    L2Object target = player.getTarget();
    if(!player.isGM() && (target == null // No target (ie GM Shop)
        || !(target instanceof L2MerchantInstance || target instanceof L2MercManagerInstance) // Target not a merchant and not mercmanager
    || !player.isInsideRadius(target, L2NpcInstance.INTERACTION_DISTANCE, false, false)))
      return; // Distance is too far
View Full Code Here

      getClient().sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    L2Summon pet = activeChar.getPet();
    L2Object target = activeChar.getTarget();

    if(Config.DEBUG)
    {
      _log.info("Requested Action ID: " + String.valueOf(_actionId));
    }

    switch(_actionId)
    {
      case 0:
        if(activeChar.getMountType() != 0)
        {
          break;
        }

        if(target != null && !activeChar.isSitting() && target instanceof L2StaticObjectInstance && ((L2StaticObjectInstance) target).getType() == 1 && CastleManager.getInstance().getCastle(target) != null && activeChar.isInsideRadius(target, L2StaticObjectInstance.INTERACTION_DISTANCE, false, false))
        {
          ChairSit cs = new ChairSit(activeChar, ((L2StaticObjectInstance) target).getStaticObjectId());
          activeChar.sendPacket(cs);
          activeChar.sitDown();
          activeChar.broadcastPacket(cs);
          break;
        }

        if(activeChar.isSitting() || activeChar.isFakeDeath())
        {
          activeChar.standUp();
        }
        else
        {
          activeChar.sitDown();
        }

        if(Config.DEBUG)
        {
          _log.fine("new wait type: " + (activeChar.isSitting() ? "SITTING" : "STANDING"));
        }

        break;
      case 1:
        if(activeChar.isRunning())
        {
          activeChar.setWalking();
        }
        else
        {
          activeChar.setRunning();
        }

        if(Config.DEBUG)
        {
          _log.fine("new move type: " + (activeChar.isRunning() ? "RUNNING" : "WALKIN"));
        }
        break;
      case 15:
      case 21: // pet follow/stop
        if(pet != null && !pet.isMovementDisabled() && !activeChar.isBetrayed())
        {
          pet.setFollowStatus(!pet.getFollowStatus());
        }

        break;
      case 16:
      case 22: // pet attack
        if(target != null && pet != null && pet != target && !pet.isAttackingDisabled() && !activeChar.isBetrayed())
           {
              if(activeChar.isInOlympiadMode() && !activeChar.isOlympiadStart())
          {
            // if L2PcInstance is in Olympia and the match isn't already start, send a Server->Client packet ActionFailed
            activeChar.sendPacket(ActionFailed.STATIC_PACKET);
            return;
          }

          if(target instanceof L2PcInstance
            && !activeChar.getAccessLevel().allowPeaceAttack()
            && L2Character.isInsidePeaceZone(pet, target))
          {
            if(!activeChar.isInFunEvent() || !((L2PcInstance)target).isInFunEvent())
            {
              activeChar.sendPacket(SystemMessageId.TARGET_IN_PEACEZONE);
              return;
            }
          }

          if(target.isAutoAttackable(activeChar) || _ctrlPressed)
          {
            if(target instanceof L2DoorInstance)
            {
              if(((L2DoorInstance) target).isAttackable(activeChar) && pet.getNpcId() != L2SiegeSummonInstance.SWOOP_CANNON_ID)
              {
                pet.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
              }
            }
            // siege golem AI doesn't support attacking other than doors at the moment
            else if(pet.getNpcId() != L2SiegeSummonInstance.SIEGE_GOLEM_ID)
            {
              pet.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
            }
          }
        }
        break;
      case 17:
      case 23: // pet - cancel action
        if(pet != null && !pet.isMovementDisabled() && !activeChar.isBetrayed())
        {
          pet.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null);
        }

        break;
      case 19: // pet unsummon
        if(pet != null && !activeChar.isBetrayed())
        {
          //returns pet to control item
          if(pet.isDead())
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.DEAD_PET_CANNOT_BE_RETURNED));
          }
          else if(pet.isAttackingNow() || pet.isRooted())
          {
            activeChar.sendMessage("You cannot despawn a summon during combat."); // Message like L2OFF
          }
          else if (pet.isInCombat() || activeChar.isInCombat())
          {
            activeChar.sendMessage("You cannot despawn a summon during combat."); // Message like L2OFF
          }
          else
          {
            // if it is a pet and not a summon
            if(pet instanceof L2PetInstance)
            {
              L2PetInstance petInst = (L2PetInstance) pet;

              // if the pet is more than 40% fed
              if(petInst.getCurrentFed() > petInst.getMaxFed() * 0.40)
              {
                pet.unSummon(activeChar);
              }
              else
              {
                activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_RESTORE_HUNGRY_PETS));
              }
            }
          }
        }
        break;
      case 38: // pet mount
        // mount
        if(pet != null && pet.isMountable() && !activeChar.isMounted() && !activeChar.isBetrayed())
        {
          if(activeChar.isDead())
          {
            //A strider cannot be ridden when dead
            SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_DEAD);
            activeChar.sendPacket(msg);
          }
          else if(pet.isDead())
          {
            //A dead strider cannot be ridden.
            SystemMessage msg = new SystemMessage(SystemMessageId.DEAD_STRIDER_CANT_BE_RIDDEN);
            activeChar.sendPacket(msg);
          }
          else if(pet.isInCombat() || pet.isRooted())
          {
            //A strider in battle cannot be ridden
            SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_IN_BATLLE_CANT_BE_RIDDEN);
            activeChar.sendPacket(msg);
          }
          else if(activeChar.isInCombat())
          {
            //A strider cannot be ridden while in battle
            SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
            activeChar.sendPacket(msg);
          }
          else if(activeChar.isInFunEvent())
          {
            //A strider cannot be ridden while in event
            SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
            activeChar.sendPacket(msg);
          }
          else if(activeChar.isSitting()) // Like L2OFF you can mount also during movement
          {
            //A strider can be ridden only when standing
            SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CAN_BE_RIDDEN_ONLY_WHILE_STANDING);
            activeChar.sendPacket(msg);
          }
          else if(activeChar.isFishing())
          {
            //You can't mount, dismount, break and drop items while fishing
            SystemMessage msg = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_2);
            activeChar.sendPacket(msg);
          }
          else if(activeChar.isCursedWeaponEquiped())
          {
            //You can't mount, dismount, break and drop items while weilding a cursed weapon
            SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
            activeChar.sendPacket(msg);
          }
          else if(!pet.isDead() && !activeChar.isMounted())
          {
            if(!activeChar.disarmWeapons())
              return;
           
            if (!activeChar.getFloodProtectors().getItemPetSummon().tryPerformAction("mount"))
              return;
           

            Ride mount = new Ride(activeChar.getObjectId(), Ride.ACTION_MOUNT, pet.getTemplate().npcId);
            activeChar.broadcastPacket(mount);
            activeChar.setMountType(mount.getMountType());
            activeChar.setMountObjectID(pet.getControlItemId());
            pet.unSummon(activeChar);

            if(activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null || activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null)
            {
              if(activeChar.isFlying())
              {
                // Remove skill Wyvern Breath
                activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
                activeChar.sendSkillList();
              }
             
              if(activeChar.setMountType(0))
              {
                Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
                activeChar.broadcastPacket(dismount);
                activeChar.setMountObjectID(0);
              }
            }
          }
        }
        else if(activeChar.isRentedPet())
        {
          activeChar.stopRentPet();
        }
        else if(activeChar.isMounted())
        {
          if(activeChar.isFlying())
          {   
            // Remove skill Wyvern Breath
            activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
            activeChar.sendSkillList();
          }
         
          if(activeChar.setMountType(0))
          {
            Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
            activeChar.broadcastPacket(dismount);
            activeChar.setMountObjectID(0);
           
            // Update status after unmount to avoid visual bug
            activeChar.broadcastStatusUpdate();
            activeChar.broadcastUserInfo();
          }
        }
        break;
      case 32: // Wild Hog Cannon - Mode Change
        useSkill(4230);
        break;
      case 36: // Soulless - Toxic Smoke
        useSkill(4259);
        break;
      case 37:
       
        if (activeChar.isAlikeDead())
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // Like L2OFF - You can't open Manufacture when you are in private store
        if (activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY || activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL)
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // Like L2OFF - You can't open Manufacture when you are sitting
        if (activeChar.isSitting() && activeChar.getPrivateStoreType() != L2PcInstance.STORE_PRIVATE_MANUFACTURE)
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // You can't open Manufacture when the task is launched
        if(activeChar.isSittingTaskLaunched())
        {
          sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        if (activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_MANUFACTURE)
        {
          activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
         
          if (activeChar.isSitting())
            activeChar.standUp();
        }
       
        if (activeChar.getCreateList() == null)
        {
          activeChar.setCreateList(new L2ManufactureList());
        }
       
        activeChar.sendPacket(new RecipeShopManageList(activeChar, true));
        break;
      case 39: // Soulless - Parasite Burst
        useSkill(4138);
        break;
      case 41: // Wild Hog Cannon - Attack
        useSkill(4230);
        break;
      case 42: // Kai the Cat - Self Damage Shield
        useSkill(4378, activeChar);
        break;
      case 43: // Unicorn Merrow - Hydro Screw
        useSkill(4137);
        break;
      case 44: // Big Boom - Boom Attack
        useSkill(4139);
        break;
      case 45: // Unicorn Boxer - Master Recharge
        useSkill(4025, activeChar);
        break;
      case 46: // Mew the Cat - Mega Storm Strike
        useSkill(4261);
        break;
      case 47: // Silhouette - Steal Blood
        useSkill(4260);
        break;
      case 48: // Mechanic Golem - Mech. Cannon
        useSkill(4068);
        break;
      case 51:
       
        // Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
        if (activeChar.isAlikeDead())
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // Like L2OFF - You can't open Manufacture when you are in private store
        if (activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY || activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL)
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // Like L2OFF - You can't open Manufacture when you are sitting
        if (activeChar.isSitting() && activeChar.getPrivateStoreType() != L2PcInstance.STORE_PRIVATE_MANUFACTURE)
        {
          getClient().sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        // You can't open Manufacture when the task is launched
        if(activeChar.isSittingTaskLaunched())
        {
          sendPacket(ActionFailed.STATIC_PACKET);
          return;
        }
       
        if (activeChar.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_MANUFACTURE)
        {
          activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
         
          if (activeChar.isSitting())
            activeChar.standUp();
        }
       
        if (activeChar.getCreateList() == null)
        {
          activeChar.setCreateList(new L2ManufactureList());
        }
       
        activeChar.sendPacket(new RecipeShopManageList(activeChar, false));
        break;
      case 52: // unsummon
        if (pet != null && pet instanceof L2SummonInstance)
        {
          if (pet.isInCombat() || activeChar.isInCombat())
          {
            activeChar.sendMessage("You cannot despawn a summon during combat."); // Message like L2OFF
          }
          else if (pet.isAttackingNow() || pet.isRooted())
          {
            activeChar.sendMessage("You cannot despawn a summon during combat."); // Message like L2OFF
          }
          else
          {
            pet.unSummon(activeChar);
          }
        }
        break;
      case 53: // move to target
        if(target != null && pet != null && pet != target && !pet.isMovementDisabled())
        {
          pet.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(target.getX(), target.getY(), target.getZ(), 0));
        }
        break;
      case 54: // move to target hatch/strider
        if(target != null && pet != null && pet != target && !pet.isMovementDisabled())
        {
          pet.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(target.getX(), target.getY(), target.getZ(), 0));
        }
        break;
      case 96: // Quit Party Command Channel
        _log.info("98 Accessed");
        break;
View Full Code Here

    handleKill(activeChar, null);
  }

  private void handleKill(L2PcInstance activeChar, String player)
  {
    L2Object obj = activeChar.getTarget();
    L2Character target = (L2Character) obj;
    String filename = "main_menu.htm";

    if(player != null)
    {
View Full Code Here

  }

  private void setEnchant(L2PcInstance activeChar, int ench, int armorType)
  {
    // get the target
    L2Object target = activeChar.getTarget();
    if(target == null)
    {
      target = activeChar;
    }
View Full Code Here

    handleRes(activeChar, null);
  }

  private void handleRes(L2PcInstance activeChar, String resParam)
  {
    L2Object obj = activeChar.getTarget();

    if(resParam != null)
    {
      // Check if a player name was specified as a param.
      L2PcInstance plyr = L2World.getInstance().getPlayer(resParam);

      if(plyr != null)
      {
        obj = plyr;
      }
      else
      {
        // Otherwise, check if the param was a radius.
        try
        {
          int radius = Integer.parseInt(resParam);

          for(L2PcInstance knownPlayer : activeChar.getKnownList().getKnownPlayersInRadius(radius))
          {
            doResurrect(knownPlayer);
          }

          activeChar.sendMessage("Resurrected all players within a " + radius + " unit radius.");
          return;
        }
        catch(NumberFormatException e)
        {
          if(Config.ENABLE_ALL_EXCEPTIONS)
            e.printStackTrace();
         
          activeChar.sendMessage("Enter a valid player name or radius.");
          return;
        }
      }

      plyr = null;
    }

    if(obj == null)
    {
      obj = activeChar;
    }

    if(obj instanceof L2ControllableMobInstance)
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }

    doResurrect((L2Character) obj);

    if(Config.DEBUG)
    {
      _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") resurrected character " + obj.getObjectId());
    }

    obj = null;
  }
View Full Code Here

    handleNonPlayerRes(activeChar, "");
  }

  private void handleNonPlayerRes(L2PcInstance activeChar, String radiusStr)
  {
    L2Object obj = activeChar.getTarget();

    try
    {
      int radius = 0;
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.L2Object

Copyright © 2018 www.massapicom. 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.