Added BOT logging damage/heals to owner
Added BOT message to owner for harmony fails
Made var Critical global to remove duplicate crit messages
Added a NULL check to Mob:GetCleanname()
This commit is contained in:
neckkola
2021-12-30 15:42:03 -04:00
parent bcf0677656
commit bcf28bc35c
7 changed files with 123 additions and 50 deletions
+15
View File
@@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
+35 -7
View File
@@ -49,6 +49,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
extern QueryServ* QServ;
extern WorldServer worldserver;
extern FastMath g_Math;
extern bool Critical;
#ifdef _WINDOWS
#define snprintf _snprintf
@@ -3746,6 +3747,33 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
owner->CastToClient()->QueuePacket(outapp, true, CLIENT_CONNECTED, filter);
}
}
#ifdef BOTS
else if (owner && owner->IsBot() && RuleB(Bots, DisplaySpellDamage)) {
if (((spell_id != SPELL_UNKNOWN) || (FromDamageShield)) && damage > 0) {
//special crap for spell damage, looks hackish to me
char val1[20] = { 0 };
owner->CastToBot()->GetBotOwner()->CastToClient()->MessageString(Chat::NonMelee, OTHER_HIT_NONMELEE, attacker->GetCleanName(), ConvertArray(damage, val1));
}
else {
if (damage > 0) {
if (spell_id != SPELL_UNKNOWN)
filter = iBuffTic ? FilterDOT : FilterSpellDamage;
else
filter = FilterPetHits;
}
else if (damage == -5)
filter = FilterNone; //cant filter invulnerable
else
filter = FilterPetMisses;
if (!FromDamageShield)
owner->CastToBot()->GetBotOwner()->CastToClient()->QueuePacket(outapp, true, CLIENT_CONNECTED, filter);
}
}
#endif
skip = owner;
}
else {
@@ -3784,8 +3812,10 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
filter = FilterNone; //cant filter invulnerable
else
filter = FilterMyMisses;
//set to filter duplicate message to the client if client uses #damage to themselves
//if (!attacker->IsClient() && attacker->CastToClient()->GetID() != attacker->GetTarget()->GetID()) {
attacker->CastToClient()->QueuePacket(outapp, true, CLIENT_CONNECTED, filter);
//}
}
}
skip = attacker;
@@ -3809,7 +3839,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
if (!FromDamageShield) {
#ifdef BOTS
// If a bot is the attacker, send a damage message ot the Bot Owner
if (spell_id != SPELL_UNKNOWN && damage > 0 && attacker && attacker != this && attacker->IsBot() && RuleB(Bots, DisplaySpellDamage)) {
if (spell_id != SPELL_UNKNOWN && damage > 0 && !Critical && attacker && attacker != this && attacker->IsBot() && RuleB(Bots, DisplaySpellDamage)) {
attacker->CastToBot()->GetBotOwner()->FilteredMessageString(
attacker->CastToBot()->GetBotOwner(),
Chat::DotDamage,
@@ -3832,7 +3862,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
);
//send the damage to ourself if we are a client
if (IsClient() && spell_id != SPELL_UNKNOWN) { //added !SPELL_UNKNOWN to remove duplicate display for #damage to self
if (IsClient() && this != attacker) { //need to add a filter to remove duplicate display for #damage to self
//I dont think any filters apply to damage affecting us
CastToClient()->QueuePacket(outapp);
}
@@ -3864,7 +3894,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
}
#ifdef BOTS
// If a bot is the attacker, send a damage message ot the Bot Owner
else if (spell_id != SPELL_UNKNOWN && attacker->IsBot() && damage > 0 && attacker && attacker !=this && RuleB(Bots, DisplaySpellDamage)) {
else if (spell_id != SPELL_UNKNOWN && attacker->IsBot() && damage > 0 && !Critical && attacker && attacker != this && RuleB(Bots, DisplaySpellDamage)) {
attacker->CastToBot()->GetBotOwner()->FilteredMessageString(
attacker->CastToBot()->GetBotOwner(),
Chat::DotDamage,
@@ -3875,13 +3905,11 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
attacker->GetCleanName(),
spells[spell_id].name);
}
#endif
}
} //end packet sending
}
void Mob::HealDamage(uint32 amount, Mob* caster, uint16 spell_id)
{
int32 maxhp = GetMaxHP();
+6 -4
View File
@@ -27,6 +27,7 @@
#include "../common/say_link.h"
extern volatile bool is_zone_loaded;
extern bool Critical;
// This constructor is used during the bot create command
Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1) {
@@ -6983,7 +6984,7 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
if (spells[spell_id].targettype == ST_Self)
return value;
bool Critical = false;
Critical = false;
int32 value_BaseEffect = 0;
value_BaseEffect = (value + (value*GetBotFocusEffect(focusFcBaseEffects, spell_id) / 100));
// Need to scale HT damage differently after level 40! It no longer scales by the constant value in the spell file. It scales differently, instead of 10 more damage per level, it does 30 more damage per level. So we multiply the level minus 40 times 20 if they are over level 40.
@@ -7028,8 +7029,9 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5)
value += (GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value) * ratio / 100);
entity_list.MessageClose(this, false, 100, Chat::SpellCrit, "%s delivers a critical blast! (%d)", GetName(), -value);
//Mitch
//if (!RuleB(Bots, DisplaySpellDamage))
entity_list.MessageClose(this, false, 100, Chat::SpellCrit, "%s\'s %s delivers a critical blast to %s! (%d)", GetName(), spells[spell_id].name, target->GetCleanName(), -value);
return value;
}
@@ -7060,7 +7062,7 @@ int32 Bot::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
int32 value_BaseEffect = 0;
int32 chance = 0;
int8 modifier = 1;
bool Critical = false;
Critical = false; //mitch
value_BaseEffect = (value + (value*GetBotFocusEffect(focusFcBaseEffects, spell_id) / 100));
value = value_BaseEffect;
value += int(value_BaseEffect*GetBotFocusEffect(focusImprovedHeal, spell_id) / 100);
+4 -2
View File
@@ -31,6 +31,8 @@
#include "zone_store.h"
#include "position.h"
extern bool Critical; //Mitch
float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard)
{
float extrange = 100;
@@ -48,7 +50,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
if (IsNPC())
value += value*CastToNPC()->GetSpellFocusDMG()/100;
bool Critical = false;
Critical = false; //Mitch removed bool
int32 value_BaseEffect = 0;
int chance = 0;
@@ -268,7 +270,7 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
int32 value_BaseEffect = 0;
int16 chance = 0;
int8 modifier = 1;
bool Critical = false;
Critical = false; //mitch
value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100);
+1
View File
@@ -87,6 +87,7 @@ volatile bool RunLoops = true;
#endif
extern volatile bool is_zone_loaded;
extern bool Critical = false;
EntityList entity_list;
WorldServer worldserver;
+1 -1
View File
@@ -3032,7 +3032,7 @@ void Mob::QuestJournalledSay(Client *QuestInitiator, const char *str, Journal::O
const char *Mob::GetCleanName()
{
if (!strlen(clean_name)) {
if (clean_name != NULL && !strlen(clean_name)) { //extra check added for crash condition. Mitch
CleanMobName(GetName(), clean_name);
}
+26 -1
View File
@@ -3846,8 +3846,24 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r
spelltar->MessageString(Chat::SpellFailure, YOU_RESIST, spells[spell_id].name);
}
else {
#ifndef BOTS
MessageString(Chat::SpellFailure, TARGET_RESISTED, spells[spell_id].name);
spelltar->MessageString(Chat::SpellFailure, YOU_RESIST, spells[spell_id].name);
#endif
#ifdef BOTS
if (this->IsBot() && IsHarmonySpell(spell_id)) {
if (IsGrouped() && this->GetGroup()->GetLeader()->IsClient()) {
Bot::BotGroupSay(this, "Your target RESISTED %s", spells[spell_id].name);
}
else {
this->CastToBot()->GetBotOwner()->MessageString(Chat::SpellFailure, TARGET_RESISTED, spells[spell_id].name);
}
}
else {
MessageString(Chat::SpellFailure, TARGET_RESISTED, spells[spell_id].name);
spelltar->MessageString(Chat::SpellFailure, YOU_RESIST, spells[spell_id].name);
}
#endif
}
if (spelltar->IsAIControlled()) {
@@ -3875,7 +3891,16 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r
return false;
}
}
#ifdef BOTS //Added to display when a HarmonySpell was successful from a bot
if (this->IsBot() && IsHarmonySpell(spell_id)) {
if (IsGrouped() && this->GetGroup()->GetLeader()->IsClient()) {
Bot::BotGroupSay(this, "Your spell was mostly successful.");
}
else {
this->CastToBot()->GetBotOwner()->MessageString(Chat::SpellFailure, SLOW_MOSTLY_SUCCESSFUL);
}
}
#endif
if (spelltar->IsClient()){
spelltar->CastToClient()->BreakSneakWhenCastOn(this, false);
spelltar->CastToClient()->BreakFeignDeathWhenCastOn(false);