Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Sep 9, 2024
1 parent ba94c75 commit 3732128
Show file tree
Hide file tree
Showing 13 changed files with 1,011 additions and 647 deletions.
2 changes: 1 addition & 1 deletion src/game/Chat/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void Channel::Join(Player* player, const char* password)

if (HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_BOOL_CHANNEL_RESTRICTED_LFG))
{
if (player->GetSession()->GetSecurity() == SEC_PLAYER && player->m_lookingForGroup.isEmpty())
if (player->GetSession()->GetSecurity() == SEC_PLAYER && !player->m_lfgInfo.queued)
{
MakeNotInLFG(data, m_name);
SendToOne(data, guid);
Expand Down
58 changes: 2 additions & 56 deletions src/game/Entities/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "Server/SQLStorages.h"
#include "Loot/LootMgr.h"
#include "Cinematics/CinematicMgr.h"
#include "LFG/LFGDefines.h"

#include <functional>
#include <vector>
Expand Down Expand Up @@ -307,61 +308,6 @@ struct EnchantDuration
typedef std::list<EnchantDuration> EnchantDurationList;
typedef std::list<Item*> ItemDurationList;

#define MAX_LOOKING_FOR_GROUP_SLOT 3

struct LookingForGroupInfo
{
struct Slot
{
bool empty() const { return (!type || !entry); }
void clear() { entry = 0; }
bool set(uint16 _entry, uint16 _type) { entry = _entry; type = _type; return !empty(); }
bool is(uint16 _entry, uint16 _type) const { return entry == _entry && type == _type; }
bool isAuto() const { return entry && (type == LFG_TYPE_DUNGEON || type == LFG_TYPE_HEROIC_DUNGEON); }

uint16 entry = 0;
uint16 type = LFG_TYPE_DUNGEON;
};

inline void clear()
{
more.clear();
for (auto& slot : group)
slot.clear();
}
inline bool isAutoFill() const { return more.isAuto(); }
inline bool isAutoJoin() const
{
for (auto& slot : group)
if (slot.isAuto())
return true;
return false;
}
inline bool isEmpty() const { return (!isLFM() && !isLFG()); }
inline bool isLFG() const
{
for (auto& slot : group)
if (!slot.empty())
return true;
return false;
}
inline bool isLFG(uint32 entry, uint32 type, bool autoOnly) const
{
for (auto& slot : group)
if (slot.is(uint16(entry), uint16(type)) && (!autoOnly || slot.isAuto()))
return true;
return false;
}
inline bool isLFG(LookingForGroupInfo const& info, bool autoOnly) const { return isLFG(uint16(info.more.entry), uint16(info.more.type), autoOnly); }
inline bool isLFM() const { return !more.empty(); }
inline bool isLFM(uint32 entry, uint32 type) const { return more.is(uint16(entry), uint16(type)); }

// bool queued = false;
Slot group[MAX_LOOKING_FOR_GROUP_SLOT];
Slot more;
std::string comment;
};

enum RaidGroupError
{
ERR_RAID_GROUP_NONE = 0,
Expand Down Expand Up @@ -2187,7 +2133,7 @@ class Player : public Unit
void RemoveAtLoginFlag(AtLoginFlags f, bool in_db_also = false);
static bool ValidateAppearance(uint8 race, uint8 class_, uint8 gender, uint8 hairID, uint8 hairColor, uint8 faceID, uint8 facialHair, uint8 skinColor, bool create = false);

LookingForGroupInfo m_lookingForGroup;
LfgPlayerInfo m_lfgInfo;

// Temporarily removed pet cache
uint32 GetTemporaryUnsummonedPetNumber() const { return m_temporaryUnsummonedPetNumber; }
Expand Down
52 changes: 52 additions & 0 deletions src/game/LFG/LFGDefines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef _LFG_DEFINES_H
#define _LFG_DEFINES_H

#include "Common.h"

#define MAX_LOOKING_FOR_GROUP_SLOT 3

enum LfgType : uint32
{
LFG_TYPE_NONE = 0,
LFG_TYPE_DUNGEON = 1,
LFG_TYPE_RAID = 2,
LFG_TYPE_QUEST = 3,
LFG_TYPE_ZONE = 4,
LFG_TYPE_HEROIC_DUNGEON = 5
};

enum class MeetingstoneFailedStatus : uint8
{
MEETINGSTONE_FAIL_NONE = 0, // custom, not to be sent
MEETINGSTONE_FAIL_PARTYLEADER = 1,
MEETINGSTONE_FAIL_FULL_GROUP = 2,
MEETINGSTONE_FAIL_RAID_GROUP = 3,
};

struct LfgPlayerInfo
{
std::string comment;
bool autojoin;
bool autofill;
bool queued; // cached async information
};

#endif
Loading

0 comments on commit 3732128

Please sign in to comment.