Skip to content

Commit

Permalink
Fix .npc set model not saving the displayid
Browse files Browse the repository at this point in the history
  • Loading branch information
KalopsiaTwilight committed Jun 23, 2024
1 parent 3d3b3ec commit bf0ac46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/server/game/Freedom/FreedomMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,15 @@ void FreedomMgr::CreatureSetAnimKitId(Creature* creature, uint16 animKitId)
creature->SetAIAnimKitId(animKitId);
}

void FreedomMgr::CreatureSetModel(Creature* creature, uint32 displayId) {
creature->SetDisplayId(displayId);
creature->SetNativeDisplayId(displayId);

_creatureExtraStore[creature->GetSpawnId()].displayLock = true;
_creatureExtraStore[creature->GetSpawnId()].displayId = displayId;
_creatureExtraStore[creature->GetSpawnId()].nativeDisplayId = displayId;
}

bool FreedomMgr::CreatureCanSwim(Creature const* creature)
{
return _creatureExtraStore[creature->GetSpawnId()].swim;
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Freedom/FreedomMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class TC_GAME_API FreedomMgr
void CreatureSetSwim(Creature* creature, bool toggle);
void CreatureSetFly(Creature* creature, bool toggle);
void CreatureSetAnimKitId(Creature* creature, uint16 animKitId);
void CreatureSetModel(Creature* creature, uint32 displayId);
bool CreatureCanSwim(Creature const* creature);
bool CreatureCanWalk(Creature const* creature);
bool CreatureCanFly(Creature const* creature);
Expand Down
4 changes: 1 addition & 3 deletions src/server/scripts/Commands/cs_npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,9 +1128,7 @@ class npc_commandscript : public CommandScript
return true;
}

target->SetDisplayId(displayId);
target->SetNativeDisplayId(displayId);

sFreedomMgr->CreatureSetModel(target, displayId);
sFreedomMgr->CreatureSetModifyHistory(target, source);
sFreedomMgr->SaveCreature(target);

Expand Down

0 comments on commit bf0ac46

Please sign in to comment.