[Initialization] Fix pet_spell sql

This commit is contained in:
Yunfan Li
2024-06-23 12:57:57 +08:00
parent 036638e110
commit 34bec12851

View File

@@ -188,7 +188,7 @@ void PlayerbotFactory::Randomize(bool incremental)
ClearSkills(); ClearSkills();
// bot->SaveToDB(false, false); // bot->SaveToDB(false, false);
ClearSpells(); ClearSpells();
bot->SaveToDB(false, false); // bot->SaveToDB(false, false);
if (!incremental) if (!incremental)
{ {
ResetQuests(); ResetQuests();
@@ -196,12 +196,12 @@ void PlayerbotFactory::Randomize(bool incremental)
if (!sPlayerbotAIConfig->equipmentPersistence || level < sPlayerbotAIConfig->equipmentPersistenceLevel) { if (!sPlayerbotAIConfig->equipmentPersistence || level < sPlayerbotAIConfig->equipmentPersistenceLevel) {
ClearAllItems(); ClearAllItems();
} }
bot->SaveToDB(false, false); // bot->SaveToDB(false, false);
bot->GiveLevel(level); bot->GiveLevel(level);
bot->InitStatsForLevel(); bot->InitStatsForLevel();
CancelAuras(); CancelAuras();
bot->SaveToDB(false, false); // bot->SaveToDB(false, false);
if (pmo) if (pmo)
pmo->finish(); pmo->finish();
@@ -260,7 +260,7 @@ void PlayerbotFactory::Randomize(bool incremental)
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Mounts"); pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Mounts");
LOG_DEBUG("playerbots", "Initializing mounts..."); LOG_DEBUG("playerbots", "Initializing mounts...");
InitMounts(); InitMounts();
bot->SaveToDB(false, false); // bot->SaveToDB(false, false);
if (pmo) if (pmo)
pmo->finish(); pmo->finish();
@@ -349,8 +349,8 @@ void PlayerbotFactory::Randomize(bool incremental)
pmo->finish(); pmo->finish();
LOG_DEBUG("playerbots", "Initializing glyphs..."); LOG_DEBUG("playerbots", "Initializing glyphs...");
bot->SaveToDB(false, false);
InitGlyphs(); InitGlyphs();
// bot->SaveToDB(false, false);
// pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Guilds"); // pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Guilds");
// LOG_INFO("playerbots", "Initializing guilds..."); // LOG_INFO("playerbots", "Initializing guilds...");
@@ -372,13 +372,14 @@ void PlayerbotFactory::Randomize(bool incremental)
if (!incremental) { if (!incremental) {
bot->RemovePet(nullptr, PET_SAVE_AS_CURRENT, true); bot->RemovePet(nullptr, PET_SAVE_AS_CURRENT, true);
bot->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true); bot->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
// bot->SaveToDB(false, false);
} }
if (bot->getLevel() >= 10) if (bot->getLevel() >= 10)
{ {
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Pet"); pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Pet");
LOG_DEBUG("playerbots", "Initializing pet..."); LOG_DEBUG("playerbots", "Initializing pet...");
InitPet(); InitPet();
bot->SaveToDB(false, false); // bot->SaveToDB(false, false);
InitPetTalents(); InitPetTalents();
if (pmo) if (pmo)
pmo->finish(); pmo->finish();
@@ -1422,10 +1423,19 @@ void PlayerbotFactory::InitEquipment(bool incremental)
else if (blevel == 80) else if (blevel == 80)
delta = 9; delta = 9;
for(uint8 slot = 0; slot < EQUIPMENT_SLOT_END; ++slot) for (uint8 slot = 0; slot < EQUIPMENT_SLOT_END; ++slot)
{ {
if (slot == EQUIPMENT_SLOT_TABARD || slot == EQUIPMENT_SLOT_BODY) if (slot == EQUIPMENT_SLOT_TABARD || slot == EQUIPMENT_SLOT_BODY)
continue; continue;
if (level < 40 && (slot == EQUIPMENT_SLOT_TRINKET1 || slot == EQUIPMENT_SLOT_TRINKET2))
continue;
if (level < 25 && slot == EQUIPMENT_SLOT_NECK)
continue;
if (level < 25 && slot == EQUIPMENT_SLOT_HEAD)
continue;
uint32 desiredQuality = itemQuality; uint32 desiredQuality = itemQuality;
if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomGearLoweringChance && desiredQuality > ITEM_QUALITY_NORMAL) { if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomGearLoweringChance && desiredQuality > ITEM_QUALITY_NORMAL) {