public static void DeleteFromDB(ObjectGuid ownerGuid, SQLTransaction trans) { PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CORPSE); stmt.AddValue(0, ownerGuid.GetCounter()); DB.Characters.ExecuteOrAppend(trans, stmt); stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CORPSE_PHASES); stmt.AddValue(0, ownerGuid.GetCounter()); DB.Characters.ExecuteOrAppend(trans, stmt); }
public static void LeaveAllArenaTeams(ObjectGuid guid) { PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PLAYER_ARENA_TEAMS); stmt.AddValue(0, guid.GetCounter()); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) { return; } do { uint arenaTeamId = result.Read <uint>(0); if (arenaTeamId != 0) { ArenaTeam arenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(arenaTeamId); if (arenaTeam != null) { arenaTeam.DelMember(guid, true); } } }while (result.NextRow()); }
public void RemovePetition(ObjectGuid petitionGuid) { _petitionStorage.Remove(petitionGuid); // Delete From DB SQLTransaction trans = new SQLTransaction(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID); stmt.AddValue(0, petitionGuid.GetCounter()); trans.Append(stmt); stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_GUID); stmt.AddValue(0, petitionGuid.GetCounter()); trans.Append(stmt); DB.Characters.CommitTransaction(trans); }
public void RemoveSignaturesBySigner(ObjectGuid signerGuid) { foreach (var petitionPair in _petitionStorage) { petitionPair.Value.RemoveSignatureBySigner(signerGuid); } PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_PETITION_SIGNATURES); stmt.AddValue(0, signerGuid.GetCounter()); DB.Characters.Execute(stmt); }
public void RemovePetitionsByOwner(ObjectGuid ownerGuid) { foreach (var key in _petitionStorage.Keys.ToList()) { if (_petitionStorage[key].ownerGuid == ownerGuid) { _petitionStorage.Remove(key); break; } } SQLTransaction trans = new SQLTransaction(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_OWNER); stmt.AddValue(0, ownerGuid.GetCounter()); trans.Append(stmt); stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_OWNER); stmt.AddValue(0, ownerGuid.GetCounter()); trans.Append(stmt); DB.Characters.CommitTransaction(trans); }
public static uint GetArenaTeamIdFromDB(ObjectGuid guid, byte type) { PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ARENA_TEAM_ID_BY_PLAYER_GUID); stmt.AddValue(0, guid.GetCounter()); stmt.AddValue(1, type); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) { return(0); } return(result.Read <uint>(0)); }
public void SetFriendNote(ObjectGuid friendGuid, string note) { if (!_playerSocialMap.ContainsKey(friendGuid)) // not exist { return; } PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_NOTE); stmt.AddValue(0, note); stmt.AddValue(1, GetPlayerGUID().GetCounter()); stmt.AddValue(2, friendGuid.GetCounter()); DB.Characters.Execute(stmt); _playerSocialMap[friendGuid].Note = note; }
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); }