Completed lair interactivity options

This commit is contained in:
Heron
2026-05-12 14:30:30 -04:00
parent 0a8d775b02
commit 4e3cfeb427
3 changed files with 182 additions and 17 deletions
@@ -196,9 +196,23 @@ public class base_player extends script.base_script
public static final String PVP_SKILL_5 = "aura_buff_self";
public static final String PVP_SKILL_6 = "airstrike_ability";
public static final string_id COVERCHARGE_DANCER_MESSAGE = new string_id("base_player", "covercharge_dancer_message");
public static final string_id SID_FOUND_NOTHING = new string_id("lair_n", "found_nothing");
public static final string_id TOO_FAR_FROM_LAIR = new string_id("lair_n", "too_far_from_lair");
public static final string_id LAIR_NOT_TARGETED = new string_id("lair_n", "lair_not_targeted");
public static final string_id SID_LAIR_NOT_SEARCHED = new string_id("lair_n", "lair_not_searched");
public static final string_id SID_LAIR_SEARCHED = new string_id("lair_n", "lair_searched");
public static final string_id SID_LAIR_INVALID_ARGUMENTS = new string_id("lair_n", "lair_invalid_arguments");
public static final String LAIR_SEARCHED = "lair.searched";
public static final String LAIR_SEARCHED_TIME = "lair.searched_time";
public static final String CONFIG_SECTION_LAIR_INTERACTIVITY = "LairInteractivity";
public static final String CONFIG_LAIR_INTERACTIVITY_ENABLED = "enabled";
public static final string_id SHAPECHANGE = new string_id("spam", "shapechange_combat");
public static final String[] WAYPOINT_GROUND_PLANETS_EXTERNAL =
{
@@ -4520,6 +4534,151 @@ public class base_player extends script.base_script
}
return SCRIPT_OVERRIDE;
}
public int adminLair(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
if (!isGod(self))
{
return SCRIPT_OVERRIDE;
}
obj_id intendedTarget = getIntendedTarget(self);
obj_id lookAtTarget = getLookAtTarget(self);
int GOT_type_intended = getGameObjectType(intendedTarget);
int GOT_type_look = getGameObjectType(lookAtTarget);
if (GOT_type_intended == GOT_lair)
{
target = intendedTarget;
}
else if (GOT_type_look == GOT_lair)
{
target = lookAtTarget;
}
else
{
sendSystemMessage(self, LAIR_NOT_TARGETED);
return SCRIPT_OVERRIDE;
}
float maxDistance = 10.0f;
float distanceToLair = utils.getDistance2D(self, target);
if (hasScript(target, "theme_park.dungeon.mustafar_trials.valley_battleground.battlefield_destructable"))
{
return SCRIPT_OVERRIDE;
}
if (distanceToLair > maxDistance)
{
sendSystemMessage(self, TOO_FAR_FROM_LAIR);
return SCRIPT_OVERRIDE;
}
java.util.StringTokenizer st = new java.util.StringTokenizer(params);
boolean getInfo = false;
boolean setSearched = false;
boolean clearSearched = false;
int tokens = st.countTokens();
if (tokens > 1)
{
sendSystemMessage(self, SID_LAIR_INVALID_ARGUMENTS);
return SCRIPT_OVERRIDE;
}
String argument = "";
if (tokens == 0)
{
sendSystemMessage(self, "Valid options are info, set, or clear", null);
return SCRIPT_OVERRIDE;
}
else
{
argument = st.nextToken().toLowerCase();
}
if (argument.equals("info"))
{
getInfo = true;
}
else if (argument.equals("set"))
{
setSearched = true;
}
else if (argument.equals("clear"))
{
clearSearched = true;
}
else
{
sendSystemMessage(self, SID_LAIR_INVALID_ARGUMENTS);
return SCRIPT_OVERRIDE;
}
if (getInfo)
{
if (utils.hasScriptVar(target, LAIR_SEARCHED))
{
sendSystemMessage(self, SID_LAIR_SEARCHED);
}
else
{
sendSystemMessage(self, SID_LAIR_NOT_SEARCHED);
}
if (utils.hasScriptVar(target, LAIR_SEARCHED_TIME))
{
int searchedTime = utils.getIntScriptVar(target, LAIR_SEARCHED_TIME);
int now = getGameTime();
int elapsed = now - searchedTime;
sendSystemMessage(self, "Was searched at (gametime) " + searchedTime + ". That was " + elapsed + " seconds ago.", null);
}
return SCRIPT_CONTINUE;
}
if (setSearched)
{
utils.setScriptVar(target, LAIR_SEARCHED, 1);
if (config_utils.getBooleanConfig(CONFIG_SECTION_LAIR_INTERACTIVITY, CONFIG_LAIR_INTERACTIVITY_ENABLED))
{
utils.setScriptVar(target, LAIR_SEARCHED_TIME, getGameTime());
}
else
{
utils.removeScriptVar(target, LAIR_SEARCHED_TIME);
}
sendSystemMessage(self, SID_LAIR_SEARCHED);
return SCRIPT_CONTINUE;
}
if (clearSearched)
{
utils.removeScriptVar(target, LAIR_SEARCHED);
utils.removeScriptVar(target, LAIR_SEARCHED_TIME);
sendSystemMessage(self, SID_LAIR_NOT_SEARCHED);
return SCRIPT_CONTINUE;
}
return SCRIPT_CONTINUE;
}
public int searchLair(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
obj_id intendedTarget = getIntendedTarget(self);
@@ -4552,7 +4711,7 @@ public class base_player extends script.base_script
}
else
{
if (!utils.hasScriptVar(target, "lair.searched") && !isIncapacitated(self))
if (!isIncapacitated(self))
{
collection.collectionResource(self, "egg");
dictionary dict = new dictionary();
@@ -44,12 +44,10 @@ public class lair_interactivity extends script.base_script
public static final String CONFIG_LAIR_INTERACTIVITY_ENABLED = "enabled";
public static final String CONFIG_LAIR_EGG_CHANCE = "eggChance";
public static final String CONFIG_LAIR_BUG_CHANCE = "bugChance";
public static final String CONFIG_LAIR_NOTHING_CHANCE = "nothingChance";
public static final String CONFIG_LAIR_EMPTY_CHANCE = "emptyChance";
public static final String CONFIG_LAIR_EGG_AMOUNT_MULTIPLIER_PERCENT = "eggAmountMultiplierPercent";
public static final String CONFIG_LAIR_RESET_MINUTES = "resetMinutes";
public static final String CONFIG_LAIR_SHOW_EMPTY_MESSAGE = "showEmptyMessage";
public static final String CONFIG_LAIR_USE_LUCK = "useLuck";
public static final String LAIR_SEARCHED_TIME = "lair.searched_time";
@@ -80,9 +78,10 @@ public class lair_interactivity extends script.base_script
public void searchLair(obj_id self, obj_id player) throws InterruptedException
{
// Missing [LairInteractivity] or enabled=false preserves vanilla/public behavior.
if (!config_utils.getBooleanConfig(CONFIG_SECTION_LAIR_INTERACTIVITY, CONFIG_LAIR_INTERACTIVITY_ENABLED))
{
{
searchLairVanilla(self, player);
return;
}
@@ -94,18 +93,16 @@ public class lair_interactivity extends script.base_script
{
if (utils.hasScriptVar(self, LAIR_SEARCHED))
{
if (hasLairSearchResetExpired(self))
if (hasLairSearchResetExpired(self, player))
{
resetLairSearchState(self);
}
else
{
if (config_utils.getBooleanConfig(CONFIG_SECTION_LAIR_INTERACTIVITY, CONFIG_LAIR_SHOW_EMPTY_MESSAGE, true))
{
sendSystemMessage(player, SID_LAIR_EMPTY);
}
return;
{
sendSystemMessage(player, SID_LAIR_EMPTY);
return;
}
}
@@ -117,7 +114,7 @@ public class lair_interactivity extends script.base_script
}
if (getVolumeFree(pInv) <= 0)
{
{
sendSystemMessage(player, SID_INVENTORY_FULL);
return;
}
@@ -125,7 +122,7 @@ public class lair_interactivity extends script.base_script
int result = rollLairSearchResult();
if (result == 0)
{
{
sendSystemMessage(player, SID_FOUND_NOTHING);
return;
}
@@ -146,7 +143,13 @@ public class lair_interactivity extends script.base_script
{
int nothingChance = config_utils.getPercentConfig(CONFIG_SECTION_LAIR_INTERACTIVITY, CONFIG_LAIR_NOTHING_CHANCE, 10);
int eggChance = config_utils.getPercentConfig(CONFIG_SECTION_LAIR_INTERACTIVITY, CONFIG_LAIR_EGG_CHANCE, 80);
int bugChance = config_utils.getPercentConfig(CONFIG_SECTION_LAIR_INTERACTIVITY, CONFIG_LAIR_BUG_CHANCE, 10);
int bugChance = 100 - nothingChance - eggChance;
if (bugChance < 0)
{
bugChance = 0;
}
int totalChance = nothingChance + eggChance + bugChance;
@@ -297,10 +300,12 @@ public class lair_interactivity extends script.base_script
}
private boolean hasLairSearchResetExpired(obj_id self) throws InterruptedException
private boolean hasLairSearchResetExpired(obj_id self, obj_id player) throws InterruptedException
{
int resetMinutes = getLairResetMinutes();
sendSystemMessage(player, "Reset minutes " + resetMinutes, null);
if (resetMinutes <= 0)
{
return false;
@@ -323,7 +328,7 @@ public class lair_interactivity extends script.base_script
return config_utils.getIntConfigClamped(
CONFIG_SECTION_LAIR_INTERACTIVITY,
CONFIG_LAIR_RESET_MINUTES,
0,
10,
0,
10080
);
@@ -1206,6 +1206,7 @@ fs_dm_cc_5_root commandClicky normal fs_dm_cc_5 failSpecialAttack 1 fs_dm_cc_5
fs_dm_cc_6_root commandClicky normal fs_dm_cc_6 failSpecialAttack 1 fs_dm_cc_6 1 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 enemy required 2 combat_ranged 0 32 combat 1 ALL HEAVY fs_dm_cc 0 0.25 7 1
milkCreature commandClicky normal milkCreature failSpecialAttack 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 other none 1 3 0 other 0 ALL gathering 0 0.25 1 0
searchLair commandClicky normal searchLair failSpecialAttack 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 other none 1 3 0 other 0 ALL gathering 0 0.25 1 0
adminLair commandClicky normal adminLair failAdmin 1 admin 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 other none 1 3 0 other 0 ALL gathering 0 0.25 1 0
of_buff_def_4 commandClicky normal of_buff_def_4 failSpecialAttack 1 of_buff_def_4 1 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 other none 2 combat_ranged combat 1 ALL of_buff_def 0.25 7 1
of_buff_def_5 commandClicky normal of_buff_def_5 failSpecialAttack 1 of_buff_def_5 1 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 other none 2 combat_ranged combat 1 ALL of_buff_def 0.25 7 1
of_buff_def_6 commandClicky normal of_buff_def_6 failSpecialAttack 1 of_buff_def_6 1 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 other none 2 combat_ranged combat 1 ALL of_buff_def 0.25 7 1