mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
fix(Core/Event): Rework STV Fishing Extravaganza (#12506)
* rework riggle bassbait script * make sure STV_FISHING_HAS_WINNER gets reset * add script for npc Jang, some improvements for Riggle script. TODO: Jang quest menu and Fishbot5000 quest condition * fix jang not offering quest * script fishbot 5000 * some cleanup * some more cleanuo * endline * minimum fishing req for quests is 150 * min fishing skill for flyer is 150 * link box to correct event * riggle: broadcast texts, announcement happens when pools despawn * remove redundant code * Convert Fishbot5000 to db, cleanup comments * add missing end line - finished now. * attempt to fix event not launching in real time * fix condition for world states, when value is 0, convert jang to db * keep jang gossip also when event has a winner * small further improvements * Update src/server/scripts/World/npcs_special.cpp Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Update src/server/scripts/World/npcs_special.cpp Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Update src/server/scripts/World/npcs_special.cpp Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * apply suggestions * Update src/server/scripts/World/npcs_special.cpp Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * apply suggestions * apply one more suggestion * Update src/server/scripts/World/npcs_special.cpp Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Update src/server/scripts/World/npcs_special.cpp Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Update src/server/scripts/World/npcs_special.cpp Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * apply suggestion * use Talk() instead of Yell() * use Yell() without passing LANG_UNIVERSAL Co-authored-by: schell244 <> Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -207,19 +207,30 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum riggleBassbait
|
||||
/*
|
||||
* Stranglethorn Vale Fishing Extravaganza World States
|
||||
*/
|
||||
enum FishingExtravaganzaWorldStates
|
||||
{
|
||||
EVENT_RIGGLE_ANNOUNCE = 1,
|
||||
STV_FISHING_PREV_WIN_TIME = 197,
|
||||
STV_FISHING_HAS_WINNER = 198,
|
||||
STV_FISHING_ANNOUNCE_EVENT_BEGIN = 199,
|
||||
STV_FISHING_ANNOUNCE_POOLS_DESPAN = 200
|
||||
};
|
||||
|
||||
RIGGLE_SAY_START = 0,
|
||||
RIGGLE_SAY_WINNER = 1,
|
||||
RIGGLE_SAY_END = 2,
|
||||
enum RiggleBassbait
|
||||
{
|
||||
RIGGLE_SAY_START = 0,
|
||||
RIGGLE_SAY_POOLS_END = 1,
|
||||
RIGGLE_SAY_WINNER = 2,
|
||||
|
||||
QUEST_MASTER_ANGLER = 8193,
|
||||
QUEST_MASTER_ANGLER = 8193,
|
||||
|
||||
DATA_ANGLER_FINISHED = 1,
|
||||
EVENT_FISHING_TURN_INS = 90,
|
||||
EVENT_FISHING_POOLS = 15,
|
||||
|
||||
GAME_EVENT_FISHING = 62
|
||||
GOSSIP_EVENT_ACTIVE = 7614,
|
||||
GOSSIP_EVENT_OVER = 7714
|
||||
};
|
||||
|
||||
class npc_riggle_bassbait : public CreatureScript
|
||||
@@ -231,84 +242,95 @@ public:
|
||||
{
|
||||
npc_riggle_bassbaitAI(Creature* c) : ScriptedAI(c)
|
||||
{
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_RIGGLE_ANNOUNCE, 1000, 1, 0);
|
||||
finished = sWorld->getWorldState(GAME_EVENT_FISHING) == 1;
|
||||
startWarning = false;
|
||||
finishWarning = false;
|
||||
}
|
||||
|
||||
EventMap events;
|
||||
bool finished;
|
||||
bool startWarning;
|
||||
bool finishWarning;
|
||||
|
||||
uint32 GetData(uint32 type) const override
|
||||
{
|
||||
if (type == DATA_ANGLER_FINISHED)
|
||||
return (uint32)finished;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DoAction(int32 param) override
|
||||
{
|
||||
if (param == DATA_ANGLER_FINISHED)
|
||||
m_uiTimer = 0;
|
||||
auto prevWinTime = sWorld->getWorldState(STV_FISHING_PREV_WIN_TIME);
|
||||
if (GameTime::GetGameTime().count() - prevWinTime > DAY)
|
||||
{
|
||||
finished = true;
|
||||
sWorld->setWorldState(GAME_EVENT_FISHING, 1);
|
||||
// reset all after 1 day
|
||||
sWorld->setWorldState(STV_FISHING_ANNOUNCE_EVENT_BEGIN, 1);
|
||||
sWorld->setWorldState(STV_FISHING_ANNOUNCE_POOLS_DESPAN, 0);
|
||||
sWorld->setWorldState(STV_FISHING_HAS_WINNER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 m_uiTimer;
|
||||
|
||||
void CheckTournamentState() const
|
||||
{
|
||||
if (sGameEventMgr->IsActiveEvent(EVENT_FISHING_TURN_INS) && !sWorld->getWorldState(STV_FISHING_HAS_WINNER))
|
||||
{
|
||||
if (!me->IsQuestGiver())
|
||||
{
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||
}
|
||||
if (sWorld->getWorldState(STV_FISHING_ANNOUNCE_EVENT_BEGIN))
|
||||
{
|
||||
me->Yell(RIGGLE_SAY_START);
|
||||
sWorld->setWorldState(STV_FISHING_ANNOUNCE_EVENT_BEGIN, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (me->IsQuestGiver())
|
||||
{
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||
}
|
||||
}
|
||||
if (sGameEventMgr->IsActiveEvent(EVENT_FISHING_POOLS))
|
||||
{
|
||||
// enable announcement: when pools despawn
|
||||
sWorld->setWorldState(STV_FISHING_ANNOUNCE_POOLS_DESPAN, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sWorld->getWorldState(STV_FISHING_ANNOUNCE_POOLS_DESPAN))
|
||||
{
|
||||
me->Yell(RIGGLE_SAY_POOLS_END);
|
||||
sWorld->setWorldState(STV_FISHING_ANNOUNCE_POOLS_DESPAN, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
events.Update(diff);
|
||||
switch (events.ExecuteEvent())
|
||||
if (m_uiTimer < diff)
|
||||
{
|
||||
case EVENT_RIGGLE_ANNOUNCE:
|
||||
{
|
||||
tm strdate = Acore::Time::TimeBreakdown();
|
||||
|
||||
if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0)
|
||||
{
|
||||
sCreatureTextMgr->SendChat(me, RIGGLE_SAY_START, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE);
|
||||
startWarning = true;
|
||||
}
|
||||
|
||||
if (!finishWarning && strdate.tm_hour == 16 && strdate.tm_min == 0)
|
||||
{
|
||||
sCreatureTextMgr->SendChat(me, RIGGLE_SAY_END, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE);
|
||||
finishWarning = true;
|
||||
// no one won - despawn
|
||||
if (!finished)
|
||||
{
|
||||
me->DespawnOrUnsummon();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
events.RepeatEvent(1000);
|
||||
break;
|
||||
}
|
||||
CheckTournamentState();
|
||||
m_uiTimer = 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiTimer -= diff;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
if (!creature->AI()->GetData(DATA_ANGLER_FINISHED))
|
||||
if (creature->IsQuestGiver())
|
||||
{
|
||||
player->PrepareQuestMenu(creature->GetGUID());
|
||||
}
|
||||
|
||||
SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
|
||||
if (sWorld->getWorldState(STV_FISHING_HAS_WINNER))
|
||||
{
|
||||
SendGossipMenuFor(player, GOSSIP_EVENT_OVER, creature->GetGUID());
|
||||
}
|
||||
else
|
||||
{
|
||||
SendGossipMenuFor(player, GOSSIP_EVENT_ACTIVE, creature->GetGUID());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 /*opt*/) override
|
||||
{
|
||||
if (!creature->AI()->GetData(DATA_ANGLER_FINISHED) && quest->GetQuestId() == QUEST_MASTER_ANGLER)
|
||||
if (quest->GetQuestId() == QUEST_MASTER_ANGLER)
|
||||
{
|
||||
creature->AI()->DoAction(DATA_ANGLER_FINISHED);
|
||||
sCreatureTextMgr->SendChat(creature, RIGGLE_SAY_WINNER, player, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE);
|
||||
creature->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||
creature->Yell(RIGGLE_SAY_WINNER, player);
|
||||
sWorld->setWorldState(STV_FISHING_PREV_WIN_TIME, GameTime::GetGameTime().count());
|
||||
sWorld->setWorldState(STV_FISHING_HAS_WINNER, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user