Skip to content

Commit

Permalink
Mark threadunsafe methods as world only in multistate
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Apr 4, 2024
1 parent 6d3cdb7 commit 010102d
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 67 deletions.
16 changes: 8 additions & 8 deletions CMangos/GroupMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,23 +378,23 @@ namespace LuaGroup
ElunaRegister<Group> GroupMethods[] =
{
// Getters
{ "GetMembers", &LuaGroup::GetMembers },
{ "GetMembers", &LuaGroup::GetMembers, METHOD_REG_WORLD }, // World state method only in multistate
{ "GetLeaderGUID", &LuaGroup::GetLeaderGUID },
{ "GetGUID", &LuaGroup::GetGUID },
{ "GetMemberGroup", &LuaGroup::GetMemberGroup },
{ "GetMemberGUID", &LuaGroup::GetMemberGUID },
{ "GetMembersCount", &LuaGroup::GetMembersCount },

// Setters
{ "SetLeader", &LuaGroup::SetLeader },
{ "SetMembersGroup", &LuaGroup::SetMembersGroup },
{ "SetTargetIcon", &LuaGroup::SetTargetIcon },
{ "SetLeader", &LuaGroup::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetMembersGroup", &LuaGroup::SetMembersGroup, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetTargetIcon", &LuaGroup::SetTargetIcon, METHOD_REG_WORLD }, // World state method only in multistate

// Boolean
{ "IsLeader", &LuaGroup::IsLeader },
{ "AddMember", &LuaGroup::AddMember },
{ "RemoveMember", &LuaGroup::RemoveMember },
{ "Disband", &LuaGroup::Disband },
{ "AddMember", &LuaGroup::AddMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "RemoveMember", &LuaGroup::RemoveMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "Disband", &LuaGroup::Disband, METHOD_REG_WORLD }, // World state method only in multistate
{ "IsFull", &LuaGroup::IsFull },
{ "IsRaidGroup", &LuaGroup::IsRaidGroup },
{ "IsBGGroup", &LuaGroup::IsBGGroup },
Expand All @@ -410,7 +410,7 @@ namespace LuaGroup

// Other
{ "SendPacket", &LuaGroup::SendPacket },
{ "ConvertToRaid", &LuaGroup::ConvertToRaid },
{ "ConvertToRaid", &LuaGroup::ConvertToRaid, METHOD_REG_WORLD }, // World state method only in multistate

// Not implemented methods
{ "IsBFGroup", nullptr, METHOD_REG_NONE }, // not implemented
Expand Down
16 changes: 8 additions & 8 deletions CMangos/GuildMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ namespace LuaGuild
ElunaRegister<Guild> GuildMethods[] =
{
// Getters
{ "GetMembers", &LuaGuild::GetMembers },
{ "GetLeader", &LuaGuild::GetLeader },
{ "GetMembers", &LuaGuild::GetMembers, METHOD_REG_WORLD }, // World state method only in multistate
{ "GetLeader", &LuaGuild::GetLeader, METHOD_REG_WORLD }, // World state method only in multistate
{ "GetLeaderGUID", &LuaGuild::GetLeaderGUID },
{ "GetId", &LuaGuild::GetId },
{ "GetName", &LuaGuild::GetName },
Expand All @@ -253,23 +253,23 @@ namespace LuaGuild

// Setters
#if defined(TBC) || defined(WOTLK)
{ "SetBankTabText", &LuaGuild::SetBankTabText },
{ "SetBankTabText", &LuaGuild::SetBankTabText, METHOD_REG_WORLD }, // World state method only in multistate
#else
{ "SetBankTabText", nullptr, METHOD_REG_NONE },
#endif
{ "SetMemberRank", &LuaGuild::SetMemberRank },
{ "SetMemberRank", &LuaGuild::SetMemberRank, METHOD_REG_WORLD }, // World state method only in multistate
#ifndef CATA
{ "SetLeader", &LuaGuild::SetLeader },
{ "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
#else
{ "SetLeader", nullptr, METHOD_REG_NONE },
#endif

// Other
{ "SendPacket", &LuaGuild::SendPacket },
{ "SendPacketToRanked", &LuaGuild::SendPacketToRanked },
{ "Disband", &LuaGuild::Disband },
{ "AddMember", &LuaGuild::AddMember },
{ "DeleteMember", &LuaGuild::DeleteMember },
{ "Disband", &LuaGuild::Disband, METHOD_REG_WORLD }, // World state method only in multistate
{ "AddMember", &LuaGuild::AddMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "DeleteMember", &LuaGuild::DeleteMember, METHOD_REG_WORLD }, // World state method only in multistate

{ NULL, NULL, METHOD_REG_NONE }
};
Expand Down
4 changes: 2 additions & 2 deletions CMangos/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -4004,8 +4004,8 @@ namespace LuaPlayer
{ "Mute", &LuaPlayer::Mute },
{ "SummonPlayer", &LuaPlayer::SummonPlayer },
{ "SaveToDB", &LuaPlayer::SaveToDB },
{ "GroupInvite", &LuaPlayer::GroupInvite },
{ "GroupCreate", &LuaPlayer::GroupCreate },
{ "GroupInvite", &LuaPlayer::GroupInvite, METHOD_REG_WORLD }, // World state method only in multistate
{ "GroupCreate", &LuaPlayer::GroupCreate, METHOD_REG_WORLD }, // World state method only in multistate
{ "SendCinematicStart", &LuaPlayer::SendCinematicStart },
#if defined(TBC) || defined(WOTLK)
{ "RemoveArenaSpellCooldowns", &LuaPlayer::RemoveArenaSpellCooldowns },
Expand Down
14 changes: 7 additions & 7 deletions Mangos/GroupMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,15 @@ namespace LuaGroup
{ "GetMembersCount", &LuaGroup::GetMembersCount },

// Setters
{ "SetLeader", &LuaGroup::SetLeader },
{ "SetMembersGroup", &LuaGroup::SetMembersGroup },
{ "SetTargetIcon", &LuaGroup::SetTargetIcon },
{ "SetLeader", &LuaGroup::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetMembersGroup", &LuaGroup::SetMembersGroup, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetTargetIcon", &LuaGroup::SetTargetIcon, METHOD_REG_WORLD }, // World state method only in multistate

// Boolean
{ "IsLeader", &LuaGroup::IsLeader },
{ "AddMember", &LuaGroup::AddMember },
{ "RemoveMember", &LuaGroup::RemoveMember },
{ "Disband", &LuaGroup::Disband },
{ "AddMember", &LuaGroup::AddMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "RemoveMember", &LuaGroup::RemoveMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "Disband", &LuaGroup::Disband, METHOD_REG_WORLD }, // World state method only in multistate
{ "IsFull", &LuaGroup::IsFull },
{ "IsRaidGroup", &LuaGroup::IsRaidGroup },
{ "IsBGGroup", &LuaGroup::IsBGGroup },
Expand All @@ -405,7 +405,7 @@ namespace LuaGroup
#endif
// Other
{ "SendPacket", &LuaGroup::SendPacket },
{ "ConvertToRaid", &LuaGroup::ConvertToRaid },
{ "ConvertToRaid", &LuaGroup::ConvertToRaid, METHOD_REG_WORLD }, // World state method only in multistate

// Not implemented methods
{ "IsBFGroup", nullptr, METHOD_REG_NONE }, // not implemented
Expand Down
12 changes: 6 additions & 6 deletions Mangos/GuildMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,20 @@ namespace LuaGuild
{ "GetMemberCount", &LuaGuild::GetMemberCount },

// Setters
{ "SetMemberRank", &LuaGuild::SetMemberRank },
{ "SetLeader", &LuaGuild::SetLeader },
{ "SetMemberRank", &LuaGuild::SetMemberRank, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
#ifndef CLASSIC
{ "SetBankTabText", &LuaGuild::SetBankTabText },
{ "SetBankTabText", &LuaGuild::SetBankTabText, METHOD_REG_WORLD }, // World state method only in multistate
#else
{ "SetBankTabText", nullptr, METHOD_REG_NONE},
#endif

// Other
{ "SendPacket", &LuaGuild::SendPacket },
{ "SendPacketToRanked", &LuaGuild::SendPacketToRanked },
{ "Disband", &LuaGuild::Disband },
{ "AddMember", &LuaGuild::AddMember },
{ "DeleteMember", &LuaGuild::DeleteMember },
{ "Disband", &LuaGuild::Disband, METHOD_REG_WORLD }, // World state method only in multistate
{ "AddMember", &LuaGuild::AddMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "DeleteMember", &LuaGuild::DeleteMember, METHOD_REG_WORLD }, // World state method only in multistate

{ NULL, NULL, METHOD_REG_NONE }
};
Expand Down
4 changes: 2 additions & 2 deletions Mangos/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -3917,8 +3917,8 @@ namespace LuaPlayer
{ "Mute", &LuaPlayer::Mute },
{ "SummonPlayer", &LuaPlayer::SummonPlayer },
{ "SaveToDB", &LuaPlayer::SaveToDB },
{ "GroupInvite", &LuaPlayer::GroupInvite },
{ "GroupCreate", &LuaPlayer::GroupCreate },
{ "GroupInvite", &LuaPlayer::GroupInvite, METHOD_REG_WORLD }, // World state method only in multistate
{ "GroupCreate", &LuaPlayer::GroupCreate, METHOD_REG_WORLD }, // World state method only in multistate
{ "SendCinematicStart", &LuaPlayer::SendCinematicStart },
#if defined(CLASSIC)
{ "UpdateHonor", &LuaPlayer::UpdateHonor },
Expand Down
37 changes: 28 additions & 9 deletions TrinityCore/GroupMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ namespace LuaGroup
/**
* Adds a new member to the [Group]
*
* In multistate, this method is only available in the WORLD state
*
* @param [Player] player : [Player] to add to the group
* @return bool added : true if member was added
*/
Expand Down Expand Up @@ -281,6 +283,8 @@ namespace LuaGroup
/**
* Sets the leader of this [Group]
*
* In multistate, this method is only available in the WORLD state
*
* @param ObjectGuid guid : guid of the new leader
*/
int SetLeader(Eluna* E, Group* group)
Expand Down Expand Up @@ -311,6 +315,8 @@ namespace LuaGroup
/**
* Removes a [Player] from this [Group] and returns 'true' if successful
*
* In multistate, this method is only available in the WORLD state
*
* <pre>
* enum RemoveMethod
* {
Expand All @@ -337,6 +343,8 @@ namespace LuaGroup
/**
* Disbands this [Group]
*
* In multistate, this method is only available in the WORLD state
*
*/
int Disband(Eluna* /*E*/, Group* group)
{
Expand All @@ -347,6 +355,8 @@ namespace LuaGroup
/**
* Converts this [Group] to a raid [Group]
*
* In multistate, this method is only available in the WORLD state
*
*/
int ConvertToRaid(Eluna* /*E*/, Group* group)
{
Expand All @@ -357,6 +367,8 @@ namespace LuaGroup
/**
* Sets the member's subGroup
*
* In multistate, this method is only available in the WORLD state
*
* @param ObjectGuid guid : guid of the player to move
* @param uint8 groupID : the subGroup's ID
*/
Expand All @@ -381,6 +393,8 @@ namespace LuaGroup
/**
* Sets the target icon of an object for the [Group]
*
* In multistate, this method is only available in the WORLD state
*
* @param uint8 icon : the icon (Skull, Square, etc)
* @param ObjectGuid target : GUID of the icon target, 0 is to clear the icon
* @param ObjectGuid setter : GUID of the icon setter
Expand All @@ -400,6 +414,9 @@ namespace LuaGroup

/**
* Converts the [Group] to a LFG group
*
* In multistate, this method is only available in the WORLD state
*
*/
int ConvertToLFG(Eluna* /*E*/, Group* group)
{
Expand All @@ -411,6 +428,8 @@ namespace LuaGroup
/**
* Sets or removes a flag for a [Group] member
*
* In multistate, this method is only available in the WORLD state
*
* <pre>
* enum GroupMemberFlags
* {
Expand Down Expand Up @@ -449,18 +468,18 @@ namespace LuaGroup
#endif

// Setters
{ "SetLeader", &LuaGroup::SetLeader },
{ "SetMembersGroup", &LuaGroup::SetMembersGroup },
{ "SetTargetIcon", &LuaGroup::SetTargetIcon },
{ "SetLeader", &LuaGroup::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetMembersGroup", &LuaGroup::SetMembersGroup, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetTargetIcon", &LuaGroup::SetTargetIcon, METHOD_REG_WORLD }, // World state method only in multistate
#ifndef CATA
{ "SetMemberFlag", &LuaGroup::SetMemberFlag },
{ "SetMemberFlag", &LuaGroup::SetMemberFlag, METHOD_REG_WORLD }, // World state method only in multistate
#endif

// Boolean
{ "IsLeader", &LuaGroup::IsLeader },
{ "AddMember", &LuaGroup::AddMember },
{ "RemoveMember", &LuaGroup::RemoveMember },
{ "Disband", &LuaGroup::Disband },
{ "AddMember", &LuaGroup::AddMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "RemoveMember", &LuaGroup::RemoveMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "Disband", &LuaGroup::Disband, METHOD_REG_WORLD }, // World state method only in multistate
{ "IsFull", &LuaGroup::IsFull },
{ "IsLFGGroup", &LuaGroup::IsLFGGroup },
{ "IsRaidGroup", &LuaGroup::IsRaidGroup },
Expand All @@ -473,8 +492,8 @@ namespace LuaGroup

// Other
{ "SendPacket", &LuaGroup::SendPacket },
{ "ConvertToLFG", &LuaGroup::ConvertToLFG },
{ "ConvertToRaid", &LuaGroup::ConvertToRaid },
{ "ConvertToLFG", &LuaGroup::ConvertToLFG, METHOD_REG_WORLD }, // World state method only in multistate
{ "ConvertToRaid", &LuaGroup::ConvertToRaid, METHOD_REG_WORLD }, // World state method only in multistate

#ifdef CATA //Not implemented in TCPP
{ "GetMemberFlags", nullptr, METHOD_REG_NONE },
Expand Down
25 changes: 19 additions & 6 deletions TrinityCore/GuildMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ namespace LuaGuild
/**
* Sets the leader of this [Guild]
*
* In multistate, this method is only available in the WORLD state
*
* @param [Player] leader : the [Player] leader to change
*/
int SetLeader(Eluna* E, Guild* guild)
Expand All @@ -142,6 +144,8 @@ namespace LuaGuild
/**
* Sets the information of the bank tab specified
*
* In multistate, this method is only available in the WORLD state
*
* @param uint8 tabId : the ID of the tab specified
* @param string info : the information to be set to the bank tab
*/
Expand Down Expand Up @@ -186,6 +190,9 @@ namespace LuaGuild

/**
* Disbands the [Guild]
*
* In multistate, this method is only available in the WORLD state
*
*/
int Disband(Eluna* /*E*/, Guild* guild)
{
Expand All @@ -198,6 +205,8 @@ namespace LuaGuild
*
* If no rank is specified, defaults to none.
*
* In multistate, this method is only available in the WORLD state
*
* @param [Player] player : the [Player] to be added to the guild
* @param uint8 rankId : the rank ID
*/
Expand All @@ -215,6 +224,8 @@ namespace LuaGuild
/**
* Removes the specified [Player] from the [Guild].
*
* In multistate, this method is only available in the WORLD state
*
* @param [Player] player : the [Player] to be removed from the guild
* @param bool isDisbanding : default 'false', should only be set to 'true' if the guild is triggered to disband
*/
Expand All @@ -232,6 +243,8 @@ namespace LuaGuild
/**
* Promotes/demotes the [Player] to the specified rank.
*
* In multistate, this method is only available in the WORLD state
*
* @param [Player] player : the [Player] to be promoted/demoted
* @param uint8 rankId : the rank ID
*/
Expand Down Expand Up @@ -259,18 +272,18 @@ namespace LuaGuild
{ "GetMemberCount", &LuaGuild::GetMemberCount },

// Setters
{ "SetBankTabText", &LuaGuild::SetBankTabText },
{ "SetMemberRank", &LuaGuild::SetMemberRank },
{ "SetBankTabText", &LuaGuild::SetBankTabText, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetMemberRank", &LuaGuild::SetMemberRank, METHOD_REG_WORLD }, // World state method only in multistate
#ifndef CATA
{ "SetLeader", &LuaGuild::SetLeader },
{ "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
#endif

// Other
{ "SendPacket", &LuaGuild::SendPacket },
{ "SendPacketToRanked", &LuaGuild::SendPacketToRanked },
{ "Disband", &LuaGuild::Disband },
{ "AddMember", &LuaGuild::AddMember },
{ "DeleteMember", &LuaGuild::DeleteMember },
{ "Disband", &LuaGuild::Disband, METHOD_REG_WORLD }, // World state method only in multistate
{ "AddMember", &LuaGuild::AddMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "DeleteMember", &LuaGuild::DeleteMember, METHOD_REG_WORLD }, // World state method only in multistate

#ifdef CATA //Not implemented in TCPP
{ "SetLeader", nullptr, METHOD_REG_NONE },
Expand Down
8 changes: 6 additions & 2 deletions TrinityCore/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -3589,6 +3589,8 @@ namespace LuaPlayer
/**
* Makes the [Player] invite another player to a group.
*
* In multistate, this method is only available in the WORLD state
*
* @param [Player] invited : player to invite to group
* @return bool success : true if the player was invited to a group
*/
Expand Down Expand Up @@ -3645,6 +3647,8 @@ namespace LuaPlayer
/**
* Creates a new [Group] with the creator [Player] as leader.
*
* In multistate, this method is only available in the WORLD state
*
* @param [Player] invited : player to add to group
* @return [Group] createdGroup : the created group or nil
*/
Expand Down Expand Up @@ -4074,8 +4078,8 @@ namespace LuaPlayer
{ "Mute", &LuaPlayer::Mute },
{ "SummonPlayer", &LuaPlayer::SummonPlayer },
{ "SaveToDB", &LuaPlayer::SaveToDB },
{ "GroupInvite", &LuaPlayer::GroupInvite },
{ "GroupCreate", &LuaPlayer::GroupCreate },
{ "GroupInvite", &LuaPlayer::GroupInvite, METHOD_REG_WORLD }, // World state method only in multistate
{ "GroupCreate", &LuaPlayer::GroupCreate, METHOD_REG_WORLD }, // World state method only in multistate
{ "SendCinematicStart", &LuaPlayer::SendCinematicStart },
{ "SendMovieStart", &LuaPlayer::SendMovieStart },

Expand Down
Loading

0 comments on commit 010102d

Please sign in to comment.