aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2011-11-25 18:54:59 +0100
committerkaelima <kaelima@live.se>2011-11-25 18:54:59 +0100
commitec54bb48952fb0f766c61976f736ad727f9aadd0 (patch)
tree816594e7dc4373461cb87743d2d09365234b3b1a /src/server/game
parent9696d6ba7b02b722b4a03e253ffa653e16940af1 (diff)
Core/Misc:
Clearing compile errors since UpdateFields were changed: - Completely remove ammo (Cataclysm change) - Revert some changes with power/maxpower and only store the 5 needed powers in db (the rest is useless) - Remove GuildId from corpse - Move PLAYER_GUILDID to character db (removed updatefield) Note: Compile is still not working as we need to change currency handling
Diffstat (limited to 'src/server/game')
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp2
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp2
-rwxr-xr-xsrc/server/game/Entities/Corpse/Corpse.cpp56
-rwxr-xr-xsrc/server/game/Entities/Object/Updates/UpdateFields.h12
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp199
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h29
-rwxr-xr-xsrc/server/game/Entities/Unit/StatSystem.cpp10
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp4
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp2
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp10
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp124
-rwxr-xr-xsrc/server/game/Spells/Spell.h3
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp2
-rwxr-xr-xsrc/server/game/World/World.cpp2
16 files changed, 86 insertions, 375 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index be0dd8c3679..08f8d7a3d77 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -1312,7 +1312,7 @@ bool CreatureEventAI::CanCast(Unit* target, SpellInfo const* spell, bool trigger
return false;
//Check for power
- if (!triggered && me->GetPower((Powers)spell->PowerType) < spell->CalcPowerCost(me, spell->GetSchoolMask()))
+ if (!triggered && (uint32)me->GetPower((Powers)spell->PowerType) < spell->CalcPowerCost(me, spell->GetSchoolMask()))
return false;
//Unit is out of range of this spell
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 953bbf7521a..e9a9c1fdcf2 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -237,7 +237,7 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
continue;
//Continue if we don't have the mana to actually cast this spell
- if (tempSpell->ManaCost > me->GetPower(Powers(tempSpell->PowerType)))
+ if (tempSpell->ManaCost > (uint32)me->GetPower(Powers(tempSpell->PowerType)))
continue;
//Check if the spell meets our range requirements
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index 7919a3fba16..77d16501415 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -87,7 +87,7 @@ void LoadDB2Stores(const std::string& dataPath)
LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2");
- LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2");
+ LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2");
// error checks
if (bad_db2_files.size() >= DB2FilesCount)
{
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 31cc21659c9..ff8c93ec404 100755
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -106,25 +106,25 @@ void Corpse::SaveToDB()
SQLTransaction trans = CharacterDatabase.BeginTransaction();
DeleteFromDB(trans);
+ uint16 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CORPSE);
- stmt->setUInt32(0, GetGUIDLow()); // corpseGuid
- stmt->setUInt32(1, GUID_LOPART(GetOwnerGUID())); // guid
- stmt->setFloat (2, GetPositionX()); // posX
- stmt->setFloat (3, GetPositionY()); // posY
- stmt->setFloat (4, GetPositionZ()); // posZ
- stmt->setFloat (5, GetOrientation()); // orientation
- stmt->setUInt16(6, GetMapId()); // mapId
- stmt->setUInt32(7, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
- stmt->setString(8, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
- stmt->setUInt32(9, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
- stmt->setUInt32(10, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
- stmt->setUInt32(11, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
- stmt->setUInt8 (12, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
- stmt->setUInt8 (13, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
- stmt->setUInt32(14, uint32(m_time)); // time
- stmt->setUInt8 (15, GetType()); // corpseType
- stmt->setUInt32(16, GetInstanceId()); // instanceId
- stmt->setUInt16(17, GetPhaseMask()); // phaseMask
+ stmt->setUInt32(index, GetGUIDLow()); // corpseGuid
+ stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid
+ stmt->setFloat (index++, GetPositionX()); // posX
+ stmt->setFloat (index++, GetPositionY()); // posY
+ stmt->setFloat (index++, GetPositionZ()); // posZ
+ stmt->setFloat (index++, GetOrientation()); // orientation
+ stmt->setUInt16(index++, GetMapId()); // mapId
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
+ stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
+ stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
+ stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
+ stmt->setUInt32(index++, uint32(m_time)); // time
+ stmt->setUInt8 (index++, GetType()); // corpseType
+ stmt->setUInt32(index++, GetInstanceId()); // instanceId
+ stmt->setUInt16(index++, GetPhaseMask()); // phaseMask
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
@@ -164,10 +164,11 @@ void Corpse::DeleteFromDB(SQLTransaction& trans)
bool Corpse::LoadFromDB(uint32 guid, Field* fields)
{
- uint32 ownerGuid = fields[17].GetUInt32();
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
- // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0
- m_type = CorpseType(fields[13].GetUInt8());
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+ // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0
+
+ uint32 ownerGuid = fields[16].GetUInt32();
+ m_type = CorpseType(fields[12].GetUInt8());
if (m_type >= MAX_CORPSE_TYPE)
{
sLog->outError("Corpse (guid: %u, owner: %u) have wrong corpse type (%u), not loading.", guid, ownerGuid, m_type);
@@ -188,15 +189,14 @@ bool Corpse::LoadFromDB(uint32 guid, Field* fields)
_LoadIntoDataField(fields[6].GetCString(), CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END);
SetUInt32Value(CORPSE_FIELD_BYTES_1, fields[7].GetUInt32());
SetUInt32Value(CORPSE_FIELD_BYTES_2, fields[8].GetUInt32());
- SetUInt32Value(CORPSE_FIELD_GUILD, fields[9].GetUInt32());
- SetUInt32Value(CORPSE_FIELD_FLAGS, fields[10].GetUInt8());
- SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[11].GetUInt8());
+ SetUInt32Value(CORPSE_FIELD_FLAGS, fields[9].GetUInt8());
+ SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[10].GetUInt8());
SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(ownerGuid, 0, HIGHGUID_PLAYER));
- m_time = time_t(fields[12].GetUInt32());
+ m_time = time_t(fields[11].GetUInt32());
- uint32 instanceId = fields[14].GetUInt32();
- uint32 phaseMask = fields[15].GetUInt16();
+ uint32 instanceId = fields[13].GetUInt32();
+ uint32 phaseMask = fields[14].GetUInt16();
// place
SetLocationInstanceId(instanceId);
diff --git a/src/server/game/Entities/Object/Updates/UpdateFields.h b/src/server/game/Entities/Object/Updates/UpdateFields.h
index 03e83496297..ce063f4f2f1 100755
--- a/src/server/game/Entities/Object/Updates/UpdateFields.h
+++ b/src/server/game/Entities/Object/Updates/UpdateFields.h
@@ -105,24 +105,12 @@ enum EUnitFields
UNIT_FIELD_POWER3 = OBJECT_END + 0x0015, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_POWER4 = OBJECT_END + 0x0016, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_POWER5 = OBJECT_END + 0x0017, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_POWER6 = OBJECT_END + 0x0018, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_POWER7 = OBJECT_END + 0x0019, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_POWER8 = OBJECT_END + 0x001A, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_POWER9 = OBJECT_END + 0x001B, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_POWER10 = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_POWER11 = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXHEALTH = OBJECT_END + 0x0018, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER1 = OBJECT_END + 0x0019, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER2 = OBJECT_END + 0x001A, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER3 = OBJECT_END + 0x001B, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER4 = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER5 = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_MAXPOWER6 = OBJECT_END + 0x0024, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_MAXPOWER7 = OBJECT_END + 0x0025, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_MAXPOWER8 = OBJECT_END + 0x0026, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_MAXPOWER9 = OBJECT_END + 0x0027, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_MAXPOWER10 = OBJECT_END + 0x0028, // Size: 1, Type: INT, Flags: PUBLIC
- UNIT_FIELD_MAXPOWER11 = OBJECT_END + 0x0029, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER = OBJECT_END + 0x001E, // Size: 5, Type: FLOAT, Flags: PRIVATE, OWNER, PARTY_MEMBER
UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER = OBJECT_END + 0x0023, // Size: 5, Type: FLOAT, Flags: PRIVATE, OWNER, PARTY_MEMBER
UNIT_FIELD_LEVEL = OBJECT_END + 0x0028, // Size: 1, Type: INT, Flags: PUBLIC
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index f3dc392f569..b75f3f07d55 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -787,6 +787,8 @@ Player::Player (WorldSession* session): Unit(), m_achievementMgr(this), m_reputa
m_activeSpec = 0;
m_specsCount = 1;
+ m_freeTalentPoints = 0;
+
for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i)
{
for (uint8 g = 0; g < MAX_GLYPH_SLOT_INDEX; ++g)
@@ -978,7 +980,6 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
SetByteValue(PLAYER_BYTES_3, 0, createInfo->Gender);
SetByteValue(PLAYER_BYTES_3, 3, 0); // BattlefieldArenaFaction (0 or 1)
- SetUInt32Value(PLAYER_GUILDID, 0);
SetUInt32Value(PLAYER_GUILDRANK, 0);
SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0);
@@ -1165,7 +1166,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
RemoveItem(INVENTORY_SLOT_BAG_0, i, true);
EquipItem(eDest, pItem, true);
}
- // move other items to more appropriate slots (ammo not equipped in special bag)
+ // move other items to more appropriate slots
else
{
ItemPosCountVec sDest;
@@ -1175,11 +1176,6 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
RemoveItem(INVENTORY_SLOT_BAG_0, i, true);
pItem = StoreItem(sDest, pItem, true);
}
-
- // if this is ammo then use it
- msg = CanUseAmmo(pItem->GetEntry());
- if (msg == EQUIP_ERR_OK)
- SetAmmo(pItem->GetEntry());
}
}
}
@@ -3111,7 +3107,7 @@ void Player::GiveLevel(uint8 level)
SetFullHealth();
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
- if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
+ if ((uint32)GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
@@ -3250,10 +3246,8 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, 0.0f);
SetInt32Value(UNIT_FIELD_ATTACK_POWER, 0);
- SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, 0);
SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, 0.0f);
SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER, 0);
- SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS, 0);
SetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, 0.0f);
// Base crit values (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
@@ -3334,7 +3328,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetFullHealth();
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
- if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
+ if ((uint32)GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, GetMaxPower(POWER_FOCUS));
SetPower(POWER_RUNIC_POWER, 0);
@@ -4502,12 +4496,6 @@ bool Player::resetTalents(bool no_cost)
return true;
}
-void Player::SetFreeTalentPoints(uint32 points)
-{
- sScriptMgr->OnPlayerFreeTalentPointsChanged(this, points);
- SetUInt32Value(PLAYER_CHARACTER_POINTS1, points);
-}
-
Mail* Player::GetMail(uint32 id)
{
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
@@ -4565,16 +4553,12 @@ void Player::InitVisibleBits()
updateVisualBits.SetBit(UNIT_FIELD_POWER3);
updateVisualBits.SetBit(UNIT_FIELD_POWER4);
updateVisualBits.SetBit(UNIT_FIELD_POWER5);
- updateVisualBits.SetBit(UNIT_FIELD_POWER6);
- updateVisualBits.SetBit(UNIT_FIELD_POWER7);
updateVisualBits.SetBit(UNIT_FIELD_MAXHEALTH);
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER1);
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER2);
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER3);
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER4);
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER5);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER6);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER7);
updateVisualBits.SetBit(UNIT_FIELD_LEVEL);
updateVisualBits.SetBit(UNIT_FIELD_FACTIONTEMPLATE);
updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 0);
@@ -4603,7 +4587,6 @@ void Player::InitVisibleBits()
updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 0);
updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 1);
updateVisualBits.SetBit(PLAYER_FLAGS);
- updateVisualBits.SetBit(PLAYER_GUILDID);
updateVisualBits.SetBit(PLAYER_GUILDRANK);
updateVisualBits.SetBit(PLAYER_BYTES);
updateVisualBits.SetBit(PLAYER_BYTES_2);
@@ -5290,12 +5273,10 @@ void Player::CreateCorpse()
flags |= CORPSE_FLAG_HIDE_CLOAK;
if (InBattleground() && !InArena())
flags |= CORPSE_FLAG_LOOTABLE; // to be able to remove insignia
- corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags);
+ corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags);
corpse->SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, GetNativeDisplayId());
- corpse->SetUInt32Value(CORPSE_FIELD_GUILD, GetGuildId());
-
uint32 iDisplayID;
uint32 iIventoryType;
uint32 _cfi;
@@ -7856,10 +7837,6 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
_ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), apply);
_ApplyItemBonuses(proto, slot, apply);
-
- if (slot == EQUIPMENT_SLOT_RANGED)
- _ApplyAmmoBonuses();
-
ApplyItemEquipSpell(item, apply);
ApplyEnchantment(item, apply);
@@ -8649,9 +8626,6 @@ void Player::_RemoveAllItemMods()
_ApplyWeaponDependentAuraMods(m_items[i], WeaponAttackType(attacktype), false);
_ApplyItemBonuses(proto, i, false);
-
- if (i == EQUIPMENT_SLOT_RANGED)
- _ApplyAmmoBonuses();
}
}
@@ -8678,9 +8652,6 @@ void Player::_ApplyAllItemMods()
_ApplyWeaponDependentAuraMods(m_items[i], WeaponAttackType(attacktype), true);
_ApplyItemBonuses(proto, i, true);
-
- if (i == EQUIPMENT_SLOT_RANGED)
- _ApplyAmmoBonuses();
}
}
@@ -8725,63 +8696,6 @@ void Player::_ApplyAllLevelScaleItemMods(bool apply)
}
}
-void Player::_ApplyAmmoBonuses()
-{
- // check ammo
- uint32 ammo_id = GetUInt32Value(PLAYER_AMMO_ID);
- if (!ammo_id)
- return;
-
- float currentAmmoDPS;
-
- ItemTemplate const* ammo_proto = sObjectMgr->GetItemTemplate(ammo_id);
- if (!ammo_proto || ammo_proto->Class != ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto))
- currentAmmoDPS = 0.0f;
- else
- currentAmmoDPS = (ammo_proto->Damage[0].DamageMin + ammo_proto->Damage[0].DamageMax) / 2;
-
- if (currentAmmoDPS == GetAmmoDPS())
- return;
-
- m_ammoDPS = currentAmmoDPS;
-
- if (CanModifyStats())
- UpdateDamagePhysical(RANGED_ATTACK);
-}
-
-bool Player::CheckAmmoCompatibility(const ItemTemplate* ammo_proto) const
-{
- if (!ammo_proto)
- return false;
-
- // check ranged weapon
- Item* weapon = GetWeaponForAttack(RANGED_ATTACK);
- if (!weapon || weapon->IsBroken())
- return false;
-
- ItemTemplate const* weapon_proto = weapon->GetTemplate();
- if (!weapon_proto || weapon_proto->Class != ITEM_CLASS_WEAPON)
- return false;
-
- // check ammo ws. weapon compatibility
- switch (weapon_proto->SubClass)
- {
- case ITEM_SUBCLASS_WEAPON_BOW:
- case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- if (ammo_proto->SubClass != ITEM_SUBCLASS_ARROW)
- return false;
- break;
- case ITEM_SUBCLASS_WEAPON_GUN:
- if (ammo_proto->SubClass != ITEM_SUBCLASS_BULLET)
- return false;
- break;
- default:
- return false;
- }
-
- return true;
-}
-
/* If in a battleground a player dies, and an enemy removes the insignia, the player's bones is lootable
Called by remove insignia spell effect */
void Player::RemovedInsignia(Player* looterPlr)
@@ -11999,71 +11913,6 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
return EQUIP_ERR_ITEM_NOT_FOUND;
}
-InventoryResult Player::CanUseAmmo(uint32 item) const
-{
- sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseAmmo item = %u", item);
- if (!isAlive())
- return EQUIP_ERR_YOU_ARE_DEAD;
- //if (isStunned())
- // return EQUIP_ERR_YOU_ARE_STUNNED;
- ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
- if (pProto)
- {
- if (pProto->InventoryType!= INVTYPE_AMMO)
- return EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE;
-
- InventoryResult res = CanUseItem(pProto);
- if (res != EQUIP_ERR_OK)
- return res;
-
- /*if (GetReputationMgr().GetReputation() < pProto->RequiredReputation)
- return EQUIP_ERR_CANT_EQUIP_REPUTATION;
- */
-
- // Requires No Ammo
- if (HasAura(46699))
- return EQUIP_ERR_BAG_FULL6;
-
- return EQUIP_ERR_OK;
- }
- return EQUIP_ERR_ITEM_NOT_FOUND;
-}
-
-void Player::SetAmmo(uint32 item)
-{
- if (!item)
- return;
-
- // already set
- if (GetUInt32Value(PLAYER_AMMO_ID) == item)
- return;
-
- // check ammo
- if (item)
- {
- InventoryResult msg = CanUseAmmo(item);
- if (msg != EQUIP_ERR_OK)
- {
- SendEquipError(msg, NULL, NULL, item);
- return;
- }
- }
-
- SetUInt32Value(PLAYER_AMMO_ID, item);
-
- _ApplyAmmoBonuses();
-}
-
-void Player::RemoveAmmo()
-{
- SetUInt32Value(PLAYER_AMMO_ID, 0);
-
- m_ammoDPS = 0.0f;
-
- if (CanModifyStats())
- UpdateDamagePhysical(RANGED_ATTACK);
-}
-
Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId)
{
AllowedLooterSet allowedLooters;
@@ -16645,10 +16494,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
//"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, "
// 39 40 41 42 43 44 45 46 47 48 49
//"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, "
- // 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
- //"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, power11, instance_id, speccount, activespec, exploredZones, equipmentCache, "
- // 67 68 69 70
- //"ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = '%u'", guid);
+ // 50 51 52 53 54 55 56 57 58 59 60
+ //"health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, "
+ // 61 62 63 64
+ //"knownTitles, actionBars, grantableLevels, guildId FROM characters WHERE guid = '%u'", guid);
PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADFROM);
if (!result)
@@ -16707,8 +16556,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
- _LoadIntoDataField(fields[65].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
- _LoadIntoDataField(fields[68].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
+ _LoadIntoDataField(fields[59].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
+ _LoadIntoDataField(fields[61].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
@@ -16730,10 +16579,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());
- SetUInt32Value(PLAYER_AMMO_ID, fields[67].GetUInt32());
-
// set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
- SetByteValue(PLAYER_FIELD_BYTES, 2, fields[69].GetUInt8());
+ SetByteValue(PLAYER_FIELD_BYTES, 2, fields[62].GetUInt8());
InitDisplayIds();
@@ -16764,7 +16611,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
uint32 transGUID = uint32(fields[30].GetUInt64()); // field type is uint64 but lowguid is saved
Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat());
uint32 mapId = fields[15].GetUInt16();
- uint32 instanceId = fields[62].GetUInt8();
+ uint32 instanceId = fields[56].GetUInt8();
uint32 dungeonDiff = fields[38].GetUInt32() & 0x0F;
if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
@@ -17126,8 +16973,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
//mails are loaded only when needed ;-) - when player in game click on mailbox.
//_LoadMail();
- m_specsCount = fields[63].GetUInt8();
- m_activeSpec = fields[64].GetUInt8();
+ m_specsCount = fields[57].GetUInt8();
+ m_activeSpec = fields[58].GetUInt8();
// sanity check
if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || m_specsCount < MIN_TALENT_SPECS)
@@ -17199,7 +17046,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// restore remembered power/health values (but not more max values)
uint32 savedHealth = fields[50].GetUInt32();
SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth);
- for (uint8 i = 0; i < MAX_POWERS; ++i)
+ for (uint8 i = 0; i < MAX_STORED_POWERS; ++i)
{
uint32 savedPower = fields[51+i].GetUInt32();
SetPower(Powers(i), savedPower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedPower);
@@ -17257,7 +17104,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
}
// RaF stuff.
- m_grantableLevels = fields[70].GetUInt32();
+ m_grantableLevels = fields[63].GetUInt32();
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND);
@@ -18524,7 +18371,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
stmt->setUInt32(index++, GetHealth());
- for (uint32 i = 0; i < MAX_POWERS; ++i)
+ for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
stmt->setUInt32(index++, GetPower(Powers(i)));
stmt->setUInt32(index++, GetSession()->GetLatency());
@@ -18555,7 +18402,6 @@ void Player::SaveToDB(bool create /*=false*/)
}
stmt->setString(index++, ss.str());
- stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID));
ss.str().clear();
for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
@@ -18637,7 +18483,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
stmt->setUInt32(index++, GetHealth());
- for (uint32 i = 0; i < MAX_POWERS; ++i)
+ for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
stmt->setUInt32(index++, GetPower(Powers(i)));
stmt->setUInt32(index++, GetSession()->GetLatency());
@@ -18668,7 +18514,6 @@ void Player::SaveToDB(bool create /*=false*/)
}
stmt->setString(index++, ss.str());
- stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID));
ss.str().clear();
for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
@@ -19142,12 +18987,12 @@ void Player::_SaveStats(SQLTransaction& trans)
trans->PAppend("DELETE FROM character_stats WHERE guid = '%u'", GetGUIDLow());
std::ostringstream ss;
- ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, maxpower8, maxpower9, maxpower10, maxpower11, "
+ ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, "
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower, resilience) VALUES ("
<< GetGUIDLow() << ','
<< GetMaxHealth() << ',';
- for (uint8 i = 0; i < MAX_POWERS; ++i)
+ for (uint8 i = 0; i < MAX_STORED_POWERS; ++i)
ss << GetMaxPower(Powers(i)) << ',';
for (uint8 i = 0; i < MAX_STATS; ++i)
ss << GetStat(Stats(i)) << ',';
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index abbbe31b3ff..b2457a87e82 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1689,8 +1689,8 @@ class Player : public Unit, public GridObject<Player>
void SetReputation(uint32 factionentry, uint32 value);
uint32 GetReputation(uint32 factionentry);
std::string GetGuildName();
- uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
- void SetFreeTalentPoints(uint32 points);
+ uint32 GetFreeTalentPoints() const { return m_freeTalentPoints; }
+ void SetFreeTalentPoints(uint32 points) { m_freeTalentPoints = points; }
bool resetTalents(bool no_cost = false);
uint32 resetTalentsCost() const;
void InitTalentForLevel();
@@ -1723,8 +1723,8 @@ class Player : public Unit, public GridObject<Player>
}
uint32 GetGlyph(uint8 slot) { return m_Glyphs[m_activeSpec][slot]; }
- uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); }
- void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); }
+ uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS); }
+ void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS, profs); }
void InitPrimaryProfessions();
PlayerSpellMap const& GetSpellMap() const { return m_spells; }
@@ -1844,11 +1844,24 @@ class Player : public Unit, public GridObject<Player>
void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
void SendUpdateToOutOfRangeGroupMembers();
- void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); }
+ void SetInGuild(uint32 GuildId)
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_GUILD_ID);
+ stmt->setUInt32(0, GuildId);
+ stmt->setUInt64(1, GetGUID());
+ CharacterDatabase.Execute(stmt);
+ }
+
+ uint32 GetGuildId()
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_GET_GUILD_ID);
+ stmt->setUInt64(0, GetGUIDLow());
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ return result ? (*result)[0].GetUInt32() : 0;
+ }
void SetRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); }
uint8 GetRank() { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; }
- uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); }
static uint32 GetGuildIdFromDB(uint64 guid);
static uint8 GetRankFromDB(uint64 guid);
int GetGuildIdInvited() { return m_GuildIdInvited; }
@@ -2075,6 +2088,7 @@ class Player : public Unit, public GridObject<Player>
/*********************************************************/
/*** PVP SYSTEM ***/
/*********************************************************/
+ // TODO: Properly implement correncies as of Cataclysm
void UpdateHonorFields();
bool RewardHonor(Unit* pVictim, uint32 groupsize, int32 honor = -1, bool pvptoken = false);
uint32 GetHonorPoints() const { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); }
@@ -2128,7 +2142,6 @@ class Player : public Unit, public GridObject<Player>
void _ApplyAllLevelScaleItemMods(bool apply);
void _ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply, bool only_level_scale = false);
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply);
- void _ApplyAmmoBonuses();
bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot);
void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
void CorrectMetaGemEnchants(uint8 slot, bool apply);
@@ -2705,6 +2718,8 @@ class Player : public Unit, public GridObject<Player>
uint8 m_activeSpec;
uint8 m_specsCount;
+ uint32 m_freeTalentPoints;
+
uint32 m_Glyphs[MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX];
ActionButtonList m_actionButtons;
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 459379ac11a..aa5d783323a 100755
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -287,13 +287,11 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER;
uint16 index = UNIT_FIELD_ATTACK_POWER;
- uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS;
uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER;
if (ranged)
{
index = UNIT_FIELD_RANGED_ATTACK_POWER;
- index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS;
index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER;
switch (getClass())
@@ -437,10 +435,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
}
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
-
SetInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field
- SetInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
- SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
Pet* pet = GetPet(); //update pet's AP
//automatically update weapon damage after attack power modification
@@ -968,13 +963,11 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER;
uint16 index = UNIT_FIELD_ATTACK_POWER;
- uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS;
uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER;
if (ranged)
{
index = UNIT_FIELD_RANGED_ATTACK_POWER;
- index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS;
index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER;
}
@@ -983,7 +976,6 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
SetInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field
- SetInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
//automatically update weapon damage after attack power modification
@@ -1336,8 +1328,6 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
//UNIT_FIELD_(RANGED)_ATTACK_POWER field
SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower);
- //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
- SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, (int32)attPowerMod);
//UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, attPowerMultiplier);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 00471c420ce..545ba676091 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -13524,14 +13524,14 @@ float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const
{
if (attType == RANGED_ATTACK)
{
- int32 ap = GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS);
+ int32 ap = GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER);
if (ap < 0)
return 0.0f;
return ap * (1.0f + GetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER));
}
else
{
- int32 ap = GetInt32Value(UNIT_FIELD_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS);
+ int32 ap = GetInt32Value(UNIT_FIELD_ATTACK_POWER);
if (ap < 0)
return 0.0f;
return ap * (1.0f + GetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER));
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 93f58003f6d..f2553b3ace5 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2184,7 +2184,7 @@ void ObjectMgr::LoadItemTemplates()
}
itemTemplate.ScalingStatDistribution = uint32(fields[48].GetUInt16());
- itemTemplate.ScalingStatValue = fields[49].GetInt32();
+ //itemTemplate.ScalingStatValue = fields[49].GetInt32();
for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
{
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 9bca1c15423..197c12ac519 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -186,6 +186,8 @@ enum Powers
POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value)
};
+#define MAX_STORED_POWERS 5
+
enum SpellSchools
{
SPELL_SCHOOL_NORMAL = 0,
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b7cc673962c..20ee5ce39e4 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1984,7 +1984,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
case FORM_DIREBEAR:
{
// get furor proc chance
- uint32 FurorChance = 0;
+ int32 FurorChance = 0;
if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
FurorChance = std::max(dummy->GetAmount(), 0);
@@ -2003,7 +2003,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
target->CastSpell(target, 17057, true);
default:
{
- uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
+ int32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
target->SetPower(POWER_ENERGY, newEnergy);
}
break;
@@ -2056,7 +2056,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
case FORM_DEFENSIVESTANCE:
case FORM_BERSERKERSTANCE:
{
- uint32 Rage_val = 0;
+ int32 Rage_val = 0;
// Defensive Tactics
if (form == FORM_DEFENSIVESTANCE)
{
@@ -4757,10 +4757,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->GetMotionMaster()->MoveFall(currentGroundLevel);
}
break;
- case 46699: // Requires No Ammo
- if (target->GetTypeId() == TYPEID_PLAYER)
- target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
- break;
case 49028:
if (caster)
if (AuraEffect* aurEff = caster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 4003f2f3b36..c1749867945 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3738,8 +3738,6 @@ void Spell::SendSpellStart()
if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
- if (m_spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO)
- castFlags |= CAST_FLAG_AMMO;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
@@ -3765,9 +3763,6 @@ void Spell::SendSpellStart()
if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
data << uint32(m_caster->GetPower((Powers)m_spellInfo->PowerType));
- if (castFlags & CAST_FLAG_AMMO)
- WriteAmmoToPacket(&data);
-
if (castFlags & CAST_FLAG_UNKNOWN_23)
{
data << uint32(0);
@@ -3791,8 +3786,6 @@ void Spell::SendSpellGo()
if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
- if (m_spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO)
- castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
@@ -3863,9 +3856,6 @@ void Spell::SendSpellGo()
data << uint32(0);
}
- if (castFlags & CAST_FLAG_AMMO)
- WriteAmmoToPacket(&data);
-
if (castFlags & CAST_FLAG_UNKNOWN_20) // unknown wotlk
{
data << uint32(0);
@@ -3880,78 +3870,6 @@ void Spell::SendSpellGo()
m_caster->SendMessageToSet(&data, true);
}
-void Spell::WriteAmmoToPacket(WorldPacket* data)
-{
- uint32 ammoInventoryType = 0;
- uint32 ammoDisplayID = 0;
-
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- {
- Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
- if (pItem)
- {
- ammoInventoryType = pItem->GetTemplate()->InventoryType;
- if (ammoInventoryType == INVTYPE_THROWN)
- ammoDisplayID = pItem->GetTemplate()->DisplayInfoID;
- else
- {
- uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
- if (ammoID)
- {
- ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ammoID);
- if (pProto)
- {
- ammoDisplayID = pProto->DisplayInfoID;
- ammoInventoryType = pProto->InventoryType;
- }
- }
- else if (m_caster->HasAura(46699)) // Requires No Ammo
- {
- ammoDisplayID = 5996; // normal arrow
- ammoInventoryType = INVTYPE_AMMO;
- }
- }
- }
- }
- else
- {
- for (uint8 i = 0; i < 3; ++i)
- {
- if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i))
- {
- if (ItemEntry const* itemEntry = sItemStore.LookupEntry(item_id))
- {
- if (itemEntry->Class == ITEM_CLASS_WEAPON)
- {
- switch (itemEntry->SubClass)
- {
- case ITEM_SUBCLASS_WEAPON_THROWN:
- ammoDisplayID = itemEntry->DisplayId;
- ammoInventoryType = itemEntry->InventoryType;
- break;
- case ITEM_SUBCLASS_WEAPON_BOW:
- case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- ammoDisplayID = 5996; // is this need fixing?
- ammoInventoryType = INVTYPE_AMMO;
- break;
- case ITEM_SUBCLASS_WEAPON_GUN:
- ammoDisplayID = 5998; // is this need fixing?
- ammoInventoryType = INVTYPE_AMMO;
- break;
- }
-
- if (ammoDisplayID)
- break;
- }
- }
- }
- }
- }
-
- *data << uint32(ammoDisplayID);
- *data << uint32(ammoInventoryType);
-}
-
void Spell::WriteSpellGoTargets(WorldPacket* data)
{
// This function also fill data for channeled spells:
@@ -4319,8 +4237,6 @@ void Spell::TakeAmmo()
m_caster->ToPlayer()->DestroyItemCount(pItem, count, true);
}
}
- else if (uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID))
- m_caster->ToPlayer()->DestroyItemCount(ammo, 1, true);
}
}
@@ -6136,46 +6052,6 @@ SpellCastResult Spell::CheckItems()
case ITEM_SUBCLASS_WEAPON_GUN:
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- {
- uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
- if (!ammo)
- {
- // Requires No Ammo
- if (m_caster->HasAura(46699))
- break; // skip other checks
-
- return SPELL_FAILED_NO_AMMO;
- }
-
- ItemTemplate const* ammoProto = sObjectMgr->GetItemTemplate(ammo);
- if (!ammoProto)
- return SPELL_FAILED_NO_AMMO;
-
- if (ammoProto->Class != ITEM_CLASS_PROJECTILE)
- return SPELL_FAILED_NO_AMMO;
-
- // check ammo ws. weapon compatibility
- switch (pItem->GetTemplate()->SubClass)
- {
- case ITEM_SUBCLASS_WEAPON_BOW:
- case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- if (ammoProto->SubClass != ITEM_SUBCLASS_ARROW)
- return SPELL_FAILED_NO_AMMO;
- break;
- case ITEM_SUBCLASS_WEAPON_GUN:
- if (ammoProto->SubClass != ITEM_SUBCLASS_BULLET)
- return SPELL_FAILED_NO_AMMO;
- break;
- default:
- return SPELL_FAILED_NO_AMMO;
- }
-
- if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
- {
- m_caster->ToPlayer()->SetUInt32Value(PLAYER_AMMO_ID, 0);
- return SPELL_FAILED_NO_AMMO;
- }
- }; break;
case ITEM_SUBCLASS_WEAPON_WAND:
break;
default:
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 624c3b9b9b3..02f415e88c3 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -43,7 +43,7 @@ enum SpellCastFlags
CAST_FLAG_UNKNOWN_3 = 0x00000004,
CAST_FLAG_UNKNOWN_4 = 0x00000008, // ignore AOE visual
CAST_FLAG_UNKNOWN_5 = 0x00000010,
- CAST_FLAG_AMMO = 0x00000020, // Projectiles visual
+ CAST_FLAG_UNKNOWN_6 = 0x00000020,
CAST_FLAG_UNKNOWN_7 = 0x00000040,
CAST_FLAG_UNKNOWN_8 = 0x00000080,
CAST_FLAG_UNKNOWN_9 = 0x00000100,
@@ -402,7 +402,6 @@ class Spell
void DoCreateItem(uint32 i, uint32 itemtype);
void WriteSpellGoTargets(WorldPacket* data);
- void WriteAmmoToPacket(WorldPacket* data);
void InitExplicitTargets(SpellCastTargets const& targets);
void SelectSpellTargets();
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 8cb001ed0ac..a3ff66f7b5b 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -7344,7 +7344,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
if (!(spellInfo->AttributesEx7 & SPELL_ATTR7_SUMMON_PLAYER_TOTEM))
continue;
- uint32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
+ int32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
if (m_caster->GetPower(POWER_MANA) < cost)
continue;
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 9a5a8d6f5fe..e4ee17e324d 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1258,7 +1258,7 @@ void World::SetInitialWorldSettings()
///- Load the DBC files
sLog->outString("Initialize data stores...");
LoadDBCStores(m_dataPath);
- LoadDB2Stores(m_dataPath);
+ LoadDB2Stores(m_dataPath);
DetectDBCLang();
sLog->outString("Loading spell dbc data corrections...");