mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7059] Drop spell slot fields as unused for characters and pets.
Also temporary fix spell slot setting in 7047_01_characters_character_spell.sql
This commit is contained in:
parent
3b15d1ec7e
commit
e1a4ad241d
11 changed files with 34 additions and 61 deletions
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
DROP TABLE IF EXISTS `character_db_version`;
|
||||
CREATE TABLE `character_db_version` (
|
||||
`required_7047_01_characters_character_spell` bit(1) default NULL
|
||||
`required_7059_02_characters_pet_spell` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
|
||||
|
||||
--
|
||||
|
|
@ -626,7 +626,6 @@ DROP TABLE IF EXISTS `character_spell`;
|
|||
CREATE TABLE `character_spell` (
|
||||
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
|
||||
`spell` int(11) unsigned NOT NULL default '0' COMMENT 'Spell Identifier',
|
||||
`slot` int(11) unsigned NOT NULL default '0',
|
||||
`active` tinyint(3) unsigned NOT NULL default '1',
|
||||
`disabled` tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`guid`,`spell`)
|
||||
|
|
@ -1216,7 +1215,6 @@ DROP TABLE IF EXISTS `pet_spell`;
|
|||
CREATE TABLE `pet_spell` (
|
||||
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
|
||||
`spell` int(11) unsigned NOT NULL default '0' COMMENT 'Spell Identifier',
|
||||
`slot` int(11) unsigned NOT NULL default '0',
|
||||
`active` int(11) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`guid`,`spell`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Pet System';
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ ALTER TABLE character_db_version CHANGE COLUMN required_6976_02_characters_chara
|
|||
|
||||
DELETE FROM `character_spell` WHERE `spell` IN ('28880', 59542, 59543, 59544, 59545, 59547, 59548);
|
||||
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 28880, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 1;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59542, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 2;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59543, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 3;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59544, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 5;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59545, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 6;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59547, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 7;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59548, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 8;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 28880, 4294967295, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 1;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59542, 4294967295, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 2;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59543, 4294967295, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 3;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59544, 4294967295, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 5;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59545, 4294967295, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 6;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59547, 4294967295, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 7;
|
||||
INSERT INTO character_spell SELECT characters.guid as guid, 59548, 4294967295, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 8;
|
||||
|
|
|
|||
4
sql/updates/7059_01_characters_character_spell.sql
Normal file
4
sql/updates/7059_01_characters_character_spell.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE character_db_version CHANGE COLUMN required_7047_01_characters_character_spell required_7059_01_characters_character_spell bit;
|
||||
|
||||
ALTER TABLE character_spell
|
||||
DROP slot;
|
||||
4
sql/updates/7059_02_characters_pet_spell.sql
Normal file
4
sql/updates/7059_02_characters_pet_spell.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE character_db_version CHANGE COLUMN required_7059_01_characters_character_spell required_7059_02_characters_pet_spell bit;
|
||||
|
||||
ALTER TABLE pet_spell
|
||||
DROP slot;
|
||||
|
|
@ -124,6 +124,8 @@ pkgdata_DATA = \
|
|||
7052_01_mangos_spell_proc_event.sql \
|
||||
7053_01_mangos_spell_proc_event.sql \
|
||||
7056_01_mangos_spell_proc_event.sql \
|
||||
7059_01_characters_character_spell.sql \
|
||||
7059_02_characters_pet_spell.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -228,4 +230,6 @@ EXTRA_DIST = \
|
|||
7052_01_mangos_spell_proc_event.sql \
|
||||
7053_01_mangos_spell_proc_event.sql \
|
||||
7056_01_mangos_spell_proc_event.sql \
|
||||
7059_01_characters_character_spell.sql \
|
||||
7059_02_characters_pet_spell.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ bool LoginQueryHolder::Initialize()
|
|||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,slot,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTUTORIALS, "SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u' AND realmid = '%u'", GetAccountId(), realmID);
|
||||
|
|
|
|||
|
|
@ -1078,7 +1078,7 @@ void Pet::_SaveSpellCooldowns()
|
|||
|
||||
void Pet::_LoadSpells()
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT spell,slot,active FROM pet_spell WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active FROM pet_spell WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
|
||||
if(result)
|
||||
{
|
||||
|
|
@ -1086,7 +1086,7 @@ void Pet::_LoadSpells()
|
|||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
addSpell(fields[0].GetUInt16(), fields[2].GetUInt16(), PETSPELL_UNCHANGED, fields[1].GetUInt16());
|
||||
addSpell(fields[0].GetUInt16(), fields[1].GetUInt16(), PETSPELL_UNCHANGED);
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
|
|
@ -1103,7 +1103,7 @@ void Pet::_SaveSpells()
|
|||
if (itr->second->state == PETSPELL_REMOVED || itr->second->state == PETSPELL_CHANGED)
|
||||
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE guid = '%u' and spell = '%u'", m_charmInfo->GetPetNumber(), itr->first);
|
||||
if (itr->second->state == PETSPELL_NEW || itr->second->state == PETSPELL_CHANGED)
|
||||
CharacterDatabase.PExecute("INSERT INTO pet_spell (guid,spell,slot,active) VALUES ('%u', '%u', '%u','%u')", m_charmInfo->GetPetNumber(), itr->first, itr->second->slotId,itr->second->active);
|
||||
CharacterDatabase.PExecute("INSERT INTO pet_spell (guid,spell,active) VALUES ('%u', '%u', '%u')", m_charmInfo->GetPetNumber(), itr->first, itr->second->active);
|
||||
|
||||
if (itr->second->state == PETSPELL_REMOVED)
|
||||
_removeSpell(itr->first);
|
||||
|
|
@ -1239,7 +1239,7 @@ void Pet::_SaveAuras()
|
|||
}
|
||||
}
|
||||
|
||||
bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, uint16 slot_id, PetSpellType type)
|
||||
bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, PetSpellType type)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
if (!spellInfo)
|
||||
|
|
@ -1299,7 +1299,6 @@ bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, uint16 s
|
|||
|
||||
if(spellmgr.GetFirstSpellInChain(itr->first) == chainstart)
|
||||
{
|
||||
slot_id = itr->second->slotId;
|
||||
newspell->active = itr->second->active;
|
||||
|
||||
if(newspell->active == ACT_ENABLED)
|
||||
|
|
@ -1311,21 +1310,6 @@ bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, uint16 s
|
|||
}
|
||||
}
|
||||
|
||||
uint16 tmpslot = slot_id;
|
||||
|
||||
if (tmpslot == 0xffff)
|
||||
{
|
||||
uint16 maxid = 0;
|
||||
PetSpellMap::iterator itr;
|
||||
for (itr = m_spells.begin(); itr != m_spells.end(); ++itr)
|
||||
{
|
||||
if(itr->second->state == PETSPELL_REMOVED) continue;
|
||||
if (itr->second->slotId > maxid) maxid = itr->second->slotId;
|
||||
}
|
||||
tmpslot = maxid + 1;
|
||||
}
|
||||
|
||||
newspell->slotId = tmpslot;
|
||||
m_spells[spell_id] = newspell;
|
||||
|
||||
if (IsPassiveSpell(spell_id))
|
||||
|
|
@ -1589,7 +1573,7 @@ void Pet::LearnPetPassives()
|
|||
if(petStore != sPetFamilySpellsStore.end())
|
||||
{
|
||||
for(PetFamilySpellsSet::const_iterator petSet = petStore->second.begin(); petSet != petStore->second.end(); ++petSet)
|
||||
addSpell(*petSet, ACT_DECIDE, PETSPELL_NEW, 0xffff, PETSPELL_FAMILY);
|
||||
addSpell(*petSet, ACT_DECIDE, PETSPELL_NEW, PETSPELL_FAMILY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ enum PetSpellType
|
|||
|
||||
struct PetSpell
|
||||
{
|
||||
uint16 slotId;
|
||||
uint16 active;
|
||||
|
||||
PetSpellState state : 16;
|
||||
|
|
@ -189,7 +188,7 @@ class Pet : public Creature
|
|||
void _LoadSpells();
|
||||
void _SaveSpells();
|
||||
|
||||
bool addSpell(uint16 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, uint16 slot_id=0xffff, PetSpellType type = PETSPELL_NORMAL);
|
||||
bool addSpell(uint16 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL);
|
||||
bool learnSpell(uint16 spell_id);
|
||||
void learnLevelupSpells();
|
||||
bool unlearnSpell(uint16 spell_id);
|
||||
|
|
|
|||
|
|
@ -2528,7 +2528,7 @@ void Player::AddNewMailDeliverTime(time_t deliver_time)
|
|||
}
|
||||
}
|
||||
|
||||
bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, uint16 slot_id, bool disabled)
|
||||
bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, bool disabled)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
if (!spellInfo)
|
||||
|
|
@ -2646,7 +2646,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading,
|
|||
else if(uint32 prev_spell = spellmgr.GetPrevSpellInChain(spell_id))
|
||||
{
|
||||
if(loading) // at spells loading, no output, but allow save
|
||||
addSpell(prev_spell,active,true,loading,SPELL_WITHOUT_SLOT_ID,disabled);
|
||||
addSpell(prev_spell,active,true,loading,disabled);
|
||||
else // at normal learning
|
||||
learnSpell(prev_spell);
|
||||
}
|
||||
|
|
@ -2704,23 +2704,6 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading,
|
|||
}
|
||||
}
|
||||
|
||||
uint16 tmpslot=slot_id;
|
||||
|
||||
if (tmpslot == SPELL_WITHOUT_SLOT_ID)
|
||||
{
|
||||
uint16 maxid = 0;
|
||||
PlayerSpellMap::iterator itr;
|
||||
for (itr = m_spells.begin(); itr != m_spells.end(); ++itr)
|
||||
{
|
||||
if(itr->second->state == PLAYERSPELL_REMOVED)
|
||||
continue;
|
||||
if (itr->second->slotId > maxid)
|
||||
maxid = itr->second->slotId;
|
||||
}
|
||||
tmpslot = maxid + 1;
|
||||
}
|
||||
|
||||
newspell->slotId = tmpslot;
|
||||
m_spells[spell_id] = newspell;
|
||||
|
||||
// return false if spell disabled
|
||||
|
|
@ -14941,7 +14924,7 @@ void Player::_LoadSpells(QueryResult *result)
|
|||
delete itr->second;
|
||||
m_spells.clear();
|
||||
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT spell,slot,active FROM character_spell WHERE guid = '%u'",GetGUIDLow());
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'",GetGUIDLow());
|
||||
|
||||
if(result)
|
||||
{
|
||||
|
|
@ -14949,7 +14932,7 @@ void Player::_LoadSpells(QueryResult *result)
|
|||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
addSpell(fields[0].GetUInt16(), fields[2].GetBool(), false, true, fields[1].GetUInt16(), fields[3].GetBool());
|
||||
addSpell(fields[0].GetUInt16(), fields[1].GetBool(), false, true, fields[2].GetBool());
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
|
|
@ -15712,7 +15695,7 @@ void Player::_SaveSpells()
|
|||
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED)
|
||||
CharacterDatabase.PExecute("DELETE FROM character_spell WHERE guid = '%u' and spell = '%u'", GetGUIDLow(), itr->first);
|
||||
if (itr->second->state == PLAYERSPELL_NEW || itr->second->state == PLAYERSPELL_CHANGED)
|
||||
CharacterDatabase.PExecute("INSERT INTO character_spell (guid,spell,slot,active,disabled) VALUES ('%u', '%u', '%u','%u','%u')", GetGUIDLow(), itr->first, itr->second->slotId,itr->second->active ? 1 : 0,itr->second->disabled ? 1 : 0);
|
||||
CharacterDatabase.PExecute("INSERT INTO character_spell (guid,spell,active,disabled) VALUES ('%u', '%u', '%u', '%u')", GetGUIDLow(), itr->first, itr->second->active ? 1 : 0,itr->second->disabled ? 1 : 0);
|
||||
|
||||
if (itr->second->state == PLAYERSPELL_REMOVED)
|
||||
_removeSpell(itr->first);
|
||||
|
|
|
|||
|
|
@ -72,14 +72,11 @@ enum PlayerSpellState
|
|||
|
||||
struct PlayerSpell
|
||||
{
|
||||
uint16 slotId : 16;
|
||||
PlayerSpellState state : 8;
|
||||
bool active : 1;
|
||||
bool disabled : 1;
|
||||
};
|
||||
|
||||
#define SPELL_WITHOUT_SLOT_ID uint16(-1)
|
||||
|
||||
// Spell modifier (used for modify other spells)
|
||||
struct SpellModifier
|
||||
{
|
||||
|
|
@ -1470,7 +1467,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
|
||||
void SendProficiency(uint8 pr1, uint32 pr2);
|
||||
void SendInitialSpells();
|
||||
bool addSpell(uint32 spell_id, bool active, bool learning = true, bool loading = false, uint16 slot_id=SPELL_WITHOUT_SLOT_ID, bool disabled = false);
|
||||
bool addSpell(uint32 spell_id, bool active, bool learning = true, bool loading = false, bool disabled = false);
|
||||
void learnSpell(uint32 spell_id);
|
||||
void removeSpell(uint32 spell_id, bool disabled = false);
|
||||
void resetSpells();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7058"
|
||||
#define REVISION_NR "7059"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue