aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/ArenaTeam.cpp2
-rw-r--r--src/game/Formulas.h2
-rw-r--r--src/game/GameEvent.cpp4
-rw-r--r--src/game/Group.cpp11
-rw-r--r--src/game/Group.h2
-rw-r--r--src/game/OutdoorPvPHP.cpp2
-rw-r--r--src/game/Player.cpp15
-rw-r--r--src/game/Totem.cpp2
-rw-r--r--src/game/Unit.cpp3
-rw-r--r--src/game/World.cpp6
10 files changed, 31 insertions, 18 deletions
diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp
index a19ba5951be..e364f7a0e7e 100644
--- a/src/game/ArenaTeam.cpp
+++ b/src/game/ArenaTeam.cpp
@@ -720,7 +720,7 @@ void ArenaTeam::UpdateArenaPointsHelper()
if(stats.games < 10)
return;
// to get points, a player has to participate in at least 30% of the matches
- uint32 min_plays = ceil(stats.games * 0.3);
+ uint32 min_plays = (uint32)ceil(stats.games * 0.3);
for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
{
// the player participated in enough games, update his points
diff --git a/src/game/Formulas.h b/src/game/Formulas.h
index d95cc8c0893..cef4fab9c7b 100644
--- a/src/game/Formulas.h
+++ b/src/game/Formulas.h
@@ -29,7 +29,7 @@ namespace Trinity
{
inline uint32 hk_honor_at_level(uint32 level, uint32 count=1)
{
- return ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f )));
+ return (uint32) ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f )));
}
}
namespace XP
diff --git a/src/game/GameEvent.cpp b/src/game/GameEvent.cpp
index 1cabcbffe1e..496d6b46f76 100644
--- a/src/game/GameEvent.cpp
+++ b/src/game/GameEvent.cpp
@@ -1527,8 +1527,8 @@ void GameEvent::SendWorldStateUpdate(Player * plr, uint16 event_id)
for(itr = mGameEvent[event_id].conditions.begin(); itr !=mGameEvent[event_id].conditions.end(); ++itr)
{
if(itr->second.done_world_state)
- plr->SendUpdateWorldState(itr->second.done_world_state, itr->second.done);
+ plr->SendUpdateWorldState(itr->second.done_world_state, (uint32)(itr->second.done));
if(itr->second.max_world_state)
- plr->SendUpdateWorldState(itr->second.max_world_state, itr->second.reqNum);
+ plr->SendUpdateWorldState(itr->second.max_world_state, (uint32)(itr->second.reqNum));
}
}
diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 98ee161cee3..bf448df36f5 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -26,6 +26,7 @@
#include "World.h"
#include "ObjectMgr.h"
#include "Group.h"
+#include "Formulas.h"
#include "ObjectAccessor.h"
#include "BattleGround.h"
#include "MapManager.h"
@@ -785,7 +786,7 @@ void Group::SetTargetIcon(uint8 id, uint64 guid)
BroadcastPacket(&data);
}
-void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level)
+void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level)
{
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -798,8 +799,16 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_lev
++count;
sum_level += member->getLevel();
+ // store maximum member level
if(!member_with_max_level || member_with_max_level->getLevel() < member->getLevel())
member_with_max_level = member;
+
+ uint32 gray_level = Trinity::XP::GetGrayLevel(member->getLevel());
+ // if the victim is higher level than the gray level of the currently examined group member,
+ // then set not_gray_member_with_max_level if needed.
+ if( victim->getLevel() > gray_level && (!not_gray_member_with_max_level
+ || not_gray_member_with_max_level->getLevel() < member->getLevel()))
+ not_gray_member_with_max_level = member;
}
}
diff --git a/src/game/Group.h b/src/game/Group.h
index c7676926b76..540232731c8 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -217,7 +217,7 @@ class TRINITY_DLL_SPEC Group
MemberSlotList const& GetMemberSlots() const { return m_memberSlots; }
GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); }
uint32 GetMembersCount() const { return m_memberSlots.size(); }
- void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level);
+ void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level);
uint8 GetMemberGroup(uint64 guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
diff --git a/src/game/OutdoorPvPHP.cpp b/src/game/OutdoorPvPHP.cpp
index 9c1971712af..5c59bb6b5e6 100644
--- a/src/game/OutdoorPvPHP.cpp
+++ b/src/game/OutdoorPvPHP.cpp
@@ -121,7 +121,7 @@ bool OutdoorPvPHP::Update(uint32 diff)
else if(m_HordeTowersControlled == 3)
BuffTeam(HORDE);
else
- BuffTeam(NULL);
+ BuffTeam(0);
SendUpdateWorldState(HP_UI_TOWER_COUNT_A, m_AllianceTowersControlled);
SendUpdateWorldState(HP_UI_TOWER_COUNT_H, m_HordeTowersControlled);
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 0ec2ae7b470..f28b763a0cd 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -588,7 +588,7 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_,
else
SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL) );
// set starting gold
- SetUInt32Value( PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_PLAYER_START_GOLD)*10000 );
+ SetUInt32Value( PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_PLAYER_START_GOLD) );
// set starting honor
SetUInt32Value( PLAYER_FIELD_HONOR_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_HONOR) );
@@ -18187,12 +18187,16 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
uint32 count = 0;
uint32 sum_level = 0;
Player* member_with_max_level = NULL;
+ Player* not_gray_member_with_max_level = NULL;
- pGroup->GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level);
+ // gets the max member level of the group, and the max member level that still gets XP
+ pGroup->GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level,not_gray_member_with_max_level);
if(member_with_max_level)
{
- xp = PvP ? 0 : Trinity::XP::Gain(member_with_max_level, pVictim);
+ // PvP kills doesn't yield experience
+ // also no XP gained if there is no member below gray level
+ xp = (PvP || !not_gray_member_with_max_level) ? 0 : Trinity::XP::Gain(not_gray_member_with_max_level, pVictim);
// skip in check PvP case (for speed, not used)
bool is_raid = PvP ? false : sMapStore.LookupEntry(GetMapId())->IsRaid() && pGroup->isRaidGroup();
@@ -18222,9 +18226,10 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
pGroupGuy->RewardReputation(pVictim,is_dungeon ? 1.0f : rate);
// XP updated only for alive group member
- if(pGroupGuy->isAlive())
+ if(pGroupGuy->isAlive() && not_gray_member_with_max_level &&
+ pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel())
{
- uint32 itr_xp = uint32(xp*rate);
+ uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1);
pGroupGuy->GiveXP(itr_xp, pVictim);
if(Pet* pet = pGroupGuy->GetPet())
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index cff192f675c..077dec45cde 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -176,4 +176,4 @@ bool Totem::IsImmunedToSpell(SpellEntry const* spellInfo, bool useCharges)
}
}
return Creature::IsImmunedToSpell(spellInfo, useCharges);
-} \ No newline at end of file
+}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 3b39fdefaf5..786ee62dafc 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2827,7 +2827,8 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
// All positive spells can`t miss
// TODO: client not show miss log for this spells - so need find info for this in dbc and use it!
- if (IsPositiveSpell(spell->Id))
+ if (IsPositiveSpell(spell->Id)
+ &&(!IsHostileTo(pVictim))) //prevent from affecting enemy by "positive" spell
return SPELL_MISS_NONE;
// Check for immune (use charges)
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 508573603e8..8bdea8996ec 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -766,7 +766,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_THREAT_RADIUS] = sConfig.GetIntDefault("ThreatRadius", 100);
- // always use declined names in the russian client
+ // always use declined names in the Russian client
m_configs[CONFIG_DECLINED_NAMES_USED] =
(m_configs[CONFIG_REALM_ZONE] == REALM_ZONE_RUSSIAN) ? true : sConfig.GetBoolDefault("DeclinedNames", false);
@@ -774,9 +774,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_LISTEN_RANGE_TEXTEMOTE] = sConfig.GetIntDefault("ListenRange.TextEmote", 25);
m_configs[CONFIG_LISTEN_RANGE_YELL] = sConfig.GetIntDefault("ListenRange.Yell", 300);
- m_configs[CONFIG_PLAYER_START_GOLD] = sConfig.GetFloatDefault("PlayerStart.Gold", 0);
- if(m_configs[CONFIG_PLAYER_START_GOLD] < 0)
- m_configs[CONFIG_PLAYER_START_GOLD] = 0;
+ m_configs[CONFIG_PLAYER_START_GOLD] = (uint32)(sConfig.GetFloatDefault("PlayerStart.Gold", 0.0f) * 10000.0f);
if(m_configs[CONFIG_PLAYER_START_GOLD] > MAX_MONEY_AMOUNT)
m_configs[CONFIG_PLAYER_START_GOLD] = MAX_MONEY_AMOUNT;