Implemented mode trade methods. Figured out the modifiers portion of the item packet and rewrote how they are stored.

This commit is contained in:
Filip Maj 2017-10-08 12:26:22 -04:00
parent 94491903f7
commit 59e3b2379a
6 changed files with 300 additions and 116 deletions

View file

@ -46,6 +46,7 @@ namespace FFXIVClassic_Map_Server
public Dictionary<ulong, RelationGroup> mRelationGroups = new Dictionary<ulong, RelationGroup>();
public Dictionary<ulong, TradeGroup> mTradeGroups = new Dictionary<ulong, TradeGroup>();
private Object groupLock = new Object();
private Object tradeLock = new Object();
public ulong groupIndexId = 1;
public WorldManager(Server server)
@ -902,7 +903,7 @@ namespace FFXIVClassic_Map_Server
}
public TradeGroup CreateTradeGroup(Player inviter, Player invitee)
{
{
lock (groupLock)
{
groupIndexId = groupIndexId | 0x0000000000000000;
@ -946,6 +947,11 @@ namespace FFXIVClassic_Map_Server
}
}
public void TradeTEST(Player player)
{
player.KickEventSpecial(Server.GetStaticActors("TradeExecuteCommand"), 0, "commandContent", null, null, null, 16, null, null, null, null, null);
}
public void AcceptTrade(Player invitee)
{
TradeGroup group = GetTradeGroup(invitee.actorId);
@ -958,13 +964,13 @@ namespace FFXIVClassic_Map_Server
Player inviter = (Player)invitee.GetZone().FindActorInArea(group.GetHost());
DeleteTradeGroup(group.groupIndex);
//DeleteTradeGroup(group.groupIndex);
inviter.StartTradeTransaction(invitee);
invitee.StartTradeTransaction(inviter);
inviter.KickEvent(Server.GetStaticActors("TradeExecuteCommand"), "commandContent", null, null, null, 16, null, null, null, null, null);
invitee.KickEvent(Server.GetStaticActors("TradeExecuteCommand"), "commandContent", null, null, null, 16, null, null, null, null, null);
inviter.KickEventSpecial(Server.GetStaticActors("TradeExecuteCommand"), 0, "commandContent", null, null, null, 16, null, null, null, null, null);
invitee.KickEventSpecial(Server.GetStaticActors("TradeExecuteCommand"), 0, "commandContent", null, null, null, 16, null, null, null, null, null);
}
public void CancelTradeTooFar(Player inviter)
@ -1023,6 +1029,20 @@ namespace FFXIVClassic_Map_Server
DeleteTradeGroup(group.groupIndex);
}
public void SwapTradedItems(Player p1, Player p2)
{
lock (tradeLock)
{
if (p1.IsTradeAccepted() && p2.IsTradeAccepted())
{
//move items around
p1.FinishTradeTransaction();
p2.FinishTradeTransaction();
}
}
}
public bool SendGroupInit(Session session, ulong groupId)
{
if (mContentGroups.ContainsKey(groupId))