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