Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/development' into repacker
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 15, 2024
2 parents 129c24d + ff028e8 commit 5d5c969
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 8 deletions.
25 changes: 25 additions & 0 deletions sql/migrations/20240914160609_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
DROP PROCEDURE IF EXISTS add_migration;
DELIMITER ??
CREATE PROCEDURE `add_migration`()
BEGIN
DECLARE v INT DEFAULT 1;
SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20240914160609');
IF v = 0 THEN
INSERT INTO `migrations` VALUES ('20240914160609');
-- Add your query below.


-- Add missing spawns for creature Longsnout.
INSERT INTO `creature` (`guid`, `id`, `id2`, `id3`, `id4`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `wander_distance`, `health_percent`, `mana_percent`, `movement_type`, `spawn_flags`, `visibility_mod`) VALUES (113, 119, 0, 0, 0, 0, -9788.9, 646.32, 35.616, 0.376152, 120, 120, 15, 100, 100, 1, 0, 0);
INSERT INTO `creature` (`guid`, `id`, `id2`, `id3`, `id4`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `wander_distance`, `health_percent`, `mana_percent`, `movement_type`, `spawn_flags`, `visibility_mod`) VALUES (189, 119, 0, 0, 0, 0, -9848.83, 648.454, 39.7502, 2.28436, 120, 120, 15, 100, 100, 1, 0, 0);
INSERT INTO `creature` (`guid`, `id`, `id2`, `id3`, `id4`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `wander_distance`, `health_percent`, `mana_percent`, `movement_type`, `spawn_flags`, `visibility_mod`) VALUES (190, 119, 0, 0, 0, 0, -9876.36, 688.972, 35.3996, 5.31748, 120, 120, 15, 100, 100, 1, 0, 0);
INSERT INTO `creature` (`guid`, `id`, `id2`, `id3`, `id4`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `wander_distance`, `health_percent`, `mana_percent`, `movement_type`, `spawn_flags`, `visibility_mod`) VALUES (703, 119, 0, 0, 0, 0, -9932.71, 660.869, 32.7262, 5.23372, 120, 120, 15, 100, 100, 1, 0, 0);
INSERT INTO `creature` (`guid`, `id`, `id2`, `id3`, `id4`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecsmin`, `spawntimesecsmax`, `wander_distance`, `health_percent`, `mana_percent`, `movement_type`, `spawn_flags`, `visibility_mod`) VALUES (1448, 119, 0, 0, 0, 0, -9957.65, 675.479, 32.483, 3.74679, 120, 120, 15, 100, 100, 1, 0, 0);


-- End of migration.
END IF;
END??
DELIMITER ;
CALL add_migration();
DROP PROCEDURE IF EXISTS add_migration;
39 changes: 31 additions & 8 deletions src/game/Group/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ bool Group::Create(ObjectGuid guid, char const* name)
Player::ConvertInstancesToGroup(leader, this, guid);

// store group in database
CharacterDatabase.BeginTransaction();
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("DELETE FROM `groups` WHERE `group_id` ='%u'", m_Id);
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `group_id` ='%u'", m_Id);

Expand All @@ -154,14 +154,12 @@ bool Group::Create(ObjectGuid guid, char const* name)
m_targetIcons[4].GetRawValue(), m_targetIcons[5].GetRawValue(),
m_targetIcons[6].GetRawValue(), m_targetIcons[7].GetRawValue(),
isRaidGroup());
CharacterDatabase.CommitTransaction();
}

if (!AddMember(guid, name))
return false;

if (!isBGGroup())
CharacterDatabase.CommitTransaction();

_updateLeaderFlag();

return true;
Expand Down Expand Up @@ -622,7 +620,7 @@ void Group::Disband(bool hideDestroy, ObjectGuid initiator)

if (!isBGGroup())
{
CharacterDatabase.BeginTransaction();
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("DELETE FROM `groups` WHERE `group_id`='%u'", m_Id);
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `group_id`='%u'", m_Id);
CharacterDatabase.CommitTransaction();
Expand Down Expand Up @@ -1584,8 +1582,11 @@ bool Group::_addMember(ObjectGuid guid, char const* name, bool isAssistant, uint
if (!isBGGroup() && !(player && player->IsSavingDisabled()))
{
// insert into group table
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("INSERT INTO `group_member` (`group_id`, `member_guid`, `assistant`, `subgroup`) VALUES('%u','%u','%u','%u')",
m_Id, member.guid.GetCounter(), ((member.assistant == 1) ? 1 : 0), member.group);
CharacterDatabase.CommitTransaction();

}

return true;
Expand Down Expand Up @@ -1620,7 +1621,11 @@ bool Group::_removeMember(ObjectGuid guid)
}

if (!isBGGroup())
{
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `member_guid`='%u'", guid.GetCounter());
CharacterDatabase.CommitTransaction();
}

if (m_leaderGuid == guid) // leader was removed
{
Expand Down Expand Up @@ -1690,7 +1695,7 @@ void Group::_setLeader(ObjectGuid guid)
uint32 leader_lowguid = m_leaderGuid.GetCounter();

// TODO: set a time limit to have this function run rarely cause it can be slow
CharacterDatabase.BeginTransaction();
CharacterDatabase.BeginTransaction(m_Id);

// update the group's bound instances when changing leaders

Expand Down Expand Up @@ -1791,8 +1796,10 @@ bool Group::_swapMembersGroup(ObjectGuid guid, ObjectGuid swapGuid)
// Don't need to change group counters since we are swapping
if (!isBGGroup())
{
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("UPDATE `group_member` SET `subgroup`='%u' WHERE `member_guid`='%u'", slot->group, guid.GetCounter());
CharacterDatabase.PExecute("UPDATE `group_member` SET `subgroup`='%u' WHERE `member_guid`='%u'", swapSlot->group, swapGuid.GetCounter());
CharacterDatabase.CommitTransaction();
}

return true;
Expand All @@ -1809,7 +1816,11 @@ bool Group::_setMembersGroup(ObjectGuid guid, uint8 group)
SubGroupCounterIncrease(group);

if (!isBGGroup())
{
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("UPDATE `group_member` SET `subgroup`='%u' WHERE `member_guid`='%u'", group, guid.GetCounter());
CharacterDatabase.CommitTransaction();
}

return true;
}
Expand All @@ -1822,7 +1833,12 @@ bool Group::_setAssistantFlag(ObjectGuid guid, bool const& state)

slot->assistant = state;
if (!isBGGroup())
{
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("UPDATE `group_member` SET `assistant`='%u' WHERE `member_guid`='%u'", (state) ? 1 : 0, guid.GetCounter());
CharacterDatabase.CommitTransaction();
}

return true;
}

Expand All @@ -1844,7 +1860,11 @@ bool Group::_setMainTank(ObjectGuid guid)
m_mainTankGuid = guid;

if (!isBGGroup())
{
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("UPDATE `groups` SET `main_tank_guid`='%u' WHERE `group_id`='%u'", m_mainTankGuid.GetCounter(), m_Id);
CharacterDatabase.CommitTransaction();
}

return true;
}
Expand All @@ -1867,8 +1887,11 @@ bool Group::_setMainAssistant(ObjectGuid guid)
m_mainAssistantGuid = guid;

if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE `groups` SET `main_assistant_guid`='%u' WHERE `group_id`='%u'",
m_mainAssistantGuid.GetCounter(), m_Id);
{
CharacterDatabase.BeginTransaction(m_Id);
CharacterDatabase.PExecute("UPDATE `groups` SET `main_assistant_guid`='%u' WHERE `group_id`='%u'", m_mainAssistantGuid.GetCounter(), m_Id);
CharacterDatabase.CommitTransaction();
}

return true;
}
Expand Down

0 comments on commit 5d5c969

Please sign in to comment.