Example #1
0
        public CreateMenuEntry AddSubmenu(Script.Section nSubMenu)
        {
            throw new System.Exception();
//			CreateMenuEntry toAdd = new CreateMenuEntry( nSubMenu );
//			AddSubmenu( toAdd );
//			return toAdd;
        }
Example #2
0
        public CreateItemEntry AddItem(Script.Section nItem)
        {
            throw new System.Exception();
//			CreateItemEntry toAdd = new CreateItemEntry( nItem );
//			AddItem( toAdd );
//			return toAdd;
        }
Example #3
0
 public CreateMenuEntry(Script.Section toScanFrom) : base()
 {
     isRoot      = false;
     itemEntries = new ArrayList();
     menuEntries = new ArrayList();
     menuID      = Conversion.ToUInt16(toScanFrom.SectionName.Remove(0, 8));
     Retrieve(toScanFrom);
 }
Example #4
0
 public CreateItemEntry(Script.Section toScanFrom) : base()
 {
     soundPlayed    = 0;
     minRank        = 1;
     maxRank        = 10;
     addItem        = "";
     delay          = 0;
     sectName       = toScanFrom.SectionName;
     resourceNeeded = new ArrayList();
     skillReqs      = new ArrayList();
     menuID         = Conversion.ToUInt16(toScanFrom.SectionName.Remove(0, 5));
     Retrieve(toScanFrom);
 }
Example #5
0
        public override void Retrieve(Script.Section toScanFrom)
        {
            foreach (Script.TagDataPair t in toScanFrom.TagDataPairs)
            {
                switch (t.Tag)
                {
                case "COLOUR":  colour = t.Data.ToUInt16();    break;

                case "ID":              targID = t.Data.ToUInt16();    break;

                case "NAME":    name = t.Data;                               break;

                case "SUBMENU": menuID = t.Data.ToUInt16();    break;

                default:                break;
                }
            }
        }
Example #6
0
 protected static void ParseSubMenu(Script.Section i, CreateMenuEntry parent, Script.BaseScript tObj)
 {
     foreach (Script.TagDataPair t in i.TagDataPairs)
     {
         if (t.Tag == "MENU")
         {
             // do menu parsing here
             string         mToFind = "MENUENTRY " + t.Data;
             Script.Section k       = tObj.FindSection(mToFind);
             if (k != null)
             {
                 CreateMenuEntry cmeMade = new CreateMenuEntry(k);
                 parent.AddSubmenu(cmeMade);
                 Script.Section l = tObj.FindSection("SUBMENU " + t.Data);
                 if (l != null)
                 {
                     ParseSubMenu(l, cmeMade, tObj);
                 }
             }
             else
             {
                 missingMenus.Add(t.Tag + " " + t.Data);
             }
         }
         else if (t.Tag == "ITEM")
         {
             // do item parsing here
             string         iToFind = "ITEM " + t.Data;
             Script.Section j       = tObj.FindSection(iToFind);
             if (j != null)
             {
                 CreateItemEntry cieMade = new CreateItemEntry(j);
                 parent.AddItem(cieMade);
             }
             else
             {
                 missingItems.Add(t.Tag + " " + t.Data);
             }
         }
     }
 }
Example #7
0
        public static ArrayList CreateStructureFromScript(Script.BaseScript tObj)
        {
            ArrayList retVal = new ArrayList();

            foreach (Script.ScriptSection i in tObj.Sections)
            {
                if (i.SectionName.StartsWith("SUBMENU "))
                {
                    string         toFind = "MENUENTRY " + i.SectionName.Remove(0, 8);
                    Script.Section j      = tObj.FindSection(toFind);
                    if (j == null)
                    {
                        CreateMenuEntry rootMenu = new CreateMenuEntry(i);
                        rootMenu.IsRoot = true;
                        retVal.Add(rootMenu);
                        ParseSubMenu(i, rootMenu, tObj);
                    }
                }
            }

            return(retVal);
        }
Example #8
0
        public override void Retrieve(Script.Section toScanFrom)
        {
            foreach (Script.TagDataPair t in toScanFrom.TagDataPairs)
            {
                switch (t.Tag)
                {
                default:                break;

                case "COLOUR":  colour = t.Data.ToUInt16();    break;

                case "ID":              targID = t.Data.ToUInt16();    break;

                case "MINRANK": minRank = t.Data.ToUInt08();    break;

                case "MAXRANK": maxRank = t.Data.ToUInt08();    break;

                case "NAME":    name = t.Data;                               break;

                case "SOUND":   soundPlayed = t.Data.ToUInt16();        break;

                case "ADDITEM": addItem = t.Data;                               break;

                case "DELAY":   delay = t.Data.ToInt16();             break;

                case "SPELL":   spell = t.Data.ToUInt16();    break;

                case "SKILL":
                    ResSkillReq rsrToAdd = new ResSkillReq();
                    string []   skSplit  = t.Data.Split(' ');
                    if (skSplit.Length < 3)
                    {
                        rsrToAdd.MaxSkill = 1000;
                    }
                    else
                    {
                        rsrToAdd.MaxSkill = Conversion.ToUInt16(skSplit[2]);
                    }
                    if (skSplit.Length < 2)
                    {
                        rsrToAdd.MinSkill = 1000;
                    }
                    else
                    {
                        rsrToAdd.MinSkill = Conversion.ToUInt16(skSplit[1]);
                    }
                    rsrToAdd.SkillNumber = (Skills)Conversion.ToUInt08(skSplit[0]);
                    skillReqs.Add(rsrToAdd);
                    break;

                case "RESOURCE":
                    ResAmountPair rapToAdd = new ResAmountPair();
                    string []     resSplit = t.Data.Split(' ');
                    if (resSplit.Length < 3)
                    {
                        rapToAdd.Colour = 0;
                    }
                    else
                    {
                        rapToAdd.Colour = Conversion.ToUInt16(resSplit[2]);
                    }
                    if (resSplit.Length < 2)
                    {
                        rapToAdd.AmountNeeded = 1;
                    }
                    else
                    {
                        rapToAdd.AmountNeeded = Conversion.ToUInt08(resSplit[1]);
                    }
                    rapToAdd.ItemID = Conversion.ToUInt16(resSplit[0]);
                    resourceNeeded.Add(rapToAdd);
                    break;
                }
            }
        }
Example #9
0
 public abstract void Retrieve(Script.Section toScanFrom);