mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 07:13:58 -05:00
migrating to .NET Core 2.0
This commit is contained in:
13
SharedLibraryCore/Objects/Alias.cs
Normal file
13
SharedLibraryCore/Objects/Alias.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibraryCore.Objects
|
||||
{
|
||||
public class Alias : Database.Models.EFAlias
|
||||
{
|
||||
|
||||
}
|
||||
}
|
25
SharedLibraryCore/Objects/Penalty.cs
Normal file
25
SharedLibraryCore/Objects/Penalty.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using SharedLibraryCore;
|
||||
|
||||
namespace SharedLibraryCore.Objects
|
||||
{
|
||||
public class Penalty : Database.Models.EFPenalty
|
||||
{
|
||||
public enum PenaltyType
|
||||
{
|
||||
Report,
|
||||
Warning,
|
||||
Flag,
|
||||
Kick,
|
||||
TempBan,
|
||||
Ban,
|
||||
Unban,
|
||||
Any,
|
||||
}
|
||||
|
||||
public String GetWhenFormatted()
|
||||
{
|
||||
return When.ToString("MM/dd/yy HH:mm:ss"); ;
|
||||
}
|
||||
}
|
||||
}
|
104
SharedLibraryCore/Objects/Player.cs
Normal file
104
SharedLibraryCore/Objects/Player.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibraryCore.Objects
|
||||
{
|
||||
public class Player : Database.Models.EFClient
|
||||
{
|
||||
public enum Permission
|
||||
{
|
||||
Banned = -1,
|
||||
User = 0,
|
||||
Flagged = 1,
|
||||
Trusted = 2,
|
||||
Moderator = 3,
|
||||
Administrator = 4,
|
||||
SeniorAdmin = 5,
|
||||
Owner = 6,
|
||||
Creator = 7,
|
||||
Console = 8,
|
||||
}
|
||||
|
||||
public Player()
|
||||
{
|
||||
ConnectionTime = DateTime.UtcNow;
|
||||
ClientNumber = -1;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Name}::{NetworkId}";
|
||||
}
|
||||
|
||||
public String GetLastConnection()
|
||||
{
|
||||
return Utilities.GetTimePassed(LastConnection);
|
||||
}
|
||||
|
||||
public async Task Tell(String Message)
|
||||
{
|
||||
await CurrentServer.Tell(Message, this);
|
||||
}
|
||||
|
||||
public async Task Kick(String Message, Player Sender)
|
||||
{
|
||||
await CurrentServer.Kick(Message, this, Sender);
|
||||
}
|
||||
|
||||
public async Task TempBan(String Message, TimeSpan Length, Player Sender)
|
||||
{
|
||||
await CurrentServer.TempBan(Message, Length, this, Sender);
|
||||
}
|
||||
|
||||
public async Task Warn(String Message, Player Sender)
|
||||
{
|
||||
await CurrentServer.Warn(Message, this, Sender);
|
||||
}
|
||||
|
||||
public async Task Ban(String Message, Player Sender)
|
||||
{
|
||||
await CurrentServer.Ban(Message, this, Sender);
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public int ClientNumber { get; set; }
|
||||
[NotMapped]
|
||||
public int Ping { get; set; }
|
||||
[NotMapped]
|
||||
public int Warnings { get; set; }
|
||||
[NotMapped]
|
||||
public DateTime ConnectionTime { get; set; }
|
||||
[NotMapped]
|
||||
public Server CurrentServer { get; set; }
|
||||
[NotMapped]
|
||||
public int Score { get; set; }
|
||||
[NotMapped]
|
||||
public IList<Dtos.ProfileMeta> Meta { get; set; }
|
||||
|
||||
private int _ipaddress;
|
||||
public override int IPAddress
|
||||
{
|
||||
get { return _ipaddress; }
|
||||
set { _ipaddress = value; }
|
||||
}
|
||||
private string _name;
|
||||
public override string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return ((Player)obj).NetworkId == NetworkId;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return NetworkId.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
22
SharedLibraryCore/Objects/Report.cs
Normal file
22
SharedLibraryCore/Objects/Report.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibraryCore.Objects
|
||||
{
|
||||
public class Report
|
||||
{
|
||||
public Report(Player T, Player O, String R)
|
||||
{
|
||||
Target = T;
|
||||
Origin = O;
|
||||
Reason = R;
|
||||
}
|
||||
|
||||
public Player Target { get; private set; }
|
||||
public Player Origin { get; private set; }
|
||||
public String Reason { get; private set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user