Template:AfflictionParser

From Official Barotrauma Wiki
Jump to: navigation, search
Documentation
Main article: Template:Items infobox


Template that replaces the old format of how afflictions were written in the Template:Items Infobox and how they are displayed there and in all other templates that display afflictions.

Previously each affliction and it's parameters had to have their own field in cargo like "burn, burnchance, burn2, burn2chance, explosionburn, explosionburnchance, explosionburn2, explosionburn2chance" & every template displaying them had to query and use all of them in a massive wall of copypasta that was modified for every exception in every table template and infobox, don't even get me started on Template:MedicalTable/row, after seeing that I immidiately gave up trying to do anything there and made this entire template instead.


This template will be used to display afflictions in all templates that do so, instead of having to copypasta the entire afflictions thing into every template. This means changes to this template will automatically affect everywhere afflictions are displayed on the wiki.

Afflictions names are found using Template:FindNameById, which finds the name of the matching identifier from the Special:CargoTables/Afflictions cargo table. This means all afflictions that have a page are by default supported by this template.

Additionally "poison" and "damage" affliction identifiers link to "Poison (Affliction Type)" and "Damage (Affliction Type)" respectively. Adding more exceptions like these is very simple.

Sub Templates

Template Instructions

Affliction values are written and stored in cargo on each page with one of the infoboxes. The template can then use the stored values to display the afflictions and their associated info. Other parameters can be used to apply Projectiles or Weapon Damage Modifier, or to customize how the afflictions are shown.

Field Note Example Default
afflictions
explosionafflictions
medicalafflictions
resistances
Afflictions are separated by ;
Affliction Parameters are separated by ,
  • medicalafflictions allows the Fail column to apprear if any affliction has fail defined, or if durationfail is defined.
  • First parameter of an affliction must be Identifier = Strength.
  • Optional parameters can be written in any order.

afflictions =
burn = 10;
burn = 20, chance = 0.5;

medicalafflictions = duration = 10;
damage = -5, fail = -2.5;
burn = -0.1, fail = -0.05;
oxygenlow = 2, fail = 3;

resistances =
burn = 0.5, chance = 0.4;
lacerations = 0.6;
bitewounds = 0.7;

projectiles Projectiles.
  • Not displayed if not defined or equal to 1.
8 1
weapondamagemodifier Weapon Damage Modifier.
  • Not displayed if not defined or equal to 1.
1.1 1
protects Protected limbs
  • Afflictions are displayed as resistances if defined.
Head
noresistancenames Resistances are displayed without names if defined as yes. yes
hidecalculations Moves the visible affliction calculations (Projectiles x Strength x Weapon Damage Modifier) to the tooltip. yes
compactmedical Displays success and fail in the same column yes
durationcolumn Displays the duration in a second column instead of under the afflictions. Intended to be used together with compactmedical yes


Affliction Instructions

Field Note Example Default
Status Effect Parameters (Must be defined before any afflictions. They affect all Afflictions. Separated by ,)
duration = number Duration of the entire Status Effect. duration = 10
durationfail = number Overrides duration for afflictions in the fail column. failduration = 15
successnote = "text" Note displayed above afflictions in the success column.
  • Text must be within quotation marks " "
successnote = "text"
failnote = "text" Note displayed above afflictions in the fail column.
  • Text must be within quotation marks " "
failnote = "text"
note = "text" Note displayed above afflictions.
  • Is displayed in both the success and fail columns.
  • Is displayed only if successnote and failnote are NOT defined.
  • Text must be within quotation marks " "
note = "text"
consumptiontime = number Time it takes to fully consume the item consumptiontime = 25
Affliction Parameters (Separated by ,)
identifier = strength Identifier of the affliction, followed by it's strength.
In case of resistances, Identifier of the affliction, followed by it's resistance multiplier.
  • It must be the first parameter of an affliction.
  • If the strength value in XML is inside a "ReduceAffliction" element, negate the value.
  • If the strength value is equal to 0, and resistances is NOT defined, then the affliction is not shown. Used when there is a fail affliction but no success affliction.
burn = 20

burn = 0.75

burn = -30
fail = number Strength of an affliction when failed fail = 10
chance = number Probability of an affliction to occur.
In case of resistances, probability to completely resist an affliction.
chance = 0.2
duration = number Duration of an affliction, only define if different from Status Effect duration. duration = 10
durationfail = number Duration of an affliction when failed, only define if different from Status Effect duration. duration = 5
delay = number Delay before the affliction starts to have an effect. delay = 3
delayfail = number Delay before the affliction starts to have an effect when failed. delay = 5
instant = yes Can be used to make an affliction ignore duration if needed. instant = yes
successnote = "text" Note displayed under the affliction stats in the success column.
  • Text must be within quotation marks " "
  • Overrides note
successnote = "text"
failnote = "text" Note displayed under the affliction stats in the fail column.
  • Text must be within quotation marks " "
  • Overrides note
failnote = "text"
note = "text" Note displayed under the affliction stats.
  • Text must be within quotation marks " "
note = "text"



Template in use

Simulations of how this would work when displayed in table cells in the infobox or table templates.

Test 1

{{AfflictionParser|afflictions = 
burn =  10; 
burn =  20, chance = 0.5; 
burn =  30; 
burn =  40, chance = 0.01;
burn =  50;
Table Cell
 Burn (10)*
 Burn (20)* (50% chance)
 Burn (30)*
 Burn (40)* (1% chance)
 Burn (50)*



40mm Mini Nuke

Main article: 40mm Mini Nuke


{{AfflictionParser|afflictions = 
explosiondamage = 100;
burn = 100;
bleeding = 50;
stun = 5;

explosionafflictions =
explosiondamage = 200;
burn = 200;
bleeding = 40, chance = 0.05;
stun = 10;
radiationsickness = 30;
}}
Table Cell
 Burn (100)*
 Bleeding (50)*
 Stun (5)*
Explosion (m):
 Burn (200)*
 Bleeding (40)* (5% chance)
 Stun (10)*



Ethanol

Main article: Ethanol


{{AfflictionParser|medicalafflictions = duration = 10;
psychosisresistance = 600, instant = yes;
drunk = 2, delay = 10;
hallucinating = -2, delay = 10;
psychosis = -2, delay = 10;

}}
Table Cell
 Drunk (20)* (10s delay)
 Hallucinating (-20)* (10s delay)
 Psychosis (-20)* (10s delay)
Duration 10s



Morphine

Main article: Morphine


{{AfflictionParser|medicalafflictions = duration = 10;
damage = -5, fail = -2.5;
burn = -0.1, fail = -0.05;
oxygenlow = 2, fail = 3;
opiateaddiction = 0.5, fail = 2.5;
opiatewithdrawal = -3, fail = -3;
opiateoverdose = 1, fail = 2;
}}
Table Cell
Success:
 Burn (-1)*
 Oxygen Low (20)*
 Opiate Overdose (10)*
Duration 10s
Failure:
 Burn (-0.5)*
 Oxygen Low (30)*
 Opiate Overdose (20)*
Duration 10s



Diving Suit

Main article: Diving Suit


{{AfflictionParser|protects = Head|resistances =
bitewounds = 0.7;
lacerations = 0.7;
blunttrauma = 0.7;
gunshotwound = 0.7;
burn = 0.75;
bleeding = 0.7;
huskinfection = 1, chance = 0.5;
radiationsickness = 0.75;
}}
Table Cell
 Bite Wounds (30%)*
 Lacerations (30%)*
 Gunshot Wound (30%)*
 Burn (25%)*
 Bleeding (30%)*
 Husk Infection (0% | 50%)*

Diving Suit no names

Main article: Diving Suit


{{AfflictionParser|protects = Head|noresistancenames = yes|resistances =
bitewounds = 0.7;
lacerations = 0.7;
blunttrauma = 0.7;
gunshotwound = 0.7;
burn = 0.75;
bleeding = 0.7;
huskinfection = 1, chance = 0.5;
radiationsickness = 0.75; 
}}
Table Cell
 (30%)*
 (30%)*
 (30%)*
 (30%)*
 (25%)*
 (30%)*
 (0% | 50%)*
 (25%)*



Raptor Bane Extract

Main article: Raptor Bane Extract


{{AfflictionParser|medicalafflictions = duration = 20, durationfail = 10;
organdamage = 10, fail = 10, note = "Only affects [[Mudraptor]]s";
nausea = 5;
Table Cell
Success:
 Organ Damage (200)*
 Only affects Mudraptors
 Nausea (100)*
Duration 20s
Failure:
 Organ Damage (100)*
 Only affects Mudraptors
Duration 10s



Endocrine Booster

Main article: Endocrine Booster


{{AfflictionParser|medicalafflictions = note = "Grants the user a new talent, provided there's one available to recieve."
Table Cell
Grants the user a new talent, provided there's one available to recieve.



Test

{{AfflictionParser|weapondamagemodifier = 1.3| afflictions = 
gunshotwound = 15;
bleeding = 5;
radiationsickness = 10;
stun = 0.15;
}}
Table Cell
 Gunshot Wound (19.5)*
 (15 x 1.3 weapon damage modifier)
 Bleeding (6.5)*
 (5 x 1.3 weapon damage modifier)
 Radiation Sickness (13)*
 (10 x 1.3 weapon damage modifier)
 Stun (0.195)*
 (0.15 x 1.3 weapon damage modifier)



Test

{{AfflictionParser|medicalafflictions = successnote = "Success Status Effect Note", failnote = "Fail Status Effect Note";
burn = 40, fail = 45, successnote = "Success note 1";
burn = 50, fail = 55, failnote = "Fail note 1";
burn = 60, fail = 65, successnote = "Success note 2", failnote = "Fail note 2";
}}
Table Cell
Success:
Success Status Effect Note
 Burn (40)*
 Success note 1
 Burn (50)*
 Burn (60)*
 Success note 2
Failure:
Fail Status Effect Note
 Burn (45)*
 Burn (55)*
 Fail note 1
 Burn (65)*
 Fail note 2



Cigar

Main article: Cigar


{{AfflictionParser|medicalafflictions = consumptiontime = 25;
psychosisresistance = 20;
psychosis = -6;
reaperstax = -1;
hallucinating = -10;
watchersgaze = -5;
}}
Table Cell
 Psychosis (-6/s)*
 Reaper's Tax (-1/s)*
 Hallucinating (-10/s)*
 Watcher's Gaze (-5/s)*
Consumption Time 25s of usage



Test

{{AfflictionParser|medicalafflictions = duration = 1, note = "Only affects the targeted limb";
bleeding = -100, fail = -75;
burn = -100, fail = -75;
organdamage = 0, fail = 1.25, duration = 5;
}}
Table Cell
Success:
Only affects the targeted limb
 Bleeding (-100)*
 Burn (-100)*
Duration 1s
Failure:
Only affects the targeted limb
 Bleeding (-75)*
 Burn (-75)*
 Organ Damage (6.25)*
Duration 1s*




{{AfflictionParser|durationcolumn=yes|compactmedical=yes|medicalafflictions = duration = 1, note = "Only affects the targeted limb";
bleeding = -100, fail = -75;
burn = -100, fail = -75;
organdamage = 0, fail = 1.25, duration = 5;
}}
Table Cell
Only affects the targeted limb
 Bleeding (-100 | -75)*
 Burn (-100 | -75)*
 Organ Damage (0 | 6.25)*
Duration 1s*




{{AfflictionParser|medicalafflictions = duration = 60;
oxygenlow = 2.5, duration = 60, delay = 1, fail = 2.5, durationfail = 10, delayfail =  5; 
organdamage = 1.5, duration = 5, fail = 1.5, durationfail = 10;
}}
Table Cell
Success:
 Oxygen Low (150)* (1s delay)
 Organ Damage (7.5)*
Duration 60s*
Failure:
 Oxygen Low (25)* (5s delay)
 Organ Damage (15)*
Duration 60s*


{{AfflictionParser|durationcolumn=yes|compactmedical=yes|medicalafflictions = duration = 60;
oxygenlow = 2.5, duration = 60, delay = 1, fail = 2.5, durationfail = 10, delayfail =  5;
organdamage = 1.5, duration = 5, fail = 1.5, durationfail = 10;
}}
Table Cell
 Oxygen Low (150 | 25)* (1s | 5s delay)
 Organ Damage (7.5 | 15)*
Duration 60s*