Exemplo n.º 1
0
        public static bool Prefix(NetPackageQuestGotoPoint __instance, World _world, string ___biomeFilter, int ___playerId, int ___questCode, QuestTags ___questTags, byte ___difficulty, Vector2 ___position, Vector3 ___size)
        {
            if (_world == null)
            {
                return(true);
            }

            // Only check if the biomeFilter is being used as a POI name
            if (String.IsNullOrEmpty(___biomeFilter))
            {
                return(true);
            }

            PrefabInstance prefabInstance = GameManager.Instance.World.ChunkClusters[0].ChunkProvider.GetDynamicPrefabDecorator().GetPOIPrefabs().Find(instance => instance.name.Contains(___biomeFilter));

            if (prefabInstance == null)
            {
                return(true);
            }

            if (SingletonMonoBehaviour <ConnectionManager> .Instance.IsServer)
            {
                for (int i = 0; i < 5; i++)
                {
                    if (__instance.GotoType == NetPackageQuestGotoPoint.QuestGotoTypes.RandomPOI)
                    {
                        if (prefabInstance != null)
                        {
                            SingletonMonoBehaviour <ConnectionManager> .Instance.SendPackage(NetPackageManager.GetPackage <NetPackageQuestGotoPoint>().Setup(___playerId, ___questTags, ___questCode, __instance.GotoType, ___difficulty, prefabInstance.boundingBoxPosition.x, prefabInstance.boundingBoxPosition.z, prefabInstance.boundingBoxSize.x, prefabInstance.boundingBoxSize.y, prefabInstance.boundingBoxSize.z, -1f, BiomeFilterTypes.AnyBiome, ___biomeFilter), false, ___playerId, -1, -1, -1);

                            return(false);
                        }
                    }
                }
                return(true);
            }

            EntityPlayer primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
            Quest        quest         = primaryPlayer.QuestJournal.FindActiveQuest(___questCode);

            if (quest != null)
            {
                for (int j = 0; j < quest.Objectives.Count; j++)
                {
                    if (quest.Objectives[j] is ObjectiveRandomPOIGoto && __instance.GotoType == NetPackageQuestGotoPoint.QuestGotoTypes.RandomPOI)
                    {
                        ((ObjectiveRandomPOIGoto)quest.Objectives[j]).FinalizePoint(new Vector3(___position.x, primaryPlayer.position.y, ___position.y), ___size);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        private static PrefabInstance GetPrefab(IList <string> _params, Vector3 position, QuestTags tag, DynamicPrefabDecorator decorator)
        {
            PrefabInstance prefab;

            if (_params.Count > 1)
            {
                if (!int.TryParse(_params[1], out var id))
                {
                    Api.Log($"Unable to parse {_params[1]} as a number");

                    return(null);
                }
                prefab = decorator.GetPrefab(id);
            }
            else
            {
                prefab = decorator.GetClosestPOIToWorldPos(tag, position);
            }

            return(prefab);
        }
Exemplo n.º 3
0
        public static bool Prefix(Prefab __instance, ref Vector3i _destinationPos, ChunkCluster _cluster, QuestTags _questTags)
        {
            // If they are pre-generated Winter Project worlds, don't apply this. They'd have already been applied.
            if (GamePrefs.GetString(EnumGamePrefs.GameWorld).ToLower().Contains("winter project"))
            {
                return(true);
            }

            _destinationPos.y -= 8;
            return(true);
        }
Exemplo n.º 4
0
    public static void SetSnowPrefab(Prefab prefab, ChunkCluster cluster, Vector3i position, QuestTags _questTag)
    {
        bool AlreadyFilled = false;

        if (_questTag != QuestTags.none)
        {
            AlreadyFilled = true;
            //Debug.Log("POI is resetting for a quest.");
        }
        SetSnow(position.x, position.z, prefab.size.x, prefab.size.z, cluster, Rpc, Logging, AlreadyFilled);
    }
Exemplo n.º 5
0
 public static void Postfix(Prefab __instance, Vector3i _destinationPos, ChunkCluster _cluster, QuestTags _questTags)
 {
     WinterModPrefab.SetSnowPrefab(__instance, _cluster, _destinationPos, _questTags);
 }