Exemple #1
0
        public async Task ShowNPCInfoAsync(L2Player player)
        {
            NpcHtmlMessage html = new NpcHtmlMessage(player, "./html/admin/npcinfo.htm", ObjectId);

            html.Replace("%objid%", ObjectId);
            html.Replace("%class%", "null");
            html.Replace("%id%", NpcId);
            html.Replace("%lvl%", Level);
            html.Replace("%name%", Name);
            html.Replace("%tmplid%", Template.IdTemplate);
            html.Replace("%aggro%", Attackable > 0 ? Template.AggroRange : 0);
            html.Replace("%corpse%", Template.CorpseTime);
            html.Replace("%enchant%", Template.EnchantEffect);
            html.Replace("%hp%", CharStatus.CurrentHp);
            html.Replace("%hpmax%", MaxHp);
            html.Replace("%mp%", CharStatus.CurrentMp);
            html.Replace("%mpmax%", MaxMp);
            html.Replace("%patk%", Template.BasePAtk);
            html.Replace("%matk%", Template.BaseMAtk);
            html.Replace("%mdef%", Template.BaseMDef);
            html.Replace("%pdef%", Template.BasePDef);
            html.Replace("%accu%", CharacterStat.Accuracy);
            html.Replace("%evas%", CharacterStat.EvasionRate(this));
            html.Replace("%crit%", Template.BaseCritRate);
            html.Replace("%aspd%", Template.BasePAtkSpd);
            html.Replace("%cspd%", CharacterStat.MAttackSpeed);
            html.Replace("%rspd%", Template.BaseRunSpd);
            html.Replace("%str%", Str);
            html.Replace("%con%", Con);
            html.Replace("%dex%", Dex);
            html.Replace("%int%", Int);
            html.Replace("%wit%", Wit);
            html.Replace("%men%", Men);
            html.Replace("%loc%", $"{X} {Y} {Z}");
            html.Replace("%dist%", player.Movement.DistanceToSquared(X, Y));
            //         // byte attackAttribute = ((L2Character)this).getAttackElement();
            //         html.replace("%ele_atk_value%", "%todo%" /* String.valueOf(((L2Character)this).getAttackElementValue(attackAttribute)) */);
            //         html.replace("%ele_dfire%", String.valueOf(((L2Character)this).getDefenseElementValue((byte)2)));
            //         html.replace("%ele_dwater%", String.valueOf(((L2Character)this).getDefenseElementValue((byte)3)));
            //         html.replace("%ele_dwind%", String.valueOf(((L2Character)this).getDefenseElementValue((byte)1)));
            //         html.replace("%ele_dearth%", String.valueOf(((L2Character)this).getDefenseElementValue((byte)4)));
            //         html.replace("%ele_dholy%", String.valueOf(((L2Character)this).getDefenseElementValue((byte)5)));
            //         html.replace("%ele_ddark%", String.valueOf(((L2Character)this).getDefenseElementValue((byte)6)));

            if (spawn != null)
            {
                html.Replace("%spawn%", $"{spawn.Location.X} {spawn.Location.Y} {spawn.Location.Z}");
                html.Replace("%loc2d%", player.Movement.DistanceToSquared(spawn.Location.Y, spawn.Location.X));
                html.Replace("%loc3d%", "<font color=FF0000>--</font>");
                //html.Replace("%loc3d%", player.getDistanceSq(spawn.Location.X,spawn.Location.Y,spawn.Location.Z); -Not implemented
                html.Replace("%resp%", spawn.Location.RespawnDelay / 1000);
            }
            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>");
            }

            //         if (hasAI())
            //         {
            //             html.replace("%ai_intention%", "<tr><td><table width=270 border=0><tr><td width=100><font color=FFAA00>Intention:</font></td><td align=right width=170>" + String.valueOf(getAI().getIntention().name()) + "</td></tr></table></td></tr>");
            //             html.replace("%ai%", "<tr><td><table width=270 border=0><tr><td width=100><font color=FFAA00>AI</font></td><td align=right width=170>" + getAI().getClass().getSimpleName() + "</td></tr></table></td></tr>");
            //             html.replace("%ai_type%", "<tr><td><table width=270 border=0><tr><td width=100><font color=FFAA00>AIType</font></td><td align=right width=170>" + String.valueOf(getAiType()) + "</td></tr></table></td></tr>");
            //             html.replace("%ai_clan%", "<tr><td><table width=270 border=0><tr><td width=100><font color=FFAA00>Clan & Range:</font></td><td align=right width=170>" + String.valueOf(getClan()) + " " + String.valueOf(getClanRange()) + "</td></tr></table></td></tr>");
            //             html.replace("%ai_enemy_clan%", "<tr><td><table width=270 border=0><tr><td width=100><font color=FFAA00>Enemy & Range:</font></td><td align=right width=170>" + String.valueOf(getEnemyClan()) + " " + String.valueOf(getEnemyRange()) + "</td></tr></table></td></tr>");
            //         }
            //         else
            //         {
            //             html.replace("%ai_intention%", "");
            //             html.replace("%ai%", "");
            //             html.replace("%ai_type%", "");
            //             html.replace("%ai_clan%", "");
            //             html.replace("%ai_enemy_clan%", "");
            //         }

            if (Template.GetType().ToString() == "L2dotNET.Models.Npcs.L2Merchant")
            {
                html.Replace("%butt%", "<button value=\"Shop\" action=\"bypass -h admin_showShop " + NpcId + "\" width=65 height=19 back=\"L2UI_ch3.smallbutton2_over\" fore=\"L2UI_ch3.smallbutton2\">");
            }
            else
            {
                html.Replace("%butt%", "");
            }

            await player.SendPacketAsync(html);
        }