@@ -695,34 +695,22 @@ bool ZoneDifficulty::VectorContainsUint32(std::vector<uint32> vec, uint32 elemen
695
695
bool ZoneDifficulty::ShouldNerfInDuels (Unit* target)
696
696
{
697
697
if (target->GetAreaId () != DUEL_AREA)
698
- {
699
698
return false ;
700
- }
701
699
702
700
if (target->ToTempSummon () && target->ToTempSummon ()->GetSummoner ())
703
- {
704
701
target = target->ToTempSummon ()->GetSummoner ()->ToUnit ();
705
- }
706
702
707
703
if (!target->GetAffectingPlayer ())
708
- {
709
704
return false ;
710
- }
711
705
712
706
if (!target->GetAffectingPlayer ()->duel )
713
- {
714
707
return false ;
715
- }
716
708
717
709
if (target->GetAffectingPlayer ()->duel ->State != DUEL_STATE_IN_PROGRESS)
718
- {
719
710
return false ;
720
- }
721
711
722
712
if (!target->GetAffectingPlayer ()->duel ->Opponent )
723
- {
724
713
return false ;
725
- }
726
714
727
715
return true ;
728
716
}
@@ -750,7 +738,6 @@ int32 ZoneDifficulty::GetLowestMatchingPhase(uint32 mapId, uint32 phaseMask)
750
738
return 0 ;
751
739
}
752
740
753
- // Check all $key in [mapId][$key] if they match the target's visible phases
754
741
for (auto const & [key, value] : sZoneDifficulty ->NerfInfo [mapId])
755
742
{
756
743
if (key & phaseMask)
@@ -767,42 +754,36 @@ int32 ZoneDifficulty::GetLowestMatchingPhase(uint32 mapId, uint32 phaseMask)
767
754
* zone_difficulty_instance_saves is used to store the data.
768
755
*
769
756
* @param InstanceID INT NOT NULL DEFAULT 0,
770
- * @param MythicmodeOn TINYINT NOT NULL DEFAULT 0,
771
757
*/
772
758
void ZoneDifficulty::SaveMythicmodeInstanceData (uint32 instanceId)
773
759
{
774
760
if (sZoneDifficulty ->MythicmodeInstanceData .find (instanceId) == sZoneDifficulty ->MythicmodeInstanceData .end ())
775
761
{
776
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: ZoneDifficulty::SaveMythicmodeInstanceData: InstanceId {} not found in MythicmodeInstanceData.", instanceId);
777
762
return ;
778
763
}
779
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: ZoneDifficulty::SaveMythicmodeInstanceData: Saving instanceId {} with MythicmodeOn {}", instanceId, sZoneDifficulty->MythicmodeInstanceData[instanceId]);
780
764
CharacterDatabase.Execute (" REPLACE INTO zone_difficulty_instance_saves (InstanceID, MythicmodeOn) VALUES ({}, {})" , instanceId, sZoneDifficulty ->MythicmodeInstanceData [instanceId]);
781
765
}
782
766
783
767
void ZoneDifficulty::MythicmodeEvent (Unit* unit, uint32 entry, uint32 key)
784
768
{
785
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: MythicmodeEvent for entry {} with key {}", entry, key);
786
769
if (unit && unit->IsAlive ())
787
770
{
788
771
if (!unit->IsInCombat ())
789
772
{
790
773
unit->m_Events .CancelEventGroup (EVENT_GROUP);
791
774
return ;
792
775
}
793
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: MythicmodeEvent IsInCombat for entry {} with key {}", entry, key);
776
+
794
777
// Try again in 1s if the unit is currently casting
795
778
if (unit->HasUnitState (UNIT_STATE_CASTING))
796
779
{
797
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: MythicmodeEvent Re-schedule AI event in 1s because unit is casting for entry {} with key {}", entry, key);
798
780
unit->m_Events .AddEventAtOffset ([unit, entry, key]()
799
781
{
800
782
sZoneDifficulty ->MythicmodeEvent (unit, entry, key);
801
783
}, 1s, EVENT_GROUP);
802
784
return ;
803
785
}
804
786
805
- // Re-schedule the event
806
787
if (sZoneDifficulty ->MythicmodeAI [entry][key].Repetitions == 0 )
807
788
{
808
789
unit->m_Events .AddEventAtOffset ([unit, entry, key]()
@@ -816,7 +797,6 @@ void ZoneDifficulty::MythicmodeEvent(Unit* unit, uint32 entry, uint32 key)
816
797
bool has_bp1 = mythicAI.Spellbp1 ;
817
798
bool has_bp2 = mythicAI.Spellbp2 ;
818
799
819
- // Multiple targets
820
800
if (mythicAI.Target == TARGET_PLAYER_DISTANCE)
821
801
{
822
802
auto const & threatlist = unit->GetThreatMgr ().GetThreatList ();
@@ -825,24 +805,18 @@ void ZoneDifficulty::MythicmodeEvent(Unit* unit, uint32 entry, uint32 key)
825
805
{
826
806
Unit* target = (*itr)->getTarget ();
827
807
if (!unit->IsWithinDist (target, mythicAI.TargetArg ))
828
- {
829
808
continue ;
830
- }
831
809
832
810
std::string targetName = target ? target->GetName () : " NoTarget" ;
833
811
if (!has_bp0 && !has_bp1 && !has_bp2)
834
- {
835
812
unit->CastSpell (target, mythicAI.Spell , mythicAI.TriggeredCast );
836
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Creature casting MythicmodeAI spell: {} at target {}", mythicAI.Spell, targetName);
837
- }
838
813
else
839
814
{
840
815
unit->CastCustomSpell (target, mythicAI.Spell ,
841
816
has_bp0 ? &mythicAI.Spellbp0 : NULL ,
842
817
has_bp1 ? &mythicAI.Spellbp1 : NULL ,
843
818
has_bp2 ? &mythicAI.Spellbp2 : NULL ,
844
819
mythicAI.TriggeredCast );
845
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Creature casting MythicmodeAI spell: {} at target {} with custom values.", mythicAI.Spell, targetName);
846
820
}
847
821
}
848
822
return ;
@@ -851,13 +825,9 @@ void ZoneDifficulty::MythicmodeEvent(Unit* unit, uint32 entry, uint32 key)
851
825
// Select target
852
826
Unit* target = nullptr ;
853
827
if (mythicAI.Target == TARGET_SELF)
854
- {
855
828
target = unit;
856
- }
857
829
else if (mythicAI.Target == TARGET_VICTIM)
858
- {
859
830
target = unit->GetVictim ();
860
- }
861
831
else
862
832
{
863
833
switch (mythicAI.Target )
@@ -866,46 +836,36 @@ void ZoneDifficulty::MythicmodeEvent(Unit* unit, uint32 entry, uint32 key)
866
836
{
867
837
float range = 200 .0f ;
868
838
if (mythicAI.TargetArg > 0 )
869
- {
870
839
range = mythicAI.TargetArg ;
871
- }
840
+
872
841
target = unit->GetAI ()->SelectTarget (SelectTargetMethod::MaxThreat, mythicAI.TargetArg2 , range, true );
873
842
874
843
if (!target)
875
- {
876
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Fall-back to GetVictim()");
877
844
target = unit->GetVictim ();
878
- }
879
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Selecting target type TARGET_HOSTILE_AGGRO_FROM_TOP with range TargetArg {} and position on threat-list TargetArg2 {}.", mythicAI.TargetArg, range);
845
+
880
846
break ;
881
847
}
882
848
case TARGET_HOSTILE_AGGRO_FROM_BOTTOM:
883
849
{
884
850
float range = 200 .0f ;
885
851
if (mythicAI.TargetArg2 > 0 )
886
- {
887
852
range = mythicAI.TargetArg2 ;
888
- }
853
+
889
854
target = unit->GetAI ()->SelectTarget (SelectTargetMethod::MinThreat, mythicAI.TargetArg , range, true );
890
855
891
856
if (!target)
892
- {
893
- // LOG_INFO("module", "Fall-back to GetVictim()");
894
857
target = unit->GetVictim ();
895
- }
896
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Selecting target type TARGET_HOSTILE_AGGRO_FROM_TOP with range TargetArg {} and position on threat-list TargetArg2 {}.", mythicAI.TargetArg, range);
858
+
897
859
break ;
898
860
}
899
861
case TARGET_HOSTILE_RANDOM:
900
862
{
901
863
target = unit->GetAI ()->SelectTarget (SelectTargetMethod::Random, 0 , mythicAI.TargetArg , true );
902
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Selecting target type TARGET_HOSTILE_RANDOM with max range {}.", mythicAI.TargetArg);
903
864
break ;
904
- }
865
+ }
905
866
case TARGET_HOSTILE_RANDOM_NOT_TOP:
906
867
{
907
868
target = unit->GetAI ()->SelectTarget (SelectTargetMethod::Random, 0 , mythicAI.TargetArg , true , false );
908
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Selecting target type TARGET_HOSTILE_RANDOM_NOT_TOP with max range {}.", mythicAI.TargetArg);
909
869
break ;
910
870
}
911
871
default :
@@ -921,16 +881,12 @@ void ZoneDifficulty::MythicmodeEvent(Unit* unit, uint32 entry, uint32 key)
921
881
if (mythicAI.TargetArg > 0 )
922
882
{
923
883
if (unit->IsInRange (victim, 0 , mythicAI.TargetArg , true ))
924
- {
925
884
target = victim;
926
- }
927
885
}
928
886
else if (mythicAI.TargetArg < 0 )
929
887
{
930
888
if (unit->IsInRange (victim, mythicAI.TargetArg , 0 , true ))
931
- {
932
889
target = victim;
933
- }
934
890
}
935
891
936
892
}
@@ -942,7 +898,6 @@ void ZoneDifficulty::MythicmodeEvent(Unit* unit, uint32 entry, uint32 key)
942
898
if (!has_bp0 && !has_bp1 && !has_bp2)
943
899
{
944
900
unit->CastSpell (target, mythicAI.Spell , mythicAI.TriggeredCast );
945
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Creature casting MythicmodeAI spell: {} at target {}", mythicAI.Spell, targetName);
946
901
}
947
902
else
948
903
{
@@ -951,7 +906,6 @@ void ZoneDifficulty::MythicmodeEvent(Unit* unit, uint32 entry, uint32 key)
951
906
has_bp1 ? &mythicAI.Spellbp1 : NULL ,
952
907
has_bp2 ? &mythicAI.Spellbp2 : NULL ,
953
908
mythicAI.TriggeredCast );
954
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Creature casting MythicmodeAI spell: {} at target {} with custom values.", mythicAI.Spell, targetName);
955
909
}
956
910
}
957
911
else
@@ -963,7 +917,6 @@ void ZoneDifficulty::MythicmodeEvent(Unit* unit, uint32 entry, uint32 key)
963
917
964
918
bool ZoneDifficulty::HasCompletedFullTier (uint32 category, uint32 playerGuid)
965
919
{
966
- // LOG_INFO("module", "MOD-ZONE-DIFFCULTY: Executing HasCompletedFullTier for category {} playerGUID {}.", category, playerGuid);
967
920
std::vector<uint32> MapList;
968
921
switch (category)
969
922
{
@@ -988,7 +941,6 @@ bool ZoneDifficulty::HasCompletedFullTier(uint32 category, uint32 playerGuid)
988
941
989
942
for (uint32 mapId : MapList)
990
943
{
991
- // LOG_INFO("module", "MOD-ZONE-DIFFCULTY: Checking HasCompletedFullTier for mapId {}.", mapId);
992
944
if (sZoneDifficulty ->EncounterCounter .find (mapId) == sZoneDifficulty ->EncounterCounter .end ())
993
945
{
994
946
LOG_ERROR (" module" , " MOD-ZONE-DIFFICULTY: Map without data requested in ZoneDifficulty::HasCompletedFullTier {}" , mapId);
@@ -1005,7 +957,6 @@ bool ZoneDifficulty::HasCompletedFullTier(uint32 category, uint32 playerGuid)
1005
957
1006
958
void ZoneDifficulty::RewardItem (Player* player, uint8 category, uint8 itemType, uint8 counter, Creature* creature, uint32 itemEntry)
1007
959
{
1008
- // Check (again) if the player has enough score in the respective category.
1009
960
uint32 availableScore = player->GetPlayerSetting (ModZoneDifficultyString + " score" , category).value ;
1010
961
1011
962
auto reward = sZoneDifficulty ->Rewards [category][itemType][counter];
@@ -1045,7 +996,6 @@ void ZoneDifficulty::RewardItem(Player* player, uint8 category, uint8 itemType,
1045
996
return ;
1046
997
}
1047
998
1048
- // Check if the player has the neccesary achievement
1049
999
if (reward.Achievement )
1050
1000
{
1051
1001
if (!player->HasAchieved (reward.Achievement ))
@@ -1059,7 +1009,6 @@ void ZoneDifficulty::RewardItem(Player* player, uint8 category, uint8 itemType,
1059
1009
}
1060
1010
}
1061
1011
1062
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Sending item with category {}, itemType {}, counter {}", category, itemType, counter);
1063
1012
sZoneDifficulty ->DeductMythicmodeScore (player, category, reward.Price );
1064
1013
sZoneDifficulty ->SendItem (player, reward);
1065
1014
0 commit comments