From 2b1a8004ba70bdcf077f78d700b10484d445f562 Mon Sep 17 00:00:00 2001 From: Gigatotem Date: Sun, 7 Oct 2012 13:44:05 +0200 Subject: Spells/Hunter: Readiness Fixes Readiness resetting the cooldown of Gift of the Naaru. Needs testing --- src/server/scripts/Spells/spell_hunter.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 9c922f2c6fb..9d0e084cfb8 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -32,6 +32,7 @@ enum HunterSpells { HUNTER_SPELL_READINESS = 23989, + DRAENEI_SPELL_GIFT_OF_THE_NAARU = 59543, HUNTER_SPELL_BESTIAL_WRATH = 19574, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED = 53479, HUNTER_PET_HEART_OF_THE_PHOENIX = 55709, @@ -340,6 +341,7 @@ class spell_hun_readiness : public SpellScriptLoader spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != HUNTER_SPELL_READINESS && spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH && + spellInfo->Id != DRAENEI_SPELL_GIFT_OF_THE_NAARU && spellInfo->GetRecoveryTime() > 0) caster->RemoveSpellCooldown((itr++)->first, true); else -- cgit v1.2.3 From d49c2a5e4d66b1f4bd4bdff3d6ed92902e8565f8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 7 Oct 2012 13:55:04 +0100 Subject: correct reputation converting at faction change --- src/server/game/Globals/ObjectMgr.cpp | 22 +++++++++ src/server/game/Globals/ObjectMgr.h | 2 + src/server/game/Handlers/CharacterHandler.cpp | 55 +++++++++++++++++++--- .../Database/Implementation/CharacterDatabase.cpp | 3 +- .../Database/Implementation/CharacterDatabase.h | 1 + 5 files changed, 75 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 95a27fd14e1..ea4386c4d41 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7590,6 +7590,28 @@ SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds(uint32 spell_id) return SpellScriptsBounds(_spellScriptsStore.lower_bound(spell_id), _spellScriptsStore.upper_bound(spell_id)); } +// this allows calculating base reputations to offline players, just by race and class +int32 ObjectMgr::GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint32 playerClass) +{ + if (!factionEntry) + return 0; + + uint32 raceMask = (1 << (race - 1)); + uint32 classMask = (1 << (playerClass-1)); + + for (int i=0; i < 4; i++) + { + if ((factionEntry->BaseRepRaceMask[i] & raceMask || + (factionEntry->BaseRepRaceMask[i] == 0 && + factionEntry->BaseRepClassMask[i] != 0)) && + (factionEntry->BaseRepClassMask[i] & classMask || + factionEntry->BaseRepClassMask[i] == 0)) + return factionEntry->BaseRepValue[i]; + } + + return 0; +} + SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial) { switch (pSkill->categoryId) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index bbd95e22685..81ca02af5d9 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -749,6 +749,8 @@ class ObjectMgr return NULL; } + int32 GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint32 playerClass); + RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const { RepSpilloverTemplateContainer::const_iterator itr = _repSpilloverTemplateStore.find(factionId); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 5c603e46086..30bc6df0539 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1625,11 +1625,23 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) uint32 lowGuid = GUID_LOPART(guid); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN); + // get the players old (at this moment current) race + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_RACE); + stmt->setUInt32(0, guid); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) + { + WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); + data << uint8(CHAR_CREATE_ERROR); + SendPacket(&data); + return; + } + Field* fields = result->Fetch(); + uint8 oldRace = fields[0].GetUInt8(); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN); stmt->setUInt32(0, lowGuid); - - PreparedQueryResult result = CharacterDatabase.Query(stmt); + result = CharacterDatabase.Query(stmt); if (!result) { @@ -1639,7 +1651,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) return; } - Field* fields = result->Fetch(); + fields = result->Fetch(); uint32 playerClass = uint32(fields[0].GetUInt8()); uint32 level = uint32(fields[1].GetUInt8()); uint32 at_loginFlags = fields[2].GetUInt16(); @@ -2004,15 +2016,44 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) uint32 reputation_alliance = it->first; uint32 reputation_horde = it->second; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REP_BY_FACTION); + // select old standing set in db + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_REP_BY_FACTION); + stmt->setUInt32(0, team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance); + stmt->setUInt32(1, lowGuid); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) + { + WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); + data << uint8(CHAR_CREATE_ERROR); + SendPacket(&data); + return; + } + + Field* fields = result->Fetch(); + int32 oldDBRep = fields[0].GetInt32(); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance); + + // old base reputation + int32 oldBaseRep = sObjectMgr->GetBaseReputation(factionEntry, oldRace, playerClass); + + // new base reputation + int32 newBaseRep = sObjectMgr->GetBaseReputation(sFactionStore.LookupEntry(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde), race, playerClass); + + // final reputation shouldnt change + int32 FinalRep = oldDBRep + oldBaseRep; + int32 newDBRep = FinalRep - newBaseRep; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REP_BY_FACTION); stmt->setUInt32(0, uint16(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde)); stmt->setUInt32(1, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REP_FACTION_CHANGE); stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde)); - stmt->setUInt16(1, uint16(team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance)); - stmt->setUInt32(2, lowGuid); + stmt->setInt32(1, newDBRep); + stmt->setUInt16(2, uint16(team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance)); + stmt->setUInt32(3, lowGuid); trans->Append(stmt); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index add782cf517..4396f67244a 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -497,8 +497,9 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE, "UPDATE item_instance ii, character_inventory ci SET ii.itemEntry = ? WHERE ii.itemEntry = ? AND ci.guid = ? AND ci.item = ii.guid", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_CHAR_SPELL_BY_SPELL, "DELETE FROM character_spell WHERE spell = ? AND guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE, "UPDATE character_spell SET spell = ? where spell = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_SEL_CHAR_REP_BY_FACTION, "SELECT standing FROM character_reputation WHERE faction = ? AND guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_DEL_CHAR_REP_BY_FACTION, "DELETE FROM character_reputation WHERE faction = ? AND guid = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(CHAR_UPD_CHAR_REP_FACTION_CHANGE, "UPDATE character_reputation SET faction = ? where faction = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_REP_FACTION_CHANGE, "UPDATE character_reputation SET faction = ?, standing = ? WHERE faction = ? AND guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_CHAR_TITLES_FACTION_CHANGE, "UPDATE characters SET knownTitles = ? WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_RES_CHAR_TITLES_FACTION_CHANGE, "UPDATE characters SET chosenTitle = 0 WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_CHAR_SPELL_COOLDOWN, "DELETE FROM character_spell_cooldown WHERE guid = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index fedf0022fcc..95b059de95c 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -460,6 +460,7 @@ enum CharacterDatabaseStatements CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE, CHAR_DEL_CHAR_SPELL_BY_SPELL, CHAR_UPD_CHAR_SPELL_FACTION_CHANGE, + CHAR_SEL_CHAR_REP_BY_FACTION, CHAR_DEL_CHAR_REP_BY_FACTION, CHAR_UPD_CHAR_REP_FACTION_CHANGE, CHAR_UPD_CHAR_TITLES_FACTION_CHANGE, -- cgit v1.2.3 From 9835f4098f55d60436538839a1698ce5464ae290 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 7 Oct 2012 16:06:40 +0100 Subject: correcting SotA demolisher spawn, adding preparation buff to 2nd round too, lowering start height for attackers --- .../game/Battlegrounds/Zones/BattlegroundSA.cpp | 147 +++++++++++++-------- .../game/Battlegrounds/Zones/BattlegroundSA.h | 45 ++++--- 2 files changed, 119 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index eae1c1e3545..35304bc9190 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -74,7 +74,7 @@ bool BattlegroundSA::ResetObjs() uint32 atF = BG_SA_Factions[Attackers]; uint32 defF = BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE]; - for (uint8 i = 0; i SetUInt32Value(GAMEOBJECT_FACTION, atF); } - //Player may enter BEFORE we set up bG - lets update his worldstates anyway... - UpdateWorldState(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0); - UpdateWorldState(BG_SA_LEFT_GY_HORDE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0); - UpdateWorldState(BG_SA_CENTER_GY_HORDE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0); + //Player may enter BEFORE we set up BG - lets update his worldstates anyway... + UpdateWorldState(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); + UpdateWorldState(BG_SA_LEFT_GY_HORDE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); + UpdateWorldState(BG_SA_CENTER_GY_HORDE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); - UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); - UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); - UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); + UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); + UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); if (Attackers == TEAM_ALLIANCE) { @@ -254,6 +257,9 @@ bool BattlegroundSA::ResetObjs() if (Player* player = ObjectAccessor::FindPlayer(itr->first)) SendTransportInit(player); + // set status manually so preparation is cast correctly in 2nd round too + SetStatus(STATUS_WAIT_JOIN); + TeleportPlayers(); return true; } @@ -295,7 +301,8 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) InitSecondRound = false; SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); } - }else + } + else { UpdateWaitTimer -= diff; return; @@ -312,7 +319,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) ToggleTimer(); DemolisherStartState(false); Status = BG_SA_ROUND_ONE; - StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702); + StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE) ? 23748 : 21702); } if (TotalTime >= BG_SA_BOAT_START) StartShips(); @@ -332,7 +339,12 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) ToggleTimer(); DemolisherStartState(false); Status = BG_SA_ROUND_TWO; - StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702); + StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE) ? 23748 : 21702); + // status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now + SetStatus(STATUS_IN_PROGRESS); + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + if (Player* p = ObjectAccessor::FindPlayer(itr->first)) + p->RemoveAurasDueToSpell(SPELL_PREPARATION); } if (TotalTime >= 30000) { @@ -371,7 +383,6 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) { RoundScores[1].time = BG_SA_ROUNDLENGTH; RoundScores[1].winner = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE; - if (RoundScores[0].time == RoundScores[1].time) EndBattleground(0); else if (RoundScores[0].time < RoundScores[1].time) @@ -411,7 +422,7 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_SA_BONUS_TIMER) << uint32(0); - data << uint32(BG_SA_HORDE_ATTACKS)<< horde_attacks; + data << uint32(BG_SA_HORDE_ATTACKS) << horde_attacks; data << uint32(BG_SA_ALLY_ATTACKS) << ally_attacks; //Time will be sent on first update... @@ -420,13 +431,13 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0); data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0); - data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0); - data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0); - data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0); + data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); + data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); + data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); - data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); - data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); - data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); + data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); + data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks; data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks; @@ -450,9 +461,9 @@ void BattlegroundSA::AddPlayer(Player* player) player->CastSpell(player, 12438, true);//Without this player falls before boat loads... if (urand(0, 1)) - player->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0); + player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0); else - player->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0); + player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0); } else @@ -513,14 +524,18 @@ void BattlegroundSA::TeleportPlayers() player->ResetAllPowers(); player->CombatStopWithPets(true); + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + if (Player* p = ObjectAccessor::FindPlayer(itr->first)) + p->CastSpell(p, SPELL_PREPARATION, true); + if (player->GetTeamId() == Attackers) { player->CastSpell(player, 12438, true); //Without this player falls before boat loads... if (urand(0, 1)) - player->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0); + player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0); else - player->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0); + player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0); } else player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); @@ -572,13 +587,13 @@ void BattlegroundSA::OverrideGunFaction() if (!BgCreatures[0]) return; - for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++) + for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10; i++) { if (Creature* gun = GetBGCreature(i)) - gun->setFaction(BG_SA_Factions[Attackers? TEAM_ALLIANCE : TEAM_HORDE]); + gun->setFaction(BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE]); } - for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4;i++) + for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) { if (Creature* dem = GetBGCreature(i)) dem->setFaction(BG_SA_Factions[Attackers]); @@ -590,6 +605,7 @@ void BattlegroundSA::DemolisherStartState(bool start) if (!BgCreatures[0]) return; + // set flags only for the demolishers on the beach, factory ones dont need it for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) { if (Creature* dem = GetBGCreature(i)) @@ -636,6 +652,8 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go) if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED) rewardHonor = false; break; + default: + break; } if (i < 5) @@ -663,7 +681,7 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveYard(Player* player) safeloc = BG_SA_GYEntries[BG_SA_DEFENDER_LAST_GY]; closest = sWorldSafeLocsStore.LookupEntry(safeloc); - nearest = sqrt((closest->x - x)*(closest->x - x) + (closest->y - y)*(closest->y - y)+(closest->z - z)*(closest->z - z)); + nearest = sqrt((closest->x - x)*(closest->x - x) + (closest->y - y)*(closest->y - y) + (closest->z - z)*(closest->z - z)); for (uint8 i = BG_SA_RIGHT_CAPTURABLE_GY; i < BG_SA_MAX_GY; i++) { @@ -671,7 +689,7 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveYard(Player* player) continue; ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); - dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y)+(ret->z - z)*(ret->z - z)); + dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y) + (ret->z - z)*(ret->z - z)); if (dist < nearest) { closest = ret; @@ -737,7 +755,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) case BG_SA_LEFT_CAPTURABLE_GY: flag = BG_SA_LEFT_FLAG; DelObject(flag); - AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)), + AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)), BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1], BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY); @@ -746,8 +764,18 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1], BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]); - UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0)); - UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1)); + for (uint8 j = BG_SA_DEMOLISHER_7; j <= BG_SA_DEMOLISHER_8; j++) + { + AddCreature(BG_SA_NpcEntries[j], j, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE), + BG_SA_NpcSpawnlocs[j][0], BG_SA_NpcSpawnlocs[j][1], + BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600); + + if (Creature* dem = GetBGCreature(j)) + dem->setFaction(BG_SA_Factions[Attackers]); + } + + UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); + UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); if (Source->GetTeamId() == TEAM_ALLIANCE) SendWarningToAll(LANG_BG_SA_A_GY_WEST); else @@ -756,7 +784,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) case BG_SA_RIGHT_CAPTURABLE_GY: flag = BG_SA_RIGHT_FLAG; DelObject(flag); - AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)), + AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)), BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1], BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY); @@ -765,8 +793,18 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1], BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]); - UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0)); - UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1)); + for (uint8 j = BG_SA_DEMOLISHER_5; j <= BG_SA_DEMOLISHER_6; j++) + { + AddCreature(BG_SA_NpcEntries[j], j, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE), + BG_SA_NpcSpawnlocs[j][0], BG_SA_NpcSpawnlocs[j][1], + BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600); + + if (Creature* dem = GetBGCreature(j)) + dem->setFaction(BG_SA_Factions[Attackers]); + } + + UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); + UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); if (Source->GetTeamId() == TEAM_ALLIANCE) SendWarningToAll(LANG_BG_SA_A_GY_EAST); else @@ -775,12 +813,12 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) case BG_SA_CENTRAL_CAPTURABLE_GY: flag = BG_SA_CENTRAL_FLAG; DelObject(flag); - AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)), + AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)), BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1], BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY); - UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0)); - UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1)); + UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); + UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); if (Source->GetTeamId() == TEAM_ALLIANCE) SendWarningToAll(LANG_BG_SA_A_GY_SOUTH); else @@ -794,7 +832,11 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object) { - if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC] && GateStatus[BG_SA_ANCIENT_GATE] == BG_SA_GATE_DESTROYED && GateStatus[BG_SA_YELLOW_GATE] == BG_SA_GATE_DESTROYED && (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED) && (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)) + if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC] && + GateStatus[BG_SA_ANCIENT_GATE] == BG_SA_GATE_DESTROYED && + GateStatus[BG_SA_YELLOW_GATE] == BG_SA_GATE_DESTROYED && + (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED) && + (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)) { if (Source->GetTeamId() == Attackers) { @@ -872,7 +914,7 @@ void BattlegroundSA::EndBattleground(uint32 winner) void BattlegroundSA::UpdateDemolisherSpawns() { - for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) + for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_8; i++) { if (BgCreatures[i]) { @@ -881,21 +923,16 @@ void BattlegroundSA::UpdateDemolisherSpawns() if (Demolisher->isDead()) { // Demolisher is not in list - if (DemoliserRespawnList.find(i)==DemoliserRespawnList.end()) + if (DemoliserRespawnList.find(i) == DemoliserRespawnList.end()) { - DemoliserRespawnList[i]=getMSTime()+30000; + DemoliserRespawnList[i] = getMSTime()+30000; } else { if (DemoliserRespawnList[i] < getMSTime()) { - uint8 gy = (i >= BG_SA_DEMOLISHER_3 ? 3 : 2); - if (GraveyardStatus[gy] == Attackers) - Demolisher->Relocate(BG_SA_NpcSpawnlocs[i + 11][0], BG_SA_NpcSpawnlocs[i + 11][1], - BG_SA_NpcSpawnlocs[i + 11][2], BG_SA_NpcSpawnlocs[i + 11][3]); - else - Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1], - BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]); + Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1], + BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]); Demolisher->Respawn(); DemoliserRespawnList.erase(i); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 748db56dc77..6de3731da50 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -126,15 +126,19 @@ enum BG_SA_NPCs BG_SA_GUN_8, BG_SA_GUN_9, BG_SA_GUN_10, - BG_SA_DEMOLISHER_1, - BG_SA_DEMOLISHER_2, - BG_SA_DEMOLISHER_3, - BG_SA_DEMOLISHER_4, BG_SA_NPC_TRIGGER_1, BG_SA_NPC_TRIGGER_2, BG_SA_NPC_TRIGGER_3, BG_SA_NPC_TRIGGER_4, BG_SA_NPC_TRIGGER_5, + BG_SA_DEMOLISHER_1, + BG_SA_DEMOLISHER_2, + BG_SA_DEMOLISHER_3, + BG_SA_DEMOLISHER_4, + BG_SA_DEMOLISHER_5, + BG_SA_DEMOLISHER_6, + BG_SA_DEMOLISHER_7, + BG_SA_DEMOLISHER_8, BG_SA_NPC_SPARKLIGHT, BG_SA_NPC_RIGSPARK, BG_SA_MAXNPC @@ -160,17 +164,22 @@ uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC] = NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, - // 4 beach demolishers - NPC_DEMOLISHER_SA, - NPC_DEMOLISHER_SA, - NPC_DEMOLISHER_SA, - NPC_DEMOLISHER_SA, // Triggers 23472, 23472, 23472, 23472, 23472, + // 4 beach demolishers + NPC_DEMOLISHER_SA, + NPC_DEMOLISHER_SA, + NPC_DEMOLISHER_SA, + NPC_DEMOLISHER_SA, + // 4 factory demolishers + NPC_DEMOLISHER_SA, + NPC_DEMOLISHER_SA, + NPC_DEMOLISHER_SA, + NPC_DEMOLISHER_SA, // Used Demolisher Salesman NPC_RIGGER_SPARKLIGHT, NPC_GORGRIL_RIGSPARK @@ -189,25 +198,25 @@ float const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = { 1249.634f, -224.189f, 66.72f, 0.635f }, { 1236.213f, 92.287f, 64.965f, 5.751f }, { 1215.11f, 57.772f, 64.739f, 5.78f }, - // Demolishers - { 1611.597656f, -117.270073f, 8.719355f, 2.513274f}, - { 1575.562500f, -158.421875f, 5.024450f, 2.129302f}, - { 1618.047729f, 61.424641f, 7.248210f, 3.979351f}, - { 1575.103149f, 98.873344f, 2.830360f, 3.752458f}, // Triggers { 1453.49f, -250.453f, 30.896f, 4.2883f}, { 1377.05f, 97.036f, 30.8605f, 2.46539f}, { 1186.05f, 58.8048f, 56.5491f, 2.75992f}, { 1042.83f, -72.839f, 84.8145f, 3.58615f}, { 1233.62f, -250.49f, 55.4036f, 3.7016f}, - // Npcs - { 1348.644165f, -298.786469f, 31.080130f, 1.710423f}, - { 1358.191040f, 195.527786f, 31.018187f, 4.171337f}, + // Demolishers + { 1611.597656f, -117.270073f, 8.719355f, 2.513274f}, + { 1575.562500f, -158.421875f, 5.024450f, 2.129302f}, + { 1618.047729f, 61.424641f, 7.248210f, 3.979351f}, + { 1575.103149f, 98.873344f, 2.830360f, 3.752458f}, // Demolishers 2 { 1371.055786f, -317.071136f, 35.007359f, 1.947460f}, { 1424.034912f, -260.195190f, 31.084425f, 2.820013f}, { 1353.139893f, 223.745438f, 35.265411f, 4.343684f}, - { 1404.809570f, 197.027237f, 32.046032f, 3.605401f} + { 1404.809570f, 197.027237f, 32.046032f, 3.605401f}, + // Npcs + { 1348.644165f, -298.786469f, 31.080130f, 1.710423f}, + { 1358.191040f, 195.527786f, 31.018187f, 4.171337f} }; enum BG_SA_Objects -- cgit v1.2.3 From 0aa63988654e2e436974615575ddb8bf2be9c8ab Mon Sep 17 00:00:00 2001 From: Retriman Date: Sun, 7 Oct 2012 11:51:56 -0400 Subject: Core/Misc: Not produce the error "can not do that while moving" to dismount. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index f28a02a52fc..4fa0468cf35 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2863,6 +2863,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode { target->RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING_FLY); target->GetMotionMaster()->MoveFall(); + target->m_movementInfo.SetFallTime(0); } Player* player = target->ToPlayer(); -- cgit v1.2.3 From 76d19ede4f9a315f85df3f458e69f13619547ba0 Mon Sep 17 00:00:00 2001 From: Retriman Date: Sun, 7 Oct 2012 14:36:53 -0400 Subject: Core/Misc: Shapeshift druid flying now displays an animation of falling. --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index f28a02a52fc..a8b37581c19 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3254,9 +3254,8 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp, target->SetCanFly(apply); if (!apply) { - target->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); - target->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); target->m_movementInfo.SetFallTime(0); + target->RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING_FLY); } Player* player = target->ToPlayer(); -- cgit v1.2.3 From 3c2a5239805f37d2167377fa9c06e369b624c53b Mon Sep 17 00:00:00 2001 From: Retriman Date: Sun, 7 Oct 2012 14:46:29 -0400 Subject: Core/Spells:Ranged spells cant be parried or dodged. --- src/server/game/Entities/Unit/Unit.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0a3876c6946..d60ad3899d8 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2302,6 +2302,9 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) // Ranged attacks can only miss, resist and deflect if (attType == RANGED_ATTACK) { + canParry = false; + canDodge = false; + // only if in front if (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) { -- cgit v1.2.3 From 42d606a81bf347bb5bcd185d994a494c6c5dc986 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 7 Oct 2012 19:02:59 -0500 Subject: Core/Spells: Fixed a crash caused by Beacon of Light. GroupReference sources should always be checked against NULL pointers. --- src/server/game/Entities/Unit/Unit.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 54559507cf4..7c59c8421ed 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6637,7 +6637,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere return false; triggered_spell_id = 0; Unit* beaconTarget = NULL; - if (this->GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) { beaconTarget = triggeredByAura->GetBase()->GetCaster(); if (beaconTarget == this || !(beaconTarget->GetAura(53563, victim->GetGUID()))) @@ -6647,23 +6647,24 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } else { // Check Party/Raid Group - if (Group *group = this->ToPlayer()->GetGroup()) + if (Group* group = ToPlayer()->GetGroup()) { - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* Member = itr->getSource(); - - // check if it was heal by paladin which casted this beacon of light - if (Member->GetAura(53563, victim->GetGUID())) + if (Player* member = itr->getSource()) { - // do not proc when target of beacon of light is healed - if (Member == this) - return false; + // check if it was heal by paladin which casted this beacon of light + if (member->GetAura(53563, victim->GetGUID())) + { + // do not proc when target of beacon of light is healed + if (member == this) + return false; - beaconTarget = Member; - basepoints0 = int32(damage); - triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654; - break; + beaconTarget = member; + basepoints0 = int32(damage); + triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654; + break; + } } } } @@ -6674,8 +6675,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, NULL, NULL, true, 0, triggeredByAura); return true; } - else - return false; + + return false; } // Judgements of the Wise if (dummySpell->SpellIconID == 3017) -- cgit v1.2.3 From 4dc28e94204ca006b7f3593aba7fa058d427070e Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 7 Oct 2012 19:31:13 -0500 Subject: Core/SAI: Fixes crashes when using SMART_EVENT_[IC/OOC]_LOS It should also fix some wrong behaviors in scripts that use these events. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index f37ae4fa60e..49023b2d5b5 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2821,9 +2821,10 @@ void SmartScript::InitTimer(SmartScriptHolder& e) case SMART_EVENT_UPDATE: case SMART_EVENT_UPDATE_IC: case SMART_EVENT_UPDATE_OOC: - case SMART_EVENT_OOC_LOS: - case SMART_EVENT_IC_LOS: RecalcTimer(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max); + case SMART_EVENT_IC_LOS: + case SMART_EVENT_OOC_LOS: + RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); break; default: e.active = true; -- cgit v1.2.3 From 0f166336caaf33eb01cffe19d5bb49f729d8d22d Mon Sep 17 00:00:00 2001 From: trickerer Date: Sun, 7 Oct 2012 19:42:06 -0500 Subject: Core/Entities: Do not create the model twice for a GameObject. Should fix #5218 (Still need to check) --- src/server/game/Entities/GameObject/GameObject.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index da6e4ef8407..c9874932e3e 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -217,7 +217,6 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa SetDisplayId(goinfo->displayId); - m_model = GameObjectModel::Create(*this); // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 SetGoType(GameobjectTypes(goinfo->type)); SetGoState(go_state); -- cgit v1.2.3 From 5896da6689410f1c06ee86f8b093fb2d370eb84f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 8 Oct 2012 17:21:09 +0100 Subject: some optimization + adding level to CharacterNameData --- src/server/game/Globals/ObjectMgr.cpp | 13 ++++----- src/server/game/Globals/ObjectMgr.h | 2 +- src/server/game/Handlers/CharacterHandler.cpp | 40 +++++++++++---------------- src/server/game/Tools/PlayerDump.cpp | 4 ++- src/server/game/World/World.cpp | 16 +++++++++-- src/server/game/World/World.h | 4 ++- src/server/scripts/Commands/cs_character.cpp | 2 +- 7 files changed, 43 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index ea4386c4d41..b28f8be7805 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7591,7 +7591,7 @@ SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds(uint32 spell_id) } // this allows calculating base reputations to offline players, just by race and class -int32 ObjectMgr::GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint32 playerClass) +int32 ObjectMgr::GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint8 playerClass) { if (!factionEntry) return 0; @@ -7599,13 +7599,12 @@ int32 ObjectMgr::GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint32 raceMask = (1 << (race - 1)); uint32 classMask = (1 << (playerClass-1)); - for (int i=0; i < 4; i++) + for (int i = 0; i < 4; i++) { - if ((factionEntry->BaseRepRaceMask[i] & raceMask || - (factionEntry->BaseRepRaceMask[i] == 0 && - factionEntry->BaseRepClassMask[i] != 0)) && - (factionEntry->BaseRepClassMask[i] & classMask || - factionEntry->BaseRepClassMask[i] == 0)) + if ((!factionEntry->BaseRepClassMask[i] || + factionEntry->BaseRepClassMask[i] & classMask) && + (!factionEntry->BaseRepRaceMask[i] || + factionEntry->BaseRepRaceMask[i] & raceMask)) return factionEntry->BaseRepValue[i]; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 81ca02af5d9..7871bbe3239 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -749,7 +749,7 @@ class ObjectMgr return NULL; } - int32 GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint32 playerClass); + int32 GetBaseReputation(FactionEntry const* factionEntry, uint8 race, uint8 playerClass); RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const { diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 30bc6df0539..91388d9bf11 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -660,7 +660,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte std::string IP_str = GetRemoteAddress(); sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); - sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass()); + sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel()); newChar.CleanupsBeforeDelete(); delete createInfo; @@ -1626,22 +1626,14 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) uint32 lowGuid = GUID_LOPART(guid); // get the players old (at this moment current) race - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_RACE); - stmt->setUInt32(0, guid); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - if (!result) - { - WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); - data << uint8(CHAR_CREATE_ERROR); - SendPacket(&data); - return; - } - Field* fields = result->Fetch(); - uint8 oldRace = fields[0].GetUInt8(); + CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGuid); + uint8 oldRace = nameData->m_race; + uint8 playerClass = nameData->m_class; + uint8 level = nameData->m_level; - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN); stmt->setUInt32(0, lowGuid); - result = CharacterDatabase.Query(stmt); + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { @@ -1651,9 +1643,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) return; } - fields = result->Fetch(); - uint32 playerClass = uint32(fields[0].GetUInt8()); - uint32 level = uint32(fields[1].GetUInt8()); + Field* fields = result->Fetch(); uint32 at_loginFlags = fields[2].GetUInt16(); uint32 used_loginFlag = ((recv_data.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION); char const* knownTitlesStr = fields[3].GetCString(); @@ -2015,10 +2005,12 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) { uint32 reputation_alliance = it->first; uint32 reputation_horde = it->second; + uint32 newReputation = (team == TEAM_ALLIANCE) ? reputation_alliance : reputation_horde; + uint32 oldReputation = (team == TEAM_ALLIANCE) ? reputation_horde : reputation_alliance; // select old standing set in db PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_REP_BY_FACTION); - stmt->setUInt32(0, team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance); + stmt->setUInt32(0, oldReputation); stmt->setUInt32(1, lowGuid); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -2032,27 +2024,27 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) Field* fields = result->Fetch(); int32 oldDBRep = fields[0].GetInt32(); - FactionEntry const* factionEntry = sFactionStore.LookupEntry(team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(oldReputation); // old base reputation int32 oldBaseRep = sObjectMgr->GetBaseReputation(factionEntry, oldRace, playerClass); // new base reputation - int32 newBaseRep = sObjectMgr->GetBaseReputation(sFactionStore.LookupEntry(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde), race, playerClass); + int32 newBaseRep = sObjectMgr->GetBaseReputation(sFactionStore.LookupEntry(newReputation), race, playerClass); // final reputation shouldnt change int32 FinalRep = oldDBRep + oldBaseRep; int32 newDBRep = FinalRep - newBaseRep; stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REP_BY_FACTION); - stmt->setUInt32(0, uint16(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde)); + stmt->setUInt32(0, newReputation); stmt->setUInt32(1, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REP_FACTION_CHANGE); - stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde)); + stmt->setUInt16(0, uint16(newReputation)); stmt->setInt32(1, newDBRep); - stmt->setUInt16(2, uint16(team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance)); + stmt->setUInt16(2, uint16(oldReputation)); stmt->setUInt32(3, lowGuid); trans->Append(stmt); } diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index f6d0de28d28..ef516a0ba4f 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -457,6 +457,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s uint8 gender = GENDER_NONE; uint8 race = RACE_NONE; uint8 playerClass = 0; + uint8 level = 1; SQLTransaction trans = CharacterDatabase.BeginTransaction(); while (!feof(fin)) @@ -531,6 +532,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s race = uint8(atol(getnth(line, 4).c_str())); playerClass = uint8(atol(getnth(line, 5).c_str())); gender = uint8(atol(getnth(line, 6).c_str())); + level = uint8(atol(getnth(line, 7).c_str())); if (name == "") { // check if the original name already exists @@ -674,7 +676,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s CharacterDatabase.CommitTransaction(trans); // in case of name conflict player has to rename at login anyway - sWorld->AddCharacterNameData(guid, name, gender, race, playerClass); + sWorld->AddCharacterNameData(guid, name, gender, race, playerClass, level); sObjectMgr->_hiItemGuid += items.size(); sObjectMgr->_mailId += mails.size(); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index eef53e17774..06e8d3eccbe 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2937,7 +2937,7 @@ void World::LoadCharacterNameData() { sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data"); - QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL"); + QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class, level FROM characters WHERE deleteDate IS NULL"); if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, "No character name data loaded, empty query"); @@ -2950,20 +2950,21 @@ void World::LoadCharacterNameData() { Field* fields = result->Fetch(); AddCharacterNameData(fields[0].GetUInt32(), fields[1].GetString(), - fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/); + fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/, fields[5].GetUInt8() /*level*/); ++count; } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loaded name data for %u characters", count); } -void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass) +void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level) { CharacterNameData& data = _characterNameDataMap[guid]; data.m_name = name; data.m_race = race; data.m_gender = gender; data.m_class = playerClass; + data.m_level = level; } void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/) @@ -2981,6 +2982,15 @@ void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 itr->second.m_race = race; } +void World::UpdateCharacterNameDataLevel(uint32 guid, uint8 level) +{ + std::map::iterator itr = _characterNameDataMap.find(guid); + if (itr == _characterNameDataMap.end()) + return; + + itr->second.m_level = level; +} + CharacterNameData const* World::GetCharacterNameData(uint32 guid) const { std::map::const_iterator itr = _characterNameDataMap.find(guid); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 90bb82f1c2e..66b52549e93 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -538,6 +538,7 @@ struct CharacterNameData uint8 m_class; uint8 m_race; uint8 m_gender; + uint8 m_level; }; /// The World @@ -759,8 +760,9 @@ class World bool isEventKillStart; CharacterNameData const* GetCharacterNameData(uint32 guid) const; - void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass); + void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level); void UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE); + void UpdateCharacterNameDataLevel(uint32 guid, uint8 level); void DeleteCharaceterNameData(uint32 guid) { _characterNameDataMap.erase(guid); } uint32 GetCleaningFlags() const { return m_CleaningFlags; } diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index f5fbfa33cae..080b2416c9a 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -224,7 +224,7 @@ public: stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); stmt->setUInt32(0, delInfo.lowGuid); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) - sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8()); + sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[2].GetUInt8()); } static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler) -- cgit v1.2.3 From 405c3b09aa9fc9ea5750f0221d7f4974dd65b67f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 8 Oct 2012 17:29:02 +0100 Subject: adding a new prepared statement for selecting char at_login and titles --- src/server/game/Handlers/CharacterHandler.cpp | 6 +++--- src/server/shared/Database/Implementation/CharacterDatabase.cpp | 3 ++- src/server/shared/Database/Implementation/CharacterDatabase.h | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 91388d9bf11..853e71fd732 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1631,7 +1631,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) uint8 playerClass = nameData->m_class; uint8 level = nameData->m_level; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_AT_LOGIN_TITLES); stmt->setUInt32(0, lowGuid); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -1644,9 +1644,9 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) } Field* fields = result->Fetch(); - uint32 at_loginFlags = fields[2].GetUInt16(); + uint32 at_loginFlags = fields[0].GetUInt16(); + char const* knownTitlesStr = fields[1].GetCString(); uint32 used_loginFlag = ((recv_data.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION); - char const* knownTitlesStr = fields[3].GetCString(); if (!sObjectMgr->GetPlayerInfo(race, playerClass)) { diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 4396f67244a..c29d8313c20 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -49,7 +49,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_CHAR_RACE, "SELECT race FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_LEVEL, "SELECT level FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_ZONE, "SELECT zone FROM characters WHERE guid = ?", CONNECTION_SYNCH); - PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender, level FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION_XYZ, "SELECT map, position_x, position_y, position_z FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION, "SELECT position_x, position_y, position_z, orientation, map, taxi_path FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_DAILY, "DELETE FROM character_queststatus_daily", CONNECTION_ASYNC); @@ -421,6 +421,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_POOL_QUEST_SAVE, "SELECT quest_id FROM pool_quest_save WHERE pool_id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHARACTER_AT_LOGIN, "SELECT at_login FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN, "SELECT class, level, at_login, knownTitles FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_AT_LOGIN_TITLES, "SELECT at_login, knownTitles FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_INSTANCE, "SELECT data, completedEncounters FROM instance WHERE map = ? AND id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_PET_SPELL_LIST, "SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet WHERE character_pet.owner = ? AND character_pet.id = pet_spell.guid AND character_pet.id <> ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_PET, "SELECT id FROM character_pet WHERE owner = ? AND id <> ?", CONNECTION_SYNCH); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 95b059de95c..88018997e4b 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -384,6 +384,7 @@ enum CharacterDatabaseStatements CHAR_SEL_POOL_QUEST_SAVE, CHAR_SEL_CHARACTER_AT_LOGIN, CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN, + CHAR_SEL_CHAR_AT_LOGIN_TITLES, CHAR_SEL_INSTANCE, CHAR_SEL_PET_SPELL_LIST, CHAR_SEL_CHAR_PET, -- cgit v1.2.3 From 05eaf75501a69a4b9561ed245f07a4d0a7871f1d Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 8 Oct 2012 20:02:11 +0100 Subject: adding forgotten UpdateCharacterNameDataLevel call --- src/server/game/Entities/Unit/Unit.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 54559507cf4..b499714e341 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13661,6 +13661,9 @@ void Unit::SetLevel(uint8 lvl) // group update if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetGroup()) ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL); + + if (GetTypeId() == TYPEID_PLAYER) + sWorld->UpdateCharacterNameDataLevel(ToPlayer()->GetGUIDLow(), lvl); } void Unit::SetHealth(uint32 val) -- cgit v1.2.3 From 0620d2249131d681529f8a69f8bbec5e1773ad4d Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 8 Oct 2012 18:33:17 -0500 Subject: Core/SAI: Added a missing break. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 49023b2d5b5..6097edf6641 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2822,6 +2822,7 @@ void SmartScript::InitTimer(SmartScriptHolder& e) case SMART_EVENT_UPDATE_IC: case SMART_EVENT_UPDATE_OOC: RecalcTimer(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max); + break; case SMART_EVENT_IC_LOS: case SMART_EVENT_OOC_LOS: RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); -- cgit v1.2.3 From 2958f64ffcd10ca7ea6b10e0b70befa5df718930 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 9 Oct 2012 14:53:06 +0200 Subject: Scripts/Misc: Correct two wrong urand's (found by Aokromes) --- src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp | 2 +- src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 676cd7be4f0..9ee3428c7dd 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -168,7 +168,7 @@ public: void Reset() { - uiDarkOffering = urand(290, 10); + uiDarkOffering = urand(200, 1000); } void UpdateAI(uint32 const uiDiff) diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index b6a4c40abdd..31b7787623c 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -86,7 +86,7 @@ public: uiConsumeTimer = 15*IN_MILLISECONDS; uiAuraCountTimer = 15500; uiCrushTimer = urand(1*IN_MILLISECONDS, 5*IN_MILLISECONDS); - uiInfectedWoundTimer = urand(60*IN_MILLISECONDS, 10*IN_MILLISECONDS); + uiInfectedWoundTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS); uiExplodeCorpseTimer = 3*IN_MILLISECONDS; uiSpawnTimer = urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS); -- cgit v1.2.3 From b75b6d33b02120e27b226a65c3d2a0641257cf8e Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 9 Oct 2012 22:50:02 -0500 Subject: Core/Achievements: Fixed achievements with ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA Closes #6339 --- src/server/game/Achievements/AchievementMgr.cpp | 10 +++++++++- src/server/game/Battlegrounds/Battleground.cpp | 1 + src/server/game/DataStores/DBCStructure.h | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index b77de70c399..fe4bbea34fb 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -1596,6 +1596,13 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui break; } + case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA: // This also behaves like ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA + { + // Check map id requirement + if (miscValue1 == achievementCriteria->win_arena.mapID) + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + } // std case: not exist in DBC, not triggered in code as result case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER: @@ -1606,7 +1613,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui break; // FIXME: not triggered in code as result, need to implement case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID: - case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA: case ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA: case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK: case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: @@ -1749,6 +1755,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve return progress->counter >= achievementCriteria->use_lfg.dungeonsComplete; case ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS: return progress->counter >= achievementCriteria->get_killing_blow.killCount; + case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA: + return achievementCriteria->win_arena.count && progress->counter >= achievementCriteria->win_arena.count; // handle all statistic-only criteria here case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP: diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index b33140a3419..8c1b3957b6d 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -856,6 +856,7 @@ void Battleground::EndBattleground(uint32 winner) // update achievement BEFORE personal rating update uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot()); player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId()); winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange); } diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index e4ba3ebb12e..538a53344e8 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -221,7 +221,8 @@ struct AchievementCriteriaEntry // ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32 struct { - uint32 mapID; // 3 Reference to Map.dbc + uint32 mapID; // 3 Reference to Map.dbc + uint32 count; // 4 Number of times that the arena must be won. } win_arena; // ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33 -- cgit v1.2.3 From 3e5af53bf75fdacdb8626e4fd95a5c889874a829 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 9 Oct 2012 22:59:18 -0500 Subject: Core/Achievements: ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL doesn't require a killing blow anymore, only a honorable kill. Author: @tibbi Closes #6224 --- src/server/game/Entities/Player/Player.cpp | 7 +++++++ src/server/game/Entities/Unit/Unit.cpp | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 50f5fd4c978..9b2921b844d 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -598,9 +598,16 @@ void KillRewarder::_RewardGroup() // 3.1.3. Reward each group member (even dead or corpse) within reward distance. for (GroupReference* itr = _group->GetFirstMember(); itr != NULL; itr = itr->next()) + { if (Player* member = itr->getSource()) + { if (member->IsAtGroupRewardDistance(_victim)) + { _RewardPlayer(member, isDungeon); + member->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, _victim); + } + } + } } } } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 76b9649f002..8fc519b2f4a 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -703,14 +703,8 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam sLog->outDebug(LOG_FILTER_UNITS, "DealDamage: victim just died"); if (victim->GetTypeId() == TYPEID_PLAYER && victim != this) - { victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); - // call before auras are removed - if (Player* killer = GetCharmerOrOwnerPlayerOrPlayerItself()) - killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, victim); - } - Kill(victim, durabilityLoss); } else -- cgit v1.2.3 From ecc2362c69e24b2afc762bc32d11453d537a84fb Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 10 Oct 2012 09:25:25 -0500 Subject: Scripts/Commands: Fixed the command to restore a deleted character. Thanks @vlad852 --- src/server/scripts/Commands/cs_character.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 080b2416c9a..1f32368adfd 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -224,7 +224,7 @@ public: stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); stmt->setUInt32(0, delInfo.lowGuid); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) - sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[2].GetUInt8()); + sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8()); } static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler) -- cgit v1.2.3