aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp302
1 files changed, 161 insertions, 141 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 11ffba972a3..13f37a50b05 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -54,6 +54,7 @@
#include "Transports.h"
#include "Weather.h"
#include "BattleGround.h"
+#include "BattleGroundAV.h"
#include "BattleGroundMgr.h"
#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"
@@ -4160,7 +4161,7 @@ void Player::RepopAtGraveyard()
// Special handle for battleground maps
BattleGround *bg = sBattleGroundMgr.GetBattleGround(GetBattleGroundId());
- if(bg && (bg->GetTypeID() == BATTLEGROUND_AB || bg->GetTypeID() == BATTLEGROUND_EY))
+ if(bg && (bg->GetTypeID() == BATTLEGROUND_AB || bg->GetTypeID() == BATTLEGROUND_EY || bg->GetTypeID() == BATTLEGROUND_AV))
ClosestGrave = bg->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetTeam());
else
ClosestGrave = objmgr.GetClosestGraveYard( GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam() );
@@ -7215,6 +7216,16 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
{
uint32 lootid = go->GetLootId();
+ //TODO: fix this big hack
+ if((go->GetEntry() == BG_AV_OBJECTID_MINE_N || go->GetEntry() == BG_AV_OBJECTID_MINE_S))
+ if( BattleGround *bg = GetBattleGround())
+ if(bg->GetTypeID() == BATTLEGROUND_AV)
+ if(!(((BattleGroundAV*)bg)->PlayerCanDoMineQuest(go->GetEntry(),GetTeam())))
+ {
+ SendLootRelease(guid);
+ return;
+ }
+
if(lootid)
{
sLog.outDebug(" if(lootid)");
@@ -7291,6 +7302,8 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
bones->lootForBody = true;
uint32 pLevel = bones->loot.gold;
bones->loot.clear();
+ if(GetBattleGround()->GetTypeID() == BATTLEGROUND_AV)
+ loot->FillLoot(1, LootTemplates_Creature, this);
// It may need a better formula
// Now it works like this: lvl10: ~6copper, lvl70: ~9silver
bones->loot.gold = (uint32)( urand(50, 150) * 0.016f * pow( ((float)pLevel)/5.76f, 2.5f) * sWorld.getRate(RATE_DROP_MONEY) );
@@ -7664,81 +7677,86 @@ void Player::SendInitWorldStates(bool forceZone, uint32 forceZoneId)
}
break;
case 2597: // AV
- data << uint32(0x7ae) << uint32(0x1); // 7
- data << uint32(0x532) << uint32(0x1); // 8
- data << uint32(0x531) << uint32(0x0); // 9
- data << uint32(0x52e) << uint32(0x0); // 10
- data << uint32(0x571) << uint32(0x0); // 11
- data << uint32(0x570) << uint32(0x0); // 12
- data << uint32(0x567) << uint32(0x1); // 13
- data << uint32(0x566) << uint32(0x1); // 14
- data << uint32(0x550) << uint32(0x1); // 15
- data << uint32(0x544) << uint32(0x0); // 16
- data << uint32(0x536) << uint32(0x0); // 17
- data << uint32(0x535) << uint32(0x1); // 18
- data << uint32(0x518) << uint32(0x0); // 19
- data << uint32(0x517) << uint32(0x0); // 20
- data << uint32(0x574) << uint32(0x0); // 21
- data << uint32(0x573) << uint32(0x0); // 22
- data << uint32(0x572) << uint32(0x0); // 23
- data << uint32(0x56f) << uint32(0x0); // 24
- data << uint32(0x56e) << uint32(0x0); // 25
- data << uint32(0x56d) << uint32(0x0); // 26
- data << uint32(0x56c) << uint32(0x0); // 27
- data << uint32(0x56b) << uint32(0x0); // 28
- data << uint32(0x56a) << uint32(0x1); // 29
- data << uint32(0x569) << uint32(0x1); // 30
- data << uint32(0x568) << uint32(0x1); // 13
- data << uint32(0x565) << uint32(0x0); // 32
- data << uint32(0x564) << uint32(0x0); // 33
- data << uint32(0x563) << uint32(0x0); // 34
- data << uint32(0x562) << uint32(0x0); // 35
- data << uint32(0x561) << uint32(0x0); // 36
- data << uint32(0x560) << uint32(0x0); // 37
- data << uint32(0x55f) << uint32(0x0); // 38
- data << uint32(0x55e) << uint32(0x0); // 39
- data << uint32(0x55d) << uint32(0x0); // 40
- data << uint32(0x3c6) << uint32(0x4); // 41
- data << uint32(0x3c4) << uint32(0x6); // 42
- data << uint32(0x3c2) << uint32(0x4); // 43
- data << uint32(0x516) << uint32(0x1); // 44
- data << uint32(0x515) << uint32(0x0); // 45
- data << uint32(0x3b6) << uint32(0x6); // 46
- data << uint32(0x55c) << uint32(0x0); // 47
- data << uint32(0x55b) << uint32(0x0); // 48
- data << uint32(0x55a) << uint32(0x0); // 49
- data << uint32(0x559) << uint32(0x0); // 50
- data << uint32(0x558) << uint32(0x0); // 51
- data << uint32(0x557) << uint32(0x0); // 52
- data << uint32(0x556) << uint32(0x0); // 53
- data << uint32(0x555) << uint32(0x0); // 54
- data << uint32(0x554) << uint32(0x1); // 55
- data << uint32(0x553) << uint32(0x1); // 56
- data << uint32(0x552) << uint32(0x1); // 57
- data << uint32(0x551) << uint32(0x1); // 58
- data << uint32(0x54f) << uint32(0x0); // 59
- data << uint32(0x54e) << uint32(0x0); // 60
- data << uint32(0x54d) << uint32(0x1); // 61
- data << uint32(0x54c) << uint32(0x0); // 62
- data << uint32(0x54b) << uint32(0x0); // 63
- data << uint32(0x545) << uint32(0x0); // 64
- data << uint32(0x543) << uint32(0x1); // 65
- data << uint32(0x542) << uint32(0x0); // 66
- data << uint32(0x540) << uint32(0x0); // 67
- data << uint32(0x53f) << uint32(0x0); // 68
- data << uint32(0x53e) << uint32(0x0); // 69
- data << uint32(0x53d) << uint32(0x0); // 70
- data << uint32(0x53c) << uint32(0x0); // 71
- data << uint32(0x53b) << uint32(0x0); // 72
- data << uint32(0x53a) << uint32(0x1); // 73
- data << uint32(0x539) << uint32(0x0); // 74
- data << uint32(0x538) << uint32(0x0); // 75
- data << uint32(0x537) << uint32(0x0); // 76
- data << uint32(0x534) << uint32(0x0); // 77
- data << uint32(0x533) << uint32(0x0); // 78
- data << uint32(0x530) << uint32(0x0); // 79
- data << uint32(0x52f) << uint32(0x0); // 80
- data << uint32(0x52d) << uint32(0x1); // 81
+ if (bg && bg->GetTypeID() == BATTLEGROUND_AV)
+ bg->FillInitialWorldStates(data);
+ else
+ {
+ data << uint32(0x7ae) << uint32(0x1); // 7 snowfall n
+ data << uint32(0x532) << uint32(0x1); // 8 frostwolfhut hc
+ data << uint32(0x531) << uint32(0x0); // 9 frostwolfhut ac
+ data << uint32(0x52e) << uint32(0x0); // 10 stormpike firstaid a_a
+ data << uint32(0x571) << uint32(0x0); // 11 east frostwolf tower horde assaulted -unused
+ data << uint32(0x570) << uint32(0x0); // 12 west frostwolf tower horde assaulted - unused
+ data << uint32(0x567) << uint32(0x1); // 13 frostwolfe c
+ data << uint32(0x566) << uint32(0x1); // 14 frostwolfw c
+ data << uint32(0x550) << uint32(0x1); // 15 irondeep (N) ally
+ data << uint32(0x544) << uint32(0x0); // 16 ice grave a_a
+ data << uint32(0x536) << uint32(0x0); // 17 stormpike grave h_c
+ data << uint32(0x535) << uint32(0x1); // 18 stormpike grave a_c
+ data << uint32(0x518) << uint32(0x0); // 19 stoneheart grave a_a
+ data << uint32(0x517) << uint32(0x0); // 20 stoneheart grave h_a
+ data << uint32(0x574) << uint32(0x0); // 21 1396 unk
+ data << uint32(0x573) << uint32(0x0); // 22 iceblood tower horde assaulted -unused
+ data << uint32(0x572) << uint32(0x0); // 23 towerpoint horde assaulted - unused
+ data << uint32(0x56f) << uint32(0x0); // 24 1391 unk
+ data << uint32(0x56e) << uint32(0x0); // 25 iceblood a
+ data << uint32(0x56d) << uint32(0x0); // 26 towerp a
+ data << uint32(0x56c) << uint32(0x0); // 27 frostwolfe a
+ data << uint32(0x56b) << uint32(0x0); // 28 froswolfw a
+ data << uint32(0x56a) << uint32(0x1); // 29 1386 unk
+ data << uint32(0x569) << uint32(0x1); // 30 iceblood c
+ data << uint32(0x568) << uint32(0x1); // 31 towerp c
+ data << uint32(0x565) << uint32(0x0); // 32 stoneh tower a
+ data << uint32(0x564) << uint32(0x0); // 33 icewing tower a
+ data << uint32(0x563) << uint32(0x0); // 34 dunn a
+ data << uint32(0x562) << uint32(0x0); // 35 duns a
+ data << uint32(0x561) << uint32(0x0); // 36 stoneheart bunker alliance assaulted - unused
+ data << uint32(0x560) << uint32(0x0); // 37 icewing bunker alliance assaulted - unused
+ data << uint32(0x55f) << uint32(0x0); // 38 dunbaldar south alliance assaulted - unused
+ data << uint32(0x55e) << uint32(0x0); // 39 dunbaldar north alliance assaulted - unused
+ data << uint32(0x55d) << uint32(0x0); // 40 stone tower d
+ data << uint32(0x3c6) << uint32(0x0); // 41 966 unk
+ data << uint32(0x3c4) << uint32(0x0); // 42 964 unk
+ data << uint32(0x3c2) << uint32(0x0); // 43 962 unk
+ data << uint32(0x516) << uint32(0x1); // 44 stoneheart grave a_c
+ data << uint32(0x515) << uint32(0x0); // 45 stonheart grave h_c
+ data << uint32(0x3b6) << uint32(0x0); // 46 950 unk
+ data << uint32(0x55c) << uint32(0x0); // 47 icewing tower d
+ data << uint32(0x55b) << uint32(0x0); // 48 dunn d
+ data << uint32(0x55a) << uint32(0x0); // 49 duns d
+ data << uint32(0x559) << uint32(0x0); // 50 1369 unk
+ data << uint32(0x558) << uint32(0x0); // 51 iceblood d
+ data << uint32(0x557) << uint32(0x0); // 52 towerp d
+ data << uint32(0x556) << uint32(0x0); // 53 frostwolfe d
+ data << uint32(0x555) << uint32(0x0); // 54 frostwolfw d
+ data << uint32(0x554) << uint32(0x1); // 55 stoneh tower c
+ data << uint32(0x553) << uint32(0x1); // 56 icewing tower c
+ data << uint32(0x552) << uint32(0x1); // 57 dunn c
+ data << uint32(0x551) << uint32(0x1); // 58 duns c
+ data << uint32(0x54f) << uint32(0x0); // 59 irondeep (N) horde
+ data << uint32(0x54e) << uint32(0x0); // 60 irondeep (N) ally
+ data << uint32(0x54d) << uint32(0x1); // 61 mine (S) neutral
+ data << uint32(0x54c) << uint32(0x0); // 62 mine (S) horde
+ data << uint32(0x54b) << uint32(0x0); // 63 mine (S) ally
+ data << uint32(0x545) << uint32(0x0); // 64 iceblood h_a
+ data << uint32(0x543) << uint32(0x1); // 65 iceblod h_c
+ data << uint32(0x542) << uint32(0x0); // 66 iceblood a_c
+ data << uint32(0x540) << uint32(0x0); // 67 snowfall h_a
+ data << uint32(0x53f) << uint32(0x0); // 68 snowfall a_a
+ data << uint32(0x53e) << uint32(0x0); // 69 snowfall h_c
+ data << uint32(0x53d) << uint32(0x0); // 70 snowfall a_c
+ data << uint32(0x53c) << uint32(0x0); // 71 frostwolf g h_a
+ data << uint32(0x53b) << uint32(0x0); // 72 frostwolf g a_a
+ data << uint32(0x53a) << uint32(0x1); // 73 frostwolf g h_c
+ data << uint32(0x539) << uint32(0x0); // 74 frostwolf g a_c
+ data << uint32(0x538) << uint32(0x0); // 75 stormpike grave h_a
+ data << uint32(0x537) << uint32(0x0); // 76 stormpike grave a_a
+ data << uint32(0x534) << uint32(0x0); // 77 frostwolf hut h_a
+ data << uint32(0x533) << uint32(0x0); // 78 frostwolf hut a_a
+ data << uint32(0x530) << uint32(0x0); // 79 stormpike first aid h_a
+ data << uint32(0x52f) << uint32(0x0); // 80 stormpike first aid h_c
+ data << uint32(0x52d) << uint32(0x1); // 81 stormpike first aid a_c
+ }
break;
case 3277: // WS
if (bg && bg->GetTypeID() == BATTLEGROUND_WS)
@@ -13350,7 +13368,8 @@ bool Player::HasQuestForItem( uint32 itemid ) const
// hide quest if player is in raid-group and quest is no raid quest
if(GetGroup() && GetGroup()->isRaidGroup() && qinfo->GetType() != QUEST_TYPE_RAID)
- continue;
+ if(!InBattleGround()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later
+ continue;
// There should be no mixed ReqItem/ReqSource drop
// This part for ReqItem drop
@@ -18045,6 +18064,7 @@ uint32 Player::GetMaxLevelForBattleGroundQueueId(uint32 queue_id)
return 10*(queue_id+2)-1;
}
+//TODO make this more generic - current implementation is wrong
uint32 Player::GetBattleGroundQueueIdFromLevel() const
{
uint32 level = getLevel();
@@ -18700,70 +18720,70 @@ bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const
//-------------TRINITY---------------
//***********************************
-void Player::HandleFallDamage(MovementInfo& movementInfo)
-{
- //Players with Feather Fall or low fall time, or physical immunity (charges used) are ignored
- if (!isInFlight() && movementInfo.fallTime > 1100 && !isDead() && !isGameMaster() &&
- !HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) &&
- !HasAuraType(SPELL_AURA_FLY) && !IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL,true) )
- {
- //Safe fall, fall time reduction
- int32 safe_fall = GetTotalAuraModifier(SPELL_AURA_SAFE_FALL);
- uint32 fall_time = (movementInfo.fallTime > (safe_fall*10)) ? movementInfo.fallTime - (safe_fall*10) : 0;
-
- if(fall_time > 1100) //Prevent damage if fall time < 1100
- {
- //Fall Damage calculation
- float fallperc = float(fall_time)/1100;
- uint32 damage = (uint32)(((fallperc*fallperc -1) / 9 * GetMaxHealth())*sWorld.getRate(RATE_DAMAGE_FALL));
-
- float height = movementInfo.z;
- UpdateGroundPositionZ(movementInfo.x,movementInfo.y,height);
-
- if (damage > 0)
- {
- //Prevent fall damage from being more than the player maximum health
- if (damage > GetMaxHealth())
- damage = GetMaxHealth();
-
- // Gust of Wind
- if (GetDummyAura(43621))
- damage = GetMaxHealth()/2;
-
- EnvironmentalDamage(GetGUID(), DAMAGE_FALL, damage);
- }
-
- //Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction
- DEBUG_LOG("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d" , movementInfo.z, height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
- }
- }
-}
-
-void Player::HandleFallUnderMap()
-{
- if(InBattleGround() && GetBattleGround()
- && GetBattleGround()->HandlePlayerUnderMap(this))
- {
- // do nothing, the handle already did if returned true
- }
- else
- {
- // NOTE: this is actually called many times while falling
- // even after the player has been teleported away
- // TODO: discard movement packets after the player is rooted
- if(isAlive())
- {
- EnvironmentalDamage(GetGUID(),DAMAGE_FALL_TO_VOID, GetMaxHealth());
- // change the death state to CORPSE to prevent the death timer from
- // starting in the next player update
- KillPlayer();
- BuildPlayerRepop();
- }
-
- // cancel the death timer here if started
- RepopAtGraveyard();
- }
-}
+void Player::HandleFallDamage(MovementInfo& movementInfo)
+{
+ //Players with Feather Fall or low fall time, or physical immunity (charges used) are ignored
+ if (!isInFlight() && movementInfo.fallTime > 1100 && !isDead() && !isGameMaster() &&
+ !HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) &&
+ !HasAuraType(SPELL_AURA_FLY) && !IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL,true) )
+ {
+ //Safe fall, fall time reduction
+ int32 safe_fall = GetTotalAuraModifier(SPELL_AURA_SAFE_FALL);
+ uint32 fall_time = (movementInfo.fallTime > (safe_fall*10)) ? movementInfo.fallTime - (safe_fall*10) : 0;
+
+ if(fall_time > 1100) //Prevent damage if fall time < 1100
+ {
+ //Fall Damage calculation
+ float fallperc = float(fall_time)/1100;
+ uint32 damage = (uint32)(((fallperc*fallperc -1) / 9 * GetMaxHealth())*sWorld.getRate(RATE_DAMAGE_FALL));
+
+ float height = movementInfo.z;
+ UpdateGroundPositionZ(movementInfo.x,movementInfo.y,height);
+
+ if (damage > 0)
+ {
+ //Prevent fall damage from being more than the player maximum health
+ if (damage > GetMaxHealth())
+ damage = GetMaxHealth();
+
+ // Gust of Wind
+ if (GetDummyAura(43621))
+ damage = GetMaxHealth()/2;
+
+ EnvironmentalDamage(GetGUID(), DAMAGE_FALL, damage);
+ }
+
+ //Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction
+ DEBUG_LOG("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d" , movementInfo.z, height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
+ }
+ }
+}
+
+void Player::HandleFallUnderMap()
+{
+ if(InBattleGround() && GetBattleGround()
+ && GetBattleGround()->HandlePlayerUnderMap(this))
+ {
+ // do nothing, the handle already did if returned true
+ }
+ else
+ {
+ // NOTE: this is actually called many times while falling
+ // even after the player has been teleported away
+ // TODO: discard movement packets after the player is rooted
+ if(isAlive())
+ {
+ EnvironmentalDamage(GetGUID(),DAMAGE_FALL_TO_VOID, GetMaxHealth());
+ // change the death state to CORPSE to prevent the death timer from
+ // starting in the next player update
+ KillPlayer();
+ BuildPlayerRepop();
+ }
+
+ // cancel the death timer here if started
+ RepopAtGraveyard();
+ }
+}
void Player::Possess(Unit *target)
{