Esempio n. 1
0
    public ArtifactState SaveArtifact()
    {
        ArtifactState ad = new ArtifactState();

        ad.artifactType = GetType().ToString();
        ad.level        = level;

        return(ad);
    }
Esempio n. 2
0
    public void LoadArtifact(ArtifactState aState)
    {
        //Need checks on type here? Checks should be performed beforehand but look here if it causes issues

        level = aState.level;

        if (level > 0)
        {
            isOwned = true;
            Activate();
        }
    }
Esempio n. 3
0
 /// <summary>
 /// Обновляет текущее состояние артефактов.
 /// </summary>
 /// <param name="artifactState">Новое состояние.</param>
 public void UpdateArtifactState(ArtifactState artifactState)
 {
     Apply(new ArtifactStateChanged(artifactState, CreateMetadata()));
 }
Esempio n. 4
0
        public void AquireLastOffer()
        {
            if (LastOfferItems == null || string.IsNullOrEmpty(LastOfferType))
            {
                return;
            }

            Player.Local.Inventory.InventoryBank.AddBaseCurrencyOfType(LastOfferMade, WICurrencyType.A_Bronze);

            for (int i = 0; i < LastOfferItems.Count; i++)
            {
                mLastOfferItem = LastOfferItems[i];
                //update which items we've aquired
                switch (LastOfferType)
                {
                case "UndatedShard":
                    ActiveMuseum.UndatedShardAquired++;
                    break;

                case "UndatedSmall":
                    ActiveMuseum.UndatedSmallAquired++;
                    break;

                case "DatedShard":
                    if (mLastOfferItem.GetStateOf <ArtifactShard>(out mArtifactStateObject))
                    {
                        mArtifactShardState = (ArtifactShardState)mArtifactStateObject;
                        ActiveMuseum.DatedShardsAquired.Add(mArtifactShardState.Age);
                    }
                    break;

                case "DatedSmall":
                    if (mLastOfferItem.GetStateOf <Artifact>(out mArtifactStateObject))
                    {
                        mArtifactState = (ArtifactState)mArtifactStateObject;
                        ArtifactQuality currentQuality;
                        if (!ActiveMuseum.SmallArtifactsAquired.TryGetValue(mArtifactState.Age, out currentQuality))
                        {
                            //if we haven't alread aquired this age add it now
                            ActiveMuseum.SmallArtifactsAquired.Add(mArtifactState.Age, mArtifactState.Quality);
                        }
                        else if (IsOfHigherQuality(mArtifactState.Quality, currentQuality))
                        {
                            //set the existing entry to the newer level of quality
                            ActiveMuseum.SmallArtifactsAquired[mArtifactState.Age] = mArtifactState.Quality;
                        }
                    }
                    break;

                case "DatedLarge":
                    if (mLastOfferItem.GetStateOf <Artifact>(out mArtifactStateObject))
                    {
                        mArtifactState = (ArtifactState)mArtifactStateObject;
                        ArtifactQuality currentQuality;
                        if (!ActiveMuseum.LargeArtifactsAquired.TryGetValue(mArtifactState.Age, out currentQuality))
                        {
                            //if we haven't alread aquired this age add it now
                            ActiveMuseum.LargeArtifactsAquired.Add(mArtifactState.Age, mArtifactState.Quality);
                        }
                        else if (IsOfHigherQuality(mArtifactState.Quality, currentQuality))
                        {
                            //set the existing entry to the newer level of quality
                            ActiveMuseum.LargeArtifactsAquired[mArtifactState.Age] = mArtifactState.Quality;
                        }
                    }
                    break;

                default:
                    Debug.Log("Couldn't find artifact type " + LastOfferType);
                    break;
                }
                //destroy it - the curator will disply a doppleganger
                mLastOfferItem.RemoveFromGame();
            }

            Mods.Get.Runtime.SaveMod(ActiveMuseum, "Museum", ActiveMuseum.Name);


            LastOfferItems.Clear();
            UndatedShard.Clear();
            UndatedSmall.Clear();
            DatedShard.Clear();
            DatedSmall.Clear();
            DatedLarge.Clear();
            //this will force the containers to update their newly missing items
            GUI.GUIInventoryInterface.Get.RefreshContainers();

            RefreshCuratedItems();
        }
Esempio n. 5
0
        public void RefreshAvailableArtifacts()
        {
            UndatedShard.Clear();
            UndatedSmall.Clear();
            DatedShard.Clear();
            DatedSmall.Clear();
            DatedLarge.Clear();

            mAvailableArtifacts.Clear();
            //this goes through the player's inventory and looks for
            //anything they can sell to the museum
            //this is used by converstions to search the player's inventory once
            //instead of for every exchange
            Player.Local.Inventory.FindItemsOfType("Artifact", mAvailableArtifacts);
            for (int i = 0; i < mAvailableArtifacts.Count; i++)
            {
                mCurrentArtifact = mAvailableArtifacts[i];
                if (mCurrentArtifact.GetStateOf <Artifact>(out mArtifactStateObject))
                {
                    mArtifactState = (ArtifactState)mArtifactStateObject;
                    //check if it's dated or not
                    if (mArtifactState.HasBeenDated)
                    {
                        if (mCurrentArtifact.StackName.Contains("Large"))
                        {
                            DatedLarge.SafeAdd(mCurrentArtifact);
                        }
                        else
                        {
                            DatedSmall.SafeAdd(mCurrentArtifact);
                        }
                    }
                    else
                    {
                        UndatedSmall.SafeAdd(mCurrentArtifact);
                    }
                }
            }

            mAvailableArtifacts.Clear();
            Player.Local.Inventory.FindItemsOfType("ArtifactShard", mAvailableArtifacts);
            for (int i = 0; i < mAvailableArtifacts.Count; i++)
            {
                mCurrentArtifact = mAvailableArtifacts[i];
                if (mCurrentArtifact.GetStateOf <ArtifactShard>(out mArtifactStateObject))
                {
                    mArtifactShardState = (ArtifactShardState)mArtifactStateObject;
                    //check if it's dated or not
                    if (mArtifactState.HasBeenDated)
                    {
                        DatedShard.SafeAdd(mCurrentArtifact);
                    }
                    else
                    {
                        UndatedShard.SafeAdd(mCurrentArtifact);
                    }
                }
            }

            /*
             * Debug.Log("Found " + UndatedShardAvailable.ToString() + " Undated Shard Available");
             * Debug.Log("Found " + UndatedSmallAvailable.ToString() + " Undated Small Available");
             * Debug.Log("Found " + DatedShardAvailable.ToString() + " Dated Shard Available");
             * Debug.Log("Found " + DatedSmallAvailable.ToString() + " Dated Small Available");
             * Debug.Log("Found " + DatedLargeAvailable.ToString() + " Dated Large Available");
             */
        }