mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
[Bots] Expanded Bot Spell Settings List. (#2606)
* [Bots] Expanded Bot Spell List Settings * [Bots] Expanded Bot Spell List Settings * Fixes/formatting * typo * Formatting & update SpellInfo Command * Spelling * Typo
This commit is contained in:
parent
35d22913b9
commit
61b91d92c3
@ -67,6 +67,7 @@ public:
|
|||||||
uint32_t follow_distance;
|
uint32_t follow_distance;
|
||||||
uint8_t stop_melee_level;
|
uint8_t stop_melee_level;
|
||||||
int32_t expansion_bitmask;
|
int32_t expansion_bitmask;
|
||||||
|
uint8_t enforce_spell_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@ -125,6 +126,7 @@ public:
|
|||||||
"follow_distance",
|
"follow_distance",
|
||||||
"stop_melee_level",
|
"stop_melee_level",
|
||||||
"expansion_bitmask",
|
"expansion_bitmask",
|
||||||
|
"enforce_spell_settings",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +181,7 @@ public:
|
|||||||
"follow_distance",
|
"follow_distance",
|
||||||
"stop_melee_level",
|
"stop_melee_level",
|
||||||
"expansion_bitmask",
|
"expansion_bitmask",
|
||||||
|
"enforce_spell_settings",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,54 +222,55 @@ public:
|
|||||||
{
|
{
|
||||||
BotData e{};
|
BotData e{};
|
||||||
|
|
||||||
e.bot_id = 0;
|
e.bot_id = 0;
|
||||||
e.owner_id = 0;
|
e.owner_id = 0;
|
||||||
e.spells_id = 0;
|
e.spells_id = 0;
|
||||||
e.name = "";
|
e.name = "";
|
||||||
e.last_name = "";
|
e.last_name = "";
|
||||||
e.title = "";
|
e.title = "";
|
||||||
e.suffix = "";
|
e.suffix = "";
|
||||||
e.zone_id = 0;
|
e.zone_id = 0;
|
||||||
e.gender = 0;
|
e.gender = 0;
|
||||||
e.race = 0;
|
e.race = 0;
|
||||||
e.class_ = 0;
|
e.class_ = 0;
|
||||||
e.level = 0;
|
e.level = 0;
|
||||||
e.deity = 0;
|
e.deity = 0;
|
||||||
e.creation_day = 0;
|
e.creation_day = 0;
|
||||||
e.last_spawn = 0;
|
e.last_spawn = 0;
|
||||||
e.time_spawned = 0;
|
e.time_spawned = 0;
|
||||||
e.size = 0;
|
e.size = 0;
|
||||||
e.face = 1;
|
e.face = 1;
|
||||||
e.hair_color = 1;
|
e.hair_color = 1;
|
||||||
e.hair_style = 1;
|
e.hair_style = 1;
|
||||||
e.beard = 0;
|
e.beard = 0;
|
||||||
e.beard_color = 1;
|
e.beard_color = 1;
|
||||||
e.eye_color_1 = 1;
|
e.eye_color_1 = 1;
|
||||||
e.eye_color_2 = 1;
|
e.eye_color_2 = 1;
|
||||||
e.drakkin_heritage = 0;
|
e.drakkin_heritage = 0;
|
||||||
e.drakkin_tattoo = 0;
|
e.drakkin_tattoo = 0;
|
||||||
e.drakkin_details = 0;
|
e.drakkin_details = 0;
|
||||||
e.ac = 0;
|
e.ac = 0;
|
||||||
e.atk = 0;
|
e.atk = 0;
|
||||||
e.hp = 0;
|
e.hp = 0;
|
||||||
e.mana = 0;
|
e.mana = 0;
|
||||||
e.str = 75;
|
e.str = 75;
|
||||||
e.sta = 75;
|
e.sta = 75;
|
||||||
e.cha = 75;
|
e.cha = 75;
|
||||||
e.dex = 75;
|
e.dex = 75;
|
||||||
e.int_ = 75;
|
e.int_ = 75;
|
||||||
e.agi = 75;
|
e.agi = 75;
|
||||||
e.wis = 75;
|
e.wis = 75;
|
||||||
e.fire = 0;
|
e.fire = 0;
|
||||||
e.cold = 0;
|
e.cold = 0;
|
||||||
e.magic = 0;
|
e.magic = 0;
|
||||||
e.poison = 0;
|
e.poison = 0;
|
||||||
e.disease = 0;
|
e.disease = 0;
|
||||||
e.corruption = 0;
|
e.corruption = 0;
|
||||||
e.show_helm = 0;
|
e.show_helm = 0;
|
||||||
e.follow_distance = 200;
|
e.follow_distance = 200;
|
||||||
e.stop_melee_level = 255;
|
e.stop_melee_level = 255;
|
||||||
e.expansion_bitmask = -1;
|
e.expansion_bitmask = -1;
|
||||||
|
e.enforce_spell_settings = 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@ -302,54 +306,55 @@ public:
|
|||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
BotData e{};
|
BotData e{};
|
||||||
|
|
||||||
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||||
e.owner_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
e.owner_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||||
e.spells_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
e.spells_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||||
e.name = row[3] ? row[3] : "";
|
e.name = row[3] ? row[3] : "";
|
||||||
e.last_name = row[4] ? row[4] : "";
|
e.last_name = row[4] ? row[4] : "";
|
||||||
e.title = row[5] ? row[5] : "";
|
e.title = row[5] ? row[5] : "";
|
||||||
e.suffix = row[6] ? row[6] : "";
|
e.suffix = row[6] ? row[6] : "";
|
||||||
e.zone_id = static_cast<int16_t>(atoi(row[7]));
|
e.zone_id = static_cast<int16_t>(atoi(row[7]));
|
||||||
e.gender = static_cast<int8_t>(atoi(row[8]));
|
e.gender = static_cast<int8_t>(atoi(row[8]));
|
||||||
e.race = static_cast<int16_t>(atoi(row[9]));
|
e.race = static_cast<int16_t>(atoi(row[9]));
|
||||||
e.class_ = static_cast<int8_t>(atoi(row[10]));
|
e.class_ = static_cast<int8_t>(atoi(row[10]));
|
||||||
e.level = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
e.level = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
||||||
e.deity = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
e.deity = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||||
e.creation_day = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
e.creation_day = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||||
e.last_spawn = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
e.last_spawn = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||||
e.time_spawned = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
e.time_spawned = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||||
e.size = strtof(row[16], nullptr);
|
e.size = strtof(row[16], nullptr);
|
||||||
e.face = static_cast<int32_t>(atoi(row[17]));
|
e.face = static_cast<int32_t>(atoi(row[17]));
|
||||||
e.hair_color = static_cast<int32_t>(atoi(row[18]));
|
e.hair_color = static_cast<int32_t>(atoi(row[18]));
|
||||||
e.hair_style = static_cast<int32_t>(atoi(row[19]));
|
e.hair_style = static_cast<int32_t>(atoi(row[19]));
|
||||||
e.beard = static_cast<int32_t>(atoi(row[20]));
|
e.beard = static_cast<int32_t>(atoi(row[20]));
|
||||||
e.beard_color = static_cast<int32_t>(atoi(row[21]));
|
e.beard_color = static_cast<int32_t>(atoi(row[21]));
|
||||||
e.eye_color_1 = static_cast<int32_t>(atoi(row[22]));
|
e.eye_color_1 = static_cast<int32_t>(atoi(row[22]));
|
||||||
e.eye_color_2 = static_cast<int32_t>(atoi(row[23]));
|
e.eye_color_2 = static_cast<int32_t>(atoi(row[23]));
|
||||||
e.drakkin_heritage = static_cast<int32_t>(atoi(row[24]));
|
e.drakkin_heritage = static_cast<int32_t>(atoi(row[24]));
|
||||||
e.drakkin_tattoo = static_cast<int32_t>(atoi(row[25]));
|
e.drakkin_tattoo = static_cast<int32_t>(atoi(row[25]));
|
||||||
e.drakkin_details = static_cast<int32_t>(atoi(row[26]));
|
e.drakkin_details = static_cast<int32_t>(atoi(row[26]));
|
||||||
e.ac = static_cast<int16_t>(atoi(row[27]));
|
e.ac = static_cast<int16_t>(atoi(row[27]));
|
||||||
e.atk = static_cast<int32_t>(atoi(row[28]));
|
e.atk = static_cast<int32_t>(atoi(row[28]));
|
||||||
e.hp = static_cast<int32_t>(atoi(row[29]));
|
e.hp = static_cast<int32_t>(atoi(row[29]));
|
||||||
e.mana = static_cast<int32_t>(atoi(row[30]));
|
e.mana = static_cast<int32_t>(atoi(row[30]));
|
||||||
e.str = static_cast<int32_t>(atoi(row[31]));
|
e.str = static_cast<int32_t>(atoi(row[31]));
|
||||||
e.sta = static_cast<int32_t>(atoi(row[32]));
|
e.sta = static_cast<int32_t>(atoi(row[32]));
|
||||||
e.cha = static_cast<int32_t>(atoi(row[33]));
|
e.cha = static_cast<int32_t>(atoi(row[33]));
|
||||||
e.dex = static_cast<int32_t>(atoi(row[34]));
|
e.dex = static_cast<int32_t>(atoi(row[34]));
|
||||||
e.int_ = static_cast<int32_t>(atoi(row[35]));
|
e.int_ = static_cast<int32_t>(atoi(row[35]));
|
||||||
e.agi = static_cast<int32_t>(atoi(row[36]));
|
e.agi = static_cast<int32_t>(atoi(row[36]));
|
||||||
e.wis = static_cast<int32_t>(atoi(row[37]));
|
e.wis = static_cast<int32_t>(atoi(row[37]));
|
||||||
e.fire = static_cast<int16_t>(atoi(row[38]));
|
e.fire = static_cast<int16_t>(atoi(row[38]));
|
||||||
e.cold = static_cast<int16_t>(atoi(row[39]));
|
e.cold = static_cast<int16_t>(atoi(row[39]));
|
||||||
e.magic = static_cast<int16_t>(atoi(row[40]));
|
e.magic = static_cast<int16_t>(atoi(row[40]));
|
||||||
e.poison = static_cast<int16_t>(atoi(row[41]));
|
e.poison = static_cast<int16_t>(atoi(row[41]));
|
||||||
e.disease = static_cast<int16_t>(atoi(row[42]));
|
e.disease = static_cast<int16_t>(atoi(row[42]));
|
||||||
e.corruption = static_cast<int16_t>(atoi(row[43]));
|
e.corruption = static_cast<int16_t>(atoi(row[43]));
|
||||||
e.show_helm = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
e.show_helm = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||||
e.follow_distance = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
e.follow_distance = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||||
e.stop_melee_level = static_cast<uint8_t>(strtoul(row[46], nullptr, 10));
|
e.stop_melee_level = static_cast<uint8_t>(strtoul(row[46], nullptr, 10));
|
||||||
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
||||||
|
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@ -430,6 +435,7 @@ public:
|
|||||||
v.push_back(columns[45] + " = " + std::to_string(e.follow_distance));
|
v.push_back(columns[45] + " = " + std::to_string(e.follow_distance));
|
||||||
v.push_back(columns[46] + " = " + std::to_string(e.stop_melee_level));
|
v.push_back(columns[46] + " = " + std::to_string(e.stop_melee_level));
|
||||||
v.push_back(columns[47] + " = " + std::to_string(e.expansion_bitmask));
|
v.push_back(columns[47] + " = " + std::to_string(e.expansion_bitmask));
|
||||||
|
v.push_back(columns[48] + " = " + std::to_string(e.enforce_spell_settings));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@ -499,6 +505,7 @@ public:
|
|||||||
v.push_back(std::to_string(e.follow_distance));
|
v.push_back(std::to_string(e.follow_distance));
|
||||||
v.push_back(std::to_string(e.stop_melee_level));
|
v.push_back(std::to_string(e.stop_melee_level));
|
||||||
v.push_back(std::to_string(e.expansion_bitmask));
|
v.push_back(std::to_string(e.expansion_bitmask));
|
||||||
|
v.push_back(std::to_string(e.enforce_spell_settings));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@ -576,6 +583,7 @@ public:
|
|||||||
v.push_back(std::to_string(e.follow_distance));
|
v.push_back(std::to_string(e.follow_distance));
|
||||||
v.push_back(std::to_string(e.stop_melee_level));
|
v.push_back(std::to_string(e.stop_melee_level));
|
||||||
v.push_back(std::to_string(e.expansion_bitmask));
|
v.push_back(std::to_string(e.expansion_bitmask));
|
||||||
|
v.push_back(std::to_string(e.enforce_spell_settings));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@ -609,54 +617,55 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
BotData e{};
|
BotData e{};
|
||||||
|
|
||||||
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||||
e.owner_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
e.owner_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||||
e.spells_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
e.spells_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||||
e.name = row[3] ? row[3] : "";
|
e.name = row[3] ? row[3] : "";
|
||||||
e.last_name = row[4] ? row[4] : "";
|
e.last_name = row[4] ? row[4] : "";
|
||||||
e.title = row[5] ? row[5] : "";
|
e.title = row[5] ? row[5] : "";
|
||||||
e.suffix = row[6] ? row[6] : "";
|
e.suffix = row[6] ? row[6] : "";
|
||||||
e.zone_id = static_cast<int16_t>(atoi(row[7]));
|
e.zone_id = static_cast<int16_t>(atoi(row[7]));
|
||||||
e.gender = static_cast<int8_t>(atoi(row[8]));
|
e.gender = static_cast<int8_t>(atoi(row[8]));
|
||||||
e.race = static_cast<int16_t>(atoi(row[9]));
|
e.race = static_cast<int16_t>(atoi(row[9]));
|
||||||
e.class_ = static_cast<int8_t>(atoi(row[10]));
|
e.class_ = static_cast<int8_t>(atoi(row[10]));
|
||||||
e.level = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
e.level = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
||||||
e.deity = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
e.deity = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||||
e.creation_day = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
e.creation_day = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||||
e.last_spawn = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
e.last_spawn = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||||
e.time_spawned = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
e.time_spawned = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||||
e.size = strtof(row[16], nullptr);
|
e.size = strtof(row[16], nullptr);
|
||||||
e.face = static_cast<int32_t>(atoi(row[17]));
|
e.face = static_cast<int32_t>(atoi(row[17]));
|
||||||
e.hair_color = static_cast<int32_t>(atoi(row[18]));
|
e.hair_color = static_cast<int32_t>(atoi(row[18]));
|
||||||
e.hair_style = static_cast<int32_t>(atoi(row[19]));
|
e.hair_style = static_cast<int32_t>(atoi(row[19]));
|
||||||
e.beard = static_cast<int32_t>(atoi(row[20]));
|
e.beard = static_cast<int32_t>(atoi(row[20]));
|
||||||
e.beard_color = static_cast<int32_t>(atoi(row[21]));
|
e.beard_color = static_cast<int32_t>(atoi(row[21]));
|
||||||
e.eye_color_1 = static_cast<int32_t>(atoi(row[22]));
|
e.eye_color_1 = static_cast<int32_t>(atoi(row[22]));
|
||||||
e.eye_color_2 = static_cast<int32_t>(atoi(row[23]));
|
e.eye_color_2 = static_cast<int32_t>(atoi(row[23]));
|
||||||
e.drakkin_heritage = static_cast<int32_t>(atoi(row[24]));
|
e.drakkin_heritage = static_cast<int32_t>(atoi(row[24]));
|
||||||
e.drakkin_tattoo = static_cast<int32_t>(atoi(row[25]));
|
e.drakkin_tattoo = static_cast<int32_t>(atoi(row[25]));
|
||||||
e.drakkin_details = static_cast<int32_t>(atoi(row[26]));
|
e.drakkin_details = static_cast<int32_t>(atoi(row[26]));
|
||||||
e.ac = static_cast<int16_t>(atoi(row[27]));
|
e.ac = static_cast<int16_t>(atoi(row[27]));
|
||||||
e.atk = static_cast<int32_t>(atoi(row[28]));
|
e.atk = static_cast<int32_t>(atoi(row[28]));
|
||||||
e.hp = static_cast<int32_t>(atoi(row[29]));
|
e.hp = static_cast<int32_t>(atoi(row[29]));
|
||||||
e.mana = static_cast<int32_t>(atoi(row[30]));
|
e.mana = static_cast<int32_t>(atoi(row[30]));
|
||||||
e.str = static_cast<int32_t>(atoi(row[31]));
|
e.str = static_cast<int32_t>(atoi(row[31]));
|
||||||
e.sta = static_cast<int32_t>(atoi(row[32]));
|
e.sta = static_cast<int32_t>(atoi(row[32]));
|
||||||
e.cha = static_cast<int32_t>(atoi(row[33]));
|
e.cha = static_cast<int32_t>(atoi(row[33]));
|
||||||
e.dex = static_cast<int32_t>(atoi(row[34]));
|
e.dex = static_cast<int32_t>(atoi(row[34]));
|
||||||
e.int_ = static_cast<int32_t>(atoi(row[35]));
|
e.int_ = static_cast<int32_t>(atoi(row[35]));
|
||||||
e.agi = static_cast<int32_t>(atoi(row[36]));
|
e.agi = static_cast<int32_t>(atoi(row[36]));
|
||||||
e.wis = static_cast<int32_t>(atoi(row[37]));
|
e.wis = static_cast<int32_t>(atoi(row[37]));
|
||||||
e.fire = static_cast<int16_t>(atoi(row[38]));
|
e.fire = static_cast<int16_t>(atoi(row[38]));
|
||||||
e.cold = static_cast<int16_t>(atoi(row[39]));
|
e.cold = static_cast<int16_t>(atoi(row[39]));
|
||||||
e.magic = static_cast<int16_t>(atoi(row[40]));
|
e.magic = static_cast<int16_t>(atoi(row[40]));
|
||||||
e.poison = static_cast<int16_t>(atoi(row[41]));
|
e.poison = static_cast<int16_t>(atoi(row[41]));
|
||||||
e.disease = static_cast<int16_t>(atoi(row[42]));
|
e.disease = static_cast<int16_t>(atoi(row[42]));
|
||||||
e.corruption = static_cast<int16_t>(atoi(row[43]));
|
e.corruption = static_cast<int16_t>(atoi(row[43]));
|
||||||
e.show_helm = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
e.show_helm = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||||
e.follow_distance = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
e.follow_distance = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||||
e.stop_melee_level = static_cast<uint8_t>(strtoul(row[46], nullptr, 10));
|
e.stop_melee_level = static_cast<uint8_t>(strtoul(row[46], nullptr, 10));
|
||||||
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
||||||
|
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@ -681,54 +690,55 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
BotData e{};
|
BotData e{};
|
||||||
|
|
||||||
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||||
e.owner_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
e.owner_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||||
e.spells_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
e.spells_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||||
e.name = row[3] ? row[3] : "";
|
e.name = row[3] ? row[3] : "";
|
||||||
e.last_name = row[4] ? row[4] : "";
|
e.last_name = row[4] ? row[4] : "";
|
||||||
e.title = row[5] ? row[5] : "";
|
e.title = row[5] ? row[5] : "";
|
||||||
e.suffix = row[6] ? row[6] : "";
|
e.suffix = row[6] ? row[6] : "";
|
||||||
e.zone_id = static_cast<int16_t>(atoi(row[7]));
|
e.zone_id = static_cast<int16_t>(atoi(row[7]));
|
||||||
e.gender = static_cast<int8_t>(atoi(row[8]));
|
e.gender = static_cast<int8_t>(atoi(row[8]));
|
||||||
e.race = static_cast<int16_t>(atoi(row[9]));
|
e.race = static_cast<int16_t>(atoi(row[9]));
|
||||||
e.class_ = static_cast<int8_t>(atoi(row[10]));
|
e.class_ = static_cast<int8_t>(atoi(row[10]));
|
||||||
e.level = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
e.level = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
||||||
e.deity = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
e.deity = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||||
e.creation_day = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
e.creation_day = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||||
e.last_spawn = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
e.last_spawn = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||||
e.time_spawned = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
e.time_spawned = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||||
e.size = strtof(row[16], nullptr);
|
e.size = strtof(row[16], nullptr);
|
||||||
e.face = static_cast<int32_t>(atoi(row[17]));
|
e.face = static_cast<int32_t>(atoi(row[17]));
|
||||||
e.hair_color = static_cast<int32_t>(atoi(row[18]));
|
e.hair_color = static_cast<int32_t>(atoi(row[18]));
|
||||||
e.hair_style = static_cast<int32_t>(atoi(row[19]));
|
e.hair_style = static_cast<int32_t>(atoi(row[19]));
|
||||||
e.beard = static_cast<int32_t>(atoi(row[20]));
|
e.beard = static_cast<int32_t>(atoi(row[20]));
|
||||||
e.beard_color = static_cast<int32_t>(atoi(row[21]));
|
e.beard_color = static_cast<int32_t>(atoi(row[21]));
|
||||||
e.eye_color_1 = static_cast<int32_t>(atoi(row[22]));
|
e.eye_color_1 = static_cast<int32_t>(atoi(row[22]));
|
||||||
e.eye_color_2 = static_cast<int32_t>(atoi(row[23]));
|
e.eye_color_2 = static_cast<int32_t>(atoi(row[23]));
|
||||||
e.drakkin_heritage = static_cast<int32_t>(atoi(row[24]));
|
e.drakkin_heritage = static_cast<int32_t>(atoi(row[24]));
|
||||||
e.drakkin_tattoo = static_cast<int32_t>(atoi(row[25]));
|
e.drakkin_tattoo = static_cast<int32_t>(atoi(row[25]));
|
||||||
e.drakkin_details = static_cast<int32_t>(atoi(row[26]));
|
e.drakkin_details = static_cast<int32_t>(atoi(row[26]));
|
||||||
e.ac = static_cast<int16_t>(atoi(row[27]));
|
e.ac = static_cast<int16_t>(atoi(row[27]));
|
||||||
e.atk = static_cast<int32_t>(atoi(row[28]));
|
e.atk = static_cast<int32_t>(atoi(row[28]));
|
||||||
e.hp = static_cast<int32_t>(atoi(row[29]));
|
e.hp = static_cast<int32_t>(atoi(row[29]));
|
||||||
e.mana = static_cast<int32_t>(atoi(row[30]));
|
e.mana = static_cast<int32_t>(atoi(row[30]));
|
||||||
e.str = static_cast<int32_t>(atoi(row[31]));
|
e.str = static_cast<int32_t>(atoi(row[31]));
|
||||||
e.sta = static_cast<int32_t>(atoi(row[32]));
|
e.sta = static_cast<int32_t>(atoi(row[32]));
|
||||||
e.cha = static_cast<int32_t>(atoi(row[33]));
|
e.cha = static_cast<int32_t>(atoi(row[33]));
|
||||||
e.dex = static_cast<int32_t>(atoi(row[34]));
|
e.dex = static_cast<int32_t>(atoi(row[34]));
|
||||||
e.int_ = static_cast<int32_t>(atoi(row[35]));
|
e.int_ = static_cast<int32_t>(atoi(row[35]));
|
||||||
e.agi = static_cast<int32_t>(atoi(row[36]));
|
e.agi = static_cast<int32_t>(atoi(row[36]));
|
||||||
e.wis = static_cast<int32_t>(atoi(row[37]));
|
e.wis = static_cast<int32_t>(atoi(row[37]));
|
||||||
e.fire = static_cast<int16_t>(atoi(row[38]));
|
e.fire = static_cast<int16_t>(atoi(row[38]));
|
||||||
e.cold = static_cast<int16_t>(atoi(row[39]));
|
e.cold = static_cast<int16_t>(atoi(row[39]));
|
||||||
e.magic = static_cast<int16_t>(atoi(row[40]));
|
e.magic = static_cast<int16_t>(atoi(row[40]));
|
||||||
e.poison = static_cast<int16_t>(atoi(row[41]));
|
e.poison = static_cast<int16_t>(atoi(row[41]));
|
||||||
e.disease = static_cast<int16_t>(atoi(row[42]));
|
e.disease = static_cast<int16_t>(atoi(row[42]));
|
||||||
e.corruption = static_cast<int16_t>(atoi(row[43]));
|
e.corruption = static_cast<int16_t>(atoi(row[43]));
|
||||||
e.show_helm = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
e.show_helm = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||||
e.follow_distance = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
e.follow_distance = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||||
e.stop_melee_level = static_cast<uint8_t>(strtoul(row[46], nullptr, 10));
|
e.stop_melee_level = static_cast<uint8_t>(strtoul(row[46], nullptr, 10));
|
||||||
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
e.expansion_bitmask = static_cast<int32_t>(atoi(row[47]));
|
||||||
|
e.enforce_spell_settings = static_cast<uint8_t>(strtoul(row[48], nullptr, 10));
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,8 +23,6 @@ public:
|
|||||||
int32_t bot_id;
|
int32_t bot_id;
|
||||||
int16_t spell_id;
|
int16_t spell_id;
|
||||||
int16_t priority;
|
int16_t priority;
|
||||||
uint16_t min_level;
|
|
||||||
uint16_t max_level;
|
|
||||||
int16_t min_hp;
|
int16_t min_hp;
|
||||||
int16_t max_hp;
|
int16_t max_hp;
|
||||||
uint8_t is_enabled;
|
uint8_t is_enabled;
|
||||||
@ -42,8 +40,6 @@ public:
|
|||||||
"bot_id",
|
"bot_id",
|
||||||
"spell_id",
|
"spell_id",
|
||||||
"priority",
|
"priority",
|
||||||
"min_level",
|
|
||||||
"max_level",
|
|
||||||
"min_hp",
|
"min_hp",
|
||||||
"max_hp",
|
"max_hp",
|
||||||
"is_enabled",
|
"is_enabled",
|
||||||
@ -57,8 +53,6 @@ public:
|
|||||||
"bot_id",
|
"bot_id",
|
||||||
"spell_id",
|
"spell_id",
|
||||||
"priority",
|
"priority",
|
||||||
"min_level",
|
|
||||||
"max_level",
|
|
||||||
"min_hp",
|
"min_hp",
|
||||||
"max_hp",
|
"max_hp",
|
||||||
"is_enabled",
|
"is_enabled",
|
||||||
@ -106,8 +100,6 @@ public:
|
|||||||
e.bot_id = 0;
|
e.bot_id = 0;
|
||||||
e.spell_id = 0;
|
e.spell_id = 0;
|
||||||
e.priority = 0;
|
e.priority = 0;
|
||||||
e.min_level = 0;
|
|
||||||
e.max_level = 255;
|
|
||||||
e.min_hp = 0;
|
e.min_hp = 0;
|
||||||
e.max_hp = 0;
|
e.max_hp = 0;
|
||||||
e.is_enabled = 1;
|
e.is_enabled = 1;
|
||||||
@ -150,11 +142,9 @@ public:
|
|||||||
e.bot_id = static_cast<int32_t>(atoi(row[1]));
|
e.bot_id = static_cast<int32_t>(atoi(row[1]));
|
||||||
e.spell_id = static_cast<int16_t>(atoi(row[2]));
|
e.spell_id = static_cast<int16_t>(atoi(row[2]));
|
||||||
e.priority = static_cast<int16_t>(atoi(row[3]));
|
e.priority = static_cast<int16_t>(atoi(row[3]));
|
||||||
e.min_level = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
e.min_hp = static_cast<int16_t>(atoi(row[4]));
|
||||||
e.max_level = static_cast<uint16_t>(strtoul(row[5], nullptr, 10));
|
e.max_hp = static_cast<int16_t>(atoi(row[5]));
|
||||||
e.min_hp = static_cast<int16_t>(atoi(row[6]));
|
e.is_enabled = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||||
e.max_hp = static_cast<int16_t>(atoi(row[7]));
|
|
||||||
e.is_enabled = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@ -188,15 +178,12 @@ public:
|
|||||||
|
|
||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
v.push_back(columns[0] + " = " + std::to_string(e.id));
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.bot_id));
|
v.push_back(columns[1] + " = " + std::to_string(e.bot_id));
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.spell_id));
|
v.push_back(columns[2] + " = " + std::to_string(e.spell_id));
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.priority));
|
v.push_back(columns[3] + " = " + std::to_string(e.priority));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.min_level));
|
v.push_back(columns[4] + " = " + std::to_string(e.min_hp));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.max_level));
|
v.push_back(columns[5] + " = " + std::to_string(e.max_hp));
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.min_hp));
|
v.push_back(columns[6] + " = " + std::to_string(e.is_enabled));
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.max_hp));
|
|
||||||
v.push_back(columns[8] + " = " + std::to_string(e.is_enabled));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@ -222,8 +209,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
v.push_back(std::to_string(e.spell_id));
|
v.push_back(std::to_string(e.spell_id));
|
||||||
v.push_back(std::to_string(e.priority));
|
v.push_back(std::to_string(e.priority));
|
||||||
v.push_back(std::to_string(e.min_level));
|
|
||||||
v.push_back(std::to_string(e.max_level));
|
|
||||||
v.push_back(std::to_string(e.min_hp));
|
v.push_back(std::to_string(e.min_hp));
|
||||||
v.push_back(std::to_string(e.max_hp));
|
v.push_back(std::to_string(e.max_hp));
|
||||||
v.push_back(std::to_string(e.is_enabled));
|
v.push_back(std::to_string(e.is_enabled));
|
||||||
@ -260,8 +245,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
v.push_back(std::to_string(e.spell_id));
|
v.push_back(std::to_string(e.spell_id));
|
||||||
v.push_back(std::to_string(e.priority));
|
v.push_back(std::to_string(e.priority));
|
||||||
v.push_back(std::to_string(e.min_level));
|
|
||||||
v.push_back(std::to_string(e.max_level));
|
|
||||||
v.push_back(std::to_string(e.min_hp));
|
v.push_back(std::to_string(e.min_hp));
|
||||||
v.push_back(std::to_string(e.max_hp));
|
v.push_back(std::to_string(e.max_hp));
|
||||||
v.push_back(std::to_string(e.is_enabled));
|
v.push_back(std::to_string(e.is_enabled));
|
||||||
@ -302,11 +285,9 @@ public:
|
|||||||
e.bot_id = static_cast<int32_t>(atoi(row[1]));
|
e.bot_id = static_cast<int32_t>(atoi(row[1]));
|
||||||
e.spell_id = static_cast<int16_t>(atoi(row[2]));
|
e.spell_id = static_cast<int16_t>(atoi(row[2]));
|
||||||
e.priority = static_cast<int16_t>(atoi(row[3]));
|
e.priority = static_cast<int16_t>(atoi(row[3]));
|
||||||
e.min_level = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
e.min_hp = static_cast<int16_t>(atoi(row[4]));
|
||||||
e.max_level = static_cast<uint16_t>(strtoul(row[5], nullptr, 10));
|
e.max_hp = static_cast<int16_t>(atoi(row[5]));
|
||||||
e.min_hp = static_cast<int16_t>(atoi(row[6]));
|
e.is_enabled = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||||
e.max_hp = static_cast<int16_t>(atoi(row[7]));
|
|
||||||
e.is_enabled = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@ -335,11 +316,9 @@ public:
|
|||||||
e.bot_id = static_cast<int32_t>(atoi(row[1]));
|
e.bot_id = static_cast<int32_t>(atoi(row[1]));
|
||||||
e.spell_id = static_cast<int16_t>(atoi(row[2]));
|
e.spell_id = static_cast<int16_t>(atoi(row[2]));
|
||||||
e.priority = static_cast<int16_t>(atoi(row[3]));
|
e.priority = static_cast<int16_t>(atoi(row[3]));
|
||||||
e.min_level = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
e.min_hp = static_cast<int16_t>(atoi(row[4]));
|
||||||
e.max_level = static_cast<uint16_t>(strtoul(row[5], nullptr, 10));
|
e.max_hp = static_cast<int16_t>(atoi(row[5]));
|
||||||
e.min_hp = static_cast<int16_t>(atoi(row[6]));
|
e.is_enabled = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||||
e.max_hp = static_cast<int16_t>(atoi(row[7]));
|
|
||||||
e.is_enabled = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,11 +54,9 @@ public:
|
|||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.priority));
|
v.push_back(columns[3] + " = " + std::to_string(e.priority));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.min_level));
|
v.push_back(columns[4] + " = " + std::to_string(e.min_hp));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.max_level));
|
v.push_back(columns[5] + " = " + std::to_string(e.max_hp));
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.min_hp));
|
v.push_back(columns[6] + " = " + std::to_string(e.is_enabled));
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.max_hp));
|
|
||||||
v.push_back(columns[8] + " = " + std::to_string(e.is_enabled));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE `bot_data`
|
||||||
|
ADD COLUMN `enforce_spell_settings` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0' AFTER `expansion_bitmask`;
|
||||||
|
|
||||||
|
ALTER TABLE `bot_spell_settings` DROP `min_level`;
|
||||||
|
ALTER TABLE `bot_spell_settings` DROP `max_level`;
|
||||||
121
zone/bot.cpp
121
zone/bot.cpp
@ -406,11 +406,6 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
|||||||
bot_owner->Message(Chat::White, "&s for '%s'", BotDatabase::fail::LoadBuffs(), GetCleanName());
|
bot_owner->Message(Chat::White, "&s for '%s'", BotDatabase::fail::LoadBuffs(), GetCleanName());
|
||||||
}
|
}
|
||||||
|
|
||||||
GetBotOwnerDataBuckets();
|
|
||||||
GetBotDataBuckets();
|
|
||||||
LoadBotSpellSettings();
|
|
||||||
AI_AddBotSpells(GetBotSpellID());
|
|
||||||
|
|
||||||
CalcBotStats(false);
|
CalcBotStats(false);
|
||||||
hp_regen = CalcHPRegen();
|
hp_regen = CalcHPRegen();
|
||||||
mana_regen = CalcManaRegen();
|
mana_regen = CalcManaRegen();
|
||||||
@ -10606,6 +10601,27 @@ void Bot::SetExpansionBitmask(int expansion_bitmask, bool save)
|
|||||||
LoadAAs();
|
LoadAAs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Bot::SetBotEnforceSpellSetting(bool enforce_spell_settings, bool save)
|
||||||
|
{
|
||||||
|
m_enforce_spell_settings = enforce_spell_settings;
|
||||||
|
|
||||||
|
if (save) {
|
||||||
|
if (!database.botdb.SaveEnforceSpellSetting(GetBotID(), enforce_spell_settings)) {
|
||||||
|
if (GetBotOwner() && GetBotOwner()->IsClient()) {
|
||||||
|
GetBotOwner()->CastToClient()->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Failed to save enforce spell settings for {}.",
|
||||||
|
GetCleanName()
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LoadBotSpellSettings();
|
||||||
|
AI_AddBotSpells(GetBotSpellID());
|
||||||
|
}
|
||||||
|
|
||||||
bool Bot::AddBotSpellSetting(uint16 spell_id, BotSpellSetting* bs)
|
bool Bot::AddBotSpellSetting(uint16 spell_id, BotSpellSetting* bs)
|
||||||
{
|
{
|
||||||
if (!IsValidSpell(spell_id) || !bs) {
|
if (!IsValidSpell(spell_id) || !bs) {
|
||||||
@ -10623,8 +10639,6 @@ bool Bot::AddBotSpellSetting(uint16 spell_id, BotSpellSetting* bs)
|
|||||||
s.bot_id = GetBotID();
|
s.bot_id = GetBotID();
|
||||||
|
|
||||||
s.priority = bs->priority;
|
s.priority = bs->priority;
|
||||||
s.min_level = bs->min_level;
|
|
||||||
s.max_level = bs->max_level;
|
|
||||||
s.min_hp = bs->min_hp;
|
s.min_hp = bs->min_hp;
|
||||||
s.max_hp = bs->max_hp;
|
s.max_hp = bs->max_hp;
|
||||||
s.is_enabled = bs->is_enabled;
|
s.is_enabled = bs->is_enabled;
|
||||||
@ -10675,7 +10689,7 @@ BotSpellSetting* Bot::GetBotSpellSetting(uint16 spell_id)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::ListBotSpells()
|
void Bot::ListBotSpells(uint8 min_level)
|
||||||
{
|
{
|
||||||
auto bot_owner = GetBotOwner();
|
auto bot_owner = GetBotOwner();
|
||||||
if (!bot_owner) {
|
if (!bot_owner) {
|
||||||
@ -10697,28 +10711,25 @@ void Bot::ListBotSpells()
|
|||||||
auto spell_number = 1;
|
auto spell_number = 1;
|
||||||
|
|
||||||
for (const auto& s : AIBot_spells) {
|
for (const auto& s : AIBot_spells) {
|
||||||
bot_owner->Message(
|
auto b = bot_spell_settings.find(s.spellid);
|
||||||
Chat::White,
|
if (b == bot_spell_settings.end() && s.minlevel >= min_level) {
|
||||||
fmt::format(
|
bot_owner->Message(
|
||||||
"Spell {} | Spell: {} ({})",
|
Chat::White,
|
||||||
spell_number,
|
fmt::format(
|
||||||
spells[s.spellid].name,
|
"Spell {} | Spell: {} | Add Spell: {}",
|
||||||
s.spellid
|
spell_number,
|
||||||
).c_str()
|
Saylink::Silent(
|
||||||
);
|
fmt::format("^spellinfo {}", s.spellid),
|
||||||
|
spells[s.spellid].name
|
||||||
|
),
|
||||||
|
Saylink::Silent(
|
||||||
|
fmt::format("^spellsettingsadd {} {} {} {}", s.spellid, s.priority, s.min_hp, s.max_hp), "Add")
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
bot_owner->Message(
|
spell_count++;
|
||||||
Chat::White,
|
spell_number++;
|
||||||
fmt::format(
|
}
|
||||||
"Spell {} | Priority: {} Health: {}",
|
|
||||||
spell_number,
|
|
||||||
s.priority,
|
|
||||||
GetHPString(s.min_hp, s.max_hp)
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
spell_count++;
|
|
||||||
spell_number++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bot_owner->Message(
|
bot_owner->Message(
|
||||||
@ -10757,22 +10768,15 @@ void Bot::ListBotSpellSettings()
|
|||||||
bot_owner->Message(
|
bot_owner->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Setting {} | Spell: {} ({}) Enabled: {}",
|
"Setting {} | Spell: {} | State: {} | {}",
|
||||||
setting_number,
|
setting_number,
|
||||||
spells[bs.first].name,
|
Saylink::Silent(fmt::format("^spellinfo {}", bs.first), spells[bs.first].name),
|
||||||
bs.first,
|
Saylink::Silent(
|
||||||
bs.second.is_enabled ? "Yes" : "No"
|
fmt::format("^spellsettingstoggle {} {}",
|
||||||
).c_str()
|
bs.first, bs.second.is_enabled ? "False" : "True"),
|
||||||
);
|
bs.second.is_enabled ? "Enabled" : "Disabled"
|
||||||
|
),
|
||||||
bot_owner->Message(
|
Saylink::Silent(fmt::format("^spellsettingsdelete {}", bs.first), "Remove")
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"Setting {} | Priority: {} Levels: {} Health: {}",
|
|
||||||
setting_number,
|
|
||||||
bs.second.priority,
|
|
||||||
GetLevelString(bs.second.min_level, bs.second.max_level),
|
|
||||||
GetHPString(bs.second.min_hp, bs.second.max_hp)
|
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -10804,12 +10808,9 @@ void Bot::LoadBotSpellSettings()
|
|||||||
BotSpellSetting b;
|
BotSpellSetting b;
|
||||||
|
|
||||||
b.priority = e.priority;
|
b.priority = e.priority;
|
||||||
b.min_level = e.min_level;
|
|
||||||
b.max_level = e.max_level;
|
|
||||||
b.min_hp = e.min_hp;
|
b.min_hp = e.min_hp;
|
||||||
b.max_hp = e.max_hp;
|
b.max_hp = e.max_hp;
|
||||||
b.is_enabled = e.is_enabled;
|
b.is_enabled = e.is_enabled;
|
||||||
|
|
||||||
bot_spell_settings[e.spell_id] = b;
|
bot_spell_settings[e.spell_id] = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10825,8 +10826,6 @@ bool Bot::UpdateBotSpellSetting(uint16 spell_id, BotSpellSetting* bs)
|
|||||||
s.spell_id = spell_id;
|
s.spell_id = spell_id;
|
||||||
s.bot_id = GetBotID();
|
s.bot_id = GetBotID();
|
||||||
s.priority = bs->priority;
|
s.priority = bs->priority;
|
||||||
s.min_level = bs->min_level;
|
|
||||||
s.max_level = bs->max_level;
|
|
||||||
s.min_hp = bs->min_hp;
|
s.min_hp = bs->min_hp;
|
||||||
s.max_hp = bs->max_hp;
|
s.max_hp = bs->max_hp;
|
||||||
s.is_enabled = bs->is_enabled;
|
s.is_enabled = bs->is_enabled;
|
||||||
@ -10844,30 +10843,6 @@ bool Bot::UpdateBotSpellSetting(uint16 spell_id, BotSpellSetting* bs)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Bot::GetLevelString(uint8 min_level, uint8 max_level)
|
|
||||||
{
|
|
||||||
std::string level_string = "Any";
|
|
||||||
if (min_level && max_level) {
|
|
||||||
level_string = fmt::format(
|
|
||||||
"{} to {}",
|
|
||||||
min_level,
|
|
||||||
max_level
|
|
||||||
);
|
|
||||||
} else if (min_level && !max_level) {
|
|
||||||
level_string = fmt::format(
|
|
||||||
"{}+",
|
|
||||||
min_level
|
|
||||||
);
|
|
||||||
} else if (!min_level && max_level) {
|
|
||||||
level_string = fmt::format(
|
|
||||||
"1 to {}",
|
|
||||||
max_level
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return level_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Bot::GetHPString(int8 min_hp, int8 max_hp)
|
std::string Bot::GetHPString(int8 min_hp, int8 max_hp)
|
||||||
{
|
{
|
||||||
std::string hp_string = "Any";
|
std::string hp_string = "Any";
|
||||||
|
|||||||
@ -315,6 +315,8 @@ public:
|
|||||||
int16 iManaCost,
|
int16 iManaCost,
|
||||||
int32 iRecastDelay,
|
int32 iRecastDelay,
|
||||||
int16 iResistAdjust,
|
int16 iResistAdjust,
|
||||||
|
uint8 min_level,
|
||||||
|
uint8 max_level,
|
||||||
int8 min_hp,
|
int8 min_hp,
|
||||||
int8 max_hp,
|
int8 max_hp,
|
||||||
std::string bucket_name,
|
std::string bucket_name,
|
||||||
@ -456,6 +458,7 @@ public:
|
|||||||
BotRoleType GetBotRole() { return _botRole; }
|
BotRoleType GetBotRole() { return _botRole; }
|
||||||
EQ::constants::StanceType GetBotStance() { return _botStance; }
|
EQ::constants::StanceType GetBotStance() { return _botStance; }
|
||||||
uint8 GetChanceToCastBySpellType(uint32 spellType);
|
uint8 GetChanceToCastBySpellType(uint32 spellType);
|
||||||
|
bool GetBotEnforceSpellSetting() { return m_enforce_spell_settings; }
|
||||||
|
|
||||||
bool IsGroupHealer() { return m_CastingRoles.GroupHealer; }
|
bool IsGroupHealer() { return m_CastingRoles.GroupHealer; }
|
||||||
bool IsGroupSlower() { return m_CastingRoles.GroupSlower; }
|
bool IsGroupSlower() { return m_CastingRoles.GroupSlower; }
|
||||||
@ -476,6 +479,7 @@ public:
|
|||||||
bool IsBotSpellFighter() { return IsSpellFighterClass(GetClass()); }
|
bool IsBotSpellFighter() { return IsSpellFighterClass(GetClass()); }
|
||||||
bool IsBotFighter() { return IsFighterClass(GetClass()); }
|
bool IsBotFighter() { return IsFighterClass(GetClass()); }
|
||||||
bool IsBotNonSpellFighter() { return IsNonSpellFighterClass(GetClass()); }
|
bool IsBotNonSpellFighter() { return IsNonSpellFighterClass(GetClass()); }
|
||||||
|
uint8 GetBotClass() { return GetClass(); }
|
||||||
bool CanHeal();
|
bool CanHeal();
|
||||||
int GetRawACNoShield(int &shield_ac);
|
int GetRawACNoShield(int &shield_ac);
|
||||||
|
|
||||||
@ -597,9 +601,8 @@ public:
|
|||||||
int GetExpansionBitmask();
|
int GetExpansionBitmask();
|
||||||
void SetExpansionBitmask(int expansion_bitmask, bool save = true);
|
void SetExpansionBitmask(int expansion_bitmask, bool save = true);
|
||||||
|
|
||||||
void ListBotSpells();
|
void ListBotSpells(uint8 min_level);
|
||||||
|
|
||||||
std::string GetLevelString(uint8 min_level, uint8 max_level);
|
|
||||||
std::string GetHPString(int8 min_hp, int8 max_hp);
|
std::string GetHPString(int8 min_hp, int8 max_hp);
|
||||||
|
|
||||||
bool AddBotSpellSetting(uint16 spell_id, BotSpellSetting* bs);
|
bool AddBotSpellSetting(uint16 spell_id, BotSpellSetting* bs);
|
||||||
@ -608,6 +611,7 @@ public:
|
|||||||
void ListBotSpellSettings();
|
void ListBotSpellSettings();
|
||||||
void LoadBotSpellSettings();
|
void LoadBotSpellSettings();
|
||||||
bool UpdateBotSpellSetting(uint16 spell_id, BotSpellSetting* bs);
|
bool UpdateBotSpellSetting(uint16 spell_id, BotSpellSetting* bs);
|
||||||
|
void SetBotEnforceSpellSetting(bool enforcespellsettings, bool save = false);
|
||||||
|
|
||||||
static void SpawnBotGroupByName(Client* c, std::string botgroup_name, uint32 leader_id);
|
static void SpawnBotGroupByName(Client* c, std::string botgroup_name, uint32 leader_id);
|
||||||
|
|
||||||
@ -789,6 +793,7 @@ private:
|
|||||||
bool _pauseAI;
|
bool _pauseAI;
|
||||||
uint8 _stopMeleeLevel;
|
uint8 _stopMeleeLevel;
|
||||||
int m_expansion_bitmask;
|
int m_expansion_bitmask;
|
||||||
|
bool m_enforce_spell_settings;
|
||||||
|
|
||||||
// Private "base stats" Members
|
// Private "base stats" Members
|
||||||
int32 _baseMR;
|
int32 _baseMR;
|
||||||
|
|||||||
@ -73,6 +73,7 @@
|
|||||||
#include "titles.h"
|
#include "titles.h"
|
||||||
#include "water_map.h"
|
#include "water_map.h"
|
||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
|
#include "dialogue_window.h"
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
@ -1362,6 +1363,7 @@ int bot_command_init(void)
|
|||||||
bot_command_add("cure", "Orders a bot to remove any ailments", AccountStatus::Player, bot_command_cure) ||
|
bot_command_add("cure", "Orders a bot to remove any ailments", AccountStatus::Player, bot_command_cure) ||
|
||||||
bot_command_add("defensive", "Orders a bot to use a defensive discipline", AccountStatus::Player, bot_command_defensive) ||
|
bot_command_add("defensive", "Orders a bot to use a defensive discipline", AccountStatus::Player, bot_command_defensive) ||
|
||||||
bot_command_add("depart", "Orders a bot to open a magical doorway to a specified destination", AccountStatus::Player, bot_command_depart) ||
|
bot_command_add("depart", "Orders a bot to open a magical doorway to a specified destination", AccountStatus::Player, bot_command_depart) ||
|
||||||
|
bot_command_add("enforcespelllist", "Toggles your Bot to cast only spells in their spell settings list.", AccountStatus::Player, bot_command_enforce_spell_list) ||
|
||||||
bot_command_add("escape", "Orders a bot to send a target group to a safe location within the zone", AccountStatus::Player, bot_command_escape) ||
|
bot_command_add("escape", "Orders a bot to send a target group to a safe location within the zone", AccountStatus::Player, bot_command_escape) ||
|
||||||
bot_command_add("findaliases", "Find available aliases for a bot command", AccountStatus::Player, bot_command_find_aliases) ||
|
bot_command_add("findaliases", "Find available aliases for a bot command", AccountStatus::Player, bot_command_find_aliases) ||
|
||||||
bot_command_add("follow", "Orders bots to follow a designated target (option 'chain' auto-links eligible spawned bots)", AccountStatus::Player, bot_command_follow) ||
|
bot_command_add("follow", "Orders bots to follow a designated target (option 'chain' auto-links eligible spawned bots)", AccountStatus::Player, bot_command_follow) ||
|
||||||
@ -1416,12 +1418,13 @@ int bot_command_init(void)
|
|||||||
bot_command_add("rune", "Orders a bot to cast a rune of protection", AccountStatus::Player, bot_command_rune) ||
|
bot_command_add("rune", "Orders a bot to cast a rune of protection", AccountStatus::Player, bot_command_rune) ||
|
||||||
bot_command_add("sendhome", "Orders a bot to open a magical doorway home", AccountStatus::Player, bot_command_send_home) ||
|
bot_command_add("sendhome", "Orders a bot to open a magical doorway home", AccountStatus::Player, bot_command_send_home) ||
|
||||||
bot_command_add("size", "Orders a bot to change a player's size", AccountStatus::Player, bot_command_size) ||
|
bot_command_add("size", "Orders a bot to change a player's size", AccountStatus::Player, bot_command_size) ||
|
||||||
bot_command_add("spelllist", "Lists a Caster of Hybrid bot's spells", AccountStatus::Player, bot_command_spell_list) ||
|
bot_command_add("spellinfo", "Opens a dialogue window with spell info", AccountStatus::Player, bot_spell_info_dialogue_window) ||
|
||||||
bot_command_add("spellsettingsadd", "Add a bot spell setting for a Caster or Hybrid bot", AccountStatus::Player, bot_command_spell_settings_add) ||
|
bot_command_add("spelllist", "Lists all Spells learned by the Bot.", AccountStatus::Player, bot_command_spell_list) ||
|
||||||
bot_command_add("spellsettingsdelete", "Delete a bot spell setting from a Caster or Hybrid bot", AccountStatus::Player, bot_command_spell_settings_delete) ||
|
bot_command_add("spellsettingsadd", "Add a bot spell setting entry", AccountStatus::Player, bot_command_spell_settings_add) ||
|
||||||
bot_command_add("spellsettingslist", "Lists a Caster or Hybrid bot's spell settings", AccountStatus::Player, bot_command_spell_settings_list) ||
|
bot_command_add("spellsettingsdelete", "Delete a bot spell setting entry", AccountStatus::Player, bot_command_spell_settings_delete) ||
|
||||||
bot_command_add("spellsettingstoggle", "Toggle a bot spell for a Caster or Hybrid bot", AccountStatus::Player, bot_command_spell_settings_toggle) ||
|
bot_command_add("spellsettingslist", "Lists a bot's spell setting entries", AccountStatus::Player, bot_command_spell_settings_list) ||
|
||||||
bot_command_add("spellsettingsupdate", "Update a bot spell setting for a Caster or Hybrid bot", AccountStatus::Player, bot_command_spell_settings_update) ||
|
bot_command_add("spellsettingstoggle", "Toggle a bot spells use", AccountStatus::Player, bot_command_spell_settings_toggle) ||
|
||||||
|
bot_command_add("spellsettingsupdate", "Update a bot spell setting entry", AccountStatus::Player, bot_command_spell_settings_update) ||
|
||||||
bot_command_add("summoncorpse", "Orders a bot to summon a corpse to its feet", AccountStatus::Player, bot_command_summon_corpse) ||
|
bot_command_add("summoncorpse", "Orders a bot to summon a corpse to its feet", AccountStatus::Player, bot_command_summon_corpse) ||
|
||||||
bot_command_add("suspend", "Suspends a bot's AI processing until released", AccountStatus::Player, bot_command_suspend) ||
|
bot_command_add("suspend", "Suspends a bot's AI processing until released", AccountStatus::Player, bot_command_suspend) ||
|
||||||
bot_command_add("taunt", "Toggles taunt use by a bot", AccountStatus::Player, bot_command_taunt) ||
|
bot_command_add("taunt", "Toggles taunt use by a bot", AccountStatus::Player, bot_command_taunt) ||
|
||||||
@ -6683,6 +6686,20 @@ void bot_subcommand_bot_spawn(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my_bot->GetBotOwnerDataBuckets();
|
||||||
|
my_bot->GetBotDataBuckets();
|
||||||
|
my_bot->LoadBotSpellSettings();
|
||||||
|
if (!my_bot->AI_AddBotSpells(my_bot->GetBotSpellID())) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Failed to load spells for '{}' (ID {}).",
|
||||||
|
bot_name,
|
||||||
|
bot_id
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static std::string bot_spawn_message[17] = {
|
static std::string bot_spawn_message[17] = {
|
||||||
"I am ready to fight!", // DEFAULT
|
"I am ready to fight!", // DEFAULT
|
||||||
"A solid weapon is my ally!", // WARRIOR
|
"A solid weapon is my ally!", // WARRIOR
|
||||||
@ -10242,7 +10259,7 @@ void bot_command_spell_list(Client* c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Usage: {} [Spell ID] [Priority] [Min Level] [Max Level] [Min HP] [Max HP]",
|
"Usage: {} [Min Level] (Level is optional)",
|
||||||
sep->arg[0]
|
sep->arg[0]
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@ -10255,7 +10272,13 @@ void bot_command_spell_list(Client* c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_bot->ListBotSpells();
|
uint8 min_level = 0;
|
||||||
|
|
||||||
|
if (sep->IsNumber(1)) {
|
||||||
|
min_level = static_cast<uint8>(std::stoul(sep->arg[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
my_bot->ListBotSpells(min_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bot_command_spell_settings_add(Client *c, const Seperator *sep)
|
void bot_command_spell_settings_add(Client *c, const Seperator *sep)
|
||||||
@ -10268,7 +10291,7 @@ void bot_command_spell_settings_add(Client *c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Usage: {} [Spell ID] [Priority] [Min Level] [Max Level] [Min HP] [Max HP]",
|
"Usage: {} [Spell ID] [Priority] [Min HP] [Max HP]",
|
||||||
sep->arg[0]
|
sep->arg[0]
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@ -10283,18 +10306,16 @@ void bot_command_spell_settings_add(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
auto arguments = sep->argnum;
|
auto arguments = sep->argnum;
|
||||||
if (
|
if (
|
||||||
arguments < 6 ||
|
arguments < 4 ||
|
||||||
!sep->IsNumber(1) ||
|
!sep->IsNumber(1) ||
|
||||||
!sep->IsNumber(2) ||
|
!sep->IsNumber(2) ||
|
||||||
!sep->IsNumber(3) ||
|
!sep->IsNumber(3) ||
|
||||||
!sep->IsNumber(4) ||
|
!sep->IsNumber(4)
|
||||||
!sep->IsNumber(5) ||
|
|
||||||
!sep->IsNumber(6)
|
|
||||||
) {
|
) {
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Usage: {} [Spell ID] [Priority] [Min Level] [Max Level] [Min HP] [Max HP]",
|
"Usage: {} [Spell ID] [Priority] [Min HP] [Max HP]",
|
||||||
sep->arg[0]
|
sep->arg[0]
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@ -10329,16 +10350,12 @@ void bot_command_spell_settings_add(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto priority = static_cast<int16>(std::stoi(sep->arg[2]));
|
auto priority = static_cast<int16>(std::stoi(sep->arg[2]));
|
||||||
auto min_level = static_cast<uint8>(std::stoul(sep->arg[3]));
|
auto min_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[3]), -1, 99));
|
||||||
auto max_level = static_cast<uint8>(std::stoul(sep->arg[4]));
|
auto max_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[4]), -1, 100));
|
||||||
auto min_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[5]), -1, 99));
|
|
||||||
auto max_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[6]), -1, 100));
|
|
||||||
|
|
||||||
BotSpellSetting bs;
|
BotSpellSetting bs;
|
||||||
|
|
||||||
bs.priority = priority;
|
bs.priority = priority;
|
||||||
bs.min_level = min_level;
|
|
||||||
bs.max_level = max_level;
|
|
||||||
bs.min_hp = min_hp;
|
bs.min_hp = min_hp;
|
||||||
bs.max_hp = max_hp;
|
bs.max_hp = max_hp;
|
||||||
|
|
||||||
@ -10375,9 +10392,8 @@ void bot_command_spell_settings_add(Client *c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Spell Setting Added | Priority: {} Levels: {} Health: {}",
|
"Spell Setting Added | Priority: {} Health: {}",
|
||||||
priority,
|
priority,
|
||||||
my_bot->GetLevelString(min_level, max_level),
|
|
||||||
my_bot->GetHPString(min_hp, max_hp)
|
my_bot->GetHPString(min_hp, max_hp)
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@ -10555,8 +10571,6 @@ void bot_command_spell_settings_toggle(Client *c, const Seperator *sep)
|
|||||||
BotSpellSetting bs;
|
BotSpellSetting bs;
|
||||||
|
|
||||||
bs.priority = obs->priority;
|
bs.priority = obs->priority;
|
||||||
bs.min_level = obs->min_level;
|
|
||||||
bs.max_level = obs->max_level;
|
|
||||||
bs.min_hp = obs->min_hp;
|
bs.min_hp = obs->min_hp;
|
||||||
bs.max_hp = obs->max_hp;
|
bs.max_hp = obs->max_hp;
|
||||||
bs.is_enabled = toggle;
|
bs.is_enabled = toggle;
|
||||||
@ -10605,7 +10619,7 @@ void bot_command_spell_settings_update(Client *c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Usage: {} [Spell ID] [Priority] [Min Level] [Max Level] [Min HP] [Max HP]",
|
"Usage: {} [Spell ID] [Priority] [Min HP] [Max HP]",
|
||||||
sep->arg[0]
|
sep->arg[0]
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@ -10620,18 +10634,16 @@ void bot_command_spell_settings_update(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
auto arguments = sep->argnum;
|
auto arguments = sep->argnum;
|
||||||
if (
|
if (
|
||||||
arguments < 6 ||
|
arguments < 4 ||
|
||||||
!sep->IsNumber(1) ||
|
!sep->IsNumber(1) ||
|
||||||
!sep->IsNumber(2) ||
|
!sep->IsNumber(2) ||
|
||||||
!sep->IsNumber(3) ||
|
!sep->IsNumber(3) ||
|
||||||
!sep->IsNumber(4) ||
|
!sep->IsNumber(4)
|
||||||
!sep->IsNumber(5) ||
|
|
||||||
!sep->IsNumber(6)
|
|
||||||
) {
|
) {
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Usage: {} [Spell ID] [Priority] [Min Level] [Max Level] [Min HP] [Max HP]",
|
"Usage: {} [Spell ID] [Priority] [Min HP] [Max HP]",
|
||||||
sep->arg[0]
|
sep->arg[0]
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@ -10652,16 +10664,12 @@ void bot_command_spell_settings_update(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto priority = static_cast<int16>(std::stoi(sep->arg[2]));
|
auto priority = static_cast<int16>(std::stoi(sep->arg[2]));
|
||||||
auto min_level = static_cast<uint8>(std::stoul(sep->arg[3]));
|
auto min_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[3]), -1, 99));
|
||||||
auto max_level = static_cast<uint8>(std::stoul(sep->arg[4]));
|
auto max_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[4]), -1, 100));
|
||||||
auto min_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[5]), -1, 99));
|
|
||||||
auto max_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[6]), -1, 100));
|
|
||||||
|
|
||||||
BotSpellSetting bs;
|
BotSpellSetting bs;
|
||||||
|
|
||||||
bs.priority = priority;
|
bs.priority = priority;
|
||||||
bs.min_level = min_level;
|
|
||||||
bs.max_level = max_level;
|
|
||||||
bs.min_hp = min_hp;
|
bs.min_hp = min_hp;
|
||||||
bs.max_hp = max_hp;
|
bs.max_hp = max_hp;
|
||||||
|
|
||||||
@ -10698,12 +10706,121 @@ void bot_command_spell_settings_update(Client *c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Spell Setting Updated | Priority: {} Levels: {} Health: {}",
|
"Spell Setting Updated | Priority: {} Health: {}",
|
||||||
priority,
|
priority,
|
||||||
my_bot->GetLevelString(min_level, max_level),
|
|
||||||
my_bot->GetHPString(min_hp, max_hp)
|
my_bot->GetHPString(min_hp, max_hp)
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bot_spell_info_dialogue_window(Client* c, const Seperator *sep)
|
||||||
|
{
|
||||||
|
if (helper_command_alias_fail(c, "bot_spell_info_dialogue_window", sep->arg[0], "spellinfo")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto arguments = sep->argnum;
|
||||||
|
if (
|
||||||
|
arguments < 1 ||
|
||||||
|
!sep->IsNumber(1)
|
||||||
|
) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Usage: {} [Spell ID]",
|
||||||
|
sep->arg[0]
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto my_bot = ActionableBots::AsTarget_ByBot(c);
|
||||||
|
if (!my_bot) {
|
||||||
|
c->Message(Chat::White, "You must target a bot that you own to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto spell_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
||||||
|
auto min_level = spells[spell_id].classes;
|
||||||
|
auto class_level = min_level[my_bot->GetBotClass() - 1];
|
||||||
|
|
||||||
|
if (class_level > my_bot->GetLevel()) {
|
||||||
|
c->Message(Chat::White, "This is not a usable spell by your bot.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto results = database.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"SELECT value FROM db_str WHERE id = {} and type = 6 LIMIT 1",
|
||||||
|
spells[spell_id].effect_description_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!results.Success() || !results.RowCount()) {
|
||||||
|
c->Message(Chat::White, "No Spell Information Available for this.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
std::string spell_desc = row[0];
|
||||||
|
|
||||||
|
auto m = DialogueWindow::TableRow(
|
||||||
|
DialogueWindow::TableCell("Spell Effect: ") +
|
||||||
|
DialogueWindow::TableCell(spell_desc)
|
||||||
|
);
|
||||||
|
|
||||||
|
m += DialogueWindow::TableRow(
|
||||||
|
DialogueWindow::TableCell("Spell Level: ") +
|
||||||
|
DialogueWindow::TableCell(fmt::format("{}", class_level))
|
||||||
|
);
|
||||||
|
|
||||||
|
c->SendPopupToClient(
|
||||||
|
fmt::format(
|
||||||
|
"Spell: {}", spells[spell_id].name
|
||||||
|
).c_str(),
|
||||||
|
DialogueWindow::Table(m).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bot_command_enforce_spell_list(Client* c, const Seperator *sep)
|
||||||
|
{
|
||||||
|
if (helper_command_alias_fail(c, "bot_command_enforce_spell_list", sep->arg[0], "enforcespelllist")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Usage: {} [True/False]",
|
||||||
|
sep->arg[0]
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto my_bot = ActionableBots::AsTarget_ByBot(c);
|
||||||
|
if (!my_bot) {
|
||||||
|
c->Message(Chat::White, "You must target a bot that you own to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool toggle = (
|
||||||
|
sep->IsNumber(1) ?
|
||||||
|
(std::stoi(sep->arg[1]) ? true : false) :
|
||||||
|
atobool(sep->arg[1])
|
||||||
|
);
|
||||||
|
|
||||||
|
my_bot->SetBotEnforceSpellSetting(toggle, true);
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{}'s Spell Settings List entries are now {}.",
|
||||||
|
my_bot->GetCleanName(),
|
||||||
|
toggle ? "enforced" : "optional"
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // BOTS
|
#endif // BOTS
|
||||||
|
|||||||
@ -592,6 +592,8 @@ void bot_command_spell_settings_delete(Client* c, const Seperator *sep);
|
|||||||
void bot_command_spell_settings_list(Client* c, const Seperator *sep);
|
void bot_command_spell_settings_list(Client* c, const Seperator *sep);
|
||||||
void bot_command_spell_settings_toggle(Client* c, const Seperator *sep);
|
void bot_command_spell_settings_toggle(Client* c, const Seperator *sep);
|
||||||
void bot_command_spell_settings_update(Client* c, const Seperator *sep);
|
void bot_command_spell_settings_update(Client* c, const Seperator *sep);
|
||||||
|
void bot_spell_info_dialogue_window(Client* c, const Seperator *sep);
|
||||||
|
void bot_command_enforce_spell_list(Client* c, const Seperator* sep);
|
||||||
void bot_command_summon_corpse(Client *c, const Seperator *sep);
|
void bot_command_summon_corpse(Client *c, const Seperator *sep);
|
||||||
void bot_command_suspend(Client *c, const Seperator *sep);
|
void bot_command_suspend(Client *c, const Seperator *sep);
|
||||||
void bot_command_taunt(Client *c, const Seperator *sep);
|
void bot_command_taunt(Client *c, const Seperator *sep);
|
||||||
|
|||||||
@ -409,7 +409,8 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
|
|||||||
" `show_helm`," // 25
|
" `show_helm`," // 25
|
||||||
" `follow_distance`," // 26
|
" `follow_distance`," // 26
|
||||||
" `stop_melee_level`," // 27
|
" `stop_melee_level`," // 27
|
||||||
" `expansion_bitmask`" // 28
|
" `expansion_bitmask`," // 28
|
||||||
|
" `enforce_spell_settings`" // 29
|
||||||
" FROM `bot_data`"
|
" FROM `bot_data`"
|
||||||
" WHERE `bot_id` = {}"
|
" WHERE `bot_id` = {}"
|
||||||
" LIMIT 1",
|
" LIMIT 1",
|
||||||
@ -508,6 +509,8 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
|
|||||||
|
|
||||||
auto eb = std::stoi(row[28]);
|
auto eb = std::stoi(row[28]);
|
||||||
loaded_bot->SetExpansionBitmask(eb, false);
|
loaded_bot->SetExpansionBitmask(eb, false);
|
||||||
|
|
||||||
|
loaded_bot->SetBotEnforceSpellSetting((std::stoi(row[29]) > 0 ? true : false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -3278,6 +3281,27 @@ bool BotDatabase::SaveExpansionBitmask(const uint32 bot_id, const int expansion_
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BotDatabase::SaveEnforceSpellSetting(const uint32 bot_id, const bool enforce_spell_setting)
|
||||||
|
{
|
||||||
|
if (!bot_id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
query = fmt::format(
|
||||||
|
"UPDATE `bot_data`"
|
||||||
|
"SET `enforce_spell_settings` = {} "
|
||||||
|
"WHERE `bot_id` = {}",
|
||||||
|
(enforce_spell_setting ? 1 : 0),
|
||||||
|
bot_id
|
||||||
|
);
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
|
if (!results.Success()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* fail::Bot functions */
|
/* fail::Bot functions */
|
||||||
const char* BotDatabase::fail::LoadBotsList() { return "Failed to bots list"; }
|
const char* BotDatabase::fail::LoadBotsList() { return "Failed to bots list"; }
|
||||||
const char* BotDatabase::fail::LoadOwnerID() { return "Failed to load owner ID"; }
|
const char* BotDatabase::fail::LoadOwnerID() { return "Failed to load owner ID"; }
|
||||||
|
|||||||
@ -99,6 +99,7 @@ public:
|
|||||||
bool SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, const uint32 rgb);
|
bool SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, const uint32 rgb);
|
||||||
|
|
||||||
bool SaveExpansionBitmask(const uint32 bot_id, const int expansion_bitmask);
|
bool SaveExpansionBitmask(const uint32 bot_id, const int expansion_bitmask);
|
||||||
|
bool SaveEnforceSpellSetting(const uint32 bot_id, const bool enforce_spell_setting);
|
||||||
|
|
||||||
|
|
||||||
/* Bot pet functions */
|
/* Bot pet functions */
|
||||||
|
|||||||
@ -3003,14 +3003,6 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bs->min_level > 0 && GetLevel() < bs->min_level) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bs->max_level > 0 && GetLevel() > bs->max_level) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSpellToBotList(
|
AddSpellToBotList(
|
||||||
bs->priority,
|
bs->priority,
|
||||||
e.spellid,
|
e.spellid,
|
||||||
@ -3018,6 +3010,8 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
|
|||||||
e.manacost,
|
e.manacost,
|
||||||
e.recast_delay,
|
e.recast_delay,
|
||||||
e.resist_adjust,
|
e.resist_adjust,
|
||||||
|
e.minlevel,
|
||||||
|
e.maxlevel,
|
||||||
bs->min_hp,
|
bs->min_hp,
|
||||||
bs->max_hp,
|
bs->max_hp,
|
||||||
e.bucket_name,
|
e.bucket_name,
|
||||||
@ -3027,19 +3021,23 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddSpellToBotList(
|
if (!GetBotEnforceSpellSetting()) {
|
||||||
e.priority,
|
AddSpellToBotList(
|
||||||
e.spellid,
|
e.priority,
|
||||||
e.type,
|
e.spellid,
|
||||||
e.manacost,
|
e.type,
|
||||||
e.recast_delay,
|
e.manacost,
|
||||||
e.resist_adjust,
|
e.recast_delay,
|
||||||
e.min_hp,
|
e.resist_adjust,
|
||||||
e.max_hp,
|
e.minlevel,
|
||||||
e.bucket_name,
|
e.maxlevel,
|
||||||
e.bucket_value,
|
e.min_hp,
|
||||||
e.bucket_comparison
|
e.max_hp,
|
||||||
);
|
e.bucket_name,
|
||||||
|
e.bucket_value,
|
||||||
|
e.bucket_comparison
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3102,14 +3100,6 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bs->min_level > 0 && GetLevel() < bs->min_level) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bs->max_level > 0 && GetLevel() > bs->max_level) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSpellToBotList(
|
AddSpellToBotList(
|
||||||
bs->priority,
|
bs->priority,
|
||||||
e.spellid,
|
e.spellid,
|
||||||
@ -3117,6 +3107,8 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
|
|||||||
e.manacost,
|
e.manacost,
|
||||||
e.recast_delay,
|
e.recast_delay,
|
||||||
e.resist_adjust,
|
e.resist_adjust,
|
||||||
|
e.minlevel,
|
||||||
|
e.maxlevel,
|
||||||
bs->min_hp,
|
bs->min_hp,
|
||||||
bs->max_hp,
|
bs->max_hp,
|
||||||
e.bucket_name,
|
e.bucket_name,
|
||||||
@ -3126,19 +3118,23 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddSpellToBotList(
|
if (!GetBotEnforceSpellSetting()) {
|
||||||
e.priority,
|
AddSpellToBotList(
|
||||||
e.spellid,
|
e.priority,
|
||||||
e.type,
|
e.spellid,
|
||||||
e.manacost,
|
e.type,
|
||||||
e.recast_delay,
|
e.manacost,
|
||||||
e.resist_adjust,
|
e.recast_delay,
|
||||||
e.min_hp,
|
e.resist_adjust,
|
||||||
e.max_hp,
|
e.minlevel,
|
||||||
e.bucket_name,
|
e.maxlevel,
|
||||||
e.bucket_value,
|
e.min_hp,
|
||||||
e.bucket_comparison
|
e.max_hp,
|
||||||
);
|
e.bucket_name,
|
||||||
|
e.bucket_value,
|
||||||
|
e.bucket_comparison
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3295,6 +3291,8 @@ void Bot::AddSpellToBotList(
|
|||||||
int16 iManaCost,
|
int16 iManaCost,
|
||||||
int32 iRecastDelay,
|
int32 iRecastDelay,
|
||||||
int16 iResistAdjust,
|
int16 iResistAdjust,
|
||||||
|
uint8 min_level,
|
||||||
|
uint8 max_level,
|
||||||
int8 min_hp,
|
int8 min_hp,
|
||||||
int8 max_hp,
|
int8 max_hp,
|
||||||
std::string bucket_name,
|
std::string bucket_name,
|
||||||
@ -3315,6 +3313,8 @@ void Bot::AddSpellToBotList(
|
|||||||
t.recast_delay = iRecastDelay;
|
t.recast_delay = iRecastDelay;
|
||||||
t.time_cancast = 0;
|
t.time_cancast = 0;
|
||||||
t.resist_adjust = iResistAdjust;
|
t.resist_adjust = iResistAdjust;
|
||||||
|
t.minlevel = min_level;
|
||||||
|
t.maxlevel = maxlevel;
|
||||||
t.min_hp = min_hp;
|
t.min_hp = min_hp;
|
||||||
t.max_hp = max_hp;
|
t.max_hp = max_hp;
|
||||||
t.bucket_name = bucket_name;
|
t.bucket_name = bucket_name;
|
||||||
|
|||||||
@ -67,6 +67,8 @@ struct BotSpells_Struct {
|
|||||||
int32 recast_delay;
|
int32 recast_delay;
|
||||||
int16 priority;
|
int16 priority;
|
||||||
int16 resist_adjust;
|
int16 resist_adjust;
|
||||||
|
uint8 minlevel;
|
||||||
|
uint8 maxlevel;
|
||||||
int16 min_hp; // >0 won't cast if HP is below
|
int16 min_hp; // >0 won't cast if HP is below
|
||||||
int16 max_hp; // >0 won't cast if HP is above
|
int16 max_hp; // >0 won't cast if HP is above
|
||||||
std::string bucket_name;
|
std::string bucket_name;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user