1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-22 12:47:46 +00:00

Finished adding the rest of the player DB load.... except achievements.

This commit is contained in:
Filip Maj 2016-01-10 00:00:50 -05:00
parent 4dec77aa69
commit 861e8add4e
2 changed files with 140 additions and 20 deletions

View file

@ -11,6 +11,7 @@ using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Map_Server.dataobjects.database;
using FFXIVClassic_Map_Server.dataobjects.chara.npc;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.utils;
namespace FFXIVClassic_Lobby_Server
{
@ -229,7 +230,7 @@ namespace FFXIVClassic_Lobby_Server
player.oldRotation = player.rotation = reader.GetFloat(4);
player.currentMainState = reader.GetUInt16(5);
player.currentZoneId = reader.GetUInt32(6);
reader.GetByte(7);
player.charaWork.parameterSave.state_mainSkill[0] = reader.GetByte(7);
player.gcCurrent = reader.GetByte(8);
player.gcRankLimsa = reader.GetByte(9);
player.gcRankGridania = reader.GetByte(10);
@ -259,16 +260,16 @@ namespace FFXIVClassic_Lobby_Server
hairColor,
hairHighlightColor,
eyeColor,
faceType,
faceEyebrows,
faceEyeShape,
faceIrisSize,
faceNose,
faceMouth,
faceFeatures,
ears,
characteristics,
characteristicsColor,
faceType,
ears,
faceMouth,
faceFeatures,
faceNose,
faceEyeShape,
faceIrisSize,
faceEyebrows,
mainHand,
offHand,
head,
@ -282,22 +283,37 @@ namespace FFXIVClassic_Lobby_Server
leftEars,
rightEars
FROM characters_appearance WHERE characterId = @charId";
(byte characteristics, byte characteristicsColor, byte faceType, byte ears, byte faceMouth, byte faceFeatures, byte faceNose, byte faceEyeShape, byte faceIrisSize, byte faceEyebrows)
cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@charId", player.actorId);
using (MySqlDataReader reader = cmd.ExecuteReader())
{
reader.GetUInt32(0);
player.modelID = DBAppearance.getTribeModel(reader.GetByte(1));
player.appearanceIDs[Character.SIZE] = reader.GetByte(2);
player.appearanceIDs[Character.COLORINFO] = (uint)(reader.GetUInt16(4) | (reader.GetUInt16(6) << 10) | (reader.GetUInt16(8) << 20));
player.appearanceIDs[Character.FACEINFO] = PrimitiveConversion.ToUInt32(CharacterUtils.getFaceInfo(reader.GetByte(9), reader.GetByte(10), reader.GetByte(11), reader.GetByte(12), reader.GetByte(13), reader.GetByte(14), reader.GetByte(15), reader.GetByte(16), reader.GetByte(17), reader.GetByte(18)));
player.appearanceIDs[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt16(7) | reader.GetUInt16(5) << 10);
player.appearanceIDs[Character.VOICE] = reader.GetByte(3);
player.appearanceIDs[Character.WEAPON1] = reader.GetUInt32(19);
player.appearanceIDs[Character.WEAPON2] = reader.GetUInt32(20);
player.appearanceIDs[Character.HEADGEAR] = reader.GetUInt32(21);
player.appearanceIDs[Character.BODYGEAR] = reader.GetUInt32(22);
player.appearanceIDs[Character.LEGSGEAR] = reader.GetUInt32(23);
player.appearanceIDs[Character.HANDSGEAR] = reader.GetUInt32(24);
player.appearanceIDs[Character.FEETGEAR] = reader.GetUInt32(25);
player.appearanceIDs[Character.WAISTGEAR] = reader.GetUInt32(26);
player.appearanceIDs[Character.R_EAR] = reader.GetUInt32(27);
player.appearanceIDs[Character.L_EAR] = reader.GetUInt32(28);
player.appearanceIDs[Character.R_FINGER] = reader.GetUInt32(29);
player.appearanceIDs[Character.L_FINGER] = reader.GetUInt32(30);
}
//Load Status Effects
query = @"
SELECT
statusId,
expireTime
FROM characters_statuseffect WHERE characterId = %u";
FROM characters_statuseffect WHERE characterId = @charId";
cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@charId", player.actorId);
@ -334,13 +350,13 @@ namespace FFXIVClassic_Lobby_Server
query = @"
SELECT
achievementId
FROM characters_achievements WHERE characterId = %u AND timeDone NOT NULL";
FROM characters_achievements WHERE characterId = @charId AND timeDone NOT NULL";
//Load Last 5 Completed
query = @"
SELECT
achievementId
FROM characters_achievements WHERE characterId = %u ORDER BY timeDone DESC LIMIT 5";
FROM characters_achievements WHERE characterId = @charId ORDER BY timeDone DESC LIMIT 5";
//Load Timers
query = @"
@ -381,7 +397,7 @@ namespace FFXIVClassic_Lobby_Server
hotbarIndex,
commandId,
recastTime
FROM characters_hotbar WHERE characterId = @charId AND classId = @classId ORDER BY hotbarIndex DESC";
FROM characters_hotbar WHERE characterId = @charId AND classId = @classId";
cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@charId", player.actorId);
@ -401,7 +417,7 @@ namespace FFXIVClassic_Lobby_Server
SELECT
index,
questId
FROM characters_quest_scenario WHERE characterId = %u";
FROM characters_quest_scenario WHERE characterId = @charId";
using (MySqlDataReader reader = cmd.ExecuteReader())
{
@ -419,7 +435,7 @@ namespace FFXIVClassic_Lobby_Server
questId,
abandoned,
completed
FROM characters_quest_scenario WHERE characterId = %u";
FROM characters_quest_scenario WHERE characterId = @charId";
using (MySqlDataReader reader = cmd.ExecuteReader())
{
@ -438,7 +454,7 @@ namespace FFXIVClassic_Lobby_Server
npcLinkshellId,
isCalling,
isExtra
FROM characters_quest_scenario WHERE characterId = %u ORDER BY npcLinkshellId DESC";
FROM characters_quest_scenario WHERE characterId = @charId";
using (MySqlDataReader reader = cmd.ExecuteReader())
{

View file

@ -0,0 +1,104 @@
using FFXIVClassic_Lobby_Server.common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.utils
{
class CharacterUtils
{
public struct FaceInfo
{
[BitfieldLength(5)]
public uint characteristics;
[BitfieldLength(3)]
public uint characteristicsColor;
[BitfieldLength(6)]
public uint type;
[BitfieldLength(2)]
public uint ears;
[BitfieldLength(2)]
public uint mouth;
[BitfieldLength(2)]
public uint features;
[BitfieldLength(3)]
public uint nose;
[BitfieldLength(3)]
public uint eyeShape;
[BitfieldLength(1)]
public uint irisSize;
[BitfieldLength(3)]
public uint eyebrows;
[BitfieldLength(2)]
public uint unknown;
}
public static FaceInfo getFaceInfo(byte characteristics, byte characteristicsColor, byte faceType, byte ears, byte faceMouth, byte faceFeatures, byte faceNose, byte faceEyeShape, byte faceIrisSize, byte faceEyebrows)
{
FaceInfo faceInfo = new FaceInfo();
faceInfo.characteristics = characteristics;
faceInfo.characteristicsColor = characteristicsColor;
faceInfo.type = faceType;
faceInfo.ears = ears;
faceInfo.features = faceFeatures;
faceInfo.eyebrows = faceEyebrows;
faceInfo.eyeShape = faceEyeShape;
faceInfo.irisSize = faceIrisSize;
faceInfo.mouth = faceMouth;
faceInfo.nose = faceNose;
return faceInfo;
}
public static UInt32 getTribeModel(byte tribe)
{
switch (tribe)
{
//Hyur Midlander Male
case 1:
default:
return 1;
//Hyur Midlander Female
case 2:
return 2;
//Elezen Male
case 4:
case 6:
return 3;
//Elezen Female
case 5:
case 7:
return 4;
//Lalafell Male
case 8:
case 10:
return 5;
//Lalafell Female
case 9:
case 11:
return 6;
//Miqo'te Female
case 12:
case 13:
return 8;
//Roegadyn Male
case 14:
case 15:
return 7;
//Hyur Highlander Male
case 3:
return 9;
}
}
}
}