feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
parent
91081f4ad8
commit
f4c226423d
568 changed files with 10655 additions and 11019 deletions
|
|
@ -0,0 +1,29 @@
|
|||
INSERT INTO `version_db_characters` (`sql_rev`) VALUES ('1617907126348389400');
|
||||
|
||||
-- Keep only the highest guid PvE or PvP (not bones) corpse per player guid
|
||||
DELETE c FROM `corpse` c LEFT JOIN
|
||||
(
|
||||
SELECT MAX(`corpseGuid`) AS id
|
||||
FROM `corpse`
|
||||
WHERE `corpseType` IN (1,2)
|
||||
GROUP BY `guid`
|
||||
) corpsetemp
|
||||
ON c.`corpseGuid` = corpsetemp.`id`
|
||||
WHERE corpsetemp.`id` IS NULL;
|
||||
|
||||
-- Remove corpseGUID and set key to player guid
|
||||
ALTER TABLE `corpse` DROP `corpseGuid`, DROP INDEX `idx_player`, ADD PRIMARY KEY (`guid`);
|
||||
|
||||
UPDATE `auctionhouse` SET `time` = 0, `auctioneerguid` = 7;
|
||||
ALTER TABLE `auctionhouse` CHANGE `auctioneerguid` `houseid` TINYINT(3) UNSIGNED NOT NULL DEFAULT '7' AFTER `id`;
|
||||
|
||||
ALTER TABLE `characters` CHANGE `transguid` `transguid` MEDIUMINT DEFAULT 0 NOT NULL;
|
||||
|
||||
ALTER TABLE `groups` CHANGE `icon1` `icon1` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `groups` CHANGE `icon2` `icon2` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `groups` CHANGE `icon3` `icon3` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `groups` CHANGE `icon4` `icon4` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `groups` CHANGE `icon5` `icon5` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `groups` CHANGE `icon6` `icon6` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `groups` CHANGE `icon7` `icon7` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `groups` CHANGE `icon8` `icon8` BIGINT UNSIGNED NOT NULL;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618042584624619500');
|
||||
|
||||
UPDATE `acore_string` SET `content_default` = 'Object GUID is: %s' WHERE `entry`=201;
|
||||
|
|
@ -142,6 +142,19 @@ namespace acore
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class K, class V, template<class, class, class...> class M, class... Rest>
|
||||
void MultimapErasePair(M<K, V, Rest...>& multimap, K const& key, V const& value)
|
||||
{
|
||||
auto range = multimap.equal_range(key);
|
||||
for (auto itr = range.first; itr != range.second;)
|
||||
{
|
||||
if (itr->second == value)
|
||||
itr = multimap.erase(itr);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
//! namespace Containers
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
*/
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "Define.h"
|
||||
#include "Dynamic/TypeList.h"
|
||||
|
|
@ -23,37 +24,41 @@
|
|||
* By itself its meaningless but collaborate along with TypeContainers,
|
||||
* it become the most powerfully container in the whole system.
|
||||
*/
|
||||
template<class OBJECT> struct ContainerMapList
|
||||
template<class OBJECT>
|
||||
struct ContainerMapList
|
||||
{
|
||||
//std::map<OBJECT_HANDLE, OBJECT *> _element;
|
||||
GridRefManager<OBJECT> _element;
|
||||
};
|
||||
|
||||
template<> struct ContainerMapList<TypeNull> /* nothing is in type null */
|
||||
template<>
|
||||
struct ContainerMapList<TypeNull> /* nothing is in type null */
|
||||
{
|
||||
};
|
||||
template<class H, class T> struct ContainerMapList<TypeList<H, T>>
|
||||
|
||||
template<class H, class T>
|
||||
struct ContainerMapList<TypeList<H, T>>
|
||||
{
|
||||
ContainerMapList<H> _elements;
|
||||
ContainerMapList<T> _TailElements;
|
||||
};
|
||||
|
||||
/*
|
||||
* @class ContaierArrayList is a multi-type container for
|
||||
* array of elements.
|
||||
*/
|
||||
template<class OBJECT> struct ContainerArrayList
|
||||
template<class OBJECT, class KEY_TYPE>
|
||||
struct ContainerUnorderedMap
|
||||
{
|
||||
std::vector<OBJECT> _element;
|
||||
std::unordered_map<KEY_TYPE, OBJECT*> _element;
|
||||
};
|
||||
|
||||
// termination condition
|
||||
template<> struct ContainerArrayList<TypeNull> { };
|
||||
// recursion
|
||||
template<class H, class T> struct ContainerArrayList<TypeList<H, T>>
|
||||
template<class KEY_TYPE>
|
||||
struct ContainerUnorderedMap<TypeNull, KEY_TYPE>
|
||||
{
|
||||
ContainerArrayList<H> _elements;
|
||||
ContainerArrayList<T> _TailElements;
|
||||
};
|
||||
|
||||
template<class H, class T, class KEY_TYPE>
|
||||
struct ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>
|
||||
{
|
||||
ContainerUnorderedMap<H, KEY_TYPE> _elements;
|
||||
ContainerUnorderedMap<T, KEY_TYPE> _TailElements;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -89,14 +94,16 @@ public:
|
|||
template<class SPECIFIC_TYPE> [[nodiscard]] size_t Count() const { return acore::Count(i_elements, (SPECIFIC_TYPE*)nullptr); }
|
||||
|
||||
/// inserts a specific object into the container
|
||||
template<class SPECIFIC_TYPE> bool insert(SPECIFIC_TYPE* obj)
|
||||
template<class SPECIFIC_TYPE>
|
||||
bool insert(SPECIFIC_TYPE* obj)
|
||||
{
|
||||
SPECIFIC_TYPE* t = acore::Insert(i_elements, obj);
|
||||
return (t != nullptr);
|
||||
}
|
||||
|
||||
/// Removes the object from the container, and returns the removed object
|
||||
//template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj)
|
||||
//template<class SPECIFIC_TYPE>
|
||||
// bool remove(SPECIFIC_TYPE* obj)
|
||||
//{
|
||||
// SPECIFIC_TYPE* t = acore::Remove(i_elements, obj);
|
||||
// return (t != nullptr);
|
||||
|
|
@ -108,4 +115,34 @@ public:
|
|||
private:
|
||||
ContainerMapList<OBJECT_TYPES> i_elements;
|
||||
};
|
||||
|
||||
template<class OBJECT_TYPES, class KEY_TYPE>
|
||||
class TypeUnorderedMapContainer
|
||||
{
|
||||
public:
|
||||
template<class SPECIFIC_TYPE>
|
||||
bool Insert(KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
|
||||
{
|
||||
return acore::Insert(_elements, handle, obj);
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE>
|
||||
bool Remove(KEY_TYPE const& handle)
|
||||
{
|
||||
return acore::Remove(_elements, handle, (SPECIFIC_TYPE*)nullptr);
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE>
|
||||
SPECIFIC_TYPE* Find(KEY_TYPE const& handle)
|
||||
{
|
||||
return acore::Find(_elements, handle, (SPECIFIC_TYPE*)nullptr);
|
||||
}
|
||||
|
||||
ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE>& GetElements() { return _elements; }
|
||||
ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE> const& GetElements() const { return _elements; }
|
||||
|
||||
private:
|
||||
ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE> _elements;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -16,57 +16,161 @@
|
|||
#include "Define.h"
|
||||
#include "Dynamic/TypeList.h"
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace acore
|
||||
{
|
||||
// Helpers
|
||||
// Insert helpers
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE>
|
||||
bool Insert(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
|
||||
{
|
||||
auto i = elements._element.find(handle);
|
||||
if (i == elements._element.end())
|
||||
{
|
||||
elements._element[handle] = obj;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(i->second == obj, "Object with certain key already in but objects are different!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE>
|
||||
bool Insert(ContainerUnorderedMap<TypeNull, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
|
||||
bool Insert(ContainerUnorderedMap<T, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
|
||||
bool Insert(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
|
||||
{
|
||||
bool ret = Insert(elements._elements, handle, obj);
|
||||
return ret ? ret : Insert(elements._TailElements, handle, obj);
|
||||
}
|
||||
|
||||
// Find helpers
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE>
|
||||
SPECIFIC_TYPE* Find(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE> const& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
auto i = elements._element.find(handle);
|
||||
if (i == elements._element.end())
|
||||
return nullptr;
|
||||
else
|
||||
return i->second;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE>
|
||||
SPECIFIC_TYPE* Find(ContainerUnorderedMap<TypeNull, KEY_TYPE> const& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
|
||||
SPECIFIC_TYPE* Find(ContainerUnorderedMap<T, KEY_TYPE> const& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
|
||||
SPECIFIC_TYPE* Find(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE> const& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
SPECIFIC_TYPE* ret = Find(elements._elements, handle, (SPECIFIC_TYPE*)nullptr);
|
||||
return ret ? ret : Find(elements._TailElements, handle, (SPECIFIC_TYPE*)nullptr);
|
||||
}
|
||||
|
||||
// Erase helpers
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE>
|
||||
bool Remove(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
elements._element.erase(handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE>
|
||||
bool Remove(ContainerUnorderedMap<TypeNull, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
|
||||
bool Remove(ContainerUnorderedMap<T, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
|
||||
bool Remove(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
bool ret = Remove(elements._elements, handle, (SPECIFIC_TYPE*)nullptr);
|
||||
return ret ? ret : Remove(elements._TailElements, handle, (SPECIFIC_TYPE*)nullptr);
|
||||
}
|
||||
|
||||
/* ContainerMapList Helpers */
|
||||
// count functions
|
||||
template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* /*fake*/)
|
||||
template<class SPECIFIC_TYPE>
|
||||
size_t Count(const ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* /*fake*/)
|
||||
{
|
||||
return elements._element.getSize();
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*fake*/)
|
||||
template<class SPECIFIC_TYPE>
|
||||
size_t Count(const ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*fake*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*fake*/)
|
||||
template<class SPECIFIC_TYPE, class T>
|
||||
size_t Count(const ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*fake*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T>>& elements, SPECIFIC_TYPE* fake)
|
||||
template<class SPECIFIC_TYPE, class T>
|
||||
size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T>>& elements, SPECIFIC_TYPE* fake)
|
||||
{
|
||||
return Count(elements._elements, fake);
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE, class H, class T> size_t Count(const ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* fake)
|
||||
template<class SPECIFIC_TYPE, class H, class T>
|
||||
size_t Count(const ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* fake)
|
||||
{
|
||||
return Count(elements._TailElements, fake);
|
||||
}
|
||||
|
||||
// non-const insert functions
|
||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* obj)
|
||||
template<class SPECIFIC_TYPE>
|
||||
SPECIFIC_TYPE* Insert(ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* obj)
|
||||
{
|
||||
//elements._element[hdl] = obj;
|
||||
obj->AddToGrid(elements._element);
|
||||
return obj;
|
||||
}
|
||||
|
||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
|
||||
template<class SPECIFIC_TYPE>
|
||||
SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// this is a missed
|
||||
template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Insert(ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
|
||||
template<class SPECIFIC_TYPE, class T>
|
||||
SPECIFIC_TYPE* Insert(ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
|
||||
{
|
||||
return nullptr; // a missed
|
||||
}
|
||||
|
||||
// Recursion
|
||||
template<class SPECIFIC_TYPE, class H, class T> SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* obj)
|
||||
template<class SPECIFIC_TYPE, class H, class T>
|
||||
SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* obj)
|
||||
{
|
||||
SPECIFIC_TYPE* t = Insert(elements._elements, obj);
|
||||
return (t != nullptr ? t : Insert(elements._TailElements, obj));
|
||||
|
|
|
|||
|
|
@ -25,21 +25,6 @@ template<class VISITOR, class TYPE_CONTAINER> void VisitorHelper(VISITOR& v, TYP
|
|||
v.Visit(c);
|
||||
}
|
||||
|
||||
// terminate condition for container list
|
||||
template<class VISITOR> void VisitorHelper(VISITOR& /*v*/, ContainerList<TypeNull>& /*c*/) { }
|
||||
|
||||
template<class VISITOR, class T> void VisitorHelper(VISITOR& v, ContainerList<T>& c)
|
||||
{
|
||||
v.Visit(c._element);
|
||||
}
|
||||
|
||||
// recursion for container list
|
||||
template<class VISITOR, class H, class T> void VisitorHelper(VISITOR& v, ContainerList<TypeList<H, T>>& c)
|
||||
{
|
||||
VisitorHelper(v, c._elements);
|
||||
VisitorHelper(v, c._TailElements);
|
||||
}
|
||||
|
||||
// terminate condition container map list
|
||||
template<class VISITOR> void VisitorHelper(VISITOR& /*v*/, ContainerMapList<TypeNull>& /*c*/) { }
|
||||
|
||||
|
|
@ -55,23 +40,31 @@ template<class VISITOR, class H, class T> void VisitorHelper(VISITOR& v, Contain
|
|||
VisitorHelper(v, c._TailElements);
|
||||
}
|
||||
|
||||
// array list
|
||||
template<class VISITOR, class T> void VisitorHelper(VISITOR& v, ContainerArrayList<T>& c)
|
||||
// for TypeMapContainer
|
||||
template<class VISITOR, class OBJECT_TYPES> void VisitorHelper(VISITOR& v, TypeMapContainer<OBJECT_TYPES>& c)
|
||||
{
|
||||
VisitorHelper(v, c.GetElements());
|
||||
}
|
||||
|
||||
// TypeUnorderedMapContainer
|
||||
template<class VISITOR, class KEY_TYPE>
|
||||
void VisitorHelper(VISITOR& /*v*/, ContainerUnorderedMap<TypeNull, KEY_TYPE>& /*c*/) { }
|
||||
|
||||
template<class VISITOR, class KEY_TYPE, class T>
|
||||
void VisitorHelper(VISITOR& v, ContainerUnorderedMap<T, KEY_TYPE>& c)
|
||||
{
|
||||
v.Visit(c._element);
|
||||
}
|
||||
|
||||
template<class VISITOR> void VisitorHelper(VISITOR& /*v*/, ContainerArrayList<TypeNull>& /*c*/) { }
|
||||
|
||||
// recursion
|
||||
template<class VISITOR, class H, class T> void VisitorHelper(VISITOR& v, ContainerArrayList<TypeList<H, T>>& c)
|
||||
template<class VISITOR, class KEY_TYPE, class H, class T>
|
||||
void VisitorHelper(VISITOR& v, ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& c)
|
||||
{
|
||||
VisitorHelper(v, c._elements);
|
||||
VisitorHelper(v, c._TailElements);
|
||||
}
|
||||
|
||||
// for TypeMapContainer
|
||||
template<class VISITOR, class OBJECT_TYPES> void VisitorHelper(VISITOR& v, TypeMapContainer<OBJECT_TYPES>& c)
|
||||
template<class VISITOR, class OBJECT_TYPES, class KEY_TYPE>
|
||||
void VisitorHelper(VISITOR& v, TypeUnorderedMapContainer<OBJECT_TYPES, KEY_TYPE>& c)
|
||||
{
|
||||
VisitorHelper(v, c.GetElements());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ struct TypeList
|
|||
};
|
||||
|
||||
// enough for now.. can be expand at any point in time as needed
|
||||
#define TYPELIST_1(T1) TypeList<T1, TypeNull>
|
||||
#define TYPELIST_2(T1, T2) TypeList<T1, TYPELIST_1(T2) >
|
||||
#define TYPELIST_3(T1, T2, T3) TypeList<T1, TYPELIST_2(T2, T3) >
|
||||
#define TYPELIST_4(T1, T2, T3, T4) TypeList<T1, TYPELIST_3(T2, T3, T4) >
|
||||
#define TYPELIST_5(T1, T2, T3, T4, T5) TypeList<T1, TYPELIST_4(T2, T3, T4, T5) >
|
||||
#define TYPELIST_1(T1) TypeList<T1, TypeNull>
|
||||
#define TYPELIST_2(T1, T2) TypeList<T1, TYPELIST_1(T2) >
|
||||
#define TYPELIST_3(T1, T2, T3) TypeList<T1, TYPELIST_2(T2, T3) >
|
||||
#define TYPELIST_4(T1, T2, T3, T4) TypeList<T1, TYPELIST_3(T2, T3, T4) >
|
||||
#define TYPELIST_5(T1, T2, T3, T4, T5) TypeList<T1, TYPELIST_4(T2, T3, T4, T5) >
|
||||
#define TYPELIST_6(T1, T2, T3, T4, T5, T6) TypeList<T1, TYPELIST_5(T2, T3, T4, T5, T6) >
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
|||
PrepareStatement(CHAR_SEL_CHARACTER_ACTIONS_SPEC, "SELECT button, action, type FROM character_action WHERE guid = ? AND spec = ? ORDER BY button", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_MAILITEMS, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, item_guid, itemEntry, owner_guid FROM mail_items mi JOIN item_instance ii ON mi.item_guid = ii.guid WHERE mail_id = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_AUCTION_ITEMS, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, itemguid, itemEntry FROM auctionhouse ah JOIN item_instance ii ON ah.itemguid = ii.guid", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_INS_AUCTION, "INSERT INTO auctionhouse (id, auctioneerguid, itemguid, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_AUCTIONS, "SELECT id, houseid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_INS_AUCTION, "INSERT INTO auctionhouse (id, houseid, itemguid, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_AUCTION, "DELETE FROM auctionhouse WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_AUCTION_BID, "UPDATE auctionhouse SET buyguid = ?, lastbid = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_MAIL, "INSERT INTO mail(id, messageType, stationery, mailTemplateId, sender, receiver, subject, body, has_items, expire_time, deliver_time, money, cod, checked) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
|
|
@ -280,11 +280,11 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
|||
PrepareStatement(CHAR_DEL_PLAYER_HOMEBIND, "DELETE FROM character_homebind WHERE guid = ?", CONNECTION_ASYNC);
|
||||
|
||||
// Corpse
|
||||
PrepareStatement(CHAR_SEL_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_INS_CORPSE, "INSERT INTO corpse (corpseGuid, guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE corpseGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_PLAYER_CORPSES, "DELETE FROM corpse WHERE guid = ? AND corpseType <> 0", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, guid FROM corpse WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_INS_CORPSE, "INSERT INTO corpse (guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CORPSES_FROM_MAP, "DELETE FROM corpse WHERE mapId = ? AND instanceId = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CORPSE_LOCATION, "SELECT mapId, posX, posY, posZ, orientation FROM corpse WHERE guid = ?", CONNECTION_ASYNC);
|
||||
|
||||
// Creature respawn
|
||||
PrepareStatement(CHAR_SEL_CREATURE_RESPAWNS, "SELECT guid, respawnTime FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH);
|
||||
|
|
|
|||
|
|
@ -245,8 +245,8 @@ enum CharacterDatabaseStatements
|
|||
CHAR_SEL_CORPSES,
|
||||
CHAR_INS_CORPSE,
|
||||
CHAR_DEL_CORPSE,
|
||||
CHAR_DEL_PLAYER_CORPSES,
|
||||
CHAR_DEL_OLD_CORPSES,
|
||||
CHAR_DEL_CORPSES_FROM_MAP,
|
||||
CHAR_SEL_CORPSE_LOCATION,
|
||||
|
||||
CHAR_SEL_CREATURE_RESPAWNS,
|
||||
CHAR_REP_CREATURE_RESPAWN,
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ public:
|
|||
|
||||
// Pass parameters between AI
|
||||
virtual void DoAction(int32 /*param = 0 */) {}
|
||||
virtual void SetGUID(uint64 /*guid*/, int32 /*id = 0 */) {}
|
||||
virtual uint64 GetGUID(int32 /*id = 0 */) const { return 0; }
|
||||
virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id = 0 */) {}
|
||||
virtual ObjectGuid GetGUID(int32 /*id = 0 */) const { return ObjectGuid::Empty; }
|
||||
|
||||
static int Permissible(GameObject const* go);
|
||||
|
||||
|
|
@ -43,8 +43,6 @@ public:
|
|||
virtual uint32 GetDialogStatus(Player* /*player*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
|
||||
virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {}
|
||||
virtual uint32 GetData(uint32 /*id*/) const { return 0; }
|
||||
virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {}
|
||||
virtual uint64 GetData64(uint32 /*id*/) const { return 0; }
|
||||
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
|
||||
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
|
||||
virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {}
|
||||
|
|
|
|||
|
|
@ -76,5 +76,5 @@ void CritterAI::UpdateAI(uint32 diff)
|
|||
void TriggerAI::IsSummonedBy(Unit* summoner)
|
||||
{
|
||||
if (me->m_spells[0])
|
||||
me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner ? summoner->GetGUID() : 0);
|
||||
me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void PetAI::_stopAttack()
|
|||
if (!me->IsAlive())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow());
|
||||
LOG_DEBUG("server", "Creature stoped attacking cuz his dead [%s]", me->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
|
|
@ -157,7 +157,7 @@ void PetAI::UpdateAI(uint32 diff)
|
|||
if (_needToStop())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Pet AI stopped attacking [guid=%u]", me->GetGUIDLow());
|
||||
LOG_DEBUG("server", "Pet AI stopped attacking [%s]", me->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
_stopAttack();
|
||||
return;
|
||||
|
|
@ -250,7 +250,7 @@ void PetAI::UpdateAI(uint32 diff)
|
|||
continue;
|
||||
}
|
||||
|
||||
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
|
||||
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE);
|
||||
spell->LoadScripts(); // xinef: load for CanAutoCast (calling CheckPetCast)
|
||||
bool spellUsed = false;
|
||||
|
||||
|
|
@ -272,9 +272,9 @@ void PetAI::UpdateAI(uint32 diff)
|
|||
// No enemy, check friendly
|
||||
if (!spellUsed)
|
||||
{
|
||||
for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
|
||||
for (ObjectGuid const guid : m_AllySet)
|
||||
{
|
||||
Unit* ally = ObjectAccessor::GetUnit(*me, *tar);
|
||||
Unit* ally = ObjectAccessor::GetUnit(*me, guid);
|
||||
|
||||
//only buff targets that are in combat, unless the spell can only be cast while out of combat
|
||||
if (!ally)
|
||||
|
|
@ -295,7 +295,7 @@ void PetAI::UpdateAI(uint32 diff)
|
|||
}
|
||||
else if (me->GetVictim() && CanAttack(me->GetVictim(), spellInfo) && spellInfo->CanBeUsedInCombat())
|
||||
{
|
||||
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
|
||||
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE);
|
||||
if (spell->CanAutoCast(me->GetVictim()))
|
||||
targetSpellStore.push_back(std::make_pair(me->GetVictim(), spell));
|
||||
else
|
||||
|
|
@ -389,7 +389,7 @@ void PetAI::KilledUnit(Unit* victim)
|
|||
return;
|
||||
|
||||
// Xinef: if pet is channeling a spell and owner killed something different, dont interrupt it
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) != victim->GetGUID())
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) && me->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT) && me->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT) != victim->GetGUID())
|
||||
return;
|
||||
|
||||
// Clear target just in case. May help problem where health / focus / mana
|
||||
|
|
@ -537,7 +537,7 @@ void PetAI::HandleReturnMovement()
|
|||
ClearCharmInfoFlags();
|
||||
me->GetCharmInfo()->SetIsReturning(true);
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MovePoint(me->GetUInt32Value(OBJECT_FIELD_GUID), x, y, z);
|
||||
me->GetMotionMaster()->MovePoint(me->GetGUID().GetCounter(), x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -557,7 +557,7 @@ void PetAI::HandleReturnMovement()
|
|||
}
|
||||
|
||||
me->GetCharmInfo()->SetForcedSpell(0);
|
||||
me->GetCharmInfo()->SetForcedTargetGUID(0);
|
||||
me->GetCharmInfo()->SetForcedTargetGUID();
|
||||
|
||||
// xinef: remember that npcs summoned by npcs can also be pets
|
||||
me->DeleteThreatList();
|
||||
|
|
@ -570,7 +570,7 @@ void PetAI::SpellHit(Unit* caster, const SpellInfo* spellInfo)
|
|||
if (spellInfo->HasAura(SPELL_AURA_MOD_TAUNT) && !me->HasReactState(REACT_PASSIVE))
|
||||
{
|
||||
me->GetCharmInfo()->SetForcedSpell(0);
|
||||
me->GetCharmInfo()->SetForcedTargetGUID(0);
|
||||
me->GetCharmInfo()->SetForcedTargetGUID();
|
||||
AttackStart(caster);
|
||||
}
|
||||
}
|
||||
|
|
@ -627,7 +627,7 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
|
|||
{
|
||||
// Pet is returning to where stay was clicked. data should be
|
||||
// pet's GUIDLow since we set that as the waypoint ID
|
||||
if (data == me->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
|
||||
if (data == me->GetGUID().GetCounter() && me->GetCharmInfo()->IsReturning())
|
||||
{
|
||||
ClearCharmInfoFlags();
|
||||
me->GetCharmInfo()->SetIsAtStay(true);
|
||||
|
|
@ -640,7 +640,7 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
|
|||
{
|
||||
// If data is owner's GUIDLow then we've reached follow point,
|
||||
// otherwise we're probably chasing a creature
|
||||
if (me->GetCharmerOrOwner() && me->GetCharmInfo() && data == me->GetCharmerOrOwner()->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
|
||||
if (me->GetCharmerOrOwner() && me->GetCharmInfo() && data == me->GetCharmerOrOwner()->GetGUID().GetCounter() && me->GetCharmInfo()->IsReturning())
|
||||
{
|
||||
ClearCharmInfoFlags();
|
||||
me->GetCharmInfo()->SetIsFollowing(true);
|
||||
|
|
@ -681,7 +681,7 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo)
|
|||
// pussywizard: ZOMG! TEMP!
|
||||
if (!me->GetCharmInfo())
|
||||
{
|
||||
LOG_INFO("misc", "PetAI::CanAttack (A1) - %u, %u", me->GetEntry(), GUID_LOPART(me->GetOwnerGUID()));
|
||||
LOG_INFO("misc", "PetAI::CanAttack (A1) - %u, %s", me->GetEntry(), me->GetOwnerGUID().ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ private:
|
|||
void UpdateAllies();
|
||||
|
||||
TimeTracker i_tracker;
|
||||
std::set<uint64> m_AllySet;
|
||||
GuidSet m_AllySet;
|
||||
uint32 m_updateAlliesTimer;
|
||||
float combatRange;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ int TotemAI::Permissible(Creature const* creature)
|
|||
return PERMIT_BASE_NO;
|
||||
}
|
||||
|
||||
TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid(0)
|
||||
TotemAI::TotemAI(Creature* c) : CreatureAI(c)
|
||||
{
|
||||
ASSERT(c->IsTotem());
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
|
|||
me->CastSpell(victim, me->ToTotem()->GetSpell(), false);
|
||||
}
|
||||
else
|
||||
i_victimGuid = 0;
|
||||
i_victimGuid.Clear();
|
||||
}
|
||||
|
||||
void TotemAI::AttackStart(Unit* /*victim*/)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
static int Permissible(Creature const* creature);
|
||||
|
||||
private:
|
||||
uint64 i_victimGuid;
|
||||
ObjectGuid i_victimGuid;
|
||||
};
|
||||
|
||||
class KillMagnetEvent : public BasicEvent
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ public:
|
|||
virtual void DoAction(int32 /*param*/) {}
|
||||
virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; }
|
||||
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
|
||||
virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) {}
|
||||
virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; }
|
||||
virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id*/ = 0) {}
|
||||
virtual ObjectGuid GetGUID(int32 /*id*/ = 0) const { return ObjectGuid::Empty; }
|
||||
|
||||
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
|
||||
// Select the targets satifying the predicate.
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace FactorySelector
|
|||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
// select NullCreatureAI if not another cases
|
||||
ainame = (ai_factory == nullptr) ? "NullCreatureAI" : ai_factory->key();
|
||||
LOG_DEBUG("scripts.ai", "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str());
|
||||
LOG_DEBUG("scripts.ai", "Creature %s used AI is %s.", creature->GetGUID().ToString().c_str(), ainame.c_str());
|
||||
#endif
|
||||
return (ai_factory == nullptr ? new NullCreatureAI(creature) : ai_factory->Create(creature));
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ namespace FactorySelector
|
|||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
std::string ainame = (ai_factory == nullptr || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
|
||||
LOG_DEBUG("scripts.ai", "GameObject %u used AI is %s.", go->GetGUIDLow(), ainame.c_str());
|
||||
LOG_DEBUG("scripts.ai", "GameObject %s used AI is %s.", go->GetGUID().ToString().c_str(), ainame.c_str());
|
||||
#endif
|
||||
|
||||
return (ai_factory == nullptr ? new NullGameObjectAI(go) : ai_factory->Create(go));
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId)
|
|||
|
||||
if (!sSoundEntriesStore.LookupEntry(soundId))
|
||||
{
|
||||
LOG_ERROR("server", "TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
|
||||
LOG_ERROR("server", "TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: %s)", soundId, source->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -359,7 +359,8 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o
|
|||
if (Player* player = unit->ToPlayer())
|
||||
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
|
||||
else
|
||||
LOG_ERROR("server", "TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
|
||||
LOG_ERROR("server", "TSCR: Creature %s Tried to teleport non-player unit %s to x: %f y:%f z: %f o: %f. Aborted.",
|
||||
me->GetGUID().ToString().c_str(), unit->GetGUID().ToString().c_str(), x, y, z, o);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class InstanceScript;
|
|||
class SummonList
|
||||
{
|
||||
public:
|
||||
typedef std::list<uint64> StorageType;
|
||||
typedef GuidList StorageType;
|
||||
typedef StorageType::iterator iterator;
|
||||
typedef StorageType::const_iterator const_iterator;
|
||||
typedef StorageType::size_type size_type;
|
||||
|
|
@ -107,7 +107,7 @@ public:
|
|||
|
||||
// We need to use a copy of SummonList here, otherwise original SummonList would be modified
|
||||
StorageType listCopy = storage_;
|
||||
acore::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max);
|
||||
acore::Containers::RandomResizeList<ObjectGuid, Predicate>(listCopy, predicate, max);
|
||||
for (StorageType::iterator i = listCopy.begin(); i != listCopy.end(); ++i)
|
||||
{
|
||||
Creature* summon = ObjectAccessor::GetCreature(*me, *i);
|
||||
|
|
@ -137,7 +137,7 @@ class EntryCheckPredicate
|
|||
{
|
||||
public:
|
||||
EntryCheckPredicate(uint32 entry) : _entry(entry) {}
|
||||
bool operator()(uint64 guid) { return GUID_ENPART(guid) == _entry; }
|
||||
bool operator()(ObjectGuid guid) { return guid.GetEntry() == _entry; }
|
||||
|
||||
private:
|
||||
uint32 _entry;
|
||||
|
|
@ -149,7 +149,7 @@ public:
|
|||
bool operator() (WorldObject* unit) const
|
||||
{
|
||||
if (unit->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!IS_PLAYER_GUID(unit->ToUnit()->GetOwnerGUID()))
|
||||
if (!unit->ToUnit()->GetOwnerGUID().IsPlayer())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ enum ePoints
|
|||
};
|
||||
|
||||
npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature),
|
||||
m_uiPlayerGUID(0),
|
||||
m_uiWPWaitTimer(1000),
|
||||
m_uiPlayerCheckTimer(0),
|
||||
m_uiEscortState(STATE_ESCORT_NONE),
|
||||
|
|
@ -442,7 +441,7 @@ void npc_escortAI::SetRun(bool on)
|
|||
}
|
||||
|
||||
//TODO: get rid of this many variables passed in function.
|
||||
void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, uint64 playerGUID /* = 0 */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
|
||||
void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = ObjectGuid::Empty */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
|
||||
{
|
||||
if (me->GetVictim())
|
||||
{
|
||||
|
|
@ -503,7 +502,8 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
|
|||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("scripts.ai", "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
|
||||
LOG_DEBUG("scripts.ai", "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %s",
|
||||
uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID.ToString().c_str());
|
||||
#endif
|
||||
|
||||
CurrentWP = WaypointList.begin();
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public:
|
|||
virtual void WaypointReached(uint32 pointId) = 0;
|
||||
virtual void WaypointStart(uint32 /*pointId*/) {}
|
||||
|
||||
void Start(bool isActiveAttacker = true, bool run = false, uint64 playerGUID = 0, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
|
||||
void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
|
||||
|
||||
void SetRun(bool on = true);
|
||||
void SetEscortPaused(bool on);
|
||||
|
|
@ -93,7 +93,7 @@ public:
|
|||
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
|
||||
bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
|
||||
void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; }
|
||||
uint64 GetEventStarterGUID() { return m_uiPlayerGUID; }
|
||||
ObjectGuid GetEventStarterGUID() { return m_uiPlayerGUID; }
|
||||
|
||||
void AddEscortState(uint32 escortState) { m_uiEscortState |= escortState; }
|
||||
void RemoveEscortState(uint32 escortState) { m_uiEscortState &= ~escortState; }
|
||||
|
|
@ -106,7 +106,7 @@ private:
|
|||
bool IsPlayerOrGroupInRange();
|
||||
void FillPointMovementListForCreature();
|
||||
|
||||
uint64 m_uiPlayerGUID;
|
||||
ObjectGuid m_uiPlayerGUID;
|
||||
uint32 m_uiWPWaitTimer;
|
||||
uint32 m_uiPlayerCheckTimer;
|
||||
uint32 m_uiEscortState;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ enum ePoints
|
|||
};
|
||||
|
||||
FollowerAI::FollowerAI(Creature* creature) : ScriptedAI(creature),
|
||||
m_uiLeaderGUID(0),
|
||||
m_uiUpdateFollowTimer(2500),
|
||||
m_uiFollowState(STATE_FOLLOW_NONE),
|
||||
m_pQuestForFollow(nullptr)
|
||||
|
|
@ -301,7 +300,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
|
|||
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID);
|
||||
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI start follow %s (%s)", player->GetName().c_str(), m_uiLeaderGUID.ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ private:
|
|||
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
|
||||
uint64 m_uiLeaderGUID;
|
||||
ObjectGuid m_uiLeaderGUID;
|
||||
uint32 m_uiUpdateFollowTimer;
|
||||
uint32 m_uiFollowState;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItem
|
|||
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(gossipMenuID, gossipMenuItemID, sender, action);
|
||||
}
|
||||
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, uint64 const& guid)
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const guid)
|
||||
{
|
||||
player->PlayerTalkClass->SendGossipMenu(npcTextID, guid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ void AddGossipItemFor(Player* player, uint32 icon, std::string const& text, uint
|
|||
void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItemID, uint32 sender, uint32 action);
|
||||
|
||||
// Send menu text
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, uint64 const& guid);
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const guid);
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, Creature const* creature);
|
||||
|
||||
// Close menu
|
||||
|
|
@ -100,7 +100,7 @@ void CloseGossipMenuFor(Player* player);
|
|||
#define ADD_GOSSIP_ITEM(a, b, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, "", 0)
|
||||
#define ADD_GOSSIP_ITEM_EXTENDED(a, b, c, d, e, f, g) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, e, f, g)
|
||||
|
||||
// This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32), b - npc guid(uint64)
|
||||
// This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32), b - npc guid(ObjectGuid)
|
||||
#define SEND_GOSSIP_MENU(a, b) PlayerTalkClass->SendGossipMenu(a, b)
|
||||
|
||||
// Closes the Menu
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
|||
mDespawnState = 0;
|
||||
|
||||
mEscortInvokerCheckTimer = 1000;
|
||||
mFollowGuid = 0;
|
||||
mFollowDist = 0;
|
||||
mFollowAngle = 0;
|
||||
mFollowCredit = 0;
|
||||
|
|
@ -297,7 +296,7 @@ void SmartAI::EndPath(bool fail)
|
|||
if (!groupGuy || !player->IsInMap(groupGuy))
|
||||
continue;
|
||||
|
||||
if (!fail && groupGuy->IsAtGroupRewardDistance(me) && !groupGuy->GetCorpse())
|
||||
if (!fail && groupGuy->IsAtGroupRewardDistance(me) && !groupGuy->HasCorpse())
|
||||
groupGuy->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
else if (fail && groupGuy->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
groupGuy->FailQuest(mEscortQuestID);
|
||||
|
|
@ -305,7 +304,7 @@ void SmartAI::EndPath(bool fail)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse())
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->HasCorpse())
|
||||
player->GroupEventHappens(mEscortQuestID, me);
|
||||
else if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(mEscortQuestID);
|
||||
|
|
@ -318,7 +317,7 @@ void SmartAI::EndPath(bool fail)
|
|||
if (GetScript()->IsPlayer((*iter)))
|
||||
{
|
||||
Player* player = (*iter)->ToPlayer();
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse())
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->HasCorpse())
|
||||
player->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
else if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(mEscortQuestID);
|
||||
|
|
@ -616,7 +615,7 @@ void SmartAI::EnterEvadeMode()
|
|||
if (!me->IsAlive() || me->IsInEvadeMode())
|
||||
return;
|
||||
|
||||
if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
|
||||
if (me->GetCharmerGUID().IsPlayer() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
|
||||
{
|
||||
me->AttackStop();
|
||||
return;
|
||||
|
|
@ -688,7 +687,7 @@ bool SmartAI::CanAIAttack(const Unit* /*who*/) const
|
|||
bool SmartAI::AssistPlayerInCombat(Unit* who)
|
||||
{
|
||||
// Xinef: if unit has no victim, or victim is player controlled thing
|
||||
if (!who->GetVictim() || IS_PLAYER_GUID(who->GetCharmerOrOwnerOrOwnGUID()))
|
||||
if (!who->GetVictim() || who->GetCharmerOrOwnerOrOwnGUID().IsPlayer())
|
||||
return false;
|
||||
|
||||
//experimental (unknown) flag not present
|
||||
|
|
@ -696,7 +695,7 @@ bool SmartAI::AssistPlayerInCombat(Unit* who)
|
|||
return false;
|
||||
|
||||
// Xinef: victim of unit has to be a player controlled unit
|
||||
if (!IS_PLAYER_GUID(who->GetVictim()->GetCharmerOrOwnerOrOwnGUID()))
|
||||
if (!who->GetVictim()->GetCharmerOrOwnerOrOwnGUID().IsPlayer())
|
||||
return false;
|
||||
|
||||
// Xinef: Check if victim can be assisted
|
||||
|
|
@ -724,7 +723,7 @@ void SmartAI::JustRespawned()
|
|||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade
|
||||
mFollowGuid.Clear();//do not reset follower on Reset(), we need it after combat evade
|
||||
mFollowDist = 0;
|
||||
mFollowAngle = 0;
|
||||
mFollowCredit = 0;
|
||||
|
|
@ -900,13 +899,13 @@ void SmartAI::SetData(uint32 id, uint32 value)
|
|||
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, nullptr, id, value);
|
||||
}
|
||||
|
||||
void SmartAI::SetGUID(uint64 /*guid*/, int32 /*id*/)
|
||||
void SmartAI::SetGUID(ObjectGuid /*guid*/, int32 /*id*/)
|
||||
{
|
||||
}
|
||||
|
||||
uint64 SmartAI::GetGUID(int32 /*id*/) const
|
||||
ObjectGuid SmartAI::GetGUID(int32 /*id*/) const
|
||||
{
|
||||
return 0;
|
||||
return ObjectGuid::Empty;
|
||||
}
|
||||
|
||||
void SmartAI::SetRun(bool run)
|
||||
|
|
@ -1014,7 +1013,7 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui
|
|||
|
||||
void SmartAI::StopFollow(bool complete)
|
||||
{
|
||||
mFollowGuid = 0;
|
||||
mFollowGuid.Clear();
|
||||
mFollowDist = 0;
|
||||
mFollowAngle = 0;
|
||||
mFollowCredit = 0;
|
||||
|
|
|
|||
|
|
@ -144,10 +144,10 @@ public:
|
|||
void SetData(uint32 id, uint32 value) override;
|
||||
|
||||
// Used in scripts to share variables
|
||||
void SetGUID(uint64 guid, int32 id = 0) override;
|
||||
void SetGUID(ObjectGuid guid, int32 id = 0) override;
|
||||
|
||||
// Used in scripts to share variables
|
||||
uint64 GetGUID(int32 id = 0) const override;
|
||||
ObjectGuid GetGUID(int32 id = 0) const override;
|
||||
|
||||
//core related
|
||||
static int32 Permissible(const Creature*);
|
||||
|
|
@ -194,7 +194,7 @@ private:
|
|||
uint32 mFollowCredit;
|
||||
uint32 mFollowArrivedEntry;
|
||||
bool mFollowArrivedAlive;
|
||||
uint64 mFollowGuid;
|
||||
ObjectGuid mFollowGuid;
|
||||
float mFollowDist;
|
||||
float mFollowAngle;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,9 +61,6 @@ SmartScript::SmartScript()
|
|||
mUseTextTimer = false;
|
||||
mTalkerEntry = 0;
|
||||
mTemplate = SMARTAI_TEMPLATE_BASIC;
|
||||
meOrigGUID = 0;
|
||||
goOrigGUID = 0;
|
||||
mLastInvoker = 0;
|
||||
mScriptType = SMART_SCRIPT_TYPE_CREATURE;
|
||||
isProcessingTimedActionList = false;
|
||||
|
||||
|
|
@ -103,7 +100,7 @@ void SmartScript::OnReset()
|
|||
}
|
||||
}
|
||||
ProcessEventsFor(SMART_EVENT_RESET);
|
||||
mLastInvoker = 0;
|
||||
mLastInvoker.Clear();
|
||||
mCounterList.clear();
|
||||
|
||||
// Xinef: Fix Combat Movement
|
||||
|
|
@ -146,7 +143,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
if (Unit* tempInvoker = GetLastInvoker())
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName().c_str(), tempInvoker->GetGUIDLow());
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: Invoker: %s (%s)", tempInvoker->GetName().c_str(), tempInvoker->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
|
||||
bool isControlled = e.action.MoveToPos.controlled > 0;
|
||||
|
|
@ -202,7 +199,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
mUseTextTimer = true;
|
||||
sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), talkTarget);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textId: %u", talker->GetName().c_str(), talker->GetGUIDLow(), mLastTextID);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (%s), textId: %u", talker->GetName().c_str(), talker->GetGUID().ToString().c_str(), mLastTextID);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -221,8 +218,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker : 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_NEUTRAL, false, (*itr)->ToPlayer());
|
||||
}
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID));
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (%s), textGroupId: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUID().ToString().c_str(), uint8(e.action.talk.textGroupID));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -241,8 +238,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToUnit()->HandleEmoteCommand(e.action.emote.emote);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (GuidLow: %u), emote: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.emote.emote);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (%s), emote: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUID().ToString().c_str(), e.action.emote.emote);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -262,8 +259,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.onlySelf > 0);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.onlySelf);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (%s), sound: %u, onlyself: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUID().ToString().c_str(), e.action.sound.sound, e.action.sound.onlySelf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -307,8 +304,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
uint32 sound = temp[urand(0, count - 1)];
|
||||
(*itr)->SendPlaySound(sound, e.action.randomSound.onlySelf > 0);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), sound, e.action.randomSound.onlySelf);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_SOUND: target: %s (%s), sound: %u, onlyself: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUID().ToString().c_str(), sound, e.action.randomSound.onlySelf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -357,8 +354,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->SendPlayMusic(e.action.music.sound, e.action.music.onlySelf > 0);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MUSIC: target: %s (GuidLow: %u), sound: %u, onlySelf: %u, type: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.music.sound, e.action.music.onlySelf, e.action.music.type);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MUSIC: target: %s (%s), sound: %u, onlySelf: %u, type: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUID().ToString().c_str(), e.action.music.sound, e.action.music.onlySelf, e.action.music.type);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -432,8 +429,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
uint32 sound = temp[urand(0, count - 1)];
|
||||
(*itr)->SendPlayMusic(sound, e.action.randomMusic.onlySelf > 0);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_MUSIC: target: %s (GuidLow: %u), sound: %u, onlyself: %u, type: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), sound, e.action.randomMusic.onlySelf, e.action.randomMusic.type);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_MUSIC: target: %s (%s), sound: %u, onlyself: %u, type: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUID().ToString().c_str(), sound, e.action.randomMusic.onlySelf, e.action.randomMusic.type);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -454,8 +451,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToCreature()->setFaction(e.action.faction.factionID);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUIDLow(), e.action.faction.factionID);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u (%s) set faction to %u",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUID().ToString().c_str(), e.action.faction.factionID);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
@ -466,8 +463,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToCreature()->setFaction(ci->faction);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUIDLow(), ci->faction);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u (%s) set faction to %u",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUID().ToString().c_str(), ci->faction);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -500,8 +497,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
uint32 displayId = ObjectMgr::ChooseDisplayId(ci);
|
||||
(*itr)->ToCreature()->SetDisplayId(displayId);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUIDLow(), displayId);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u (%s) set displayid to %u",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUID().ToString().c_str(), displayId);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -510,8 +507,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToCreature()->SetDisplayId(e.action.morphOrMount.model);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUIDLow(), e.action.morphOrMount.model);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u (%s) set displayid to %u",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUID().ToString().c_str(), e.action.morphOrMount.model);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -519,8 +516,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToCreature()->DeMorph();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u demorphs.",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUIDLow());
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u (%s) demorphs.",
|
||||
(*itr)->GetEntry(), (*itr)->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -540,8 +537,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToPlayer()->FailQuest(e.action.quest.quest);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_FAIL_QUEST: Player guidLow %u fails quest %u",
|
||||
(*itr)->GetGUIDLow(), e.action.quest.quest);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_FAIL_QUEST: Player %s fails quest %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.quest.quest);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -569,8 +566,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
PlayerMenu menu(session);
|
||||
menu.SendQuestGiverQuestDetails(q, me->GetGUID(), true);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player guidLow %u - offering quest %u",
|
||||
(*itr)->GetGUIDLow(), e.action.questOffer.questID);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player %s- offering quest %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.questOffer.questID);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -578,8 +575,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, nullptr);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player guidLow %u - quest %u added",
|
||||
(*itr)->GetGUIDLow(), e.action.questOffer.questID);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player %s - quest %u added",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.questOffer.questID);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -643,8 +640,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
uint32 emote = temp[urand(0, count - 1)];
|
||||
(*itr)->ToUnit()->HandleEmoteCommand(emote);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_EMOTE: Creature guidLow %u handle random emote %u",
|
||||
(*itr)->GetGUIDLow(), emote);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_EMOTE: Creature %s handle random emote %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), emote);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -664,8 +661,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
me->getThreatManager().modifyThreatPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature guidLow %u modify threat for unit %u, value %i",
|
||||
me->GetGUIDLow(), target->GetGUIDLow(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature %s modify threat for unit %s, value %i",
|
||||
me->GetGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -686,8 +683,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
me->getThreatManager().modifyThreatPercent((*itr)->ToUnit(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow %u modify threat for unit %u, value %i",
|
||||
me->GetGUIDLow(), (*itr)->GetGUIDLow(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature %s modify threat for unit %s, value %i",
|
||||
me->GetGUID().ToString().c_str(), (*itr)->GetGUID().ToString().c_str(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -715,8 +712,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
player->GroupEventHappens(e.action.quest.quest, me);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS: Player guidLow %u credited quest %u",
|
||||
(*itr)->GetGUIDLow(), e.action.quest.quest);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS: Player %s credited quest %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.quest.quest);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -827,8 +824,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToUnit()->AddAura(e.action.cast.spell, (*itr)->ToUnit());
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ADD_AURA: Adding aura %u to unit %u",
|
||||
e.action.cast.spell, (*itr)->GetGUIDLow());
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ADD_AURA: Adding aura %u to unit %s",
|
||||
e.action.cast.spell, (*itr)->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -851,8 +848,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
(*itr)->ToGameObject()->SetLootState(GO_READY);
|
||||
(*itr)->ToGameObject()->UseDoorOrButton(0, !!e.action.activateObject.alternative, unit);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %u (entry: %u) activated",
|
||||
(*itr)->GetGUIDLow(), (*itr)->GetEntry());
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %s activated",
|
||||
(*itr)->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -872,8 +869,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToGameObject()->ResetDoorOrButton();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RESET_GOBJECT. Gameobject %u (entry: %u) reset",
|
||||
(*itr)->GetGUIDLow(), (*itr)->GetEntry());
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RESET_GOBJECT. Gameobject %s reset",
|
||||
(*itr)->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -893,8 +890,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
(*itr)->ToUnit()->SetUInt32Value(UNIT_NPC_EMOTESTATE, e.action.emote.emote);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set emotestate to %u",
|
||||
(*itr)->GetGUIDLow(), e.action.emote.emote);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %s set emotestate to %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.emote.emote);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -915,14 +912,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
if (!e.action.unitFlag.type)
|
||||
{
|
||||
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS",
|
||||
(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %s added flag %u to UNIT_FIELD_FLAGS",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS_2",
|
||||
(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %s added flag %u to UNIT_FIELD_FLAGS_2",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -943,14 +940,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
if (!e.action.unitFlag.type)
|
||||
{
|
||||
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS",
|
||||
(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %s removed flag %u to UNIT_FIELD_FLAGS",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS_2",
|
||||
(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %s removed flag %u to UNIT_FIELD_FLAGS_2",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -965,8 +962,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
|
||||
CAST_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %u bool on = %u",
|
||||
me->GetGUIDLow(), e.action.autoAttack.attack);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %s bool on = %u",
|
||||
me->GetGUID().ToString().c_str(), e.action.autoAttack.attack);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -985,8 +982,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
else
|
||||
CAST_AI(SmartAI, me->AI())->SetCombatMove(move);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u",
|
||||
me->GetGUIDLow(), e.action.combatMove.move);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %s bool on = %u",
|
||||
me->GetGUID().ToString().c_str(), e.action.combatMove.move);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -997,8 +994,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
|
||||
SetPhase(e.action.setEventPhase.phase);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_EVENT_PHASE: Creature %u set event phase %u",
|
||||
GetBaseObject()->GetGUIDLow(), e.action.setEventPhase.phase);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_EVENT_PHASE: Creature %s set event phase %u",
|
||||
GetBaseObject()->GetGUID().ToString().c_str(), e.action.setEventPhase.phase);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -1010,8 +1007,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
IncPhase(e.action.incEventPhase.inc);
|
||||
DecPhase(e.action.incEventPhase.dec);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_INC_EVENT_PHASE: Creature %u inc event phase by %u, "
|
||||
"decrease by %u", GetBaseObject()->GetGUIDLow(), e.action.incEventPhase.inc, e.action.incEventPhase.dec);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_INC_EVENT_PHASE: Creature %s inc event phase by %u, "
|
||||
"decrease by %u", GetBaseObject()->GetGUID().ToString().c_str(), e.action.incEventPhase.inc, e.action.incEventPhase.dec);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -1045,7 +1042,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE);
|
||||
}
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow());
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %s DoFleeToGetAssistance", me->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -1073,8 +1070,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
if (Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
player->GroupEventHappens(e.action.quest.quest, GetBaseObject());
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u",
|
||||
(*itr)->GetGUIDLow(), e.action.quest.quest);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %s, group credit for quest %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.quest.quest);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -1107,8 +1104,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
(*itr)->ToUnit()->RemoveAllAuras();
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %u, spell %u",
|
||||
(*itr)->GetGUIDLow(), e.action.removeAura.spell);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %s, spell %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.removeAura.spell);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1134,8 +1131,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
float angle = e.action.follow.angle > 6 ? (e.action.follow.angle * M_PI / 180.0f) : e.action.follow.angle;
|
||||
CAST_AI(SmartAI, me->AI())->SetFollow((*itr)->ToUnit(), float(int32(e.action.follow.dist)) + 0.1f, angle, e.action.follow.credit, e.action.follow.entry, e.action.follow.creditType, e.action.follow.aliveState);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %u following target %u",
|
||||
me->GetGUIDLow(), (*itr)->GetGUIDLow());
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %s following target %s",
|
||||
me->GetGUID().ToString().c_str(), (*itr)->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -1173,8 +1170,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
uint32 phase = temp[urand(0, count - 1)];
|
||||
SetPhase(phase);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE: Creature %u sets event phase to %u",
|
||||
GetBaseObject()->GetGUIDLow(), phase);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE: Creature %s sets event phase to %u",
|
||||
GetBaseObject()->GetGUID().ToString().c_str(), phase);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -1186,8 +1183,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
uint32 phase = urand(e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax);
|
||||
SetPhase(phase);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE_RANGE: Creature %u sets event phase to %u",
|
||||
GetBaseObject()->GetGUIDLow(), phase);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE_RANGE: Creature %s sets event phase to %u",
|
||||
GetBaseObject()->GetGUID().ToString().c_str(), phase);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
@ -1197,8 +1194,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
unit->ToPlayer()->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, unit);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: (trigger == true) Player %u, Killcredit: %u",
|
||||
unit->GetGUIDLow(), e.action.killedMonster.creature);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: (trigger == true) Player %s, Killcredit: %u",
|
||||
unit->GetGUID().ToString().c_str(), e.action.killedMonster.creature);
|
||||
#endif
|
||||
}
|
||||
else if (e.target.type == SMART_TARGET_NONE || e.target.type == SMART_TARGET_SELF) // Loot recipient and his group members
|
||||
|
|
@ -1209,8 +1206,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
if (Player* player = me->GetLootRecipient())
|
||||
{
|
||||
player->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, player);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u",
|
||||
player->GetGUIDLow(), e.action.killedMonster.creature);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %s, Killcredit: %u",
|
||||
player->GetGUID().ToString().c_str(), e.action.killedMonster.creature);
|
||||
}
|
||||
}
|
||||
else // Specific target type
|
||||
|
|
@ -1230,8 +1227,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
|
||||
player->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, player);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u",
|
||||
(*itr)->GetGUIDLow(), e.action.killedMonster.creature);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %s, Killcredit: %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.killedMonster.creature);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1282,10 +1279,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
if (!targets)
|
||||
break;
|
||||
|
||||
instance->SetData64(e.action.setInstanceData64.field, targets->front()->GetGUID());
|
||||
instance->SetGuidData(e.action.setInstanceData64.field, targets->front()->GetGUID());
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: %lu",
|
||||
e.action.setInstanceData64.field, targets->front()->GetGUID());
|
||||
e.action.setInstanceData64.field, targets->front()->GetGUID().GetRawValue());
|
||||
#endif
|
||||
delete targets;
|
||||
break;
|
||||
|
|
@ -1309,7 +1306,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
Unit::Kill(me, me);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature %u", me->GetGUIDLow());
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature %s", me->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
|
@ -1368,8 +1365,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
{
|
||||
me->SetSheath(SheathState(e.action.setSheath.sheath));
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_SET_SHEATH: Creature %u, State: %u",
|
||||
me->GetGUIDLow(), e.action.setSheath.sheath);
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_SET_SHEATH: Creature %s, State: %u",
|
||||
me->GetGUID().ToString().c_str(), e.action.setSheath.sheath);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
|
@ -2118,9 +2115,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
if (IsCreature(*itr))
|
||||
{
|
||||
if (!meOrigGUID)
|
||||
meOrigGUID = me ? me->GetGUID() : 0;
|
||||
meOrigGUID = me ? me->GetGUID() : ObjectGuid::Empty;
|
||||
if (!goOrigGUID)
|
||||
goOrigGUID = go ? go->GetGUID() : 0;
|
||||
goOrigGUID = go ? go->GetGUID() : ObjectGuid::Empty;
|
||||
go = nullptr;
|
||||
me = (*itr)->ToCreature();
|
||||
break;
|
||||
|
|
@ -2128,9 +2125,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
else if (IsGameObject(*itr))
|
||||
{
|
||||
if (!meOrigGUID)
|
||||
meOrigGUID = me ? me->GetGUID() : 0;
|
||||
meOrigGUID = me ? me->GetGUID() : ObjectGuid::Empty;
|
||||
if (!goOrigGUID)
|
||||
goOrigGUID = go ? go->GetGUID() : 0;
|
||||
goOrigGUID = go ? go->GetGUID() : ObjectGuid::Empty;
|
||||
go = (*itr)->ToGameObject();
|
||||
me = nullptr;
|
||||
break;
|
||||
|
|
@ -2270,8 +2267,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||
(*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
|
||||
}
|
||||
else
|
||||
LOG_DEBUG("sql.sql", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura",
|
||||
e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
|
||||
LOG_DEBUG("sql.sql", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target %s already has the aura",
|
||||
e.action.cast.spell, (*it)->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3632,7 +3629,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
|||
// xinef: my addition
|
||||
if (e.target.unitGUID.getFromHashMap)
|
||||
{
|
||||
if ((target = ObjectAccessor::GetCreature(scriptTrigger ? *scriptTrigger : *GetBaseObject(), MAKE_NEW_GUID(e.target.unitGUID.dbGuid, e.target.unitGUID.entry, HIGHGUID_UNIT))))
|
||||
if ((target = ObjectAccessor::GetCreature(scriptTrigger ? *scriptTrigger : *GetBaseObject(), ObjectGuid::Create<HighGuid::Unit>(e.target.unitGUID.entry, e.target.unitGUID.dbGuid))))
|
||||
l->push_back(target);
|
||||
}
|
||||
else
|
||||
|
|
@ -3655,7 +3652,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
|||
// xinef: my addition
|
||||
if (e.target.goGUID.getFromHashMap)
|
||||
{
|
||||
if ((target = ObjectAccessor::GetGameObject(scriptTrigger ? *scriptTrigger : *GetBaseObject(), MAKE_NEW_GUID(e.target.goGUID.dbGuid, e.target.goGUID.entry, HIGHGUID_GAMEOBJECT))))
|
||||
if ((target = ObjectAccessor::GetGameObject(scriptTrigger ? *scriptTrigger : *GetBaseObject(), ObjectGuid::Create<HighGuid::GameObject>(e.target.goGUID.entry, e.target.goGUID.dbGuid))))
|
||||
l->push_back(target);
|
||||
}
|
||||
else
|
||||
|
|
@ -4708,14 +4705,14 @@ void SmartScript::GetScript()
|
|||
SmartAIEventList e;
|
||||
if (me)
|
||||
{
|
||||
e = sSmartScriptMgr->GetScript(-((int32)me->GetDBTableGUIDLow()), mScriptType);
|
||||
e = sSmartScriptMgr->GetScript(-((int32)me->GetSpawnId()), mScriptType);
|
||||
if (e.empty())
|
||||
e = sSmartScriptMgr->GetScript((int32)me->GetEntry(), mScriptType);
|
||||
FillScript(e, me, nullptr);
|
||||
}
|
||||
else if (go)
|
||||
{
|
||||
e = sSmartScriptMgr->GetScript(-((int32)go->GetDBTableGUIDLow()), mScriptType);
|
||||
e = sSmartScriptMgr->GetScript(-((int32)go->GetSpawnId()), mScriptType);
|
||||
if (e.empty())
|
||||
e = sSmartScriptMgr->GetScript((int32)go->GetEntry(), mScriptType);
|
||||
FillScript(e, go, nullptr);
|
||||
|
|
@ -4824,20 +4821,20 @@ void SmartScript::DoAction(int32 param)
|
|||
|
||||
uint32 SmartScript::GetData(uint32 id)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SmartScript::SetData(uint32 id, uint32 value)
|
||||
{
|
||||
}
|
||||
|
||||
void SmartScript::SetGUID(uint64 guid, int32 id)
|
||||
void SmartScript::SetGUID(ObjectGuid guid, int32 id)
|
||||
{
|
||||
}
|
||||
|
||||
uint64 SmartScript::GetGUID(int32 id)
|
||||
ObjectGuid SmartScript::GetGUID(int32 id)
|
||||
{
|
||||
return 0;
|
||||
return ObjectGuid::Empty;
|
||||
}
|
||||
|
||||
void SmartScript::MovepointStart(uint32 id)
|
||||
|
|
@ -4852,9 +4849,9 @@ void SmartScript::SetMovePathEndAction(SMART_ACTION action)
|
|||
{
|
||||
}
|
||||
|
||||
uint32 SmartScript::DoChat(int8 id, uint64 whisperGuid)
|
||||
uint32 SmartScript::DoChat(int8 id, ObjectGuid whisperGuid)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}*/
|
||||
// SmartScript end
|
||||
|
||||
|
|
|
|||
|
|
@ -156,35 +156,27 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, uint32 guid) const
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
|
||||
{
|
||||
GameObject* gameObject = nullptr;
|
||||
auto bounds = searchObject->GetMap()->GetGameObjectBySpawnIdStore().equal_range(guid);
|
||||
if (bounds.first == bounds.second)
|
||||
return nullptr;
|
||||
|
||||
CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
|
||||
acore::GameObjectWithDbGUIDCheck goCheck(guid);
|
||||
acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck> checker(searchObject, gameObject, goCheck);
|
||||
|
||||
TypeContainerVisitor<acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > objectChecker(checker);
|
||||
cell.Visit(p, objectChecker, *searchObject->GetMap(), *searchObject, searchObject->GetVisibilityRange());
|
||||
|
||||
return gameObject;
|
||||
return bounds.first->second;
|
||||
}
|
||||
|
||||
Creature* FindCreatureNear(WorldObject* searchObject, uint32 guid) const
|
||||
Creature* FindCreatureNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
|
||||
{
|
||||
Creature* creature = nullptr;
|
||||
CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
auto bounds = searchObject->GetMap()->GetCreatureBySpawnIdStore().equal_range(guid);
|
||||
if (bounds.first == bounds.second)
|
||||
return nullptr;
|
||||
|
||||
acore::CreatureWithDbGUIDCheck target_check(guid);
|
||||
acore::CreatureSearcher<acore::CreatureWithDbGUIDCheck> checker(searchObject, creature, target_check);
|
||||
auto creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type const& pair)
|
||||
{
|
||||
return pair.second->IsAlive();
|
||||
});
|
||||
|
||||
TypeContainerVisitor<acore::CreatureSearcher <acore::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker);
|
||||
cell.Visit(p, unit_checker, *searchObject->GetMap(), *searchObject, searchObject->GetVisibilityRange());
|
||||
|
||||
return creature;
|
||||
return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
|
||||
}
|
||||
|
||||
ObjectListMap* mTargetStorage;
|
||||
|
|
@ -192,30 +184,39 @@ public:
|
|||
void OnReset();
|
||||
void ResetBaseObject()
|
||||
{
|
||||
if (meOrigGUID)
|
||||
WorldObject* lookupRoot = me;
|
||||
if (!lookupRoot)
|
||||
lookupRoot = go;
|
||||
|
||||
if (lookupRoot)
|
||||
{
|
||||
if (Creature* m = HashMapHolder<Creature>::Find(meOrigGUID))
|
||||
if (meOrigGUID)
|
||||
{
|
||||
me = m;
|
||||
go = nullptr;
|
||||
if (Creature* m = ObjectAccessor::GetCreature(*lookupRoot, meOrigGUID))
|
||||
{
|
||||
me = m;
|
||||
go = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (goOrigGUID)
|
||||
{
|
||||
if (GameObject* o = ObjectAccessor::GetGameObject(*lookupRoot, goOrigGUID))
|
||||
{
|
||||
me = nullptr;
|
||||
go = o;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (goOrigGUID)
|
||||
{
|
||||
if (GameObject* o = HashMapHolder<GameObject>::Find(goOrigGUID))
|
||||
{
|
||||
me = nullptr;
|
||||
go = o;
|
||||
}
|
||||
}
|
||||
goOrigGUID = 0;
|
||||
meOrigGUID = 0;
|
||||
|
||||
goOrigGUID.Clear();
|
||||
meOrigGUID.Clear();
|
||||
}
|
||||
|
||||
//TIMED_ACTIONLIST (script type 9 aka script9)
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry);
|
||||
Unit* GetLastInvoker(Unit* invoker = nullptr);
|
||||
uint64 mLastInvoker;
|
||||
ObjectGuid mLastInvoker;
|
||||
typedef std::unordered_map<uint32, uint32> CounterMap;
|
||||
CounterMap mCounterList;
|
||||
|
||||
|
|
@ -262,9 +263,9 @@ private:
|
|||
SmartAIEventList mTimedActionList;
|
||||
bool isProcessingTimedActionList;
|
||||
Creature* me;
|
||||
uint64 meOrigGUID;
|
||||
ObjectGuid meOrigGUID;
|
||||
GameObject* go;
|
||||
uint64 goOrigGUID;
|
||||
ObjectGuid goOrigGUID;
|
||||
AreaTrigger const* trigger;
|
||||
SmartScriptType mScriptType;
|
||||
uint32 mEventPhase;
|
||||
|
|
|
|||
|
|
@ -1705,7 +1705,6 @@ public:
|
|||
typedef std::unordered_map<uint32, WayPoint*> WPPath;
|
||||
|
||||
typedef std::list<WorldObject*> ObjectList;
|
||||
typedef std::list<uint64> GuidList;
|
||||
|
||||
class ObjectGuidList
|
||||
{
|
||||
|
|
@ -1739,7 +1738,7 @@ public:
|
|||
if (WorldObject* obj = ObjectAccessor::GetWorldObject(*m_baseObject, *itr))
|
||||
m_objectList->push_back(obj);
|
||||
//else
|
||||
// TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: " UI64FMTD, *itr);
|
||||
// TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: %s", (*itr).ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,8 +69,7 @@ namespace AccountMgr
|
|||
{
|
||||
do
|
||||
{
|
||||
uint32 guidLow = (*result)[0].GetUInt32();
|
||||
uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||
ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt32());
|
||||
|
||||
// Kick if player is online
|
||||
if (Player* p = ObjectAccessor::FindPlayer(guid))
|
||||
|
|
@ -80,7 +79,7 @@ namespace AccountMgr
|
|||
s->LogoutPlayer(false); // logout player without waiting next session list update
|
||||
}
|
||||
|
||||
Player::DeleteFromDB(guid, accountId, false, true); // no need to update realm characters
|
||||
Player::DeleteFromDB(guid.GetCounter(), accountId, false, true); // no need to update realm characters
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -486,7 +486,7 @@ void AchievementMgr::Reset()
|
|||
|
||||
m_completedAchievements.clear();
|
||||
m_criteriaProgress.clear();
|
||||
DeleteFromDB(m_player->GetGUIDLow());
|
||||
DeleteFromDB(m_player->GetGUID().GetCounter());
|
||||
|
||||
// re-fill data
|
||||
CheckAllAchievementCriteria();
|
||||
|
|
@ -519,7 +519,7 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaCondition condi
|
|||
}
|
||||
}
|
||||
|
||||
void AchievementMgr::DeleteFromDB(uint32 lowguid)
|
||||
void AchievementMgr::DeleteFromDB(ObjectGuid::LowType lowguid)
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
|
|
@ -545,11 +545,11 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
|
|||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
|
||||
stmt->setUInt16(0, iter->first);
|
||||
stmt->setUInt32(1, GetPlayer()->GetGUID());
|
||||
stmt->setUInt32(1, GetPlayer()->GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT);
|
||||
stmt->setUInt32(0, GetPlayer()->GetGUID());
|
||||
stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter());
|
||||
stmt->setUInt16(1, iter->first);
|
||||
stmt->setUInt32(2, uint32(iter->second.date));
|
||||
trans->Append(stmt);
|
||||
|
|
@ -568,7 +568,7 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
|
|||
continue;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS_BY_CRITERIA);
|
||||
stmt->setUInt32(0, GetPlayer()->GetGUID());
|
||||
stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter());
|
||||
stmt->setUInt16(1, iter->first);
|
||||
trans->Append(stmt);
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
|
|||
if (iter->second.counter)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT_PROGRESS);
|
||||
stmt->setUInt32(0, GetPlayer()->GetGUID());
|
||||
stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter());
|
||||
stmt->setUInt16(1, iter->first);
|
||||
stmt->setUInt32(2, iter->second.counter);
|
||||
stmt->setUInt32(3, uint32(iter->second.date));
|
||||
|
|
@ -681,7 +681,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
|||
{
|
||||
WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, guild->GetName().size() + 1 + 8 + 4 + 4);
|
||||
data << guild->GetName();
|
||||
data << uint64(GetPlayer()->GetGUID());
|
||||
data << GetPlayer()->GetGUID();
|
||||
data << uint32(achievement->ID);
|
||||
data << uint32(0); // display name as plain string in chat (always 0 for guild)
|
||||
sWorld->SendGlobalMessage(&data);
|
||||
|
|
@ -693,7 +693,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
|||
// broadcast realm first reached
|
||||
WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, GetPlayer()->GetName().size() + 1 + 8 + 4 + 4);
|
||||
data << GetPlayer()->GetName();
|
||||
data << uint64(GetPlayer()->GetGUID());
|
||||
data << GetPlayer()->GetGUID();
|
||||
data << uint32(achievement->ID);
|
||||
std::size_t linkTypePos = data.wpos();
|
||||
data << uint32(1); // display name as clickable link in chat
|
||||
|
|
@ -719,7 +719,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
|||
}
|
||||
|
||||
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8 + 4 + 8);
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data << GetPlayer()->GetPackGUID();
|
||||
data << uint32(achievement->ID);
|
||||
data.AppendPackedTime(time(nullptr));
|
||||
data << uint32(0);
|
||||
|
|
@ -734,7 +734,7 @@ void AchievementMgr::SendCriteriaUpdate(AchievementCriteriaEntry const* entry, C
|
|||
// the counter is packed like a packed Guid
|
||||
data.appendPackGUID(progress->counter);
|
||||
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data << GetPlayer()->GetPackGUID();
|
||||
if (!entry->timeLimit)
|
||||
data << uint32(0);
|
||||
else
|
||||
|
|
@ -2026,7 +2026,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
|
|||
return;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("achievement", "AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow());
|
||||
LOG_DEBUG("achievement", "AchievementMgr::SetCriteriaProgress(%u, %u) for %s", entry->ID, changeValue, m_player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
|
||||
CriteriaProgress* progress = GetCriteriaProgress(entry);
|
||||
|
|
@ -2289,7 +2289,7 @@ void AchievementMgr::SendAllAchievementData() const
|
|||
void AchievementMgr::SendRespondInspectAchievements(Player* player) const
|
||||
{
|
||||
WorldPacket data(SMSG_RESPOND_INSPECT_ACHIEVEMENTS, 9 + m_completedAchievements.size() * 8 + 4 + 4);
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data << GetPlayer()->GetPackGUID();
|
||||
BuildAllDataPacket(&data, true);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
@ -2320,7 +2320,7 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data, bool inspect) const
|
|||
{
|
||||
*data << uint32(iter->first);
|
||||
data->appendPackGUID(iter->second.counter);
|
||||
data->append(GetPlayer()->GetPackGUID());
|
||||
*data << GetPlayer()->GetPackGUID();
|
||||
*data << uint32(0);
|
||||
data->AppendPackedTime(iter->second.date);
|
||||
*data << uint32(0);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "DatabaseEnv.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "DBCStores.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
typedef std::list<AchievementCriteriaEntry const*> AchievementCriteriaEntryList;
|
||||
typedef std::list<AchievementEntry const*> AchievementEntryList;
|
||||
|
|
@ -258,7 +259,7 @@ public:
|
|||
~AchievementMgr();
|
||||
|
||||
void Reset();
|
||||
static void DeleteFromDB(uint32 lowguid);
|
||||
static void DeleteFromDB(ObjectGuid::LowType lowguid);
|
||||
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult);
|
||||
void SaveToDB(SQLTransaction& trans);
|
||||
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete = false);
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ namespace ArenaSpectator
|
|||
inline void SendPacketTo(const Player* p, const char* m);
|
||||
inline void SendPacketTo(const Map* map, const char* m);
|
||||
inline void HandleResetCommand(Player* p);
|
||||
inline bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove);
|
||||
inline bool ShouldSendAura(Aura* aura, uint8 effMask, ObjectGuid targetGUID, bool remove);
|
||||
|
||||
template<class T> inline void SendCommand_String(T* p, uint64 targetGUID, const char* prefix, const std::string& c);
|
||||
template<class T> inline void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t);
|
||||
template<class T> inline void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t);
|
||||
template<class T> inline void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime);
|
||||
template<class T> inline void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur);
|
||||
template<class T> inline void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove);
|
||||
template<class T> inline void SendCommand_String(T* p, ObjectGuid targetGUID, const char* prefix, const std::string& c);
|
||||
template<class T> inline void SendCommand_UInt32Value(T* o, ObjectGuid targetGUID, const char* prefix, uint32 t);
|
||||
template<class T> inline void SendCommand_GUID(T* o, ObjectGuid targetGUID, const char* prefix, ObjectGuid t);
|
||||
template<class T> inline void SendCommand_Spell(T* o, ObjectGuid targetGUID, const char* prefix, uint32 id, int32 casttime);
|
||||
template<class T> inline void SendCommand_Cooldown(T* o, ObjectGuid targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur);
|
||||
template<class T> inline void SendCommand_Aura(T* o, ObjectGuid targetGUID, const char* prefix, ObjectGuid caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove);
|
||||
|
||||
bool HandleSpectatorSpectateCommand(ChatHandler* handler, char const* args);
|
||||
bool HandleSpectatorWatchCommand(ChatHandler* handler, char const* args);
|
||||
|
|
@ -88,54 +88,54 @@ namespace ArenaSpectator
|
|||
}
|
||||
|
||||
template<class T>
|
||||
void SendCommand_String(T* o, uint64 targetGUID, const char* prefix, const char* c)
|
||||
void SendCommand_String(T* o, ObjectGuid targetGUID, const char* prefix, const char* c)
|
||||
{
|
||||
if (!IS_PLAYER_GUID(targetGUID))
|
||||
if (!targetGUID.IsPlayer())
|
||||
return;
|
||||
SendCommand(o, "%s0x%016llX;%s=%s;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID, prefix, c);
|
||||
SendCommand(o, "%s0x%016llX;%s=%s;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID.GetRawValue(), prefix, c);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t)
|
||||
void SendCommand_UInt32Value(T* o, ObjectGuid targetGUID, const char* prefix, uint32 t)
|
||||
{
|
||||
if (!IS_PLAYER_GUID(targetGUID))
|
||||
if (!targetGUID.IsPlayer())
|
||||
return;
|
||||
SendCommand(o, "%s0x%016llX;%s=%u;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID, prefix, t);
|
||||
SendCommand(o, "%s0x%016llX;%s=%u;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID.GetRawValue(), prefix, t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t)
|
||||
void SendCommand_GUID(T* o, ObjectGuid targetGUID, const char* prefix, ObjectGuid t)
|
||||
{
|
||||
if (!IS_PLAYER_GUID(targetGUID))
|
||||
if (!targetGUID.IsPlayer())
|
||||
return;
|
||||
SendCommand(o, "%s0x%016llX;%s=0x%016llX;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID, prefix, (unsigned long long)t);
|
||||
SendCommand(o, "%s0x%016llX;%s=0x%016llX;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID.GetRawValue(), prefix, (unsigned long long)t.GetRawValue());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime)
|
||||
void SendCommand_Spell(T* o, ObjectGuid targetGUID, const char* prefix, uint32 id, int32 casttime)
|
||||
{
|
||||
if (!IS_PLAYER_GUID(targetGUID))
|
||||
if (!targetGUID.IsPlayer())
|
||||
return;
|
||||
SendCommand(o, "%s0x%016llX;%s=%u,%i;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID, prefix, id, casttime);
|
||||
SendCommand(o, "%s0x%016llX;%s=%u,%i;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID.GetRawValue(), prefix, id, casttime);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur)
|
||||
void SendCommand_Cooldown(T* o, ObjectGuid targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur)
|
||||
{
|
||||
if (!IS_PLAYER_GUID(targetGUID))
|
||||
if (!targetGUID.IsPlayer())
|
||||
return;
|
||||
if (const SpellInfo* si = sSpellMgr->GetSpellInfo(id))
|
||||
if (si->SpellIconID == 1)
|
||||
return;
|
||||
SendCommand(o, "%s0x%016llX;%s=%u,%u,%u;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID, prefix, id, dur, maxdur);
|
||||
SendCommand(o, "%s0x%016llX;%s=%u,%u,%u;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID.GetRawValue(), prefix, id, dur, maxdur);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove)
|
||||
void SendCommand_Aura(T* o, ObjectGuid targetGUID, const char* prefix, ObjectGuid caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove)
|
||||
{
|
||||
if (!IS_PLAYER_GUID(targetGUID))
|
||||
if (!targetGUID.IsPlayer())
|
||||
return;
|
||||
SendCommand(o, "%s0x%016llX;%s=%u,%u,%i,%i,%u,%u,%u,0x%016llX;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID, prefix, remove ? 1 : 0, stack, dur, maxdur, id, dispel, isDebuff ? 1 : 0, (unsigned long long)caster);
|
||||
SendCommand(o, "%s0x%016llX;%s=%u,%u,%i,%i,%u,%u,%u,0x%016llX;", SPECTATOR_ADDON_PREFIX, (unsigned long long)targetGUID.GetRawValue(), prefix, remove ? 1 : 0, stack, dur, maxdur, id, dispel, isDebuff ? 1 : 0, (unsigned long long)caster.GetRawValue());
|
||||
}
|
||||
|
||||
void HandleResetCommand(Player* p)
|
||||
|
|
@ -148,11 +148,11 @@ namespace ArenaSpectator
|
|||
Battleground::BattlegroundPlayerMap const& pl = bg->GetPlayers();
|
||||
for (Battleground::BattlegroundPlayerMap::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
|
||||
{
|
||||
if (p->HasReceivedSpectatorResetFor(GUID_LOPART(itr->first)))
|
||||
if (p->HasReceivedSpectatorResetFor(itr->first))
|
||||
continue;
|
||||
|
||||
Player* plr = itr->second;
|
||||
p->AddReceivedSpectatorResetFor(GUID_LOPART(itr->first));
|
||||
p->AddReceivedSpectatorResetFor(itr->first);
|
||||
|
||||
SendCommand_String(p, itr->first, "NME", plr->GetName().c_str());
|
||||
// Xinef: addon compatibility
|
||||
|
|
@ -192,7 +192,7 @@ namespace ArenaSpectator
|
|||
}
|
||||
}
|
||||
|
||||
bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove)
|
||||
bool ShouldSendAura(Aura* aura, uint8 effMask, ObjectGuid targetGUID, bool remove)
|
||||
{
|
||||
if (aura->GetSpellInfo()->SpellIconID == 1 || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -56,8 +56,26 @@ AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId)
|
|||
return &mAllianceAuctions;
|
||||
else if (u_entry->ourMask & FACTION_MASK_HORDE)
|
||||
return &mHordeAuctions;
|
||||
else
|
||||
|
||||
return &mNeutralAuctions;
|
||||
}
|
||||
|
||||
AuctionHouseObject* AuctionHouseMgr::GetAuctionsMapByHouseId(uint8 auctionHouseId)
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
return &mNeutralAuctions;
|
||||
|
||||
switch(auctionHouseId)
|
||||
{
|
||||
case AUCTIONHOUSE_ALLIANCE:
|
||||
return &mAllianceAuctions;
|
||||
case AUCTIONHOUSE_HORDE:
|
||||
return &mHordeAuctions;
|
||||
break;
|
||||
}
|
||||
|
||||
return &mNeutralAuctions;
|
||||
|
||||
}
|
||||
|
||||
uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count)
|
||||
|
|
@ -87,17 +105,16 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
|||
//does not clear ram
|
||||
void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification, bool updateAchievementCriteria, bool sendMail)
|
||||
{
|
||||
Item* pItem = GetAItem(auction->item_guidlow);
|
||||
Item* pItem = GetAItem(auction->item_guid);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
|
||||
uint32 bidder_accId = 0;
|
||||
Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid);
|
||||
Player* bidder = ObjectAccessor::FindConnectedPlayer(auction->bidder);
|
||||
if (bidder)
|
||||
bidder_accId = bidder->GetSession()->GetAccountId();
|
||||
else
|
||||
bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid);
|
||||
bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(auction->bidder.GetCounter());
|
||||
|
||||
// receiver exist
|
||||
if (bidder || bidder_accId)
|
||||
|
|
@ -106,14 +123,14 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
|||
// set owner to bidder (to prevent delete item with sender char deleting)
|
||||
// owner in `data` will set at mail receive and item extracting
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
|
||||
stmt->setUInt32(0, auction->bidder);
|
||||
stmt->setUInt32(1, pItem->GetGUIDLow());
|
||||
stmt->setUInt32(0, auction->bidder.GetCounter());
|
||||
stmt->setUInt32(1, pItem->GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
if (bidder)
|
||||
{
|
||||
if (sendNotification) // can be changed in the hook
|
||||
bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template);
|
||||
bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, auction->bidder, 0, 0, auction->item_template);
|
||||
// FIXME: for offline player need also
|
||||
if (updateAchievementCriteria) // can be changed in the hook
|
||||
bidder->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
|
||||
|
|
@ -122,33 +139,31 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
|||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_WON), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, 0, 0))
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder.GetCounter()), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
else
|
||||
sAuctionMgr->RemoveAItem(auction->item_guidlow, true);
|
||||
sAuctionMgr->RemoveAItem(auction->item_guid, true);
|
||||
}
|
||||
|
||||
void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans, bool sendMail)
|
||||
{
|
||||
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
|
||||
Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(owner_guid);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
|
||||
Player* owner = ObjectAccessor::FindConnectedPlayer(auction->owner);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner.GetCounter());
|
||||
// owner exist (online or offline)
|
||||
if (owner || owner_accId)
|
||||
{
|
||||
sScriptMgr->OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(this, auction, owner, owner_accId, sendMail);
|
||||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_SALE_PENDING), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner.GetCounter()), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
//call this method to send mail to auction owner, when auction is successful, it does not clear ram
|
||||
void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification, bool updateAchievementCriteria, bool sendMail)
|
||||
{
|
||||
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
|
||||
Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(owner_guid);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
|
||||
Player* owner = ObjectAccessor::FindConnectedPlayer(auction->owner);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner.GetCounter());
|
||||
// owner exist
|
||||
if (owner || owner_accId)
|
||||
{
|
||||
|
|
@ -170,21 +185,21 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
|
|||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_SUCCESSFUL), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
|
||||
.AddMoney(profit)
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY));
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner.GetCounter()), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY));
|
||||
|
||||
if (auction->bid >= 500 * GOLD)
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(auction->bidder))
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(auction->bidder.GetCounter()))
|
||||
{
|
||||
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
|
||||
Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid);
|
||||
Player* bidder = ObjectAccessor::FindConnectedPlayer(auction->bidder);
|
||||
std::string owner_name = "";
|
||||
uint8 owner_level = 0;
|
||||
if (const GlobalPlayerData* gpd_owner = sWorld->GetGlobalPlayerData(auction->owner))
|
||||
if (const GlobalPlayerData* gpd_owner = sWorld->GetGlobalPlayerData(auction->owner.GetCounter()))
|
||||
{
|
||||
owner_name = gpd_owner->name;
|
||||
owner_level = gpd_owner->level;
|
||||
}
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<AH> profit: %ug, bidder: %s %u lvl (guid: %u), seller: %s %u lvl (guid: %u), item %u (%u)\", NOW())", gpd->accountId, auction->bidder, gpd->name.c_str(), bidder ? bidder->GetSession()->GetRemoteAddress().c_str() : "", owner_accId, owner_name.c_str(), auction->bid, (profit / GOLD), gpd->name.c_str(), gpd->level, auction->bidder, owner_name.c_str(), owner_level, auction->owner, auction->item_template, auction->itemCount);
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<AH> profit: %ug, bidder: %s %u lvl (guid: %u), seller: %s %u lvl (guid: %u), item %u (%u)\", NOW())",
|
||||
gpd->accountId, auction->bidder.GetCounter(), gpd->name.c_str(), bidder ? bidder->GetSession()->GetRemoteAddress().c_str() : "", owner_accId, owner_name.c_str(), auction->bid, (profit / GOLD), gpd->name.c_str(), gpd->level, auction->bidder.GetCounter(), owner_name.c_str(), owner_level, auction->owner.GetCounter(), auction->item_template, auction->itemCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -193,13 +208,12 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
|
|||
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans, bool sendNotification, bool sendMail)
|
||||
{
|
||||
//return an item in auction to its owner by mail
|
||||
Item* pItem = GetAItem(auction->item_guidlow);
|
||||
Item* pItem = GetAItem(auction->item_guid);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
|
||||
Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(owner_guid);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
|
||||
Player* owner = ObjectAccessor::FindConnectedPlayer(auction->owner);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner.GetCounter());
|
||||
|
||||
// owner exist
|
||||
if (owner || owner_accId)
|
||||
|
|
@ -210,23 +224,22 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
|
|||
owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||
|
||||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(ObjectGuid::Empty, 0, auction->buyout, auction->deposit, 0))
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0);
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner.GetCounter()), auction, MAIL_CHECK_MASK_COPIED, 0);
|
||||
}
|
||||
else
|
||||
sAuctionMgr->RemoveAItem(auction->item_guidlow, true);
|
||||
sAuctionMgr->RemoveAItem(auction->item_guid, true);
|
||||
}
|
||||
|
||||
//this function sends mail to old bidder
|
||||
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans, bool sendNotification, bool sendMail)
|
||||
{
|
||||
uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
|
||||
Player* oldBidder = ObjectAccessor::FindPlayerInOrOutOfWorld(oldBidder_guid);
|
||||
Player* oldBidder = ObjectAccessor::FindConnectedPlayer(auction->bidder);
|
||||
|
||||
uint32 oldBidder_accId = 0;
|
||||
if (!oldBidder)
|
||||
oldBidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(oldBidder_guid);
|
||||
oldBidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(auction->bidder.GetCounter());
|
||||
|
||||
// old bidder exist
|
||||
if (oldBidder || oldBidder_accId)
|
||||
|
|
@ -239,19 +252,18 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
|
|||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
|
||||
.AddMoney(auction->bid)
|
||||
.SendMailTo(trans, MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(trans, MailReceiver(oldBidder, auction->bidder.GetCounter()), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
//this function sends mail, when auction is cancelled to old bidder
|
||||
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans, bool sendMail)
|
||||
{
|
||||
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
|
||||
Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid);
|
||||
Player* bidder = ObjectAccessor::FindConnectedPlayer(auction->bidder);
|
||||
|
||||
uint32 bidder_accId = 0;
|
||||
if (!bidder)
|
||||
bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid);
|
||||
bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(auction->bidder.GetCounter());
|
||||
|
||||
// bidder exist
|
||||
if (bidder || bidder_accId)
|
||||
|
|
@ -260,7 +272,7 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ
|
|||
if (sendMail) // can be changed in the hook
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, 0))
|
||||
.AddMoney(auction->bid)
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder.GetCounter()), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,8 +306,8 @@ void AuctionHouseMgr::LoadAuctionItems()
|
|||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 item_guid = fields[11].GetUInt32();
|
||||
uint32 item_template = fields[12].GetUInt32();
|
||||
ObjectGuid::LowType item_guid = fields[11].GetUInt32();
|
||||
uint32 item_template = fields[12].GetUInt32();
|
||||
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template);
|
||||
if (!proto)
|
||||
|
|
@ -305,7 +317,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
|||
}
|
||||
|
||||
Item* item = NewItemOrBag(proto);
|
||||
if (!item->LoadFromDB(item_guid, 0, fields, item_template))
|
||||
if (!item->LoadFromDB(item_guid, ObjectGuid::Empty, fields, item_template))
|
||||
{
|
||||
delete item;
|
||||
continue;
|
||||
|
|
@ -348,7 +360,7 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
continue;
|
||||
}
|
||||
|
||||
GetAuctionsMap(aItem->factionTemplateId)->AddAuction(aItem);
|
||||
GetAuctionsMapByHouseId(aItem->houseId)->AddAuction(aItem);
|
||||
count++;
|
||||
} while (result->NextRow());
|
||||
|
||||
|
|
@ -361,13 +373,13 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
void AuctionHouseMgr::AddAItem(Item* it)
|
||||
{
|
||||
ASSERT(it);
|
||||
ASSERT(mAitems.find(it->GetGUIDLow()) == mAitems.end());
|
||||
mAitems[it->GetGUIDLow()] = it;
|
||||
ASSERT(mAitems.find(it->GetGUID()) == mAitems.end());
|
||||
mAitems[it->GetGUID()] = it;
|
||||
}
|
||||
|
||||
bool AuctionHouseMgr::RemoveAItem(uint32 id, bool deleteFromDB)
|
||||
bool AuctionHouseMgr::RemoveAItem(ObjectGuid itemGuid, bool deleteFromDB)
|
||||
{
|
||||
ItemMap::iterator i = mAitems.find(id);
|
||||
ItemMap::iterator i = mAitems.find(itemGuid);
|
||||
if (i == mAitems.end())
|
||||
return false;
|
||||
|
||||
|
|
@ -393,64 +405,32 @@ void AuctionHouseMgr::Update()
|
|||
|
||||
AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTemplateId)
|
||||
{
|
||||
uint32 houseid = 7; // goblin auction house
|
||||
uint32 houseid = AUCTIONHOUSE_NEUTRAL; // goblin auction house
|
||||
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
{
|
||||
//FIXME: found way for proper auctionhouse selection by another way
|
||||
// AuctionHouse.dbc have faction field with _player_ factions associated with auction house races.
|
||||
// but no easy way convert creature faction to player race faction for specific city
|
||||
switch (factionTemplateId)
|
||||
{
|
||||
case 12:
|
||||
houseid = 1;
|
||||
break; // human
|
||||
case 29:
|
||||
houseid = 6;
|
||||
break; // orc, and generic for horde
|
||||
case 55:
|
||||
houseid = 2;
|
||||
break; // dwarf, and generic for alliance
|
||||
case 68:
|
||||
houseid = 4;
|
||||
break; // undead
|
||||
case 80:
|
||||
houseid = 3;
|
||||
break; // n-elf
|
||||
case 104:
|
||||
houseid = 5;
|
||||
break; // trolls
|
||||
case 120:
|
||||
houseid = 7;
|
||||
break; // booty bay, neutral
|
||||
case 474:
|
||||
houseid = 7;
|
||||
break; // gadgetzan, neutral
|
||||
case 855:
|
||||
houseid = 7;
|
||||
break; // everlook, neutral
|
||||
case 1604:
|
||||
houseid = 6;
|
||||
break; // b-elfs,
|
||||
default: // for unknown case
|
||||
{
|
||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||
if (!u_entry)
|
||||
houseid = 7; // goblin auction house
|
||||
else if (u_entry->ourMask & FACTION_MASK_ALLIANCE)
|
||||
houseid = 1; // human auction house
|
||||
else if (u_entry->ourMask & FACTION_MASK_HORDE)
|
||||
houseid = 6; // orc auction house
|
||||
else
|
||||
houseid = 7; // goblin auction house
|
||||
break;
|
||||
}
|
||||
}
|
||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||
if (!u_entry)
|
||||
houseid = AUCTIONHOUSE_NEUTRAL; // goblin auction house
|
||||
else if (u_entry->ourMask & FACTION_MASK_ALLIANCE)
|
||||
houseid = AUCTIONHOUSE_ALLIANCE; // human auction house
|
||||
else if (u_entry->ourMask & FACTION_MASK_HORDE)
|
||||
houseid = AUCTIONHOUSE_HORDE; // orc auction house
|
||||
else
|
||||
houseid = AUCTIONHOUSE_NEUTRAL; // goblin auction house
|
||||
}
|
||||
|
||||
return sAuctionHouseStore.LookupEntry(houseid);
|
||||
}
|
||||
|
||||
AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntryFromHouse(uint8 houseId)
|
||||
{
|
||||
return (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) ? sAuctionHouseStore.LookupEntry(AUCTIONHOUSE_NEUTRAL) : sAuctionHouseStore.LookupEntry(houseId);
|
||||
}
|
||||
|
||||
void AuctionHouseObject::AddAuction(AuctionEntry* auction)
|
||||
{
|
||||
ASSERT(auction);
|
||||
|
|
@ -492,7 +472,7 @@ void AuctionHouseObject::Update()
|
|||
continue;
|
||||
|
||||
///- Either cancel the auction if there was no bidder
|
||||
if (auction->bidder == 0)
|
||||
if (!auction->bidder)
|
||||
{
|
||||
sAuctionMgr->SendAuctionExpiredMail(auction, trans);
|
||||
sScriptMgr->OnAuctionExpire(this, auction);
|
||||
|
|
@ -511,7 +491,7 @@ void AuctionHouseObject::Update()
|
|||
///- In any case clear the auction
|
||||
auction->DeleteFromDB(trans);
|
||||
|
||||
sAuctionMgr->RemoveAItem(auction->item_guidlow);
|
||||
sAuctionMgr->RemoveAItem(auction->item_guid);
|
||||
RemoveAuction(auction);
|
||||
}
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
|
@ -522,7 +502,7 @@ void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player,
|
|||
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
|
||||
{
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry && Aentry->bidder == player->GetGUIDLow())
|
||||
if (Aentry && Aentry->bidder == player->GetGUID())
|
||||
{
|
||||
if (itr->second->BuildAuctionInfo(data))
|
||||
++count;
|
||||
|
|
@ -537,7 +517,7 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player,
|
|||
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
|
||||
{
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry && Aentry->owner == player->GetGUIDLow())
|
||||
if (Aentry && Aentry->owner == player->GetGUID())
|
||||
{
|
||||
if (Aentry->BuildAuctionInfo(data))
|
||||
++count;
|
||||
|
|
@ -589,7 +569,7 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
|
|||
if (Aentry->expire_time < curTime)
|
||||
continue;
|
||||
|
||||
Item* item = sAuctionMgr->GetAItem(Aentry->item_guidlow);
|
||||
Item* item = sAuctionMgr->GetAItem(Aentry->item_guid);
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
|
|
@ -693,10 +673,10 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
|
|||
//this function inserts to WorldPacket auction's data
|
||||
bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
|
||||
{
|
||||
Item* item = sAuctionMgr->GetAItem(item_guidlow);
|
||||
Item* item = sAuctionMgr->GetAItem(item_guid);
|
||||
if (!item)
|
||||
{
|
||||
LOG_ERROR("server", "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow);
|
||||
LOG_ERROR("server", "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %s", Id, item_guid.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
data << uint32(Id);
|
||||
|
|
@ -714,13 +694,13 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
|
|||
data << uint32(item->GetCount()); // item->count
|
||||
data << uint32(item->GetSpellCharges()); // item->charge FFFFFFF
|
||||
data << uint32(0); // Unknown
|
||||
data << uint64(owner); // Auction->owner
|
||||
data << owner; // Auction->owner
|
||||
data << uint32(startbid); // Auction->startbid (not sure if useful)
|
||||
data << uint32(bid ? GetAuctionOutBid() : 0);
|
||||
// Minimal outbid
|
||||
data << uint32(buyout); // Auction->buyout
|
||||
data << uint32((expire_time - time(nullptr)) * IN_MILLISECONDS); // time left
|
||||
data << uint64(bidder); // auction->bidder current
|
||||
data << uint32((expire_time - time(nullptr)) * IN_MILLISECONDS); // time left
|
||||
data << bidder; // auction->bidder current
|
||||
data << uint32(bid); // current bid
|
||||
return true;
|
||||
}
|
||||
|
|
@ -749,12 +729,12 @@ void AuctionEntry::SaveToDB(SQLTransaction& trans) const
|
|||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AUCTION);
|
||||
stmt->setUInt32(0, Id);
|
||||
stmt->setUInt32(1, auctioneer);
|
||||
stmt->setUInt32(2, item_guidlow);
|
||||
stmt->setUInt32(3, owner);
|
||||
stmt->setUInt8(1, houseId);
|
||||
stmt->setUInt32(2, item_guid.GetCounter());
|
||||
stmt->setUInt32(3, owner.GetCounter());
|
||||
stmt->setUInt32 (4, buyout);
|
||||
stmt->setUInt32(5, uint32(expire_time));
|
||||
stmt->setUInt32(6, bidder);
|
||||
stmt->setUInt32(6, bidder.GetCounter());
|
||||
stmt->setUInt32 (7, bid);
|
||||
stmt->setUInt32 (8, startbid);
|
||||
stmt->setUInt32 (9, deposit);
|
||||
|
|
@ -764,95 +744,35 @@ void AuctionEntry::SaveToDB(SQLTransaction& trans) const
|
|||
bool AuctionEntry::LoadFromDB(Field* fields)
|
||||
{
|
||||
Id = fields[0].GetUInt32();
|
||||
auctioneer = fields[1].GetUInt32();
|
||||
item_guidlow = fields[2].GetUInt32();
|
||||
houseId = fields[1].GetUInt8();
|
||||
item_guid = ObjectGuid::Create<HighGuid::Item>(fields[2].GetUInt32());
|
||||
item_template = fields[3].GetUInt32();
|
||||
itemCount = fields[4].GetUInt32();
|
||||
owner = fields[5].GetUInt32();
|
||||
owner = ObjectGuid::Create<HighGuid::Player>(fields[5].GetUInt32());
|
||||
buyout = fields[6].GetUInt32();
|
||||
expire_time = fields[7].GetUInt32();
|
||||
bidder = fields[8].GetUInt32();
|
||||
bidder = ObjectGuid::Create<HighGuid::Player>(fields[8].GetUInt32());
|
||||
bid = fields[9].GetUInt32();
|
||||
startbid = fields[10].GetUInt32();
|
||||
deposit = fields[11].GetUInt32();
|
||||
|
||||
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer);
|
||||
if (!auctioneerData)
|
||||
{
|
||||
LOG_ERROR("server", "Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
|
||||
if (!auctioneerInfo)
|
||||
{
|
||||
LOG_ERROR("server", "Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
|
||||
return false;
|
||||
}
|
||||
|
||||
factionTemplateId = auctioneerInfo->faction;
|
||||
auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId);
|
||||
auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntryFromHouse(houseId);
|
||||
if (!auctionHouseEntry)
|
||||
{
|
||||
LOG_ERROR("server", "Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
|
||||
LOG_ERROR("server", "Auction %u has invalid house id %u", Id, houseId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if sold item exists for guid
|
||||
// and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
|
||||
if (!sAuctionMgr->GetAItem(item_guidlow))
|
||||
if (!sAuctionMgr->GetAItem(item_guid))
|
||||
{
|
||||
LOG_ERROR("server", "Auction %u has not a existing item : %u", Id, item_guidlow);
|
||||
LOG_ERROR("server", "Auction %u has not a existing item : %s", Id, item_guid.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AuctionEntry::LoadFromFieldList(Field* fields)
|
||||
{
|
||||
// Loads an AuctionEntry item from a field list. Unlike "LoadFromDB()", this one
|
||||
// does not require the AuctionEntryMap to have been loaded with items. It simply
|
||||
// acts as a wrapper to fill out an AuctionEntry struct from a field list
|
||||
|
||||
Id = fields[0].GetUInt32();
|
||||
auctioneer = fields[1].GetUInt32();
|
||||
item_guidlow = fields[2].GetUInt32();
|
||||
item_template = fields[3].GetUInt32();
|
||||
itemCount = fields[4].GetUInt32();
|
||||
owner = fields[5].GetUInt32();
|
||||
buyout = fields[6].GetUInt32();
|
||||
expire_time = fields[7].GetUInt32();
|
||||
bidder = fields[8].GetUInt32();
|
||||
bid = fields[9].GetUInt32();
|
||||
startbid = fields[10].GetUInt32();
|
||||
deposit = fields[11].GetUInt32();
|
||||
|
||||
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer);
|
||||
if (!auctioneerData)
|
||||
{
|
||||
LOG_ERROR("server", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
|
||||
if (!auctioneerInfo)
|
||||
{
|
||||
LOG_ERROR("server", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
|
||||
return false;
|
||||
}
|
||||
|
||||
factionTemplateId = auctioneerInfo->faction;
|
||||
auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId);
|
||||
|
||||
if (!auctionHouseEntry)
|
||||
{
|
||||
LOG_ERROR("server", "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const
|
||||
{
|
||||
std::ostringstream strm;
|
||||
|
|
@ -860,11 +780,11 @@ std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) c
|
|||
return strm.str();
|
||||
}
|
||||
|
||||
std::string AuctionEntry::BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut)
|
||||
std::string AuctionEntry::BuildAuctionMailBody(ObjectGuid guid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut)
|
||||
{
|
||||
std::ostringstream strm;
|
||||
strm.width(16);
|
||||
strm << std::right << std::hex << MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); // HIGHGUID_PLAYER always present, even for empty guids
|
||||
strm << guid.ToString();
|
||||
strm << std::dec << ':' << bid << ':' << buyout;
|
||||
strm << ':' << deposit << ':' << cut;
|
||||
return strm.str();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "DatabaseEnv.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "EventProcessor.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
class Item;
|
||||
|
|
@ -50,35 +51,39 @@ enum MailAuctionAnswers
|
|||
AUCTION_SALE_PENDING = 6
|
||||
};
|
||||
|
||||
enum AuctionHouses
|
||||
{
|
||||
AUCTIONHOUSE_ALLIANCE = 2,
|
||||
AUCTIONHOUSE_HORDE = 6,
|
||||
AUCTIONHOUSE_NEUTRAL = 7
|
||||
};
|
||||
|
||||
struct AuctionEntry
|
||||
{
|
||||
uint32 Id;
|
||||
uint32 auctioneer; // creature low guid
|
||||
uint32 item_guidlow;
|
||||
uint8 houseId;
|
||||
ObjectGuid item_guid;
|
||||
uint32 item_template;
|
||||
uint32 itemCount;
|
||||
uint32 owner;
|
||||
ObjectGuid owner;
|
||||
uint32 startbid; //maybe useless
|
||||
uint32 bid;
|
||||
uint32 buyout;
|
||||
time_t expire_time;
|
||||
uint32 bidder;
|
||||
ObjectGuid bidder;
|
||||
uint32 deposit; //deposit can be calculated only when creating auction
|
||||
AuctionHouseEntry const* auctionHouseEntry; // in AuctionHouse.dbc
|
||||
uint32 factionTemplateId;
|
||||
|
||||
// helpers
|
||||
[[nodiscard]] uint32 GetHouseId() const { return auctionHouseEntry->houseId; }
|
||||
[[nodiscard]] uint32 GetHouseFaction() const { return auctionHouseEntry->faction; }
|
||||
[[nodiscard]] uint8 GetHouseId() const { return houseId; }
|
||||
[[nodiscard]] uint32 GetAuctionCut() const;
|
||||
[[nodiscard]] uint32 GetAuctionOutBid() const;
|
||||
bool BuildAuctionInfo(WorldPacket& data) const;
|
||||
void DeleteFromDB(SQLTransaction& trans) const;
|
||||
void SaveToDB(SQLTransaction& trans) const;
|
||||
bool LoadFromDB(Field* fields);
|
||||
bool LoadFromFieldList(Field* fields);
|
||||
[[nodiscard]] std::string BuildAuctionMailSubject(MailAuctionAnswers response) const;
|
||||
static std::string BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut);
|
||||
static std::string BuildAuctionMailBody(ObjectGuid guid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut);
|
||||
};
|
||||
|
||||
//this class is used as auctionhouse instance
|
||||
|
|
@ -133,16 +138,17 @@ private:
|
|||
~AuctionHouseMgr();
|
||||
|
||||
public:
|
||||
typedef std::unordered_map<uint32, Item*> ItemMap;
|
||||
typedef std::unordered_map<ObjectGuid, Item*> ItemMap;
|
||||
|
||||
static AuctionHouseMgr* instance();
|
||||
|
||||
AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId);
|
||||
AuctionHouseObject* GetAuctionsMapByHouseId(uint8 auctionHouseId);
|
||||
AuctionHouseObject* GetBidsMap(uint32 factionTemplateId);
|
||||
|
||||
Item* GetAItem(uint32 id)
|
||||
Item* GetAItem(ObjectGuid itemGuid)
|
||||
{
|
||||
ItemMap::const_iterator itr = mAitems.find(id);
|
||||
ItemMap::const_iterator itr = mAitems.find(itemGuid);
|
||||
if (itr != mAitems.end())
|
||||
return itr->second;
|
||||
|
||||
|
|
@ -159,6 +165,7 @@ public:
|
|||
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntryFromHouse(uint8 houseId);
|
||||
|
||||
public:
|
||||
//load first auction items, because of check if item exists, when loading
|
||||
|
|
@ -166,7 +173,7 @@ public:
|
|||
void LoadAuctions();
|
||||
|
||||
void AddAItem(Item* it);
|
||||
bool RemoveAItem(uint32 id, bool deleteFromDB = false);
|
||||
bool RemoveAItem(ObjectGuid itemGuid, bool deleteFromDB = false);
|
||||
|
||||
void Update();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ Battlefield::Battlefield()
|
|||
m_TypeId = 0;
|
||||
m_BattleId = 0;
|
||||
m_ZoneId = 0;
|
||||
m_Map = nullptr;
|
||||
m_MapId = 0;
|
||||
m_MaxPlayer = 0;
|
||||
m_MinPlayer = 0;
|
||||
|
|
@ -45,13 +46,12 @@ Battlefield::Battlefield()
|
|||
m_LastResurectTimer = RESURRECTION_INTERVAL;
|
||||
m_StartGroupingTimer = 0;
|
||||
m_StartGrouping = false;
|
||||
StalkerGuid = 0;
|
||||
}
|
||||
|
||||
Battlefield::~Battlefield()
|
||||
{
|
||||
for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
delete itr->second;
|
||||
for (BfCapturePointVector::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
delete *itr;
|
||||
|
||||
for (GraveyardVect::const_iterator itr = m_GraveyardList.begin(); itr != m_GraveyardList.end(); ++itr)
|
||||
delete *itr;
|
||||
|
|
@ -110,8 +110,8 @@ void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
|
|||
}
|
||||
}
|
||||
|
||||
for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
itr->second->HandlePlayerLeave(player);
|
||||
for (BfCapturePointVector::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
(*itr)->HandlePlayerLeave(player);
|
||||
|
||||
m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
|
||||
m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
|
||||
|
|
@ -182,8 +182,8 @@ bool Battlefield::Update(uint32 diff)
|
|||
else
|
||||
m_uiKickDontAcceptTimer -= diff;
|
||||
|
||||
for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->Update(diff))
|
||||
for (BfCapturePointVector::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if ((*itr)->Update(diff))
|
||||
objective_changed = true;
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ bool Battlefield::Update(uint32 diff)
|
|||
void Battlefield::InvitePlayersInZoneToQueue()
|
||||
{
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
InvitePlayerToQueue(player);
|
||||
}
|
||||
|
|
@ -221,8 +221,8 @@ void Battlefield::InvitePlayersInQueueToWar()
|
|||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
{
|
||||
GuidSet copy(m_PlayersInQueue[team]);
|
||||
for (GuidSet::const_iterator itr = copy.begin(); itr != copy.end(); ++itr)
|
||||
GuidUnorderedSet copy(m_PlayersInQueue[team]);
|
||||
for (GuidUnorderedSet::const_iterator itr = copy.begin(); itr != copy.end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
|
|
@ -241,7 +241,7 @@ void Battlefield::InvitePlayersInQueueToWar()
|
|||
void Battlefield::InvitePlayersInZoneToWar()
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
|
|
@ -299,13 +299,13 @@ void Battlefield::KickAfkPlayers()
|
|||
{
|
||||
// xinef: optimization, dont lookup player twice
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (player->isAFK() && player->GetZoneId() == GetZoneId() && !player->IsGameMaster())
|
||||
player->TeleportTo(KickPosition);
|
||||
}
|
||||
|
||||
void Battlefield::KickPlayerFromBattlefield(uint64 guid)
|
||||
void Battlefield::KickPlayerFromBattlefield(ObjectGuid guid)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
|
|
@ -367,7 +367,7 @@ void Battlefield::DoPlaySoundToAll(uint32 SoundID)
|
|||
data << uint32(SoundID);
|
||||
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
@ -423,13 +423,13 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
|
|||
{
|
||||
if (spellId > 0)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->CastSpell(player, uint32(spellId), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->RemoveAuraFromStack(uint32(-spellId));
|
||||
}
|
||||
|
|
@ -438,7 +438,7 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
|
|||
void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
@ -446,7 +446,7 @@ void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
|
|||
void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
@ -454,22 +454,23 @@ void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
|
|||
void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Battlefield::SendWarningToAllInZone(uint32 entry)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(StalkerGuid))
|
||||
if (Creature* stalker = unit->ToCreature())
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
|
||||
if (Map* map = sMapMgr->CreateBaseMap(m_MapId))
|
||||
if (Unit* unit = map->GetCreature(StalkerGuid))
|
||||
if (Creature* stalker = unit->ToCreature())
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
|
||||
}
|
||||
|
||||
void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
|
||||
{
|
||||
if (player)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(StalkerGuid))
|
||||
if (Unit* unit = ObjectAccessor::GetCreature(*player, StalkerGuid))
|
||||
if (Creature* stalker = unit->ToCreature())
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, player);
|
||||
}
|
||||
|
|
@ -477,7 +478,7 @@ void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
|
|||
void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
{
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
for (GuidUnorderedSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendUpdateWorldState(field, value);
|
||||
}
|
||||
|
|
@ -518,18 +519,18 @@ void Battlefield::ShowNpc(Creature* creature, bool aggressive)
|
|||
// ****************************************************
|
||||
Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
||||
for (GuidUnorderedSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
|
||||
if (!group->IsFull())
|
||||
return group;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
|
||||
Group* Battlefield::GetGroupPlayer(ObjectGuid guid, TeamId TeamId)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
||||
for (GuidUnorderedSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
|
||||
if (group->IsMember(guid))
|
||||
return group;
|
||||
|
||||
|
|
@ -617,7 +618,7 @@ GraveyardStruct const* Battlefield::GetClosestGraveyard(Player* player)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
|
||||
void Battlefield::AddPlayerToResurrectQueue(ObjectGuid npcGuid, ObjectGuid playerGuid)
|
||||
{
|
||||
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||
{
|
||||
|
|
@ -632,7 +633,7 @@ void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
|
|||
}
|
||||
}
|
||||
|
||||
void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
|
||||
void Battlefield::RemovePlayerFromResurrectQueue(ObjectGuid playerGuid)
|
||||
{
|
||||
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||
{
|
||||
|
|
@ -647,7 +648,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
|
|||
}
|
||||
}
|
||||
|
||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64& guid)
|
||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const ObjectGuid& guid)
|
||||
{
|
||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||
uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
|
||||
|
|
@ -665,8 +666,6 @@ BfGraveyard::BfGraveyard(Battlefield* battlefield)
|
|||
m_Bf = battlefield;
|
||||
m_GraveyardId = 0;
|
||||
m_ControlTeam = TEAM_NEUTRAL;
|
||||
m_SpiritGuide[0] = 0;
|
||||
m_SpiritGuide[1] = 0;
|
||||
m_ResurrectQueue.clear();
|
||||
}
|
||||
|
||||
|
|
@ -694,7 +693,7 @@ float BfGraveyard::GetDistance(Player* player)
|
|||
return player->GetDistance2d(safeLoc->x, safeLoc->y);
|
||||
}
|
||||
|
||||
void BfGraveyard::AddPlayer(uint64 playerGuid)
|
||||
void BfGraveyard::AddPlayer(ObjectGuid playerGuid)
|
||||
{
|
||||
if (!m_ResurrectQueue.count(playerGuid))
|
||||
{
|
||||
|
|
@ -705,7 +704,7 @@ void BfGraveyard::AddPlayer(uint64 playerGuid)
|
|||
}
|
||||
}
|
||||
|
||||
void BfGraveyard::RemovePlayer(uint64 playerGuid)
|
||||
void BfGraveyard::RemovePlayer(ObjectGuid playerGuid)
|
||||
{
|
||||
m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
|
||||
|
||||
|
|
@ -718,7 +717,7 @@ void BfGraveyard::Resurrect()
|
|||
if (m_ResurrectQueue.empty())
|
||||
return;
|
||||
|
||||
for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
{
|
||||
// Get player object from his guid
|
||||
Player* player = ObjectAccessor::FindPlayer(*itr);
|
||||
|
|
@ -727,7 +726,7 @@ void BfGraveyard::Resurrect()
|
|||
|
||||
// Check if the player is in world and on the good graveyard
|
||||
if (player->IsInWorld())
|
||||
if (Unit* spirit = ObjectAccessor::FindUnit(m_SpiritGuide[m_ControlTeam]))
|
||||
if (Unit* spirit = ObjectAccessor::GetCreature(*player, m_SpiritGuide[m_ControlTeam]))
|
||||
spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
|
||||
|
||||
// Resurect player
|
||||
|
|
@ -736,7 +735,7 @@ void BfGraveyard::Resurrect()
|
|||
player->CastSpell(player, 6962, true);
|
||||
player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
|
||||
|
||||
sObjectAccessor->ConvertCorpseForPlayer(player->GetGUID());
|
||||
player->SpawnCorpseBones(false);
|
||||
}
|
||||
|
||||
m_ResurrectQueue.clear();
|
||||
|
|
@ -753,7 +752,7 @@ void BfGraveyard::GiveControlTo(TeamId team)
|
|||
void BfGraveyard::RelocateDeadPlayers()
|
||||
{
|
||||
GraveyardStruct const* closestGrave = nullptr;
|
||||
for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(*itr);
|
||||
if (!player)
|
||||
|
|
@ -792,7 +791,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
|||
}
|
||||
|
||||
Creature* creature = new Creature(true);
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
|
||||
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
|
||||
{
|
||||
LOG_ERROR("server", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
|
||||
delete creature;
|
||||
|
|
@ -828,7 +827,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
|
|||
|
||||
// Create gameobject
|
||||
GameObject* go = sObjectMgr->IsGameObjectStaticTransport(entry) ? new StaticTransport() : new GameObject();
|
||||
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(), 100, GO_STATE_READY))
|
||||
if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), entry, map, PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(), 100, GO_STATE_READY))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
|
||||
LOG_ERROR("server", "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
|
||||
|
|
@ -843,11 +842,27 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
|
|||
return go;
|
||||
}
|
||||
|
||||
Creature* Battlefield::GetCreature(ObjectGuid const guid)
|
||||
{
|
||||
if (!m_Map)
|
||||
return nullptr;
|
||||
|
||||
return m_Map->GetCreature(guid);
|
||||
}
|
||||
|
||||
GameObject* Battlefield::GetGameObject(ObjectGuid const guid)
|
||||
{
|
||||
if (!m_Map)
|
||||
return nullptr;
|
||||
|
||||
return m_Map->GetGameObject(guid);
|
||||
}
|
||||
|
||||
// *******************************************************
|
||||
// ******************* CapturePoint **********************
|
||||
// *******************************************************
|
||||
|
||||
BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(0)
|
||||
BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield)
|
||||
{
|
||||
m_team = TEAM_NEUTRAL;
|
||||
m_value = 0;
|
||||
|
|
@ -871,12 +886,12 @@ bool BfCapturePoint::HandlePlayerEnter(Player* player)
|
|||
return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
|
||||
}
|
||||
|
||||
GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
|
||||
GuidUnorderedSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
|
||||
{
|
||||
if (GameObject* go = GetCapturePointGo(player))
|
||||
player->SendUpdateWorldState(go->GetGOInfo()->capturePoint.worldState1, 0);
|
||||
|
||||
GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
|
||||
GuidUnorderedSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
|
||||
|
||||
if (current == m_activePlayers[player->GetTeamId()].end())
|
||||
return current; // return end()
|
||||
|
|
@ -892,7 +907,7 @@ void BfCapturePoint::SendChangePhase()
|
|||
return;
|
||||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
for (GuidUnorderedSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
|
|
@ -948,12 +963,22 @@ bool BfCapturePoint::DelCapturePoint()
|
|||
{
|
||||
capturePoint->SetRespawnTime(0); // not save respawn time
|
||||
capturePoint->Delete();
|
||||
m_capturePoint = 0;
|
||||
m_capturePoint.Clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GameObject* BfCapturePoint::GetCapturePointGo()
|
||||
{
|
||||
return m_Bf->GetGameObject(m_capturePoint);
|
||||
}
|
||||
|
||||
GameObject* BfCapturePoint::GetCapturePointGo(WorldObject* obj)
|
||||
{
|
||||
return ObjectAccessor::GetGameObject(*obj, m_capturePoint);
|
||||
}
|
||||
|
||||
bool BfCapturePoint::Update(uint32 diff)
|
||||
{
|
||||
GameObject* capturePoint = GetCapturePointGo();
|
||||
|
|
@ -964,7 +989,7 @@ bool BfCapturePoint::Update(uint32 diff)
|
|||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
{
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
||||
for (GuidUnorderedSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (!capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
|
||||
|
|
@ -1076,12 +1101,12 @@ bool BfCapturePoint::Update(uint32 diff)
|
|||
void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
{
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
for (GuidUnorderedSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendUpdateWorldState(field, value);
|
||||
}
|
||||
|
||||
void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
|
||||
void BfCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid)
|
||||
{
|
||||
uint8 team;
|
||||
switch (m_State)
|
||||
|
|
@ -1097,7 +1122,7 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
|
|||
}
|
||||
|
||||
// send to all players present in the area
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->KilledMonsterCredit(id, guid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,9 +65,8 @@ class Unit;
|
|||
class Battlefield;
|
||||
class BfGraveyard;
|
||||
|
||||
typedef std::unordered_set<uint64> GuidSet;
|
||||
typedef std::vector<BfGraveyard*> GraveyardVect;
|
||||
typedef std::map<uint64, time_t> PlayerTimerMap;
|
||||
typedef std::map<ObjectGuid, time_t> PlayerTimerMap;
|
||||
|
||||
class BfCapturePoint
|
||||
{
|
||||
|
|
@ -82,11 +81,11 @@ public:
|
|||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
|
||||
// Send kill notify to players in the controlling faction
|
||||
void SendObjectiveComplete(uint32 id, uint64 guid);
|
||||
void SendObjectiveComplete(uint32 id, ObjectGuid guid);
|
||||
|
||||
// Used when player is activated/inactivated in the area
|
||||
virtual bool HandlePlayerEnter(Player* player);
|
||||
virtual GuidSet::iterator HandlePlayerLeave(Player* player);
|
||||
virtual GuidUnorderedSet::iterator HandlePlayerLeave(Player* player);
|
||||
//virtual void HandlePlayerActivityChanged(Player* player);
|
||||
|
||||
// Checks if player is in range of a capture credit marker
|
||||
|
|
@ -98,15 +97,15 @@ public:
|
|||
virtual void SendChangePhase();
|
||||
|
||||
bool SetCapturePointData(GameObject* capturePoint);
|
||||
GameObject* GetCapturePointGo() { return ObjectAccessor::GetObjectInWorld(m_capturePoint, (GameObject*)nullptr); }
|
||||
GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); }
|
||||
GameObject* GetCapturePointGo();
|
||||
GameObject* GetCapturePointGo(WorldObject* obj);
|
||||
|
||||
TeamId GetTeamId() { return m_team; }
|
||||
protected:
|
||||
bool DelCapturePoint();
|
||||
|
||||
// active Players in the area of the objective, 0 - alliance, 1 - horde
|
||||
GuidSet m_activePlayers[2];
|
||||
GuidUnorderedSet m_activePlayers[2];
|
||||
|
||||
// Total shift needed to capture the objective
|
||||
float m_maxValue;
|
||||
|
|
@ -133,7 +132,7 @@ protected:
|
|||
uint32 m_capturePointEntry;
|
||||
|
||||
// Gameobject related to that capture point
|
||||
uint64 m_capturePoint;
|
||||
ObjectGuid m_capturePoint;
|
||||
};
|
||||
|
||||
class BfGraveyard
|
||||
|
|
@ -155,10 +154,10 @@ public:
|
|||
void SetSpirit(Creature* spirit, TeamId team);
|
||||
|
||||
// Add a player to the graveyard
|
||||
void AddPlayer(uint64 player_guid);
|
||||
void AddPlayer(ObjectGuid player_guid);
|
||||
|
||||
// Remove a player from the graveyard
|
||||
void RemovePlayer(uint64 player_guid);
|
||||
void RemovePlayer(ObjectGuid player_guid);
|
||||
|
||||
// Resurrect players
|
||||
void Resurrect();
|
||||
|
|
@ -167,7 +166,7 @@ public:
|
|||
void RelocateDeadPlayers();
|
||||
|
||||
// Check if this graveyard has a spirit guide
|
||||
bool HasNpc(uint64 guid)
|
||||
bool HasNpc(ObjectGuid guid)
|
||||
{
|
||||
if (!m_SpiritGuide[0] && !m_SpiritGuide[1])
|
||||
return false;
|
||||
|
|
@ -181,7 +180,7 @@ public:
|
|||
}
|
||||
|
||||
// Check if a player is in this graveyard's resurrect queue
|
||||
bool HasPlayer(uint64 guid) const { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
|
||||
bool HasPlayer(ObjectGuid guid) const { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
|
||||
|
||||
// Get the graveyard's ID.
|
||||
uint32 GetGraveyardId() const { return m_GraveyardId; }
|
||||
|
|
@ -189,8 +188,8 @@ public:
|
|||
protected:
|
||||
TeamId m_ControlTeam;
|
||||
uint32 m_GraveyardId;
|
||||
uint64 m_SpiritGuide[2];
|
||||
GuidSet m_ResurrectQueue;
|
||||
ObjectGuid m_SpiritGuide[2];
|
||||
GuidUnorderedSet m_ResurrectQueue;
|
||||
Battlefield* m_Bf;
|
||||
};
|
||||
|
||||
|
|
@ -205,7 +204,7 @@ public:
|
|||
~Battlefield() override;
|
||||
|
||||
/// typedef of map witch store capturepoint and the associate gameobject entry
|
||||
typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
|
||||
typedef std::vector<BfCapturePoint*> BfCapturePointVector;
|
||||
|
||||
/// Call this to init the Battlefield
|
||||
virtual bool SetupBattlefield() { return true; }
|
||||
|
|
@ -249,7 +248,7 @@ public:
|
|||
* \brief Kick player from battlefield and teleport him to kick-point location
|
||||
* \param guid : guid of player who must be kick
|
||||
*/
|
||||
void KickPlayerFromBattlefield(uint64 guid);
|
||||
void KickPlayerFromBattlefield(ObjectGuid guid);
|
||||
|
||||
/// Called when player (player) enter in zone
|
||||
void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||
|
|
@ -278,7 +277,7 @@ public:
|
|||
*/
|
||||
Group* GetFreeBfRaid(TeamId TeamId);
|
||||
/// Return battlefield group where player is.
|
||||
Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
|
||||
Group* GetGroupPlayer(ObjectGuid guid, TeamId TeamId);
|
||||
/// Force player to join a battlefield group
|
||||
bool AddOrSetPlayerToCorrectBfGroup(Player* player);
|
||||
|
||||
|
|
@ -286,8 +285,8 @@ public:
|
|||
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
|
||||
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void RemovePlayerFromResurrectQueue(uint64 player_guid);
|
||||
virtual void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid);
|
||||
void RemovePlayerFromResurrectQueue(ObjectGuid player_guid);
|
||||
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
|
||||
BfGraveyard* GetGraveyardById(uint32 id) const;
|
||||
|
||||
|
|
@ -296,6 +295,9 @@ public:
|
|||
Creature* SpawnCreature(uint32 entry, Position pos, TeamId teamId);
|
||||
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
|
||||
|
||||
Creature* GetCreature(ObjectGuid const guid);
|
||||
GameObject* GetGameObject(ObjectGuid const guid);
|
||||
|
||||
// Script-methods
|
||||
|
||||
/// Called on start
|
||||
|
|
@ -331,7 +333,7 @@ public:
|
|||
/// Return if we can use mount in battlefield
|
||||
bool CanFlyIn() { return !m_isActive; }
|
||||
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64& guid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, const ObjectGuid& guid);
|
||||
|
||||
void StartBattle();
|
||||
void EndBattle(bool endByTimer);
|
||||
|
|
@ -352,19 +354,19 @@ public:
|
|||
void InitStalker(uint32 entry, float x, float y, float z, float o);
|
||||
|
||||
protected:
|
||||
uint64 StalkerGuid;
|
||||
ObjectGuid StalkerGuid;
|
||||
uint32 m_Timer; // Global timer for event
|
||||
bool m_IsEnabled;
|
||||
bool m_isActive;
|
||||
TeamId m_DefenderTeam;
|
||||
|
||||
// Map of the objectives belonging to this OutdoorPvP
|
||||
BfCapturePointMap m_capturePoints;
|
||||
BfCapturePointVector m_capturePoints;
|
||||
|
||||
// Players info maps
|
||||
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
||||
GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
|
||||
GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
|
||||
GuidUnorderedSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
||||
GuidUnorderedSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
|
||||
GuidUnorderedSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
|
||||
PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
|
||||
PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
|
||||
|
||||
|
|
@ -373,6 +375,7 @@ protected:
|
|||
uint32 m_BattleId; // BattleID (for packet)
|
||||
uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
|
||||
uint32 m_MapId; // MapId where is Battlefield
|
||||
Map* m_Map;
|
||||
uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
|
||||
uint32 m_MinPlayer; // Minimum number of player for Battlefield start
|
||||
uint32 m_MinLevel; // Required level to participate at Battlefield
|
||||
|
|
@ -392,7 +395,7 @@ protected:
|
|||
uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
|
||||
bool m_StartGrouping; // bool for know if all players in area has been invited
|
||||
|
||||
GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
|
||||
GuidUnorderedSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
|
||||
|
||||
std::vector<uint64> m_Data64;
|
||||
std::vector<uint32> m_Data32;
|
||||
|
|
@ -408,15 +411,7 @@ protected:
|
|||
void BroadcastPacketToWar(WorldPacket& data) const;
|
||||
|
||||
// CapturePoint system
|
||||
void AddCapturePoint(BfCapturePoint* cp, GameObject* go) { m_capturePoints[go->GetEntry()] = cp; }
|
||||
|
||||
BfCapturePoint* GetCapturePoint(uint32 lowguid) const
|
||||
{
|
||||
Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
|
||||
if (itr != m_capturePoints.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints.push_back(cp); }
|
||||
|
||||
void RegisterZone(uint32 zoneid);
|
||||
bool HasPlayer(Player* player) const;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
|
|||
|
||||
itr->second->HandlePlayerEnterZone(player, zoneid);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("bg.battlefield", "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
|
||||
LOG_DEBUG("bg.battlefield", "Player %s entered outdoorpvp id %u", player->GetGUID().ToString().c_str(), itr->second->GetTypeId());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ void BattlefieldMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
|
|||
return;
|
||||
itr->second->HandlePlayerLeaveZone(player, zoneid);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("bg.battlefield", "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
|
||||
LOG_DEBUG("bg.battlefield", "Player %s left outdoorpvp id %u", player->GetGUID().ToString().c_str(), itr->second->GetTypeId());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
void Update(uint32 diff);
|
||||
|
||||
void HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
|
||||
void HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid);
|
||||
|
||||
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems gso);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// TODO: Add proper implement of achievement
|
||||
|
||||
#include "BattlefieldWG.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
|
|
@ -32,6 +33,7 @@ bool BattlefieldWG::SetupBattlefield()
|
|||
m_BattleId = BATTLEFIELD_BATTLEID_WG;
|
||||
m_ZoneId = BATTLEFIELD_WG_ZONEID;
|
||||
m_MapId = BATTLEFIELD_WG_MAPID;
|
||||
m_Map = sMapMgr->FindMap(m_MapId, 0);
|
||||
|
||||
// init stalker AFTER setting map id... we spawn it at map=random memory value?...
|
||||
InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
|
||||
|
|
@ -49,7 +51,7 @@ bool BattlefieldWG::SetupBattlefield()
|
|||
m_StartGrouping = false;
|
||||
|
||||
m_tenacityStack = 0;
|
||||
m_titansRelic = 0;
|
||||
m_titansRelic.Clear();
|
||||
|
||||
KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
|
||||
KickPosition.m_mapId = m_MapId;
|
||||
|
|
@ -121,10 +123,9 @@ bool BattlefieldWG::SetupBattlefield()
|
|||
}
|
||||
|
||||
// Hide NPCs from the Attacker's team in the keep
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
for (GuidUnorderedSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
HideNpc(creature);
|
||||
|
||||
// Spawn Horde NPCs outside the keep
|
||||
for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
|
||||
|
|
@ -137,10 +138,9 @@ bool BattlefieldWG::SetupBattlefield()
|
|||
OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
|
||||
|
||||
// Hide units outside the keep that are defenders
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
for (GuidUnorderedSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
HideNpc(creature);
|
||||
|
||||
// Spawn turrets and hide them per default
|
||||
for (uint8 i = 0; i < WG_MAX_TURRET; i++)
|
||||
|
|
@ -223,15 +223,12 @@ void BattlefieldWG::OnBattleStart()
|
|||
LOG_ERROR("server", "WG: Failed to spawn titan relic.");
|
||||
|
||||
// Update tower visibility and update faction
|
||||
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
{
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
ShowNpc(creature, true);
|
||||
creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
|
||||
}
|
||||
ShowNpc(creature, true);
|
||||
creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +252,7 @@ void BattlefieldWG::OnBattleStart()
|
|||
(*itr)->UpdateGraveyardAndWorkshop();
|
||||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
{
|
||||
// Kick player in orb room, TODO: offline player ?
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
|
|
@ -308,7 +305,7 @@ void BattlefieldWG::UpdateCounterVehicle(bool init)
|
|||
void BattlefieldWG::UpdateVehicleCountWG()
|
||||
{
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
for (GuidUnorderedSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
|
||||
|
|
@ -321,7 +318,7 @@ void BattlefieldWG::UpdateVehicleCountWG()
|
|||
void BattlefieldWG::CapturePointTaken(uint32 areaId)
|
||||
{
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
for (GuidUnorderedSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (player->GetAreaId() == areaId)
|
||||
player->UpdateAreaDependentAuras(areaId);
|
||||
|
|
@ -332,43 +329,37 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
|||
// Remove relic
|
||||
if (GameObject* go = GetRelic())
|
||||
go->RemoveFromWorld();
|
||||
m_titansRelic = 0;
|
||||
|
||||
m_titansRelic.Clear();
|
||||
|
||||
// Remove turret
|
||||
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
{
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
if (!endByTimer)
|
||||
creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
|
||||
HideNpc(creature);
|
||||
}
|
||||
if (!endByTimer)
|
||||
creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
|
||||
HideNpc(creature);
|
||||
}
|
||||
}
|
||||
|
||||
// Change all npc in keep
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
for (GuidUnorderedSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
HideNpc(creature);
|
||||
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
ShowNpc(creature, true);
|
||||
for (GuidUnorderedSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
ShowNpc(creature, true);
|
||||
|
||||
// Change all npc out of keep
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
for (GuidUnorderedSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
HideNpc(creature);
|
||||
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
ShowNpc(creature, true);
|
||||
for (GuidUnorderedSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
ShowNpc(creature, true);
|
||||
|
||||
// Update all graveyard, control is to defender when no wartime
|
||||
for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++)
|
||||
|
|
@ -398,10 +389,9 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
|||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
creature->DespawnOrUnsummon(1);
|
||||
for (GuidUnorderedSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
creature->DespawnOrUnsummon(1);
|
||||
|
||||
m_vehicles[team].clear();
|
||||
}
|
||||
|
|
@ -425,7 +415,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
|||
spellFullAtt = SPELL_DESTROYED_TOWER;
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
|
|
@ -443,7 +433,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
|||
}
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
player->CastSpell(player, SPELL_DEFEAT_REWARD, true);
|
||||
|
|
@ -459,7 +449,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
|||
{
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
|
|
@ -682,7 +672,7 @@ void BattlefieldWG::OnGameObjectCreate(GameObject* go)
|
|||
|
||||
capturePoint->SetCapturePointData(go);
|
||||
capturePoint->LinkToWorkshop(workshop);
|
||||
AddCapturePoint(capturePoint, go);
|
||||
AddCapturePoint(capturePoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -700,7 +690,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
|||
// xinef: tower cannons also grant rank
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (player->GetDistance2d(killer) < 40)
|
||||
PromotePlayer(player);
|
||||
|
|
@ -712,10 +702,10 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
|||
else if (victim->IsVehicle() && !killer->IsFriendlyTo(victim))
|
||||
{
|
||||
// Quest - Wintergrasp - PvP Kill - Vehicle
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (player->GetDistance2d(killer) < 40)
|
||||
player->KilledMonsterCredit(NPC_QUEST_PVP_KILL_VEHICLE, 0);
|
||||
player->KilledMonsterCredit(NPC_QUEST_PVP_KILL_VEHICLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -918,7 +908,7 @@ void BattlefieldWG::SendInitWorldStatesTo(Player* player)
|
|||
void BattlefieldWG::SendInitWorldStatesToAll()
|
||||
{
|
||||
for (uint8 team = 0; team < 2; team++)
|
||||
for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
SendInitWorldStatesTo(player);
|
||||
}
|
||||
|
|
@ -928,7 +918,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
|
|||
// might be some use for this in the future. old code commented out below. KL
|
||||
/* if (team == GetDefenderTeam())
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
|
||||
|
|
@ -947,17 +937,17 @@ void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team, GameObject* go)
|
|||
UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 1);
|
||||
|
||||
// Remove buff stack on attackers
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->RemoveAuraFromStack(SPELL_TOWER_CONTROL);
|
||||
|
||||
// Add buff stack to defenders
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
// Quest - Wintergrasp - Southern Tower Kill
|
||||
if (go && player->GetDistance2d(go) < 200.0f)
|
||||
player->KilledMonsterCredit(NPC_QUEST_SOUTHERN_TOWER_KILL, 0);
|
||||
player->KilledMonsterCredit(NPC_QUEST_SOUTHERN_TOWER_KILL);
|
||||
|
||||
player->CastSpell(player, SPELL_TOWER_CONTROL, true);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_LEANING_TOWER_ACHIEVEMENT, 0, 0);
|
||||
|
|
@ -976,12 +966,12 @@ void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team, GameObject* go)
|
|||
else
|
||||
{
|
||||
// Xinef: rest of structures, quest credit
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
// Quest - Wintergrasp - Vehicle Protected
|
||||
if (go && player->GetDistance2d(go) < 100.0f)
|
||||
player->KilledMonsterCredit(NPC_QUEST_VEHICLE_PROTECTED, 0);
|
||||
player->KilledMonsterCredit(NPC_QUEST_VEHICLE_PROTECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1053,7 +1043,7 @@ void BattlefieldWG::AddUpdateTenacity(Player* player)
|
|||
void BattlefieldWG::RemoveUpdateTenacity(Player* player)
|
||||
{
|
||||
m_updateTenacityList.erase(player->GetGUID());
|
||||
m_updateTenacityList.insert(0);
|
||||
m_updateTenacityList.insert(ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
void BattlefieldWG::UpdateTenacity()
|
||||
|
|
@ -1074,7 +1064,7 @@ void BattlefieldWG::UpdateTenacity()
|
|||
// Return if no change in stack and apply tenacity to new player
|
||||
if (newStack == m_tenacityStack)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_updateTenacityList.begin(); itr != m_updateTenacityList.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_updateTenacityList.begin(); itr != m_updateTenacityList.end(); ++itr)
|
||||
if (Player* newPlayer = ObjectAccessor::FindPlayer(*itr))
|
||||
if ((newPlayer->GetTeamId() == TEAM_ALLIANCE && m_tenacityStack > 0) || (newPlayer->GetTeamId() == TEAM_HORDE && m_tenacityStack < 0))
|
||||
{
|
||||
|
|
@ -1099,13 +1089,13 @@ void BattlefieldWG::UpdateTenacity()
|
|||
// Remove old buff
|
||||
if (team != TEAM_NEUTRAL)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
unit->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE);
|
||||
for (GuidUnorderedSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE);
|
||||
}
|
||||
|
||||
// Apply new buff
|
||||
|
|
@ -1115,7 +1105,7 @@ void BattlefieldWG::UpdateTenacity()
|
|||
newStack = std::min(abs(newStack), 20);
|
||||
uint32 buff_honor = GetHonorBuff(newStack);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
player->SetAuraStack(SPELL_TENACITY, player, newStack);
|
||||
|
|
@ -1123,12 +1113,12 @@ void BattlefieldWG::UpdateTenacity()
|
|||
player->CastSpell(player, buff_honor, true);
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
for (GuidUnorderedSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Creature* creature = GetCreature(*itr))
|
||||
{
|
||||
unit->SetAuraStack(SPELL_TENACITY_VEHICLE, unit, newStack);
|
||||
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
|
||||
if (buff_honor)
|
||||
unit->CastSpell(unit, buff_honor, true);
|
||||
creature->CastSpell(creature, buff_honor, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ public:
|
|||
bool SetupBattlefield() override;
|
||||
|
||||
/// Return pointer to relic object
|
||||
GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)nullptr); }
|
||||
GameObject* GetRelic() { return GetGameObject(m_titansRelic); }
|
||||
|
||||
/// Define relic object
|
||||
//void SetRelic(GameObject* relic) { m_titansRelic = relic; }
|
||||
|
|
@ -450,17 +450,17 @@ protected:
|
|||
GameObjectSet m_KeepGameObject[2];
|
||||
GameObjectBuilding BuildingsInZone;
|
||||
|
||||
GuidSet m_vehicles[2];
|
||||
GuidSet CanonList;
|
||||
GuidSet KeepCreature[2];
|
||||
GuidSet OutsideCreature[2];
|
||||
GuidSet m_updateTenacityList;
|
||||
GuidUnorderedSet m_vehicles[2];
|
||||
GuidUnorderedSet CanonList;
|
||||
GuidUnorderedSet KeepCreature[2];
|
||||
GuidUnorderedSet OutsideCreature[2];
|
||||
GuidUnorderedSet m_updateTenacityList;
|
||||
|
||||
int32 m_tenacityStack;
|
||||
uint32 m_tenacityUpdateTimer;
|
||||
uint32 m_saveTimer;
|
||||
|
||||
uint64 m_titansRelic;
|
||||
ObjectGuid m_titansRelic;
|
||||
};
|
||||
|
||||
const uint8 WG_MAX_OBJ = 32;
|
||||
|
|
@ -1079,7 +1079,6 @@ struct BfWGGameObjectBuilding
|
|||
{
|
||||
m_WG = WG;
|
||||
m_Team = TEAM_ALLIANCE;
|
||||
m_Build = 0;
|
||||
m_Type = 0;
|
||||
m_WorldState = 0;
|
||||
m_State = 0;
|
||||
|
|
@ -1094,7 +1093,7 @@ struct BfWGGameObjectBuilding
|
|||
BattlefieldWG* m_WG;
|
||||
|
||||
// Linked gameobject
|
||||
uint64 m_Build;
|
||||
ObjectGuid m_Build;
|
||||
|
||||
// eWGGameObjectBuildingType
|
||||
uint32 m_Type;
|
||||
|
|
@ -1113,10 +1112,10 @@ struct BfWGGameObjectBuilding
|
|||
GameObjectSet m_GameObjectList[2];
|
||||
|
||||
// Creature associations
|
||||
GuidSet m_CreatureBottomList[2];
|
||||
GuidSet m_CreatureTopList[2];
|
||||
GuidSet m_TowerCannonBottomList;
|
||||
GuidSet m_TurretTopList;
|
||||
GuidUnorderedSet m_CreatureBottomList[2];
|
||||
GuidUnorderedSet m_CreatureTopList[2];
|
||||
GuidUnorderedSet m_TowerCannonBottomList;
|
||||
GuidUnorderedSet m_TurretTopList;
|
||||
|
||||
void Rebuild()
|
||||
{
|
||||
|
|
@ -1136,7 +1135,7 @@ struct BfWGGameObjectBuilding
|
|||
break;
|
||||
}
|
||||
|
||||
GameObject* go = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)nullptr);
|
||||
GameObject* go = m_WG->GetGameObject(m_Build);
|
||||
if (go)
|
||||
{
|
||||
// Rebuild gameobject
|
||||
|
|
@ -1161,15 +1160,13 @@ struct BfWGGameObjectBuilding
|
|||
if (m_damagedText) // tower damage + name
|
||||
m_WG->SendWarningToAllInZone(m_damagedText);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
m_WG->HideNpc(creature);
|
||||
for (GuidUnorderedSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
m_WG->HideNpc(creature);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
m_WG->HideNpc(creature);
|
||||
for (GuidUnorderedSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
m_WG->HideNpc(creature);
|
||||
|
||||
if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER)
|
||||
m_WG->UpdateDamagedTowerCount(m_WG->GetAttackerTeam());
|
||||
|
|
@ -1190,7 +1187,7 @@ struct BfWGGameObjectBuilding
|
|||
{
|
||||
// Inform the global wintergrasp script of the destruction of this object
|
||||
case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
|
||||
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)nullptr));
|
||||
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), m_WG->GetGameObject(m_Build));
|
||||
break;
|
||||
case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
|
||||
m_WG->SetRelicInteractible(true);
|
||||
|
|
@ -1202,7 +1199,7 @@ struct BfWGGameObjectBuilding
|
|||
case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
|
||||
case BATTLEFIELD_WG_OBJECTTYPE_WALL:
|
||||
case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
|
||||
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)nullptr));
|
||||
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), m_WG->GetGameObject(m_Build));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1355,25 +1352,21 @@ struct BfWGGameObjectBuilding
|
|||
|
||||
void UpdateCreatureAndGo()
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
m_WG->HideNpc(creature);
|
||||
for (GuidUnorderedSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr)
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
m_WG->HideNpc(creature);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
m_WG->ShowNpc(creature, true);
|
||||
for (GuidUnorderedSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
m_WG->ShowNpc(creature, true);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
m_WG->HideNpc(creature);
|
||||
for (GuidUnorderedSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr)
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
m_WG->HideNpc(creature);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
m_WG->ShowNpc(creature, true);
|
||||
for (GuidUnorderedSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr)
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
m_WG->ShowNpc(creature, true);
|
||||
|
||||
for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr)
|
||||
(*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
|
||||
|
|
@ -1384,7 +1377,7 @@ struct BfWGGameObjectBuilding
|
|||
|
||||
void UpdateTurretAttack(bool disable)
|
||||
{
|
||||
GameObject* build = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)nullptr);
|
||||
GameObject* build = m_WG->GetGameObject(m_Build);
|
||||
if (!build)
|
||||
return;
|
||||
|
||||
|
|
@ -1404,33 +1397,27 @@ struct BfWGGameObjectBuilding
|
|||
break;
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
{
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
creature->setFaction(faction);
|
||||
if (disable)
|
||||
m_WG->HideNpc(creature);
|
||||
else
|
||||
m_WG->ShowNpc(creature, true);
|
||||
}
|
||||
creature->setFaction(faction);
|
||||
if (disable)
|
||||
m_WG->HideNpc(creature);
|
||||
else
|
||||
m_WG->ShowNpc(creature, true);
|
||||
}
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
{
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
creature->setFaction(faction);
|
||||
if (disable)
|
||||
m_WG->HideNpc(creature);
|
||||
else
|
||||
m_WG->ShowNpc(creature, true);
|
||||
}
|
||||
creature->setFaction(faction);
|
||||
if (disable)
|
||||
m_WG->HideNpc(creature);
|
||||
else
|
||||
m_WG->ShowNpc(creature, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "WorldSession.h"
|
||||
|
||||
ArenaTeam::ArenaTeam()
|
||||
: TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
|
||||
: TeamId(0), Type(0), TeamName(), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
|
||||
BorderStyle(0), BorderColor(0)
|
||||
{
|
||||
Stats.WeekGames = 0;
|
||||
|
|
@ -32,10 +32,10 @@ ArenaTeam::~ArenaTeam()
|
|||
{
|
||||
}
|
||||
|
||||
bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
|
||||
bool ArenaTeam::Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
|
||||
{
|
||||
// Check if captain is present
|
||||
if (!ObjectAccessor::FindPlayerInOrOutOfWorld(captainGuid))
|
||||
if (!ObjectAccessor::FindConnectedPlayer(captainGuid))
|
||||
return false;
|
||||
|
||||
// Check if arena team name is already taken
|
||||
|
|
@ -54,13 +54,12 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa
|
|||
EmblemColor = emblemColor;
|
||||
BorderStyle = borderStyle;
|
||||
BorderColor = borderColor;
|
||||
uint32 captainLowGuid = GUID_LOPART(captainGuid);
|
||||
|
||||
// Save arena team to db
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM);
|
||||
stmt->setUInt32(0, TeamId);
|
||||
stmt->setString(1, TeamName);
|
||||
stmt->setUInt32(2, captainLowGuid);
|
||||
stmt->setUInt32(2, captainGuid.GetCounter());
|
||||
stmt->setUInt8(3, Type);
|
||||
stmt->setUInt16(4, Stats.Rating);
|
||||
stmt->setUInt32(5, BackgroundColor);
|
||||
|
|
@ -75,7 +74,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ArenaTeam::AddMember(uint64 playerGuid)
|
||||
bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||
{
|
||||
std::string playerName;
|
||||
uint8 playerClass;
|
||||
|
|
@ -85,7 +84,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
|||
return false;
|
||||
|
||||
// xinef: Get player name and class from player storage or global data storage
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(playerGuid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(playerGuid);
|
||||
if (player)
|
||||
{
|
||||
playerClass = player->getClass();
|
||||
|
|
@ -93,7 +92,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
|||
}
|
||||
else
|
||||
{
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(playerGuid));
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(playerGuid.GetCounter());
|
||||
if (!playerData)
|
||||
return false;
|
||||
|
||||
|
|
@ -105,9 +104,9 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
|||
return false;
|
||||
|
||||
// Check if player is already in a similar arena team
|
||||
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromStorage(GUID_LOPART(playerGuid), GetSlot()) != 0)
|
||||
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromStorage(playerGuid.GetCounter(), GetSlot()) != 0)
|
||||
{
|
||||
LOG_ERROR("server", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
|
||||
LOG_ERROR("server", "Arena: Player %s (%s) already has an arena team of type %u", playerName.c_str(), playerGuid.ToString().c_str(), GetType());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +121,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
|||
// xinef: zomg! sync query
|
||||
// Try to get player's match maker rating from db and fall back to config setting if not found
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING);
|
||||
stmt->setUInt32(0, GUID_LOPART(playerGuid));
|
||||
stmt->setUInt32(0, playerGuid.GetCounter());
|
||||
stmt->setUInt8(1, GetSlot());
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
|
|
@ -158,12 +157,12 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
|||
newMember.MaxMMR = maxMMR;
|
||||
|
||||
Members.push_back(newMember);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(playerGuid), GetSlot(), GetId());
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(playerGuid.GetCounter(), GetSlot(), GetId());
|
||||
|
||||
// Save player's arena team membership to db
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER);
|
||||
stmt->setUInt32(0, TeamId);
|
||||
stmt->setUInt32(1, GUID_LOPART(playerGuid));
|
||||
stmt->setUInt32(1, playerGuid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// Inform player if online
|
||||
|
|
@ -189,7 +188,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result)
|
|||
|
||||
TeamId = fields[0].GetUInt32();
|
||||
TeamName = fields[1].GetString();
|
||||
CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
CaptainGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt32());
|
||||
Type = fields[3].GetUInt8();
|
||||
BackgroundColor = fields[4].GetUInt32();
|
||||
EmblemStyle = fields[5].GetUInt8();
|
||||
|
|
@ -228,7 +227,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
|||
break;
|
||||
|
||||
ArenaTeamMember newMember;
|
||||
newMember.Guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
newMember.Guid = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt32());
|
||||
newMember.WeekGames = fields[2].GetUInt16();
|
||||
newMember.WeekWins = fields[3].GetUInt16();
|
||||
newMember.SeasonGames = fields[4].GetUInt16();
|
||||
|
|
@ -242,7 +241,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
|||
// Delete member if character information is missing
|
||||
if (fields[6].GetString().empty())
|
||||
{
|
||||
LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
|
||||
LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %s doesn't exist, deleting him from memberlist!", arenaTeamId, newMember.Guid.ToString().c_str());
|
||||
this->DelMember(newMember.Guid, true);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -253,7 +252,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
|||
|
||||
// Put the player in the team
|
||||
Members.push_back(newMember);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId());
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(newMember.Guid.GetCounter(), GetSlot(), GetId());
|
||||
} while (result->NextRow());
|
||||
|
||||
if (Empty() || !captainPresentInTeam)
|
||||
|
|
@ -281,10 +280,10 @@ bool ArenaTeam::SetName(std::string const& name)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ArenaTeam::SetCaptain(uint64 guid)
|
||||
void ArenaTeam::SetCaptain(ObjectGuid guid)
|
||||
{
|
||||
// Disable remove/promote buttons
|
||||
Player* oldCaptain = ObjectAccessor::FindPlayerInOrOutOfWorld(GetCaptain());
|
||||
Player* oldCaptain = ObjectAccessor::FindConnectedPlayer(GetCaptain());
|
||||
if (oldCaptain)
|
||||
oldCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
||||
|
||||
|
|
@ -293,33 +292,33 @@ void ArenaTeam::SetCaptain(uint64 guid)
|
|||
|
||||
// Update database
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN);
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
stmt->setUInt32(1, GetId());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// Enable remove/promote buttons
|
||||
if (Player* newCaptain = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* newCaptain = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
{
|
||||
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
|
||||
/*if (oldCaptain)
|
||||
{
|
||||
LOG_DEBUG("bg.battleground", "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
|
||||
oldCaptain->GetName().c_str(), oldCaptain->GetGUIDLow(), newCaptain->GetName().c_str(),
|
||||
newCaptain->GetGUIDLow(), GetId(), GetType());
|
||||
LOG_DEBUG("bg.battleground", "Player: %s [%s] promoted player: %s [%s] to leader of arena team [Id: %u] [Type: %u].",
|
||||
oldCaptain->GetName().c_str(), oldCaptain->GetGUID().ToString().c_str(), newCaptain->GetName().c_str(),
|
||||
newCaptain->GetGUID().ToString().c_str(), GetId(), GetType());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
|
||||
void ArenaTeam::DelMember(ObjectGuid guid, bool cleanDb)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
Group* group = (player && player->GetGroup()) ? player->GetGroup() : nullptr;
|
||||
|
||||
// Remove member from team
|
||||
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
// Remove queues of members
|
||||
if (Player* playerMember = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->Guid))
|
||||
if (Player* playerMember = ObjectAccessor::FindConnectedPlayer(itr->Guid))
|
||||
{
|
||||
if (group && playerMember->GetGroup() && group->GetGUID() == playerMember->GetGroup()->GetGUID())
|
||||
{
|
||||
|
|
@ -345,7 +344,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
|
|||
if (itr->Guid == guid)
|
||||
{
|
||||
Members.erase(itr);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(guid), GetSlot(), 0);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(guid.GetCounter(), GetSlot(), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -364,7 +363,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
|
|||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBER);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setUInt32(1, GUID_LOPART(guid));
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
|
|
@ -378,7 +377,7 @@ void ArenaTeam::Disband(WorldSession* session)
|
|||
// Broadcast update
|
||||
if (session)
|
||||
{
|
||||
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
|
||||
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, ObjectGuid::Empty, 2, session->GetPlayerName(), GetName(), "");
|
||||
}
|
||||
|
||||
// Update database
|
||||
|
|
@ -436,12 +435,12 @@ void ArenaTeam::Roster(WorldSession* session)
|
|||
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
player = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->Guid);
|
||||
player = ObjectAccessor::FindConnectedPlayer(itr->Guid);
|
||||
|
||||
data << uint64(itr->Guid); // guid
|
||||
data << uint8((player ? 1 : 0)); // online flag
|
||||
data << itr->Guid; // guid
|
||||
data << uint8((player ? 1 : 0)); // online flag
|
||||
tempName = "";
|
||||
sObjectMgr->GetPlayerNameByGUID(itr->Guid, tempName);
|
||||
sObjectMgr->GetPlayerNameByGUID(itr->Guid.GetCounter(), tempName);
|
||||
data << tempName; // member name
|
||||
data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member
|
||||
data << uint8((player ? player->getLevel() : 0)); // unknown, level?
|
||||
|
|
@ -499,18 +498,18 @@ void ArenaTeam::NotifyStatsChanged()
|
|||
// This is called after a rated match ended
|
||||
// Updates arena team stats for every member of the team (not only the ones who participated!)
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->Guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(itr->Guid))
|
||||
SendStats(player->GetSession());
|
||||
}
|
||||
|
||||
void ArenaTeam::Inspect(WorldSession* session, uint64 guid)
|
||||
void ArenaTeam::Inspect(WorldSession* session, ObjectGuid guid)
|
||||
{
|
||||
ArenaTeamMember* member = GetMember(guid);
|
||||
if (!member || GetSlot() >= MAX_ARENA_SLOT)
|
||||
return;
|
||||
|
||||
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8 + 1 + 4 * 6);
|
||||
data << uint64(guid); // player guid
|
||||
data << guid; // player guid
|
||||
data << uint8(GetSlot()); // slot (0...2)
|
||||
data << uint32(GetId()); // arena team id
|
||||
data << uint32(Stats.Rating); // rating
|
||||
|
|
@ -556,11 +555,11 @@ void ArenaTeamMember::ModifyMatchmakerRating(int32 mod, uint32 /*slot*/)
|
|||
void ArenaTeam::BroadcastPacket(WorldPacket* packet)
|
||||
{
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->Guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(itr->Guid))
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
|
||||
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
|
||||
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1 + 1 + 1);
|
||||
data << uint8(event);
|
||||
|
|
@ -584,7 +583,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun
|
|||
}
|
||||
|
||||
if (guid)
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
|
||||
BroadcastPacket(&data);
|
||||
|
||||
|
|
@ -602,7 +601,7 @@ void ArenaTeam::MassInviteToEvent(WorldSession* session)
|
|||
{
|
||||
if (itr->Guid != session->GetPlayer()->GetGUID())
|
||||
{
|
||||
data.appendPackGUID(itr->Guid);
|
||||
data << itr->Guid.WriteAsPacked();
|
||||
data << uint8(0); // unk
|
||||
}
|
||||
}
|
||||
|
|
@ -635,7 +634,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
|
|||
return 0xFF;
|
||||
}
|
||||
|
||||
bool ArenaTeam::IsMember(uint64 guid) const
|
||||
bool ArenaTeam::IsMember(ObjectGuid guid) const
|
||||
{
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
if (itr->Guid == guid)
|
||||
|
|
@ -684,7 +683,7 @@ uint32 ArenaTeam::GetAverageMMR(Group* group) const
|
|||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
// Skip if player is not online
|
||||
if (!ObjectAccessor::FindPlayerInOrOutOfWorld(itr->Guid))
|
||||
if (!ObjectAccessor::FindConnectedPlayer(itr->Guid))
|
||||
continue;
|
||||
|
||||
// Skip if player is not member of group
|
||||
|
|
@ -778,7 +777,7 @@ void ArenaTeam::FinishGame(int32 mod, const Map* bgMap)
|
|||
|
||||
// Check if rating related achivements are met
|
||||
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
if (Player* member = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->Guid))
|
||||
if (Player* member = ObjectAccessor::FindConnectedPlayer(itr->Guid))
|
||||
if (member->FindMap() == bgMap)
|
||||
member->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING, Stats.Rating, Type);
|
||||
}
|
||||
|
|
@ -892,7 +891,7 @@ void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32
|
|||
}
|
||||
}
|
||||
|
||||
void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
|
||||
void ArenaTeam::UpdateArenaPointsHelper(std::map<ObjectGuid, uint32>& playerPoints)
|
||||
{
|
||||
// Called after a match has ended and the stats are already modified
|
||||
// Helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
|
||||
|
|
@ -910,15 +909,15 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
|
|||
if (itr->WeekGames >= requiredGames)
|
||||
pointsToAdd = GetPoints(itr->PersonalRating);
|
||||
|
||||
std::map<uint32, uint32>::iterator plr_itr = playerPoints.find(GUID_LOPART(itr->Guid));
|
||||
std::map<ObjectGuid, uint32>::iterator plr_itr = playerPoints.find(itr->Guid);
|
||||
if (plr_itr != playerPoints.end())
|
||||
{
|
||||
// Check if there is already more points
|
||||
if (plr_itr->second < pointsToAdd)
|
||||
playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd;
|
||||
playerPoints[itr->Guid] = pointsToAdd;
|
||||
}
|
||||
else
|
||||
playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd;
|
||||
playerPoints[itr->Guid] = pointsToAdd;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -951,11 +950,11 @@ void ArenaTeam::SaveToDB()
|
|||
stmt->setUInt16(3, itr->SeasonGames);
|
||||
stmt->setUInt16(4, itr->SeasonWins);
|
||||
stmt->setUInt32(5, GetId());
|
||||
stmt->setUInt32(6, GUID_LOPART(itr->Guid));
|
||||
stmt->setUInt32(6, itr->Guid.GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHARACTER_ARENA_STATS);
|
||||
stmt->setUInt32(0, GUID_LOPART(itr->Guid));
|
||||
stmt->setUInt32(0, itr->Guid.GetCounter());
|
||||
stmt->setUInt8(1, GetSlot());
|
||||
stmt->setUInt16(2, itr->MatchMakerRating);
|
||||
stmt->setUInt16(3, itr->MaxMMR);
|
||||
|
|
@ -994,7 +993,7 @@ ArenaTeamMember* ArenaTeam::GetMember(const std::string& name)
|
|||
return GetMember(sObjectMgr->GetPlayerGUIDByName(name));
|
||||
}
|
||||
|
||||
ArenaTeamMember* ArenaTeam::GetMember(uint64 guid)
|
||||
ArenaTeamMember* ArenaTeam::GetMember(ObjectGuid guid)
|
||||
{
|
||||
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
if (itr->Guid == guid)
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ enum ArenaSlot
|
|||
|
||||
struct ArenaTeamMember
|
||||
{
|
||||
uint64 Guid;
|
||||
ObjectGuid Guid;
|
||||
std::string Name;
|
||||
uint8 Class;
|
||||
uint16 WeekGames;
|
||||
|
|
@ -128,7 +128,7 @@ public:
|
|||
ArenaTeam();
|
||||
~ArenaTeam();
|
||||
|
||||
bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
|
||||
bool Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
|
||||
void Disband(WorldSession* session);
|
||||
void Disband();
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ public:
|
|||
[[nodiscard]] uint8 GetSlot() const { return GetSlotByType(GetType()); }
|
||||
static uint8 GetSlotByType(uint32 type);
|
||||
static uint8 GetReqPlayersForType(uint32 type);
|
||||
[[nodiscard]] uint64 GetCaptain() const { return CaptainGuid; }
|
||||
[[nodiscard]] ObjectGuid GetCaptain() const { return CaptainGuid; }
|
||||
[[nodiscard]] std::string const& GetName() const { return TeamName; }
|
||||
[[nodiscard]] const ArenaTeamStats& GetStats() const { return Stats; }
|
||||
void SetArenaTeamStats(ArenaTeamStats& stats) { Stats = stats; }
|
||||
|
|
@ -147,22 +147,22 @@ public:
|
|||
[[nodiscard]] uint32 GetRating() const { return Stats.Rating; }
|
||||
uint32 GetAverageMMR(Group* group) const;
|
||||
|
||||
void SetCaptain(uint64 guid);
|
||||
void SetCaptain(ObjectGuid guid);
|
||||
bool SetName(std::string const& name);
|
||||
bool AddMember(uint64 playerGuid);
|
||||
bool AddMember(ObjectGuid playerGuid);
|
||||
|
||||
// Shouldn't be uint64 ed, because than can reference guid from members on Disband
|
||||
// Shouldn't be ObjectGuid, because than can reference guid from members on Disband
|
||||
// and this method removes given record from list. So invalid reference can happen.
|
||||
void DelMember(uint64 guid, bool cleanDb);
|
||||
void DelMember(ObjectGuid guid, bool cleanDb);
|
||||
|
||||
[[nodiscard]] size_t GetMembersSize() const { return Members.size(); }
|
||||
[[nodiscard]] bool Empty() const { return Members.empty(); }
|
||||
MemberList::iterator m_membersBegin() { return Members.begin(); }
|
||||
MemberList::iterator m_membersEnd() { return Members.end(); }
|
||||
MemberList& GetMembers() { return Members; }
|
||||
[[nodiscard]] bool IsMember(uint64 guid) const;
|
||||
[[nodiscard]] bool IsMember(ObjectGuid guid) const;
|
||||
|
||||
ArenaTeamMember* GetMember(uint64 guid);
|
||||
ArenaTeamMember* GetMember(ObjectGuid guid);
|
||||
ArenaTeamMember* GetMember(std::string const& name);
|
||||
|
||||
[[nodiscard]] bool IsFighting() const;
|
||||
|
|
@ -173,7 +173,7 @@ public:
|
|||
void SaveToDB();
|
||||
|
||||
void BroadcastPacket(WorldPacket* packet);
|
||||
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
|
||||
void BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
|
||||
void NotifyStatsChanged();
|
||||
|
||||
void MassInviteToEvent(WorldSession* session);
|
||||
|
|
@ -181,7 +181,7 @@ public:
|
|||
void Roster(WorldSession* session);
|
||||
void Query(WorldSession* session);
|
||||
void SendStats(WorldSession* session);
|
||||
void Inspect(WorldSession* session, uint64 guid);
|
||||
void Inspect(WorldSession* session, ObjectGuid guid);
|
||||
|
||||
uint32 GetPoints(uint32 MemberRating);
|
||||
int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
|
||||
|
|
@ -192,7 +192,7 @@ public:
|
|||
int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap);
|
||||
void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
|
||||
|
||||
void UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints);
|
||||
void UpdateArenaPointsHelper(std::map<ObjectGuid, uint32>& PlayerPoints);
|
||||
|
||||
void FinishWeek();
|
||||
void FinishGame(int32 mod, const Map* bgMap);
|
||||
|
|
@ -207,7 +207,7 @@ protected:
|
|||
uint32 TeamId;
|
||||
uint8 Type;
|
||||
std::string TeamName;
|
||||
uint64 CaptainGuid;
|
||||
ObjectGuid CaptainGuid;
|
||||
|
||||
uint32 BackgroundColor; // ARGB format
|
||||
uint8 EmblemStyle; // icon id
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamByName(std::string const& arenaTeamName, co
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(uint64 guid) const
|
||||
ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(ObjectGuid guid) const
|
||||
{
|
||||
for (ArenaTeamContainer::const_iterator itr = ArenaTeamStore.begin(); itr != ArenaTeamStore.end(); ++itr)
|
||||
{
|
||||
|
|
@ -94,7 +94,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(uint64 guid) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(uint64 guid, const uint32 type) const
|
||||
ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(ObjectGuid guid, const uint32 type) const
|
||||
{
|
||||
for (ArenaTeamContainer::const_iterator itr = ArenaTeamStore.begin(); itr != ArenaTeamStore.end(); ++itr)
|
||||
{
|
||||
|
|
@ -191,7 +191,7 @@ void ArenaTeamMgr::DistributeArenaPoints()
|
|||
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START);
|
||||
|
||||
// Temporary structure for storing maximum points to add values for all players
|
||||
std::map<uint32, uint32> PlayerPoints;
|
||||
std::map<ObjectGuid, uint32> PlayerPoints;
|
||||
|
||||
// At first update all points for all team members
|
||||
for (ArenaTeamContainer::iterator teamItr = GetArenaTeamMapBegin(); teamItr != GetArenaTeamMapEnd(); ++teamItr)
|
||||
|
|
@ -206,16 +206,16 @@ void ArenaTeamMgr::DistributeArenaPoints()
|
|||
PreparedStatement* stmt;
|
||||
|
||||
// Cycle that gives points to all players
|
||||
for (std::map<uint32, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr)
|
||||
for (std::map<ObjectGuid, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr)
|
||||
{
|
||||
// Add points to player if online
|
||||
if (Player* player = HashMapHolder<Player>::Find(playerItr->first))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(playerItr->first))
|
||||
player->ModifyArenaPoints(playerItr->second, &trans);
|
||||
else // Update database
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ARENA_POINTS);
|
||||
stmt->setUInt32(0, playerItr->second);
|
||||
stmt->setUInt32(1, playerItr->first);
|
||||
stmt->setUInt32(1, playerItr->first.GetCounter());
|
||||
trans->Append(stmt);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ public:
|
|||
|
||||
ArenaTeam* GetArenaTeamById(uint32 arenaTeamId) const;
|
||||
ArenaTeam* GetArenaTeamByName(std::string const& arenaTeamName) const;
|
||||
ArenaTeam* GetArenaTeamByCaptain(uint64 guid) const;
|
||||
ArenaTeam* GetArenaTeamByCaptain(ObjectGuid guid) const;
|
||||
ArenaTeam* GetArenaTeamByName(std::string const& arenaTeamName, const uint32 type) const;
|
||||
ArenaTeam* GetArenaTeamByCaptain(uint64 guid, const uint32 type) const;
|
||||
ArenaTeam* GetArenaTeamByCaptain(ObjectGuid guid, const uint32 type) const;
|
||||
|
||||
void LoadArenaTeams();
|
||||
void AddArenaTeam(ArenaTeam* arenaTeam);
|
||||
|
|
|
|||
|
|
@ -328,12 +328,12 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
|
|||
{
|
||||
if (GetReviveQueueSize())
|
||||
{
|
||||
for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
{
|
||||
Creature* sh = nullptr;
|
||||
for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
for (ObjectGuid const guid : itr->second)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(*itr2);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
|
|
@ -348,9 +348,10 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
|
|||
|
||||
// Resurrection visual
|
||||
player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
|
||||
m_ResurrectQueue.push_back(*itr2);
|
||||
m_ResurrectQueue.push_back(guid);
|
||||
}
|
||||
(itr->second).clear();
|
||||
|
||||
itr->second.clear();
|
||||
}
|
||||
|
||||
m_ReviveQueue.clear();
|
||||
|
|
@ -362,15 +363,15 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
|
|||
}
|
||||
else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC
|
||||
{
|
||||
for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
for (ObjectGuid const guid : m_ResurrectQueue)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(*itr);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player)
|
||||
continue;
|
||||
player->ResurrectPlayer(1.0f);
|
||||
player->CastSpell(player, 6962, true);
|
||||
player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
|
||||
sObjectAccessor->ConvertCorpseForPlayer(*itr);
|
||||
player->SpawnCorpseBones(false);
|
||||
}
|
||||
m_ResurrectQueue.clear();
|
||||
}
|
||||
|
|
@ -557,7 +558,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
|||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
for (ToBeTeleportedMap::const_iterator itr = m_ToBeTeleported.begin(); itr != m_ToBeTeleported.end(); ++itr)
|
||||
if (Player* p = ObjectAccessor::GetObjectInOrOutOfWorld(itr->first, (Player*)nullptr))
|
||||
if (Player* p = ObjectAccessor::FindConnectedPlayer(itr->first))
|
||||
if (Player* t = ObjectAccessor::FindPlayer(itr->second))
|
||||
{
|
||||
if (!t->FindMap() || t->FindMap() != GetBgMap())
|
||||
|
|
@ -566,7 +567,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
|||
p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true);
|
||||
|
||||
WorldPacket data(SMSG_SUMMON_REQUEST, 8 + 4 + 4);
|
||||
data << uint64(t->GetGUID());
|
||||
data << t->GetGUID();
|
||||
data << uint32(t->GetZoneId());
|
||||
data << uint32(15 * IN_MILLISECONDS);
|
||||
p->GetSession()->SendPacket(&data);
|
||||
|
|
@ -1019,7 +1020,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
|||
BattlegroundScoreMap::const_iterator score = PlayerScores.find(player->GetGUID());
|
||||
|
||||
stmt->setUInt32(0, battlegroundId);
|
||||
stmt->setUInt32(1, player->GetGUIDLow());
|
||||
stmt->setUInt32(1, player->GetGUID().GetCounter());
|
||||
stmt->setBool(2, bgTeamId == winnerTeamId);
|
||||
stmt->setUInt32(3, score->second->GetKillingBlows());
|
||||
stmt->setUInt32(4, score->second->GetDeaths());
|
||||
|
|
@ -1205,7 +1206,7 @@ void Battleground::AddPlayer(Player* player)
|
|||
|
||||
// score struct must be created in inherited class
|
||||
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
TeamId teamId = player->GetBgTeamId();
|
||||
|
||||
// Add to list/maps
|
||||
|
|
@ -1282,7 +1283,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId)
|
|||
return;
|
||||
}
|
||||
|
||||
uint64 playerGuid = player->GetGUID();
|
||||
ObjectGuid playerGuid = player->GetGUID();
|
||||
Group* group = GetBgRaid(teamId);
|
||||
if (!group) // first player joined
|
||||
{
|
||||
|
|
@ -1380,7 +1381,7 @@ void Battleground::ReadyMarkerClicked(Player* p)
|
|||
{
|
||||
if (!isArena() || GetStatus() >= STATUS_IN_PROGRESS || GetStartDelayTime() <= BG_START_DELAY_15S || (m_Events & BG_STARTING_EVENT_3) || p->IsSpectator())
|
||||
return;
|
||||
readyMarkerClickedSet.insert(p->GetGUIDLow());
|
||||
readyMarkerClickedSet.insert(p->GetGUID());
|
||||
uint32 count = readyMarkerClickedSet.size();
|
||||
uint32 req = ArenaTeam::GetReqPlayersForType(GetArenaType());
|
||||
p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req);
|
||||
|
|
@ -1453,7 +1454,7 @@ void Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value,
|
|||
}
|
||||
}
|
||||
|
||||
void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid)
|
||||
void Battleground::AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid)
|
||||
{
|
||||
m_ReviveQueue[npc_guid].push_back(player_guid);
|
||||
|
||||
|
|
@ -1466,26 +1467,26 @@ void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
|
|||
|
||||
void Battleground::RemovePlayerFromResurrectQueue(Player* player)
|
||||
{
|
||||
for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
for (std::vector<uint64>::iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
for (GuidVector::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
|
||||
if (*itr2 == player->GetGUID())
|
||||
{
|
||||
(itr->second).erase(itr2);
|
||||
itr->second.erase(itr2);
|
||||
player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Battleground::RelocateDeadPlayers(uint64 queueIndex)
|
||||
void Battleground::RelocateDeadPlayers(ObjectGuid queueIndex)
|
||||
{
|
||||
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
|
||||
std::vector<uint64>& ghostList = m_ReviveQueue[queueIndex];
|
||||
GuidVector& ghostList = m_ReviveQueue[queueIndex];
|
||||
if (!ghostList.empty())
|
||||
{
|
||||
GraveyardStruct const* closestGrave = nullptr;
|
||||
for (std::vector<uint64>::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr)
|
||||
for (ObjectGuid const guid : ghostList)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(*itr);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
|
|
@ -1495,6 +1496,7 @@ void Battleground::RelocateDeadPlayers(uint64 queueIndex)
|
|||
if (closestGrave)
|
||||
player->TeleportTo(GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
|
||||
}
|
||||
|
||||
ghostList.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -1511,7 +1513,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
// and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
|
||||
// So we must create it specific for this instance
|
||||
GameObject* go = sObjectMgr->IsGameObjectStaticTransport(entry) ? new StaticTransport() : new GameObject();
|
||||
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(),
|
||||
if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), entry, GetBgMap(),
|
||||
PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(rotation0, rotation1, rotation2, rotation3), 100, goState))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
|
||||
|
|
@ -1522,11 +1524,11 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
return false;
|
||||
}
|
||||
/*
|
||||
uint32 guid = go->GetGUIDLow();
|
||||
ObjectGuid::LowType spawnId = go->GetSpawnId();
|
||||
|
||||
// without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
|
||||
// iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed
|
||||
GameObjectData& data = sObjectMgr->NewGOData(guid);
|
||||
GameObjectData& data = sObjectMgr->NewGOData(spawnId);
|
||||
|
||||
data.id = entry;
|
||||
data.mapid = GetMapId();
|
||||
|
|
@ -1567,8 +1569,8 @@ void Battleground::DoorClose(uint32 type)
|
|||
}
|
||||
}
|
||||
else
|
||||
LOG_ERROR("server", "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
LOG_ERROR("server", "Battleground::DoorClose: door gameobject (type: %u, %s) not found for BG (map: %u, instance id: %u)!",
|
||||
type, BgObjects[type].ToString().c_str(), m_MapId, m_InstanceID);
|
||||
}
|
||||
|
||||
void Battleground::DoorOpen(uint32 type)
|
||||
|
|
@ -1579,16 +1581,16 @@ void Battleground::DoorOpen(uint32 type)
|
|||
obj->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
else
|
||||
LOG_ERROR("server", "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
LOG_ERROR("server", "Battleground::DoorOpen: door gameobject (type: %u, %s) not found for BG (map: %u, instance id: %u)!",
|
||||
type, BgObjects[type].ToString().c_str(), m_MapId, m_InstanceID);
|
||||
}
|
||||
|
||||
GameObject* Battleground::GetBGObject(uint32 type)
|
||||
{
|
||||
GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]);
|
||||
if (!obj)
|
||||
LOG_ERROR("server", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
LOG_ERROR("server", "Battleground::GetBGObject: gameobject (type: %u, %s) not found for BG (map: %u, instance id: %u)!",
|
||||
type, BgObjects[type].ToString().c_str(), m_MapId, m_InstanceID);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
@ -1596,8 +1598,8 @@ Creature* Battleground::GetBGCreature(uint32 type)
|
|||
{
|
||||
Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]);
|
||||
if (!creature)
|
||||
LOG_ERROR("server", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
|
||||
LOG_ERROR("server", "Battleground::GetBGCreature: creature (type: %u, %s) not found for BG (map: %u, instance id: %u)!",
|
||||
type, BgCreatures[type].ToString().c_str(), m_MapId, m_InstanceID);
|
||||
return creature;
|
||||
}
|
||||
|
||||
|
|
@ -1639,7 +1641,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
|
|||
}
|
||||
|
||||
Creature* creature = new Creature();
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
|
||||
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
|
||||
{
|
||||
LOG_ERROR("server", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
|
||||
entry, m_MapId, m_InstanceID);
|
||||
|
|
@ -1687,13 +1689,14 @@ bool Battleground::DelCreature(uint32 type)
|
|||
if (Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]))
|
||||
{
|
||||
creature->AddObjectToRemoveList();
|
||||
BgCreatures[type] = 0;
|
||||
BgCreatures[type].Clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_ERROR("server", "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
|
||||
BgCreatures[type] = 0;
|
||||
LOG_ERROR("server", "Battleground::DelCreature: creature (type: %u, %s) not found for BG (map: %u, instance id: %u)!",
|
||||
type, BgCreatures[type].ToString().c_str(), m_MapId, m_InstanceID);
|
||||
|
||||
BgCreatures[type].Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1706,12 +1709,14 @@ bool Battleground::DelObject(uint32 type)
|
|||
{
|
||||
obj->SetRespawnTime(0); // not save respawn time
|
||||
obj->Delete();
|
||||
BgObjects[type] = 0;
|
||||
BgObjects[type].Clear();
|
||||
return true;
|
||||
}
|
||||
LOG_ERROR("server", "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
|
||||
BgObjects[type] = 0;
|
||||
|
||||
LOG_ERROR("server", "Battleground::DelObject: gameobject (type: %u, %s) not found for BG (map: %u, instance id: %u)!",
|
||||
type, BgObjects[type].ToString().c_str(), m_MapId, m_InstanceID);
|
||||
|
||||
BgObjects[type].Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1722,7 +1727,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
|
|||
if (Creature* creature = AddCreature(entry, type, x, y, z, o))
|
||||
{
|
||||
creature->setDeathState(DEAD);
|
||||
creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
|
||||
creature->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
|
||||
// aura
|
||||
// TODO: Fix display here
|
||||
// creature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL);
|
||||
|
|
@ -1878,7 +1883,7 @@ TeamId Battleground::GetOtherTeamId(TeamId teamId)
|
|||
return teamId != TEAM_NEUTRAL ? (teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE) : TEAM_NEUTRAL;
|
||||
}
|
||||
|
||||
bool Battleground::IsPlayerInBattleground(uint64 guid) const
|
||||
bool Battleground::IsPlayerInBattleground(ObjectGuid guid) const
|
||||
{
|
||||
BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
||||
if (itr != m_Players.end())
|
||||
|
|
@ -1916,13 +1921,15 @@ void Battleground::SetHoliday(bool is_holiday)
|
|||
m_HonorMode = is_holiday ? BG_HOLIDAY : BG_NORMAL;
|
||||
}
|
||||
|
||||
int32 Battleground::GetObjectType(uint64 guid)
|
||||
int32 Battleground::GetObjectType(ObjectGuid guid)
|
||||
{
|
||||
for (uint32 i = 0; i < BgObjects.size(); ++i)
|
||||
if (BgObjects[i] == guid)
|
||||
return i;
|
||||
LOG_ERROR("server", "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
|
||||
GUID_LOPART(guid), m_MapId, m_InstanceID);
|
||||
|
||||
LOG_ERROR("server", "Battleground::GetObjectType: player used gameobject (%s) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
|
||||
guid.ToString().c_str(), m_MapId, m_InstanceID);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ class ArenaLogEntryData
|
|||
{
|
||||
public:
|
||||
ArenaLogEntryData() {}
|
||||
void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
void Fill(const char* name, ObjectGuid::LowType guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
{
|
||||
Name = std::string(name);
|
||||
Guid = guid;
|
||||
|
|
@ -284,7 +284,7 @@ public:
|
|||
}
|
||||
|
||||
std::string Name;
|
||||
uint32 Guid{0};
|
||||
ObjectGuid::LowType Guid{0};
|
||||
uint32 Acc;
|
||||
uint32 ArenaTeamId{0};
|
||||
std::string IP;
|
||||
|
|
@ -400,28 +400,28 @@ public:
|
|||
[[nodiscard]] uint32 GetMaxFreeSlots() const;
|
||||
|
||||
typedef std::set<Player*> SpectatorList;
|
||||
typedef std::map<uint64, uint64> ToBeTeleportedMap;
|
||||
typedef std::map<ObjectGuid, ObjectGuid> ToBeTeleportedMap;
|
||||
void AddSpectator(Player* p) { m_Spectators.insert(p); }
|
||||
void RemoveSpectator(Player* p) { m_Spectators.erase(p); }
|
||||
bool HaveSpectators() { return !m_Spectators.empty(); }
|
||||
[[nodiscard]] const SpectatorList& GetSpectators() const { return m_Spectators; }
|
||||
void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; }
|
||||
void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
|
||||
void AddToBeTeleported(ObjectGuid spectator, ObjectGuid participant) { m_ToBeTeleported[spectator] = participant; }
|
||||
void RemoveToBeTeleported(ObjectGuid spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
|
||||
void SpectatorsSendPacket(WorldPacket& data);
|
||||
|
||||
[[nodiscard]] bool isArena() const { return m_IsArena; }
|
||||
[[nodiscard]] bool isBattleground() const { return !m_IsArena; }
|
||||
[[nodiscard]] bool isRated() const { return m_IsRated; }
|
||||
|
||||
typedef std::map<uint64, Player*> BattlegroundPlayerMap;
|
||||
typedef std::map<ObjectGuid, Player*> BattlegroundPlayerMap;
|
||||
[[nodiscard]] BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
|
||||
[[nodiscard]] uint32 GetPlayersSize() const { return m_Players.size(); }
|
||||
|
||||
void ReadyMarkerClicked(Player* p); // pussywizard
|
||||
std::set<uint32> readyMarkerClickedSet; // pussywizard
|
||||
GuidSet readyMarkerClickedSet; // pussywizard
|
||||
|
||||
typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
|
||||
typedef std::map<uint64, ArenaLogEntryData> ArenaLogEntryDataMap;// pussywizard
|
||||
typedef std::map<ObjectGuid, BattlegroundScore*> BattlegroundScoreMap;
|
||||
typedef std::map<ObjectGuid, ArenaLogEntryData> ArenaLogEntryDataMap;// pussywizard
|
||||
ArenaLogEntryDataMap ArenaLogEntries; // pussywizard
|
||||
[[nodiscard]] BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); }
|
||||
[[nodiscard]] BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); }
|
||||
|
|
@ -429,11 +429,11 @@ public:
|
|||
|
||||
[[nodiscard]] uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
|
||||
|
||||
void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid);
|
||||
void RemovePlayerFromResurrectQueue(Player* player);
|
||||
|
||||
/// Relocate all players in ReviveQueue to the closest graveyard
|
||||
void RelocateDeadPlayers(uint64 queueIndex);
|
||||
void RelocateDeadPlayers(ObjectGuid queueIndex);
|
||||
|
||||
void StartBattleground();
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ public:
|
|||
virtual void EventPlayerUsedGO(Player* /*player*/, GameObject* /*go*/) {}
|
||||
|
||||
// this function can be used by spell to interact with the BG map
|
||||
virtual void DoAction(uint32 /*action*/, uint64 /*var*/) {}
|
||||
virtual void DoAction(uint32 /*action*/, ObjectGuid /*var*/) {}
|
||||
|
||||
virtual void HandlePlayerResurrect(Player* /*player*/) {}
|
||||
|
||||
|
|
@ -550,8 +550,8 @@ public:
|
|||
void SetHoliday(bool is_holiday);
|
||||
|
||||
// TODO: make this protected:
|
||||
typedef std::vector<uint64> BGObjects;
|
||||
typedef std::vector<uint64> BGCreatures;
|
||||
typedef GuidVector BGObjects;
|
||||
typedef GuidVector BGCreatures;
|
||||
BGObjects BgObjects;
|
||||
BGCreatures BgCreatures;
|
||||
void SpawnBGObject(uint32 type, uint32 respawntime);
|
||||
|
|
@ -560,7 +560,7 @@ public:
|
|||
bool DelCreature(uint32 type);
|
||||
bool DelObject(uint32 type);
|
||||
bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId);
|
||||
int32 GetObjectType(uint64 guid);
|
||||
int32 GetObjectType(ObjectGuid guid);
|
||||
|
||||
void DoorOpen(uint32 type);
|
||||
void DoorClose(uint32 type);
|
||||
|
|
@ -571,15 +571,15 @@ public:
|
|||
|
||||
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
|
||||
static TeamId GetOtherTeamId(TeamId teamId);
|
||||
[[nodiscard]] bool IsPlayerInBattleground(uint64 guid) const;
|
||||
[[nodiscard]] bool IsPlayerInBattleground(ObjectGuid guid) const;
|
||||
|
||||
[[nodiscard]] bool ToBeDeleted() const { return m_SetDeleteThis; }
|
||||
//void SetDeleteThis() { m_SetDeleteThis = true; }
|
||||
|
||||
void RewardXPAtKill(Player* killer, Player* victim);
|
||||
|
||||
[[nodiscard]] virtual uint64 GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const { return 0; }
|
||||
virtual void SetDroppedFlagGUID(uint64 /*guid*/, TeamId /*teamId*/ = TEAM_NEUTRAL) {}
|
||||
[[nodiscard]] virtual ObjectGuid GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const { return ObjectGuid::Empty; }
|
||||
virtual void SetDroppedFlagGUID(ObjectGuid /*guid*/, TeamId /*teamId*/ = TEAM_NEUTRAL) {}
|
||||
[[nodiscard]] uint32 GetTeamScore(TeamId teamId) const;
|
||||
|
||||
virtual TeamId GetPrematureWinner();
|
||||
|
|
@ -637,9 +637,9 @@ protected:
|
|||
virtual void RemovePlayer(Player* /*player*/) {}
|
||||
|
||||
// Player lists, those need to be accessible by inherited classes
|
||||
BattlegroundPlayerMap m_Players;
|
||||
BattlegroundPlayerMap m_Players;
|
||||
// Spirit Guide guid + Player list GUIDS
|
||||
std::map<uint64, std::vector<uint64> > m_ReviveQueue;
|
||||
std::map<ObjectGuid, GuidVector> m_ReviveQueue;
|
||||
|
||||
// these are important variables used for starting messages
|
||||
uint8 m_Events;
|
||||
|
|
@ -708,8 +708,8 @@ private:
|
|||
virtual void PostUpdateImpl(uint32 /* diff */) { }
|
||||
|
||||
// Player lists
|
||||
std::vector<uint64> m_ResurrectQueue; // Player GUID
|
||||
std::deque<uint64> m_OfflineQueue; // Player GUID
|
||||
GuidVector m_ResurrectQueue; // Player GUID
|
||||
GuidDeque m_OfflineQueue; // Player GUID
|
||||
|
||||
// Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
|
||||
// Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
|
||||
|
|
|
|||
|
|
@ -248,11 +248,11 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
|||
itr2 = itr++;
|
||||
if (!bg->IsPlayerInBattleground(itr2->first))
|
||||
{
|
||||
LOG_ERROR("server", "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetBgTypeID());
|
||||
LOG_ERROR("server", "Player %s has scoreboard entry for battleground %u but is not in battleground!", itr->first.ToString().c_str(), bg->GetBgTypeID());
|
||||
continue;
|
||||
}
|
||||
|
||||
*data << uint64(itr2->first);
|
||||
*data << itr2->first;
|
||||
*data << uint32(itr2->second->KillingBlows);
|
||||
if (type == 0)
|
||||
{
|
||||
|
|
@ -392,16 +392,16 @@ void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
|
|||
*data << uint32(soundid);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid)
|
||||
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player)
|
||||
{
|
||||
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
|
||||
*data << uint64(player->GetGUID());
|
||||
*data << player->GetGUID();
|
||||
}
|
||||
|
||||
Battleground* BattlegroundMgr::GetBattleground(uint32 instanceId)
|
||||
|
|
@ -646,7 +646,7 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
|
|||
LOG_INFO("server", "AzerothCore Battleground: Automatic Arena Point Distribution initialized.");
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
|
||||
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
|
@ -659,7 +659,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
|
|||
loser_kills = acore::Honor::hk_honor_at_level(player->getLevel(), float(loser_kills));
|
||||
|
||||
data->Initialize(SMSG_BATTLEFIELD_LIST);
|
||||
*data << uint64(guid); // battlemaster guid
|
||||
*data << guid; // battlemaster guid
|
||||
*data << uint8(fromWhere); // from where you joined
|
||||
*data << uint32(bgTypeId); // battleground id
|
||||
*data << uint8(0); // unk
|
||||
|
|
@ -714,7 +714,7 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt
|
|||
}
|
||||
}
|
||||
|
||||
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
|
||||
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid)
|
||||
{
|
||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||
uint32 time_ = RESURRECTION_INTERVAL - bg->GetLastResurrectTime(); // resurrect every X seconds
|
||||
|
|
@ -1021,7 +1021,7 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
|||
for (auto itr : ginfo->Players)
|
||||
{
|
||||
// get the player
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(itr);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(itr);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
|
|
@ -1049,7 +1049,7 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
|||
|
||||
// pussywizard:
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress());
|
||||
bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUID().GetCounter(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ public:
|
|||
|
||||
/* Packet Building */
|
||||
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player);
|
||||
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid);
|
||||
void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
|
||||
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid);
|
||||
void BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
|
||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
|
||||
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
|
||||
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
|
||||
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, TeamId teamId, bool isRated = false, BattlegroundTypeId forceBgTypeId = BATTLEGROUND_TYPE_NONE);
|
||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid);
|
||||
|
||||
/* Battlegrounds */
|
||||
Battleground* GetBattleground(uint32 InstanceID);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include "ScriptMgr.h"
|
||||
#include <unordered_map>
|
||||
|
||||
std::unordered_map<uint64, uint32> BGSpamProtection;
|
||||
std::unordered_map<ObjectGuid, uint32> BGSpamProtection;
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE SYSTEM ***/
|
||||
|
|
@ -240,11 +240,11 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const
|
|||
}
|
||||
|
||||
//remove player from queue and from group info, if group info is empty then remove it too
|
||||
void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQueueSlot)
|
||||
void BattlegroundQueue::RemovePlayer(ObjectGuid guid, bool sentToBg, uint32 playerQueueSlot)
|
||||
{
|
||||
// pussywizard: leave queue packet
|
||||
if (playerQueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||
if (Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* p = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, nullptr, playerQueueSlot, STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL);
|
||||
|
|
@ -302,7 +302,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
|
|||
if (groupInfo->IsInvitedToBGInstanceGUID && groupInfo->IsRated && !sentToBg)
|
||||
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(groupInfo->ArenaTeamId))
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
at->MemberLost(player, groupInfo->OpponentsMatchmakerRating);
|
||||
at->SaveToDB();
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
|
|||
{
|
||||
uint32 queueSlot = PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
|
||||
if (Player* plr = ObjectAccessor::FindPlayerInOrOutOfWorld(*(groupInfo->Players.begin())))
|
||||
if (Player* plr = ObjectAccessor::FindConnectedPlayer(*(groupInfo->Players.begin())))
|
||||
{
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(groupInfo->BgTypeId, groupInfo->ArenaType);
|
||||
queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||
|
|
@ -338,20 +338,20 @@ void BattlegroundQueue::AddEvent(BasicEvent* Event, uint64 e_time)
|
|||
m_events.AddEvent(Event, m_events.CalculateTime(e_time));
|
||||
}
|
||||
|
||||
bool BattlegroundQueue::IsPlayerInvitedToRatedArena(uint64 pl_guid)
|
||||
bool BattlegroundQueue::IsPlayerInvitedToRatedArena(ObjectGuid pl_guid)
|
||||
{
|
||||
auto qItr = m_QueuedPlayers.find(pl_guid);
|
||||
return qItr != m_QueuedPlayers.end() && qItr->second->IsRated && qItr->second->IsInvitedToBGInstanceGUID;
|
||||
}
|
||||
|
||||
//returns true when player pl_guid is in queue and is invited to bgInstanceGuid
|
||||
bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
|
||||
bool BattlegroundQueue::IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
|
||||
{
|
||||
auto qItr = m_QueuedPlayers.find(pl_guid);
|
||||
return qItr != m_QueuedPlayers.end() && qItr->second->IsInvitedToBGInstanceGUID == bgInstanceGuid && qItr->second->RemoveInviteTime == removeTime;
|
||||
}
|
||||
|
||||
bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo)
|
||||
bool BattlegroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo)
|
||||
{
|
||||
auto qItr = m_QueuedPlayers.find(guid);
|
||||
if (qItr == m_QueuedPlayers.end())
|
||||
|
|
@ -1034,7 +1034,7 @@ void BattlegroundQueue::SendMessageArenaQueue(GroupQueueInfo* ginfo, bool IsJoin
|
|||
|
||||
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(m_PlayerGuid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(m_PlayerGuid);
|
||||
|
||||
// player logged off, so he is no longer in queue
|
||||
if (!player)
|
||||
|
|
@ -1072,7 +1072,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
|
|||
|
||||
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(m_PlayerGuid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(m_PlayerGuid);
|
||||
|
||||
// player logged off, so he is no longer in queue
|
||||
if (!player)
|
||||
|
|
@ -1096,7 +1096,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, player->GetGUIDLow());
|
||||
stmt->setUInt32(0, player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_NO_ENTER_BUTTON);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!)
|
||||
{
|
||||
std::set<uint64> Players; // player guid set
|
||||
GuidSet Players; // player guid set
|
||||
TeamId teamId; // Player team (TEAM_ALLIANCE/TEAM_HORDE)
|
||||
TeamId RealTeamID; // Realm player team (TEAM_ALLIANCE/TEAM_HORDE)
|
||||
BattlegroundTypeId BgTypeId; // battleground type id
|
||||
|
|
@ -63,10 +63,10 @@ public:
|
|||
bool CheckNormalMatch(Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||
GroupQueueInfo* AddGroup(Player* leader, Group* group, PvPDifficultyEntry const* bracketEntry, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId);
|
||||
void RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQueueSlot);
|
||||
bool IsPlayerInvitedToRatedArena(uint64 pl_guid);
|
||||
bool IsPlayerInvited(uint64 pl_guid, uint32 bgInstanceGuid, uint32 removeTime);
|
||||
bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo);
|
||||
void RemovePlayer(ObjectGuid guid, bool sentToBg, uint32 playerQueueSlot);
|
||||
bool IsPlayerInvitedToRatedArena(ObjectGuid pl_guid);
|
||||
bool IsPlayerInvited(ObjectGuid pl_guid, uint32 bgInstanceGuid, uint32 removeTime);
|
||||
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo);
|
||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
|
||||
uint32 GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue);
|
||||
|
|
@ -77,7 +77,7 @@ public:
|
|||
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
|
||||
void AddEvent(BasicEvent* Event, uint64 e_time);
|
||||
|
||||
typedef std::map<uint64, GroupQueueInfo*> QueuedPlayersMap;
|
||||
typedef std::map<ObjectGuid, GroupQueueInfo*> QueuedPlayersMap;
|
||||
QueuedPlayersMap m_QueuedPlayers;
|
||||
|
||||
//do NOT use deque because deque.erase() invalidates ALL iterators
|
||||
|
|
@ -131,7 +131,7 @@ private:
|
|||
class BGQueueInviteEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
|
||||
BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
||||
{ }
|
||||
~BGQueueInviteEvent() override = default;
|
||||
|
|
@ -139,7 +139,7 @@ public:
|
|||
bool Execute(uint64 e_time, uint32 p_time) override;
|
||||
void Abort(uint64 e_time) override;
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
ObjectGuid m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
BattlegroundTypeId m_BgTypeId;
|
||||
uint8 m_ArenaType;
|
||||
|
|
@ -154,7 +154,7 @@ private:
|
|||
class BGQueueRemoveEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueRemoveEvent(uint64 pl_guid, uint32 bgInstanceGUID, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
|
||||
BGQueueRemoveEvent(ObjectGuid pl_guid, uint32 bgInstanceGUID, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
|
||||
: m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgQueueTypeId(bgQueueTypeId)
|
||||
{}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ public:
|
|||
bool Execute(uint64 e_time, uint32 p_time) override;
|
||||
void Abort(uint64 e_time) override;
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
ObjectGuid m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
uint32 m_RemoveTime;
|
||||
BattlegroundQueueTypeId m_BgQueueTypeId;
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
|
||||
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
|
||||
{
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node);
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
|
|
@ -307,7 +307,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
{
|
||||
if (!_capturePointInfo[node]._captured)
|
||||
{
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node);
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
|
|
@ -327,7 +327,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
}
|
||||
else
|
||||
{
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node);
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
NodeDeoccupied(node); // before setting team owner to neutral
|
||||
|
||||
|
|
@ -379,14 +379,14 @@ bool BattlegroundAB::SetupBattleground()
|
|||
AddSpiritGuide(BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][3], TEAM_HORDE);
|
||||
|
||||
for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
if (!BgObjects[i])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
if (!BgCreatures[i])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
|
|||
if (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3)
|
||||
|| (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
|
||||
{
|
||||
CreatureData& data = sObjectMgr->NewOrExistCreatureData(creature->GetDBTableGUIDLow());
|
||||
CreatureData& data = sObjectMgr->NewOrExistCreatureData(creature->GetSpawnId());
|
||||
data.wander_distance = 5;
|
||||
}
|
||||
//else wander_distance will be 15, so creatures move maximum=10
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ BattlegroundEY::BattlegroundEY()
|
|||
_honorTics = 0;
|
||||
_ownedPointsCount[TEAM_ALLIANCE] = 0;
|
||||
_ownedPointsCount[TEAM_HORDE] = 0;
|
||||
_flagKeeperGUID = 0;
|
||||
_droppedFlagGUID = 0;
|
||||
_flagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
_flagCapturedObject = 0;
|
||||
|
||||
|
|
@ -318,14 +316,14 @@ bool BattlegroundEY::SetupBattleground()
|
|||
AddSpiritGuide(BG_EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE);
|
||||
|
||||
for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
if (!BgObjects[i])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = BG_EY_SPIRIT_MAIN_ALLIANCE; i <= BG_EY_SPIRIT_MAIN_HORDE; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
if (!BgCreatures[i])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
|
|
@ -343,8 +341,8 @@ void BattlegroundEY::Init()
|
|||
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID(true)) ? BG_EY_HONOR_TICK_WEEKEND : BG_EY_HONOR_TICK_NORMAL;
|
||||
_ownedPointsCount[TEAM_ALLIANCE] = 0;
|
||||
_ownedPointsCount[TEAM_HORDE] = 0;
|
||||
_flagKeeperGUID = 0;
|
||||
_droppedFlagGUID = 0;
|
||||
_flagKeeperGUID.Clear();
|
||||
_droppedFlagGUID.Clear();
|
||||
_flagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
_flagCapturedObject = 0;
|
||||
}
|
||||
|
|
@ -372,9 +370,9 @@ void BattlegroundEY::RespawnFlagAfterDrop()
|
|||
|
||||
_flagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
RespawnFlag();
|
||||
if (GameObject* flag = ObjectAccessor::GetObjectInMap(GetDroppedFlagGUID(), FindBgMap(), (GameObject*)nullptr))
|
||||
if (GameObject* flag = FindBgMap()->GetGameObject(GetDroppedFlagGUID()))
|
||||
flag->Delete();
|
||||
SetDroppedFlagGUID(0);
|
||||
SetDroppedFlagGUID(ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer)
|
||||
|
|
@ -391,7 +389,7 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
|
|||
if (GetFlagPickerGUID() != player->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
SetFlagPicker(ObjectGuid::Empty);
|
||||
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -413,7 +411,7 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
_flagState = BG_EY_FLAG_STATE_ON_PLAYER;
|
||||
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_ONE_DAY);
|
||||
SetFlagPicker(player->GetGUID());
|
||||
SetDroppedFlagGUID(0);
|
||||
SetDroppedFlagGUID(ObjectGuid::Empty);
|
||||
|
||||
player->CastSpell(player, BG_EY_NETHERSTORM_FLAG_SPELL, true);
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
|
@ -501,7 +499,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
|
|||
|
||||
void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType)
|
||||
{
|
||||
SetFlagPicker(0);
|
||||
SetFlagPicker(ObjectGuid::Empty);
|
||||
_flagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
|
|
|||
|
|
@ -326,14 +326,14 @@ public:
|
|||
void StartingEventOpenDoors() override;
|
||||
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const override { return _flagKeeperGUID; }
|
||||
void SetFlagPicker(uint64 guid) { _flagKeeperGUID = guid; }
|
||||
ObjectGuid GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const override { return _flagKeeperGUID; }
|
||||
void SetFlagPicker(ObjectGuid guid) { _flagKeeperGUID = guid; }
|
||||
uint8 GetFlagState() const { return _flagState; }
|
||||
void RespawnFlag();
|
||||
void RespawnFlagAfterDrop();
|
||||
|
||||
void RemovePlayer(Player* player) override;
|
||||
void HandleBuffUse(uint64 buff_guid);
|
||||
void HandleBuffUse(ObjectGuid buff_guid);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger) override;
|
||||
void HandleKillPlayer(Player* player, Player* killer) override;
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player) override;
|
||||
|
|
@ -342,8 +342,8 @@ public:
|
|||
void EndBattleground(TeamId winnerTeamId) override;
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
void SetDroppedFlagGUID(uint64 guid, TeamId /*teamId*/ = TEAM_NEUTRAL) override { _droppedFlagGUID = guid; }
|
||||
uint64 GetDroppedFlagGUID() const { return _droppedFlagGUID; }
|
||||
void SetDroppedFlagGUID(ObjectGuid guid, TeamId /*teamId*/ = TEAM_NEUTRAL) override { _droppedFlagGUID = guid; }
|
||||
ObjectGuid GetDroppedFlagGUID() const { return _droppedFlagGUID; }
|
||||
|
||||
/* Battleground Events */
|
||||
void EventPlayerClickedOnFlag(Player* player, GameObject* gameObject) override;
|
||||
|
|
@ -390,8 +390,8 @@ private:
|
|||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint8 _ownedPointsCount[BG_TEAMS_COUNT];
|
||||
uint64 _flagKeeperGUID;
|
||||
uint64 _droppedFlagGUID;
|
||||
ObjectGuid _flagKeeperGUID;
|
||||
ObjectGuid _droppedFlagGUID;
|
||||
uint8 _flagState;
|
||||
uint32 _flagCapturedObject;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ BattlegroundIC::~BattlegroundIC()
|
|||
{
|
||||
}
|
||||
|
||||
void BattlegroundIC::DoAction(uint32 action, uint64 guid)
|
||||
void BattlegroundIC::DoAction(uint32 action, ObjectGuid guid)
|
||||
{
|
||||
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
|
||||
return;
|
||||
|
|
@ -127,7 +127,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
if (!catapult->IsAlive())
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow());
|
||||
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUID());
|
||||
if (itr == respawnMap.end() || time(nullptr) < itr->second)
|
||||
continue;
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
if (!glaiveThrower->IsAlive())
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow());
|
||||
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUID());
|
||||
if (itr == respawnMap.end() || time(nullptr) < itr->second)
|
||||
continue;
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
if (!siege->IsAlive())
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow());
|
||||
RespawnMap::iterator itr = respawnMap.find(siege->GetGUID());
|
||||
if (itr == respawnMap.end() || time(nullptr) < itr->second)
|
||||
continue;
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
if (!demolisher->IsAlive())
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow());
|
||||
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUID());
|
||||
if (itr == respawnMap.end() || time(nullptr) < itr->second)
|
||||
continue;
|
||||
|
||||
|
|
@ -521,7 +521,7 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
|
|||
// Xinef: Add to respawn list
|
||||
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
|
||||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
|
||||
respawnMap[unit->GetGUIDLow()] = time(nullptr) + VEHICLE_RESPAWN_TIME;
|
||||
respawnMap[unit->GetGUID()] = time(nullptr) + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -868,7 +868,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||
if (!siegeVehicle->IsVehicleInUse())
|
||||
Unit::Kill(siegeEngine, siegeEngine);
|
||||
|
||||
respawnMap[siegeEngine->GetGUIDLow()] = time(nullptr) + VEHICLE_RESPAWN_TIME;
|
||||
respawnMap[siegeEngine->GetGUID()] = time(nullptr) + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ public:
|
|||
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const override; // overwrited
|
||||
bool IsResourceGlutAllowed(TeamId teamId) const;
|
||||
void DoAction(uint32 action, uint64 guid) override;
|
||||
void DoAction(uint32 action, ObjectGuid guid) override;
|
||||
private:
|
||||
uint32 closeFortressDoorsTimer;
|
||||
bool doorsClosed;
|
||||
|
|
@ -935,7 +935,7 @@ private:
|
|||
BG_IC_GateState GateStatus[6];
|
||||
ICNodePoint nodePoint[7];
|
||||
|
||||
typedef std::map<uint32, uint32> RespawnMap;
|
||||
typedef std::map<ObjectGuid, uint32> RespawnMap;
|
||||
RespawnMap respawnMap;
|
||||
|
||||
MotionTransport* gunshipAlliance;
|
||||
|
|
|
|||
|
|
@ -886,13 +886,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
|
|||
|
||||
GraveyardStatus[i] = Source->GetTeamId();
|
||||
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
|
||||
std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]];
|
||||
GuidVector& ghost_list = m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]];
|
||||
if (!ghost_list.empty())
|
||||
{
|
||||
GraveyardStruct const* ClosestGrave = nullptr;
|
||||
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
|
||||
for (ObjectGuid const guid : ghost_list)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(*itr);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
|
|
@ -902,8 +902,9 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
|
|||
if (ClosestGrave)
|
||||
player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
|
||||
}
|
||||
|
||||
// xinef: clear resurrect queue for this creature
|
||||
m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]].clear();
|
||||
ghost_list.clear();
|
||||
}
|
||||
|
||||
DelCreature(BG_SA_MAXNPC + i);
|
||||
|
|
|
|||
|
|
@ -24,10 +24,6 @@ BattlegroundWS::BattlegroundWS()
|
|||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
|
||||
_flagKeepers[TEAM_ALLIANCE] = 0;
|
||||
_flagKeepers[TEAM_HORDE] = 0;
|
||||
_droppedFlagGUID[TEAM_ALLIANCE] = 0;
|
||||
_droppedFlagGUID[TEAM_HORDE] = 0;
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_lastFlagCaptureTeam = TEAM_NEUTRAL;
|
||||
|
|
@ -70,18 +66,18 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
|
|||
RespawnFlagAfterDrop(TEAM_HORDE);
|
||||
break;
|
||||
case BG_WS_EVENT_BOTH_FLAGS_KEPT10:
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)nullptr))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(FindBgMap(), GetFlagPickerGUID(TEAM_ALLIANCE)))
|
||||
player->CastSpell(player, BG_WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)nullptr))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(FindBgMap(), GetFlagPickerGUID(TEAM_HORDE)))
|
||||
player->CastSpell(player, BG_WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
break;
|
||||
case BG_WS_EVENT_BOTH_FLAGS_KEPT15:
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)nullptr))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(FindBgMap(), GetFlagPickerGUID(TEAM_ALLIANCE)))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->CastSpell(player, BG_WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
}
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)nullptr))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(FindBgMap(), GetFlagPickerGUID(TEAM_HORDE)))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->CastSpell(player, BG_WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
|
|
@ -142,7 +138,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(TeamId teamId)
|
|||
if (GameObject* flag = GetBgMap()->GetGameObject(GetDroppedFlagGUID(teamId)))
|
||||
flag->Delete();
|
||||
|
||||
SetDroppedFlagGUID(0, teamId);
|
||||
SetDroppedFlagGUID(ObjectGuid::Empty, teamId);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
|
|
@ -157,7 +153,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
|
|||
RemoveAssaultAuras();
|
||||
|
||||
AddPoints(player->GetTeamId(), 1);
|
||||
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
|
||||
SetFlagPicker(ObjectGuid::Empty, GetOtherTeamId(player->GetTeamId()));
|
||||
UpdateFlagState(GetOtherTeamId(player->GetTeamId()), BG_WS_FLAG_STATE_ON_BASE);
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
{
|
||||
|
|
@ -200,7 +196,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
|
|||
if (GetFlagPickerGUID(TEAM_HORDE) != player->GetGUID() && GetFlagPickerGUID(TEAM_ALLIANCE) != player->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
|
||||
SetFlagPicker(ObjectGuid::Empty, GetOtherTeamId(player->GetTeamId()));
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
|
||||
|
|
@ -279,7 +275,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
// Alliance Flag on ground
|
||||
if (GetFlagState(TEAM_ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(gameObject, 10.0f) && gameObject->GetEntry() == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
|
||||
{
|
||||
SetDroppedFlagGUID(0, TEAM_ALLIANCE);
|
||||
SetDroppedFlagGUID(ObjectGuid::Empty, TEAM_ALLIANCE);
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
{
|
||||
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_BASE);
|
||||
|
|
@ -310,7 +306,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
|||
// Horde Flag on ground
|
||||
if (GetFlagState(TEAM_HORDE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(gameObject, 10.0f) && gameObject->GetEntry() == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
|
||||
{
|
||||
SetDroppedFlagGUID(0, TEAM_HORDE);
|
||||
SetDroppedFlagGUID(ObjectGuid::Empty, TEAM_HORDE);
|
||||
if (player->GetTeamId() == TEAM_HORDE)
|
||||
{
|
||||
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_BASE);
|
||||
|
|
@ -412,14 +408,14 @@ bool BattlegroundWS::SetupBattleground()
|
|||
AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE);
|
||||
|
||||
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
if (!BgObjects[i])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i < BG_CREATURES_MAX_WS; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
if (!BgCreatures[i])
|
||||
{
|
||||
LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
|
|
@ -434,10 +430,10 @@ void BattlegroundWS::Init()
|
|||
Battleground::Init();
|
||||
|
||||
_bgEvents.Reset();
|
||||
_flagKeepers[TEAM_ALLIANCE] = 0;
|
||||
_flagKeepers[TEAM_HORDE] = 0;
|
||||
_droppedFlagGUID[TEAM_ALLIANCE] = 0;
|
||||
_droppedFlagGUID[TEAM_HORDE] = 0;
|
||||
_flagKeepers[TEAM_ALLIANCE].Clear();
|
||||
_flagKeepers[TEAM_HORDE].Clear();
|
||||
_droppedFlagGUID[TEAM_ALLIANCE].Clear();
|
||||
_droppedFlagGUID[TEAM_HORDE].Clear();
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_lastFlagCaptureTeam = TEAM_NEUTRAL;
|
||||
|
|
@ -530,8 +526,8 @@ TeamId BattlegroundWS::GetPrematureWinner()
|
|||
|
||||
uint32 BattlegroundWS::GetAssaultSpellId() const
|
||||
{
|
||||
if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
(GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
if ((!GetFlagPickerGUID(TEAM_ALLIANCE) && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
(!GetFlagPickerGUID(TEAM_HORDE) && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
_bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -540,12 +536,12 @@ uint32 BattlegroundWS::GetAssaultSpellId() const
|
|||
|
||||
void BattlegroundWS::RemoveAssaultAuras()
|
||||
{
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)nullptr))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(FindBgMap(), GetFlagPickerGUID(TEAM_ALLIANCE)))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
|
||||
}
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)nullptr))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(FindBgMap(), GetFlagPickerGUID(TEAM_HORDE)))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
|
||||
|
|
|
|||
|
|
@ -159,8 +159,8 @@ public:
|
|||
void StartingEventOpenDoors() override;
|
||||
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID(TeamId teamId) const override { return _flagKeepers[teamId]; }
|
||||
void SetFlagPicker(uint64 guid, TeamId teamId) { _flagKeepers[teamId] = guid; }
|
||||
ObjectGuid GetFlagPickerGUID(TeamId teamId) const override { return _flagKeepers[teamId]; }
|
||||
void SetFlagPicker(ObjectGuid guid, TeamId teamId) { _flagKeepers[teamId] = guid; }
|
||||
void RespawnFlagAfterDrop(TeamId teamId);
|
||||
uint8 GetFlagState(TeamId teamId) const { return _flagState[teamId]; }
|
||||
|
||||
|
|
@ -179,8 +179,8 @@ public:
|
|||
|
||||
void UpdateFlagState(TeamId teamId, uint32 value);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
void SetDroppedFlagGUID(uint64 guid, TeamId teamId) override { _droppedFlagGUID[teamId] = guid; }
|
||||
uint64 GetDroppedFlagGUID(TeamId teamId) const { return _droppedFlagGUID[teamId];}
|
||||
void SetDroppedFlagGUID(ObjectGuid guid, TeamId teamId) override { _droppedFlagGUID[teamId] = guid; }
|
||||
ObjectGuid GetDroppedFlagGUID(TeamId teamId) const { return _droppedFlagGUID[teamId];}
|
||||
void FillInitialWorldStates(WorldPacket& data) override;
|
||||
|
||||
/* Scorekeeping */
|
||||
|
|
@ -194,8 +194,8 @@ public:
|
|||
private:
|
||||
EventMap _bgEvents;
|
||||
|
||||
uint64 _flagKeepers[2];
|
||||
uint64 _droppedFlagGUID[2];
|
||||
ObjectGuid _flagKeepers[2];
|
||||
ObjectGuid _droppedFlagGUID[2];
|
||||
uint8 _flagState[2];
|
||||
TeamId _lastFlagCaptureTeam;
|
||||
uint32 _reputationCapture;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ void CalendarMgr::LoadFromDB()
|
|||
Field* fields = result->Fetch();
|
||||
|
||||
uint64 eventId = fields[0].GetUInt64();
|
||||
uint64 creatorGUID = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
ObjectGuid creatorGUID = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt32());
|
||||
std::string title = fields[2].GetString();
|
||||
std::string description = fields[3].GetString();
|
||||
CalendarEventType type = CalendarEventType(fields[4].GetUInt8());
|
||||
|
|
@ -66,7 +66,7 @@ void CalendarMgr::LoadFromDB()
|
|||
uint32 guildId = 0;
|
||||
|
||||
if (flags & CALENDAR_FLAG_GUILD_EVENT || flags & CALENDAR_FLAG_WITHOUT_INVITES)
|
||||
guildId = Player::GetGuildIdFromStorage(GUID_LOPART(creatorGUID));
|
||||
guildId = Player::GetGuildIdFromStorage(creatorGUID.GetCounter());
|
||||
|
||||
CalendarEvent* calendarEvent = new CalendarEvent(eventId, creatorGUID, guildId, type, dungeonId, time_t(eventTime), flags, time_t(timezoneTime), title, description);
|
||||
_events.insert(calendarEvent);
|
||||
|
|
@ -87,8 +87,8 @@ void CalendarMgr::LoadFromDB()
|
|||
|
||||
uint64 inviteId = fields[0].GetUInt64();
|
||||
uint64 eventId = fields[1].GetUInt64();
|
||||
uint64 invitee = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
uint64 senderGUID = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
ObjectGuid invitee = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt32());
|
||||
ObjectGuid senderGUID = ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt32());
|
||||
CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8());
|
||||
uint32 statusTime = fields[5].GetUInt32();
|
||||
CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8());
|
||||
|
|
@ -142,7 +142,7 @@ void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite
|
|||
}
|
||||
}
|
||||
|
||||
void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
|
||||
void CalendarMgr::RemoveEvent(uint64 eventId, ObjectGuid remover)
|
||||
{
|
||||
CalendarEvent* calendarEvent = GetEvent(eventId);
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
|
|||
RemoveEvent(calendarEvent, remover);
|
||||
}
|
||||
|
||||
void CalendarMgr::RemoveEvent(CalendarEvent* calendarEvent, uint64 remover)
|
||||
void CalendarMgr::RemoveEvent(CalendarEvent* calendarEvent, ObjectGuid remover)
|
||||
{
|
||||
if (!calendarEvent)
|
||||
{
|
||||
|
|
@ -180,7 +180,7 @@ void CalendarMgr::RemoveEvent(CalendarEvent* calendarEvent, uint64 remover)
|
|||
// guild events only? check invite status here?
|
||||
// When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki)
|
||||
if (remover && invite->GetInviteeGUID() != remover)
|
||||
mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID()), calendarEvent, MAIL_CHECK_MASK_COPIED);
|
||||
mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID().GetCounter()), calendarEvent, MAIL_CHECK_MASK_COPIED);
|
||||
|
||||
delete invite;
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ void CalendarMgr::RemoveEvent(CalendarEvent* calendarEvent, uint64 remover)
|
|||
return;
|
||||
}
|
||||
|
||||
void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, uint64 /*remover*/)
|
||||
void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid /*remover*/)
|
||||
{
|
||||
CalendarEvent* calendarEvent = GetEvent(eventId);
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent)
|
|||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT);
|
||||
stmt->setUInt64(0, calendarEvent->GetEventId());
|
||||
stmt->setUInt32(1, GUID_LOPART(calendarEvent->GetCreatorGUID()));
|
||||
stmt->setUInt32(1, calendarEvent->GetCreatorGUID().GetCounter());
|
||||
stmt->setString(2, calendarEvent->GetTitle());
|
||||
stmt->setString(3, calendarEvent->GetDescription());
|
||||
stmt->setUInt8(4, calendarEvent->GetType());
|
||||
|
|
@ -258,8 +258,8 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans)
|
|||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_INVITE);
|
||||
stmt->setUInt64(0, invite->GetInviteId());
|
||||
stmt->setUInt64(1, invite->GetEventId());
|
||||
stmt->setUInt32(2, GUID_LOPART(invite->GetInviteeGUID()));
|
||||
stmt->setUInt32(3, GUID_LOPART(invite->GetSenderGUID()));
|
||||
stmt->setUInt32(2, invite->GetInviteeGUID().GetCounter());
|
||||
stmt->setUInt32(3, invite->GetSenderGUID().GetCounter());
|
||||
stmt->setUInt8(4, invite->GetStatus());
|
||||
stmt->setUInt32(5, uint32(invite->GetStatusTime()));
|
||||
stmt->setUInt8(6, invite->GetRank());
|
||||
|
|
@ -267,7 +267,7 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans)
|
|||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
}
|
||||
|
||||
void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid)
|
||||
void CalendarMgr::RemoveAllPlayerEventsAndInvites(ObjectGuid guid)
|
||||
{
|
||||
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end();)
|
||||
{
|
||||
|
|
@ -275,7 +275,7 @@ void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid)
|
|||
++itr;
|
||||
if (event->GetCreatorGUID() == guid)
|
||||
{
|
||||
RemoveEvent(event, 0);
|
||||
RemoveEvent(event, ObjectGuid::Empty);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -285,7 +285,7 @@ void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid)
|
|||
RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
|
||||
}
|
||||
|
||||
void CalendarMgr::RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId)
|
||||
void CalendarMgr::RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId)
|
||||
{
|
||||
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
|
||||
if ((*itr)->GetCreatorGUID() == guid && ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement()))
|
||||
|
|
@ -365,11 +365,11 @@ void CalendarMgr::DeleteOldEvents()
|
|||
CalendarEvent* event = *itr;
|
||||
++itr;
|
||||
if (event->GetEventTime() < oldEventsTime)
|
||||
RemoveEvent(event, 0);
|
||||
RemoveEvent(event, ObjectGuid::Empty);
|
||||
}
|
||||
}
|
||||
|
||||
CalendarEventStore CalendarMgr::GetEventsCreatedBy(uint64 guid, bool includeGuildEvents)
|
||||
CalendarEventStore CalendarMgr::GetEventsCreatedBy(ObjectGuid guid, bool includeGuildEvents)
|
||||
{
|
||||
CalendarEventStore result;
|
||||
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
|
||||
|
|
@ -394,7 +394,7 @@ CalendarEventStore CalendarMgr::GetGuildEvents(uint32 guildId)
|
|||
return result;
|
||||
}
|
||||
|
||||
CalendarEventStore CalendarMgr::GetPlayerEvents(uint64 guid)
|
||||
CalendarEventStore CalendarMgr::GetPlayerEvents(ObjectGuid guid)
|
||||
{
|
||||
CalendarEventStore events;
|
||||
|
||||
|
|
@ -404,7 +404,7 @@ CalendarEventStore CalendarMgr::GetPlayerEvents(uint64 guid)
|
|||
if (CalendarEvent* event = GetEvent(itr->first)) // nullptr check added as attempt to fix #11512
|
||||
events.insert(event);
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
if (player->GetGuildId())
|
||||
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
|
||||
if ((*itr)->GetGuildId() == player->GetGuildId())
|
||||
|
|
@ -418,7 +418,7 @@ CalendarInviteStore const& CalendarMgr::GetEventInvites(uint64 eventId)
|
|||
return _invites[eventId];
|
||||
}
|
||||
|
||||
CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid)
|
||||
CalendarInviteStore CalendarMgr::GetPlayerInvites(ObjectGuid guid)
|
||||
{
|
||||
CalendarInviteStore invites;
|
||||
|
||||
|
|
@ -430,7 +430,7 @@ CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid)
|
|||
return invites;
|
||||
}
|
||||
|
||||
uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
|
||||
uint32 CalendarMgr::GetPlayerNumPending(ObjectGuid guid)
|
||||
{
|
||||
CalendarInviteStore const& invites = GetPlayerInvites(guid);
|
||||
|
||||
|
|
@ -452,10 +452,10 @@ uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
|
|||
return pendingNum;
|
||||
}
|
||||
|
||||
std::string CalendarEvent::BuildCalendarMailSubject(uint64 remover) const
|
||||
std::string CalendarEvent::BuildCalendarMailSubject(ObjectGuid remover) const
|
||||
{
|
||||
std::ostringstream strm;
|
||||
strm << remover << ':' << _title;
|
||||
strm << remover.ToString().c_str() << ':' << _title;
|
||||
return strm.str();
|
||||
}
|
||||
|
||||
|
|
@ -478,13 +478,13 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
|
|||
time_t statusTime = invite.GetStatusTime();
|
||||
bool hasStatusTime = statusTime != 946684800; // 01/01/2000 00:00:00
|
||||
|
||||
uint64 invitee = invite.GetInviteeGUID();
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(invitee);
|
||||
ObjectGuid invitee = invite.GetInviteeGUID();
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(invitee);
|
||||
|
||||
uint8 level = player ? player->getLevel() : Player::GetLevelFromStorage(invitee);
|
||||
uint8 level = player ? player->getLevel() : Player::GetLevelFromStorage(invitee.GetCounter());
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
|
||||
data.appendPackGUID(invitee);
|
||||
data << invitee.WriteAsPacked();
|
||||
data << uint64(invite.GetEventId());
|
||||
data << uint64(invite.GetInviteId());
|
||||
data << uint8(level);
|
||||
|
|
@ -496,7 +496,7 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
|
|||
|
||||
if (!calendarEvent) // Pre-invite
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(invite.GetSenderGUID()))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(invite.GetSenderGUID()))
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
else
|
||||
|
|
@ -529,7 +529,7 @@ void CalendarMgr::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEven
|
|||
void CalendarMgr::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
|
||||
{
|
||||
WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
|
||||
data.appendPackGUID(invite.GetInviteeGUID());
|
||||
data << invite.GetInviteeGUID().WriteAsPacked();
|
||||
data << uint64(calendarEvent.GetEventId());
|
||||
data.AppendPackedTime(calendarEvent.GetEventTime());
|
||||
data << uint32(calendarEvent.GetFlags());
|
||||
|
|
@ -553,7 +553,7 @@ void CalendarMgr::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEve
|
|||
void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags)
|
||||
{
|
||||
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1);
|
||||
data.appendPackGUID(invite.GetInviteeGUID());
|
||||
data<< invite.GetInviteeGUID().WriteAsPacked();
|
||||
data << uint64(invite.GetEventId());
|
||||
data << uint32(flags);
|
||||
data << uint8(1); // FIXME
|
||||
|
|
@ -564,7 +564,7 @@ void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEve
|
|||
void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
|
||||
{
|
||||
WorldPacket data(SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, 8 + 8 + 1 + 1);
|
||||
data.appendPackGUID(invite.GetInviteeGUID());
|
||||
data << invite.GetInviteeGUID().WriteAsPacked();
|
||||
data << uint64(invite.GetEventId());
|
||||
data << uint8(invite.GetRank());
|
||||
data << uint8(1); // Unk boolean - Display to client?
|
||||
|
|
@ -584,21 +584,21 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven
|
|||
data << uint64(invite.GetInviteId());
|
||||
data << uint8(invite.GetStatus());
|
||||
data << uint8(invite.GetRank());
|
||||
data.appendPackGUID(calendarEvent.GetCreatorGUID());
|
||||
data.appendPackGUID(invite.GetSenderGUID());
|
||||
data << calendarEvent.GetCreatorGUID().WriteAsPacked();
|
||||
data << invite.GetSenderGUID().WriteAsPacked();
|
||||
|
||||
if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
|
||||
{
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
|
||||
guild->BroadcastPacket(&data);
|
||||
}
|
||||
else if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(invite.GetInviteeGUID()))
|
||||
else if (Player* player = ObjectAccessor::FindConnectedPlayer(invite.GetInviteeGUID()))
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
|
||||
void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
|
|
@ -606,7 +606,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
|
|||
|
||||
WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
|
||||
data << uint8(sendType);
|
||||
data.appendPackGUID(calendarEvent.GetCreatorGUID());
|
||||
data << calendarEvent.GetCreatorGUID().WriteAsPacked();
|
||||
data << uint64(calendarEvent.GetEventId());
|
||||
data << calendarEvent.GetTitle();
|
||||
data << calendarEvent.GetDescription();
|
||||
|
|
@ -623,13 +623,13 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
|
|||
for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
|
||||
{
|
||||
CalendarInvite const* calendarInvite = (*itr);
|
||||
uint64 inviteeGuid = calendarInvite->GetInviteeGUID();
|
||||
Player* invitee = ObjectAccessor::FindPlayerInOrOutOfWorld(inviteeGuid);
|
||||
ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID();
|
||||
Player* invitee = ObjectAccessor::FindConnectedPlayer(inviteeGuid);
|
||||
|
||||
uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromStorage(inviteeGuid);
|
||||
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromStorage(GUID_LOPART(inviteeGuid));
|
||||
uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromStorage(inviteeGuid.GetCounter());
|
||||
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromStorage(inviteeGuid.GetCounter());
|
||||
|
||||
data.appendPackGUID(inviteeGuid);
|
||||
data << inviteeGuid.WriteAsPacked();
|
||||
data << uint8(inviteeLevel);
|
||||
data << uint8(calendarInvite->GetStatus());
|
||||
data << uint8(calendarInvite->GetRank());
|
||||
|
|
@ -642,9 +642,9 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
|
|||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
|
||||
void CalendarMgr::SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
{
|
||||
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT, 8 + 4 + 4 + 1);
|
||||
data << uint64(calendarEvent.GetEventId());
|
||||
|
|
@ -656,18 +656,18 @@ void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent
|
|||
}
|
||||
}
|
||||
|
||||
void CalendarMgr::SendCalendarClearPendingAction(uint64 guid)
|
||||
void CalendarMgr::SendCalendarClearPendingAction(ObjectGuid guid)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
{
|
||||
WorldPacket data(SMSG_CALENDAR_CLEAR_PENDING_ACTION, 0);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
void CalendarMgr::SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param /*= nullptr*/)
|
||||
void CalendarMgr::SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const* param /*= nullptr*/)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
{
|
||||
WorldPacket data(SMSG_CALENDAR_COMMAND_RESULT, 0);
|
||||
data << uint32(0);
|
||||
|
|
@ -700,7 +700,7 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEven
|
|||
// Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them)
|
||||
CalendarInviteStore invites = _invites[calendarEvent.GetEventId()];
|
||||
for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld((*itr)->GetInviteeGUID()))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer((*itr)->GetInviteeGUID()))
|
||||
if (!calendarEvent.IsGuildEvent() || player->GetGuildId() != calendarEvent.GetGuildId())
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
enum CalendarMailAnswers
|
||||
{
|
||||
|
|
@ -134,10 +135,10 @@ public:
|
|||
_text = calendarInvite.GetText();
|
||||
}
|
||||
|
||||
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(nullptr)),
|
||||
CalendarInvite() : _inviteId(1), _eventId(0), _statusTime(time(nullptr)),
|
||||
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
|
||||
|
||||
CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime,
|
||||
CalendarInvite(uint64 inviteId, uint64 eventId, ObjectGuid invitee, ObjectGuid senderGUID, time_t statusTime,
|
||||
CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
|
||||
_inviteId(inviteId), _eventId(eventId), _invitee(invitee), _senderGUID(senderGUID), _statusTime(statusTime),
|
||||
_status(status), _rank(rank), _text(text) { }
|
||||
|
|
@ -150,11 +151,11 @@ public:
|
|||
void SetEventId(uint64 eventId) { _eventId = eventId; }
|
||||
uint64 GetEventId() const { return _eventId; }
|
||||
|
||||
void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
|
||||
uint64 GetSenderGUID() const { return _senderGUID; }
|
||||
void SetSenderGUID(ObjectGuid guid) { _senderGUID = guid; }
|
||||
ObjectGuid GetSenderGUID() const { return _senderGUID; }
|
||||
|
||||
void SetInvitee(uint64 guid) { _invitee = guid; }
|
||||
uint64 GetInviteeGUID() const { return _invitee; }
|
||||
void SetInvitee(ObjectGuid guid) { _invitee = guid; }
|
||||
ObjectGuid GetInviteeGUID() const { return _invitee; }
|
||||
|
||||
void SetStatusTime(time_t statusTime) { _statusTime = statusTime; }
|
||||
time_t GetStatusTime() const { return _statusTime; }
|
||||
|
|
@ -171,8 +172,8 @@ public:
|
|||
private:
|
||||
uint64 _inviteId;
|
||||
uint64 _eventId;
|
||||
uint64 _invitee;
|
||||
uint64 _senderGUID;
|
||||
ObjectGuid _invitee;
|
||||
ObjectGuid _senderGUID;
|
||||
time_t _statusTime;
|
||||
CalendarInviteStatus _status;
|
||||
CalendarModerationRank _rank;
|
||||
|
|
@ -196,13 +197,13 @@ public:
|
|||
_description = calendarEvent.GetDescription();
|
||||
}
|
||||
|
||||
CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
|
||||
CalendarEvent(uint64 eventId, ObjectGuid creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
|
||||
time_t eventTime, uint32 flags, time_t timezoneTime, std::string title, std::string description) :
|
||||
_eventId(eventId), _creatorGUID(creatorGUID), _guildId(guildId), _type(type), _dungeonId(dungeonId),
|
||||
_eventTime(eventTime), _flags(flags), _timezoneTime(timezoneTime), _title(title),
|
||||
_description(description) { }
|
||||
|
||||
CalendarEvent() : _eventId(1), _creatorGUID(0), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
|
||||
CalendarEvent() : _eventId(1), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
|
||||
_flags(0), _timezoneTime(0), _title(""), _description("") { }
|
||||
|
||||
~CalendarEvent();
|
||||
|
|
@ -210,8 +211,8 @@ public:
|
|||
void SetEventId(uint64 eventId) { _eventId = eventId; }
|
||||
uint64 GetEventId() const { return _eventId; }
|
||||
|
||||
void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
|
||||
uint64 GetCreatorGUID() const { return _creatorGUID; }
|
||||
void SetCreatorGUID(ObjectGuid guid) { _creatorGUID = guid; }
|
||||
ObjectGuid GetCreatorGUID() const { return _creatorGUID; }
|
||||
|
||||
void SetGuildId(uint32 guildId) { _guildId = guildId; }
|
||||
uint32 GetGuildId() const { return _guildId; }
|
||||
|
|
@ -243,12 +244,12 @@ public:
|
|||
static bool IsGuildEvent(uint32 flags) { return (flags & CALENDAR_FLAG_GUILD_EVENT) != 0; }
|
||||
static bool IsGuildAnnouncement(uint32 flags) { return (flags & CALENDAR_FLAG_WITHOUT_INVITES) != 0; }
|
||||
|
||||
std::string BuildCalendarMailSubject(uint64 remover) const;
|
||||
std::string BuildCalendarMailSubject(ObjectGuid remover) const;
|
||||
std::string BuildCalendarMailBody() const;
|
||||
|
||||
private:
|
||||
uint64 _eventId;
|
||||
uint64 _creatorGUID;
|
||||
ObjectGuid _creatorGUID;
|
||||
uint32 _guildId;
|
||||
CalendarEventType _type;
|
||||
int32 _dungeonId;
|
||||
|
|
@ -283,14 +284,14 @@ public:
|
|||
|
||||
CalendarEvent* GetEvent(uint64 eventId);
|
||||
CalendarEventStore const& GetEvents() const { return _events; }
|
||||
CalendarEventStore GetEventsCreatedBy(uint64 guid, bool includeGuildEvents = false);
|
||||
CalendarEventStore GetPlayerEvents(uint64 guid);
|
||||
CalendarEventStore GetEventsCreatedBy(ObjectGuid guid, bool includeGuildEvents = false);
|
||||
CalendarEventStore GetPlayerEvents(ObjectGuid guid);
|
||||
CalendarEventStore GetGuildEvents(uint32 guildId);
|
||||
|
||||
CalendarInvite* GetInvite(uint64 inviteId) const;
|
||||
CalendarEventInviteStore const& GetInvites() const { return _invites; }
|
||||
CalendarInviteStore const& GetEventInvites(uint64 eventId);
|
||||
CalendarInviteStore GetPlayerInvites(uint64 guid);
|
||||
CalendarInviteStore GetPlayerInvites(ObjectGuid guid);
|
||||
|
||||
void FreeEventId(uint64 id);
|
||||
uint64 GetFreeEventId();
|
||||
|
|
@ -299,33 +300,33 @@ public:
|
|||
|
||||
void DeleteOldEvents();
|
||||
|
||||
uint32 GetPlayerNumPending(uint64 guid);
|
||||
uint32 GetPlayerNumPending(ObjectGuid guid);
|
||||
|
||||
void AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType sendType);
|
||||
void RemoveEvent(uint64 eventId, uint64 remover);
|
||||
void RemoveEvent(CalendarEvent* calendarEvent, uint64 remover);
|
||||
void RemoveEvent(uint64 eventId, ObjectGuid remover);
|
||||
void RemoveEvent(CalendarEvent* calendarEvent, ObjectGuid remover);
|
||||
void UpdateEvent(CalendarEvent* calendarEvent);
|
||||
|
||||
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite);
|
||||
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans);
|
||||
void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover);
|
||||
void RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid remover);
|
||||
void UpdateInvite(CalendarInvite* invite);
|
||||
void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans);
|
||||
|
||||
void RemoveAllPlayerEventsAndInvites(uint64 guid);
|
||||
void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId);
|
||||
void RemoveAllPlayerEventsAndInvites(ObjectGuid guid);
|
||||
void RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId);
|
||||
|
||||
void SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
|
||||
void SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
|
||||
void SendCalendarEventInvite(CalendarInvite const& invite);
|
||||
void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags);
|
||||
void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
|
||||
void SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
|
||||
void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime);
|
||||
void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent);
|
||||
void SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
|
||||
void SendCalendarClearPendingAction(uint64 guid);
|
||||
void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = nullptr);
|
||||
void SendCalendarClearPendingAction(ObjectGuid guid);
|
||||
void SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const* param = nullptr);
|
||||
|
||||
void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const& calendarEvent);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
|
|||
_channelId(channelId),
|
||||
_channelDBId(channelDBId),
|
||||
_teamId(teamId),
|
||||
_ownerGUID(0),
|
||||
_name(name),
|
||||
_password("")
|
||||
{
|
||||
|
|
@ -81,9 +80,9 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
|
|||
}
|
||||
}
|
||||
|
||||
bool Channel::IsBanned(uint64 guid) const
|
||||
bool Channel::IsBanned(ObjectGuid guid) const
|
||||
{
|
||||
BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid));
|
||||
BannedContainer::const_iterator itr = bannedStore.find(guid);
|
||||
return itr != bannedStore.end() && itr->second > time(nullptr);
|
||||
}
|
||||
|
||||
|
|
@ -110,20 +109,20 @@ void Channel::UpdateChannelUseageInDB() const
|
|||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
void Channel::AddChannelBanToDB(uint32 guid, uint32 time) const
|
||||
void Channel::AddChannelBanToDB(ObjectGuid guid, uint32 time) const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL_BAN);
|
||||
stmt->setUInt32(0, _channelDBId);
|
||||
stmt->setUInt32(1, guid);
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
stmt->setUInt32(2, time);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
void Channel::RemoveChannelBanFromDB(uint32 guid) const
|
||||
void Channel::RemoveChannelBanFromDB(ObjectGuid guid) const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL_BAN);
|
||||
stmt->setUInt32(0, _channelDBId);
|
||||
stmt->setUInt32(1, guid);
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +145,7 @@ void Channel::CleanOldChannelsInDB()
|
|||
|
||||
void Channel::JoinChannel(Player* player, std::string const& pass)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
if (IsOn(guid))
|
||||
{
|
||||
// Do not send error message for built-in channels
|
||||
|
|
@ -243,7 +242,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
|
|||
|
||||
void Channel::LeaveChannel(Player* player, bool send)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
if (!IsOn(guid))
|
||||
{
|
||||
if (send)
|
||||
|
|
@ -288,7 +287,7 @@ void Channel::LeaveChannel(Player* player, bool send)
|
|||
{
|
||||
if (!playersStore.empty())
|
||||
{
|
||||
uint64 newowner = 0;
|
||||
ObjectGuid newowner;
|
||||
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
|
||||
{
|
||||
newowner = itr->second.player;
|
||||
|
|
@ -303,7 +302,7 @@ void Channel::LeaveChannel(Player* player, bool send)
|
|||
// if the new owner is invisible gm, set flag to automatically choose a new owner
|
||||
}
|
||||
else
|
||||
SetOwner(0);
|
||||
SetOwner(ObjectGuid::Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -311,7 +310,7 @@ void Channel::LeaveChannel(Player* player, bool send)
|
|||
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
|
||||
{
|
||||
AccountTypes sec = player->GetSession()->GetSecurity();
|
||||
uint64 good = player->GetGUID();
|
||||
ObjectGuid good = player->GetGUID();
|
||||
|
||||
if (!IsOn(good))
|
||||
{
|
||||
|
|
@ -332,7 +331,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|||
bool banOffline = false; // pussywizard
|
||||
bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end();
|
||||
|
||||
uint64 victim = 0;
|
||||
ObjectGuid victim;
|
||||
uint32 badAccId = 0;
|
||||
uint32 badSecurity = 0;
|
||||
Player* bad = ObjectAccessor::FindPlayerByName(badname, false);
|
||||
|
|
@ -348,13 +347,13 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|||
{
|
||||
if (ban && (AccountMgr::IsGMAccount(sec) || isGoodConstantModerator))
|
||||
{
|
||||
if (uint32 lowGuid = sWorld->GetGlobalPlayerGUID(badname))
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(lowGuid))
|
||||
if (ObjectGuid guid = sWorld->GetGlobalPlayerGUID(badname))
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(guid.GetCounter()))
|
||||
{
|
||||
if (Player::TeamIdForRace(gpd->race) == Player::TeamIdForRace(player->getRace()))
|
||||
{
|
||||
banOffline = true;
|
||||
victim = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER);
|
||||
victim = guid;
|
||||
badAccId = gpd->accountId;
|
||||
}
|
||||
else
|
||||
|
|
@ -417,8 +416,8 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|||
{
|
||||
if (!IsBanned(victim))
|
||||
{
|
||||
bannedStore[GUID_LOPART(victim)] = time(nullptr) + CHANNEL_BAN_DURATION;
|
||||
AddChannelBanToDB(GUID_LOPART(victim), time(nullptr) + CHANNEL_BAN_DURATION);
|
||||
bannedStore[victim] = time(nullptr) + CHANNEL_BAN_DURATION;
|
||||
AddChannelBanToDB(victim, time(nullptr) + CHANNEL_BAN_DURATION);
|
||||
|
||||
if (notify)
|
||||
{
|
||||
|
|
@ -449,7 +448,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|||
SetOwner(good);
|
||||
else if (!playersStore.empty())
|
||||
{
|
||||
uint64 newowner = 0;
|
||||
ObjectGuid newowner;
|
||||
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
|
||||
{
|
||||
newowner = itr->second.player;
|
||||
|
|
@ -459,14 +458,14 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|||
SetOwner(newowner);
|
||||
}
|
||||
else
|
||||
SetOwner(0);
|
||||
SetOwner(ObjectGuid::Empty);
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::UnBan(Player const* player, std::string const& badname)
|
||||
{
|
||||
uint32 sec = player->GetSession()->GetSecurity();
|
||||
uint64 good = player->GetGUID();
|
||||
ObjectGuid good = player->GetGUID();
|
||||
|
||||
if (!IsOn(good))
|
||||
{
|
||||
|
|
@ -484,9 +483,9 @@ void Channel::UnBan(Player const* player, std::string const& badname)
|
|||
return;
|
||||
}
|
||||
|
||||
uint64 victim = 0;
|
||||
if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(badname))
|
||||
victim = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||
ObjectGuid victim;
|
||||
if (ObjectGuid guid = sWorld->GetGlobalPlayerGUID(badname))
|
||||
victim = guid;
|
||||
|
||||
if (!victim || !IsBanned(victim))
|
||||
{
|
||||
|
|
@ -509,27 +508,29 @@ void Channel::UnBan(Player const* player, std::string const& badname)
|
|||
}
|
||||
|
||||
if (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN)
|
||||
LOG_GM(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [guid: %u, account: %u] unbanned %s [guid: %u])", GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), badname.c_str(), GUID_LOPART(victim));
|
||||
LOG_GM(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [%s, account: %u] unbanned %s [%s])",
|
||||
GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(), player->GetSession()->GetAccountId(),
|
||||
badname.c_str(), victim.ToString().c_str());
|
||||
|
||||
bannedStore.erase(GUID_LOPART(victim));
|
||||
RemoveChannelBanFromDB(GUID_LOPART(victim));
|
||||
bannedStore.erase(victim);
|
||||
RemoveChannelBanFromDB(victim);
|
||||
|
||||
WorldPacket data;
|
||||
MakePlayerUnbanned(&data, victim, good);
|
||||
SendToAll(&data);
|
||||
}
|
||||
|
||||
void Channel::UnBan(uint64 guid)
|
||||
void Channel::UnBan(ObjectGuid guid)
|
||||
{
|
||||
if (!IsBanned(guid))
|
||||
return;
|
||||
bannedStore.erase(GUID_LOPART(guid));
|
||||
RemoveChannelBanFromDB(GUID_LOPART(guid));
|
||||
bannedStore.erase(guid);
|
||||
RemoveChannelBanFromDB(guid);
|
||||
}
|
||||
|
||||
void Channel::Password(Player const* player, std::string const& pass)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
|
||||
ChatHandler chat(player->GetSession());
|
||||
if (!IsOn(guid))
|
||||
|
|
@ -567,7 +568,7 @@ void Channel::Password(Player const* player, std::string const& pass)
|
|||
|
||||
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
uint32 sec = player->GetSession()->GetSecurity();
|
||||
|
||||
if (!IsOn(guid))
|
||||
|
|
@ -590,7 +591,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
|
|||
return;
|
||||
|
||||
Player* newp = ObjectAccessor::FindPlayerByName(p2n, false);
|
||||
uint64 victim = newp ? newp->GetGUID() : 0;
|
||||
ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
|
||||
|
||||
if (!victim || !IsOn(victim) ||
|
||||
// allow make moderator from another team only if both is GMs
|
||||
|
|
@ -638,7 +639,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
|
|||
|
||||
void Channel::SetOwner(Player const* player, std::string const& newname)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
uint32 sec = player->GetSession()->GetSecurity();
|
||||
|
||||
if (!IsOn(guid))
|
||||
|
|
@ -659,7 +660,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
|
|||
}
|
||||
|
||||
Player* newp = ObjectAccessor::FindPlayerByName(newname, false);
|
||||
uint64 victim = newp ? newp->GetGUID() : 0;
|
||||
ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
|
||||
|
||||
if (!victim || !IsOn(victim) || (newp->GetTeamId() != player->GetTeamId() &&
|
||||
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
|
||||
|
|
@ -673,7 +674,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
|
|||
SetOwner(victim);
|
||||
}
|
||||
|
||||
void Channel::SendWhoOwner(uint64 guid)
|
||||
void Channel::SendWhoOwner(ObjectGuid guid)
|
||||
{
|
||||
WorldPacket data;
|
||||
if (IsOn(guid))
|
||||
|
|
@ -685,7 +686,7 @@ void Channel::SendWhoOwner(uint64 guid)
|
|||
|
||||
void Channel::List(Player const* player)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
|
||||
if (!IsOn(guid))
|
||||
{
|
||||
|
|
@ -711,7 +712,7 @@ void Channel::List(Player const* player)
|
|||
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
|
||||
if (AccountMgr::IsPlayerAccount(i->second.plrPtr->GetSession()->GetSecurity()))
|
||||
{
|
||||
data << uint64(i->first);
|
||||
data << i->first;
|
||||
data << uint8(i->second.flags); // flags seems to be changed...
|
||||
++count;
|
||||
}
|
||||
|
|
@ -723,7 +724,7 @@ void Channel::List(Player const* player)
|
|||
|
||||
void Channel::Announce(Player const* player)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
uint32 sec = player->GetSession()->GetSecurity();
|
||||
|
||||
if (!IsOn(guid))
|
||||
|
|
@ -762,7 +763,7 @@ void Channel::Announce(Player const* player)
|
|||
UpdateChannelInDB();
|
||||
}
|
||||
|
||||
void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
|
||||
void Channel::Say(ObjectGuid guid, std::string const& what, uint32 lang)
|
||||
{
|
||||
if (what.empty())
|
||||
return;
|
||||
|
|
@ -814,7 +815,7 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
|
|||
else
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), guid, guid, what, 0, "", "", 0, false, _name);
|
||||
|
||||
SendToAll(&data, pinfo.IsModerator() ? 0 : guid);
|
||||
SendToAll(&data, pinfo.IsModerator() ? ObjectGuid::Empty : guid);
|
||||
}
|
||||
|
||||
void Channel::EveryoneSayToSelf(const char* what)
|
||||
|
|
@ -845,7 +846,7 @@ void Channel::EveryoneSayToSelf(const char* what)
|
|||
|
||||
void Channel::Invite(Player const* player, std::string const& newname)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
|
||||
if (!IsOn(guid))
|
||||
{
|
||||
|
|
@ -888,7 +889,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!newp->GetSocial()->HasIgnore(GUID_LOPART(guid)))
|
||||
if (!newp->GetSocial()->HasIgnore(guid))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeInvite(&data, guid);
|
||||
|
|
@ -901,7 +902,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
|
|||
SendToOne(&data, guid);
|
||||
}
|
||||
|
||||
void Channel::SetOwner(uint64 guid, bool exclaim)
|
||||
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
|
||||
{
|
||||
if (_ownerGUID)
|
||||
{
|
||||
|
|
@ -950,23 +951,23 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
|
|||
}
|
||||
}
|
||||
|
||||
void Channel::SendToAll(WorldPacket* data, uint64 guid)
|
||||
void Channel::SendToAll(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
|
||||
if (!guid || !i->second.plrPtr->GetSocial()->HasIgnore(GUID_LOPART(guid)))
|
||||
if (!guid || !i->second.plrPtr->GetSocial()->HasIgnore(guid))
|
||||
i->second.plrPtr->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
|
||||
void Channel::SendToAllButOne(WorldPacket* data, ObjectGuid who)
|
||||
{
|
||||
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
|
||||
if (i->first != who)
|
||||
i->second.plrPtr->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
void Channel::SendToOne(WorldPacket* data, uint64 who)
|
||||
void Channel::SendToOne(WorldPacket* data, ObjectGuid who)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(who))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(who))
|
||||
player->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
|
|
@ -976,11 +977,11 @@ void Channel::SendToAllWatching(WorldPacket* data)
|
|||
(*i)->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
|
||||
void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
|
||||
{
|
||||
}
|
||||
|
||||
void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
|
||||
void Channel::DeVoice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -991,16 +992,16 @@ void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type)
|
|||
*data << _name;
|
||||
}
|
||||
|
||||
void Channel::MakeJoined(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeJoined(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeLeft(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeLeft(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeYouJoined(WorldPacket* data)
|
||||
|
|
@ -1033,16 +1034,16 @@ void Channel::MakeNotModerator(WorldPacket* data)
|
|||
MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE);
|
||||
}
|
||||
|
||||
void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakePasswordChanged(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeOwnerChanged(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakePlayerNotFound(WorldPacket* data, std::string const& name)
|
||||
|
|
@ -1060,31 +1061,31 @@ void Channel::MakeChannelOwner(WorldPacket* data)
|
|||
{
|
||||
std::string name = "";
|
||||
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(_ownerGUID, name) || name.empty())
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(_ownerGUID.GetCounter(), name) || name.empty())
|
||||
name = "PLAYER_NOT_FOUND";
|
||||
|
||||
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
|
||||
*data << ((IsConstant() || !_ownerGUID) ? "Nobody" : name);
|
||||
}
|
||||
|
||||
void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
|
||||
void Channel::MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
*data << uint8(oldflags);
|
||||
*data << uint8(GetPlayerFlags(guid));
|
||||
}
|
||||
|
||||
void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeMuted(WorldPacket* data)
|
||||
|
|
@ -1092,11 +1093,11 @@ void Channel::MakeMuted(WorldPacket* data)
|
|||
MakeNotifyPacket(data, CHAT_MUTED_NOTICE);
|
||||
}
|
||||
|
||||
void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good)
|
||||
void Channel::MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE);
|
||||
*data << uint64(bad);
|
||||
*data << uint64(good);
|
||||
*data << bad;
|
||||
*data << good;
|
||||
}
|
||||
|
||||
void Channel::MakeBanned(WorldPacket* data)
|
||||
|
|
@ -1104,18 +1105,18 @@ void Channel::MakeBanned(WorldPacket* data)
|
|||
MakeNotifyPacket(data, CHAT_BANNED_NOTICE);
|
||||
}
|
||||
|
||||
void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good)
|
||||
void Channel::MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE);
|
||||
*data << uint64(bad);
|
||||
*data << uint64(good);
|
||||
*data << bad;
|
||||
*data << good;
|
||||
}
|
||||
|
||||
void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good)
|
||||
void Channel::MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE);
|
||||
*data << uint64(bad);
|
||||
*data << uint64(good);
|
||||
*data << bad;
|
||||
*data << good;
|
||||
}
|
||||
|
||||
void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string& name)
|
||||
|
|
@ -1124,16 +1125,16 @@ void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string& name)
|
|||
*data << name;
|
||||
}
|
||||
|
||||
void Channel::MakePlayerAlreadyMember(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeInvite(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeInvite(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeInviteWrongFaction(WorldPacket* data)
|
||||
|
|
@ -1183,16 +1184,16 @@ void Channel::MakeNotInLfg(WorldPacket* data)
|
|||
MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE);
|
||||
}
|
||||
|
||||
void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeVoiceOn(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeVoiceOff(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::JoinNotify(Player* p)
|
||||
|
|
@ -1203,7 +1204,7 @@ void Channel::JoinNotify(Player* p)
|
|||
return;
|
||||
|
||||
WorldPacket data(SMSG_USERLIST_ADD, 8 + 1 + 1 + 4 + GetName().size());
|
||||
data << uint64(p->GetGUID());
|
||||
data << p->GetGUID();
|
||||
data << uint8(GetPlayerFlags(p->GetGUID()));
|
||||
data << uint8(GetFlags());
|
||||
data << uint32(GetNumPlayers());
|
||||
|
|
@ -1220,7 +1221,7 @@ void Channel::LeaveNotify(Player* p)
|
|||
return;
|
||||
|
||||
WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size());
|
||||
data << uint64(p->GetGUID());
|
||||
data << p->GetGUID();
|
||||
data << uint8(GetFlags());
|
||||
data << uint32(GetNumPlayers());
|
||||
data << GetName();
|
||||
|
|
@ -1236,7 +1237,7 @@ void Channel::FlagsNotify(Player* p)
|
|||
return;
|
||||
|
||||
WorldPacket data(SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size());
|
||||
data << uint64(p->GetGUID());
|
||||
data << p->GetGUID();
|
||||
data << uint8(GetPlayerFlags(p->GetGUID()));
|
||||
data << uint8(GetFlags());
|
||||
data << uint32(GetNumPlayers());
|
||||
|
|
@ -1261,7 +1262,7 @@ void Channel::RemoveWatching(Player* p)
|
|||
|
||||
void Channel::ToggleModeration(Player* player)
|
||||
{
|
||||
uint64 guid = player->GetGUIDLow();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
|
||||
if (!IsOn(guid))
|
||||
{
|
||||
|
|
@ -1298,14 +1299,14 @@ void Channel::ToggleModeration(Player* player)
|
|||
SendToAll(&data);
|
||||
}
|
||||
|
||||
void Channel::MakeModerationOn(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeModerationOn(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_MODERATION_ON_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void Channel::MakeModerationOff(WorldPacket* data, uint64 guid)
|
||||
void Channel::MakeModerationOff(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_MODERATION_OFF_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << guid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class Channel
|
|||
{
|
||||
struct PlayerInfo
|
||||
{
|
||||
uint64 player;
|
||||
ObjectGuid player;
|
||||
uint8 flags;
|
||||
uint64 lastSpeakTime; // pussywizard
|
||||
Player* plrPtr; // pussywizard
|
||||
|
|
@ -194,25 +194,25 @@ public:
|
|||
void KickOrBan(Player const* player, std::string const& badname, bool ban);
|
||||
void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); }
|
||||
void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); }
|
||||
void AddBan(uint32 guid, uint32 time) { bannedStore[guid] = time; }
|
||||
void AddBan(ObjectGuid guid, uint32 time) { bannedStore[guid] = time; }
|
||||
void UnBan(Player const* player, std::string const& badname);
|
||||
void UnBan(uint64 guid);
|
||||
void UnBan(ObjectGuid guid);
|
||||
void Password(Player const* player, std::string const& pass);
|
||||
void SetMode(Player const* player, std::string const& p2n, bool mod, bool set);
|
||||
void SetOwner(uint64 guid, bool exclaim = true);
|
||||
void SetOwner(ObjectGuid guid, bool exclaim = true);
|
||||
void SetOwner(Player const* player, std::string const& name);
|
||||
void SendWhoOwner(uint64 guid);
|
||||
void SendWhoOwner(ObjectGuid guid);
|
||||
void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); }
|
||||
void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); }
|
||||
void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); }
|
||||
void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); }
|
||||
void List(Player const* player);
|
||||
void Announce(Player const* player);
|
||||
void Say(uint64 guid, std::string const& what, uint32 lang);
|
||||
void Say(ObjectGuid guid, std::string const& what, uint32 lang);
|
||||
void EveryoneSayToSelf(const char* what);
|
||||
void Invite(Player const* player, std::string const& newp);
|
||||
void Voice(uint64 guid1, uint64 guid2);
|
||||
void DeVoice(uint64 guid1, uint64 guid2);
|
||||
void Voice(ObjectGuid guid1, ObjectGuid guid2);
|
||||
void DeVoice(ObjectGuid guid1, ObjectGuid guid2);
|
||||
void JoinNotify(Player* p);
|
||||
void LeaveNotify(Player* p);
|
||||
void FlagsNotify(Player* p);
|
||||
|
|
@ -227,63 +227,63 @@ private:
|
|||
// initial packet data (notify type and channel name)
|
||||
void MakeNotifyPacket(WorldPacket* data, uint8 notify_type);
|
||||
// type specific packet data
|
||||
void MakeJoined(WorldPacket* data, uint64 guid); //+ 0x00
|
||||
void MakeLeft(WorldPacket* data, uint64 guid); //+ 0x01
|
||||
void MakeYouJoined(WorldPacket* data); //+ 0x02
|
||||
void MakeYouLeft(WorldPacket* data); //+ 0x03
|
||||
void MakeWrongPassword(WorldPacket* data); //? 0x04
|
||||
void MakeNotMember(WorldPacket* data); //? 0x05
|
||||
void MakeNotModerator(WorldPacket* data); //? 0x06
|
||||
void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07
|
||||
void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08
|
||||
void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
|
||||
void MakeNotOwner(WorldPacket* data); //? 0x0A
|
||||
void MakeChannelOwner(WorldPacket* data); //? 0x0B
|
||||
void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C
|
||||
void MakeAnnouncementsOn(WorldPacket* data, uint64 guid); //+ 0x0D
|
||||
void MakeAnnouncementsOff(WorldPacket* data, uint64 guid); //+ 0x0E
|
||||
void MakeMuted(WorldPacket* data); //? 0x11
|
||||
void MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good); //? 0x12
|
||||
void MakeBanned(WorldPacket* data); //? 0x13
|
||||
void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14
|
||||
void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15
|
||||
void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
|
||||
void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17
|
||||
void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18
|
||||
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
|
||||
void MakeWrongFaction(WorldPacket* data); //? 0x1A
|
||||
void MakeInvalidName(WorldPacket* data); //? 0x1B
|
||||
void MakeNotModerated(WorldPacket* data); //? 0x1C
|
||||
void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D
|
||||
void MakePlayerInviteBanned(WorldPacket* data, std::string const& name);//? 0x1E
|
||||
void MakeThrottled(WorldPacket* data); //? 0x1F
|
||||
void MakeNotInArea(WorldPacket* data); //? 0x20
|
||||
void MakeNotInLfg(WorldPacket* data); //? 0x21
|
||||
void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
|
||||
void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23
|
||||
void MakeModerationOn(WorldPacket* data, uint64 guid);
|
||||
void MakeModerationOff(WorldPacket* data, uint64 guid);
|
||||
void MakeJoined(WorldPacket* data, ObjectGuid guid); //+ 0x00
|
||||
void MakeLeft(WorldPacket* data, ObjectGuid guid); //+ 0x01
|
||||
void MakeYouJoined(WorldPacket* data); //+ 0x02
|
||||
void MakeYouLeft(WorldPacket* data); //+ 0x03
|
||||
void MakeWrongPassword(WorldPacket* data); //? 0x04
|
||||
void MakeNotMember(WorldPacket* data); //? 0x05
|
||||
void MakeNotModerator(WorldPacket* data); //? 0x06
|
||||
void MakePasswordChanged(WorldPacket* data, ObjectGuid guid); //+ 0x07
|
||||
void MakeOwnerChanged(WorldPacket* data, ObjectGuid guid); //? 0x08
|
||||
void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
|
||||
void MakeNotOwner(WorldPacket* data); //? 0x0A
|
||||
void MakeChannelOwner(WorldPacket* data); //? 0x0B
|
||||
void MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags); //+ 0x0C
|
||||
void MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid); //+ 0x0D
|
||||
void MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid); //+ 0x0E
|
||||
void MakeMuted(WorldPacket* data); //? 0x11
|
||||
void MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good); //? 0x12
|
||||
void MakeBanned(WorldPacket* data); //? 0x13
|
||||
void MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good); //? 0x14
|
||||
void MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x15
|
||||
void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
|
||||
void MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid); //+ 0x17
|
||||
void MakeInvite(WorldPacket* data, ObjectGuid guid); //? 0x18
|
||||
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
|
||||
void MakeWrongFaction(WorldPacket* data); //? 0x1A
|
||||
void MakeInvalidName(WorldPacket* data); //? 0x1B
|
||||
void MakeNotModerated(WorldPacket* data); //? 0x1C
|
||||
void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D
|
||||
void MakePlayerInviteBanned(WorldPacket* data, std::string const& name); //? 0x1E
|
||||
void MakeThrottled(WorldPacket* data); //? 0x1F
|
||||
void MakeNotInArea(WorldPacket* data); //? 0x20
|
||||
void MakeNotInLfg(WorldPacket* data); //? 0x21
|
||||
void MakeVoiceOn(WorldPacket* data, ObjectGuid guid); //+ 0x22
|
||||
void MakeVoiceOff(WorldPacket* data, ObjectGuid guid); //+ 0x23
|
||||
void MakeModerationOn(WorldPacket* data, ObjectGuid guid);
|
||||
void MakeModerationOff(WorldPacket* data, ObjectGuid guid);
|
||||
|
||||
void SendToAll(WorldPacket* data, uint64 guid = 0);
|
||||
void SendToAllButOne(WorldPacket* data, uint64 who);
|
||||
void SendToOne(WorldPacket* data, uint64 who);
|
||||
void SendToAll(WorldPacket* data, ObjectGuid guid = ObjectGuid::Empty);
|
||||
void SendToAllButOne(WorldPacket* data, ObjectGuid who);
|
||||
void SendToOne(WorldPacket* data, ObjectGuid who);
|
||||
void SendToAllWatching(WorldPacket* data);
|
||||
|
||||
bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
|
||||
bool IsBanned(uint64 guid) const;
|
||||
bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); }
|
||||
bool IsBanned(ObjectGuid guid) const;
|
||||
|
||||
void UpdateChannelInDB() const;
|
||||
void UpdateChannelUseageInDB() const;
|
||||
void AddChannelBanToDB(uint32 guid, uint32 time) const;
|
||||
void RemoveChannelBanFromDB(uint32 guid) const;
|
||||
void AddChannelBanToDB(ObjectGuid guid, uint32 time) const;
|
||||
void RemoveChannelBanFromDB(ObjectGuid guid) const;
|
||||
|
||||
uint8 GetPlayerFlags(uint64 guid) const
|
||||
uint8 GetPlayerFlags(ObjectGuid guid) const
|
||||
{
|
||||
PlayerContainer::const_iterator itr = playersStore.find(guid);
|
||||
return itr != playersStore.end() ? itr->second.flags : 0;
|
||||
}
|
||||
|
||||
void SetModerator(uint64 guid, bool set)
|
||||
void SetModerator(ObjectGuid guid, bool set)
|
||||
{
|
||||
PlayerInfo& pinfo = playersStore[guid];
|
||||
if (pinfo.IsModerator() != set)
|
||||
|
|
@ -299,7 +299,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void SetMute(uint64 guid, bool set)
|
||||
void SetMute(ObjectGuid guid, bool set)
|
||||
{
|
||||
PlayerInfo& pinfo = playersStore[guid];
|
||||
if (pinfo.IsMuted() != set)
|
||||
|
|
@ -313,8 +313,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
typedef std::unordered_map<uint64, PlayerInfo> PlayerContainer;
|
||||
typedef std::unordered_map<uint32, uint32> BannedContainer;
|
||||
typedef std::unordered_map<ObjectGuid, PlayerInfo> PlayerContainer;
|
||||
typedef std::unordered_map<ObjectGuid, uint32> BannedContainer;
|
||||
typedef std::unordered_set<Player*> PlayersWatchingContainer;
|
||||
|
||||
bool _announce;
|
||||
|
|
@ -326,7 +326,7 @@ private:
|
|||
uint32 _channelId;
|
||||
uint32 _channelDBId;
|
||||
TeamId _teamId;
|
||||
uint64 _ownerGUID;
|
||||
ObjectGuid _ownerGUID;
|
||||
std::string _name;
|
||||
std::string _password;
|
||||
ChannelRights _channelRights;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void ChannelMgr::LoadChannels()
|
|||
Field* banFields = banResult->Fetch();
|
||||
if (!banFields)
|
||||
break;
|
||||
newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32());
|
||||
newChannel->AddBan(ObjectGuid::Create<HighGuid::Player>(banFields[0].GetUInt32()), banFields[1].GetUInt32());
|
||||
} while (banResult->NextRow());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ bool ChatHandler::isAvailable(ChatCommand const& cmd) const
|
|||
return m_session->GetSecurity() >= AccountTypes(cmd.SecurityLevel);
|
||||
}
|
||||
|
||||
bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
|
||||
bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
|
||||
{
|
||||
WorldSession* target_session = nullptr;
|
||||
uint32 target_account = 0;
|
||||
|
|
@ -87,7 +87,7 @@ bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
|
|||
if (target)
|
||||
target_session = target->GetSession();
|
||||
else if (guid)
|
||||
target_account = sObjectMgr->GetPlayerAccountIdByGUID(guid);
|
||||
target_account = sObjectMgr->GetPlayerAccountIdByGUID(guid.GetCounter());
|
||||
|
||||
if (!target_session && !target_account)
|
||||
{
|
||||
|
|
@ -304,7 +304,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
|||
Player* player = m_session->GetPlayer();
|
||||
if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
|
||||
{
|
||||
uint64 guid = player->GetTarget();
|
||||
ObjectGuid guid = player->GetTarget();
|
||||
uint32 areaId = player->GetAreaId();
|
||||
std::string areaName = "Unknown";
|
||||
std::string zoneName = "Unknown";
|
||||
|
|
@ -316,20 +316,14 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
|||
zoneName = zone->area_name[locale];
|
||||
}
|
||||
|
||||
LOG_GM(m_session->GetAccountId(), "Command: %s [Player: %s (%u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%ul)]",
|
||||
fullcmd.c_str(),
|
||||
player->GetName().c_str(),
|
||||
GUID_LOPART(player->GetGUID()),
|
||||
m_session->GetAccountId(),
|
||||
player->GetPositionX(),
|
||||
player->GetPositionY(),
|
||||
player->GetPositionZ(),
|
||||
player->GetMapId(),
|
||||
player->GetMap()->GetMapName(),
|
||||
areaId, areaName.c_str(),
|
||||
zoneName.c_str(),
|
||||
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
|
||||
GUID_LOPART(guid));
|
||||
LOG_GM(m_session->GetAccountId(), "Command: %s [Player: %s (%s) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%s)]",
|
||||
fullcmd.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(),
|
||||
m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
|
||||
player->GetPositionZ(), player->GetMapId(),
|
||||
player->GetMap()->GetMapName(),
|
||||
areaId, areaName.c_str(), zoneName.c_str(),
|
||||
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
|
||||
guid.ToString().c_str());
|
||||
}
|
||||
}
|
||||
// some commands have custom error messages. Don't send the default one in these cases.
|
||||
|
|
@ -601,7 +595,7 @@ bool ChatHandler::ShowHelpForCommand(std::vector<ChatCommand> const& table, cons
|
|||
return ShowHelpForSubCommands(table, "", cmd);
|
||||
}
|
||||
|
||||
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
|
||||
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
|
||||
std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
|
||||
uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/)
|
||||
{
|
||||
|
|
@ -609,7 +603,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
|
|||
data.Initialize(!gmMessage ? SMSG_MESSAGECHAT : SMSG_GM_MESSAGECHAT);
|
||||
data << uint8(chatType);
|
||||
data << int32(language);
|
||||
data << uint64(senderGUID);
|
||||
data << senderGUID;
|
||||
data << uint32(0); // some flags
|
||||
switch (chatType)
|
||||
{
|
||||
|
|
@ -624,8 +618,8 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
|
|||
data << uint32(senderName.length() + 1);
|
||||
data << senderName;
|
||||
receiverGUIDPos = data.wpos();
|
||||
data << uint64(receiverGUID);
|
||||
if (receiverGUID && !IS_PLAYER_GUID(receiverGUID) && !IS_PET_GUID(receiverGUID))
|
||||
data << receiverGUID;
|
||||
if (receiverGUID && !receiverGUID.IsPlayer() && !receiverGUID.IsPet())
|
||||
{
|
||||
data << uint32(receiverName.length() + 1);
|
||||
data << receiverName;
|
||||
|
|
@ -635,14 +629,14 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
|
|||
data << uint32(senderName.length() + 1);
|
||||
data << senderName;
|
||||
receiverGUIDPos = data.wpos();
|
||||
data << uint64(receiverGUID);
|
||||
data << receiverGUID;
|
||||
break;
|
||||
case CHAT_MSG_BG_SYSTEM_NEUTRAL:
|
||||
case CHAT_MSG_BG_SYSTEM_ALLIANCE:
|
||||
case CHAT_MSG_BG_SYSTEM_HORDE:
|
||||
receiverGUIDPos = data.wpos();
|
||||
data << uint64(receiverGUID);
|
||||
if (receiverGUID && !IS_PLAYER_GUID(receiverGUID))
|
||||
data << receiverGUID;
|
||||
if (receiverGUID && !receiverGUID.IsPlayer())
|
||||
{
|
||||
data << uint32(receiverName.length() + 1);
|
||||
data << receiverName;
|
||||
|
|
@ -651,7 +645,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
|
|||
case CHAT_MSG_ACHIEVEMENT:
|
||||
case CHAT_MSG_GUILD_ACHIEVEMENT:
|
||||
receiverGUIDPos = data.wpos();
|
||||
data << uint64(receiverGUID);
|
||||
data << receiverGUID;
|
||||
break;
|
||||
default:
|
||||
if (gmMessage)
|
||||
|
|
@ -667,7 +661,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
|
|||
}
|
||||
|
||||
receiverGUIDPos = data.wpos();
|
||||
data << uint64(receiverGUID);
|
||||
data << receiverGUID;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -684,11 +678,11 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
|
|||
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message,
|
||||
uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/)
|
||||
{
|
||||
uint64 senderGUID = 0;
|
||||
ObjectGuid senderGUID;
|
||||
std::string senderName = "";
|
||||
uint8 chatTag = 0;
|
||||
bool gmMessage = false;
|
||||
uint64 receiverGUID = 0;
|
||||
ObjectGuid receiverGUID;
|
||||
std::string receiverName = "";
|
||||
if (sender)
|
||||
{
|
||||
|
|
@ -715,11 +709,11 @@ Player* ChatHandler::getSelectedPlayer()
|
|||
if (!m_session)
|
||||
return nullptr;
|
||||
|
||||
uint64 selected = m_session->GetPlayer()->GetTarget();
|
||||
ObjectGuid selected = m_session->GetPlayer()->GetTarget();
|
||||
if (!selected)
|
||||
return m_session->GetPlayer();
|
||||
|
||||
return ObjectAccessor::FindPlayerInOrOutOfWorld(selected);
|
||||
return ObjectAccessor::FindConnectedPlayer(selected);
|
||||
}
|
||||
|
||||
Unit* ChatHandler::getSelectedUnit()
|
||||
|
|
@ -738,9 +732,9 @@ WorldObject* ChatHandler::getSelectedObject()
|
|||
if (!m_session)
|
||||
return nullptr;
|
||||
|
||||
uint64 guid = m_session->GetPlayer()->GetTarget();
|
||||
ObjectGuid guid = m_session->GetPlayer()->GetTarget();
|
||||
|
||||
if (guid == 0)
|
||||
if (!guid)
|
||||
return GetNearbyGameObject();
|
||||
|
||||
return ObjectAccessor::GetUnit(*m_session->GetPlayer(), guid);
|
||||
|
|
@ -759,12 +753,12 @@ Player* ChatHandler::getSelectedPlayerOrSelf()
|
|||
if (!m_session)
|
||||
return nullptr;
|
||||
|
||||
uint64 selected = m_session->GetPlayer()->GetTarget();
|
||||
ObjectGuid selected = m_session->GetPlayer()->GetTarget();
|
||||
if (!selected)
|
||||
return m_session->GetPlayer();
|
||||
|
||||
// first try with selected target
|
||||
Player* targetPlayer = ObjectAccessor::FindPlayerInOrOutOfWorld(selected);
|
||||
Player* targetPlayer = ObjectAccessor::FindConnectedPlayer(selected);
|
||||
// if the target is not a player, then return self
|
||||
if (!targetPlayer)
|
||||
targetPlayer = m_session->GetPlayer();
|
||||
|
|
@ -897,29 +891,35 @@ GameObject* ChatHandler::GetNearbyGameObject()
|
|||
return obj;
|
||||
}
|
||||
|
||||
GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry)
|
||||
Creature* ChatHandler::GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
|
||||
{
|
||||
if (!m_session)
|
||||
return nullptr;
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
// Select the first alive creature or a dead one if not found
|
||||
Creature* creature = nullptr;
|
||||
|
||||
GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT));
|
||||
|
||||
if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object
|
||||
auto bounds = m_session->GetPlayer()->GetMap()->GetCreatureBySpawnIdStore().equal_range(lowguid);
|
||||
for (auto it = bounds.first; it != bounds.second; ++it)
|
||||
{
|
||||
// search near player then
|
||||
CellCoord p(acore::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY()));
|
||||
Cell cell(p);
|
||||
|
||||
acore::GameObjectWithDbGUIDCheck go_check(lowguid);
|
||||
acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck> checker(pl, obj, go_check);
|
||||
|
||||
TypeContainerVisitor<acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
|
||||
cell.Visit(p, object_checker, *pl->GetMap(), *pl, pl->GetGridActivationRange());
|
||||
creature = it->second;
|
||||
if (it->second->IsAlive())
|
||||
break;
|
||||
}
|
||||
|
||||
return obj;
|
||||
return creature;
|
||||
}
|
||||
|
||||
GameObject* ChatHandler::GetObjectFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
|
||||
{
|
||||
if (!m_session)
|
||||
return nullptr;
|
||||
|
||||
auto bounds = m_session->GetPlayer()->GetMap()->GetGameObjectBySpawnIdStore().equal_range(lowguid);
|
||||
if (bounds.first != bounds.second)
|
||||
return bounds.first->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
enum SpellLinkType
|
||||
|
|
@ -1025,7 +1025,7 @@ static char const* const guidKeys[] =
|
|||
0
|
||||
};
|
||||
|
||||
uint64 ChatHandler::extractGuidFromLink(char* text)
|
||||
ObjectGuid::LowType ChatHandler::extractLowGuidFromLink(char* text, HighGuid& guidHigh)
|
||||
{
|
||||
int type = 0;
|
||||
|
||||
|
|
@ -1040,33 +1040,39 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
|
|||
{
|
||||
case SPELL_LINK_PLAYER:
|
||||
{
|
||||
guidHigh = HighGuid::Player;
|
||||
|
||||
std::string name = idS;
|
||||
if (!normalizePlayerName(name))
|
||||
return 0;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerByName(name, false))
|
||||
return player->GetGUID();
|
||||
return player->GetGUID().GetCounter();
|
||||
|
||||
if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
|
||||
return guid;
|
||||
if (ObjectGuid guid = sObjectMgr->GetPlayerGUIDByName(name))
|
||||
return guid.GetCounter();
|
||||
|
||||
return 0;
|
||||
}
|
||||
case SPELL_LINK_CREATURE:
|
||||
{
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
guidHigh = HighGuid::Unit;
|
||||
|
||||
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
|
||||
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT);
|
||||
ObjectGuid::LowType lowguid = (uint32)atol(idS);
|
||||
|
||||
if (sObjectMgr->GetCreatureData(lowguid))
|
||||
return lowguid;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
case SPELL_LINK_GAMEOBJECT:
|
||||
{
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
guidHigh = HighGuid::GameObject;
|
||||
|
||||
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
|
||||
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_GAMEOBJECT);
|
||||
ObjectGuid::LowType lowguid = (uint32)atol(idS);
|
||||
|
||||
if (sObjectMgr->GetGOData(lowguid))
|
||||
return lowguid;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1090,7 +1096,7 @@ std::string ChatHandler::extractPlayerNameFromLink(char* text)
|
|||
return name;
|
||||
}
|
||||
|
||||
bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=nullptr*/, std::string* player_name /*= nullptr*/)
|
||||
bool ChatHandler::extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid /*=nullptr*/, std::string* player_name /*= nullptr*/)
|
||||
{
|
||||
if (args && *args)
|
||||
{
|
||||
|
|
@ -1109,7 +1115,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
|
|||
*player = pl;
|
||||
|
||||
// if need guid value from DB (in name case for check player existence)
|
||||
uint64 guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : 0;
|
||||
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : ObjectGuid::Empty;
|
||||
|
||||
// if allowed player guid (if no then only online players allowed)
|
||||
if (player_guid)
|
||||
|
|
@ -1126,7 +1132,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
|
|||
*player = pl;
|
||||
// if allowed player guid (if no then only online players allowed)
|
||||
if (player_guid)
|
||||
*player_guid = pl ? pl->GetGUID() : 0;
|
||||
*player_guid = pl ? pl->GetGUID() : ObjectGuid::Empty;
|
||||
|
||||
if (player_name)
|
||||
*player_name = pl ? pl->GetName() : "";
|
||||
|
|
@ -1249,10 +1255,10 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, uint64& guid, bool offline)
|
||||
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline)
|
||||
{
|
||||
player = nullptr;
|
||||
guid = 0;
|
||||
player = nullptr;
|
||||
guid = ObjectGuid::Empty;
|
||||
|
||||
if (cname)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
virtual ~ChatHandler() { }
|
||||
|
||||
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
|
||||
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
|
||||
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
|
||||
std::string const& senderName = "", std::string const& receiverName = "",
|
||||
uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = "");
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ public:
|
|||
virtual LocaleConstant GetSessionDbcLocale() const;
|
||||
virtual int GetSessionDbLocaleIndex() const;
|
||||
|
||||
bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false);
|
||||
bool HasLowerSecurity(Player* target, ObjectGuid guid = ObjectGuid::Empty, bool strong = false);
|
||||
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
|
||||
|
||||
void SendGlobalGMSysMessage(const char* str);
|
||||
|
|
@ -98,18 +98,19 @@ public:
|
|||
char* extractQuotedArg(char* args);
|
||||
|
||||
uint32 extractSpellIdFromLink(char* text);
|
||||
uint64 extractGuidFromLink(char* text);
|
||||
ObjectGuid::LowType extractLowGuidFromLink(char* text, HighGuid& guidHigh);
|
||||
GameTele const* extractGameTeleFromLink(char* text);
|
||||
bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, uint64& guid, bool offline = false);
|
||||
bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline = false);
|
||||
std::string extractPlayerNameFromLink(char* text);
|
||||
// select by arg (name/link) or in-game selection online/offline player
|
||||
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = nullptr, std::string* player_name = nullptr);
|
||||
bool extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid = nullptr, std::string* player_name = nullptr);
|
||||
|
||||
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:" + name + "|h[" + name + "]|h|r" : name; }
|
||||
std::string GetNameLink(Player* chr) const;
|
||||
|
||||
GameObject* GetNearbyGameObject();
|
||||
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
|
||||
GameObject* GetObjectFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid);
|
||||
Creature* GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid);
|
||||
bool HasSentErrorMessage() const { return sentErrorMessage; }
|
||||
void SetSentErrorMessage(bool val) { sentErrorMessage = val; }
|
||||
static bool LoadCommandTable() { return load_command_table; }
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const
|
|||
if (!victim)
|
||||
return nullptr;
|
||||
|
||||
uint64 const guid = victim->GetGUID();
|
||||
ObjectGuid const guid = victim->GetGUID();
|
||||
for (ThreatContainer::StorageType::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
|
||||
{
|
||||
HostileReference* ref = (*i);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public:
|
|||
|
||||
//=================================================
|
||||
|
||||
[[nodiscard]] uint64 getUnitGuid() const { return iUnitGuid; }
|
||||
[[nodiscard]] ObjectGuid getUnitGuid() const { return iUnitGuid; }
|
||||
|
||||
//=================================================
|
||||
// reference is not needed anymore. realy delete it !
|
||||
|
|
@ -113,7 +113,7 @@ private:
|
|||
private:
|
||||
float iThreat;
|
||||
float iTempThreatModifier; // used for taunt
|
||||
uint64 iUnitGuid;
|
||||
ObjectGuid iUnitGuid;
|
||||
bool iOnline;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -170,12 +170,15 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
|
|||
case INSTANCE_INFO_DATA:
|
||||
condMeets = instance->GetData(ConditionValue1) == ConditionValue2;
|
||||
break;
|
||||
case INSTANCE_INFO_DATA64:
|
||||
condMeets = instance->GetData64(ConditionValue1) == ConditionValue2;
|
||||
case INSTANCE_INFO_GUID_DATA:
|
||||
condMeets = instance->GetGuidData(ConditionValue1) == ObjectGuid(uint64(ConditionValue2));
|
||||
break;
|
||||
case INSTANCE_INFO_BOSS_STATE:
|
||||
condMeets = instance->GetBossState(ConditionValue1) == EncounterState(ConditionValue2);
|
||||
break;
|
||||
case INSTANCE_INFO_DATA64:
|
||||
condMeets = instance->GetData64(ConditionValue1) == ConditionValue2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -230,10 +233,10 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
|
|||
switch (object->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
condMeets &= object->ToCreature()->GetDBTableGUIDLow() == ConditionValue3;
|
||||
condMeets &= object->ToCreature()->GetSpawnId() == ConditionValue3;
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
condMeets &= object->ToGameObject()->GetDBTableGUIDLow() == ConditionValue3;
|
||||
condMeets &= object->ToGameObject()->GetSpawnId() == ConditionValue3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -153,8 +153,9 @@ enum RelationType
|
|||
enum InstanceInfo
|
||||
{
|
||||
INSTANCE_INFO_DATA = 0,
|
||||
INSTANCE_INFO_DATA64,
|
||||
INSTANCE_INFO_BOSS_STATE
|
||||
INSTANCE_INFO_GUID_DATA,
|
||||
INSTANCE_INFO_BOSS_STATE,
|
||||
INSTANCE_INFO_DATA64
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
|
|||
|
|
@ -9,9 +9,12 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
|
|
@ -93,68 +96,68 @@ namespace lfg
|
|||
typedef std::list<Lfg5Guids> Lfg5GuidsList;
|
||||
typedef std::set<uint32> LfgDungeonSet;
|
||||
typedef std::map<uint32, uint32> LfgLockMap;
|
||||
typedef std::map<uint64, LfgLockMap> LfgLockPartyMap;
|
||||
typedef std::set<uint64> LfgGuidSet;
|
||||
typedef std::list<uint64> LfgGuidList;
|
||||
typedef std::map<uint64, uint8> LfgRolesMap;
|
||||
typedef std::map<uint64, uint64> LfgGroupsMap;
|
||||
typedef std::map<ObjectGuid, LfgLockMap> LfgLockPartyMap;
|
||||
typedef GuidSet LfgGuidSet;
|
||||
typedef GuidList LfgGuidList;
|
||||
typedef std::map<ObjectGuid, uint8> LfgRolesMap;
|
||||
typedef std::map<ObjectGuid, ObjectGuid> LfgGroupsMap;
|
||||
|
||||
class Lfg5Guids
|
||||
{
|
||||
public:
|
||||
uint64 guid[5];
|
||||
std::array<ObjectGuid, 5> guids = { };
|
||||
LfgRolesMap* roles;
|
||||
Lfg5Guids()
|
||||
{
|
||||
memset(&guid, 0, 5 * 8);
|
||||
guids.fill(ObjectGuid::Empty);
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
Lfg5Guids(uint64 g)
|
||||
Lfg5Guids(ObjectGuid g)
|
||||
{
|
||||
memset(&guid, 0, 5 * 8);
|
||||
guid[0] = g;
|
||||
guids.fill(ObjectGuid::Empty);
|
||||
guids[0] = g;
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
guids = x.guids;
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x, bool /*copyRoles*/)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
guids = x.guids;
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
~Lfg5Guids() { delete roles; }
|
||||
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
|
||||
void clear() { memset(&guid, 0, 5 * 8); }
|
||||
bool empty() const { return guid[0] == 0; }
|
||||
uint64 front() const { return guid[0]; }
|
||||
void clear() { guids.fill(ObjectGuid::Empty); }
|
||||
bool empty() const { return guids[0] == ObjectGuid::Empty; }
|
||||
ObjectGuid front() const { return guids[0]; }
|
||||
|
||||
uint8 size() const
|
||||
{
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
else if (guid[3])
|
||||
else if (guids[3])
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
else if (guid[1])
|
||||
else if (guids[1])
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (guid[0])
|
||||
else if (guids[0])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -162,289 +165,289 @@ namespace lfg
|
|||
return 0;
|
||||
}
|
||||
|
||||
void insert(const uint64& g)
|
||||
void insert(const ObjectGuid& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == 0)
|
||||
if (!guids[0])
|
||||
{
|
||||
guid[0] = g;
|
||||
guids[0] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[0])
|
||||
if (g <= guids[0])
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guids[4] = guids[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
guids[3] = guids[2];
|
||||
}
|
||||
|
||||
if (guid[1])
|
||||
if (guids[1])
|
||||
{
|
||||
guid[2] = guid[1];
|
||||
guids[2] = guids[1];
|
||||
}
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
guids[1] = guids[0];
|
||||
guids[0] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[1] == 0)
|
||||
if (!guids[1])
|
||||
{
|
||||
guid[1] = g;
|
||||
guids[1] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[1])
|
||||
if (g <= guids[1])
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guids[4] = guids[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
guids[3] = guids[2];
|
||||
}
|
||||
|
||||
guid[2] = guid[1];
|
||||
guid[1] = g;
|
||||
guids[2] = guids[1];
|
||||
guids[1] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2] == 0)
|
||||
if (!guids[2])
|
||||
{
|
||||
guid[2] = g;
|
||||
guids[2] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[2])
|
||||
if (g <= guids[2])
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guids[4] = guids[3];
|
||||
}
|
||||
|
||||
guid[3] = guid[2];
|
||||
guid[2] = g;
|
||||
guids[3] = guids[2];
|
||||
guids[2] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == 0)
|
||||
if (!guids[3])
|
||||
{
|
||||
guid[3] = g;
|
||||
guids[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[3])
|
||||
if (g <= guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guid[3] = g;
|
||||
guids[4] = guids[3];
|
||||
guids[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = g;
|
||||
guids[4] = g;
|
||||
}
|
||||
|
||||
void force_insert_front(const uint64& g)
|
||||
void force_insert_front(const ObjectGuid& g)
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guids[4] = guids[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
guids[3] = guids[2];
|
||||
}
|
||||
|
||||
if (guid[1])
|
||||
if (guids[1])
|
||||
{
|
||||
guid[2] = guid[1];
|
||||
guids[2] = guids[1];
|
||||
}
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
guids[1] = guids[0];
|
||||
guids[0] = g;
|
||||
}
|
||||
|
||||
void remove(const uint64& g)
|
||||
void remove(const ObjectGuid& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == g)
|
||||
if (guids[0] == g)
|
||||
{
|
||||
if (guid[1])
|
||||
if (guids[1])
|
||||
{
|
||||
guid[0] = guid[1];
|
||||
guids[0] = guids[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[0] = 0;
|
||||
guids[0].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
guids[1] = guids[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
guids[1].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
guids[2] = guids[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
guids[2].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
guids[3] = guids[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
guids[3].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[1] == g)
|
||||
if (guids[1] == g)
|
||||
{
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
guids[1] = guids[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
guids[1].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
guids[2] = guids[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
guids[2].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
guids[3] = guids[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
guids[3].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2] == g)
|
||||
if (guids[2] == g)
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
guids[2] = guids[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
guids[2].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
guids[3] = guids[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
guids[3].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == g)
|
||||
if (guids[3] == g)
|
||||
{
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
guids[3] = guids[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
guids[3].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4] == g)
|
||||
if (guids[4] == g)
|
||||
{
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool hasGuid(const uint64& g) const
|
||||
bool hasGuid(const ObjectGuid& g) const
|
||||
{
|
||||
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
|
||||
return g && (guids[0] == g || guids[1] == g || guids[2] == g || guids[3] == g || guids[4] == g);
|
||||
}
|
||||
|
||||
bool operator<(const Lfg5Guids& x) const
|
||||
{
|
||||
if (guid[0] <= x.guid[0])
|
||||
if (guids[0] <= x.guids[0])
|
||||
{
|
||||
if (guid[0] != x.guid[0])
|
||||
if (guids[0] != x.guids[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[1] <= x.guid[1])
|
||||
if (guids[1] <= x.guids[1])
|
||||
{
|
||||
if (guid[1] != x.guid[1])
|
||||
if (guids[1] != x.guids[1])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[2] <= x.guid[2])
|
||||
if (guids[2] <= x.guids[2])
|
||||
{
|
||||
if (guid[2] != x.guid[2])
|
||||
if (guids[2] != x.guids[2])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[3] <= x.guid[3])
|
||||
if (guids[3] <= x.guids[3])
|
||||
{
|
||||
if (guid[3] != x.guid[3])
|
||||
if (guids[3] != x.guids[3])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[4] <= x.guid[4])
|
||||
if (guids[4] <= x.guids[4])
|
||||
{
|
||||
return !(guid[4] == x.guid[4]);
|
||||
return !(guids[4] == x.guids[4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -456,12 +459,12 @@ namespace lfg
|
|||
|
||||
bool operator==(const Lfg5Guids& x) const
|
||||
{
|
||||
return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4];
|
||||
return guids[0] == x.guids[0] && guids[1] == x.guids[1] && guids[2] == x.guids[2] && guids[3] == x.guids[3] && guids[4] == x.guids[4];
|
||||
}
|
||||
|
||||
void operator=(const Lfg5Guids& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
guids = x.guids;
|
||||
delete roles;
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
|
@ -469,7 +472,7 @@ namespace lfg
|
|||
std::string toString() const // for debugging
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0);
|
||||
o << guids[0].ToString().c_str() << "," << guids[1].ToString().c_str() << "," << guids[2].ToString().c_str() << "," << guids[3].ToString().c_str() << "," << guids[4].ToString().c_str() << ":" << (roles ? 1 : 0);
|
||||
return o.str();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace lfg
|
|||
{
|
||||
|
||||
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
|
||||
m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
|
||||
m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
|
||||
{ }
|
||||
|
||||
LfgGroupData::~LfgGroupData()
|
||||
|
|
@ -44,12 +44,12 @@ namespace lfg
|
|||
m_State = m_OldState;
|
||||
}
|
||||
|
||||
void LfgGroupData::AddPlayer(uint64 guid)
|
||||
void LfgGroupData::AddPlayer(ObjectGuid guid)
|
||||
{
|
||||
m_Players.insert(guid);
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::RemovePlayer(uint64 guid)
|
||||
uint8 LfgGroupData::RemovePlayer(ObjectGuid guid)
|
||||
{
|
||||
LfgGuidSet::iterator it = m_Players.find(guid);
|
||||
if (it != m_Players.end())
|
||||
|
|
@ -62,7 +62,7 @@ namespace lfg
|
|||
m_Players.clear();
|
||||
}
|
||||
|
||||
void LfgGroupData::SetLeader(uint64 guid)
|
||||
void LfgGroupData::SetLeader(ObjectGuid guid)
|
||||
{
|
||||
m_Leader = guid;
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ namespace lfg
|
|||
return m_Players.size();
|
||||
}
|
||||
|
||||
uint64 LfgGroupData::GetLeader() const
|
||||
ObjectGuid LfgGroupData::GetLeader() const
|
||||
{
|
||||
return m_Leader;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ namespace lfg
|
|||
// General
|
||||
void SetState(LfgState state);
|
||||
void RestoreState();
|
||||
void AddPlayer(uint64 guid);
|
||||
uint8 RemovePlayer(uint64 guid);
|
||||
void AddPlayer(ObjectGuid guid);
|
||||
uint8 RemovePlayer(ObjectGuid guid);
|
||||
void RemoveAllPlayers();
|
||||
void SetLeader(uint64 guid);
|
||||
void SetLeader(ObjectGuid guid);
|
||||
|
||||
// Dungeon
|
||||
void SetDungeon(uint32 dungeon);
|
||||
|
|
@ -47,7 +47,7 @@ namespace lfg
|
|||
LfgState GetOldState() const;
|
||||
LfgGuidSet const& GetPlayers() const;
|
||||
uint8 GetPlayerCount() const;
|
||||
uint64 GetLeader() const;
|
||||
ObjectGuid GetLeader() const;
|
||||
|
||||
// Dungeon
|
||||
uint32 GetDungeon(bool asId = true) const;
|
||||
|
|
@ -59,7 +59,7 @@ namespace lfg
|
|||
// General
|
||||
LfgState m_State; ///< State if group in LFG
|
||||
LfgState m_OldState; ///< Old State
|
||||
uint64 m_Leader; ///< Leader GUID
|
||||
ObjectGuid m_Leader; ///< Leader GUID
|
||||
LfgGuidSet m_Players; ///< Players in group
|
||||
// Dungeon
|
||||
uint32 m_Dungeon; ///< Dungeon entry
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -137,13 +137,13 @@ namespace lfg
|
|||
|
||||
struct RBInternalInfo
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string comment;
|
||||
bool isGroupLeader;
|
||||
uint64 groupGuid;
|
||||
ObjectGuid groupGuid;
|
||||
uint8 roles;
|
||||
uint32 encounterMask;
|
||||
uint64 instanceGuid;
|
||||
ObjectGuid instanceGuid;
|
||||
|
||||
// additional character info parameters:
|
||||
uint8 _online;
|
||||
|
|
@ -179,7 +179,7 @@ namespace lfg
|
|||
uint32 _expertiseRating;
|
||||
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid,
|
||||
RBInternalInfo(ObjectGuid guid, std::string const& comment, bool isGroupLeader, ObjectGuid groupGuid, uint8 roles, uint32 encounterMask, ObjectGuid instanceGuid,
|
||||
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
|
||||
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
|
||||
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
|
||||
|
|
@ -242,13 +242,13 @@ namespace lfg
|
|||
typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer;
|
||||
typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds;
|
||||
typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer;
|
||||
typedef std::map<uint64, LfgAnswer> LfgAnswerContainer;
|
||||
typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer;
|
||||
typedef std::map<ObjectGuid, LfgAnswer> LfgAnswerContainer;
|
||||
typedef std::map<ObjectGuid, LfgRoleCheck> LfgRoleCheckContainer;
|
||||
typedef std::map<uint32, LfgProposal> LfgProposalContainer;
|
||||
typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer;
|
||||
typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer;
|
||||
typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer;
|
||||
typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer;
|
||||
typedef std::map<ObjectGuid, LfgProposalPlayer> LfgProposalPlayerContainer;
|
||||
typedef std::map<ObjectGuid, LfgPlayerBoot> LfgPlayerBootContainer;
|
||||
typedef std::map<ObjectGuid, LfgGroupData> LfgGroupDataContainer;
|
||||
typedef std::map<ObjectGuid, LfgPlayerData> LfgPlayerDataContainer;
|
||||
typedef std::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer;
|
||||
|
||||
// Data needed by SMSG_LFG_JOIN_RESULT
|
||||
|
|
@ -320,24 +320,23 @@ namespace lfg
|
|||
/// Stores player data related to proposal to join
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING) { }
|
||||
uint8 role; ///< Proposed role
|
||||
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint64 group; ///< Original group guid. 0 if no original group
|
||||
ObjectGuid group; ///< Original group guid. 0 if no original group
|
||||
};
|
||||
|
||||
/// Stores group data related to proposal to join
|
||||
struct LfgProposal
|
||||
{
|
||||
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING),
|
||||
group(0), leader(0), cancelTime(0), encounters(0), isNew(true)
|
||||
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING), cancelTime(0), encounters(0), isNew(true)
|
||||
{ }
|
||||
|
||||
uint32 id; ///< Proposal Id
|
||||
uint32 dungeonId; ///< Dungeon to join
|
||||
LfgProposalState state; ///< State of the proposal
|
||||
uint64 group; ///< Proposal group (0 if new)
|
||||
uint64 leader; ///< Leader guid.
|
||||
ObjectGuid group; ///< Proposal group (0 if new)
|
||||
ObjectGuid leader; ///< Leader guid.
|
||||
time_t cancelTime; ///< Time when we will cancel this proposal
|
||||
uint32 encounters; ///< Dungeon Encounters
|
||||
bool isNew; ///< Determines if it's new group or not
|
||||
|
|
@ -354,7 +353,7 @@ namespace lfg
|
|||
LfgRoleCheckState state; ///< State of the rolecheck
|
||||
LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons)
|
||||
uint32 rDungeonId; ///< Random Dungeon Id.
|
||||
uint64 leader; ///< Leader of the group
|
||||
ObjectGuid leader; ///< Leader of the group
|
||||
};
|
||||
|
||||
/// Stores information of a current vote to kick someone from a group
|
||||
|
|
@ -363,7 +362,7 @@ namespace lfg
|
|||
time_t cancelTime; ///< Time left to vote
|
||||
bool inProgress; ///< Vote in progress
|
||||
LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint64 victim; ///< Player guid to be kicked (can't vote)
|
||||
ObjectGuid victim; ///< Player guid to be kicked (can't vote)
|
||||
std::string reason; ///< kick reason
|
||||
};
|
||||
|
||||
|
|
@ -401,14 +400,14 @@ namespace lfg
|
|||
~LFGMgr();
|
||||
|
||||
// pussywizard: RAIDBROWSER
|
||||
typedef std::unordered_map<uint32 /*playerGuidLow*/, RBEntryInfo> RBEntryInfoMap;
|
||||
typedef std::unordered_map<ObjectGuid /*playerGuid*/, RBEntryInfo> RBEntryInfoMap;
|
||||
typedef std::unordered_map<uint32 /*dungeonId*/, RBEntryInfoMap> RBStoreMap;
|
||||
RBStoreMap RaidBrowserStore[2]; // for 2 factions
|
||||
typedef std::unordered_map<uint32 /*playerGuidLow*/, uint32 /*dungeonId*/> RBSearchersMap;
|
||||
typedef std::unordered_map<ObjectGuid /*playerGuid*/, uint32 /*dungeonId*/> RBSearchersMap;
|
||||
RBSearchersMap RBSearchersStore[2]; // for 2 factions
|
||||
typedef std::unordered_map<uint32 /*dungeonId*/, WorldPacket> RBCacheMap;
|
||||
RBCacheMap RBCacheStore[2]; // for 2 factions
|
||||
typedef std::unordered_map<uint32 /*guidLow*/, RBInternalInfo> RBInternalInfoMap;
|
||||
typedef std::unordered_map<ObjectGuid /*guid*/, RBInternalInfo> RBInternalInfoMap;
|
||||
typedef std::unordered_map<uint32 /*dungeonId*/, RBInternalInfoMap> RBInternalInfoMapMap;
|
||||
RBInternalInfoMapMap RBInternalInfoStorePrev[2]; // for 2 factions
|
||||
RBInternalInfoMapMap RBInternalInfoStoreCurr[2]; // for 2 factions
|
||||
|
|
@ -423,7 +422,7 @@ namespace lfg
|
|||
|
||||
// World.cpp
|
||||
/// Finish the dungeon for the given group. All check are performed using internal lfg data
|
||||
void FinishDungeon(uint64 gguid, uint32 dungeonId, const Map* currMap);
|
||||
void FinishDungeon(ObjectGuid gguid, uint32 dungeonId, const Map* currMap);
|
||||
/// Loads rewards for random dungeons
|
||||
void LoadRewards();
|
||||
/// Loads dungeons from dbc and adds teleport coords
|
||||
|
|
@ -431,31 +430,31 @@ namespace lfg
|
|||
|
||||
// Multiple files
|
||||
/// Check if given guid applied for random dungeon
|
||||
bool selectedRandomLfgDungeon(uint64 guid);
|
||||
bool selectedRandomLfgDungeon(ObjectGuid guid);
|
||||
/// Check if given guid applied for given map and difficulty. Used to know
|
||||
bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty);
|
||||
bool inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty);
|
||||
/// Get selected dungeons
|
||||
LfgDungeonSet const& GetSelectedDungeons(uint64 guid);
|
||||
LfgDungeonSet const& GetSelectedDungeons(ObjectGuid guid);
|
||||
/// Get current lfg state
|
||||
LfgState GetState(uint64 guid);
|
||||
LfgState GetState(ObjectGuid guid);
|
||||
/// Get current dungeon
|
||||
uint32 GetDungeon(uint64 guid, bool asId = true);
|
||||
uint32 GetDungeon(ObjectGuid guid, bool asId = true);
|
||||
/// Get the map id of the current dungeon
|
||||
uint32 GetDungeonMapId(uint64 guid);
|
||||
uint32 GetDungeonMapId(ObjectGuid guid);
|
||||
/// Get kicks left in current group
|
||||
uint8 GetKicksLeft(uint64 gguid);
|
||||
uint8 GetKicksLeft(ObjectGuid gguid);
|
||||
/// Load Lfg group info from DB
|
||||
void _LoadFromDB(Field* fields, uint64 guid);
|
||||
void _LoadFromDB(Field* fields, ObjectGuid guid);
|
||||
/// Initializes player data after loading group data from DB
|
||||
void SetupGroupMember(uint64 guid, uint64 gguid);
|
||||
void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid);
|
||||
/// Return Lfg dungeon entry for given dungeon id
|
||||
uint32 GetLFGDungeonEntry(uint32 id);
|
||||
|
||||
// cs_lfg
|
||||
/// Get current player roles
|
||||
uint8 GetRoles(uint64 guid);
|
||||
uint8 GetRoles(ObjectGuid guid);
|
||||
/// Get current player comment (used for LFR)
|
||||
std::string const& GetComment(uint64 gguid);
|
||||
std::string const& GetComment(ObjectGuid gguid);
|
||||
/// Gets current lfg options
|
||||
uint32 GetOptions();
|
||||
/// Sets new lfg options
|
||||
|
|
@ -467,33 +466,33 @@ namespace lfg
|
|||
|
||||
// LFGScripts
|
||||
/// Get leader of the group (using internal data)
|
||||
uint64 GetLeader(uint64 guid);
|
||||
ObjectGuid GetLeader(ObjectGuid guid);
|
||||
/// Initializes locked dungeons for given player (called at login or level change)
|
||||
void InitializeLockedDungeons(Player* player, uint8 level = 0);
|
||||
/// Sets player team
|
||||
void SetTeam(uint64 guid, TeamId teamId);
|
||||
void SetTeam(ObjectGuid guid, TeamId teamId);
|
||||
/// Sets player group
|
||||
void SetGroup(uint64 guid, uint64 group);
|
||||
void SetGroup(ObjectGuid guid, ObjectGuid group);
|
||||
/// Gets player group
|
||||
uint64 GetGroup(uint64 guid);
|
||||
ObjectGuid GetGroup(ObjectGuid guid);
|
||||
/// Sets the leader of the group
|
||||
void SetLeader(uint64 gguid, uint64 leader);
|
||||
void SetLeader(ObjectGuid gguid, ObjectGuid leader);
|
||||
/// Removes saved group data
|
||||
void RemoveGroupData(uint64 guid);
|
||||
void RemoveGroupData(ObjectGuid guid);
|
||||
/// Removes a player from a group
|
||||
uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid);
|
||||
uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid);
|
||||
/// Adds player to group
|
||||
void AddPlayerToGroup(uint64 gguid, uint64 guid);
|
||||
void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid);
|
||||
/// Xinef: Set Random Players Count
|
||||
void SetRandomPlayersCount(uint64 guid, uint8 count);
|
||||
void SetRandomPlayersCount(ObjectGuid guid, uint8 count);
|
||||
/// Xinef: Get Random Players Count
|
||||
uint8 GetRandomPlayersCount(uint64 guid);
|
||||
uint8 GetRandomPlayersCount(ObjectGuid guid);
|
||||
|
||||
// LFGHandler
|
||||
/// Get locked dungeons
|
||||
LfgLockMap const& GetLockedDungeons(uint64 guid);
|
||||
LfgLockMap const& GetLockedDungeons(ObjectGuid guid);
|
||||
/// Returns current lfg status
|
||||
LfgUpdateData GetLfgStatus(uint64 guid);
|
||||
LfgUpdateData GetLfgStatus(ObjectGuid guid);
|
||||
/// Checks if Seasonal dungeon is active
|
||||
bool IsSeasonActive(uint32 dungeonId);
|
||||
/// Gets the random dungeon reward corresponding to given dungeon and player level
|
||||
|
|
@ -503,26 +502,26 @@ namespace lfg
|
|||
/// Teleport a player to/from selected dungeon
|
||||
void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
|
||||
/// Inits new proposal to boot a player
|
||||
void InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string const& reason);
|
||||
void InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, std::string const& reason);
|
||||
/// Updates player boot proposal with new player answer
|
||||
void UpdateBoot(uint64 guid, bool accept);
|
||||
void UpdateBoot(ObjectGuid guid, bool accept);
|
||||
/// Updates proposal to join dungeon with player answer
|
||||
void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
|
||||
void UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept);
|
||||
/// Updates the role check with player answer
|
||||
void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = PLAYER_ROLE_NONE);
|
||||
void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = ObjectGuid::Empty, uint8 roles = PLAYER_ROLE_NONE);
|
||||
/// Sets player lfg roles
|
||||
void SetRoles(uint64 guid, uint8 roles);
|
||||
void SetRoles(ObjectGuid guid, uint8 roles);
|
||||
/// Sets player lfr comment
|
||||
void SetComment(uint64 guid, std::string const& comment);
|
||||
void SetComment(ObjectGuid guid, std::string const& comment);
|
||||
/// Join Lfg with selected roles, dungeons and comment
|
||||
void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment);
|
||||
/// Leaves lfg
|
||||
void LeaveLfg(uint64 guid);
|
||||
void LeaveLfg(ObjectGuid guid);
|
||||
/// pussywizard: cleans all queues' data
|
||||
void LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid = 0);
|
||||
void LeaveAllLfgQueues(ObjectGuid guid, bool allowgroup, ObjectGuid groupguid = ObjectGuid::Empty);
|
||||
/// pussywizard: Raid Browser
|
||||
void JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment);
|
||||
void LeaveRaidBrowser(uint64 guid);
|
||||
void LeaveRaidBrowser(ObjectGuid guid);
|
||||
void LfrSearchAdd(Player* p, uint32 dungeonId);
|
||||
void LfrSearchRemove(Player* p);
|
||||
void SendRaidBrowserCachedList(Player* player, uint32 dungeonId);
|
||||
|
|
@ -536,11 +535,11 @@ namespace lfg
|
|||
|
||||
// LfgQueue
|
||||
/// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
|
||||
LfgState GetOldState(uint64 guid);
|
||||
LfgState GetOldState(ObjectGuid guid);
|
||||
/// Check if given group guid is lfg
|
||||
bool IsLfgGroup(uint64 guid);
|
||||
bool IsLfgGroup(ObjectGuid guid);
|
||||
/// Gets the player count of given group
|
||||
uint8 GetPlayerCount(uint64 guid);
|
||||
uint8 GetPlayerCount(ObjectGuid guid);
|
||||
/// Add a new Proposal
|
||||
uint32 AddProposal(LfgProposal& proposal);
|
||||
/// Checks if all players are queued
|
||||
|
|
@ -548,22 +547,22 @@ namespace lfg
|
|||
/// Checks if given roles match, modifies given roles map with new roles
|
||||
static uint8 CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag = true);
|
||||
/// Checks if given players are ignoring each other
|
||||
static bool HasIgnore(uint64 guid1, uint64 guid2);
|
||||
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
|
||||
/// Sends queue status to player
|
||||
static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data);
|
||||
static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data);
|
||||
|
||||
private:
|
||||
TeamId GetTeam(uint64 guid);
|
||||
void RestoreState(uint64 guid, char const* debugMsg);
|
||||
void ClearState(uint64 guid, char const* debugMsg);
|
||||
void SetDungeon(uint64 guid, uint32 dungeon);
|
||||
void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons);
|
||||
void SetLockedDungeons(uint64 guid, LfgLockMap const& lock);
|
||||
void DecreaseKicksLeft(uint64 guid);
|
||||
void SetState(uint64 guid, LfgState state);
|
||||
void SetCanOverrideRBState(uint64 guid, bool val);
|
||||
TeamId GetTeam(ObjectGuid guid);
|
||||
void RestoreState(ObjectGuid guid, char const* debugMsg);
|
||||
void ClearState(ObjectGuid guid, char const* debugMsg);
|
||||
void SetDungeon(ObjectGuid guid, uint32 dungeon);
|
||||
void SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons);
|
||||
void SetLockedDungeons(ObjectGuid guid, LfgLockMap const& lock);
|
||||
void DecreaseKicksLeft(ObjectGuid guid);
|
||||
void SetState(ObjectGuid guid, LfgState state);
|
||||
void SetCanOverrideRBState(ObjectGuid guid, bool val);
|
||||
void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
|
||||
void _SaveToDB(uint64 guid);
|
||||
void _SaveToDB(ObjectGuid guid);
|
||||
LFGDungeonData const* GetLFGDungeon(uint32 id);
|
||||
|
||||
// Proposals
|
||||
|
|
@ -571,19 +570,19 @@ namespace lfg
|
|||
void MakeNewGroup(LfgProposal const& proposal);
|
||||
|
||||
// Generic
|
||||
LFGQueue& GetQueue(uint64 guid);
|
||||
LFGQueue& GetQueue(ObjectGuid guid);
|
||||
LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon);
|
||||
LfgType GetDungeonType(uint32 dungeon);
|
||||
|
||||
void SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot);
|
||||
void SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data);
|
||||
void SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles);
|
||||
void SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck);
|
||||
void SendLfgUpdateParty(uint64 guid, LfgUpdateData const& data);
|
||||
void SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data);
|
||||
void SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal);
|
||||
void SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot);
|
||||
void SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data);
|
||||
void SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles);
|
||||
void SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck);
|
||||
void SendLfgUpdateParty(ObjectGuid guid, LfgUpdateData const& data);
|
||||
void SendLfgUpdatePlayer(ObjectGuid guid, LfgUpdateData const& data);
|
||||
void SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal);
|
||||
|
||||
LfgGuidSet const& GetPlayers(uint64 guid);
|
||||
LfgGuidSet const& GetPlayers(ObjectGuid guid);
|
||||
|
||||
// General variables
|
||||
uint32 m_lfgProposalId; ///< used as internal counter for proposals
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace lfg
|
|||
{
|
||||
|
||||
LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), m_canOverrideRBState(false),
|
||||
m_TeamId(TEAM_ALLIANCE), m_Group(0), m_Roles(0), m_Comment("")
|
||||
m_TeamId(TEAM_ALLIANCE), m_Roles(0), m_Comment("")
|
||||
{}
|
||||
|
||||
LfgPlayerData::~LfgPlayerData()
|
||||
|
|
@ -62,7 +62,7 @@ namespace lfg
|
|||
m_TeamId = teamId;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetGroup(uint64 group)
|
||||
void LfgPlayerData::SetGroup(ObjectGuid group)
|
||||
{
|
||||
m_Group = group;
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ namespace lfg
|
|||
return m_TeamId;
|
||||
}
|
||||
|
||||
uint64 LfgPlayerData::GetGroup() const
|
||||
ObjectGuid LfgPlayerData::GetGroup() const
|
||||
{
|
||||
return m_Group;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace lfg
|
|||
void RestoreState();
|
||||
void SetLockedDungeons(LfgLockMap const& lock);
|
||||
void SetTeam(TeamId teamId);
|
||||
void SetGroup(uint64 group);
|
||||
void SetGroup(ObjectGuid group);
|
||||
void SetRandomPlayersCount(uint8 count);
|
||||
|
||||
// Queue
|
||||
|
|
@ -40,7 +40,7 @@ namespace lfg
|
|||
LfgState GetOldState() const;
|
||||
LfgLockMap const& GetLockedDungeons() const;
|
||||
TeamId GetTeam() const;
|
||||
uint64 GetGroup() const;
|
||||
ObjectGuid GetGroup() const;
|
||||
uint8 GetRandomPlayersCount() const;
|
||||
void SetCanOverrideRBState(bool val) { m_canOverrideRBState = val; }
|
||||
bool CanOverrideRBState() const { return m_canOverrideRBState; }
|
||||
|
|
@ -58,7 +58,7 @@ namespace lfg
|
|||
// Player
|
||||
LfgLockMap m_LockedDungeons; ///< Dungeons player can't do and reason
|
||||
TeamId m_TeamId; ///< Player team - determines the queue to join
|
||||
uint64 m_Group; ///< Original group of player when joined LFG
|
||||
ObjectGuid m_Group; ///< Original group of player when joined LFG
|
||||
uint8 m_randomPlayers; ///< Xinef: Amount of random players you raid with
|
||||
|
||||
// Queue
|
||||
|
|
|
|||
|
|
@ -29,22 +29,22 @@
|
|||
namespace lfg
|
||||
{
|
||||
|
||||
void LFGQueue::AddToQueue(uint64 guid, bool failedProposal)
|
||||
void LFGQueue::AddToQueue(ObjectGuid guid, bool failedProposal)
|
||||
{
|
||||
//LOG_INFO("server", "ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0);
|
||||
//LOG_INFO("server", "ADD AddToQueue: %s, failed proposal: %u", guid.ToString().c_str(), failedProposal ? 1 : 0);
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
|
||||
if (itQueue == QueueDataStore.end())
|
||||
{
|
||||
LOG_ERROR("server", "LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid);
|
||||
LOG_ERROR("server", "LFGQueue::AddToQueue: Queue data not found for [%s]", guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
//LOG_INFO("server", "AddToQueue success: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "AddToQueue success: %s", guid.ToString().c_str());
|
||||
AddToNewQueue(guid, failedProposal);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromQueue(uint64 guid, bool partial)
|
||||
void LFGQueue::RemoveFromQueue(ObjectGuid guid, bool partial)
|
||||
{
|
||||
//LOG_INFO("server", "REMOVE RemoveFromQueue: %u, partial: %u", GUID_LOPART(guid), partial ? 1 : 0);
|
||||
//LOG_INFO("server", "REMOVE RemoveFromQueue: %s, partial: %u", guid.ToString().c_str(), partial ? 1 : 0);
|
||||
RemoveFromNewQueue(guid);
|
||||
RemoveFromCompatibles(guid);
|
||||
|
||||
|
|
@ -55,13 +55,13 @@ namespace lfg
|
|||
{
|
||||
if (itr->second.bestCompatible.hasGuid(guid))
|
||||
{
|
||||
//LOG_INFO("server", "CLEAR bestCompatible: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "CLEAR bestCompatible: %s, because of: %s", itr->second.bestCompatible.toString().c_str(), guid.ToString().c_str());
|
||||
itr->second.bestCompatible.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//LOG_INFO("server", "CLEAR bestCompatible SELF: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "CLEAR bestCompatible SELF: %s, because of: %s", itr->second.bestCompatible.toString().c_str(), guid.ToString().c_str());
|
||||
//itr->second.bestCompatible.clear(); // don't clear here, because UpdateQueueTimers will try to find with every diff update
|
||||
itDelete = itr;
|
||||
}
|
||||
|
|
@ -70,45 +70,45 @@ namespace lfg
|
|||
// xinef: partial
|
||||
if (!partial && itDelete != QueueDataStore.end())
|
||||
{
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %u, itDelete: %u,%u,%u", GUID_LOPART(guid), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %s", guid.ToString().c_str());
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %s, itDelete: %u,%u,%u", guid.ToString().c_str(), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
|
||||
QueueDataStore.erase(itDelete);
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %u SUCCESS", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %s SUCCESS", guid.ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void LFGQueue::AddToNewQueue(uint64 guid, bool front)
|
||||
void LFGQueue::AddToNewQueue(ObjectGuid guid, bool front)
|
||||
{
|
||||
if (front)
|
||||
{
|
||||
//LOG_INFO("server", "ADD AddToNewQueue at FRONT: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "ADD AddToNewQueue at FRONT: %s", guid.ToString().c_str());
|
||||
restoredAfterProposal.push_back(guid);
|
||||
newToQueueStore.push_front(guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
//LOG_INFO("server", "ADD AddToNewQueue at the END: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "ADD AddToNewQueue at the END: %s", guid.ToString().c_str());
|
||||
newToQueueStore.push_back(guid);
|
||||
}
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromNewQueue(uint64 guid)
|
||||
void LFGQueue::RemoveFromNewQueue(ObjectGuid guid)
|
||||
{
|
||||
//LOG_INFO("server", "REMOVE RemoveFromNewQueue: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "REMOVE RemoveFromNewQueue: %s", guid.ToString().c_str());
|
||||
newToQueueStore.remove(guid);
|
||||
restoredAfterProposal.remove(guid);
|
||||
}
|
||||
|
||||
void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
|
||||
void LFGQueue::AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
|
||||
{
|
||||
//LOG_INFO("server", "JOINED AddQueueData: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "JOINED AddQueueData: %s", guid.ToString().c_str());
|
||||
QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
|
||||
AddToQueue(guid);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveQueueData(uint64 guid)
|
||||
void LFGQueue::RemoveQueueData(ObjectGuid guid)
|
||||
{
|
||||
//LOG_INFO("server", "LEFT RemoveQueueData: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "LEFT RemoveQueueData: %s", guid.ToString().c_str());
|
||||
LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
|
||||
if (it != QueueDataStore.end())
|
||||
QueueDataStore.erase(it);
|
||||
|
|
@ -142,13 +142,13 @@ namespace lfg
|
|||
wt.time = int32((wt.time * old_number + waitTime) / wt.number);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromCompatibles(uint64 guid)
|
||||
void LFGQueue::RemoveFromCompatibles(ObjectGuid guid)
|
||||
{
|
||||
//LOG_INFO("server", "COMPATIBLES REMOVE for: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "COMPATIBLES REMOVE for: %s", guid.ToString().c_str());
|
||||
for (LfgCompatibleContainer::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it)
|
||||
if (it->hasGuid(guid))
|
||||
{
|
||||
//LOG_INFO("server", "Removed Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "Removed Compatible: %s, because of: %s", it->toString().c_str(), guid.ToString().c_str());
|
||||
it->clear(); // set to 0, this will be removed while iterating in FindNewGroups
|
||||
}
|
||||
for (LfgCompatibleContainer::iterator itr = CompatibleTempList.begin(); itr != CompatibleTempList.end(); )
|
||||
|
|
@ -156,7 +156,7 @@ namespace lfg
|
|||
LfgCompatibleContainer::iterator it = itr++;
|
||||
if (it->hasGuid(guid))
|
||||
{
|
||||
//LOG_INFO("server", "Erased Temp Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "Erased Temp Compatible: %s, because of: %s", it->toString().c_str(), guid.ToString().c_str());
|
||||
CompatibleTempList.erase(it);
|
||||
}
|
||||
}
|
||||
|
|
@ -175,9 +175,9 @@ namespace lfg
|
|||
if (!newToQueueStore.empty())
|
||||
{
|
||||
++newGroupsProcessed;
|
||||
uint64 newGuid = newToQueueStore.front();
|
||||
ObjectGuid newGuid = newToQueueStore.front();
|
||||
bool pushCompatiblesToFront = (std::find(restoredAfterProposal.begin(), restoredAfterProposal.end(), newGuid) != restoredAfterProposal.end());
|
||||
//LOG_INFO("server", "newToQueueStore guid: %u, front: %u", GUID_LOPART(newGuid), pushCompatiblesToFront ? 1 : 0);
|
||||
//LOG_INFO("server", "newToQueueStore: %s, front: %u", newGuid.ToString().c_str(), pushCompatiblesToFront ? 1 : 0);
|
||||
RemoveFromNewQueue(newGuid);
|
||||
|
||||
FindNewGroups(newGuid);
|
||||
|
|
@ -190,14 +190,14 @@ namespace lfg
|
|||
return newGroupsProcessed;
|
||||
}
|
||||
|
||||
LfgCompatibility LFGQueue::FindNewGroups(const uint64& newGuid)
|
||||
LfgCompatibility LFGQueue::FindNewGroups(const ObjectGuid& newGuid)
|
||||
{
|
||||
// each combination of dps+heal+tank (tank*8 + heal+4 + dps) has a value assigned 0..15
|
||||
// first 16 bits of the mask are for marking if such combination was found once, second 16 bits for marking second occurence of that combination, etc
|
||||
uint64 foundMask = 0;
|
||||
uint32 foundCount = 0;
|
||||
|
||||
//LOG_INFO("server", "FIND NEW GROUPS for: %u", GUID_LOPART(newGuid));
|
||||
//LOG_INFO("server", "FIND NEW GROUPS for: %s", newGuid.ToString().c_str());
|
||||
|
||||
// we have to take into account that FindNewGroups is called every X minutes if number of compatibles is low!
|
||||
// build set of already present compatibles for this guid
|
||||
|
|
@ -239,9 +239,9 @@ namespace lfg
|
|||
return selfCompatibility;
|
||||
}
|
||||
|
||||
LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles)
|
||||
LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const ObjectGuid& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles)
|
||||
{
|
||||
//LOG_INFO("server", "CHECK CheckCompatibility: %s, new guid: %u", checkWith.toString().c_str(), GUID_LOPART(newGuid));
|
||||
//LOG_INFO("server", "CHECK CheckCompatibility: %s, new guid: %s", checkWith.toString().c_str(), newGuid.ToString().c_str());
|
||||
Lfg5Guids check(checkWith, false); // here newGuid is at front
|
||||
Lfg5Guids strGuids(checkWith, false); // here guids are sorted
|
||||
check.force_insert_front(newGuid);
|
||||
|
|
@ -258,22 +258,23 @@ namespace lfg
|
|||
// Check if more than one LFG group and number of players joining
|
||||
uint8 numPlayers = 0;
|
||||
uint8 numLfgGroups = 0;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint64 addToFoundMask = 0;
|
||||
|
||||
for (uint8 i = 0; i < 5 && (guid = check.guid[i]) != 0 && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++i)
|
||||
for (uint8 i = 0; i < 5 && !(guid = check.guids[i]).IsEmpty() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++i)
|
||||
{
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
|
||||
if (itQueue == QueueDataStore.end())
|
||||
{
|
||||
LOG_ERROR("server", "LFGQueue::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", guid);
|
||||
LOG_ERROR("server", "LFGQueue::CheckCompatibility: [%s] is not queued but listed as queued!", guid.ToString().c_str());
|
||||
RemoveFromQueue(guid);
|
||||
return LFG_COMPATIBILITY_PENDING;
|
||||
}
|
||||
|
||||
// Store group so we don't need to call Mgr to get it later (if it's player group will be 0 otherwise would have joined as group)
|
||||
for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2)
|
||||
proposalGroups[it2->first] = IS_GROUP_GUID(itQueue->first) ? itQueue->first : 0;
|
||||
proposalGroups[it2->first] = itQueue->first.IsGroup() ? itQueue->first : ObjectGuid::Empty;
|
||||
;
|
||||
|
||||
numPlayers += itQueue->second.roles.size();
|
||||
|
||||
|
|
@ -309,9 +310,9 @@ namespace lfg
|
|||
// If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining
|
||||
if (check.size() > 1)
|
||||
{
|
||||
for (uint8 i = 0; i < 5 && check.guid[i]; ++i)
|
||||
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)
|
||||
{
|
||||
const LfgRolesMap& roles = QueueDataStore[check.guid[i]].roles;
|
||||
const LfgRolesMap& roles = QueueDataStore[check.guids[i]].roles;
|
||||
for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
|
||||
{
|
||||
LfgRolesMap::const_iterator itPlayer;
|
||||
|
|
@ -320,7 +321,7 @@ namespace lfg
|
|||
if (itRoles->first == itPlayer->first)
|
||||
{
|
||||
// pussywizard: LFG ZOMG! this means that this player was in two different LfgQueueData (in QueueDataStore), and at least one of them is a group guid, because we do checks so there aren't 2 same guids in current CHECK
|
||||
//LOG_ERROR("server", "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
|
||||
//LOG_ERROR("server", "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [%s]", itRoles->first.ToString().c_str());
|
||||
break;
|
||||
}
|
||||
else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
|
||||
|
|
@ -365,10 +366,10 @@ namespace lfg
|
|||
addToFoundMask |= (((uint64)1) << (roleCheckResult - 1));
|
||||
|
||||
proposalDungeons = QueueDataStore[check.front()].dungeons;
|
||||
for (uint8 i = 1; i < 5 && check.guid[i]; ++i)
|
||||
for (uint8 i = 1; i < 5 && check.guids[i]; ++i)
|
||||
{
|
||||
LfgDungeonSet temporal;
|
||||
LfgDungeonSet& dungeons = QueueDataStore[check.guid[i]].dungeons;
|
||||
LfgDungeonSet& dungeons = QueueDataStore[check.guids[i]].dungeons;
|
||||
std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin()));
|
||||
proposalDungeons = temporal;
|
||||
}
|
||||
|
|
@ -378,7 +379,7 @@ namespace lfg
|
|||
}
|
||||
else
|
||||
{
|
||||
uint64 gguid = check.front();
|
||||
ObjectGuid gguid = check.front();
|
||||
const LfgQueueData& queue = QueueDataStore[gguid];
|
||||
proposalDungeons = queue.dungeons;
|
||||
proposalRoles = queue.roles;
|
||||
|
|
@ -389,9 +390,9 @@ namespace lfg
|
|||
if (numPlayers != MAXGROUPSIZE)
|
||||
{
|
||||
strGuids.addRoles(proposalRoles);
|
||||
for (uint8 i = 0; i < 5 && check.guid[i]; ++i)
|
||||
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)
|
||||
{
|
||||
LfgQueueDataContainer::iterator itr = QueueDataStore.find(check.guid[i]);
|
||||
LfgQueueDataContainer::iterator itr = QueueDataStore.find(check.guids[i]);
|
||||
if (!itr->second.bestCompatible.empty()) // update if groups don't have it empty (for empty it will be generated in UpdateQueueTimers)
|
||||
UpdateBestCompatibleInQueue(itr, strGuids);
|
||||
}
|
||||
|
|
@ -401,7 +402,7 @@ namespace lfg
|
|||
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
|
||||
}
|
||||
|
||||
uint64 gguid = check.front();
|
||||
ObjectGuid gguid = check.front();
|
||||
proposal.queues = strGuids;
|
||||
proposal.isNew = numLfgGroups != 1 || sLFGMgr->GetOldState(gguid) != LFG_STATE_DUNGEON;
|
||||
|
||||
|
|
@ -411,7 +412,7 @@ namespace lfg
|
|||
// Create a new proposal
|
||||
proposal.cancelTime = time(nullptr) + LFG_TIME_PROPOSAL;
|
||||
proposal.state = LFG_PROPOSAL_INITIATING;
|
||||
proposal.leader = 0;
|
||||
proposal.leader.Clear();
|
||||
proposal.dungeonId = acore::Containers::SelectRandomContainerElement(proposalDungeons);
|
||||
|
||||
bool leader = false;
|
||||
|
|
@ -435,8 +436,8 @@ namespace lfg
|
|||
data.accept = LFG_ANSWER_AGREE;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < 5 && proposal.queues.guid[i]; ++i)
|
||||
RemoveFromQueue(proposal.queues.guid[i], true);
|
||||
for (uint8 i = 0; i < 5 && proposal.queues.guids[i]; ++i)
|
||||
RemoveFromQueue(proposal.queues.guids[i], true);
|
||||
|
||||
sLFGMgr->AddProposal(proposal);
|
||||
|
||||
|
|
@ -473,7 +474,7 @@ namespace lfg
|
|||
{
|
||||
if (currTime - itQueue->second.joinTime > 2 * HOUR)
|
||||
{
|
||||
uint64 guid = itQueue->first;
|
||||
ObjectGuid guid = itQueue->first;
|
||||
QueueDataStore.erase(itQueue++);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true);
|
||||
continue;
|
||||
|
|
@ -537,13 +538,13 @@ namespace lfg
|
|||
LfgQueueStatusData queueData(dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps);
|
||||
for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer)
|
||||
{
|
||||
uint64 pguid = itPlayer->first;
|
||||
ObjectGuid pguid = itPlayer->first;
|
||||
LFGMgr::SendLfgQueueStatus(pguid, queueData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
time_t LFGQueue::GetJoinTime(uint64 guid)
|
||||
time_t LFGQueue::GetJoinTime(ObjectGuid guid)
|
||||
{
|
||||
return QueueDataStore[guid].joinTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace lfg
|
|||
};
|
||||
|
||||
typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
|
||||
typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer;
|
||||
typedef std::map<ObjectGuid, LfgQueueData> LfgQueueDataContainer;
|
||||
typedef std::list<Lfg5Guids> LfgCompatibleContainer;
|
||||
|
||||
/**
|
||||
|
|
@ -65,10 +65,10 @@ namespace lfg
|
|||
{
|
||||
public:
|
||||
// Add/Remove from queue
|
||||
void AddToQueue(uint64 guid, bool failedProposal = false);
|
||||
void RemoveFromQueue(uint64 guid, bool partial = false); // xinef: partial remove, dont delete data from list!
|
||||
void AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
|
||||
void RemoveQueueData(uint64 guid);
|
||||
void AddToQueue(ObjectGuid guid, bool failedProposal = false);
|
||||
void RemoveFromQueue(ObjectGuid guid, bool partial = false); // xinef: partial remove, dont delete data from list!
|
||||
void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
|
||||
void RemoveQueueData(ObjectGuid guid);
|
||||
|
||||
// Update Timers (when proposal success)
|
||||
void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId);
|
||||
|
|
@ -78,7 +78,7 @@ namespace lfg
|
|||
|
||||
// Update Queue timers
|
||||
void UpdateQueueTimers(uint32 diff);
|
||||
time_t GetJoinTime(uint64 guid);
|
||||
time_t GetJoinTime(ObjectGuid guid);
|
||||
|
||||
// Find new group
|
||||
uint8 FindGroups();
|
||||
|
|
@ -86,17 +86,17 @@ namespace lfg
|
|||
private:
|
||||
void SetQueueUpdateData(std::string const& strGuids, LfgRolesMap const& proposalRoles);
|
||||
|
||||
void AddToNewQueue(uint64 guid, bool front);
|
||||
void RemoveFromNewQueue(uint64 guid);
|
||||
void AddToNewQueue(ObjectGuid guid, bool front);
|
||||
void RemoveFromNewQueue(ObjectGuid guid);
|
||||
|
||||
void RemoveFromCompatibles(uint64 guid);
|
||||
void RemoveFromCompatibles(ObjectGuid guid);
|
||||
void AddToCompatibles(Lfg5Guids const& key);
|
||||
|
||||
uint32 FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue);
|
||||
void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key);
|
||||
|
||||
LfgCompatibility FindNewGroups(const uint64& newGuid);
|
||||
LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles);
|
||||
LfgCompatibility FindNewGroups(const ObjectGuid& newGuid);
|
||||
LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const ObjectGuid& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles);
|
||||
|
||||
// Queue
|
||||
uint32 m_QueueStatusTimer; ///< used to check interval of sending queue status
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace lfg
|
|||
{
|
||||
player->GetSession()->SendLfgLfrList(false);
|
||||
sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true, player->GetGroup() ? player->GetGroup()->GetGUID() : 0);
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true, player->GetGroup() ? player->GetGroup()->GetGUID() : ObjectGuid::Empty);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
|
|
@ -59,16 +59,16 @@ namespace lfg
|
|||
return;
|
||||
|
||||
// Temporal: Trying to determine when group data and LFG data gets desynched
|
||||
uint64 guid = player->GetGUID();
|
||||
uint64 gguid = sLFGMgr->GetGroup(guid);
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
ObjectGuid gguid = sLFGMgr->GetGroup(guid);
|
||||
|
||||
if (Group const* group = player->GetGroup())
|
||||
{
|
||||
uint64 gguid2 = group->GetGUID();
|
||||
ObjectGuid gguid2 = group->GetGUID();
|
||||
if (gguid != gguid2)
|
||||
{
|
||||
//LOG_ERROR("server", "%s on group %u but LFG has group %u saved... Fixing.",
|
||||
// player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
|
||||
//LOG_ERROR("server", "%s on group %s but LFG has group %s saved... Fixing.",
|
||||
// player->GetSession()->GetPlayerInfo().c_str(), gguid2.ToString().c_str(), gguid.ToString().c_str());
|
||||
sLFGMgr->SetupGroupMember(guid, group->GetGUID());
|
||||
}
|
||||
}
|
||||
|
|
@ -103,7 +103,8 @@ namespace lfg
|
|||
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
|
||||
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, 0.0f);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player %s (%u) is in LFG dungeon map but does not have a valid group! Teleporting to homebind.", player->GetName().c_str(), player->GetGUIDLow());
|
||||
LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player %s (%s) is in LFG dungeon map but does not have a valid group! Teleporting to homebind.",
|
||||
player->GetName().c_str(), player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
@ -130,18 +131,18 @@ namespace lfg
|
|||
{
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
|
||||
void LFGGroupScript::OnAddMember(Group* group, ObjectGuid guid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
ObjectGuid leader = group->GetLeaderGUID();
|
||||
|
||||
if (leader == guid)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
|
||||
#endif
|
||||
sLFGMgr->SetLeader(gguid, guid);
|
||||
}
|
||||
|
|
@ -150,7 +151,8 @@ namespace lfg
|
|||
LfgState gstate = sLFGMgr->GetState(gguid);
|
||||
LfgState state = sLFGMgr->GetState(guid);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s] gstate: %u, state: %u",
|
||||
gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str(), gstate, state);
|
||||
#endif
|
||||
|
||||
if (state == LFG_STATE_QUEUED)
|
||||
|
|
@ -174,7 +176,7 @@ namespace lfg
|
|||
sLFGMgr->LeaveLfg(guid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
|
||||
void LFGGroupScript::OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(kicker);
|
||||
|
|
@ -183,9 +185,10 @@ namespace lfg
|
|||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [%s]: remove [%s] Method: %d Kicker: [%s] Reason: %s",
|
||||
gguid.ToString().c_str(), guid.ToString().c_str(), method, kicker.ToString().c_str(), (reason ? reason : ""));
|
||||
#endif
|
||||
|
||||
bool isLFG = group->isLFGGroup();
|
||||
|
|
@ -195,14 +198,14 @@ namespace lfg
|
|||
if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT)
|
||||
{
|
||||
// LfgData: Remove player from group
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
sLFGMgr->SetGroup(guid, ObjectGuid::Empty);
|
||||
sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
return;
|
||||
}
|
||||
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true, gguid);
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
sLFGMgr->SetGroup(guid, ObjectGuid::Empty);
|
||||
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
|
|
@ -214,7 +217,7 @@ namespace lfg
|
|||
if (!isLFG)
|
||||
return;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
{
|
||||
// xinef: fixed dungeon deserter
|
||||
if (method != GROUP_REMOVEMETHOD_KICK_LFG && state != LFG_STATE_FINISHED_DUNGEON &&
|
||||
|
|
@ -235,7 +238,7 @@ namespace lfg
|
|||
}
|
||||
|
||||
if (state != LFG_STATE_FINISHED_DUNGEON) // Need more players to finish the dungeon
|
||||
if (Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(sLFGMgr->GetLeader(gguid)))
|
||||
if (Player* leader = ObjectAccessor::FindConnectedPlayer(sLFGMgr->GetLeader(gguid)))
|
||||
leader->GetSession()->SendLfgOfferContinue(sLFGMgr->GetDungeon(gguid, false));
|
||||
}
|
||||
|
||||
|
|
@ -244,9 +247,9 @@ namespace lfg
|
|||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnDisband [%s]", gguid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
|
|
@ -256,15 +259,16 @@ namespace lfg
|
|||
sLFGMgr->RemoveGroupData(gguid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
|
||||
void LFGGroupScript::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [%s]: old [%s] new [%s]",
|
||||
gguid.ToString().c_str(), newLeaderGuid.ToString().c_str(), oldLeaderGuid.ToString().c_str());
|
||||
#endif
|
||||
sLFGMgr->SetLeader(gguid, newLeaderGuid);
|
||||
|
||||
|
|
@ -273,7 +277,7 @@ namespace lfg
|
|||
sLFGMgr->LeaveLfg(oldLeaderGuid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
|
||||
void LFGGroupScript::OnInviteMember(Group* group, ObjectGuid guid)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(guid);
|
||||
|
|
@ -281,10 +285,10 @@ namespace lfg
|
|||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
ObjectGuid leader = group->GetLeaderGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [%s]: invite [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
|
||||
#endif
|
||||
// No gguid == new group being formed
|
||||
// No leader == after group creation first invite is new leader
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ namespace lfg
|
|||
LFGGroupScript();
|
||||
|
||||
// Group Hooks
|
||||
void OnAddMember(Group* group, uint64 guid) override;
|
||||
void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) override;
|
||||
void OnAddMember(Group* group, ObjectGuid guid) override;
|
||||
void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason) override;
|
||||
void OnDisband(Group* group) override;
|
||||
void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) override;
|
||||
void OnInviteMember(Group* group, uint64 guid) override;
|
||||
void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override;
|
||||
void OnInviteMember(Group* group, ObjectGuid guid) override;
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void Corpse::AddToWorld()
|
|||
{
|
||||
///- Register the corpse for guid lookup
|
||||
if (!IsInWorld())
|
||||
sObjectAccessor->AddObject(this);
|
||||
GetMap()->GetObjectsStore().Insert<Corpse>(GetGUID(), this);
|
||||
|
||||
Object::AddToWorld();
|
||||
}
|
||||
|
|
@ -45,19 +45,18 @@ void Corpse::RemoveFromWorld()
|
|||
{
|
||||
///- Remove the corpse from the accessor
|
||||
if (IsInWorld())
|
||||
sObjectAccessor->RemoveObject(this);
|
||||
GetMap()->GetObjectsStore().Remove<Corpse>(GetGUID());
|
||||
|
||||
Object::RemoveFromWorld();
|
||||
WorldObject::RemoveFromWorld();
|
||||
}
|
||||
|
||||
bool Corpse::Create(uint32 guidlow, Map* map)
|
||||
bool Corpse::Create(ObjectGuid::LowType guidlow)
|
||||
{
|
||||
SetMap(map);
|
||||
Object::_Create(guidlow, 0, HIGHGUID_CORPSE);
|
||||
Object::_Create(guidlow, 0, HighGuid::Corpse);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Corpse::Create(uint32 guidlow, Player* owner)
|
||||
bool Corpse::Create(ObjectGuid::LowType guidlow, Player* owner)
|
||||
{
|
||||
ASSERT(owner);
|
||||
|
||||
|
|
@ -70,16 +69,12 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
|
|||
return false;
|
||||
}
|
||||
|
||||
//we need to assign owner's map for corpse
|
||||
//in other way we will get a crash in Corpse::SaveToDB()
|
||||
SetMap(owner->GetMap());
|
||||
|
||||
WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask());
|
||||
WorldObject::_Create(guidlow, HighGuid::Corpse, owner->GetPhaseMask());
|
||||
|
||||
SetObjectScale(1);
|
||||
SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID());
|
||||
SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID());
|
||||
|
||||
_gridCoord = acore::ComputeGridCoord(GetPositionX(), GetPositionY());
|
||||
_cellCoord = acore::ComputeCellCoord(GetPositionX(), GetPositionY());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -91,24 +86,23 @@ void Corpse::SaveToDB()
|
|||
DeleteFromDB(trans);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
|
||||
stmt->setUInt32(0, GetGUIDLow()); // corpseGuid
|
||||
stmt->setUInt32(1, GUID_LOPART(GetOwnerGUID())); // guid
|
||||
stmt->setFloat (2, GetPositionX()); // posX
|
||||
stmt->setFloat (3, GetPositionY()); // posY
|
||||
stmt->setFloat (4, GetPositionZ()); // posZ
|
||||
stmt->setFloat (5, GetOrientation()); // orientation
|
||||
stmt->setUInt16(6, GetMapId()); // mapId
|
||||
stmt->setUInt32(7, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
|
||||
stmt->setString(8, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
|
||||
stmt->setUInt32(9, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
|
||||
stmt->setUInt32(10, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
|
||||
stmt->setUInt32(11, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
|
||||
stmt->setUInt8 (12, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
|
||||
stmt->setUInt8 (13, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
|
||||
stmt->setUInt32(14, uint32(m_time)); // time
|
||||
stmt->setUInt8 (15, GetType()); // corpseType
|
||||
stmt->setUInt32(16, GetInstanceId()); // instanceId
|
||||
stmt->setUInt32(17, GetPhaseMask()); // phaseMask
|
||||
stmt->setUInt32(0, GetOwnerGUID().GetCounter()); // guid
|
||||
stmt->setFloat (1, GetPositionX()); // posX
|
||||
stmt->setFloat (2, GetPositionY()); // posY
|
||||
stmt->setFloat (3, GetPositionZ()); // posZ
|
||||
stmt->setFloat (4, GetOrientation()); // orientation
|
||||
stmt->setUInt16(5, GetMapId()); // mapId
|
||||
stmt->setUInt32(6, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
|
||||
stmt->setString(7, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
|
||||
stmt->setUInt32(8, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
|
||||
stmt->setUInt32(9, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
|
||||
stmt->setUInt32(10, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
|
||||
stmt->setUInt8 (11, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
|
||||
stmt->setUInt8 (12, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
|
||||
stmt->setUInt32(13, uint32(m_time)); // time
|
||||
stmt->setUInt8 (14, GetType()); // corpseType
|
||||
stmt->setUInt32(15, GetInstanceId()); // instanceId
|
||||
stmt->setUInt32(16, GetPhaseMask()); // phaseMask
|
||||
trans->Append(stmt);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
|
@ -116,34 +110,29 @@ void Corpse::SaveToDB()
|
|||
|
||||
void Corpse::DeleteFromDB(SQLTransaction& trans)
|
||||
{
|
||||
PreparedStatement* stmt = nullptr;
|
||||
if (GetType() == CORPSE_BONES)
|
||||
{
|
||||
// Only specific bones
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSE);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
}
|
||||
else
|
||||
{
|
||||
// all corpses (not bones)
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_CORPSES);
|
||||
stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
|
||||
}
|
||||
trans->Append(stmt);
|
||||
DeleteFromDB(GetOwnerGUID(), trans);
|
||||
}
|
||||
|
||||
bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
|
||||
void Corpse::DeleteFromDB(ObjectGuid const ownerGuid, SQLTransaction& trans)
|
||||
{
|
||||
uint32 ownerGuid = fields[17].GetUInt32();
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
// SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSE);
|
||||
stmt->setUInt32(0, ownerGuid.GetCounter());
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
}
|
||||
|
||||
bool Corpse::LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields)
|
||||
{
|
||||
ObjectGuid::LowType ownerGuid = fields[16].GetUInt32();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
||||
// SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, guid FROM corpse WHERE mapId = ? AND instanceId = ?
|
||||
float posX = fields[0].GetFloat();
|
||||
float posY = fields[1].GetFloat();
|
||||
float posZ = fields[2].GetFloat();
|
||||
float o = fields[3].GetFloat();
|
||||
uint32 mapId = fields[4].GetUInt16();
|
||||
|
||||
Object::_Create(guid, 0, HIGHGUID_CORPSE);
|
||||
Object::_Create(guid, 0, HighGuid::Corpse);
|
||||
|
||||
SetObjectScale(1.0f);
|
||||
SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, fields[5].GetUInt32());
|
||||
|
|
@ -153,7 +142,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
|
|||
SetUInt32Value(CORPSE_FIELD_GUILD, fields[9].GetUInt32());
|
||||
SetUInt32Value(CORPSE_FIELD_FLAGS, fields[10].GetUInt8());
|
||||
SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[11].GetUInt8());
|
||||
SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(ownerGuid, 0, HIGHGUID_PLAYER));
|
||||
SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid::Create<HighGuid::Player>(ownerGuid));
|
||||
|
||||
m_time = time_t(fields[12].GetUInt32());
|
||||
|
||||
|
|
@ -168,17 +157,21 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
|
|||
|
||||
if (!IsPositionValid())
|
||||
{
|
||||
LOG_ERROR("server", "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
|
||||
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ);
|
||||
LOG_ERROR("server", "Corpse ( %s, owner: %s) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
|
||||
GetGUID().ToString().c_str(), GetOwnerGUID().ToString().c_str(), posX, posY, posZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
_gridCoord = acore::ComputeGridCoord(GetPositionX(), GetPositionY());
|
||||
_cellCoord = acore::ComputeCellCoord(GetPositionX(), GetPositionY());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Corpse::IsExpired(time_t t) const
|
||||
{
|
||||
// Deleted character
|
||||
if (!sWorld->GetGlobalPlayerData(GetOwnerGUID().GetCounter()))
|
||||
return true;
|
||||
|
||||
if (m_type == CORPSE_BONES)
|
||||
return m_time < t - 60 * MINUTE;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -43,22 +43,23 @@ public:
|
|||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
bool Create(uint32 guidlow, Map* map);
|
||||
bool Create(uint32 guidlow, Player* owner);
|
||||
bool Create(ObjectGuid::LowType guidlow);
|
||||
bool Create(ObjectGuid::LowType guidlow, Player* owner);
|
||||
|
||||
void SaveToDB();
|
||||
bool LoadCorpseFromDB(uint32 guid, Field* fields);
|
||||
bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields);
|
||||
|
||||
void DeleteFromDB(SQLTransaction& trans);
|
||||
static void DeleteFromDB(ObjectGuid const ownerGuid, SQLTransaction& trans);
|
||||
|
||||
[[nodiscard]] uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
|
||||
[[nodiscard]] ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); }
|
||||
|
||||
[[nodiscard]] time_t const& GetGhostTime() const { return m_time; }
|
||||
void ResetGhostTime() { m_time = time(nullptr); }
|
||||
[[nodiscard]] CorpseType GetType() const { return m_type; }
|
||||
|
||||
[[nodiscard]] GridCoord const& GetGridCoord() const { return _gridCoord; }
|
||||
void SetGridCoord(GridCoord const& gridCoord) { _gridCoord = gridCoord; }
|
||||
CellCoord const& GetCellCoord() const { return _cellCoord; }
|
||||
void SetCellCoord(CellCoord const& cellCoord) { _cellCoord = cellCoord; }
|
||||
|
||||
Loot loot; // remove insignia ONLY at BG
|
||||
Player* lootRecipient;
|
||||
|
|
@ -68,6 +69,6 @@ public:
|
|||
private:
|
||||
CorpseType m_type;
|
||||
time_t m_time;
|
||||
GridCoord _gridCoord; // gride for corpse position for fast search
|
||||
CellCoord _cellCoord;
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -163,10 +163,10 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0),
|
||||
Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), m_lootRecipientGroup(0),
|
||||
m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_wanderDistance(0.0f),
|
||||
m_transportCheckTimer(1000), lootPickPocketRestoreTime(0), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE),
|
||||
m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_originalAnimTier(UNIT_BYTE1_FLAG_GROUND), m_AlreadyCallAssistance(false),
|
||||
m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_originalAnimTier(UNIT_BYTE1_FLAG_GROUND), m_AlreadyCallAssistance(false),
|
||||
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_moveInLineOfSightDisabled(false), m_moveInLineOfSightStrictlyDisabled(false),
|
||||
m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_waypointID(0), m_path_id(0), m_formation(nullptr), _lastDamagedTime(nullptr), m_cannotReachTarget(false), m_cannotReachTimer(0),
|
||||
_isMissingSwimmingFlagOutOfCombat(false)
|
||||
|
|
@ -217,10 +217,16 @@ void Creature::AddToWorld()
|
|||
if (GetZoneScript())
|
||||
GetZoneScript()->OnCreatureCreate(this);
|
||||
|
||||
sObjectAccessor->AddObject(this);
|
||||
GetMap()->GetObjectsStore().Insert<Creature>(GetGUID(), this);
|
||||
if (m_spawnId)
|
||||
GetMap()->GetCreatureBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
|
||||
|
||||
Unit::AddToWorld();
|
||||
|
||||
SearchFormation();
|
||||
|
||||
AIM_Initialize();
|
||||
|
||||
if (IsVehicle())
|
||||
GetVehicleKit()->Install();
|
||||
#ifdef ELUNA
|
||||
|
|
@ -238,12 +244,19 @@ void Creature::RemoveFromWorld()
|
|||
#endif
|
||||
if (GetZoneScript())
|
||||
GetZoneScript()->OnCreatureRemove(this);
|
||||
|
||||
if (m_formation)
|
||||
sFormationMgr->RemoveCreatureFromGroup(m_formation, this);
|
||||
|
||||
if (Transport* transport = GetTransport())
|
||||
transport->RemovePassenger(this, true);
|
||||
|
||||
Unit::RemoveFromWorld();
|
||||
sObjectAccessor->RemoveObject(this);
|
||||
|
||||
if (m_spawnId)
|
||||
acore::Containers::MultimapErasePair(GetMap()->GetCreatureBySpawnIdStore(), m_spawnId, this);
|
||||
|
||||
GetMap()->GetObjectsStore().Remove<Creature>(GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -262,11 +275,11 @@ void Creature::SearchFormation()
|
|||
if (IsSummon())
|
||||
return;
|
||||
|
||||
uint32 lowguid = GetDBTableGUIDLow();
|
||||
if (!lowguid)
|
||||
ObjectGuid::LowType spawnId = GetSpawnId();
|
||||
if (!spawnId)
|
||||
return;
|
||||
|
||||
CreatureGroupInfoType::iterator frmdata = sFormationMgr->CreatureGroupMap.find(lowguid);
|
||||
CreatureGroupInfoType::iterator frmdata = sFormationMgr->CreatureGroupMap.find(spawnId);
|
||||
if (frmdata != sFormationMgr->CreatureGroupMap.end())
|
||||
sFormationMgr->AddCreatureToGroup(frmdata->second->leaderGUID, this);
|
||||
}
|
||||
|
|
@ -520,11 +533,11 @@ void Creature::Update(uint32 diff)
|
|||
{
|
||||
case JUST_RESPAWNED:
|
||||
// Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
|
||||
LOG_ERROR("server", "Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
|
||||
LOG_ERROR("server", "Creature (%s) in wrong state: JUST_RESPAWNED (4)", GetGUID().ToString().c_str());
|
||||
break;
|
||||
case JUST_DIED:
|
||||
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
|
||||
LOG_ERROR("server", "Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
|
||||
LOG_ERROR("server", "Creature (%s) in wrong state: JUST_DEAD (1)", GetGUID().ToString().c_str());
|
||||
break;
|
||||
case DEAD:
|
||||
{
|
||||
|
|
@ -535,13 +548,13 @@ void Creature::Update(uint32 diff)
|
|||
if (!allowed) // Will be rechecked on next Update call
|
||||
break;
|
||||
|
||||
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_UNIT);
|
||||
ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Unit>(GetEntry(), m_spawnId);
|
||||
time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
|
||||
if (!linkedRespawntime) // Can respawn
|
||||
Respawn();
|
||||
else // the master is dead
|
||||
{
|
||||
uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
|
||||
ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
|
||||
if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
|
||||
SetRespawnTime(DAY);
|
||||
else
|
||||
|
|
@ -695,7 +708,7 @@ void Creature::Update(uint32 diff)
|
|||
if (IsInWorld() && !IsDuringRemoveFromWorld())
|
||||
{
|
||||
// pussywizard:
|
||||
if (IS_PLAYER_GUID(GetOwnerGUID()))
|
||||
if (GetOwnerGUID().IsPlayer())
|
||||
{
|
||||
if (m_transportCheckTimer <= diff)
|
||||
{
|
||||
|
|
@ -739,7 +752,7 @@ void Creature::Regenerate(Powers power)
|
|||
uint32 maxValue = GetMaxPower(power);
|
||||
|
||||
// Xinef: implement power regeneration flag
|
||||
if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER) && !IS_PLAYER_GUID(GetOwnerGUID()))
|
||||
if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER) && !GetOwnerGUID().IsPlayer())
|
||||
return;
|
||||
|
||||
if (curValue >= maxValue)
|
||||
|
|
@ -892,7 +905,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
|
|||
i_AI->InitializeAI();
|
||||
|
||||
// Xinef: Initialize vehicle if it is not summoned!
|
||||
if (GetVehicleKit() && GetDBTableGUIDLow())
|
||||
if (GetVehicleKit() && m_spawnId)
|
||||
GetVehicleKit()->Reset();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -912,7 +925,7 @@ void Creature::Motion_Initialize()
|
|||
GetMotionMaster()->Initialize();
|
||||
}
|
||||
|
||||
bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data)
|
||||
bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data)
|
||||
{
|
||||
ASSERT(map);
|
||||
SetMap(map);
|
||||
|
|
@ -1088,7 +1101,7 @@ Player* Creature::GetLootRecipient() const
|
|||
{
|
||||
if (!m_lootRecipient)
|
||||
return nullptr;
|
||||
return ObjectAccessor::FindPlayerInOrOutOfWorld(m_lootRecipient);
|
||||
return ObjectAccessor::FindConnectedPlayer(m_lootRecipient);
|
||||
}
|
||||
|
||||
Group* Creature::GetLootRecipientGroup() const
|
||||
|
|
@ -1106,7 +1119,7 @@ void Creature::SetLootRecipient(Unit* unit, bool withGroup)
|
|||
|
||||
if (!unit)
|
||||
{
|
||||
m_lootRecipient = 0;
|
||||
m_lootRecipient.Clear();
|
||||
m_lootRecipientGroup = 0;
|
||||
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED);
|
||||
return;
|
||||
|
|
@ -1124,7 +1137,7 @@ void Creature::SetLootRecipient(Unit* unit, bool withGroup)
|
|||
if (withGroup)
|
||||
{
|
||||
if (Group* group = player->GetGroup())
|
||||
m_lootRecipientGroup = group->GetLowGUID();
|
||||
m_lootRecipientGroup = group->GetGUID().GetCounter();
|
||||
}
|
||||
else
|
||||
m_lootRecipientGroup = 0;
|
||||
|
|
@ -1149,7 +1162,7 @@ void Creature::SaveToDB()
|
|||
{
|
||||
// this should only be used when the creature has already been loaded
|
||||
// preferably after adding to map, because mapid may not be valid otherwise
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(m_DBTableGuid);
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
|
||||
if (!data)
|
||||
{
|
||||
LOG_ERROR("server", "Creature::SaveToDB failed, cannot get creature data!");
|
||||
|
|
@ -1163,9 +1176,10 @@ void Creature::SaveToDB()
|
|||
void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||
{
|
||||
// update in loaded data
|
||||
if (!m_DBTableGuid)
|
||||
m_DBTableGuid = GetGUIDLow();
|
||||
CreatureData& data = sObjectMgr->NewOrExistCreatureData(m_DBTableGuid);
|
||||
if (!m_spawnId)
|
||||
m_spawnId = sObjectMgr->GenerateCreatureSpawnId();
|
||||
|
||||
CreatureData& data = sObjectMgr->NewOrExistCreatureData(m_spawnId);
|
||||
|
||||
uint32 displayId = GetNativeDisplayId();
|
||||
uint32 npcflag = GetUInt32Value(UNIT_NPC_FLAGS);
|
||||
|
|
@ -1190,7 +1204,6 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
|||
dynamicflags = 0;
|
||||
}
|
||||
|
||||
// data->guid = guid must not be updated at save
|
||||
data.id = GetEntry();
|
||||
data.mapid = mapid;
|
||||
data.phaseMask = phaseMask;
|
||||
|
|
@ -1229,13 +1242,13 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
|||
SQLTransaction trans = WorldDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
stmt->setUInt32(0, m_spawnId);
|
||||
trans->Append(stmt);
|
||||
|
||||
uint8 index = 0;
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE);
|
||||
stmt->setUInt32(index++, m_DBTableGuid);
|
||||
stmt->setUInt32(index++, m_spawnId);
|
||||
stmt->setUInt32(index++, GetEntry());
|
||||
stmt->setUInt16(index++, uint16(mapid));
|
||||
stmt->setUInt8(index++, spawnMask);
|
||||
|
|
@ -1377,7 +1390,7 @@ float Creature::GetSpellDamageMod(int32 Rank)
|
|||
}
|
||||
}
|
||||
|
||||
bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const CreatureData* data)
|
||||
bool Creature::CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, const CreatureData* data)
|
||||
{
|
||||
SetZoneScript();
|
||||
if (GetZoneScript() && data)
|
||||
|
|
@ -1396,7 +1409,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const
|
|||
|
||||
SetOriginalEntry(Entry);
|
||||
|
||||
Object::_Create(guidlow, Entry, (vehId || normalInfo->VehicleId) ? HIGHGUID_VEHICLE : HIGHGUID_UNIT);
|
||||
Object::_Create(guidlow, Entry, (vehId || normalInfo->VehicleId) ? HighGuid::Vehicle : HighGuid::Unit);
|
||||
|
||||
// Xinef: select proper vehicle id
|
||||
if (!vehId)
|
||||
|
|
@ -1434,13 +1447,42 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap, bool gridLoad)
|
||||
bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, bool gridLoad, bool allowDuplicate /*= false*/)
|
||||
{
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(guid);
|
||||
if (!allowDuplicate)
|
||||
{
|
||||
// If an alive instance of this spawnId is already found, skip creation
|
||||
// If only dead instance(s) exist, despawn them and spawn a new (maybe also dead) version
|
||||
const auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(spawnId);
|
||||
std::vector <Creature*> despawnList;
|
||||
|
||||
if (creatureBounds.first != creatureBounds.second)
|
||||
{
|
||||
for (auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
|
||||
{
|
||||
if (itr->second->IsAlive())
|
||||
{
|
||||
LOG_DEBUG("maps", "Would have spawned %u but %s already exists", spawnId, creatureBounds.first->second->GetGUID().ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
despawnList.push_back(itr->second);
|
||||
LOG_DEBUG("maps", "Despawned dead instance of spawn %u (%s)", spawnId, itr->second->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
for (Creature* despawnCreature : despawnList)
|
||||
{
|
||||
despawnCreature->AddObjectToRemoveList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(spawnId);
|
||||
if (!data)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Creature (GUID: %u) not found in table `creature`, can't load. ", guid);
|
||||
LOG_ERROR("sql.sql", "Creature (SpawnId: %u) not found in table `creature`, can't load. ", spawnId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1456,17 +1498,9 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap, bool gri
|
|||
|
||||
// xinef: this has to be assigned before Create function, properly loads equipment id from DB
|
||||
m_creatureData = data;
|
||||
m_DBTableGuid = guid;
|
||||
m_spawnId = spawnId;
|
||||
|
||||
if (map->GetInstanceId() == 0)
|
||||
{
|
||||
if (map->GetCreature(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
|
||||
|
||||
if (!Create(guid, map, data->phaseMask, data->id, 0, data->posX, data->posY, data->posZ, data->orientation, data))
|
||||
if (!Create(map->GenerateLowGuid<HighGuid::Unit>(), map, data->phaseMask, data->id, 0, data->posX, data->posY, data->posZ, data->orientation, data))
|
||||
return false;
|
||||
|
||||
//We should set first home position, because then AI calls home movement
|
||||
|
|
@ -1477,7 +1511,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap, bool gri
|
|||
m_respawnDelay = data->spawntimesecs;
|
||||
m_deathState = ALIVE;
|
||||
|
||||
m_respawnTime = GetMap()->GetCreatureRespawnTime(m_DBTableGuid);
|
||||
m_respawnTime = GetMap()->GetCreatureRespawnTime(m_spawnId);
|
||||
if (m_respawnTime) // respawn on Update
|
||||
{
|
||||
m_deathState = DEAD;
|
||||
|
|
@ -1572,31 +1606,31 @@ bool Creature::hasInvolvedQuest(uint32 quest_id) const
|
|||
|
||||
void Creature::DeleteFromDB()
|
||||
{
|
||||
if (!m_DBTableGuid)
|
||||
if (!m_spawnId)
|
||||
{
|
||||
LOG_ERROR("server", "Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry());
|
||||
LOG_ERROR("server", "Trying to delete not saved creature: %s", GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
|
||||
sObjectMgr->DeleteCreatureData(m_DBTableGuid);
|
||||
GetMap()->RemoveCreatureRespawnTime(m_spawnId);
|
||||
sObjectMgr->DeleteCreatureData(m_spawnId);
|
||||
|
||||
SQLTransaction trans = WorldDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
stmt->setUInt32(0, m_spawnId);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
stmt->setUInt32(0, m_spawnId);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_CREATURE);
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
stmt->setUInt32(0, m_spawnId);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP);
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
stmt->setUInt32(0, m_spawnId);
|
||||
trans->Append(stmt);
|
||||
|
||||
WorldDatabase.CommitTransaction(trans);
|
||||
|
|
@ -1683,7 +1717,7 @@ void Creature::setDeathState(DeathState s, bool despawn)
|
|||
if (GetMap()->IsDungeon() || isWorldBoss() || GetCreatureTemplate()->rank >= CREATURE_ELITE_ELITE)
|
||||
SaveRespawnTime();
|
||||
|
||||
SetTarget(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
|
||||
SetTarget(); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
|
||||
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
Dismount(); // if creature is mounted on a virtual mount, remove it at death
|
||||
|
|
@ -1761,11 +1795,11 @@ void Creature::Respawn(bool force)
|
|||
|
||||
if (getDeathState() == DEAD)
|
||||
{
|
||||
if (m_DBTableGuid)
|
||||
GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
|
||||
if (m_spawnId)
|
||||
GetMap()->RemoveCreatureRespawnTime(m_spawnId);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry());
|
||||
LOG_DEBUG("server", "Respawning creature %s (SpawnId: %u, %s)", GetName().c_str(), GetSpawnId(), GetGUID().ToString().c_str());
|
||||
#endif
|
||||
m_respawnTime = 0;
|
||||
ResetPickPocketLootTime();
|
||||
|
|
@ -1796,9 +1830,9 @@ void Creature::Respawn(bool force)
|
|||
TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing
|
||||
}
|
||||
|
||||
uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
|
||||
uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<Creature>(m_spawnId) : 0;
|
||||
if (poolid)
|
||||
sPoolMgr->UpdatePool<Creature>(poolid, GetDBTableGUIDLow());
|
||||
sPoolMgr->UpdatePool<Creature>(poolid, m_spawnId);
|
||||
|
||||
//Re-initialize reactstate that could be altered by movementgenerators
|
||||
InitializeReactState();
|
||||
|
|
@ -1848,7 +1882,7 @@ void Creature::InitializeReactState()
|
|||
|
||||
bool Creature::HasMechanicTemplateImmunity(uint32 mask) const
|
||||
{
|
||||
return !IS_PLAYER_GUID(GetOwnerGUID()) && (GetCreatureTemplate()->MechanicImmuneMask & mask);
|
||||
return !GetOwnerGUID().IsPlayer() && (GetCreatureTemplate()->MechanicImmuneMask & mask);
|
||||
}
|
||||
|
||||
void Creature::LoadSpellTemplateImmunity()
|
||||
|
|
@ -1864,7 +1898,7 @@ void Creature::LoadSpellTemplateImmunity()
|
|||
}
|
||||
|
||||
// don't inherit immunities for hunter pets
|
||||
if (IS_PLAYER_GUID(GetOwnerGUID()) && IsHunterPet())
|
||||
if (GetOwnerGUID().IsPlayer() && IsHunterPet())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -2071,7 +2105,7 @@ void Creature::SendAIReaction(AiReaction reactionType)
|
|||
{
|
||||
WorldPacket data(SMSG_AI_REACTION, 12);
|
||||
|
||||
data << uint64(GetGUID());
|
||||
data << GetGUID();
|
||||
data << uint32(reactionType);
|
||||
|
||||
((WorldObject*)this)->SendMessageToSet(&data, true);
|
||||
|
|
@ -2262,10 +2296,10 @@ void Creature::UpdateMoveInLineOfSightState()
|
|||
|
||||
void Creature::SaveRespawnTime()
|
||||
{
|
||||
if (IsSummon() || !GetDBTableGUIDLow() || (m_creatureData && !m_creatureData->dbData))
|
||||
if (IsSummon() || !m_spawnId || (m_creatureData && !m_creatureData->dbData))
|
||||
return;
|
||||
|
||||
GetMap()->SaveCreatureRespawnTime(GetDBTableGUIDLow(), m_respawnTime);
|
||||
GetMap()->SaveCreatureRespawnTime(m_spawnId, m_respawnTime);
|
||||
}
|
||||
|
||||
bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
||||
|
|
@ -2296,7 +2330,7 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!IS_PLAYER_GUID(GetCharmerOrOwnerGUID()))
|
||||
if (!GetCharmerOrOwnerGUID().IsPlayer())
|
||||
{
|
||||
if (GetMap()->IsDungeon())
|
||||
return true;
|
||||
|
|
@ -2327,9 +2361,9 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
|||
|
||||
CreatureAddon const* Creature::GetCreatureAddon() const
|
||||
{
|
||||
if (m_DBTableGuid)
|
||||
if (m_spawnId)
|
||||
{
|
||||
if (CreatureAddon const* addon = sObjectMgr->GetCreatureAddon(m_DBTableGuid))
|
||||
if (CreatureAddon const* addon = sObjectMgr->GetCreatureAddon(m_spawnId))
|
||||
return addon;
|
||||
}
|
||||
|
||||
|
|
@ -2407,7 +2441,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
|
|||
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
|
||||
if (!AdditionalSpellInfo)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
|
||||
LOG_ERROR("sql.sql", "Creature (%s) has wrong spell %u defined in `auras` field.", GetGUID().ToString().c_str(), *itr);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2415,14 +2449,14 @@ bool Creature::LoadCreaturesAddon(bool reload)
|
|||
if (HasAura(*itr))
|
||||
{
|
||||
if (!reload)
|
||||
LOG_ERROR("sql.sql", "Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
|
||||
LOG_ERROR("sql.sql", "Creature (%s) has duplicate aura (spell %u) in `auras` field.", GetGUID().ToString().c_str(), *itr);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
AddAura(*itr, this);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.unit", "Spell: %u added to creature (GUID: %u Entry: %u)", *itr, GetGUIDLow(), GetEntry());
|
||||
LOG_DEBUG("entities.unit", "Spell: %u added to creature (%s)", *itr, GetGUID().ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -2576,9 +2610,9 @@ time_t Creature::GetRespawnTimeEx() const
|
|||
|
||||
void Creature::GetRespawnPosition(float& x, float& y, float& z, float* ori, float* dist) const
|
||||
{
|
||||
if (m_DBTableGuid)
|
||||
if (m_spawnId)
|
||||
{
|
||||
if (CreatureData const* data = sObjectMgr->GetCreatureData(GetDBTableGUIDLow()))
|
||||
if (CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId))
|
||||
{
|
||||
x = data->posX;
|
||||
y = data->posY;
|
||||
|
|
@ -2775,7 +2809,7 @@ void Creature::SetPosition(float x, float y, float z, float o)
|
|||
|
||||
bool Creature::IsDungeonBoss() const
|
||||
{
|
||||
if (IS_PLAYER_GUID(GetOwnerGUID()))
|
||||
if (GetOwnerGUID().IsPlayer())
|
||||
return false;
|
||||
|
||||
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
|
||||
|
|
@ -2784,7 +2818,7 @@ bool Creature::IsDungeonBoss() const
|
|||
|
||||
bool Creature::IsImmuneToKnockback() const
|
||||
{
|
||||
if (IS_PLAYER_GUID(GetOwnerGUID()))
|
||||
if (GetOwnerGUID().IsPlayer())
|
||||
return false;
|
||||
|
||||
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
|
||||
|
|
@ -2797,7 +2831,7 @@ bool Creature::SetWalk(bool enable)
|
|||
return false;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_WALK_MODE : SMSG_SPLINE_MOVE_SET_RUN_MODE, 9);
|
||||
data.append(GetPackGUID());
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, false);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2815,7 +2849,7 @@ bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/)
|
|||
return true;
|
||||
|
||||
WorldPacket data(disable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9);
|
||||
data.append(GetPackGUID());
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, false);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2849,7 +2883,7 @@ bool Creature::SetSwim(bool enable)
|
|||
return true;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_START_SWIM : SMSG_SPLINE_MOVE_STOP_SWIM);
|
||||
data.append(GetPackGUID());
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, true);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2866,7 +2900,7 @@ bool Creature::CanSwim() const
|
|||
if (Unit::CanSwim())
|
||||
return true;
|
||||
|
||||
if (IsPet() || IS_PLAYER_GUID(GetOwnerGUID()))
|
||||
if (IsPet() || GetOwnerGUID().IsPlayer())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -2900,7 +2934,7 @@ bool Creature::SetCanFly(bool enable, bool /*packetOnly*/ /* = false */)
|
|||
return true;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9);
|
||||
data.append(GetPackGUID());
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, false);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2922,7 +2956,7 @@ bool Creature::SetWaterWalking(bool enable, bool packetOnly /* = false */)
|
|||
return true;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_WATER_WALK : SMSG_SPLINE_MOVE_LAND_WALK, 9);
|
||||
data.append(GetPackGUID());
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, true);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2936,7 +2970,7 @@ bool Creature::SetFeatherFall(bool enable, bool packetOnly /* = false */)
|
|||
return true;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL, 9);
|
||||
data.append(GetPackGUID());
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, true);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2953,7 +2987,7 @@ bool Creature::SetHover(bool enable, bool packetOnly /*= false*/)
|
|||
|
||||
//! Not always a packet is sent
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9);
|
||||
data.append(GetPackGUID());
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, false);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3038,10 +3072,10 @@ void Creature::SetDisplayId(uint32 modelId)
|
|||
SetFloatValue(UNIT_FIELD_COMBATREACH, combatReach * GetObjectScale());
|
||||
}
|
||||
|
||||
void Creature::SetTarget(uint64 guid)
|
||||
void Creature::SetTarget(ObjectGuid guid)
|
||||
{
|
||||
if (!_focusSpell)
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, guid);
|
||||
SetGuidValue(UNIT_FIELD_TARGET, guid);
|
||||
}
|
||||
|
||||
void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
|
||||
|
|
@ -3051,7 +3085,7 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
|
|||
return;
|
||||
|
||||
_focusSpell = focusSpell;
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, this == target ? 0 : target->GetGUID());
|
||||
SetGuidValue(UNIT_FIELD_TARGET, this == target ? ObjectGuid::Empty : target->GetGUID());
|
||||
if (focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST))
|
||||
AddUnitState(UNIT_STATE_ROTATING);
|
||||
|
||||
|
|
@ -3080,9 +3114,9 @@ void Creature::ReleaseFocus(Spell const* focusSpell)
|
|||
|
||||
_focusSpell = nullptr;
|
||||
if (Unit* victim = GetVictim())
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
|
||||
SetGuidValue(UNIT_FIELD_TARGET, victim->GetGUID());
|
||||
else
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
||||
SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty);
|
||||
|
||||
if (focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST))
|
||||
ClearUnitState(UNIT_STATE_ROTATING);
|
||||
|
|
|
|||
|
|
@ -444,12 +444,12 @@ public:
|
|||
|
||||
void DisappearAndDie();
|
||||
|
||||
bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data = nullptr);
|
||||
bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data = nullptr);
|
||||
bool LoadCreaturesAddon(bool reload = false);
|
||||
void SelectLevel(bool changelevel = true);
|
||||
void LoadEquipment(int8 id = 1, bool force = false);
|
||||
|
||||
[[nodiscard]] uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
|
||||
[[nodiscard]] ObjectGuid::LowType GetSpawnId() const { return m_spawnId; }
|
||||
|
||||
void Update(uint32 time) override; // overwrited Unit::Update
|
||||
void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr, float* dist = nullptr) const;
|
||||
|
|
@ -527,7 +527,7 @@ public:
|
|||
{
|
||||
::Spell const* Spell = nullptr;
|
||||
uint32 Delay = 0; // ms until the creature's target should snap back (0 = no snapback scheduled)
|
||||
uint64 Target; // the creature's "real" target while casting
|
||||
ObjectGuid Target; // the creature's "real" target while casting
|
||||
float Orientation = 0.0f; // the creature's "real" orientation while casting
|
||||
} _spellFocusInfo;
|
||||
|
||||
|
|
@ -584,15 +584,15 @@ public:
|
|||
|
||||
void setDeathState(DeathState s, bool despawn = false) override; // override virtual Unit::setDeathState
|
||||
|
||||
bool LoadFromDB(uint32 guid, Map* map) { return LoadCreatureFromDB(guid, map, false, true); }
|
||||
bool LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap = true, bool gridLoad = false);
|
||||
bool LoadFromDB(ObjectGuid::LowType guid, Map* map, bool allowDuplicate = false) { return LoadCreatureFromDB(guid, map, false, true, allowDuplicate); }
|
||||
bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap = true, bool gridLoad = false, bool allowDuplicate = false);
|
||||
void SaveToDB();
|
||||
// overriden in Pet
|
||||
virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
|
||||
virtual void DeleteFromDB(); // overriden in Pet
|
||||
|
||||
Loot loot;
|
||||
[[nodiscard]] uint64 GetLootRecipientGUID() const { return m_lootRecipient; }
|
||||
[[nodiscard]] ObjectGuid GetLootRecipientGUID() const { return m_lootRecipient; }
|
||||
[[nodiscard]] Player* GetLootRecipient() const;
|
||||
[[nodiscard]] Group* GetLootRecipientGroup() const;
|
||||
[[nodiscard]] bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
|
||||
|
|
@ -733,7 +733,7 @@ public:
|
|||
bool m_isTempWorldObject; //true when possessed
|
||||
|
||||
// Handling caster facing during spellcast
|
||||
void SetTarget(uint64 guid) override;
|
||||
void SetTarget(ObjectGuid guid = ObjectGuid::Empty) override;
|
||||
void FocusTarget(Spell const* focusSpell, WorldObject const* target);
|
||||
void ReleaseFocus(Spell const* focusSpell);
|
||||
bool IsMovementPreventedByCasting() const;
|
||||
|
|
@ -757,7 +757,7 @@ public:
|
|||
void RefreshSwimmingFlag(bool recheck = false);
|
||||
|
||||
protected:
|
||||
bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const CreatureData* data = nullptr);
|
||||
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, const CreatureData* data = nullptr);
|
||||
bool InitEntry(uint32 entry, const CreatureData* data = nullptr);
|
||||
|
||||
// vendor items
|
||||
|
|
@ -765,7 +765,7 @@ protected:
|
|||
|
||||
static float _GetHealthMod(int32 Rank);
|
||||
|
||||
uint64 m_lootRecipient;
|
||||
ObjectGuid m_lootRecipient;
|
||||
uint32 m_lootRecipientGroup;
|
||||
|
||||
/// Timers
|
||||
|
|
@ -782,7 +782,7 @@ protected:
|
|||
void RegenerateHealth();
|
||||
void Regenerate(Powers power);
|
||||
MovementGeneratorType m_defaultMovementType;
|
||||
uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
|
||||
ObjectGuid::LowType m_spawnId; ///< For new or temporary creatures is 0 for saved it is lowguid
|
||||
uint8 m_equipmentId;
|
||||
int8 m_originalEquipmentId; // can be -1
|
||||
|
||||
|
|
@ -838,15 +838,16 @@ private:
|
|||
class AssistDelayEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
AssistDelayEvent(uint64 victim, Creature* owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
|
||||
AssistDelayEvent(ObjectGuid victim, Creature* owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
|
||||
|
||||
bool Execute(uint64 e_time, uint32 p_time) override;
|
||||
void AddAssistant(uint64 guid) { m_assistants.push_back(guid); }
|
||||
void AddAssistant(ObjectGuid guid) { m_assistants.push_back(guid); }
|
||||
|
||||
private:
|
||||
AssistDelayEvent();
|
||||
|
||||
uint64 m_victim;
|
||||
std::list<uint64> m_assistants;
|
||||
ObjectGuid m_victim;
|
||||
GuidList m_assistants;
|
||||
Creature* m_owner;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
|
|||
if (itr != map->CreatureGroupHolder.end())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.unit", "Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId());
|
||||
LOG_DEBUG("entities.unit", "Group found: %u, inserting creature %s, Group InstanceID %u", groupId, member->GetGUID().ToString().c_str(), member->GetInstanceId());
|
||||
#endif
|
||||
itr->second->AddMember(member);
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
|
|||
void FormationMgr::RemoveCreatureFromGroup(CreatureGroup* group, Creature* member)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.unit", "Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow());
|
||||
LOG_DEBUG("entities.unit", "Deleting member pointer to spawnId: %u from group %u", member->GetSpawnId(), group->GetId());
|
||||
#endif
|
||||
group->RemoveMember(member);
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ void FormationMgr::LoadCreatureFormations()
|
|||
//Load group member data
|
||||
group_member = new FormationInfo();
|
||||
group_member->leaderGUID = fields[0].GetUInt32();
|
||||
uint32 memberGUID = fields[1].GetUInt32();
|
||||
ObjectGuid::LowType memberGUID = fields[1].GetUInt32();
|
||||
group_member->groupAI = fields[4].GetUInt32();
|
||||
group_member->point_1 = fields[5].GetUInt16();
|
||||
group_member->point_2 = fields[6].GetUInt16();
|
||||
|
|
@ -144,19 +144,19 @@ void FormationMgr::LoadCreatureFormations()
|
|||
void CreatureGroup::AddMember(Creature* member)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.unit", "CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow());
|
||||
LOG_DEBUG("entities.unit", "CreatureGroup::AddMember: Adding unit %s.", member->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
|
||||
//Check if it is a leader
|
||||
if (member->GetDBTableGUIDLow() == m_groupID)
|
||||
if (member->GetSpawnId() == m_groupID)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.unit", "Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow());
|
||||
LOG_DEBUG("entities.unit", "Unit %s is formation leader. Adding group.", member->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
m_leader = member;
|
||||
}
|
||||
|
||||
m_members[member] = sFormationMgr->CreatureGroupMap.find(member->GetDBTableGUIDLow())->second;
|
||||
m_members[member] = sFormationMgr->CreatureGroupMap.find(member->GetSpawnId())->second;
|
||||
member->SetFormation(this);
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ void CreatureGroup::RemoveMember(Creature* member)
|
|||
|
||||
void CreatureGroup::MemberAttackStart(Creature* member, Unit* target)
|
||||
{
|
||||
uint8 groupAI = sFormationMgr->CreatureGroupMap[member->GetDBTableGUIDLow()]->groupAI;
|
||||
uint8 groupAI = sFormationMgr->CreatureGroupMap[member->GetSpawnId()]->groupAI;
|
||||
if (!groupAI)
|
||||
return;
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ void CreatureGroup::FormationReset(bool dismiss)
|
|||
else
|
||||
itr->first->GetMotionMaster()->MoveIdle();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.unit", "Set %s movement for member GUID: %u", dismiss ? "default" : "idle", itr->first->GetGUIDLow());
|
||||
LOG_DEBUG("entities.unit", "Set %s movement for member %s", dismiss ? "default" : "idle", itr->first->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
|
|||
if (!m_leader)
|
||||
return;
|
||||
|
||||
uint8 groupAI = sFormationMgr->CreatureGroupMap[m_leader->GetDBTableGUIDLow()]->groupAI;
|
||||
uint8 groupAI = sFormationMgr->CreatureGroupMap[m_leader->GetSpawnId()]->groupAI;
|
||||
if (groupAI == 5)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class CreatureGroup;
|
|||
|
||||
struct FormationInfo
|
||||
{
|
||||
uint32 leaderGUID;
|
||||
ObjectGuid::LowType leaderGUID;
|
||||
float follow_dist;
|
||||
float follow_angle;
|
||||
uint8 groupAI;
|
||||
|
|
@ -25,7 +25,7 @@ struct FormationInfo
|
|||
uint16 point_2;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<uint32/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType;
|
||||
typedef std::unordered_map<ObjectGuid::LowType/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType;
|
||||
|
||||
class FormationMgr
|
||||
{
|
||||
|
|
|
|||
|
|
@ -177,10 +177,10 @@ void PlayerMenu::ClearMenus()
|
|||
_questMenu.ClearMenu();
|
||||
}
|
||||
|
||||
void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
|
||||
void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) const
|
||||
{
|
||||
WorldPacket data(SMSG_GOSSIP_MESSAGE, 24 + _gossipMenu.GetMenuItemCount() * 100 + _questMenu.GetMenuItemCount() * 75); // guess size
|
||||
data << uint64(objectGUID);
|
||||
data << objectGUID;
|
||||
data << uint32(_gossipMenu.GetMenuId()); // new 2.4.0
|
||||
data << uint32(titleTextId);
|
||||
data << uint32(_gossipMenu.GetMenuItemCount()); // max count 0x10
|
||||
|
|
@ -297,10 +297,10 @@ void QuestMenu::ClearMenu()
|
|||
_questMenuItems.clear();
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, uint64 npcGUID)
|
||||
void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID)
|
||||
{
|
||||
WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100 + _questMenu.GetMenuItemCount() * 75); // guess size
|
||||
data << uint64(npcGUID);
|
||||
data << npcGUID;
|
||||
data << Title;
|
||||
data << uint32(eEmote._Delay); // player emote
|
||||
data << uint32(eEmote._Emote); // NPC emote
|
||||
|
|
@ -335,23 +335,23 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string
|
|||
data.put<uint8>(count_pos, count);
|
||||
_session->SendPacket(&data);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID));
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC %s", npcGUID.ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const
|
||||
void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) const
|
||||
{
|
||||
WorldPacket data(SMSG_QUESTGIVER_STATUS, 9);
|
||||
data << uint64(npcGUID);
|
||||
data << npcGUID;
|
||||
data << uint8(questStatus);
|
||||
|
||||
_session->SendPacket(&data);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus);
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC %s, status=%u", npcGUID.ToString().c_str(), questStatus);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const
|
||||
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const
|
||||
{
|
||||
std::string questTitle = quest->GetTitle();
|
||||
std::string questDetails = quest->GetDetails();
|
||||
|
|
@ -368,8 +368,8 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
|
|||
}
|
||||
|
||||
WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 500); // guess size
|
||||
data << uint64(npcGUID);
|
||||
data << uint64(_session->GetPlayer()->GetDivider());
|
||||
data << npcGUID;
|
||||
data << _session->GetPlayer()->GetDivider();
|
||||
data << uint32(quest->GetQuestId());
|
||||
data << questTitle;
|
||||
data << questDetails;
|
||||
|
|
@ -451,7 +451,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
|
|||
_session->SendPacket(&data);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS %s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -588,7 +588,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
|
|||
#endif
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const
|
||||
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const
|
||||
{
|
||||
std::string questTitle = quest->GetTitle();
|
||||
std::string RewardText = quest->GetOfferRewardText();
|
||||
|
|
@ -601,7 +601,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
|
|||
ObjectMgr::GetLocaleString(questOfferRewardLocale->RewardText, locale, RewardText);
|
||||
|
||||
WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 400); // guess size
|
||||
data << uint64(npcGUID);
|
||||
data << npcGUID;
|
||||
data << uint32(quest->GetQuestId());
|
||||
data << questTitle;
|
||||
data << RewardText;
|
||||
|
|
@ -674,11 +674,11 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
|
|||
|
||||
_session->SendPacket(&data);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD %s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const
|
||||
void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const
|
||||
{
|
||||
// We can always call to RequestItems, but this packet only goes out if there are actually
|
||||
// items. Otherwise, we'll skip straight to the OfferReward
|
||||
|
|
@ -717,7 +717,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
|
|||
}
|
||||
|
||||
WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 300); // guess size
|
||||
data << uint64(npcGUID);
|
||||
data << npcGUID;
|
||||
data << uint32(quest->GetQuestId());
|
||||
data << questTitle;
|
||||
data << requestItemsText;
|
||||
|
|
@ -767,6 +767,6 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
|
|||
|
||||
_session->SendPacket(&data);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS %s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "QuestDef.h"
|
||||
|
||||
class WorldSession;
|
||||
class ObjectGuid;
|
||||
|
||||
#define GOSSIP_MAX_MENU_ITEMS 32
|
||||
#define DEFAULT_GOSSIP_MESSAGE 0xffffff
|
||||
|
|
@ -253,22 +254,22 @@ public:
|
|||
[[nodiscard]] uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
|
||||
[[nodiscard]] bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
|
||||
|
||||
void SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const;
|
||||
void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) const;
|
||||
void SendCloseGossip() const;
|
||||
void SendPointOfInterest(uint32 poiId) const;
|
||||
|
||||
/*********************************************************/
|
||||
/*** QUEST SYSTEM ***/
|
||||
/*********************************************************/
|
||||
void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const;
|
||||
void SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) const;
|
||||
|
||||
void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, uint64 npcGUID);
|
||||
void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID);
|
||||
|
||||
void SendQuestQueryResponse(Quest const* quest) const;
|
||||
void SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const;
|
||||
void SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const;
|
||||
|
||||
void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const;
|
||||
void SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const;
|
||||
void SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const;
|
||||
void SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const;
|
||||
|
||||
private:
|
||||
GossipMenu _gossipMenu;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include "ScriptMgr.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
TempSummon::TempSummon(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject) :
|
||||
TempSummon::TempSummon(SummonPropertiesEntry const* properties, ObjectGuid owner, bool isWorldObject) :
|
||||
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
|
||||
m_timer(0), m_lifetime(0)
|
||||
{
|
||||
|
|
@ -260,7 +260,7 @@ void TempSummon::RemoveFromWorld()
|
|||
if (uint32 slot = m_Properties->Slot)
|
||||
if (Unit* owner = GetSummoner())
|
||||
if (owner->m_SummonSlot[slot] == GetGUID())
|
||||
owner->m_SummonSlot[slot] = 0;
|
||||
owner->m_SummonSlot[slot].Clear();
|
||||
|
||||
//if (GetOwnerGUID())
|
||||
// LOG_ERROR("server", "Unit %u has owner guid when removed from world", GetEntry());
|
||||
|
|
@ -268,7 +268,7 @@ void TempSummon::RemoveFromWorld()
|
|||
Creature::RemoveFromWorld();
|
||||
}
|
||||
|
||||
Minion::Minion(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject) : TempSummon(properties, owner, isWorldObject)
|
||||
Minion::Minion(SummonPropertiesEntry const* properties, ObjectGuid owner, bool isWorldObject) : TempSummon(properties, owner, isWorldObject)
|
||||
, m_owner(owner)
|
||||
{
|
||||
ASSERT(m_owner);
|
||||
|
|
@ -325,7 +325,7 @@ void Minion::setDeathState(DeathState s, bool despawn)
|
|||
}
|
||||
}
|
||||
|
||||
Guardian::Guardian(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject) : Minion(properties, owner, isWorldObject)
|
||||
Guardian::Guardian(SummonPropertiesEntry const* properties, ObjectGuid owner, bool isWorldObject) : Minion(properties, owner, isWorldObject)
|
||||
{
|
||||
m_unitTypeMask |= UNIT_MASK_GUARDIAN;
|
||||
if (properties && properties->Type == SUMMON_TYPE_PET)
|
||||
|
|
@ -359,9 +359,9 @@ void Guardian::InitSummon()
|
|||
m_owner->ToPlayer()->CharmSpellInitialize();
|
||||
}
|
||||
|
||||
Puppet::Puppet(SummonPropertiesEntry const* properties, uint64 owner) : Minion(properties, owner, false), m_owner(owner) //maybe true?
|
||||
Puppet::Puppet(SummonPropertiesEntry const* properties, ObjectGuid owner) : Minion(properties, owner, false), m_owner(owner) //maybe true?
|
||||
{
|
||||
ASSERT(IS_PLAYER_GUID(owner));
|
||||
ASSERT(owner.IsPlayer());
|
||||
m_unitTypeMask |= UNIT_MASK_PUPPET;
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +378,7 @@ void Puppet::InitSummon()
|
|||
if (!SetCharmedBy(GetOwner(), CHARM_TYPE_POSSESS))
|
||||
{
|
||||
if (Player* p = GetOwner())
|
||||
LOG_INFO("misc", "Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap()->GetId(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0);
|
||||
LOG_INFO("misc", "Puppet::InitSummon (A1) - %s, %u, %u, %u, %u, %u, %u, %u", p->GetGUID().ToString().c_str(), p->GetMapId(), p->GetInstanceId(), p->FindMap()->GetId(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0);
|
||||
else
|
||||
{
|
||||
LOG_INFO("misc", "Puppet::InitSummon (B1)");
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ struct TempSummonData
|
|||
class TempSummon : public Creature
|
||||
{
|
||||
public:
|
||||
explicit TempSummon(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject);
|
||||
explicit TempSummon(SummonPropertiesEntry const* properties, ObjectGuid owner, bool isWorldObject);
|
||||
~TempSummon() override = default;
|
||||
void Update(uint32 time) override;
|
||||
virtual void InitStats(uint32 lifetime);
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
void SetTempSummonType(TempSummonType type);
|
||||
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override {}
|
||||
[[nodiscard]] Unit* GetSummoner() const;
|
||||
uint64 GetSummonerGUID() { return m_summonerGUID; }
|
||||
ObjectGuid GetSummonerGUID() { return m_summonerGUID; }
|
||||
TempSummonType const& GetSummonType() { return m_type; }
|
||||
uint32 GetTimer() { return m_timer; }
|
||||
void SetTimer(uint32 t) { m_timer = t; }
|
||||
|
|
@ -48,13 +48,13 @@ private:
|
|||
TempSummonType m_type;
|
||||
uint32 m_timer;
|
||||
uint32 m_lifetime;
|
||||
uint64 m_summonerGUID;
|
||||
ObjectGuid m_summonerGUID;
|
||||
};
|
||||
|
||||
class Minion : public TempSummon
|
||||
{
|
||||
public:
|
||||
Minion(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject);
|
||||
Minion(SummonPropertiesEntry const* properties, ObjectGuid owner, bool isWorldObject);
|
||||
void InitStats(uint32 duration) override;
|
||||
void RemoveFromWorld() override;
|
||||
[[nodiscard]] Unit* GetOwner() const;
|
||||
|
|
@ -64,14 +64,14 @@ public:
|
|||
[[nodiscard]] bool IsGuardianPet() const;
|
||||
void setDeathState(DeathState s, bool despawn = false) override; // override virtual Unit::setDeathState
|
||||
protected:
|
||||
const uint64 m_owner;
|
||||
const ObjectGuid m_owner;
|
||||
float m_followAngle;
|
||||
};
|
||||
|
||||
class Guardian : public Minion
|
||||
{
|
||||
public:
|
||||
Guardian(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject);
|
||||
Guardian(SummonPropertiesEntry const* properties, ObjectGuid owner, bool isWorldObject);
|
||||
void InitStats(uint32 duration) override;
|
||||
bool InitStatsForLevel(uint8 level);
|
||||
void InitSummon() override;
|
||||
|
|
@ -88,14 +88,14 @@ public:
|
|||
class Puppet : public Minion
|
||||
{
|
||||
public:
|
||||
Puppet(SummonPropertiesEntry const* properties, uint64 owner);
|
||||
Puppet(SummonPropertiesEntry const* properties, ObjectGuid owner);
|
||||
void InitStats(uint32 duration) override;
|
||||
void InitSummon() override;
|
||||
void Update(uint32 time) override;
|
||||
void RemoveFromWorld() override;
|
||||
protected:
|
||||
[[nodiscard]] Player* GetOwner() const;
|
||||
const uint64 m_owner;
|
||||
const ObjectGuid m_owner;
|
||||
};
|
||||
|
||||
class ForcedUnsummonDelayEvent : public BasicEvent
|
||||
|
|
|
|||
|
|
@ -54,8 +54,10 @@ void DynamicObject::AddToWorld()
|
|||
///- Register the dynamicObject for guid lookup and for caster
|
||||
if (!IsInWorld())
|
||||
{
|
||||
sObjectAccessor->AddObject(this);
|
||||
GetMap()->GetObjectsStore().Insert<DynamicObject>(GetGUID(), this);
|
||||
|
||||
WorldObject::AddToWorld();
|
||||
|
||||
BindToCaster();
|
||||
}
|
||||
}
|
||||
|
|
@ -76,14 +78,17 @@ void DynamicObject::RemoveFromWorld()
|
|||
return;
|
||||
|
||||
UnbindFromCaster();
|
||||
|
||||
if (Transport* transport = GetTransport())
|
||||
transport->RemovePassenger(this, true);
|
||||
|
||||
WorldObject::RemoveFromWorld();
|
||||
sObjectAccessor->RemoveObject(this);
|
||||
|
||||
GetMap()->GetObjectsStore().Remove<DynamicObject>(GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type)
|
||||
bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type)
|
||||
{
|
||||
SetMap(caster->GetMap());
|
||||
Relocate(pos);
|
||||
|
|
@ -93,11 +98,11 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe
|
|||
return false;
|
||||
}
|
||||
|
||||
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
|
||||
WorldObject::_Create(guidlow, HighGuid::DynamicObject, caster->GetPhaseMask());
|
||||
|
||||
SetEntry(spellId);
|
||||
SetObjectScale(1);
|
||||
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());
|
||||
SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID());
|
||||
|
||||
// The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
|
||||
// by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
void CleanupsBeforeDelete(bool finalCleanup = true) override;
|
||||
|
||||
bool CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type);
|
||||
bool CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type);
|
||||
void Update(uint32 p_time) override;
|
||||
void Remove();
|
||||
void SetDuration(int32 newDuration);
|
||||
|
|
@ -45,7 +45,7 @@ public:
|
|||
void BindToCaster();
|
||||
void UnbindFromCaster();
|
||||
[[nodiscard]] uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
|
||||
[[nodiscard]] uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
|
||||
[[nodiscard]] ObjectGuid GetCasterGUID() const { return GetGuidValue(DYNAMICOBJECT_CASTER); }
|
||||
[[nodiscard]] float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
|
||||
[[nodiscard]] bool IsViewpoint() const { return _isViewpoint; }
|
||||
|
||||
|
|
|
|||
|
|
@ -47,13 +47,11 @@ GameObject::GameObject() : WorldObject(false), MovableMapObject(),
|
|||
m_spellId = 0;
|
||||
m_cooldownTime = 0;
|
||||
m_goInfo = nullptr;
|
||||
m_ritualOwnerGUIDLow = 0;
|
||||
m_goData = nullptr;
|
||||
m_packedRotation = 0;
|
||||
|
||||
m_DBTableGuid = 0;
|
||||
m_spawnId = 0;
|
||||
|
||||
m_lootRecipient = 0;
|
||||
m_lootRecipientGroup = 0;
|
||||
m_groupLootTimer = 0;
|
||||
lootingGroupLowGUID = 0;
|
||||
|
|
@ -109,7 +107,7 @@ void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
|
|||
|
||||
void GameObject::RemoveFromOwner()
|
||||
{
|
||||
uint64 ownerGUID = GetOwnerGUID();
|
||||
ObjectGuid ownerGUID = GetOwnerGUID();
|
||||
if (!ownerGUID)
|
||||
return;
|
||||
|
||||
|
|
@ -120,16 +118,10 @@ void GameObject::RemoveFromOwner()
|
|||
return;
|
||||
}
|
||||
|
||||
// Xinef: not needed
|
||||
/*const char * ownerType = "creature";
|
||||
if (IS_PLAYER_GUID(ownerGUID))
|
||||
ownerType = "player";
|
||||
else if (IS_PET_GUID(ownerGUID))
|
||||
ownerType = "pet";
|
||||
LOG_FATAL("server", "Delete GameObject (%s Entry: %u SpellId %u LinkedGO %u) that lost references to owner %s GO list. Crash possible later.",
|
||||
GetGUID().ToString().c_str(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), ownerGUID.ToString().c_str());
|
||||
|
||||
LOG_FATAL("server", "Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
|
||||
GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType);*/
|
||||
SetOwnerGUID(0);
|
||||
SetOwnerGUID(ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
void GameObject::AddToWorld()
|
||||
|
|
@ -140,7 +132,9 @@ void GameObject::AddToWorld()
|
|||
if (m_zoneScript)
|
||||
m_zoneScript->OnGameObjectCreate(this);
|
||||
|
||||
sObjectAccessor->AddObject(this);
|
||||
GetMap()->GetObjectsStore().Insert<GameObject>(GetGUID(), this);
|
||||
if (m_spawnId)
|
||||
GetMap()->GetGameObjectBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
|
||||
|
||||
if (m_model)
|
||||
{
|
||||
|
|
@ -169,13 +163,19 @@ void GameObject::RemoveFromWorld()
|
|||
m_zoneScript->OnGameObjectRemove(this);
|
||||
|
||||
RemoveFromOwner();
|
||||
|
||||
if (m_model)
|
||||
if (GetMap()->ContainsGameObjectModel(*m_model))
|
||||
GetMap()->RemoveGameObjectModel(*m_model);
|
||||
|
||||
if (Transport* transport = GetTransport())
|
||||
transport->RemovePassenger(this, true);
|
||||
|
||||
WorldObject::RemoveFromWorld();
|
||||
sObjectAccessor->RemoveObject(this);
|
||||
|
||||
if (m_spawnId)
|
||||
acore::Containers::MultimapErasePair(GetMap()->GetGameObjectBySpawnIdStore(), m_spawnId, this);
|
||||
GetMap()->GetObjectsStore().Remove<GameObject>(GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -183,13 +183,15 @@ void GameObject::CheckRitualList()
|
|||
{
|
||||
if (m_unique_users.empty())
|
||||
return;
|
||||
for (std::set<uint64>::iterator itr = m_unique_users.begin(); itr != m_unique_users.end();)
|
||||
|
||||
for (GuidSet::iterator itr = m_unique_users.begin(); itr != m_unique_users.end();)
|
||||
{
|
||||
if (*itr == GetOwnerGUID())
|
||||
{
|
||||
++itr;
|
||||
continue;
|
||||
}
|
||||
|
||||
bool erase = true;
|
||||
if (Player* channeler = ObjectAccessor::GetPlayer(*this, *itr))
|
||||
if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
|
|
@ -208,9 +210,10 @@ void GameObject::ClearRitualList()
|
|||
uint32 animSpell = GetGOInfo()->summoningRitual.animSpell;
|
||||
if (!animSpell || m_unique_users.empty())
|
||||
return;
|
||||
for (std::set<uint64>::iterator itr = m_unique_users.begin(); itr != m_unique_users.end(); ++itr)
|
||||
|
||||
for (ObjectGuid const guid : m_unique_users)
|
||||
{
|
||||
if (Player* channeler = ObjectAccessor::GetPlayer(*this, *itr))
|
||||
if (Player* channeler = ObjectAccessor::GetPlayer(*this, guid))
|
||||
if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
if (spell->m_spellInfo->Id == animSpell)
|
||||
{
|
||||
|
|
@ -218,10 +221,11 @@ void GameObject::ClearRitualList()
|
|||
spell->finish();
|
||||
}
|
||||
}
|
||||
|
||||
m_unique_users.clear();
|
||||
}
|
||||
|
||||
bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit)
|
||||
bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit)
|
||||
{
|
||||
ASSERT(map);
|
||||
SetMap(map);
|
||||
|
|
@ -251,7 +255,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
|
|||
return false;
|
||||
}
|
||||
|
||||
Object::_Create(guidlow, goinfo->entry, HIGHGUID_GAMEOBJECT);
|
||||
Object::_Create(guidlow, goinfo->entry, HighGuid::GameObject);
|
||||
|
||||
m_goInfo = goinfo;
|
||||
|
||||
|
|
@ -431,7 +435,7 @@ void GameObject::Update(uint32 diff)
|
|||
|
||||
bool triggered = info->summoningRitual.animSpell;
|
||||
Unit* owner = GetOwner();
|
||||
Unit* spellCaster = owner ? owner : ObjectAccessor::GetPlayer(*this, MAKE_NEW_GUID(m_ritualOwnerGUIDLow, 0, HIGHGUID_PLAYER));
|
||||
Unit* spellCaster = owner ? owner : ObjectAccessor::GetPlayer(*this, m_ritualOwnerGUID);
|
||||
if (!spellCaster)
|
||||
{
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
|
@ -493,11 +497,11 @@ void GameObject::Update(uint32 diff)
|
|||
time_t now = time(nullptr);
|
||||
if (m_respawnTime <= now) // timer expired
|
||||
{
|
||||
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT);
|
||||
ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::GameObject>(GetEntry(), m_spawnId);
|
||||
time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
|
||||
if (linkedRespawntime) // Can't respawn, the master is dead
|
||||
{
|
||||
uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
|
||||
ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
|
||||
if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
|
||||
SetRespawnTime(DAY);
|
||||
else
|
||||
|
|
@ -552,9 +556,9 @@ void GameObject::Update(uint32 diff)
|
|||
AI()->Reset();
|
||||
|
||||
// respawn timer
|
||||
uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0;
|
||||
uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<GameObject>(m_spawnId) : 0;
|
||||
if (poolid)
|
||||
sPoolMgr->UpdatePool<GameObject>(poolid, GetDBTableGUIDLow());
|
||||
sPoolMgr->UpdatePool<GameObject>(poolid, m_spawnId);
|
||||
else
|
||||
GetMap()->AddToMap(this);
|
||||
}
|
||||
|
|
@ -793,9 +797,9 @@ void GameObject::Delete()
|
|||
if (GetGOInfo()->type == GAMEOBJECT_TYPE_SUMMONING_RITUAL)
|
||||
ClearRitualList();
|
||||
|
||||
uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0;
|
||||
uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<GameObject>(m_spawnId) : 0;
|
||||
if (poolid)
|
||||
sPoolMgr->UpdatePool<GameObject>(poolid, GetDBTableGUIDLow());
|
||||
sPoolMgr->UpdatePool<GameObject>(poolid, m_spawnId);
|
||||
else
|
||||
AddObjectToRemoveList();
|
||||
}
|
||||
|
|
@ -844,7 +848,7 @@ void GameObject::SaveToDB()
|
|||
{
|
||||
// this should only be used when the gameobject has already been loaded
|
||||
// preferably after adding to map, because mapid may not be valid otherwise
|
||||
GameObjectData const* data = sObjectMgr->GetGOData(m_DBTableGuid);
|
||||
GameObjectData const* data = sObjectMgr->GetGOData(m_spawnId);
|
||||
if (!data)
|
||||
{
|
||||
LOG_ERROR("server", "GameObject::SaveToDB failed, cannot get gameobject data!");
|
||||
|
|
@ -861,12 +865,12 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
|||
if (!goI)
|
||||
return;
|
||||
|
||||
if (!m_DBTableGuid)
|
||||
m_DBTableGuid = GetGUIDLow();
|
||||
// update in loaded data (changing data only in this place)
|
||||
GameObjectData& data = sObjectMgr->NewGOData(m_DBTableGuid);
|
||||
if (!m_spawnId)
|
||||
m_spawnId = sObjectMgr->GenerateGameObjectSpawnId();
|
||||
|
||||
// update in loaded data (changing data only in this place)
|
||||
GameObjectData& data = sObjectMgr->NewGOData(m_spawnId);
|
||||
|
||||
// data->guid = guid must not be updated at save
|
||||
data.id = GetEntry();
|
||||
data.mapid = mapid;
|
||||
data.phaseMask = phaseMask;
|
||||
|
|
@ -887,11 +891,11 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
|||
uint8 index = 0;
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT);
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
stmt->setUInt32(0, m_spawnId);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT);
|
||||
stmt->setUInt32(index++, m_DBTableGuid);
|
||||
stmt->setUInt32(index++, m_spawnId);
|
||||
stmt->setUInt32(index++, GetEntry());
|
||||
stmt->setUInt16(index++, uint16(mapid));
|
||||
stmt->setUInt8(index++, spawnMask);
|
||||
|
|
@ -912,13 +916,13 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
|||
WorldDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
|
||||
bool GameObject::LoadGameObjectFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap)
|
||||
{
|
||||
GameObjectData const* data = sObjectMgr->GetGOData(guid);
|
||||
GameObjectData const* data = sObjectMgr->GetGOData(spawnId);
|
||||
|
||||
if (!data)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid);
|
||||
LOG_ERROR("sql.sql", "Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", spawnId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -934,10 +938,9 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
|
|||
GOState go_state = data->go_state;
|
||||
uint32 artKit = data->artKit;
|
||||
|
||||
m_DBTableGuid = guid;
|
||||
if (map->GetInstanceId() != 0) guid = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
|
||||
m_spawnId = spawnId;
|
||||
|
||||
if (!Create(guid, entry, map, phaseMask, x, y, z, ang, data->rotation, animprogress, go_state, artKit))
|
||||
if (!Create(map->GenerateLowGuid<HighGuid::GameObject>(), entry, map, phaseMask, x, y, z, ang, data->rotation, animprogress, go_state, artKit))
|
||||
return false;
|
||||
|
||||
if (data->spawntimesecs >= 0)
|
||||
|
|
@ -953,13 +956,13 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
|
|||
else
|
||||
{
|
||||
m_respawnDelayTime = data->spawntimesecs;
|
||||
m_respawnTime = GetMap()->GetGORespawnTime(m_DBTableGuid);
|
||||
m_respawnTime = GetMap()->GetGORespawnTime(m_spawnId);
|
||||
|
||||
// ready to respawn
|
||||
if (m_respawnTime && m_respawnTime <= time(nullptr))
|
||||
{
|
||||
m_respawnTime = 0;
|
||||
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
|
||||
GetMap()->RemoveGORespawnTime(m_spawnId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -980,19 +983,15 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
|
|||
|
||||
void GameObject::DeleteFromDB()
|
||||
{
|
||||
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
|
||||
sObjectMgr->DeleteGOData(m_DBTableGuid);
|
||||
GetMap()->RemoveGORespawnTime(m_spawnId);
|
||||
sObjectMgr->DeleteGOData(m_spawnId);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT);
|
||||
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
|
||||
stmt->setUInt32(0, m_spawnId);
|
||||
WorldDatabase.Execute(stmt);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT);
|
||||
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
|
||||
stmt->setUInt32(0, m_spawnId);
|
||||
WorldDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
|
|
@ -1041,7 +1040,7 @@ Unit* GameObject::GetOwner() const
|
|||
void GameObject::SaveRespawnTime()
|
||||
{
|
||||
if (m_goData && m_goData->dbData && m_respawnTime > time(nullptr) && m_spawnedByDefault)
|
||||
GetMap()->SaveGORespawnTime(m_DBTableGuid, m_respawnTime);
|
||||
GetMap()->SaveGORespawnTime(m_spawnId, m_respawnTime);
|
||||
}
|
||||
|
||||
bool GameObject::IsNeverVisible() const
|
||||
|
|
@ -1067,7 +1066,7 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
|
|||
return false;
|
||||
|
||||
// Always seen by owner and friendly units
|
||||
if (uint64 guid = GetOwnerGUID())
|
||||
if (ObjectGuid guid = GetOwnerGUID())
|
||||
{
|
||||
if (seer->GetGUID() == guid)
|
||||
return true;
|
||||
|
|
@ -1100,7 +1099,7 @@ void GameObject::Respawn()
|
|||
if (m_spawnedByDefault && m_respawnTime > 0)
|
||||
{
|
||||
m_respawnTime = time(nullptr);
|
||||
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
|
||||
GetMap()->RemoveGORespawnTime(m_spawnId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1239,12 +1238,12 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f
|
|||
void GameObject::SetGoArtKit(uint8 kit)
|
||||
{
|
||||
SetByteValue(GAMEOBJECT_BYTES_1, 2, kit);
|
||||
GameObjectData* data = const_cast<GameObjectData*>(sObjectMgr->GetGOData(m_DBTableGuid));
|
||||
GameObjectData* data = const_cast<GameObjectData*>(sObjectMgr->GetGOData(m_spawnId));
|
||||
if (data)
|
||||
data->artKit = kit;
|
||||
}
|
||||
|
||||
void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid)
|
||||
void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType lowguid)
|
||||
{
|
||||
const GameObjectData* data = nullptr;
|
||||
if (go)
|
||||
|
|
@ -1358,9 +1357,9 @@ void GameObject::Use(Unit* user)
|
|||
{
|
||||
if (info->chair.slots > 0) // sometimes chairs in DB have error in fields and we dont know number of slots
|
||||
for (uint32 i = 0; i < info->chair.slots; ++i)
|
||||
ChairListSlots[i] = 0; // Last user of current slot set to 0 (none sit here yet)
|
||||
ChairListSlots[i].Clear(); // Last user of current slot set to 0 (none sit here yet)
|
||||
else
|
||||
ChairListSlots[0] = 0; // error in DB, make one default slot
|
||||
ChairListSlots[0].Clear(); // error in DB, make one default slot
|
||||
}
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
|
|
@ -1393,10 +1392,10 @@ void GameObject::Use(Unit* user)
|
|||
if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
|
||||
continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required.
|
||||
else
|
||||
itr->second = 0; // This seat is unoccupied.
|
||||
itr->second.Clear(); // This seat is unoccupied.
|
||||
}
|
||||
else
|
||||
itr->second = 0; // The seat may of had an occupant, but they're offline.
|
||||
itr->second.Clear(); // The seat may of had an occupant, but they're offline.
|
||||
}
|
||||
|
||||
found_free_slot = true;
|
||||
|
|
@ -1455,7 +1454,7 @@ void GameObject::Use(Unit* user)
|
|||
if (info->goober.eventId)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("maps.script", "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow());
|
||||
LOG_DEBUG("maps.script", "Goober ScriptStart id %u for GO entry %u (spawnId %u).", info->goober.eventId, GetEntry(), m_spawnId);
|
||||
#endif
|
||||
GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this);
|
||||
EventInform(info->goober.eventId);
|
||||
|
|
@ -1617,8 +1616,8 @@ void GameObject::Use(Unit* user)
|
|||
GameObjectTemplate const* info = GetGOInfo();
|
||||
|
||||
// ritual owner is set for GO's without owner (not summoned)
|
||||
if (m_ritualOwnerGUIDLow == 0 && !owner)
|
||||
m_ritualOwnerGUIDLow = player->GetGUIDLow();
|
||||
if (!m_ritualOwnerGUID && !owner)
|
||||
m_ritualOwnerGUID = player->GetGUID();
|
||||
|
||||
if (owner)
|
||||
{
|
||||
|
|
@ -1635,7 +1634,7 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
else
|
||||
{
|
||||
Player* ritualOwner = ObjectAccessor::GetPlayer(*this, MAKE_NEW_GUID(m_ritualOwnerGUIDLow, 0, HIGHGUID_PLAYER));
|
||||
Player* ritualOwner = ObjectAccessor::GetPlayer(*this, m_ritualOwnerGUID);
|
||||
if (!ritualOwner)
|
||||
return;
|
||||
if (player != ritualOwner && (info->summoningRitual.castersGrouped && !player->IsInSameRaidWith(ritualOwner)))
|
||||
|
|
@ -1677,7 +1676,7 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
if (info->spellcaster.partyOnly)
|
||||
{
|
||||
Player const* caster = ObjectAccessor::GetObjectInOrOutOfWorld(GetOwnerGUID(), (Player*)nullptr);
|
||||
Player const* caster = ObjectAccessor::FindConnectedPlayer(GetOwnerGUID());
|
||||
if (!caster || user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster))
|
||||
return;
|
||||
}
|
||||
|
|
@ -1839,8 +1838,8 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
default:
|
||||
if (GetGoType() >= MAX_GAMEOBJECT_TYPE)
|
||||
LOG_ERROR("server", "GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)",
|
||||
user->GetTypeId(), user->GetGUIDLow(), user->GetName().c_str(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType());
|
||||
LOG_ERROR("server", "GameObject::Use(): unit (%s, name: %s) tries to use object (%s, name: %s) of unknown type (%u)",
|
||||
user->GetGUID().ToString().c_str(), user->GetName().c_str(), GetGUID().ToString().c_str(), GetGOInfo()->name.c_str(), GetGoType());
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1924,7 +1923,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
|
|||
// xinef: set proper orientation, fixes cast against stealthed targets
|
||||
if (target)
|
||||
trigger->SetInFront(target);
|
||||
trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, target ? target->GetGUID() : 0);
|
||||
trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, target ? target->GetGUID() : ObjectGuid::Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2071,9 +2070,9 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= nullptr*/
|
|||
if (player)
|
||||
{
|
||||
WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8 + 8 + 8 + 4 + 4);
|
||||
data.appendPackGUID(GetGUID());
|
||||
data.appendPackGUID(attackerOrHealer->GetGUID());
|
||||
data.appendPackGUID(player->GetGUID());
|
||||
data << GetPackGUID();
|
||||
data << attackerOrHealer->GetPackGUID();
|
||||
data << player->GetPackGUID();
|
||||
data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event
|
||||
// change >= 0 triggers SPELL_BUILDING_DAMAGE event
|
||||
data << uint32(spellId);
|
||||
|
|
@ -2299,7 +2298,7 @@ Player* GameObject::GetLootRecipient() const
|
|||
{
|
||||
if (!m_lootRecipient)
|
||||
return nullptr;
|
||||
return ObjectAccessor::FindPlayerInOrOutOfWorld(m_lootRecipient);
|
||||
return ObjectAccessor::FindConnectedPlayer(m_lootRecipient);
|
||||
}
|
||||
|
||||
Group* GameObject::GetLootRecipientGroup() const
|
||||
|
|
@ -2317,7 +2316,7 @@ void GameObject::SetLootRecipient(Unit* unit)
|
|||
|
||||
if (!unit)
|
||||
{
|
||||
m_lootRecipient = 0;
|
||||
m_lootRecipient.Clear();
|
||||
m_lootRecipientGroup = 0;
|
||||
return;
|
||||
}
|
||||
|
|
@ -2331,7 +2330,7 @@ void GameObject::SetLootRecipient(Unit* unit)
|
|||
|
||||
m_lootRecipient = player->GetGUID();
|
||||
if (Group* group = player->GetGroup())
|
||||
m_lootRecipientGroup = group->GetLowGUID();
|
||||
m_lootRecipientGroup = group->GetGUID().GetCounter();
|
||||
}
|
||||
|
||||
bool GameObject::IsLootAllowedFor(Player const* player) const
|
||||
|
|
@ -2449,9 +2448,9 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
|
|||
|
||||
void GameObject::GetRespawnPosition(float& x, float& y, float& z, float* ori /* = nullptr*/) const
|
||||
{
|
||||
if (m_DBTableGuid)
|
||||
if (m_spawnId)
|
||||
{
|
||||
if (GameObjectData const* data = sObjectMgr->GetGOData(GetDBTableGUIDLow()))
|
||||
if (GameObjectData const* data = sObjectMgr->GetGOData(m_spawnId))
|
||||
{
|
||||
x = data->posX;
|
||||
y = data->posY;
|
||||
|
|
|
|||
|
|
@ -738,7 +738,7 @@ public:
|
|||
void RemoveFromWorld() override;
|
||||
void CleanupsBeforeDelete(bool finalCleanup = true) override;
|
||||
|
||||
virtual bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0);
|
||||
virtual bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0);
|
||||
void Update(uint32 p_time) override;
|
||||
[[nodiscard]] GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
|
||||
[[nodiscard]] GameObjectTemplateAddon const* GetTemplateAddon() const;
|
||||
|
|
@ -748,7 +748,7 @@ public:
|
|||
[[nodiscard]] bool IsTransport() const;
|
||||
[[nodiscard]] bool IsDestructibleBuilding() const;
|
||||
|
||||
[[nodiscard]] uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
|
||||
[[nodiscard]] ObjectGuid::LowType GetSpawnId() const { return m_spawnId; }
|
||||
|
||||
// z_rot, y_rot, x_rot - rotation angles around z, y and x axes
|
||||
void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot);
|
||||
|
|
@ -761,11 +761,11 @@ public:
|
|||
|
||||
void SaveToDB();
|
||||
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
|
||||
bool LoadFromDB(uint32 guid, Map* map) { return LoadGameObjectFromDB(guid, map, false); }
|
||||
bool LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap = true);
|
||||
bool LoadFromDB(ObjectGuid::LowType guid, Map* map) { return LoadGameObjectFromDB(guid, map, false); }
|
||||
bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap = true);
|
||||
void DeleteFromDB();
|
||||
|
||||
void SetOwnerGUID(uint64 owner)
|
||||
void SetOwnerGUID(ObjectGuid owner)
|
||||
{
|
||||
// Owner already found and different than expected owner - remove object from old owner
|
||||
if (owner && GetOwnerGUID() && GetOwnerGUID() != owner)
|
||||
|
|
@ -773,9 +773,9 @@ public:
|
|||
ABORT();
|
||||
}
|
||||
m_spawnedByDefault = false; // all object with owner is despawned after delay
|
||||
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
|
||||
SetGuidValue(OBJECT_FIELD_CREATED_BY, owner);
|
||||
}
|
||||
[[nodiscard]] uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
|
||||
[[nodiscard]] ObjectGuid GetOwnerGUID() const { return GetGuidValue(OBJECT_FIELD_CREATED_BY); }
|
||||
[[nodiscard]] Unit* GetOwner() const;
|
||||
|
||||
void SetSpellId(uint32 id)
|
||||
|
|
@ -822,7 +822,7 @@ public:
|
|||
void SetGoArtKit(uint8 artkit);
|
||||
[[nodiscard]] uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
|
||||
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
|
||||
static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
|
||||
static void SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType lowguid = 0);
|
||||
|
||||
void SetPhaseMask(uint32 newPhaseMask, bool update) override;
|
||||
void EnableCollision(bool enable);
|
||||
|
|
@ -840,11 +840,11 @@ public:
|
|||
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
|
||||
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
|
||||
|
||||
void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
|
||||
[[nodiscard]] bool IsInSkillupList(uint32 PlayerGuidLow) const
|
||||
void AddToSkillupList(ObjectGuid playerGuid) { m_SkillupList.push_back(playerGuid); }
|
||||
[[nodiscard]] bool IsInSkillupList(ObjectGuid playerGuid) const
|
||||
{
|
||||
for (unsigned int i : m_SkillupList)
|
||||
if (i == PlayerGuidLow)
|
||||
for (ObjectGuid const guid : m_SkillupList)
|
||||
if (guid == playerGuid)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -961,16 +961,16 @@ protected:
|
|||
bool m_spawnedByDefault;
|
||||
uint32 m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
|
||||
// For traps this: spell casting cooldown, for doors/buttons: reset time.
|
||||
std::list<uint32> m_SkillupList;
|
||||
GuidList m_SkillupList;
|
||||
|
||||
uint32 m_ritualOwnerGUIDLow; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
|
||||
std::set<uint64> m_unique_users;
|
||||
ObjectGuid m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
|
||||
GuidSet m_unique_users;
|
||||
uint32 m_usetimes;
|
||||
|
||||
typedef std::map<uint32, uint64> ChairSlotAndUser;
|
||||
typedef std::map<uint32, ObjectGuid> ChairSlotAndUser;
|
||||
ChairSlotAndUser ChairListSlots;
|
||||
|
||||
uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
|
||||
ObjectGuid::LowType m_spawnId; ///< For new or temporary gameobjects is 0 for saved it is lowguid
|
||||
GameObjectTemplate const* m_goInfo;
|
||||
GameObjectData const* m_goData;
|
||||
GameObjectValue m_goValue;
|
||||
|
|
@ -980,7 +980,7 @@ protected:
|
|||
G3D::Quat m_worldRotation;
|
||||
Position m_stationaryPosition;
|
||||
|
||||
uint64 m_lootRecipient;
|
||||
ObjectGuid m_lootRecipient;
|
||||
uint32 m_lootRecipientGroup;
|
||||
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
|
||||
uint32 m_lootGenerationTime;
|
||||
|
|
|
|||
|
|
@ -56,20 +56,20 @@ void Bag::RemoveFromWorld()
|
|||
Item::RemoveFromWorld();
|
||||
}
|
||||
|
||||
bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||
bool Bag::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner)
|
||||
{
|
||||
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid);
|
||||
|
||||
if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
|
||||
return false;
|
||||
|
||||
Object::_Create(guidlow, 0, HIGHGUID_CONTAINER);
|
||||
Object::_Create(guidlow, 0, HighGuid::Item);
|
||||
|
||||
SetEntry(itemid);
|
||||
SetObjectScale(1.0f);
|
||||
|
||||
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
|
||||
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
|
||||
SetGuidValue(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : ObjectGuid::Empty);
|
||||
SetGuidValue(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : ObjectGuid::Empty);
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
|
||||
SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability);
|
||||
|
|
@ -81,7 +81,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
|||
// Cleaning 20 slots
|
||||
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
{
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i * 2), 0);
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid::Empty);
|
||||
m_bagslot[i] = nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ void Bag::SaveToDB(SQLTransaction& trans)
|
|||
Item::SaveToDB(trans);
|
||||
}
|
||||
|
||||
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry)
|
||||
bool Bag::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fields, uint32 entry)
|
||||
{
|
||||
if (!Item::LoadFromDB(guid, owner_guid, fields, entry))
|
||||
return false;
|
||||
|
|
@ -103,7 +103,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry
|
|||
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
|
||||
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
{
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i * 2), 0);
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid::Empty);
|
||||
delete m_bagslot[i];
|
||||
m_bagslot[i] = nullptr;
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/)
|
|||
m_bagslot[slot]->SetContainer(nullptr);
|
||||
|
||||
m_bagslot[slot] = nullptr;
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0);
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
|
||||
|
|
@ -148,9 +148,9 @@ void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
|
|||
if (pItem && pItem->GetGUID() != this->GetGUID())
|
||||
{
|
||||
m_bagslot[slot] = pItem;
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
|
||||
pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID());
|
||||
pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetOwnerGUID());
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
|
||||
pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID());
|
||||
pItem->SetGuidValue(ITEM_FIELD_OWNER, GetOwnerGUID());
|
||||
pItem->SetContainer(this);
|
||||
pItem->SetSlot(slot);
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem)
|
|||
return count;
|
||||
}
|
||||
|
||||
uint8 Bag::GetSlotByItemGUID(uint64 guid) const
|
||||
uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const
|
||||
{
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i] != 0)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public:
|
|||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
bool Create(uint32 guidlow, uint32 itemid, Player const* owner) override;
|
||||
bool Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner) override;
|
||||
|
||||
void Clear();
|
||||
void StoreItem(uint8 slot, Item* pItem, bool update);
|
||||
|
|
@ -32,7 +32,7 @@ public:
|
|||
uint32 GetItemCount(uint32 item, Item* eItem = nullptr) const;
|
||||
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
|
||||
|
||||
[[nodiscard]] uint8 GetSlotByItemGUID(uint64 guid) const;
|
||||
[[nodiscard]] uint8 GetSlotByItemGUID(ObjectGuid guid) const;
|
||||
[[nodiscard]] bool IsEmpty() const;
|
||||
[[nodiscard]] uint32 GetFreeSlots() const;
|
||||
[[nodiscard]] uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
|
||||
|
|
@ -41,7 +41,7 @@ public:
|
|||
// overwrite virtual Item::SaveToDB
|
||||
void SaveToDB(SQLTransaction& trans) override;
|
||||
// overwrite virtual Item::LoadFromDB
|
||||
bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry) override;
|
||||
bool LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fields, uint32 entry) override;
|
||||
// overwrite virtual Item::DeleteFromDB
|
||||
void DeleteFromDB(SQLTransaction& trans) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -247,15 +247,15 @@ Item::Item()
|
|||
m_paidExtendedCost = 0;
|
||||
}
|
||||
|
||||
bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||
bool Item::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner)
|
||||
{
|
||||
Object::_Create(guidlow, 0, HIGHGUID_ITEM);
|
||||
Object::_Create(guidlow, 0, HighGuid::Item);
|
||||
|
||||
SetEntry(itemid);
|
||||
SetObjectScale(1.0f);
|
||||
|
||||
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
|
||||
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
|
||||
SetGuidValue(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : ObjectGuid::Empty);
|
||||
SetGuidValue(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : ObjectGuid::Empty);
|
||||
|
||||
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid);
|
||||
if (!itemProto)
|
||||
|
|
@ -309,7 +309,7 @@ void Item::SaveToDB(SQLTransaction& trans)
|
|||
if (!isInTransaction)
|
||||
trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
uint32 guid = GetGUIDLow();
|
||||
ObjectGuid::LowType guid = GetGUID().GetCounter();
|
||||
switch (uState)
|
||||
{
|
||||
case ITEM_NEW:
|
||||
|
|
@ -318,9 +318,9 @@ void Item::SaveToDB(SQLTransaction& trans)
|
|||
uint8 index = 0;
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE);
|
||||
stmt->setUInt32( index, GetEntry());
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetOwnerGUID()));
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_CREATOR)));
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_GIFTCREATOR)));
|
||||
stmt->setUInt32(++index, GetOwnerGUID().GetCounter());
|
||||
stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter());
|
||||
stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter());
|
||||
stmt->setUInt32(++index, GetCount());
|
||||
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION));
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ void Item::SaveToDB(SQLTransaction& trans)
|
|||
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
|
||||
stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
|
||||
stmt->setUInt32(0, GetOwnerGUID().GetCounter());
|
||||
stmt->setUInt32(1, guid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
|
@ -386,14 +386,14 @@ void Item::SaveToDB(SQLTransaction& trans)
|
|||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry)
|
||||
bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fields, uint32 entry)
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
//result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid);
|
||||
|
||||
// create item before any checks for store correct guid
|
||||
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
|
||||
Object::_Create(guid, 0, HIGHGUID_ITEM);
|
||||
Object::_Create(guid, 0, HighGuid::Item);
|
||||
|
||||
// Set entry, MUST be before proto check
|
||||
SetEntry(entry);
|
||||
|
|
@ -404,12 +404,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
|||
return false;
|
||||
|
||||
// set owner (not if item is only loaded for gbank/auction/mail
|
||||
if (owner_guid != 0)
|
||||
if (owner_guid)
|
||||
SetOwnerGUID(owner_guid);
|
||||
|
||||
bool need_save = false; // need explicit save data at load fixes
|
||||
SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
|
||||
SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER));
|
||||
SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32()));
|
||||
SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt32()));
|
||||
SetCount(fields[2].GetUInt32());
|
||||
|
||||
uint32 duration = fields[3].GetUInt32();
|
||||
|
|
@ -470,7 +470,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
|||
}
|
||||
|
||||
/*static*/
|
||||
void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid)
|
||||
void Item::DeleteFromDB(SQLTransaction& trans, ObjectGuid::LowType itemGuid)
|
||||
{
|
||||
sScriptMgr->OnGlobalItemDelFromDB(trans, itemGuid);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
||||
|
|
@ -480,11 +480,11 @@ void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid)
|
|||
|
||||
void Item::DeleteFromDB(SQLTransaction& trans)
|
||||
{
|
||||
DeleteFromDB(trans, GetGUIDLow());
|
||||
DeleteFromDB(trans, GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
/*static*/
|
||||
void Item::DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid)
|
||||
void Item::DeleteFromInventoryDB(SQLTransaction& trans, ObjectGuid::LowType itemGuid)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
|
||||
stmt->setUInt32(0, itemGuid);
|
||||
|
|
@ -493,7 +493,7 @@ void Item::DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid)
|
|||
|
||||
void Item::DeleteFromInventoryDB(SQLTransaction& trans)
|
||||
{
|
||||
DeleteFromInventoryDB(trans, GetGUIDLow());
|
||||
DeleteFromInventoryDB(trans, GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
ItemTemplate const* Item::GetTemplate() const
|
||||
|
|
@ -674,7 +674,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
|||
if (forplayer)
|
||||
{
|
||||
RemoveFromUpdateQueueOf(forplayer);
|
||||
forplayer->DeleteRefundReference(GetGUIDLow());
|
||||
forplayer->DeleteRefundReference(GetGUID());
|
||||
}
|
||||
delete this;
|
||||
return;
|
||||
|
|
@ -706,7 +706,7 @@ void Item::AddToUpdateQueueOf(Player* player)
|
|||
if (player->GetGUID() != GetOwnerGUID())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
|
||||
LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!", GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
@ -728,7 +728,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player)
|
|||
if (player->GetGUID() != GetOwnerGUID())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
|
||||
LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!", GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
@ -880,7 +880,7 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
|
|||
return true;
|
||||
}
|
||||
|
||||
void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster /*= 0*/)
|
||||
void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster /*= ObjectGuid::Empty*/)
|
||||
{
|
||||
// Better lost small time at check in comparison lost time at item save to DB.
|
||||
if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
|
||||
|
|
@ -890,7 +890,7 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
|
|||
if (slot < MAX_INSPECTED_ENCHANTMENT_SLOT)
|
||||
{
|
||||
if (uint32 oldEnchant = GetEnchantmentId(slot))
|
||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), 0, GetEntry(), oldEnchant);
|
||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), ObjectGuid::Empty, GetEntry(), oldEnchant);
|
||||
|
||||
if (id)
|
||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetEntry(), id);
|
||||
|
|
@ -1025,7 +1025,7 @@ bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) cons
|
|||
void Item::SendUpdateSockets()
|
||||
{
|
||||
WorldPacket data(SMSG_SOCKET_GEMS_RESULT, 8 + 4 + 4 + 4 + 4);
|
||||
data << uint64(GetGUID());
|
||||
data << GetGUID();
|
||||
for (uint32 i = SOCK_ENCHANTMENT_SLOT; i <= BONUS_ENCHANTMENT_SLOT; ++i)
|
||||
data << uint32(GetEnchantmentId(EnchantmentSlot(i)));
|
||||
|
||||
|
|
@ -1042,7 +1042,7 @@ void Item::SendTimeUpdate(Player* owner)
|
|||
return;
|
||||
|
||||
WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8 + 4));
|
||||
data << uint64(GetGUID());
|
||||
data << GetGUID();
|
||||
data << uint32(duration);
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
@ -1061,7 +1061,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clo
|
|||
ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
|
||||
|
||||
Item* pItem = NewItemOrBag(pProto);
|
||||
if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
|
||||
if (pItem->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), item, player))
|
||||
{
|
||||
pItem->SetCount(count);
|
||||
if (!clone)
|
||||
|
|
@ -1103,7 +1103,7 @@ bool Item::IsBindedNotWith(Player const* player) const
|
|||
return false;
|
||||
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE))
|
||||
if (allowedGUIDs.find(player->GetGUIDLow()) != allowedGUIDs.end())
|
||||
if (allowedGUIDs.find(player->GetGUID()) != allowedGUIDs.end())
|
||||
return false;
|
||||
|
||||
// BOA item case
|
||||
|
|
@ -1120,16 +1120,28 @@ void Item::BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&)
|
|||
ClearUpdateMask(false);
|
||||
}
|
||||
|
||||
void Item::AddToObjectUpdate()
|
||||
{
|
||||
if (Player* owner = GetOwner())
|
||||
owner->GetMap()->AddUpdateObject(this);
|
||||
}
|
||||
|
||||
void Item::RemoveFromObjectUpdate()
|
||||
{
|
||||
if (Player* owner = GetOwner())
|
||||
owner->GetMap()->RemoveUpdateObject(this);
|
||||
}
|
||||
|
||||
void Item::SaveRefundDataToDB()
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, GetRefundRecipient());
|
||||
stmt->setUInt32(2, GetPaidMoney());
|
||||
stmt->setUInt16(3, uint16(GetPaidExtendedCost()));
|
||||
|
|
@ -1143,7 +1155,7 @@ void Item::DeleteRefundDataFromDB(SQLTransaction* trans)
|
|||
if (trans)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
(*trans)->Append(stmt);
|
||||
}
|
||||
}
|
||||
|
|
@ -1163,7 +1175,7 @@ void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, SQLTransa
|
|||
SetPaidExtendedCost(0);
|
||||
DeleteRefundDataFromDB(trans);
|
||||
|
||||
owner->DeleteRefundReference(GetGUIDLow());
|
||||
owner->DeleteRefundReference(GetGUID());
|
||||
}
|
||||
|
||||
void Item::UpdatePlayedTime(Player* owner)
|
||||
|
|
@ -1221,7 +1233,7 @@ void Item::ClearSoulboundTradeable(Player* currentOwner)
|
|||
allowedGUIDs.clear();
|
||||
SetState(ITEM_CHANGED, currentOwner);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_BOP_TRADE);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue