forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSkillRepository.cs
More file actions
38 lines (34 loc) · 1.24 KB
/
SkillRepository.cs
File metadata and controls
38 lines (34 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using Dapper;
using log4net;
using L2dotNET.DataContracts;
using L2dotNET.Repositories.Contracts;
using MySql.Data.MySqlClient;
namespace L2dotNET.Repositories
{
public class SkillRepository : ISkillRepository
{
private static readonly ILog Log = LogManager.GetLogger(typeof(ServerRepository));
internal IDbConnection Db;
public SkillRepository()
{
Db = new MySqlConnection(ConfigurationManager.ConnectionStrings["PrimaryConnection"].ToString());
}
public List<SkillResponseContract> GetPlayerSkills(int charID)
{
try
{
const string sql = @"select ownerId as CharObjId, id as skillId, lvl as SkillLvl, iclass as ClassId from user_skills where ownerId = @char_obj_id";
return Db.Query<SkillResponseContract>(sql, new { char_obj_id = charID }).ToList();
}
catch (MySqlException ex)
{
Log.Error($"Method: {nameof(GetPlayerSkills)}. Message: '{ex.Message}' (Error Number: '{ex.Number}')");
return new List<SkillResponseContract>();
}
}
}
}