mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-20 03:37:48 +00:00
Inv/Equip load on first character fixed.
This commit is contained in:
parent
69d4b19979
commit
ecf07317fc
3 changed files with 32 additions and 33 deletions
|
@ -129,11 +129,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
return AddItem(itemId, quantity, 1);
|
||||
}
|
||||
|
||||
public int AddItems(uint[] itemIds, uint[] quantity, byte[] quality)
|
||||
public int AddItems(uint[] itemIds, uint[] quantity = null, byte[] quality = null)
|
||||
{
|
||||
if (itemIds.Length != quantity.Length && itemIds.Length != quality.Length)
|
||||
return ERROR_SYSTEM;
|
||||
|
||||
//Check if has space
|
||||
if (!CanAdd(itemIds, quantity, quality))
|
||||
return ERROR_FULL;
|
||||
|
@ -153,14 +150,17 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
}
|
||||
|
||||
//Check if item id exists
|
||||
int quantityCount = (int) quantity[i];
|
||||
uint setQuantity = quantity != null ? quantity[i] : 1;
|
||||
int quantityCount = (int)setQuantity;
|
||||
for (int j = 0; j < endOfListIndex; j++)
|
||||
{
|
||||
InventoryItem item = list[j];
|
||||
|
||||
Debug.Assert(item != null, "Item slot was null!!!");
|
||||
|
||||
if (item.itemId == itemIds[i] && item.quality == quantity[i] && item.quantity < gItem.maxStack)
|
||||
byte setQuality = quality != null ? quality[i] : (byte)1;
|
||||
|
||||
if (item.itemId == itemIds[i] && item.quality == setQuality && item.quantity < gItem.maxStack)
|
||||
{
|
||||
int oldQuantity = item.quantity;
|
||||
item.quantity = Math.Min(item.quantity + quantityCount, gItem.maxStack);
|
||||
|
@ -184,7 +184,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
modifiers.durability = (uint)gItem.durability;
|
||||
}
|
||||
|
||||
InventoryItem addedItem = Database.CreateItem(itemIds[i], Math.Min(quantityCount, gItem.maxStack), quality[i], modifiers);
|
||||
byte setQuality = quality != null ? quality[i] : (byte)1;
|
||||
|
||||
InventoryItem addedItem = Database.CreateItem(itemIds[i], Math.Min(quantityCount, gItem.maxStack), setQuality, modifiers);
|
||||
addedItem.RefreshPositioning(owner, itemPackageCode, (ushort)endOfListIndex);
|
||||
isDirty[endOfListIndex] = true;
|
||||
list[endOfListIndex++] = addedItem;
|
||||
|
@ -206,23 +208,20 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
|
||||
public bool CanAdd(uint[] itemIds, uint[] quantity, byte[] quality)
|
||||
{
|
||||
if (itemIds.Length != quantity.Length && itemIds.Length != quality.Length)
|
||||
return false;
|
||||
|
||||
int tempInvSize = GetCount();
|
||||
|
||||
for (int i = 0; i < itemIds.Length; i++)
|
||||
{
|
||||
ItemData gItem = Server.GetItemGamedata(itemIds[i]);
|
||||
//Check if item id exists and fill up til maxstack
|
||||
int quantityCount = (int) quantity[i];
|
||||
int quantityCount = (int) (quantity != null ? quantity[i] : 1);
|
||||
for (int j = 0; j < endOfListIndex; j++)
|
||||
{
|
||||
InventoryItem item = list[j];
|
||||
|
||||
Debug.Assert(item != null, "Item slot was null!!!");
|
||||
|
||||
if (item.itemId == itemIds[i] && item.quality == quality[i] && item.quantity < gItem.maxStack)
|
||||
if (item.itemId == itemIds[i] && item.quality == (quality != null ? quality[i] : 1) && item.quantity < gItem.maxStack)
|
||||
{
|
||||
quantityCount -= (gItem.maxStack - item.quantity);
|
||||
if (quantityCount <= 0)
|
||||
|
|
|
@ -41,19 +41,19 @@ namespace FFXIVClassic_Map_Server.actors.chara
|
|||
toSet.CopyTo(referenceList, 0);
|
||||
}
|
||||
|
||||
public void SetList(ushort[] positions, InventoryItem[] values)
|
||||
public void Set(ushort[] positions, ushort[] itemSlots, ushort itemPackage)
|
||||
{
|
||||
Debug.Assert(positions.Length == values.Length);
|
||||
Debug.Assert(positions.Length == itemSlots.Length);
|
||||
|
||||
for (int i = 0; i < positions.Length; i++)
|
||||
{
|
||||
InventoryItem item = values[i];
|
||||
InventoryItem item = owner.GetItemPackage(itemPackage)?.GetItemAtSlot(itemSlots[i]);
|
||||
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
//Database.EquipItem(owner, positions[i], item.uniqueId);
|
||||
referenceList[positions[i]] = values[i];
|
||||
Database.EquipItem(owner, positions[i], item.uniqueId);
|
||||
referenceList[positions[i]] = item;
|
||||
}
|
||||
|
||||
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||
|
|
|
@ -82,27 +82,27 @@ function initClassItems(player)
|
|||
|
||||
--DoW
|
||||
if (player.charaWork.parameterSave.state_mainSkill[0] == 2) then --PUG
|
||||
player:GetItemPackage(0):AddItem({4020001, 8030701, 8050728, 8080601, 8090307});
|
||||
player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4});
|
||||
player:GetItemPackage(0):AddItems({4020001, 8030701, 8050728, 8080601, 8090307});
|
||||
player:GetEquipment():Set({0, 10, 12, 14, 15},{0, 1, 2, 3, 4},0);
|
||||
elseif (player.charaWork.parameterSave.state_mainSkill[0] == 3) then --GLA
|
||||
player:GetItemPackage(0):AddItem({4030010, 8031120, 8050245, 8080601, 8090307});
|
||||
player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4});
|
||||
player:GetItemPackage(0):AddItems({4030010, 8031120, 8050245, 8080601, 8090307});
|
||||
player:GetEquipment():Set({0, 10, 12, 14, 15},{0, 1, 2, 3, 4},0);
|
||||
elseif (player.charaWork.parameterSave.state_mainSkill[0] == 4) then --MRD
|
||||
player:GetItemPackage(0):AddItem({4040001, 8011001, 8050621, 8070346, 8090307});
|
||||
player:GetEquipment():SetEquipment({0, 8, 12, 13, 15},{0, 1, 2, 3, 4});
|
||||
player:GetItemPackage(0):AddItems({4040001, 8011001, 8050621, 8070346, 8090307});
|
||||
player:GetEquipment():Set({0, 8, 12, 13, 15},{0, 1, 2, 3, 4},0);
|
||||
elseif (player.charaWork.parameterSave.state_mainSkill[0] == 7) then --ARC
|
||||
player:GetItemPackage(0):AddItem({4070001, 8030601, 8050622, 8080601, 8090307});
|
||||
player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4});
|
||||
player:GetItemPackage(0):AddItems({4070001, 8030601, 8050622, 8080601, 8090307});
|
||||
player:GetEquipment():Set({0, 10, 12, 14, 15},{0, 1, 2, 3, 4},0);
|
||||
elseif (player.charaWork.parameterSave.state_mainSkill[0] == 8) then --LNC
|
||||
player:GetItemPackage(0):AddItem({4080201, 8030801, 8051015, 8080501, 8090307});
|
||||
player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4});
|
||||
player:GetItemPackage(0):AddItems({4080201, 8030801, 8051015, 8080501, 8090307});
|
||||
player:GetEquipment():Set({0, 10, 12, 14, 15},{0, 1, 2, 3, 4},0);
|
||||
--DoM
|
||||
elseif (player.charaWork.parameterSave.state_mainSkill[0] == 22) then --THM
|
||||
player:GetItemPackage(0):AddItem({5020001, 8030245, 8050346, 8080346, 8090208});
|
||||
player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4});
|
||||
player:GetItemPackage(0):AddItems({5020001, 8030245, 8050346, 8080346, 8090208});
|
||||
player:GetEquipment():Set({0, 10, 12, 14, 15},{0, 1, 2, 3, 4},0);
|
||||
elseif (player.charaWork.parameterSave.state_mainSkill[0] == 23) then --CNJ
|
||||
player:GetItemPackage(0):AddItem({5030101, 8030445, 8050031, 8080246, 8090208});
|
||||
player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4});
|
||||
player:GetItemPackage(0):AddItems({5030101, 8030445, 8050031, 8080246, 8090208});
|
||||
player:GetEquipment():Set({0, 10, 12, 14, 15},{0, 1, 2, 3, 4},0);
|
||||
|
||||
--DoH
|
||||
elseif (player.charaWork.parameterSave.state_mainSkill[0] == 29) then --
|
||||
|
@ -171,6 +171,6 @@ function initRaceItems(player)
|
|||
player:GetItemPackage(0):AddItem(8060015);
|
||||
end
|
||||
|
||||
player:GetEquipment():SetEquipment({9, 11},{5,6});
|
||||
player:GetEquipment():Set({9,11},{5,6}, 0);
|
||||
|
||||
end
|
Loading…
Add table
Reference in a new issue