diff --git a/zone/bot.cpp b/zone/bot.cpp index ba7624158..48a4dfe55 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3459,6 +3459,9 @@ void Bot::AI_Process() { return; } + if (!(m_PlayerState & static_cast(PlayerState::Aggressive))) + SendAddPlayerState(PlayerState::Aggressive); + bool atCombatRange = false; float meleeDistance = GetMaxMeleeRangeToTarget(GetTarget()); @@ -3717,6 +3720,9 @@ void Bot::AI_Process() { // Not engaged in combat SetTarget(0); + if (m_PlayerState & static_cast(PlayerState::Aggressive)) + SendRemovePlayerState(PlayerState::Aggressive); + if(!IsMoving() && AIthink_timer->Check() && !spellend_timer.Enabled()) { if(GetBotStance() != BotStancePassive) { if(!AI_IdleCastCheck() && !IsCasting()) diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 3170729d0..e3014b12e 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -58,7 +58,7 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite if(max_cash > 0 && lts->avgcoin > 0 && EQEmu::ValueWithin(lts->avgcoin, min_cash, max_cash)) { float upper_chance = (float)(lts->avgcoin - min_cash) / (float)(max_cash - min_cash); float avg_cash_roll = (float)zone->random.Real(0.0, 1.0); - + if(avg_cash_roll < upper_chance) { cash = zone->random.Int(lts->avgcoin, max_cash); } else { @@ -120,7 +120,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml for(int j = 0; j < charges; ++j) { if(zone->random.Real(0.0, 100.0) <= lds->Entries[i].chance) { const Item_Struct* dbitem = GetItem(lds->Entries[i].item_id); - npc->AddLootDrop(dbitem, itemlist, lds->Entries[i].item_charges, lds->Entries[i].minlevel, + npc->AddLootDrop(dbitem, itemlist, lds->Entries[i].item_charges, lds->Entries[i].minlevel, lds->Entries[i].maxlevel, lds->Entries[i].equip_item > 0 ? true : false, false); } } @@ -332,6 +332,8 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge CastToMob()->AddProcToWeapon(item2->Proc.Effect, true); eslot = MaterialPrimary; + if (item2->Damage > 0) + SendAddPlayerState(PlayerState::PrimaryWeaponEquipped); } else if (foundslot == MainSecondary && (GetOwner() != nullptr || (GetLevel() >= 13 && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) && @@ -342,6 +344,8 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge CastToMob()->AddProcToWeapon(item2->Proc.Effect, true); eslot = MaterialSecondary; + if (item2->Damage > 0) + SendAddPlayerState(PlayerState::SecondaryWeaponEquipped); } else if (foundslot == MainHead) { eslot = MaterialHead; diff --git a/zone/merc.cpp b/zone/merc.cpp index 73f6b1fbf..5f06331fa 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1468,6 +1468,9 @@ void Merc::AI_Process() { return; } + if (!(m_PlayerState & static_cast(PlayerState::Aggressive))) + SendAddPlayerState(PlayerState::Aggressive); + bool atCombatRange = false; float meleeDistance = GetMaxMeleeRangeToTarget(GetTarget()); @@ -1681,6 +1684,9 @@ void Merc::AI_Process() { confidence_timer.Disable(); _check_confidence = false; + if (m_PlayerState & static_cast(PlayerState::Aggressive)) + SendRemovePlayerState(PlayerState::Aggressive); + if(!check_target_timer.Enabled()) check_target_timer.Start(2000, false); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 452ca71fd..020c833e8 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1084,6 +1084,8 @@ void Mob::AI_Process() { if (engaged) { + if (!(m_PlayerState & static_cast(PlayerState::Aggressive))) + SendAddPlayerState(PlayerState::Aggressive); // we are prevented from getting here if we are blind and don't have a target in range // from above, so no extra blind checks needed if ((IsRooted() && !GetSpecialAbility(IGNORE_ROOT_AGGRO_RULES)) || IsBlind()) @@ -1435,6 +1437,8 @@ void Mob::AI_Process() { } else { + if (m_PlayerState & static_cast(PlayerState::Aggressive)) + SendRemovePlayerState(PlayerState::Aggressive); if(AIfeignremember_timer->Check()) { // 6/14/06 // Improved Feign Death Memory