mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-05-20 08:26:59 -04:00
Redid the database, actor_class and npclist was combined. Added commands to the lua engine. Script will default to a PopulaceStandard if no script detected to avoid crashing. Static Actors now loaded from the static actors file.
This commit is contained in:
@@ -18,10 +18,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
class Npc : Character
|
||||
{
|
||||
public Npc(uint id, string actorName, uint zoneId, uint actorTemplateId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, string className)
|
||||
private uint actorClassId;
|
||||
|
||||
public Npc(uint id, string actorName, uint zoneId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, uint displayNameId, string customDisplayName, string className)
|
||||
: base(id)
|
||||
{
|
||||
this.actorName = actorName;
|
||||
this.actorClassId = id;
|
||||
this.positionX = posX;
|
||||
this.positionY = posY;
|
||||
this.positionZ = posZ;
|
||||
@@ -34,7 +37,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
|
||||
this.zoneId = zoneId;
|
||||
|
||||
loadNpcTemplate(actorTemplateId);
|
||||
loadNpcTemplate(id);
|
||||
}
|
||||
|
||||
public SubPacket createAddActorPacket(uint playerActorId)
|
||||
@@ -51,7 +54,10 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
lParams = lua.doActorOnInstantiate(player, this);
|
||||
|
||||
if (lParams == null)
|
||||
{
|
||||
className = "PopulaceStandard";
|
||||
lParams = LuaUtils.createLuaParamList("/Chara/Npc/Populace/PopulaceStandard", false, false, false, false, false, 0xF47F6, false, false, 0, 1, "TEST");
|
||||
}
|
||||
|
||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||
}
|
||||
@@ -75,6 +81,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
return BasePacket.createPacket(subpackets, true, false);
|
||||
}
|
||||
|
||||
public uint getActorClassId()
|
||||
{
|
||||
return actorClassId;
|
||||
}
|
||||
|
||||
public void loadNpcTemplate(uint id)
|
||||
{
|
||||
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)))
|
||||
@@ -84,9 +95,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
conn.Open();
|
||||
|
||||
string query = @"
|
||||
SELECT
|
||||
displayNameId,
|
||||
customDisplayName,
|
||||
SELECT
|
||||
base,
|
||||
size,
|
||||
hairStyle,
|
||||
@@ -126,9 +135,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
rightIndex,
|
||||
leftFinger,
|
||||
rightFinger
|
||||
FROM gamedata_actor_templates
|
||||
INNER JOIN gamedata_actor_appearance ON gamedata_actor_templates.id = gamedata_actor_appearance.id
|
||||
WHERE gamedata_actor_templates.id = @templateId
|
||||
FROM gamedata_actor_appearance
|
||||
WHERE id = @templateId
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
@@ -139,35 +147,25 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
while (reader.Read())
|
||||
{
|
||||
|
||||
//Handle Name
|
||||
|
||||
if (reader.IsDBNull(1))
|
||||
displayNameId = reader.GetUInt32(0);
|
||||
else
|
||||
{
|
||||
customDisplayName = reader.GetString(1);
|
||||
displayNameId = 0xFFFFFFF;
|
||||
}
|
||||
|
||||
//Handle Appearance
|
||||
modelId = reader.GetUInt32(2);
|
||||
appearanceIds[Character.SIZE] = reader.GetUInt32(3);
|
||||
appearanceIds[Character.COLORINFO] = (uint)(reader.GetUInt32(18) | (reader.GetUInt32(17) << 10) | (reader.GetUInt32(19) << 20)); //17 - Skin Color, 16 - Hair Color, 18 - Eye Color
|
||||
appearanceIds[Character.FACEINFO] = PrimitiveConversion.ToUInt32(CharacterUtils.getFaceInfo(reader.GetByte(8), reader.GetByte(9), reader.GetByte(7), reader.GetByte(16), reader.GetByte(15), reader.GetByte(14), reader.GetByte(13), reader.GetByte(12), reader.GetByte(11), reader.GetByte(10)));
|
||||
appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt32(5) | reader.GetUInt32(4) << 10); //5- Hair Highlight, 4 - Hair Style
|
||||
appearanceIds[Character.VOICE] = reader.GetUInt32(19);
|
||||
appearanceIds[Character.WEAPON1] = reader.GetUInt32(21);
|
||||
modelId = reader.GetUInt32(0);
|
||||
appearanceIds[Character.SIZE] = reader.GetUInt32(1);
|
||||
appearanceIds[Character.COLORINFO] = (uint)(reader.GetUInt32(16) | (reader.GetUInt32(15) << 10) | (reader.GetUInt32(17) << 20)); //17 - Skin Color, 16 - Hair Color, 18 - Eye Color
|
||||
appearanceIds[Character.FACEINFO] = PrimitiveConversion.ToUInt32(CharacterUtils.getFaceInfo(reader.GetByte(6), reader.GetByte(7), reader.GetByte(5), reader.GetByte(14), reader.GetByte(13), reader.GetByte(12), reader.GetByte(11), reader.GetByte(10), reader.GetByte(9), reader.GetByte(8)));
|
||||
appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt32(3) | reader.GetUInt32(2) << 10); //5- Hair Highlight, 4 - Hair Style
|
||||
appearanceIds[Character.VOICE] = reader.GetUInt32(17);
|
||||
appearanceIds[Character.WEAPON1] = reader.GetUInt32(19);
|
||||
//appearanceIds[Character.WEAPON2] = reader.GetUInt32(22);
|
||||
appearanceIds[Character.HEADGEAR] = reader.GetUInt32(28);
|
||||
appearanceIds[Character.BODYGEAR] = reader.GetUInt32(29);
|
||||
appearanceIds[Character.LEGSGEAR] = reader.GetUInt32(30);
|
||||
appearanceIds[Character.HANDSGEAR] = reader.GetUInt32(31);
|
||||
appearanceIds[Character.FEETGEAR] = reader.GetUInt32(32);
|
||||
appearanceIds[Character.WAISTGEAR] = reader.GetUInt32(33);
|
||||
appearanceIds[Character.R_EAR] = reader.GetUInt32(34);
|
||||
appearanceIds[Character.L_EAR] = reader.GetUInt32(35);
|
||||
appearanceIds[Character.R_FINGER] = reader.GetUInt32(38);
|
||||
appearanceIds[Character.L_FINGER] = reader.GetUInt32(39);
|
||||
appearanceIds[Character.HEADGEAR] = reader.GetUInt32(26);
|
||||
appearanceIds[Character.BODYGEAR] = reader.GetUInt32(27);
|
||||
appearanceIds[Character.LEGSGEAR] = reader.GetUInt32(28);
|
||||
appearanceIds[Character.HANDSGEAR] = reader.GetUInt32(29);
|
||||
appearanceIds[Character.FEETGEAR] = reader.GetUInt32(30);
|
||||
appearanceIds[Character.WAISTGEAR] = reader.GetUInt32(31);
|
||||
appearanceIds[Character.R_EAR] = reader.GetUInt32(32);
|
||||
appearanceIds[Character.L_EAR] = reader.GetUInt32(33);
|
||||
appearanceIds[Character.R_FINGER] = reader.GetUInt32(36);
|
||||
appearanceIds[Character.L_FINGER] = reader.GetUInt32(37);
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user