Core: SOme code cleanup, more to follow.
This commit is contained in:
@@ -56,7 +56,7 @@ namespace Game.Scenarios
|
||||
return;
|
||||
}
|
||||
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
SQLTransaction trans = new();
|
||||
foreach (var iter in _criteriaProgress)
|
||||
{
|
||||
if (!iter.Value.Changed)
|
||||
@@ -101,10 +101,10 @@ namespace Game.Scenarios
|
||||
SQLResult result = DB.Characters.Query(stmt);
|
||||
if (!result.IsEmpty())
|
||||
{
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
SQLTransaction trans = new();
|
||||
long now = Time.UnixTime;
|
||||
|
||||
List<CriteriaTree> criteriaTrees = new List<CriteriaTree>();
|
||||
List<CriteriaTree> criteriaTrees = new();
|
||||
do
|
||||
{
|
||||
uint id = result.Read<uint>(0);
|
||||
@@ -178,6 +178,6 @@ namespace Game.Scenarios
|
||||
}
|
||||
|
||||
Map _map;
|
||||
Dictionary<byte, Dictionary<uint, CriteriaProgress>> _stepCriteriaProgress = new Dictionary<byte, Dictionary<uint, CriteriaProgress>>();
|
||||
Dictionary<byte, Dictionary<uint, CriteriaProgress>> _stepCriteriaProgress = new();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Game.Scenarios
|
||||
if (step != null)
|
||||
SetStepState(step, ScenarioStepState.InProgress);
|
||||
|
||||
ScenarioState scenarioState = new ScenarioState();
|
||||
ScenarioState scenarioState = new();
|
||||
BuildScenarioState(scenarioState);
|
||||
SendPacket(scenarioState);
|
||||
}
|
||||
@@ -155,7 +155,7 @@ namespace Game.Scenarios
|
||||
|
||||
public override void SendCriteriaUpdate(Criteria criteria, CriteriaProgress progress, uint timeElapsed, bool timedCompleted)
|
||||
{
|
||||
ScenarioProgressUpdate progressUpdate = new ScenarioProgressUpdate();
|
||||
ScenarioProgressUpdate progressUpdate = new();
|
||||
progressUpdate.CriteriaProgress.Id = criteria.Id;
|
||||
progressUpdate.CriteriaProgress.Quantity = progress.Counter;
|
||||
progressUpdate.CriteriaProgress.Player = progress.PlayerGUID;
|
||||
@@ -279,14 +279,14 @@ namespace Game.Scenarios
|
||||
|
||||
public void SendScenarioState(Player player)
|
||||
{
|
||||
ScenarioState scenarioState = new ScenarioState();
|
||||
ScenarioState scenarioState = new();
|
||||
BuildScenarioState(scenarioState);
|
||||
player.SendPacket(scenarioState);
|
||||
}
|
||||
|
||||
List<BonusObjectiveData> GetBonusObjectivesData()
|
||||
{
|
||||
List<BonusObjectiveData> bonusObjectivesData = new List<BonusObjectiveData>();
|
||||
List<BonusObjectiveData> bonusObjectivesData = new();
|
||||
foreach (var step in _data.Steps.Values)
|
||||
{
|
||||
if (!step.IsBonusObjective())
|
||||
@@ -306,13 +306,13 @@ namespace Game.Scenarios
|
||||
|
||||
List<CriteriaProgressPkt> GetCriteriasProgress()
|
||||
{
|
||||
List<CriteriaProgressPkt> criteriasProgress = new List<CriteriaProgressPkt>();
|
||||
List<CriteriaProgressPkt> criteriasProgress = new();
|
||||
|
||||
if (!_criteriaProgress.Empty())
|
||||
{
|
||||
foreach (var pair in _criteriaProgress)
|
||||
{
|
||||
CriteriaProgressPkt criteriaProgress = new CriteriaProgressPkt();
|
||||
CriteriaProgressPkt criteriaProgress = new();
|
||||
criteriaProgress.Id = pair.Key;
|
||||
criteriaProgress.Quantity = pair.Value.Counter;
|
||||
criteriaProgress.Date = pair.Value.Date;
|
||||
@@ -331,7 +331,7 @@ namespace Game.Scenarios
|
||||
|
||||
void SendBootPlayer(Player player)
|
||||
{
|
||||
ScenarioVacate scenarioBoot = new ScenarioVacate();
|
||||
ScenarioVacate scenarioBoot = new();
|
||||
scenarioBoot.ScenarioID = (int)_data.Entry.Id;
|
||||
player.SendPacket(scenarioBoot);
|
||||
}
|
||||
@@ -348,10 +348,10 @@ namespace Game.Scenarios
|
||||
public override void AfterCriteriaTreeUpdate(CriteriaTree tree, Player referencePlayer) { }
|
||||
public override void SendAllData(Player receiver) { }
|
||||
|
||||
List<ObjectGuid> _players = new List<ObjectGuid>();
|
||||
List<ObjectGuid> _players = new();
|
||||
ScenarioData _data;
|
||||
ScenarioStepRecord _currentstep;
|
||||
Dictionary<ScenarioStepRecord, ScenarioStepState> _stepStates = new Dictionary<ScenarioStepRecord, ScenarioStepState>();
|
||||
Dictionary<ScenarioStepRecord, ScenarioStepState> _stepStates = new();
|
||||
}
|
||||
|
||||
public enum ScenarioStepState
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Game.Scenarios
|
||||
if (scenarioHordeId == 0)
|
||||
scenarioHordeId = scenarioAllianceId;
|
||||
|
||||
ScenarioDBData data = new ScenarioDBData();
|
||||
ScenarioDBData data = new();
|
||||
data.MapID = mapId;
|
||||
data.DifficultyID = difficulty;
|
||||
data.Scenario_A = scenarioAllianceId;
|
||||
@@ -111,7 +111,7 @@ namespace Game.Scenarios
|
||||
{
|
||||
_scenarioData.Clear();
|
||||
|
||||
Dictionary<uint, Dictionary<byte, ScenarioStepRecord>> scenarioSteps = new Dictionary<uint, Dictionary<byte, ScenarioStepRecord>>();
|
||||
Dictionary<uint, Dictionary<byte, ScenarioStepRecord>> scenarioSteps = new();
|
||||
uint deepestCriteriaTreeSize = 0;
|
||||
|
||||
foreach (ScenarioStepRecord step in CliDB.ScenarioStepStorage.Values)
|
||||
@@ -136,7 +136,7 @@ namespace Game.Scenarios
|
||||
|
||||
foreach (ScenarioRecord scenario in CliDB.ScenarioStorage.Values)
|
||||
{
|
||||
ScenarioData data = new ScenarioData();
|
||||
ScenarioData data = new();
|
||||
data.Entry = scenario;
|
||||
data.Steps = scenarioSteps.LookupByKey(scenario.Id);
|
||||
_scenarioData[scenario.Id] = data;
|
||||
@@ -160,7 +160,7 @@ namespace Game.Scenarios
|
||||
}
|
||||
|
||||
List<Vector2>[][] POIs = new List<Vector2>[0][];
|
||||
Dictionary<uint, MultiMap<int, ScenarioPOIPoint>> allPoints = new Dictionary<uint, MultiMap<int, ScenarioPOIPoint>>();
|
||||
Dictionary<uint, MultiMap<int, ScenarioPOIPoint>> allPoints = new();
|
||||
|
||||
// 0 1 2 3 4
|
||||
SQLResult pointsResult = DB.World.Query("SELECT CriteriaTreeID, Idx1, X, Y, Z FROM scenario_poi_points ORDER BY CriteriaTreeID DESC, Idx1, Idx2");
|
||||
@@ -225,15 +225,15 @@ namespace Game.Scenarios
|
||||
return _scenarioPOIStore[CriteriaTreeID];
|
||||
}
|
||||
|
||||
Dictionary<uint, ScenarioData> _scenarioData = new Dictionary<uint, ScenarioData>();
|
||||
MultiMap<uint, ScenarioPOI> _scenarioPOIStore = new MultiMap<uint, ScenarioPOI>();
|
||||
Dictionary<Tuple<uint, byte>, ScenarioDBData> _scenarioDBData = new Dictionary<Tuple<uint, byte>, ScenarioDBData>();
|
||||
Dictionary<uint, ScenarioData> _scenarioData = new();
|
||||
MultiMap<uint, ScenarioPOI> _scenarioPOIStore = new();
|
||||
Dictionary<Tuple<uint, byte>, ScenarioDBData> _scenarioDBData = new();
|
||||
}
|
||||
|
||||
public class ScenarioData
|
||||
{
|
||||
public ScenarioRecord Entry;
|
||||
public Dictionary<byte, ScenarioStepRecord> Steps = new Dictionary<byte, ScenarioStepRecord>();
|
||||
public Dictionary<byte, ScenarioStepRecord> Steps = new();
|
||||
}
|
||||
|
||||
class ScenarioDBData
|
||||
@@ -268,7 +268,7 @@ namespace Game.Scenarios
|
||||
public int WorldEffectID;
|
||||
public int PlayerConditionID;
|
||||
public int NavigationPlayerConditionID;
|
||||
public List<ScenarioPOIPoint> Points = new List<ScenarioPOIPoint>();
|
||||
public List<ScenarioPOIPoint> Points = new();
|
||||
|
||||
public ScenarioPOI(int blobIndex, int mapID, int uiMapID, int priority, int flags, int worldEffectID, int playerConditionID, int navigationPlayerConditionID, List<ScenarioPOIPoint> points)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user