public static void CalculateMailGoal(WonderMail mail) { Dungeons.IDungeonMap goalMap = null; if (mail.RDungeon) { goalMap = Dungeons.DungeonManager.Dungeons[mail.DungeonIndex].RandomMaps[mail.GoalMapIndex]; } else { goalMap = Dungeons.DungeonManager.Dungeons[mail.DungeonIndex].StandardMaps[mail.GoalMapIndex]; } mail.Difficulty = goalMap.Difficulty; if (goalMap.DungeonMapType == Enums.MapType.Standard) { mail.DungeonMapNum = ((Dungeons.StandardDungeonMap)goalMap).MapNum; mail.RDungeonFloor = -1; } else if (goalMap.DungeonMapType == Enums.MapType.RDungeonMap) { mail.DungeonMapNum = ((Dungeons.RandomDungeonMap)goalMap).RDungeonIndex; mail.RDungeonFloor = ((Dungeons.RandomDungeonMap)goalMap).RDungeonFloor; } mail.GoalName = GetGoalName(mail); }
public static bool AreIndicesLegal(WonderMail mail) { if (mail.DungeonIndex >= Dungeons.DungeonManager.Dungeons.Count) { return(false); } Dungeons.IDungeonMap goalMap = null; if (mail.RDungeon) { if (mail.GoalMapIndex >= Dungeons.DungeonManager.Dungeons[mail.DungeonIndex].RandomMaps.Count) { return(false); } else { goalMap = Dungeons.DungeonManager.Dungeons[mail.DungeonIndex].RandomMaps[mail.GoalMapIndex]; } } else { if (mail.GoalMapIndex >= Dungeons.DungeonManager.Dungeons[mail.DungeonIndex].StandardMaps.Count) { return(false); } else { goalMap = Dungeons.DungeonManager.Dungeons[mail.DungeonIndex].StandardMaps[mail.GoalMapIndex]; } } if (mail.MissionClientIndex >= WonderMailManager.Missions[(int)goalMap.Difficulty - 1].MissionClients.Count) { return(false); } if (mail.RewardIndex >= WonderMailManager.Missions[(int)goalMap.Difficulty - 1].Rewards.Count) { return(false); } return(true); }