mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Added DB Support for Chocobo Lenders
This commit is contained in:
parent
4f3828e594
commit
fb18c1fbe4
@ -1406,5 +1406,43 @@ namespace FFXIVClassic_Map_Server
|
||||
}
|
||||
return issues;
|
||||
}
|
||||
|
||||
public static void IssuePlayerChocobo(Player player, byte appearanceId, string name)
|
||||
{
|
||||
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_chocobo
|
||||
(characterId, hasChocobo, chocoboAppearance, chocoboName)
|
||||
VALUES
|
||||
(@characterId, @hasChocobo, @chocoboAppearance, @chocoboName)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
hasChocobo=@hasChocobo, chocoboAppearance=@chocoboAppearance, chocoboName=@chocoboName";
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@characterId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@hasChocobo", 1);
|
||||
cmd.Parameters.AddWithValue("@chocoboAppearance", appearanceId);
|
||||
cmd.Parameters.AddWithValue("@chocoboName", name);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -704,6 +704,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, musicId, 1));
|
||||
}
|
||||
|
||||
public void ChangeMusicWithEffect(ushort musicId, ushort effect)
|
||||
{
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, musicId, effect));
|
||||
}
|
||||
|
||||
public void SendChocoboAppearance()
|
||||
{
|
||||
BroadcastPacket(SetCurrentMountChocoboPacket.BuildPacket(actorId, chocoboAppearance), true);
|
||||
@ -1263,5 +1268,17 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
|
||||
}
|
||||
|
||||
public void issueChocobo(byte appearanceId, string name)
|
||||
{
|
||||
Database.IssuePlayerChocobo(this, appearanceId, name);
|
||||
hasChocobo = true;
|
||||
chocoboAppearance = appearanceId;
|
||||
chocoboName = name;
|
||||
}
|
||||
|
||||
public void changeChocoboAppearance(int appearanceId)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,50 @@ end
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
|
||||
--callClientFunction(player, "eventTalkWelcome", player);
|
||||
callClientFunction(player, "eventAskMainMenu", player, 20, true, true, true, true, 4);
|
||||
local curLevel = 20;
|
||||
local hasIssuance = true;
|
||||
local hasChocobo = player.hasChocobo;
|
||||
|
||||
if (player.isGM and hasChocobo == false) then
|
||||
hasIssuance = true;
|
||||
end
|
||||
|
||||
local rentPrice = 800;
|
||||
local playerFunds = 0; --TODO: pull character's money
|
||||
local hasFunds = (playerFunds >= rentPrice);
|
||||
|
||||
callClientFunction(player, "eventTalkWelcome", player);
|
||||
menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, hasChocobo, hasChocobo, 4);
|
||||
|
||||
if (menuChoice == 1) then -- Issuance option
|
||||
callClientFunction(player, "eventTalkMyChocobo", player);
|
||||
callClientFunction(player, "eventSetChocoboName", false);
|
||||
nameResponse = callClientFunction(player, "eventSetChocoboName", false);
|
||||
|
||||
if (nameResponse == "") then -- Cancel Chocobo naming
|
||||
callClientFunction(player, "eventCancelChocoboName", player);
|
||||
end
|
||||
|
||||
appearance = 1; -- TODO: pull correct appearance based on GC
|
||||
--player:issueChocobo(appearance, nameResponse);
|
||||
if (nameResponse ~= "") then -- Successfully named Chocobo
|
||||
callClientFunction(player, "eventAfterChocoboName", player);
|
||||
end
|
||||
elseif(menuChoice == 2 and hasChocobo) then -- Summon Bird
|
||||
player:ChangeMusic(83);
|
||||
player:SendChocoboAppearance();
|
||||
player:SendGameMessage(player, worldMaster, 26001, 0x20);
|
||||
player:SetMountState(1);
|
||||
elseif(menuChoice == 3) then -- Change Barding
|
||||
callClientFunction(player, "eventTalkStepBreak", player);
|
||||
elseif(menuChoice == 5) then -- Rent Bird
|
||||
if (hasFunds == false) then -- Not enough money
|
||||
-- Do not enough money action??
|
||||
else
|
||||
--Issue rental chocobo
|
||||
end
|
||||
else
|
||||
callClientFunction(player, "eventTalkStepBreak", player);
|
||||
end
|
||||
|
||||
player:EndEvent();
|
||||
end
|
Loading…
Reference in New Issue
Block a user