--HG--
branch : trunk
This commit is contained in:
Xanadu
2010-06-22 02:54:36 +02:00
12 changed files with 71 additions and 114 deletions
+12 -4
View File
@@ -707,6 +707,14 @@ void Channel::Invite(uint64 p, const char *newname)
return;
}
if (IsBanned(newp->GetGUID()))
{
WorldPacket data;
MakePlayerInviteBanned(&data, newname);
SendToOne(&data, p);
return;
}
Player *plr = objmgr.GetPlayer(p);
if (!plr)
return;
@@ -983,10 +991,10 @@ void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good)
}
// done 0x16
void Channel::MakePlayerNotBanned(WorldPacket *data, uint64 guid)
void Channel::MakePlayerNotBanned(WorldPacket *data, const std::string &name)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
*data << uint64(guid);
*data << name;
}
// done 0x17
@@ -1035,10 +1043,10 @@ void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name)
}
// done 0x1E
void Channel::MakePlayerInviteBanned(WorldPacket *data, uint64 guid)
void Channel::MakePlayerInviteBanned(WorldPacket *data, const std::string& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
*data << uint64(guid);
*data << name;
}
// done 0x1F
+2 -2
View File
@@ -187,7 +187,7 @@ class Channel
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, uint64 guid); //? 0x16
void MakePlayerNotBanned(WorldPacket *data, const std::string& name); //? 0x16
void MakePlayerAlreadyMember(WorldPacket *data, uint64 guid); //+ 0x17
void MakeInvite(WorldPacket *data, uint64 guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket *data); //? 0x19
@@ -195,7 +195,7 @@ class Channel
void MakeInvalidName(WorldPacket *data); //? 0x1B
void MakeNotModerated(WorldPacket *data); //? 0x1C
void MakePlayerInvited(WorldPacket *data, const std::string& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket *data, uint64 guid); //? 0x1E
void MakePlayerInviteBanned(WorldPacket *data, const std::string &name);//? 0x1E
void MakeThrottled(WorldPacket *data); //? 0x1F
void MakeNotInArea(WorldPacket *data); //? 0x20
void MakeNotInLfg(WorldPacket *data); //? 0x21
+1 -2
View File
@@ -506,8 +506,7 @@ void LoadDBCStores(const std::string& dataPath)
// fill data
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
sTaxiPathNodesByPath[entry->path][entry->index] = TaxiPathNode(entry->mapid,entry->x,entry->y,entry->z,entry->actionFlag,entry->delay);
sTaxiPathNodeStore.Clear();
sTaxiPathNodesByPath[entry->path][entry->index] = entry;
// Initialize global taxinodes mask
// include existed nodes that have at least single not spell base (scripted) path
+1 -13
View File
@@ -1911,19 +1911,7 @@ struct TaxiPathBySourceAndDestination
typedef std::map<uint32,TaxiPathBySourceAndDestination> TaxiPathSetForSource;
typedef std::map<uint32,TaxiPathSetForSource> TaxiPathSetBySource;
struct TaxiPathNode
{
TaxiPathNode() : mapid(0), x(0),y(0),z(0),actionFlag(0),delay(0) {}
TaxiPathNode(uint32 _mapid, float _x, float _y, float _z, uint32 _actionFlag, uint32 _delay) : mapid(_mapid), x(_x),y(_y),z(_z),actionFlag(_actionFlag),delay(_delay) {}
uint32 mapid;
float x;
float y;
float z;
uint32 actionFlag;
uint32 delay;
};
typedef std::vector<TaxiPathNode> TaxiPathNodeList;
typedef std::vector<TaxiPathNodeEntry const*> TaxiPathNodeList;
typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath;
#define TaxiMaskSize 12
+13 -12
View File
@@ -15935,6 +15935,7 @@ bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder)
// There are no transports on instances
instanceId = 0;
m_movementInfo.t_guid = MAKE_NEW_GUID(transGUID, 0, HIGHGUID_TRANSPORT);
m_movementInfo.t_x = fields[26].GetFloat();
m_movementInfo.t_y = fields[27].GetFloat();
m_movementInfo.t_z = fields[28].GetFloat();
@@ -19362,30 +19363,30 @@ void Player::ContinueTaxiFlight()
float distPrev = MAP_SIZE*MAP_SIZE;
float distNext =
(nodeList[0].x-GetPositionX())*(nodeList[0].x-GetPositionX())+
(nodeList[0].y-GetPositionY())*(nodeList[0].y-GetPositionY())+
(nodeList[0].z-GetPositionZ())*(nodeList[0].z-GetPositionZ());
(nodeList[0]->x-GetPositionX())*(nodeList[0]->x-GetPositionX())+
(nodeList[0]->y-GetPositionY())*(nodeList[0]->y-GetPositionY())+
(nodeList[0]->z-GetPositionZ())*(nodeList[0]->z-GetPositionZ());
for (uint32 i = 1; i < nodeList.size(); ++i)
{
TaxiPathNode const& node = nodeList[i];
TaxiPathNode const& prevNode = nodeList[i-1];
TaxiPathNodeEntry const* node = nodeList[i];
TaxiPathNodeEntry const* prevNode = nodeList[i-1];
// skip nodes at another map
if (node.mapid != GetMapId())
if (node->mapid != GetMapId())
continue;
distPrev = distNext;
distNext =
(node.x-GetPositionX())*(node.x-GetPositionX())+
(node.y-GetPositionY())*(node.y-GetPositionY())+
(node.z-GetPositionZ())*(node.z-GetPositionZ());
(node->x-GetPositionX())*(node->x-GetPositionX())+
(node->y-GetPositionY())*(node->y-GetPositionY())+
(node->z-GetPositionZ())*(node->z-GetPositionZ());
float distNodes =
(node.x-prevNode.x)*(node.x-prevNode.x)+
(node.y-prevNode.y)*(node.y-prevNode.y)+
(node.z-prevNode.z)*(node.z-prevNode.z);
(node->x-prevNode->x)*(node->x-prevNode->x)+
(node->y-prevNode->y)*(node->y-prevNode->y)+
(node->z-prevNode->z)*(node->z-prevNode->z);
if (distNext + distPrev < distNodes)
{
@@ -205,22 +205,22 @@ struct keyFrame
bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
{
TransportPath path;
objmgr.GetTransportPathNodes(pathid, path);
if (path.Empty())
if (pathid >= sTaxiPathNodesByPath.size())
return false;
TaxiPathNodeList const& path = sTaxiPathNodesByPath[pathid];
std::vector<keyFrame> keyFrames;
int mapChange = 0;
mapids.clear();
for (size_t i = 1; i < path.Size() - 1; ++i)
for (size_t i = 1; i < path.size() - 1; ++i)
{
if (mapChange == 0)
{
if ((path[i].mapid == path[i+1].mapid))
TaxiPathNodeEntry const* node_i = path[i];
if (node_i->mapid == path[i+1]->mapid)
{
keyFrame k(path[i].x, path[i].y, path[i].z, path[i].mapid, path[i].actionFlag, path[i].delay);
keyFrame k(node_i->x, node_i->y, node_i->z, node_i->mapid, node_i->actionFlag, node_i->delay);
keyFrames.push_back(k);
mapids.insert(k.mapid);
}
@@ -27,35 +27,6 @@
#include <set>
#include <string>
class TransportPath
{
public:
struct PathNode
{
uint32 mapid;
float x,y,z;
uint32 actionFlag;
uint32 delay;
};
void SetLength(const unsigned int sz)
{
i_nodes.resize(sz);
}
unsigned int Size(void) const { return i_nodes.size(); }
bool Empty(void) const { return i_nodes.empty(); }
void Resize(unsigned int sz) { i_nodes.resize(sz); }
void Clear(void) { i_nodes.clear(); }
PathNode* GetNodes(void) { return static_cast<PathNode *>(&i_nodes[0]); }
PathNode& operator[](const unsigned int idx) { return i_nodes[idx]; }
const PathNode& operator()(const unsigned int idx) const { return i_nodes[idx]; }
protected:
std::vector<PathNode> i_nodes;
};
class Transport : public GameObject
{
public:
+4 -25
View File
@@ -5494,31 +5494,10 @@ void ObjectMgr::GetTaxiPathNodes(uint32 path, Path &pathnodes, std::vector<uint3
for (size_t i = 0; i < nodeList.size(); ++i)
{
pathnodes[ i ].x = nodeList[i].x;
pathnodes[ i ].y = nodeList[i].y;
pathnodes[ i ].z = nodeList[i].z;
mapIds[i] = nodeList[i].mapid;
}
}
void ObjectMgr::GetTransportPathNodes(uint32 path, TransportPath &pathnodes)
{
if (path >= sTaxiPathNodesByPath.size())
return;
TaxiPathNodeList& nodeList = sTaxiPathNodesByPath[path];
pathnodes.Resize(nodeList.size());
for (size_t i = 0; i < nodeList.size(); ++i)
{
pathnodes[ i ].mapid = nodeList[i].mapid;
pathnodes[ i ].x = nodeList[i].x;
pathnodes[ i ].y = nodeList[i].y;
pathnodes[ i ].z = nodeList[i].z;
pathnodes[ i ].actionFlag = nodeList[i].actionFlag;
pathnodes[ i ].delay = nodeList[i].delay;
pathnodes[i].x = nodeList[i]->x;
pathnodes[i].y = nodeList[i]->y;
pathnodes[i].z = nodeList[i]->z;
mapIds[i] = nodeList[i]->mapid;
}
}
-1
View File
@@ -474,7 +474,6 @@ class ObjectMgr
void GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uint32 &cost);
uint32 GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt_team = false);
void GetTaxiPathNodes(uint32 path, Path &pathnodes, std::vector<uint32>& mapIds);
void GetTransportPathNodes(uint32 path, TransportPath &pathnodes);
Quest const* GetQuestTemplate(uint32 quest_id) const
{
+13 -6
View File
@@ -1192,7 +1192,7 @@ bool Group::_addMember(const uint64 &guid, const char* name)
if (m_subGroupsCounts)
{
bool groupFound = false;
for (; groupid < MAXRAIDSIZE/MAXGROUPSIZE; ++groupid)
for (; groupid < MAX_RAID_SUBGROUPS; ++groupid)
{
if (m_subGroupsCounts[groupid] < MAXGROUPSIZE)
{
@@ -1445,17 +1445,20 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
{
if (!isRaidGroup())
return;
Player *player = objmgr.GetPlayer(guid);
if (!player)
{
uint8 prevSubGroup;
prevSubGroup = GetMemberGroup(guid);
SubGroupCounterDecrease(prevSubGroup);
uint8 prevSubGroup = GetMemberGroup(guid);
if (prevSubGroup == group)
return;
if (_setMembersGroup(guid, group))
{
SubGroupCounterDecrease(prevSubGroup);
SendUpdate();
}
}
else
// This methods handles itself groupcounter decrease
@@ -1467,9 +1470,13 @@ void Group::ChangeMembersGroup(Player *player, const uint8 &group)
{
if (!player || !isRaidGroup())
return;
uint8 prevSubGroup = player->GetSubGroup();
if (prevSubGroup == group)
return;
if (_setMembersGroup(player->GetGUID(), group))
{
uint8 prevSubGroup = player->GetSubGroup();
if (player->GetGroup() == this)
player->GetGroupRef().setSubGroup(group);
//if player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference
+4 -3
View File
@@ -33,6 +33,7 @@
#define MAXGROUPSIZE 5
#define MAXRAIDSIZE 40
#define MAX_RAID_SUBGROUPS MAXRAIDSIZE/MAXGROUPSIZE
#define TARGETICONCOUNT 8
enum RollVote
@@ -260,7 +261,7 @@ class Group
{
member_citerator mslot = _getMemberCSlot(guid);
if (mslot == m_memberSlots.end())
return (MAXRAIDSIZE/MAXGROUPSIZE+1);
return (MAX_RAID_SUBGROUPS+1);
return mslot->group;
}
@@ -381,9 +382,9 @@ class Group
{
// Sub group counters initialization
if (!m_subGroupsCounts)
m_subGroupsCounts = new uint8[MAXRAIDSIZE / MAXGROUPSIZE];
m_subGroupsCounts = new uint8[MAX_RAID_SUBGROUPS];
memset((void*)m_subGroupsCounts, 0, (MAXRAIDSIZE / MAXGROUPSIZE)*sizeof(uint8));
memset((void*)m_subGroupsCounts, 0, (MAX_RAID_SUBGROUPS)*sizeof(uint8));
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
++m_subGroupsCounts[itr->group];
@@ -534,8 +534,10 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data)
std::string name;
uint8 groupNr;
recv_data >> name;
recv_data >> groupNr;
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
/** error handling **/
uint64 senderGuid = GetPlayer()->GetGUID();
@@ -546,16 +548,18 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data)
return;
/********************/
Player *movedPlayer=objmgr.GetPlayer(name.c_str());
if (!movedPlayer)
return;
Player *movedPlayer = objmgr.GetPlayer(name.c_str());
if (movedPlayer)
{
//Do not allow leader to change group of player in combat
if (movedPlayer->isInCombat())
return;
//Do not allow leader to change group of player in combat
if (movedPlayer->isInCombat())
return;
// everything's fine, do it
group->ChangeMembersGroup(movedPlayer, groupNr);
// everything's fine, do it
group->ChangeMembersGroup(movedPlayer, groupNr);
}
else
group->ChangeMembersGroup(objmgr.GetPlayerGUIDByName(name.c_str()), groupNr);
}
void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket & recv_data)