Core/Scripts: unified scripted gossip/quest api
Port From (https://github.com/TrinityCore/TrinityCore/commit/6604849716bc73d82a4cdbf8c66bb188086ceae4)
This commit is contained in:
@@ -692,7 +692,7 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent
|
||||
{
|
||||
public npc_grandmother(Creature creature) : base(creature) { }
|
||||
|
||||
public override void GossipSelect(Player player, uint menuId, uint gossipListId)
|
||||
public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
|
||||
{
|
||||
if (menuId == RedRidingHood.OptionWhatPhatLewtsYouHave && gossipListId == 0)
|
||||
{
|
||||
@@ -704,6 +704,7 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent
|
||||
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1574,6 +1575,67 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent
|
||||
}
|
||||
}
|
||||
|
||||
public override bool GossipHello(Player player)
|
||||
{
|
||||
// Check for death of Moroes and if opera event is not done already
|
||||
if (instance.GetBossState(DataTypes.Moroes) == EncounterState.Done && instance.GetBossState(DataTypes.OperaPerformance) != EncounterState.Done)
|
||||
{
|
||||
AddGossipItemFor(player, GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
|
||||
|
||||
if (player.IsGameMaster())
|
||||
{
|
||||
AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3);
|
||||
AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4);
|
||||
AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5);
|
||||
}
|
||||
|
||||
if (!RaidWiped)
|
||||
SendGossipMenuFor(player, 8970, me.GetGUID());
|
||||
else
|
||||
SendGossipMenuFor(player, 8975, me.GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SendGossipMenuFor(player, 8978, me.GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
|
||||
{
|
||||
uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
|
||||
ClearGossipMenuFor(player);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case eTradeskill.GossipActionInfoDef + 1:
|
||||
AddGossipItemFor(player, GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
|
||||
SendGossipMenuFor(player, 8971, me.GetGUID());
|
||||
break;
|
||||
case eTradeskill.GossipActionInfoDef + 2:
|
||||
player.CLOSE_GOSSIP_MENU();
|
||||
StartEvent();
|
||||
break;
|
||||
case eTradeskill.GossipActionInfoDef + 3:
|
||||
CloseGossipMenuFor(player);
|
||||
m_uiEventId = OperaEvents.Oz;
|
||||
Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_OZ", player.GetGUID());
|
||||
break;
|
||||
case eTradeskill.GossipActionInfoDef + 4:
|
||||
CloseGossipMenuFor(player);
|
||||
m_uiEventId = OperaEvents.Hood;
|
||||
Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_HOOD", player.GetGUID());
|
||||
break;
|
||||
case eTradeskill.GossipActionInfoDef + 5:
|
||||
CloseGossipMenuFor(player);
|
||||
m_uiEventId = OperaEvents.RAJ;
|
||||
Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_RAJ", player.GetGUID());
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
|
||||
ObjectGuid m_uiSpotlightGUID;
|
||||
@@ -1587,75 +1649,6 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent
|
||||
public bool RaidWiped;
|
||||
}
|
||||
|
||||
public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
|
||||
{
|
||||
player.PlayerTalkClass.ClearMenus();
|
||||
npc_barnesAI pBarnesAI = (npc_barnesAI)creature.GetAI();
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case eTradeskill.GossipActionInfoDef + 1:
|
||||
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
|
||||
player.SEND_GOSSIP_MENU(8971, creature.GetGUID());
|
||||
break;
|
||||
case eTradeskill.GossipActionInfoDef + 2:
|
||||
player.CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI.StartEvent();
|
||||
break;
|
||||
case eTradeskill.GossipActionInfoDef + 3:
|
||||
player.CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI.m_uiEventId = OperaEvents.Oz;
|
||||
Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_OZ", player.GetGUID());
|
||||
break;
|
||||
case eTradeskill.GossipActionInfoDef + 4:
|
||||
player.CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI.m_uiEventId = OperaEvents.Hood;
|
||||
Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_HOOD", player.GetGUID());
|
||||
break;
|
||||
case eTradeskill.GossipActionInfoDef + 5:
|
||||
player.CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI.m_uiEventId = OperaEvents.RAJ;
|
||||
Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_RAJ", player.GetGUID());
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnGossipHello(Player player, Creature creature)
|
||||
{
|
||||
InstanceScript instance = creature.GetInstanceScript();
|
||||
if (instance != null)
|
||||
{
|
||||
// Check for death of Moroes and if opera event is not done already
|
||||
if (instance.GetBossState(DataTypes.Moroes) == EncounterState.Done && instance.GetBossState(DataTypes.OperaPerformance) != EncounterState.Done)
|
||||
{
|
||||
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
|
||||
|
||||
if (player.IsGameMaster())
|
||||
{
|
||||
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3);
|
||||
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4);
|
||||
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5);
|
||||
}
|
||||
|
||||
npc_barnesAI pBarnesAI = (npc_barnesAI)creature.GetAI();
|
||||
if (pBarnesAI != null)
|
||||
{
|
||||
if (!pBarnesAI.RaidWiped)
|
||||
player.SEND_GOSSIP_MENU(8970, creature.GetGUID());
|
||||
else
|
||||
player.SEND_GOSSIP_MENU(8975, creature.GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.SEND_GOSSIP_MENU(8978, creature.GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return GetInstanceAI<npc_barnesAI>(creature);
|
||||
|
||||
@@ -349,21 +349,31 @@ namespace Scripts.EasternKingdoms
|
||||
{
|
||||
public go_acherus_soul_prison() : base("go_acherus_soul_prison") { }
|
||||
|
||||
public override bool OnGossipHello(Player player, GameObject go)
|
||||
class go_acherus_soul_prisonAI : GameObjectAI
|
||||
{
|
||||
Creature anchor = go.FindNearestCreature(29521, 15);
|
||||
if (anchor)
|
||||
{
|
||||
ObjectGuid prisonerGUID = anchor.GetAI().GetGUID();
|
||||
if (!prisonerGUID.IsEmpty())
|
||||
{
|
||||
Creature prisoner = ObjectAccessor.GetCreature(player, prisonerGUID);
|
||||
if (prisoner)
|
||||
((npc_unworthy_initiate)prisoner.GetAI()).EventStart(anchor, player);
|
||||
}
|
||||
}
|
||||
public go_acherus_soul_prisonAI(GameObject go) : base(go) { }
|
||||
|
||||
return false;
|
||||
public override bool GossipHello(Player player, bool reportUse)
|
||||
{
|
||||
Creature anchor = me.FindNearestCreature(29521, 15);
|
||||
if (anchor)
|
||||
{
|
||||
ObjectGuid prisonerGUID = anchor.GetAI().GetGUID();
|
||||
if (!prisonerGUID.IsEmpty())
|
||||
{
|
||||
Creature prisoner = ObjectAccessor.GetCreature(player, prisonerGUID);
|
||||
if (prisoner)
|
||||
((npc_unworthy_initiate)prisoner.GetAI()).EventStart(anchor, player);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override GameObjectAI GetAI(GameObject go)
|
||||
{
|
||||
return new go_acherus_soul_prisonAI(go);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,54 +555,51 @@ namespace Scripts.EasternKingdoms
|
||||
base.UpdateAI(uiDiff);
|
||||
}
|
||||
|
||||
public override bool GossipHello(Player player)
|
||||
{
|
||||
if (player.GetQuestStatus(MiscConst.QuestDeathChallenge) == QuestStatus.Incomplete && me.IsFullHealth())
|
||||
{
|
||||
if (player.HealthBelowPct(10))
|
||||
return true;
|
||||
|
||||
if (player.IsInCombat() || me.IsInCombat())
|
||||
return true;
|
||||
|
||||
AddGossipItemFor(player, Player.GetDefaultGossipMenuForSource(me), 0, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
|
||||
SendGossipMenuFor(player, player.GetGossipTextId(me), me.GetGUID());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
|
||||
{
|
||||
uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
|
||||
ClearGossipMenuFor(player);
|
||||
if (action == eTradeskill.GossipActionInfoDef)
|
||||
{
|
||||
CloseGossipMenuFor(player);
|
||||
|
||||
if (player.IsInCombat() || me.IsInCombat())
|
||||
return true;
|
||||
|
||||
if (m_bIsDuelInProgress)
|
||||
return true;
|
||||
|
||||
me.RemoveUnitFlag(UnitFlags.ImmuneToPc);
|
||||
me.RemoveUnitFlag(UnitFlags.Unk15);
|
||||
|
||||
player.CastSpell(me, SpellIds.Duel, false);
|
||||
player.CastSpell(player, SpellIds.DuelFlag, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lose;
|
||||
ObjectGuid m_uiDuelerGUID;
|
||||
uint m_uiDuelTimer;
|
||||
public bool m_bIsDuelInProgress;
|
||||
}
|
||||
|
||||
public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
|
||||
{
|
||||
ClearGossipMenuFor(player);
|
||||
if (action == eTradeskill.GossipActionInfoDef)
|
||||
{
|
||||
CloseGossipMenuFor(player);
|
||||
|
||||
if (player.IsInCombat() || creature.IsInCombat())
|
||||
return true;
|
||||
|
||||
npc_death_knight_initiateAI pInitiateAI = creature.GetAI<npc_death_knight_initiateAI>();
|
||||
if (pInitiateAI != null)
|
||||
{
|
||||
if (pInitiateAI.m_bIsDuelInProgress)
|
||||
return true;
|
||||
}
|
||||
|
||||
creature.RemoveUnitFlag(UnitFlags.ImmuneToPc);
|
||||
creature.RemoveUnitFlag(UnitFlags.Unk15);
|
||||
|
||||
player.CastSpell(creature, SpellIds.Duel, false);
|
||||
player.CastSpell(player, SpellIds.DuelFlag, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnGossipHello(Player player, Creature creature)
|
||||
{
|
||||
if (player.GetQuestStatus(MiscConst.QuestDeathChallenge) == QuestStatus.Incomplete && creature.IsFullHealth())
|
||||
{
|
||||
if (player.HealthBelowPct(10))
|
||||
return true;
|
||||
|
||||
if (player.IsInCombat() || creature.IsInCombat())
|
||||
return true;
|
||||
|
||||
AddGossipItemFor(player, Player.GetDefaultGossipMenuForSource(creature), 0, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
|
||||
SendGossipMenuFor(player, player.GetGossipTextId(creature), creature.GetGUID());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new npc_death_knight_initiateAI(creature);
|
||||
@@ -681,13 +688,14 @@ namespace Scripts.EasternKingdoms
|
||||
{
|
||||
public npc_salanar_the_horseman(Creature creature) : base(creature) { }
|
||||
|
||||
public override void GossipSelect(Player player, uint menuId, uint gossipListId)
|
||||
public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
|
||||
{
|
||||
if (menuId == MiscConst.GossipSalanarMenu && gossipListId == MiscConst.GossipSalanarOption)
|
||||
{
|
||||
player.CastSpell(player, SpellIds.RealmOfShadows, true);
|
||||
player.PlayerTalkClass.SendCloseGossip();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void SpellHit(Unit caster, SpellInfo spell)
|
||||
|
||||
Reference in New Issue
Block a user