public void LoadSignatures() { uint oldMSTime = Time.GetMSTime(); SQLResult result = DB.Characters.Query("SELECT petitionguid, player_account, playerguid FROM petition_sign"); if (result.IsEmpty()) { Log.outInfo(LogFilter.ServerLoading, "Loaded 0 Petition signs!"); return; } uint count = 0; do { Petition petition = GetPetition(ObjectGuid.Create(HighGuid.Item, result.Read <ulong>(0))); if (petition == null) { continue; } petition.AddSignature(petition.PetitionGuid, result.Read <uint>(1), ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(2)), true); ++count; } while (result.NextRow()); Log.outInfo(LogFilter.ServerLoading, $"Loaded {count} Petition signs in {Time.GetMSTimeDiffToNow(oldMSTime)} ms."); }
public void AddPetition(ObjectGuid petitionGuid, ObjectGuid ownerGuid, string name, bool isLoading) { Petition p = new Petition(); p.PetitionGuid = petitionGuid; p.ownerGuid = ownerGuid; p.petitionName = name; p.signatures.Clear(); _petitionStorage[petitionGuid] = p; if (isLoading) { return; } PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PETITION); stmt.AddValue(0, ownerGuid.GetCounter()); stmt.AddValue(1, petitionGuid.GetCounter()); stmt.AddValue(2, name); DB.Characters.Execute(stmt); }