Guest User

Untitled

a guest
Oct 12th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.57 KB | None | 0 0
  1.     @Override
  2.     public void onActionShift(Player player) {
  3.         // Check if the Player is a GM
  4.         if (player.isGM()) {
  5.             final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  6.             html.setFile("data/html/admin/npcinfo.htm");
  7.             html.replace("%class%", getClass().getSimpleName());
  8.             html.replace("%id%", getTemplate().getNpcId());
  9.             html.replace("%lvl%", getTemplate().getLevel());
  10.             html.replace("%name%", getName());
  11.             html.replace("%race%", getTemplate().getRace().toString());
  12.             html.replace("%tmplid%", getTemplate().getIdTemplate());
  13.             html.replace("%castle%", (getCastle() != null) ? getCastle().getName() : "none");
  14.             html.replace("%aggro%", getTemplate().getAggroRange());
  15.             html.replace("%corpse%", StringUtil.getTimeStamp(getTemplate().getCorpseTime()));
  16.             html.replace("%enchant%", getTemplate().getEnchantEffect());
  17.             html.replace("%hp%", (int) getCurrentHp());
  18.             html.replace("%hpmax%", getMaxHp());
  19.             html.replace("%mp%", (int) getCurrentMp());
  20.             html.replace("%mpmax%", getMaxMp());
  21.             html.replace("%patk%", getPAtk(null));
  22.             html.replace("%matk%", getMAtk(null, null));
  23.             html.replace("%pdef%", getPDef(null));
  24.             html.replace("%mdef%", getMDef(null, null));
  25.             html.replace("%accu%", getAccuracy());
  26.             html.replace("%evas%", getEvasionRate(null));
  27.             html.replace("%crit%", getCriticalHit(null, null));
  28.             html.replace("%rspd%", getMoveSpeed());
  29.             html.replace("%aspd%", getPAtkSpd());
  30.             html.replace("%cspd%", getMAtkSpd());
  31.             html.replace("%str%", getSTR());
  32.             html.replace("%dex%", getDEX());
  33.             html.replace("%con%", getCON());
  34.             html.replace("%int%", getINT());
  35.             html.replace("%wit%", getWIT());
  36.             html.replace("%men%", getMEN());
  37.             html.replace("%loc%", getX() + " " + getY() + " " + getZ());
  38.             html.replace("%dist%", (int) Math.sqrt(player.getDistanceSq(this)));
  39.             html.replace("%ele_fire%", getDefenseElementValue((byte) 2));
  40.             html.replace("%ele_water%", getDefenseElementValue((byte) 3));
  41.             html.replace("%ele_wind%", getDefenseElementValue((byte) 1));
  42.             html.replace("%ele_earth%", getDefenseElementValue((byte) 4));
  43.             html.replace("%ele_holy%", getDefenseElementValue((byte) 5));
  44.             html.replace("%ele_dark%", getDefenseElementValue((byte) 6));
  45.  
  46.             if (getSpawn() != null) {
  47.                 html.replace("%spawn%", getSpawn().getLoc().toString());
  48.                 html.replace("%loc2d%", (int) Math.sqrt(getPlanDistanceSq(getSpawn().getLocX(), getSpawn().getLocY())));
  49.                 html.replace("%loc3d%", (int) Math.sqrt(getDistanceSq(getSpawn().getLocX(), getSpawn().getLocY(), getSpawn().getLocZ())));
  50.                 html.replace("%resp%", StringUtil.getTimeStamp(getSpawn().getRespawnDelay()));
  51.                 html.replace("%rand_resp%", StringUtil.getTimeStamp(getSpawn().getRespawnRandom()));
  52.             } else {
  53.                 html.replace("%spawn%", "<font color=FF0000>null</font>");
  54.                 html.replace("%loc2d%", "<font color=FF0000>--</font>");
  55.                 html.replace("%loc3d%", "<font color=FF0000>--</font>");
  56.                 html.replace("%resp%", "<font color=FF0000>--</font>");
  57.                 html.replace("%rand_resp%", "<font color=FF0000>--</font>");
  58.             }
  59.  
  60.             if (hasAI()) {
  61.                 html.replace("%ai_intention%", "<font color=\"LEVEL\">Intention</font><table width=\"100%\"><tr><td><font color=\"LEVEL\">Intention:</font></td><td>" + getAI().getIntention().name() + "</td></tr>");
  62.                 html.replace("%ai%", "<tr><td><font color=\"LEVEL\">AI:</font></td><td>" + getAI().getClass().getSimpleName() + "</td></tr></table><br>");
  63.             } else {
  64.                 html.replace("%ai_intention%", "");
  65.                 html.replace("%ai%", "");
  66.             }
  67.  
  68.             html.replace("%ai_type%", getTemplate().getAiType().name());
  69.             html.replace("%ai_clan%", (getTemplate().getClans() != null) ? "<tr><td width=100><font color=\"LEVEL\">Clan:</font></td><td align=right width=170>" + Arrays.toString(getTemplate().getClans()) + " " + getTemplate().getClanRange() + "</td></tr>" + ((getTemplate().getIgnoredIds() != null) ? "<tr><td width=100><font color=\"LEVEL\">Ignored ids:</font></td><td align=right width=170>" + Arrays.toString(getTemplate().getIgnoredIds()) + "</td></tr>" : "") : "");
  70.             html.replace("%ai_move%", String.valueOf(getTemplate().canMove()));
  71.             html.replace("%ai_seed%", String.valueOf(getTemplate().isSeedable()));
  72.             html.replace("%ai_ssinfo%", _currentSsCount + "[" + getTemplate().getSsCount() + "] - " + getTemplate().getSsRate() + "%");
  73.             html.replace("%ai_spsinfo%", _currentSpsCount + "[" + getTemplate().getSpsCount() + "] - " + getTemplate().getSpsRate() + "%");
  74.             html.replace("%butt%", ((this instanceof Merchant) ? "<button value=\"Shop\" action=\"bypass -h admin_show_shop " + getNpcId() + "\" width=65 height=19 back=\"L2UI_ch3.smallbutton2_over\" fore=\"L2UI_ch3.smallbutton2\">" : ""));
  75.             player.sendPacket(html);
  76.         }
  77.         else if (Config.ALT_NPC_VIEW){
  78.             sendNpcDrop(player, getTemplate().getNpcId(), 1);
  79.         }
  80.         if (player.getTarget() != this)
  81.             player.setTarget(this);
  82.         else
  83.             player.sendPacket(ActionFailed.STATIC_PACKET);
  84.     }
Add Comment
Please, Sign In to add comment