mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Added bot owner option 'stats update'
This commit is contained in:
parent
c9d4bb178f
commit
2e9cf7dbd7
@ -34,7 +34,7 @@
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9139
|
||||
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9022
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9023
|
||||
#else
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||
#endif
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
9020|2018_08_13_bots_inventory_update.sql|SELECT * FROM `inventory_versions` WHERE `version` = 2 and `bot_step` = 0|not_empty|
|
||||
9021|2018_10_09_bots_owner_options.sql|SHOW TABLES LIKE 'bot_owner_options'|empty|
|
||||
9022|2019_02_07_bots_stance_type_update.sql|SELECT * FROM `bot_spell_casting_chances` WHERE `spell_type_index` = '255' AND `class_id` = '255' AND `stance_index` = '0'|not_empty|
|
||||
9023|2019_06_22_bots_owner_option_stats_update.sql|SHOW COLUMNS FROM `bot_owner_options` LIKE 'stats_update'|empty|
|
||||
|
||||
# Upgrade conditions:
|
||||
# This won't be needed after this system is implemented, but it is used database that are not
|
||||
|
||||
@ -0,0 +1 @@
|
||||
ALTER TABLE `bot_owner_options` ADD COLUMN `stats_update` SMALLINT(3) UNSIGNED NULL DEFAULT '0' AFTER `death_marquee`;
|
||||
@ -3499,7 +3499,7 @@ void Bot::LevelBotWithClient(Client* client, uint8 level, bool sendlvlapp) {
|
||||
Bot* bot = *biter;
|
||||
if(bot && (bot->GetLevel() != client->GetLevel())) {
|
||||
bot->SetPetChooser(false); // not sure what this does, but was in bot 'update' code
|
||||
bot->CalcBotStats(false); // TODO: look at this and see if 'true' should be passed...
|
||||
bot->CalcBotStats(client->GetBotOptionStatsUpdate());
|
||||
if(sendlvlapp)
|
||||
bot->SendLevelAppearance();
|
||||
// modified from Client::SetLevel()
|
||||
@ -4176,6 +4176,9 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
|
||||
size_t returned_count = client_return.size();
|
||||
|
||||
client->Message(CC_Lime, "Trade with '%s' resulted in %i accepted item%s, %i returned item%s.", GetCleanName(), accepted_count, ((accepted_count == 1) ? "" : "s"), returned_count, ((returned_count == 1) ? "" : "s"));
|
||||
|
||||
if (accepted_count)
|
||||
CalcBotStats(client->GetBotOptionStatsUpdate());
|
||||
}
|
||||
|
||||
bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) {
|
||||
|
||||
@ -3441,16 +3441,34 @@ void bot_command_movement_speed(Client *c, const Seperator *sep)
|
||||
void bot_command_owner_option(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||
c->Message(m_usage, "usage: %s [deathmarquee]", sep->arg[0]);
|
||||
c->Message(m_usage, "usage: %s [deathmarquee | statsupdate] (argument: enable | disable | null (toggles))", sep->arg[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string owner_option = sep->arg[1];
|
||||
std::string flag = sep->arg[2];
|
||||
|
||||
if (!owner_option.compare("deathmarquee")) {
|
||||
c->SetBotOptionDeathMarquee(!c->GetBotOptionDeathMarquee());
|
||||
c->Message(m_action, "Bot death marquee is now %s.", (c->GetBotOptionDeathMarquee() == true ? "enabled" : "disabled"));
|
||||
if (!flag.compare("enable"))
|
||||
c->SetBotOptionDeathMarquee(true);
|
||||
else if (!flag.compare("disable"))
|
||||
c->SetBotOptionDeathMarquee(false);
|
||||
else
|
||||
c->SetBotOptionDeathMarquee(!c->GetBotOptionDeathMarquee());
|
||||
|
||||
botdb.SaveOwnerOptionDeathMarquee(c->CharacterID(), c->GetBotOptionDeathMarquee());
|
||||
c->Message(m_action, "Bot 'death marquee' is now %s.", (c->GetBotOptionDeathMarquee() == true ? "enabled" : "disabled"));
|
||||
}
|
||||
else if (!owner_option.compare("statsupdate")) {
|
||||
if (!flag.compare("enable"))
|
||||
c->SetBotOptionStatsUpdate(true);
|
||||
else if (!flag.compare("disable"))
|
||||
c->SetBotOptionStatsUpdate(false);
|
||||
else
|
||||
c->SetBotOptionStatsUpdate(!c->GetBotOptionStatsUpdate());
|
||||
|
||||
botdb.SaveOwnerOptionStatsUpdate(c->CharacterID(), c->GetBotOptionStatsUpdate());
|
||||
c->Message(m_action, "Bot 'stats update' is now %s.", (c->GetBotOptionStatsUpdate() == true ? "enabled" : "disabled"));
|
||||
}
|
||||
else {
|
||||
c->Message(m_fail, "Owner option '%s' is not recognized.", owner_option.c_str());
|
||||
@ -5532,7 +5550,7 @@ void bot_subcommand_bot_update(Client *c, const Seperator *sep)
|
||||
continue;
|
||||
|
||||
bot_iter->SetPetChooser(false);
|
||||
bot_iter->CalcBotStats((sbl.size() == 1));
|
||||
bot_iter->CalcBotStats(c->GetBotOptionStatsUpdate());
|
||||
bot_iter->SendAppearancePacket(AT_WhoLevel, bot_iter->GetLevel(), true, true);
|
||||
++bot_count;
|
||||
}
|
||||
@ -7321,7 +7339,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
my_bot->BotRemoveEquipItem(slotId);
|
||||
my_bot->CalcBotStats();
|
||||
my_bot->CalcBotStats(c->GetBotOptionStatsUpdate());
|
||||
}
|
||||
|
||||
switch (slotId) {
|
||||
|
||||
@ -2188,7 +2188,7 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
|
||||
return false;
|
||||
|
||||
query = StringFormat(
|
||||
"SELECT `death_marquee` FROM `bot_owner_options`"
|
||||
"SELECT `death_marquee`, `stats_update` FROM `bot_owner_options`"
|
||||
" WHERE `owner_id` = '%u'",
|
||||
owner->CharacterID()
|
||||
);
|
||||
@ -2204,6 +2204,7 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
|
||||
|
||||
auto row = results.begin();
|
||||
owner->SetBotOptionDeathMarquee((atoi(row[0]) != 0));
|
||||
owner->SetBotOptionStatsUpdate((atoi(row[1]) != 0));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2227,6 +2228,25 @@ bool BotDatabase::SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BotDatabase::SaveOwnerOptionStatsUpdate(const uint32 owner_id, const bool flag)
|
||||
{
|
||||
if (!owner_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat(
|
||||
"UPDATE `bot_owner_options`"
|
||||
" SET `stats_update` = '%u'"
|
||||
" WHERE `owner_id` = '%u'",
|
||||
(flag == true ? 1 : 0),
|
||||
owner_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Bot bot-group functions */
|
||||
bool BotDatabase::QueryBotGroupExistence(const std::string& group_name, bool& extant_flag)
|
||||
|
||||
@ -148,6 +148,7 @@ public:
|
||||
|
||||
bool LoadOwnerOptions(Client *owner);
|
||||
bool SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool flag);
|
||||
bool SaveOwnerOptionStatsUpdate(const uint32 owner_id, const bool flag);
|
||||
|
||||
/* Bot bot-group functions */
|
||||
bool QueryBotGroupExistence(const std::string& botgroup_name, bool& extant_flag);
|
||||
|
||||
@ -1642,18 +1642,22 @@ private:
|
||||
#ifdef BOTS
|
||||
struct BotOwnerOptions {
|
||||
bool death_marquee;
|
||||
bool stats_update;
|
||||
};
|
||||
|
||||
BotOwnerOptions bot_owner_options;
|
||||
|
||||
const BotOwnerOptions DefaultBotOwnerOptions = {
|
||||
false // death_marquee
|
||||
false, // death_marquee
|
||||
false // stats_update
|
||||
};
|
||||
|
||||
public:
|
||||
void SetBotOptionDeathMarquee(bool flag) { bot_owner_options.death_marquee = flag; }
|
||||
void SetBotOptionStatsUpdate(bool flag) { bot_owner_options.stats_update = flag; }
|
||||
|
||||
bool GetBotOptionDeathMarquee() const { return bot_owner_options.death_marquee; }
|
||||
bool GetBotOptionStatsUpdate() const { return bot_owner_options.stats_update; }
|
||||
|
||||
private:
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user