[svn] *** Source: MaNGOS ***

* Fixed build extractor at Windows Vista. Author: Vladimir
* Fixed comment text and code indentifiers spelling. Author: Vladimir & Paradox.
* Access cached member lists in guild handlers instead of querying the DB. Author: Hunuza
* Small fixes in send/received packet and simple code cleanup also. Author: Vladimir
* Not output error at loading empty character_ticket table. Author: Vladimir
* Not reset display model at shapeshift aura remove if it not set at apply. Author: Arthorius
* Applied props to few files.

--HG--
branch : trunk
This commit is contained in:
visagalis
2008-11-14 16:28:45 -06:00
parent eefcc9026b
commit d1e759479b
79 changed files with 901 additions and 905 deletions

View File

@@ -173,26 +173,20 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(plName);
if(!plGuid)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
return;
}
if(plGuid == guild->GetLeader())
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
if(!guild->IsMember(GUID_LOPART(plGuid)))
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(plName, plGuid);
if(!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if(slot->RankId == GR_GUILDMASTER)
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
guild->DelMember(plGuid);
// Put record into guildlog
guild->LogGuildEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, GetPlayer()->GetGUIDLow(), GUID_LOPART(plGuid), 0);
@@ -301,29 +295,25 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(plName);
if(!plGuid)
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(plName, plGuid);
if(!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
else if(plGuid == GetPlayer()->GetGUID())
if(plGuid == GetPlayer()->GetGUID())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID);
return;
}
int32 plRankId = guild->GetRank(GUID_LOPART(plGuid));
if(plRankId == -1)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if(plRankId < 2 || (plRankId-1) < GetPlayer()->GetRank())
if(slot->RankId < 2 || (slot->RankId-1) < GetPlayer()->GetRank())
return;
uint32 newRankId = plRankId < guild->GetNrRanks() ? plRankId-1 : guild->GetNrRanks()-1;
uint32 newRankId = slot->RankId < guild->GetNrRanks() ? slot->RankId-1 : guild->GetNrRanks()-1;
guild->ChangeRank(plGuid, newRankId);
// Put record into guildlog
@@ -365,11 +355,12 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(plName);
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(plName, plGuid);
if( !plGuid )
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
@@ -379,26 +370,19 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
return;
}
int32 plRankId = guild->GetRank(GUID_LOPART(plGuid));
if(plRankId == -1)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if((plRankId+1) >= guild->GetNrRanks() || plRankId <= this->GetPlayer()->GetRank())
if((slot->RankId+1) >= guild->GetNrRanks() || slot->RankId <= GetPlayer()->GetRank())
return;
guild->ChangeRank(plGuid, (plRankId+1));
guild->ChangeRank(plGuid, (slot->RankId+1));
// Put record into guildlog
guild->LogGuildEvent(GUILD_EVENT_LOG_DEMOTE_PLAYER, GetPlayer()->GetGUIDLow(), GUID_LOPART(plGuid), (plRankId+1));
guild->LogGuildEvent(GUILD_EVENT_LOG_DEMOTE_PLAYER, GetPlayer()->GetGUIDLow(), GUID_LOPART(plGuid), (slot->RankId+1));
WorldPacket data(SMSG_GUILD_EVENT, (2+30)); // guess size
data << (uint8)GE_DEMOTION;
data << (uint8)3;
data << GetPlayer()->GetName();
data << plName;
data << guild->GetRankName(plRankId+1);
data << guild->GetRankName(slot->RankId+1);
guild->BroadcastPacket(&data);
}
@@ -497,13 +481,10 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
return;
}
uint64 newLeaderGUID = objmgr.GetPlayerGUIDByName(name);
if (!newLeaderGUID)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND);
return;
}
if(!guild->IsMember(GUID_LOPART(newLeaderGUID)))
uint64 newLeaderGUID;
MemberSlot* slot = guild->GetMemberSlot(name, newLeaderGUID);
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
@@ -583,15 +564,10 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(name);
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(name, plGuid);
if (!plGuid)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND);
return;
}
if (!guild->IsMember(GUID_LOPART(plGuid)))
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
@@ -628,15 +604,10 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(plName);
if (!plGuid)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
return;
}
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(plName, plGuid);
if (!guild->IsMember(GUID_LOPART(plGuid)))
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;