protected Zone GetZoneById(ZoneId id, bool spawnIfMissing) { Zone zone = null; bool exists = this.zones.ContainsKey(id); if (!exists && spawnIfMissing) { List <Region> neighborRegionTypes = this.GetNeighborRegions(id); Region regionType = this.GetComponent <RegionSelector> ().GetRandomConnectableRegion( neighborRegionTypes ); zone = regionType.SpawnZone( id , this.GetComponent <LevelAttributes> ().zoneDimensions ); this.zones.Add(id, zone); } else if (exists) { zone = this.zones [id]; } return(zone); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name_Renamed = (string)newValue; break; case -1422950650: // active this.active_Renamed = (bool?)newValue.Value; break; case 1255686170: // fixingTime this.fixingTime_Renamed = (LocalTime)newValue; break; case 1255870713: // fixingZone this.fixingZone_Renamed = (ZoneId)newValue; break; case -1321546630: // template this.template_Renamed = (FixedIborSwapTemplate)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public void ProcessOpenZoneInterest(Guid sessionId, ZoneId zoneId) { if (zoneId == null) { mLogger.Error("ZoneId is null!!"); return; } mLogger.Debug("sessionId: " + sessionId + " is now interested in zoneId: " + zoneId); if (mSessionManager.SessionIdHasInterest(sessionId, zoneId)) { mLogger.Warn(String.Format("sessionId: {0} already has interest in zoneId: {1}", sessionId, zoneId)); return; } // Record the new zone interest in our dictionaries mSessionManager.AddZoneIdInterestToSessionId(sessionId, zoneId); List <IServerDistributedObject> objects = mServerObjectRepository.GetObjectsInZone(zoneId); List <Guid> sessionIds = new List <Guid>(); sessionIds.Add(sessionId); foreach (IServerDistributedObject obj in objects) { mLogger.Debug("ProcessOpenInterest: sending create for objId " + obj.DistributedObjectId + " to session: " + sessionId); SendCreateObjectMessage(obj, sessionIds); mServerObjectRepository.SendDistributedObjectStateUpdate((ServerDistributedObject)obj); } }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 116685664: // longShort this.longShort_Renamed = (LongShort)newValue; break; case -816738431: // expiryDate this.expiryDate_Renamed = (LocalDate)newValue; break; case -816254304: // expiryTime this.expiryTime_Renamed = (LocalTime)newValue; break; case -816069761: // expiryZone this.expiryZone_Renamed = (ZoneId)newValue; break; case -1770633379: // underlying this.underlying_Renamed = (FxSingle)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
// Returns the zone that this object is currently in. public ZoneId GetZone(IServerDistributedObject obj) { ZoneId zoneId = null; mDistributedObjectIdToObjectZones.TryGetValue(obj.DistributedObjectId, out zoneId); return(zoneId); }
public override int GetHashCode() { int hash = 1; if (ZoneId != 0) { hash ^= ZoneId.GetHashCode(); } if (ZoneName.Length != 0) { hash ^= ZoneName.GetHashCode(); } if (ServerId != 0) { hash ^= ServerId.GetHashCode(); } if (ServerName.Length != 0) { hash ^= ServerName.GetHashCode(); } if (Status != 0) { hash ^= Status.GetHashCode(); } if (UserCount != 0) { hash ^= UserCount.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void TransitionFromCreateToEdit(SceneLayoutData sceneLayoutData, PrefabContentKey loadingScreenPrefab) { string sceneNameFromZoneName = IglooMediator.GetSceneNameFromZoneName(sceneLayoutData.LotZoneName); if (DataManager.LayoutManager.HasCachedLayoutData()) { DataManager.LayoutManager.RemoveCachedSceneLayout(); } DataManager.LayoutManager.RemoveActiveSceneLayout(); if (previouslyPublishedLotName != sceneLayoutData.LotZoneName) { ZoneId zoneId = new ZoneId(); zoneId.name = sceneLayoutData.LotZoneName; zoneId.instanceId = Service.Get <ZoneTransitionService>().CurrentInstanceId; Service.Get <ZoneTransitionService>().LoadIgloo(zoneId, Service.Get <Localizer>().Language, SceneStateData.SceneState.Edit); return; } Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add(SceneTransitionService.SceneArgs.LoadingScreenOverride.ToString(), loadingScreenPrefab.Key); SceneSwapper.SwapScene(sceneNameFromZoneName, dictionary, delegate { SetState(SceneStateData.SceneState.Edit); ResetUI(); DataManager.LayoutManager.AddNewSceneLayoutData(sceneLayoutData); CloseManageIglooPopup(); }); }
private const double TOLERANCE_PRICE_CALIBRATION_LS = 5.0E-4; // Calibration Least Square; result not exact //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void normal_cube() public virtual void normal_cube() { double beta = 0.50; Surface betaSurface = ConstantSurface.of("Beta", beta).withMetadata(DefaultSurfaceMetadata.builder().xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).zValueType(ValueType.SABR_BETA).surfaceName("Beta").build()); double shift = 0.0300; Surface shiftSurface = ConstantSurface.of("Shift", shift).withMetadata(DefaultSurfaceMetadata.builder().xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).surfaceName("Shift").build()); SabrParametersSwaptionVolatilities calibrated = SABR_CALIBRATION.calibrateWithFixedBetaAndShift(DEFINITION, CALIBRATION_TIME, DATA_SPARSE, MULTICURVE, betaSurface, shiftSurface); for (int looptenor = 0; looptenor < TENORS.size(); looptenor++) { double tenor = TENORS.get(looptenor).get(ChronoUnit.YEARS); for (int loopexpiry = 0; loopexpiry < EXPIRIES.size(); loopexpiry++) { LocalDate expiry = EUR_FIXED_1Y_EURIBOR_6M.FloatingLeg.StartDateBusinessDayAdjustment.adjust(CALIBRATION_DATE.plus(EXPIRIES.get(loopexpiry)), REF_DATA); LocalDate effectiveDate = EUR_FIXED_1Y_EURIBOR_6M.calculateSpotDateFromTradeDate(expiry, REF_DATA); LocalDate endDate = effectiveDate.plus(TENORS.get(looptenor)); SwapTrade swap = EUR_FIXED_1Y_EURIBOR_6M.toTrade(CALIBRATION_DATE, effectiveDate, endDate, BuySell.BUY, 1.0, 0.0); double parRate = SWAP_PRICER.parRate(swap.resolve(REF_DATA).Product, MULTICURVE); ZonedDateTime expiryDateTime = expiry.atTime(11, 0).atZone(ZoneId.of("Europe/Berlin")); double time = calibrated.relativeTime(expiryDateTime); for (int loopmoney = 0; loopmoney < MONEYNESS.size(); loopmoney++) { if (!double.IsNaN(DATA_ARRAY_SPARSE[looptenor][loopexpiry][loopmoney])) { double strike = parRate + MONEYNESS.get(loopmoney); double volBlack = calibrated.volatility(expiryDateTime, tenor, strike, parRate); double priceComputed = BlackFormulaRepository.price(parRate + shift, parRate + MONEYNESS.get(loopmoney) + shift, time, volBlack, true); double priceNormal = NormalFormulaRepository.price(parRate, parRate + MONEYNESS.get(loopmoney), time, DATA_ARRAY_SPARSE[looptenor][loopexpiry][loopmoney], PutCall.CALL); assertEquals(priceComputed, priceNormal, TOLERANCE_PRICE_CALIBRATION_LS); } } } } }
public virtual void test_volatilities() { BlackFxOptionInterpolatedNodalSurfaceVolatilitiesSpecification @base = BlackFxOptionInterpolatedNodalSurfaceVolatilitiesSpecification.builder().name(VOL_NAME).currencyPair(GBP_USD).dayCount(ACT_365F).nodes(NODES).timeInterpolator(PCHIP).strikeInterpolator(DOUBLE_QUADRATIC).build(); LocalDate date = LocalDate.of(2017, 9, 25); ZonedDateTime dateTime = date.atStartOfDay().atZone(ZoneId.of("Europe/London")); DoubleArray parameters = DoubleArray.of(0.19, 0.15, 0.13, 0.14, 0.14, 0.11, 0.09, 0.09, 0.11, 0.09, 0.07, 0.07); BlackFxOptionSurfaceVolatilities computed = @base.volatilities(dateTime, parameters, REF_DATA); DaysAdjustment expOffset = DaysAdjustment.ofBusinessDays(-2, NY_LO); double[] expiries = new double[STRIKES.Count * TENORS.Count]; double[] strikes = new double[STRIKES.Count * TENORS.Count]; ImmutableList.Builder <ParameterMetadata> paramMetadata = ImmutableList.builder(); for (int i = 0; i < TENORS.Count; ++i) { double expiry = ACT_365F.relativeYearFraction(date, expOffset.adjust(BDA.adjust(SPOT_OFFSET.adjust(date, REF_DATA).plus(TENORS[i]), REF_DATA), REF_DATA)); for (int j = 0; j < STRIKES.Count; ++j) { paramMetadata.add(FxVolatilitySurfaceYearFractionParameterMetadata.of(expiry, SimpleStrike.of(STRIKES[j]), GBP_USD)); expiries[STRIKES.Count * i + j] = expiry; strikes[STRIKES.Count * i + j] = STRIKES[j]; } } InterpolatedNodalSurface surface = InterpolatedNodalSurface.ofUnsorted(Surfaces.blackVolatilityByExpiryStrike(VOL_NAME.Name, ACT_365F).withParameterMetadata(paramMetadata.build()), DoubleArray.ofUnsafe(expiries), DoubleArray.ofUnsafe(strikes), parameters, GridSurfaceInterpolator.of(PCHIP, DOUBLE_QUADRATIC)); BlackFxOptionSurfaceVolatilities expected = BlackFxOptionSurfaceVolatilities.of(VOL_NAME, GBP_USD, dateTime, surface); assertEquals(computed, expected); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void writeDateTime(java.time.ZonedDateTime zonedDateTime) throws java.io.IOException public override void WriteDateTime(ZonedDateTime zonedDateTime) { long epochSecondLocal = zonedDateTime.toLocalDateTime().toEpochSecond(UTC); int nano = zonedDateTime.Nano; ZoneId zone = zonedDateTime.Zone; if (zone is ZoneOffset) { int offsetSeconds = (( ZoneOffset )zone).TotalSeconds; PackStructHeader(DATE_TIME_WITH_ZONE_OFFSET_SIZE, DATE_TIME_WITH_ZONE_OFFSET); Pack(epochSecondLocal); Pack(nano); Pack(offsetSeconds); } else { string zoneId = zone.Id; PackStructHeader(DATE_TIME_WITH_ZONE_NAME_SIZE, DATE_TIME_WITH_ZONE_NAME); Pack(epochSecondLocal); Pack(nano); Pack(zoneId); } }
public TemporalAccessorAnonymousInnerClassHelper(TemporalAccessor temporal, Chronology effectiveChrono, ZoneId effectiveZone, ChronoLocalDate effectiveDate) { this.Temporal = temporal; this.EffectiveChrono = effectiveChrono; this.EffectiveZone = effectiveZone; this.EffectiveDate = effectiveDate; }
public RoomIdentifier(string world, Language language, ZoneId zoneId, string contentIdentifier) { this.world = world; this.language = language; this.zoneId = zoneId; this.contentIdentifier = contentIdentifier; }
public override void Convert(byte[] rawData) { WorldMapOverlayEntry val = new WorldMapOverlayEntry(); val.WorldMapOverlayId = (WorldMapOverlayId)DBCRecordConverter.GetUInt32(rawData, 0); for (int index = 0; index < val.ZoneTemplateId.Length; ++index) { ZoneId uint32 = (ZoneId)DBCRecordConverter.GetUInt32(rawData, 2 + index); if (uint32 != ZoneId.None) { val.ZoneTemplateId[index] = uint32; ZoneTemplate zoneTemplate = WCell.RealmServer.Global.World.s_ZoneTemplates[(int)uint32]; if (zoneTemplate == null) { LogManager.GetCurrentClassLogger().Warn(string.Format( "Invalid ZoneId #{0} found at WorldMapOverlay #{1} during the DBC loading.", (object)uint32, (object)val.WorldMapOverlayId)); } else { zoneTemplate.WorldMapOverlays.Add(val.WorldMapOverlayId); } } else { break; } } ArrayUtil.Set <WorldMapOverlayEntry>(ref WCell.RealmServer.Global.World.s_WorldMapOverlayEntries, (uint)val.WorldMapOverlayId, val); }
public RoomIdentifier() { world = ""; language = Language.none; zoneId = new ZoneId(); contentIdentifier = ""; }
private static IborIndex parseIborIndex(CsvRow row) { string name = row.getValue(NAME_FIELD); Currency currency = Currency.parse(row.getValue(CURRENCY_FIELD)); bool active = bool.Parse(row.getValue(ACTIVE_FIELD)); DayCount dayCount = DayCount.of(row.getValue(DAY_COUNT_FIELD)); HolidayCalendarId fixingCal = HolidayCalendarId.of(row.getValue(FIXING_CALENDAR_FIELD)); int offsetDays = int.Parse(row.getValue(OFFSET_DAYS_FIELD)); HolidayCalendarId offsetCal = HolidayCalendarId.of(row.getValue(OFFSET_CALENDAR_FIELD)); HolidayCalendarId effectiveCal = HolidayCalendarId.of(row.getValue(EFFECTIVE_DATE_CALENDAR_FIELD)); Tenor tenor = Tenor.parse(row.getValue(TENOR_FIELD)); LocalTime time = LocalTime.parse(row.getValue(FIXING_TIME_FIELD), TIME_FORMAT); ZoneId zoneId = ZoneId.of(row.getValue(FIXING_ZONE_FIELD)); DayCount fixedLegDayCount = DayCount.of(row.getValue(FIXED_LEG_DAY_COUNT)); // interpret CSV DaysAdjustment fixingOffset = DaysAdjustment.ofBusinessDays(-offsetDays, offsetCal, BusinessDayAdjustment.of(PRECEDING, fixingCal)).normalized(); DaysAdjustment effectiveOffset = DaysAdjustment.ofBusinessDays(offsetDays, offsetCal, BusinessDayAdjustment.of(FOLLOWING, effectiveCal)).normalized(); // convention can be two different things PeriodAdditionConvention periodAdditionConvention = PeriodAdditionConvention.extendedEnum().find(row.getField(TENOR_CONVENTION_FIELD)).orElse(PeriodAdditionConventions.NONE); BusinessDayConvention tenorBusinessConvention = BusinessDayConvention.extendedEnum().find(row.getField(TENOR_CONVENTION_FIELD)).orElse(isEndOfMonth(periodAdditionConvention) ? MODIFIED_FOLLOWING : FOLLOWING); BusinessDayAdjustment adj = BusinessDayAdjustment.of(tenorBusinessConvention, effectiveCal); TenorAdjustment tenorAdjustment = TenorAdjustment.of(tenor, periodAdditionConvention, adj); // build result return(ImmutableIborIndex.builder().name(name).currency(currency).active(active).dayCount(dayCount).fixingCalendar(fixingCal).fixingDateOffset(fixingOffset).effectiveDateOffset(effectiveOffset).maturityDateOffset(tenorAdjustment).fixingTime(time).fixingZone(zoneId).defaultFixedLegDayCount(fixedLegDayCount).build()); }
private int CompareNamedZonesWithMapping(ZoneId thisZone, ZoneId thatZone) { string thisZoneNormalized = TimeZones.Map(TimeZones.Map(thisZone.Id)); string thatZoneNormalized = TimeZones.Map(TimeZones.Map(thatZone.Id)); return(thisZoneNormalized.CompareTo(thatZoneNormalized)); }
public WorldState(MapId mapId, ZoneId zoneId, uint key, int value) { this.MapId = mapId; this.ZoneId = zoneId; this.Key = (WorldStateId)key; this.DefaultValue = value; }
public JoinIglooSequence(ClubPenguinClient client, ZoneId igloo, string language, IJoinIglooErrorHandler errorHandler) { clubPenguinClient = client; iglooToJoin = igloo; this.language = language; this.errorHandler = errorHandler; }
public WorldState(MapId mapId, ZoneId zoneId, uint key, int value) { MapId = mapId; ZoneId = zoneId; Key = (WorldStateId)key; DefaultValue = value; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(enabled = true) public void log_normal_atm() public virtual void log_normal_atm() { double beta = 0.50; Surface betaSurface = ConstantSurface.of("Beta", beta).withMetadata(DefaultSurfaceMetadata.builder().xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).zValueType(ValueType.SABR_BETA).surfaceName("Beta").build()); double shift = 0.0000; Surface shiftSurface = ConstantSurface.of("Shift", shift).withMetadata(DefaultSurfaceMetadata.builder().xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).surfaceName("Shift").build()); SabrParametersSwaptionVolatilities calibratedSmile = SABR_CALIBRATION.calibrateWithFixedBetaAndShift(DEFINITION, CALIBRATION_TIME, DATA_SPARSE, MULTICURVE, betaSurface, shiftSurface); SabrParametersSwaptionVolatilities calibratedAtm = SABR_CALIBRATION.calibrateAlphaWithAtm(NAME_SABR, calibratedSmile, MULTICURVE, ATM_LOGNORMAL_SIMPLE, TENORS_SIMPLE, EXPIRIES_SIMPLE_2, INTERPOLATOR_2D); int nbExp = EXPIRIES_SIMPLE_2.size(); int nbTenor = TENORS_SIMPLE.size(); for (int loopexpiry = 0; loopexpiry < nbExp; loopexpiry++) { for (int looptenor = 0; looptenor < nbTenor; looptenor++) { double tenor = TENORS_SIMPLE.get(looptenor).get(ChronoUnit.YEARS); LocalDate expiry = EUR_FIXED_1Y_EURIBOR_6M.FloatingLeg.StartDateBusinessDayAdjustment.adjust(CALIBRATION_DATE.plus(EXPIRIES_SIMPLE_2.get(loopexpiry)), REF_DATA); LocalDate effectiveDate = EUR_FIXED_1Y_EURIBOR_6M.calculateSpotDateFromTradeDate(expiry, REF_DATA); LocalDate endDate = effectiveDate.plus(TENORS_SIMPLE.get(looptenor)); SwapTrade swap = EUR_FIXED_1Y_EURIBOR_6M.toTrade(CALIBRATION_DATE, effectiveDate, endDate, BuySell.BUY, 1.0, 0.0); double parRate = SWAP_PRICER.parRate(swap.resolve(REF_DATA).Product, MULTICURVE); ZonedDateTime expiryDateTime = expiry.atTime(11, 0).atZone(ZoneId.of("Europe/Berlin")); double time = calibratedAtm.relativeTime(expiryDateTime); double volBlack = calibratedAtm.volatility(expiryDateTime, tenor, parRate, parRate); double priceComputed = calibratedAtm.price(time, tenor, PutCall.CALL, parRate, parRate, volBlack); double priceBlack = BlackFormulaRepository.price(parRate, parRate, time, DATA_LOGNORMAL_ATM_SIMPLE[looptenor + loopexpiry * nbTenor], true); assertEquals(priceComputed, priceBlack, TOLERANCE_PRICE_CALIBRATION_ROOT); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private QueryStatusResult(org.neo4j.kernel.api.query.QuerySnapshot query, org.neo4j.kernel.impl.core.EmbeddedProxySPI manager, java.time.ZoneId zoneId) throws org.neo4j.kernel.api.exceptions.InvalidArgumentsException private QueryStatusResult(QuerySnapshot query, EmbeddedProxySPI manager, ZoneId zoneId) { this.QueryId = ofInternalId(query.InternalQueryId()).ToString(); this.Username = query.Username(); this.Query = query.QueryText(); this.Parameters = AsRawMap(query.QueryParameters(), new ParameterWriter(manager)); this.StartTime = formatTime(query.StartTimestampMillis(), zoneId); this.ElapsedTimeMillis = MicrosAsMillis(query.ElapsedTimeMicros()).Value; this.ElapsedTime = formatInterval(ElapsedTimeMillis); ClientConnectionInfo clientConnection = query.ClientConnection(); this.ConnectionDetails = clientConnection.AsConnectionDetails(); this.Protocol = clientConnection.Protocol(); this.ClientAddress = clientConnection.ClientAddress(); this.RequestUri = clientConnection.RequestURI(); this.MetaData = query.TransactionAnnotationData(); this.CpuTimeMillis = MicrosAsMillis(query.CpuTimeMicros()); this.Status = query.Status(); this.ResourceInformation = query.ResourceInformation(); this.ActiveLockCount = query.ActiveLockCount(); this.WaitTimeMillis = MicrosAsMillis(query.WaitTimeMicros()).Value; this.IdleTimeMillis = MicrosAsMillis(query.IdleTimeMicros()); this.Planner = query.Planner(); this.Runtime = query.Runtime(); this.Indexes = query.Indexes(); this.AllocatedBytes = query.AllocatedBytes(); this.PageHits = query.PageHits(); this.PageFaults = query.PageFaults(); this.ConnectionId = clientConnection.ConnectionId(); }
public void BroadcastDistributedObjectUpdateMessageToZone(Message message, DistributedObjectId serverDistributedObjectId) { ZoneId zoneId = this.GetZone(serverDistributedObjectId); List <Guid> sessionIdsToSendMessage = mServerStateMachine.SessionManager.GetSessionIdsInterestedInZoneId(zoneId); mServerStateMachine.SendMessageToReflector(message, sessionIdsToSendMessage); }
public override bool Equals(Value other) { if (other is DateTimeValue) { ZonedDateTime that = (( DateTimeValue )other)._value; bool res = _value.toLocalDateTime().Equals(that.toLocalDateTime()); if (res) { ZoneId thisZone = _value.Zone; ZoneId thatZone = that.Zone; bool thisIsOffset = thisZone is ZoneOffset; bool thatIsOffset = thatZone is ZoneOffset; if (thisIsOffset && thatIsOffset) { res = thisZone.Equals(thatZone); } else if (!thisIsOffset && !thatIsOffset) { res = string.ReferenceEquals(TimeZones.map(thisZone.Id), TimeZones.map(thatZone.Id)); } else { res = false; } } return(res); } return(false); }
public void RemoveObject(IServerDistributedObject obj) { base.RemoveObject(obj); DistributedObjectId doId = obj.DistributedObjectId; // Remove from object zones dict ZoneId zone = null; mDistributedObjectIdToObjectZones.TryGetValue(doId, out zone); mDistributedObjectIdToObjectZones.Remove(doId); // Remove from zone dict List <IServerDistributedObject> objList = null; if (zone != null && mZoneDict.TryGetValue(zone, out objList)) { objList.Remove(obj); } //remove from mSessionIdsToDistributedObjectIds foreach (KeyValuePair <Guid, List <DistributedObjectId> > sessionIdToDistributedObjectIds in mSessionIdsToDistributedObjectIds) { sessionIdToDistributedObjectIds.Value.Remove(doId); } }
// Returns the zone that this object is currently in. public ZoneId GetZone(DistributedObjectId doId) { ZoneId zoneId = null; mDistributedObjectIdToObjectZones.TryGetValue(doId, out zoneId); return(zoneId); }
public APICall <PostIglooPlayersOperation> PostIglooPlayers(ZoneId igloo, string language, bool bypassCaptcha = false) { PostIglooPlayersOperation postIglooPlayersOperation = new PostIglooPlayersOperation(igloo, language); postIglooPlayersOperation.BypassCaptcha = bypassCaptcha; return(new APICall <PostIglooPlayersOperation>(clubPenguinClient, postIglooPlayersOperation)); }
public virtual void ParseDateTimeStandardLocalDateTimeFormat() { LocalDateTime expected = LocalDateTime.Parse("2017-11-02T15:30"); SUTime.Time actual = SUTime.ParseDateTime("2017-11-02T15:30", true); NUnit.Framework.Assert.AreEqual(expected.ToInstant(ZoneId.SystemDefault().GetRules().GetOffset(expected.ToInstant(ZoneOffset.Utc))).ToEpochMilli(), actual.GetJodaTimeInstant().GetMillis()); }
// Test adding and removing interest in a couple zones public void OpenAndCloseInterest() { SessionManager sessionManager = new SessionManager(); Guid sessionId = new Guid(); ZoneId zoneId1 = new ZoneId(100); ZoneId zoneId2 = new ZoneId(200); Assert.IsTrue(sessionManager.AddSession(sessionId, mTestServerAccount)); // List should start out empty Assert.IsTrue(sessionManager.GetSessionIdsInterestedInZoneId(zoneId1).Count == 0); // Session should not already have interest Assert.IsFalse(sessionManager.SessionIdHasInterest(sessionId, zoneId1)); Assert.IsFalse(sessionManager.SessionIdHasInterest(sessionId, zoneId2)); sessionManager.AddZoneIdInterestToSessionId(sessionId, zoneId1); // List should now contain one session Assert.IsTrue(sessionManager.GetSessionIdsInterestedInZoneId(zoneId1).Count == 1); // Session should now have interest Assert.IsTrue(sessionManager.SessionIdHasInterest(sessionId, zoneId1)); // Session should be interested in that single zone List <ZoneId> zoneIds = sessionManager.GetZoneIdsFromInterestedSessionId(sessionId); Assert.IsTrue(zoneIds.Count == 1); Assert.IsTrue(zoneIds.Contains(zoneId1)); // Lets test a second zone sessionManager.AddZoneIdInterestToSessionId(sessionId, zoneId2); // Session should now have interest Assert.IsTrue(sessionManager.SessionIdHasInterest(sessionId, zoneId2)); // Session should be interested in two zones Assert.IsTrue(sessionManager.GetZoneIdsFromInterestedSessionId(sessionId).Count == 2); // Remove interest in first zone sessionManager.RemoveZoneIdInterestFromSessionId(sessionId, zoneId1); // Session should no longer have interest Assert.IsFalse(sessionManager.SessionIdHasInterest(sessionId, zoneId1)); // Back to one Assert.IsTrue(sessionManager.GetSessionIdsInterestedInZoneId(zoneId2).Count == 1); // Remove interest in the second zone sessionManager.RemoveZoneIdInterestFromSessionId(sessionId, zoneId2); // Session should no longer have interest Assert.IsFalse(sessionManager.SessionIdHasInterest(sessionId, zoneId2)); // Back to empty Assert.IsTrue(sessionManager.GetSessionIdsInterestedInZoneId(zoneId1).Count == 0); sessionManager.RemoveSession(sessionId); }
public bool IsOwnIgloo(ZoneId iglooId) { if (dataEntityCollection.TryGetComponent <ProfileData>(dataEntityCollection.LocalPlayerHandle, out var component)) { return(component.ZoneId.Equals(iglooId)); } return(false); }
private void sendMockSelfJoinedRoomEvent() { ZoneId zoneId = new ZoneId(); zoneId.name = TestZoneDefinition.ZoneName; WorldServiceEvents.SelfRoomJoinedEvent evt = new WorldServiceEvents.SelfRoomJoinedEvent(1234L, TestZoneDefinition.ZoneName, new RoomIdentifier("TestWorld", Language.en_US, zoneId, ""), null, null, isRoomOwner: false); eventDispatcher.DispatchEvent(evt); }
public ZoneTreeNode(MapId map, ZoneId zone, List<Point2D> coords) : base(zone.ToString(), coords.TransformArray(coordss => new TileTreeNode(map, coordss))) { Zone = zone; Coordinates = coords; foreach (TileTreeNode child in Nodes) { if (!File.Exists(SimpleTileWriter.GetFileName(map, child.Coords.X, child.Coords.Y))) { child.BackColor = TileTreeNode.NotLoadedColor; } } }
public static void SendInitWorldStates(IPacketReceiver rcv, MapId map, ZoneId zone, uint areaId, params WorldState[] states) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_INIT_WORLD_STATES, 300)) { packet.Write((uint)map); packet.Write((uint)zone); packet.Write(areaId); packet.Write((ushort)states.Length); foreach (var state in states) { packet.Write((uint)state.Key); packet.Write(state.DefaultValue); } rcv.Send(packet); } }
/// <summary> /// Gets the first significant location within the Zone with the given Id /// </summary> /// <param name="id"></param> /// <returns></returns> public static IWorldLocation GetSite(ZoneId id) { var zone = GetZoneInfo(id); if (zone != null) { return zone.Site; } return null; }
/// <summary> /// Gets zone template by ID. /// </summary> /// <param name="zoneID">the ID to the zone to get</param> /// <returns>the <see cref="Zone" /> object for the given zone ID</returns> public static ZoneTemplate GetZoneInfo(ZoneId zoneID) { return s_ZoneTemplates.Get((uint)zoneID); }
public ZoneWorldLocation(MapId region, Vector3 pos, ZoneId zone) : base(region, pos) { if (Region != null) { ZoneTemplate = World.GetZoneInfo(zone); } }
public static void SendPlayerBound(Character chr, WorldObject binder, ZoneId zone) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PLAYERBOUND, 8 + 4)) { packet.Write(binder.EntityId); packet.Write((uint)zone); chr.Client.Send(packet); } }
public static void SendBindConfirm(Character chr, WorldObject binder, ZoneId zone) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BINDER_CONFIRM, 8 + 4)) { packet.Write(binder.EntityId); packet.Write((uint)zone); chr.Client.Send(packet); } }
public static WorldState[] GetStates(ZoneId zone) { return ZoneStates.Get((uint)zone) ?? new WorldState[0]; }
public void SetZoneExplored(ZoneId id, bool explored) { var zone = World.GetZoneInfo(id); if (zone != null) { SetZoneExplored(zone, explored); } }
public bool IsZoneExplored(ZoneId id) { var zone = World.GetZoneInfo(id); return zone != null && IsZoneExplored(zone); }
public WorldZoneLocation(MapId map, Vector3 pos, ZoneId zone) : base(map, pos) { if (Map != null) { ZoneTemplate = World.GetZoneInfo(zone); } }
/// <summary> /// Gets zone info by ID. /// </summary> /// <param name="zoneID">the ID to the zone to get</param> /// <returns>the <see cref="Zone" /> object for the given zone ID</returns> public static ZoneInfo GetZoneInfo(ZoneId zoneID) { return s_ZoneInfos.Get((uint)zoneID); }
public static void SendExplorationExperience(IPacketReceiver client, ZoneId zone, int xpAmount) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_EXPLORATION_EXPERIENCE, 8)) { packet.Write((uint)zone); packet.Write(xpAmount); client.Send(packet); } }
public static void SendSummonRequest(IPacketReceiver target, IEntity summoner, ZoneId zone, int decisionTimeout) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SUMMON_REQUEST, 16)) { packet.Write(summoner.EntityId); packet.Write((uint)zone); packet.Write(decisionTimeout); target.Send(packet); } }