Movement will now be handled by the movement manager instead of mob

This commit is contained in:
KimLS
2018-09-20 16:14:47 -07:00
parent f754cb1307
commit 7278c6294d
32 changed files with 323 additions and 306 deletions
+23 -27
View File
@@ -208,7 +208,7 @@ Mob* QuestManager::spawn2(int npc_type, int grid, int unused, const glm::vec4& p
const NPCType* tmp = 0;
if (tmp = database.LoadNPCTypesData(npc_type))
{
auto npc = new NPC(tmp, nullptr, position, FlyMode3);
auto npc = new NPC(tmp, nullptr, position, GravityBehavior::Ground);
npc->AddLootTable();
if (npc->DropsGlobalLoot())
npc->CheckGlobalLootTables();
@@ -232,7 +232,7 @@ Mob* QuestManager::unique_spawn(int npc_type, int grid, int unused, const glm::v
const NPCType* tmp = 0;
if (tmp = database.LoadNPCTypesData(npc_type))
{
auto npc = new NPC(tmp, nullptr, position, FlyMode3);
auto npc = new NPC(tmp, nullptr, position, GravityBehavior::Ground);
npc->AddLootTable();
if (npc->DropsGlobalLoot())
npc->CheckGlobalLootTables();
@@ -308,22 +308,22 @@ Mob* QuestManager::spawn_from_spawn2(uint32 spawn2_id)
found_spawn->SetCurrentNPCID(npcid);
auto position = glm::vec4(found_spawn->GetX(), found_spawn->GetY(), found_spawn->GetZ(), found_spawn->GetHeading());
auto npc = new NPC(tmp, found_spawn, position, FlyMode3);
auto npc = new NPC(tmp, found_spawn, position, GravityBehavior::Ground);
found_spawn->SetNPCPointer(npc);
npc->AddLootTable();
if (npc->DropsGlobalLoot())
npc->CheckGlobalLootTables();
npc->SetSp2(found_spawn->SpawnGroupID());
entity_list.AddNPC(npc);
entity_list.LimitAddNPC(npc);
found_spawn->SetNPCPointer(npc);
npc->AddLootTable();
if (npc->DropsGlobalLoot())
npc->CheckGlobalLootTables();
npc->SetSp2(found_spawn->SpawnGroupID());
entity_list.AddNPC(npc);
entity_list.LimitAddNPC(npc);
if (sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay &&
sg->min_delay)
npc->AI_SetRoambox(sg->roamdist, sg->roambox[0], sg->roambox[1], sg->roambox[2], sg->roambox[3],
sg->delay, sg->min_delay);
if (zone->InstantGrids()) {
found_spawn->LoadGrid();
if (sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay &&
sg->min_delay)
npc->AI_SetRoambox(sg->roamdist, sg->roambox[0], sg->roambox[1], sg->roambox[2], sg->roambox[3],
sg->delay, sg->min_delay);
if (zone->InstantGrids()) {
found_spawn->LoadGrid();
}
return npc;
@@ -1686,7 +1686,7 @@ void QuestManager::respawn(int npcTypeID, int grid) {
const NPCType* npcType = nullptr;
if ((npcType = database.LoadNPCTypesData(npcTypeID)))
{
owner = new NPC(npcType, nullptr, owner->GetPosition(), FlyMode3);
owner = new NPC(npcType, nullptr, owner->GetPosition(), GravityBehavior::Ground);
owner->CastToNPC()->AddLootTable();
if (owner->CastToNPC()->DropsGlobalLoot())
owner->CastToNPC()->CheckGlobalLootTables();
@@ -2827,22 +2827,18 @@ bool QuestManager::IsRunning()
return owner->IsRunning();
}
void QuestManager::FlyMode(uint8 flymode)
void QuestManager::FlyMode(GravityBehavior flymode)
{
QuestManagerCurrentQuestVars();
if(initiator)
{
if (flymode >= 0 && flymode < 3) {
initiator->SendAppearancePacket(AT_Levitate, flymode);
return;
}
initiator->SendAppearancePacket(AT_Levitate, static_cast<int>(flymode));
initiator->SetFlyMode(flymode);
}
if(owner)
else if(owner)
{
if (flymode >= 0 && flymode < 3) {
owner->SendAppearancePacket(AT_Levitate, flymode);
return;
}
owner->SendAppearancePacket(AT_Levitate, static_cast<int>(flymode));
owner->SetFlyMode(flymode);
}
}