mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-21 12:17:46 +00:00
Got retainer meeting group working and cleaned up retainer instancing. Added a RemoveItemAtSlot with quantity.
This commit is contained in:
parent
5bec522c8e
commit
76f073d85f
4 changed files with 70 additions and 15 deletions
|
@ -182,8 +182,12 @@ namespace FFXIVClassic_Map_Server
|
||||||
|
|
||||||
if (ownerActor == null)
|
if (ownerActor == null)
|
||||||
{
|
{
|
||||||
|
//Is it your retainer?
|
||||||
|
if (session.GetActor().currentSpawnedRetainer != null && session.GetActor().currentSpawnedRetainer.actorId == eventStart.scriptOwnerActorID)
|
||||||
|
ownerActor = session.GetActor().currentSpawnedRetainer;
|
||||||
//Is it a instance actor?
|
//Is it a instance actor?
|
||||||
ownerActor = session.GetActor().zone.FindActorInArea(session.GetActor().currentEventOwner);
|
if (ownerActor == null)
|
||||||
|
ownerActor = session.GetActor().zone.FindActorInArea(session.GetActor().currentEventOwner);
|
||||||
if (ownerActor == null)
|
if (ownerActor == null)
|
||||||
{
|
{
|
||||||
//Is it a Director?
|
//Is it a Director?
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
using FFXIVClassic_Map_Server.actors.chara.player;
|
using FFXIVClassic.Common;
|
||||||
|
using FFXIVClassic_Map_Server.actors.chara.player;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
|
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -10,22 +12,45 @@ namespace FFXIVClassic_Map_Server.actors.chara.npc
|
||||||
{
|
{
|
||||||
class Retainer : Npc
|
class Retainer : Npc
|
||||||
{
|
{
|
||||||
public Retainer(uint id, string retainerName, ActorClass actorClass, Player player, float posX, float posY, float posZ, float rot)
|
Player player;
|
||||||
: base(0, actorClass, String.Format("_rtnre{0:x7}", id), player.GetZone(), posX, posY, posZ, rot, 0, 0, retainerName)
|
|
||||||
|
public Retainer(string retainerName, ActorClass actorClass, Player player, float posX, float posY, float posZ, float rot)
|
||||||
|
: base(0, actorClass, "myretainer", player.GetZone(), posX, posY, posZ, rot, 0, 0, retainerName)
|
||||||
{
|
{
|
||||||
this.actorId = 0xD0000000 | id;
|
this.player = player;
|
||||||
|
this.actorName = String.Format("_rtnre{0:x7}", actorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendBazaarItems(Player player)
|
public void SendBazaarItems(Player player)
|
||||||
{
|
{
|
||||||
Inventory bazaar = new Inventory(this, 4, Inventory.RETAINER_BAZAAR);
|
Inventory bazaar = new Inventory(this, 150, (ushort)0);
|
||||||
bazaar.SendFullInventory(player);
|
bazaar.AddItem(1000001);
|
||||||
|
bazaar.AddItem(3020517);
|
||||||
|
player.QueuePacket(InventoryBeginChangePacket.BuildPacket(actorId));
|
||||||
|
bazaar.SendFullInventory(player);
|
||||||
|
player.QueuePacket(InventoryEndChangePacket.BuildPacket(actorId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendStorageItems(Player player)
|
public void SendStorageItems(Player player)
|
||||||
{
|
{
|
||||||
Inventory storage = new Inventory(this, 4, 1);
|
Inventory storage = new Inventory(this, 10, Inventory.CURRENCY);
|
||||||
|
storage.AddItem(1000001);
|
||||||
|
storage.AddItem(3020519);
|
||||||
|
player.QueuePacket(InventoryBeginChangePacket.BuildPacket(actorId));
|
||||||
storage.SendFullInventory(player);
|
storage.SendFullInventory(player);
|
||||||
|
player.QueuePacket(InventoryEndChangePacket.BuildPacket(actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendHuhItems(Player player)
|
||||||
|
{
|
||||||
|
Inventory storage = new Inventory(this, 20, 7);
|
||||||
|
storage.AddItem(1000003);
|
||||||
|
storage.AddItem(1000016);
|
||||||
|
player.QueuePacket(InventoryBeginChangePacket.BuildPacket(actorId));
|
||||||
|
storage.SendFullInventory(player);
|
||||||
|
player.QueuePacket(InventoryEndChangePacket.BuildPacket(actorId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,6 +230,27 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
doRealign();
|
doRealign();
|
||||||
if (owner is Player)
|
if (owner is Player)
|
||||||
SendUpdatePackets((Player)owner);
|
SendUpdatePackets((Player)owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveItemAtSlot(ushort slot, int quantity)
|
||||||
|
{
|
||||||
|
if (slot >= endOfListIndex)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (list[slot] != null)
|
||||||
|
{
|
||||||
|
list[slot].quantity -= quantity;
|
||||||
|
|
||||||
|
if (list[slot].quantity <= 0)
|
||||||
|
{
|
||||||
|
list[slot] = null;
|
||||||
|
doRealign();
|
||||||
|
}
|
||||||
|
|
||||||
|
isDirty[slot] = true;
|
||||||
|
if (owner is Player)
|
||||||
|
SendUpdatePackets((Player)owner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeDurability(uint slot, uint durabilityChange)
|
public void ChangeDurability(uint slot, uint durabilityChange)
|
||||||
|
@ -390,12 +411,14 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
|
|
||||||
Array.Clear(isDirty, 0, isDirty.Length);
|
Array.Clear(isDirty, 0, isDirty.Length);
|
||||||
|
|
||||||
|
player.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
player.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
player.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
//Send Updated Slots
|
//Send Updated Slots
|
||||||
SendInventoryPackets(player, items);
|
SendInventoryPackets(player, items);
|
||||||
//Send Remove packets for tail end
|
//Send Remove packets for tail end
|
||||||
SendInventoryRemovePackets(player, slotsToRemove);
|
SendInventoryRemovePackets(player, slotsToRemove);
|
||||||
player.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
player.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
|
player.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
public uint homepoint = 0;
|
public uint homepoint = 0;
|
||||||
public byte homepointInn = 0;
|
public byte homepointInn = 0;
|
||||||
|
|
||||||
//Instancing
|
//Retainer
|
||||||
|
RetainerMeetingRelationGroup retainerMeetingGroup = null;
|
||||||
public Retainer currentSpawnedRetainer = null;
|
public Retainer currentSpawnedRetainer = null;
|
||||||
public bool sentRetainerSpawn = false;
|
public bool sentRetainerSpawn = false;
|
||||||
|
|
||||||
|
@ -1742,30 +1743,30 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
chocoboAppearance = appearanceId;
|
chocoboAppearance = appearanceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SpawnMyRetainer(Npc bell, int retainerIndex)
|
public Retainer SpawnMyRetainer(Npc bell, int retainerIndex)
|
||||||
{
|
{
|
||||||
Tuple<uint, uint, string> retainerData = Database.GetRetainer(this, retainerIndex);
|
Tuple<uint, uint, string> retainerData = Database.GetRetainer(this, retainerIndex);
|
||||||
|
|
||||||
ActorClass actorClass = Server.GetWorldManager().GetActorClass(retainerData.Item2);
|
ActorClass actorClass = Server.GetWorldManager().GetActorClass(retainerData.Item2);
|
||||||
|
|
||||||
if (actorClass == null)
|
if (actorClass == null)
|
||||||
return false;
|
return null;
|
||||||
|
|
||||||
float distance = (float)Math.Sqrt(((positionX - bell.positionX) * (positionX - bell.positionX)) + ((positionZ - bell.positionZ) * (positionZ - bell.positionZ)));
|
float distance = (float)Math.Sqrt(((positionX - bell.positionX) * (positionX - bell.positionX)) + ((positionZ - bell.positionZ) * (positionZ - bell.positionZ)));
|
||||||
float posX = bell.positionX - ((-1.0f * (bell.positionX - positionX)) / distance);
|
float posX = bell.positionX - ((-1.0f * (bell.positionX - positionX)) / distance);
|
||||||
float posZ = bell.positionZ - ((-1.0f * (bell.positionZ - positionZ)) / distance);
|
float posZ = bell.positionZ - ((-1.0f * (bell.positionZ - positionZ)) / distance);
|
||||||
|
|
||||||
Retainer retainer = new Retainer(retainerData.Item1, retainerData.Item3, actorClass, this, posX, bell.positionY, positionZ, (float)Math.Atan2(positionX - posX, positionZ - posZ));
|
Retainer retainer = new Retainer(retainerData.Item3, actorClass, this, posX, bell.positionY, positionZ, (float)Math.Atan2(positionX - posX, positionZ - posZ));
|
||||||
|
|
||||||
retainer.LoadEventConditions(actorClass.eventConditions);
|
retainer.LoadEventConditions(actorClass.eventConditions);
|
||||||
|
|
||||||
//RetainerMeetingRelationGroup group = new RetainerMeetingRelationGroup(5555, this, retainer);
|
retainerMeetingGroup = new RetainerMeetingRelationGroup(5555, this, retainer);
|
||||||
//group.SendGroupPackets(playerSession);
|
retainerMeetingGroup.SendGroupPackets(playerSession);
|
||||||
|
|
||||||
currentSpawnedRetainer = retainer;
|
currentSpawnedRetainer = retainer;
|
||||||
sentRetainerSpawn = false;
|
sentRetainerSpawn = false;
|
||||||
|
|
||||||
return true;
|
return retainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DespawnMyRetainer()
|
public void DespawnMyRetainer()
|
||||||
|
@ -1773,6 +1774,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
if (currentSpawnedRetainer != null)
|
if (currentSpawnedRetainer != null)
|
||||||
{
|
{
|
||||||
currentSpawnedRetainer = null;
|
currentSpawnedRetainer = null;
|
||||||
|
retainerMeetingGroup.SendDeletePacket(playerSession);
|
||||||
|
retainerMeetingGroup = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue