Core/Loot: Set loot dungeon encounter id before generating
Port From (https://github.com/TrinityCore/TrinityCore/commit/5f1a4cf9044d9ad65b49eb859ec36e1f62c2be10)
This commit is contained in:
@@ -547,16 +547,7 @@ namespace Game.AI
|
|||||||
summons.DespawnAll();
|
summons.DespawnAll();
|
||||||
_scheduler.CancelAll();
|
_scheduler.CancelAll();
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
{
|
|
||||||
if (me.loot != null)
|
|
||||||
{
|
|
||||||
DungeonEncounterRecord dungeonEncounter = instance.GetBossDungeonEncounter(_bossId);
|
|
||||||
if (dungeonEncounter != null)
|
|
||||||
me.loot.SetDungeonEncounterId(dungeonEncounter.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
instance.SetBossState(_bossId, EncounterState.Done);
|
instance.SetBossState(_bossId, EncounterState.Done);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _JustEngagedWith(Unit who)
|
public void _JustEngagedWith(Unit who)
|
||||||
@@ -587,7 +578,7 @@ namespace Game.AI
|
|||||||
{
|
{
|
||||||
Unit target = pair.Value.GetOther(me);
|
Unit target = pair.Value.GetOther(me);
|
||||||
if (target.IsControlledByPlayer() && !IsInBoundary(target))
|
if (target.IsControlledByPlayer() && !IsInBoundary(target))
|
||||||
target.NearTeleportTo(x, y, z, 0);
|
target.NearTeleportTo(x, y, z, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -689,6 +680,8 @@ namespace Game.AI
|
|||||||
public override bool CanAIAttack(Unit victim) { return IsInBoundary(victim); }
|
public override bool CanAIAttack(Unit victim) { return IsInBoundary(victim); }
|
||||||
|
|
||||||
public void _JustReachedHome() { me.SetActive(false); }
|
public void _JustReachedHome() { me.SetActive(false); }
|
||||||
|
|
||||||
|
public uint GetBossId() { return _bossId; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WorldBossAI : ScriptedAI
|
public class WorldBossAI : ScriptedAI
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Game.AI;
|
|||||||
using Game.BattleFields;
|
using Game.BattleFields;
|
||||||
using Game.BattleGrounds;
|
using Game.BattleGrounds;
|
||||||
using Game.Combat;
|
using Game.Combat;
|
||||||
|
using Game.DataStorage;
|
||||||
using Game.Groups;
|
using Game.Groups;
|
||||||
using Game.Loots;
|
using Game.Loots;
|
||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
@@ -778,6 +779,14 @@ namespace Game.Entities
|
|||||||
if (creature.GetMap().Is25ManRaid())
|
if (creature.GetMap().Is25ManRaid())
|
||||||
loot.maxDuplicates = 3;
|
loot.maxDuplicates = 3;
|
||||||
|
|
||||||
|
InstanceScript instance = creature.GetInstanceScript();
|
||||||
|
if (instance != null)
|
||||||
|
{
|
||||||
|
DungeonEncounterRecord dungeonEncounter = instance.GetBossDungeonEncounter(creature);
|
||||||
|
if (dungeonEncounter != null)
|
||||||
|
loot.SetDungeonEncounterId(dungeonEncounter.Id);
|
||||||
|
}
|
||||||
|
|
||||||
uint lootid = creature.GetCreatureTemplate().LootId;
|
uint lootid = creature.GetCreatureTemplate().LootId;
|
||||||
if (lootid != 0)
|
if (lootid != 0)
|
||||||
loot.FillLoot(lootid, LootStorage.Creature, looter, false, false, creature.GetLootMode(), creature.GetMap().GetDifficultyLootItemContext());
|
loot.FillLoot(lootid, LootStorage.Creature, looter, false, false, creature.GetLootMode(), creature.GetMap().GetDifficultyLootItemContext());
|
||||||
|
|||||||
@@ -16,18 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Framework.Database;
|
using Game.AI;
|
||||||
using Framework.IO;
|
|
||||||
using Game.DataStorage;
|
using Game.DataStorage;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Groups;
|
using Game.Groups;
|
||||||
using Game.Networking.Packets;
|
using Game.Networking.Packets;
|
||||||
using Game.Scenarios;
|
|
||||||
using Game.Spells;
|
using Game.Spells;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Game.Maps
|
namespace Game.Maps
|
||||||
{
|
{
|
||||||
@@ -704,6 +701,15 @@ namespace Game.Maps
|
|||||||
return id < bosses.Count ? bosses[id].GetDungeonEncounterForDifficulty(instance.GetDifficultyID()) : null;
|
return id < bosses.Count ? bosses[id].GetDungeonEncounterForDifficulty(instance.GetDifficultyID()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DungeonEncounterRecord GetBossDungeonEncounter(Creature creature)
|
||||||
|
{
|
||||||
|
BossAI bossAi = (BossAI)creature.GetAI();
|
||||||
|
if (bossAi != null)
|
||||||
|
return GetBossDungeonEncounter(bossAi.GetBossId());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool CheckAchievementCriteriaMeet(uint criteria_id, Player source, Unit target = null, uint miscvalue1 = 0)
|
public virtual bool CheckAchievementCriteriaMeet(uint criteria_id, Player source, Unit target = null, uint miscvalue1 = 0)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Server, "Achievement system call CheckAchievementCriteriaMeet but instance script for map {0} not have implementation for achievement criteria {1}",
|
Log.outError(LogFilter.Server, "Achievement system call CheckAchievementCriteriaMeet but instance script for map {0} not have implementation for achievement criteria {1}",
|
||||||
|
|||||||
@@ -1259,6 +1259,7 @@ namespace Game.Spells
|
|||||||
loot = new(gameObjTarget.GetMap(), guid, loottype, groupRules ? group : null);
|
loot = new(gameObjTarget.GetMap(), guid, loottype, groupRules ? group : null);
|
||||||
gameObjTarget.loot = loot;
|
gameObjTarget.loot = loot;
|
||||||
|
|
||||||
|
loot.SetDungeonEncounterId(gameObjTarget.GetGoInfo().Chest.DungeonEncounter);
|
||||||
loot.FillLoot(lootId, LootStorage.Gameobject, player, !groupRules, false, gameObjTarget.GetLootMode(), gameObjTarget.GetMap().GetDifficultyLootItemContext());
|
loot.FillLoot(lootId, LootStorage.Gameobject, player, !groupRules, false, gameObjTarget.GetLootMode(), gameObjTarget.GetMap().GetDifficultyLootItemContext());
|
||||||
|
|
||||||
if (gameObjTarget.GetLootMode() > 0)
|
if (gameObjTarget.GetLootMode() > 0)
|
||||||
@@ -1267,8 +1268,6 @@ namespace Game.Spells
|
|||||||
if (addon != null)
|
if (addon != null)
|
||||||
loot.GenerateMoneyLoot(addon.Mingold, addon.Maxgold);
|
loot.GenerateMoneyLoot(addon.Mingold, addon.Maxgold);
|
||||||
}
|
}
|
||||||
|
|
||||||
loot.SetDungeonEncounterId(gameObjTarget.GetGoInfo().Chest.DungeonEncounter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @todo possible must be moved to loot release (in different from linked triggering)
|
/// @todo possible must be moved to loot release (in different from linked triggering)
|
||||||
|
|||||||
Reference in New Issue
Block a user