bool EyeOfTheStorm::GivePoints(uint32 team, uint32 points) { //printf("EOTS: Give team %u %u points.\n", team, points); m_points[team] += points; if((m_points[team] - m_lastHonorGainPoints[team]) >= resourcesToGainBH) { uint32 honorToAdd = m_honorPerKill; m_mainLock.Acquire(); for(set<Player*>::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { (*itr)->m_bgScore.BonusHonor += honorToAdd; HonorHandler::AddHonorPointsToPlayer((*itr), honorToAdd); } UpdatePvPData(); m_mainLock.Release(); m_lastHonorGainPoints[team] += resourcesToGainBH; } if(m_points[team] >= 1600) { m_points[team] = 1600; m_ended = true; m_winningteam = static_cast<uint8>(team); m_nextPvPUpdateTime = 0; sEventMgr.RemoveEvents(this); sEventMgr.AddEvent(TO< CBattleground* >(this), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); m_mainLock.Acquire(); AddHonorToTeam( m_winningteam, 3 * 185 ); CastSpellOnTeam( m_winningteam, 43477 ); CastSpellOnTeam( m_winningteam, 69156 ); if( m_winningteam == TEAM_ALLIANCE ) AddHonorToTeam( TEAM_HORDE, 1 * 185 ); else AddHonorToTeam( TEAM_ALLIANCE, 1 * 185 ); m_mainLock.Release(); SetWorldState(WORLDSTATE_EOTS_ALLIANCE_VICTORYPOINTS + team, m_points[team]); UpdatePvPData(); return true; } SetWorldState(WORLDSTATE_EOTS_ALLIANCE_VICTORYPOINTS + team, m_points[team]); return false; }
void StrandOfTheAncient::Finish( uint32 winningteam ){ sEventMgr.RemoveEvents( this ); m_ended = true; m_winningteam = winningteam; uint32 losingteam; if( winningteam == TEAM_ALLIANCE ) losingteam = TEAM_HORDE; else losingteam = TEAM_ALLIANCE; AddHonorToTeam( winningteam, 3 * 185 ); AddHonorToTeam( losingteam, 1 * 185 ); CastSpellOnTeam( m_winningteam, 61213 ); UpdatePvPData(); sEventMgr.AddEvent( TO< CBattleground* >( this ), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120 * 1000, 1,0 ); }
void IsleOfConquest::Finish( uint32 losingTeam ){ if( m_ended ) return; m_ended = true; sEventMgr.RemoveEvents(this); sEventMgr.AddEvent(TO< CBattleground* >(this), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120 * 1000, 1,0); if( losingTeam == TEAM_ALLIANCE ) m_winningteam = TEAM_HORDE; else m_winningteam = TEAM_ALLIANCE; AddHonorToTeam( m_winningteam, 3 * 185 ); AddHonorToTeam( losingTeam, 1 * 185 ); CastSpellOnTeam( m_winningteam, 67033 ); UpdatePvPData(); }
void IsleOfConquest::UpdateResources(){ uint32 bonus[ 2 ]; std::fill( &bonus[ 0 ], &bonus[ 2 ], 0 ); if( controlpoint[ IOC_CONTROL_POINT_REFINERY ].state == IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED ) bonus[ TEAM_ALLIANCE ]++; else if( controlpoint[ IOC_CONTROL_POINT_REFINERY ].state == IOC_SPAWN_TYPE_HORDE_CONTROLLED ) bonus[ TEAM_HORDE ]++; if( controlpoint[ IOC_CONTROL_POINT_QUARRY ].state == IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED ) bonus[ TEAM_ALLIANCE ]++; else if( controlpoint[ IOC_CONTROL_POINT_QUARRY ].state == IOC_SPAWN_TYPE_HORDE_CONTROLLED ) bonus[ TEAM_HORDE ]++; AddReinforcements( TEAM_ALLIANCE, bonus[ TEAM_ALLIANCE ] ); AddReinforcements( TEAM_HORDE, bonus[ TEAM_HORDE ] ); AddHonorToTeam( TEAM_ALLIANCE, bonus[ TEAM_ALLIANCE ] ); AddHonorToTeam( TEAM_HORDE, bonus[ TEAM_HORDE ] ); }
void IsleOfConquest::CaptureControlPoint(uint32 Id, uint32 Team) { if(m_basesOwnedBy[Id] != -1) { // there is a very slim chance of this happening, 2 teams evnets could clash.. // just in case... return; } // anticheat, not really necessary because this is a server method but anyway if(m_basesAssaultedBy[Id] != (int32)Team) return; m_basesLastOwnedBy[Id] = Team; m_flagIsVirgin[Id] = false; m_basesOwnedBy[Id] = Team; m_basesAssaultedBy[Id]=-1; // remove the other spirit guide (if it exists) // burlex: shouldnt' happen if(m_spiritGuides[Id] != NULL) { RemoveSpiritGuide(m_spiritGuides[Id]); m_spiritGuides[Id]->Despawn(0,0); } // spawn the spirit guide for our faction m_spiritGuides[Id] = SpawnSpiritGuide(GraveyardLocations[Id][0], GraveyardLocations[Id][1], GraveyardLocations[Id][2], 0.0f, Team); AddSpiritGuide(m_spiritGuides[Id]); // send the chat message/sounds out PlaySoundToAll(Team ? SOUND_HORDE_SCORES : SOUND_ALLIANCE_SCORES); SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The %s has taken the %s!", Team ? "Horde" : "Alliance", ControlPointNames[Id]); // update the overhead display on the clients (world states) m_capturedBases[Team]++; // respawn the control point with the correct aura SpawnControlPoint(Id, Team ? IOC_SPAWN_TYPE_HORDE_CONTROLLED : IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED); // update the map SetWorldState(AssaultFields[Id][Team], 0); SetWorldState(OwnedFields[Id][Team], 1); AddHonorToTeam(5, Team); ApplyCaptureBonus(Id, Team); if(Id == 5) Updateworkshop(Team); }
void ArathiBasin::EventUpdateResources(uint32 Team) { uint32 resource_fields[2] = { WORLDSTATE_AB_ALLIANCE_RESOURCES, WORLDSTATE_AB_HORDE_RESOURCES }; uint32 current_resources = m_resources[Team]; uint32 current_bases = m_capturedBases[Team]; if(current_bases > 5) current_bases = 5; // figure out how much resources we have to add to that team based on the number of captured bases. current_resources += (PointBonusPerUpdate[current_bases]); // did it change? if(current_resources == m_resources[Team]) return; // check for overflow if(current_resources > RESOURCES_WINVAL) current_resources = RESOURCES_WINVAL; m_resources[Team] = current_resources; if((current_resources - m_lastRepGainResources[Team]) >= resourcesToGainBR) { m_mainLock.Acquire(); for(set<Player*>::iterator itr = m_players[Team].begin(); itr != m_players[Team].end(); ++itr) { uint32 fact = (*itr)->IsTeamHorde() ? 510 : 509; //The Defilers : The League of Arathor (*itr)->ModStanding(fact, 10); } m_mainLock.Release(); m_lastRepGainResources[Team] += resourcesToGainBR; } if((current_resources - m_lastHonorGainResources[Team]) >= resourcesToGainBH) { uint32 honorToAdd = m_honorPerKill; m_mainLock.Acquire(); for(set<Player*>::iterator itr = m_players[Team].begin(); itr != m_players[Team].end(); ++itr) { (*itr)->m_bgScore.BonusHonor += honorToAdd; HonorHandler::AddHonorPointsToPlayer((*itr), honorToAdd); } UpdatePvPData(); m_mainLock.Release(); m_lastHonorGainResources[Team] += resourcesToGainBH; } // update the world states SetWorldState(resource_fields[Team], current_resources); if(current_resources >= RESOURCES_WARNING_THRESHOLD && !m_nearingVictory[Team]) { m_nearingVictory[Team] = true; SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, (uint64)0, "The %s has gathered %u resources and is nearing victory!", Team ? "Horde" : "Alliance", current_resources); uint32 sound = SOUND_ALLIANCE_BGALMOSTEND - Team; PlaySoundToAll(sound); } // check for winning condition if(current_resources == RESOURCES_WINVAL) { m_ended = true; m_winningteam = static_cast<uint8>(Team); m_nextPvPUpdateTime = 0; sEventMgr.RemoveEvents(this); sEventMgr.AddEvent(TO< CBattleground* >(this), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); m_winningteam = Team; AddHonorToTeam( m_winningteam, 3 * 185 ); // Winning spells for AB CastSpellOnTeam( m_winningteam, 43484 ); CastSpellOnTeam( m_winningteam, 69153 ); CastSpellOnTeam( m_winningteam, 69499 ); CastSpellOnTeam( m_winningteam, 69500 ); if( m_winningteam == TEAM_ALLIANCE ) AddHonorToTeam( TEAM_HORDE, 1 * 185 ); else AddHonorToTeam( TEAM_ALLIANCE, 1 * 185 ); UpdatePvPData(); } }
void WarsongGulch::HookOnAreaTrigger(Player* plr, uint32 id) { int32 buffslot = -1; switch(id) { case 3686: // Speed buffslot = 0; break; case 3687: // Speed (Horde) buffslot = 1; break; case 3706: // Restoration buffslot = 2; break; case 3708: // Restoration (Horde) buffslot = 3; break; case 3707: // Berserking buffslot = 4; break; case 3709: // Berserking (Horde) buffslot = 5; break; } if(buffslot >= 0) { if(m_buffs[buffslot] != 0 && m_buffs[buffslot]->IsInWorld()) { /* apply the buff */ SpellEntry* sp = dbcSpell.LookupEntry(m_buffs[buffslot]->GetInfo()->sound3); Spell* s = sSpellFactoryMgr.NewSpell(plr, sp, true, 0); SpellCastTargets targets(plr->GetGUID()); s->prepare(&targets); /* despawn the gameobject (not delete!) */ m_buffs[buffslot]->Despawn(0, BUFF_RESPAWN_TIME); } return; } if(((id == 3646 && plr->IsTeamAlliance()) || (id == 3647 && plr->IsTeamHorde())) && (plr->m_bgHasFlag && m_flagHolders[plr->GetTeam()] == plr->GetLowGUID())) { if(m_flagHolders[plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE] != 0 || m_dropFlags[plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE]->IsInWorld()) { /* can't cap while flag dropped */ return; } float distance = plr->IsTeamAlliance() ? plr->CalcDistance(1540.29f, 1481.34f, 352.64f) : plr->CalcDistance(915.367f, 1433.78f, 346.089f); if(distance > 50.0f) { //50 yards from the spawn, gtfo hacker. sCheatLog.writefromsession(plr->GetSession(), "Tried to capture the flag in WSG while being more then 50 yards away. (%f yards)", plr->CalcDistance(915.367f, 1433.78f, 346.089f)); plr->GetSession()->Disconnect(); return; } /* remove the bool from the player so the flag doesn't drop */ m_flagHolders[plr->GetTeam()] = 0; plr->m_bgHasFlag = 0; /* remove flag aura from player */ plr->RemoveAura(23333 + (plr->GetTeam() * 2)); /* capture flag points */ plr->m_bgScore.MiscData[BG_SCORE_WSG_FLAGS_CAPTURED]++; PlaySoundToAll(plr->IsTeamHorde() ? SOUND_HORDE_SCORES : SOUND_ALLIANCE_SCORES); if(plr->IsTeamHorde()) SendChatMessage(CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "%s captured the Alliance flag!", plr->GetName()); else SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "%s captured the Horde flag!", plr->GetName()); SetWorldState(plr->IsTeamHorde() ? WORLDSTATE_WSG_ALLIANCE_FLAG_DISPLAY : WORLDSTATE_WSG_HORDE_FLAG_DISPLAY, 1); // Remove the Other Flag if(m_homeFlags[plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE]->IsInWorld()) m_homeFlags[plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE]->RemoveFromWorld(false); // Add the Event to respawn the Flags sEventMgr.AddEvent(this, &WarsongGulch::EventReturnFlags, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG, 20000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); /* give each player on that team bonus honor and reputation*/ uint32 honorToAdd = 2 * m_honorPerKill; uint32 repToAdd = m_isWeekend ? 45 : 35; uint32 fact = plr->IsTeamHorde() ? 889 : 890; /*Warsong Outriders : Sliverwing Sentinels*/ for(set<Player*>::iterator itr = m_players[plr->GetTeam()].begin(); itr != m_players[plr->GetTeam()].end(); ++itr) { (*itr)->m_bgScore.BonusHonor += honorToAdd; HonorHandler::AddHonorPointsToPlayer((*itr), honorToAdd); plr->ModStanding(fact, repToAdd); } m_scores[plr->GetTeam()]++; if(m_scores[plr->GetTeam()] == 3) { /* victory! */ m_ended = true; m_winningteam = (uint8)plr->GetTeam(); m_nextPvPUpdateTime = 0; sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_CLOSE); sEventMgr.AddEvent(TO< CBattleground* >(this), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); AddHonorToTeam( m_winningteam, 3 * 185 ); CastSpellOnTeam( m_winningteam, 69158 ); CastSpellOnTeam( m_winningteam, 69496 ); CastSpellOnTeam( m_winningteam, 69497 ); CastSpellOnTeam( m_winningteam, 69498 ); if( m_winningteam == TEAM_ALLIANCE ) AddHonorToTeam( TEAM_HORDE, 1 * 185 ); else AddHonorToTeam( TEAM_ALLIANCE, 1 * 185 ); m_mainLock.Release(); } /* increment the score world state */ SetWorldState(plr->IsTeamHorde() ? WORLDSTATE_WSG_HORDE_SCORE : WORLDSTATE_WSG_ALLIANCE_SCORE, m_scores[plr->GetTeam()]); UpdatePvPData(); } }
void IsleOfConquest::HookGameObjectDamage(GameObject*go) { go->SetUInt32Value(GAMEOBJECT_DYNAMIC, 0); switch(go->bannerslot) { case 1: { if(go->HasFlags(GAMEOBJECT_FLAG_DESTROYED)) { SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "Alliance Keep's Front Gate has been destroyed!"); SetWorldState(4327, 0); SetWorldState(4325, 1); AddHonorToTeam(10, 1); } }break; case 2: { if(go->HasFlags(GAMEOBJECT_FLAG_DESTROYED)) { SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "Alliance Keep's East Gate has been destroyed!"); SetWorldState(4328, 0); SetWorldState(4324, 1); AddHonorToTeam(10, 1); } }break; case 3: { if(go->HasFlags(GAMEOBJECT_FLAG_DESTROYED)) { SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "Alliance Keep's West Gate has been destroyed!"); SetWorldState(4326, 0); SetWorldState(4323, 1); AddHonorToTeam(10, 1); } }break; case 4: // horde front { if(go->HasFlags(GAMEOBJECT_FLAG_DESTROYED)) { SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "Horde Keep's Front Gate has been destroyed!"); SetWorldState(4317, 0); SetWorldState(4322, 1); AddHonorToTeam(10, 0); } }break; case 5: // horde west { if(go->HasFlags(GAMEOBJECT_FLAG_DESTROYED)) { SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "Horde Keep's West Gate has been destroyed!"); SetWorldState(4318, 0); SetWorldState(4321, 1); AddHonorToTeam(10, 0); } }break; case 6: // horde east { if(go->HasFlags(GAMEOBJECT_FLAG_DESTROYED)) { SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "Alliance Keep's West Gate has been destroyed!"); SetWorldState(4319, 0); SetWorldState(4320, 1); AddHonorToTeam(10, 0); } }break; } }