aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-03-29 11:30:49 +0200
committerShauren <shauren.trinity@gmail.com>2022-03-29 11:30:49 +0200
commitd611925dc7ab2b3f19c5ee9e0f75b8dfb6de1291 (patch)
tree4428ac0728c043ca1cb4fc55427f87268ab4860c /src/server/scripts/Commands
parentc02b829788cb274a68b125aee4dab35b9a56a2b8 (diff)
Core/Units: Reduce differences between branches part 1 - unit updatefield accessors
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp28
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp14
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp4
3 files changed, 23 insertions, 23 deletions
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index d2bd8f3e824..da9b6ad5ec7 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -225,35 +225,35 @@ public:
if (!pfactionid)
{
uint32 factionid = target->GetFaction();
- uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
- uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
- uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
+ uint32 flag = target->GetUnitFlags();
+ uint32 npcflag = target->GetNpcFlags();
+ uint32 dyflag = target->GetDynamicFlags();
handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUID().GetCounter(), factionid, flag, npcflag, dyflag);
return true;
}
uint32 factionid = atoi(pfactionid);
- uint32 flag;
+ UnitFlags flag;
char *pflag = strtok(nullptr, " ");
if (!pflag)
- flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
+ flag = target->GetUnitFlags();
else
- flag = atoi(pflag);
+ flag = UnitFlags(atoi(pflag));
char* pnpcflag = strtok(nullptr, " ");
- uint32 npcflag;
+ NPCFlags npcflag;
if (!pnpcflag)
- npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
+ npcflag = target->GetNpcFlags();
else
- npcflag = atoi(pnpcflag);
+ npcflag = NPCFlags(atoi(pnpcflag));
char* pdyflag = strtok(nullptr, " ");
uint32 dyflag;
if (!pdyflag)
- dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
+ dyflag = target->GetDynamicFlags();
else
dyflag = atoi(pdyflag);
@@ -267,9 +267,9 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_FACTION, target->GetGUID().GetCounter(), factionid, flag, npcflag, dyflag);
target->SetFaction(factionid);
- target->SetUInt32Value(UNIT_FIELD_FLAGS, flag);
- target->SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
- target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, dyflag);
+ target->ReplaceAllUnitFlags(flag);
+ target->ReplaceAllNpcFlags(npcflag);
+ target->ReplaceAllDynamicFlags(dyflag);
return true;
}
@@ -857,7 +857,7 @@ public:
return false;
uint32 anim_id = atoi((char*)args);
- handler->GetSession()->GetPlayer()->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim_id);
+ handler->GetSession()->GetPlayer()->SetEmoteState(Emote(anim_id));
return true;
}
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index a232da2ef1b..e4ee87db7b6 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -403,7 +403,7 @@ public:
return false;
}
- creature->SetUInt32Value(UNIT_NPC_FLAGS, npcFlags);
+ creature->ReplaceAllNpcFlags(npcFlags);
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_NPCFLAG);
@@ -469,7 +469,7 @@ public:
CreatureTemplate const* cInfo = target->GetCreatureTemplate();
uint32 faction = target->GetFaction();
- uint32 npcflags = target->GetUInt32Value(UNIT_NPC_FLAGS);
+ uint32 npcflags = target->GetNpcFlags();
uint32 mechanicImmuneMask = cInfo->MechanicImmuneMask;
uint32 displayid = target->GetDisplayId();
uint32 nativeid = target->GetNativeDisplayId();
@@ -494,12 +494,12 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
handler->PSendSysMessage(LANG_NPCINFO_MOVEMENT_DATA, target->GetMovementTemplate().ToString().c_str());
- handler->PSendSysMessage(LANG_NPCINFO_UNIT_FIELD_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS));
+ handler->PSendSysMessage(LANG_NPCINFO_UNIT_FIELD_FLAGS, target->GetUnitFlags());
for (UnitFlags flag : EnumUtils::Iterate<UnitFlags>())
- if (target->GetUInt32Value(UNIT_FIELD_FLAGS) & flag)
+ if (target->HasUnitFlag(flag))
handler->PSendSysMessage("* %s (0x%X)", EnumUtils::ToTitle(flag), flag);
- handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS_2), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->GetFaction());
+ handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUnitFlags2(), target->GetDynamicFlags(), target->GetFaction());
handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
handler->PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->lootid, cInfo->pickpocketLootId, cInfo->SkinLootId);
handler->PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId());
@@ -624,7 +624,7 @@ public:
}
//play npc emote
- static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, uint32 emote)
+ static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, Emote emote)
{
Creature* target = handler->getSelectedCreature();
if (!target)
@@ -634,7 +634,7 @@ public:
return false;
}
- target->SetUInt32Value(UNIT_NPC_EMOTESTATE, emote);
+ target->SetEmoteState(emote);
return true;
}
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
index 604e9cc5aed..be78a9054b7 100644
--- a/src/server/scripts/Commands/cs_reset.cpp
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -117,9 +117,9 @@ public:
if (player->GetShapeshiftForm() == FORM_NONE)
player->InitDisplayIds();
- player->SetByteValue(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, UNIT_BYTE2_FLAG_PVP);
+ player->ReplaceAllPvpFlags(UNIT_BYTE2_FLAG_PVP);
- player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
+ player->ReplaceAllUnitFlags(UNIT_FLAG_PLAYER_CONTROLLED);
//-1 is default value
player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1));