Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Core) Dynamic Creature/GameObject #14893

Closed
wants to merge 46 commits into from
Closed

feat(Core) Dynamic Creature/GameObject #14893

wants to merge 46 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 7, 2023

Changes Proposed:

  • Continue the work of IQ: WIP feat(core): Dynamic Creature/Go spawning #11646

  • True blizzlike creature spawn/respawn behavior - new creature = new object

  • Toggleable spawn groups (with C++/SAI/command options to use them)

  • Custom feature: dynamic spawn rate scaling. Accelerates respawn rate based on players in the zone.

  • Backward compatibility mode (set via group and for summons) to support creatures/gos that currently don't work well with this (this should be removed once the exceptions are fixed)

Issues Addressed:

SOURCE:

TrinityCore/TrinityCore@59db2ee

Tests Performed:

  • None

How to Test the Changes:

  1. For the moment test the stability and look to potential major issues with the PR (spawn, gob...)

Known Issues and TODO List:

  • Documentation, doxygene, wiki
  • Fix Respawn issue
  • Look to import new commits
  • Import new commands with the PR

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

@yehonal-bot yehonal-bot added CORE Related to the core DB related to the SQL database file-cpp Used to trigger the matrix build Script labels Feb 7, 2023
@ghost ghost added the SENSITIVE WIP SENSITIVE Work in Progress, Do not Update, Do not Merge until author approves. label Feb 7, 2023
@ghost ghost changed the title Dynamic crea go feat(Core/GameObject) Dynamic Crea/GO Feb 7, 2023
@ghost ghost changed the title feat(Core/GameObject) Dynamic Crea/GO feat(Core) Dynamic Creature/GameObject Feb 7, 2023
Maelthyrr and others added 5 commits February 7, 2023 17:10
*Cherry-pick: TrinityCore/TrinityCore@2644085

Co-authored-by: Treeston <treeston@users.noreply.github.com>
*Add also overlappaing to avoid conflicts between classic coords and Position usage
@ghost ghost marked this pull request as ready for review February 8, 2023 13:46
@ghost ghost added WIP Work in Progress. Waiting to be Tested labels Feb 8, 2023
@ghost
Copy link
Author

ghost commented Feb 8, 2023

Need always some work (mainly new commands) and some commits but the main PR is here and ready for tests.

@Kitzunu
Copy link
Member

Kitzunu commented Feb 8, 2023

Build failing tho

if (m_bCanInstantRespawn)
bool isEscort = false;
if (CreatureData const* cdata = me->GetCreatureData())
isEscort = (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (cdata->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC));
Copy link
Member

@Kitzunu Kitzunu Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no helper for flags here? Like HasFlags()?

Otherwise we should create that cuz flags & xyz is not nice.

Not needed to ve done in this PR but would be nice in the future

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. I will look later.

*Cherry-pick: TrinityCore/TrinityCore@b92e4af

*Co-authored-by: Ujp8LfXBJ6wCPR <Ujp8LfXBJ6wCPR@
@ghost
Copy link
Author

ghost commented Feb 12, 2023

Major issue find: Creatures don't respawn

@ghost ghost removed the Waiting to be Tested label Feb 12, 2023
if (!linkedRespawntime || (cInfo && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_HARD_RESET))) // Can respawn
ObjectGuid dbtableHighGuid(HighGuid::Unit, GetEntry(), m_spawnId);
time_t linkedRespawnTime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (!linkedRespawnTime) // Can respawn
Respawn();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should keep the check for hard reset as well.

{
RespawnInfoMap const& map = GetRespawnMapForType(type);
auto it = map.find(spawnId);
if (it == map.end())
Copy link
Author

@ghost ghost Mar 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lost the gridId here. I don't know why (gridId get the value 0)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that the creature/gob you are searching for never had it's gridId saved?

Copy link
Member

@Kitzunu Kitzunu Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or that Acore::ComputeGridCoord(x, y).GetId() returns 0 ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that the creature/gob you are searching for never had it's gridId saved?

No because just before entering in the method, the gridId is correctly saved in spawnData. I will look for Acore::ComputeGridCoor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you get the GridId if you debug LoadRespawnTimes()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look but I don't reach it. I've used a breakpoint in respawn command. So the calls are: Respawn -> RemoveRespawnTime() (Map.h) -> Map::GetRespawnInfo (here I lost the GridId) -> DoRespawn() and here it breaks because the first condition is: if (!sGridLoaded(gridId) { return; }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. The only thing I can see by just looking at the code (havent had time to debug it myself) is that I don't see where you save the RespawnInfo before calling GetRespawnInfo()

It should be loaded during startup, no?

Anyhow the only logical thing that could cause it is that GridId is never fetched when saving the creature/gob into RespawnInfo

@ghost ghost added the Help Wanted label Mar 11, 2023
@ghost ghost closed this by deleting the head repository Mar 25, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING CHANGE Change that will require data re-extraction or major DB table alterations CORE Related to the core DB related to the SQL database file-cpp Used to trigger the matrix build Help Wanted Requires WIKI Update Wiki sources will need to be updated after merging this PR. Script SENSITIVE WIP SENSITIVE Work in Progress, Do not Update, Do not Merge until author approves. UnitTests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Dynamic Creature/Go spawning
4 participants