Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onActionShift(Player player) {
- // Check if the Player is a GM
- if (player.isGM()) {
- final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- html.setFile("data/html/admin/npcinfo.htm");
- html.replace("%class%", getClass().getSimpleName());
- html.replace("%id%", getTemplate().getNpcId());
- html.replace("%lvl%", getTemplate().getLevel());
- html.replace("%name%", getName());
- html.replace("%race%", getTemplate().getRace().toString());
- html.replace("%tmplid%", getTemplate().getIdTemplate());
- html.replace("%castle%", (getCastle() != null) ? getCastle().getName() : "none");
- html.replace("%aggro%", getTemplate().getAggroRange());
- html.replace("%corpse%", StringUtil.getTimeStamp(getTemplate().getCorpseTime()));
- html.replace("%enchant%", getTemplate().getEnchantEffect());
- html.replace("%hp%", (int) getCurrentHp());
- html.replace("%hpmax%", getMaxHp());
- html.replace("%mp%", (int) getCurrentMp());
- html.replace("%mpmax%", getMaxMp());
- html.replace("%patk%", getPAtk(null));
- html.replace("%matk%", getMAtk(null, null));
- html.replace("%pdef%", getPDef(null));
- html.replace("%mdef%", getMDef(null, null));
- html.replace("%accu%", getAccuracy());
- html.replace("%evas%", getEvasionRate(null));
- html.replace("%crit%", getCriticalHit(null, null));
- html.replace("%rspd%", getMoveSpeed());
- html.replace("%aspd%", getPAtkSpd());
- html.replace("%cspd%", getMAtkSpd());
- html.replace("%str%", getSTR());
- html.replace("%dex%", getDEX());
- html.replace("%con%", getCON());
- html.replace("%int%", getINT());
- html.replace("%wit%", getWIT());
- html.replace("%men%", getMEN());
- html.replace("%loc%", getX() + " " + getY() + " " + getZ());
- html.replace("%dist%", (int) Math.sqrt(player.getDistanceSq(this)));
- html.replace("%ele_fire%", getDefenseElementValue((byte) 2));
- html.replace("%ele_water%", getDefenseElementValue((byte) 3));
- html.replace("%ele_wind%", getDefenseElementValue((byte) 1));
- html.replace("%ele_earth%", getDefenseElementValue((byte) 4));
- html.replace("%ele_holy%", getDefenseElementValue((byte) 5));
- html.replace("%ele_dark%", getDefenseElementValue((byte) 6));
- if (getSpawn() != null) {
- html.replace("%spawn%", getSpawn().getLoc().toString());
- html.replace("%loc2d%", (int) Math.sqrt(getPlanDistanceSq(getSpawn().getLocX(), getSpawn().getLocY())));
- html.replace("%loc3d%", (int) Math.sqrt(getDistanceSq(getSpawn().getLocX(), getSpawn().getLocY(), getSpawn().getLocZ())));
- html.replace("%resp%", StringUtil.getTimeStamp(getSpawn().getRespawnDelay()));
- html.replace("%rand_resp%", StringUtil.getTimeStamp(getSpawn().getRespawnRandom()));
- } else {
- html.replace("%spawn%", "<font color=FF0000>null</font>");
- html.replace("%loc2d%", "<font color=FF0000>--</font>");
- html.replace("%loc3d%", "<font color=FF0000>--</font>");
- html.replace("%resp%", "<font color=FF0000>--</font>");
- html.replace("%rand_resp%", "<font color=FF0000>--</font>");
- }
- if (hasAI()) {
- 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>");
- html.replace("%ai%", "<tr><td><font color=\"LEVEL\">AI:</font></td><td>" + getAI().getClass().getSimpleName() + "</td></tr></table><br>");
- } else {
- html.replace("%ai_intention%", "");
- html.replace("%ai%", "");
- }
- html.replace("%ai_type%", getTemplate().getAiType().name());
- 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>" : "") : "");
- html.replace("%ai_move%", String.valueOf(getTemplate().canMove()));
- html.replace("%ai_seed%", String.valueOf(getTemplate().isSeedable()));
- html.replace("%ai_ssinfo%", _currentSsCount + "[" + getTemplate().getSsCount() + "] - " + getTemplate().getSsRate() + "%");
- html.replace("%ai_spsinfo%", _currentSpsCount + "[" + getTemplate().getSpsCount() + "] - " + getTemplate().getSpsRate() + "%");
- 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\">" : ""));
- player.sendPacket(html);
- }
- else if (Config.ALT_NPC_VIEW){
- sendNpcDrop(player, getTemplate().getNpcId(), 1);
- }
- if (player.getTarget() != this)
- player.setTarget(this);
- else
- player.sendPacket(ActionFailed.STATIC_PACKET);
- }
Add Comment
Please, Sign In to add comment