Added homepoint and aetheryte code. You can set the homepoint on an aetheryte or inn and the return menu will show the correct response. Added effects/msgs to teleport/return. Some sql changes I forgot.

This commit is contained in:
Filip Maj 2017-05-01 22:30:43 -04:00
parent 8c9ecebae6
commit 1516e0bc50
18 changed files with 481 additions and 140 deletions

View file

@ -302,6 +302,42 @@ namespace FFXIVClassic_Map_Server
}
}
public static void SavePlayerHomePoints(Player player)
{
string query;
MySqlCommand cmd;
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();
query = @"
UPDATE characters SET
homepoint = @homepoint,
homepointInn = @homepointInn
WHERE id = @charaId
";
cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@charaId", player.actorId);
cmd.Parameters.AddWithValue("@homepoint", player.homepoint);
cmd.Parameters.AddWithValue("@homepointInn", player.homepointInn);
cmd.ExecuteNonQuery();
}
catch (MySqlException e)
{
Program.Log.Error(e.ToString());
}
finally
{
conn.Dispose();
}
}
}
public static void SaveQuest(Player player, Quest quest)
{
int slot = player.GetQuestSlot(quest.actorId);
@ -486,7 +522,9 @@ namespace FFXIVClassic_Map_Server
destinationZoneId,
destinationSpawnType,
currentPrivateArea,
currentPrivateAreaType
currentPrivateAreaType,
homepoint,
homepointInn
FROM characters WHERE id = @charId";
cmd = new MySqlCommand(query, conn);
@ -517,6 +555,8 @@ namespace FFXIVClassic_Map_Server
player.playerWork.restBonusExpRate = reader.GetInt32(17);
player.achievementPoints = reader.GetUInt32(18);
player.playTime = reader.GetUInt32(19);
player.homepoint = reader.GetUInt32("homepoint");
player.homepointInn = reader.GetByte("homepointInn");
player.destinationZone = reader.GetUInt32("destinationZoneId");
player.destinationSpawnType = reader.GetByte("destinationSpawnType");

View file

@ -104,7 +104,12 @@ namespace FFXIVClassic_Map_Server.Actors
propPacketUtil.AddProperty("charaWork.currentContentGroup");
player.QueuePackets(propPacketUtil.Done());
}
}
}
public void PlayAnimation(uint animId)
{
zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, actorId, animId));
}
}

View file

@ -128,6 +128,10 @@ namespace FFXIVClassic_Map_Server.Actors
public Quest[] questScenario = new Quest[16];
public Quest[] questGuildleve = new Quest[8];
//Aetheryte
public uint homepoint = 0;
public byte homepointInn = 0;
private List<Director> ownedDirectors = new List<Director>();
private Director loginInitDirector = null;
@ -1039,6 +1043,36 @@ namespace FFXIVClassic_Map_Server.Actors
return playerWork.initialTown;
}
public uint GetHomePoint()
{
return homepoint;
}
public byte GetHomePointInn()
{
return homepointInn;
}
public void SetHomePoint(uint aetheryteId)
{
homepoint = aetheryteId;
Database.SavePlayerHomePoints(this);
}
public void SetHomePointInn(byte townId)
{
homepointInn = townId;
Database.SavePlayerHomePoints(this);
}
public bool HasAetheryteNodeUnlocked(uint aetheryteId)
{
if (aetheryteId != 0)
return true;
else
return false;
}
public int GetFreeQuestSlot()
{
for (int i = 0; i < questScenario.Length; i++)
@ -1527,6 +1561,8 @@ namespace FFXIVClassic_Map_Server.Actors
currentParty = null;
}
public void Update(double delta)
{
LuaEngine.GetInstance().CallLuaFunction(this, this, "OnUpdate", true, delta);