#include "inc_misc_tools"
// Randomly Generates Magic Staves.
// iType 2 = Medium Staff
// iType 3 = Major Staff
// No other value will work.

object Table826b();
object Table826c();                                     //mstaff008

object Table826b()
    {
    int iRoll =  d100();
    string sString;
    if (iRoll <= 10) {Table826b();} //Reroll
    else if (iRoll <= 20) {sString = "mstaff101";}
    else if (iRoll <= 30) {sString = "mstaff102";}
    else if (iRoll <= 40) {sString = "mstaff103";}
    else if (iRoll <= 50) {Table826b();} //Reroll
    else if (iRoll <= 60) {sString = "mstaff104";}
    else if (iRoll <= 70) {Table826b();} //Reroll
    else if (iRoll <= 80) {sString = "mstaff105";}
    else if (iRoll <= 89) {sString = "mstaff106";}
    else if (iRoll <= 95) {sString = "mstaff107";}
    else if (iRoll <= 100) {Table826b();} //Reroll
    return CreateItemOnObject(sString);
    }
object Table826c()
    {
    int iRoll =  d100();
    string sString;
    if (iRoll <= 5) {sString = "mstaff101";}
    else if (iRoll <= 15) {sString = "mstaff102";}
    else if (iRoll <= 30) {sString = "mstaff103";}
    else if (iRoll <= 40) {Table826b();} //Reroll
    else if (iRoll <= 50) {sString = "mstaff104";}
    else if (iRoll <= 60) {Table826b();} //Reroll
    else if (iRoll <= 70) {sString = "mstaff105";}
    else if (iRoll <= 80) {sString = "mstaff106";}
    else if (iRoll <= 90) {sString = "mstaff107";}
    else if (iRoll <= 96) {Table826b();} //Reroll
    else if (iRoll <= 100) {sString = "mstaff108";} //Reroll
    return CreateItemOnObject(sString);;
    }
