From 795c1fe00d3922d9f7b3d4ebe165ac1a3f995d6f Mon Sep 17 00:00:00 2001 From: Reedux Date: Sat, 11 Jan 2020 21:53:26 +0000 Subject: [PATCH] Change ITV check to a datatable query for ease of adding future ITVs (#78) * Change ITV check to a datatable query for ease of adding future ITV vehicles * Adjusted to check if ITV has already been learned Idea from tyrones PR https://github.com/SWG-Source/dsrc/pull/77 Co-authored-by: rotations --- .../game/datatables/item/itv_command_list.tab | 10 +++ .../instant_travel_terminal.tpf | 1 + .../instant_travel_terminal_deed.java | 67 ++++--------------- 3 files changed, 25 insertions(+), 53 deletions(-) create mode 100644 sku.0/sys.server/compiled/game/datatables/item/itv_command_list.tab diff --git a/sku.0/sys.server/compiled/game/datatables/item/itv_command_list.tab b/sku.0/sys.server/compiled/game/datatables/item/itv_command_list.tab new file mode 100644 index 000000000..e51e3c1a6 --- /dev/null +++ b/sku.0/sys.server/compiled/game/datatables/item/itv_command_list.tab @@ -0,0 +1,10 @@ +objVarName itvCommand +s s +privateerShip callforprivateerpickup +royalShip callforroyalpickup +junk callforrattletrappickup +tcg_itv_home callforsolarsailerpickup +tcg_itv_location callforg9riggerpickup +itv_snowspeeder callforsnowspeeder +itv_slave_1 callforslave1pickup +default_itv callforpickup diff --git a/sku.0/sys.server/compiled/game/object/tangible/veteran_reward/instant_travel_terminal.tpf b/sku.0/sys.server/compiled/game/object/tangible/veteran_reward/instant_travel_terminal.tpf index 2073246b3..2e7bbf8aa 100755 --- a/sku.0/sys.server/compiled/game/object/tangible/veteran_reward/instant_travel_terminal.tpf +++ b/sku.0/sys.server/compiled/game/object/tangible/veteran_reward/instant_travel_terminal.tpf @@ -8,3 +8,4 @@ sharedTemplate = "object/tangible/veteran_reward/shared_instant_travel_terminal. scripts = ["systems.veteran_reward.instant_travel_terminal_deed", "item.special.nomove"] objvars = +["default_itv" = 1] persistByDefault = true +objvars = +["default_itv" = 1] diff --git a/sku.0/sys.server/compiled/game/script/systems/veteran_reward/instant_travel_terminal_deed.java b/sku.0/sys.server/compiled/game/script/systems/veteran_reward/instant_travel_terminal_deed.java index 2a6b99408..2862ad6ee 100755 --- a/sku.0/sys.server/compiled/game/script/systems/veteran_reward/instant_travel_terminal_deed.java +++ b/sku.0/sys.server/compiled/game/script/systems/veteran_reward/instant_travel_terminal_deed.java @@ -10,6 +10,7 @@ public class instant_travel_terminal_deed extends script.base_script public instant_travel_terminal_deed() { } + private static final String ITV_COMMAND_TABLE = "datatables/item/itv_command_list.iff"; public static final string_id LEARN_ABILITY = new string_id("item_n", "instant_travel_terminal_learn"); public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { @@ -27,61 +28,21 @@ public class instant_travel_terminal_deed extends script.base_script { if(getLevel(player) < minimumLevel){ sendSystemMessage(player, "Instant Travel vehicles may not be used until you have reached level " + minLevelSetting + ". Please use this deed again when you reach level " + minLevelSetting + " or higher.", null); + return SCRIPT_CONTINUE; } - else if (hasObjVar(self, "privateerShip") && (!hasObjVar(player, "itv.owned.privateer"))) - { - grantCommand(player, "callforprivateerpickup"); - setObjVar(player, "itv.owned.privateer", 1); - destroyObject(self); + // Make sure the default_itv is always at the bottom of the table else you will get false hits + int rows = dataTableGetNumRows(ITV_COMMAND_TABLE); + for (int i=0;i