mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-12 23:44:34 +02:00
Added seek nameplate code. Added bazaar transaction stuff to WorldManager and DB. Added Item Gamedata to InventoryItem class.
This commit is contained in:
parent
b191da416b
commit
3850860440
5 changed files with 512 additions and 47 deletions
|
@ -110,6 +110,29 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
public INV_ERROR AddItem(uint itemId, int quantity)
|
||||
{
|
||||
return AddItem(itemId, quantity, 1);
|
||||
}
|
||||
|
||||
|
||||
public INV_ERROR AddItem(InventoryItem itemRef)
|
||||
{
|
||||
if (!IsSpaceForAdd(itemRef.itemId, itemRef.quantity, itemRef.quality))
|
||||
return INV_ERROR.INVENTORY_FULL;
|
||||
|
||||
ItemData gItem = Server.GetItemGamedata(itemRef.itemId);
|
||||
|
||||
if (gItem == null)
|
||||
{
|
||||
Program.Log.Error("Inventory.AddItem: unable to find item %u", itemRef.itemId);
|
||||
return INV_ERROR.SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
isDirty[endOfListIndex] = true;
|
||||
list[endOfListIndex++] = itemRef;
|
||||
DoDatabaseAdd(itemRef);
|
||||
|
||||
SendUpdatePackets();
|
||||
|
||||
return INV_ERROR.SUCCESS;
|
||||
}
|
||||
|
||||
public INV_ERROR AddItem(uint itemId, int quantity, byte quality)
|
||||
|
@ -154,12 +177,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
//New item that spilled over
|
||||
while (quantityCount > 0)
|
||||
{
|
||||
byte[] tags = new byte[4];
|
||||
byte[] values = new byte[4];
|
||||
|
||||
if (gItem.isExclusive)
|
||||
tags[1] = 3;
|
||||
|
||||
InventoryItem.ItemModifier modifiers = null;
|
||||
if (gItem.durability != 0)
|
||||
{
|
||||
|
@ -167,7 +184,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
modifiers.durability = (uint)gItem.durability;
|
||||
}
|
||||
|
||||
InventoryItem addedItem = Database.CreateItem(itemId, Math.Min(quantityCount, gItem.maxStack), tags, values, quality, modifiers);
|
||||
InventoryItem addedItem = Database.CreateItem(itemId, Math.Min(quantityCount, gItem.maxStack), quality, modifiers);
|
||||
addedItem.slot = (ushort)endOfListIndex;
|
||||
isDirty[endOfListIndex] = true;
|
||||
list[endOfListIndex++] = addedItem;
|
||||
|
@ -244,6 +261,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
|
||||
DoRealign();
|
||||
SendUpdatePackets();
|
||||
}
|
||||
|
||||
public void RemoveItem(InventoryItem item)
|
||||
{
|
||||
RemoveItemByUniqueId(item.uniqueId);
|
||||
}
|
||||
|
||||
public void RemoveItemByUniqueId(ulong itemDBId)
|
||||
|
@ -641,7 +663,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
endOfListIndex = lastNullSlot;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
return endOfListIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,6 +141,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
public uint homepoint = 0;
|
||||
public byte homepointInn = 0;
|
||||
|
||||
//Nameplate Stuff
|
||||
public uint currentLSPlate = 0;
|
||||
public bool isBazaarRetail = false;
|
||||
public bool isBazaarRepair = false;
|
||||
public bool isMateriaRequest = false;
|
||||
public byte repairType = 0;
|
||||
|
||||
//Retainer
|
||||
RetainerMeetingRelationGroup retainerMeetingGroup = null;
|
||||
public Retainer currentSpawnedRetainer = null;
|
||||
|
@ -501,7 +508,17 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
propPacketUtil.AddProperty(String.Format("work.guildleveChecked[{0}]", i));
|
||||
}
|
||||
|
||||
//NPC Linkshell
|
||||
//Bazaar
|
||||
if (charaWork.eventSave.repairType != 0)
|
||||
propPacketUtil.AddProperty("charaWork.eventSave.repairType");
|
||||
if (charaWork.eventTemp.bazaarRetail)
|
||||
propPacketUtil.AddProperty("charaWork.eventTemp.bazaarRetail");
|
||||
if (charaWork.eventTemp.bazaarRepair)
|
||||
propPacketUtil.AddProperty("charaWork.eventTemp.bazaarRepair");
|
||||
if (charaWork.eventTemp.bazaarMateria)
|
||||
propPacketUtil.AddProperty("charaWork.eventTemp.bazaarMateria");
|
||||
|
||||
//NPC Linkshell
|
||||
for (int i = 0; i < playerWork.npcLinkshellChatCalling.Length; i++)
|
||||
{
|
||||
if (playerWork.npcLinkshellChatCalling[i] != false)
|
||||
|
@ -1046,6 +1063,47 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
BroadcastPacket(CreateAppearancePacket(), true);
|
||||
}
|
||||
|
||||
public void SetRepairRequest(byte type)
|
||||
{
|
||||
charaWork.eventSave.repairType = type;
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("charaWork/bazaar", this);
|
||||
propPacketUtil.AddProperty("charaWork.eventSave.repairType");
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
|
||||
public void CheckBazaarFlags()
|
||||
{
|
||||
bool isDealing = false, isRepairing = false, seekingItem = false;
|
||||
lock (GetInventory(Inventory.BAZAAR))
|
||||
{
|
||||
foreach (InventoryItem item in GetInventory(Inventory.BAZAAR).GetRawList())
|
||||
{
|
||||
if (item == null)
|
||||
break;
|
||||
|
||||
if (item.GetBazaarMode() == InventoryItem.TYPE_SINGLE || item.GetBazaarMode() == InventoryItem.TYPE_STACK)
|
||||
isDealing = true;
|
||||
if (item.GetBazaarMode() == InventoryItem.TYPE_SEEK_REPAIR)
|
||||
isRepairing = true;
|
||||
if (item.GetBazaarMode() == InventoryItem.TYPE_SEEK_ITEM)
|
||||
seekingItem = true;
|
||||
|
||||
if (isDealing && isRepairing && seekingItem)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
charaWork.eventTemp.bazaarRetail = isDealing;
|
||||
charaWork.eventTemp.bazaarRepair = isRepairing;
|
||||
charaWork.eventTemp.bazaarMateria = GetInventory(Inventory.MELDREQUEST).GetCount() == 0;
|
||||
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("charaWork/bazaar", this);
|
||||
propPacketUtil.AddProperty("charaWork.eventTemp.bazaarRetail");
|
||||
propPacketUtil.AddProperty("charaWork.eventTemp.bazaarRepair");
|
||||
propPacketUtil.AddProperty("charaWork.eventTemp.bazaarMateria");
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
|
||||
public Inventory GetInventory(ushort type)
|
||||
{
|
||||
if (inventories.ContainsKey(type))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue