Compare commits

...

8 Commits

Author SHA1 Message Date
Chris Miles 508b37dc93 [Release] 22.44.2 (#4068) 2024-02-12 13:43:38 -06:00
Alex King 0adca46a73 [Bots] Remove Alt Combat Functionality (#4067)
* [Bots] Remove Alt Combat Functionality

# Notes
- This functionality needlessly complicates bot targeting logic and causes crashes and unintended behavior for players when accidentally enabled or enabled by default.

* Cleanup
2024-02-12 03:00:11 -06:00
hg e920e35a5c [Cleanup] Use explicit conversions for enum formatting (#4064)
This is prep for updating to fmt 10 which removed implicit conversions
for enums.
2024-02-12 02:58:48 -06:00
Mitch Freeman 20c01ef343 [Fix] Guard against crash condition (#4062) 2024-02-11 18:32:59 -05:00
JJ 1567141c19 [Database] Fix table name in manifest (#4063) 2024-02-11 18:29:05 -05:00
JJ 6bc9bcf15a [Database] Proper default for droptime from object_contents (#4061) 2024-02-11 17:59:48 -05:00
JJ 86a2a86ba8 [Database] Fix default value for time_of_death in character_corpses (#4060)
* [Database] Fix default value for `time_of_death` in `character_corpses`

* Extra `NULL`

* Update repository

* Repositories with updated structure this time
2024-02-11 16:12:07 -05:00
JJ 3e6924d10e [Guilds] Clean up GUILD_RANK_NONE references (#4059)
Should be exhaustive for guild rank values
Cleans up redefinition of `GUILD_RANK_NONE` by including `GUILD_RANK_NONE_TI`
Fixes #4057
2024-02-11 11:58:19 -05:00
38 changed files with 162 additions and 238 deletions
+24
View File
@@ -1,3 +1,27 @@
## [22.44.2] - 2/12/2024
### Bots
* Remove Alt Combat Functionality ([#4067](https://github.com/EQEmu/Server/pull/4067)) @Kinglykrab 2024-02-12
### Code
* Use explicit conversions for enum formatting ([#4064](https://github.com/EQEmu/Server/pull/4064)) @hgtw 2024-02-12
### Database
* Fix default value for `time_of_death` in `character_corpses` ([#4060](https://github.com/EQEmu/Server/pull/4060)) @joligario 2024-02-11
* Fix table name in manifest ([#4063](https://github.com/EQEmu/Server/pull/4063)) @joligario 2024-02-11
* Proper default for `droptime` from `object_contents` ([#4061](https://github.com/EQEmu/Server/pull/4061)) @joligario 2024-02-11
### Fixes
* Guard against crash condition ([#4062](https://github.com/EQEmu/Server/pull/4062)) @neckkola 2024-02-11
### Guilds
* Clean up `GUILD_RANK_NONE` references ([#4059](https://github.com/EQEmu/Server/pull/4059)) @joligario 2024-02-11
## [22.44.1] - 2/11/2024
### Fixes
+2
View File
@@ -64,4 +64,6 @@ typedef enum {
} bodyType;
/* bodytypes above 64 make the mob not show up */
constexpr int format_as(bodyType type) { return static_cast<int>(type); }
#endif
@@ -5346,6 +5346,26 @@ CREATE TABLE guild_tributes (
) ENGINE=InnoDB;
)"
},
ManifestEntry{
.version = 9261,
.description = "2024_02_11_character_corpses.sql",
.check = "SHOW COLUMNS FROM `character_corpses` LIKE 'time_of_death'",
.condition = "contains",
.match = "0000-00-00 00:00:00",
.sql = R"(
ALTER TABLE `character_corpses` MODIFY COLUMN `time_of_death` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP;
)"
},
ManifestEntry{
.version = 9262,
.description = "2024_02_11_object_contents.sql",
.check = "SHOW COLUMNS FROM `object_contents` LIKE 'droptime'",
.condition = "contains",
.match = "0000-00-00 00:00:00",
.sql = R"(
ALTER TABLE `object_contents` MODIFY COLUMN `droptime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP;
)"
}
// -- template; copy/paste this when you need to create a new entry
// ManifestEntry{
// .version = 9228,
+2
View File
@@ -71,6 +71,8 @@ namespace EQ
bit_DeityAll = UINT32_MAX
};
constexpr int format_as(DeityType type) { return static_cast<int>(type); }
extern DeityTypeBit GetDeityBitmask(DeityType deity_type);
extern std::string GetDeityName(DeityType deity_type);
extern const std::map<DeityType, std::string>& GetDeityMap();
+1
View File
@@ -45,6 +45,7 @@ typedef enum { //EQEmu internal opcodes list
_maxEmuOpcode
} EmuOpcode;
constexpr int format_as(EmuOpcode opcode) { return static_cast<int>(opcode); }
extern const char *OpcodeNames[_maxEmuOpcode+1];
#endif
+1 -1
View File
@@ -881,7 +881,7 @@ static void ProcessGuildMember(MySQLRequestRow row, CharGuildInfo &into)
if (into.guild_id == 0) {
into.guild_id = GUILD_NONE;
}
if (into.rank > GUILD_MAX_RANK) {
if (into.rank > GUILD_MAX_RANK + 1) {
into.rank = GUILD_RANK_NONE;
}
}
+2 -1
View File
@@ -35,7 +35,7 @@
#define GUILD_MEMBER_TI 0
#define GUILD_OFFICER_TI 1
#define GUILD_LEADER_TI 2
#define GUILD_RANK_NONE (GUILD_MAX_RANK+1)
#define GUILD_RANK_NONE_TI (GUILD_MAX_RANK + 1)
//defines for standard ranks base on RoF2 definitions
#define GUILD_RANK_NONE 0
@@ -81,5 +81,6 @@ typedef enum {
GUILD_ACTION_MEMBERS_DEMOTE_SELF = 30,
} GuildAction;
constexpr int format_as(GuildAction action) { return static_cast<int>(action); }
#endif
+1
View File
@@ -158,6 +158,7 @@ namespace RoF2
slotCursor
};
constexpr int16 format_as(InventorySlots slot) { return static_cast<int16>(slot); }
} // namespace enum_
using namespace enum_;
+5
View File
@@ -692,6 +692,10 @@ namespace Titanium
eq->rank = GUILD_LEADER_TI;
break;
}
default: {
eq->rank = GUILD_RANK_NONE_TI;
break;
}
}
memcpy(eq->member_name, emu->member_name, sizeof(eq->member_name));
@@ -1417,6 +1421,7 @@ namespace Titanium
break;
}
default: {
eq->guildrank = GUILD_RANK_NONE_TI;
break;
}
}
+16
View File
@@ -1155,6 +1155,7 @@ namespace UF
break;
}
default: {
emu_e->rank = GUILD_RANK_NONE_TI;
break;
}
}
@@ -1256,6 +1257,10 @@ namespace UF
eq->rank_ = GUILD_LEADER_TI;
break;
}
default: {
eq->rank_ = GUILD_RANK_NONE_TI;
break;
}
}
OUT(zone_id)
OUT(last_on)
@@ -1291,6 +1296,10 @@ namespace UF
eq->rank_ = GUILD_LEADER_TI;
break;
}
default: {
eq->rank_ = GUILD_RANK_NONE_TI;
break;
}
}
FINISH_ENCODE()
}
@@ -1970,6 +1979,7 @@ namespace UF
break;
}
default: {
emu->guildrank = GUILD_RANK_NONE_TI;
break;
}
}
@@ -2503,6 +2513,10 @@ namespace UF
eq->parameter = GUILD_LEADER_TI;
break;
}
default: {
eq->parameter = GUILD_RANK_NONE_TI;
break;
}
}
break;
}
@@ -2545,6 +2559,7 @@ namespace UF
break;
}
default: {
emu->rank = GUILD_RANK_NONE_TI;
break;
}
}
@@ -3163,6 +3178,7 @@ namespace UF
break;
}
default: {
emu->guildrank = GUILD_RANK_NONE_TI;
break;
}
}
@@ -237,7 +237,7 @@ public:
e.y = 0;
e.z = 0;
e.heading = 0;
e.time_of_death = 0;
e.time_of_death = std::time(nullptr);
e.guild_consent_id = 0;
e.is_rezzed = 0;
e.is_buried = 0;
@@ -116,7 +116,7 @@ public:
e.bagidx = 0;
e.itemid = 0;
e.charges = 0;
e.droptime = 0;
e.droptime = std::time(nullptr);
e.augslot1 = 0;
e.augslot2 = 0;
e.augslot3 = 0;
-1
View File
@@ -694,7 +694,6 @@ RULE_BOOL(Bots, BotGroupXP, false, "Determines whether client gets experience fo
RULE_BOOL(Bots, BotLevelsWithOwner, false, "Auto-updates spawned bots as owner levels/de-levels (false is original behavior)")
RULE_INT(Bots, BotCharacterLevel, 0, "If level is greater that value player can spawn bots if BotCharacterLevelEnabled is true")
RULE_INT(Bots, CasterStopMeleeLevel, 13, "Level at which caster bots stop melee attacks")
RULE_BOOL(Bots, AllowOwnerOptionAltCombat, true, "When option is enabled, bots will use an auto-/shared-aggro combat model")
RULE_BOOL(Bots, AllowOwnerOptionAutoDefend, true, "When option is enabled, bots will defend their owner on enemy aggro")
RULE_REAL(Bots, LeashDistance, 562500.0f, "Distance a bot is allowed to travel from leash owner before being pulled back (squared value)")
RULE_BOOL(Bots, AllowApplyPoisonCommand, true, "Allows the use of the bot command 'applypoison'")
+2
View File
@@ -162,6 +162,8 @@ namespace EQ
// server profile does not reflect this yet..so, prefixed with 'PACKET_'
#define PACKET_SKILL_ARRAY_SIZE 100
constexpr int format_as(SkillType skill) { return static_cast<int>(skill); }
bool IsTradeskill(SkillType skill);
bool IsSpecializedSkill(SkillType skill);
float GetSkillMeleePushForce(SkillType skill);
+2
View File
@@ -252,6 +252,8 @@ typedef enum {
ActivityCompleted = 2
} ActivityState;
constexpr int format_as(ActivityState state) { return static_cast<int>(state); }
struct ClientActivityInformation {
int activity_id;
int done_count;
+2
View File
@@ -54,6 +54,8 @@ namespace EQ
tintInvalid = textureInvalid
};
constexpr int format_as(TextureSlot slot) { return static_cast<int>(slot); }
const int8 LastTexture = weaponSecondary;
const int8 LastTintableTexture = tintFeet;
+2 -2
View File
@@ -25,7 +25,7 @@
// Build variables
// these get injected during the build pipeline
#define CURRENT_VERSION "22.44.1-dev" // always append -dev to the current version for custom-builds
#define CURRENT_VERSION "22.44.2-dev" // always append -dev to the current version for custom-builds
#define LOGIN_VERSION "0.8.0"
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__
@@ -42,7 +42,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9260
#define CURRENT_BINARY_DATABASE_VERSION 9262
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9042
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "eqemu-server",
"version": "22.44.1",
"version": "22.44.2",
"repository": {
"type": "git",
"url": "https://github.com/EQEmu/Server.git"
+1 -1
View File
@@ -139,7 +139,7 @@ void ClientListEntry::SetOnline(CLE_Status iOnline)
AccountName(),
AccountID(),
CLEStatusString[CLE_Status::Online],
iOnline
static_cast<int>(iOnline)
);
if (iOnline >= CLE_Status::Online && pOnline < CLE_Status::Online) {
+1 -1
View File
@@ -280,7 +280,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
fmt::format_to(std::back_inserter(out), fmt::runtime(newline));
}
fmt::format_to(std::back_inserter(out), "ID: {} Acc# {} AccName: {} IP: {}", cle->GetID(), cle->AccountID(), cle->AccountName(), inet_ntoa(in));
fmt::format_to(std::back_inserter(out), "{} Stale: {} Online: {} Admin: {}", newline, cle->GetStaleCounter(), cle->Online(), cle->Admin());
fmt::format_to(std::back_inserter(out), "{} Stale: {} Online: {} Admin: {}", newline, cle->GetStaleCounter(), static_cast<int>(cle->Online()), cle->Admin());
if (cle->LSID())
fmt::format_to(std::back_inserter(out), "{} LSID: {} LSName: {} WorldAdmin: {}", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin());
if (cle->CharID())
+2 -2
View File
@@ -343,7 +343,7 @@ void NPC::DescribeAggro(Client *to_who, Mob *mob, bool verbose) {
"{} does not have low enough faction, their Faction Level is {} ({}).",
to_who->GetTargetDescription(mob),
FactionValueToString(faction_value),
faction_value
static_cast<int>(faction_value)
).c_str()
);
return;
@@ -556,7 +556,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
LogAggro("Is In zone?:[{}]\n", mob->InZone());
LogAggro("Dist^2: [{}]\n", distance_squared);
LogAggro("Range^2: [{}]\n", aggro_range_squared);
LogAggro("Faction: [{}]\n", faction_value);
LogAggro("Faction: [{}]\n", static_cast<int>(faction_value));
LogAggro("AlwaysAggroFlag: [{}]\n", AlwaysAggro());
LogAggro("Int: [{}]\n", GetINT());
LogAggro("Con: [{}]\n", GetLevelCon(mob->GetLevel()));
+28 -172
View File
@@ -85,7 +85,6 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
SetShowHelm(true);
SetPauseAI(false);
m_alt_combat_hate_timer.Start(250);
m_auto_defend_timer.Disable();
SetGuardFlag(false);
SetHoldFlag(false);
@@ -205,7 +204,6 @@ Bot::Bot(
SetTaunting((GetClass() == Class::Warrior || GetClass() == Class::Paladin || GetClass() == Class::ShadowKnight) && (GetBotStance() == EQ::constants::stanceAggressive));
SetPauseAI(false);
m_alt_combat_hate_timer.Start(250);
m_auto_defend_timer.Disable();
SetGuardFlag(false);
SetHoldFlag(false);
@@ -1958,8 +1956,6 @@ void Bot::AI_Process()
HealRotationChecks();
bool bo_alt_combat = (RuleB(Bots, AllowOwnerOptionAltCombat) && bot_owner->GetBotOption(Client::booAltCombat));
if (GetAttackFlag()) { // Push owner's target onto our hate list
SetOwnerTarget(bot_owner);
}
@@ -1969,8 +1965,6 @@ void Bot::AI_Process()
//ALT COMBAT (ACQUIRE HATE)
SetBotTarget(bot_owner, raid, bot_group, leash_owner, lo_distance, leash_distance, bo_alt_combat);
glm::vec3 Goal(0, 0, 0);
// We have aggro to choose from
@@ -1996,12 +1990,6 @@ void Bot::AI_Process()
}
}
// ALT COMBAT (ACQUIRE TARGET)
else if (bo_alt_combat && m_alt_combat_hate_timer.Check()) { // Find a mob from hate list to target
AcquireBotTarget(bot_group, nullptr, leash_owner, leash_distance);
}
// DEFAULT (ACQUIRE TARGET)
// VERIFY TARGET AND STANCE
@@ -2021,7 +2009,7 @@ void Bot::AI_Process()
// TARGET VALIDATION
if (!IsValidTarget(bot_owner, leash_owner, lo_distance, leash_distance, bo_alt_combat, tar, tar_distance)) {
if (!IsValidTarget(bot_owner, leash_owner, lo_distance, leash_distance, tar, tar_distance)) {
return;
}
@@ -2683,17 +2671,29 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
}
}
bool Bot::IsValidTarget(Client* bot_owner, Client* leash_owner, float lo_distance, float leash_distance, bool bo_alt_combat, Mob* tar, float tar_distance) {
bool Bot::IsValidTarget(
Client* bot_owner,
Client* leash_owner,
float lo_distance,
float leash_distance,
Mob* tar,
float tar_distance
)
{
if (!tar || !bot_owner || !leash_owner) {
return false;
}
bool valid_target_state = HOLDING || !tar->IsNPC() || tar->IsMezzed() || lo_distance > leash_distance || tar_distance > leash_distance;
bool valid_target = !GetAttackingFlag() && !CheckLosFN(tar) && !leash_owner->CheckLosFN(tar);
bool valid_bo_target = !GetAttackingFlag() && NOT_PULLING_BOT && !leash_owner->AutoAttackEnabled() && !tar->GetHateAmount(this) && !tar->GetHateAmount(leash_owner);
const bool valid_target_state = (
HOLDING ||
!tar->IsNPC() ||
tar->IsMezzed() ||
lo_distance > leash_distance ||
tar_distance > leash_distance
);
const bool valid_target = !GetAttackingFlag() && !CheckLosFN(tar) && !leash_owner->CheckLosFN(tar);
if (valid_target_state || valid_target || !IsAttackAllowed(tar) || (bo_alt_combat && valid_bo_target)) {
if (valid_target_state || valid_target || !IsAttackAllowed(tar)) {
// Normally, we wouldn't want to do this without class checks..but, too many issues can arise if we let enchanter animation pets run rampant
if (HasPet()) {
GetPet()->RemoveFromHateList(tar);
@@ -2712,6 +2712,7 @@ bool Bot::IsValidTarget(Client* bot_owner, Client* leash_owner, float lo_distanc
SetPullingFlag(false);
SetReturningFlag(false);
bot_owner->SetBotPulling(false);
if (GetPet()) {
GetPet()->SetPetOrder(m_previous_pet_order);
}
@@ -2723,13 +2724,15 @@ bool Bot::IsValidTarget(Client* bot_owner, Client* leash_owner, float lo_distanc
return false;
}
return true;
}
Mob* Bot::GetBotTarget(Client* bot_owner) {
Mob* Bot::GetBotTarget(Client* bot_owner)
{
Mob* t = GetTarget();
Mob* tar = GetTarget();
if (!tar || PASSIVE) {
if (!t || PASSIVE) {
if (GetTarget()) {
SetTarget(nullptr);
}
@@ -2737,12 +2740,13 @@ Mob* Bot::GetBotTarget(Client* bot_owner) {
WipeHateList();
SetAttackFlag(false);
SetAttackingFlag(false);
if (PULLING_BOT) {
if (PULLING_BOT) {
// 'Flags' should only be set on the bot that is pulling
SetPullingFlag(false);
SetReturningFlag(false);
bot_owner->SetBotPulling(false);
if (GetPet()) {
GetPet()->SetPetOrder(m_previous_pet_order);
}
@@ -2752,84 +2756,8 @@ Mob* Bot::GetBotTarget(Client* bot_owner) {
BotMeditate(true);
}
}
return tar;
}
void Bot::AcquireBotTarget(Group* bot_group, Raid* raid, Client* leash_owner, float leash_distance) {// Group roles can be expounded upon in the future
Mob* assist_mob = nullptr;
bool find_target = true;
if (raid) {
assist_mob = raid->GetRaidMainAssistOne();
}
else if (bot_group) {
assist_mob = entity_list.GetMob(bot_group->GetMainAssistName());
}
if (assist_mob) {
if (assist_mob->GetTarget()) {
if (assist_mob != this) {
if (GetTarget() != assist_mob->GetTarget()) {
SetTarget(assist_mob->GetTarget());
}
if (
HasPet() &&
(
GetClass() != Class::Enchanter ||
GetPet()->GetPetType() != petAnimation ||
GetAA(aaAnimationEmpathy) >= 2
)
) {
// This artificially inflates pet's target aggro..but, less expensive than checking hate each AI process
GetPet()->AddToHateList(assist_mob->GetTarget(), 1);
GetPet()->SetTarget(assist_mob->GetTarget());
}
}
find_target = false;
} else if (assist_mob != this) {
if (GetTarget()) {
SetTarget(nullptr);
}
if (
HasPet() &&
(
GetClass() != Class::Enchanter ||
GetPet()->GetPetType() != petAnimation ||
GetAA(aaAnimationEmpathy) >= 1
)
) {
GetPet()->WipeHateList();
GetPet()->SetTarget(nullptr);
}
find_target = false;
}
}
if (find_target) {
if (IsRooted()) {
auto closest = hate_list.GetClosestEntOnHateList(this, true);
if (closest) {
SetTarget(closest);
}
} else {
// This will keep bots on target for now..but, future updates will allow for rooting/stunning
if (auto escaping = hate_list.GetEscapingMobOnHateList(leash_owner, leash_distance)) {
SetTarget(escaping);
}
if (!GetTarget()) {
auto most_hate = hate_list.GetMobWithMostHateOnList(this, nullptr, true);
if (most_hate) {
SetTarget(most_hate);
}
}
}
}
return t;
}
bool Bot::ReturningFlagChecks(Client* bot_owner, float fm_distance) {// Need to make it back to group before clearing return flag
@@ -2893,42 +2821,6 @@ bool Bot::PullingFlagChecks(Client* bot_owner) {
return true;
}
void Bot::SetBotTarget(Client* bot_owner, Raid* raid, Group* bot_group, Client* leash_owner, float lo_distance, float leash_distance, bool bo_alt_combat) {
if (bo_alt_combat && m_alt_combat_hate_timer.Check(false)) {
// Empty hate list - let's find some aggro
if (bot_owner->IsEngaged() && !IsEngaged() && NOT_HOLDING && NOT_PASSIVE && (!bot_owner->GetBotPulling() || NOT_PULLING_BOT)) {
SetLeashOwnerTarget(leash_owner, bot_owner, lo_distance, leash_distance);
}
else if (!IsEngaged() && raid) {
for (const auto& raid_member : raid->members) {
if (!raid_member.member) {
continue;
}
auto rm_target = raid_member.member->GetTarget();
if (!rm_target || !rm_target->IsNPC()) {
continue;
}
SetBotGroupTarget(bot_owner, leash_owner, lo_distance, leash_distance, raid_member.member, rm_target);
}
}
else if (!IsEngaged() && bot_group) {
for (const auto& bg_member: bot_group->members) {
if (!bg_member) {
continue;
}
auto bgm_target = bg_member->GetTarget();
if (!bgm_target || !bgm_target->IsNPC()) {
continue;
}
SetBotGroupTarget(bot_owner, leash_owner, lo_distance, leash_distance, bg_member, bgm_target);
}
}
}
}
void Bot::HealRotationChecks() {
if (IsMyHealRotationSet()) {
@@ -3063,26 +2955,6 @@ Client* Bot::SetLeashOwner(Client* bot_owner, Group* bot_group, Raid* raid, uint
return leash_owner;
}
void Bot::SetLeashOwnerTarget(Client* leash_owner, Client* bot_owner, float lo_distance, float leash_distance) {
Mob* lo_target = leash_owner->GetTarget();
if (lo_target &&
lo_target->IsNPC() &&
!lo_target->IsMezzed() &&
((bot_owner->GetBotOption(Client::booAutoDefend) && lo_target->GetHateAmount(leash_owner)) || leash_owner->AutoAttackEnabled()) &&
lo_distance <= leash_distance &&
DistanceSquared(m_Position, lo_target->GetPosition()) <= leash_distance &&
(CheckLosFN(lo_target) || leash_owner->CheckLosFN(lo_target)) &&
IsAttackAllowed(lo_target))
{
AddToHateList(lo_target, 1);
if (HasPet() && (GetClass() != Class::Enchanter || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 2)) {
GetPet()->AddToHateList(lo_target, 1);
GetPet()->SetTarget(lo_target);
}
}
}
void Bot::SetOwnerTarget(Client* bot_owner) {
if (GetPet() && PULLING_BOT) {
GetPet()->SetPetOrder(m_previous_pet_order);
@@ -3155,22 +3027,6 @@ void Bot::BotPullerProcess(Client* bot_owner, Raid* raid) {
}
}
void Bot::SetBotGroupTarget(const Client* bot_owner, Client* leash_owner, float lo_distance, float leash_distance, Mob* const& bg_member, Mob* bgm_target) {
if (!bgm_target->IsMezzed() &&
((bot_owner->GetBotOption(Client::booAutoDefend) && bgm_target->GetHateAmount(bg_member)) || leash_owner->AutoAttackEnabled()) &&
lo_distance <= leash_distance &&
DistanceSquared(m_Position, bgm_target->GetPosition()) <= leash_distance &&
(CheckLosFN(bgm_target) || leash_owner->CheckLosFN(bgm_target)) &&
IsAttackAllowed(bgm_target))
{
AddToHateList(bgm_target, 1);
if (HasPet() && (GetClass() != Class::Enchanter || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 2)) {
GetPet()->AddToHateList(bgm_target, 1);
GetPet()->SetTarget(bgm_target);
}
}
}
void Bot::Depop() {
WipeHateList();
entity_list.RemoveFromHateLists(this);
+8 -6
View File
@@ -781,12 +781,15 @@ public:
Mob* SetFollowMob(Client* leash_owner);
Mob* GetBotTarget(Client* bot_owner);
void AcquireBotTarget(Group* bot_group, Raid* raid, Client* leash_owner, float leash_distance);
void SetBotTarget(Client* bot_owner, Raid* raid, Group* bot_group, Client* leash_owner, float lo_distance, float leash_distance, bool bo_alt_combat);
void SetLeashOwnerTarget(Client* leash_owner, Client* bot_owner, float lo_distance, float leash_distance);
void SetOwnerTarget(Client* bot_owner);
void SetBotGroupTarget(const Client* bot_owner, Client* leash_owner, float lo_distance, float leash_distance, Mob* const& bg_member, Mob* bgm_target);
bool IsValidTarget(Client* bot_owner, Client* leash_owner, float lo_distance, float leash_distance, bool bo_alt_combat, Mob* tar, float tar_distance);
bool IsValidTarget(
Client* bot_owner,
Client* leash_owner,
float lo_distance,
float leash_distance,
Mob* tar,
float tar_distance
);
bool PullingFlagChecks(Client* bot_owner);
bool ReturningFlagChecks(Client* bot_owner, float fm_distance);
@@ -879,7 +882,6 @@ private:
int32 end_regen;
Timer m_evade_timer; // can be moved to pTimers at some point
Timer m_alt_combat_hate_timer;
Timer m_auto_defend_timer;
Timer auto_save_timer;
bool m_dirtyautohaters;
+1 -1
View File
@@ -1107,7 +1107,7 @@ void bot_command_stance(Client *c, const Seperator *sep)
fmt::format(
"My current stance is {} ({}).",
EQ::constants::GetStanceName(bot_iter->GetBotStance()),
bot_iter->GetBotStance()
static_cast<int>(bot_iter->GetBotStance())
).c_str()
);
}
-29
View File
@@ -45,11 +45,6 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
"<td><c \"#888888\">spawn with class-based message</td>"
"</tr>"
"<tr>"
"<td><c \"#CCCCCC\">altcombat</td>"
"<td><c \"#00CC00\">enable <c \"#CCCCCC\">| <c \"#00CC00\">disable</td>"
"<td><c \"#888888\">use alternate ai combat behavior</td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00CCCC\">null</td>"
"<td><c \"#888888\">(toggles)</td>"
@@ -199,28 +194,6 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
c->Message(Chat::White, "Bot 'spawn message' is now %s.", argument.c_str());
}
else if (!owner_option.compare("altcombat")) {
if (RuleB(Bots, AllowOwnerOptionAltCombat)) {
if (!argument.compare("enable")) {
c->SetBotOption(Client::booAltCombat, true);
}
else if (!argument.compare("disable")) {
c->SetBotOption(Client::booAltCombat, false);
}
else {
c->SetBotOption(Client::booAltCombat, !c->GetBotOption(Client::booAltCombat));
}
database.botdb.SaveOwnerOption(c->CharacterID(), Client::booAltCombat, c->GetBotOption(Client::booAltCombat));
c->Message(Chat::White, "Bot 'alt combat' is now %s.", (c->GetBotOption(Client::booAltCombat) ? "enabled" : "disabled"));
}
else {
c->Message(Chat::White, "Bot owner option 'altcombat' is not allowed on this server.");
}
}
else if (!owner_option.compare("autodefend")) {
if (RuleB(Bots, AllowOwnerOptionAutoDefend)) {
@@ -292,7 +265,6 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
"<tr>" "<td><c \"#CCCCCC\">statsupdate</td>" "<td><c \"#00CC00\">{}</td>" "</tr>"
"<tr>" "<td><c \"#CCCCCC\">spawnmessage</td>" "<td><c \"#00CC00\">{}</td>" "</tr>"
"<tr>" "<td><c \"#CCCCCC\">spawnmessage</td>" "<td><c \"#00CC00\">{}</td>" "</tr>"
"<tr>" "<td><c \"#CCCCCC\">altcombat</td>" "<td><c \"#00CC00\">{}</td>" "</tr>"
"<tr>" "<td><c \"#CCCCCC\">autodefend</td>" "<td><c \"#00CC00\">{}</td>" "</tr>"
"<tr>" "<td><c \"#CCCCCC\">buffcounter</td>" "<td><c \"#00CC00\">{}</td>" "</tr>"
"<tr>" "<td><c \"#CCCCCC\">monkwumessage</td>" "<td><c \"#00CC00\">{}</td>" "</tr>"
@@ -301,7 +273,6 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
(c->GetBotOption(Client::booStatsUpdate) ? "enabled" : "disabled"),
(c->GetBotOption(Client::booSpawnMessageSay) ? "say" : (c->GetBotOption(Client::booSpawnMessageTell) ? "tell" : "silent")),
(c->GetBotOption(Client::booSpawnMessageClassSpecific) ? "class" : "default"),
(RuleB(Bots, AllowOwnerOptionAltCombat) ? (c->GetBotOption(Client::booAltCombat) ? "enabled" : "disabled") : "restricted"),
(RuleB(Bots, AllowOwnerOptionAutoDefend) ? (c->GetBotOption(Client::booAutoDefend) ? "enabled" : "disabled") : "restricted"),
(c->GetBotOption(Client::booBuffCounter) ? "enabled" : "disabled"),
(c->GetBotOption(Client::booMonkWuMessage) ? "enabled" : "disabled")
+1 -1
View File
@@ -1842,7 +1842,7 @@ bool BotDatabase::SaveOwnerOption(const uint32 owner_id, size_t type, const bool
Client::booDeathMarquee,
Client::booStatsUpdate,
Client::booSpawnMessageClassSpecific,
Client::booAltCombat,
Client::booUnused,
Client::booAutoDefend,
Client::booBuffCounter,
Client::booMonkWuMessage
+3 -4
View File
@@ -370,7 +370,6 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
bot_owner_options[booSpawnMessageSay] = false;
bot_owner_options[booSpawnMessageTell] = true;
bot_owner_options[booSpawnMessageClassSpecific] = true;
bot_owner_options[booAltCombat] = RuleB(Bots, AllowOwnerOptionAltCombat);
bot_owner_options[booAutoDefend] = RuleB(Bots, AllowOwnerOptionAutoDefend);
bot_owner_options[booBuffCounter] = false;
bot_owner_options[booMonkWuMessage] = false;
@@ -537,7 +536,7 @@ void Client::SendZoneInPackets()
safe_delete(outapp);
if (IsInAGuild()) {
guild_mgr.UpdateDbMemberOnline(CharacterID(), true);
guild_mgr.UpdateDbMemberOnline(CharacterID(), true);
//SendGuildMembers();
SendGuildURL();
SendGuildChannel();
@@ -747,7 +746,7 @@ bool Client::Save(uint8 iCommitNow) {
SetNextInvSnapshot(RuleI(Character, InvSnapshotMinRetryM));
}
}
database.SaveCharacterData(this, &m_pp, &m_epp); /* Save Character Data */
database.SaveCharacterEXPModifier(this);
@@ -6955,7 +6954,7 @@ void Client::ShowXTargets(Client *c)
fmt::format(
"xtarget slot [{}] type [{}] ID [{}] name [{}]",
i,
XTargets[i].Type,
static_cast<int>(XTargets[i].Type),
XTargets[i].ID,
strlen(XTargets[i].Name) ? XTargets[i].Name : "No Name"
).c_str()
+1 -1
View File
@@ -2076,7 +2076,7 @@ public:
booSpawnMessageSay,
booSpawnMessageTell,
booSpawnMessageClassSpecific,
booAltCombat,
booUnused,
booAutoDefend,
booBuffCounter,
booMonkWuMessage,
+10 -2
View File
@@ -516,7 +516,7 @@ int Client::HandlePacket(const EQApplicationPacket *app)
case CLIENT_LINKDEAD:
break;
default:
LogDebug("Unknown client_state: [{}]\n", client_state);
LogDebug("Unknown client_state: [{}]\n", static_cast<int>(client_state));
break;
}
@@ -8163,6 +8163,10 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app)
rank = GUILD_LEADER;
break;
}
default: {
rank = GUILD_RANK_NONE;
break;
}
}
}
@@ -8564,6 +8568,10 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app)
rank = GUILD_LEADER;
break;
}
default: {
rank = GUILD_RANK_NONE;
break;
}
}
}
@@ -16334,7 +16342,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app)
}
default:
LogDebug("Unhandled XTarget Type [{}]", Type);
LogDebug("Unhandled XTarget Type [{}]", static_cast<int>(Type));
break;
}
+2 -2
View File
@@ -410,7 +410,7 @@ void DataBucket::BulkLoadEntities(DataBucketLoadType::Type t, std::vector<uint32
column = "npc_id";
break;
default:
LogError("Incorrect LoadType [{}]", t);
LogError("Incorrect LoadType [{}]", static_cast<int>(t));
break;
}
@@ -546,7 +546,7 @@ void DataBucket::HandleWorldMessage(ServerPacket *p)
n.e.id,
n.e.key_,
n.e.value,
n.update_action
static_cast<int>(n.update_action)
);
// delete
+8 -1
View File
@@ -146,13 +146,20 @@ void Client::SendGuildRankNames()
{
if (IsInAGuild() && (ClientVersion() >= EQ::versions::ClientVersion::RoF)) {
auto guild = guild_mgr.GetGuildByGuildID(GuildID());
if (!guild) {
return;
}
for (int i = 1; i <= GUILD_MAX_RANK; i++) {
auto outapp = new EQApplicationPacket(OP_GuildUpdate, sizeof(GuildUpdateUCPStruct));
GuildUpdateUCPStruct *gucp = (GuildUpdateUCPStruct *) outapp->pBuffer;
GuildUpdateUCPStruct* gucp = (GuildUpdateUCPStruct*)outapp->pBuffer;
gucp->payload.rank_name.rank = i;
if (guild->rank_names[i].empty()) {
continue;
}
strn0cpy(
gucp->payload.rank_name.rank_name,
guild->rank_names[i].c_str(),
+1
View File
@@ -1640,6 +1640,7 @@ uint8* ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char* prefix_na
break;
}
default: {
ci->rank = GUILD_RANK_NONE_TI;
break;
}
}
+1 -1
View File
@@ -2521,7 +2521,7 @@ void Mob::SendStatsWindow(Client* c, bool use_window)
CastToClient()->GetPVP() ? "Yes" : "No",
CastToClient()->GetGM() ? "On" : "Off",
EQ::constants::GetFlyModeName(static_cast<uint8>(flymode)),
flymode,
static_cast<int>(flymode),
CastToClient()->GetGMSpeed() ? "On" : "Off",
CastToClient()->GetHideMe() ? "On" : "Off",
CastToClient()->GetGMInvul() ? "On" : "Off",
+1 -1
View File
@@ -1487,7 +1487,7 @@ void MobMovementManager::PushEvadeCombat(MobMovementEntry &mob_movement_entry)
*/
void MobMovementManager::HandleStuckBehavior(Mob *who, float x, float y, float z, MobMovementMode mob_movement_mode)
{
LogDebug("Handle stuck behavior for {0} at ({1}, {2}, {3}) with movement_mode {4}", who->GetName(), x, y, z, mob_movement_mode);
LogDebug("Handle stuck behavior for {0} at ({1}, {2}, {3}) with movement_mode {4}", who->GetName(), x, y, z, static_cast<int>(mob_movement_mode));
auto sb = who->GetStuckBehavior();
MobStuckBehavior behavior = RunToTarget;
+3
View File
@@ -169,4 +169,7 @@ protected:
TimeOfDay_Struct next_event;
};
constexpr int format_as(SpawnCondition::OnChange val) { return static_cast<int>(val); }
constexpr int format_as(SpawnEvent::Action val) { return static_cast<int>(val); }
#endif
+3 -3
View File
@@ -407,7 +407,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
spell.target_type == ST_Beam
) && target_id == 0
) {
LogSpells("Spell [{}] auto-targeted the caster. Group? [{}], target type [{}]", spell_id, IsGroupSpell(spell_id), spell.target_type);
LogSpells("Spell [{}] auto-targeted the caster. Group? [{}], target type [{}]", spell_id, IsGroupSpell(spell_id), static_cast<int>(spell.target_type));
target_id = GetID();
}
@@ -2383,7 +2383,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
default:
{
LogSpells("I dont know Target Type: [{}] Spell: ([{}]) [{}]", spells[spell_id].target_type, spell_id, spells[spell_id].name);
LogSpells("I dont know Target Type: [{}] Spell: ([{}]) [{}]", static_cast<int>(spells[spell_id].target_type), spell_id, spells[spell_id].name);
Message(0, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].target_type, spell_id, spells[spell_id].name);
CastAction = CastActUnknown;
break;
@@ -2461,7 +2461,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
}
}
LogSpells("Spell [{}]: target type [{}], target [{}], AE center [{}]", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE");
LogSpells("Spell [{}]: target type [{}], target [{}], AE center [{}]", spell_id, static_cast<int>(CastAction), spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE");
// if a spell has the AEDuration flag, it becomes an AE on target
// spell that's recast every 2500 msec for AEDuration msec.
+1 -1
View File
@@ -256,7 +256,7 @@ bool TaskManager::LoadTasks(int single_task)
activity_id,
task_data->activity_count,
static_cast<int32_t>(ad->activity_type),
ad->goal_method,
static_cast<int32_t>(ad->goal_method),
ad->goal_count,
ad->zones.c_str(),
ad->target_name.c_str(),
+1 -1
View File
@@ -746,7 +746,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
z,
heading,
ignorerestrictions,
zm
static_cast<int>(zm)
);
cheat_manager.SetExemptStatus(Port, true);