Package lineage2.gameserver.model.items.etcitems

Examples of lineage2.gameserver.model.items.etcitems.AppearanceStone


   * @param killer Creature
   */
  @Override
  protected void onEvtDead(Creature killer)
  {
    final NpcInstance actor = getActor();
    boolean isOverhit = false;
    if (actor instanceof MonsterInstance)
    {
      isOverhit = ((MonsterInstance) actor).getOverhitDamage() > 0;
    }
    final int npcId = actor.getNpcId();
    int nextId = 0;
    int type = 0;
    if ((npcId != getNextDoppler(npcId)) && (npcId != getNextVoid(npcId)))
    {
      type = 1;
      if (isOverhit)
      {
        if (Rnd.chance(70))
        {
          nextId = getNextDoppler(npcId);
        }
        else if (Rnd.chance(80))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(65))
      {
        nextId = getNextDoppler(npcId);
      }
    }
    else if (npcId == getNextDoppler(npcId))
    {
      type = 2;
      if (isOverhit)
      {
        if (Rnd.chance(60))
        {
          nextId = getNextDoppler(npcId);
        }
        else if (Rnd.chance(90))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(40))
      {
        nextId = getNextDoppler(npcId);
      }
      else if (Rnd.chance(50))
      {
        nextId = getNextVoid(npcId);
      }
    }
    else if (npcId == getNextVoid(npcId))
    {
      type = 3;
      if (isOverhit)
      {
        if (Rnd.chance(80))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(50))
      {
        nextId = getNextVoid(npcId);
      }
    }
    final Reflection r = actor.getReflection();
    boolean spawnPossible = true;
    if (r instanceof KamalokaNightmare)
    {
      final KamalokaNightmare kama = (KamalokaNightmare) r;
      kama.addKilledKanabion(type);
View Full Code Here


      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      return;
    }

    AppearanceStone appearanceStone = EnchantItemHolder.getInstance().getAppearanceStone(stone.getItemId());
    if(appearanceStone == null)
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      return;
    }

    if(appearanceStone.getType() != ShapeType.RESTORE && targetItem.getVisualId() > 0 || appearanceStone.getType() == ShapeType.RESTORE && targetItem.getVisualId() == 0)
    {
      player.sendPacket(ExPutShapeShiftingTargetItemResult.FAIL);
      return;
    }

    if(!targetItem.isOther() && targetItem.getTemplate().getItemGrade() == Grade.NONE)
    {
      player.sendPacket(SystemMsg.YOU_CANNOT_MODIFY_OR_RESTORE_NOGRADE_ITEMS);
      return;
    }

    Grade[] stoneGrades = appearanceStone.getGrades();
    if(stoneGrades != null && stoneGrades.length > 0)
    {
      if(!ArrayUtils.contains(stoneGrades, targetItem.getTemplate().getItemGrade()))
      {
        player.sendPacket(SystemMsg.ITEM_GRADES_DO_NOT_MATCH);
        return;
      }
    }

    ShapeTargetType[] targetTypes = appearanceStone.getTargetTypes();
    if(targetTypes == null || targetTypes.length == 0)
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      return;
    }

    if(!ArrayUtils.contains(targetTypes, ShapeTargetType.ALL))
    {
      if(targetItem.isWeapon())
      {
        if(!ArrayUtils.contains(targetTypes, ShapeTargetType.WEAPON))
        {
          player.sendPacket(SystemMsg.WEAPONS_ONLY);
          return;
        }
      }
      else if(targetItem.isArmor())
      {
        if(!ArrayUtils.contains(targetTypes, ShapeTargetType.ARMOR))
        {
          player.sendPacket(SystemMsg.ARMOR_ONLY);
          return;
        }
      }
      else
      {
        if(!ArrayUtils.contains(targetTypes, ShapeTargetType.ACCESSORY))
        {
          player.sendPacket(SystemMsg.THIS_ITEM_DOES_NOT_MEET_REQUIREMENTS);
          return;
        }
      }
    }

    ExItemType[] itemTypes = appearanceStone.getItemTypes();
    if(itemTypes != null && itemTypes.length > 0)
    {
      if(!ArrayUtils.contains(itemTypes, targetItem.getExItemType()))
      {
        player.sendPacket(SystemMsg.THIS_ITEM_DOES_NOT_MEET_REQUIREMENTS);
        return;
      }
    }

    if(targetItem.getOwnerId() != player.getObjectId())
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      return;
    }

    player.sendPacket(new ExPutShapeShiftingTargetItemResult(ExPutShapeShiftingTargetItemResult.SUCCESS_RESULT, appearanceStone.getCost()));
  }
View Full Code Here

      for(int i = 0; i < itemTypesStr.length; i++)
      {
        itemTypes[i] = ExItemType.valueOf(itemTypesStr[i].toUpperCase());
      }

      getHolder().addAppearanceStone(new AppearanceStone(itemId, targetTypes, type, grades, cost, extractItemId, itemTypes));
    }
  }
View Full Code Here

      player.setAppearanceStone(null);
      player.setAppearanceExtractItem(null);
      return;
    }

    AppearanceStone appearanceStone = EnchantItemHolder.getInstance().getAppearanceStone(stone.getItemId());
    if(appearanceStone == null)
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      player.setAppearanceExtractItem(null);
      return;
    }

    if(appearanceStone.getType() != ShapeType.RESTORE && targetItem.getVisualId() > 0 || appearanceStone.getType() == ShapeType.RESTORE && targetItem.getVisualId() == 0)
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      player.setAppearanceExtractItem(null);
      return;
    }

    if(!targetItem.isOther() && targetItem.getTemplate().getItemGrade() == Grade.NONE)
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      player.setAppearanceExtractItem(null);
      return;
    }

    Grade[] stoneGrades = appearanceStone.getGrades();
    if(stoneGrades != null && stoneGrades.length > 0)
    {
      if(!ArrayUtils.contains(stoneGrades, targetItem.getTemplate().getItemGrade()))
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }
    }

    ShapeTargetType[] targetTypes = appearanceStone.getTargetTypes();
    if(targetTypes == null || targetTypes.length == 0)
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      player.setAppearanceExtractItem(null);
      return;
    }

    if(!ArrayUtils.contains(targetTypes, ShapeTargetType.ALL))
    {
      if(targetItem.isWeapon())
      {
        if(!ArrayUtils.contains(targetTypes, ShapeTargetType.WEAPON))
        {
          player.sendPacket(ExShapeShiftingResult.FAIL);
          player.setAppearanceStone(null);
          player.setAppearanceExtractItem(null);
          return;
        }
      }
      else if(targetItem.isArmor())
      {
        if(!ArrayUtils.contains(targetTypes, ShapeTargetType.ARMOR))
        {
          player.sendPacket(ExShapeShiftingResult.FAIL);
          player.setAppearanceStone(null);
          player.setAppearanceExtractItem(null);
          return;
        }
      }
      else
      {
        if(!ArrayUtils.contains(targetTypes, ShapeTargetType.ACCESSORY))
        {
          player.sendPacket(ExShapeShiftingResult.FAIL);
          player.setAppearanceStone(null);
          player.setAppearanceExtractItem(null);
          return;
        }
      }
    }

    ExItemType[] itemTypes = appearanceStone.getItemTypes();
    if(itemTypes != null && itemTypes.length > 0)
    {
      if(!ArrayUtils.contains(itemTypes, targetItem.getExItemType()))
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }
    }

    ItemInstance extracItem = player.getAppearanceExtractItem();
    int extracItemId = 0;
    if(appearanceStone.getType() != ShapeType.RESTORE && appearanceStone.getType() != ShapeType.FIXED)
    {
      if(extracItem == null)
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }

      if(!extracItem.canBeAppearance())
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }

      if(extracItem.getLocation() != ItemInstance.ItemLocation.INVENTORY && extracItem.getLocation() != ItemInstance.ItemLocation.PAPERDOLL)
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }

      /*if(!extracItem.isOther() && extracItem.getGrade() == ItemGrade.NONE)
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }*/

      if(!extracItem.isOther() && targetItem.getTemplate().getItemGrade().ordinal() <= extracItem.getTemplate().getItemGrade().ordinal())
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }

      if(extracItem.getVisualId() > 0)
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }

      if(targetItem.getExItemType() != extracItem.getExItemType())
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }

      if(extracItem.getOwnerId() != player.getObjectId())
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }
      extracItemId = extracItem.getItemId();
    }

    if(targetItem.getOwnerId() != player.getObjectId())
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      player.setAppearanceExtractItem(null);
      return;
    }

    inventory.writeLock();
    try
    {
      long cost = appearanceStone.getCost();
      if(cost > player.getAdena())
      {
        player.sendPacket(SystemMsg.YOU_CANNOT_MODIFY_AS_YOU_DO_NOT_HAVE_ENOUGH_ADENA);
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }

      if(stone.getCount() < 1L)
      {
        player.sendPacket(ExShapeShiftingResult.FAIL);
        player.setAppearanceStone(null);
        player.setAppearanceExtractItem(null);
        return;
      }

      if(appearanceStone.getType() == ShapeType.NORMAL)
      {
        if(!inventory.destroyItem(extracItem, 1L))
        {
          player.sendPacket(ExShapeShiftingResult.FAIL);
          player.setAppearanceStone(null);
          player.setAppearanceExtractItem(null);
          return;
        }
      }

      inventory.destroyItem(stone, 1L);
      player.reduceAdena(cost);

      boolean equipped = false;
      if(equipped = targetItem.isEquipped())
      {
        inventory.isRefresh = true;
        inventory.unEquipItem(targetItem);
      }

      switch(appearanceStone.getType())
      {
        case RESTORE:
          targetItem.setVisualId(0);
          break;
        case NORMAL:
          targetItem.setVisualId(extracItem.getItemId());
          break;
        case BLESSED:
          targetItem.setVisualId(extracItem.getItemId());
          break;
        case FIXED:
          targetItem.setVisualId(appearanceStone.getExtractItemId());
          break;
        default:
          break;
      }

View Full Code Here

      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      return;
    }

    AppearanceStone appearanceStone = EnchantItemHolder.getInstance().getAppearanceStone(stone.getItemId());
    if(appearanceStone == null)
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      player.setAppearanceStone(null);
      return;
    }

    if(appearanceStone.getType() == ShapeType.RESTORE || appearanceStone.getType() == ShapeType.FIXED)
    {
      player.sendPacket(ExShapeShiftingResult.FAIL);
      return;
    }
View Full Code Here

      Player player = cha.getPlayer();
     
      QuestState qs = player.getQuestState(_10301_ShadowOfTerrorBlackishRedFog.class);
      if(qs != null && qs.getCond() == 3 && player.getVar("instance10301") == null)
      {
        Quest q = QuestManager.getQuest(10301);
        player.processQuestEvent(q.getName(), "enterInstance", null);
        //player.setVar("instance10301", "true", -1);
        return;
      }
      if (!player.getVarB("@25_20_telzone_to_magmeld"))
      {
View Full Code Here

    {
      htmltext = "32640-10.htm";
    }
    else if (id == CREATED)
    {
      QuestState ImTheOnlyOneYouCanTrust = st.getPlayer().getQuestState(_240_ImTheOnlyOneYouCanTrust.class);
      if ((st.getPlayer().getLevel() >= 81) && (ImTheOnlyOneYouCanTrust != null) && ImTheOnlyOneYouCanTrust.isCompleted())
      {
        htmltext = "32640-1.htm";
      }
      else
      {
View Full Code Here

      {
        return;
      }
      Player player = cha.getPlayer();
     
      QuestState qs = player.getQuestState(_10301_ShadowOfTerrorBlackishRedFog.class);
      if(qs != null && qs.getCond() == 3 && player.getVar("instance10301") == null)
      {
        Quest q = QuestManager.getQuest(10301);
        player.processQuestEvent(q.getName(), "enterInstance", null);
        //player.setVar("instance10301", "true", -1);
        return;
View Full Code Here

      if (cha.isPlayer())
      {
        Player player = cha.getPlayer();
        if (!player.getVarB("@ti_present_video"))
        {
          QuestState qs = player.getQuestState(_10320_LetsGototheCentralSquare.class);
          if ((qs != null) && (qs.getCond() == 1))
          {
            player.showQuestMovie(SceneMovie.si_illusion_02_que);
          }
          else
          {
View Full Code Here

      Class.forName(GarbageCollector.class.getName());
    }
    Shutdown.getInstance().schedule(Config.RESTART_AT_TIME, Shutdown.RESTART);
    _log.info("GameServer Started");
    _log.info("Maximum Numbers of Connected Players: " + Config.MAXIMUM_ONLINE_USERS);
    GamePacketHandler gph = new GamePacketHandler();
    InetAddress serverAddr = Config.GAMESERVER_HOSTNAME.equalsIgnoreCase("*") ? null : InetAddress.getByName(Config.GAMESERVER_HOSTNAME);
    _selectorThreads = new SelectorThread[Config.PORTS_GAME.length];
    for (int i = 0; i < Config.PORTS_GAME.length; i++)
    {
      _selectorThreads[i] = new SelectorThread<>(Config.SELECTOR_CONFIG, gph, gph, gph, null);
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.items.etcitems.AppearanceStone

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.