Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.CursedWeapon


                        NamedNodeMap attrs = d.getAttributes();
                          int id = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
                          int skillId = Integer.parseInt(attrs.getNamedItem("skillId").getNodeValue());
                          String name = attrs.getNamedItem("name").getNodeValue();

                          CursedWeapon cw = new CursedWeapon(id, skillId, name);

                          int val;
                            for (Node cd=d.getFirstChild(); cd != null; cd = cd.getNextSibling())
                            {
                                if ("dropRate".equalsIgnoreCase(cd.getNodeName()))
                                {
                                attrs = cd.getAttributes();
                                val = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
                                cw.setDropRate(val);
                                } else if ("duration".equalsIgnoreCase(cd.getNodeName()))
                                {
                                attrs = cd.getAttributes();
                                val = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
                                cw.setDuration(val);
                                } else if ("durationLost".equalsIgnoreCase(cd.getNodeName()))
                                {
                                attrs = cd.getAttributes();
                                val = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
                                cw.setDurationLost(val);
                                } else if ("disapearChance".equalsIgnoreCase(cd.getNodeName()))
                                {
                                attrs = cd.getAttributes();
                                val = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
                                cw.setDisapearChance(val);
                                } else if ("stageKills".equalsIgnoreCase(cd.getNodeName()))
                                {
                                attrs = cd.getAttributes();
                                val = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
                                cw.setStageKills(val);
                                }
                            }

                            // Store cursed weapon
                            _cursedWeapons.put(id, cw);
View Full Code Here


        int playerKarma   = rset.getInt("playerKarma");
        int playerPkKills = rset.getInt("playerPkKills");
        int nbKills       = rset.getInt("nbKills");
        long endTime      = rset.getLong("endTime");

        CursedWeapon cw = _cursedWeapons.get(itemId);
        cw.setPlayerId(playerId);
        cw.setPlayerKarma(playerKarma);
        cw.setPlayerPkKills(playerPkKills);
        cw.setNbKills(nbKills);
        cw.setEndTime(endTime);
        cw.reActivate();
      }

      rset.close();
      statement.close();
View Full Code Here

    }
  }

  public void activate(L2PcInstance player, L2ItemInstance item)
  {
    CursedWeapon cw = _cursedWeapons.get(item.getItemId());
    if (player.isCursedWeaponEquiped()) // cannot own 2 cursed swords
    {
      CursedWeapon cw2 = _cursedWeapons.get(player.getCursedWeaponEquipedId());
      /* TODO: give the bonus level in a more appropriate manner.
       *  The following code adds "_stageKills" levels.  This will also show in the char status.
       * I do not have enough info to know if the bonus should be shown in the pk count, or if it
       * should be a full "_stageKills" bonus or just the remaining from the current count till the
       * of the current stage...
       * This code is a TEMP fix, so that the cursed weapon's bonus level can be observed with as
       * little change in the code as possible, until proper info arises.
       */
      cw2.setNbKills(cw2.getStageKills()-1);
      cw2.increaseKills();

      // erase the newly obtained cursed weapon
      cw.setPlayer(player)// NECESSARY in order to find which inventory the weapon is in!
      cw.endOfLife();        // expire the weapon and clean up.
    }
View Full Code Here

    else cw.activate(player, item);
  }

  public void drop(int itemId, L2Character killer)
  {
    CursedWeapon cw = _cursedWeapons.get(itemId);

    cw.dropIt(killer);
  }
View Full Code Here

    cw.dropIt(killer);
  }

  public void increaseKills(int itemId)
  {
    CursedWeapon cw = _cursedWeapons.get(itemId);

    cw.increaseKills();
  }
View Full Code Here

    cw.increaseKills();
  }

  public int getLevel(int itemId)
  {
    CursedWeapon cw = _cursedWeapons.get(itemId);

    return cw.getLevel();
  }
View Full Code Here

    {
      cwm.reload();
    }
    else
    {
      CursedWeapon cw=null;
      try
      {
        String parameter = st.nextToken();
        if (parameter.matches("[0-9]*"))
          id = Integer.parseInt(parameter);
        else
        {
          parameter = parameter.replace('_', ' ');
          for (CursedWeapon cwp : cwm.getCursedWeapons())
          {
            if (cwp.getName().toLowerCase().contains(parameter.toLowerCase()))
            {
              id=cwp.getItemId();
              break;
            }
          }
        }
        cw = cwm.getCursedWeapon(id);
        if (cw==null)
        {
          activeChar.sendMessage("Unknown cursed weapon ID.");
          return false;
        }
      }
      catch (Exception e)
      {
        activeChar.sendMessage("Usage: //cw_remove|//cw_goto|//cw_add <itemid|name>");
      }

      if (command.startsWith("admin_cw_remove "))
      {
        cw.endOfLife();
      }
      else if (command.startsWith("admin_cw_goto "))
      {
        cw.goTo(activeChar);
      }
      else if (command.startsWith("admin_cw_add"))
      {
        if (cw==null)
        {
          activeChar.sendMessage("Usage: //cw_add <itemid|name>");
          return false;
        }
        else if (cw.isActive())
          activeChar.sendMessage("This cursed weapon is already active.");
        else
        {
          L2Object target = activeChar.getTarget();
          if (target != null && target instanceof L2PcInstance)
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.CursedWeapon

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.