mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8826] Set creatures PvP state flag based on creature faction and rename related enum
Condition with custom flag civilian and player team only is not sufficient. This update also disallow use *_addon -table (second byte of bytes2) to set flag manually (small chance it may be needed) Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
bc5fb40867
commit
84432d8459
4 changed files with 12 additions and 12 deletions
|
|
@ -306,14 +306,13 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
SetCanModifyStats(true);
|
SetCanModifyStats(true);
|
||||||
UpdateAllStats();
|
UpdateAllStats();
|
||||||
|
|
||||||
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->faction_A);
|
// checked and error show at loading templates
|
||||||
if (factionTemplate) // check and error show at loading templates
|
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->faction_A))
|
||||||
{
|
{
|
||||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction);
|
if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP)
|
||||||
if (factionEntry)
|
SetPvP(true);
|
||||||
if( !(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN) &&
|
else
|
||||||
(factionEntry->team == ALLIANCE || factionEntry->team == HORDE) )
|
SetPvP(false);
|
||||||
SetPvP(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i < CREATURE_MAX_SPELLS; ++i)
|
for(int i=0; i < CREATURE_MAX_SPELLS; ++i)
|
||||||
|
|
@ -1971,12 +1970,12 @@ bool Creature::LoadCreaturesAddon(bool reload)
|
||||||
if (cainfo->bytes2 != 0)
|
if (cainfo->bytes2 != 0)
|
||||||
{
|
{
|
||||||
// 0 SheathState
|
// 0 SheathState
|
||||||
// 1 Bytes2Flags
|
// 1 UnitPVPStateFlags Set at Creature::UpdateEntry (SetPvp())
|
||||||
// 2 UnitRename Pet only, so always 0 for default creature
|
// 2 UnitRename Pet only, so always 0 for default creature
|
||||||
// 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
|
// 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
|
||||||
|
|
||||||
SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF));
|
SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF));
|
||||||
SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF));
|
//SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF));
|
||||||
//SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF));
|
//SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF));
|
||||||
SetByteValue(UNIT_FIELD_BYTES_2, 2, 0);
|
SetByteValue(UNIT_FIELD_BYTES_2, 2, 0);
|
||||||
//SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF));
|
//SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF));
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,8 @@ enum SpawnMask
|
||||||
|
|
||||||
enum FactionTemplateFlags
|
enum FactionTemplateFlags
|
||||||
{
|
{
|
||||||
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
|
FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP
|
||||||
|
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FactionMasks
|
enum FactionMasks
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ enum SheathState
|
||||||
#define MAX_SHEATH_STATE 3
|
#define MAX_SHEATH_STATE 3
|
||||||
|
|
||||||
// byte (1 from 0..3) of UNIT_FIELD_BYTES_2
|
// byte (1 from 0..3) of UNIT_FIELD_BYTES_2
|
||||||
enum UnitBytes2_Flags
|
enum UnitPVPStateFlags
|
||||||
{
|
{
|
||||||
UNIT_BYTE2_FLAG_PVP = 0x01,
|
UNIT_BYTE2_FLAG_PVP = 0x01,
|
||||||
UNIT_BYTE2_FLAG_UNK1 = 0x02,
|
UNIT_BYTE2_FLAG_UNK1 = 0x02,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8825"
|
#define REVISION_NR "8826"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue