📄 mbm_logging.d2l
字号:
/* 骀骀骀骀骀骀骀骀骀骀骀骀骀骀
Run Logging by Rayzer and Scavenger
骀骀骀骀骀骀骀骀骀骀骀骀骀骀 */
var RunLog="output/mephdata/" +me.name+"RunLog.pwn";
var abortLog="output/mephdata/" +me.name+"AbortLog.pwn";
var calcsLog="output/mephdata/" +me.name+"calcs.pwn";
var chickenLog = "output/"+me.name+"ChickenLog.txt";
if (HtmlLogging) chickenLog = "output/mephdata/"+me.name+"ChickenLog.pwn";
var l_total = 0;
var l_kills = 0;
var l_abort = 0;
var l_badres = 0;
var l_crash = 0;
var l_deaths = 0;
var l_merc_deaths = 0;
var l_meph_runs = 0;
var l_meph_kills = 0;
var l_meph_badres = 0;
var l_pindle_runs = 0;
var l_pindle_kills = 0;
var l_pindle_badres = 0;
var l_coldorb_hit = 0;
var l_coldorb_dodge = 0;
var l_coldorb_pct = 0;
var l_time = 1000000;
var StartTimer=new Date().getTime();
var RunTimer = 0;
var TotalRunTime = 0;
var notKilledReasons = new Array();
function mbm_LoadRun()
{
mbm_GetRunInfo(RunLog);
if(l_total==0) mbm_GetRunInfo(calcsLog);
l_crash = l_total - l_kills - l_abort - l_deaths;
l_total++;
mbm_SaveRun(0);
if (displayHUD && l_total > 0) {
delay(500);
mbm_BuildHUD();
}
}
function mbm_GetRunInfo(which)
{
file = fileOpen(which, 0);
if (file)
{
while(!file.eof)
{
line = file.readLine();
a = line.split("=");
if (a.length == 2)
{
switch (a[0])
{
case "Total Runs":
l_total = parseInt(a[1]);
break;
case "Completed Runs":
l_kills = parseInt(a[1]);
break;
case "Aborted Runs":
l_abort = parseInt(a[1]);
break;
case "Total Deaths":
l_deaths = parseInt(a[1]);
break;
case "Total Crashes/Chickens":
l_crash = parseInt(a[1]);
break;
case "Last Run Time":
RunTimer = parseInt(a[1]);
break;
case "Best Run Time":
l_time = parseInt(a[1]);
break;
case "Total Run Time":
TotalRunTime = parseInt(a[1]);
break;
case "Merc Deaths":
l_merc_deaths = parseInt(a[1]);
break;
case "Meph Runs":
l_meph_runs = parseInt(a[1]);
break;
case "Meph Kills":
l_meph_kills = parseInt(a[1]);
break;
case "Meph BadRes":
l_meph_badres = parseInt(a[1]);
break;
case "Pindle Runs":
l_pindle_runs = parseInt(a[1]);
break;
case "Pindle Kills":
l_pindle_kills = parseInt(a[1]);
break;
case "Pindle BadRes":
l_pindle_badres = parseInt(a[1]);
break;
case "Cold Orb Hits":
l_coldorb_hit = parseInt(a[1]);
break;
case "Cold Orbs Dodged":
l_coldorb_dodge = parseInt(a[1]);
break;
case "Dodge Success Rate":
l_coldorb_pct = parseInt(a[1]);
break;
default:
break;
}
}
}
file.close();
}
}
function mbm_SaveRun(how)
{
file = fileOpen(RunLog, 1);
if (!file) {
print("Failed to open logfile");
return;
}
if(how==0) file.writeLine("Success Rate=" + String((l_kills / (l_total-1)) * 100).substring(0,5) + "%");
else if(how>0) file.writeLine("Success Rate=" + String((l_kills / l_total) * 100).substring(0,5) + "%");
file.writeLine("Total Runs=" + l_total);
file.writeLine("Completed Runs=" + l_kills);
file.writeLine("Aborted Runs=" + l_abort);
file.writeLine("Total Deaths="+ l_deaths);
file.writeLine("Total Crashes/Chickens=" + l_crash);
file.writeLine("Last Run Time=" + RunTimer);
file.writeLine("Best Run Time=" + l_time);
file.writeLine("Average Run Time=" + Math.floor(TotalRunTime/l_kills));
file.writeLine("Total Run Time=" + TotalRunTime);
file.writeLine("Merc Deaths=" + l_merc_deaths);
file.writeLine("Meph Runs="+ l_meph_runs);
file.writeLine("Meph Kills="+ l_meph_kills);
file.writeLine("Meph BadRes="+ l_meph_badres);
file.writeLine("Pindle Runs="+ l_pindle_runs);
file.writeLine("Pindle Kills="+ l_pindle_kills);
file.writeLine("Pindle BadRes="+ l_pindle_badres);
file.writeLine("Cold Orb Hits="+ l_coldorb_hit);
file.writeLine("Cold Orbs Dodged="+ l_coldorb_dodge);
file.writeLine("Dodge Success Rate="+ l_coldorb_pct);
file.close();
if(how==0)
{
tfile = fileOpen(calcsLog, 1);
if (!tfile)
{
print("Failed to open temp logfile");
return;
}
tfile.writeLine("This file is only for calculation purposes, and for backups in case of error with writing to a file, please ignore it");
tfile.writeLine("Total Runs=" + l_total);
tfile.writeLine("Completed Runs=" + l_kills);
tfile.writeLine("Aborted Runs=" + l_abort);
tfile.writeLine("Total Deaths="+ l_deaths);
tfile.writeLine("Total Crashes/Chickens=" + l_crash);
tfile.writeLine("Last Run Time=" + RunTimer);
tfile.writeLine("Best Run Time=" + l_time);
tfile.writeLine("Total Run Time=" + TotalRunTime);
tfile.writeLine("Merc Deaths=" + l_merc_deaths);
tfile.writeLine("Meph Runs="+ l_meph_runs);
tfile.writeLine("Meph Kills="+ l_meph_kills);
tfile.writeLine("Meph BadRes="+ l_meph_badres);
tfile.writeLine("Pindle Runs="+ l_pindle_runs);
tfile.writeLine("Pindle Kills="+ l_pindle_kills);
tfile.writeLine("Pindle BadRes="+ l_pindle_badres);
tfile.writeLine("Cold Orb Hits="+ l_coldorb_hit);
tfile.writeLine("Cold Orbs Dodged="+ l_coldorb_dodge);
tfile.writeLine("Dodge Success Rate="+ l_coldorb_pct);
tfile.close();
}
if(how && HtmlLogging)
mbm_header();
}
function mbm_plus_kills(who)
{
switch(who)
{
case MEPHISTO : l_meph_kills++; mbm_SaveRun(0); break;
default : EndTimer=new Date().getTime();
RunTimer=EndTimer-StartTimer;
TotalRunTime += RunTimer;
if(RunTimer-l_time <= 0)
l_time=RunTimer;
l_kills++;
mbm_SaveRun(2);
}
}
// - count how many times player died.
function mbm_plus_deaths()
{
l_deaths++;
mbm_SaveRun(1);
}
// - count how many times merc died.
function mbm_plus_merc_deaths()
{
// - dont count merc death if player died
// if (Idied) return;
l_merc_deaths++;
mbm_SaveRun(0);
}
function mbm_plus_aborts()
{
l_abort++;
mbm_SaveRun(1);
}
function mbm_plus_badres(who)
{
switch(who)
{
case MEPHISTO : l_meph_badres++; break;
case PINDLESKIN : l_pindle_badres++; break;
}
mbm_SaveRun(0);
}
function mbm_plus_runs(who)
{
switch(who)
{
case MEPHISTO : l_meph_runs++; break;
case PINDLESKIN : l_pindle_runs++; break;
}
mbm_SaveRun(0);
}
////////////////////////////////////////
//
// Functions by FuQ_Serotonin, to get some html logging goin.
// Serotonin@clanfuq.com #d2jsp-dev irc.openprojects.net
// http://www.clanfuq.com
////////////////////////////////////////
////////////////////
//Global Data Members
////////////////////
function mbm_header(){
file = fileOpen("output/"+me.name+"Mephlog.html", 1);
if(file){
file.writeLine("<html>");
file.writeLine("<head>");
file.writeLine("<title>d2jsp log for " +me.name +"- By Serotonin (html template by njaguar, Scavenger, and Vapid)</title>");
file.writeLine("<meta HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
file.writeLine("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
file.writeLine("<link rel=\"stylesheet\" type=\"text/css\" href=\"frame.css\">");
file.writeLine("<style type='text/css'>");
file.writeLine("form { display: inline }");
file.writeLine("TABLE, TR, TD { font-family: Tahoma; font-size: 8pt; color: #000000; word-wrap: break-word }");
file.writeLine(".row1 { background-color: #EEF2F7 }");
file.writeLine("a:link, a:visited, a:active { text-decoration: underline; color: #000000 }");
file.writeLine("a:hover { color: #465584 }");
file.writeLine(".header { font-size:10pt; color: #FFFFFF }");
file.writeLine(".headerinfo { font-size:8pt; color: #000000; }");
file.writeLine("</style>");
file.writeLine("<noscript>");
file.writeLine("<meta http-equiv='refresh' content='2'>");
file.writeLine("</noscript>");
file.writeLine("<script language='JavaScript'>");
file.writeLine("function doLoad() { setTimeout( 'refresh()', 60000 ); }");
file.writeLine("</script>");
file.writeLine("<script language='JavaScript'>");
file.writeLine("var sURL = unescape(window.location.pathname);");
file.writeLine("function refresh() { window.location.href = sURL; }");
file.writeLine("</script>");
file.writeLine("</head>");
file.writeLine("<body onload='doLoad()' bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#000000\" leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
file.writeLine("<table class=\"frame\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
file.writeLine(" <tr>");
file.writeLine(" <td> ");
file.writeLine(" <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
file.writeLine(" <tr> ");
file.writeLine(" <td height=\"59\" background=\"images/TOP_BACK.jpg\" width=\"249\"><img src=\"images/logo.jpg\" width=\"249\" height=\"59\"></td>");
file.writeLine(" <td height=\"59\" background=\"images/TOP_BACK.jpg\" align=\"left\" valign=\"middle\" width=\"20\"> </td>");
file.writeLine(" <td height=\"59\" background=\"images/TOP_BACK.jpg\" align=\"left\" valign=\"middle\"><font style=\"font-size:12pt\" color=\"#FFFFFF\">");
file.writeLine(" d2jsp was written and programmed by Paul Taulborg (njaguar) <a href=\"mailto:njaguar@d2jsp.org\">njaguar@d2jsp.org</a>");
file.writeLine(" </font> ");
file.writeLine(" <p><font size=\"3\" color=\"#FFFFFF\">d2jsp character log file by Serotonin</font></td>");
file.writeLine(" </tr>");
file.writeLine(" </table>");
file.writeLine(" <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
file.writeLine(" <tr> ");
file.writeLine(" <td width=\"10\"><img src=\"images/spacer.gif\" width=\"10\" height=\"10\"></td>");
file.writeLine(" <td width=\"150\"><img src=\"images/spacer.gif\" width=\"150\" height=\"10\"></td>");
file.writeLine(" <td width=\"10\"><img src=\"images/spacer.gif\" width=\"10\" height=\"10\"></td>");
file.writeLine(" <td width=\"100%\"> </td>");
file.writeLine(" <td width=\"10\"><img src=\"images/spacer.gif\" width=\"10\" height=\"10\"></td>");
file.writeLine(" <td width=\"150\"><img src=\"images/spacer.gif\" width=\"150\" height=\"10\"></td>");
file.writeLine(" <td width=\"10\"><img src=\"images/spacer.gif\" width=\"10\" height=\"10\"></td>");
file.writeLine(" </tr>");
file.writeLine(" <tr> ");
file.writeLine(" <td> </td>");
file.writeLine(" <td class=\"menu\" align=\"left\" valign=\"top\"> ");
file.writeLine(" <table width=\"148\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">");
file.writeLine(" <tr> ");
file.writeLine(" <td> ");
file.writeLine(" <table border='0' width='128' cellspacing='0' cellpadding='1'>");
file.writeLine("<tr><td class='menu_title'>Main</td></tr>");
file.writeLine("<tr><td><a href='http://www.d2jsp.org' class='menu_normal' target='_blank'>Home</a></td></tr>");
file.writeLine("<tr><td><a href='http://forums.d2jsp.org/index.php?act=Reg&CODE=00' class='menu_normal' target='_blank'>Register</td></tr>");
file.writeLine("<tr><td><a href='http://forums.d2jsp.org/index.php?act=Login&CODE=00' class='menu_normal' target='_blank'>Login</td></tr>");
file.writeLine("<tr><td class='menu_normal'> </td></tr>");
file.writeLine("<tr><td class='menu_title'>Quick Links</td></tr>");
file.writeLine("<tr><td><a href='http://forums.d2jsp.org' class='menu_normal' target='_blank'>Forums</a></td></tr>");
file.writeLine("<tr><td><a href='http://scripts.d2jsp.org' class='menu_normal' target='_blank'>Scripts</a></td></tr>");
file.writeLine("<tr><td class='menu_normal'> </td></tr>");
file.writeLine("<tr><td><a href='http://www.d2jsp.org/docs/' class='menu_normal' target='_blank'>Scripting Docs</a></td></tr>");
file.writeLine("<tr><td><a href='http://www.d2jsp.org/docs/itemcodes.html' class='menu_normal' target='_blank'>Item Codes</a></td></tr>");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -