mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 09:07:19 +00:00
- 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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user