Exemplo n.º 1
0
 public NpcEffect(ETargetCondition p_targetEffect, EEffectPeriodicity p_effectType, Single p_effectValue, Int32 p_effectPrice)
 {
     m_targetEffect      = p_targetEffect;
     m_effectPeriodicity = p_effectType;
     m_effectValue       = p_effectValue;
     m_effectPrice       = p_effectPrice;
 }
Exemplo n.º 2
0
 public Int32 GetRestCount(ETargetCondition p_target)
 {
     if (m_restCount.ContainsKey(p_target))
     {
         return(m_restCount[p_target]);
     }
     return(-1);
 }
Exemplo n.º 3
0
 public Int32 GetTurnCount(ETargetCondition p_target)
 {
     if (m_perTurnCount.ContainsKey(p_target))
     {
         return(m_perTurnCount[p_target]);
     }
     return(0);
 }
Exemplo n.º 4
0
 public Int32 GetDayCount(ETargetCondition p_target)
 {
     if (m_dayCount.ContainsKey(p_target))
     {
         return(m_dayCount[p_target]);
     }
     return(-2);
 }
Exemplo n.º 5
0
 public void SetTurnCount(ETargetCondition p_target, Int32 p_count)
 {
     if (m_perTurnCount.ContainsKey(p_target))
     {
         m_perTurnCount[p_target] = p_count;
     }
     else
     {
         m_perTurnCount.Add(p_target, p_count);
     }
 }
Exemplo n.º 6
0
 public NpcEffect GetNpcEffect(ETargetCondition p_conditionTarget)
 {
     for (Int32 i = 0; i < m_staticData.NpcEffects.Length; i++)
     {
         if (m_staticData.NpcEffects[i].TargetEffect == p_conditionTarget)
         {
             return(m_staticData.NpcEffects[i]);
         }
     }
     return(new NpcEffect(ETargetCondition.NONE, EEffectPeriodicity.PERMANENT, 0f, Int32.MaxValue));
 }
Exemplo n.º 7
0
        public void SetDayBreakCount(ETargetCondition p_target, Int32 p_count)
        {
            Boolean flag = LegacyLogic.Instance.GameTime.Time.Hours > ConfigManager.Instance.Game.DayStartHours;

            if (flag)
            {
                SetDayCount(p_target, p_count);
            }
            else
            {
                SetDayCount(p_target, p_count - 1);
            }
        }
Exemplo n.º 8
0
 private void OnHirelingsUpdated(Object p_sender, EventArgs p_args)
 {
     if (p_args is HirelingEventArgs && ((HirelingEventArgs)p_args).Index == m_idx)
     {
         HirelingEventArgs hirelingEventArgs = (HirelingEventArgs)p_args;
         ETargetCondition  condition         = hirelingEventArgs.Condition;
         if (condition != ETargetCondition.HIRE)
         {
             if (condition == ETargetCondition.FIRE)
             {
                 SetView(null);
             }
         }
         else
         {
             SetView(hirelingEventArgs.Npc);
         }
     }
 }
Exemplo n.º 9
0
        public Boolean AllowedPeriodicity(Npc p_npc, ETargetCondition p_targetEffect)
        {
            if (p_npc == null)
            {
                return(false);
            }
            NpcEffect npcEffect = p_npc.GetNpcEffect(p_targetEffect);

            if (npcEffect.TargetEffect == ETargetCondition.NONE)
            {
                LegacyLogger.Log("This target cant have periodicity");
                return(false);
            }
            switch (npcEffect.EffectPeriodicity)
            {
            case EEffectPeriodicity.PERMANENT:
                return(true);

            case EEffectPeriodicity.ON_DEMAND:
                return(true);

            case EEffectPeriodicity.ONCE_A_REST:
                return(p_npc.GetRestCount(p_targetEffect) < LegacyLogic.Instance.WorldManager.Party.RestCount);

            case EEffectPeriodicity.ONCE_A_DAY:
            {
                Int32 dayCount = p_npc.GetDayCount(p_targetEffect);
                Int32 num      = LegacyLogic.Instance.GameTime.Time.Days;
                if (LegacyLogic.Instance.GameTime.Time.Hours < ConfigManager.Instance.Game.DayStartHours)
                {
                    num--;
                }
                return(dayCount < num);
            }

            case EEffectPeriodicity.ONCE_A_TURN:
                return(p_npc.GetTurnCount(p_targetEffect) < (Int32)npcEffect.EffectValue);

            default:
                return(false);
            }
        }
Exemplo n.º 10
0
        public Boolean HasEffect(ETargetCondition p_targetCondition, out NpcEffect p_npcEffect, out Npc p_npc)
        {
            NpcEffect npcEffect = new NpcEffect(ETargetCondition.NONE, EEffectPeriodicity.PERMANENT, 0f, Int32.MaxValue);

            for (Int32 i = 0; i < 2; i++)
            {
                if (m_hirelings[i] != null)
                {
                    npcEffect = m_hirelings[i].GetNpcEffect(p_targetCondition);
                    if (npcEffect.TargetEffect != ETargetCondition.NONE)
                    {
                        p_npcEffect = npcEffect;
                        p_npc       = m_hirelings[i];
                        return(true);
                    }
                }
            }
            p_npcEffect = npcEffect;
            p_npc       = null;
            return(false);
        }
Exemplo n.º 11
0
        public Int32 GetCosts(ETargetCondition p_conditionTarget)
        {
            switch (p_conditionTarget)
            {
            case ETargetCondition.REPAIR:
                return(ConfigManager.Instance.Game.CostRepair);

            case ETargetCondition.CURE:
                return(ConfigManager.Instance.Game.CostCure);

            case ETargetCondition.IDENTIFY:
                return(ConfigManager.Instance.Game.CostIdentify);

            case ETargetCondition.RESURRECT:
                return(ConfigManager.Instance.Game.CostResurrect);

            case ETargetCondition.RESTORATION:
                return(ConfigManager.Instance.Game.CostRestoration);

            case ETargetCondition.CAST:
                return(ConfigManager.Instance.Game.CostCast);

            case ETargetCondition.REST:
                return(ConfigManager.Instance.Game.CostRest);

            case ETargetCondition.HIRE:
                return(m_staticData.HirePrice);

            default:
                if (p_conditionTarget >= ETargetCondition.HIRE && p_conditionTarget <= ETargetCondition.FIRE)
                {
                    NpcEffect npcEffect = GetNpcEffect(p_conditionTarget);
                    if (npcEffect.TargetEffect != ETargetCondition.NONE)
                    {
                        return(npcEffect.EffectPrice);
                    }
                }
                return(Int32.MaxValue);
            }
        }
Exemplo n.º 12
0
 public HirelingFunction(ETargetCondition p_condition, Int32 p_dialogID, Int32 p_price, Single p_sharePrice) : this(p_condition, p_dialogID)
 {
     m_price      = p_price;
     m_sharePrice = p_sharePrice;
 }
Exemplo n.º 13
0
 public HirelingFunction(ETargetCondition p_condition, Int32 p_dialogID)
 {
     ConditionTarget = p_condition;
     m_dialogID      = p_dialogID;
 }
Exemplo n.º 14
0
        public Boolean HasEffect(ETargetCondition p_targetCondition, out NpcEffect p_npcEffect)
        {
            Npc npc;

            return(HasEffect(p_targetCondition, out p_npcEffect, out npc));
        }
Exemplo n.º 15
0
 public HirelingEventArgs(ETargetCondition p_condition, Npc p_npc, Int32 p_index)
 {
     m_condition = p_condition;
     m_npc       = p_npc;
     m_index     = p_index;
 }
Exemplo n.º 16
0
 public void SetDayBreakCountStrict(ETargetCondition p_target, Int32 p_count)
 {
     SetDayCount(p_target, p_count);
 }
Exemplo n.º 17
0
 private static void ResolveColumnValue(Object sender, ColumnValueResolveEventArg e)
 {
     if (e.Type == typeof(Resistance[]))
     {
         String[]          array = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         List <Resistance> list  = new List <Resistance>(array.Length / 2);
         for (Int32 i = 1; i < array.Length; i += 2)
         {
             Resistance item;
             item.Type  = (EDamageType)Enum.Parse(typeof(EDamageType), array[i - 1], true);
             item.Value = Int32.Parse(array[i], CultureInfo.InvariantCulture);
             list.Add(item);
         }
         e.Output = list.ToArray();
     }
     else if (e.Type == typeof(DamageData[]))
     {
         String[]          array2 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         List <DamageData> list2  = new List <DamageData>(array2.Length / 3);
         for (Int32 j = 2; j < array2.Length; j += 3)
         {
             EDamageType p_type    = (EDamageType)Enum.Parse(typeof(EDamageType), array2[j - 2], true);
             Int32       p_minimum = Int32.Parse(array2[j - 1]);
             Int32       p_maximum = Int32.Parse(array2[j]);
             DamageData  item2     = new DamageData(p_type, p_minimum, p_maximum);
             list2.Add(item2);
         }
         e.Output = list2.ToArray();
     }
     else if (e.Type == typeof(NpcEffect[]))
     {
         String[]         array3 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         List <NpcEffect> list3  = new List <NpcEffect>(array3.Length / 4);
         for (Int32 k = 3; k < array3.Length; k += 4)
         {
             ETargetCondition   p_targetEffect = (ETargetCondition)Enum.Parse(typeof(ETargetCondition), array3[k - 3], true);
             EEffectPeriodicity p_effectType   = (EEffectPeriodicity)Enum.Parse(typeof(EEffectPeriodicity), array3[k - 2], true);
             Single             p_effectValue  = Single.Parse(array3[k - 1]);
             Int32     p_effectPrice           = Int32.Parse(array3[k]);
             NpcEffect item3 = new NpcEffect(p_targetEffect, p_effectType, p_effectValue, p_effectPrice);
             list3.Add(item3);
         }
         e.Output = list3.ToArray();
     }
     else if (e.Type == typeof(IntRange))
     {
         String[] array4 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         IntRange zero   = IntRange.Zero;
         if (array4.Length == 1)
         {
             zero.Min = (zero.Max = Int32.Parse(array4[0]));
         }
         else if (array4.Length > 1)
         {
             zero.Min = Int32.Parse(array4[0]);
             zero.Max = Int32.Parse(array4[1]);
         }
         e.Output = zero;
     }
     else if (e.Type == typeof(FloatRange))
     {
         String[]   array5 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         FloatRange zero2  = FloatRange.Zero;
         if (array5.Length == 1)
         {
             zero2.Min = (zero2.Max = Single.Parse(array5[0]));
         }
         else if (array5.Length > 1)
         {
             zero2.Min = Single.Parse(array5[0]);
             zero2.Max = Single.Parse(array5[1]);
         }
         e.Output = zero2;
     }
     else if (e.Type == typeof(MonsterStaticData.SpellData[]))
     {
         String[] array6 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         List <MonsterStaticData.SpellData> list4 = new List <MonsterStaticData.SpellData>(array6.Length / 4);
         for (Int32 l = 2; l < array6.Length; l += 4)
         {
             String p_animationClipName = array6[l - 2];
             Int32  p_spellID           = Int32.Parse(array6[l - 1]);
             Int32  p_spellProbability  = Int32.Parse(array6[l]);
             Int32  p_level             = Int32.Parse(array6[l + 1]);
             list4.Add(new MonsterStaticData.SpellData(p_animationClipName, p_spellID, p_spellProbability, p_level));
         }
         e.Output = list4.ToArray();
     }
     else if (e.Type == typeof(MonsterStaticData.ExtraDamage))
     {
         String[] array7 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         if (array7.Length > 0)
         {
             MonsterStaticData.ExtraDamage extraDamage = new MonsterStaticData.ExtraDamage((EDamageType)Enum.Parse(typeof(EDamageType), array7[0], true), Int32.Parse(array7[1]));
             e.Output = extraDamage;
         }
     }
     else if (e.Type == typeof(ItemOffer[]))
     {
         String[]    array8 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         ItemOffer[] array9 = new ItemOffer[array8.Length / 3];
         for (Int32 m = 0; m < array9.Length; m++)
         {
             EDataType p_itemType     = (EDataType)Enum.Parse(typeof(EDataType), array8[m * 3], true);
             Int32     p_itemID       = Int32.Parse(array8[m * 3 + 1]);
             Int32     p_itemQuantity = Int32.Parse(array8[m * 3 + 2]);
             array9[m] = new ItemOffer(p_itemType, p_itemID, p_itemQuantity);
         }
         e.Output = array9;
     }
     else if (e.Type == typeof(Position))
     {
         String[] array10  = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         Position position = default(Position);
         if (array10.Length == 2)
         {
             position.X = Int32.Parse(array10[0]);
             position.Y = Int32.Parse(array10[1]);
         }
         e.Output = position;
     }
     else if (e.Type == typeof(EquipmentData[]))
     {
         String[]        array11 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         EquipmentData[] array12 = new EquipmentData[array11.Length / 2];
         for (Int32 n = 0; n < array12.Length; n++)
         {
             EDataType p_type2    = (EDataType)Enum.Parse(typeof(EDataType), array11[n * 2], true);
             Int32     p_staticId = Int32.Parse(array11[n * 2 + 1]);
             array12[n] = new EquipmentData(p_type2, p_staticId);
         }
         e.Output = array12;
     }
     else if (e.Type == typeof(SteadyLoot[]))
     {
         String[]     array13 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         SteadyLoot[] array14 = new SteadyLoot[array13.Length / 5];
         for (Int32 num = 0; num < array14.Length; num++)
         {
             EDataType p_itemClass  = (EDataType)Enum.Parse(typeof(EDataType), array13[num * 5], true);
             Int32     p_itemID2    = Int32.Parse(array13[num * 5 + 1]);
             Int32     p_min        = Int32.Parse(array13[num * 5 + 2]);
             Int32     p_max        = Int32.Parse(array13[num * 5 + 3]);
             Single    p_dropChance = Single.Parse(array13[num * 5 + 4]);
             array14[num] = new SteadyLoot(p_itemClass, p_itemID2, p_min, p_max, p_dropChance);
         }
         e.Output = array14;
     }
     else if (e.Type == typeof(ModelProbability[]))
     {
         String[]           array15 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         ModelProbability[] array16 = new ModelProbability[array15.Length / 2];
         for (Int32 num2 = 0; num2 < array16.Length; num2++)
         {
             String    text         = array15[num2 * 2];
             Int32     p_modelLevel = Int32.Parse(text.Substring(0, 1));
             ESubModel p_subModel   = (ESubModel)Enum.Parse(typeof(ESubModel), text.Substring(1, 1), true);
             Single    p_weight     = Single.Parse(array15[num2 * 2 + 1]);
             array16[num2] = new ModelProbability(p_modelLevel, p_subModel, p_weight);
         }
         e.Output = array16;
     }
     else if (e.Type == typeof(EnchantmentProbability[]))
     {
         String[] array17 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         EnchantmentProbability[] array18 = new EnchantmentProbability[array17.Length / 2];
         for (Int32 num3 = 0; num3 < array18.Length; num3++)
         {
             Int32  p_modelLevel2 = Int32.Parse(array17[num3 * 2]);
             Single p_weight2     = Single.Parse(array17[num3 * 2 + 1]);
             array18[num3] = new EnchantmentProbability(p_modelLevel2, p_weight2);
         }
         e.Output = array18;
     }
     else if (e.Type == typeof(StepsOnTerrainData))
     {
         StepsOnTerrainData empty   = StepsOnTerrainData.Empty;
         String[]           array19 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         if (array19.Length == 2)
         {
             Int32        p_numberOfSteps = Int32.Parse(array19[0]);
             ETerrainType p_type3         = (ETerrainType)Enum.Parse(typeof(ETerrainType), array19[1], true);
             empty = new StepsOnTerrainData(p_numberOfSteps, p_type3);
         }
         e.Output = empty;
     }
     else if (e.Type == typeof(MonsterAbilityID[]))
     {
         String[]           array20 = e.Value.Split(s_Seperator, StringSplitOptions.RemoveEmptyEntries);
         MonsterAbilityID[] array21 = new MonsterAbilityID[array20.Length / 2];
         for (Int32 num4 = 0; num4 < array21.Length; num4++)
         {
             MonsterAbilityID monsterAbilityID;
             monsterAbilityID.AbilityType = (EMonsterAbilityType)Enum.Parse(typeof(EMonsterAbilityType), array20[num4 * 2]);
             monsterAbilityID.Level       = Int32.Parse(array20[num4 * 2 + 1]);
             array21[num4] = monsterAbilityID;
         }
         e.Output = array21;
     }
 }
Exemplo n.º 18
0
 public void SetDayBreakCount(ETargetCondition p_target)
 {
     SetDayBreakCount(p_target, LegacyLogic.Instance.GameTime.Time.Days);
 }
Exemplo n.º 19
0
        public Boolean HasEffect(ETargetCondition p_targetCondition)
        {
            NpcEffect npcEffect;

            return(HasEffect(p_targetCondition, out npcEffect));
        }