コード例 #1
0
        // converts the currency amount to its base currency and returns it
        public int GetBaseCurrencyAmount(Currency currency, int currencyAmount)
        {
            //Debug.Log("CurrencyConverter.GetBaseCurrencyAmount(" + currency.DisplayName + ", " + currencyAmount + ")");
            CurrencyGroup currencyGroup = FindCurrencyGroup(currency);

            if (currencyGroup != null)
            {
                // attemp redistribution
                Currency baseCurrency = currencyGroup.MyBaseCurrency;
                // convert everything in the group to the base amount
                if (SystemDataFactory.MatchResource(currency.DisplayName, currencyGroup.MyBaseCurrency.DisplayName))
                {
                    //Debug.Log("CurrencyConverter.GetBaseCurrencyAmount(" + currency.DisplayName + ", " + currencyAmount + ") return: " + currencyAmount);
                    return(currencyAmount);
                }
                // the currency needs conversion
                foreach (CurrencyGroupRate currencyGroupRate in currencyGroup.MyCurrencyGroupRates)
                {
                    if (SystemDataFactory.MatchResource(currencyGroupRate.Currency.DisplayName, currency.DisplayName))
                    {
                        //Debug.Log("CurrencyConverter.GetBaseCurrencyAmount(" + currency.DisplayName + ", " + currencyAmount + ") return: " + (currencyGroupRate.MyBaseMultiple * currencyAmount));
                        return(currencyGroupRate.BaseMultiple * currencyAmount);
                    }
                }
                //Debug.Log("CurrencyConverter.GetBaseCurrencyAmount(" + currency.DisplayName + ", " + currencyAmount + ") return: " + currencyAmount);
                return(currencyAmount);
            }
            //Debug.Log("CurrencyConverter.GetBaseCurrencyAmount(" + currency.DisplayName + ", " + currencyAmount + ") return: " + currencyAmount);
            return(currencyAmount);
        }
コード例 #2
0
ファイル: LootTable.cs プロジェクト: michaelday008/AnyRPGCore
 /// <summary>
 /// used to prevent multiple copies of a unique item from dropping since the other check requires it to be in your bag, so multiple can still drop if you haven't looted a mob yet
 /// </summary>
 /// <param name="itemName"></param>
 /// <returns></returns>
 public bool droppedItemsContains(LootTableState lootTableState, string itemName)
 {
     foreach (LootDrop lootDrop in lootTableState.DroppedItems)
     {
         if ((lootDrop as ItemLootDrop) is ItemLootDrop)
         {
         }
         if (SystemDataFactory.MatchResource((lootDrop as ItemLootDrop).Item.DisplayName, itemName))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
        public void CheckPetSpawn(IAbilityCaster source, Interactable target, AbilityEffectContext abilityEffectInput)
        {
            //Debug.Log(DisplayName + ".PetEffect.CheckPetSpawn()");
            CharacterPetManager characterPetManager = null;

            if ((source as BaseCharacter) is BaseCharacter)
            {
                characterPetManager = (source as BaseCharacter).CharacterPetManager;
            }
            else
            {
                //Debug.Log(DisplayName + ".PetEffect.CheckPetSpawn(): source is not basecharacter");
                return;
            }

            List <AbilityEffect> castList = new List <AbilityEffect>();

            foreach (SummonEffect petEffect in petEffectList)
            {
                if (SystemDataFactory.MatchResource(petEffect.DisplayName, DisplayName))
                {
                    Debug.LogError(DisplayName + ".PerformAbilityEffects(): circular reference detected.  Tried to cast self.  CHECK INSPECTOR AND FIX ABILITY EFFECT CONFIGURATION!!!");
                }
                else
                {
                    //Debug.Log(DisplayName + ".PetEffect.CheckPetSpawn(): adding to cast list");
                    if (petEffect.UnitProfile != null &&
                        characterPetManager.ActiveUnitProfiles.ContainsKey(petEffect.UnitProfile) == false)
                    {
                        //Debug.Log(DisplayName + ".PetEffect.CheckPetSpawn(): adding cast:" + petEffect.DisplayName);
                        castList.Add(petEffect);
                    }
                }
            }
            if (castList.Count > 0)
            {
                //Debug.Log(DisplayName + ".PetEffect.CheckPetSpawn(): castlist.count: " + castList.Count);
                Dictionary <PrefabProfile, GameObject> rawObjectList = PerformAbilityEffects(source, target, abilityEffectInput, castList);
            }
        }