mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Added "CanAcceptQuest" and "IsQuestCompleted" helpers.
This commit is contained in:
parent
b345521f79
commit
6c366110ef
@ -354,6 +354,31 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsQuestCompleted(Player player, string questId)
|
||||||
|
{
|
||||||
|
bool isCompleted = 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 * FROM characters_quest_completed WHERE characterId = @charaId and questId = @questId", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
||||||
|
cmd.Parameters.AddWithValue("@questId", questId);
|
||||||
|
isCompleted = (int)cmd.ExecuteScalar() > 0;
|
||||||
|
}
|
||||||
|
catch (MySqlException e)
|
||||||
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
conn.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
public static void LoadPlayerCharacter(Player player)
|
public static void LoadPlayerCharacter(Player player)
|
||||||
{
|
{
|
||||||
|
@ -1122,6 +1122,32 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanAcceptQuest(string name)
|
||||||
|
{
|
||||||
|
if (!IsQuestCompleted(name) && !HasQuest(name))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanAcceptQuest(uint id)
|
||||||
|
{
|
||||||
|
Actor actor = Server.GetStaticActors((0xA0F00000 | id));
|
||||||
|
return CanAcceptQuest(actor.actorName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsQuestCompleted(string id)
|
||||||
|
{
|
||||||
|
bool isCompleted = Database.IsQuestCompleted(this, id);
|
||||||
|
return isCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsQuestCompleted(uint id)
|
||||||
|
{
|
||||||
|
Actor actor = Server.GetStaticActors((0xA0F00000 | id));
|
||||||
|
return IsQuestCompleted(actor.actorName);
|
||||||
|
}
|
||||||
|
|
||||||
public Quest GetQuest(uint id)
|
public Quest GetQuest(uint id)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < questScenario.Length; i++)
|
for (int i = 0; i < questScenario.Length; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user