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

138 lines
4.4 KiB
Java
Executable File

package script.systems.gcw;
import script.*;
import script.library.chat;
import script.library.gcw;
import script.library.sui;
import script.library.utils;
public class newsnet_terminal extends script.base_script
{
public newsnet_terminal()
{
}
public int OnInitialize(obj_id self) throws InterruptedException
{
callAttentionBarker(self);
return SCRIPT_CONTINUE;
}
public static final float MIN_BARK_TIME = 30.0f;
public static final float MAX_BARK_TIME = 240.0f;
public static final float[] RATINGS =
{
0.10f,
0.25f,
0.50f,
0.75f,
1.0f,
1.25f,
1.5f,
2.0f,
2.5f
};
public static final String[] RATING_STRINGS =
{
"rebel_losing_4",
"rebel_losing_3",
"rebel_losing_2",
"rebel_losing_1",
"equal",
"rebel_winning_1",
"rebel_winning_2",
"rebel_winning_3",
"rebel_winning_4"
};
public static final String[] BARK_STRINGS =
{
"newsnet_extra",
"newsnet_read_all"
};
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info item) throws InterruptedException
{
int menuOption = item.addRootMenu(menu_info_types.ITEM_USE, new string_id("gcw", "read_headline"));
return SCRIPT_CONTINUE;
}
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
{
if (item == menu_info_types.ITEM_USE)
{
LOG("LOG_CHANNEL", "newsnet_terminal::OnItemUse");
doNewsNetUI(self, player);
}
return SCRIPT_CONTINUE;
}
public void doNewsNetUI(obj_id self, obj_id player) throws InterruptedException
{
float fltRatio = gcw.getRebelRatio(self);
LOG("gcw", "ratio is " + fltRatio);
String headlineString = getHeadlineString(fltRatio);
location locTest = getLocation(self);
String strPlanetID = locTest.area;
String planetSTFName = "general";
if (strPlanetID.equals("naboo") || strPlanetID.equals("corellia"))
{
planetSTFName = strPlanetID;
}
String strBody = "headline_" + planetSTFName + "_" + headlineString;
String strTitle = planetSTFName + "_newsnet_name";
string_id strTitleId = new string_id("gcw", strTitle);
string_id strBodyID = new string_id("gcw", strBody);
sui.msgbox(player, player, utils.packStringId(strBodyID), sui.OK_ONLY, utils.packStringId(strTitleId), "noHandler");
}
public String getHeadlineString(float fltRatio) throws InterruptedException
{
if (fltRatio <= RATINGS[0])
{
return RATING_STRINGS[0];
}
else if ((fltRatio >= RATINGS[0]) && (fltRatio <= RATINGS[1]))
{
return RATING_STRINGS[1];
}
else if ((fltRatio >= RATINGS[1]) && (fltRatio <= RATINGS[2]))
{
return RATING_STRINGS[2];
}
else if ((fltRatio >= RATINGS[2]) && (fltRatio <= RATINGS[3]))
{
return RATING_STRINGS[3];
}
else if ((fltRatio >= RATINGS[3]) && (fltRatio <= RATINGS[5]))
{
return RATING_STRINGS[4];
}
else if ((fltRatio >= RATINGS[5]) && (fltRatio <= RATINGS[6]))
{
return RATING_STRINGS[5];
}
else if ((fltRatio >= RATINGS[6]) && (fltRatio <= RATINGS[7]))
{
return RATING_STRINGS[6];
}
else if ((fltRatio >= RATINGS[7]) && (fltRatio <= RATINGS[8]))
{
return RATING_STRINGS[7];
}
else if (fltRatio >= RATINGS[8])
{
return RATING_STRINGS[8];
}
else
{
return null;
}
}
public void callAttentionBarker(obj_id self) throws InterruptedException
{
float bark_delay = rand(MIN_BARK_TIME, MIN_BARK_TIME);
messageTo(self, "barkForAttention", null, bark_delay, false);
}
public int factionBaseUnitRefund(obj_id self, dictionary params) throws InterruptedException
{
string_id barkMessage = new string_id("gcw", BARK_STRINGS[rand(0, BARK_STRINGS.length)]);
chat.chat(self, "exclaim", barkMessage);
callAttentionBarker(self);
return SCRIPT_CONTINUE;
}
}