/// <summary> /// creates a single contact information /// </summary> /// <param name="player">player</param> /// <param name="target">targetUser</param> /// <returns></returns> public static UserContacts createContact(Core.User player, Core.User targetUser) { UserContacts knownUsers = new UserContacts(); knownUsers.knownUser = new List <UserContact>(); SpacegameServer.Core.FullDiplomaticRelationProposals targetRelation = Core.Core.Instance.userRelations.getDiplomaticsToUser(player, targetUser); knownUsers.knownUser.Add( new UserContact(targetUser.id, targetUser.username, targetRelation.relation, targetRelation.relationSenderProposal, targetRelation.relationTargetProposal, //Math.Min(relations.Key, relations.Value), relations.Key, relations.Value, targetUser.popVicPoints, targetUser.researchVicPoints, targetUser.goodsVicPoints, targetUser.shipVicPoints, targetUser.overallVicPoints, targetUser.overallRank, targetUser.allianceId, targetUser.AiId, targetUser.AiRelation, targetUser.ProfileUrl) ); return(knownUsers); }
/// <summary> /// creates all contact Informations /// </summary> /// <param name="player"></param> /// <returns></returns> public static UserContacts createAllContacts(Core.User player) { UserContacts knownUsers = new UserContacts(); knownUsers.knownUser = new List <UserContact>(); foreach (var targetRelation in Core.Core.Instance.userRelations.getAllDiplomatics(player, 1)) { Core.User targetUser = (Core.User)targetRelation.target; knownUsers.knownUser.Add( new UserContact(targetUser.id, targetUser.username, targetRelation.relation, targetRelation.relationSenderProposal, targetRelation.relationTargetProposal, //Math.Min(relations.Key, relations.Value), relations.Key, relations.Value, targetUser.popVicPoints, targetUser.researchVicPoints, targetUser.goodsVicPoints, targetUser.shipVicPoints, targetUser.overallVicPoints, targetUser.overallRank, targetUser.allianceId, targetUser.AiId, targetUser.AiRelation, targetUser.ProfileUrl) ); } return(knownUsers); }
/// <summary> /// creates a single contact information /// </summary> /// <param name="player"></param> /// <param name="target"></param> /// <returns></returns> public static UserContacts createContacts(Core.User player, int target) { UserContacts knownUsers = new UserContacts(); knownUsers.knownUser = new List <UserContact>(); foreach (var targetRelation in Core.Core.Instance.userRelations.getDiplomatics(player, 1)) { Core.User targetUser = (Core.User)targetRelation.target; knownUsers.knownUser.Add( new UserContact(targetUser.id, targetUser.username, targetRelation.relation, targetRelation.relationSenderProposal, targetRelation.relationTargetProposal, //Math.Min(relations.Key, relations.Value), relations.Key, relations.Value, targetUser.popVicPoints, targetUser.researchVicPoints, targetUser.goodsVicPoints, targetUser.shipVicPoints, targetUser.overallVicPoints, targetUser.overallRank, targetUser.allianceId, targetUser.AiId, targetUser.AiRelation, targetUser.ProfileUrl) ); } /* * foreach(var targetRelation in Core.Core.Instance.userRelations.getUserRelationsForUser(player)) * { * //skip others if single player data is requested * if (target != 0 && targetRelation.Key != target) continue; * Core.User targetUser = Core.Core.Instance.users[targetRelation.Key]; * * var relations = Core.Core.Instance.userRelations.getProposals(player, targetUser); * * knownUsers.knownUser.Add( * new UserContact(targetUser.id, targetUser.username, * Math.Min(relations.Key, relations.Value), relations.Key, relations.Value, * targetUser.popVicPoints, * targetUser.researchPoints, * targetUser.goodsVicPoints, * targetUser.shipVicPoints, * targetUser.overallVicPoints, * targetUser.overallRank, * targetUser.allianceId) * ); * * } */ return(knownUsers); }