mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
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 <[email protected]>
This commit is contained in:
committed by
Tekaoh
co-authored by
rotations
parent
536c5bf2d1
commit
795c1fe00d
@@ -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
|
||||
+1
@@ -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]
|
||||
|
||||
+14
-53
@@ -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<rows;i++) {
|
||||
if (hasObjVar(self, dataTableGetString(ITV_COMMAND_TABLE, i, 0))) {
|
||||
if (hasCommand(player,dataTableGetString(ITV_COMMAND_TABLE, i, 1))) {
|
||||
sendSystemMessageTestingOnly(player, "You have already used this item.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
grantCommand(player, dataTableGetString(ITV_COMMAND_TABLE, i, 1));
|
||||
destroyObject(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
else if (hasObjVar(self, "royalShip") && (!hasObjVar(player, "itv.owned.royalship")))
|
||||
{
|
||||
grantCommand(player, "callforroyalpickup");
|
||||
setObjVar(player, "itv.owned.royalship", 1);
|
||||
destroyObject(self);
|
||||
}
|
||||
else if (hasObjVar(self, "junk") && (!hasObjVar(player, "itv.owned.junk")))
|
||||
{
|
||||
grantCommand(player, "callforrattletrappickup");
|
||||
setObjVar(player, "itv.owned.junk", 1);
|
||||
destroyObject(self);
|
||||
}
|
||||
else if (hasObjVar(self, "tcg_itv_home") && (!hasObjVar(player, "itv.owned.solar")))
|
||||
{
|
||||
grantCommand(player, "callforsolarsailerpickup");
|
||||
setObjVar(player, "itv.owned.solar", 1);
|
||||
destroyObject(self);
|
||||
}
|
||||
else if (hasObjVar(self, "tcg_itv_location") && (!hasObjVar(player, "itv.owned.g9rigger")))
|
||||
{
|
||||
grantCommand(player, "callforg9riggerpickup");
|
||||
setObjVar(player, "itv.owned.g9rigger", 1);
|
||||
destroyObject(self);
|
||||
}
|
||||
else if (hasObjVar(self, "itv_snowspeeder") && (!hasObjVar(player, "itv.owned.snowspeeder")))
|
||||
{
|
||||
grantCommand(player, "callforsnowspeeder");
|
||||
setObjVar(player, "itv.owned.snowspeeder", 1);
|
||||
destroyObject(self);
|
||||
}
|
||||
else if (hasObjVar(self, "itv_slave_1") && (!hasObjVar(player, "itv.owned.slave1")))
|
||||
{
|
||||
grantCommand(player, "callforslave1pickup");
|
||||
setObjVar(player, "itv.owned.slave1", 1);
|
||||
destroyObject(self);
|
||||
}
|
||||
else if (hasObjVar(self, "default_itv") && (!hasObjVar(player, "itv.owned.callforpickup")))
|
||||
{
|
||||
grantCommand(player, "callforpickup");
|
||||
setObjVar(player, "itv.owned.callforpickup", 1);
|
||||
destroyObject(self);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "You have already used this item.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user