mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Fixed new positions after realignment not saving. Fixed Dealer info not clearing from the db sometimes.
This commit is contained in:
parent
e91960040c
commit
a07aa12783
@ -1635,6 +1635,48 @@ namespace FFXIVClassic_Map_Server
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateItemPositions(List<InventoryItem> updated)
|
||||
{
|
||||
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 characters_inventory
|
||||
SET slot = @slot
|
||||
WHERE serverItemId = @serverItemId;
|
||||
";
|
||||
|
||||
using (MySqlTransaction trans = conn.BeginTransaction())
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand(query, conn, trans))
|
||||
{
|
||||
foreach (InventoryItem item in updated)
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
cmd.Parameters.AddWithValue("@serverItemId", item.uniqueId);
|
||||
cmd.Parameters.AddWithValue("@slot", item.slot);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)))
|
||||
|
@ -1638,14 +1638,12 @@ namespace FFXIVClassic_Map_Server
|
||||
bazaarPackage.RemoveItem(reward);
|
||||
reward.SetNormal();
|
||||
player.AddItem(reward);
|
||||
Database.ClearDealingInfo(reward);
|
||||
|
||||
if (seek != null)
|
||||
{
|
||||
bazaarPackage.RemoveItem(seek);
|
||||
seek.SetNormal();
|
||||
player.AddItem(seek);
|
||||
Database.ClearDealingInfo(seek);
|
||||
}
|
||||
|
||||
player.CheckBazaarFlags();
|
||||
|
@ -826,7 +826,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||
|
||||
private void DoRealign()
|
||||
{
|
||||
int lastNullSlot = -1;
|
||||
List<InventoryItem> positionUpdate = new List<InventoryItem>();
|
||||
|
||||
int lastNullSlot = -1;
|
||||
|
||||
for (int i = 0; i < endOfListIndex; i++)
|
||||
{
|
||||
@ -838,7 +840,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||
else if (list[i] != null && lastNullSlot != -1)
|
||||
{
|
||||
list[lastNullSlot] = list[i];
|
||||
if (list[lastNullSlot].GetOfferedTo() != null)
|
||||
{
|
||||
list[lastNullSlot].UpdateOfferedSlot((ushort)(list[lastNullSlot].slot - lastNullSlot));
|
||||
}
|
||||
list[lastNullSlot].slot = (ushort)lastNullSlot;
|
||||
positionUpdate.Add(list[lastNullSlot]);
|
||||
list[i] = null;
|
||||
isDirty[lastNullSlot] = true;
|
||||
isDirty[i] = true;
|
||||
@ -848,6 +855,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||
|
||||
if (lastNullSlot != -1)
|
||||
endOfListIndex = lastNullSlot;
|
||||
|
||||
Database.UpdateItemPositions(positionUpdate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -271,6 +271,9 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
||||
|
||||
public void SetNormal()
|
||||
{
|
||||
if (dealingMode != 0 || tags[0] == TAG_ATTACHED)
|
||||
Database.ClearDealingInfo(this);
|
||||
|
||||
tags[0] = 0;
|
||||
tagValues[0] = 0;
|
||||
dealingVal = 0;
|
||||
@ -319,6 +322,18 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
||||
Database.SetDealingInfo(this);
|
||||
}
|
||||
|
||||
public void UpdateOfferedSlot(ushort delta)
|
||||
{
|
||||
if (dealingMode == DEALINGMODE_REFERENCED)
|
||||
{
|
||||
ushort attachedItemPackage = (ushort)((dealingAttached1 >> 16) & 0xFF);
|
||||
ushort attachedSlot = (ushort)(dealingAttached1 & 0xFF);
|
||||
attachedSlot -= delta;
|
||||
dealingAttached1 = ((attachedItemPackage << 16) | attachedSlot);
|
||||
Database.SetDealingInfo(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetSeeking()
|
||||
{
|
||||
tags[0] = TAG_ATTACHED;
|
||||
|
Loading…
Reference in New Issue
Block a user