Core/Gossip: Drop OptionNpcFlag from gossip_menu_option
Port From (https://github.com/TrinityCore/TrinityCore/commit/ba49dbfdcbbbee4d6be39284c6924bf56d7f6586)
This commit is contained in:
@@ -731,7 +731,6 @@ namespace Game.Misc
|
||||
public GossipOptionNpc OptionNpc;
|
||||
public string OptionText;
|
||||
public uint OptionBroadcastTextId;
|
||||
public NPCFlags OptionNpcFlag;
|
||||
public uint Language;
|
||||
public uint ActionMenuId;
|
||||
public uint ActionPoiId;
|
||||
|
||||
@@ -2308,12 +2308,9 @@ namespace Game.Entities
|
||||
|
||||
var menuItemBounds = Global.ObjectMgr.GetGossipMenuItemsMapBounds(menuId);
|
||||
|
||||
NPCFlags npcflags = 0;
|
||||
|
||||
if (source.IsTypeId(TypeId.Unit))
|
||||
{
|
||||
npcflags = (NPCFlags)(((ulong)(source.ToUnit().m_unitData.NpcFlags[1]) << 32) | source.ToUnit().m_unitData.NpcFlags[0]);
|
||||
if (Convert.ToBoolean(npcflags & NPCFlags.QuestGiver) && showQuests)
|
||||
if (showQuests && source.ToUnit().IsQuestGiver())
|
||||
PrepareQuestMenu(source.GetGUID());
|
||||
}
|
||||
else if (source.IsTypeId(TypeId.GameObject))
|
||||
@@ -2330,9 +2327,6 @@ namespace Game.Entities
|
||||
Creature creature = source.ToCreature();
|
||||
if (creature)
|
||||
{
|
||||
if (!gossipMenuItem.OptionNpcFlag.HasAnyFlag(npcflags))
|
||||
continue;
|
||||
|
||||
switch (gossipMenuItem.OptionNpc)
|
||||
{
|
||||
case GossipOptionNpc.TaxiNode:
|
||||
|
||||
@@ -579,8 +579,8 @@ namespace Game
|
||||
|
||||
gossipMenuItemsStorage.Clear();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||
SQLResult result = DB.World.Query("SELECT MenuID, OptionID, OptionNpc, OptionText, OptionBroadcastTextID, OptionNpcFlag, Language, ActionMenuID, ActionPoiID, BoxCoded, BoxMoney, BoxText, BoxBroadcastTextID " +
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
SQLResult result = DB.World.Query("SELECT MenuID, OptionID, OptionNpc, OptionText, OptionBroadcastTextID, Language, ActionMenuID, ActionPoiID, BoxCoded, BoxMoney, BoxText, BoxBroadcastTextID " +
|
||||
"FROM gossip_menu_option ORDER BY MenuID, OptionID");
|
||||
|
||||
if (result.IsEmpty())
|
||||
@@ -598,14 +598,13 @@ namespace Game
|
||||
gMenuItem.OptionNpc = (GossipOptionNpc)result.Read<byte>(2);
|
||||
gMenuItem.OptionText = result.Read<string>(3);
|
||||
gMenuItem.OptionBroadcastTextId = result.Read<uint>(4);
|
||||
gMenuItem.OptionNpcFlag = (NPCFlags)result.Read<ulong>(5);
|
||||
gMenuItem.Language = result.Read<uint>(6);
|
||||
gMenuItem.ActionMenuId = result.Read<uint>(7);
|
||||
gMenuItem.ActionPoiId = result.Read<uint>(8);
|
||||
gMenuItem.BoxCoded = result.Read<bool>(9);
|
||||
gMenuItem.BoxMoney = result.Read<uint>(10);
|
||||
gMenuItem.BoxText = result.Read<string>(11);
|
||||
gMenuItem.BoxBroadcastTextId = result.Read<uint>(12);
|
||||
gMenuItem.Language = result.Read<uint>(5);
|
||||
gMenuItem.ActionMenuId = result.Read<uint>(6);
|
||||
gMenuItem.ActionPoiId = result.Read<uint>(7);
|
||||
gMenuItem.BoxCoded = result.Read<bool>(8);
|
||||
gMenuItem.BoxMoney = result.Read<uint>(9);
|
||||
gMenuItem.BoxText = result.Read<string>(10);
|
||||
gMenuItem.BoxBroadcastTextId = result.Read<uint>(11);
|
||||
|
||||
if (gMenuItem.OptionNpc >= GossipOptionNpc.Max)
|
||||
{
|
||||
|
||||
@@ -403,6 +403,7 @@ namespace Scripts.World.NpcSpecial
|
||||
public const uint AuraDurationTimeLeft = 30000;
|
||||
|
||||
//Argent squire/gruntling
|
||||
public const uint AchievementPonyUp = 3736;
|
||||
public static Tuple<uint, uint>[] bannerSpells =
|
||||
{
|
||||
Tuple.Create(SpellIds.DarnassusPennant, SpellIds.SenjinPennant),
|
||||
@@ -1354,7 +1355,7 @@ namespace Scripts.World.NpcSpecial
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Script]
|
||||
class npc_training_dummy : NullCreatureAI
|
||||
{
|
||||
@@ -1366,7 +1367,7 @@ namespace Scripts.World.NpcSpecial
|
||||
{
|
||||
_combatTimer[who.GetGUID()] = TimeSpan.FromSeconds(5);
|
||||
}
|
||||
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
|
||||
{
|
||||
damage = 0;
|
||||
@@ -1647,46 +1648,46 @@ namespace Scripts.World.NpcSpecial
|
||||
switch (_nextAction)
|
||||
{
|
||||
case TrainWrecker.EventDoJump:
|
||||
{
|
||||
GameObject target = VerifyTarget();
|
||||
if (target)
|
||||
me.GetMotionMaster().MoveJump(target, 5.0f, 10.0f, TrainWrecker.MoveidJump);
|
||||
_nextAction = 0;
|
||||
}
|
||||
break;
|
||||
{
|
||||
GameObject target = VerifyTarget();
|
||||
if (target)
|
||||
me.GetMotionMaster().MoveJump(target, 5.0f, 10.0f, TrainWrecker.MoveidJump);
|
||||
_nextAction = 0;
|
||||
}
|
||||
break;
|
||||
case TrainWrecker.EventDoFacing:
|
||||
{
|
||||
GameObject target = VerifyTarget();
|
||||
if (target)
|
||||
{
|
||||
GameObject target = VerifyTarget();
|
||||
if (target)
|
||||
{
|
||||
me.SetFacingTo(target.GetOrientation());
|
||||
me.HandleEmoteCommand(Emote.OneshotAttack1h);
|
||||
_timer = (uint)(1.5 * Time.InMilliseconds);
|
||||
_nextAction = TrainWrecker.EventDoWreck;
|
||||
}
|
||||
else
|
||||
_nextAction = 0;
|
||||
me.SetFacingTo(target.GetOrientation());
|
||||
me.HandleEmoteCommand(Emote.OneshotAttack1h);
|
||||
_timer = (uint)(1.5 * Time.InMilliseconds);
|
||||
_nextAction = TrainWrecker.EventDoWreck;
|
||||
}
|
||||
break;
|
||||
else
|
||||
_nextAction = 0;
|
||||
}
|
||||
break;
|
||||
case TrainWrecker.EventDoWreck:
|
||||
{
|
||||
if (diff < _timer)
|
||||
{
|
||||
if (diff < _timer)
|
||||
{
|
||||
_timer -= diff;
|
||||
break;
|
||||
}
|
||||
|
||||
GameObject target = VerifyTarget();
|
||||
if (target)
|
||||
{
|
||||
me.CastSpell(target, SpellIds.WreckTrain, false);
|
||||
_timer = 2 * Time.InMilliseconds;
|
||||
_nextAction = TrainWrecker.EventDoDance;
|
||||
}
|
||||
else
|
||||
_nextAction = 0;
|
||||
_timer -= diff;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
GameObject target = VerifyTarget();
|
||||
if (target)
|
||||
{
|
||||
me.CastSpell(target, SpellIds.WreckTrain, false);
|
||||
_timer = 2 * Time.InMilliseconds;
|
||||
_nextAction = TrainWrecker.EventDoDance;
|
||||
}
|
||||
else
|
||||
_nextAction = 0;
|
||||
}
|
||||
break;
|
||||
case TrainWrecker.EventDoDance:
|
||||
if (diff < _timer)
|
||||
{
|
||||
@@ -1721,29 +1722,29 @@ namespace Scripts.World.NpcSpecial
|
||||
[Script]
|
||||
class npc_argent_squire_gruntling : ScriptedAI
|
||||
{
|
||||
public npc_argent_squire_gruntling(Creature creature) : base(creature)
|
||||
{
|
||||
ScheduleTasks();
|
||||
}
|
||||
public npc_argent_squire_gruntling(Creature creature) : base(creature) { }
|
||||
|
||||
public void ScheduleTasks()
|
||||
public override void Reset()
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
|
||||
Player owner = me.GetOwner()?.ToPlayer();
|
||||
if (owner != null)
|
||||
{
|
||||
Aura ownerTired = me.GetOwner().GetAura(SpellIds.TiredPlayer);
|
||||
Aura ownerTired = owner.GetAura(SpellIds.TiredPlayer);
|
||||
if (ownerTired != null)
|
||||
{
|
||||
Aura squireTired = me.AddAura(IsArgentSquire() ? SpellIds.AuraTiredS : SpellIds.AuraTiredG, me);
|
||||
if (squireTired != null)
|
||||
squireTired.SetDuration(ownerTired.GetDuration());
|
||||
}
|
||||
});
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
|
||||
{
|
||||
if ((me.HasAura(SpellIds.AuraTiredS) || me.HasAura(SpellIds.AuraTiredG)) && me.HasNpcFlag(NPCFlags.Banker | NPCFlags.Mailbox | NPCFlags.Vendor))
|
||||
me.RemoveNpcFlag(NPCFlags.Banker | NPCFlags.Mailbox | NPCFlags.Vendor);
|
||||
task.Repeat();
|
||||
});
|
||||
|
||||
if (owner.HasAchieved(Misc.AchievementPonyUp) && !me.HasAura(SpellIds.AuraTiredS) && !me.HasAura(SpellIds.AuraTiredG))
|
||||
{
|
||||
me.SetNpcFlag(NPCFlags.Banker | NPCFlags.Mailbox | NPCFlags.Vendor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
me.RemoveNpcFlag(NPCFlags.Banker | NPCFlags.Mailbox | NPCFlags.Vendor);
|
||||
}
|
||||
|
||||
public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId)
|
||||
@@ -1751,40 +1752,39 @@ namespace Scripts.World.NpcSpecial
|
||||
switch (gossipListId)
|
||||
{
|
||||
case GossipMenus.OptionIdBank:
|
||||
{
|
||||
me.SetNpcFlag(NPCFlags.Banker);
|
||||
uint _bankAura = IsArgentSquire() ? SpellIds.AuraBankS : SpellIds.AuraBankG;
|
||||
if (!me.HasAura(_bankAura))
|
||||
DoCastSelf(_bankAura);
|
||||
{
|
||||
me.RemoveNpcFlag(NPCFlags.Mailbox | NPCFlags.Vendor);
|
||||
uint _bankAura = IsArgentSquire() ? SpellIds.AuraBankS : SpellIds.AuraBankG;
|
||||
if (!me.HasAura(_bankAura))
|
||||
DoCastSelf(_bankAura);
|
||||
|
||||
if (!player.HasAura(SpellIds.TiredPlayer))
|
||||
player.CastSpell(player, SpellIds.TiredPlayer, true);
|
||||
break;
|
||||
}
|
||||
if (!player.HasAura(SpellIds.TiredPlayer))
|
||||
player.CastSpell(player, SpellIds.TiredPlayer, true);
|
||||
break;
|
||||
}
|
||||
case GossipMenus.OptionIdShop:
|
||||
{
|
||||
me.SetNpcFlag(NPCFlags.Vendor);
|
||||
uint _shopAura = IsArgentSquire() ? SpellIds.AuraShopS : SpellIds.AuraShopG;
|
||||
if (!me.HasAura(_shopAura))
|
||||
DoCastSelf(_shopAura);
|
||||
{
|
||||
me.RemoveNpcFlag(NPCFlags.Banker | NPCFlags.Mailbox);
|
||||
uint _shopAura = IsArgentSquire() ? SpellIds.AuraShopS : SpellIds.AuraShopG;
|
||||
if (!me.HasAura(_shopAura))
|
||||
DoCastSelf(_shopAura);
|
||||
|
||||
if (!player.HasAura(SpellIds.TiredPlayer))
|
||||
player.CastSpell(player, SpellIds.TiredPlayer, true);
|
||||
break;
|
||||
}
|
||||
if (!player.HasAura(SpellIds.TiredPlayer))
|
||||
player.CastSpell(player, SpellIds.TiredPlayer, true);
|
||||
break;
|
||||
}
|
||||
case GossipMenus.OptionIdMail:
|
||||
{
|
||||
me.SetNpcFlag(NPCFlags.Mailbox);
|
||||
player.GetSession().SendShowMailBox(me.GetGUID());
|
||||
{
|
||||
me.RemoveNpcFlag(NPCFlags.Banker | NPCFlags.Vendor);
|
||||
|
||||
uint _mailAura = IsArgentSquire() ? SpellIds.AuraPostmanS : SpellIds.AuraPostmanG;
|
||||
if (!me.HasAura(_mailAura))
|
||||
DoCastSelf(_mailAura);
|
||||
uint _mailAura = IsArgentSquire() ? SpellIds.AuraPostmanS : SpellIds.AuraPostmanG;
|
||||
if (!me.HasAura(_mailAura))
|
||||
DoCastSelf(_mailAura);
|
||||
|
||||
if (!player.HasAura(SpellIds.TiredPlayer))
|
||||
player.CastSpell(player, SpellIds.TiredPlayer, true);
|
||||
break;
|
||||
}
|
||||
if (!player.HasAura(SpellIds.TiredPlayer))
|
||||
player.CastSpell(player, SpellIds.TiredPlayer, true);
|
||||
break;
|
||||
}
|
||||
case GossipMenus.OptionIdDarnassusSenjinPennant:
|
||||
case GossipMenus.OptionIdExodarUndercityPennant:
|
||||
case GossipMenus.OptionIdGnomereganOrgrimmarPennant:
|
||||
@@ -1794,15 +1794,14 @@ namespace Scripts.World.NpcSpecial
|
||||
DoCastSelf(Misc.bannerSpells[gossipListId - 3].Item1, new CastSpellExtraArgs(true));
|
||||
else
|
||||
DoCastSelf(Misc.bannerSpells[gossipListId - 3].Item2, new CastSpellExtraArgs(true));
|
||||
|
||||
player.PlayerTalkClass.SendCloseGossip();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
player.PlayerTalkClass.SendCloseGossip();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsArgentSquire() { return me.GetEntry() == CreatureIds.ArgentSquire; }
|
||||
@@ -1902,7 +1901,7 @@ namespace Scripts.World.NpcSpecial
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CastFoodSpell : BasicEvent
|
||||
{
|
||||
Unit _owner;
|
||||
|
||||
Reference in New Issue
Block a user