mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 21:27:46 +00:00
Added the Waste Not Want Not quest.
This commit is contained in:
parent
c0f7f1b1ad
commit
9d63be52e3
4 changed files with 176 additions and 16 deletions
|
@ -354,8 +354,77 @@ namespace FFXIVClassic_Map_Server
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveQuest(Player player, uint questId)
|
||||
{
|
||||
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 = @"
|
||||
DELETE FROM characters_quest_scenario
|
||||
WHERE characterId = @charaId and questId = @questId
|
||||
";
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@questId", 0xFFFFF & questId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CompleteQuest(Player player, uint questId)
|
||||
{
|
||||
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 = @"
|
||||
INSERT INTO characters_quest_completed
|
||||
(characterId, questId)
|
||||
VALUES
|
||||
(@charaId, @questId)
|
||||
ON DUPLICATE KEY UPDATE characterId=characterId
|
||||
";
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@questId", 0xFFFFF & questId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsQuestCompleted(Player player, string questId)
|
||||
public static bool IsQuestCompleted(Player player, uint 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)))
|
||||
|
@ -366,7 +435,7 @@ namespace FFXIVClassic_Map_Server
|
|||
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;
|
||||
isCompleted = cmd.ExecuteScalar() != null;
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
|
|
|
@ -1107,11 +1107,17 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
uint id = actor.actorId;
|
||||
if (HasQuest(id))
|
||||
{
|
||||
Database.CompleteQuest(playerSession.GetActor(), id);
|
||||
SendGameMessage(Server.GetWorldManager().GetActor(), 25086, 0x20, (object)GetQuest(id).GetQuestId());
|
||||
RemoveQuest(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveQuestByQuestId(uint id)
|
||||
{
|
||||
RemoveQuest((0xA0F00000 | id));
|
||||
}
|
||||
|
||||
public void RemoveQuest(uint id)
|
||||
{
|
||||
if (HasQuest(id))
|
||||
|
@ -1120,7 +1126,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
{
|
||||
if (questScenario[i] != null && questScenario[i].actorId == id)
|
||||
{
|
||||
Database.SaveQuest(this, questScenario[i]);
|
||||
Database.RemoveQuest(this, questScenario[i].actorId);
|
||||
questScenario[i] = null;
|
||||
playerWork.questScenario[i] = 0;
|
||||
SendQuestClientUpdate(i);
|
||||
|
@ -1163,16 +1169,15 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
return CanAcceptQuest(actor.actorName);
|
||||
}
|
||||
|
||||
public bool IsQuestCompleted(string id)
|
||||
public bool IsQuestCompleted(string questName)
|
||||
{
|
||||
bool isCompleted = Database.IsQuestCompleted(this, id);
|
||||
return isCompleted;
|
||||
Actor actor = Server.GetStaticActors(questName);
|
||||
return IsQuestCompleted(actor.actorId);
|
||||
}
|
||||
|
||||
public bool IsQuestCompleted(uint id)
|
||||
public bool IsQuestCompleted(uint questId)
|
||||
{
|
||||
Actor actor = Server.GetStaticActors((0xA0F00000 | id));
|
||||
return IsQuestCompleted(actor.actorName);
|
||||
return Database.IsQuestCompleted(this, 0xFFFFF & questId);
|
||||
}
|
||||
|
||||
public Quest GetQuest(uint id)
|
||||
|
|
|
@ -1,7 +1,46 @@
|
|||
require ("global")
|
||||
require ("quests/etc/etc5g0")
|
||||
|
||||
function onSpawn(player, npc)
|
||||
|
||||
if (player:HasQuest("Etc5g0") == true and player:GetQuest("Etc5g0"):GetPhase() == 0) then
|
||||
npc:SetQuestGraphic(player, 0x2);
|
||||
else
|
||||
npc:SetQuestGraphic(player, 0x0);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function onEventStarted(player, npc)
|
||||
defaultFst = GetStaticActor("DftFst");
|
||||
callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithPfarahr_001", nil, nil, nil);
|
||||
quest = player:GetQuest("Etc5g0");
|
||||
|
||||
result = 1;
|
||||
if (player:HasQuest("Etc5g0")) then
|
||||
unknown, result = callClientFunction(player, "switchEvent", defaultFst, quest, nil, nil, 1, 1, 0x3f1);
|
||||
end
|
||||
|
||||
if (result == 1) then
|
||||
callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithPfarahr_001", -1, -1);
|
||||
elseif (result == 2) then
|
||||
|
||||
ownedQuest = player:GetQuest("Etc5g0");
|
||||
if (ownedQuest:GetPhase() == 0) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent_010");
|
||||
worldMaster = GetWorldMaster();
|
||||
player:SendGameMessage(player, worldMaster, 25225, ownedQuest:GetQuestId());
|
||||
player:SendDataPacket("attention", worldMaster, "", 25225, ownedQuest:GetQuestId());
|
||||
ownedQuest:NextPhase(1);
|
||||
npc:SetQuestGraphic(player, 0x0);
|
||||
vkorolon = GetWorldManager():GetActorInWorldByUniqueId("vkorolon");
|
||||
if (vkorolon ~= nil) then
|
||||
vkorolon:SetQuestGraphic(player, 0x4);
|
||||
end
|
||||
else
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_1");
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
player:endEvent();
|
||||
end
|
|
@ -1,14 +1,61 @@
|
|||
require ("global")
|
||||
require ("quests/etc/etc5g0")
|
||||
|
||||
function onSpawn(player, npc)
|
||||
|
||||
if (player:HasQuest("Etc5g0") == true and player:GetQuest("Etc5g0"):GetPhase() == 1) then
|
||||
npc:SetQuestGraphic(player, 0x1);
|
||||
elseif (player:HasQuest("Etc5g0") == false and player:IsQuestCompleted("Etc5g0") == false) then
|
||||
npc:SetQuestGraphic(player, 0x2);
|
||||
else
|
||||
npc:SetQuestGraphic(player, 0x0);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function onEventStarted(player, npc)
|
||||
defaultFst = GetStaticActor("DftFst");
|
||||
choice = callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithInn_Desk", nil, nil, nil);
|
||||
quest = GetStaticActor("Etc5g0");
|
||||
|
||||
if (choice == 1) then
|
||||
GetWorldManager():DoZoneChange(player, 13);
|
||||
elseif (choice == 2) then
|
||||
--Do Set Homepoint
|
||||
end
|
||||
result = 1;
|
||||
|
||||
if (player:IsQuestCompleted("Etc5g0") == true) then
|
||||
result = 0;
|
||||
else
|
||||
unknown, result = callClientFunction(player, "switchEvent", defaultFst, quest, nil, nil, 1, 1, 0x3f1);
|
||||
end
|
||||
|
||||
if (result == 0) then
|
||||
choice = callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithInn_Desk", nil, nil, nil);
|
||||
|
||||
if (choice == 1) then
|
||||
GetWorldManager():DoZoneChange(player, 13);
|
||||
elseif (choice == 2) then
|
||||
--Do Set Homepoint
|
||||
end
|
||||
elseif (result == 1) then
|
||||
callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithVkorolon_001", -1, -1);
|
||||
elseif (result == 2) then
|
||||
if (player:HasQuest("Etc5g0") == false) then
|
||||
offerQuestResult = callClientFunction(player, "delegateEvent", player, quest, "processEventVKOROLONStart");
|
||||
if (offerQuestResult == 1) then
|
||||
player:AddQuest("Etc5g0");
|
||||
npc:SetQuestGraphic(player, 0x0);
|
||||
pfarahr = GetWorldManager():GetActorInWorldByUniqueId("pfarahr");
|
||||
if (pfarahr ~= nil) then
|
||||
pfarahr:SetQuestGraphic(player, 0x2);
|
||||
end
|
||||
end
|
||||
elseif (player:GetQuest("Etc5g0"):GetPhase() == 0) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent_000_1");
|
||||
elseif (player:GetQuest("Etc5g0"):GetPhase() == 1) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent_020");
|
||||
callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 200, 1);
|
||||
player:CompleteQuest("Etc5g0");
|
||||
npc:SetQuestGraphic(player, 0x0);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
player:EndEvent();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue