Skip to content

Commit

Permalink
Merge fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomrus88 committed Nov 15, 2010
1 parent 349e6ed commit ebc52dc
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 69 deletions.
2 changes: 1 addition & 1 deletion src/game/Creature.cpp
Expand Up @@ -1913,7 +1913,7 @@ bool Creature::LoadCreatureAddon(bool reload)
else
AddSpellAuraHolder(holder);

SpellEffectEntry const* effectEntry = AdditionalSpellInfo->GetSpellEffect(cAura->effect_idx);
SpellEffectEntry const* effectEntry = AdditionalSpellInfo->GetSpellEffect(EFFECT_INDEX_0);
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell: %u - Aura %u added to creature (GUIDLow: %u Entry: %u )", cAura->spell_id, effectEntry ? effectEntry->EffectApplyAuraName : 0, GetGUIDLow(), GetEntry());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/CreatureAI.cpp
Expand Up @@ -47,7 +47,7 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry *pSpell,
return CAST_FAIL_STATE;

// Check for power (also done by Spell::CheckCast())
if (m_creature->GetPower((Powers)pSpell->powerType) < pSpell->GetManaCost())
if (m_creature->GetPower((Powers)pSpell->powerType) < Spell::CalculatePowerCost(pSpell, m_creature))
return CAST_FAIL_POWER;
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/CreatureEventAI.cpp
Expand Up @@ -1390,7 +1390,7 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
return false;

//Check for power
if (!Triggered && m_creature->GetPower((Powers)Spell->powerType) < Spell->GetManaCost())
if (!Triggered && m_creature->GetPower((Powers)Spell->powerType) < Spell::CalculatePowerCost(Spell, m_creature))
return false;

SpellRangeEntry const *TempRange = NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/game/DBCStores.cpp
Expand Up @@ -580,7 +580,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRadiusStore, dbcPath,"SpellRadius.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRangeStore, dbcPath,"SpellRange.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRuneCostStore, dbcPath,"SpellRuneCost.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftStore, dbcPath,"SpellShapeshiftForm.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftFormStore, dbcPath,"SpellShapeshiftForm.dbc");
//LoadDBC(availableDbcLocales,bar,bad_dbc_files,sStableSlotPricesStore, dbcPath,"StableSlotPrices.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentStore, dbcPath,"Talent.dbc");
Expand Down Expand Up @@ -997,7 +997,7 @@ bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, flo
// rotate the players position instead of rotating the whole cube, that way we can make a simplified
// is-in-cube check and we have to calculate only one point instead of 4

// 2PI = 360
// 2PI = 360, keep in mind that ingame orientation is counter-clockwise
double rotation = 2*M_PI-atEntry->box_orientation;
double sinVal = sin(rotation);
double cosVal = cos(rotation);
Expand Down
6 changes: 3 additions & 3 deletions src/game/DBCStructure.h
Expand Up @@ -1576,7 +1576,7 @@ struct SpellPowerEntry
uint32 manaCostPerlevel; // 46 m_manaCostPerLevel
uint32 ManaCostPercentage; // 144 m_manaCostPct
uint32 manaPerSecond; // 47 m_manaPerSecond
//uint32 PowerDisplayId; // 168 PowerDisplay.dbc, new in 3.1
//uint32 PowerDisplayId; // 168 m_powerDisplayID - id from PowerDisplay.dbc, new in 3.1
//uint32 unk1; // 6 4.0.0
};

Expand Down Expand Up @@ -1643,7 +1643,7 @@ struct MANGOS_DLL_SPEC SpellEntry
uint32 AttributesEx4; // 5 m_attributesExD
uint32 AttributesEx5; // 6 m_attributesExE
uint32 AttributesEx6; // 7 m_attributesExF
// uint32 unk_320_1; // 8 3.2.0 (0x20 - totems, 0x4 - paladin auras, etc...)
uint32 AttributesEx7; // 8 m_attributesExG (0x20 - totems, 0x4 - paladin auras, etc...)
// uint32 someFlags; // 9 4.0.0
// uint32 unk_400_1; // 10 4.0.0
uint32 CastingTimeIndex; // 11 m_castingTimeIndex
Expand All @@ -1661,7 +1661,7 @@ struct MANGOS_DLL_SPEC SpellEntry
uint32 SchoolMask; // 24 m_schoolMask
uint32 runeCostID; // 25 m_runeCostID
//uint32 spellMissileID; // 26 m_spellMissileID not used
//uint32 spellDescriptionVariableID; // 27 3.2.0
//uint32 spellDescriptionVariableID; // 27 m_spellDescriptionVariableID, 3.2.0
uint32 SpellDifficultyId; // 28 m_spellDifficultyID - id from SpellDifficulty.dbc
//float unk_f1; // 29
uint32 SpellScalingId; // 30 SpellScaling.dbc
Expand Down
2 changes: 1 addition & 1 deletion src/game/DBCfmt.h
Expand Up @@ -93,7 +93,7 @@ const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellCastTimefmt[]="nixx";
const char SpellDurationfmt[]="niii";
const char SpellDifficultyfmt[]="niiii";
const char SpellEntryfmt[]="niiiiiiixxxiiiifiiiissxxiixxixiiiiiiixiiiiiiiix";
const char SpellEntryfmt[]="niiiiiiiixxiiiifiiiissxxiixxixiiiiiiixiiiiiiiix";
const char SpellAuraOptionsEntryfmt[]="diiii";
const char SpellAuraRestrictionsEntryfmt[]="diiiiiiii";
const char SpellCastingRequirementsEntryfmt[]="dixxixi";
Expand Down
1 change: 1 addition & 0 deletions src/game/MiscHandler.cpp
Expand Up @@ -753,6 +753,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
if(GetPlayer()->getLevel() < at->requiredLevel && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_LEVEL))
missingLevel = true;

// must have one or the other, report the first one that's missing
if(at->requiredItem)
{
if(!GetPlayer()->HasItemCount(at->requiredItem, 1) &&
Expand Down
16 changes: 1 addition & 15 deletions src/game/Player.cpp
Expand Up @@ -754,20 +754,6 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
}

//if(getPowerType() == POWER_RUNIC_POWER)
//{
// SetPower(POWER_RUNE, 8);
// SetMaxPower(POWER_RUNE, 8);
// SetPower(POWER_RUNIC_POWER, 0);
// SetMaxPower(POWER_RUNIC_POWER, 1000);
//}

//if(getPowerType() == POWER_FOCUS)
//{
// SetPower(POWER_FOCUS, 100);
// SetMaxPower(POWER_FOCUS, 100);
//}

if(getPowerType() != POWER_MANA) // hide additional mana bar if we have no mana
{
SetPower(POWER_MANA, 0);
Expand Down Expand Up @@ -14846,7 +14832,7 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive
GetMap()->ScriptsStart(sQuestEndScripts, pQuest->GetQuestCompleteScript(), questGiver, this);
}

void Player::SendQuestFailed( uint32 quest_id, InventoryChangeFailure reason )
void Player::SendQuestFailed( uint32 quest_id, InventoryChangeFailure reason)
{
if( quest_id )
{
Expand Down
4 changes: 2 additions & 2 deletions src/game/Player.h
Expand Up @@ -509,7 +509,7 @@ enum PlayerFlags
PLAYER_FLAGS_PARTIAL_PLAY_TIME = 0x00001000, // played long time
PLAYER_FLAGS_NO_PLAY_TIME = 0x00002000, // played too long time
PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000, // Lua_IsOutOfBounds
PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> chat tag
PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> chat tag, name prefix
PLAYER_FLAGS_UNK17 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
Expand Down Expand Up @@ -1508,7 +1508,7 @@ class MANGOS_DLL_SPEC Player : public Unit

void SendQuestCompleteEvent(uint32 quest_id);
void SendQuestReward( Quest const *pQuest, uint32 XP, Object* questGiver );
void SendQuestFailed( uint32 quest_id, InventoryChangeFailure reason = EQUIP_ERR_OK );
void SendQuestFailed( uint32 quest_id, InventoryChangeFailure reason = EQUIP_ERR_OK);
void SendQuestTimerFailed( uint32 quest_id );
void SendCanTakeQuestResponse( uint32 msg ) const;
void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver);
Expand Down
12 changes: 6 additions & 6 deletions src/game/Spell.cpp
Expand Up @@ -5729,24 +5729,24 @@ uint32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spel
}

// Base powerCost
int32 powerCost = m_spellInfo->GetManaCost();
int32 powerCost = spellInfo->GetManaCost();
// PCT cost from total amount
if (uint32 manaCostPct = m_spellInfo->GetManaCostPercentage())
if (uint32 manaCostPct = spellInfo->GetManaCostPercentage())
{
switch (spellInfo->powerType)
{
// health as power used
case POWER_HEALTH:
powerCost += manaCostPct * m_caster->GetCreateHealth() / 100;
powerCost += manaCostPct * caster->GetCreateHealth() / 100;
break;
case POWER_MANA:
powerCost += manaCostPct * m_caster->GetCreateMana() / 100;
powerCost += manaCostPct * caster->GetCreateMana() / 100;
break;
case POWER_RAGE:
case POWER_FOCUS:
case POWER_ENERGY:
case POWER_HAPPINESS:
powerCost += manaCostPct * m_caster->GetMaxPower(Powers(m_spellInfo->powerType)) / 100;
powerCost += manaCostPct * caster->GetMaxPower(Powers(spellInfo->powerType)) / 100;
break;
case POWER_RUNE:
case POWER_RUNIC_POWER:
Expand All @@ -5769,7 +5769,7 @@ uint32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spel
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost, spell);

if (spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION)
powerCost = int32(powerCost/ (1.117f * m_spellInfo->GetSpellLevel() / m_caster->getLevel() -0.1327f));
powerCost = int32(powerCost/ (1.117f * spellInfo->GetSpellLevel() / caster->getLevel() -0.1327f));

// PCT mod from user auras by school
powerCost = int32(powerCost * (1.0f + caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school)));
Expand Down

0 comments on commit ebc52dc

Please sign in to comment.