mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using ACE.Entity;
|
|
|
|
namespace ACE.Database
|
|
{
|
|
|
|
public class WorldDatabase : Database, IWorldDatabase
|
|
{
|
|
private enum WorldPreparedStatement
|
|
{
|
|
TeleportLocationSelect
|
|
}
|
|
|
|
protected override Type preparedStatementType => typeof(WorldPreparedStatement);
|
|
|
|
protected override void InitialisePreparedStatements()
|
|
{
|
|
AddPreparedStatement(WorldPreparedStatement.TeleportLocationSelect, "SELECT `location`, `cell`, `x`, `y`, `z`, `qx`, `qy`, `qz`, `qw` FROM `teleport_location`;");
|
|
}
|
|
|
|
public List<TeleportLocation> GetLocations()
|
|
{
|
|
var result = SelectPreparedStatement(WorldPreparedStatement.TeleportLocationSelect);
|
|
List<TeleportLocation> locations = new List<TeleportLocation>();
|
|
|
|
for (uint i = 0u; i < result.Count; i++)
|
|
{
|
|
locations.Add(new TeleportLocation
|
|
{
|
|
Location = result.Read<string>(i, "location"),
|
|
Position = new Position(result.Read<uint>(i, "cell"), result.Read<float>(i, "x"), result.Read<float>(i, "y"),
|
|
result.Read<float>(i, "z"), result.Read<float>(i, "qx"), result.Read<float>(i, "qy"), result.Read<float>(i, "qz"), result.Read<float>(i, "qw"))
|
|
});
|
|
}
|
|
|
|
return locations;
|
|
}
|
|
}
|
|
}
|