public void SaveAggroToFaction(string charID) { DBFactionAggroLevel dbfactionAggroLevel = GameServer.Database.SelectObject<DBFactionAggroLevel>("CharacterID = '" + GameServer.Database.Escape(charID) + "' AND FactionID =" + this.ID); if (dbfactionAggroLevel == null) { dbfactionAggroLevel = new DBFactionAggroLevel(); dbfactionAggroLevel.AggroLevel = (int)m_playerxFaction[charID]; dbfactionAggroLevel.CharacterID = charID; dbfactionAggroLevel.FactionID = this.ID; GameServer.Database.AddObject(dbfactionAggroLevel); } else { dbfactionAggroLevel.AggroLevel = (int)m_playerxFaction[charID]; GameServer.Database.SaveObject(dbfactionAggroLevel); } }
public void SaveAggroToFaction(string charID) { DBFactionAggroLevel dbfactionAggroLevel = GameServer.Database.SelectObjects<DBFactionAggroLevel>("`CharacterID` = @CharacterID AND `FactionID` = @FactionID", new[] { new QueryParameter("@CharacterID", charID), new QueryParameter("@FactionID", this.ID) }).FirstOrDefault(); if (dbfactionAggroLevel == null) { dbfactionAggroLevel = new DBFactionAggroLevel(); dbfactionAggroLevel.AggroLevel = (int)m_playerxFaction[charID]; dbfactionAggroLevel.CharacterID = charID; dbfactionAggroLevel.FactionID = this.ID; GameServer.Database.AddObject(dbfactionAggroLevel); } else { dbfactionAggroLevel.AggroLevel = (int)m_playerxFaction[charID]; GameServer.Database.SaveObject(dbfactionAggroLevel); } }