Merge pull request #350 from HeronAlexandria/master

Fix for trader crafting assembly build a buff
This commit is contained in:
Cekis
2022-04-09 20:55:14 -07:00
committed by GitHub
5 changed files with 435 additions and 175 deletions

View File

@@ -24,6 +24,13 @@ public class reset extends script.base_script
};
public int createNewGoggles(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
String config = getConfigSetting("GameServer", "seGogglesReward");
if (config == null || !config.equals("true"))
{
return SCRIPT_CONTINUE;
}
boolean createFailed = false;
if (features.isCollectorEdition(self) || features.isJPCollectorEdition(self))
{

View File

@@ -0,0 +1,55 @@
package script.systems.buff;
import script.*;
import script.library.*;
import java.util.ArrayList;
public class buff_builder_effect_map extends script.base_script
{
public static final String DATATABLE_BUFF_BUILDER_EFFECT_MAP = "datatables/buff/buff_builder_effect_map.iff";
public buff_builder_effect_map()
{
}
public static String[] getEffectList(String affectName) throws InterruptedException
{
//get the effect from the list
ArrayList<String> effectList = new ArrayList<String>();
int rowIndex = dataTableSearchColumnForString(affectName, "BUFF_BUILDER_AFFECTS", DATATABLE_BUFF_BUILDER_EFFECT_MAP);
if (rowIndex >= 0)
{
int rowCount = dataTableGetNumRows(DATATABLE_BUFF_BUILDER_EFFECT_MAP);
dictionary row;
String affect;
for (int index = 0; index < rowCount; index++)
{
row = dataTableGetRow(DATATABLE_BUFF_BUILDER_EFFECT_MAP, index);
affect = row.getString("BUFF_BUILDER_AFFECTS");
if (affect.equals(affectName))
{
effectList.add(row.getString("AFFECT"));
}
}
}
return effectList.toArray(new String[effectList.size()]);
}
public static String[] getEffects() throws InterruptedException
{
return dataTableGetStringColumn(DATATABLE_BUFF_BUILDER_EFFECT_MAP, "AFFECT");
}
}

View File

@@ -1802,159 +1802,61 @@ public class buff_handler extends script.base_script
{
buffValue = (buffValue * 0.2f);
}
switch (category) {
case "attributes":
case "resistances":
case "combat":
switch (category) {
case "attributes":
float attribModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId)) {
attribModifier = (float) (getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_inspire_attrib_increase") / 100.0f);
}
if (internalDecay == true) {
if (utils.hasScriptVar(self, "decayAttribMod")) {
attribModifier = utils.getFloatScriptVar(self, "decayAttribMod");
CustomerServiceLog("SuspectedCheaterChannel: ", "Using stored attribMod: " + attribModifier);
}
} else {
CustomerServiceLog("SuspectedCheaterChannel: ", "Storing attribMod: " + attribModifier);
utils.setScriptVar(self, "decayAttribMod", attribModifier);
}
buffValue *= 1.0f + attribModifier;
break;
case "resistances":
float resistModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId)) {
resistModifier = (float) (getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_inspire_resist_increase") / 100.0f);
}
if (internalDecay == true) {
if (utils.hasScriptVar(self, "decayResistMod")) {
resistModifier = utils.getFloatScriptVar(self, "decayResistMod");
}
} else {
utils.setScriptVar(self, "decayResistMod", resistModifier);
}
buffValue *= 1.0f + resistModifier;
break;
case "combat":
float combatModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId)) {
combatModifier = getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_combat_buff_increase");
}
if (internalDecay == true) {
if (utils.hasScriptVar(self, "decayCombatMod")) {
combatModifier = utils.getFloatScriptVar(self, "decayCombatMod");
}
} else {
utils.setScriptVar(self, "decayCombatMod", combatModifier);
}
buffValue += combatModifier;
break;
}
{
CustomerServiceLog("SuspectedCheaterChannel: ", "Adding Stat Modifier: " + "buildabuff_" + effect + " Value = " + buffValue + " Duration = " + duration);
}
addSkillModModifier(self, "buildabuff_" + effect, effect, (int) buffValue, duration, false, true);
if ((effect.startsWith("constitution")) || (effect.startsWith("stamina"))) {
messageTo(self, "recalcPools", null, 0.25f, false);
} else if (effect.startsWith("expertise_innate_protection_") || effect.equals("elemental_resistance")) //ensure recalc for new elemental_resistance Modifier
{
messageTo(self, "recalcArmor", null, 0.25f, false);
}
break;
case "trade":
float tradeModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId)) {
tradeModifier = (float) (getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_inspire_trader_increase") / 100.0f);
}
if (internalDecay == true) {
if (utils.hasScriptVar(self, "decayTradeMod")) {
tradeModifier = utils.getFloatScriptVar(self, "decayTradeMod");
}
} else {
utils.setScriptVar(self, "decayTradeMod", tradeModifier);
}
buffValue *= 1.0f + tradeModifier;
String[] xpArray =
{
"crafting",
"combat_general",
"entertainer",
"space_combat_general"
};
utils.setScriptVar(self, "buff.xpBonus.types", xpArray);
utils.setScriptVar(self, "buff.xpBonus.value", buffValue / 100);
{
CustomerServiceLog("SuspectedCheaterChannel: ", "Adding Stat Modifier: " + "buildabuff_" + effect + " Value = " + buffValue + " Duration = " + duration);
}
addSkillModModifier(self, "buildabuff_" + effect, effect, (int) buffValue, duration, false, true);
break;
case "misc":
switch (effect) {
case "movement_speed":
if (value == 0) {
value = 1;
}
if (movement.hasMovementModifier(self, "buildabuff_movement_speed")) {
movement.removeMovementModifier(self, "buildabuff_movement_speed", false);
}
movement.applyMovementModifier(self, "buildabuff_movement_speed", buffValue);
break;
case "reactive_second_chance":
int playerLevel = getLevel(self);
float reactiveModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId)) {
reactiveModifier = getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_inspire_proc_chance_increase");
}
if (internalDecay == true) {
if (utils.hasScriptVar(self, "decayReactiveMod")) {
reactiveModifier = utils.getFloatScriptVar(self, "decayReactiveMod");
}
} else {
utils.setScriptVar(self, "decayReactiveMod", reactiveModifier);
}
buffValue += reactiveModifier;
if (playerLevel > 69) {
addSkillModModifier(self, "expertise_buildabuff_heal_3_reac", "expertise_buildabuff_heal_3_reac", (int) buffValue, duration, false, true);
} else if (playerLevel > 39 && playerLevel < 70) {
addSkillModModifier(self, "expertise_buildabuff_heal_2_reac", "expertise_buildabuff_heal_2_reac", (int) buffValue, duration, false, true);
} else {
addSkillModModifier(self, "expertise_buildabuff_heal_1_reac", "expertise_buildabuff_heal_1_reac", (int) buffValue, duration, false, true);
}
messageTo(self, "cacheExpertiseProcReacList", null, 2, false);
break;
case "flush_with_success":
String[] xpa =
{
"crafting",
"combat_general",
"entertainer",
"space_combat_general",
"chronicles"
};
utils.setScriptVar(self, "buff.xpBonus.types", xpa);
utils.setScriptVar(self, "buff.xpBonus.value", buffValue / 100.0f);
break;
default: {
CustomerServiceLog("SuspectedCheaterChannel: ", "Adding Stat Modifier: " + "buildabuff_" + effect + " Value = " + buffValue + " Duration = " + duration);
}
addSkillModModifier(self, "buildabuff_" + effect, effect, (int) buffValue, duration, false, true);
break;
}
break;
String[] effectPackage = buff_builder_effect_map.getEffectList(effect);
if (effectPackage == null || effectPackage.length == 0)
{
effectPackage = new String[1];
effectPackage[0] = effect;
}
for (String e : effectPackage)
{
switch (category)
{
case "attributes":
ApplyBuildaBuffAttributeBuff(self,
bufferId,
internalDecay,
e,
buffValue,
duration);
break;
case "resistances":
ApplyBuildaBuffResistanceBuff(self,
bufferId, internalDecay, e,
buffValue, duration);
break;
case "combat":
ApplyBuildaBuffCombatBuff(self, bufferId, internalDecay, e,
buffValue, duration);
break;
case "trade":
ApplyBuildaBuffTradeBuff(self, bufferId,
internalDecay, e,
buffValue,
duration);
break;
case "misc":
ApplyBuildaBuffMiscBuff(self, bufferId,
internalDecay, e,
value,
buffValue,
duration);
break;
}
}
}
if (!buff.hasBuff(self, "col_ent_invis_buff_tracker"))
{
@@ -1973,6 +1875,269 @@ public class buff_handler extends script.base_script
}
return SCRIPT_CONTINUE;
}
public void ApplyBuildaBuffAttributeBuff(obj_id self,
obj_id bufferId,
boolean internalDecay, String effect,
float buffValue, float duration) throws InterruptedException
{
float attribModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId))
{
attribModifier = (float) (getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_inspire_attrib_increase") / 100.0f);
}
if (internalDecay == true)
{
if (utils.hasScriptVar(self, "decayAttribMod"))
{
attribModifier = utils.getFloatScriptVar(self, "decayAttribMod");
CustomerServiceLog("SuspectedCheaterChannel: ", "Using stored attribMod: " + attribModifier);
}
}
else
{
CustomerServiceLog("SuspectedCheaterChannel: ", "Storing attribMod: " + attribModifier);
utils.setScriptVar(self, "decayAttribMod", attribModifier);
}
buffValue *= 1.0f + attribModifier;
addSkillModModifier(self, "buildabuff_" + effect, effect, (int) buffValue, duration, false, true);
CheckForBuildABuffCombatRecalc(self, effect);
}
public void ApplyBuildaBuffResistanceBuff(obj_id self,
obj_id bufferId, boolean internalDecay, String effect,
float buffValue, float duration) throws InterruptedException
{
float resistModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId))
{
resistModifier = (float) (getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_inspire_resist_increase") / 100.0f);
}
if (internalDecay == true)
{
if (utils.hasScriptVar(self, "decayResistMod")) {
resistModifier = utils.getFloatScriptVar(self, "decayResistMod");
}
}
else
{
utils.setScriptVar(self, "decayResistMod", resistModifier);
}
buffValue *= 1.0f + resistModifier;
addSkillModModifier(self, "buildabuff_" + effect, effect, (int) buffValue, duration, false, true);
CheckForBuildABuffCombatRecalc(self, effect);
}
public void ApplyBuildaBuffCombatBuff(obj_id self, obj_id bufferId, boolean internalDecay, String effect,
float buffValue, float duration) throws InterruptedException
{
float combatModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId)) {
combatModifier = getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_combat_buff_increase");
}
if (internalDecay == true) {
if (utils.hasScriptVar(self, "decayCombatMod"))
{
combatModifier = utils.getFloatScriptVar(self, "decayCombatMod");
}
}
else
{
utils.setScriptVar(self, "decayCombatMod", combatModifier);
}
buffValue += combatModifier;
addSkillModModifier(self, "buildabuff_" + effect, effect, (int) buffValue, duration, false, true);
CheckForBuildABuffCombatRecalc(self, effect);
}
public void ApplyBuildaBuffTradeBuff(obj_id self, obj_id bufferId,
boolean internalDecay, String effect,
float buffValue,
float duration) throws InterruptedException
{
float tradeModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId)) {
tradeModifier = (float) (getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_inspire_trader_increase") / 100.0f);
}
if (internalDecay == true)
{
if (utils.hasScriptVar(self, "decayTradeMod")) {
tradeModifier = utils.getFloatScriptVar(self, "decayTradeMod");
}
}
else
{
utils.setScriptVar(self, "decayTradeMod", tradeModifier);
}
buffValue *= 1.0f + tradeModifier;
ApplyBuildaBuffXpBuff(self, buffValue);
addSkillModModifier(self, "buildabuff_" + effect, effect, (int) buffValue, duration, false, true);
}
public void ApplyBuildaBuffMiscBuff(obj_id self, obj_id bufferId,
boolean internalDecay, String effect,
float value,
float buffValue,
float duration) throws InterruptedException
{
switch (effect)
{
case "movement_speed":
if (value == 0)
{
value = 1;
}
if (movement.hasMovementModifier(self, "buildabuff_movement_speed"))
{
movement.removeMovementModifier(self, "buildabuff_movement_speed", false);
}
movement.applyMovementModifier(self, "buildabuff_movement_speed", buffValue);
break;
case "reactive_second_chance":
int playerLevel = getLevel(self);
float reactiveModifier = 0.0f;
if (isIdValid(bufferId) && exists(bufferId))
{
reactiveModifier = getEnhancedSkillStatisticModifierUncapped(bufferId, "expertise_en_inspire_proc_chance_increase");
}
if (internalDecay == true)
{
if (utils.hasScriptVar(self, "decayReactiveMod"))
{
reactiveModifier = utils.getFloatScriptVar(self, "decayReactiveMod");
}
}
else
{
utils.setScriptVar(self, "decayReactiveMod", reactiveModifier);
}
buffValue += reactiveModifier;
if (playerLevel > 69)
{
addSkillModModifier(self, "expertise_buildabuff_heal_3_reac", "expertise_buildabuff_heal_3_reac", (int) buffValue, duration, false, true);
}
else if (playerLevel > 39 && playerLevel < 70)
{
addSkillModModifier(self, "expertise_buildabuff_heal_2_reac", "expertise_buildabuff_heal_2_reac", (int) buffValue, duration, false, true);
}
else
{
addSkillModModifier(self, "expertise_buildabuff_heal_1_reac", "expertise_buildabuff_heal_1_reac", (int) buffValue, duration, false, true);
}
messageTo(self, "cacheExpertiseProcReacList", null, 2, false);
break;
case "flush_with_success":
ApplyBuildaBuffXpBuff(self, buffValue);
break;
default:
CustomerServiceLog("SuspectedCheaterChannel: ", "Adding Stat Modifier: " + "buildabuff_" + effect + " Value = " + buffValue + " Duration = " + duration);
break;
}
addSkillModModifier(self, "buildabuff_" + effect, effect, (int) buffValue, duration, false, true);
}
public void CheckForBuildABuffCombatRecalc(obj_id self, String effect) throws InterruptedException
{
if ((effect.startsWith("constitution")) || (effect.startsWith("stamina")))
{
messageTo(self, "recalcPools", null, 0.25f, false);
}
else if (effect.startsWith("expertise_innate_protection_") || effect.equals("elemental_resistance")) //ensure recalc for new elemental_resistance Modifier
{
messageTo(self, "recalcArmor", null, 0.25f, false);
}
}
public void ApplyBuildaBuffXpBuff(obj_id self, float buffValue) throws InterruptedException
{
float bonusXpValue = buffValue / 100;
//add the bonus types if they do not exist
if (!hasObjVar(self, "buff.xpBonus.types"))
{
String[] xpArray =
{
"crafting",
"combat_general",
"entertainer",
"space_combat_general",
"chronicles"
};
utils.setScriptVar(self, "buff.xpBonus.types", xpArray);
}
if (hasObjVar(self, "buff.xpBonus.value"))
{
float currentBonus = getFloatObjVar(self, "buff.xpBonus.value");
if (bonusXpValue > currentBonus)
{
utils.setScriptVar(self, "buff.xpBonus.value", bonusXpValue);
}
}
else
{
utils.setScriptVar(self, "buff.xpBonus.value", bonusXpValue);
}
}
public int buildabuffRemoveBuffHandler(obj_id self, String effectName, String subtype, float duration, float value, String buffName, obj_id caster) throws InterruptedException
{
String[] baseModList = dataTableGetStringColumn(DATATABLE_BUFF_BUILDER, "AFFECTS");
@@ -1981,6 +2146,19 @@ public class buff_handler extends script.base_script
removeAttribOrSkillModModifier(self, "buildabuff_" + s);
}
}
baseModList = buff_builder_effect_map.getEffects();
if (baseModList != null && baseModList.length > 0)
{
for (String s : baseModList) {
if (hasSkillModModifier(self, "buildabuff_" + s)) {
removeAttribOrSkillModModifier(self, "buildabuff_" + s);
}
}
}
if (hasSkillModModifier(self, "expertise_buildabuff_heal_1_reac"))
{
removeAttribOrSkillModModifier(self, "expertise_buildabuff_heal_1_reac");

View File

@@ -1,24 +1,24 @@
NAME CATEGORY AFFECTS MAX_TIMES_APPLIED COST AFFECT_AMOUNT REQUIRED_EXPERTISE
s s s i i i s
strength attributes strength_modified 10 1 10
constitution attributes constitution_modified 10 1 10
stamina attributes stamina_modified 10 1 10
precision attributes precision_modified 10 1 10
agility attributes agility_modified 10 1 10
luck attributes luck_modified 10 1 10
kinetic resistances expertise_innate_protection_kinetic 5 1 250
energy resistances expertise_innate_protection_energy 5 1 250
elemental resistances elemental_resistance 5 1 250
crafting trade food_assembly 5 2 1
crafting_success trade crafting_critical_success_bonus 2 5 1
hand_sampling trade expertise_resource_sampling_increase 5 2 2 harvest_faire
critical_hit combat expertise_critical_niche_all 1 5 3
critical_hit_defense combat expertise_critical_hit_reduction 1 5 3
dodge combat expertise_glancing_blow_all 1 5 3
action_cost_reduction combat expertise_action_all 1 5 5
healing misc expertise_dot_absorption_all 5 2 4 holism
healer misc expertise_healing_all 5 2 3 holism
reactive_go_with_the_flow misc movement_speed 5 2 5 go_with_the_flow
reactive_second_chance misc reactive_second_chance 4 2 2 second_chance
harvest_faire misc expertise_harvester_collection_increase 5 2 1 harvest_faire
flush_with_success misc flush_with_success 5 2 3 flush_with_success
NAME CATEGORY AFFECTS MAX_TIMES_APPLIED COST AFFECT_AMOUNT REQUIRED_EXPERTISE
s s s i i i s
strength attributes strength_modified 10 1 10
constitution attributes constitution_modified 10 1 10
stamina attributes stamina_modified 10 1 10
precision attributes precision_modified 10 1 10
agility attributes agility_modified 10 1 10
luck attributes luck_modified 10 1 10
kinetic resistances expertise_innate_protection_kinetic 5 1 250
energy resistances expertise_innate_protection_energy 5 1 250
elemental resistances elemental_resistance 5 1 250
crafting trade crafting_assembly 5 2 1
crafting_success trade crafting_critical_success_bonus 2 5 1
hand_sampling trade expertise_resource_sampling_increase 5 2 2 harvest_faire
critical_hit combat expertise_critical_niche_all 1 5 3
critical_hit_defense combat expertise_critical_hit_reduction 1 5 3
dodge combat expertise_glancing_blow_all 1 5 3
action_cost_reduction combat expertise_action_all 1 5 5
healing misc expertise_dot_absorption_all 5 2 4 holism
healer misc expertise_healing_all 5 2 3 holism
reactive_go_with_the_flow misc movement_speed 5 2 5 go_with_the_flow
reactive_second_chance misc reactive_second_chance 4 2 2 second_chance
harvest_faire misc expertise_harvester_collection_increase 5 2 1 harvest_faire
flush_with_success misc flush_with_success 5 2 3 flush_with_success

View File

@@ -0,0 +1,20 @@
BUFF_BUILDER_AFFECTS AFFECT
s s
crafting_assembly armor_assembly
crafting_assembly advanced_assembly
crafting_assembly booster_assembly
crafting_assembly chassis_assembly
crafting_assembly clothing_assembly
crafting_assembly cybernetic_assembly
crafting_assembly droid_assembly
crafting_assembly engine_assembly
crafting_assembly food_assembly
crafting_assembly general_assembly
crafting_assembly instrument_assembly
crafting_assembly jedi_saber_assembly
crafting_assembly power_systems
crafting_assembly prop_assembly
crafting_assembly shields_assembly
crafting_assembly structure_assembly
crafting_assembly weapon_assembly
crafting_assembly weapon_systems