public static void AddCommonZoneScopeDataComponents(DataEntityCollection dataEntityCollection, DataEntityHandle handle) { if (!dataEntityCollection.HasComponent <LocomotionData>(handle)) { dataEntityCollection.AddComponent <LocomotionData>(handle); } if (!dataEntityCollection.HasComponent <PositionData>(handle)) { dataEntityCollection.AddComponent <PositionData>(handle); } if (!dataEntityCollection.HasComponent <ChatHistoryData>(handle)) { dataEntityCollection.AddComponent <ChatHistoryData>(handle); } }
public static void AddCommonDataComponents(DataEntityCollection dataEntityCollection, DataEntityHandle handle) { if (!dataEntityCollection.HasComponent <TubeData>(handle)) { dataEntityCollection.AddComponent <TubeData>(handle); } if (!dataEntityCollection.HasComponent <HeldObjectsData>(handle)) { dataEntityCollection.AddComponent <HeldObjectsData>(handle); } if (!dataEntityCollection.HasComponent <PresenceData>(handle)) { dataEntityCollection.AddComponent <PresenceData>(handle); } }
public static void AddLocalPlayerSessionScopeDataComponents(DataEntityCollection dataEntityCollection, DataEntityHandle handle) { if (!dataEntityCollection.HasComponent <CoinsData>(handle)) { dataEntityCollection.AddComponent <CoinsData>(handle); } if (!dataEntityCollection.HasComponent <CollectiblesData>(handle)) { dataEntityCollection.AddComponent <CollectiblesData>(handle); } if (!dataEntityCollection.HasComponent <ConsumableInventoryData>(handle)) { dataEntityCollection.AddComponent <ConsumableInventoryData>(handle); } if (!dataEntityCollection.HasComponent <MiniGamePlayCountData>(handle)) { dataEntityCollection.AddComponent <MiniGamePlayCountData>(handle); } }
private static DataEntityHandle createRemotePlayerEntity(DataEntityCollection dataEntityCollection, string displayName) { if (!dataEntityCollection.TryFindEntity <DisplayNameData, string>(displayName, out DataEntityHandle dataEntityHandle)) { dataEntityHandle = dataEntityCollection.AddEntity("rp_" + displayName); } if (!dataEntityCollection.HasComponent <DisplayNameData>(dataEntityHandle)) { dataEntityCollection.AddComponent <DisplayNameData>(dataEntityHandle).DisplayName = displayName; } return(dataEntityHandle); }
private static void setClaimedRewardIds(DataEntityCollection dataEntityCollection, DataEntityHandle handle, List <int> claimedRewardIds) { if (!dataEntityCollection.HasComponent <ClaimedRewardIdsData>(handle)) { dataEntityCollection.AddComponent <ClaimedRewardIdsData>(handle); } if (claimedRewardIds != null && claimedRewardIds.Count > 0) { ClaimedRewardIdsData component = dataEntityCollection.GetComponent <ClaimedRewardIdsData>(handle); component.RewardIds = claimedRewardIds; } }
public static DataEntityHandle AddLocalPlayerProfileDataComponents(DataEntityCollection dataEntityCollection, LocalPlayerData data, bool isOnline = false) { DataEntityHandle dataEntityHandle = dataEntityCollection.FindEntityByName("LocalPlayer"); if (dataEntityHandle.IsNull) { return(dataEntityHandle); } if (data == null) { return(dataEntityHandle); } if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out DisplayNameData component2)) { component2 = dataEntityCollection.AddComponent <DisplayNameData>(dataEntityHandle); } component2.DisplayName = data.name; if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out QuestStateData component3)) { component3 = dataEntityCollection.AddComponent <QuestStateData>(dataEntityHandle); } component3.Data = data.quests; if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out AvatarDetailsData component4)) { component4 = dataEntityCollection.AddComponent <AvatarDetailsData>(dataEntityHandle); component4.BodyColor = AvatarService.DefaultBodyColor; component4.Outfit = new DCustomEquipment[0]; } if (data.outfit != null && data.outfit.Count > 0) { component4.Outfit = CustomEquipmentResponseAdaptor.ConvertResponseToOutfit(data.outfit); } if (data.profile != null) { Dictionary <int, AvatarColorDefinition> avatarColors = Service.Get <GameData>().Get <Dictionary <int, AvatarColorDefinition> >(); component4.BodyColor = AvatarBodyColorAdaptor.GetColorFromDefinitions(avatarColors, data.profile.colour); } if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out ProfileData component5)) { component5 = dataEntityCollection.AddComponent <ProfileData>(dataEntityHandle); } component5.PenguinAgeInDays = ((data.profile != null) ? data.profile.daysOld : 0); component5.IsOnline = isOnline; component5.IsMigratedPlayer = (data.migrationData != null && data.migrationData.status.Equals("MIGRATED")); component5.ZoneId = data.zoneId; if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out MembershipData component6)) { component6 = dataEntityCollection.AddComponent <MembershipData>(dataEntityHandle); } component6.IsMember = data.member; component6.MembershipType = (data.member ? MembershipType.Member : MembershipType.None); component6.MembershipExpireDate = data.membershipExpireDate; component6.MembershipTrialAvailable = data.trialAvailable; if (!component6.IsMember && Service.Get <AllAccessService>().IsAllAccessActive()) { component6.IsMember = true; component6.MembershipType = MembershipType.AllAccessEventMember; } logPlayerStatusBI(data); if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out SubscriptionData component7)) { component7 = dataEntityCollection.AddComponent <SubscriptionData>(dataEntityHandle); } component7.SubscriptionVendor = data.subscriptionVendor; component7.SubscriptionProductId = data.subscriptionProductId; component7.SubscriptionPaymentPending = data.subscriptionPaymentPending; component7.SubscriptionRecurring = data.recurring; if (data.migrationData != null && data.migrationData.legacyAccountData != null) { if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out LegacyProfileData component8)) { component8 = dataEntityCollection.AddComponent <LegacyProfileData>(dataEntityHandle); } component8.Username = data.migrationData.legacyAccountData.username; component8.IsMember = data.migrationData.legacyAccountData.member; component8.CreatedDate = data.migrationData.legacyAccountData.createdDate; component8.MigratedDate = data.migrationData.migratedDate; } byte[] array = new byte[data.tutorialData.Count]; for (int i = 0; i < array.Length; i++) { array[i] = (byte)data.tutorialData[i]; } if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out TutorialData component9)) { component9 = dataEntityCollection.AddComponent <TutorialData>(dataEntityHandle); } component9.Data = new BitArray(array); switch (data.id.type) { case PlayerId.PlayerIdType.SESSION_ID: if (!dataEntityCollection.HasComponent <SessionIdData>(dataEntityHandle)) { dataEntityCollection.AddComponent(dataEntityHandle, delegate(SessionIdData component) { component.SessionId = Convert.ToInt64(data.id.id); }); } break; case PlayerId.PlayerIdType.SWID: if (!dataEntityCollection.HasComponent <SwidData>(dataEntityHandle)) { dataEntityCollection.AddComponent <SwidData>(dataEntityHandle).Swid = data.id.id; } break; } setClaimedRewardIds(dataEntityCollection, dataEntityHandle, data.claimedRewardIds); addDailySpinDataComponent(dataEntityCollection, dataEntityHandle, data); return(dataEntityHandle); }