Core/Spells: Implemented personal summons

This commit is contained in:
hondacrx
2018-04-08 18:50:05 -04:00
parent 7c8f9d5d15
commit c69c715cc0
10 changed files with 81 additions and 18 deletions
+15 -4
View File
@@ -1719,8 +1719,19 @@ namespace Game.Entities
WorldObject viewpoint = this;
Player player = ToPlayer();
if (player != null)
{
viewpoint = player.GetViewpoint();
Creature creature = obj.ToCreature();
if (creature)
{
TempSummon tempSummon = creature.ToTempSummon();
if (tempSummon)
if (tempSummon.IsVisibleBySummonerOnly() && GetGUID() != tempSummon.GetSummonerGUID())
return false;
}
}
if (viewpoint == null)
viewpoint = this;
@@ -1990,7 +2001,7 @@ namespace Game.Entities
return null;
}
public TempSummon SummonCreature(uint id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TempSummonType.ManualDespawn, uint despwtime = 0)
public TempSummon SummonCreature(uint id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TempSummonType.ManualDespawn, uint despwtime = 0, bool visibleBySummonerOnly = false)
{
if (x == 0.0f && y == 0.0f && z == 0.0f)
{
@@ -1999,15 +2010,15 @@ namespace Game.Entities
}
Position pos = new Position();
pos.Relocate(x, y, z, ang);
return SummonCreature(id, pos, spwtype, despwtime, 0);
return SummonCreature(id, pos, spwtype, despwtime, 0, visibleBySummonerOnly);
}
public TempSummon SummonCreature(uint entry, Position pos, TempSummonType spwtype = TempSummonType.ManualDespawn, uint duration = 0, uint vehId = 0)
public TempSummon SummonCreature(uint entry, Position pos, TempSummonType spwtype = TempSummonType.ManualDespawn, uint duration = 0, uint vehId = 0, bool visibleBySummonerOnly = false)
{
Map map = GetMap();
if (map != null)
{
TempSummon summon = map.SummonCreature(entry, pos, null, duration, isTypeMask(TypeMask.Unit) ? ToUnit() : null);
TempSummon summon = map.SummonCreature(entry, pos, null, duration, ToUnit(), 0, vehId, visibleBySummonerOnly);
if (summon != null)
{
summon.SetTempSummonType(spwtype);
+2 -1
View File
@@ -1716,7 +1716,8 @@ namespace Game.Entities
void CastAllObtainSpells()
{
for (byte slot = InventorySlots.ItemStart; slot < InventorySlots.ItemEnd; ++slot)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte slot = InventorySlots.ItemStart; slot < inventoryEnd; ++slot)
{
Item item = GetItemByPos(InventorySlots.Bag0, slot);
if (item)
+3
View File
@@ -4501,6 +4501,9 @@ namespace Game.Entities
// update visibility
UpdateObjectVisibility();
// recast lost by death auras of any items held in the inventory
CastAllObtainSpells();
if (!applySickness)
return;
+4
View File
@@ -296,11 +296,15 @@ namespace Game.Entities
public uint GetTimer() { return m_timer; }
public void SetVisibleBySummonerOnly(bool visibleBySummonerOnly) { m_visibleBySummonerOnly = visibleBySummonerOnly; }
public bool IsVisibleBySummonerOnly() { return m_visibleBySummonerOnly; }
public SummonPropertiesRecord m_Properties;
TempSummonType m_type;
uint m_timer;
uint m_lifetime;
ObjectGuid m_summonerGUID;
bool m_visibleBySummonerOnly;
}
public class Minion : TempSummon