/// <summary> /// Writes the current zone capture status (gauge in upper right corner of client UI). /// </summary> /// <param name="Out">Packet to write</param> /// <param name="lockingRealm">Realm that is locking the Battlefront</param> public void WriteCaptureStatus(PacketOut Out, Realms lockingRealm) { _logger.Trace("."); Out.WriteByte(0); float orderPercent, destroPercent = 0; switch (lockingRealm) { case Realms.REALMS_REALM_ORDER: orderPercent = 100; destroPercent = 0; break; case Realms.REALMS_REALM_DESTRUCTION: orderPercent = 0; destroPercent = 100; break; default: orderPercent = (VictoryPointProgress.OrderVictoryPoints * 100) / BattlefrontConstants.LOCK_VICTORY_POINTS; destroPercent = (VictoryPointProgress.DestructionVictoryPoints * 100) / BattlefrontConstants.LOCK_VICTORY_POINTS; break; } _logger.Trace($"{(byte)orderPercent} {(byte)destroPercent}"); Out.WriteByte((byte)orderPercent); Out.WriteByte((byte)destroPercent); }
public IHttpActionResult PostRealms(Realms realms) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Realms.Add(realms); try { db.SaveChanges(); } catch (DbUpdateException) { if (RealmsExists(realms.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = realms.Id }, realms)); }
/// <summary> /// Computes distance of player to warcamp of given realm. /// </summary> /// <param name="plr">Player to compute distance from</param> /// <param name="realm">Realm of the warcamp to compute distance to</param> /// <returns>Distance or int.MaxValue if not found in current zone</returns> private static int GetWarcampDistance(Player plr, Realms realm) { ushort zoneId = plr.ZoneId.Value; Point3D warcampLoc = BattleFrontService.GetWarcampEntrance(zoneId, realm); return(warcampLoc != null?plr.GetDistanceTo(warcampLoc) : int.MaxValue); }
public void Remove(Siege siege, Realms realm) { DeployedSieges.Remove(siege); var siegeType = SiegeTracking.SingleOrDefault(x => x.Type == siege.SiegeInterface.Type && x.Realm == realm); siegeType?.Decrement(); }
public void SetRealmAssociation(Realms realm) { if (RealmCapturableFor == realm) { return; } RealmCapturableFor = realm; if (_glowObject != null && _glowObject.IsActive) { SetGlowColorFor(RealmCapturableFor); PacketOut Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE, 20); Out.WriteUInt16(_glowObject.Oid); Out.WriteByte(6); //state Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(8); Out.WriteByte(0); Out.WriteByte(_glowObject.VfxState); Out.Fill(0, 10); DispatchPacket(Out, false); } }
public Globe Restore() { var globe = new Globe(); globe.Terrain = Terrain; var realmDict = Realms.ToDictionary(storedRealm => storedRealm.Id, storedRealm => new Realm { Name = storedRealm.Name, Banner = new RealmBanner { MainColor = storedRealm.MainColor } }); globe.Realms = realmDict.Select(x => x.Value).ToList(); RestoreLocalities(out globe.Localities, out globe.LocalitiesCells, Localities, globe.Terrain, realmDict); RestoreAgents(out globe.Agents, Agents, globe.Terrain, realmDict); globe.AgentCrisys = AgentCrisys; globe.HomeProvince = globe.Terrain[HomeProvince.Coords.X][HomeProvince.Coords.Y]; globe.StartProvince = globe.Terrain[StartProvince.Coords.X][StartProvince.Coords.Y]; return(globe); }
/// <summary> /// Writes current front victory points. /// </summary> /// <param name="realm">Recipent player's realm</param> /// <param name="Out">TCP output</param> public void WriteVictoryPoints(Realms realm, PacketOut Out) { if (realm == Realms.REALMS_REALM_ORDER) { Out.WriteByte((byte)VictoryPoints); Out.WriteByte((byte)(100 - VictoryPoints)); } else { Out.WriteByte((byte)(100 - VictoryPoints)); Out.WriteByte((byte)VictoryPoints); } //no clue but set to a value wont show the pool updatetimer Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(00); //local timer for poolupdates int curTimeSeconds = TCPManager.GetTimeStamp(); if (_nextVpUpdateTime == 0 || curTimeSeconds > _nextVpUpdateTime) { Out.WriteUInt32(0); } else { Out.WriteUInt32((uint)(_nextVpUpdateTime - curTimeSeconds)); //in seconds } }
private void SetGlowColorFor(Realms realm) { switch (realm) { case Realms.REALMS_REALM_NEUTRAL: _glowObject.VfxState = 0; break; case Realms.REALMS_REALM_ORDER: if (ColorMatchesRealm) { _glowObject.VfxState = 1; } else { _glowObject.VfxState = 2; } break; case Realms.REALMS_REALM_DESTRUCTION: if (ColorMatchesRealm) { _glowObject.VfxState = 2; } else { _glowObject.VfxState = 1; } break; } }
/// <summary> /// Returns the pairing to its open state, allowing interaction with objectives. /// </summary> public virtual void ResetPairing() { LockingRealm = Realms.REALMS_REALM_NEUTRAL; VictoryPoints = 50; LastAnnouncedVictoryPoints = 50; foreach (var flag in _Objectives) { flag.UnlockObjective(); } foreach (Keep keep in _Keeps) { keep.NotifyPairingUnlocked(); } Broadcast(Region.ZonesInfo[0].Name + " and " + Region.ZonesInfo[1].Name + " battlefield objectives are now open for capture!"); ActiveSupplyLine = 1; UpdateStateOfTheRealm(); WorldMgr.SendCampaignStatus(null); }
/// <summary> /// Periodically checks player positions around flags to debuff /// them when they approach warcamp entrances. /// </summary> private void CheckSpawnFarm() { foreach (Player player in _syncPlayersList) { BattlefrontFlag flag = (BattlefrontFlag)GetClosestFlag(player.WorldPosition, true); if (flag != null && flag.FlagState != ObjectiveFlags.ZoneLocked) { flag.AddPlayerInQuadrant(player); } // Check warcamp farm if (player.Zone != null) { Realms opposite = player.Realm == Realms.REALMS_REALM_DESTRUCTION ? Realms.REALMS_REALM_ORDER : Realms.REALMS_REALM_DESTRUCTION; Point3D warcampLoc = BattlefrontService.GetWarcampEntrance(player.Zone.ZoneId, opposite); if (warcampLoc != null) { float range = (float)player.GetDistanceTo(warcampLoc); if (range < WARCAMP_FARM_RANGE) { player.WarcampFarmScaler = range / WARCAMP_FARM_RANGE; } else { player.WarcampFarmScaler = 1f; } } } } }
/// <summary> /// Initialize the static data store by pulling down all data we care about. /// </summary> public static void Initialize(StaticRiotApi riotStaticApi) { var realms = Enum.GetValues(typeof(Region)).OfType <Region>().AsParallel().WithDegreeOfParallelism(4).Select(region => new { Region = region, Realm = riotStaticApi.GetRealm(region) }).ToList(); Version = realms.Max(realm => new RiotVersion(realm.Realm.V)); var filteredRealms = realms.Where(realm => Version.IsSamePatch(new RiotVersion(realm.Realm.V))); // Get data for all valid realms Realms = filteredRealms.ToDictionary(realm => realm.Region, realm => new RealmStaticData(riotStaticApi, realm.Realm, realm.Region)); // Try getting NA data if available RealmStaticData primaryrealm; if (!Realms.TryGetValue(Region.na, out primaryrealm)) { // Try to find an english realm primaryrealm = Realms.FirstOrDefault(kvp => kvp.Value.Realm.L.Contains("en")).Value; // If we can't find english data, give up and just choose the first realm if (primaryrealm == null) { primaryrealm = Realms.FirstOrDefault().Value; } // If there are no realms, just return if (primaryrealm == null) { return; } } Champions = primaryrealm.Champions; Items = primaryrealm.Items; SummonerSpells = primaryrealm.SummonerSpells; }
public static void InnerDoorReward(KeepDoor door, Realms attackingRealm, string description, ContributionManager contributionManagerInstance) { var attackingPlayers = door.GameObject.PlayersInRange.Where(x => x.Realm == attackingRealm); // Small reward for inner door destruction foreach (var player in attackingPlayers) { if (!player.Initialized) { continue; } RewardLogger.Trace($"Inner Door reward for player : {player.Name} "); var random = StaticRandom.Instance.Next(1, 25); player.AddXp((uint)(INNER_DOOR_XP * (1 + (float)random / 100)), false, false); player.AddRenown((uint)(INNER_DOOR_RP * (1 + (float)random / 100)), false, RewardType.None, $"Destruction of {description}'s inner door"); player.UpdatePlayerBountyEvent((byte)ContributionDefinitions.DESTROY_INNER_DOOR); // Add contribution //contributionManagerInstance.UpdateContribution(player.CharacterId, (byte)ContributionDefinitions.DESTROY_INNER_DOOR); //var contributionDefinition = new BountyService().GetDefinition((byte)ContributionDefinitions.DESTROY_INNER_DOOR); //player.BountyManagerInstance.AddCharacterBounty(player.CharacterId, contributionDefinition.ContributionValue); } }
/// <summary> /// Searches for the portal from warcamp to the managed objective. /// </summary> /// <param name="realm">Realm of warcamp to seach</param> /// <returns>Portal of null if missing info</returns> private BattlefrontObject GetPortalToObjective(Realms realm) { ushort zoneId = _objective.ZoneId; int objectiveId = _objective.ID; BattlefrontObject portalData = BattlefrontService.GetPortalToObjective(zoneId, objectiveId, realm); if (portalData != null) // A portal exists in same zone { return(portalData); } // Obtherwise, search in other zones of same region foreach (Zone_Info zone in _region.ZonesInfo) { if (zone.ZoneId == zoneId) { continue; } portalData = BattlefrontService.GetPortalToObjective(zone.ZoneId, objectiveId, realm); if (portalData != null) { return(portalData); } } return(null); }
/// <summary> /// Prevents this objective from being captured. /// </summary> public void LockObjective(Realms lockingRealm, bool announce) { _logger.Debug($"Locking Objective {Name} for {lockingRealm.ToString()}"); OwningRealm = lockingRealm; AssaultingRealm = Realms.REALMS_REALM_NEUTRAL; State = StateFlags.ZoneLocked; _nextTransitionTimestamp = 0; AccumulatedKills = 0; _controlGauge = lockingRealm == Realms.REALMS_REALM_ORDER ? -MAX_CONTROL_GAUGE : MAX_CONTROL_GAUGE; _lastGaugeUpdateTick = 0; _lastTransitionUpdateSpeed = 0; _secureProgress = MAX_SECURE_PROGRESS; _displayedTimer = 0; _closeOrderCount = 0; _closeDestroCount = 0; _closePlayers.Clear(); if (!announce) { return; } BroadcastFlagInfo(false); }
public HttpResponseMessage InsertRealm(dynamic para) { var le = EFClass.GetEF(); int type = Convert.ToInt32(para.type); if (type == 1) { String RealmDes = Convert.ToString(para.RealmDes); long Sequence = Convert.ToInt64(para.Sequence); String Uri = Convert.ToString(para.Uri); //String ParentID = Convert.ToString(para.ParentID); String AppID = Guid.NewGuid().ToString(); String Security = Guid.NewGuid().ToString(); Realms r = new Realms(); r.RealmID = Guid.NewGuid().ToString(); r.RealmDes = RealmDes; r.Uri = Uri; r.AppID = AppID; r.Sequence = Sequence; r.Security = Security; r.CreatedDate = DateTime.Now; le.Realms.Add(r); return(ToJson.toJson(le.SaveChanges())); } else if (type == 2) { Thread.Sleep(2000); String RealmID = Convert.ToString(para.id); var r = le.Realms.Where(p => p.RealmID == RealmID).FirstOrDefault(); r.Forzen = 1; return(ToJson.toJson(le.SaveChanges())); } return(ToJson.toJson("")); }
/// <summary> /// Updates aao buffs for the given realm. /// </summary> /// <param name="realm">Realm that have aao, can be neutral</param> /// <param name="newMult">Signed multiplier</param> private void UpdateAAOBuffs(Realms realm, float newMult) { List <NewBuff> buffs = GetAaoBuffs(realm); if (buffs == null) { return; } short aaoValue = (short)(Math.Abs(newMult) * 20); float aaoBonus = Math.Abs(newMult) * 0.2f; lock (buffs) { foreach (NewBuff aaoBuff in buffs) { aaoBuff.DeleteBuffParameter(1); aaoBuff.DeleteBuffParameter(2); aaoBuff.DeleteBuffParameter(3); aaoBuff.DeleteBuffParameter(4); aaoBuff.AddBuffParameter(1, 1); aaoBuff.AddBuffParameter(2, aaoValue); aaoBuff.AddBuffParameter(3, aaoValue); aaoBuff.AddBuffParameter(4, aaoValue); ((Player)aaoBuff.Caster).AAOBonus = aaoBonus; aaoBuff.SoftRefresh(); } } }
public void Reset() { CountdownTimerEnd = 0; OwningRealm = Realms.REALMS_REALM_NEUTRAL; foreach (Player plr in PlayersInRange) { UpdateGlow(plr); } BroadcastObjectiveInfo(); foreach (Object obj in Region.Objects) { Player plr = obj as Player; if (plr != null) { SendObjectiveState(plr); SendRealmBonus(plr); } } Locked = false; }
/// <summary> /// Builds binary flag depending on the objective's current state. /// </summary> /// <param name="realm">Realm of the player that will get the state</param> /// <returns>String constance representation</returns> private string GetStateText(Realms realm) { switch (State) { case StateFlags.Secure: //return _secureProgress == MAX_SECURE_PROGRESS ? "GENERATING" : "SECURING"; return("GUARDED"); case StateFlags.Abandoned: return("SECURED"); case StateFlags.Contested: return(realm == OwningRealm ? "RECLAIM" : "HOLD"); case StateFlags.Unsecure: return("AVAILABLE"); case StateFlags.Hidden: return(""); case StateFlags.ZoneLocked: return("ZONE-LOCKED"); case StateFlags.Locked: return("SECURED"); } return("UNKNOWN"); }
private void AddGlow(Realms assaultingRealm) { GameObject_proto glowProto = GameObjectService.GetGameObjectProto(99858); //99858 if (glowProto != null) { GameObject_spawn spawn = new GameObject_spawn { Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID(), WorldO = Heading, WorldX = WorldPosition.X, WorldY = WorldPosition.Y, WorldZ = WorldPosition.Z, ZoneId = ZoneId, }; spawn.BuildFromProto(glowProto); var siegeRangeFlag = new GameObject(spawn); if (assaultingRealm == Realms.REALMS_REALM_DESTRUCTION) { siegeRangeFlag.VfxState = 2; //1 blue, 2 red, 3 white, 4 - white; } else { siegeRangeFlag.VfxState = 1; //1 blue, 2 red, 3 white, 4 - white; } Region.AddObject(siegeRangeFlag, ZoneId); } }
/// <summary> /// Builds binary flag depending on the objective's current state. /// </summary> /// <param name="realm">Realm of the player that will get the state</param> /// <returns>String constance representation</returns> private string GetStateText(Realms realm) { switch (State) { case StateFlags.Secure: return(_secureProgress == MAX_SECURE_PROGRESS ? "GENERATING" : "SECURING"); case StateFlags.Abandoned: return("ABANDONED"); case StateFlags.Contested: return(realm == OwningRealm ? "DEFEND" : "ASSAULT"); case StateFlags.Unsecure: return("OPEN"); case StateFlags.Hidden: return(""); case StateFlags.ZoneLocked: return("LOCKED"); case StateFlags.Locked: return("SECURED"); } return("UNKNOWN"); }
public IHttpActionResult PutRealms(int id, Realms realms) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != realms.Id) { return(BadRequest()); } db.Entry(realms).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RealmsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
/// <summary> /// Invoked by buff interface to keep track of aao buff. /// </summary> /// <param name="aaoBuff">Buff that was created</param> private void AaoAssigned(NewBuff aaoBuff) { if (aaoBuff == null) { return; } Realms aaoRealm = GetAaoRealm(_againstAllOddsMult); short aaoValue = (short)(Math.Abs(_againstAllOddsMult) * 20); float aaoBonus = Math.Abs(_againstAllOddsMult) * 0.2f; if (aaoRealm == aaoBuff.Caster.Realm) { lock (_orderAAOBuffs) _orderAAOBuffs.Add(aaoBuff); aaoBuff.AddBuffParameter(1, 1); aaoBuff.AddBuffParameter(2, aaoValue); aaoBuff.AddBuffParameter(3, aaoValue); aaoBuff.AddBuffParameter(4, aaoValue); ((Player)aaoBuff.Caster).AAOBonus = aaoBonus; } else { aaoBuff.BuffHasExpired = true; } }
/// <summary> /// Removes the specified Realm from the game world /// </summary> /// <param name="realm"></param> public void RemoveRealm(IRealm realm) { if (Realms.Contains(realm)) { Realms.Remove(realm); } }
public ContributionInfo(Player player) { PlayerCharId = player.CharacterId; PlayerRealm = player.Realm; PlayerCareerLine = player.Info.CareerLine; PlayerLevel = player.Level; PlayerName = player.Name; }
public override bool CanAttackDoor(Realms realm, ushort zoneId) { if (realm == Realms.REALMS_REALM_ORDER) { return(_held[Zones.FindIndex(z => z.ZoneId == zoneId), 2] >= 3); } return(_held[Zones.FindIndex(z => z.ZoneId == zoneId), 1] >= 3); }
/// <summary> /// Gets the warcamp entrance in a zone for given realm. /// </summary> /// <param name="zoneId">Zone identifer</param> /// <param name="realm">Order/destro</param> /// <returns>Warcamp entrance coordinate or null if does not exists or is not parameterized /// (given zone's inner coordinates)</returns> public static Point3D GetWarcampEntrance(ushort zoneId, Realms realm) { if (_warcampEntrances.ContainsKey(zoneId)) { return(_warcampEntrances[zoneId][(int)realm - 1]); } return(null); }
/// <summary> /// Returns the enemy realm's population divided by the input realm's population. /// </summary> private float GetRelativePopFactor(Realms realm) { if (_relativePopulationFactor == 0) { return(0); } return(realm == Realms.REALMS_REALM_DESTRUCTION ? _relativePopulationFactor : 1f / _relativePopulationFactor); }
public void Write(GamePacketWriter writer) { writer.Write(Unknown0); writer.Write(Realms.Count); Realms.ForEach(s => s.Write(writer)); writer.Write(Unknown2.Count); Unknown2.ForEach(s => s.Write(writer)); }
public void getRealm() { Realms realmList = AMRealmHelper.getRealms(); string id = realmList.Items[rnd.Next(realmList.Items.Count)].Id; Realm realm = AMRealmHelper.getRealm(id); Assert.AreEqual(id, realm.Id, "Вернулся другой realm"); }
public Standard(Creature_spawn spawn, Player owner, byte bannertyp) { Spawn = spawn; Name = owner.GldInterface.Guild.Info.Name; Owner = owner; RealmStandard = owner.Realm; Bannertyp = bannertyp; Faction = (byte)(owner.Realm == Realms.REALMS_REALM_DESTRUCTION ? 8 : 6); }
/// <summary> /// Class constructor /// </summary> public MobSpawnPacket(Realms.Common.Mob mob) : base(typeof(MobSpawnPacket)) { this.ID = mob.ID; this.MobType = mob.MobType; this.PositionX = mob.transform.position.x; this.PositionY = mob.transform.position.y; this.PositionZ = mob.transform.position.z; }
public static SharedRealmHandle OpenWithSync(Realms.Native.Configuration configuration, Native.SyncConfiguration syncConfiguration, RealmSchema schema, byte[] encryptionKey) { DoInitialFileSystemConfiguration(); var marshaledSchema = new SharedRealmHandle.SchemaMarshaler(schema); NativeException nativeException; var result = NativeMethods.open_with_sync(configuration, syncConfiguration, marshaledSchema.Objects, marshaledSchema.Objects.Length, marshaledSchema.Properties, encryptionKey, out nativeException); nativeException.ThrowIfNecessary(); var handle = new SharedRealmHandle(); handle.SetHandle(result); return handle; }
public static extern IntPtr open_with_sync(Realms.Native.Configuration configuration, Native.SyncConfiguration sync_configuration, [MarshalAs(UnmanagedType.LPArray), In] Realms.Native.SchemaObject[] objects, int objects_length, [MarshalAs(UnmanagedType.LPArray), In] Realms.Native.SchemaProperty[] properties, byte[] encryptionKey, out NativeException ex);
/// <summary> /// /// </summary> /// <param name="mob"></param> public void RegisterMob(Realms.Common.Mob mob) { m_mobs.Add(mob); var mobSpawnPacket = new Server.Packet.MobSpawnPacket(mob); QueuePacketAll(mobSpawnPacket); }