Files
dsrc/sku.0/sys.server/compiled/game/script/systems/gcw/flip_banner.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

112 lines
3.6 KiB
Java
Executable File

package script.systems.gcw;
import script.*;
import script.library.gcw;
import script.library.locations;
import script.library.utils;
public class flip_banner extends script.base_script
{
public flip_banner()
{
}
public int OnInitialize(obj_id self) throws InterruptedException
{
messageTo(self, "checkBannerImpulse", null, 1.0f, false);
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
messageTo(self, "checkBannerImpulse", null, 1.0f, false);
return SCRIPT_CONTINUE;
}
public int OnDestroy(obj_id self) throws InterruptedException
{
if (utils.hasScriptVar(self, "banner"))
{
obj_id banner = utils.getObjIdScriptVar(self, "banner");
if (isIdValid(banner))
{
destroyObject(banner);
}
}
return SCRIPT_CONTINUE;
}
public int OnUnloadedFromMemory(obj_id self) throws InterruptedException
{
if (utils.hasScriptVar(self, "banner"))
{
obj_id banner = utils.getObjIdScriptVar(self, "banner");
if (isIdValid(banner))
{
destroyObject(banner);
}
}
return SCRIPT_CONTINUE;
}
public int checkBannerImpulse(obj_id self, dictionary params) throws InterruptedException
{
float imp_r = gcw.getImperialPercentileByRegion(self);
float reb_r = gcw.getRebelPercentileByRegion(self);
if ((imp_r > reb_r))
{
utils.setScriptVar(self, "faction", 1);
obj_id banner = utils.getObjIdScriptVar(self, "banner");
if (isIdValid(banner))
{
destroyObject(banner);
}
spawnBanner(self, "imperial");
}
else if ((reb_r > imp_r))
{
utils.setScriptVar(self, "faction", 2);
obj_id banner = utils.getObjIdScriptVar(self, "banner");
if (isIdValid(banner))
{
destroyObject(banner);
}
spawnBanner(self, "rebel");
}
messageTo(self, "checkBannerImpulse", null, 3600.0f, false);
return SCRIPT_CONTINUE;
}
public void spawnBanner(obj_id self, String faction) throws InterruptedException
{
String empiredayRunning = getConfigSetting("GameServer", "empireday_ceremony");
if (empiredayRunning != null && (empiredayRunning.equals("true") || empiredayRunning.equals("1")))
{
location here = getLocation(self);
String city = locations.getCityName(here);
if (city == null)
{
city = locations.getGuardSpawnerRegionName(here);
}
if (city != null && city.length() > 0)
{
if (city.equals("coronet"))
{
faction = "rebel";
}
else if (city.equals("theed"))
{
faction = "imperial";
}
}
}
transform t = getTransform_o2w(self);
if (faction.equals("rebel"))
{
t = t.move_l(new vector(0, 0, 2));
}
obj_id banner = createObject("object/tangible/gcw/flip_banner_" + faction + ".iff", t, null);
if (banner == null || !isIdValid(banner))
{
return;
}
setObjVar(banner, "spawner", self);
utils.setScriptVar(self, "banner", banner);
return;
}
}