- Fixed loading WorldPosition from string to fix RTSC points loading (#965)

- Restored loading from playerbots_db_store
- Added deletion before saving to playerbots_db_store
This commit is contained in:
kadeshar
2025-02-13 11:39:20 +01:00
committed by GitHub
parent ab7acfbdfc
commit bf195efaea
4 changed files with 44 additions and 19 deletions

View File

@@ -17,11 +17,6 @@ void PlayerbotDbStore::Load(PlayerbotAI* botAI)
stmt->SetData(0, guid);
if (PreparedQueryResult result = PlayerbotsDatabase.Query(stmt))
{
botAI->ClearStrategies(BOT_STATE_COMBAT);
botAI->ClearStrategies(BOT_STATE_NON_COMBAT);
botAI->ChangeStrategy("+chat", BOT_STATE_COMBAT);
botAI->ChangeStrategy("+chat", BOT_STATE_NON_COMBAT);
std::vector<std::string> values;
do
{
@@ -32,9 +27,17 @@ void PlayerbotDbStore::Load(PlayerbotAI* botAI)
if (key == "value")
values.push_back(value);
else if (key == "co")
{
botAI->ClearStrategies(BOT_STATE_COMBAT);
botAI->ChangeStrategy("+chat", BOT_STATE_COMBAT);
botAI->ChangeStrategy(value, BOT_STATE_COMBAT);
}
else if (key == "nc")
{
botAI->ClearStrategies(BOT_STATE_NON_COMBAT);
botAI->ChangeStrategy("+chat", BOT_STATE_NON_COMBAT);
botAI->ChangeStrategy(value, BOT_STATE_NON_COMBAT);
}
else if (key == "dead")
botAI->ChangeStrategy(value, BOT_STATE_DEAD);
} while (result->NextRow());
@@ -49,6 +52,11 @@ void PlayerbotDbStore::Save(PlayerbotAI* botAI)
Reset(botAI);
PlayerbotsDatabasePreparedStatement* deleteStatement =
PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_DEL_DB_STORE);
deleteStatement->SetData(0, guid);
PlayerbotsDatabase.Execute(deleteStatement);
std::vector<std::string> data = botAI->GetAiObjectContext()->Save();
for (std::vector<std::string>::iterator i = data.begin(); i != data.end(); ++i)
{