Пример #1
0
// Called when opening pGuild bank tab only (first one)
// Cata Status: Done
void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data) {
	sLog->outDebug(LOG_FILTER_NETWORKIO,
			"WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)");

	uint64 GoGuid;
	recv_data >> GoGuid;

	uint8 tabId;
	recv_data >> tabId;

	uint8 unk1;
	recv_data >> unk1;

	if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid,
			GAMEOBJECT_TYPE_GUILD_BANK))
		if (Guild* pGuild = _GetPlayerGuild(this))
			pGuild->SendBankTabData(this, tabId);
}
Пример #2
0
// Called when clicking on Guild bank gameobject
void WorldSession::HandleGuildBankerActivate(WorldPacket & recv_data)
{
    sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Received (CMSG_GUILD_BANKER_ACTIVATE)");

    uint64 GoGuid;
    recv_data >> GoGuid;

    uint8 unk;
    recv_data >> unk;

    if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
    {
        if (Guild* guild = _GetPlayerGuild(this))
            guild->SendBankTabsInfo(this);
        else
            Guild::SendCommandResult(this, GUILD_UNK1, ERR_GUILD_PLAYER_NOT_IN_GUILD);
    }
}
// Called when clicking on Guild bank gameobject
void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANKER_ACTIVATE)");

    uint64 GoGuid;
    recvData >> GoGuid;

    uint8 fullSlotList;
    recvData >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated

    if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
    {
        if (Guild* guild = _GetPlayerGuild(this))
            guild->SendBankList(this, 0, true, true);
        else
            Guild::SendCommandResult(this, GUILD_UNK1, ERR_GUILD_PLAYER_NOT_IN_GUILD);
    }
}
Пример #4
0
void WorldSession::HandleGuildAssignRankOpcode(WorldPacket& recvPacket)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_ASSIGN_MEMBER_RANK");

    ObjectGuid targetGuid;
    ObjectGuid setterGuid;

    uint32 rankId;
    recvPacket >> rankId;

    uint8 bitOrder[8] = {3, 5, 7, 4, 6, 0, 1, 2};
    recvPacket.ReadBitInOrder(targetGuid, bitOrder);

    uint8 byteOrder[8] = {2, 6, 7, 4, 0, 3, 5, 1};
    recvPacket.ReadBytesSeq(targetGuid, byteOrder);

    if (Guild* guild = _GetPlayerGuild(this, true))
        guild->HandleSetMemberRank(this, targetGuid, GetPlayer()->GetGUID(), rankId);
}
Пример #5
0
void WorldSession::HandleGuildMasterReplaceOpcode(WorldPacket& recvPacket)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_REPLACE_GUILD_MASTER");

    Guild* guild = _GetPlayerGuild(this, true);

    if (!guild)
        return; // Cheat

    uint32 logoutTime = guild->GetMemberLogoutTime(guild->GetLeaderGUID());

    if (!logoutTime)
        return;

    time_t now = time(NULL);

    if (time_t(logoutTime + 3 * MONTH) > now)
        return; // Cheat

    guild->SwitchGuildLeader(GetPlayer()->GetGUID());
}
Пример #6
0
void WorldSession::HandleGuildSetNoteOpcode(WorldPacket& recvPacket)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_SET_NOTE");

    ObjectGuid playerGuid;
    playerGuid[0] = recvPacket.ReadBit();
    playerGuid[2] = recvPacket.ReadBit();
    playerGuid[7] = recvPacket.ReadBit();
    playerGuid[3] = recvPacket.ReadBit();
    bool type = recvPacket.ReadBit();      // 0 == Officer, 1 == Public
    uint32 noteLength = recvPacket.ReadBits(8);
    recvPacket.ReadBit(); //noteLength & 0x1F
    playerGuid[4] = recvPacket.ReadBit();
    playerGuid[6] = recvPacket.ReadBit();
    playerGuid[5] = recvPacket.ReadBit();
    playerGuid[1] = recvPacket.ReadBit();
    recvPacket.FlushBits();
    /*playerGuid[1] = recvPacket.ReadBit();
    playerGuid[4] = recvPacket.ReadBit();
    playerGuid[5] = recvPacket.ReadBit();
    playerGuid[3] = recvPacket.ReadBit();
    playerGuid[0] = recvPacket.ReadBit();
    playerGuid[7] = recvPacket.ReadBit();
    bool type = recvPacket.ReadBit();      // 0 == Officer, 1 == Public
    playerGuid[6] = recvPacket.ReadBit();
    uint32 noteLength = recvPacket.ReadBits(8);
    playerGuid[2] = recvPacket.ReadBit();
    */
    std::string note = recvPacket.ReadString(noteLength);

    uint8 byteOrder[8] = {2, 5, 0, 3, 7, 4, 6, 1};
    recvPacket.ReadBytesSeq(playerGuid, byteOrder);

    if (Guild* guild = _GetPlayerGuild(this, true))
        guild->HandleSetMemberNote(this, note, playerGuid, type);
}
void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
{
    time_t now = time(NULL);
    if (now - timeLastGuildInviteCommand < 5)
        return;
    else
       timeLastGuildInviteCommand = now;

    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_INVITE");

    uint32 nameLength = recvPacket.ReadBits(8);

    bool pair = recvPacket.ReadBit();

    if (pair)
        nameLength++;

    recvPacket.FlushBits();
    std::string invitedName = recvPacket.ReadString(nameLength);

    if (normalizePlayerName(invitedName))
        if (Guild* guild = _GetPlayerGuild(this, true))
            guild->HandleInviteMember(this, invitedName);
}
Пример #8
0
void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
{
    uint32 BankStacks[GUILD_BANK_MAX_TABS];
    for (uint32 i = 0; i < GUILD_BANK_MAX_TABS; i++)
        recvPacket >> BankStacks[i];

    uint32 new_rights;
    recvPacket >> new_rights;

    uint32 new_rankId;
    recvPacket >> new_rankId;

    uint32 old_rankId;
    recvPacket >> old_rankId;

    uint32 BankRights[GUILD_BANK_MAX_TABS];
    for (uint32 i = 0; i < GUILD_BANK_MAX_TABS; i++)
        recvPacket >> BankRights[i];

    uint64 guildId;
    recvPacket >> guildId;

    uint32 old_rights;
    recvPacket >> old_rights;

    uint32 money;
    recvPacket >> money;

    uint64 playerGuid;
    recvPacket >> playerGuid;

    std::string rankName;
    recvPacket >> rankName;

    sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Received CMSG_GUILD_RANK");

    if (GetPlayer()->GetGUID() != playerGuid)
    {
        printf("CMSG_GUILD_RANK: The playerGUID in the packet does not match the current player!\n");
        recvPacket.rpos(recvPacket.wpos());
        Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
        return;
    }

    if (GetPlayer()->GetGuildId() != GUID_LOPART(guildId))
    {
        printf("CMSG_GUILD_RANK: This player is not in the guild.\n");
        recvPacket.rpos(recvPacket.wpos());
        Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
        return;
    }

    Guild* guild = _GetPlayerGuild(this, true);
    if (!guild)
    {
        recvPacket.rpos(recvPacket.wpos());
        return;
    }

    GuildBankRightsAndSlotsVec rightsAndSlots(GUILD_BANK_MAX_TABS);
    if (old_rankId != GR_GUILDMASTER)
    {
        for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
        {
            rightsAndSlots[tabId] = GuildBankRightsAndSlots(BankRights[tabId], BankStacks[tabId]);
        }

        guild->HandleSetRankInfo(this, new_rankId, rankName, new_rights, money, rightsAndSlots);
    }

    if (old_rankId != new_rankId && old_rankId != GR_GUILDMASTER && new_rankId != GR_GUILDMASTER)
        guild->ChangeMemberRank(old_rankId, new_rankId);
}
Пример #9
0
void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
{
    /*  Packet Breakdown 
        FF FF FF FF =>Bank permissions 1
        FF FF FF FF =>Bank permissions 2
        FF FF FF FF =>Bank permissions 3
        FF FF FF FF =>Bank permissions 4
        FF FF FF FF =>Bank permissions 5
        FF FF FF FF =>Bank permissions 6
        FF FF FF FF =>Bank permissions 7
        FF FF FF FF =>Bank permissions 8
        00 00 00 00 =>Bank withdrawal 1
        00 00 00 00 =>Bank withdrawal 2
        00 00 00 00 =>Bank withdrawal 3
        00 00 00 00 =>Bank withdrawal 4
        00 00 00 00 =>Bank withdrawal 5
        00 00 00 00 =>Bank withdrawal 6
        00 00 00 00 =>Bank withdrawal 7
        00 00 00 00 =>Bank withdrawal 8
        00 00 00 00 =>new rankID
        00 00 00 00 =>last rankID
        04 00 00 00 00 00 00 00 =>playerguid
        FF F1 1D 00 =>new permissions
        FF F1 1D 00 =>last permissions
        02 00 00 00 00 00 F6 1F =>guildId
        FF FF FF FF =>max bank withdrawal
        47 75 69 6C 64 20 4D 61 73 74 65 72 C2 B0 30 00 =>rankName
    */

    uint32 BankRights[GUILD_BANK_MAX_TABS];
    for(uint32 i = 0; i < GUILD_BANK_MAX_TABS; i++)
        recvPacket >> BankRights[i];

    uint32 new_rights;
    recvPacket >> new_rights;

    uint32 new_rankId;
    recvPacket >> new_rankId;

    uint32 old_rankId;
    recvPacket >> old_rankId;

    uint32 BankStacks[GUILD_BANK_MAX_TABS];
    for(uint32 i = 0; i < GUILD_BANK_MAX_TABS; i++)
        recvPacket >> BankStacks[i];

    uint64 guildId;
    recvPacket >> guildId;


    uint32 old_rights;
    recvPacket >> old_rights;

    uint32 money;
    recvPacket >> money;
    
    uint64 playerGuid;
    recvPacket >> playerGuid;

    std::string rankName;
    recvPacket >> rankName;

    sLog->outDebug("WORLD: Received CMSG_GUILD_RANK");

    if (GetPlayer()->GetGUID() != playerGuid)
    {
        printf("CMSG_GUILD_RANK: The playerGUID in the packet does not match the current player!\n");
        recvPacket.rpos(recvPacket.wpos());
        Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
        return;
    }
    if (GetPlayer()->GetGuildId() != GUID_LOPART(guildId))
    {
        printf("CMSG_GUILD_RANK: This player is not in the guild.\n");
        recvPacket.rpos(recvPacket.wpos());
        Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
        return;
    }

    Guild* pGuild = _GetPlayerGuild(this, true);

    if (!pGuild)
    {
        recvPacket.rpos(recvPacket.wpos());
        return;
    }
    
    GuildBankRightsAndSlotsVec rightsAndSlots(GUILD_BANK_MAX_TABS);
    if (old_rankId != GR_GUILDMASTER)
    {
        for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
        {
            rightsAndSlots[tabId] = GuildBankRightsAndSlots(uint8(old_rights), new_rights);
        }

        pGuild->HandleSetRankInfo(this, new_rankId, rankName, new_rights, money, rightsAndSlots);

    }
    if (old_rankId != new_rankId && old_rankId != GR_GUILDMASTER && new_rankId != GR_GUILDMASTER)
        pGuild->SwitchRank(old_rankId, new_rankId);
}
Пример #10
0
// Cata Status: Done
void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/) {
	sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DISBAND");

	if (Guild* pGuild = _GetPlayerGuild(this, true))
		pGuild->HandleDisband(this);
}
Пример #11
0
// Cata Status: Done
void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) {
	sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_LEAVE");

	if (Guild* pGuild = _GetPlayerGuild(this, true))
		pGuild->HandleLeaveMember(this);
}
Пример #12
0
// CATA Status: Done
void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/) {
	sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_ROSTER");

	if (Guild* pGuild = _GetPlayerGuild(this))
		pGuild->HandleRoster(this);
}
Пример #13
0
// Cata Status: Done
void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) {
	sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_INFO");

	if (Guild* pGuild = _GetPlayerGuild(this, true))
		pGuild->SendInfo(this);
}