public ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info)
        {
            ItemDropAttemptResult result = default(ItemDropAttemptResult);

            result.State = ItemDropAttemptResultState.DidNotRunCode;
            return(result);
        }
Ejemplo n.º 2
0
        public ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info)
        {
            ItemDropAttemptResult result = default(ItemDropAttemptResult);

            result.State = ItemDropAttemptResultState.DoesntFillConditions;
            return(result);
        }
Ejemplo n.º 3
0
 private void ResolveRuleChains(
     IItemDropRule rule,
     DropAttemptInfo info,
     ItemDropAttemptResult parentResult)
 {
     this.ResolveRuleChains(ref info, ref parentResult, rule.ChainedRules);
 }
Ejemplo n.º 4
0
        public ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info)
        {
            ItemDropAttemptResult result = default(ItemDropAttemptResult);

            result.State = ItemDropAttemptResultState.Success;
            return(result);
        }
Ejemplo n.º 5
0
        public ItemDropAttemptResult TryDroppingItem(DropAttemptInfo info)
        {
            int itemId = (int)info.npc.ai[1];

            GetDropInfo(itemId, out int amountDroppedMinimum, out int amountDroppedMaximum);
            CommonCode.DropItemFromNPC(info.npc, itemId, info.rng.Next(amountDroppedMinimum, amountDroppedMaximum + 1));
            ItemDropAttemptResult result = default(ItemDropAttemptResult);

            result.State = ItemDropAttemptResultState.Success;
            return(result);
        }
Ejemplo n.º 6
0
 private void ResolveRuleChains(DropAttemptInfo info, ItemDropAttemptResult parentResult, List <IItemDropRuleChainAttempt> ruleChains)
 {
     if (ruleChains == null)
     {
         return;
     }
     for (int i = 0; i < ruleChains.Count; i++)
     {
         IItemDropRuleChainAttempt itemDropRuleChainAttempt = ruleChains[i];
         if (itemDropRuleChainAttempt.CanChainIntoRule(parentResult))
         {
             ResolveRule(itemDropRuleChainAttempt.RuleToChain, info);
         }
     }
 }
Ejemplo n.º 7
0
        private ItemDropAttemptResult ResolveRule(IItemDropRule rule, DropAttemptInfo info)
        {
            if (!rule.CanDrop(info))
            {
                ItemDropAttemptResult itemDropAttemptResult = default(ItemDropAttemptResult);
                itemDropAttemptResult.State = ItemDropAttemptResultState.DoesntFillConditions;
                ItemDropAttemptResult itemDropAttemptResult2 = itemDropAttemptResult;
                ResolveRuleChains(rule, info, itemDropAttemptResult2);
                return(itemDropAttemptResult2);
            }
            ItemDropAttemptResult itemDropAttemptResult3 = (rule as INestedItemDropRule)?.TryDroppingItem(info, ResolveRule) ?? rule.TryDroppingItem(info);

            ResolveRuleChains(rule, info, itemDropAttemptResult3);
            return(itemDropAttemptResult3);
        }
Ejemplo n.º 8
0
 public ItemDropAttemptResult TryDroppingItem(
     DropAttemptInfo info,
     ItemDropRuleResolveAction resolveAction)
 {
     if (info.rng.Next(this._outOfY) == 0)
     {
         int index = info.rng.Next(this._options.Length);
         ItemDropAttemptResult dropAttemptResult = resolveAction(this._options[index], info);
         return(new ItemDropAttemptResult()
         {
             State = ItemDropAttemptResultState.Success
         });
     }
     return(new ItemDropAttemptResult()
     {
         State = ItemDropAttemptResultState.FailedRandomRoll
     });
 }
Ejemplo n.º 9
0
 private void ResolveRuleChains(
     ref DropAttemptInfo info,
     ref ItemDropAttemptResult parentResult,
     List <IItemDropRuleChainAttempt> ruleChains)
 {
     if (ruleChains == null)
     {
         return;
     }
     for (int index = 0; index < ruleChains.Count; ++index)
     {
         IItemDropRuleChainAttempt ruleChain = ruleChains[index];
         if (ruleChain.CanChainIntoRule(parentResult))
         {
             this.ResolveRule(ruleChain.RuleToChain, info);
         }
     }
 }
Ejemplo n.º 10
0
        private ItemDropAttemptResult ResolveRule(
            IItemDropRule rule,
            DropAttemptInfo info)
        {
            if (!rule.CanDrop(info))
            {
                ItemDropAttemptResult parentResult = new ItemDropAttemptResult()
                {
                    State = ItemDropAttemptResultState.DoesntFillConditions
                };
                this.ResolveRuleChains(rule, info, parentResult);
                return(parentResult);
            }
            ItemDropAttemptResult parentResult1 = !(rule is INestedItemDropRule nestedItemDropRule) ? rule.TryDroppingItem(info) : nestedItemDropRule.TryDroppingItem(info, new ItemDropRuleResolveAction(this.ResolveRule));

            this.ResolveRuleChains(rule, info, parentResult1);
            return(parentResult1);
        }
Ejemplo n.º 11
0
 public bool CanChainIntoRule(ItemDropAttemptResult parentResult)
 {
     return(parentResult.State == ItemDropAttemptResultState.Success);
 }
Ejemplo n.º 12
0
 public bool CanChainIntoRule(ItemDropAttemptResult parentResult)
 {
     return(parentResult.State == ItemDropAttemptResultState.FailedRandomRoll);
 }
Ejemplo n.º 13
0
 public bool CanChainIntoRule(ItemDropAttemptResult parentResult)
 {
     return(parentResult.State == ItemDropAttemptResultState.DoesntFillConditions);
 }