void GossipSelectOption(Object* pObject, Player* plr, uint32 Id, uint32 IntId, const char* Code) { if(!pObject->IsCreature()) return; Creature* pCreature = static_cast<Creature*>(pObject); GossipMenu* Menu; switch(IntId) { case 0: // Return to start GossipHello(pCreature, plr); break; case 1: //Horde { objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4715, plr); Menu->SendTo(plr); QuestLogEntry* qle = plr->GetQuestLogForEntry(6002); if(qle == NULL) return; if(qle->CanBeFinished()) return; qle->Complete(); qle->SendQuestComplete(); qle->UpdatePlayerFields(); pCreature->Emote(EMOTE_ONESHOT_WAVE); pCreature->Despawn(240000, 0); } break; case 2: //Ally { objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4715, plr); Menu->SendTo(plr); QuestLogEntry* qle = plr->GetQuestLogForEntry(6001); if(qle == NULL) return; if(qle->CanBeFinished()) return; qle->Complete(); qle->SendQuestComplete(); qle->UpdatePlayerFields(); pCreature->Emote(EMOTE_ONESHOT_WAVE); pCreature->Despawn(240000, 0); } break; } }
void QuestMgr::OnPlayerExploreArea(Player* plr, uint32 AreaID) { uint32 i, j; QuestLogEntry *qle; for(i = 0; i < 25; ++i) { if((qle = plr->GetQuestLogInSlot(i))) { // dont waste time on quests without mobs if(qle->GetQuest()->count_requiredtriggers == 0) continue; for(j = 0; j < 4; ++j) { if(qle->GetQuest()->required_triggers[j] == AreaID && !qle->m_explored_areas[j]) { qle->SetTrigger(j); CALL_QUESTSCRIPT_EVENT(qle, OnExploreArea)(qle->m_explored_areas[j], plr); qle->UpdatePlayerFields(); if(qle->CanBeFinished()) { plr->UpdateNearbyGameObjects(); qle->SendQuestComplete(); } break; } } } } }
void QuestMgr::OnPlayerItemPickup(Player* plr, Item* item) { uint32 i, j; uint32 pcount; uint32 entry = item->GetEntry(); QuestLogEntry *qle; for(i = 0; i < 25; ++i) { if((qle = plr->GetQuestLogInSlot(i))) { for(j = 0; j < qle->GetQuest()->count_required_item; ++j) { if(qle->GetQuest()->required_item[j] == entry) { pcount = plr->GetItemInterface()->GetItemCount(entry, true); CALL_QUESTSCRIPT_EVENT(qle, OnPlayerItemPickup)(entry, pcount, plr); if(pcount < qle->GetQuest()->required_itemcount[j]) { WorldPacket data(8); data.SetOpcode(SMSG_QUESTUPDATE_ADD_ITEM); data << qle->GetQuest()->required_item[j] << uint32(1); plr->GetSession()->SendPacket(&data); if(qle->CanBeFinished()) { plr->UpdateNearbyGameObjects(); qle->SendQuestComplete(); } break; } } } } } }
void OnSelectOption(Object* pObject, Player* Plr, uint32 Id, const char* Code) { switch(Id) { case 0: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2714, Plr, 1, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_0); break; case 1: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2715, Plr, 2, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_1); break; case 2: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2716, Plr, 3, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_2); break; case 3: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2717, Plr, 4, Arcemu::Gossip::ICON_CHAT, RaggedJphn_GOSSIP_3); break; case 4: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2718, Plr, 5, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_4); break; case 5: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2719, Plr, 6, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_5); break; case 6: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2720, Plr, 7, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_6); break; case 7: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2721, Plr, 8, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_7); break; case 8: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2722, Plr, 9, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_8); break; case 9: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2723, Plr, 10, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_9); break; case 10: Arcemu::Gossip::Menu::SendQuickMenu(Plr->GetGUID(), 2725, Plr, 11, Arcemu::Gossip::ICON_CHAT, RaggedJohn_GOSSIP_10); break; case 11: { QuestLogEntry* pQuest = Plr->GetQuestLogForEntry(4224); if(!pQuest) return; pQuest->Complete(); pQuest->SendQuestComplete(); pQuest->UpdatePlayerFields(); Arcemu::Gossip::Menu::Complete(Plr); } } }
void OnDamageTaken(Unit* mAttacker, uint32 fAmount) { if(_unit->GetHealthPct() < 10) { if(mAttacker->IsPlayer()) { _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry* qle = (static_cast<Player*>(mAttacker))->GetQuestLogForEntry(590); if(!qle) return; qle->SendQuestComplete(); } } }
void OnDamageTaken(Unit* mAttacker, uint32 fAmount) override { if (getCreature()->getHealth() - fAmount <= getCreature()->getMaxHealth() * 0.2f) { if (mAttacker->isPlayer()) { getCreature()->addUnitFlags(UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry* qle = (static_cast<Player*>(mAttacker))->GetQuestLogForEntry(1447); if (!qle) return; qle->SendQuestComplete(); } } }
void OnDamageTaken(Unit* mAttacker, uint32 fAmount) { if(_unit->GetHealthPct() < 10) { if(mAttacker->GetTypeId() == TYPEID_PLAYER) { _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry *qle = (TO_PLAYER(mAttacker))->GetQuestLogForEntry(590); if(!qle) return; qle->SendQuestComplete(); } } }
void OnDamageTaken(Unit* mAttacker, float fAmount) { if(_unit->GetUInt32Value(UNIT_FIELD_HEALTH)- fAmount<=_unit->GetUInt32Value(UNIT_FIELD_MAXHEALTH)*0.2) { if(mAttacker->GetTypeId() == TYPEID_PLAYER) { _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry *qle = (TO_PLAYER(mAttacker))->GetQuestLogForEntry( 1447 ); if(!qle) return; qle->SendQuestComplete(); } } }
void OnDamageTaken(Unit* mAttacker, uint32 fAmount) { if(_unit->GetUInt32Value(UNIT_FIELD_HEALTH) - fAmount <= _unit->GetUInt32Value(UNIT_FIELD_MAXHEALTH) * 0.37f) { if(mAttacker->IsPlayer()) { _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry* qle = (TO_PLAYER(mAttacker))->GetQuestLogForEntry(1640); if(!qle) return; qle->SendQuestComplete(); } } }
bool OpeningTyraliusPrison(uint32 i, Spell* pSpell) { if ( pSpell == NULL || pSpell->u_caster == NULL || !pSpell->u_caster->IsPlayer() ) return true; Player *pPlayer = static_cast< Player* >( pSpell->u_caster ); QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 10442 ); if ( pQuest != NULL ) { sEAS.SpawnCreature( pPlayer, 20787, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), 2 * 60 * 1000 ); pQuest->SendQuestComplete(); // not sure if it's enough } return true; }
bool RaeloraszSpark(uint32 i, Spell * pSpell) { if ( pSpell == NULL || pSpell->p_caster == NULL ) return true; Player * plr = TO_PLAYER(pSpell->u_caster); if( plr == NULL ) return true; Creature * pCreature = sEAS.SpawnCreature(plr, 26237, plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(),0, 0); pCreature->Despawn(5*60*1000, 0); QuestLogEntry *qle = plr->GetQuestLogForEntry(11969); if(qle == NULL) return true; qle->SendQuestComplete(); return true; }
bool PreparationForBattle(uint32 i, Spell* pSpell) { if ( pSpell == NULL || pSpell->u_caster == NULL || !pSpell->u_caster->IsPlayer() ) return true; Player* pPlayer = TO_PLAYER( pSpell->u_caster ); QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 12842 ); if ( pQuest != NULL ) { if ( pQuest->GetMobCount(0) < pQuest->GetQuest()->required_mobcount[0] ) { pQuest->SetMobCount( 0, pQuest->GetMobCount( 0 ) + 1 ); pQuest->SendUpdateAddKill( 0 ); pQuest->UpdatePlayerFields(); pQuest->SendQuestComplete(); } } return true; };
void OnDamageTaken(Unit* mAttacker, uint32 fAmount) override { uint32 chance = Util::getRandomUInt(100); if (chance < 25) { getCreature()->castSpell(mAttacker, sSpellMgr.getSpellInfo(6749), true); } if (getCreature()->getHealth() - fAmount <= getCreature()->getMaxHealth() * 0.3f) { if (mAttacker->isPlayer()) { getCreature()->addUnitFlags(UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry* qle = (static_cast<Player*>(mAttacker))->GetQuestLogForEntry(1173); if (!qle) return; qle->SendQuestComplete(); } } }
void OnDamageTaken(Unit* mAttacker, uint32 fAmount) { uint32 chance = RandomUInt(100); if(chance < 25) { _unit->CastSpell(mAttacker, dbcSpell.LookupEntry(6749), true); } if(_unit->GetUInt32Value(UNIT_FIELD_HEALTH) - fAmount <= _unit->GetUInt32Value(UNIT_FIELD_MAXHEALTH) * 0.3f) { if(mAttacker->IsPlayer()) { _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry* qle = (static_cast<Player*>(mAttacker))->GetQuestLogForEntry(1173); if(!qle) return; qle->SendQuestComplete(); } } }
void OnDamageTaken(Unit* mAttacker, float fAmount) { uint32 chance = RandomUInt(100); if(chance < 25) { _unit->CastSpell(mAttacker, dbcSpell.LookupEntry(6749), true); } if(_unit->GetUInt32Value(UNIT_FIELD_HEALTH)- fAmount<=_unit->GetUInt32Value(UNIT_FIELD_MAXHEALTH)*0.3) { if(mAttacker->GetTypeId() == TYPEID_PLAYER) { _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry *qle = (TO_PLAYER(mAttacker))->GetQuestLogForEntry(1173); if(!qle) return; qle->SendQuestComplete(); } } }
void OnDied(Unit * mKiller) { if( !mKiller->IsPlayer() ) return; // don't credit if any other player kills my initiate if( mKiller->GetGUID() != _unit->GetSummonedByGUID() ) return; Player * plr = TO_PLAYER(mKiller); QuestLogEntry * qle = plr->GetQuestLogForEntry(12848); if( !qle ) return; qle->SetMobCount(0, 1); qle->SendUpdateAddKill(0); qle->UpdatePlayerFields(); qle->SendQuestComplete(); ParentClass::OnDied(mKiller); }
bool RodofPurification(uint32 i, Spell* pSpell) { Player *pPlayer = (Player*)pSpell->u_caster; if(!pPlayer) return true; if(!pSpell->u_caster->IsPlayer()) return true; QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(10839); if(qle == NULL) return true; GameObject* Darkstone = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-2512, 5418, 0, 185191); if(Darkstone != NULL) { if(pPlayer->CalcDistance(pPlayer, Darkstone) < 15) qle->SendQuestComplete(); } return true; }
void OnSelectOption(Object* pObject, Player* plr, uint32 Id, const char* Code) { switch(Id) { case 0: Arcemu::Gossip::Menu::SendQuickMenu(pObject->GetGUID(), 3759, plr, 1, Arcemu::Gossip::ICON_CHAT, "What do you do here?"); break; case 1: Arcemu::Gossip::Menu::SendQuickMenu(pObject->GetGUID(), 3760, plr, 2, Arcemu::Gossip::ICON_CHAT, "I can help you"); break; case 2: Arcemu::Gossip::Menu::SendQuickMenu(pObject->GetGUID(), 3761, plr, 3, Arcemu::Gossip::ICON_CHAT, "What deal?"); break; case 3: Arcemu::Gossip::Menu::SendQuickMenu(pObject->GetGUID(), 3762, plr, 4, Arcemu::Gossip::ICON_CHAT, "Then what happened?"); break; case 4: Arcemu::Gossip::Menu::SendQuickMenu(pObject->GetGUID(), 3763, plr, 5, Arcemu::Gossip::ICON_CHAT, "He is not safe, i'll make sure of that."); break; case 5: { QuestLogEntry* pQuest = plr->GetQuestLogForEntry(5126); if (pQuest) { pQuest->Complete(); pQuest->UpdatePlayerFields(); pQuest->SendQuestComplete(); } plr->Gossip_Complete(); }break; } }
void AreatriggerHook(Player* pPlayer, uint32 triggerID) { if(!pPlayer) return; if( triggerID == ALLIANCE_RETURN || triggerID == HORDE_RETURN ) { if( pPlayer->HasAura( SILITHYST_SPELL ) ) // if we doesn't have it, do nothing { pPlayer->RemoveAura( SILITHYST_SPELL ); /* Rewards */ pPlayer->CastSpell(pPlayer, TRACES_OF_SILITHYST, true); pPlayer->m_honorPoints += REWARD_HONOR; pPlayer->ModStanding(REWARD_REPUTATION_FACTION, REWARD_REPUTATION_VALUE); uint32 quest = pPlayer->GetTeam() == ALLIANCE ? ALLIANCE_SILITHYST_QUEST : HORDE_SILITHYST_QUEST; QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(quest); if( qle ) qle->SendQuestComplete(); /***********/ if( locked ) return; silithyst_gathered[ pPlayer->GetTeam() ]++; uint32 worldstate = pPlayer->GetTeam() == ALLIANCE ? WORLDSTATE_SILITHUS_GATHERED_ALLIANCE : WORLDSTATE_SILITHUS_GATHERED_HORDE; pPlayer->GetMapMgr()->GetStateManager().UpdateWorldState( worldstate , silithyst_gathered[ pPlayer->GetTeam() ] ); if( silithyst_gathered[ pPlayer->GetTeam() ] >= SILITHYST_MAX ) { locked = true; // we win, so opposite team must wait for server restart winners = pPlayer->GetTeam(); pPlayer->GetMapMgr()->CastSpellOnPlayers(winners, CENARION_FAVOR); pPlayer->GetMapMgr()->RemovePositiveAuraFromPlayers( winners == ALLIANCE ? HORDE : ALLIANCE, CENARION_FAVOR); } } } }
bool QuestMgr::OnGameObjectActivate(Player *plr, GameObject *go) { uint32 i, j; QuestLogEntry *qle; uint32 entry = go->GetEntry(); for(i = 0; i < 25; ++i) { if((qle = plr->GetQuestLogInSlot(i))) { // dont waste time on quests without mobs if(qle->GetQuest()->count_required_mob == 0) continue; for(j = 0; j < 4; ++j) { if(qle->GetQuest()->required_mob[j] == entry && qle->GetQuest()->required_mobtype[j] == QUEST_MOB_TYPE_GAMEOBJECT && qle->m_mobcount[j] < qle->GetQuest()->required_mobcount[j]) { // add another kill. // (auto-dirtys it) qle->SetMobCount(j, qle->m_mobcount[j] + 1); qle->SendUpdateAddKill(j); CALL_QUESTSCRIPT_EVENT(qle, OnGameObjectActivate)(entry, plr); if(qle->CanBeFinished()) qle->SendQuestComplete(); qle->UpdatePlayerFields(); return true; } } } } return false; }
void QuestMgr::OnPlayerKill(Player* plr, Creature* victim) { if(!plr) return; uint32 i, j; uint32 entry = victim->GetEntry(); QuestLogEntry *qle; for(i = 0; i < 25; ++i) { if((qle = plr->GetQuestLogInSlot(i))) { // dont waste time on quests without mobs if(qle->GetQuest()->count_required_mob == 0) continue; for(j = 0; j < 4; ++j) { if(qle->GetQuest()->required_mob[j] == entry && qle->GetQuest()->required_mobtype[j] == QUEST_MOB_TYPE_CREATURE && qle->m_mobcount[j] < qle->GetQuest()->required_mobcount[j]) { // add another kill. // (auto-dirtys it) qle->SetMobCount(j, qle->m_mobcount[j] + 1); qle->SendUpdateAddKill(j); CALL_QUESTSCRIPT_EVENT(qle, OnCreatureKill)(entry, plr); qle->UpdatePlayerFields(); break; } } } } // Shared kills Player *gplr = NULL; if(plr->InGroup()) { if(Group* pGroup = plr->GetGroup()) { if(pGroup->GetGroupType() != GROUP_TYPE_PARTY) return; // Raid's don't get shared kills. GroupMembersSet::iterator gitr; for(uint32 k = 0; k < pGroup->GetSubGroupCount(); k++) { for(gitr = pGroup->GetSubGroup(k)->GetGroupMembersBegin(); gitr != pGroup->GetSubGroup(k)->GetGroupMembersEnd(); ++gitr) { gplr = (*gitr); if(gplr && gplr != plr) // dont double kills { for(i = 0; i < 20; ++i) { if((qle = gplr->GetQuestLogInSlot(i))) { // dont waste time on quests without mobs if(qle->GetQuest()->count_required_mob == 0) continue; for(j = 0; j < 4; ++j) { if(qle->GetQuest()->required_mob[j] == entry && qle->GetQuest()->required_mobtype[j] == QUEST_MOB_TYPE_CREATURE && qle->m_mobcount[j] < qle->GetQuest()->required_mobcount[j]) { // add another kill. // (auto-dirtys it) qle->SetMobCount(j, qle->m_mobcount[j] + 1); qle->SendUpdateAddKill(j); CALL_QUESTSCRIPT_EVENT(qle, OnCreatureKill)(entry, plr); qle->UpdatePlayerFields(); // lua stuff //QUESTLUA_SendEvent(qst, victim, plr, ON_QUEST_KILLMOB, qle->m_mobcount[j]); if(qle->CanBeFinished()) qle->SendQuestComplete(); break; } } } } } } } } } }
void OnActivate(Player* player) { QuestLogEntry* qle = player->GetQuestLogForEntry(8345); if (qle != nullptr) qle->SendQuestComplete(); }
void OnActivate(PlayerPointer pPlayer) { QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(8345); if(qle) qle->SendQuestComplete(); }