Merge remote-tracking branch 'origin/master' into mmaps

Conflicts:
	src/server/game/Movement/Spline/MoveSplineInit.cpp
This commit is contained in:
Nay
2012-09-10 00:54:29 +01:00
16 changed files with 150 additions and 51 deletions
@@ -0,0 +1,10 @@
-- Gift of the Naaru
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_gift_of_naaru';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(28880,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_WARRIOR
(59542,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_PALADIN
(59543,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_HUNTER
(59544,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_PRIEST
(59545,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_DEATHKNIGHT
(59547,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_SHAMAN
(59548,'spell_gen_gift_of_naaru'); -- SPELLFAMILY_MAGE
@@ -0,0 +1,9 @@
DELETE FROM `spell_bonus_data` WHERE `entry` IN (28880,59542,59543,59544,59545,59547,59548);
INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES
(28880,0,0,0,0,'Warrior - Gift of the Naaru'),
(59542,0,0,0,0,'Paladin - Gift of the Naaru'),
(59543,0,0,0,0,'Hunter - Gift of the Naaru'),
(59544,0,0,0,0,'Priest - Gift of the Naaru'),
(59545,0,0,0,0,'Deathknight - Gift of the Naaru'),
(59547,0,0,0,0,'Shaman - Gift of the Naaru'),
(59548,0,0,0,0,'Mage - Gift of the Naaru');
@@ -0,0 +1 @@
UPDATE `quest_template` SET `OfferRewardText`='Excellent, $N. You''ve saved me a lot of work!$b$bBut don''t think that I''m not grateful!' WHERE `Id`=6571;
@@ -128,12 +128,6 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
}
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
if (!classRace.class_id && !classRace.race_id)
{
sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
criteria->ID, criteria->requiredType, dataType);
return false;
}
if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0)
{
sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
+5 -1
View File
@@ -11531,7 +11531,11 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
if (eslot == EQUIPMENT_SLOT_OFFHAND)
{
if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
// Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750)
if (pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM)
return EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT;
else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
{
if (!CanDualWield())
return EQUIP_ERR_CANT_DUAL_WIELD;
@@ -704,17 +704,15 @@ void Transport::UpdateNPCPositions()
}
}
//! This method transforms supplied transport offsets into global coordinates
void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
{
float inx = x, iny = y, inz = z, ino = o;
o = GetOrientation() + ino;
x = GetPositionX() + (inx * cos(GetOrientation()) + iny * sin(GetOrientation() + M_PI));
y = GetPositionY() + (iny * cos(GetOrientation()) + inx * sin(GetOrientation()));
x = GetPositionX() + inx * cos(GetOrientation()) - iny * sin(GetOrientation());
y = GetPositionY() + iny * cos(GetOrientation()) + inx * sin(GetOrientation());
z = GetPositionZ() + inz;
}
//! This method transforms supplied global coordinates into local offsets
void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
{
o -= GetOrientation();
@@ -722,6 +720,6 @@ void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
float inx = x, iny = y;
y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) - sin(GetOrientation() + M_PI) * tan(GetOrientation()));
x = (inx - iny * sin(GetOrientation() + M_PI) / cos(GetOrientation())) / (cos(GetOrientation()) - tan(GetOrientation()) * sin(GetOrientation() + M_PI));
y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
}
@@ -20,12 +20,13 @@
#define TRANSPORTS_H
#include "GameObject.h"
#include "VehicleDefines.h"
#include <map>
#include <set>
#include <string>
class Transport : public GameObject
class Transport : public GameObject, public TransportBase
{
public:
Transport(uint32 period, uint32 script);
@@ -47,8 +48,13 @@ class Transport : public GameObject
uint32 AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim=0);
void UpdatePosition(MovementInfo* mi);
void UpdateNPCPositions();
/// This method transforms supplied transport offsets into global coordinates
void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
/// This method transforms supplied global coordinates into local offsets
void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
void BuildStartMovePacket(Map const* targetMap);
void BuildStopMovePacket(Map const* targetMap);
uint32 GetScriptId() const { return ScriptId; }
+9 -19
View File
@@ -406,15 +406,8 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
pos.m_positionZ = loc.z;
pos.m_orientation = loc.orientation;
if (Unit* vehicle = GetVehicleBase())
{
loc.x += vehicle->GetPositionX();
loc.y += vehicle->GetPositionY();
loc.z += vehicle->GetPositionZMinusOffset();
loc.orientation = vehicle->GetOrientation();
}
else if (Transport* trans = GetTransport())
trans->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
if (TransportBase* transport = GetDirectTransport())
transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
}
UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
@@ -11263,16 +11256,6 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
// Gift of the Naaru
if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329)
{
int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK)));
if (apBonus > DoneAdvertisedBenefit)
DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick
else
DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick
}
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (spellProto->Effects[i].ApplyAuraName)
@@ -16299,6 +16282,13 @@ uint64 Unit::GetTransGUID() const
return 0;
}
TransportBase* Unit::GetDirectTransport() const
{
if (Vehicle* veh = GetVehicle())
return veh;
return GetTransport();
}
bool Unit::IsInPartyWith(Unit const* unit) const
{
if (this == unit)
+3
View File
@@ -339,6 +339,7 @@ class UnitAI;
class Totem;
class Transport;
class Vehicle;
class TransportBase;
typedef std::list<Unit*> UnitList;
typedef std::list< std::pair<Aura*, uint8> > DispelChargesList;
@@ -2170,6 +2171,8 @@ class Unit : public WorldObject
uint32 GetTransTime() const { return m_movementInfo.t_time; }
int8 GetTransSeat() const { return m_movementInfo.t_seat; }
uint64 GetTransGUID() const;
/// Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
TransportBase* GetDirectTransport() const;
bool m_ControlledByPlayer;
+26 -6
View File
@@ -441,19 +441,19 @@ void Vehicle::RelocatePassengers(float x, float y, float z, float ang)
{
ASSERT(_me->GetMap());
// not sure that absolute position calculation is correct, it must depend on vehicle orientation and pitch angle
// not sure that absolute position calculation is correct, it must depend on vehicle pitch angle
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
{
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger))
{
ASSERT(passenger->IsInWorld());
float px = x + passenger->m_movementInfo.t_pos.m_positionX;
float py = y + passenger->m_movementInfo.t_pos.m_positionY;
float pz = z + passenger->m_movementInfo.t_pos.m_positionZ;
float po = ang + passenger->m_movementInfo.t_pos.m_orientation;
float px, py, pz, po;
passenger->m_movementInfo.t_pos.GetPosition(px, py, pz, po);
CalculatePassengerPosition(px, py, pz, po);
passenger->UpdatePosition(px, py, pz, po);
}
}
}
void Vehicle::Dismiss()
@@ -512,3 +512,23 @@ uint8 Vehicle::GetAvailableSeatCount() const
return ret;
}
void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
{
float inx = x, iny = y, inz = z, ino = o;
o = GetBase()->GetOrientation() + ino;
x = GetBase()->GetPositionX() + inx * cos(GetBase()->GetOrientation()) - iny * sin(GetBase()->GetOrientation());
y = GetBase()->GetPositionY() + iny * cos(GetBase()->GetOrientation()) + inx * sin(GetBase()->GetOrientation());
z = GetBase()->GetPositionZ() + inz;
}
void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
{
o -= GetBase()->GetOrientation();
z -= GetBase()->GetPositionZ();
y -= GetBase()->GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
x -= GetBase()->GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
float inx = x, iny = y;
y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
}
+7 -1
View File
@@ -27,7 +27,7 @@ class Unit;
typedef std::set<uint64> GuidSet;
class Vehicle
class Vehicle : public TransportBase
{
public:
explicit Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry);
@@ -66,6 +66,12 @@ class Vehicle
SeatMap::iterator GetSeatIteratorForPassenger(Unit* passenger);
void InitMovementInfoForBase();
/// This method transforms supplied transport offsets into global coordinates
void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
/// This method transforms supplied global coordinates into local offsets
void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
Unit* _me;
VehicleEntry const* _vehicleInfo;
GuidSet vehiclePlayers;
@@ -75,4 +75,14 @@ typedef std::vector<VehicleAccessory> VehicleAccessoryList;
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryContainer;
typedef std::map<int8, VehicleSeat> SeatMap;
class TransportBase
{
public:
/// This method transforms supplied transport offsets into global coordinates
virtual void CalculatePassengerPosition(float& x, float& y, float& z, float& o) = 0;
/// This method transforms supplied global coordinates into local offsets
virtual void CalculatePassengerOffset(float& x, float& y, float& z, float& o) = 0;
};
#endif
@@ -173,17 +173,9 @@ namespace Movement
{
if (_transformForTransport)
{
if (Unit* vehicle = _owner->GetVehicleBase())
{
input.x -= vehicle->GetPositionX();
input.y -= vehicle->GetPositionY();
input.z -= vehicle->GetPositionZMinusOffset();
}
else if (Transport* transport = _owner->GetTransport())
{
float unused = 0.0f;
float unused = 0.0f;
if (TransportBase* transport = _owner.GetDirectTransport())
transport->CalculatePassengerOffset(input.x, input.y, input.z, unused);
}
}
return input;
+3
View File
@@ -4279,6 +4279,9 @@ void Spell::SendChannelUpdate(uint32 time)
void Spell::SendChannelStart(uint32 duration)
{
uint64 channelTarget = m_targets.GetObjectTargetGUID();
if (!channelTarget && !m_spellInfo->NeedsExplicitUnitTarget())
if (m_UniqueTargetInfo.size() + m_UniqueGOTargetInfo.size() == 1) // this is for TARGET_SELECT_CATEGORY_NEARBY
channelTarget = !m_UniqueTargetInfo.empty() ? m_UniqueTargetInfo.front().targetGUID : m_UniqueGOTargetInfo.front().targetGUID;
WorldPacket data(MSG_CHANNEL_START, (8+4+4));
data.append(m_caster->GetPackGUID());
@@ -233,7 +233,7 @@ public:
SWPainTimer = 20000;
AmplifyDamageTimer = 5000;
Cleave_Timer = 8000;
InfernalTimer = 45000;
InfernalTimer = 40000;
InfernalCleanupTimer = 47000;
AxesTargetSwitchTimer = urand(7500, 20000);
SunderArmorTimer = urand(5000, 10000);
@@ -3250,6 +3250,58 @@ class spell_gen_bonked : public SpellScriptLoader
}
};
class spell_gen_gift_of_naaru : public SpellScriptLoader
{
public:
spell_gen_gift_of_naaru() : SpellScriptLoader("spell_gen_gift_of_naaru") { }
class spell_gen_gift_of_naaru_AuraScript : public AuraScript
{
PrepareAuraScript(spell_gen_gift_of_naaru_AuraScript);
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (!GetCaster())
return;
float heal = 0.0f;
switch (GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
case SPELLFAMILY_WARLOCK:
case SPELLFAMILY_PRIEST:
heal = 1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()));
break;
case SPELLFAMILY_PALADIN:
case SPELLFAMILY_SHAMAN:
heal = std::max(1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())), 1.1f * float(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)));
break;
case SPELLFAMILY_WARRIOR:
case SPELLFAMILY_HUNTER:
case SPELLFAMILY_DEATHKNIGHT:
heal = 1.1f * float(std::max(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetCaster()->GetTotalAttackPowerValue(RANGED_ATTACK)));
break;
case SPELLFAMILY_GENERIC:
default:
break;
}
int32 healTick = floor(heal / aurEff->GetTotalTicks());
amount += int32(std::max(healTick, 0));
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_gift_of_naaru_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_gen_gift_of_naaru_AuraScript();
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3325,4 +3377,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310);
new spell_gen_upper_deck_create_foam_sword();
new spell_gen_bonked();
new spell_gen_gift_of_naaru();
}