[Bots] Add Expansion Bitmask Quest APIs. (#2523)

* [Bots] Add Expansion Bitmask Quest APIs.

- Add `$bot->GetExpansionBitmask()` to Perl.
- Add `$bot->SetExpansionBitmask(expansion_bitmask)` to Perl.

- Add `bot:GetExpansionBitmask()` to Lua.
- Add `bot:SetExpansionBitmask(expansion_bitmask)` to Lua.

- Adds `expansion_bitmask` column to `bot_data` table.
- Allows server operators to limit expansion settings on a bot-by-bot basis.
- Allows limiting or allowing of AAs in `Bot::LoadAAs()` based on expansion bitmask.
- Default value is `-1` which just defaults to the `Bots:BotExpansionSettings` rule value.
- Setting bitmask saves to database and reloads AAs so bots automatically recalculate bonuses.

* Add save parameter.

* Typo.
This commit is contained in:
Kinglykrab
2022-11-16 08:29:50 -05:00
committed by GitHub
parent bb58a9cd20
commit 730cd3f28a
11 changed files with 540 additions and 348 deletions
+19
View File
@@ -81,6 +81,21 @@ uint32 Perl_Bot_GetBotItemIDBySlot(Bot* self, uint16 slot_id)
return self->GetBotItemBySlot(slot_id);
}
int Perl_Bot_GetExpansionBitmask(Bot* self)
{
return self->GetExpansionBitmask();
}
void Perl_Bot_SetExpansionBitmask(Bot* self, int expansion_bitmask)
{
self->SetExpansionBitmask(expansion_bitmask);
}
void Perl_Bot_SetExpansionBitmask(Bot* self, int expansion_bitmask, bool save)
{
self->SetExpansionBitmask(expansion_bitmask, save);
}
void perl_register_bot()
{
perl::interpreter state(PERL_GET_THX);
@@ -99,10 +114,14 @@ void perl_register_bot()
package.add("CountBotItem", &Perl_Bot_CountBotItem);
package.add("GetBotItem", &Perl_Bot_GetBotItem);
package.add("GetBotItemIDBySlot", &Perl_Bot_GetBotItemIDBySlot);
package.add("GetExpansionBitmask", &Perl_Bot_GetExpansionBitmask);
package.add("GetOwner", &Perl_Bot_GetOwner);
package.add("HasBotItem", &Perl_Bot_HasBotItem);
package.add("RemoveBotItem", &Perl_Bot_RemoveBotItem);
package.add("SetExpansionBitmask", (void(*)(Bot*, int))&Perl_Bot_SetExpansionBitmask);
package.add("SetExpansionBitmask", (void(*)(Bot*, int, bool))&Perl_Bot_SetExpansionBitmask);
}
#endif //EMBPERL_XS_CLASSES
#endif //BOTS