mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-04 21:50:35 -04:00
Removed NioTSO client and server
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
This commit is contained in:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
13
server/FSO.Server.Database/DA/GlobalCooldowns/DbGlobalCooldowns.cs
Executable file
13
server/FSO.Server.Database/DA/GlobalCooldowns/DbGlobalCooldowns.cs
Executable file
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
|
||||
namespace FSO.Server.Database.DA.GlobalCooldowns
|
||||
{
|
||||
public class DbGlobalCooldowns
|
||||
{
|
||||
public uint object_guid { get; set; }
|
||||
public uint avatar_id { get; set; }
|
||||
public uint user_id { get; set; }
|
||||
public uint category { get; set; }
|
||||
public DateTime expiry { get; set; }
|
||||
}
|
||||
}
|
14
server/FSO.Server.Database/DA/GlobalCooldowns/IGlobalCooldowns.cs
Executable file
14
server/FSO.Server.Database/DA/GlobalCooldowns/IGlobalCooldowns.cs
Executable file
|
@ -0,0 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace FSO.Server.Database.DA.GlobalCooldowns
|
||||
{
|
||||
public interface IGlobalCooldowns
|
||||
{
|
||||
DbGlobalCooldowns Get(uint objguid, uint avatarid, bool useAccount, uint category);
|
||||
List<DbGlobalCooldowns> GetAllByObj(uint objguid);
|
||||
List<DbGlobalCooldowns> GetAllByAvatar(uint avatarid);
|
||||
List<DbGlobalCooldowns> GetAllByObjectAndAvatar(uint objguid, uint avatarid);
|
||||
bool Create(DbGlobalCooldowns cooldown);
|
||||
bool Update(DbGlobalCooldowns cooldown);
|
||||
}
|
||||
}
|
49
server/FSO.Server.Database/DA/GlobalCooldowns/SqlGlobalCooldowns.cs
Executable file
49
server/FSO.Server.Database/DA/GlobalCooldowns/SqlGlobalCooldowns.cs
Executable file
|
@ -0,0 +1,49 @@
|
|||
using Dapper;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FSO.Server.Database.DA.GlobalCooldowns
|
||||
{
|
||||
public class SqlGlobalCooldowns : AbstractSqlDA, IGlobalCooldowns
|
||||
{
|
||||
public SqlGlobalCooldowns(ISqlContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public DbGlobalCooldowns Get(uint objguid, uint avatarOrUserid, bool useAccount, uint category)
|
||||
{
|
||||
if (useAccount)
|
||||
return Context.Connection.Query<DbGlobalCooldowns>("SELECT * FROM fso_global_cooldowns WHERE object_guid = @guid AND " +
|
||||
"user_id = @id AND category = @category", new { guid = objguid, id = avatarOrUserid, category = category }).FirstOrDefault();
|
||||
else
|
||||
return Context.Connection.Query<DbGlobalCooldowns>("SELECT * FROM fso_global_cooldowns WHERE object_guid = @guid AND " +
|
||||
"avatar_id = @id AND category = @category", new { guid = objguid, id = avatarOrUserid, category = category }).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<DbGlobalCooldowns> GetAllByObj(uint objguid)
|
||||
{
|
||||
return Context.Connection.Query<DbGlobalCooldowns>("SELECT * FROM fso_global_cooldowns WHERE object_guid = @guid", new { guid = objguid }).ToList();
|
||||
}
|
||||
|
||||
public List<DbGlobalCooldowns> GetAllByAvatar(uint avatarid)
|
||||
{
|
||||
return Context.Connection.Query<DbGlobalCooldowns>("SELECT * FROM fso_global_cooldowns WHERE avatar_id = @avatarid", new { avatarid = avatarid }).ToList();
|
||||
}
|
||||
|
||||
public List<DbGlobalCooldowns> GetAllByObjectAndAvatar(uint objguid, uint avatarid)
|
||||
{
|
||||
return Context.Connection.Query<DbGlobalCooldowns>("SELECT * FROM fso_global_cooldowns WHERE object_guid = @guid AND " +
|
||||
"avatar_id = @avatarid", new { guid = objguid, avatarid = avatarid }).ToList();
|
||||
}
|
||||
public bool Create(DbGlobalCooldowns newCooldown)
|
||||
{
|
||||
return Context.Connection.Execute("INSERT INTO fso_global_cooldowns (object_guid, avatar_id, user_id, category, expiry) " +
|
||||
"VALUES (@object_guid, @avatar_id, @user_id, @category, @expiry)", newCooldown) > 0;
|
||||
}
|
||||
public bool Update(DbGlobalCooldowns updatedCooldown)
|
||||
{
|
||||
return Context.Connection.Execute("UPDATE fso_global_cooldowns SET expiry = @expiry WHERE object_guid = @object_guid AND " +
|
||||
"avatar_id = @avatar_id AND user_id = @user_id AND category = @category", updatedCooldown) > 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue