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

188 lines
6.9 KiB
Java
Executable File

package script.systems.gcw;
import script.*;
import script.library.*;
public class gcw_tower extends script.base_script
{
public gcw_tower()
{
}
public int OnInitialize(obj_id self) throws InterruptedException
{
setObjVar(self, "questCallBack", 1);
dictionary params = new dictionary();
location loc = getLocation(self);
params.put("particleLoc", loc);
int playIconTime = getGameTime();
params.put("iconMessageTime", playIconTime);
utils.setScriptVar(self, "iconMessageTime", playIconTime);
messageTo(self, "playQuestIcon", params, 1.0f, false);
setInvulnerable(self, false);
pvpSetAttackableOverride(self, true);
messageTo(self, "handleGCWTower", null, 2, false);
return SCRIPT_CONTINUE;
}
public int OnGetAttributes(obj_id self, obj_id player, String[] names, String[] attribs) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
{
if (!utils.hasScriptVar(self, "faction"))
{
LOG("gcw_patrol_point", "no faction on turret obj");
return SCRIPT_CONTINUE;
}
if (!factions.isPlayerSameGcwFactionAsSchedulerObject(player, self))
{
LOG("gcw_patrol_point", "faction invalid on turret obj");
return SCRIPT_CONTINUE;
}
else
{
menu_info_data data = mi.getMenuItemByType(menu_info_types.ITEM_USE);
if (data != null)
{
data.setServerNotify(true);
}
}
return SCRIPT_CONTINUE;
}
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
{
LOG("gcw_patrol_point", "OnObjectMenuSelect");
if (!isIdValid(player) || !exists(player) || isIncapacitated(player) || isDead(player) || factions.isOnLeave(player))
{
return SCRIPT_CONTINUE;
}
if (!utils.hasScriptVar(self, "faction"))
{
LOG("gcw_patrol_point", "no faction on patrol obj");
return SCRIPT_CONTINUE;
}
int faction = utils.getIntScriptVar(self, "faction");
if (faction < 0)
{
LOG("gcw_patrol_point", "faction invalid on patrol obj");
return SCRIPT_CONTINUE;
}
if (!factions.isPlayerSameGcwFactionAsSchedulerObject(player, self))
{
LOG("gcw_patrol_point", "Wrong Faction");
return SCRIPT_CONTINUE;
}
else
{
LOG("gcw_patrol_point", "player is of correct faction");
String questName = gcw.GCW_DEFEND_TOWER_REBEL;
if (faction == factions.FACTION_FLAG_IMPERIAL)
{
questName = gcw.GCW_DEFEND_TOWER_IMPERIAL;
}
LOG("gcw_patrol_point", "questName: " + questName);
if (groundquests.isQuestActive(player, questName))
{
return SCRIPT_CONTINUE;
}
if (groundquests.hasCompletedQuest(player, questName))
{
groundquests.clearQuest(player, questName);
}
if (!groundquests.isQuestActive(player, questName))
{
groundquests.grantQuest(player, questName);
}
}
return SCRIPT_CONTINUE;
}
public int destroyGCWTower(obj_id self, dictionary params) throws InterruptedException
{
trial.cleanupObject(self);
return SCRIPT_CONTINUE;
}
public int playQuestIcon(obj_id self, dictionary params) throws InterruptedException
{
params.put("offset", 12.0f);
gcw.playQuestIconHandler(self, params);
return SCRIPT_CONTINUE;
}
public int OnDeath(obj_id self, obj_id killer, obj_id corpseId) throws InterruptedException
{
handleDestroyTower(self, killer);
return SCRIPT_CONTINUE;
}
public int OnObjectDisabled(obj_id self, obj_id killer) throws InterruptedException
{
handleDestroyTower(self, killer);
return SCRIPT_CONTINUE;
}
public void handleDestroyTower(obj_id self, obj_id killer) throws InterruptedException
{
playClientEffectLoc(self, "clienteffect/combat_explosion_lair_large.cef", getLocation(self), 0);
setInvulnerable(self, true);
messageTo(self, "destroyGCWTower", null, 1.0f, false);
gcw.gcwInvasionCreditForDestroy(killer);
return;
}
public int OnObjectDamaged(obj_id self, obj_id attacker, obj_id weapon, int damage) throws InterruptedException
{
if (!isIdValid(attacker) || !exists(attacker) || !isIdValid(weapon) || !exists(weapon) || damage < 1)
{
return SCRIPT_CONTINUE;
}
String template = getTemplateName(attacker);
if (template == null || (!template.equals("object/mobile/atst.iff") && !template.equals("object/mobile/atxt.iff") && !template.equals("object/mobile/atat.iff")))
{
LOG("gcw_vehicle", "Tower being attacked by non-vehicle: " + attacker);
return SCRIPT_CONTINUE;
}
LOG("gcw_vehicle", "Tower being attacked by vehicle: " + attacker + " damage: " + damage);
return SCRIPT_CONTINUE;
}
public int handleGCWTower(obj_id self, dictionary params) throws InterruptedException
{
obj_id[] objects = getObjectsInRange(self, 25.0f);
int faction = -1;
if (utils.hasScriptVar(self, "faction"))
{
faction = utils.getIntScriptVar(self, "faction");
}
if (objects != null && objects.length > 0)
{
for (obj_id object : objects) {
if (isIdValid(object) && isMob(object) && !isPlayer(object) && !isIdValid(getMaster(object)) && factions.isPlayerSameGcwFactionAsSchedulerObject(object, self)) {
buff.applyBuff(object, self, "tower_defender");
}
}
}
messageTo(self, "handleGCWTower", null, 10, false);
return SCRIPT_CONTINUE;
}
public int handleQuestCallBack(obj_id self, dictionary params) throws InterruptedException
{
if (params == null)
{
return SCRIPT_CONTINUE;
}
if (!params.containsKey("questComplete"))
{
return SCRIPT_CONTINUE;
}
if (!params.containsKey("player"))
{
return SCRIPT_CONTINUE;
}
if (params.getBoolean("questComplete"))
{
obj_id player = params.getObjId("player");
if (!isValidId(player))
{
return SCRIPT_CONTINUE;
}
trial.addNonInstanceFactionParticipant(player, self);
}
return SCRIPT_CONTINUE;
}
}