private static void WriteCatchInfo(PacketSerializer serializer, CatchInfo value, bool writeDefaultLength = true) { serializer.Write(value.Method); serializer.Write(value.Location); serializer.Write(value.TrainerName); serializer.Write(value.TrainerID); serializer.Write(value.PokeballID); serializer.Write(value.Nickname); }
private CatchInfoBase <Task> .CatchResult StartNextRequestError(CatchInfo errorInfo) { // StartNextRequestAsync should handle it's own exceptions. LogHelper.LogException(_logger, "Unexpected exception.", errorInfo.Exception); Contract.Assert(false, "Un-expected exception path: " + errorInfo.Exception.ToString()); #if DEBUG // Break into the debugger in case the message pump fails. System.Diagnostics.Debugger.Break(); #endif return(errorInfo.Throw()); }
private void ballMovedToTile(Ball pBall) { Player cutPlayer; if (isBallCut(pBall, out cutPlayer)) { ApplicationFactory.instance.m_messageBus.dispatchTackleBattleStart(); FX02 fx = ApplicationFactory.instance.m_fxManager.createFX02(cutPlayer.transform.position); fx.init(); if (cutPlayer.isGK) { bool isGoal = UnityEngine.Random.RandomRange(0.0f, 1.0f) > 0.5f; if (isGoal) { fx.e_end += catchGoalStart; } else { fx.e_end += catchNoGoalStart; } m_catchInfo = new CatchInfo(); m_catchInfo.m_isGoal = isGoal; m_catchInfo.m_catchPlayer = cutPlayer; } else { bool isPass = UnityEngine.Random.RandomRange(0.0f, 1.0f) > 0.5f; if (isPass) { fx.e_end += cutPassStart; } else { fx.e_end += cutNoPassStart; } m_cutInfo = new CutInfo(); m_cutInfo.m_isPass = isPass; m_cutInfo.m_cutPlayer = cutPlayer; } } else { pBall.moveToNextSquare(); } }
public CatchInfoBase <Task> .CatchResult Complete(CatchInfo catchInfo) { Detach(); return(catchInfo.Throw()); }
/// <summary> /// Initializes a new instance of the <see cref="CustomEventArgs"/> class. /// </summary> /// <param name="catch">The catch info.</param> /// <param name="eventKey">The key for the event.</param> /// <exception cref="ArgumentNullException">An argument was null.</exception> public CustomEventArgs(CatchInfo @catch, NamespacedKey eventKey) { this.Catch = @catch ?? throw new ArgumentNullException(nameof(@catch)); this.EventKey = eventKey; }
private CatchInfoBase<Task>.CatchResult HandleAcceptError(CatchInfo errorInfo) { HandleAcceptError(errorInfo.Exception); return errorInfo.Handled(); }
public CatchInfoBase<Task>.CatchResult Complete(CatchInfo catchInfo) { Detach(); return catchInfo.Throw(); }
private CatchInfoBase <Task> .CatchResult HandleAcceptError(CatchInfo errorInfo) { HandleAcceptError(errorInfo.Exception); return(errorInfo.Handled()); }
/// <summary> /// Initializes a new instance of the <see cref="CaughtItemEventArgs"/> class. /// </summary> /// <param name="catch">The catch info.</param> /// <exception cref="ArgumentNullException">An argument was null.</exception> public CaughtItemEventArgs(CatchInfo @catch) { this.Catch = @catch ?? throw new ArgumentNullException(nameof(@catch)); }
private CatchInfoBase<Task>.CatchResult HandleError(IHttpResponseDelegate response, CatchInfo errorInfo) { Console.Error.WriteLine("Error from Gate application."); Console.Error.WriteStackTrace(errorInfo.Exception); response.OnResponse(new HttpResponseHead() { Status = "503 Internal Server Error", Headers = new Dictionary<string, string>() { { "Connection", "close" } } }, null); return errorInfo.Handled(); }
public Monster(DataItems dataItems) : this(GetID(dataItems), GetGender(dataItems), GetIsShiny(dataItems), GetAbility(dataItems), GetNature(dataItems)) { var dict = dataItems.ToDictionary(); Experience = int.Parse(dict["Experience"]); Friendship = byte.Parse(dict["Friendship"]); EggSteps = int.Parse(dict["EggSteps"]); CatchInfo = new CatchInfo() { Nickname = string.IsNullOrEmpty(dict["NickName"]) ? string.Empty : dict["NickName"], PokeballID = byte.Parse(dict["CatchBall"]), Method = dict["CatchMethod"], Location = dict["CatchLocation"], TrainerName = dict["CatchTrainer"], TrainerID = (ushort)int.Parse(dict["OT"]).BitsGet(0, 16) == ushort.MaxValue ? (ushort)int.Parse(dict["OT"]).BitsGet(16, 32) : (ushort)int.Parse(dict["OT"]).BitsGet(0, 16) }; if (short.TryParse(dict["Item"], out var item) && item != 0) { HeldItem = new Item(item); } var move0 = dict["Attack1"].Split(','); var move1 = dict["Attack2"].Split(','); var move2 = dict["Attack3"].Split(','); var move3 = dict["Attack4"].Split(','); Moves = new List <BaseAttackInstance>(); if (move0.Length != 1) { var dat = Cached <AttackStaticData> .Get(short.Parse(move0[0])); var ppUps = (byte)Math.Round((double)(byte.Parse(move0[1]) - dat.PP) / dat.PP / 0.2D); Moves.Add(new Attack(dat, byte.Parse(move0[2]), ppUps)); } if (move1.Length != 1) { var dat = Cached <AttackStaticData> .Get(short.Parse(move1[0])); var ppUps = (byte)Math.Round((double)(byte.Parse(move1[1]) - dat.PP) / dat.PP / 0.2D); Moves.Add(new Attack(dat, byte.Parse(move1[2]), ppUps)); } if (move2.Length != 1) { var dat = Cached <AttackStaticData> .Get(short.Parse(move2[0])); var ppUps = (byte)Math.Round((double)(byte.Parse(move2[1]) - dat.PP) / dat.PP / 0.2D); Moves.Add(new Attack(dat, byte.Parse(move2[2]), ppUps)); } if (move3.Length != 1) { var dat = Cached <AttackStaticData> .Get(short.Parse(move3[0])); var ppUps = (byte)Math.Round((double)(byte.Parse(move3[1]) - dat.PP) / dat.PP / 0.2D); Moves.Add(new Attack(dat, byte.Parse(move3[2]), ppUps)); } CurrentHP = short.Parse(dict["HP"]); var ev = dict["EVs"].Split(','); var ev0 = short.Parse(ev[0]); var ev1 = short.Parse(ev[1]); var ev2 = short.Parse(ev[2]); var ev3 = short.Parse(ev[3]); var ev4 = short.Parse(ev[4]); var ev5 = short.Parse(ev[5]); EV = new Stats(ev0, ev1, ev2, ev3, ev4, ev5); var iv = dict["IVs"].Split(','); var iv0 = short.Parse(iv[0]); var iv1 = short.Parse(iv[1]); var iv2 = short.Parse(iv[2]); var iv3 = short.Parse(iv[3]); var iv4 = short.Parse(iv[4]); var iv5 = short.Parse(iv[5]); IV = new Stats(iv0, iv1, iv2, iv3, iv4, iv5); }
private CatchInfoBase <Task> .CatchResult HandleError(IHttpResponseDelegate response, CatchInfo errorInfo) { Console.Error.WriteLine("Error from Gate application."); Console.Error.WriteStackTrace(errorInfo.Exception); response.OnResponse(new HttpResponseHead() { Status = "503 Internal Server Error", Headers = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { { "Connection", "close" } } }, null); return(errorInfo.Handled()); }