Skip to content

Commit 107e0a5

Browse files
author
Heron
committed
Server implementation of Space RLS
1 parent 49edd3c commit 107e0a5

9 files changed

Lines changed: 134 additions & 20 deletions

File tree

sku.0/sys.server/compiled/game/datatables/item/master_item/master_item.tab

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8303,6 +8303,9 @@ item_schematic_gcw2_survey_tool_all object/tangible/loot/loot_schematic/generic_
83038303
rare_loot_chest_quality_1 object/tangible/item/rare_loot_chest_1.iff systems.loot.rare_loot_chest Rare Loot Chest Rare Loot Chest... Open it up!
83048304
rare_loot_chest_quality_2 object/tangible/item/rare_loot_chest_2.iff systems.loot.rare_loot_chest Exceptional Loot Chest Exceptional Loot Chest... Open it up!
83058305
rare_loot_chest_quality_3 object/tangible/item/rare_loot_chest_3.iff systems.loot.rare_loot_chest Legendary Loot Chest Legen-wait for it-dary Loot Chest... Open it up!
8306+
space_rare_loot_chest_quality_1 object/tangible/item/space_rare_loot_chest_1.iff space.rare_loot.space_rare_loot_chest Rare Space Loot Chest Rare Space Loot Chest... Open it up!
8307+
space_rare_loot_chest_quality_2 object/tangible/item/space_rare_loot_chest_2.iff space.rare_loot.space_rare_loot_chest Exceptional Space Loot Chest Exceptional Space Loot Chest... Open it up!
8308+
space_rare_loot_chest_quality_3 object/tangible/item/space_rare_loot_chest_3.iff space.rare_loot.space_rare_loot_chest Legendary Space Loot Chest Legendary Space Loot Chest... Open it up!
83068309
item_player_house_deed_jabbas_sail_barge object/tangible/deed/player_house_deed/jabbas_sail_barge_deed.iff 4 item.special.nomove,item.structure_deed.player_structure_deed Replica Jabba's Sail Barge House a replica of Jabba's sail barge for use as a house.
83078310
item_tcg_loot_reward_series8_glass_sculpture object/tangible/tcg/series8/decorative_bespin_glass_sculpture.iff 4 item.special.nomove Glass Helix Sculpture From the skilled artisans of the Cloud City, this showy piece beautifies your home, creating an opulent diffusion of light in even the most humble of dwellings.
83088311
item_tcg_loot_reward_series8_bespin_lamp_off object/tangible/tcg/series8/combine_decorative_bespin_lamp_off.iff 4 item.special.nomove,systems.tcg.tcg_bespin_lights,systems.tcg.tcg_combine_tcg_items_generic Cloud City Lamp Build-An-Item Object #2: This elegant lamp is patterned after the decorative illumination units found in the Cloud city on Bespin.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@base object/tangible/base/tangible_base.iff
2+
3+
@class tangible_object_template 4
4+
5+
@class object_template 11
6+
7+
sharedTemplate = "object/tangible/item/shared_space_rare_loot_chest_1.iff"
8+
scripts = +["item.container.base.base_container"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@base object/tangible/base/tangible_base.iff
2+
3+
@class tangible_object_template 4
4+
5+
@class object_template 11
6+
7+
sharedTemplate = "object/tangible/item/shared_space_rare_loot_chest_2.iff"
8+
scripts = +["item.container.base.base_container"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@base object/tangible/base/tangible_base.iff
2+
3+
@class tangible_object_template 4
4+
5+
@class object_template 11
6+
7+
sharedTemplate = "object/tangible/item/shared_space_rare_loot_chest_3.iff"
8+
scripts = +["item.container.base.base_container"]

sku.0/sys.server/compiled/game/script/space/crafting/component_loot.java

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
package script.space.crafting;
2-
3-
import script.library.space_crafting;
4-
import script.library.utils;
5-
import script.obj_id;
1+
package script.space.crafting;
2+
3+
import script.library.space_crafting;
4+
import script.library.utils;
5+
import script.obj_id;
6+
import script.space.rare_loot.space_rare_loot;
67

78
public class component_loot extends script.base_script
89
{
@@ -20,14 +21,28 @@ public int OnInitialize(obj_id self) throws InterruptedException
2021
obj_id player = utils.getContainingPlayer(self);
2122
return SCRIPT_CONTINUE;
2223
}
23-
public int OnGetAttributes(obj_id self, obj_id player, String[] names, String[] attribs) throws InterruptedException
24-
{
25-
if(self == null || self == obj_id.NULL_ID || !isIdValid(self)){
26-
return SCRIPT_CONTINUE;
27-
}
28-
int flags = getIntObjVar(self, "ship_comp.flags");
29-
boolean isBitSet = (flags & ship_component_flags.SCF_reverse_engineered) != 0;
30-
if (isBitSet)
24+
public int OnGetAttributes(obj_id self, obj_id player, String[] names, String[] attribs) throws InterruptedException
25+
{
26+
if(self == null || self == obj_id.NULL_ID || !isIdValid(self)){
27+
return SCRIPT_CONTINUE;
28+
}
29+
if ((names == null) || (attribs == null) || (names.length != attribs.length))
30+
{
31+
return SCRIPT_CONTINUE;
32+
}
33+
if (hasObjVar(self, space_rare_loot.VAR_ITEM_IS_RARE_SPACE_LOOT))
34+
{
35+
int idx = utils.getValidAttributeIndex(names);
36+
if (idx == -1)
37+
{
38+
return SCRIPT_CONTINUE;
39+
}
40+
names[idx] = "rare_loot_category";
41+
attribs[idx] = "\\#ed8d16" + getRareSpaceLootDisplayName(self);
42+
}
43+
int flags = getIntObjVar(self, "ship_comp.flags");
44+
boolean isBitSet = (flags & ship_component_flags.SCF_reverse_engineered) != 0;
45+
if (isBitSet)
3146
{
3247
int idx = utils.getValidAttributeIndex(names);
3348
if (idx == -1)
@@ -62,7 +77,34 @@ public int OnGetAttributes(obj_id self, obj_id player, String[] names, String[]
6277
}
6378
names[idx] = "miningExtractionRate";
6479
attribs[idx] = atr;
65-
}
66-
return SCRIPT_CONTINUE;
67-
}
68-
}
80+
}
81+
return SCRIPT_CONTINUE;
82+
}
83+
84+
public String getRareSpaceLootDisplayName(obj_id self) throws InterruptedException
85+
{
86+
String qualityName = "";
87+
if (hasObjVar(self, space_rare_loot.VAR_ITEM_REWARD_QUALITY_NAME))
88+
{
89+
qualityName = getStringObjVar(self, space_rare_loot.VAR_ITEM_REWARD_QUALITY_NAME);
90+
}
91+
else if (hasObjVar(self, space_rare_loot.VAR_ITEM_REWARD_QUALITY))
92+
{
93+
qualityName = space_rare_loot.getRewardQualityName(getIntObjVar(self, space_rare_loot.VAR_ITEM_REWARD_QUALITY));
94+
}
95+
if (qualityName == null || qualityName.equals(""))
96+
{
97+
qualityName = "rare";
98+
}
99+
return toDisplayCase(qualityName) + " Space Part";
100+
}
101+
102+
public String toDisplayCase(String value) throws InterruptedException
103+
{
104+
if (value == null || value.equals(""))
105+
{
106+
return "";
107+
}
108+
return value.substring(0, 1).toUpperCase() + value.substring(1).toLowerCase();
109+
}
110+
}

sku.0/sys.server/compiled/game/script/space/rare_loot/space_rare_loot.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public space_rare_loot()
2929
public static final String REWARD_TABLE_COLUMN_ITEM_TYPE = "strItemType";
3030
public static final String REWARD_TABLE_COLUMN_ENABLED = "enabled";
3131
public static final String REWARD_TABLE_QUALITY_ALL = "all";
32-
public static final String CHEST_STATIC_ITEM_BASE = "rare_loot_chest_quality_";
32+
public static final String CHEST_STATIC_ITEM_BASE = "space_rare_loot_chest_quality_";
3333
public static final String SCRIPT_GROUND_RARE_LOOT_CHEST = "systems.loot.rare_loot_chest";
3434
public static final String SCRIPT_SPACE_RARE_LOOT_CHEST = "space.rare_loot.space_rare_loot_chest";
3535
public static final int MIN_REWARD_TIER = 1;
@@ -206,8 +206,14 @@ public static obj_id createRareLootChest(obj_id lootContainer, int rewardQuality
206206
{
207207
setObjVar(chest, VAR_CHEST_REWARD_QUALITY, rewardQuality);
208208
setObjVar(chest, VAR_CHEST_REWARD_TIER, rewardTier);
209-
detachScript(chest, SCRIPT_GROUND_RARE_LOOT_CHEST);
210-
attachScript(chest, SCRIPT_SPACE_RARE_LOOT_CHEST);
209+
if (hasScript(chest, SCRIPT_GROUND_RARE_LOOT_CHEST))
210+
{
211+
detachScript(chest, SCRIPT_GROUND_RARE_LOOT_CHEST);
212+
}
213+
if (!hasScript(chest, SCRIPT_SPACE_RARE_LOOT_CHEST))
214+
{
215+
attachScript(chest, SCRIPT_SPACE_RARE_LOOT_CHEST);
216+
}
211217
}
212218
return chest;
213219
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@base object/tangible/base/shared_tangible_base.iff
2+
3+
@class tangible_object_template 10
4+
5+
@class object_template 10
6+
7+
objectName = "static_item_n" "space_rare_loot_chest_1"
8+
9+
detailedDescription = "static_item_d" "space_rare_loot_chest_1"
10+
11+
appearanceFilename = "appearance/item_rare_loot_chest.apt"
12+
13+
gameObjectType = GOT_misc_item_usable
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@base object/tangible/base/shared_tangible_base.iff
2+
3+
@class tangible_object_template 10
4+
5+
@class object_template 10
6+
7+
objectName = "static_item_n" "space_rare_loot_chest_2"
8+
9+
detailedDescription = "static_item_d" "space_rare_loot_chest_2"
10+
11+
appearanceFilename = "appearance/item_rare_loot_chest_exquisite.apt"
12+
13+
gameObjectType = GOT_misc_item_usable
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@base object/tangible/base/shared_tangible_base.iff
2+
3+
@class tangible_object_template 10
4+
5+
@class object_template 10
6+
7+
objectName = "static_item_n" "space_rare_loot_chest_3"
8+
9+
detailedDescription = "static_item_d" "space_rare_loot_chest_3"
10+
11+
appearanceFilename = "appearance/item_rare_loot_chest_legendary.apt"
12+
13+
gameObjectType = GOT_misc_item_usable

0 commit comments

Comments
 (0)