From 0e8f027a407aaaf8d71dd0fceea5368af347dfd9 Mon Sep 17 00:00:00 2001 From: Reedux Date: Sat, 11 Jan 2020 15:04:12 +0000 Subject: [PATCH] Change ITV check to a datatable query for ease of adding future ITV vehicles --- .../game/datatables/item/itv_command_list.tab | 9 ++++ .../instant_travel_terminal_deed.java | 50 ++++--------------- 2 files changed, 20 insertions(+), 39 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..340e0a650 --- /dev/null +++ b/sku.0/sys.server/compiled/game/datatables/item/itv_command_list.tab @@ -0,0 +1,9 @@ +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 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 fad1ff20b..f19d0b627 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,47 +28,18 @@ 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")) - { - grantCommand(player, "callforprivateerpickup"); - destroyObject(self); - } - else if (hasObjVar(self, "royalShip")) - { - grantCommand(player, "callforroyalpickup"); - destroyObject(self); - } - else if (hasObjVar(self, "junk")) - { - grantCommand(player, "callforrattletrappickup"); - destroyObject(self); - } - else if (hasObjVar(self, "tcg_itv_home")) - { - grantCommand(player, "callforsolarsailerpickup"); - destroyObject(self); - } - else if (hasObjVar(self, "tcg_itv_location")) - { - grantCommand(player, "callforg9riggerpickup"); - destroyObject(self); - } - else if (hasObjVar(self, "itv_snowspeeder")) - { - grantCommand(player, "callforsnowspeeder"); - destroyObject(self); - } - else if (hasObjVar(self, "itv_slave_1")) - { - grantCommand(player, "callforslave1pickup"); - destroyObject(self); - } - else - { - grantCommand(player, "callforpickup"); - destroyObject(self); + int rows = dataTableGetNumRows(ITV_COMMAND_TABLE); + for (int i=0;i