//1230 This file contains descriptions for all the hack options found in TobEx .ini files

Description format:
-------------------

/////////////////////////////////////// <INI CATEGORY>

-----<designated component number> <hack name> [hack flags]
(compatibility information)
Hack description

Options:
-<value>: <behaviour>

Hack flags:
[B] - Currently in beta and otherwise unclassified
[C] - Compatibility issues present
[D] - Extra debugging information
[F] - Engine bug fix
[M] - Adds extra functionality for modder/player use
[O] - Code optimisation
[T] - Tweak to engine behaviour (configured in TobEx_ini/TobExTweak.ini)
[X] - This hack makes use of alterations to game resources outside the executable that are implemented by TobEx

/////////////////////////////////////// ACTION

-----820 AddKit Actions Fix [F]
Fixes the AddKit() and AddSuperKit() actions to store the entire kit DWORD instead of just the low WORD
This allows setting BARBARIAN (0x40000000) and WILDMAGE (0x80000000) kits specifically

Options:
-0: disabled
-1: enabled

-----770 EquipRanged Action Fix [F]
Corrects an error in the EquipRanged() action where an equipped shield would prevent one-handed ranged weapons in the weapon slot to be equipped

Options:
-0: disabled
-1: enabled

-----1230 Expanded Actions [M]
Enables the use of new actions

Descriptions
352 LoseGame()
Plays the ending cutscene as if the protagonist died. If the action is used in a pausing dialogue, the ending cutscene will play after the dialogue ends. This action does nothing in the arenas game type.

353 DialogueSetGlobal(S:Name*,S:Area*,I:Value*)
Sets the variable 'Name' in the scope 'Area' to 'Value' immediately instead of being added through the dialogue owner's action queue. This allows variables to be set instantaneously and checked immediately afterwards in the same dialogue. ActionOverride() is supported. If used outside dialogue, this action behaves exactly as SetGlobal().
Limitations: Variables become set asynchronously to the order in which the action is present on the script block. This can cause issues when an action is purposely sandwiched between two modifications of the same variable.

354 DialogueIncrementGlobal(S:Name*,S:Area*,I:Value*)
Increments the variable 'Name' in the scope 'Area' by 'Value' immediately instead of being added through the dialogue owner's action queue. This allows variables to be set instantaneously and checked immediately afterwards in the same dialogue. ActionOverride() is supported. If used outside dialogue, this action behaves exactly as IncrementGlobal().
Limitations: Variables become set asynchronously to the order in which the action is present on the script block. This can cause issues when an action is purposely sandwiched between two modifications of the same variable.

355 DialogueSG(S:Name*,I:Num*)
Sets the global variable 'Name' to 'Num' immediately instead of being added through the dialogue owner's action queue. This allows variables to be set instantaneously and checked immediately afterwards in the same dialogue. ActionOverride() is supported. If used outside dialogue, this action behaves exactly as SG().
Limitations: Variables become set asynchronously to the order in which the action is present on the script block. This can cause issues when an action is purposely sandwiched between two modifications of the same variable.

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// ARENAS

-----1100 Enable Arenas Game Type [M]
Enables the arena multiplayer game type accessible from the multiplayer menu
In the arena game type:
-Games are called scenarios and are loaded as saved games from the ./arenas directory
-Pausing the game is not allowed
-The game does not end when Player1 dies
-LOCALSKickedOut is not set on death
-Only inventory slot items are dropped on death
-The DeathmatchPosition() actions set the DEATHMATCH_RESURRECT<PLAYERNUM> variable
-When the action DeathmatchPosition() is used, a player who dies will immediately Raise Dead and LeaveAreaLua() to the position set by DeathmatchPosition(), with a random orientation
-Gold is not shared by the party but is kept by the player
-Opposing players' health is not shown overhead and tooltips reveal approximate health
-No locator feedback is displayed when opposing players are damaged
-Opposing players' visibility maps are not displayed
-Party effects do not affected opposing players, hostile non-party effects affect opposing players
-Chunk death is disabled
-The default action when clicking on the portrait of an opposing player is to attack when in visibility range, and to move to opposing player when outside visibility range
-Record screen information on opposing players is not accessible

Limitations:
-Multiplayer permissions cannot be set correctly when setting up the game
-The host can reform party, kicking out other players
-The party can rest, all party members will heal, and the party cannot rest when the party is scattered (including opposing players)
-Any player can modify the party position of all party members
-Dialogue can be made to pause the game
-One can see the opposing player's kit description
-When outside visibility range, clicking on an opposing player's portrait allows the player to locate their opponents
-Summoned creatures turn enemy when hit by opposing players

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// DEBUG

-----190 Critical Error Message Box Fix [F]
Fixes an issue where the critical error message box during a crash does not always display
This is because the window thread that the message box is sent to is suspended

Options:
-0: disabled
-1: enabled

-----390 Externalise Logging [D]
Duplicates the game's logging text onto the console and TobEx.log (with timestamp)
Requires 'Logging On=1' under baldur.ini [Program Options]

Options:
-0: disabled
-1: enabled

-----500 Log Assertion Failures [D]
Logs assertion failures in the game to console and TobEx.log (with timestamp)
These are logged even when the game is unable to display them
Assertions will display a return address to facilitate debugging
The following are also changed:
-Missing spell icons for spells in the spell selection screen correctly display an assertion failure
Does not require "Logging On=1" in baldur.ini

Options:
-0: disabled
-1: enabled

-----510 Log Assertion Warnings [D]
Logs assertion failures that are ignored by the game to console and TobEx.log (with timestamp)
Display of these errors does not mean your game is unstable
May be useful for debugging

Options:
-0: disabled
-1: enabled


-----520 Log Dialogue Bar [D]
Logs everything printed to the dialogue/log bar in-game into TobEx_dlg.log
The in-game timestamp is appended in hexadecimal format before each entry

Options:
-0: disabled
-1: enabled

-----540 Log File Mode [D]
Determines whether log files created by TobEx are overwritten or appended to each TobEx session
This applies to both TobEx.log and TobEx_dlg.log

Options:
-0: overwrites log files each session
-1: appends to log files each session

-----890 Log Missing Resources [D]
Logs when a resource is not found
If 'Extenal Logging' is enabled, text is also printed to console and TobEx.log (with timestamp)
Requires 'Logging On=1' under baldur.ini [Program Options]

Note: if the game attempts to find a string reference out of bounds of dialog.tlk, spurious missing .WAV resources are logged that look like <text>.wav

Options:
-0: disabled
-1: enabled

-----530 Log More Messages [D]
Logs some messages suppressed by hard code into baldur.log
If 'Extenal Logging' is enabled, text is also printed to console and TobEx.log (with timestamp)
Requires 'Logging On=1' under baldur.ini [Program Options]

Options:
-0: disabled
-1: enabled

-----1080 Log Network Errors [D]
Prints some network errors to the console and logs into TobEx.log (with timestamp)

Options:
-0: disabled
-1: enabled

-----620 Restore Extra Combat Info Text [C, D]
(Different implementation to, and clashes with tob_inject)
Restores the option of displaying extra to hit and damage rolls and modifiers in the game console
This debug feature was present in Shadows of Amn 23037 but not Throne of Bhaal
Requires 'Extra Combat Info=1' under baldur.ini [Game Options]

Options:
-0: disabled
-1: enabled

-----710 Verbose Logging [D]
Prints to console and logs excessive amounts of internal TobEx debug messages
Do not use this unless you are troubleshooting and need to report TobEx debug messages

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// EFFECT OPCODES

-----850 Apply Concentration Check On Damage [T]
Modifies the damage opcode such that spellcasters spells are interrupted if they do not save against a concentration check
A spellcaster passes the concentration check if (1D20 + luck) > (spell level + damage taken)
Note: This hack is subject to change

Options:
-0: disabled
-1: enabled

-----60 Apply Effect Item Fix [F]
Restores the function of the apply effect item opcode

Description
#182 (0x0B6)  Item: Apply Effect Item [182]
Parameter #1: Undetermined
Parameter #2: Undetermined
Description:
Applies the effect specified by the resource 2 key to the targeted creature(s) when an item specified by the resource key is equipped. Due to the use of the resource 2 key, this effect must be used in an EFF file.

Limitations: the effect is applied again if an already equipped matching item is used to force-attack a target via the quickbar.

Options:
-0: disabled
-1: enabled

-----70 Apply Effect Itemtype Fix [F]
Restores the function of the apply effect item type opcode

Description
#183 (0x0B7)  Item: Apply Effect Itemtype [183]
Parameter #1: String Reference
Parameter #2: Type
Description:
Applies the effect specified by the resource key to the targeted creature(s) when an item of the item type specified by the 'Type' field is equipped. The 'String Reference' field is currently unused.

Limitations: the effect is applied again if an already equipped matching itemtype is used to force-attack a target via the quickbar.

Options:
-0: disabled
-1: enabled

-----80 Attacks Per Round Mod Fix [C, F]
(Different implementation to, and overrides tob_hacks)
Fixes the attacks per round modifier opcode to integrate the 1-5 and 1.5-4.5 attacks per round

Description
#1 (0x001)  Stat: Attacks Per Round Modifier [1]
Parameter #1: Value
Parameter #2: Type
Description:
Alters a characters Attacks per Round in the style specified by 'Type' field.

Key	Attacks Per Round
0	0
1	1
2	2
3	3
4	4
5	5
6	0.5
7	1.5
8	2.5
9	3.5
10	4.5

Known values for 'Type' are:
0   Cumulative Modifier -> Key = Key + Value [Value is of type 'Key' with support for negative keys]
1   Flat Value Modifier -> Key = Value [Value is of type 'Key']
2   Percentage Modifier -> Key = Key * value / 100 [Value is of type 'positive integer', with rounding to the nearest 0.5 attacks]

NB. Unlike the original engine implementation, stacking this opcode stacks the effect on the number of attacks, not the key.

Options:
-0: disabled
-1: enabled

-----90 Awaken Fix [C, F]
(Identical to Spell Revisions 'Cure Sleep Fix')
Fixes awaken opcode to remove sleep opcode rather than itself

Options:
-0: disabled
-1: enabled

-----100 Awaken On Damage [T]
Creatures have the equivalent of the awaken opcode applied if the damage opcode is applied
i.e. sleeping creatures wake up when hurt

Options:
-0: disabled
-1: enabled

-----970 Blindness As Spell Description [C, T]
(Different implementation to, and overrides tob_hacks)
Overwrites the blindness effect opcode to give -4 to hit and 4 point armor penalty as per spell description in the game
If enabled, this hack overrides 110 Blindness Fix

Options:
-0: disabled
-1: enabled

-----110 Blindness Fix [C, F]
(Different implementation to, and overrides tob_hacks)
Removes the cumulative -10 to hit penalty when the blindness effect opcode stacks
If 970 Blindness As Spell Description is enabled, this hack is overridden

Options:
-0: disabled
-1: enabled

-----1210 Button Effects Mod [M]
REQUIRES: Expanded Stats
Expands the disable and enable button opcodes to allow disabling/enabling the Bard Song (10) and Find Traps (14) buttons, respectively. The button disabled states are tied to new hard-coded stats 308-322, inclusive.

Descriptions
#144 (0x090)  Button: Disable Button [144]
Parameter #1: Irrelevant
Parameter #2: Button
Description:
Disabled the button specified by the 'Button' field.

Known values for 'Button' are:
0   Stealth Button
1   Thieving Skill Button
2   Spell Select Button
3   First Quick Spell Button
4   Second Quick Spell Button
5   Third Quick Spell Button
6   Turn Undead Button
7   Talk Button
8   Use Item Button
9   First Quick Item Button
10  Bard Song Button
11  Second Quick Item Button
12  Third Quick Item Button
13  Innate Ability Button
14  Find Traps Button

#279 (0x117)  Button: Enable Button [279]
Parameter #1: Irrelevant
Parameter #2: Button
Description:
Enables the button specified by the 'Button Type' field.

Known values for 'Button' are:
As above

Options:
-0: disabled
-1: enabled

-----210 Cast Spell On Condition Mod [M]
Modifies the cast spell on condition effect to allow customisation of how often the condition is checked
Note: using too many conditional spells with low values for trigger check period may slow the game down
The default trigger check value is 100

Description
#232 (0x0E8)  Spell Effect: Cast Spell on Condition [232]
Parameter #1: Target
Parameter #2 Low: Condition
Parameter #2 High: Trigger Check Period
Description:
Casts the spell specified by the resource field on the target specified by the 'Target' field, when the condition from the 'Condition' field is true. The conditions are akin to various triggers.
The trigger check period field specifies how often (in ticks) the condition is checked. If set to 0, the trigger check period is 100 ticks (game default).

Known values for 'Target' are:
0   Effect Target
1   LastHitter
2   NearestEnemyOf
3   Nearest

Known values for 'Condition' are:
0   HitBy()
1   See(NearestEnemyOf())
2   HPPercentLT(Myself 50)
3   HPPercentLT(Myself 25)
4   HPPercentLT(Myself 10)
5   StateCheck(Myself,STATE_HELPLESS) i.e. unconscious
6   StateCheck(Myself,STATE_POISONED) i.e. poisoned
7   AttackedBy('Target')
8   PersonalSpaceDistance('Target',4)
9   PersonalSpaceDistance('Target',10)
10  Unknown - every round
11  TookDamage()

A non-zero Parameter 3 Low value activates the portrait icon, immediately triggers the HitBy() trigger, and prevents purging of the conditional spell after the condition is true.
Parameter 3 High is reserved for internal use (specifies that Parameter 4 has been set).
Parameter 4 is reserved for internal use (set to the game time when the effect is first applied).

Options:
-0: disabled
-1: enabled

-----50 Casting Level Mod Fix [C, F, M]
(Identical to tob_hacks)
Restores the function of casting level modifier effect opcode by applying CASTINGLEVELBONUSMAGE and CASTINGLEVELBONUSCLERIC bonuses when casting spells

Options:
-0: disabled
-1: enabled

-----130 Configurable Backstab Every Hit [C, M]
(Incompatible with tob_hacks)
Modifies the backstab every hit opcode parameter 2 to configure whether STATE_INVISIBLE and position matters in a backstab

Description
#303 (0x12F)  Spell Effect: Backstab On Condition [303]
Parameter #1: Irrelevant
Parameter #2: Type (bitfield)

Description:
The targeted creature(s) will backstab on the conditions set by the 'Type' field.

Known values for 'Type' are:
0 Normal conditions (attacker must be invisible, attacker must be in 90-degree arc behind victim)
1 Ignore invisible requirement and positioning requirement
2 Ignore invisible requirement only
4 Ignore positioning requirement only

Options:
-0: disabled
-1: enabled

-----160 Configurable Damage Effect Bypasses Mirror Images [C, M]
(Identical to tob_hacks, SCS, SCSII, Spell Revisions)
Adds new bit 24 to item ability flag 'Bypass Mirror Images'
Only for the damage effect opcode, if this bit is set, the mirror image check is skipped when checking saving throw

Options:
-0: disabled
-1: enabled

-----170 Configurable Magical Item Dispel Behaviour [C, M]
(Different implementation to, and overrides tob_hacks, Spell Revisions)

This hack perform two functions:
1. Modification to dispel effect opcode
Alows configuration of the dispelling of items in the magical weapon slot (SLOT_MISC19) by adding a high WORD (0xA)

Description
#58 (0x03A)  Cure: Dispellable Effects (Dispel Magic) [58]
Parameter #1: Level
Parameter #2 Low: Type
Parameter #2 High: Magical weapon dispel behaviour
Description:
Dispels magic from the targeted creature(s). Depending on the value of the 'Type' field, the 'Level' field can be used to set the level of the effect.

Known values for 'Type' are:
0 Always dispel
1 Use Caster Level
2 Use 'Level' field

Known values for 'Magical weapon dispel behaviour' are:
0 Always dispel
1 Do not dispel
2 Chance of dispel (target level is the higher of the effective mage or cleric level, whichever is higher)

With 'Type' of 1 or 2, the base chance of successfully dispelling is 50%. This chance is modified by the relative levels of the dispeller to the target.
Each level below target gives a -10% chance, each level above target gives a +5% chance. There is always a 1% chance of success or failure.

2. Adds new bit 24 to the item flags 'Not dispellable in magical weapon slot'

Options:
-0: disabled
-1: enabled

-----1020 Container Use EFF File Fix [F]
Fixes memory deallocation bug for use EFF file opcode on containers and doors

Options:
-0: disabled
-1: enabled

-----200 Cure Drunk Fix [C, F]
(Identical to tob_hacks)
Fixes cure drunkenness opcode to remove Drunk opcode rather than itself

Options:
-0: disabled
-1: enabled

-----350 Cut Scene 2 Mod [C, M]
(Different implementation to, and overrides tob_hacks)
Expands the pocketplane opcode to allow for use of custom cutscene scripts and options for storing current party locations

Description
#298 (0x12A) Cutscene 2 [298]
Parameter #1: Store party location behaviour
Parameter #2: Script
Description:
Starts a cutscene.

Values for 'Store party location behaviour':
0   Use list specifically for pocket plane
1   Use list normally used by StorePartyLocations() action - restore with RestorePartyLocations() action
2   Do not store party locations

Values for 'Use custom script':
0   Use cut250a.bcs
1   Use cutscene script specified by the Resource field

Options:
-0: disabled
-1: enabled

-----860 Damage Fix [F]
Fixes the following bugs with the damage opcode:
1. Killing someone with magic fire damage would cause a WEIRD damage assertion failure
2. Hitting someone with magic cold damage would not play a hit sound

Options:
-0: disabled
-1: enabled

-----450 Dexterity Mod [M, X]
Adds the Icewind Dale Type 3 Cat's Grace Spell to the dexterity modifier effect opcode

#15 (0x00F)  Stat: Dexterity Modifier [15]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0   Cumulative Modifier -> Dexterity = Dexterity + 'Statistic Modifier' value
1   Flat Value Modifier -> Dexterity = 'Statistic Modifier' value
2   Percentage Modifier -> Dexterity = (Dexterity * 'Statistic Modifier' value) / 100
3   Cats Grace Spell

For a Type of 3 (Cat's Grace Spell), dexterity is modified as per Icewind Dale Cat's Grace spell behaviour,
externalised to CLSSPLAB.2DA, in which 1Dx dexterity is gained up to a maximum of 20 depending on the player's
class (defaults to 1D6 if class is not present), where x is specified by the DEX column.

Options:
-0: disabled
-1: enabled

-----260 Disable Stoneskin Grey Colour [C, T]
(Identical to tob_hacks, SCS, SCSII)
Removes grey colour change of character applied the stoneskin opcode

Options:
-0: disabled
-1: enabled

-----270 Disease Fix [C, F]
(Different implementation to, and clashes with tob_hacks)
Fixes a bug with the disease opcode for parameter 2 values of 0-3 where a creature with multiple instances of disease, 
poison, wing buffet, regeneration and/or repeating effect opcodes would only have the highest frequency instance applied

Options:
-0: disabled
-1: enabled

-----280 Disintegrate Fix [F]
Fixed a memory leak in the disintegrate effect opcode in the case where the target does not match the effect
parameters. An instant death effect would be allocated in memory but not freed.

Options:
-0: disabled
-1: enabled

-----290 Dispel Formula Fix [C, F]
(Different implementation to, and clashes with tob_hacks, SCS, SCSII, Spell Revisions)
Corrects the formula used for the dispel opcode

Options:
-0: disabled
-1: enabled

-----1050/1060/1070 Drop Inventory On Disintegrate/Frozen Death/Stone Death [C, T]
(May clash with components of P5Tweaks, which tries to replicate this behaviour)
Alters the instant death opcode to make the creature drop all non-critical items on disintegrate, frozen death, and/or stone death

Options:
-0: disabled
-1: enabled

-----420 Forbid Item Type Fix [C, F]
(Identical to tob_hacks)
Fixes an engine bug that caused the forbidden item type information to be placed in an unused list whenever parameter 2 was non-zero

Options:
-0: disabled
-1: enabled

-----430 Invisible Fix [F]
Corrects the application of improved invisibility when the timing is permanent until death for the invisible opcode

Options:
-0: disabled
-1: enabled

-----920 Learn Spell Mod [M]
Adds a number of flags to parameter 1 high of the learn spell opcode as described below

Description
#147 (0x093)  Spell: Learn Spell [147]
Parameter #1 Low: Irrelevant
Parameter #1 High: Flags
Parameter #2: Irrelevant
Description:
The targeted creature(s) tries to learn the spell specified by the resource key.
Learning is successful when 1D100 <= the INT-dependent LEARN_SPELL value in INTBON.2DA.
The LEARN_SPELL value is modified for mage specialists, with +15 for same school spells, and -15 for non-same school spells.

The 'Flags' field modifies the behaviour of the effect in the following manners:
Bit 0: Learning the spell never gives experience (including scrolls from the inventory screen)
Bit 1: No effect (reserved for GemRB)
Bit 2: Learning is always successful (including scrolls from the inventory screen)
Bit 3: No effect (reserved for GemRB)
Bit 4: If the spell is already learnt, no experience is given (excludes inventory screen)
Bit 5: Learning the spell obeys mage school exclusions (excludes inventory screen)
Bit 6: The spell cannot be learnt by sorcerer class (excludes inventory screen)
Bit 7: Learning fails if the target has already learnt the maximum number of spells as per INTMOD.2DA for the spell's level (excludes inventory screen)

Options:
-0: disabled
-1: enabled

-----1120 Luck Mod [M]
Adds instantaneous sum type (3)

Description
#22 (0x016)  Stat: Cumulative Luck Bonus [22]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field. 

Known values for 'Type' are:
0   Cumulative Modifier -> Luck = Luck + 'Statistic Modifier' value
1   Flat Value Modifier -> Luck = 'Statistic Modifier' value
2   Percentage Modifier -> Luck = (Luck * 'Statistic Modifier' value) / 100
3   Instantaneous Cumulative Modifier -> Luck = Luck + 'Statistic Modifier' value

For a non-permanent timing, the instantaneous cumulative modifier immediately adds the 'Statistic Modifier' value, unlike the cumulative modifier which adds the 'Statistic Modifier' after all effects are applied. The former has the disadvantage that it will be overriden by any subsequent flat value modifiers. Percentage modifiers override all other modifiers.

-----460 Mage Spell Slots Mod [M]
Adds the Icewind Dale Type 512 Double Spells to the mage spell slots modifier effect opcode
See the IWD:TotL description for this opcode in the IESDP for more information.

Options:
-0: disabled
-1: enabled

-----550 Magic Resistance Mod Fix [F, M]
Fixes the magic resistance modifier opcode to allow for permanent timing
Adds percentage modifier type (2)

Description
#166 (0x0A6)  Stat: Magical Resistance Modifier [166]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0   Instantaneous Cumulative Modifier -> Value = Value + 'Statistic Modifier' value
1   Flat Value Modifier -> Value = 'Statistic Modifier' value
2   Percentage Modifier -> Value = (Value * 'Statistic Modifier' value) / 100
3   Cumulative Modifier -> Value = Value + 'Statistic Modifier' value

For a non-permanent timing, the instantaneous cumulative modifier immediately adds the 'Statistic Modifier' value, unlike the cumulative modifier which adds the 'Statistic Modifier' after all effects are applied. The former has the disadvantage that it will be overriden by any subsequent flat value modifiers. Percentage modifiers override all other modifiers.

Options:
-0: disabled
-1: enabled

-----870 No Spell Interruption On Zero Damage [T]
Modifies the damage opcode such that if damage is reduced to zero (with normal damage behaviour; wParam2Low = 0), spellcasting and casting animations are not interrupted

Options:
-0: disabled
-1: enabled

-----570 Poison Fix [C, F]
(Different implementation to, and clashes with tob_hacks)
Fixes a bug with the poison opcode where a creature with multiple instances of disease, poison, wing buffet, 
regeneration and/or repeating effect opcodes would only have the highest frequency instance applied 

Options:
-0: disabled
-1: enabled

-----470 Priest Spell Slots Mod [M]
Adds the Icewind Dale Type 512 Double Spells to the priest spell slots modifier effect opcode
See the IWD:TotL description for this opcode in the IESDP for more information.

Options:
-0: disabled
-1: enabled

-----1030 Proficiency Modifier Mod [M]
Extends the proficiency modifier opcode to allow incrementation/decrementation of proficiencies
Standard Throne of Bhaal proficiencies are limited to a maximum of 5 stars

Description
#233 (0x0E9) Stat: Proficiency Modifier [233]
Parameter #1: Amount
Parameter #2 Low: Type
Parameter #2 High: Behaviour
Description:

Applies 'Behaviour' to the weapon proficiency points for the weapon type specified in the 'Type' field with the value specified by the 'Amount' field, for the targeted creature(s).

Values for 'Behaviour' are:
0 Set proficiency 'Type' to 'Amount' only if 'Amount' is higher than the current proficiency points
1 Proficiency points of 'Type' = Proficiency points of 'Type' + 'Amount' (applied after all of Behaviour 0)

Values for 'Type' are:
See STATS.IDS for proficiency values

Options:
-0: disabled
-1: enabled

-----580 Regeneration Fix [C, F]
(Different implementation to, and clashes with tob_hacks)
Fixes a bug with the regeneration opcode where a creature with multiple instances of disease, poison, wing buffet, 
regeneration and/or repeating effect opcodes would only have the highest frequency instance applied 

Options:
-0: disabled
-1: enabled

-----600 Remove Projectile Mod [M]
Enabled the use of the remove specific area effect to allow custom 2DAs to be used in the Resource field.

Description
#273 (0x111)  Remove: Specific Area Effect(Zone of Sweet Air) [273]
Parameter #1: Mode
Parameter #2: Undetermined
Description:
If Mode is not 1, removes projectiles listed in clearair.2da and smoke of animation ID 0x5*0 (standard behaviour).
If Mode is 1, removes projectiles and smoke animations listed in the 2da resource specified in the Resource field.
If the custom resource is invalid, standard behaviour occurs as if Mode is 0.

The recommended format of the custom 2da resources are as follows:
2DA V1.00
*
		Projectile Number
		Smoke Animation
<PROJECTILE_NAME>	94			*			//for projectile only
<PROJECTILE_NAME>	*			0X0500			//for smoke animation only
<PROJECTILE_NAME>	186			0X0600			//for projectile and smoke animation

Note that the smoke animation ID must be specified in hexadecimal, with capital X and must be 4 hexadecimal digits.
The third digit of the target smoke animation ID is ignored, e.g. 0X0500 will remove smoke animation IDs 0x05*0.

Options:
-0: disabled
-1: enabled

-----610 Repeating Effect Fix [c, F]
(Different implementation to, and clashes with tob_hacks)
Fixes a bug with the repeating effect opcode where a creature with multiple instances of disease, poison, wing buffet, 
regeneration and/or repeating effect opcodes would only have the highest frequency instance applied 

Options:
-0: disabled
-1: enabled

-----1130 Save Vs Breath Mod [M]
Adds instantaneous sum type (3)

Description
#36 (0x024)  Stat: Save vs. Breath Weapons Modifier [36]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0   Cumulative Modifier -> Save = Save + 'Statistic Modifier' value
1   Flat Value Modifier -> Save = 'Statistic Modifier' value
2   Percentage Modifier -> Save = (Save * 'Statistic Modifier' value) / 100
3   Instantaneous Cumulative Modifier -> Save = Save + 'Statistic Modifier' value

'Statistic Modifier' can be positive or negative.

For a non-permanent timing, the instantaneous cumulative modifier immediately adds the 'Statistic Modifier' value, unlike the cumulative modifier which adds the 'Statistic Modifier' after all effects are applied. The former has the disadvantage that it will be overriden by any subsequent flat value modifiers. Percentage modifiers override all other modifiers.

-----1140 Save Vs Death Mod [M]
Adds instantaneous sum type (3)

Description
#33 (0x021)  Stat: Save vs. Death Modifier [33]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0   Cumulative Modifier -> Save = Save + 'Statistic Modifier' value
1   Flat Value Modifier -> Save = 'Statistic Modifier' value
2   Percentage Modifier -> Save = (Save * 'Statistic Modifier' value) / 100
3   Instantaneous Cumulative Modifier -> Save = Save + 'Statistic Modifier' value

'Statistic Modifier' can be positive or negative.

For a non-permanent timing, the instantaneous cumulative modifier immediately adds the 'Statistic Modifier' value, unlike the cumulative modifier which adds the 'Statistic Modifier' after all effects are applied. The former has the disadvantage that it will be overriden by any subsequent flat value modifiers. Percentage modifiers override all other modifiers.

-----1150 Save Vs Poly Mod [M]
Adds instantaneous sum type (3)

Description
#35 (0x023)  Stat: Save vs. Petrification/Polymorph Modifier [35]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0   Cumulative Modifier -> Save = Save + 'Statistic Modifier' value
1   Flat Value Modifier -> Save = 'Statistic Modifier' value
2   Percentage Modifier -> Save = (Save * 'Statistic Modifier' value) / 100
3   Instantaneous Cumulative Modifier -> Save = Save + 'Statistic Modifier' value

'Statistic Modifier' can be positive or negative.

For a non-permanent timing, the instantaneous cumulative modifier immediately adds the 'Statistic Modifier' value, unlike the cumulative modifier which adds the 'Statistic Modifier' after all effects are applied. The former has the disadvantage that it will be overriden by any subsequent flat value modifiers. Percentage modifiers override all other modifiers.

-----1160 Save Vs Spells Mod [M]
Adds instantaneous sum type (3)

Description
#37 (0x025)  Stat: Save vs. Spells Modifier [37]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0   Cumulative Modifier -> Save = Save + 'Statistic Modifier' value
1   Flat Value Modifier -> Save = 'Statistic Modifier' value
2   Percentage Modifier -> Save = (Save * 'Statistic Modifier' value) / 100
3   Instantaneous Cumulative Modifier -> Save = Save + 'Statistic Modifier' value

'Statistic Modifier' can be positive or negative.

For a non-permanent timing, the instantaneous cumulative modifier immediately adds the 'Statistic Modifier' value, unlike the cumulative modifier which adds the 'Statistic Modifier' after all effects are applied. The former has the disadvantage that it will be overriden by any subsequent flat value modifiers. Percentage modifiers override all other modifiers.

-----1170 Save Vs Wands Mod [M]
Adds instantaneous sum type (3)

Description
#34 (0x022)  Stat: Save vs. Wands Modifier [34]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0   Cumulative Modifier -> Save = Save + 'Statistic Modifier' value
1   Flat Value Modifier -> Save = 'Statistic Modifier' value
2   Percentage Modifier -> Save = (Save * 'Statistic Modifier' value) / 100
3   Instantaneous Cumulative Modifier -> Save = Save + 'Statistic Modifier' value

'Statistic Modifier' can be positive or negative.

For a non-permanent timing, the instantaneous cumulative modifier immediately adds the 'Statistic Modifier' value, unlike the cumulative modifier which adds the 'Statistic Modifier' after all effects are applied. The former has the disadvantage that it will be overriden by any subsequent flat value modifiers. Percentage modifiers override all other modifiers.

-----480 Strength Mod [M, X]
Alters the strength modifier effect opcode to work similar to Icewind Dale behaviour

Description
#44 (0x02C)  Stat: Strength Modifier [44]
Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0 Cumulative Modifier -> Strength = Strength + 'Statistic Modifier' value
1 Flat Value Modifier -> Strength = 'Statistic Modifier' value
2 Percentage Modifier -> Strength = (Strength * 'Statistic Modifier' value) / 100
3 Strength Spell

For a Type of 3 (Strength Spell), strength is modified as per Icewind Dale Strength spell behaviour, externalised to CLSSPLAB.2DA, in which 1Dx strength is gained up to a maximum of 18/<STREX value> depending on the player's class (defaults to 1D6 if class is not present), where x is specified by the STR column. Unit increments between 18 and 19 depend on differences detected in the STRMODEX.2DA table. The 'Statistic Modifier' value overrides the CLSSPLAB.2DA entry, specifying the die size and allowing a maximum strength of 18/00.

FlameWing's description of Strength Spell:
"IWD1/P&P Strength Spell With a slight change, in that param1 != 0 means dice size to roll for all classes and allows exceptional strength bonuses for non-warrior classes. For example, param1 = 4 rolls a d4 for strength increase,
similar to P&P Strength of Stone spell. In all cases, strength cannot become 19 or more."

Options:
-0: disabled
-1: enabled

-----700 Use Caster Level On Mirror Image [C, M, T]
(Identical to tob_hacks, SCS, SCSII, Spell Revisions)
Modifies the mirror image opcode to keeps caster level so dispel formulae will work on it

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// ENGINE

-----20 Allow 99 Priest Known Spells Per Level [M]
Expands the 50-spell cap per level of priest spells to 99, but is still limited by SPELLS.2DA

Modding Note
If this hack is used, the following change should be made to SPELLS.2DA to avoid existing Throne of Bhaal priest spells that
should not be included:
PRIEST  99  99  99  99  98  97  99

Options:
-0: disabled
-1: enabled

-----1220 Allow All Races to Dual Class [T]
Allows all races to dual class, rather than just humans

Options:
-0: disabled
-1: enabled

-----560 Allow Equipping Armor in Combat [T]
Allows the equipment in the armor slot to be changed during combat.

Options:
-0: disabled
-1: enabled

-----940 Allow Zero Starting Experience [M]
Prevents character generation issues when starting experience is set to zero

Options:
-0: disabled
-1: enabled

-----810 Assassin and Bounty Hunter Penalty to Similar Kits [C, M]
(No compatibility issues currently described, but may cause undesirable effects to kit modifications that add kits that combine the 0x40000 and/or 0x80000 unusability flags with other unusability flags)
Applies the 15% (Assassin) or 20% (Bounty Hunter) thieving skill points disadvantage to thief kits that combine the use of the 0x40000 and/or 0x80000 unusability flags, respectively, with other unusability flags

Options:
-0: disabled
-1: enabled

-----830 Cleric-Ranger HLA Fix [F]
Fixed a bug where cleric-ranger multi-class characters had the cleric and ranger HLA rules swapped around
This was due to the arrays being set up inconsistently when working out the number of HLAs available at level-up
Therefore, cleric-rangers correctly get their first HLA at Ranger level 13 (with cleric HLAs available due to level 7 spells being available), get one HLA for each Ranger level from level 13 and higher, and get one HLA for each Cleric level from level 15 and higher

[INCORRECT]
-60 nLevelRangerOld
-5f nLevelClericOld
-5c nLevelRangerNew
-5b nLevelClericNew
-58 sRanger
-54 sCleric

[CORRECT]
-4c nChangeLevelCleric
-4b nChangeLevelRanger
-44 nFirstLevelCleric
-43 nFirstLevelRanger
-38 fNewRateCleric
-34 fNewRateRanger
-28 fRateCleric
-24 fRateRanger

Options:
-0: disabled
-1: enabled

-----950 Custom Shadows of Amn Starting Experience [C, T]
(overrides any mods that directly modify the starting experience in the executable, including Baldur's Gate Trilogy-WeiDU)
Allows setting a custom amount of starting experience for Shadows of Amn

Options:
-(-1): disabled
-Other value: Shadows of Amn starting experience set to this value

-----960 Custom Throne of Bhaal Starting Experience [C, T]
(overrides any mods that directly modify the starting experience in the executable)
Allows setting a custom amount of starting experience for Throne of Bhaal

Options:
-(-1): disabled
-Other value: Throne of Bhaal starting experience set to this value

-----240 Disable Duplicate Effect Stacking [B]
Alters stacking behaviour of effects such that a duplicate effect applied from the same item/spell is not applied if the original effect is still active. If the duration of the duplicate effect continues beyond the original effect, the duplicate effect will apply when the original effect expires.

Options:
-0: disabled
-1: enabled

-----1110 Disable End On Player1 Dead [T]
Disables the ending cutscene when the protagonist dies

Options:
-0: disabled
-1: enabled

-----760 Disable Force Inventory Pause [T]
In single player, entering the inventory screen with the game unpaused does not pause the game
If the game is first paused and the user enters the inventory screen, the game will still pause

Limitations: similar to the area map, if the user enters the inventory screen with the game unpaused, and then changes to a different screen (e.g. menu, mage book, priest book, journal), the game will remain unpaused

Options:
-0: disabled
-1: enabled

-----930 Disable Experience Boost [T]
Disables the hard-coded feature where the party gains 110% of the experience actually coded in creatures
Also, fixes a bug where the game incorrectly reports the amount of experience gained by the party

Options:
-0: disabled
-1: enabled

-----250 Disable Silence On Charm [T]
Allows dialogue with charmed/dominated creatures
Charmed/dominated creatures also keep their soundsets

Options:
-0: disabled
-1: enabled

-----730 Expanded Stats [M]
Allows modders to extend STATS.IDS to use opcodes 202-SHRT_MAX (32767)
Features of new stats:
-New stats can be set using effect opcode 318 (0x13E) with description below
-New stats 202-400 are reserved for hard-coded stats
-New stats can be checked correctly using CheckStat(), CheckStatLT(), and CheckStatGT() script triggers
-New stats are not permanent, they require an ongoing effect opcode 318 in order to keep their values
-In order to make a new stat semi-permanent, you can set an extremely long duration for the effect, or use timing mode 10 and set duration to INT_MAX (2147483647)
-New stats will only be saved in saved games if stored as an effect opcode 318
-Actions cannot directly set the value of new stats (they will not keep); use an action to trigger effect opcode 318 if actions are required
-New stats have no effect on the game unless you specifically script in; for example, use scripts to CheckStat() and apply appropriate actions

Description
#318 (0x13E)  Stat: Set stat [318]
Parameter #1: Statistic Modifier
Parameter #2 low: Stat Opcode
Parameter #2 high: Type

Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field to the opcode specified by the 'Stat Opcode' field.
Known values for 'Type' are:
0   Cumulative Modifier -> Value = Value + 'Statistic Modifier' value
1   Flat Value Modifier -> Value = 'Statistic Modifier' value
2   Percentage Modifier -> Value = (Value * 'Statistic Modifier' value) / 100
3   Multiplicative Modifier -> Value = Value * 'Statistic Modifier' value
4   Divisive Modifier -> Value = Value / 'Statistic Modifier' value
5   Modulus Modifier -> Value = Value % 'Statistic Modifier' value
6   Logical AND Modifier -> Value = Value && 'Statistic Modifier' value
7   Logical OR Modifier -> Value = Value || 'Statistic Modifier' value
8   Bitwise AND Modifier -> Value = Value & 'Statistic Modifier' value
9   Bitwise OR Modifier -> Value = Value | 'Statistic Modifier' value
10  Inverse Modifier -> Value = !Value

Note: You cannot set any stats with opcode < 387 with this effect. New stats 202-400 are reserved for new hard-coded stats.

New hard-coded stats
301 FIGHTERLEVEL - true fighter level (does not include monk)
302 MAGELEVEL - true mage level (does not include sorcerer)
303 CLERICLEVEL - true cleric level
304 THIEFLEVEL - true thief level
305 DRUIDLEVEL - true druid level
306 RANGERLEVEL - true ranger level
307 EFFECTCLERICLEVEL - equivalent cleric casting level (Cleric 1 = Ranger 8 = Paladin 9; Cleric-Rangers use cleric level)
308 BUTTONDISABLESTEALTH - set to 1 on Disable Button effect (requires Button Effects Mod)
309 BUTTONDISABLETHIEVING - set to 1 on Disable Button effect (requires Button Effects Mod)
310 BUTTONDISABLECASTSPELL - set to 1 on Disable Button effect (requires Button Effects Mod)
311 BUTTONDISABLEQUICKSPELL1 - set to 1 on Disable Button effect (requires Button Effects Mod)
312 BUTTONDISABLEQUICKSPELL2 - set to 1 on Disable Button effect (requires Button Effects Mod)
313 BUTTONDISABLEQUICKSPELL3 - set to 1 on Disable Button effect (requires Button Effects Mod)
314 BUTTONDISABLETURNUNDEAD - set to 1 on Disable Button effect (requires Button Effects Mod)
315 BUTTONDISABLETALK - set to 1 on Disable Button effect (requires Button Effects Mod)
316 BUTTONDISABLEUSEITEM - set to 1 on Disable Button effect (requires Button Effects Mod)
317 BUTTONDISABLEQUICKITEM1 - set to 1 on Disable Button effect (requires Button Effects Mod)
318 BUTTONDISABLEBARDSONG - set to 1 on Disable Button effect (requires Button Effects Mod)
319 BUTTONDISABLEQUICKITEM2 - set to 1 on Disable Button effect (requires Button Effects Mod)
320 BUTTONDISABLEQUICKITEM3 - set to 1 on Disable Button effect (requires Button Effects Mod)
321 BUTTONDISABLEABILITY - set to 1 on Disable Button effect (requires Button Effects Mod)
322 BUTTONDISABLEFINDTRAPS - disables Find Traps button when set to 1 (requires Button Effects Mod)
323 AID - set to param1 of Aid effect
324 BLESS - set to param1 of Bless effect
325 CHANT - set to param1 of Chant effect
326 DRAWUPONHOLYMIGHT - set to param1 of Draw Upon Holy Might effect
327 CHANTBAD - set to param1 of Chant Bad effect
328 DISABLESPELLTYPEWIZARD - set to 1 on Disable Spelltype effect
329 DISABLESPELLTYPEPRIEST - set to 1 on Disable Spelltype effect
330 DISABLESPELLTYPEINNATE - set to 1 on Disable Spelltype effect
331 WINGBUFFET - set to param2 of Wing Buffet effect

387 ACIDDAMAGEBONUS - percentage modifier to acid damage from item/spell ability effects
388 COLDDAMAGEBONUS - percentage modifier to cold damage from item/spell ability effects
389 CRUSHINGDAMAGEBONUS - percentage modifier to crushing damage from normal damage and item/spell ability effects
390 ELECTRICITYDAMAGEBONUS - percentage modifier to electricity damage from item/spell ability effects
391 FIREDAMAGEBONUS - percentage modifier to fire damage from item/spell ability effects
392 PIERCINGDAMAGEBONUS - percentage modifier to piercing damage from normal damage and item/spell ability effects
393 POISONDAMAGEBONUS - percentage modifier to poison damage from item/spell ability effects
394 MAGICDAMAGEBONUS - percentage modifier to magic damage from item/spell ability effects
395 MISSILEDAMAGEBONUS - percentage modifier to missile damage from normal damage and item/spell ability effects
396 SLASHINGDAMAGEBONUS - percentage modifier to slashing damage from normal damage and item/spell ability effects
397 MAGICFIREDAMAGEBONUS - percentage modifier to magic fire damage from item/spell ability effects
398 MAGICCOLDDAMAGEBONUS - percentage modifier to magic colddamage from item/spell ability effects
399 STUNNINGDAMAGEBONUS - percentage modifier to stunning damage from normal damage and item/spell ability effects
400 WEIGHTALLOWANCEMOD - custom stat that modiifies by sum the amount a character is allowed to carry (total weight allowance = StrMod value + StrModEx value + WeightAllowanceMod)

Options:
-0: disabled
-1: enabled

-----840 Externalise HP Tables [M]
Externalises two things:
1. Externalises the barbarian HP table to HPBARB.2DA
2. Externalises which HP table to use by subclass to HPCLASS.2DA

HPCLASS.2DA should ONLY contain single classes

Options:
-0: disabled
-1: enabled

-----380 Externalise Class-Race Restrictions [M, X]
The class restrictions of races are externalised to CLSRCREQ.2DA (0: not allowed, 1: allowed)
The mage school restrictions of races are externalised to MGSRCREQ.2DA (0: not allowed, 1: allowed)
If you enable all classes and mage schools, this effectively allows you to use any class-race combination
Note: there are no pre-existing animations for halfling mages and non-human monks
Therefore, animation IDs for the former are set to the halfling cleric and the latter to fighter of the same race

Options:
-0: disabled
-1: enabled

-----790 Externalise Encumbrance Restrictions [M, X]
Externalises the thresholds for low and high encumbrance to ENCUMBER.2DA

ENCUMBER.2DA
Description
THRESHOLD: The percentage weight above which [ROWNAME] applies. If the THRESHOLD is set to 0, [ROWNAME] never applies. If the THRESHOLD is set to a negative number, the value is treated as invalid and the default hard-coded value is applied.
[ROWNAME]: Either LOW_ENCUMBRANCE (slowed) or HIGH_ENCUMBRANCE (cannot move)

Options:
-0: disabled
-1: enabled

-----1180 Externalise Mage Spells Cap [M]
Externalises the number of spells cap per level of mage spells to SPELLS.2DA
The cap for level 1-8 spells can be set to 99
The cap for level 9 spells can be set to 199, for which spells 100-199 refer to SPWI0**.SPL

Modding Note
If this hack is used, it is recommended you use this hack with Externalize Mage Spell Hiding
Otherwise, unwanted spells will show up on spell selection screens
Also, assuming you provide maximum values for the number of spells in SPELLS.2DA,
you should add to HIDESPL.2DA the following vanilla Throne of Bhaal spells:
SPWI298-299
SPWI399
SPWI483-491, 493-499
SPWI590-97
SPWI853, 888, 897-899
SPWI926-965, 979-999
SPWI001-027, 050-056

Options:
-0: disabled
-1: enabled

-----490 Level One Proficiency Restrictions [C, M, T]
(Different implentation to, and clashes with tob_hacks)
Enables proficiency restrictions at level one as described by the FIRST_LEVEL column of PROFSMAX.2DA
This applies to both character generation and dual classing

Options:
-0: disabled
-1: enabled

-----590 Remain Hidden On Pickpocket Success [C, T]
(Different implementation to, and clashes with tob_hacks)
If pickpocketing is successful, the character does not become visible
Limitation: Hide In Shadows will still terminate at the end of the round

Options:
-0: disabled
-1: enabled

-----780 Rest Spawns Advance Time [T]
If resting is interrupted by rest spawns, a random amount of time up to eight hours (minus one tick) will pass
This feature already existed in the code, but was never utilised

Options:
-0: disabled
-1: enabled

-----900 Targetting Dead Animations Fix [F]
Fixes a broad bug where the dead creatures that are not transferred to the middle vertical list can be targetted by AI, triggers and actions

Brief Explanation
Vertical lists are implemented by areas to determine drawing order
There are three vertical lists: LIST_FRONT, LIST_MIDDLE, LIST_BACK
AI targetting generally includes only active creatures in LIST_FRONT
When most creatures die, they are transferred from LIST_FRONT to LIST_MIDDLE
However, some creature animations are coded to disallow use of LIST_MIDDLE; when they die, they stay in LIST_FRONT
AI targetting does not account for this, and so dead creatures in LIST_FRONT can still be targetted by AI, triggers and actions (e.g. AttackReevaluate)
Animations affected by this are: 0x6404 SAREVOK, 0x4XXX STATIC_* (SLEEPING_* are excluded based on STATE_SLEEPING)
This hack correct this issue by preventing dead creatures in LIST_FRONT and are disallowed use of LIST_MIDDLE from being targetted

Options:
-0: disabled
-1: enabled

-----990 Weapon Specialisation Number of Attacks Mod [C, T]
(identical to tb#tweaks)

Modifies the application of weapon specialisation-associated number of attacks bonuses described by WSPATCK.2DA
Specifically, all non-monk classes receive such a bonus based on their average level
Originally, ranger, paladin, and fighter classes received such a bonus based on their fighter level, while other non-monk classes received no bonus
Calculation of such a bonus for the monk class is unchanged

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// ITEMS

-----1200 Ability-specific Use Item Animations [M]
Allows the use of different custom animation sequences for different abilities of the same item
This is reflected by the support of extra columns in ITEMANIM.2DA

ITEMANIM.2DA
Description
This file lists the character animation sequence to be played when an item ability is used. This only applies to items that are used in UseItem() and UseItemPoint() actions, or equivalent thereof (i.e. used as quick item).

[ROWNAME]: Item ResRef
SEQUENCE: The animation sequence to play for the first ability of the specified item (from seq.ids). If there are no other columns, this is the animation sequence to play for all abilities.
<subsequent columns>: The animation sequence to play for the (n+1)th ability of the specified item (from seq.ids), where n is the name of the column.

Example
WAND05.ITM has two abilities

2DA V1.0
-1
	SEQUENCE	1               
WAND05	-1	12

Using the first ability plays no animation sequence (-1). Using the second ability plays animation sequence 12 (SEQ_ATTACK_BACKSLASH).

Options:
-0: disabled
-1: enabled

-----140 Configurable Backstab Restrictions [C, M]
(Different implementation to, and clashes with tob_hacks)
Adds new item ability flag bit 25 'Toggle backstab restrictions'
When bit 25 is not set, only non-ranged items usable by thieves can be used for backstabbing
When bit 25 is set, items normally usable for backstabbing are unusable for backstabbing, and vice versa
For a ranged attack that hits, both launcher and ammo abilities are checked for bit 25 and backstabbing toggled if at least one of the two has bit 25 set

Examples:
		Usable by thief		Ranged		Bit 25 Off	Bit 25 On
Dagger		Yes			No		Backstab	No backstab
Warhammer	No			No		No backstab	Backstab
Arrow		Yes			Yes		No backstab	Backstab (bit 25 can be set either on Arrow or Bow)
Throwing Axe	No			Yes		No backstab	Backstab

Options:
-0: disabled
-1: enabled

-----150 Configurable Critical Hit Aversion [M]
Adds new item flag bit 25 'Toggle critical hit aversion'
If an item with bit 25 set is equipped, critical hit aversion is enabled if the item is equipped in a non-helmet slot
If an item with bit 25 set is equipped, critical hit aversion is disabled if the item is equipped in a helmet slot

Modding Note
Whenever a critical hit is averted by helmet or not with this hack, string reference 20696 will display, reading 'Critical Hit Averted By Helmet'. Mods using this hack should change the string reference to read 'Critical Hit Averted'

Options:
-0: disabled
-1: enabled

-----1040 Configurable Items Cannot Target Invisible [M]
Adds new item ability flag bit 26 'Cannot target invisible'
This includes all creatures with invisibility and/or sanctuary

Modding Note
If this hack is enabled and a player attempts to use an item ability on an invisible/sanctuary creature with bit 26 set, string reference 46529 will display.
It reads 'Spell Cancelled: Can not target spells on invisible or sanctuaried creatures.'
This is not consistent with this hack.
Mods using this hack should change the string reference to read 'Action Cancelled: Can not target action on invisible or sanctuaried creatures.'
This substitutes the words 'Spell[s]' with 'Action' and allows compatibility with the 'Configurable Spells Can Target Invisible' hack.

Options:
-0: disabled
-1: enabled

-----300 Enable 99 Random Treasure Rows [M]
Enables the use of 99 rows for all RND*.2DA files for modders

Options:
-0: disabled
-1: enabled

-----740 Externalise Item-Creature Exclusions [M, X]
Externalises creature-specific item restrictions to ITCREXCL.2DA.

ITCREXCL.2DA
Description
[ROWNAME]: Death variable/Script name of creature (not case-sensitive)
ITEM: the resource name of the item that the item-creature restrictions apply to
NO_PICKUP_E: if set to non-zero, the ITEM cannot be removed from any equipment slot of the creature with associated death variable
STRREF_PE: the string reference to display in the inventory screen when the ITEM is attempted to be removed from an equipment slot of the creature with associated death variable
ONLY_EQUIP: if set to non-zero, the ITEM can only be equipped by the creature with associated death variable (this is 'stackable', in that multiple ITEM entries under different death variables mean that multiple creatures with associated death variables can equip the ITEM)
STRREF_E: the string reference to display in when a creature other than that with the associated death variables tries to equip the ITEM
NO_PICKUP_I: if set to non-zero, the ITEM cannot be removed from any inventory slot of the creature with associated death variable
STRREF_I: the string reference to display in the inventory screen when the ITEM is attempted to be removed from an equipment slot of the creature with associated death variable
NO_DROP_I: if set to non-zero, the ITEM cannot be placed in any inventory slot of the creature with associated death variable
STRREF_DI: the string reference to display in the inventory screen when the ITEM is attempted to be placed in any inventory slot of the creature with associated death variable
NO_DROP_E: if set to non-zero, the ITEM cannot be placed in any equipment slot of the creature with associated death variable
STRREF_DE: the string reference to display in the inventory screen when the ITEM is attmpted to be placed in any equipment slot of the creature with associated death variable

For example,
	ITEM	NO_PICKUP_E	STRREF_PE	ONLY_EQUIP	STRREF_E	NO_PICKUP_I	STRREF_I	NO_DROP_I	STRREF_DI	NO_DROP_E	STRREF_DE
MINSC	MISC84	1	10218	1	10218	1	10218	0	-1	0	-1

Item MISC84 cannot be removed from "Minsc"'s equipment slots or inventory slots, and can only be equipped by "Minsc".

Options:
-0: disabled
-1: enabled

-----910 Non-Ammo Launcher Damage Fix [F]
Fixes a bug with launcher weapons granting the damage and strength bonuses of non-launcher (4)-type abilities
This corrects the issue with non-ammo-requiring launcher weapons (using ranged (2) ability) granting extra damage when ammo is equipped
If this is enabled, damage bonuses of launcher abilities are only given for the first launcher (4)-type ability of the launcher weapon

Options:
-0: disabled
-1: enabled

-----800 Use Animation Percentages for Throwing Weapons [M, T]
Enables the use of item ability slash %, backslash %, and jab % fields for ranged weapons equipped in a weapon slot that do not require a launcher
Because this hack makes the creature use of the SEQ_ATTACK_[] animations instead of SEQ_SHOOT, attacks play the SEQ_ATTACK and SEQ_ATTACK_[] animation sounds instead of the SEQ_SHOOT animation sound
These percentages will only affect creatures with animation IDs in the 0x5000-0x53FF group with animation prefix starting with C, and 0x6*** groups to maintain vanilla behaviour and Infinity Animations compatibility

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// MUSIC

-----360 Extended Songlist [C, M]
(Different implementation to, and overrides tob_hacks)
Removes the 100-row limit in SONGLIST.2DA
Script action PlaySong() supports this change
Extended song numbers are recognised in ARE files

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// SOUND

-----40 Animation Sound Fix [C, F]
(Identical to tob_hacks)
Fixes a bug that prevented sounds in the middle of animation soundset 2DA files from playing

Options:
-0: disabled
-1: enabled

-----230 Dialogue Greeting Subtitles [T]
Displays the greeting string reference in the dialogue bar when initiating dialogue, similar to Baldur's Gate I behaviour

Options:
-0: disabled
-1: enabled

-----310 Enable Animation Attack Sounds [M, T]
Enables the SLASH, BACKSLASH, and JAB sounds in animation soundset 2DA files

Options:
-0: disabled
-1: enabled

-----340 Existence Sound Fix [F]
Fixes a bug where PICKED_POCKET sounds were played when EXISTANCE sounds were called for
This was corrected to EXISTANCE5

Options:
-0: disabled
-1: enabled

-----370 Externalise Animation Walking Sounds [M, X]
Externalises all animation walking sounds to ANIWKSND.2DA

ANIWKSND.2DA
Description
[ROWNAME]: animation ID
ANIMATION: the name of the animation for your reference (from ANIMATE.IDS)
WALK_SOUND: 6-character string specifying the root name of the walking sound.
Longer strings are read truncated. Shorter strings cause havoc!
A value of '*' is equivalent to no walking sound.
WALK_NUM: integer specifying the number of walking sounds available for the root name.

As per engine behaviour, a sound file will be loaded with name <WALK_SOUND><random>,
where <random> is mapped 0 -> a, 1 -> b, 2 -> c, ..., (WALK_NUM - 1) -> nul
For example,

	WALK_SOUND	WALK_NUM
0x1234	WAL_20		4

Walking sound for animation ID 0x1234 loads one of the following sounds:
WAL_20a [0]
WAL_20b [1]
WAL_20c [2]
WAL_20  [3]

If WALK_SOUND is set to 'TERRAIN' and WALK_NUM is set to '*', ANITNSND.2DA is used
to determine the walking sound.

ANITNSND.2DA
Description
[ROWNAME]: terrain code, based on search map pixel
WALK_SOUND: as ANIWKSND.2DA above
WALK_NUM: as per ANIWKSND.2DA above

Options:
-0: disabled
-1: enabled

-----680 Soundset Subtitles [M, X]
Enables subtitles for custom soundsets
This works by appending CSOUND.2DA
This is vanilla-compatible: if no column is present in CSOUND.2DA, no subtitles are used
Before disabling this hack from your game, please switch the characters' soundsets back to Default

Modding Note
To use this hack, use APPEND_COL on CSOUND.2DA. The column header should contain the prefix of the soundset (e.g. FEMALE1). The values for each sound should point to the string reference to display for the sound with suffix designated by the existing LETTER column.

Please note the LETTER values in rows labelled with the numbers 30, 31, 39, 63, and 64 are incorrect in vanilla Throne of Bhaal and should be corrected as shown below:

COPY_EXISTING "csound.2da" "override/csound.2da"
  COUNT_2DA_COLS nColumns
  PATCH_IF nColumns == 2 THEN BEGIN
    SET_2DA_ENTRY 31 1 2 "x"
    SET_2DA_ENTRY 32 1 2 "y"
    SET_2DA_ENTRY 40 1 2 "*"
    SET_2DA_ENTRY 64 1 2 "_"
    SET_2DA_ENTRY 65 1 2 "*"
  END ELSE BEGIN
    SET_2DA_ENTRY 32 1 2 "x"
    SET_2DA_ENTRY 33 1 2 "y"
    SET_2DA_ENTRY 41 1 2 "*"
    SET_2DA_ENTRY 65 1 2 "_"
    SET_2DA_ENTRY 66 1 2 "*"
  END
BUT_ONLY

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// SPELLS

-----180 Casting Fixes [F]
Fixes a number of issues with casting sounds and graphics:
1. Modifies the way that the gender of casting sound selection is handled
Normally, female gender uses female sound, other and niether gender uses unvoiced sound, and all other genders uses male sound
This caused problems with spells like Project Image where illusory female creatures used male casting sounds
This hack modifies so that female gender uses female sound, other and niether gender uses unvoiced sound, male gender uses male sound, and all other genders check the Sex field (0x237) in the CRE file format. If the Sex field is male, male sound is used. If female, female sound is used. For any other Sex field, an unvoiced sound is used

2. Takes into account the MENTALSPEED stat when determining whether to play a casting sound at all, whether to play a gendered or unvoiced casting sound, and whether to play the casting animation

Options:
-0: disabled
-1: enabled

-----1010 Configurable Spells Can Be Unvoiced [M]
Adds new bit 25 to spell flags 'Can Be Cast When Silenced'
When a spell is being cast while silenced using this flag, the silenced casting sound "CHA_S*" is used
This does not change the behaviour of Vocalize (SPWI219), Set Snare (SPCL412), Set Special Snare (SPCL414), and Pocket Plane (SPIN649), which are castable when silenced without the hack

Options:
-0: disabled
-1: enabled

-----880 Configurable Spells Can Target Invisible [M]
Adds new bit 24 to spell flags 'Can Target Invisible'
This includes all creatures with invisibility and/or sanctuary

Modding Note
If this hack is enabled and a player attempts to use an item ability on an invisible/sanctuary creature with bit 26 set, string reference 46529 will display.
It reads 'Spell Cancelled: Can not target spells on invisible or sanctuaried creatures.'
This is not consistent with this hack.
Mods using this hack should change the string reference to read 'Action Cancelled: Can not target action on invisible or sanctuaried creatures.'
This substitutes the words 'Spell[s]' with 'Action' and allows compatibility with the 'Configurable Items Cannot Target Invisible' hack.

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// TRIGGER

-----320 Enable PickpocketFailed Trigger [C, M, T]
(Identical to tob_hacks)
When pickpocketing fails, a PickPocketFailed() trigger is sent instead of Attacked()

Options:
-0: disabled
-1: enabled

-----1000 Expanded Triggers [M]
Enables the use of new triggers

Descriptions
0x4100 NextTriggerObject(O:Object*)
Defines the object that the next trigger will be evaluated in reference to
The trigger itself does not evaluate and does not count as a trigger in an OR() block
If the object cannot be found, the next trigger will evaluate to false

0x4101 MovementRate(O:Object*,I:Value*)
0x4102 MovementRateGT(O:Object*,I:Value*)
0x4103 MovementRateLT(O:Object*,I:Value*)
Compares the animation movement rate of the target creature specified by Object to Value. This is not affected by slow or haste, but is affected if the Object is entangled, webbed, etc.

0x4104 NumMirrorImages(O:Object*,I:Value*)
0x4105 NumMirrorImagesGT(O:Object*,I:Value*)
0x4106 NumMirrorImagesLT(O:Object*,I:Value*)
Compares the number of mirror images present on the target creature specified by Object to Value.

0x4107 BouncingSpellLevel(O:Object*,I:Level*)
Returns true if the target creature specified by Object is bouncing spells of power Level.
This returns true for both Bounce Spell Level (199) and Decrementing Bounce Spells (200) effects.

0x4108 NumBouncingSpellLevel(O:Object*,I:Level*,I:Amount*)
0x4109 NumBouncingSpellLevelGT(O:Object*,I:Level*,I:Amount*)
0x410A NumBouncingSpellLevelLT(O:Object*,I:Level*,I:Amount*)
Compares the number of spell bounces remaining on the target creature specified by Object at the power Level to Amount.
If Object has the Bounce Spell Level (199) opcode, then the number of spell bounces is unsigned 0xFFFFFFFF.

0x410B ImmuneToSpellLevel(O:Object*,I:Level*)
Returns true if the target creature specified by Object is protected from spells of power Level.
This returns true for both Protection from Spell Levels (102) and Decrementing Spell Immunity (201) effects.

0x410C NumImmuneToSpellLevel(O:Object*,I:Level*,I:Amount*)
0x410D NumImmuneToSpellLevelGT(O:Object*,I:Level*,I:Amount*)
0x410E NumImmuneToSpellLevelLT(O:Object*,I:Level*,I:Amount*)
Compares the number of spell protections remaining on the target creature specified by Object at the power Level to Amount.
If Object has the Protection from Spell Levels (102) opcode, then the number of spell protections is unsigned 0xFFFFFFFF.

0x410F TimeStopCounter(I:Number*)
0x4110 TimeStopCounterGT(I:Number*)
0x4111 TimeStopCounterLT(I:Number*)
Compares the number of ticks left of time stop to Number.

0x4112 TimeStopObject(O:Object*)
Returns true if the the target sprite specified by Object is the caster of time stop (and is exempt from the effect).

0x4113 NumTrappingSpellLevel(O:Object*,I:Level*,I:Amount*)
0x4114 NumTrappingSpellLevelGT(O:Object*,I:Level*,I:Amount*)
0x4115 NumTrappingSpellLevelLT(O:Object*,I:Level*,I:Amount*)
Compares the number of spell traps remaining on the target creature specified by Object at the power Level to Amount.

0x4116 OriginalClass(O:Object*,I:Class*Class)
Returns true if the target creature specified by Object is dual-classed and the original class matches Class.

0x4117 HPLost(O:Object*,I:Hit Points*)
0x4118 HPLostGT(O:Object*,I:Hit Points*)
0x4119 HPLostLT(O:Object*,I:Hit Points*)
Compares the absolute number of hit points short of maximum hit points on the target creature specified by Object to Amount.

Options:
-0: disabled
-1: enabled

-----750 Kit Trigger Fix [F, M]
Fixes the Kit() trigger to check the entire kit DWORD instead of just the low WORD
This allows checking for the BARBARIAN (0x40000000) and WILDMAGE (0x80000000) kits specifically

Options:
-0: disabled
-1: enabled

-----1090 Optimise Bag Search Code [F, O]
Greatly reduces the amount of overhead with triggers that check bags for the presence of items (i.e. HasItem() and variants)
Also fixes the PartyHasItemIdentified() trigger, which had identical behaviour to the PartyHasItem() trigger in single player

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// UI

-----10 Allow 1280 Total Kits [M]
Multiples the maximum total kits allowed (256) to be installed by 5
For use with Scrollable Kit Selection

Options:
-0: disabled
-1: enabled

-----120 Contingency Detects Select Spell [F, M]
Allows the contingency panel to support spells containing the Select Spell opcode
Instead of showing the parent spell, the child spells contained in the 2DA file specified by the 'Resource' field of the Select Spell opcode that would be used if the spell is cast at the creature's level are shown
Child spells are displayed separately, and are thus not stacked upon, normal spells or child spells from a different parent spell (for example, A.SPL with a Select Spell opcode of A.2DA containing SPWI112 would display separately from SPWI112.SPL and separately from B.SPL with a Select Spell opcode of B.2DA containing SPWI112)
Select Spell opcodes embedded within Use EFF File opcodes are supported

This also fixes a bug with scrolling of the spell choices when there are greater than 11 choices in a level

Options:
-0: disabled
-1: enabled

-----220 Custom Dialogue Bar Buffer Size [M]
Allows you to customise the number of lines the dialogue/log bar displays before text is lost from the top
256 is the default value and is also the recommended minimum value
Warning: values less than 32 should be considered unsafe, as clipped dialogue will crash the game
Warning: very large values may slow the game down over time

Options:
-0: disabled
-32-32767: sets the number of lines equivalent to this value

-----330 Enlarge Tooltip Scroll [C, X]
(Identical to tob_hacks)
Makes the scroll for the tooltip wider

Options:
-0: disabled
-1: enabled

-----400 Externalise Mage Spell Hiding [C, M, X]
(Different implementation to, and clashes with tob_hacks, Spell Revisions)
Externalises the spells excluded from display in chargen and sorcerer level-up spell selection to hidespl.2da
These spells are also excluded from the auto-picker
Allows the NEXT/DONE button to be clicked in chargen even if not all spells are chosen
Note that specialist mages (including wild mages) still require at least one school spell per level
Warning: If all spells are excluded from a single level for a specialist mage, chargen cannot continue

Options:
-0: disabled
-1: enabled

-----410 Externalise Race Selection StrRef [C, M, X]
(Different implementation to, and clashes with tob_hacks)
Externalises hard-coded race selection StrRefs to RACETEXT.2DA

Modding Note
Basilisk (102), bear (103), mist (136), mimic (140), and giant (142) races have no race strings. If you plan to use these, use SET_2DA_ENTRY on the relevant rows of RACETEXT.2DA

Options:
-0: disabled
-1: enabled

-----630 Scrollable Chargen Mage Spell Selection [M, X]
Adds a scroll bar to the mage spell selection panel during character generation

Options:
-0: disabled
-1: enabled

-----640 Scrollable Kit Selection [M, X]
Adds a scroll bar to the kit selection panel during character generation
Does not add scroll bars to mage specialties
Does not allow more than 256 total kits (kits over 256 will crash game when clicking SKILLS button)
The 256-kit limit can be overriden by using the Allow 1280 Total Kits hack

Options:
-0: disabled
-1: enabled

-----650 Scrollable Level Up Mage Spell Selection [M, X]
Adds a scroll bar to the sorcerer spell selection panel during level-up

Options:
-0: disabled
-1: enabled

-----660 Scrollable Mage Spellbook [C, M, X]
(Different implementation to, and clashes with tob_hacks)
Adds up and down buttons to the mage book known spells panel
Scrolls only when the number of spells in the level is > 20

Options:
-0: disabled
-1: enabled

-----670 Scrollable Priest Spellbook [C, M, X]
(Different implementation to, and clashes with tob_hacks)
Adds up and down buttons to the priest book known spells panel
Scrolls only when the number of spells in the level is > 20

Options:
-0: disabled
-1: enabled

-----690 Universal Four Inventory Weapon Slots [M, T]
Gives all playable classes four weapon slots in the inventory like fighters
This only changes the inventory display and not the quick bar at the bottom of the screen

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// VIDEO

-----980 Enable More Paperdolls [C, M]
(identical to, but also extends from Fishing For Trouble)
Allows paperdolls to show in inventory and character customisation for animations 0x12XX, 0x2XXX, 0x3XXX, and non-vanilla 0x7XXX (except 0x73XX, which is already shown in vanilla)
Note that paperdolls for the 0x7XXX group of animation must have to be named <prefix>0INV.BAM

Options:
-0: disabled
-1: enabled

-----440 IWD Animation Attack 3 Fix [F]
Fixed IWD animations (0xE***) using the 3rd attack animation (A3) that would display the
2nd attack animation in northeast and east orientations when 'Sprite Mirror' is disabled in 'baldur.ini'

Options:
-0: disabled
-1: enabled

-----720 VVC Alpha Rendering Crash Fix [F]
Enables the use of the alpha mask animation RLE-encoded BAM of VVC files by removing an erroneously placed assertion error
This alpha mask animation is used only when 3d acceleration is enabled

Options:
-0: disabled
-1: enabled

-----1190 VVC Shadow Animation Fix [F]
Fixes a bug in VVC files where the use of the 'Translucent shadow' display flag would use the normal animation Resref (0x8) for the shadow animation rather than the 'Shadow Animation ResRef' field (0x10)

Options:
-0: disabled
-1: enabled

/////////////////////////////////////// EOF