mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-23 11:05:56 +02:00
Started implementing retainers. Added a instanced retainer spawn. Documented retainer scripts.
This commit is contained in:
parent
b5054debea
commit
f437b36f5a
19 changed files with 313 additions and 34 deletions
|
@ -83,7 +83,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public SubPacket CreateNamePacket()
|
||||
{
|
||||
return SetActorNamePacket.BuildPacket(actorId, displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 ? customDisplayName : "");
|
||||
return SetActorNamePacket.BuildPacket(actorId, customDisplayName != null ? 0 : displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 | customDisplayName != null ? customDisplayName : "");
|
||||
}
|
||||
|
||||
public SubPacket CreateSpeedPacket()
|
||||
|
|
31
FFXIVClassic Map Server/actors/chara/npc/Retainer.cs
Normal file
31
FFXIVClassic Map Server/actors/chara/npc/Retainer.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using FFXIVClassic_Map_Server.actors.chara.player;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.actors.chara.npc
|
||||
{
|
||||
class Retainer : Npc
|
||||
{
|
||||
public Retainer(uint id, string retainerName, ActorClass actorClass, Player player, float posX, float posY, float posZ, float rot)
|
||||
: base(0, actorClass, String.Format("_rtnre{0:x7}", id), player.GetZone(), posX, posY, posZ, rot, 0, 0, retainerName)
|
||||
{
|
||||
this.actorId = 0xD0000000 | id;
|
||||
}
|
||||
|
||||
public void SendBazaarItems(Player player)
|
||||
{
|
||||
Inventory bazaar = new Inventory(this, 4, Inventory.RETAINER_BAZAAR);
|
||||
bazaar.SendFullInventory(player);
|
||||
}
|
||||
|
||||
public void SendStorageItems(Player player)
|
||||
{
|
||||
Inventory storage = new Inventory(this, 4, 1);
|
||||
storage.SendFullInventory(player);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,10 +11,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||
{
|
||||
class Inventory
|
||||
{
|
||||
public const ushort NORMAL = 0x0000; //Max 0xC8
|
||||
public const ushort NORMAL = 0x0000; //Max 0xC8
|
||||
public const ushort TRADE = 0x0001; //Max 0x96
|
||||
public const ushort LOOT = 0x0004; //Max 0xA
|
||||
public const ushort MELDREQUEST = 0x0005; //Max 0x04
|
||||
public const ushort BAZAAR = 0x0007; //Max 0x0A
|
||||
public const ushort MELDREQUEST = 0x0005; //Max 0x04
|
||||
public const ushort BAZAAR = 0x0007; //Max 0x0A
|
||||
public const ushort RETAINER_BAZAAR = 0x0008; //????
|
||||
public const ushort CURRENCY = 0x0063; //Max 0x140
|
||||
public const ushort KEYITEMS = 0x0064; //Max 0x500
|
||||
public const ushort EQUIPMENT = 0x00FE; //Max 0x23
|
||||
|
|
|
@ -20,6 +20,7 @@ using FFXIVClassic_Map_Server.packets.send.actor.inventory;
|
|||
using FFXIVClassic_Map_Server.actors.group;
|
||||
using FFXIVClassic_Map_Server.packets.send.group;
|
||||
using FFXIVClassic_Map_Server.packets.WorldPackets.Send.Group;
|
||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
|
@ -134,6 +135,10 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
public uint homepoint = 0;
|
||||
public byte homepointInn = 0;
|
||||
|
||||
//Instancing
|
||||
public Retainer currentSpawnedRetainer = null;
|
||||
public bool sentRetainerSpawn = false;
|
||||
|
||||
private List<Director> ownedDirectors = new List<Director>();
|
||||
private Director loginInitDirector = null;
|
||||
|
||||
|
@ -1558,6 +1563,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
QueuePacket(InventoryEndChangePacket.BuildPacket(toBeExamined.actorId));
|
||||
}
|
||||
|
||||
public void SendMyTradeToPlayer(Player player)
|
||||
{
|
||||
Inventory tradeInventory = new Inventory(this, 4, Inventory.TRADE);
|
||||
tradeInventory.SendFullInventory(player);
|
||||
}
|
||||
|
||||
public void SendDataPacket(params object[] parameters)
|
||||
{
|
||||
List<LuaParam> lParams = LuaUtils.CreateLuaParamList(parameters);
|
||||
|
@ -1730,5 +1741,40 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
Database.ChangePlayerChocoboAppearance(this, appearanceId);
|
||||
chocoboAppearance = appearanceId;
|
||||
}
|
||||
|
||||
public bool SpawnMyRetainer(Npc bell, int retainerIndex)
|
||||
{
|
||||
Tuple<uint, uint, string> retainerData = Database.GetRetainer(this, retainerIndex);
|
||||
|
||||
ActorClass actorClass = Server.GetWorldManager().GetActorClass(retainerData.Item2);
|
||||
|
||||
if (actorClass == null)
|
||||
return false;
|
||||
|
||||
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 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.LoadEventConditions(actorClass.eventConditions);
|
||||
|
||||
//RetainerMeetingRelationGroup group = new RetainerMeetingRelationGroup(5555, this, retainer);
|
||||
//group.SendGroupPackets(playerSession);
|
||||
|
||||
currentSpawnedRetainer = retainer;
|
||||
sentRetainerSpawn = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void DespawnMyRetainer()
|
||||
{
|
||||
if (currentSpawnedRetainer != null)
|
||||
{
|
||||
currentSpawnedRetainer = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace FFXIVClassic_Map_Server.actors.group
|
|||
groupWork.addByte(Utils.MurmurHash2("contentGroupWork.property[0]", 0), 1);
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.id, session.id);
|
||||
SubPacket test = groupWork.buildPacket(session.id);
|
||||
test.DebugPrintSubPacket();
|
||||
session.QueuePacket(test);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace FFXIVClassic_Map_Server.actors.group
|
|||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.id, session.id);
|
||||
SubPacket test = groupWork.buildPacket(session.id);
|
||||
session.QueuePacket(test);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace FFXIVClassic_Map_Server.actors.group
|
|||
groupWork.addProperty(this, "work._globalTemp.variableCommand");
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.id, session.id);
|
||||
SubPacket test = groupWork.buildPacket(session.id);
|
||||
test.DebugPrintSubPacket();
|
||||
session.QueuePacket(test);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using FFXIVClassic_Map_Server.dataobjects;
|
||||
using FFXIVClassic_Map_Server.packets.send.group;
|
||||
using FFXIVClassic_Map_Server.packets.send.groups;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.actors.group
|
||||
{
|
||||
class RetainerMeetingRelationGroup : Group
|
||||
{
|
||||
Player player;
|
||||
Retainer retainer;
|
||||
|
||||
public RetainerMeetingRelationGroup(ulong groupIndex, Player player, Retainer retainer)
|
||||
: base(groupIndex)
|
||||
{
|
||||
this.player = player;
|
||||
this.retainer = retainer;
|
||||
}
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList(uint id)
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
|
||||
groupMembers.Add(new GroupMember(player.actorId, -1, 0x83, false, true, player.customDisplayName));
|
||||
groupMembers.Add(new GroupMember(retainer.actorId, -1, 0x83, false, true, retainer.customDisplayName));
|
||||
|
||||
return groupMembers;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return 50003;
|
||||
}
|
||||
|
||||
public override void SendInitWorkValues(Session session)
|
||||
{
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.id);
|
||||
test.DebugPrintSubPacket();
|
||||
session.QueuePacket(test);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue