void HandleOfferPetition(OfferPetition packet) { Player player = Global.ObjAccessor.FindConnectedPlayer(packet.TargetPlayer); if (!player) { return; } if (!WorldConfig.GetBoolValue(WorldCfg.AllowTwoSideInteractionGuild) && GetPlayer().GetTeam() != player.GetTeam()) { Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NotAllied); return; } if (player.GetGuildId() != 0) { Guild.SendCommandResult(this, GuildCommandType.InvitePlayer, GuildCommandError.AlreadyInGuild_S, GetPlayer().GetName()); return; } if (player.GetGuildIdInvited() != 0) { Guild.SendCommandResult(this, GuildCommandType.InvitePlayer, GuildCommandError.AlreadyInvitedToGuild_S, GetPlayer().GetName()); return; } PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PETITION_SIGNATURE); stmt.AddValue(0, packet.ItemGUID.GetCounter()); SQLResult result = DB.Characters.Query(stmt); ServerPetitionShowSignatures signaturesPacket = new ServerPetitionShowSignatures(); signaturesPacket.Item = packet.ItemGUID; signaturesPacket.Owner = GetPlayer().GetGUID(); signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, player.GetSession().GetAccountId()); signaturesPacket.PetitionID = (int)packet.ItemGUID.GetCounter(); // @todo verify that... do { ObjectGuid signerGUID = ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(0)); ServerPetitionShowSignatures.PetitionSignature signature = new ServerPetitionShowSignatures.PetitionSignature(); signature.Signer = signerGUID; signature.Choice = 0; signaturesPacket.Signatures.Add(signature); }while (result.NextRow()); player.SendPacket(signaturesPacket); }
void HandleOfferPetition(OfferPetition packet) { Player player = Global.ObjAccessor.FindConnectedPlayer(packet.TargetPlayer); if (!player) { return; } Petition petition = Global.PetitionMgr.GetPetition(packet.ItemGUID); if (petition == null) { return; } if (!WorldConfig.GetBoolValue(WorldCfg.AllowTwoSideInteractionGuild) && GetPlayer().GetTeam() != player.GetTeam()) { Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NotAllied); return; } if (player.GetGuildId() != 0) { Guild.SendCommandResult(this, GuildCommandType.InvitePlayer, GuildCommandError.AlreadyInGuild_S, GetPlayer().GetName()); return; } if (player.GetGuildIdInvited() != 0) { Guild.SendCommandResult(this, GuildCommandType.InvitePlayer, GuildCommandError.AlreadyInvitedToGuild_S, GetPlayer().GetName()); return; } SendPetitionSigns(petition, player); }