mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-28 17:56:25 -04:00
Fixed issues with new Space GCW vendors not allowing purchases when tokens are stored in achievements box.
This commit is contained in:
@@ -4648,4 +4648,6 @@ item_tcg_loot_reward_series8_bespin_lamp_on string:type=lamp,string:status=off
|
||||
item_tcg_loot_reward_series8_bespin_shelves string:tcg.combineItemTemplatePattern=object/tangible/tcg/series8/combine_decorative_,string:tcg.setName=set8_cloud_house
|
||||
item_tcg_loot_reward_series8_glowly_sculpture string:tcg.combineItemTemplatePattern=object/tangible/tcg/series8/combine_decorative_,string:tcg.setName=set8_cloud_house
|
||||
item_tcg_loot_reward_series8_torture_table string:tcg.combineItemTemplatePattern=object/tangible/tcg/series8/combine_decorative_,string:tcg.setName=set8_cloud_house
|
||||
item_tcg_loot_reward_series8_armored_tauntaun_statue string:armored_creature_type=tcg8_armored_tauntaun
|
||||
item_tcg_loot_reward_series8_armored_tauntaun_statue string:armored_creature_type=tcg8_armored_tauntaun
|
||||
item_imperial_station_token_01_01
|
||||
item_rebel_station_token_01_01
|
||||
|
||||
+17
-18
@@ -1,18 +1,17 @@
|
||||
item cash token0 token1 token2 token3 token4 class script note
|
||||
s[none] i[0] i[0] i[0] i[0] i[0] i[0] i[0] s c
|
||||
item_schematic_gcw2_mandal_armor_plating 100 0 "See library.utils for the int value of the classes. 0 is ""all"" but will only show if there are no items for the opener's class."
|
||||
item_schematic_gcw2_mandal_fusion_reactor 100 0 "So in the case of this table only traders will see the ""all"" items."
|
||||
item_schematic_gcw2_eng_reward_experimental 100 0
|
||||
item_schematic_gcw2_borstel_cannon 100 0
|
||||
item_schematic_gcw2_tie_defender 300 0
|
||||
item_schematic_gcw2_vaksai_heavy 300 0
|
||||
item_schematic_gcw2_havoc 300 0
|
||||
item_ship_deed_tiedefender 1000 0
|
||||
item_ship_deed_havoc 1000 0
|
||||
item_helmet_ace_imp 50 0
|
||||
item_helmet_ace_neut 50 0
|
||||
item_jacket_ace_imp 50 0
|
||||
item_jacket_ace_neut 50 0
|
||||
item_kimogila_s01_texture_kit 50 0
|
||||
item_schematic_gcw2_survey_tool_all 100 0
|
||||
|
||||
item cash token20 class script note
|
||||
s[none] i[0] i[0] i[0] s c
|
||||
item_schematic_gcw2_mandal_armor_plating 100 0 "See library.utils for the int value of the classes. 0 is ""all"" but will only show if there are no items for the opener's class."
|
||||
item_schematic_gcw2_mandal_fusion_reactor 100 0 "So in the case of this table only traders will see the ""all"" items."
|
||||
item_schematic_gcw2_eng_reward_experimental 100 0
|
||||
item_schematic_gcw2_borstel_cannon 100 0
|
||||
item_schematic_gcw2_tie_defender 300 0
|
||||
item_schematic_gcw2_vaksai_heavy 300 0
|
||||
item_schematic_gcw2_havoc 300 0
|
||||
item_ship_deed_tiedefender 1000 0
|
||||
item_ship_deed_havoc 1000 0
|
||||
item_helmet_ace_imp 50 0
|
||||
item_helmet_ace_neut 50 0
|
||||
item_jacket_ace_imp 50 0
|
||||
item_jacket_ace_neut 50 0
|
||||
item_kimogila_s01_texture_kit 50 0
|
||||
item_schematic_gcw2_survey_tool_all 100 0
|
||||
|
||||
+17
-17
@@ -1,17 +1,17 @@
|
||||
item cash token0 token1 token2 token3 token4 class script note
|
||||
s[none] i[0] i[0] i[0] i[0] i[0] i[0] i[0] s c
|
||||
item_schematic_gcw2_mandal_armor_plating 100 0 "See library.utils for the int value of the classes. 0 is ""all"" but will only show if there are no items for the opener's class."
|
||||
item_schematic_gcw2_mandal_fusion_reactor 100 0 "So in the case of this table only traders will see the ""all"" items."
|
||||
item_schematic_gcw2_eng_reward_experimental 100 0
|
||||
item_schematic_gcw2_borstel_cannon 100 0
|
||||
item_schematic_gcw2_twing 300 0
|
||||
item_schematic_gcw2_vaksai_heavy 300 0
|
||||
item_schematic_gcw2_havoc 300 0
|
||||
item_ship_deed_twing 1000 0
|
||||
item_ship_deed_havoc 1000 0
|
||||
item_helmet_ace_neut 50 0
|
||||
item_helmet_ace_reb 50 0
|
||||
item_jacket_ace_neut 50 0
|
||||
item_jacket_ace_reb 50 0
|
||||
item_kimogila_s01_texture_kit 50 0
|
||||
item_schematic_gcw2_survey_tool_all 100 0
|
||||
item cash token21 class script note
|
||||
s[none] i[0] i[0] i[0] s c
|
||||
item_schematic_gcw2_mandal_armor_plating 100 0 "See library.utils for the int value of the classes. 0 is ""all"" but will only show if there are no items for the opener's class."
|
||||
item_schematic_gcw2_mandal_fusion_reactor 100 0 "So in the case of this table only traders will see the ""all"" items."
|
||||
item_schematic_gcw2_eng_reward_experimental 100 0
|
||||
item_schematic_gcw2_borstel_cannon 100 0
|
||||
item_schematic_gcw2_twing 300 0
|
||||
item_schematic_gcw2_vaksai_heavy 300 0
|
||||
item_schematic_gcw2_havoc 300 0
|
||||
item_ship_deed_twing 1000 0
|
||||
item_ship_deed_havoc 1000 0
|
||||
item_helmet_ace_neut 50 0
|
||||
item_helmet_ace_reb 50 0
|
||||
item_jacket_ace_neut 50 0
|
||||
item_jacket_ace_reb 50 0
|
||||
item_kimogila_s01_texture_kit 50 0
|
||||
item_schematic_gcw2_survey_tool_all 100 0
|
||||
|
||||
@@ -6678,8 +6678,8 @@ nym_themepark_pirate_engineer 60 0 0 0 -3 NORMAL lok piratesoflok marooned_p
|
||||
community_tcg_photo_contest_painting_handout 100 0 0 0 0 NORMAL townsperson dressed_noble_human_female_02.iff 0 0 0 0 0 0 0 0 0 2 npc 1 conversation.community_tcg_photo_contest_painting_handout commoner_10 commoner_10 0 2
|
||||
nym_themepark_sulfur_pirate_henchmen_low 60 1 0 0 -1 NORMAL lok sulfur_lake_pirate sulfur_lake_pirate criminal_smuggler 0.9 1.2 0 15 15 0 35 50 -1 -1 0 2 npc/npc_61_70 generic_npc_7 "housing_improvement_01,col_aurebesh_tiles,col_shattered_shard_01" npc "int:bm_doNotShowExamineInfo=1,int:distance_check=50,int:henchmen=1" theme_park.nym.boss_nyms_themepark pirate slang pirate_carbine pirate_pistol officer_7 officer_6 12 12
|
||||
naboo_vana_legacy_jeepfal_nareedo 25 0 0 0 0 NORMAL global thug thug thug_rodian_male 0 0 0 0 0 0 0 0 -1 2 npc/npc_1_10 generic_npc_1 npc ai.thug thug slang pirate_pistol_low_level pirate_carbine_low_level 0 2
|
||||
rebel_vendor_gcw2 100 0 0 0 0 NORMAL anywhere rebel Rebel dressed_rebel_recruiter_human_female_01.iff 1 1 0 0 0 0 0 0 0 0 -1 2 0 0 npc 1 "string:item.vendor.vendor_table=space_gcw_stuff_rebel,string:item.token.type=item_rebel_station_token_01_01" "npc.vendor.vendor,conversation.rebel_space_gcw_vendor" 0 0
|
||||
imperial_vendor_gcw2 100 0 0 0 0 NORMAL anywhere imperial Imperial tie_pilot_m.iff 1 1 0 0 0 0 0 0 0 0 -1 2 0 0 npc 1 "string:item.vendor.vendor_table=space_gcw_stuff_imperial,string:item.token.type=item_imperial_station_token_01_01" "npc.vendor.vendor,conversation.imperial_space_gcw_vendor" 0 0
|
||||
rebel_vendor_gcw2 100 0 0 0 0 NORMAL anywhere rebel Rebel dressed_rebel_recruiter_human_female_01.iff 1 1 0 0 0 0 0 0 0 0 -1 2 0 0 npc 1 "string:item.vendor.vendor_table=space_gcw_stuff_rebel" "npc.vendor.vendor,conversation.rebel_space_gcw_vendor" 0 0
|
||||
imperial_vendor_gcw2 100 0 0 0 0 NORMAL anywhere imperial Imperial tie_pilot_m.iff 1 1 0 0 0 0 0 0 0 0 -1 2 0 0 npc 1 "string:item.vendor.vendor_table=space_gcw_stuff_imperial" "npc.vendor.vendor,conversation.imperial_space_gcw_vendor" 0 0
|
||||
gcw_atst_familiar 1 0 0 0 0 NORMAL global imperial atst_toy.iff 0.1 0.1 0 35 35 -1 100 100 0 0 100 2 none 1 0
|
||||
gcw_atxt_familiar 1 0 0 0 0 NORMAL global rebel atxt_toy.iff 0.1 0.1 0 0 0 0 0 0 0 0 0 2 none 1 0
|
||||
item_tcg_loot_reward_series8_snow_speeder_familiar 1 0 0 0 0 NORMAL tcg set 8 loot item - snow speeder familiar anywhere tcg_familiar tcg_familiar_rebel snow_speeder_toy.iff 1 1 0 0 0 0 0 0 0 0 0 0 none 1 0
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
package script.npc.vendor;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.library.*;
|
||||
import script.menu_info_types;
|
||||
import script.obj_id;
|
||||
import script.prose_package;
|
||||
import script.string_id;
|
||||
|
||||
import script.library.factions;
|
||||
import script.library.money;
|
||||
import script.library.prose;
|
||||
import script.library.static_item;
|
||||
import script.library.township;
|
||||
import script.library.trial;
|
||||
import script.library.utils;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class object_for_sale extends script.base_script
|
||||
{
|
||||
@@ -137,127 +130,70 @@ public class object_for_sale extends script.base_script
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean confirmFunds(obj_id self, obj_id player) throws InterruptedException
|
||||
{
|
||||
boolean canPay = false;
|
||||
boolean hasTheCredits = false;
|
||||
boolean hasTheTokens = false;
|
||||
boolean foundTokenHolderBox = false;
|
||||
obj_id[] inventoryContents = getInventoryAndEquipment(player);
|
||||
|
||||
public boolean confirmFunds(obj_id self, obj_id player) throws InterruptedException {
|
||||
int creditCost = getIntObjVar(self, "item.object_for_sale.cash_cost");
|
||||
int[] tokenCostInThisFunction = getIntArrayObjVar(self, "item.object_for_sale.token_cost");
|
||||
if (creditCost < 1)
|
||||
{
|
||||
hasTheCredits = true;
|
||||
}
|
||||
if (creditCost >= 1)
|
||||
{
|
||||
if (money.hasFunds(player, money.MT_TOTAL, creditCost))
|
||||
{
|
||||
hasTheCredits = true;
|
||||
int[] tokenCosts = getIntArrayObjVar(self, "item.object_for_sale.token_cost");
|
||||
|
||||
// do we have enough credits for the item?
|
||||
boolean hasTheCredits = (creditCost < 1 || money.hasFunds(player, money.MT_TOTAL, creditCost));
|
||||
|
||||
// bail if we don't have enough credits - doesn't even matter if we have enough tokens or not.
|
||||
if(!hasTheCredits) return false;
|
||||
|
||||
// this thing may have token cost requirements to it so we have to check if we have enough tokens now.
|
||||
Map<String, Integer> tokensNeeded = new HashMap<>();
|
||||
Map<String, Integer> tokensFound = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < tokenCosts.length; i++) {
|
||||
if(tokenCosts[i] > 0){
|
||||
tokensNeeded.put(trial.HEROIC_TOKENS[i], tokenCosts[i]);
|
||||
tokensFound.put(trial.HEROIC_TOKENS[i], 0);
|
||||
}
|
||||
}
|
||||
int owedTokenCount = 0;
|
||||
boolean owesTokens = false;
|
||||
for (int o = 0; o < tokenCostInThisFunction.length; o++)
|
||||
{
|
||||
owedTokenCount += tokenCostInThisFunction[o];
|
||||
}
|
||||
if (owedTokenCount > 0)
|
||||
{
|
||||
owesTokens = true;
|
||||
}
|
||||
if (owesTokens)
|
||||
{
|
||||
for (int i = 0; i < inventoryContents.length; i++)
|
||||
{
|
||||
String itemName = getStaticItemName(inventoryContents[i]);
|
||||
if (itemName != null && !itemName.equals(""))
|
||||
{
|
||||
if (hasObjVar(self, VENDOR_TOKEN_TYPE))
|
||||
{
|
||||
String tokenList = getStringObjVar(self, VENDOR_TOKEN_TYPE);
|
||||
String[] differentTokens = split(tokenList, ',');
|
||||
for (int j = 0; j < differentTokens.length; j++)
|
||||
{
|
||||
if (itemName.equals(differentTokens[j]) && tokenCostInThisFunction[j] > 0)
|
||||
{
|
||||
if (getCount(inventoryContents[i]) > 1)
|
||||
{
|
||||
for (int m = 0; m < getCount(inventoryContents[i]); m++)
|
||||
{
|
||||
if (tokenCostInThisFunction[j] > 0)
|
||||
{
|
||||
tokenCostInThisFunction[j]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tokenCostInThisFunction[j]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bail if we don't need tokens because we've already proven we have the credits for it
|
||||
if(tokensNeeded.size() == 0) return true;
|
||||
|
||||
boolean foundTokenHolderBox = false;
|
||||
obj_id[] playerInventoryItems = getInventoryAndEquipment(player);
|
||||
for (obj_id inventoryItem : playerInventoryItems) {
|
||||
String itemName = getStaticItemName(inventoryItem);
|
||||
if(itemName == null || itemName.equals("")) continue;
|
||||
|
||||
// first see if the item is a token
|
||||
if (tokensNeeded.containsKey(itemName) && tokensNeeded.get(itemName) > 0) {
|
||||
// this is a token that we need, let's see if we have enough of them
|
||||
tokensFound.put(itemName, tokensFound.get(itemName) + getCount(inventoryItem));
|
||||
}
|
||||
// next, see if the item is a token box - all other item types can be ignored
|
||||
else if (itemName.equalsIgnoreCase("item_heroic_token_box_01_01") && !foundTokenHolderBox) {
|
||||
// this is a token box... let's see if we have this token in our box
|
||||
// first, let's be efficient - we can only have one so set a flag that prevents us from "finding another"
|
||||
foundTokenHolderBox = true;
|
||||
int[] tokensInBox = getIntArrayObjVar(inventoryItem, "item.set.tokens_held");
|
||||
// check if we have this token type in the box
|
||||
for (int k = 0; k < trial.HEROIC_TOKENS.length; k++) {
|
||||
String checkToken = trial.HEROIC_TOKENS[k];
|
||||
if(!tokensNeeded.containsKey(checkToken)){
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < trial.HEROIC_TOKENS.length; j++)
|
||||
{
|
||||
if (itemName.equals(trial.HEROIC_TOKENS[j]) && tokenCostInThisFunction[j] > 0)
|
||||
{
|
||||
if (getCount(inventoryContents[i]) > 1)
|
||||
{
|
||||
for (int m = 0; m < getCount(inventoryContents[i]); m++)
|
||||
{
|
||||
if (tokenCostInThisFunction[j] > 0)
|
||||
{
|
||||
tokenCostInThisFunction[j]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tokenCostInThisFunction[j]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundTokenHolderBox && itemName.equals("item_heroic_token_box_01_01"))
|
||||
{
|
||||
foundTokenHolderBox = true;
|
||||
if (hasObjVar(inventoryContents[i], "item.set.tokens_held"))
|
||||
{
|
||||
int[] virtualTokens = getIntArrayObjVar(inventoryContents[i], "item.set.tokens_held");
|
||||
for (int k = 0; k < trial.HEROIC_TOKENS.length; k++)
|
||||
{
|
||||
if (tokenCostInThisFunction[k] > 0 && virtualTokens[k] > 0)
|
||||
{
|
||||
int paymentIterations = tokenCostInThisFunction[k];
|
||||
for (int l = 0; l < paymentIterations; l++)
|
||||
{
|
||||
if (virtualTokens[k] > 0)
|
||||
{
|
||||
virtualTokens[k]--;
|
||||
tokenCostInThisFunction[k]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tokensNeeded.containsKey(checkToken) && tokensNeeded.get(checkToken) > 0 && tokensInBox[k] > 0) {
|
||||
tokensFound.put(checkToken, tokensFound.get(checkToken) + tokensInBox[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int outstandingTokensOwed = 0;
|
||||
for (int n = 0; n < tokenCostInThisFunction.length; n++)
|
||||
{
|
||||
outstandingTokensOwed += tokenCostInThisFunction[n];
|
||||
|
||||
// now after reviewing all inventory items, let's check how many tokens we have
|
||||
for(Map.Entry<String, Integer> token : tokensNeeded.entrySet()){
|
||||
// bail if we don't have enough of a token type
|
||||
if(tokensFound.get(token.getKey()) < token.getValue()){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (outstandingTokensOwed == 0)
|
||||
{
|
||||
hasTheTokens = true;
|
||||
}
|
||||
return hasTheCredits && hasTheTokens;
|
||||
|
||||
return true;
|
||||
}
|
||||
public void processItemPurchase(obj_id self, obj_id player) throws InterruptedException
|
||||
{
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
package script.npc.vendor;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.sui;
|
||||
import script.library.trial;
|
||||
import script.library.static_item;
|
||||
import script.library.chat;
|
||||
import script.library.factions;
|
||||
import script.dictionary;
|
||||
import script.library.*;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
public class vendor extends script.base_script
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user