Core/Vehicles: Remove vehicle stat scaling hack and implement it properly trough the spell system. NOTE: This does need some further research on coefficients for different vehicles.
Signed-off-by: Machiavelli <[email protected]>
This commit is contained in:
@@ -361,21 +361,6 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
|
||||
{
|
||||
if (!me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
|
||||
ASSERT(false);
|
||||
|
||||
// hack: should be done by aura system
|
||||
if (VehicleScalingInfo const* scalingInfo = sObjectMgr->GetVehicleScalingInfo(m_vehicleInfo->m_ID))
|
||||
{
|
||||
Player* player = unit->ToPlayer();
|
||||
float averageItemLevel = player->GetAverageItemLevel();
|
||||
if (averageItemLevel < scalingInfo->baseItemLevel)
|
||||
averageItemLevel = scalingInfo->baseItemLevel;
|
||||
averageItemLevel -= scalingInfo->baseItemLevel;
|
||||
|
||||
float currentHealthPct = float(me->GetHealth() / me->GetMaxHealth());
|
||||
m_bonusHP = uint32(me->GetMaxHealth() * (averageItemLevel * scalingInfo->scalingFactor));
|
||||
me->SetMaxHealth(me->GetMaxHealth() + m_bonusHP);
|
||||
me->SetHealth(uint32((me->GetHealth() + m_bonusHP) * currentHealthPct));
|
||||
}
|
||||
}
|
||||
|
||||
if (me->IsInWorld())
|
||||
|
||||
@@ -95,16 +95,8 @@ struct VehicleAccessory
|
||||
uint32 SummonTime;
|
||||
};
|
||||
|
||||
struct VehicleScalingInfo
|
||||
{
|
||||
uint32 ID;
|
||||
float baseItemLevel;
|
||||
float scalingFactor;
|
||||
};
|
||||
|
||||
typedef std::vector<VehicleAccessory> VehicleAccessoryList;
|
||||
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
|
||||
typedef std::map<uint32, VehicleScalingInfo> VehicleScalingMap;
|
||||
typedef std::map<int8, VehicleSeat> SeatMap;
|
||||
|
||||
class Vehicle
|
||||
|
||||
@@ -2935,48 +2935,6 @@ void ObjectMgr::LoadVehicleAccessories()
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadVehicleScaling()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
m_VehicleScalingMap.clear(); // needed for reload case
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
QueryResult result = WorldDatabase.Query("SELECT `entry`, `baseItemLevel`, `scalingFactor` FROM `vehicle_scaling_info`");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
sLog->outString(">> Loaded 0 vehicle scaling entries. DB table `vehicle_scaling_info` is empty.");
|
||||
sLog->outString();
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
uint32 vehicleEntry = fields[0].GetUInt32();
|
||||
float baseItemLevel = fields[1].GetFloat();
|
||||
float scalingFactor = fields[2].GetFloat();
|
||||
|
||||
if (!sVehicleStore.LookupEntry(vehicleEntry))
|
||||
{
|
||||
sLog->outErrorDb("Table `vehicle_scaling_info`: vehicle entry %u does not exist.", vehicleEntry);
|
||||
continue;
|
||||
}
|
||||
|
||||
m_VehicleScalingMap[vehicleEntry].ID = vehicleEntry;
|
||||
m_VehicleScalingMap[vehicleEntry].baseItemLevel = baseItemLevel;
|
||||
m_VehicleScalingMap[vehicleEntry].scalingFactor = scalingFactor;
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u vehicle scaling entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadPetLevelInfo()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -791,14 +791,6 @@ class ObjectMgr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VehicleScalingInfo const* GetVehicleScalingInfo(uint32 vehicleEntry) const
|
||||
{
|
||||
VehicleScalingMap::const_iterator itr = m_VehicleScalingMap.find(vehicleEntry);
|
||||
if (itr != m_VehicleScalingMap.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DungeonEncounterList const* GetDungeonEncounterList(uint32 mapId, Difficulty difficulty)
|
||||
{
|
||||
UNORDERED_MAP<uint32, DungeonEncounterList>::const_iterator itr = mDungeonEncounters.find(MAKE_PAIR32(mapId, difficulty));
|
||||
@@ -896,7 +888,6 @@ class ObjectMgr
|
||||
void LoadMailLevelRewards();
|
||||
void LoadVehicleTemplateAccessories();
|
||||
void LoadVehicleAccessories();
|
||||
void LoadVehicleScaling();
|
||||
|
||||
void LoadGossipText();
|
||||
|
||||
@@ -1280,7 +1271,6 @@ class ObjectMgr
|
||||
|
||||
VehicleAccessoryMap m_VehicleTemplateAccessoryMap;
|
||||
VehicleAccessoryMap m_VehicleAccessoryMap;
|
||||
VehicleScalingMap m_VehicleScalingMap;
|
||||
|
||||
typedef std::vector<LocaleConstant> LocalForIndex;
|
||||
LocalForIndex m_LocalForIndex;
|
||||
|
||||
@@ -1349,9 +1349,6 @@ void World::SetInitialWorldSettings()
|
||||
sLog->outString("Loading Creature template addons...");
|
||||
sObjectMgr->LoadCreatureTemplateAddons();
|
||||
|
||||
sLog->outString("Loading Vehicle scaling information...");
|
||||
sObjectMgr->LoadVehicleScaling();
|
||||
|
||||
sLog->outString("Loading Reputation Reward Rates...");
|
||||
sObjectMgr->LoadReputationRewardRate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user