DB/Lock: Difference between revisions
Jump to navigation
Jump to search
Barncastle (talk | contribs) mNo edit summary |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 29: | Line 29: | ||
<tt>m_Action</tt> is used to validate if the gameObject is eligible to be (re)used based on it's current state. This check is used in conjunction with the item/skill/spell requirements. This logic appears to be the same throughout {{Template:Sandbox/VersionRange|min_expansionlevel=0|max_expansionlevel=6}}. | <tt>m_Action</tt> is used to validate if the gameObject is eligible to be (re)used based on it's current state. This check is used in conjunction with the item/skill/spell requirements. This logic appears to be the same throughout {{Template:Sandbox/VersionRange|min_expansionlevel=0|max_expansionlevel=6}}. | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
bool CGGameObject_C::IsValidOpenAction(OpenAction action) | |||
{ | { | ||
GOState state = this->m_gameObj->m_state; | GOState state = this->m_gameObj->m_state; | ||
bool locked = gameObject->m_flags & 0x2; | |||
if ( state == GO_STATE_ACTIVE_ALTERNATIVE ) // destroyed | if ( state == GO_STATE_ACTIVE_ALTERNATIVE ) // destroyed | ||
return | return action == OPENACTION_REBUILD; | ||
if ( action == OPENACTION_CLOSE ) | if ( action == OPENACTION_CLOSE ) | ||
return state == GO_STATE_ACTIVE; | |||
if ( state != GO_STATE_READY ) | if ( state != GO_STATE_READY ) | ||
return false; | |||
if( action == OPENACTION_OPEN && locked ) | if( action == OPENACTION_OPEN && locked ) | ||
return false; | |||
if( action == OPENACTION_OPEN_UNLOCK && !locked ) | if( action == OPENACTION_OPEN_UNLOCK && !locked ) | ||
return false; | |||
return | return true; | ||
} | } | ||
Line 57: | Line 57: | ||
OPENACTION_OPEN_UNLOCK = 0x1, // mandatory unlock before open | OPENACTION_OPEN_UNLOCK = 0x1, // mandatory unlock before open | ||
OPENACTION_CLOSE = 0x2, | OPENACTION_CLOSE = 0x2, | ||
OPENACTION_DESTROY = 0x3, // mostly used by spells | OPENACTION_DESTROY = 0x3, // mostly used by spells | ||
OPENACTION_REBUILD = 0x4 // not seen in any DB | OPENACTION_REBUILD = 0x4 // not seen in any DB | ||
}; | }; |
Latest revision as of 08:08, 16 April 2018
0.5.3.3368
struct LockRec { uint32_t m_ID; uint32_t m_Type[4]; uint32_t m_Index[4]; uint32_t m_Skill[4]; uint32_t m_Action[4]; // OpenAction };
Structure
Column Field Type Notes
1 ID Integer
2 Type[8] Integer If this is 1, then the next lock_properties is an item ID, if it's 2, then it's an iRef to LockType.dbc
10 Lock_Properties[8] Integer If the corresponding Type field is 2 then this is an iRefID_LockType.dbc.
If the corresponding Type field value is 1 then this is the itemID of the key or item that 'unlocks' this item.
≥ If the corresponding Type field is 3 then this is a Spell ID
18 Required_Skill[8] Integer Required skill needed for Lock_Properties
26 Action[8] Integer Something to do with direction / opening / closing. used in CGGameObject_C::IsValidOpenAction
1.12.1.5875 - 6.0.1.18179
struct LockRec { uint32_t m_ID; foreign_keyⁱ<uint32_t, &LockTypeRec::m_ID> m_Type[8]; uint32_t m_Index[8]; uint32_t m_Skill[8]; uint32_t m_Action[8]; };
Action Validation
m_Action is used to validate if the gameObject is eligible to be (re)used based on it's current state. This check is used in conjunction with the item/skill/spell requirements. This logic appears to be the same throughout … .
bool CGGameObject_C::IsValidOpenAction(OpenAction action)
{
GOState state = this->m_gameObj->m_state;
bool locked = gameObject->m_flags & 0x2;
if ( state == GO_STATE_ACTIVE_ALTERNATIVE ) // destroyed
return action == OPENACTION_REBUILD;
if ( action == OPENACTION_CLOSE )
return state == GO_STATE_ACTIVE;
if ( state != GO_STATE_READY )
return false;
if( action == OPENACTION_OPEN && locked )
return false;
if( action == OPENACTION_OPEN_UNLOCK && !locked )
return false;
return true;
}
enum OpenAction
{
OPENACTION_OPEN = 0x0,
OPENACTION_OPEN_UNLOCK = 0x1, // mandatory unlock before open
OPENACTION_CLOSE = 0x2,
OPENACTION_DESTROY = 0x3, // mostly used by spells
OPENACTION_REBUILD = 0x4 // not seen in any DB
};
// taken from Trinity
enum GOState
{
GO_STATE_ACTIVE = 0, // used and not reset (closed door is open)
GO_STATE_READY = 1, // initial unused state (closed door is closed)
GO_STATE_ACTIVE_ALTERNATIVE = 2, // used and destroyed ([Blow Zul'Farrak Door]'s spell effect)
};