-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParty.cs
More file actions
47 lines (40 loc) · 1.33 KB
/
Party.cs
File metadata and controls
47 lines (40 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Parties have to be structs in order to work with SyncLists.
namespace uMMORPG
{
public struct Party
{
// Guild.Empty for ease of use
public static Party Empty = new Party();
// properties
public int partyId;
public string[] members; // first one == master
public bool shareExperience;
public bool shareGold;
// helper properties
public string master => members != null && members.Length > 0 ? members[0] : "";
// statics
public static int Capacity = 8;
public static float BonusExperiencePerMember = 0.1f;
// if we create a party then always with two initial members
public Party(int partyId, string master, string firstMember)
{
// create members array
this.partyId = partyId;
members = new string[]{master, firstMember};
shareExperience = false;
shareGold = false;
}
public bool Contains(string memberName)
{
if (members != null)
foreach (string member in members)
if (member == memberName)
return true;
return false;
}
public bool IsFull()
{
return members != null && members.Length == Capacity;
}
}
}