// Validate the mobile passed and add into arraylist // passed by reference public void Validate(PlayerMobile pm, ref ArrayList fp) { // Make sure we have a ruleset if (TourneyStone.Ruleset.Count == 0) { return; } Player = pm; ArrayList failures = new ArrayList(); ArrayList Rules = new ArrayList(); ArrayList Fallthroughs = new ArrayList(); // Grab the ruleset Rules = TourneyStone.Ruleset; int RulesetCount = Rules.Count; // Create a HeldStuff instance to figure out // what they have HeldStuff CurrentHeld = new HeldStuff(pm); // Loop through each rule & condition... deal for (int rpos = 0; rpos < RulesetCount; rpos++) { Rule RuleChecking = (Rule)Rules[rpos]; if (RuleChecking.Conditions.Count == 0 || RuleChecking.Active == false) { continue; } foreach (RuleCondition rc in RuleChecking.Conditions) { // What kind of condition are we dealing with here? if (rc is ItemCondition) { // ITEM CONDITION // (validate entire held item list against rule) string FailText = RuleChecking.FailText; string sDynFails = ""; bool bFails = false; // wea: 25/Feb/2007 Modified call to pass CurrentHeld rather // than one item at a time if (!rc.Guage(CurrentHeld.Contents, ref Fallthroughs)) { sDynFails += string.Format("{0}{1}", (sDynFails == "" ? "" : ", "), RuleChecking.FailTextDyn); bFails = true; } if (bFails) { if (sDynFails != "") { FailText += " You have : " + sDynFails; } FailText = RuleChecking.DynFill(FailText); failures.Add(FailText); } } else if (rc is ItemPropertyCondition) // wea: 28/Feb/2007 Incorrect rule handling fix { // ITEM PROPERTY CONDITION string FailText = RuleChecking.FailText; string sDynFails = ""; bool bFails = false; foreach (HeldItem hi in CurrentHeld.Contents) { if (!rc.Guage(hi, ref Fallthroughs)) { sDynFails += string.Format("{0}{1}", (sDynFails == "" ? "" : ", "), RuleChecking.FailTextDyn); bFails = true; } } if (bFails) { if (sDynFails != "") { FailText += " You have : " + sDynFails; } FailText = RuleChecking.DynFill(FailText); failures.Add(FailText); } } else if (rc is PropertyCondition) { // MOBILE PROPERTY CONDITION // (validate using the mobile) if (!rc.Guage(Player)) { string FailText = RuleChecking.FailText + " " + RuleChecking.FailTextDyn; FailText = RuleChecking.DynFill(FailText); failures.Add(FailText); } } } } fp = failures; }
// Validate the mobile passed and add into arraylist // passed by reference public void Validate (PlayerMobile pm, ref ArrayList fp) { // Make sure we have a ruleset if( TourneyStone.Ruleset.Count == 0 ) return; Player = pm; ArrayList failures = new ArrayList(); ArrayList Rules = new ArrayList(); ArrayList Fallthroughs = new ArrayList(); // Grab the ruleset Rules = TourneyStone.Ruleset; int RulesetCount = Rules.Count; // Create a HeldStuff instance to figure out // what they have HeldStuff CurrentHeld = new HeldStuff(pm); // Loop through each rule & condition... deal for( int rpos = 0; rpos < RulesetCount; rpos++ ) { Rule RuleChecking = (Rule) Rules[rpos]; if( RuleChecking.Conditions.Count == 0 || RuleChecking.Active == false ) continue; foreach( RuleCondition rc in RuleChecking.Conditions ) { // What kind of condition are we dealing with here? if( rc is ItemCondition ) { // ITEM CONDITION // (validate entire held item list against rule) string FailText = RuleChecking.FailText; string sDynFails = ""; bool bFails = false; // wea: 25/Feb/2007 Modified call to pass CurrentHeld rather // than one item at a time if (!rc.Guage( CurrentHeld.Contents, ref Fallthroughs)) { sDynFails += string.Format("{0}{1}", (sDynFails == "" ? "" : ", "), RuleChecking.FailTextDyn); bFails = true; } if( bFails ) { if( sDynFails!="" ) FailText += " You have : " + sDynFails; FailText = RuleChecking.DynFill( FailText ); failures.Add( FailText ); } } else if (rc is ItemPropertyCondition) // wea: 28/Feb/2007 Incorrect rule handling fix { // ITEM PROPERTY CONDITION string FailText = RuleChecking.FailText; string sDynFails = ""; bool bFails = false; foreach (HeldItem hi in CurrentHeld.Contents) { if (!rc.Guage(hi, ref Fallthroughs)) { sDynFails += string.Format("{0}{1}", (sDynFails == "" ? "" : ", "), RuleChecking.FailTextDyn); bFails = true; } } if (bFails) { if (sDynFails != "") FailText += " You have : " + sDynFails; FailText = RuleChecking.DynFill(FailText); failures.Add(FailText); } } else if (rc is PropertyCondition) { // MOBILE PROPERTY CONDITION // (validate using the mobile) if (!rc.Guage(Player)) { string FailText = RuleChecking.FailText + " " + RuleChecking.FailTextDyn; FailText = RuleChecking.DynFill(FailText); failures.Add(FailText); } } } } fp = failures; }