public void PartyChangeLootMode(Common.Party.Party party, PartyLootMode mode, byte rank, ulong actorID) { if (party != null) { party.LootMode = mode; party.AuctionItemRank = rank; party.SpecifiedLooter = null; if (actorID != 0) { foreach (ActorPC i in party.Members) { if (i.ActorID == actorID) { party.SpecifiedLooter = i; break; } } } foreach (ActorPC i in party.Members) { GameSession client = i.Client(); client?.SendPartyChangeLootMode(mode, rank, actorID); } } }
public void PartyMemberDirUpdate(Common.Party.Party party, ActorPC pc) { if (party != null) { UpdateEvent evt = new UpdateEvent(); evt.AddActorPara(Common.Packets.GameServer.PacketParameter.Dir, pc.Dir); PartyMemberUpdate(party, evt, pc); } }
private void PartyMemberUpdate(Common.Party.Party party, UpdateEvent evt, ActorPC pc) { foreach (ActorPC i in party.Members) { if (i != pc) { GameSession client = i.Client(); client?.SendPartyMemberUpdate(pc, evt); } } }
public ActorPC PartyGetMember(Common.Party.Party party, uint charID) { if (party != null) { foreach (ActorPC i in party.Members) { if (i.CharID == charID) { return(i); } } } return(null); }
public void PartyMemberKick(Common.Party.Party party, string name) { if (party != null) { foreach (ActorPC i in party.Members) { if (i.Name == name) { PartyMemberQuit(party, i); return; } } } }
public void PartyChangeLeader(Common.Party.Party party, ActorPC newLeader) { if (party?.Members.Contains(newLeader) == true) { party.Leader = newLeader; ActorPC backup = party.Members[0]; party.Members.Remove(newLeader); party.Members.Insert(0, newLeader); foreach (ActorPC i in party.Members) { GameSession client = i.Client(); client?.SendPartyLeaderChange(); } } }
public void PartyMemberQuit(Common.Party.Party party, ActorPC pc) { if (party?.Members.Contains(pc) == true) { pc.Party = null; pc.PartyID = 0; foreach (ActorPC i in party.Members) { GameSession client = i.Client(); client?.SendPartyMemberLeave(i.Name); } party.Members.Remove(pc); if (party.Members.Count <= 1) { if (party.Members.Count > 0) { GameSession client = party.Members[0].Client(); client?.SendPartyMemberLeave(client.Character.Name); client.Character.PartyID = 0; client.Character.Party = null; } party.Leader = null; party.Members.Clear(); parties.TryRemove(party.PartyID, out party); } else { if (party.Leader == pc) { PartyChangeLeader(party, party.Members[0]); } if (party.SpecifiedLooter == pc) { PartyChangeLootMode(party, party.LootMode, party.AuctionItemRank, party.Leader.ActorID); } } } }
public void PartyMemberOfflineChange(Common.Party.Party party, ActorPC pc, bool offline) { pc.Offline = offline; if (party != null) { if (party.Leader == pc) { PartyChangeLeader(party, party.Members[1]); } foreach (ActorPC i in party.Members) { if (i == pc && !offline) { i.Client().SendPartyInfo(); } else { GameSession client = i.Client(); client?.SendPartyMemberOnlineStatusChange(pc); } } } }
public Common.Party.Party NewParty(ulong id, ActorPC leader, params ActorPC[] members) { if (!parties.ContainsKey(id)) { Common.Party.Party party = new Common.Party.Party(); leader.PartyID = id; leader.Party = party; foreach (ActorPC i in members) { i.PartyID = id; i.Party = party; } party.PartyID = id; party.Leader = leader; party.Members.Add(leader); party.Members.AddRange(members); parties[id] = party; return(party); } else { return(null); } }