Files
dsrc/sku.0/sys.server/compiled/game/script/working/jfreeman/creaturetest.java
T
TekaohandGitHub 5c2e112349 Java 11.0.2 migration (#32)
* Code compiles - execution NOT tested

* updating gitignore

* Removed intellij settings files

* Removed more intellij files

* Added exclusion for JDK classes.

* Fixed purchasing script for vendors that have listed coin types.

* Updated script to not kick off until the entire preload is complete.

* adds static name entry for Solo movie poster and tcg9 vendor entry

* clean up empty and orphaned object templates

* adds placeholder black market (static) spawns

* corrects entries for the video game table to correctly set it in tcg series 2 and remove series 1 console errors

* Updated gitignore and removed intellij project files

* Fixed appearance reference for thranta payroll and kashyyyk door, added skipLosCheck objvar due to cannit see issue. Requires updated src

* Fixed appearance and template for terminal (#2)

* Fixed appearance and template for terminal (#3)

* Fixed appearance and template for terminal (#4)

* Deleted another faulty/orphaned object template

* Fixed gcw ranks option on frog. Only issue is that it doesn't award the officer commands or badges.

* Fixed some unneeded java 11 changes
2019-04-18 18:31:52 -05:00

96 lines
3.6 KiB
Java
Executable File

package script.working.jfreeman;
import script.dictionary;
import script.library.create;
import script.library.utils;
import script.location;
import script.obj_id;
public class creaturetest extends script.base_script
{
public creaturetest()
{
}
public static final String CREATURE_TABLE = "datatables/mob/creatures.iff";
public int OnAttach(obj_id self) throws InterruptedException
{
debugSpeakMsg(self, "attached");
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (text.equals("creaturetest"))
{
if (utils.hasScriptVar(self, "creatureTest"))
{
debugSpeakMsg(self, "creaturetest is already running");
return SCRIPT_CONTINUE;
}
int startTime = getGameTime();
debugSpeakMsg(self, "beginning creatureTest " + startTime);
utils.setScriptVar(self, "startTime", startTime);
utils.setScriptVar(self, "creatureTest", 0);
LOG("creaturetest", "BEGIN " + startTime);
messageTo(self, "spawnNextCreature", null, 1, false);
}
else if (text.equals("creaturetest stop"))
{
utils.removeScriptVar(self, "creatureTest");
}
return SCRIPT_CONTINUE;
}
public int spawnNextCreature(obj_id self, dictionary params) throws InterruptedException
{
if (!utils.hasScriptVar(self, "creatureTest"))
{
return SCRIPT_CONTINUE;
}
int creatureNum = utils.getIntScriptVar(self, "creatureTest");
int numRows = dataTableGetNumRows(CREATURE_TABLE);
if (creatureNum >= numRows)
{
int startTime = utils.getIntScriptVar(self, "startTime");
debugSpeakMsg(self, "creaturetest " + startTime + " is DONE");
utils.removeScriptVar(self, "creatureTest");
utils.removeScriptVar(self, "startTime");
LOG("creaturetest", "END " + startTime);
return SCRIPT_CONTINUE;
}
String creatureName = dataTableGetString(CREATURE_TABLE, creatureNum, "creatureName");
if (creatureName.equals("") || creatureName == null)
{
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg(self, "CREATURE NAME IS " + creatureName + " - NUMBER: " + creatureNum);
utils.setScriptVar(self, "lastCreature", creatureName);
location spawnLoc = getLocation(self);
spawnLoc.x += 2;
spawnLoc.z += 2;
obj_id creature = create.object(creatureName, spawnLoc, false);
if (!isIdValid(creature))
{
String templateName = dataTableGetString(CREATURE_TABLE, creatureName, "template");
LOG("creaturetest", "UNABLE TO CREATE " + creatureName + " WITH TEMPLATE " + templateName + "DOES THIS TEMPLATE EXIST?");
LOG("creaturetest", creatureName + ":" + templateName);
}
else
{
destroyObject(creature);
}
creatureNum++;
utils.setScriptVar(self, "creatureTest", creatureNum);
messageTo(self, "spawnNextCreature", null, 1, false);
return SCRIPT_CONTINUE;
}
public int OnImmediateLogout(obj_id self) throws InterruptedException
{
String creatureName = utils.getStringScriptVar(self, "lastCreature");
if (creatureName != null)
{
LOG("creaturetest", "CLIENT FATAL " + creatureName);
debugServerConsoleMsg(self, "CLIENT FATAL " + creatureName);
}
return SCRIPT_CONTINUE;
}
}