mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11620] Make equipment manager handle "ignore this slot" option properly.
Also fix SQL fields to use unsigned values as expected in code, otherwise large values will get lost.
This commit is contained in:
parent
de0fc143f6
commit
1ffde196ce
7 changed files with 81 additions and 34 deletions
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
DROP TABLE IF EXISTS `character_db_version`;
|
||||
CREATE TABLE `character_db_version` (
|
||||
`required_11436_01_characters_character_queststatus` bit(1) default NULL
|
||||
`required_11620_01_characters_character_equipmentsets` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
|
||||
|
||||
--
|
||||
|
|
@ -460,25 +460,26 @@ CREATE TABLE `character_equipmentsets` (
|
|||
`setindex` tinyint(4) NOT NULL default '0',
|
||||
`name` varchar(100) NOT NULL,
|
||||
`iconname` varchar(100) NOT NULL,
|
||||
`item0` int(11) NOT NULL default '0',
|
||||
`item1` int(11) NOT NULL default '0',
|
||||
`item2` int(11) NOT NULL default '0',
|
||||
`item3` int(11) NOT NULL default '0',
|
||||
`item4` int(11) NOT NULL default '0',
|
||||
`item5` int(11) NOT NULL default '0',
|
||||
`item6` int(11) NOT NULL default '0',
|
||||
`item7` int(11) NOT NULL default '0',
|
||||
`item8` int(11) NOT NULL default '0',
|
||||
`item9` int(11) NOT NULL default '0',
|
||||
`item10` int(11) NOT NULL default '0',
|
||||
`item11` int(11) NOT NULL default '0',
|
||||
`item12` int(11) NOT NULL default '0',
|
||||
`item13` int(11) NOT NULL default '0',
|
||||
`item14` int(11) NOT NULL default '0',
|
||||
`item15` int(11) NOT NULL default '0',
|
||||
`item16` int(11) NOT NULL default '0',
|
||||
`item17` int(11) NOT NULL default '0',
|
||||
`item18` int(11) NOT NULL default '0',
|
||||
`ignore_mask` int(11) unsigned NOT NULL default '0',
|
||||
`item0` int(11) unsigned NOT NULL default '0',
|
||||
`item1` int(11) unsigned NOT NULL default '0',
|
||||
`item2` int(11) unsigned NOT NULL default '0',
|
||||
`item3` int(11) unsigned NOT NULL default '0',
|
||||
`item4` int(11) unsigned NOT NULL default '0',
|
||||
`item5` int(11) unsigned NOT NULL default '0',
|
||||
`item6` int(11) unsigned NOT NULL default '0',
|
||||
`item7` int(11) unsigned NOT NULL default '0',
|
||||
`item8` int(11) unsigned NOT NULL default '0',
|
||||
`item9` int(11) unsigned NOT NULL default '0',
|
||||
`item10` int(11) unsigned NOT NULL default '0',
|
||||
`item11` int(11) unsigned NOT NULL default '0',
|
||||
`item12` int(11) unsigned NOT NULL default '0',
|
||||
`item13` int(11) unsigned NOT NULL default '0',
|
||||
`item14` int(11) unsigned NOT NULL default '0',
|
||||
`item15` int(11) unsigned NOT NULL default '0',
|
||||
`item16` int(11) unsigned NOT NULL default '0',
|
||||
`item17` int(11) unsigned NOT NULL default '0',
|
||||
`item18` int(11) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`setguid`),
|
||||
UNIQUE KEY `idx_set` (`guid`,`setguid`,`setindex`),
|
||||
INDEX `Idx_setindex` (`setindex`)
|
||||
|
|
|
|||
24
sql/updates/11620_01_characters_character_equipmentsets.sql
Normal file
24
sql/updates/11620_01_characters_character_equipmentsets.sql
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
ALTER TABLE character_db_version CHANGE COLUMN required_11436_01_characters_character_queststatus required_11620_01_characters_character_equipmentsets bit;
|
||||
|
||||
ALTER TABLE character_equipmentsets
|
||||
MODIFY COLUMN item0 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item1 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item2 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item3 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item4 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item5 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item6 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item7 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item8 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item9 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item10 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item11 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item12 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item13 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item14 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item15 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item16 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item17 int(11) unsigned NOT NULL DEFAULT 0,
|
||||
MODIFY COLUMN item18 int(11) unsigned NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE character_equipmentsets ADD COLUMN ignore_mask int(11) unsigned NOT NULL DEFAULT 0 AFTER iconname;
|
||||
|
|
@ -95,7 +95,7 @@ bool LoginQueryHolder::Initialize()
|
|||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, wons_season, personal_rating FROM arena_team_member WHERE guid='%u'", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, "SELECT instance_id, team, join_x, join_y, join_z, join_o, join_map, taxi_start, taxi_end, mount_spell FROM character_battleground_data WHERE guid = '%u'", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, "SELECT type, time, data FROM character_account_data WHERE guid='%u'", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT talent_id, current_rank, spec FROM character_talent WHERE guid = '%u'", m_guid.GetCounter());
|
||||
|
|
@ -1242,6 +1242,14 @@ void WorldSession::HandleEquipmentSetSaveOpcode(WorldPacket &recv_data)
|
|||
|
||||
recv_data >> itemGuid.ReadAsPacked();
|
||||
|
||||
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (not touch slot at equip set)
|
||||
if (itemGuid.GetRawValue() == 1)
|
||||
{
|
||||
// ignored slots saved as bit mask because we have no free special values for Items[i]
|
||||
eqSet.IgnoreMask |= 1 << i;
|
||||
continue;
|
||||
}
|
||||
|
||||
Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
|
||||
if(!item && itemGuid) // cheating check 1
|
||||
|
|
@ -1282,6 +1290,10 @@ void WorldSession::HandleEquipmentSetUseOpcode(WorldPacket &recv_data)
|
|||
|
||||
DEBUG_LOG("Item (%s): srcbag %u, srcslot %u", itemGuid.GetString().c_str(), srcbag, srcslot);
|
||||
|
||||
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
|
||||
if (itemGuid.GetRawValue() == 1)
|
||||
continue;
|
||||
|
||||
Item *item = _player->GetItemByGuid(itemGuid);
|
||||
|
||||
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
|
||||
|
|
|
|||
|
|
@ -15233,7 +15233,7 @@ void Player::_LoadArenaTeamInfo(QueryResult *result)
|
|||
|
||||
void Player::_LoadEquipmentSets(QueryResult *result)
|
||||
{
|
||||
// SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid));
|
||||
// SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid));
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
|
|
@ -15244,14 +15244,15 @@ void Player::_LoadEquipmentSets(QueryResult *result)
|
|||
|
||||
EquipmentSet eqSet;
|
||||
|
||||
eqSet.Guid = fields[0].GetUInt64();
|
||||
uint32 index = fields[1].GetUInt32();
|
||||
eqSet.Name = fields[2].GetCppString();
|
||||
eqSet.IconName = fields[3].GetCppString();
|
||||
eqSet.state = EQUIPMENT_SET_UNCHANGED;
|
||||
eqSet.Guid = fields[0].GetUInt64();
|
||||
uint32 index = fields[1].GetUInt32();
|
||||
eqSet.Name = fields[2].GetCppString();
|
||||
eqSet.IconName = fields[3].GetCppString();
|
||||
eqSet.IgnoreMask = fields[4].GetUInt32();
|
||||
eqSet.state = EQUIPMENT_SET_UNCHANGED;
|
||||
|
||||
for(uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
eqSet.Items[i] = fields[4+i].GetUInt32();
|
||||
eqSet.Items[i] = fields[5+i].GetUInt32();
|
||||
|
||||
m_EquipmentSets[index] = eqSet;
|
||||
|
||||
|
|
@ -22405,7 +22406,13 @@ void Player::SendEquipmentSetList()
|
|||
data << itr->second.Name;
|
||||
data << itr->second.IconName;
|
||||
for(uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
data << ObjectGuid(HIGHGUID_ITEM, itr->second.Items[i]).WriteAsPacked();
|
||||
{
|
||||
// ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM
|
||||
if (itr->second.IgnoreMask & (1 << i))
|
||||
data << ObjectGuid(uint64(1)).WriteAsPacked();
|
||||
else
|
||||
data << ObjectGuid(HIGHGUID_ITEM, itr->second.Items[i]).WriteAsPacked();
|
||||
}
|
||||
|
||||
++count; // client have limit but it checked at loading and set
|
||||
}
|
||||
|
|
@ -22471,12 +22478,13 @@ void Player::_SaveEquipmentSets()
|
|||
break; // nothing do
|
||||
case EQUIPMENT_SET_CHANGED:
|
||||
{
|
||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updSets, "UPDATE character_equipmentsets SET name=?, iconname=?, item0=?, item1=?, item2=?, item3=?, item4=?, "
|
||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updSets, "UPDATE character_equipmentsets SET name=?, iconname=?, ignore_mask=?, item0=?, item1=?, item2=?, item3=?, item4=?, "
|
||||
"item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, "
|
||||
"item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?");
|
||||
|
||||
stmt.addString(eqset.Name);
|
||||
stmt.addString(eqset.IconName);
|
||||
stmt.addUInt32(eqset.IgnoreMask);
|
||||
|
||||
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
stmt.addUInt32(eqset.Items[i]);
|
||||
|
|
@ -22493,12 +22501,13 @@ void Player::_SaveEquipmentSets()
|
|||
}
|
||||
case EQUIPMENT_SET_NEW:
|
||||
{
|
||||
SqlStatement stmt = CharacterDatabase.CreateStatement(insSets, "INSERT INTO character_equipmentsets VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
SqlStatement stmt = CharacterDatabase.CreateStatement(insSets, "INSERT INTO character_equipmentsets VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
stmt.addUInt32(GetGUIDLow());
|
||||
stmt.addUInt64(eqset.Guid);
|
||||
stmt.addUInt32(index);
|
||||
stmt.addString(eqset.Name);
|
||||
stmt.addString(eqset.IconName);
|
||||
stmt.addUInt32(eqset.IgnoreMask);
|
||||
|
||||
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
stmt.addUInt32(eqset.Items[i]);
|
||||
|
|
|
|||
|
|
@ -707,7 +707,7 @@ enum EquipmentSetUpdateState
|
|||
|
||||
struct EquipmentSet
|
||||
{
|
||||
EquipmentSet() : Guid(0), state(EQUIPMENT_SET_NEW)
|
||||
EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
|
||||
{
|
||||
for(int i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
Items[i] = 0;
|
||||
|
|
@ -716,6 +716,7 @@ struct EquipmentSet
|
|||
uint64 Guid;
|
||||
std::string Name;
|
||||
std::string IconName;
|
||||
uint32 IgnoreMask;
|
||||
uint32 Items[EQUIPMENT_SLOT_END];
|
||||
EquipmentSetUpdateState state;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11619"
|
||||
#define REVISION_NR "11620"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_11436_01_characters_character_queststatus"
|
||||
#define REVISION_DB_CHARACTERS "required_11620_01_characters_character_equipmentsets"
|
||||
#define REVISION_DB_MANGOS "required_11613_01_mangos_spell_bonus_data"
|
||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue