mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 05:24:34 +02:00
Added the UpdateItemPackage packet used to signal the server to send bazaar item info. Added a transaction method in WorldManager. Fixed some inventory bugs. InvItems now track what player, itempackage, and itemslot they are in... and may have their quantity set from there. Fixed DB SetQuantity bug.
This commit is contained in:
parent
b2e273d7cf
commit
f5ea82f735
8 changed files with 156 additions and 51 deletions
|
@ -1698,7 +1698,9 @@ namespace FFXIVClassic_Map_Server
|
|||
}
|
||||
}
|
||||
|
||||
public static void SetQuantity(Player player, ulong serverItemId, int quantity)
|
||||
|
||||
|
||||
public static void SetQuantity(ulong serverItemId, int quantity)
|
||||
{
|
||||
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)))
|
||||
{
|
||||
|
@ -1707,13 +1709,12 @@ namespace FFXIVClassic_Map_Server
|
|||
conn.Open();
|
||||
|
||||
string query = @"
|
||||
UPDATE characters_inventory
|
||||
UPDATE server_items
|
||||
SET quantity = @quantity
|
||||
WHERE characterId = @charId and serverItemId = @serverItemId;
|
||||
WHERE id = @serverItemId;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@serverItemId", serverItemId);
|
||||
cmd.Parameters.AddWithValue("@quantity", quantity);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
@ -1796,39 +1797,6 @@ namespace FFXIVClassic_Map_Server
|
|||
}
|
||||
}
|
||||
|
||||
public static void SetQuantity(Retainer retainer, ulong serverItemId, int quantity)
|
||||
{
|
||||
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();
|
||||
|
||||
string query = @"
|
||||
UPDATE retainers_inventory
|
||||
SET quantity = @quantity
|
||||
WHERE retainerId = @retainerId and serverItemId = @serverItemId;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@retainerId", retainer.getRetainerId());
|
||||
cmd.Parameters.AddWithValue("@serverItemId", serverItemId);
|
||||
cmd.Parameters.AddWithValue("@quantity", quantity);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RemoveItem(Retainer retainer, ulong serverItemId)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}; Allow User Variables=True", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue