public ReturnValue AddNpcDeath(NpcDeath npcDeath) { var returnValue = new ReturnValue(); try { DapperDb dapperDb = DapperDb.Init(OpenConnection(), 3, false); var newId = dapperDb.NpcDeathTable.Insert( new //NpcDeath() { Name = npcDeath.Name, Deaths = npcDeath.Deaths }); returnValue.Success = true; returnValue.Message = newId.ToString(); return(returnValue); } catch (Exception ex) { returnValue.Message = ex.Message; return(returnValue); } }
public void KillNpc(Player player, NpcInstance npc) { var session = sessions.Get(player); foreach (var connection in connectionProvider.GetConnectedActivePlayerConnections(session)) { connection.Send(NpcDeath.Create(npc, player), SendOption.Reliable); } }
public ReturnValue UpdateNpcDeath(NpcDeath npcDeath) { var returnValue = new ReturnValue(); try { string timeElapsed; var result = Execute(e => e.Execute(MySQL.NpcDeath.UpdateItem, new { @deaths = npcDeath.Deaths, @name = npcDeath.Name }), out timeElapsed); returnValue.Success = true; returnValue.Message = result.ToString(); return(returnValue); } catch (Exception ex) { returnValue.Message = ex.Message; return(returnValue); } }