PSO2SERVER/Server/Party/Party.cs

81 lines
1.8 KiB
C#
Raw Normal View History

2024-09-10 01:13:20 +08:00
using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;
2024-09-10 00:31:40 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
2024-09-10 01:13:20 +08:00
namespace PSO2SERVER.Party
2024-09-10 00:31:40 +08:00
{
public class Party
{
2024-11-25 23:33:41 +08:00
public enum PartyColor : byte
{
Red,
Green,
Yellow,
Blue,
}
2024-09-10 00:31:40 +08:00
public string name;
private List<Client> members;
private Client host;
public Quest currentQuest;
public Party(string name, Client host)
{
this.name = name;
this.host = host;
this.members = new List<Client>();
addClientToParty(host);
}
public void addClientToParty(Client c)
{
if (members.Count < 1)
{
c.SendPacket(new PartyInitPacket(new Models.Character[1] { c.Character }));
}
else
{
// ???
}
members.Add(c);
c.currentParty = this;
}
public void removeClientFromParty(Client c)
{
if(!members.Contains(c))
{
2024-09-20 21:58:37 +08:00
Logger.WriteWarning("[PTY] Client {0} was trying to be removed from {1}, but he was never in {1}!", c._account.Username, name);
2024-09-10 00:31:40 +08:00
return;
}
members.Remove(c);
//TODO do stuff like send the "remove from party" packet.
}
public bool hasClientInParty(Client c)
{
return members.Contains(c);
}
public Client getPartyHost()
{
return host;
}
public int getSize()
{
return members.Count;
}
public List<Client> getMembers()
{
return members;
}
}
}