public IEnumerator <YieldInstruction> BeginRescue(string sosPath) { SOSMail sos = (SOSMail)DataManager.LoadRescueMail(sosPath); //specify seed with a random byte, verify goals work in all cases sos.RescueSeed = (byte)(MathUtils.Rand.NextUInt64() % byte.MaxValue); ReRandom rerand = new ReRandom(sos.Seed); for (int ii = 0; ii < sos.RescueSeed; ii++) { rerand.NextUInt64(); } yield return(CoroutineManager.Instance.StartCoroutine(BeginGame(sos.Goal.ID, rerand.NextUInt64(), GameProgress.DungeonStakes.Risk, true, false))); //set a rescuing boolean so that rescuability is disabled //must also set a goal variable somewhere //actually, just save the entire SOS mail somewhere as the current SOS DataManager.Instance.Save.Rescue = new RescueState(sos, true); //this is after saving the fail file, but before saving the first state of the replay yield return(CoroutineManager.Instance.StartCoroutine(BeginSegment(new ZoneLoc(sos.Goal.ID, new SegLoc(0, 0))))); //must also set script variables for dungeon if they matter //when this mission ends, all scripts must move the player back to the rescue start location... //if the mission was a success, the replay must be packaged into an AOK mail }
public IEnumerator <YieldInstruction> OnRescued(SOSMail mail) { string assetName = "zone_" + ZoneManager.Instance.CurrentZoneID; //Do script event yield return(CoroutineManager.Instance.StartCoroutine(RunScriptEvent(LuaEngine.EZoneCallbacks.Rescued, this, mail))); }
public void SetSOS(SOSMail sos) { Title.SetText(Text.FormatKey("MENU_SOS_TITLE")); Portraits = new SpeakerPortrait[sos.TeamProfile.Length]; for (int ii = 0; ii < sos.TeamProfile.Length; ii++) { Portraits[ii] = new SpeakerPortrait(sos.TeamProfile[ii], new EmoteStyle(sos.RescuedBy == null ? GraphicsManager.SOSEmotion : 0, true), new Loc(Bounds.X + Bounds.Width / 2 - (GraphicsManager.PortraitSize * sos.TeamProfile.Length + (sos.TeamProfile.Length - 1) * 2) / 2 + ii * (GraphicsManager.PortraitSize + 2), Bounds.Y + GraphicsManager.MenuBG.TileHeight + TitledStripMenu.TITLE_OFFSET), false); } Name.SetText(Text.FormatKey("MENU_SOS_CLIENT", sos.TeamName)); LastSeen.SetText(Text.FormatKey("MENU_SOS_DATE", sos.DateDefeated)); Goal.SetText(Text.FormatKey("MENU_SOS_GOAL", sos.GoalText.ToLocal().Replace('\n', ' '))); Reward.SetText(sos.OfferedItem.Value > 0 ? Text.FormatKey("MENU_SOS_REWARD", sos.OfferedItem.GetDungeonName()) : ""); }
public void SetSOS(SOSMail mail) { if (mail != null) { Name.Text = mail.TeamName; Reward.Text = Text.FormatKey("MENU_SOS_REWARD", mail.OfferedItem.Value > -1 ? mail.OfferedItem.GetDungeonName() : "---"); LastSeen.Text = Text.FormatKey("MENU_SOS_DATE", mail.DateDefeated); Goal.Text = Text.FormatKey("MENU_SOS_GOAL", mail.GoalText.ToLocal().Replace('\n', ' ')); Portraits = new SpeakerPortrait[mail.TeamProfile.Length]; for (int ii = 0; ii < mail.TeamProfile.Length; ii++) { Portraits[ii] = new SpeakerPortrait(mail.TeamProfile[ii], new EmoteStyle(GraphicsManager.SOSEmotion, true), new Loc(Bounds.End.X - GraphicsManager.MenuBG.TileWidth + (GraphicsManager.PortraitSize + 2) * (ii - mail.TeamProfile.Length), Bounds.Y + GraphicsManager.MenuBG.TileHeight), false); } } else { setError(); } }
public static void Continue(SOSMail rescueMail) { //check for presence of a main save-quicksave ReplayData replay = null; string recordDir = DataManager.QUICKSAVE_FILE_PATH; if (File.Exists(recordDir)) { replay = DataManager.Instance.LoadReplay(recordDir, true); if (replay == null) { cannotRead(recordDir); return; } } if (replay != null) { MenuManager.Instance.ClearMenus(); GameManager.Instance.SceneOutcome = continueReplay(replay, rescueMail); return; } //then, we should load a main save instead GameState state = DataManager.Instance.LoadMainGameState(); if (state == null) { cannotRead(DataManager.SAVE_FILE_PATH); return; } if (state.Save.Rescue != null) { state.Save.Rescue = null; DataManager.Instance.SaveGameState(state); } MenuManager.Instance.ClearMenus(); GameManager.Instance.SceneOutcome = continueMain(state); }
public override void Update(InputManager input) { Visible = true; NetworkManager.Instance.Update(); if (NetworkManager.Instance.Status == OnlineStatus.Offline) { //give offline message in a dialogue MenuManager.Instance.RemoveMenu(); if (CurrentState != ExchangeRescueState.Completed) { MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(NetworkManager.Instance.ExitMsg), false); } } else { if (CurrentState == ExchangeRescueState.Communicating) { //wait for an SOS ActivitySendHelp sendHelp = NetworkManager.Instance.Activity as ActivitySendHelp; if (sendHelp.CurrentState == ExchangeRescueState.SOSReady) { SOSMail sos = sendHelp.OfferedMail; aokPath = DataManager.FindRescueMail(DataManager.RESCUE_OUT_PATH + DataManager.AOK_PATH, sos, DataManager.AOK_EXTENSION); if (aokPath == null) { //no aok found; ask to receive SOS //TODO: check to see if SOS has already been sent //it needs to check if the reward is the same. SetSOS(sendHelp.OfferedMail); CurrentState = ExchangeRescueState.SOSReady; sendHelp.SetReady(CurrentState); QuestionDialog dialog = MenuManager.Instance.CreateQuestion(Text.FormatKey("DLG_RESCUE_RECEIVE_SOS_ASK", sendHelp.TargetInfo.Data.TeamName), () => { CurrentState = ExchangeRescueState.SOSTrading; sendHelp.SetReady(CurrentState); }, () => { //just disconnect MenuManager.Instance.RemoveMenu(); NetworkManager.Instance.Disconnect(); }); MenuManager.Instance.AddMenu(dialog, true); } else { //aok found; ask to send AOK aok = (AOKMail)DataManager.LoadRescueMail(aokPath); SetAOK(aok); CurrentState = ExchangeRescueState.AOKReady; sendHelp.OfferMail(aok); sendHelp.SetReady(CurrentState); } } } else if (CurrentState == ExchangeRescueState.SOSTrading) { //wait for the other party to also be SOSTrading or Completed ActivitySendHelp sendHelp = NetworkManager.Instance.Activity as ActivitySendHelp; if (sendHelp.CurrentState == ExchangeRescueState.SOSTrading || sendHelp.CurrentState == ExchangeRescueState.Completed) { //save the SOS mail DataManager.SaveRescueMail(DataManager.RESCUE_IN_PATH + DataManager.SOS_PATH, sendHelp.OfferedMail, false); MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(Text.FormatKey("DLG_RESCUE_RECEIVE_SOS", sendHelp.TargetInfo.Data.TeamName)), false); CurrentState = ExchangeRescueState.Completed; sendHelp.SetReady(CurrentState); } //the other possible outcome is that they just disconnect } else if (CurrentState == ExchangeRescueState.AOKReady) { //wait for other party's ready to receive SOS or ready to send AOK ActivitySendHelp sendHelp = NetworkManager.Instance.Activity as ActivitySendHelp; if (sendHelp.CurrentState == ExchangeRescueState.AOKReady) { //ready to receive SOS string baseAskString = (aok.OfferedItem.Value > -1) ? "DLG_RESCUE_SEND_AOK_ASK_REWARD" : "DLG_RESCUE_SEND_AOK_ASK"; QuestionDialog dialog = MenuManager.Instance.CreateQuestion(Text.FormatKey(baseAskString, sendHelp.TargetInfo.Data.TeamName), () => { CurrentState = ExchangeRescueState.AOKTrading; sendHelp.SetReady(CurrentState); }, () => { //just disconnect MenuManager.Instance.RemoveMenu(); NetworkManager.Instance.Disconnect(); }); MenuManager.Instance.AddMenu(dialog, true); } //the other possible outcome is that they just disconnect } else if (CurrentState == ExchangeRescueState.AOKTrading) { //wait for the other party to also be AOKTrading or Completed ActivitySendHelp sendHelp = NetworkManager.Instance.Activity as ActivitySendHelp; if (sendHelp.CurrentState == ExchangeRescueState.AOKTrading || sendHelp.CurrentState == ExchangeRescueState.Completed) { //delete the AOK file File.Delete(aokPath); if (aok.OfferedItem.Value > -1) { if (aok.OfferedItem.IsMoney) { DataManager.Instance.Save.ActiveTeam.Bank += aok.OfferedItem.Value; } else { List <InvItem> itemsToStore = new List <InvItem>(); itemsToStore.Add(aok.OfferedItem.MakeInvItem()); DataManager.Instance.Save.ActiveTeam.StoreItems(itemsToStore); } DataManager.Instance.SaveMainGameState(); MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(Text.FormatKey("DLG_RESCUE_SEND_AOK", sendHelp.TargetInfo.Data.TeamName), Text.FormatKey("DLG_RESCUE_SEND_AOK_REWARD")), false); } else { MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(Text.FormatKey("DLG_RESCUE_SEND_AOK", sendHelp.TargetInfo.Data.TeamName)), false); } CurrentState = ExchangeRescueState.Completed; sendHelp.SetReady(CurrentState); } //the other possible outcome is that they just disconnect } else if (CurrentState == ExchangeRescueState.Completed) { ActivitySendHelp sendHelp = NetworkManager.Instance.Activity as ActivitySendHelp; //wait for the other party to also be Completed to leave the transaction if (sendHelp.CurrentState == ExchangeRescueState.Completed) { MenuManager.Instance.RemoveMenu(); NetworkManager.Instance.Disconnect(); } } UpdateStatus(); } }
public override void Update(InputManager input) { Visible = true; NetworkManager.Instance.Update(); if (NetworkManager.Instance.Status == OnlineStatus.Offline) { //give offline message in a dialogue MenuManager.Instance.RemoveMenu(); if (CurrentState != ExchangeRescueState.Completed) { MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(NetworkManager.Instance.ExitMsg), false); } } else { if (CurrentState == ExchangeRescueState.Communicating) { //first send the SOS SOSMail mail = DataManager.Instance.Save.Rescue.SOS; CurrentState = ExchangeRescueState.SOSReady; ActivityGetHelp getHelp = NetworkManager.Instance.Activity as ActivityGetHelp; getHelp.OfferMail(mail); getHelp.SetReady(CurrentState); } else if (CurrentState == ExchangeRescueState.SOSReady) { //wait for other party's ready to receive SOS or ready to send AOK ActivityGetHelp getHelp = NetworkManager.Instance.Activity as ActivityGetHelp; if (getHelp.CurrentState == ExchangeRescueState.SOSReady) { //ready to receive SOS DialogueBox dialog = MenuManager.Instance.CreateQuestion(Text.FormatKey("DLG_RESCUE_SEND_SOS_ASK", getHelp.TargetInfo.Data.TeamName), () => { CurrentState = ExchangeRescueState.SOSTrading; getHelp.SetReady(CurrentState); }, () => { //just disconnect MenuManager.Instance.RemoveMenu(); NetworkManager.Instance.Disconnect(); }); MenuManager.Instance.AddMenu(dialog, true); } else if (getHelp.CurrentState == ExchangeRescueState.AOKReady) { //ready to receive AOK SetAOK(getHelp.OfferedMail); CurrentState = ExchangeRescueState.AOKReady; getHelp.SetReady(CurrentState); string baseAskString = (getHelp.OfferedMail.OfferedItem.Value > -1) ? "DLG_RESCUE_GET_AOK_ASK_REWARD" : "DLG_RESCUE_GET_AOK_ASK"; DialogueBox dialog = MenuManager.Instance.CreateQuestion(Text.FormatKey(baseAskString, getHelp.TargetInfo.Data.TeamName), () => { CurrentState = ExchangeRescueState.AOKTrading; getHelp.SetReady(CurrentState); }, () => { //just disconnect MenuManager.Instance.RemoveMenu(); NetworkManager.Instance.Disconnect(); }); MenuManager.Instance.AddMenu(dialog, true); } else if (getHelp.CurrentState == ExchangeRescueState.Completed) { //TODO: signal that an SOS has already been sent //MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(Text.FormatKey("DLG_RESCUE_SEND_SOS_ALREADY", getHelp.TargetInfo.Data.TeamName)), false); CurrentState = ExchangeRescueState.Completed; getHelp.SetReady(CurrentState); } } else if (CurrentState == ExchangeRescueState.SOSTrading) { //wait for the other party to also be SOSTrading or Completed ActivityGetHelp getHelp = NetworkManager.Instance.Activity as ActivityGetHelp; if (getHelp.CurrentState == ExchangeRescueState.SOSTrading || getHelp.CurrentState == ExchangeRescueState.Completed) { MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(Text.FormatKey("DLG_RESCUE_SEND_SOS", getHelp.TargetInfo.Data.TeamName)), false); CurrentState = ExchangeRescueState.Completed; getHelp.SetReady(CurrentState); } //the other possible outcome is that they just disconnect } else if (CurrentState == ExchangeRescueState.AOKTrading) { //wait for the other party to also be AOKTrading or Completed ActivityGetHelp getHelp = NetworkManager.Instance.Activity as ActivityGetHelp; if (getHelp.CurrentState == ExchangeRescueState.AOKTrading || getHelp.CurrentState == ExchangeRescueState.Completed) { //save the AOK file DataManager.SaveRescueMail(PathMod.NoMod(DataManager.RESCUE_IN_PATH + DataManager.AOK_FOLDER), getHelp.OfferedMail, false); if (getHelp.OfferedMail.OfferedItem.Value > -1) { //deduct your reward and save it to the base file GameState state = DataManager.Instance.LoadMainGameState(); state.Save.Rescue.SOS.OfferedItem = getHelp.OfferedMail.OfferedItem; DataManager.Instance.SaveGameState(state); MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(Text.FormatKey("DLG_RESCUE_GOT_AOK", getHelp.TargetInfo.Data.TeamName), Text.FormatKey("DLG_RESCUE_GOT_AOK_REWARD")), false); } else { MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(Text.FormatKey("DLG_RESCUE_GOT_AOK", getHelp.TargetInfo.Data.TeamName)), false); } CurrentState = ExchangeRescueState.Completed; getHelp.SetReady(CurrentState); } //the other possible outcome is that they just disconnect } else if (CurrentState == ExchangeRescueState.Completed) { ActivityGetHelp getHelp = NetworkManager.Instance.Activity as ActivityGetHelp; //wait for the other party to also be Completed to leave the transaction if (getHelp.CurrentState == ExchangeRescueState.Completed) { MenuManager.Instance.RemoveMenu(); NetworkManager.Instance.Disconnect(); } } UpdateStatus(); } }
private void choose(string fileName) { SOSMail mail = DataManager.LoadRescueMail(fileName) as SOSMail; MenuManager.Instance.AddMenu(new MailChosenMenu(sosMode && (mail != null), fileName, action, () => { DeleteAction(fileName); }), true); }
public IEnumerator <YieldInstruction> EndSegment(GameProgress.ResultType result) { if ((result == GameProgress.ResultType.Failed || result == GameProgress.ResultType.Downed || result == GameProgress.ResultType.TimedOut) && DataManager.Instance.CurrentReplay == null) { SE("Menu/Skip"); yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.ProcessMenuCoroutine(new MsgLogMenu()))); } BGM("", true); yield return(CoroutineManager.Instance.StartCoroutine(FadeOut(false))); yield return(new WaitForFrames(40)); if (DataManager.Instance.CurrentReplay != null) { //try to get the game state. if we can't get any states, then we must have quicksaved here if (DataManager.Instance.CurrentReplay.CurrentState < DataManager.Instance.CurrentReplay.States.Count) { GameState state = DataManager.Instance.CurrentReplay.ReadState(); DataManager.Instance.SetProgress(state.Save); LuaEngine.Instance.LoadSavedData(DataManager.Instance.Save); //notify script engine ZoneManager.LoadFromState(state.Zone); SceneOutcome = MoveToZone(DataManager.Instance.Save.NextDest); } else { //check for a rescue input GameAction rescued = null; if (DataManager.Instance.CurrentReplay.CurrentAction < DataManager.Instance.CurrentReplay.Actions.Count) { GameAction nextAction = DataManager.Instance.CurrentReplay.ReadCommand(); if (nextAction.Type == GameAction.ActionType.Rescue) { rescued = nextAction; } else//we shouldn't be hitting this point! give an error notification! { yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(Text.FormatKey("DLG_REPLAY_DESYNC")))); } } if (rescued != null) //run the action { yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.Instance.ProcessRescue(rescued, null))); } else if (DataManager.Instance.Save.Rescue != null && !DataManager.Instance.Save.Rescue.Rescuing) { //resuming a game that was just rescued DataManager.Instance.ResumePlay(DataManager.Instance.CurrentReplay.RecordDir, DataManager.Instance.CurrentReplay.QuicksavePos); DataManager.Instance.CurrentReplay = null; DataManager.Instance.Loading = DataManager.LoadMode.None; SOSMail mail = DataManager.Instance.Save.Rescue.SOS; //and then run the action rescued = new GameAction(GameAction.ActionType.Rescue, Dir8.None); rescued.AddArg(mail.OfferedItem.IsMoney ? 1 : 0); rescued.AddArg(mail.OfferedItem.Value); rescued.AddArg(mail.OfferedItem.HiddenValue); rescued.AddArg(mail.RescuedBy.Length); for (int ii = 0; ii < mail.RescuedBy.Length; ii++) { rescued.AddArg(mail.RescuedBy[ii]); } DataManager.Instance.LogPlay(rescued); yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.Instance.ProcessRescue(rescued, mail))); } else { if (DataManager.Instance.Loading == DataManager.LoadMode.Rescuing) { if (result == GameProgress.ResultType.Rescue) { //mark as verified RescueMenu menu = (RescueMenu)TitleScene.TitleMenuSaveState[TitleScene.TitleMenuSaveState.Count - 1]; menu.Verified = true; } //default is failure to verify yield return(CoroutineManager.Instance.StartCoroutine(EndReplay())); } else if (DataManager.Instance.Loading == DataManager.LoadMode.Loading) { //the game accepts loading into a file that has been downed, or passed its section with nothing else DataManager.Instance.ResumePlay(DataManager.Instance.CurrentReplay.RecordDir, DataManager.Instance.CurrentReplay.QuicksavePos); DataManager.Instance.CurrentReplay = null; SetFade(true, false); DataManager.Instance.Loading = DataManager.LoadMode.None; bool rescuing = DataManager.Instance.Save.Rescue != null && DataManager.Instance.Save.Rescue.Rescuing; //if failed, just show the death plaque //if succeeded, run the script that follows. SceneOutcome = ZoneManager.Instance.CurrentZone.OnExitSegment(result, rescuing); } else //we've reached the end of the replay { yield return(CoroutineManager.Instance.StartCoroutine(EndReplay())); } } } } else { string dateDefeated = String.Format("{0:yyyy-MM-dd}", DateTime.Now); bool rescue = false; if (result == GameProgress.ResultType.Downed && DataManager.Instance.Save.RescuesLeft > 0) { yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.ProcessMenuCoroutine(MenuManager.Instance.CreateQuestion(Text.FormatKey("DLG_RESCUE_ASK"), () => { rescue = true; }, () => { })))); } //trigger the end-segment script if (rescue) { DataManager.Instance.SuspendPlay(); GameState state = DataManager.Instance.LoadMainGameState(); SOSMail awaiting = new SOSMail(DataManager.Instance.Save, new ZoneLoc(ZoneManager.Instance.CurrentZoneID, ZoneManager.Instance.CurrentMapID), ZoneManager.Instance.CurrentMap.Name, dateDefeated, Versioning.GetVersion()); state.Save.Rescue = new RescueState(awaiting, false); DataManager.Instance.SaveGameState(state); DataManager.SaveRescueMail(DataManager.RESCUE_OUT_PATH + DataManager.SOS_PATH, state.Save.Rescue.SOS, true); yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(Text.FormatKey("DLG_RESCUE_INFO_1")))); yield return(new WaitForFrames(1)); MenuBase.Transparent = false; SceneOutcome = RestartToTitle(); yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.Instance.SuspendGame())); } else { bool rescuing = DataManager.Instance.Save.Rescue != null && DataManager.Instance.Save.Rescue.Rescuing; SceneOutcome = ZoneManager.Instance.CurrentZone.OnExitSegment(result, rescuing); } } }
private static IEnumerator <YieldInstruction> continueReplay(ReplayData replay, SOSMail rescueMail) { GameManager.Instance.BGM("", true); yield return(CoroutineManager.Instance.StartCoroutine(GameManager.Instance.FadeOut(false))); DataManager.Instance.MsgLog.Clear(); //load that up instead if found GameState state = replay.ReadState(); DataManager.Instance.SetProgress(state.Save); LuaEngine.Instance.LoadSavedData(DataManager.Instance.Save); //notify script engine ZoneManager.LoadFromState(state.Zone); //NOTE: In order to preserve debug consistency, you SHOULD set the language to that of the quicksave. //HOWEVER, it would be too inconvenient for players sharing their quicksaves, thus this feature is LEFT OUT. DataManager.Instance.Loading = DataManager.LoadMode.Loading; DataManager.Instance.CurrentReplay = replay; if (rescueMail != null) { DataManager.Instance.Save.Rescue = new RescueState(rescueMail, false); } yield return(CoroutineManager.Instance.StartCoroutine(ZoneManager.Instance.CurrentZone.OnInit())); if (DataManager.Instance.Save.NextDest.IsValid()) { yield return(CoroutineManager.Instance.StartCoroutine(GameManager.Instance.MoveToZone(DataManager.Instance.Save.NextDest))); } else { //no valid next dest happens when the player has saved in a ground map in the middle of an adventure DataManager.Instance.ResumePlay(DataManager.Instance.CurrentReplay.RecordDir, DataManager.Instance.CurrentReplay.QuicksavePos); DataManager.Instance.CurrentReplay = null; GameManager.Instance.SetFade(true, false); DataManager.Instance.Loading = DataManager.LoadMode.None; if (ZoneManager.Instance.CurrentMapID.Segment > -1) { GameManager.Instance.MoveToScene(Dungeon.DungeonScene.Instance); GameManager.Instance.BGM(ZoneManager.Instance.CurrentMap.Music, true); } else { GameManager.Instance.MoveToScene(Ground.GroundScene.Instance); GameManager.Instance.BGM(ZoneManager.Instance.CurrentGround.Music, true); } yield return(CoroutineManager.Instance.StartCoroutine(GameManager.Instance.FadeIn())); } }
public IEnumerator <YieldInstruction> ProcessRescue(GameAction action, SOSMail mail) { //delete all enemies for (int ii = ZoneManager.Instance.CurrentMap.MapTeams.Count - 1; ii >= 0; ii--) { for (int jj = ZoneManager.Instance.CurrentMap.MapTeams[ii].Players.Count - 1; jj >= 0; jj--) { yield return(CoroutineManager.Instance.StartCoroutine(ZoneManager.Instance.CurrentMap.MapTeams[ii].Players[jj].DieSilent())); } for (int jj = ZoneManager.Instance.CurrentMap.MapTeams[ii].Guests.Count - 1; jj >= 0; jj--) { yield return(CoroutineManager.Instance.StartCoroutine(ZoneManager.Instance.CurrentMap.MapTeams[ii].Guests[jj].DieSilent())); } } //heal players foreach (Character character in ActiveTeam.IterateMainByRank()) { if (character.Dead) { Loc?endLoc = ZoneManager.Instance.CurrentMap.GetClosestTileForChar(character, ActiveTeam.Leader.CharLoc); if (endLoc == null) { endLoc = ActiveTeam.Leader.CharLoc; } character.CharLoc = endLoc.Value; character.HP = character.MaxHP; character.Dead = false; character.DefeatAt = ""; ZoneManager.Instance.CurrentMap.UpdateExploration(character); } } ZoneManager.Instance.CurrentMap.CurrentTurnMap.CurrentOrder.TurnIndex = 0; ZoneManager.Instance.CurrentMap.CurrentTurnMap.CurrentOrder.Faction = Faction.Player; ZoneManager.Instance.CurrentMap.CurrentTurnMap.CurrentOrder.TurnTier = 0; ZoneManager.Instance.CurrentMap.CurrentTurnMap.CurrentOrder.SkipAll = false; RegenerateTurnMap(); RemoveDeadTeams(); DataManager.Instance.Save.RescuesLeft--; //fade white back with music //remove reward item MapItem offeredItem = new MapItem((action[0] == 1), action[1]); offeredItem.HiddenValue = action[2]; if (offeredItem.Value > -1) { if (offeredItem.IsMoney) { ActiveTeam.Bank -= offeredItem.Value; } else { ItemData entry = DataManager.Instance.GetItem(offeredItem.Value); if (entry.MaxStack > 1) { List <int> itemsToTake = new List <int>(); for (int ii = 0; ii < offeredItem.HiddenValue; ii++) { itemsToTake.Add(offeredItem.Value); } ActiveTeam.TakeItems(itemsToTake); } else if (entry.UsageType == ItemData.UseType.Box) { int chosenIndex = 0; for (int ii = 0; ii < ActiveTeam.BoxStorage.Count; ii++) { if (ActiveTeam.BoxStorage[ii].ID == offeredItem.Value && ActiveTeam.BoxStorage[ii].HiddenValue == offeredItem.HiddenValue) { chosenIndex = ii; break; } } List <int> itemsToTake = new List <int>(); itemsToTake.Add(DataManager.Instance.DataIndices[DataManager.DataType.Item].Count + chosenIndex); } else { List <int> itemsToTake = new List <int>(); itemsToTake.Add(offeredItem.Value); ActiveTeam.TakeItems(itemsToTake); } } } if (DataManager.Instance.CurrentReplay == null) { yield return(CoroutineManager.Instance.StartCoroutine(ZoneManager.Instance.CurrentZone.OnRescued(mail))); yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(Text.FormatKey("MSG_RESCUES_LEFT", DataManager.Instance.Save.RescuesLeft)))); yield return(new WaitForFrames(1)); } else { GameManager.Instance.SE(GraphicsManager.ReviveSE); GameManager.Instance.SetFade(true, true); yield return(CoroutineManager.Instance.StartCoroutine(GameManager.Instance.FadeIn())); int nameLength = action[3]; string name = ""; for (int ii = 0; ii < nameLength; ii++) { name += (char)action[4 + ii]; } LogMsg(Text.FormatKey("MSG_RESCUED_BY", name)); } ZoneManager.Instance.CurrentMap.NoRescue = true; yield return(CoroutineManager.Instance.StartCoroutine(ProcessTurnStart(CurrentCharacter))); }
public void OfferMail(SOSMail mail) { netPacketProcessor.SendNetSerializable(partner, new ExchangeSOSState { State = mail }, DeliveryMethod.ReliableOrdered); }