public XmlElement ToXml(XmlDocument ownerDoc)
        {
            XmlElement ele = ownerDoc.CreateElement("loc");

            ele.SetAttribute("id", Id.ToString());
            ele.SetAttribute("name", Name);
            ele.SetAttribute("type", Type.ToString());
            ele.SetAttribute("NS", Coords.NS.ToString());
            ele.SetAttribute("EW", Coords.EW.ToString());
            if (HasExitCoords)
            {
                ele.SetAttribute("exitNS", ExitCoords.NS.ToString());
                ele.SetAttribute("exitEW", ExitCoords.EW.ToString());
                if (!UseInRouteFinding)
                {
                    ele.SetAttribute("use", UseInRouteFinding.ToString());
                }
            }
            if (DungeonId != 0)
            {
                ele.SetAttribute("dungeonId", DungeonId.ToString());
            }
            if (IsCustomized)
            {
                ele.SetAttribute("customized", IsCustomized.ToString());
            }
            if (HasSpecializedIcon)
            {
                ele.SetAttribute("icon", GetIcon(false).ToString("X8"));
            }

            ele.InnerText = Notes;
            return(ele);
        }
        public static bool IsDifferent(this DungeonId a, DungeonId b)
        {
            int nodeValue  = a.ToIntValue();
            int nodeValueb = b.ToIntValue();

            return(nodeValue != nodeValueb);
        }
        public static bool IsBiggerThan(this DungeonId a, DungeonId b)
        {
            int nodeValue  = a.ToIntValue();
            int nodeValueb = b.ToIntValue();

            return(nodeValue > nodeValueb);
        }
        public static bool IsLastNodeOfDifficulty(this DungeonId dungeonId)
        {
            bool flag1 = dungeonId.NodeId == dungeonId.GetModeLogic().GetNumOfNodeInDifficulty();
            bool flag2 = dungeonId.MapId == dungeonId.GetModeLogic().GetHighestMapId();

            return(flag1 && flag2);
        }
 public static bool IsEqual(this DungeonId a, DungeonId b)
 {
     if (a == null)
     {
         return(false);
     }
     return(a.ToIntValue() == b.ToIntValue());
 }
        public static int ToIntValue(this DungeonId dungeonId)
        {
            int difficultyValue = (dungeonId.Difficulty.ToInt() + 1) * 1000000;
            int mapValue        = (dungeonId.MapId + 1) * 1000;
            int nodeValue       = (dungeonId.NodeId + 1);

            return(difficultyValue + mapValue + nodeValue);
        }
    public static SpawnTable GetOreTable(DungeonId inDungeon, int inCurLevel)
    {
        if (oreTables.ContainsKey(inDungeon))
        {
            List <SpawnTable> tables = oreTables[inDungeon];
            for (int i = 0; i < tables.Count; i++)
            {
                if (tables[i].ContainsDungeonLevel(inCurLevel))
                {
                    return(tables[i]);
                }
            }

            //none of the tables contained our requested level so just return the highest one
            return(tables[tables.Count - 1]);
        }

        return(null);
    }
    public static void CreateDungeons()
    {
        dungeonDictionary = new Dictionary <DungeonId, DungeonData>();

        //use this line to read from a json file
        //DungeonMap map = Utils.LoadJsonFromPath<DungeonMap>("data/dungeon_data");

        //instead, create the data manually
        var castle = new DungeonRow()
        {
            id = "CASTLE", bossesPerArea = 2, minibossesPerBoss = 1, battlesPerArea = 20, hpIncreasePerArea = 13, atkIncreasePerArea = 2, battleLimit = 0, areas = new string[] { "CAVERNS", "JAIL", "KITCHEN", "ARMORY", "THRONE_ROOM" }
        };
        DungeonMap map = new DungeonMap();

        map.dungeons = new DungeonRow[] { castle };

        DungeonRow  row;
        DungeonData tempDungeon;

        for (int i = 0; i < map.dungeons.Length; i++)
        {
            row = map.dungeons[i];

            DungeonId parsedType = (DungeonId)Enum.Parse(typeof(DungeonId), row.id);
            tempDungeon = new DungeonData(parsedType);

            tempDungeon.SetBattleConstraints(row.bossesPerArea, row.minibossesPerBoss, row.battlesPerArea, row.hpIncreasePerArea, row.atkIncreasePerArea, row.battleLimit);
            tempDungeon.SetAreas(row.areas);

            dungeonDictionary.Add(tempDungeon.type, tempDungeon);
        }


        areaMusicIds = new Dictionary <AdventureArea, string>();
        areaMusicIds[AdventureArea.CAVERNS]     = "stage_1";
        areaMusicIds[AdventureArea.JAIL]        = "jail";
        areaMusicIds[AdventureArea.KITCHEN]     = "kitchen";
        areaMusicIds[AdventureArea.ARMORY]      = "stage_2";
        areaMusicIds[AdventureArea.THRONE_ROOM] = "throne_room";

        areaMusicIds[AdventureArea.ARENA] = "stage_2";
    }
Example #9
0
 //highest level completed? let's make it 100
 public int GetHighestLevelCompleted(DungeonId inId)
 {
     return(100);
 }
Example #10
0
 //dark lord never in dungeon
 public bool DarkLordIsInDungeon(DungeonId inId)
 {
     return(false);
 }
 /// <summary>
 /// Gets the remaining <see cref="Waypoint"/>s in a dungeon, relative to the given starting position.
 /// </summary>
 /// <param name="dungeon">Dungeon to plan a <see cref="IRoute"/> for.</param>
 /// <param name="startingPos">Position to resume the <see cref="IRoute"/> from.</param>
 /// <returns>Remaining <see cref="Waypoint"/>s to complete the dungeon.</returns>
 public Queue <Waypoint> Calculate(DungeonId dungeon, Vector3 startingPos)
 {
     return(_dungeonRoutes[dungeon].Calculate(startingPos));
 }
 public static DungeonMode GetDungeonMode(this DungeonId dungeonId)
 {
     return(dungeonId.GetModeLogic().GetDungeonMode());
 }
 public static int GetChapter(this DungeonId dungeonId)
 {
     return(1);
     // return dungeonId.NodeId <= 10 ? 1 : 2;
 }
 public static bool IsSmallerThanOrEqual(this DungeonId a, DungeonId b)
 {
     return(a.IsSmallerThan(b) || a.Equals(b));
 }
 private DungeonData(DungeonId inType)
 {
     type = inType;
 }
 public static DungeonData GetDungeon(DungeonId id)
 {
     return(dungeonDictionary[id]);
 }