Package lineage2.gameserver.model

Examples of lineage2.gameserver.model.GameObject


   * Method showTeleportCharWindow.
   * @param activeChar Player
   */
  private void showTeleportCharWindow(Player activeChar)
  {
    GameObject target = activeChar.getTarget();
    Player player = null;
    if (target.isPlayer())
    {
      player = (Player) target;
    }
    else
    {
View Full Code Here


   * @param activeChar Player
   * @param Cords String
   */
  private void teleportCharacter(Player activeChar, String Cords)
  {
    GameObject target = activeChar.getTarget();
    if ((target == null) || !target.isPlayer())
    {
      activeChar.sendPacket(Msg.INVALID_TARGET);
      return;
    }
    if (target.getObjectId() == activeChar.getObjectId())
    {
      activeChar.sendMessage("You cannot teleport yourself.");
      return;
    }
    teleportTo(activeChar, (Player) target, Cords, activeChar.getReflectionId());
View Full Code Here

   * Method recallNPC.
   * @param activeChar Player
   */
  private void recallNPC(Player activeChar)
  {
    GameObject obj = activeChar.getTarget();
    if ((obj != null) && obj.isNpc())
    {
      obj.setLoc(activeChar.getLoc());
      ((NpcInstance) obj).broadcastCharInfo();
      activeChar.sendMessage("You teleported npc " + obj.getName() + " to " + activeChar.getLoc().toString() + ".");
    }
    else
    {
      activeChar.sendMessage("Target is't npc.");
    }
View Full Code Here

   * @return boolean
   */
  @Override
  protected boolean useItemImpl(Player player, ItemInstance item, boolean ctrl)
  {
    final GameObject target = player.getTarget();
    if ((target == null) || !target.isMonster())
    {
      player.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
      return false;
    }
    final MonsterInstance monster = (MonsterInstance) player.getTarget();
View Full Code Here

            reloadQuestStates(p);
          }
        }
        else
        {
          GameObject t = activeChar.getTarget();
          if ((t != null) && t.isPlayer())
          {
            Player p = (Player) t;
            reloadQuestStates(p);
          }
          else
View Full Code Here

    Commands command = (Commands) comm;
    if (!activeChar.getPlayerAccess().CanPolymorph)
    {
      return false;
    }
    GameObject target = activeChar.getTarget();
    switch (command)
    {
      case admin_polyself:
        target = activeChar;
      case admin_polymorph:
      case admin_poly:
        if ((target == null) || !target.isPlayer())
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
          return false;
        }
        try
        {
          int id = Integer.parseInt(wordList[1]);
          if (NpcHolder.getInstance().getTemplate(id) != null)
          {
            ((Player) target).setPolyId(id);
            ((Player) target).broadcastCharInfo();
          }
        }
        catch (Exception e)
        {
          activeChar.sendMessage("USAGE: //poly id [type:npc|item]");
          return false;
        }
        break;
      case admin_unpolyself:
        target = activeChar;
      case admin_unpolymorph:
      case admin_unpoly:
        if ((target == null) || !target.isPlayer())
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
          return false;
        }
        ((Player) target).setPolyId(0);
View Full Code Here

      case admin_disconnect:
      case admin_kick:
        final Player player;
        if (wordList.length == 1)
        {
          GameObject target = activeChar.getTarget();
          if (target == null)
          {
            activeChar.sendMessage("Select character or specify player name.");
            break;
          }
          if (!target.isPlayer())
          {
            activeChar.sendPacket(Msg.INVALID_TARGET);
            break;
          }
          player = (Player) target;
View Full Code Here

          {
            Functions.sendDebugMessage(activeChar, "USAGE: //setnpcstate state");
            return false;
          }
          int state;
          GameObject target = activeChar.getTarget();
          try
          {
            state = Integer.parseInt(wordList[1]);
          }
          catch (NumberFormatException e)
          {
            Functions.sendDebugMessage(activeChar, "You must specify state");
            return false;
          }
          if (!target.isNpc())
          {
            Functions.sendDebugMessage(activeChar, "You must target an NPC");
            return false;
          }
          NpcInstance npc = (NpcInstance) target;
          npc.setNpcState(state);
          break;
        case admin_setareanpcstate:
          try
          {
            final String val = fullString.substring(15).trim();
            String[] vals = val.split(" ");
            int range = NumberUtils.toInt(vals[0], 0);
            int astate = vals.length > 1 ? NumberUtils.toInt(vals[1], 0) : 0;
            for (NpcInstance n : activeChar.getAroundNpc(range, 200))
            {
              n.setNpcState(astate);
            }
          }
          catch (Exception e)
          {
            Functions.sendDebugMessage(activeChar, "Usage: //setareanpcstate [range] [state]");
          }
          break;
        case admin_showmovie:
          if (wordList.length < 2)
          {
            Functions.sendDebugMessage(activeChar, "USAGE: //showmovie id");
            return false;
          }
          int id;
          try
          {
            id = Integer.parseInt(wordList[1]);
          }
          catch (NumberFormatException e)
          {
            Functions.sendDebugMessage(activeChar, "You must specify id");
            return false;
          }
          activeChar.showQuestMovie(id);
          break;
        case admin_setzoneinfo:
          if (wordList.length < 2)
          {
            Functions.sendDebugMessage(activeChar, "USAGE: //setzoneinfo id");
            return false;
          }
          int stateid;
          try
          {
            stateid = Integer.parseInt(wordList[1]);
          }
          catch (NumberFormatException e)
          {
            Functions.sendDebugMessage(activeChar, "You must specify id");
            return false;
          }
          activeChar.broadcastPacket(new ExChangeClientEffectInfo(stateid));
          break;
        case admin_eventtrigger:
          if (wordList.length < 2)
          {
            Functions.sendDebugMessage(activeChar, "USAGE: //eventtrigger id");
            return false;
          }
          int triggerid;
          try
          {
            triggerid = Integer.parseInt(wordList[1]);
          }
          catch (NumberFormatException e)
          {
            Functions.sendDebugMessage(activeChar, "You must specify id");
            return false;
          }
          activeChar.broadcastPacket(new EventTrigger(triggerid, true));
          break;
        case admin_debug:
          GameObject ob = activeChar.getTarget();
          if (!ob.isPlayer())
          {
            Functions.sendDebugMessage(activeChar, "Only player target is allowed");
            return false;
          }
          Player pl = ob.getPlayer();
          List<String> _s = new ArrayList<>();
          _s.add("==========TARGET STATS:");
          _s.add("==Magic Resist: " + pl.calcStat(Stats.MAGIC_RESIST, null, null));
          _s.add("==Magic Power: " + pl.calcStat(Stats.MAGIC_POWER, 1, null, null));
          _s.add("==Skill Power: " + pl.calcStat(Stats.SKILL_POWER, 1, null, null));
          _s.add("==Cast Break Rate: " + pl.calcStat(Stats.CAST_INTERRUPT, 1, null, null));
          _s.add("==========Powers:");
          _s.add("==Bleed: " + pl.calcStat(Stats.BLEED_POWER, 1, null, null));
          _s.add("==Poison: " + pl.calcStat(Stats.POISON_POWER, 1, null, null));
          _s.add("==Stun: " + pl.calcStat(Stats.STUN_POWER, 1, null, null));
          _s.add("==Root: " + pl.calcStat(Stats.ROOT_POWER, 1, null, null));
          _s.add("==Mental: " + pl.calcStat(Stats.MENTAL_POWER, 1, null, null));
          _s.add("==Sleep: " + pl.calcStat(Stats.SLEEP_POWER, 1, null, null));
          _s.add("==Paralyze: " + pl.calcStat(Stats.PARALYZE_POWER, 1, null, null));
          _s.add("==Cancel: " + pl.calcStat(Stats.CANCEL_POWER, 1, null, null));
          _s.add("==Debuff: " + pl.calcStat(Stats.DEBUFF_POWER, 1, null, null));
          _s.add("==========PvP Stats:");
          _s.add("==Phys Attack Dmg: " + pl.calcStat(Stats.PVP_PHYS_DMG_BONUS, 1, null, null));
          _s.add("==Phys Skill Dmg: " + pl.calcStat(Stats.PVP_PHYS_SKILL_DMG_BONUS, 1, null, null));
          _s.add("==Magic Skill Dmg: " + pl.calcStat(Stats.PVP_MAGIC_SKILL_DMG_BONUS, 1, null, null));
          _s.add("==Phys Attack Def: " + pl.calcStat(Stats.PVP_PHYS_DEFENCE_BONUS, 1, null, null));
          _s.add("==Phys Skill Def: " + pl.calcStat(Stats.PVP_PHYS_SKILL_DEFENCE_BONUS, 1, null, null));
          _s.add("==Magic Skill Def: " + pl.calcStat(Stats.PVP_MAGIC_SKILL_DEFENCE_BONUS, 1, null, null));
          _s.add("==========Reflects:");
          _s.add("==Phys Dmg Chance: " + pl.calcStat(Stats.REFLECT_AND_BLOCK_DAMAGE_CHANCE, null, null));
          _s.add("==Phys Skill Dmg Chance: " + pl.calcStat(Stats.REFLECT_AND_BLOCK_PSKILL_DAMAGE_CHANCE, null, null));
          _s.add("==Magic Skill Dmg Chance: " + pl.calcStat(Stats.REFLECT_AND_BLOCK_MSKILL_DAMAGE_CHANCE, null, null));
          _s.add("==Counterattack: Phys Dmg Chance: " + pl.calcStat(Stats.REFLECT_DAMAGE_PERCENT, null, null));
          _s.add("==Counterattack: Phys Skill Dmg Chance: " + pl.calcStat(Stats.REFLECT_PSKILL_DAMAGE_PERCENT, null, null));
          _s.add("==Counterattack: Magic Skill Dmg Chance: " + pl.calcStat(Stats.REFLECT_MSKILL_DAMAGE_PERCENT, null, null));
          _s.add("==========MP Consume Rate:");
          _s.add("==Magic Skills: " + pl.calcStat(Stats.MP_MAGIC_SKILL_CONSUME, 1, null, null));
          _s.add("==Phys Skills: " + pl.calcStat(Stats.MP_PHYSICAL_SKILL_CONSUME, 1, null, null));
          _s.add("==Music: " + pl.calcStat(Stats.MP_DANCE_SKILL_CONSUME, 1, null, null));
          _s.add("==========Shield:");
          _s.add("==Shield Defence: " + pl.calcStat(Stats.SHIELD_DEFENCE, null, null));
          _s.add("==Shield Defence Rate: " + pl.calcStat(Stats.SHIELD_RATE, null, null));
          _s.add("==Shield Defence Angle: " + pl.calcStat(Stats.SHIELD_ANGLE, null, null));
          _s.add("==========Etc:");
          _s.add("==Fatal Blow Rate: " + pl.calcStat(Stats.FATALBLOW_RATE, null, null));
          _s.add("==Phys Skill Evasion Rate: " + pl.calcStat(Stats.PSKILL_EVASION, null, null));
          _s.add("==Counterattack Rate: " + pl.calcStat(Stats.COUNTER_ATTACK, null, null));
          _s.add("==Pole Attack Angle: " + pl.calcStat(Stats.POLE_ATTACK_ANGLE, null, null));
          _s.add("==Pole Target Count: " + pl.calcStat(Stats.POLE_TARGET_COUNT, 1, null, null));
          _s.add("==========DONE.");
          for (String s : _s)
          {
            Functions.sendDebugMessage(activeChar, s);
          }
          break;
        case admin_uievent:
          if (wordList.length < 5)
          {
            Functions.sendDebugMessage(activeChar, "USAGE: //uievent isHide doIncrease startTime endTime Text");
            return false;
          }
          int hide;
          int increase;
          int startTime;
          int endTime;
          String text;
          try
          {
            hide = Integer.parseInt(wordList[1]);
            increase = Integer.parseInt(wordList[2]);
            startTime = Integer.parseInt(wordList[3]);
            endTime = Integer.parseInt(wordList[4]);
            text = wordList[5];
          }
          catch (NumberFormatException e)
          {
            Functions.sendDebugMessage(activeChar, "Invalid format");
            return false;
          }
          activeChar.broadcastPacket(new ExSendUIEvent(activeChar, hide, increase, startTime, endTime, text));
          break;
        case admin_opensod:
          if (wordList.length < 1)
          {
            Functions.sendDebugMessage(activeChar, "USAGE: //opensod minutes");
            return false;
          }
          SoDManager.openSeed(Integer.parseInt(wordList[1]) * 60 * 1000L);
          break;
        case admin_closesod:
          SoDManager.closeSeed();
          break;
        case admin_setsoistage:
          if (wordList.length < 1)
          {
            Functions.sendDebugMessage(activeChar, "USAGE: //setsoistage stage[1-5]");
            return false;
          }
          SoIManager.setCurrentStage(Integer.parseInt(wordList[1]));
          break;
        case admin_soinotify:
          if (wordList.length < 1)
          {
            Functions.sendDebugMessage(activeChar, "USAGE: //soinotify [1-3]");
            return false;
          }
          switch (Integer.parseInt(wordList[1]))
          {
            case 1:
              SoIManager.notifyCohemenesKill();
              break;
            case 2:
              SoIManager.notifyEkimusKill();
              break;
            case 3:
              SoIManager.notifyHoEDefSuccess();
              break;
          }
          break;
        case admin_forcenpcinfo:
          GameObject obj2 = activeChar.getTarget();
          if (!obj2.isNpc())
          {
            Functions.sendDebugMessage(activeChar, "Only NPC target is allowed");
            return false;
          }
          ((NpcInstance) obj2).broadcastCharInfo();
View Full Code Here

        {
          System.out.println("Parameters is empty.");
        }
        break;
      case admin_setheading:
        GameObject obj = activeChar.getTarget();
        if (!obj.isNpc())
        {
          activeChar.sendMessage("Target is incorrect!");
          return false;
        }
        npc = (NpcInstance) obj;
View Full Code Here

   * @param respawnTime int
   * @param mobCount int
   */
  private void spawnMonster(Player activeChar, String monsterId, int respawnTime, int mobCount)
  {
    GameObject target = activeChar.getTarget();
    if (target == null)
    {
      target = activeChar;
    }
    Pattern pattern = Pattern.compile("[0-9]*");
    Matcher regexp = pattern.matcher(monsterId);
    NpcTemplate template;
    if (regexp.matches())
    {
      int monsterTemplate = Integer.parseInt(monsterId);
      template = NpcHolder.getInstance().getTemplate(monsterTemplate);
    }
    else
    {
      monsterId = monsterId.replace('_', ' ');
      template = NpcHolder.getInstance().getTemplateByName(monsterId);
    }
    if (template == null)
    {
      activeChar.sendMessage("Incorrect monster template.");
      return;
    }
    try
    {
      SimpleSpawner spawn = new SimpleSpawner(template);
      spawn.setLoc(target.getLoc());
      spawn.setAmount(mobCount);
      spawn.setHeading(activeChar.getHeading());
      spawn.setRespawnDelay(respawnTime);
      spawn.setReflection(activeChar.getReflection());
      if (RaidBossSpawnManager.getInstance().isDefined(template.getNpcId()))
      {
        activeChar.sendMessage("Raid Boss " + template.name + " already spawned.");
      }
      else
      {
        if (Config.SAVE_GM_SPAWN_CUSTOM)
        {
          CustomSpawnTable.getInstance().addNewSpawn(spawn);
        }
        spawn.init();
        if (respawnTime == 0)
        {
          spawn.stopRespawn();
        }
        activeChar.sendMessage("Created " + template.name + " on " + target.getObjectId() + ".");
      }
    }
    catch (Exception e)
    {
      activeChar.sendMessage("Target is not ingame.");
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.GameObject

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.