public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			GroupMemberReference group = null;
			if ( json != null && !json.IsNull )
			{
				group = new GroupMemberReference();
				group.ID            = json.ContainsName("id"           ) ? json.GetValue<string>("id"           ) : String.Empty;
				group.Name          = json.ContainsName("name"         ) ? json.GetValue<string>("name"         ) : String.Empty;
				group.Administrator = json.ContainsName("administrator") ? json.GetValue<bool  >("administrator") : false;
			}
			return group;
		}
Example #2
0
        public object Deserialize(JsonValue json, JsonMapper mapper)
        {
            GroupMemberReference group = null;

            if (json != null && !json.IsNull)
            {
                group               = new GroupMemberReference();
                group.ID            = json.ContainsName("id") ? json.GetValue <string>("id") : String.Empty;
                group.Name          = json.ContainsName("name") ? json.GetValue <string>("name") : String.Empty;
                group.Administrator = json.ContainsName("administrator") ? json.GetValue <bool>("administrator") : false;
            }
            return(group);
        }
        private static void DoGroupMemberAddedSession(GroupMemberAddedSession groupMemberAddedSession)
        {
            Group group;

            if (!GroupManager.Instance.TryGetGroup(groupMemberAddedSession.GroupGuid, out group))
            {
                _logger.WarnFormat("[DoGroupMemberAddedSession]: Group (Guid={0}) not found.", groupMemberAddedSession.GroupGuid);
                return;
            }

            WorldSession session;

            if (MmoWorld.Instance.SessionCache.TryGetSessionBySessionId(groupMemberAddedSession.SessionId, out session))
            {
                group.AddMember(session.Player);
            }
            else
            {
                var memberInfo      = groupMemberAddedSession.MemberInfo;
                var memberReference = new GroupMemberReference(memberInfo.Guid, groupMemberAddedSession.SessionId, memberInfo.Name, MmoWorld.Instance.Server);
                group.AddMember(memberReference);
            }
        }