Core/Creature: Added DB support for UNIT_FIELD_FLAGS_2. Thanks cyberbrest
- Added more flags to UnitFlags2 enum (Thanks wpp)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ALTER TABLE `creature_template` ADD `unit_flags2` int(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `unit_flags`;
|
||||
@@ -380,6 +380,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
|
||||
SetAttackTime(RANGED_ATTACK, cInfo->rangeattacktime);
|
||||
|
||||
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
|
||||
SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2);
|
||||
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicflags);
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ struct CreatureTemplate
|
||||
uint32 rangeattacktime;
|
||||
uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
|
||||
uint32 unit_flags; // enum UnitFlags mask values
|
||||
uint32 unit_flags2; // enum UnitFlags2 mask values
|
||||
uint32 dynamicflags;
|
||||
uint32 family; // enum CreatureFamily values (optional)
|
||||
uint32 trainer_type;
|
||||
|
||||
@@ -17119,7 +17119,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
SetUInt64Value(PLAYER_FARSIGHT, 0);
|
||||
SetCreatorGUID(0);
|
||||
|
||||
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
|
||||
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
|
||||
|
||||
// reset some aura modifiers before aura apply
|
||||
SetUInt32Value(PLAYER_TRACK_CREATURES, 0);
|
||||
@@ -17516,8 +17516,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
|
||||
{
|
||||
uint32 zoneId = GetZoneId();
|
||||
|
||||
std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
|
||||
std::map<uint64, Item*> invalidBagMap; // fast guid lookup for bags
|
||||
std::map<uint32, Bag*> bagMap; // fast guid lookup for bags
|
||||
std::map<uint32, Item*> invalidBagMap; // fast guid lookup for bags
|
||||
std::list<Item*> problematicItems;
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
@@ -17576,7 +17576,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
|
||||
{
|
||||
item->SetSlot(NULL_SLOT);
|
||||
// Item is in the bag, find the bag
|
||||
std::map<uint64, Bag*>::iterator itr = bagMap.find(bagGuid);
|
||||
std::map<uint32, Bag*>::iterator itr = bagMap.find(bagGuid);
|
||||
if (itr != bagMap.end())
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
@@ -17586,8 +17586,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
|
||||
}
|
||||
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
|
||||
{
|
||||
std::map<uint64, Item*>::iterator itr = invalidBagMap.find(bagGuid);
|
||||
if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end())
|
||||
std::map<uint32, Item*>::iterator itr = invalidBagMap.find(bagGuid);
|
||||
if (std::find(problematicItems.begin(), problematicItems.end(), itr->second) != problematicItems.end())
|
||||
err = EQUIP_ERR_INT_BAG_ERROR;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -623,12 +623,19 @@ enum UnitFlags2
|
||||
UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
|
||||
UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
|
||||
UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
|
||||
UNIT_FLAG2_FORCE_MOVE = 0x00000040,
|
||||
UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
|
||||
UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
|
||||
UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
|
||||
UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
|
||||
UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
|
||||
UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
|
||||
UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
|
||||
UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
|
||||
UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
|
||||
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
|
||||
UNIT_FLAG2_DISABLE_TURN = 0x00008000,
|
||||
UNIT_FLAG2_UNK2 = 0x00010000,
|
||||
UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
|
||||
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
|
||||
};
|
||||
|
||||
/// Non Player Character flags
|
||||
|
||||
@@ -369,17 +369,17 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, "
|
||||
// 9 10 11 12 13 14 15 16 17 18 19 20 21
|
||||
"modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, "
|
||||
// 22 23 24 25 26 27 28 29 30 31 32
|
||||
"scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, "
|
||||
// 33 34 35 36 37 38 39 40 41 42
|
||||
// 22 23 24 25 26 27 28 29 30 31 32 33
|
||||
"scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, "
|
||||
// 34 35 36 37 38 39 40 41 42 43
|
||||
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, "
|
||||
// 43 44 45 46 47 48 49 50 51 52 53
|
||||
// 44 45 46 47 48 49 50 51 52 53 54
|
||||
"type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, "
|
||||
// 54 55 56 57 58 59 60 61 62 63 64 65 66
|
||||
// 55 56 57 58 59 60 61 62 63 64 65 66 67
|
||||
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
|
||||
// 67 68 69 70 71 72 73 74 75 76 77
|
||||
// 68 69 70 71 72 73 74 75 76 77 78
|
||||
"InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, "
|
||||
// 78 79 80 81 82 83
|
||||
// 79 80 81 82 83 84
|
||||
" questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName "
|
||||
"FROM creature_template;");
|
||||
|
||||
@@ -435,49 +435,50 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
creatureTemplate.rangeattacktime = fields[30].GetUInt32();
|
||||
creatureTemplate.unit_class = uint32(fields[31].GetUInt8());
|
||||
creatureTemplate.unit_flags = fields[32].GetUInt32();
|
||||
creatureTemplate.dynamicflags = fields[33].GetUInt32();
|
||||
creatureTemplate.family = uint32(fields[34].GetUInt8());
|
||||
creatureTemplate.trainer_type = uint32(fields[35].GetUInt8());
|
||||
creatureTemplate.trainer_spell = fields[36].GetUInt32();
|
||||
creatureTemplate.trainer_class = uint32(fields[37].GetUInt8());
|
||||
creatureTemplate.trainer_race = uint32(fields[38].GetUInt8());
|
||||
creatureTemplate.minrangedmg = fields[39].GetFloat();
|
||||
creatureTemplate.maxrangedmg = fields[40].GetFloat();
|
||||
creatureTemplate.rangedattackpower = uint32(fields[41].GetUInt16());
|
||||
creatureTemplate.type = uint32(fields[42].GetUInt8());
|
||||
creatureTemplate.type_flags = fields[43].GetUInt32();
|
||||
creatureTemplate.lootid = fields[44].GetUInt32();
|
||||
creatureTemplate.pickpocketLootId = fields[45].GetUInt32();
|
||||
creatureTemplate.SkinLootId = fields[46].GetUInt32();
|
||||
creatureTemplate.unit_flags2 = fields[33].GetUInt32();
|
||||
creatureTemplate.dynamicflags = fields[34].GetUInt32();
|
||||
creatureTemplate.family = uint32(fields[35].GetUInt8());
|
||||
creatureTemplate.trainer_type = uint32(fields[36].GetUInt8());
|
||||
creatureTemplate.trainer_spell = fields[37].GetUInt32();
|
||||
creatureTemplate.trainer_class = uint32(fields[38].GetUInt8());
|
||||
creatureTemplate.trainer_race = uint32(fields[39].GetUInt8());
|
||||
creatureTemplate.minrangedmg = fields[40].GetFloat();
|
||||
creatureTemplate.maxrangedmg = fields[41].GetFloat();
|
||||
creatureTemplate.rangedattackpower = uint32(fields[42].GetUInt16());
|
||||
creatureTemplate.type = uint32(fields[43].GetUInt8());
|
||||
creatureTemplate.type_flags = fields[44].GetUInt32();
|
||||
creatureTemplate.lootid = fields[45].GetUInt32();
|
||||
creatureTemplate.pickpocketLootId = fields[46].GetUInt32();
|
||||
creatureTemplate.SkinLootId = fields[47].GetUInt32();
|
||||
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16();
|
||||
creatureTemplate.resistance[i] = fields[48 + i -1].GetInt16();
|
||||
|
||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
|
||||
creatureTemplate.spells[i] = fields[54 + i].GetUInt32();
|
||||
|
||||
creatureTemplate.PetSpellDataId = fields[61].GetUInt32();
|
||||
creatureTemplate.VehicleId = fields[62].GetUInt32();
|
||||
creatureTemplate.mingold = fields[63].GetUInt32();
|
||||
creatureTemplate.maxgold = fields[64].GetUInt32();
|
||||
creatureTemplate.AIName = fields[65].GetString();
|
||||
creatureTemplate.MovementType = uint32(fields[66].GetUInt8());
|
||||
creatureTemplate.InhabitType = uint32(fields[67].GetUInt8());
|
||||
creatureTemplate.HoverHeight = fields[68].GetFloat();
|
||||
creatureTemplate.ModHealth = fields[69].GetFloat();
|
||||
creatureTemplate.ModMana = fields[70].GetFloat();
|
||||
creatureTemplate.ModArmor = fields[71].GetFloat();
|
||||
creatureTemplate.RacialLeader = fields[72].GetBool();
|
||||
creatureTemplate.PetSpellDataId = fields[62].GetUInt32();
|
||||
creatureTemplate.VehicleId = fields[63].GetUInt32();
|
||||
creatureTemplate.mingold = fields[64].GetUInt32();
|
||||
creatureTemplate.maxgold = fields[65].GetUInt32();
|
||||
creatureTemplate.AIName = fields[66].GetString();
|
||||
creatureTemplate.MovementType = uint32(fields[67].GetUInt8());
|
||||
creatureTemplate.InhabitType = uint32(fields[68].GetUInt8());
|
||||
creatureTemplate.HoverHeight = fields[69].GetFloat();
|
||||
creatureTemplate.ModHealth = fields[70].GetFloat();
|
||||
creatureTemplate.ModMana = fields[71].GetFloat();
|
||||
creatureTemplate.ModArmor = fields[72].GetFloat();
|
||||
creatureTemplate.RacialLeader = fields[73].GetBool();
|
||||
|
||||
for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
|
||||
creatureTemplate.questItems[i] = fields[73 + i].GetUInt32();
|
||||
creatureTemplate.questItems[i] = fields[74 + i].GetUInt32();
|
||||
|
||||
creatureTemplate.movementId = fields[79].GetUInt32();
|
||||
creatureTemplate.RegenHealth = fields[80].GetBool();
|
||||
creatureTemplate.equipmentId = fields[81].GetUInt32();
|
||||
creatureTemplate.MechanicImmuneMask = fields[82].GetUInt32();
|
||||
creatureTemplate.flags_extra = fields[83].GetUInt32();
|
||||
creatureTemplate.ScriptID = GetScriptId(fields[84].GetCString());
|
||||
creatureTemplate.movementId = fields[80].GetUInt32();
|
||||
creatureTemplate.RegenHealth = fields[81].GetBool();
|
||||
creatureTemplate.equipmentId = fields[82].GetUInt32();
|
||||
creatureTemplate.MechanicImmuneMask = fields[83].GetUInt32();
|
||||
creatureTemplate.flags_extra = fields[84].GetUInt32();
|
||||
creatureTemplate.ScriptID = GetScriptId(fields[85].GetCString());
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
@@ -2958,13 +2958,13 @@ void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mod
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (apply)
|
||||
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
|
||||
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
|
||||
else
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (target->HasAuraType(GetAuraType()))
|
||||
return;
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
|
||||
PREPARE_STATEMENT(WORLD_INS_CREATURE_TRANSPORT, "INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PREPARE_STATEMENT(WORLD_UPD_CREATURE_TRANSPORT_EMOTE, "UPDATE creature_transport SET emote = ? WHERE transport_entry = ? AND guid = ?", CONNECTION_ASYNC);
|
||||
PREPARE_STATEMENT(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH);
|
||||
PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
|
||||
PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
|
||||
PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
|
||||
PREPARE_STATEMENT(WORLD_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH);
|
||||
PREPARE_STATEMENT(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
|
||||
|
||||
Reference in New Issue
Block a user