public void SendPetitionQuery(ObjectGuid petitionGuid) { QueryPetitionResponse responsePacket = new QueryPetitionResponse(); responsePacket.PetitionID = (uint)petitionGuid.GetCounter(); // PetitionID (in Trinity always same as GUID_LOPART(petition guid)) Petition petition = Global.PetitionMgr.GetPetition(petitionGuid); if (petition == null) { responsePacket.Allow = false; SendPacket(responsePacket); Log.outDebug(LogFilter.Network, $"CMSG_PETITION_Select failed for petition ({petitionGuid})"); return; } uint reqSignatures = WorldConfig.GetUIntValue(WorldCfg.MinPetitionSigns); PetitionInfo petitionInfo = new PetitionInfo(); petitionInfo.PetitionID = (int)petitionGuid.GetCounter(); petitionInfo.Petitioner = petition.ownerGuid; petitionInfo.MinSignatures = reqSignatures; petitionInfo.MaxSignatures = reqSignatures; petitionInfo.Title = petition.petitionName; responsePacket.Allow = true; responsePacket.Info = petitionInfo; SendPacket(responsePacket); }
public void SendPetitionQuery(ObjectGuid petitionGUID) { ObjectGuid ownerGUID = ObjectGuid.Empty; string title = "NO_NAME_FOR_GUID"; QueryPetitionResponse responsePacket = new QueryPetitionResponse(); responsePacket.PetitionID = (uint)petitionGUID.GetCounter(); // PetitionID (in Trinity always same as GUID_LOPART(petition guid)) PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PETITION); stmt.AddValue(0, petitionGUID.GetCounter()); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) { ownerGUID = ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(0)); title = result.Read <string>(1); } else { Log.outDebug(LogFilter.Network, "CMSG_PETITION_Select failed for petition ({0})", petitionGUID.ToString()); return; } int reqSignatures = WorldConfig.GetIntValue(WorldCfg.MinPetitionSigns); PetitionInfo petitionInfo = new PetitionInfo(); petitionInfo.PetitionID = (int)petitionGUID.GetCounter(); petitionInfo.Petitioner = ownerGUID; petitionInfo.MinSignatures = reqSignatures; petitionInfo.MaxSignatures = reqSignatures; petitionInfo.Title = title; responsePacket.Allow = true; responsePacket.Info = petitionInfo; SendPacket(responsePacket); }