-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Conversation
*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
Need always some work (mainly new commands) and some commits but the main PR is here and ready for tests. |
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)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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@
…al-AC into dynamic-crea-go
Major issue find: Creatures don't respawn |
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(); |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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()?
There was a problem hiding this comment.
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; }
There was a problem hiding this comment.
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
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:
How to Test the Changes:
Known Issues and TODO List:
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.