Package net.sf.l2j.gameserver.model.actor.instance

Examples of net.sf.l2j.gameserver.model.actor.instance.L2PcInstance


   void regardTeam(L2PcInstance activeChar, int team, int n, int id, String type){
       LinkedList<String> linked = L2Event.players.get(team);
       int temp = n;
       Iterator<String> it = linked.iterator();
       while(it.hasNext()){
          try{ L2PcInstance target = L2World.getInstance().getPlayer(it.next().toString());
           if(type.equalsIgnoreCase("level")) temp = n * target.getLevel();
           else if(type.equalsIgnoreCase("kills")) temp = n * target.kills.size();
           else temp = n;
           createItem(activeChar, target, id, temp);}catch(Exception e){}
       }

View Full Code Here


       resTeam(team);
       unpolyTeam(team);
       LinkedList<String> linked = L2Event.players.get(team);
       Iterator<String> it = linked.iterator();
       while(it.hasNext()){
         try{ L2PcInstance target = L2World.getInstance().getPlayer(it.next().toString());
          target.setTitle(target.eventTitle);
          target.setKarma(target.eventkarma);
          target.setPvpKills(target.eventpvpkills);
          target.setPkKills(target.eventpkkills);
          target.teleToLocation(target.eventX, target.eventY, target.eventZ, true);
          target.kills.clear();
          target.eventSitForced = false;
          target.atEvent = false;}catch(Exception e){}
       }
   }
View Full Code Here

                  if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss)
                    // doesn't affect siege golem or wild hog cannon
                    && !(target instanceof L2SiegeSummonInstance)
                    )
                  {
                    L2PcInstance summonOwner = null;
                    L2Summon summonPet = null;
                    summonOwner = ((L2Summon)target).getOwner();
                    summonPet = summonOwner.getPet();
                    summonPet.unSummon(summonOwner);
                        SystemMessage sm = new SystemMessage(SystemMessageId.LETHAL_STRIKE);
                summonOwner.sendPacket(sm);
                  }
                  else
                    {
                        if (activeChar instanceof L2PcInstance)
                        {
View Full Code Here

 
  @Override
  protected
  void runImpl()
  {
    L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null)
      return;
    else if (activeChar.isAttackingNow() && activeChar.getActiveWeaponItem() != null && (activeChar.getActiveWeaponItem().getItemType() == L2WeaponType.BOW))
    {
      activeChar.sendPacket(new ActionFailed());
    }
    else
    {
      if(!activeChar.isInBoat())
      {
        activeChar.setInBoat(true);
      }
      L2BoatInstance boat = BoatManager.getInstance().GetBoat(_boatId);
      activeChar.setBoat(boat);
      activeChar.setInBoatPosition(_pos);
      activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO_IN_A_BOAT, new L2CharPosition(_pos.getX(),_pos.getY(), _pos.getZ(), 0), new L2CharPosition(_origin_pos.getX(),_origin_pos.getY(),_origin_pos.getZ(), 0));
    }
  }
View Full Code Here

  }

  @Override
  protected void runImpl()
  {
    L2PcInstance player = getClient().getActiveChar();
    FastList<String> manorsName = new FastList<String>();
    manorsName.add("gludio");
    manorsName.add("dion");
    manorsName.add("giran");
    manorsName.add("oren");
    manorsName.add("aden");
    manorsName.add("innadril");
    manorsName.add("goddard");
    manorsName.add("rune");
    manorsName.add("schuttgart");
    ExSendManorList manorlist = new ExSendManorList(manorsName);
    player.sendPacket(manorlist);

  }
View Full Code Here

      removeCirclet(member, castleId);
  }
  public void removeCirclet(L2ClanMember member, int castleId)
  {
    if (member == null) return;
    L2PcInstance player = member.getPlayerInstance();
    int circletId = getCircletByCastleId(castleId);

    if (circletId != 0)
    {
      // online-player circlet removal
      if (player != null)
      {
        try
        {
          L2ItemInstance circlet = player.getInventory().getItemByItemId(circletId);
          if (circlet != null)
          {
            if (circlet.isEquipped())
              player.getInventory().unEquipItemInSlotAndRecord(circlet.getEquipSlot());
            player.destroyItemByItemId("CastleCircletRemoval", circletId, 1, player, true);
          }
          return;
        } catch (NullPointerException e)
        {
          // continue removing offline
View Full Code Here

  @Override
  public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  {
    if (!(playable instanceof L2PcInstance))
      return;
    L2PcInstance activeChar = (L2PcInstance)playable;
        L2RecipeList rp = RecipeController.getInstance().getRecipeByItemId(item.getItemId());
       if (activeChar.hasRecipeList(rp.getId()))
        {
         SystemMessage sm = new SystemMessage(SystemMessageId.RECIPE_ALREADY_REGISTERED);
          activeChar.sendPacket(sm);
        }
        else
        {
          if (rp.isDwarvenRecipe())
          {
            if (activeChar.hasDwarvenCraft())
            {
          if (rp.getLevel()>activeChar.getDwarvenCraft())
          {
        //can't add recipe, becouse create item level too low
              SystemMessage sm = new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER);
              activeChar.sendPacket(sm);
          }
          else if (activeChar.getDwarvenRecipeBook().length >= activeChar.GetDwarfRecipeLimit())
        {
          //Up to $s1 recipes can be registered.
          SystemMessage sm = new SystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER);
          sm.addNumber(activeChar.GetDwarfRecipeLimit());
              activeChar.sendPacket(sm);
        }
        else
          {
              activeChar.registerDwarvenRecipeList(rp);
              activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
              sm.addString("Added recipe \"" + rp.getRecipeName() + "\" to Dwarven RecipeBook");
              activeChar.sendPacket(sm);
          }
            }
            else
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT);
              activeChar.sendPacket(sm);
            }
          }
          else
          {
            if (activeChar.hasCommonCraft())
            {
          if (rp.getLevel()>activeChar.getCommonCraft())
          {
        //can't add recipe, becouse create item level too low
              SystemMessage sm = new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER);
              activeChar.sendPacket(sm);
          }
          else if (activeChar.getCommonRecipeBook().length >= activeChar.GetCommonRecipeLimit())
        {
          //Up to $s1 recipes can be registered.
          SystemMessage sm = new SystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER);
          sm.addNumber(activeChar.GetCommonRecipeLimit());
              activeChar.sendPacket(sm);
        }
        else
          {
              activeChar.registerCommonRecipeList(rp);
              activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
              sm.addString("Added recipe \"" + rp.getRecipeName() + "\" to Common RecipeBook");
              activeChar.sendPacket(sm);
          }
            }
            else
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT);
              activeChar.sendPacket(sm);
            }
          }
        }
    }
View Full Code Here

    }
   
    @Override
  protected void runImpl()
    {
      L2PcInstance activeChar = getClient().getActiveChar();
        L2Clan clan = activeChar.getClan();
        if (clan == null) return;

        if((activeChar.getClanPrivileges() & L2Clan.CP_CL_MASTER_RIGHTS) != L2Clan.CP_CL_MASTER_RIGHTS)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_DISMISS_AN_APPRENTICE));
          return;
        }

        L2ClanMember currentMember = clan.getClanMember(_currPlayerName);
        L2ClanMember targetMember = clan.getClanMember(_targetPlayerName);
        if (currentMember == null || targetMember == null) return;

        L2ClanMember apprenticeMember, sponsorMember;
        if (currentMember.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
        {
          apprenticeMember = currentMember;
          sponsorMember = targetMember;
        }
        else
        {
          apprenticeMember = targetMember;
          sponsorMember = currentMember;
        }

        L2PcInstance apprentice = apprenticeMember.getPlayerInstance();
        L2PcInstance sponsor = sponsorMember.getPlayerInstance();

        SystemMessage sm = null;
        if(_set == 0)
        {
          // test: do we get the current sponsor & apprentice from this packet or no?
          if (apprentice != null) apprentice.setSponsor(0);
          else // offline
            apprenticeMember.initApprenticeAndSponsor(0, 0);

          if (sponsor != null) sponsor.setApprentice(0);
          else // offline
            sponsorMember.initApprenticeAndSponsor(0, 0);

          apprenticeMember.saveApprenticeAndSponsor(0, 0);
          sponsorMember.saveApprenticeAndSponsor(0, 0);

          sm = new SystemMessage(SystemMessageId.S2_CLAN_MEMBER_S1_S_APPRENTICE_HAS_BEEN_REMOVED);
        }
        else
        {
          if (apprenticeMember.getSponsor() != 0 || sponsorMember.getApprentice() != 0
              || apprenticeMember.getApprentice() != 0 || sponsorMember.getSponsor() != 0)
          {
            activeChar.sendMessage("Remove previous connections first.");
            return;
          }
          if (apprentice != null)
            apprentice.setSponsor(sponsorMember.getObjectId());
          else // offline
            apprenticeMember.initApprenticeAndSponsor(0, sponsorMember.getObjectId());

          if (sponsor != null)
            sponsor.setApprentice(apprenticeMember.getObjectId());
          else // offline
            sponsorMember.initApprenticeAndSponsor(apprenticeMember.getObjectId(), 0);

          // saving to database even if online, since both must match
          apprenticeMember.saveApprenticeAndSponsor(0, sponsorMember.getObjectId());
          sponsorMember.saveApprenticeAndSponsor(apprenticeMember.getObjectId(), 0);

          sm = new SystemMessage(SystemMessageId.S2_HAS_BEEN_DESIGNATED_AS_APPRENTICE_OF_CLAN_MEMBER_S1);
        }
        sm.addString(sponsorMember.getName());
      sm.addString(apprenticeMember.getName());
      if (sponsor != activeChar && sponsor != apprentice) activeChar.sendPacket(sm);
      if (sponsor != null) sponsor.sendPacket(sm);
      if (apprentice != null) apprentice.sendPacket(sm);
    }
View Full Code Here

  }

  @Override
  protected void runImpl()
  {
    L2PcInstance activeChar = getClient().getActiveChar();
    if(activeChar == null)
      return;
        L2BoatInstance boat = BoatManager.getInstance().GetBoat(_id);
        GetOffVehicle Gon = new GetOffVehicle(activeChar,boat,_x,_y,_z);
        activeChar.broadcastPacket(Gon);
  }
View Full Code Here

  @Override
  public synchronized void useItem(L2PlayableInstance playable, L2ItemInstance item)
  {
        if (!(playable instanceof L2PcInstance)) return;

        L2PcInstance activeChar = (L2PcInstance)playable;
        L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
        L2Weapon weaponItem = activeChar.getActiveWeaponItem();
        int itemId = item.getItemId();

        if (activeChar.isInOlympiadMode()){
          SystemMessage sm = new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
      sm.addString(item.getItemName());
      activeChar.sendPacket(sm);
      sm = null;
          return;
        }

        // Check if Blessed Spiritshot can be used
        if (weaponInst == null || weaponItem.getSpiritShotCount() == 0)
        {
            if(!activeChar.getAutoSoulShot().containsKey(itemId))
                activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
            return;
        }

        // Check if Blessed Spiritshot is already active (it can be charged over Spiritshot)
        if (weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE) return;

        // Check for correct grade
        int weaponGrade = weaponItem.getCrystalType();
    if ((weaponGrade == L2Item.CRYSTAL_NONE && itemId != 3947) ||
        (weaponGrade == L2Item.CRYSTAL_D && itemId != 3948) ||
        (weaponGrade == L2Item.CRYSTAL_C && itemId != 3949) ||
        (weaponGrade == L2Item.CRYSTAL_B && itemId != 3950) ||
        (weaponGrade == L2Item.CRYSTAL_A && itemId != 3951) ||
        (weaponGrade == L2Item.CRYSTAL_S && itemId != 3952))
        {
            if(!activeChar.getAutoSoulShot().containsKey(itemId))
                activeChar.sendPacket(new SystemMessage(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH));
            return;
        }

        // Consume Blessed Spiritshot if player has enough of them
        if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false))
        {
            if(activeChar.getAutoSoulShot().containsKey(itemId))
            {
                activeChar.removeAutoSoulShot(itemId);
                activeChar.sendPacket(new ExAutoSoulShot(itemId, 0));

                SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
                sm.addString(item.getItem().getName());
                activeChar.sendPacket(sm);
            }
            else activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS));
            return;
        }

        // Charge Blessed Spiritshot
        weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT);

        // Send message to client
        activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SPIRITSHOT));
        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
  }
 
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.actor.instance.L2PcInstance

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.