mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 09:33:47 +00:00
Playerbot fixes and functionnality to talk in channels
This commit is contained in:
@@ -41,6 +41,9 @@ DBCStorage <AreaGroupEntry> sAreaGroupStore(AreaGroupEntryfmt);
|
|||||||
DBCStorage <AreaPOIEntry> sAreaPOIStore(AreaPOIEntryfmt);
|
DBCStorage <AreaPOIEntry> sAreaPOIStore(AreaPOIEntryfmt);
|
||||||
|
|
||||||
static WMOAreaInfoByTripple sWMOAreaInfoByTripple;
|
static WMOAreaInfoByTripple sWMOAreaInfoByTripple;
|
||||||
|
static AreaFlagByAreaID sAreaFlagByAreaID;
|
||||||
|
// for instances without generated *.map files
|
||||||
|
static AreaFlagByMapID sAreaFlagByMapID;
|
||||||
|
|
||||||
DBCStorage <AchievementEntry> sAchievementStore(Achievementfmt);
|
DBCStorage <AchievementEntry> sAchievementStore(Achievementfmt);
|
||||||
DBCStorage <AchievementCategoryEntry> sAchievementCategoryStore(AchievementCategoryfmt);
|
DBCStorage <AchievementCategoryEntry> sAchievementCategoryStore(AchievementCategoryfmt);
|
||||||
@@ -396,6 +399,19 @@ void LoadDBCStores(const std::string& dataPath)
|
|||||||
|
|
||||||
#undef LOAD_DBC
|
#undef LOAD_DBC
|
||||||
|
|
||||||
|
for (uint32 i = 0; i < sAreaTableStore.GetNumRows(); ++i) // areaflag numbered from 0
|
||||||
|
{
|
||||||
|
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(i))
|
||||||
|
{
|
||||||
|
// fill AreaId->DBC records
|
||||||
|
sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID), area->exploreFlag));
|
||||||
|
|
||||||
|
// fill MapId->DBC records ( skip sub zones and continents )
|
||||||
|
if (area->zone == 0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530)
|
||||||
|
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid, area->exploreFlag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore)
|
for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore)
|
||||||
sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit;
|
sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit;
|
||||||
|
|
||||||
@@ -960,3 +976,40 @@ const std::vector<SkillLineAbilityEntry const*>& GetSkillLineAbilitiesBySkillLin
|
|||||||
}
|
}
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 GetAreaFlagByMapId(uint32 mapid)
|
||||||
|
{
|
||||||
|
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
|
||||||
|
if (i == sAreaFlagByMapID.end())
|
||||||
|
return 0;
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 GetAreaFlagByAreaID(uint32 area_id)
|
||||||
|
{
|
||||||
|
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
|
||||||
|
if (i == sAreaFlagByAreaID.end())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
|
||||||
|
{
|
||||||
|
int32 areaflag = GetAreaFlagByAreaID(area_id);
|
||||||
|
if (areaflag < 0)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return sAreaTableStore.LookupEntry(areaflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id)
|
||||||
|
{
|
||||||
|
if (area_flag)
|
||||||
|
return sAreaTableStore.LookupEntry(area_flag);
|
||||||
|
|
||||||
|
if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
|
||||||
|
return GetAreaEntryByAreaID(mapEntry->linked_zone);
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
@@ -35,6 +35,13 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId);
|
|||||||
|
|
||||||
WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid);
|
WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid);
|
||||||
|
|
||||||
|
|
||||||
|
// -1 if not found
|
||||||
|
int32 GetAreaFlagByAreaID(uint32 area_id);
|
||||||
|
uint32 GetAreaFlagByMapId(uint32 mapid);
|
||||||
|
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id);
|
||||||
|
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id);
|
||||||
|
|
||||||
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId);
|
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId);
|
||||||
|
|
||||||
enum ContentLevels : uint8
|
enum ContentLevels : uint8
|
||||||
|
|||||||
@@ -4955,6 +4955,15 @@ void Player::CleanupChannels()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Playerbot helper if bot talks in a different locale
|
||||||
|
bool Player::IsInChannel(const Channel* c)
|
||||||
|
{
|
||||||
|
return std::any_of(m_channels.begin(), m_channels.end(), [c](const Channel* chan)
|
||||||
|
{
|
||||||
|
return c->GetChannelId() == chan->GetChannelId();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Player::ClearChannelWatch()
|
void Player::ClearChannelWatch()
|
||||||
{
|
{
|
||||||
for (JoinedChannelsList::iterator itr = m_channels.begin(); itr != m_channels.end(); ++itr)
|
for (JoinedChannelsList::iterator itr = m_channels.begin(); itr != m_channels.end(); ++itr)
|
||||||
|
|||||||
@@ -2043,6 +2043,7 @@ public:
|
|||||||
|
|
||||||
void JoinedChannel(Channel* c);
|
void JoinedChannel(Channel* c);
|
||||||
void LeftChannel(Channel* c);
|
void LeftChannel(Channel* c);
|
||||||
|
bool IsInChannel(const Channel* c);
|
||||||
void CleanupChannels();
|
void CleanupChannels();
|
||||||
void ClearChannelWatch();
|
void ClearChannelWatch();
|
||||||
void UpdateLocalChannels(uint32 newZone);
|
void UpdateLocalChannels(uint32 newZone);
|
||||||
|
|||||||
@@ -516,8 +516,8 @@ public:
|
|||||||
time_t m_muteTime;
|
time_t m_muteTime;
|
||||||
|
|
||||||
// Locales
|
// Locales
|
||||||
LocaleConstant GetSessionDbcLocale() const { return _isBot? LOCALE_enUS : m_sessionDbcLocale; }
|
LocaleConstant GetSessionDbcLocale() const { return /*_isBot? LOCALE_enUS : */m_sessionDbcLocale; }
|
||||||
LocaleConstant GetSessionDbLocaleIndex() const { return _isBot? LOCALE_enUS : m_sessionDbLocaleIndex; }
|
LocaleConstant GetSessionDbLocaleIndex() const { return /*_isBot? LOCALE_enUS : */m_sessionDbLocaleIndex; }
|
||||||
char const* GetAcoreString(uint32 entry) const;
|
char const* GetAcoreString(uint32 entry) const;
|
||||||
|
|
||||||
uint32 GetLatency() const { return m_latency; }
|
uint32 GetLatency() const { return m_latency; }
|
||||||
|
|||||||
Reference in New Issue
Block a user