Skip to content

Python builtin tpdp module

Dude McDude edited this page Mar 21, 2017 · 31 revisions

Under Construction


The tpdp module is a new Temple+ builtin module used for exposing many ToEE data types. You can see the contents by typing in the game console

import tpdp
dir(tpdp)

Or, just check out the CPP file:
python_dispatcher.cpp

Data Types

BonusList

Methods

  • add(value, bonus_type, mesline_num)
    adds a bonus entry. Will show a line from bonus.mes in the roll breakdown.
  • add(value, bonus_type, text)
    adds a bonus entry. Will show the specified text in the rolls breakdown.
  • add_from_feat(value, bonus_type, mesline_num, feat_enum)
    adds a bonus entry. Specifies the feat as the case.
  • add_from_feat(value, bonus_type, mesline_num, feat_text_id)
    adds a bonus entry. Specifies the feat as the case. (uses the string as feat ID - meant for use with the new Temple+ feats)
  • set_overall_cap(flags, new_cap_value, new_cap_type, mesline_num)
    sets an overall cap for a bonus type (use 0 to cap all types)
  • get_sum()
  • add_zeroed(mesline_num)
    - adds a null bonus (used for indicating nullified bonuses, e.g. Dex bonus nulled from Flatfooted)
  • add_cap(bonus_type, cap_value, mesline_num)
    adds a cap for a particular bonus type

AttackPacket

Members:

  • target (PyObjHandle)
  • attacker (PyObjHandle)

Methods:

  • get_flags()
    gets the D20CAF flags
  • set_flags(flags)
    sets the D20CAF flags
  • get_weapon_used()
    returns PyObjHandle of the weapon used in this attack
  • is_offhand_attack()
    Is this an offhand attack?

DamagePacket

Members:

  • bonus_list
  • flags
  • attack_power (See D20DAP_ flags)
  • critical_multiplier (integer; 1 by default, gets increased by various things)

Methods:

  • add_dice(dice, damType, damageMesLine)
    dice is a PyDice object, create it via dice_new('XdY')

SpellEntry

SpellPacket

Members:

  • spell_enum
  • inventory_idx - for spells originating from items, this indicates the item slot (as per the .inventory_item(idx) method from PyObjHandle). For non-item spells, this is set to 255.
  • picker_result - not yet exposed to python :) but this contains the result of the UI picker after selecting targets.
  • spell_class - For domain spells, this is the domain enum. For non-domain spells, this is currently just the casting class OR'd with 0x80 (e.g. for Sorcerers, class enum is 0x10, so spell_class will be 0x10 | 0x80 → 0x90). In the future this may be expanded a bit (to exploit the fact that domains only go up to 23 currently), so it's best to use a central method such as GetSpellClassFromClassEnum() to handle this.
  • spell_id - the spell ID. A unique identifier for a specific spell casting. This is used as a key in the Active Spell Registry, where the spell information is kept.
  • caster_level - caster level.
  • loc - spell location.
  • caster - the spell caster (PyObjHandle). For item-based spells (like wands and such), this is the holder of the item.

Methods:

  • get_target(idx) - get target object (PyObjHandle).
  • is_divine_spell() - Is the spell divinely sourced?
  • debit_spell() - debit from the daily casting / memorized spells.
  • update_registry() - Updates changes made to this local copy in the Active Spell Registry.
  • set_spell_object(spellObjHandle, partSysId) - sets the spell's Spell Object and its concomitant particle system id. Used for AoE spells that spawn a Spell Object with an applied Modifier (such as "sp-Grease").
  • set_projectile(idx, projectileHandle) - sets projectile object.

TurnBasedStatus

D20Action

Members

  • performer (PyObjHandle)
  • target (PyObjHandle)
  • spell_id
  • data1 (generic piece of data used for various things depending on context, action type etc.)
  • flags (see D20CAF_ flags)
  • path
  • action_type (see D20A_ constants)
  • loc
  • anim_id

Methods:

  • query_can_be_affected_action_perform(obj)
    can obj be affected by the action (returns 1 by default, can return 0 due to things like Sanctuary, Ethereality, etc)

D20SpellData

MetaMagicData

Event Objects

EventArgs

This is the "args" in the various callbacks.

Methods

  • get_arg(n)
    gets the value of modifier arg n
  • set_arg(n, value)
    sets the value of modifier arg n
  • condition_remove()
    removes the modifier

Note: The class name is a bit of a misnomer - this is mostly used for exposing the Modifier args.

EventObjD20Query

Used for d20_query calls.

  • return_val - integer return value for the d20_query.
  • data1 - generic piece of data. Can be a C++ pointer to another object.
  • data2 - second generic piece of data
  • get_spell_packet() - Used for CasterLevelMod events to get a SpellPacket from the data1 field

EventObjD20Signal

  • data1 - generic piece of data. Can be a C++ pointer to another object (such as D20Action).
  • data2 - second generic piece of data
  • return_val - integer return value. Not really used as a return value, but you can manipulate it nonetheless for communicating with other callbacks.

EventObjBonusList

Used for fetching ability score levels and cur/max HP

Members

  • bonus_list
  • flags

EventObjObjectBonus

Used for Item Bonuses, initiative modifiers and others.

Members

  • bonus_list
  • return_val

EventObjSavingThrow

Members

EventObjAttack

Used in ET_OnToHitBonusBase, ET_OnToHitBonus2, ET_OnGetAC and ET_OnGetAcModifierFromAttacker

Members

EventObjDamage

Used for adding damage dice and bonuses. Belongs to events ET_OnDealingDamage and ET_OnDealingDamage2.

Members

EventObjGetAttackDice

Used for getting the critter's attack dice

EventObjD20Action

Used for D20 Action Checks/Performance events and obtaining number of attacks (base/bonus/natural)

EventObjTurnBasedStatus

EventObjSpellEntry

EventObjSpellCaster

Used for retrieving spell caster specs. New for Temple+!

EventObjTooltip

Tooltip event for mouse-overed objects.

EventObjEffectTooltip

Used creating status effect indicators in the party portrait row and their associated tooltips.

Methods

  • append(effect_type_id, spell_enum, text)
    effect_type_id - up to 91 is for buffs, 92 thru 167 is for ailments, and the rest are for status effects (icons inside the portrait)
    spell_enum - use -2 for non-spells
    text - freeform text

EventObjObjectEvent

Used for Object Events (triggered by entering/leaveing AoE).

Members

  • target (PyObjHandle) - the critter affected by the AoE (or departing it)
  • aoe_obj (PyObjHandle) - The origin of the AoE effect (often a spell object - proto 6400)
  • evt_id - event id. Whenever an object event process is registered, it will create a unique ID, which should generally also be stored in a condition argument. See more info on Object Events here.

EventObjModifier

EventObjDispelCheck

Dispel Check Event

EventObjImmunityTrigger

Used for triggering the immunity handling query

EventObjMoveSpeed

Used for getting move speed, and also for model size scaling with Temple+.

EventObjGetAbilityLoss

Used for Ability Loss status

EventObjReflexSaveThrow

Used for Reflex Save throws that reduce damage.

Clone this wiki locally