diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 000000000..9204f06eb --- /dev/null +++ b/CMakeSettings.json @@ -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": "" + } + ] +} \ No newline at end of file diff --git a/zone/attack.cpp b/zone/attack.cpp index ef6b6e719..c2286d341 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -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 @@ -3401,7 +3402,7 @@ bool Mob::CheckDoubleAttack() return zone->random.Int(1, 500) <= chance; } -void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const EQ::skills::SkillType skill_used, bool &avoidable, const int8 buffslot, const bool iBuffTic, eSpecialAttacks special) { +void Mob::CommonDamage(Mob* attacker, int& damage, const uint16 spell_id, const EQ::skills::SkillType skill_used, bool& avoidable, const int8 buffslot, const bool iBuffTic, eSpecialAttacks special) { // This method is called with skill_used=ABJURE for Damage Shield damage. bool FromDamageShield = (skill_used == EQ::skills::SkillAbjuration); bool ignore_invul = false; @@ -3466,12 +3467,12 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const // emote goes with every one ... even npcs entity_list.MessageClose(this, true, RuleI(Range, SpellMessages), Chat::Emote, "%s beams a smile at %s", attacker->GetCleanName(), this->GetCleanName()); } - + // If a client pet is damaged while sitting, stand, fix sit button, // and remove sitting regen. Removes bug where client clicks sit // during battle and gains pet hp-regen and bugs the sit button. if (IsPet()) { - Mob *owner = this->GetOwner(); + Mob* owner = this->GetOwner(); if (owner && owner->IsClient()) { if (GetPetOrder() == SPO_Sit) { SetPetOrder(SPO_Follow); @@ -3479,28 +3480,28 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const // fix GUI sit button to be unpressed and stop sitting regen owner->CastToClient()->SetPetCommandState(PET_BUTTON_SIT, 0); SetAppearance(eaStanding); - } + } } } //end `if there is some damage being done and theres anattacker person involved` - Mob *pet = GetPet(); + Mob* pet = GetPet(); // pets that have GHold will never automatically add NPCs // pets that have Hold and no Focus will add NPCs if they're engaged // pets that have Hold and Focus will not add NPCs if ( - pet && - !pet->IsFamiliar() && - !pet->GetSpecialAbility(IMMUNE_AGGRO) && - !pet->IsEngaged() && - attacker && - !(pet->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && attacker->IsClient()) && - !(pet->GetSpecialAbility(IMMUNE_AGGRO_NPC) && attacker->IsNPC()) && - attacker != this && - !attacker->IsCorpse() && - !pet->IsGHeld() && + pet && + !pet->IsFamiliar() && + !pet->GetSpecialAbility(IMMUNE_AGGRO) && + !pet->IsEngaged() && + attacker && + !(pet->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && attacker->IsClient()) && + !(pet->GetSpecialAbility(IMMUNE_AGGRO_NPC) && attacker->IsNPC()) && + attacker != this && + !attacker->IsCorpse() && + !pet->IsGHeld() && !attacker->IsTrap() - ) { + ) { if (!pet->IsHeld()) { LogAggro("Sending pet [{}] into battle due to attack", pet->GetName()); if (IsClient()) { @@ -3720,12 +3721,12 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const //Note: if players can become pets, they will not receive damage messages of their own //this was done to simplify the code here (since we can only effectively skip one mob on queue) eqFilterType filter; - Mob *skip = attacker; + Mob* skip = attacker; if (attacker && attacker->GetOwnerID()) { //attacker is a pet, let pet owners see their pet's damage Mob* owner = attacker->GetOwner(); if (owner && owner->IsClient()) { - if (((spell_id != SPELL_UNKNOWN) || (FromDamageShield)) && damage>0) { + if (((spell_id != SPELL_UNKNOWN) || (FromDamageShield)) && damage > 0) { //special crap for spell damage, looks hackish to me char val1[20] = { 0 }; owner->MessageString(Chat::NonMelee, OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1)); @@ -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; @@ -3808,14 +3838,14 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const // we don't send them here. 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 a bot is the attacker, send a damage message ot the Bot Owner + 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, + attacker->CastToBot()->GetBotOwner(), + Chat::DotDamage, FilterDOT, - OTHER_HIT_DOT, - attacker->GetTarget()->GetCleanName(), + OTHER_HIT_DOT, + attacker->GetTarget()->GetCleanName(), itoa(damage), attacker->GetCleanName(), spells[spell_id].name); @@ -3829,10 +3859,10 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const skip, /* Skip this mob */ true, /* Packet ACK */ filter /* eqFilterType filter */ - ); + ); //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,23 +3894,21 @@ 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)) { - attacker->CastToBot()->GetBotOwner()->FilteredMessageString( - attacker->CastToBot()->GetBotOwner(), - Chat::DotDamage, - FilterDOT, - OTHER_HIT_DOT, - attacker->GetTarget()->GetCleanName(), - itoa(damage), - attacker->GetCleanName(), - spells[spell_id].name); - } - + 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, + FilterDOT, + OTHER_HIT_DOT, + attacker->GetTarget()->GetCleanName(), + itoa(damage), + attacker->GetCleanName(), + spells[spell_id].name); + } #endif + } - } //end packet sending - -} +} //end packet sending void Mob::HealDamage(uint32 amount, Mob* caster, uint16 spell_id) { diff --git a/zone/bot.cpp b/zone/bot.cpp index 59bdf9788..2ac70c6ea 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -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); diff --git a/zone/effects.cpp b/zone/effects.cpp index b62a2b383..f7f5f9863 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -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); diff --git a/zone/main.cpp b/zone/main.cpp index dc708a517..b0d1a9f4d 100644 --- a/zone/main.cpp +++ b/zone/main.cpp @@ -87,6 +87,7 @@ volatile bool RunLoops = true; #endif extern volatile bool is_zone_loaded; +extern bool Critical = false; EntityList entity_list; WorldServer worldserver; diff --git a/zone/mob.cpp b/zone/mob.cpp index dbee488e5..efaf619ef 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -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); } diff --git a/zone/spells.cpp b/zone/spells.cpp index b4e001ad2..f1000dfd4 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -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);