public void GroupInvite(bool accept) { if (GroupInvitation == null) { ReceiveChat("You have not been invited to a group.", ChatType.System); return; } if (!accept) { GroupInvitation.ReceiveChat(Name + " has declined your group invite.", ChatType.System); GroupInvitation = null; return; } if (GroupInvitation.GroupMembers != null && GroupInvitation.GroupMembers[0] != GroupInvitation) { ReceiveChat(GroupInvitation.Name + " is no longer the group leader.", ChatType.System); GroupInvitation = null; return; } if (GroupInvitation.GroupMembers != null && GroupInvitation.GroupMembers.Count >= Globals.MaxGroup) { ReceiveChat(GroupInvitation.Name + "'s group already has the maximum number of members.", ChatType.System); GroupInvitation = null; return; } if (!GroupInvitation.AllowGroup) { ReceiveChat(GroupInvitation.Name + " is not on allow group.", ChatType.System); GroupInvitation = null; return; } if (GroupInvitation.Node == null) { ReceiveChat(GroupInvitation.Name + " no longer online.", ChatType.System); GroupInvitation = null; return; } if (GroupInvitation.GroupMembers == null) { GroupInvitation.GroupMembers = new List<PlayerObject> { GroupInvitation }; GroupInvitation.Enqueue(new S.AddMember { Name = GroupInvitation.Name }); } Packet p = new S.AddMember { Name = Name }; GroupMembers = GroupInvitation.GroupMembers; GroupInvitation = null; for (int i = 0; i < GroupMembers.Count; i++) { PlayerObject member = GroupMembers[i]; member.Enqueue(p); Enqueue(new S.AddMember { Name = member.Name }); if (CurrentMap != member.CurrentMap || !Functions.InRange(CurrentLocation, member.CurrentLocation, Globals.DataRange)) continue; byte time = Math.Min(byte.MaxValue, (byte)Math.Max(5, (RevTime - Envir.Time) / 1000)); member.Enqueue(new S.ObjectHealth { ObjectID = ObjectID, Percent = member.PercentHealth, Expire = time }); Enqueue(new S.ObjectHealth { ObjectID = member.ObjectID, Percent = member.PercentHealth, Expire = time }); } GroupMembers.Add(this); Enqueue(p); }
public void GroupInvite(bool accept) { if (GroupInvitation == null) { ReceiveChat("You have not been invited to a group.", ChatType.System); return; } if (!accept) { GroupInvitation.ReceiveChat(Name + " has declined your group invite.", ChatType.System); GroupInvitation = null; return; } if (GroupInvitation.GroupMembers != null && GroupInvitation.GroupMembers[0] != GroupInvitation) { ReceiveChat(GroupInvitation.Name + " is no longer the group leader.", ChatType.System); GroupInvitation = null; return; } if (GroupInvitation.GroupMembers != null && GroupInvitation.GroupMembers.Count >= Globals.MaxGroup) { ReceiveChat(GroupInvitation.Name + "'s group already has the maximum number of members.", ChatType.System); GroupInvitation = null; return; } if (!GroupInvitation.AllowGroup) { ReceiveChat(GroupInvitation.Name + " is not on allow group.", ChatType.System); GroupInvitation = null; return; } if (GroupInvitation.Node == null) { ReceiveChat(GroupInvitation.Name + " no longer online.", ChatType.System); GroupInvitation = null; return; } if (GroupInvitation.GroupMembers == null) { GroupInvitation.GroupMembers = new List<PlayerObject> { GroupInvitation }; GroupInvitation.Enqueue(new S.AddMember { Name = GroupInvitation.Name }); } Packet p = new S.AddMember { Name = Name }; GroupMembers = GroupInvitation.GroupMembers; GroupInvitation = null; for (int i = 0; i < GroupMembers.Count; i++) { PlayerObject member = GroupMembers[i]; member.Enqueue(p); Enqueue(new S.AddMember { Name = member.Name }); if (CurrentMap != member.CurrentMap || !Functions.InRange(CurrentLocation, member.CurrentLocation, Globals.DataRange)) continue; byte time = Math.Min(byte.MaxValue, (byte)Math.Max(5, (RevTime - Envir.Time) / 1000)); member.Enqueue(new S.ObjectHealth { ObjectID = ObjectID, Percent = PercentHealth, Expire = time }); Enqueue(new S.ObjectHealth { ObjectID = member.ObjectID, Percent = member.PercentHealth, Expire = time }); for (int j = 0; j < member.Pets.Count; j++) { MonsterObject pet = member.Pets[j]; Enqueue(new S.ObjectHealth { ObjectID = pet.ObjectID, Percent = pet.PercentHealth, Expire = time }); } } GroupMembers.Add(this); //Adding Buff on for marriage if (GroupMembers != null) for (int i = 0; i < GroupMembers.Count; i++) { PlayerObject player = GroupMembers[i]; if (Info.Married == player.Info.Index) { AddBuff(new Buff { Type = BuffType.RelationshipEXP, Caster = player, ExpireTime = Envir.Time * 1000, Infinite = true, Values = new int[] { Settings.LoverEXPBonus } }); player.AddBuff(new Buff { Type = BuffType.RelationshipEXP, Caster = this, ExpireTime = Envir.Time * 1000, Infinite = true, Values = new int[] { Settings.LoverEXPBonus } }); } if (Info.Mentor == player.Info.Index) { if (Info.isMentor) { player.AddBuff(new Buff { Type = BuffType.Mentee, Caster = player, ExpireTime = Envir.Time * 1000, Infinite = true, Values = new int[] { Settings.MentorExpBoost } }); AddBuff(new Buff { Type = BuffType.Mentor, Caster = this, ExpireTime = Envir.Time * 1000, Infinite = true, Values = new int[] { Settings.MentorDamageBoost } }); } else { AddBuff(new Buff { Type = BuffType.Mentee, Caster = player, ExpireTime = Envir.Time * 1000, Infinite = true, Values = new int[] { Settings.MentorExpBoost } }); player.AddBuff(new Buff { Type = BuffType.Mentor, Caster = this, ExpireTime = Envir.Time * 1000, Infinite = true, Values = new int[] { Settings.MentorDamageBoost } }); } } } for (int j = 0; j < Pets.Count; j++) Pets[j].BroadcastHealthChange(); Enqueue(p); }
private static void AddMember(S.AddMember p) => gameManager.AddMemberToGroup(p.Name);