WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player *plr) { float x = plr->GetPositionX(); float y = plr->GetPositionY(); BattleGroundAVTeamIndex teamIdx = GetAVTeamIndexByTeamId(plr->GetTeam()); WorldSafeLocsEntry const* good_entry = NULL; if (GetStatus() == STATUS_IN_PROGRESS) { // Is there any occupied node for this team? float mindist = 9999999.0f; for(uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) { if (m_Nodes[i].Owner != teamIdx || m_Nodes[i].State != POINT_CONTROLLED) continue; WorldSafeLocsEntry const * entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[i] ); if (!entry) continue; float dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y); if (mindist > dist) { mindist = dist; good_entry = entry; } } } // If not, place ghost in the starting-cave if (!good_entry) good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[teamIdx + 7] ); return good_entry; }
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) { if (GetStatus() != STATUS_IN_PROGRESS) return; BattleGroundAVTeamIndex teamIdx = GetAVTeamIndexByTeamId(player->GetTeam()); MANGOS_ASSERT(teamIdx != BG_AV_TEAM_NEUTRAL); uint32 reputation = 0; // reputation for the whole team (other reputation must be done in db) // TODO add events (including quest not available anymore, next quest availabe, go/npc de/spawning) sLog.outError("BattleGroundAV: Quest %i completed", questid); switch(questid) { case BG_AV_QUEST_A_SCRAPS1: case BG_AV_QUEST_A_SCRAPS2: case BG_AV_QUEST_H_SCRAPS1: case BG_AV_QUEST_H_SCRAPS2: m_Team_QuestStatus[teamIdx][0] += 20; reputation = 1; if (m_Team_QuestStatus[teamIdx][0] == 500 || m_Team_QuestStatus[teamIdx][0] == 1000 || m_Team_QuestStatus[teamIdx][0] == 1500) //25,50,75 turn ins { DEBUG_LOG("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid); for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) if (m_Nodes[i].Owner == teamIdx && m_Nodes[i].State == POINT_CONTROLLED) PopulateNode(i); } break; case BG_AV_QUEST_A_COMMANDER1: case BG_AV_QUEST_H_COMMANDER1: m_Team_QuestStatus[teamIdx][1]++; reputation = 1; if (m_Team_QuestStatus[teamIdx][1] == 120) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_COMMANDER2: case BG_AV_QUEST_H_COMMANDER2: m_Team_QuestStatus[teamIdx][2]++; reputation = 2; if (m_Team_QuestStatus[teamIdx][2] == 60) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_COMMANDER3: case BG_AV_QUEST_H_COMMANDER3: m_Team_QuestStatus[teamIdx][3]++; reputation = 5; if (m_Team_QuestStatus[teamIdx][1] == 30) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_BOSS1: case BG_AV_QUEST_H_BOSS1: m_Team_QuestStatus[teamIdx][4] += 4; // there are 2 quests where you can turn in 5 or 1 item.. ( + 4 cause +1 will be done some lines below) reputation = 4; case BG_AV_QUEST_A_BOSS2: case BG_AV_QUEST_H_BOSS2: m_Team_QuestStatus[teamIdx][4]++; reputation += 1; if (m_Team_QuestStatus[teamIdx][4] >= 200) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_NEAR_MINE: case BG_AV_QUEST_H_NEAR_MINE: m_Team_QuestStatus[teamIdx][5]++; reputation = 2; if (m_Team_QuestStatus[teamIdx][5] == 28) { DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[teamIdx][6] == 7) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); } break; case BG_AV_QUEST_A_OTHER_MINE: case BG_AV_QUEST_H_OTHER_MINE: m_Team_QuestStatus[teamIdx][6]++; reputation = 3; if (m_Team_QuestStatus[teamIdx][6] == 7) { DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[teamIdx][5] == 20) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); } break; case BG_AV_QUEST_A_RIDER_HIDE: case BG_AV_QUEST_H_RIDER_HIDE: m_Team_QuestStatus[teamIdx][7]++; reputation = 1; if (m_Team_QuestStatus[teamIdx][7] == 25) { DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[teamIdx][8] == 25) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); } break; case BG_AV_QUEST_A_RIDER_TAME: case BG_AV_QUEST_H_RIDER_TAME: m_Team_QuestStatus[teamIdx][8]++; reputation = 1; if (m_Team_QuestStatus[teamIdx][8] == 25) { DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[teamIdx][7] == 25) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); } break; default: DEBUG_LOG("BattleGroundAV: Quest %i completed but is not interesting for us", questid); return; break; } if (reputation) RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam()); }
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) { if (GetStatus() != STATUS_IN_PROGRESS) return; BattleGroundAVTeamIndex teamIdx = GetAVTeamIndexByTeamId(player->GetTeam()); MANGOS_ASSERT(teamIdx != BG_AV_TEAM_NEUTRAL); uint32 reputation = 0; // reputation for the whole team (other reputation must be done in db) // TODO add events (including quest not available anymore, next quest availabe, go/npc de/spawning) sLog.outError("BattleGroundAV: Quest %i completed", questid); switch(questid) { case BG_AV_QUEST_A_SCRAPS1: case BG_AV_QUEST_A_SCRAPS2: case BG_AV_QUEST_H_SCRAPS1: case BG_AV_QUEST_H_SCRAPS2: //ToDo: We have to handle the supply crates! m_Team_QuestStatus[teamIdx][0] += 20; reputation = 1; if( m_Team_QuestStatus[teamIdx][0] == 500 || m_Team_QuestStatus[teamIdx][0] == 1500 || m_Team_QuestStatus[teamIdx][0] == 3000) { //get team smith Creature* Smith = 0; if (teamIdx == BG_TEAM_ALLIANCE) Smith = player->GetMap()->GetCreature(GetSingleCreatureGuid(BG_AV_Smith_A, 0)); else if (teamIdx == BG_TEAM_HORDE) Smith = player->GetMap()->GetCreature(GetSingleCreatureGuid(BG_AV_Smith_H, 0)); //here we call the scriptevzero alterac valley.cpp to handle the smith gossip if (Smith) Smith->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); DEBUG_LOG("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid); for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) if (m_Nodes[i].Owner == teamIdx && m_Nodes[i].State == POINT_CONTROLLED) PopulateNode(i); } break; case BG_AV_QUEST_A_COMMANDER1: case BG_AV_QUEST_H_COMMANDER1: m_Team_QuestStatus[teamIdx][1]++; reputation = 1; if (m_Team_QuestStatus[teamIdx][1] == 120) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_COMMANDER2: case BG_AV_QUEST_H_COMMANDER2: m_Team_QuestStatus[teamIdx][2]++; reputation = 2; if (m_Team_QuestStatus[teamIdx][2] == 60) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_COMMANDER3: case BG_AV_QUEST_H_COMMANDER3: m_Team_QuestStatus[teamIdx][3]++; reputation = 5; if (m_Team_QuestStatus[teamIdx][1] == 30) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_BOSS1: case BG_AV_QUEST_H_BOSS1: m_Team_QuestStatus[teamIdx][4] += 4; // there are 2 quests where you can turn in 5 or 1 item.. ( + 4 cause +1 will be done some lines below) reputation = 4; case BG_AV_QUEST_A_BOSS2: case BG_AV_QUEST_H_BOSS2: m_Team_QuestStatus[teamIdx][4]++; reputation += 1; //Zero: this feature isn't completly finished and stable if (m_Team_QuestStatus[teamIdx][4] >= 200) { //get team smith Creature* summonMaster = 0; if (teamIdx == BG_TEAM_ALLIANCE) summonMaster = player->GetMap()->GetCreature(GetSingleCreatureGuid(BG_AV_BOSS_SUMMON_MASTER_A, 0)); else if (teamIdx == BG_TEAM_HORDE) summonMaster = player->GetMap()->GetCreature(GetSingleCreatureGuid(BG_AV_BOSS_SUMMON_MASTER_H, 0)); if (summonMaster) summonMaster->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_OUTDOORPVP); } break; case BG_AV_QUEST_A_NEAR_MINE: case BG_AV_QUEST_H_NEAR_MINE: m_Team_QuestStatus[teamIdx][5]++; reputation = 2; if (m_Team_QuestStatus[teamIdx][5] == 28) { DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[teamIdx][6] == 7) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); } break; case BG_AV_QUEST_A_OTHER_MINE: case BG_AV_QUEST_H_OTHER_MINE: m_Team_QuestStatus[teamIdx][6]++; reputation = 3; if (m_Team_QuestStatus[teamIdx][6] == 7) { DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[teamIdx][5] == 20) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); } break; case BG_AV_QUEST_A_RIDER_HIDE: case BG_AV_QUEST_H_RIDER_HIDE: m_Team_QuestStatus[teamIdx][7]++; reputation = 1; if (m_Team_QuestStatus[teamIdx][7] == 25) { DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[teamIdx][8] == 25) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); } break; case BG_AV_QUEST_A_RIDER_TAME: case BG_AV_QUEST_H_RIDER_TAME: m_Team_QuestStatus[teamIdx][8]++; reputation = 1; if (m_Team_QuestStatus[teamIdx][8] == 25) { DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[teamIdx][7] == 25) DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); } break; default: DEBUG_LOG("BattleGroundAV: Quest %i completed but is not interesting for us", questid); return; break; } if (reputation) RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam()); }