Core/Auras: Save cast item guids for auras to db

--HG--
branch : trunk
This commit is contained in:
Shauren committed 2010-12-20 14:55:36 +01:00
1 parent 834285c86d
commit 89f2870b97
4 files changed
+17 -11

No files matched your search

+2 -1
View File
@@ -461,6 +461,7 @@ DROP TABLE IF EXISTS `character_aura`;
CREATE TABLE `character_aura` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`caster_guid` bigint(20) unsigned NOT NULL default '0' COMMENT 'Full Global Unique Identifier',
`item_guid` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`spell` int(11) unsigned NOT NULL default '0',
`effect_mask` tinyint(3) unsigned NOT NULL default '0',
`recalculate_mask` tinyint(3) unsigned NOT NULL default '0',
@@ -474,7 +475,7 @@ CREATE TABLE `character_aura` (
`maxduration` int(11) NOT NULL default '0',
`remaintime` int(11) NOT NULL default '0',
`remaincharges` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`guid`,`caster_guid`,`spell`,`effect_mask`)
PRIMARY KEY (`guid`,`caster_guid`,`item_guid`,`spell`,`effect_mask`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Player System';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -0,0 +1,4 @@
ALTER TABLE `character_aura`
ADD COLUMN `item_guid` bigint(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `caster_guid`,
DROP PRIMARY KEY,
ADD PRIMARY KEY (`guid`,`caster_guid`,`item_guid`,`spell`,`effect_mask`);
+9 -8
View File
@@ -18120,18 +18120,18 @@ void Player::_SaveAuras(SQLTransaction& trans)
uint8 recalculateMask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (aura->GetEffect(i))
if (AuraEffect const* effect = aura->GetEffect(i))
{
baseDamage[i] = aura->GetEffect(i)->GetBaseAmount();
damage[i] = aura->GetEffect(i)->GetAmount();
effMask |= (1<<i);
if (aura->GetEffect(i)->CanBeRecalculated())
recalculateMask |= (1<<i);
baseDamage[i] = effect->GetBaseAmount();
damage[i] = effect->GetAmount();
effMask |= 1 << i;
if (effect->CanBeRecalculated())
recalculateMask |= 1 << i;
}
else
{
baseDamage[i] = NULL;
damage[i] = NULL;
baseDamage[i] = 0;
damage[i] = 0;
}
}
@@ -18139,6 +18139,7 @@ void Player::_SaveAuras(SQLTransaction& trans)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_AURA);
stmt->setUInt32(index++, GetGUIDLow());
stmt->setUInt64(index++, itr->second->GetCasterGUID());
stmt->setUInt64(index++, itr->second->GetCastItemGUID());
stmt->setUInt32(index++, itr->second->GetId());
stmt->setUInt8(index++, effMask);
stmt->setUInt8(index++, recalculateMask);
@@ -255,8 +255,8 @@ bool CharacterDatabaseConnection::Open()
// Auras
PrepareStatement(CHAR_DEL_AURA, "DELETE FROM character_aura WHERE guid = ?", true);
PrepareStatement(CHAR_ADD_AURA, "INSERT INTO character_aura (guid,caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", true);
PrepareStatement(CHAR_ADD_AURA, "INSERT INTO character_aura (guid,caster_guid,item_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", true);
return true;
}