mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-11-27 10:06:53 -08:00
Removed EMD code because Spirtix yelled at me.
This commit is contained in:
parent
67a0b9f360
commit
6963a22f6f
@ -1,5 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using sodoff.Attributes;
|
using sodoff.Attributes;
|
||||||
using sodoff.Model;
|
using sodoff.Model;
|
||||||
using sodoff.Schema;
|
using sodoff.Schema;
|
||||||
@ -99,8 +98,6 @@ public class GroupController : Controller {
|
|||||||
|
|
||||||
private readonly DBContext ctx;
|
private readonly DBContext ctx;
|
||||||
|
|
||||||
private bool AddedEMD = false;
|
|
||||||
|
|
||||||
public GroupController(DBContext ctx) {
|
public GroupController(DBContext ctx) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
}
|
}
|
||||||
@ -512,11 +509,6 @@ public class GroupController : Controller {
|
|||||||
public Schema.Group[] GetGroupsByGroupType([FromForm] string apiKey, [FromForm] string groupType) {
|
public Schema.Group[] GetGroupsByGroupType([FromForm] string apiKey, [FromForm] string groupType) {
|
||||||
uint gameId = ClientVersion.GetGameID(apiKey);
|
uint gameId = ClientVersion.GetGameID(apiKey);
|
||||||
|
|
||||||
if (!AddedEMD) {
|
|
||||||
AddEMDGroups();
|
|
||||||
AddedEMD = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Schema.Group> groups = new List<Schema.Group>();
|
List<Schema.Group> groups = new List<Schema.Group>();
|
||||||
foreach (Model.Group group in ctx.Groups) {
|
foreach (Model.Group group in ctx.Groups) {
|
||||||
if (group.GameID == gameId && group.Type.ToString() == groupType) groups.Add(new Schema.Group {
|
if (group.GameID == gameId && group.Type.ToString() == groupType) groups.Add(new Schema.Group {
|
||||||
@ -554,36 +546,4 @@ public class GroupController : Controller {
|
|||||||
Points = group.Points
|
Points = group.Points
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddEMDGroups() {
|
|
||||||
bool changed = false;
|
|
||||||
Guid DragonString = new Guid(EMD_Dragons.GroupID);
|
|
||||||
Guid ScorpionString = new Guid(EMD_Scorpions.GroupID);
|
|
||||||
if (!ctx.Groups.Any(g => g.GroupID == DragonString)) {
|
|
||||||
ctx.Groups.Add(new Model.Group {
|
|
||||||
GroupID = DragonString,
|
|
||||||
Name = EMD_Dragons.Name,
|
|
||||||
Color = EMD_Dragons.Color,
|
|
||||||
Logo = EMD_Dragons.Logo,
|
|
||||||
Type = GroupType.System,
|
|
||||||
GameID = ClientVersion.EMD,
|
|
||||||
MaxMemberLimit = int.MaxValue
|
|
||||||
});
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
if (!ctx.Groups.Any(g => g.GroupID == ScorpionString)) {
|
|
||||||
ctx.Groups.Add(new Model.Group {
|
|
||||||
GroupID = ScorpionString,
|
|
||||||
Name = EMD_Scorpions.Name,
|
|
||||||
Color = EMD_Scorpions.Color,
|
|
||||||
Logo = EMD_Scorpions.Logo,
|
|
||||||
Type = GroupType.System,
|
|
||||||
GameID = ClientVersion.EMD,
|
|
||||||
MaxMemberLimit = int.MaxValue
|
|
||||||
});
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
if (changed) ctx.SaveChanges();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user