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 string GetGoalName(WonderMail wonderMail) { //if (wonderMail.MissionType == Enums.MissionType.CompleteDungeon) { // return Dungeons.DungeonManager.Dungeons[wonderMail.DungeonIndex].Name; //} if (wonderMail.RDungeonFloor == -1) { string mapName = null; using (Database.DatabaseConnection dbConnection = new Database.DatabaseConnection(Database.DatabaseID.Data)) { mapName = DataManager.Maps.MapDataManager.GetMapName(dbConnection.Database, MapManager.GenerateMapID(wonderMail.DungeonMapNum)); } if (!string.IsNullOrEmpty(mapName)) { return(mapName); } else { return("???"); } } else { return(RDungeons.RDungeonFloorGen.GenerateName(wonderMail.DungeonMapNum, wonderMail.RDungeonFloor)); } }
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; }
//public static Point DetermineGoalPoint(WonderMail wonderMail) { // Point val = new Point(0, 0); // bool selected = false; // // IMap map; // if (MapManager.IsMapActive(MapManager.GenerateMapID(wonderMail.GoalMap))) { // map = MapManager.RetrieveActiveMap(MapManager.GenerateMapID(wonderMail.GoalMap)); // } else { // map = MapManager.LoadMap(wonderMail.GoalMap); // } // We'll try 100 times to randomly select a tile // for (int i = 0; i < 100; i++) { // int x = Server.Math.Rand(0, map.MaxX + 1); // int y = Server.Math.Rand(0, map.MaxY + 1); // Check if the tile is walk able // if (map.Tile[x, y].Type == Enums.TileType.Walkable) { // val.X = x; // val.Y = y; // selected = true; // break; // } // } // Didn't select anything, so now we'll just try to find a free tile // if (!selected) { // for (int Y = 0; Y <= map.MaxY; Y++) { // for (int X = 0; X <= map.MaxX; X++) { // if (map.Tile[X, Y].Type == Enums.TileType.Walkable) { // val.X = X; // val.Y = Y; // selected = true; // } // } // } // } // return val; //} public static bool IsGoalMap(WonderMail wonderMail, IMap map) { if (wonderMail.RDungeonFloor == -1 && map.MapType == Enums.MapType.Standard) { if (((Map)map).MapNum == wonderMail.DungeonMapNum) { return(true); } } else if (wonderMail.RDungeonFloor == -1 && map.MapType == Enums.MapType.Instanced) { if (((InstancedMap)map).MapBase == wonderMail.DungeonMapNum) { return(true); } } else if (wonderMail.RDungeonFloor > -1 && map.MapType == Enums.MapType.RDungeonMap) { if (((RDungeonMap)map).RDungeonIndex == wonderMail.DungeonMapNum && ((RDungeonMap)map).RDungeonFloor == wonderMail.RDungeonFloor) { return(true); } } return(false); }
//public void TakeMission(int slot) { // owner.JobList.AddJob(new WonderMailJob(boardMissions[slot].RawMission)); // boardMissions.RemoveAt(slot); //} public void LoadMissionBoardData() { for (int i = 0; i < owner.PlayerData.MissionBoardMissions.Count; i++) { WonderMail mail = new WonderMail(owner.PlayerData.MissionBoardMissions[i]); if (Generator.AreIndicesLegal(mail)) { Generator.CalculateMailGoal(mail); Scripting.ScriptManager.InvokeSub("CreateMissionInfo", mail); boardMissions.Add(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); }
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 WonderMailJob(WonderMailJob mail) { mission = new WonderMail(new PlayerDataJobListItem()); mission.Data1 = mail.Mission.Data1; mission.Data2 = mail.Mission.Data2; mission.Difficulty = mail.Mission.Difficulty; mission.DungeonIndex = mail.Mission.DungeonIndex; mission.DungeonMapNum = mail.Mission.DungeonMapNum; mission.GoalMapIndex = mail.Mission.GoalMapIndex; mission.GoalName = mail.Mission.GoalName; mission.LoseStoryScript = mail.Mission.LoseStoryScript; mission.MissionClientIndex = mail.Mission.MissionClientIndex; mission.MissionType = mail.Mission.MissionType; mission.Mugshot = mail.Mission.Mugshot; mission.RDungeon = mail.Mission.RDungeon; mission.RDungeonFloor = mail.Mission.RDungeonFloor; mission.RewardIndex = mail.Mission.RewardIndex; mission.StartStoryScript = mail.Mission.StartStoryScript; mission.Summary = mail.Mission.Summary; mission.TargetIndex = mail.Mission.TargetIndex; mission.Title = mail.Mission.Title; mission.WinStoryScript = mail.Mission.WinStoryScript; }
public WonderMailJob(WonderMailJob mail) { mission = new WonderMail(new PlayerDataJobListItem()); mission.Data1 = mail.Mission.Data1; mission.Data2 = mail.Mission.Data2; mission.Difficulty = mail.Mission.Difficulty; mission.DungeonIndex = mail.Mission.DungeonIndex; mission.DungeonMapNum = mail.Mission.DungeonMapNum; mission.GoalMapIndex = mail.Mission.GoalMapIndex; mission.GoalName = mail.Mission.GoalName; mission.LoseStoryScript = mail.Mission.LoseStoryScript; mission.MissionClientIndex = mail.Mission.MissionClientIndex; mission.MissionType = mail.Mission.MissionType; mission.Mugshot = mail.Mission.Mugshot; mission.RDungeon = mail.Mission.RDungeon; mission.RDungeonFloor = mail.Mission.RDungeonFloor; mission.RewardIndex = mail.Mission.RewardIndex; mission.StartStoryScript = mail.Mission.StartStoryScript; mission.Summary = mail.Mission.Summary; mission.TargetIndex = mail.Mission.TargetIndex; mission.Title = mail.Mission.Title; mission.WinStoryScript = mail.Mission.WinStoryScript; }
public void GenerateMission() { WonderMail mail = Generator.Generate(owner.SelectCompletedDungeons(), owner.Client); if (mail != null) { if (boardMissions.Count >= Constants.MAX_JOB_LIST) { int excess = boardMissions.Count - Constants.MAX_JOB_LIST + 1; for (int i = 0; i < excess; i++) { boardMissions.RemoveAt(boardMissions.Count - 1); } } boardMissions.Insert(0, mail); if (owner.Map != null && owner.Map.Tile[owner.X, owner.Y].Type == Enums.TileType.MissionBoard) { Network.Messenger.SendAddedMission(owner.Client); } } LastGenTime = Core.GetTickCount().Tick; }
public WonderMailJob(WonderMail mail) { mission = mail; }
public WonderMailJob(PlayerDataJobListItem baseJobItem) { mission = new WonderMail(baseJobItem); }
public static void CreateMissionInfo(WonderMail mail) { MissionPool pool = WonderMailManager.Missions[(int)mail.Difficulty - 1]; switch (mail.MissionType) { case Enums.MissionType.Rescue: { int total = mail.DungeonIndex*pool.MissionClients.Count*pool.Rewards.Count + mail.MissionClientIndex*pool.Rewards.Count + mail.RewardIndex; switch (total % 8) { case 0: { mail.Title = "I can't get home!"; mail.Summary = "Whoa! It's too rough in here... Please, I need help!"; } break; case 1: { mail.Title = "I can't get home!"; mail.Summary = "I was set upon by bandits! Whoa! Someone! Help!"; } break; case 2: { mail.Title = "I was KO'd..."; mail.Summary = "I can't get back! I'm fading... Help..."; } break; case 3: { mail.Title = "I'm scared!"; mail.Summary = "My exploration went astray! I'm fading... Help..."; } break; case 4: { mail.Title = "Where am I?"; mail.Summary = "I can't take another step..."; } break; case 5: { mail.Title = "I fainted..."; mail.Summary = "I got lost in this dungeon! Someone, please!"; } break; case 6: { mail.Title = "I'm sad and lonely..."; mail.Summary = "Fighting that tough foe was a mistake... Aiyeeeeeeeeh!"; } break; case 7: { mail.Title = "I'm sad and lonely..."; mail.Summary = "This dungeon is scary! My consciousness is slipping... Help..."; } break; } } break; case Enums.MissionType.ItemRetrieval: { Item item = ItemManager.Items[mail.Data1]; int total = mail.DungeonIndex*pool.MissionClients.Count*pool.Rewards.Count + mail.MissionClientIndex*pool.Rewards.Count + mail.RewardIndex; switch (total % 2) { case 0: { mail.Title = "Find " + item.Name + "."; mail.Summary = "I'm looking for a " + item.Name + "! Please help me find it!"; } break; case 1: { mail.Title = "Deliver one " + item.Name + "."; mail.Summary = "I can't even find one " + item.Name + ". Please share one with me!"; } break; } } break; case Enums.MissionType.Escort: { int total = mail.DungeonIndex*pool.MissionClients.Count*pool.Rewards.Count + mail.MissionClientIndex*pool.Rewards.Count + mail.RewardIndex; switch (total % 2) { case 0: { mail.Title = "Take me!"; mail.Summary = "I want to see " + Pokedex.GetPokemon(mail.Data1).Name + ", but I can't make it alone... can somebody help?"; } break; case 1: { mail.Title = "Please, take me with you!"; mail.Summary = "I want to meet with " + Pokedex.GetPokemon(mail.Data1).Name + ". Someone, please escort me!"; } break; } } break; } mail.Mugshot = WonderMailManager.Missions.MissionPools[(int)mail.Difficulty - 1].MissionClients[mail.MissionClientIndex].Species; }
public static bool IsMissionAcceptable(Client client, WonderMail mail) { bool noItems = false; if (DungeonManager.Dungeons[mail.DungeonIndex].ScriptList.Count >= 2) { string[] reqString = DungeonManager.Dungeons[mail.DungeonIndex].ScriptList[1].Split(';'); for (int i = 0; i < reqString.Length; i++) { if (reqString[i] == "3,0") { noItems = true; } } if (mail.MissionType == Enums.MissionType.ItemRetrieval && noItems) { return false; } } if (mail.Difficulty >= Enums.JobDifficulty.SixStar && client.Player.ExplorerRank < Enums.ExplorerRank.Super) { return false; } else if (mail.Difficulty >= Enums.JobDifficulty.Star && client.Player.ExplorerRank < Enums.ExplorerRank.Gold) { return false; } else if (mail.Difficulty >= Enums.JobDifficulty.S && client.Player.ExplorerRank < Enums.ExplorerRank.Silver) { return false; } else if (mail.Difficulty >= Enums.JobDifficulty.B && client.Player.ExplorerRank < Enums.ExplorerRank.Bronze) { return false; } return true; }
public WonderMailJob(WonderMail mail) { mission = mail; }
public WonderMailJob(PlayerDataJobListItem baseJobItem) { mission = new WonderMail(baseJobItem); }
//public void TakeMission(int slot) { // owner.JobList.AddJob(new WonderMailJob(boardMissions[slot].RawMission)); // boardMissions.RemoveAt(slot); //} public void LoadMissionBoardData() { for (int i = 0; i < owner.PlayerData.MissionBoardMissions.Count; i++) { WonderMail mail = new WonderMail(owner.PlayerData.MissionBoardMissions[i]); if (Generator.AreIndicesLegal(mail)) { Generator.CalculateMailGoal(mail); Scripting.ScriptManager.InvokeSub("CreateMissionInfo", mail); boardMissions.Add(mail); } } }
public static string GetGoalName(WonderMail wonderMail) { //if (wonderMail.MissionType == Enums.MissionType.CompleteDungeon) { // return Dungeons.DungeonManager.Dungeons[wonderMail.DungeonIndex].Name; //} if (wonderMail.RDungeonFloor == -1) { string mapName = null; using (Database.DatabaseConnection dbConnection = new Database.DatabaseConnection(Database.DatabaseID.Data)) { mapName = DataManager.Maps.MapDataManager.GetMapName(dbConnection.Database, MapManager.GenerateMapID(wonderMail.DungeonMapNum)); } if (!string.IsNullOrEmpty(mapName)) { return mapName; } else { return "???"; } } else { return RDungeons.RDungeonFloorGen.GenerateName(wonderMail.DungeonMapNum, wonderMail.RDungeonFloor); } }
//public static Point DetermineGoalPoint(WonderMail wonderMail) { // Point val = new Point(0, 0); // bool selected = false; // // IMap map; // if (MapManager.IsMapActive(MapManager.GenerateMapID(wonderMail.GoalMap))) { // map = MapManager.RetrieveActiveMap(MapManager.GenerateMapID(wonderMail.GoalMap)); // } else { // map = MapManager.LoadMap(wonderMail.GoalMap); // } // We'll try 100 times to randomly select a tile // for (int i = 0; i < 100; i++) { // int x = Server.Math.Rand(0, map.MaxX + 1); // int y = Server.Math.Rand(0, map.MaxY + 1); // Check if the tile is walk able // if (map.Tile[x, y].Type == Enums.TileType.Walkable) { // val.X = x; // val.Y = y; // selected = true; // break; // } // } // Didn't select anything, so now we'll just try to find a free tile // if (!selected) { // for (int Y = 0; Y <= map.MaxY; Y++) { // for (int X = 0; X <= map.MaxX; X++) { // if (map.Tile[X, Y].Type == Enums.TileType.Walkable) { // val.X = X; // val.Y = Y; // selected = true; // } // } // } // } // return val; //} public static bool IsGoalMap(WonderMail wonderMail, IMap map) { if (wonderMail.RDungeonFloor == -1 && map.MapType == Enums.MapType.Standard) { if (((Map)map).MapNum == wonderMail.DungeonMapNum) { return true; } } else if (wonderMail.RDungeonFloor == -1 && map.MapType == Enums.MapType.Instanced) { if (((InstancedMap)map).MapBase == wonderMail.DungeonMapNum) { return true; } } else if (wonderMail.RDungeonFloor > -1 && map.MapType == Enums.MapType.RDungeonMap) { if (((RDungeonMap)map).RDungeonIndex == wonderMail.DungeonMapNum && ((RDungeonMap)map).RDungeonFloor == wonderMail.RDungeonFloor) { return true; } } return false; }