DB/Lock: Difference between revisions

From wowdev
Jump to navigation Jump to search
mNo edit summary
 
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
==Header Info==
==0.5.3.3368==
  Records...................298
  struct LockRec {
Fields.....................33
  uint32_t m_ID;
Record Size...............132
  uint32_t m_Type[4];
  String Block Size...........1
  uint32_t m_Index[4];
 
  uint32_t m_Skill[4];
  uint32_t m_Action[4]; // OpenAction
  };
==Structure==
==Structure==
  Column Field Type Notes  
  Column Field Type Notes  
  1 ID Integer
  1 ID Integer
  2 Type_1 Integer If this is 1, then the next lock_properties is an item ID, if it's 2, then it's an iRef to [[LockTypes.dbc]]  
  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]]  
  3 Type_2 Integer "
  10 Lock_Properties[8] Integer If the corresponding Type field is 2 then this is an iRefID_[[LockType.dbc]].  
4 Type_3 Integer "
If the corresponding Type field value is 1 then this is the itemID of the key or item that 'unlocks' this item.  
5 Type_4 Integer "
{{Template:Sandbox/VersionRange|min_expansionlevel=6}} If the corresponding Type field is 3 then this is a [[DB/Spell|Spell ID]]
6 Type_5 Integer "
  18 Required_Skill[8] Integer Required skill needed for Lock_Properties
''7 Type_6 NULL "''
  26 Action[8] Integer Something to do with direction / opening / closing. used in <code>CGGameObject_C::IsValidOpenAction</code>
''8 Type_7 NULL "''
 
''9 Type_8 NULL "''
==1.12.1.5875 - 6.0.1.18179==
10 Lock_Properties_1 Integer If the corresponding Type_ field is 2 then this is an iRefID_[[LockTypes.dbc]].  
  struct LockRec {
If the corresponding Type_ field value is 1 then this is the itemID of the key or item that 'unlocks' this item.  
  uint32_t m_ID;
  11 Lock_Properties_2 Integer "
  {{Template:Type/foreign_key|table=LockType}} m_Type[8];
  12 Lock_Properties_3 Integer "
  uint32_t m_Index[8];
  13 Lock_Properties_4 Integer "
  uint32_t m_Skill[8];
  14 Lock_Properties_5 Integer "
  uint32_t m_Action[8];
''15 Lock_Properties_6 NULL "''
  };
''16 Lock_Properties_7 NULL "''
 
''17 Lock_Properties_8 NULL "''
==Action Validation==
18 Required_Skill_1 Integer Required skill needed for Lock_Properties_1
<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}}.
19 Required_Skill_2 Integer "  
<syntaxhighlight lang="cpp">
20 Required_Skill_3 Integer "  
bool CGGameObject_C::IsValidOpenAction(OpenAction action)
21 Required_Skill_4 Integer "
{
22 Required_Skill_5 Integer "
  GOState state = this->m_gameObj->m_state;  
  ''23 Required_Skill_6 NULL "''
  bool locked = gameObject->m_flags & 0x2;
''24 Required_Skill_7 NULL "''
 
''25 Required_Skill_8 NULL "''
  if ( state == GO_STATE_ACTIVE_ALTERNATIVE ) // destroyed
26 Unknown_1 Integer Theory: Something to do with direction / opening / closing?
    return action == OPENACTION_REBUILD;
27 Unknown_2 Integer
 
28 Unknown_3 Integer
  if ( action == OPENACTION_CLOSE )
29 Unknown_4 Integer
    return state == GO_STATE_ACTIVE;
30 Unknown_5 Integer
 
''31 Unknown_6 NULL ''
  if ( state != GO_STATE_READY )
  ''32 Unknown_7 NULL ''
    return false;
''33 Unknown_8 NULL''
 
  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
};


Retrieved from "http://www.sourcepeek.com/wiki/Lock.dbc"
// 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)
};
</syntaxhighlight>


[[Category:DBC]]
[[Category:DBC]]
[[Category:DBC_Alpha]]
[[Category:DBC_Vanilla]]
[[Category:DBC_WotLK]]
[[Category:DBC_WoD]][[Category:6.0.1.18179]]

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. 
						≥ WoD 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 PreVanilla … WoD.

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)
};