mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-10-11 01:12:51 -04:00
938 lines
26 KiB
Plaintext
938 lines
26 KiB
Plaintext
/**
|
|
* online_jedi_test.script
|
|
*
|
|
* Assumes this script is attached to a character
|
|
*/
|
|
|
|
//----------------------------------------------------------
|
|
|
|
include library.utils;
|
|
include library.jedi;
|
|
include java.util.StringTokenizer;
|
|
|
|
//----------------------------------------------------------
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnHearSpeech(obj_id objSpeaker, string strText)
|
|
{
|
|
if (objSpeaker != self)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (strText.startsWith("ojt3"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(strText);
|
|
if (st.countTokens() == 2)
|
|
{
|
|
string command = st.nextToken();
|
|
string file = st.nextToken();
|
|
|
|
if (true)
|
|
{
|
|
int numOnlineJedis = 0;
|
|
int numOfflineJedis = 0;
|
|
string strOutput = "";
|
|
string strOffline = "offline jedi\r\n";
|
|
dictionary dctJediInfo = requestJedi(IGNORE_JEDI_STAT, IGNORE_JEDI_STAT, 1, 1000, IGNORE_JEDI_STAT, IGNORE_JEDI_STAT);
|
|
|
|
if (dctJediInfo==null)
|
|
{
|
|
strOutput = "requestJedi() returned NULL dctJediInfo\r\n";
|
|
}
|
|
else
|
|
{
|
|
obj_id[] objJedis = dctJediInfo.getObjIdArray("id");
|
|
boolean[] boolOnline = dctJediInfo.getBooleanArray("online");
|
|
string[] strNames = dctJediInfo.getStringArray("name");
|
|
int[] visibility = dctJediInfo.getIntArray("visibility");
|
|
int[] bountyValue = dctJediInfo.getIntArray("bountyValue");
|
|
int[] level = dctJediInfo.getIntArray("level");
|
|
int[] faction = dctJediInfo.getIntArray("faction");
|
|
location[] loc = dctJediInfo.getLocationArray("location");
|
|
obj_id[][] bounties = (obj_id[][])(dctJediInfo.get("bounties"));
|
|
|
|
if (objJedis != null && boolOnline != null && strNames != null && visibility != null)
|
|
{
|
|
strOutput = "requestJedi() returned " + objJedis.length + " jedis\r\n";
|
|
|
|
for (int i = 0; i < objJedis.length; ++i)
|
|
{
|
|
if (boolOnline[i])
|
|
{
|
|
++numOnlineJedis;
|
|
strOutput += objJedis[i];
|
|
strOutput += " [";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ",";
|
|
strOutput += bountyValue[i];
|
|
strOutput += ",";
|
|
strOutput += level[i];
|
|
strOutput += ",";
|
|
strOutput += getFactionString(faction[i]);
|
|
strOutput += ",";
|
|
strOutput += loc[i];
|
|
strOutput += ", hunted by (";
|
|
for (int j = 0; j < bounties[i].length; ++j)
|
|
{
|
|
if (j > 0)
|
|
strOutput += ",";
|
|
|
|
strOutput += bounties[i][j];
|
|
strOutput += "-";
|
|
strOutput += getPlayerName(bounties[i][j]);
|
|
}
|
|
strOutput += ")";
|
|
|
|
strOutput += "] is online\r\n";
|
|
}
|
|
else
|
|
{
|
|
++numOfflineJedis;
|
|
strOffline += objJedis[i];
|
|
strOffline += " [";
|
|
strOffline += strNames[i];
|
|
strOffline += ",";
|
|
strOffline += visibility[i];
|
|
strOffline += ",";
|
|
strOffline += bountyValue[i];
|
|
strOffline += ",";
|
|
strOffline += level[i];
|
|
strOffline += ",";
|
|
strOffline += getFactionString(faction[i]);
|
|
strOffline += ",";
|
|
strOffline += loc[i];
|
|
strOffline += ", hunted by (";
|
|
for (int j = 0; j < bounties[i].length; ++j)
|
|
{
|
|
if (j > 0)
|
|
strOffline += ",";
|
|
|
|
strOffline += bounties[i][j];
|
|
strOffline += "-";
|
|
strOffline += getPlayerName(bounties[i][j]);
|
|
}
|
|
strOffline += ")";
|
|
|
|
strOffline += "] is offline\r\n";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput = "requestJedi() returned null data\r\n";
|
|
}
|
|
}
|
|
|
|
strOutput += numOnlineJedis;
|
|
strOutput += " online jedis\r\n";
|
|
|
|
strOffline += numOfflineJedis;
|
|
strOffline += " offline jedis\r\n";
|
|
|
|
saveTextOnClient(self, "online_jedi" + file + ".txt", strOutput);
|
|
saveTextOnClient(self, "offline_jedi" + file + ".txt", strOffline);
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
|
|
/*
|
|
if (strText.startsWith("ojt1"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(strText);
|
|
if (st.countTokens() == 2)
|
|
{
|
|
string command = st.nextToken();
|
|
string file = st.nextToken();
|
|
|
|
if (true)
|
|
{
|
|
int numOnlineJedis = 0;
|
|
int numOfflineJedis = 0;
|
|
string strOutput = "";
|
|
string strOffline = "offline jedi\r\n";
|
|
dictionary dctJediInfo = requestJedi(jedi.BOUNTY_VISIBILITY_THRESHHOLD, IGNORE_JEDI_STAT, 1, 1000, IGNORE_JEDI_STAT, -3);
|
|
|
|
if (dctJediInfo==null)
|
|
{
|
|
strOutput = "requestJedi() returned NULL dctJediInfo\r\n";
|
|
}
|
|
else
|
|
{
|
|
//HUY
|
|
|
|
//HUY
|
|
std::deque<bool> * huyBool = new std::deque<bool>;
|
|
std::vector<int> * huyInt = new std::vector<int>;
|
|
for (int i = 1; i <= 100000; ++i)
|
|
{
|
|
huyInt->push_back(i);
|
|
|
|
if ((i % 2) == 0)
|
|
huyBool->push_back(true);
|
|
else
|
|
huyBool->push_back(false);
|
|
}
|
|
|
|
returnParams.addParam(*huyBool, "huyBool", true);
|
|
returnParams.addParam(*huyInt, "huyInt", true);
|
|
//HUY
|
|
string strHuy;
|
|
boolean[] boolHuy = dctJediInfo.getBooleanArray("huyBool");
|
|
if (boolHuy == null)
|
|
{
|
|
strHuy = "no bool array returned\r\n";
|
|
}
|
|
else
|
|
{
|
|
strHuy = "bool array's length is " + boolHuy.length + "\r\n";
|
|
for (int iHuy = 1; iHuy <= boolHuy.length; ++iHuy)
|
|
{
|
|
if ((iHuy % 2) == 0)
|
|
{
|
|
if (!boolHuy[iHuy-1])
|
|
{
|
|
strHuy += "index ";
|
|
strHuy += iHuy;
|
|
strHuy += " is supposed to be true but is false\r\n";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (boolHuy[iHuy-1])
|
|
{
|
|
strHuy += "index ";
|
|
strHuy += iHuy;
|
|
strHuy += " is supposed to be false but is true\r\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
saveTextOnClient(self, "bool_array_test.txt", strHuy);
|
|
|
|
int[] intHuy = dctJediInfo.getIntArray("huyInt");
|
|
if (intHuy == null)
|
|
{
|
|
strHuy = "no int array returned\r\n";
|
|
}
|
|
else
|
|
{
|
|
strHuy = "int array's length is " + intHuy.length + "\r\n";
|
|
for (int iHuy = 1; iHuy <= intHuy.length; ++iHuy)
|
|
{
|
|
if (iHuy != intHuy[iHuy-1])
|
|
{
|
|
strHuy += "index ";
|
|
strHuy += iHuy;
|
|
strHuy += " is supposed to be ";
|
|
strHuy += iHuy;
|
|
strHuy += " but is ";
|
|
strHuy += intHuy[iHuy-1];
|
|
strHuy += "\r\n";
|
|
}
|
|
}
|
|
}
|
|
saveTextOnClient(self, "int_array_test.txt", strHuy);
|
|
//HUY
|
|
obj_id[] objJedis = dctJediInfo.getObjIdArray("id");
|
|
boolean[] boolOnline = dctJediInfo.getBooleanArray("online");
|
|
string[] strNames = dctJediInfo.getStringArray("name");
|
|
int[] visibility = dctJediInfo.getIntArray("visibility");
|
|
|
|
if (objJedis != null && boolOnline != null && strNames != null && visibility != null)
|
|
{
|
|
strOutput = "requestJedi() returned " + objJedis.length + " jedis\r\n";
|
|
|
|
for (int i = 0; i < objJedis.length; ++i)
|
|
{
|
|
if (boolOnline[i])
|
|
{
|
|
++numOnlineJedis;
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ") is online\r\n";
|
|
}
|
|
else
|
|
{
|
|
++numOfflineJedis;
|
|
strOffline += objJedis[i];
|
|
strOffline += " (";
|
|
strOffline += strNames[i];
|
|
strOffline += ",";
|
|
strOffline += visibility[i];
|
|
strOffline += ") is offline\r\n";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput = "requestJedi() returned null data\r\n";
|
|
}
|
|
}
|
|
|
|
strOutput += numOnlineJedis;
|
|
strOutput += " online jedis\r\n";
|
|
|
|
strOffline += numOfflineJedis;
|
|
strOffline += " offline jedis\r\n";
|
|
|
|
saveTextOnClient(self, "online_jedi" + file + "a.txt", strOutput);
|
|
saveTextOnClient(self, "offline_jedi" + file + "a.txt", strOffline);
|
|
}
|
|
|
|
if (true)
|
|
{
|
|
int numOnlineJedis = 0;
|
|
int numOfflineJedis = 0;
|
|
string strOutput = "";
|
|
string strOffline = "offline jedi\r\n";
|
|
dictionary dctJediInfo = requestJedi(jedi.BOUNTY_VISIBILITY_THRESHHOLD, IGNORE_JEDI_STAT, 1, 1000, IGNORE_JEDI_STAT, -3);
|
|
|
|
if (dctJediInfo==null)
|
|
{
|
|
strOutput = "requestJedi() returned NULL dctJediInfo\r\n";
|
|
}
|
|
else
|
|
{
|
|
obj_id[] objJedis = dctJediInfo.getObjIdArray("id");
|
|
boolean[] boolOnline = dctJediInfo.getBooleanArray("online");
|
|
string[] strNames = dctJediInfo.getStringArray("name");
|
|
int[] visibility = dctJediInfo.getIntArray("visibility");
|
|
|
|
if (objJedis != null && boolOnline != null && strNames != null && visibility != null)
|
|
{
|
|
strOutput = "requestJedi() returned " + objJedis.length + " jedis\r\n";
|
|
|
|
for (int i = 0; i < objJedis.length; ++i)
|
|
{
|
|
if (boolOnline[i])
|
|
{
|
|
++numOnlineJedis;
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ") is online\r\n";
|
|
}
|
|
else
|
|
{
|
|
++numOfflineJedis;
|
|
strOffline += objJedis[i];
|
|
strOffline += " (";
|
|
strOffline += strNames[i];
|
|
strOffline += ",";
|
|
strOffline += visibility[i];
|
|
strOffline += ") is offline\r\n";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput = "requestJedi() returned null data\r\n";
|
|
}
|
|
}
|
|
|
|
strOutput += numOnlineJedis;
|
|
strOutput += " online jedis\r\n";
|
|
|
|
strOffline += numOfflineJedis;
|
|
strOffline += " offline jedis\r\n";
|
|
|
|
saveTextOnClient(self, "online_jedi" + file + "b.txt", strOutput);
|
|
saveTextOnClient(self, "offline_jedi" + file + "b.txt", strOffline);
|
|
}
|
|
}
|
|
}
|
|
else if (strText.startsWith("ojt2"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(strText);
|
|
if (st.countTokens() == 2)
|
|
{
|
|
string command = st.nextToken();
|
|
string file = st.nextToken();
|
|
|
|
if (true)
|
|
{
|
|
int numOnlineJedis = 0;
|
|
int numOfflineJedis = 0;
|
|
string strOutput = "";
|
|
string strOffline = "offline jedi\r\n";
|
|
dictionary dctJediInfo = requestJedi(jedi.BOUNTY_VISIBILITY_THRESHHOLD, IGNORE_JEDI_STAT, 1, 1000, IGNORE_JEDI_STAT, -3);
|
|
|
|
if (dctJediInfo==null)
|
|
{
|
|
strOutput = "requestJedi() returned NULL dctJediInfo\r\n";
|
|
}
|
|
else
|
|
{
|
|
obj_id[] objJedis = dctJediInfo.getObjIdArray("id");
|
|
string[] strNames = dctJediInfo.getStringArray("name");
|
|
int[] visibility = dctJediInfo.getIntArray("visibility");
|
|
|
|
if (objJedis != null && strNames != null && visibility != null)
|
|
{
|
|
strOutput = "requestJedi() returned " + objJedis.length + " jedis\r\n";
|
|
|
|
for (int i = 0; i < objJedis.length; ++i)
|
|
{
|
|
dictionary dctSingleJediInfo = requestJedi(objJedis[i]);
|
|
if (dctSingleJediInfo != null)
|
|
{
|
|
boolean boolOnline = dctSingleJediInfo.getBoolean("online");
|
|
if (boolOnline)
|
|
{
|
|
++numOnlineJedis;
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ") is online\r\n";
|
|
}
|
|
else
|
|
{
|
|
++numOfflineJedis;
|
|
strOffline += objJedis[i];
|
|
strOffline += " (";
|
|
strOffline += strNames[i];
|
|
strOffline += ",";
|
|
strOffline += visibility[i];
|
|
strOffline += ") is offline\r\n";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ") ***ERROR*** requestJedi() returned null\r\n";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput = "requestJedi() returned null data\r\n";
|
|
}
|
|
}
|
|
|
|
strOutput += numOnlineJedis;
|
|
strOutput += " online jedis\r\n";
|
|
|
|
strOffline += numOfflineJedis;
|
|
strOffline += " offline jedis\r\n";
|
|
|
|
saveTextOnClient(self, "online_jedi" + file + "a.txt", strOutput);
|
|
saveTextOnClient(self, "offline_jedi" + file + "a.txt", strOffline);
|
|
}
|
|
|
|
if (true)
|
|
{
|
|
int numOnlineJedis = 0;
|
|
int numOfflineJedis = 0;
|
|
string strOutput = "";
|
|
string strOffline = "offline jedi\r\n";
|
|
dictionary dctJediInfo = requestJedi(jedi.BOUNTY_VISIBILITY_THRESHHOLD, IGNORE_JEDI_STAT, 1, 1000, IGNORE_JEDI_STAT, -3);
|
|
|
|
if (dctJediInfo==null)
|
|
{
|
|
strOutput = "requestJedi() returned NULL dctJediInfo\r\n";
|
|
}
|
|
else
|
|
{
|
|
obj_id[] objJedis = dctJediInfo.getObjIdArray("id");
|
|
string[] strNames = dctJediInfo.getStringArray("name");
|
|
int[] visibility = dctJediInfo.getIntArray("visibility");
|
|
|
|
if (objJedis != null && strNames != null && visibility != null)
|
|
{
|
|
strOutput = "requestJedi() returned " + objJedis.length + " jedis\r\n";
|
|
|
|
for (int i = 0; i < objJedis.length; ++i)
|
|
{
|
|
dictionary dctSingleJediInfo = requestJedi(objJedis[i]);
|
|
if (dctSingleJediInfo != null)
|
|
{
|
|
boolean boolOnline = dctSingleJediInfo.getBoolean("online");
|
|
if (boolOnline)
|
|
{
|
|
++numOnlineJedis;
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ") is online\r\n";
|
|
}
|
|
else
|
|
{
|
|
++numOfflineJedis;
|
|
strOffline += objJedis[i];
|
|
strOffline += " (";
|
|
strOffline += strNames[i];
|
|
strOffline += ",";
|
|
strOffline += visibility[i];
|
|
strOffline += ") is offline\r\n";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ") ***ERROR*** requestJedi() returned null\r\n";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput = "requestJedi() returned null data\r\n";
|
|
}
|
|
}
|
|
|
|
strOutput += numOnlineJedis;
|
|
strOutput += " online jedis\r\n";
|
|
|
|
strOffline += numOfflineJedis;
|
|
strOffline += " offline jedis\r\n";
|
|
|
|
saveTextOnClient(self, "online_jedi" + file + "b.txt", strOutput);
|
|
saveTextOnClient(self, "offline_jedi" + file + "b.txt", strOffline);
|
|
}
|
|
}
|
|
}
|
|
else if (strText.startsWith("ojt4"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(strText);
|
|
if (st.countTokens() == 2)
|
|
{
|
|
string command = st.nextToken();
|
|
string file = st.nextToken();
|
|
|
|
if (true)
|
|
{
|
|
int numOnlineJedis = 0;
|
|
int numOfflineJedis = 0;
|
|
string strOutput = "";
|
|
string strOffline = "offline jedi\r\n";
|
|
dictionary dctJediInfo = requestJedi(IGNORE_JEDI_STAT, IGNORE_JEDI_STAT, 1, 1000, IGNORE_JEDI_STAT, IGNORE_JEDI_STAT);
|
|
|
|
if (dctJediInfo==null)
|
|
{
|
|
strOutput = "requestJedi() returned NULL dctJediInfo\r\n";
|
|
}
|
|
else
|
|
{
|
|
obj_id[] objJedis = dctJediInfo.getObjIdArray("id");
|
|
string[] strNames = dctJediInfo.getStringArray("name");
|
|
int[] visibility = dctJediInfo.getIntArray("visibility");
|
|
int[] bountyValue = dctJediInfo.getIntArray("bountyValue");
|
|
int[] level = dctJediInfo.getIntArray("level");
|
|
int[] faction = dctJediInfo.getIntArray("faction");
|
|
location[] loc = dctJediInfo.getLocationArray("location");
|
|
|
|
if (objJedis != null && strNames != null && visibility != null)
|
|
{
|
|
strOutput = "requestJedi() returned " + objJedis.length + " jedis\r\n";
|
|
|
|
for (int i = 0; i < objJedis.length; ++i)
|
|
{
|
|
dictionary dctSingleJediInfo = requestJedi(objJedis[i]);
|
|
if (dctSingleJediInfo != null)
|
|
{
|
|
boolean boolOnline = dctSingleJediInfo.getBoolean("online");
|
|
if (boolOnline)
|
|
{
|
|
++numOnlineJedis;
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ",";
|
|
strOutput += bountyValue[i];
|
|
strOutput += ",";
|
|
strOutput += level[i];
|
|
strOutput += ",";
|
|
strOutput += getFactionString(faction[i]);
|
|
strOutput += ",";
|
|
strOutput += loc[i];
|
|
strOutput += ") is online\r\n";
|
|
}
|
|
else
|
|
{
|
|
++numOfflineJedis;
|
|
strOffline += objJedis[i];
|
|
strOffline += " (";
|
|
strOffline += strNames[i];
|
|
strOffline += ",";
|
|
strOffline += visibility[i];
|
|
strOffline += ",";
|
|
strOffline += bountyValue[i];
|
|
strOffline += ",";
|
|
strOffline += level[i];
|
|
strOffline += ",";
|
|
strOffline += getFactionString(faction[i]);
|
|
strOffline += ",";
|
|
strOffline += loc[i];
|
|
strOffline += ") is offline\r\n";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ",";
|
|
strOutput += bountyValue[i];
|
|
strOutput += ",";
|
|
strOutput += level[i];
|
|
strOutput += ",";
|
|
strOutput += getFactionString(faction[i]);
|
|
strOutput += ",";
|
|
strOutput += loc[i];
|
|
strOutput += ") ***ERROR*** requestJedi() returned null\r\n";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput = "requestJedi() returned null data\r\n";
|
|
}
|
|
}
|
|
|
|
strOutput += numOnlineJedis;
|
|
strOutput += " online jedis\r\n";
|
|
|
|
strOffline += numOfflineJedis;
|
|
strOffline += " offline jedis\r\n";
|
|
|
|
saveTextOnClient(self, "online_jedi" + file + "a.txt", strOutput);
|
|
saveTextOnClient(self, "offline_jedi" + file + "a.txt", strOffline);
|
|
}
|
|
|
|
if (true)
|
|
{
|
|
int numOnlineJedis = 0;
|
|
int numOfflineJedis = 0;
|
|
string strOutput = "";
|
|
string strOffline = "offline jedi\r\n";
|
|
dictionary dctJediInfo = requestJedi(IGNORE_JEDI_STAT, IGNORE_JEDI_STAT, 1, 1000, IGNORE_JEDI_STAT, IGNORE_JEDI_STAT);
|
|
|
|
if (dctJediInfo==null)
|
|
{
|
|
strOutput = "requestJedi() returned NULL dctJediInfo\r\n";
|
|
}
|
|
else
|
|
{
|
|
obj_id[] objJedis = dctJediInfo.getObjIdArray("id");
|
|
string[] strNames = dctJediInfo.getStringArray("name");
|
|
int[] visibility = dctJediInfo.getIntArray("visibility");
|
|
int[] bountyValue = dctJediInfo.getIntArray("bountyValue");
|
|
int[] level = dctJediInfo.getIntArray("level");
|
|
int[] faction = dctJediInfo.getIntArray("faction");
|
|
location[] loc = dctJediInfo.getLocationArray("location");
|
|
|
|
if (objJedis != null && strNames != null && visibility != null)
|
|
{
|
|
strOutput = "requestJedi() returned " + objJedis.length + " jedis\r\n";
|
|
|
|
for (int i = 0; i < objJedis.length; ++i)
|
|
{
|
|
dictionary dctSingleJediInfo = requestJedi(objJedis[i]);
|
|
if (dctSingleJediInfo != null)
|
|
{
|
|
boolean boolOnline = dctSingleJediInfo.getBoolean("online");
|
|
if (boolOnline)
|
|
{
|
|
++numOnlineJedis;
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ",";
|
|
strOutput += bountyValue[i];
|
|
strOutput += ",";
|
|
strOutput += level[i];
|
|
strOutput += ",";
|
|
strOutput += getFactionString(faction[i]);
|
|
strOutput += ",";
|
|
strOutput += loc[i];
|
|
strOutput += ") is online\r\n";
|
|
}
|
|
else
|
|
{
|
|
++numOfflineJedis;
|
|
strOffline += objJedis[i];
|
|
strOffline += " (";
|
|
strOffline += strNames[i];
|
|
strOffline += ",";
|
|
strOffline += visibility[i];
|
|
strOffline += ",";
|
|
strOffline += bountyValue[i];
|
|
strOffline += ",";
|
|
strOffline += level[i];
|
|
strOffline += ",";
|
|
strOffline += getFactionString(faction[i]);
|
|
strOffline += ",";
|
|
strOffline += loc[i];
|
|
strOffline += ") is offline\r\n";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput += objJedis[i];
|
|
strOutput += " (";
|
|
strOutput += strNames[i];
|
|
strOutput += ",";
|
|
strOutput += visibility[i];
|
|
strOutput += ",";
|
|
strOutput += bountyValue[i];
|
|
strOutput += ",";
|
|
strOutput += level[i];
|
|
strOutput += ",";
|
|
strOutput += getFactionString(faction[i]);
|
|
strOutput += ",";
|
|
strOutput += loc[i];
|
|
strOutput += ") ***ERROR*** requestJedi() returned null\r\n";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strOutput = "requestJedi() returned null data\r\n";
|
|
}
|
|
}
|
|
|
|
strOutput += numOnlineJedis;
|
|
strOutput += " online jedis\r\n";
|
|
|
|
strOffline += numOfflineJedis;
|
|
strOffline += " offline jedis\r\n";
|
|
|
|
saveTextOnClient(self, "online_jedi" + file + "b.txt", strOutput);
|
|
saveTextOnClient(self, "offline_jedi" + file + "b.txt", strOffline);
|
|
}
|
|
}
|
|
}
|
|
else if (strText.startsWith("crbt"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(strText);
|
|
if (st.countTokens() == 3)
|
|
{
|
|
string command = st.nextToken();
|
|
string bh = st.nextToken();
|
|
string jedi = st.nextToken();
|
|
|
|
obj_id bhId = utils.stringToObjId(bh);
|
|
obj_id jediId = utils.stringToObjId(jedi);
|
|
|
|
string bhName = "";
|
|
string jediName = "";
|
|
|
|
if ((bhId != null) && (isIdValid(bhId)))
|
|
bhName = getPlayerName(bhId);
|
|
|
|
if ((jediId != null) && (isIdValid(jediId)))
|
|
jediName = getPlayerName(jediId);
|
|
|
|
if ((bhName == null) || (bhName == ""))
|
|
{
|
|
sendSystemMessageTestingOnly(self, bh + " is not a player character");
|
|
}
|
|
else if ((jediName == null) || (jediName == ""))
|
|
{
|
|
sendSystemMessageTestingOnly(self, jedi + " is not a player character");
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "attempting to create bounty bh=(" + bh + "," + bhName + ") jedi=(" + jedi + "," + jediName + ")");
|
|
requestJediBounty(jediId, bhId, "hnguyencrbtConfirmed", "hnguyencrbtFailed");
|
|
}
|
|
}
|
|
}
|
|
else if (strText.startsWith("rmbt"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(strText);
|
|
if (st.countTokens() == 3)
|
|
{
|
|
string command = st.nextToken();
|
|
string bh = st.nextToken();
|
|
string jedi = st.nextToken();
|
|
|
|
obj_id bhId = utils.stringToObjId(bh);
|
|
obj_id jediId = utils.stringToObjId(jedi);
|
|
|
|
string bhName = "";
|
|
string jediName = "";
|
|
|
|
if ((bhId != null) && (isIdValid(bhId)))
|
|
bhName = getPlayerName(bhId);
|
|
|
|
if ((jediId != null) && (isIdValid(jediId)))
|
|
jediName = getPlayerName(jediId);
|
|
|
|
if ((bhName == null) || (bhName == ""))
|
|
{
|
|
sendSystemMessageTestingOnly(self, bh + " is not a player character");
|
|
}
|
|
else if ((jediName == null) || (jediName == ""))
|
|
{
|
|
sendSystemMessageTestingOnly(self, jedi + " is not a player character");
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "removing bounty bh=(" + bh + "," + bhName + ") jedi=(" + jedi + "," + jediName + ")");
|
|
removeJediBounty(jediId, bhId);
|
|
}
|
|
}
|
|
}
|
|
else if (strText.startsWith("dmpbt"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(strText);
|
|
if (st.countTokens() == 2)
|
|
{
|
|
string command = st.nextToken();
|
|
string fileName = st.nextToken();
|
|
string output = "";
|
|
|
|
dictionary result = requestJedi(IGNORE_JEDI_STAT, IGNORE_JEDI_STAT, 1, 1000, IGNORE_JEDI_STAT, IGNORE_JEDI_STAT, IGNORE_JEDI_STAT);
|
|
if (result != null)
|
|
{
|
|
obj_id[] id = result.getObjIdArray("id");
|
|
string[] name = result.getStringArray("name");
|
|
obj_id[][] bounties = (obj_id[][])(result.get("bounties"));
|
|
if (id != null && id.length > 0)
|
|
{
|
|
for (int i = 0; i < id.length; ++i)
|
|
{
|
|
if (bounties[i] != null && bounties[i].length > 0)
|
|
{
|
|
output += "(";
|
|
output += id[i];
|
|
output += ",";
|
|
output += name[i];
|
|
output += ",";
|
|
output += bounties[i].length;
|
|
output += ") - ";
|
|
|
|
for (int j = 0; j < bounties[i].length; ++j)
|
|
{
|
|
output += bounties[i][j];
|
|
output += "(";
|
|
output += getPlayerName(bounties[i][j]);
|
|
output += ") ";
|
|
}
|
|
|
|
output += "\r\n";
|
|
}
|
|
}
|
|
|
|
if (output == "")
|
|
{
|
|
sendSystemMessageTestingOnly(self, "requestJedi() returned no bounties");
|
|
}
|
|
else
|
|
{
|
|
saveTextOnClient(self, fileName + ".txt", output);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "requestJedi() returned no Jedi");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "requestJedi() returned null dictionary");
|
|
}
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
*/
|
|
}
|
|
|
|
messageHandler hnguyencrbtConfirmed()
|
|
{
|
|
obj_id bhId = params.getObjId( "hunter");
|
|
obj_id jediId = params.getObjId( "jedi");
|
|
int bounties = params.getInt("bounties");
|
|
|
|
string bhName = "";
|
|
string jediName = "";
|
|
|
|
if ((bhId != null) && (isIdValid(bhId)))
|
|
bhName = getPlayerName(bhId);
|
|
|
|
if ((jediId != null) && (isIdValid(jediId)))
|
|
jediName = getPlayerName(jediId);
|
|
|
|
sendSystemMessageTestingOnly(self, "SUCCESS - bounty created bh=(" + bhId + "," + bhName + ") jedi=(" + jediId + "," + jediName + "," + bounties + ")");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler hnguyencrbtFailed()
|
|
{
|
|
obj_id bhId = params.getObjId( "hunter");
|
|
obj_id jediId = params.getObjId( "jedi");
|
|
int bounties = params.getInt("bounties");
|
|
|
|
string bhName = "";
|
|
string jediName = "";
|
|
|
|
if ((bhId != null) && (isIdValid(bhId)))
|
|
bhName = getPlayerName(bhId);
|
|
|
|
if ((jediId != null) && (isIdValid(jediId)))
|
|
jediName = getPlayerName(jediId);
|
|
|
|
sendSystemMessageTestingOnly(self, "FAILED - bounty not created bh=(" + bhId + "," + bhName + ") jedi=(" + jediId + "," + jediName + "," + bounties + ")");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
string getFactionString(int iTefFac)
|
|
{
|
|
string sTefFacName = "<unknown>";
|
|
|
|
if (iTefFac == ##"battlefield")
|
|
sTefFacName = "battlefield";
|
|
else if (iTefFac == ##"duel")
|
|
sTefFacName = "duel";
|
|
else if (iTefFac == ##"bountyduel")
|
|
sTefFacName = "bountyduel";
|
|
else if (iTefFac == ##"nonaggressive")
|
|
sTefFacName = "nonaggressive";
|
|
else if (iTefFac == ##"unattackable")
|
|
sTefFacName = "unattackable";
|
|
else if (iTefFac == ##"bountytarget")
|
|
sTefFacName = "bountytarget";
|
|
else if (iTefFac == ##"guildwarcooldownperiod")
|
|
sTefFacName = "guildwarcooldownperiod";
|
|
else if (iTefFac == ##"imperial")
|
|
sTefFacName = "imperial";
|
|
else if (iTefFac == ##"rebel")
|
|
sTefFacName = "rebel";
|
|
else if (iTefFac == ##"bubblecombat")
|
|
sTefFacName = "bubblecombat";
|
|
|
|
return sTefFacName;
|
|
}
|