using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FiestaBot.Instances.Networking;
using FiestaBot.Manager.ClientPacket;
using FiestaBot.Manager.Networking;
using FiestaBot.Zone.Game;

namespace FiestaBot.Manager.Handlers
{
    internal class Manager14Handler
    {
        [ManagerPacketHandler(14, 3)]
        public static void PartyIncomingInvite(ManagerClient Socket, Packet Packet)
        {
            Packet.ReadString(out string InvitedBy, 16);
            Packet.Dispose();

            //reject
            ManagerPacket.SendPartyReject(Socket, InvitedBy);
        }

        [ManagerPacketHandler(14, 7)]
        public static void PartyResponse(ManagerClient Socket, Packet Packet)
        {
            Packet.ReadString(out string PartyMember, 16);
            Packet.ReadShort(out short Response);

            if(Response == 1217)
            {
                Socket.InParty = true; 
                Chat.Party(Socket, "Hi, {0}. Seems like we successfully created a party, enjoy!", PartyMember);
            }

            Packet.Dispose();
        }

        [ManagerPacketHandler(14, 11)]
        public static void PartyLeave(ManagerClient Socket, Packet Packet)
        {
            Packet.ReadString(out string PartyMember, 16);
            Packet.ReadShort(out short Status);

            Socket.InParty = false;

            Packet.Dispose();
        }

        [ManagerPacketHandler(14, 30)]
        public static void PartyDestroy(ManagerClient Socket, Packet Packet)
        {
            Socket.InParty = false;

            Packet.Dispose();
        }
    }
}
