mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 07:37:02 +00:00
[9353] Some fixes to guild/arenateam events.
This commit is contained in:
parent
1aa6c8eac9
commit
0bd88dd55a
12 changed files with 317 additions and 347 deletions
|
|
@ -45,6 +45,7 @@
|
|||
#define ARENA_TEAM_CHARTER_3v3_COST 1200000 // 120 G
|
||||
#define ARENA_TEAM_CHARTER_5v5 23562
|
||||
#define ARENA_TEAM_CHARTER_5v5_COST 2000000 // 200 G
|
||||
#define CHARTER_DISPLAY_ID 16161
|
||||
|
||||
void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
|
|
@ -148,12 +149,12 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
if(sObjectMgr.GetGuildByName(name))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS);
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_EXISTS_S);
|
||||
return;
|
||||
}
|
||||
if(sObjectMgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_INVALID);
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_INVALID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -204,8 +205,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
|||
_player->SendNewItem(charter, 1, true, false);
|
||||
|
||||
// a petition is invalid, if both the owner and the type matches
|
||||
// we checked above, if this player is in an arenateam, so this must be
|
||||
// datacorruption
|
||||
// we checked above, if this player is in an arenateam, so this must be data corruption
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT petitionguid FROM petition WHERE ownerguid = '%u' AND type = '%u'", _player->GetGUIDLow(), type);
|
||||
|
||||
std::ostringstream ssInvalidPetitionGUIDs;
|
||||
|
|
@ -258,7 +258,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
|
|||
delete result;
|
||||
|
||||
// if guild petition and has guild => error, return;
|
||||
if(type==9 && _player->GetGuildId())
|
||||
if(type == 9 && _player->GetGuildId())
|
||||
return;
|
||||
|
||||
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionguid_low);
|
||||
|
|
@ -270,18 +270,18 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
|
|||
sLog.outDebug("CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid_low);
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12));
|
||||
data << petitionguid; // petition guid
|
||||
data << _player->GetGUID(); // owner guid
|
||||
data << petitionguid_low; // guild guid (in mangos always same as GUID_LOPART(petitionguid)
|
||||
data << signs; // sign's count
|
||||
data << uint64(petitionguid); // petition guid
|
||||
data << uint64(_player->GetGUID()); // owner guid
|
||||
data << uint32(petitionguid_low); // guild guid (in mangos always same as GUID_LOPART(petitionguid)
|
||||
data << uint8(signs); // sign's count
|
||||
|
||||
for(uint8 i = 1; i <= signs; ++i)
|
||||
{
|
||||
Field *fields2 = result->Fetch();
|
||||
uint64 plguid = fields2[0].GetUInt64();
|
||||
|
||||
data << plguid; // Player GUID
|
||||
data << (uint32)0; // there 0 ...
|
||||
data << uint64(plguid); // Player GUID
|
||||
data << uint32(0); // there 0 ...
|
||||
|
||||
result->NextRow();
|
||||
}
|
||||
|
|
@ -404,12 +404,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
if(sObjectMgr.GetGuildByName(newname))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, newname, GUILD_NAME_EXISTS);
|
||||
SendGuildCommandResult(GUILD_CREATE_S, newname, ERR_GUILD_NAME_EXISTS_S);
|
||||
return;
|
||||
}
|
||||
if(sObjectMgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, newname, GUILD_NAME_INVALID);
|
||||
SendGuildCommandResult(GUILD_CREATE_S, newname, ERR_GUILD_NAME_INVALID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -433,8 +433,9 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
|
|||
db_newname.c_str(), GUID_LOPART(petitionguid));
|
||||
|
||||
sLog.outDebug("Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionguid), newname.c_str());
|
||||
|
||||
WorldPacket data(MSG_PETITION_RENAME, (8+newname.size()+1));
|
||||
data << petitionguid;
|
||||
data << uint64(petitionguid);
|
||||
data << newname;
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
|
@ -479,7 +480,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
if(type != 9)
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
else
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_NOT_ALLIED);
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_NOT_ALLIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -487,7 +488,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
if(_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_PLAYER_TO_LOW);
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -511,12 +512,12 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
if(_player->GetGuildId())
|
||||
{
|
||||
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_IN_GUILD);
|
||||
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ERR_ALREADY_IN_GUILD_S);
|
||||
return;
|
||||
}
|
||||
if(_player->GetGuildIdInvited())
|
||||
{
|
||||
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_INVITED_TO_GUILD);
|
||||
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ERR_ALREADY_INVITED_TO_GUILD_S);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -532,9 +533,9 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
delete result;
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
|
||||
data << petitionguid;
|
||||
data << _player->GetGUID();
|
||||
data << (uint32)PETITION_SIGN_ALREADY_SIGNED;
|
||||
data << uint64(petitionguid);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << uint32(PETITION_SIGN_ALREADY_SIGNED);
|
||||
|
||||
// close at signer side
|
||||
SendPacket(&data);
|
||||
|
|
@ -550,9 +551,9 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
sLog.outDebug("PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionguid), _player->GetName(),plguidlo,GetAccountId());
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
|
||||
data << petitionguid;
|
||||
data << _player->GetGUID();
|
||||
data << (uint32)PETITION_SIGN_OK;
|
||||
data << uint64(petitionguid);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << uint32(PETITION_SIGN_OK);
|
||||
|
||||
// close at signer side
|
||||
SendPacket(&data);
|
||||
|
|
@ -589,7 +590,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data)
|
|||
if(owner) // petition owner online
|
||||
{
|
||||
WorldPacket data(MSG_PETITION_DECLINE, 8);
|
||||
data << _player->GetGUID();
|
||||
data << uint64(_player->GetGUID());
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
@ -626,7 +627,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
|||
if(type != 9)
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
else
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_NOT_ALLIED);
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_NOT_ALLIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -635,7 +636,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
|||
if(player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
// player is too low level to join an arena team
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ARENA_TEAM_PLAYER_TO_LOW);
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -660,13 +661,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
if(player->GetGuildId())
|
||||
{
|
||||
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_IN_GUILD);
|
||||
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ERR_ALREADY_IN_GUILD_S);
|
||||
return;
|
||||
}
|
||||
|
||||
if(player->GetGuildIdInvited())
|
||||
{
|
||||
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_INVITED_TO_GUILD);
|
||||
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ERR_ALREADY_INVITED_TO_GUILD_S);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -677,18 +678,18 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
|||
signs = (uint8)result->GetRowCount();
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
|
||||
data << petitionguid; // petition guid
|
||||
data << _player->GetGUID(); // owner guid
|
||||
data << GUID_LOPART(petitionguid); // guild guid (in mangos always same as GUID_LOPART(petition guid)
|
||||
data << signs; // sign's count
|
||||
data << uint64(petitionguid); // petition guid
|
||||
data << uint64(_player->GetGUID()); // owner guid
|
||||
data << uint32(GUID_LOPART(petitionguid)); // guild guid (in mangos always same as GUID_LOPART(petition guid)
|
||||
data << uint8(signs); // sign's count
|
||||
|
||||
for(uint8 i = 1; i <= signs; ++i)
|
||||
{
|
||||
Field *fields2 = result->Fetch();
|
||||
plguid = fields2[0].GetUInt64();
|
||||
|
||||
data << plguid; // Player GUID
|
||||
data << (uint32)0; // there 0 ...
|
||||
data << uint64(plguid); // Player GUID
|
||||
data << uint32(0); // there 0 ...
|
||||
|
||||
result->NextRow();
|
||||
}
|
||||
|
|
@ -734,7 +735,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
if(_player->GetGuildId())
|
||||
{
|
||||
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild
|
||||
data << uint32(PETITION_TURN_ALREADY_IN_GUILD); // already in guild
|
||||
_player->GetSession()->SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
|
|
@ -748,7 +749,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
if(_player->GetArenaTeamId(slot))
|
||||
{
|
||||
//data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
//data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild
|
||||
//data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild
|
||||
//_player->GetSession()->SendPacket(&data);
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM);
|
||||
return;
|
||||
|
|
@ -771,11 +772,11 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
if(type == 9)
|
||||
count = sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS);
|
||||
else
|
||||
count = type-1;
|
||||
count = type - 1;
|
||||
if(signs < count)
|
||||
{
|
||||
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
data << (uint32)PETITION_TURN_NEED_MORE_SIGNATURES; // need more signatures...
|
||||
data << uint32(PETITION_TURN_NEED_MORE_SIGNATURES); // need more signatures...
|
||||
SendPacket(&data);
|
||||
delete result;
|
||||
return;
|
||||
|
|
@ -785,7 +786,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
if(sObjectMgr.GetGuildByName(name))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS);
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_EXISTS_S);
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
|
@ -811,7 +812,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
// OK!
|
||||
|
||||
// delete charter item
|
||||
_player->DestroyItem(item->GetBagSlot(),item->GetSlot(), true);
|
||||
_player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||
|
||||
if(type == 9) // create guild
|
||||
{
|
||||
|
|
@ -876,7 +877,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
sLog.outDebug("TURN IN PETITION GUID %u", GUID_LOPART(petitionguid));
|
||||
|
||||
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
data << (uint32)PETITION_TURN_OK;
|
||||
data << uint32(PETITION_TURN_OK);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
|
@ -911,13 +912,13 @@ void WorldSession::SendPetitionShowList(uint64 guid)
|
|||
count = 3;
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOWLIST, 8+1+4*6);
|
||||
data << guid; // npc guid
|
||||
data << count; // count
|
||||
data << uint64(guid); // npc guid
|
||||
data << uint8(count); // count
|
||||
if(count == 1)
|
||||
{
|
||||
data << uint32(1); // index
|
||||
data << uint32(GUILD_CHARTER); // charter entry
|
||||
data << uint32(16161); // charter display id
|
||||
data << uint32(CHARTER_DISPLAY_ID); // charter display id
|
||||
data << uint32(GUILD_CHARTER_COST); // charter cost
|
||||
data << uint32(0); // unknown
|
||||
data << uint32(9); // required signs?
|
||||
|
|
@ -927,33 +928,33 @@ void WorldSession::SendPetitionShowList(uint64 guid)
|
|||
// 2v2
|
||||
data << uint32(1); // index
|
||||
data << uint32(ARENA_TEAM_CHARTER_2v2); // charter entry
|
||||
data << uint32(16161); // charter display id
|
||||
data << uint32(CHARTER_DISPLAY_ID); // charter display id
|
||||
data << uint32(ARENA_TEAM_CHARTER_2v2_COST); // charter cost
|
||||
data << uint32(2); // unknown
|
||||
data << uint32(2); // required signs?
|
||||
// 3v3
|
||||
data << uint32(2); // index
|
||||
data << uint32(ARENA_TEAM_CHARTER_3v3); // charter entry
|
||||
data << uint32(16161); // charter display id
|
||||
data << uint32(CHARTER_DISPLAY_ID); // charter display id
|
||||
data << uint32(ARENA_TEAM_CHARTER_3v3_COST); // charter cost
|
||||
data << uint32(3); // unknown
|
||||
data << uint32(3); // required signs?
|
||||
// 5v5
|
||||
data << uint32(3); // index
|
||||
data << uint32(ARENA_TEAM_CHARTER_5v5); // charter entry
|
||||
data << uint32(16161); // charter display id
|
||||
data << uint32(CHARTER_DISPLAY_ID); // charter display id
|
||||
data << uint32(ARENA_TEAM_CHARTER_5v5_COST); // charter cost
|
||||
data << uint32(5); // unknown
|
||||
data << uint32(5); // required signs?
|
||||
}
|
||||
//for(uint8 i = 0; i < count; ++i)
|
||||
//{
|
||||
// data << uint32(i); // index
|
||||
// data << uint32(GUILD_CHARTER); // charter entry
|
||||
// data << uint32(16161); // charter display id
|
||||
// data << uint32(GUILD_CHARTER_COST+i); // charter cost
|
||||
// data << uint32(0); // unknown
|
||||
// data << uint32(9); // required signs?
|
||||
// data << uint32(i); // index
|
||||
// data << uint32(GUILD_CHARTER); // charter entry
|
||||
// data << uint32(CHARTER_DISPLAY_ID); // charter display id
|
||||
// data << uint32(GUILD_CHARTER_COST+i); // charter cost
|
||||
// data << uint32(0); // unknown
|
||||
// data << uint32(9); // required signs?
|
||||
//}
|
||||
SendPacket(&data);
|
||||
sLog.outDebug("Sent SMSG_PETITION_SHOWLIST");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue