mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-05-20 08:26:59 -04:00
Random work.
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_World_Server.DataObjects;
|
||||
using FFXIVClassic_World_Server.DataObjects.Group;
|
||||
|
||||
@@ -11,6 +8,48 @@ namespace FFXIVClassic_World_Server
|
||||
{
|
||||
class Database
|
||||
{
|
||||
public static bool LoadZoneSessionInfo(Session session)
|
||||
{
|
||||
string characterName;
|
||||
uint currentZone = 0;
|
||||
uint destinationZone = 0;
|
||||
bool readIn = false;
|
||||
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("SELECT name, currentZoneId, destinationZoneId FROM characters WHERE id = @charaId", conn);
|
||||
cmd.Parameters.AddWithValue("@charaId", session.sessionId);
|
||||
using (MySqlDataReader Reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (Reader.Read())
|
||||
{
|
||||
characterName = Reader.GetString("name");
|
||||
currentZone = Reader.GetUInt32("currentZoneId");
|
||||
destinationZone = Reader.GetUInt32("destinationZoneId");
|
||||
|
||||
session.characterName = characterName;
|
||||
session.currentZoneId = currentZone;
|
||||
|
||||
readIn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return readIn;
|
||||
}
|
||||
|
||||
public static uint GetCurrentZoneForSession(uint charId)
|
||||
{
|
||||
uint currentZone = 0;
|
||||
@@ -50,7 +89,7 @@ namespace FFXIVClassic_World_Server
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<uint, RetainerGroupMember> GetRetainers(uint charaId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user