void OnAreaChanged(Area area) { Wars.EndAllWarsForEliminatedFactions(); Pins.RemoveAllPinsInUnclaimedAreas(); Hud.GenerateMapOverlayImage(); Hud.RefreshForAllPlayers(); }
/// <summary> /// Wyświetla listę klanów w wojnie z klanem użytkownika /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonWarWith_Click(object sender, EventArgs e) { List <Tables.Clan> clansAtWar = Wars.GetAll().Where(clan => clan.Clan1Name == CurrentUser.ClanName).Select(clan => clan.Clan2).ToList(); clansAtWar.AddRange(Wars.GetAll().Where(clan => clan.Clan2Name == CurrentUser.ClanName).Select(clan => clan.Clan1)); dataGridViewTables.DataSource = clansAtWar; }
public void FixWars() { if (Wars != null) { var previousEndDate = DateTime.UtcNow.AddYears(-2); foreach (var war in Wars.OrderBy(w => w.EndTime)) { war.FixData(previousEndDate); previousEndDate = war.EndTime; } } }
public void LoadAudioContent(Wars wars) { engineSound = contentManager.Load <SoundEffect>(".\\sound\\Engine"); engineSoundInstance = engineSound.Play(1.0f, 0.3f, 0.0f, true); // true == looped engineSoundInstance.Pause(); enemyEngineSound = contentManager.Load <SoundEffect>(".\\sound\\Engine"); enemyEngineSoundInstance = engineSound.Play(1.0f, 0.0f, 0.0f, true); // true == looped enemyEngineSoundInstance.Pause(); redShotSound = contentManager.Load <SoundEffect>(".\\sound\\Laser1"); blueShotSound = contentManager.Load <SoundEffect>(".\\sound\\Laser3"); explosionSound = contentManager.Load <SoundEffect>(".\\sound\\ExplosionA"); imHit = contentManager.Load <SoundEffect>(".\\sound\\ExplosionB"); }
void OnWarDeclareCommand(User user, string[] args) { Faction attacker = Factions.GetByMember(user); if (!EnsureUserAndFactionCanEngageInDiplomacy(user, attacker)) { return; } if (args.Length < 2) { user.SendChatMessage(Messages.Usage, "/war declare FACTION \"REASON\""); return; } Faction defender = Factions.Get(Util.NormalizeFactionId(args[0])); if (defender == null) { user.SendChatMessage(Messages.FactionDoesNotExist, args[0]); return; } if (attacker.Id == defender.Id) { user.SendChatMessage(Messages.CannotDeclareWarAgainstYourself); return; } War existingWar = Wars.GetActiveWarBetween(attacker, defender); if (existingWar != null) { user.SendChatMessage(Messages.CannotDeclareWarAlreadyAtWar, defender.Id); return; } string cassusBelli = args[1].Trim(); if (cassusBelli.Length < Options.War.MinCassusBelliLength) { user.SendChatMessage(Messages.CannotDeclareWarInvalidCassusBelli, defender.Id); return; } War war = Wars.DeclareWar(attacker, defender, user, cassusBelli); PrintToChat(Messages.WarDeclaredAnnouncement, war.AttackerId, war.DefenderId, war.CassusBelli); Log($"{Util.Format(user)} declared war on faction {war.DefenderId} on behalf of {war.AttackerId} for reason: {war.CassusBelli}"); }
public int GetWar(Player player) { if (player == null) { return(WarWithNoOwner); } if (player == this) { return(0); } if (Wars.ContainsKey(player)) { return(Wars[player]); } return(0); }
void OnFactionDisbanded(Faction faction) { Area[] areas = Instance.Areas.GetAllClaimedByFaction(faction); if (areas.Length > 0) { foreach (Area area in areas) { PrintToChat(Messages.AreaClaimLostFactionDisbandedAnnouncement, area.FactionId, area.Id); } Areas.Unclaim(areas); } Wars.EndAllWarsForEliminatedFactions(); Hud.RefreshForAllPlayers(); }
void OnWarEndCommand(User user, string[] args) { Faction faction = Factions.GetByMember(user); if (!EnsureUserAndFactionCanEngageInDiplomacy(user, faction)) { return; } Faction enemy = Factions.Get(Util.NormalizeFactionId(args[0])); if (enemy == null) { user.SendChatMessage(Messages.FactionDoesNotExist, args[0]); return; } War war = Wars.GetActiveWarBetween(faction, enemy); if (war == null) { user.SendChatMessage(Messages.NotAtWar, enemy.Id); return; } if (war.IsOfferingPeace(faction)) { user.SendChatMessage(Messages.CannotOfferPeaceAlreadyOfferedPeace, enemy.Id); return; } war.OfferPeace(faction); if (war.IsAttackerOfferingPeace && war.IsDefenderOfferingPeace) { PrintToChat(Messages.WarEndedTreatyAcceptedAnnouncement, faction.Id, enemy.Id); Log($"{Util.Format(user)} accepted the peace offering of {enemy.Id} on behalf of {faction.Id}"); Wars.EndWar(war, WarEndReason.Treaty); OnDiplomacyChanged(); } else { user.SendChatMessage(Messages.PeaceOffered, enemy.Id); Log($"{Util.Format(user)} offered peace to faction {enemy.Id} on behalf of {faction.Id}"); } }
void OnWarStatusCommand(User user) { Faction faction = Factions.GetByMember(user); if (faction == null) { user.SendChatMessage(Messages.NotMemberOfFaction); return; } var sb = new StringBuilder(); War[] wars = Wars.GetAllActiveWarsByFaction(faction); if (wars.Length == 0) { sb.AppendLine("Your faction is not involved in any wars."); } else { sb.AppendLine(String.Format("<color=#ffd479>Your faction is involved in {0} wars:</color>", wars.Length)); for (var idx = 0; idx < wars.Length; idx++) { War war = wars[idx]; sb.AppendFormat("{0}. <color=#ffd479>{1}</color> vs <color=#ffd479>{2}</color>", (idx + 1), war.AttackerId, war.DefenderId); if (war.IsAttackerOfferingPeace) { sb.AppendFormat(": <color=#ffd479>{0}</color> is offering peace!", war.AttackerId); } if (war.IsDefenderOfferingPeace) { sb.AppendFormat(": <color=#ffd479>{0}</color> is offering peace!", war.DefenderId); } sb.AppendLine(); } } user.SendChatMessage(sb); }
public void UpdateWar(Player player, int days) { if (player == this) { return; } if (player == null) { WarWithNoOwner = days; return; } if (Wars.ContainsKey(player)) { Wars[player] = days; } else { Wars.Add(player, days); } }
/// <summary>Construct Public ESI interface</summary> public Public() : base() { Alliance = new AllianceMain(this); Character = new CharacterMain(this); Corporation = new CorporationMain(this); Dogma = new Dogma(this); FactionWarfare = new FactionWarfare(this); Incursions = new Incursions(this); Industry = new Industry(this); Insurance = new Insurance(this); Killmails = new Killmails(this); Loyalty = new Loyalty(this); Market = new Market(this); Opportunities = new Opportunities(this); PlanetaryInteraction = new PlanetaryInteraction(this); Routes = new Routes(this); Search = new Search(this); Sovereignty = new Sovereignty(this); Status = new Status(this); Universe = new Universe(this); Wars = new Wars(this); }
public void LoadAudioContent(Wars wars) { engineSound = contentManager.Load <SoundEffect>(".\\sound\\Engine"); engineSoundInstance = engineSound.CreateInstance(); engineSoundInstance.IsLooped = true; engineSoundInstance.Volume = 1.0f; engineSoundInstance.Pitch = 0.3f; engineSoundInstance.Pan = 0.0f; engineSoundInstance.Play(); // XNA3140: probably not necessary... engineSoundInstance.Stop(); enemyEngineSound = contentManager.Load <SoundEffect>(".\\sound\\Engine"); enemyEngineSoundInstance = engineSound.CreateInstance(); enemyEngineSoundInstance.IsLooped = true; enemyEngineSoundInstance.Volume = 1.0f; enemyEngineSoundInstance.Pitch = 0.0f; enemyEngineSoundInstance.Pan = 0.0f; enemyEngineSoundInstance.Play(); // XNA3140: probably not necessary... enemyEngineSoundInstance.Stop(); redShotSound = contentManager.Load <SoundEffect>(".\\sound\\Laser1"); blueShotSound = contentManager.Load <SoundEffect>(".\\sound\\Laser3"); explosionSound = contentManager.Load <SoundEffect>(".\\sound\\ExplosionA"); imHit = contentManager.Load <SoundEffect>(".\\sound\\ExplosionB"); }
void OnWarListCommand(User user) { var sb = new StringBuilder(); War[] wars = Wars.GetAllActiveWars(); if (wars.Length == 0) { sb.Append("The island is at peace... for now. No wars have been declared."); } else { sb.AppendLine(String.Format("<color=#ffd479>The island is at war! {0} wars have been declared:</color>", wars.Length)); for (var idx = 0; idx < wars.Length; idx++) { War war = wars[idx]; sb.AppendFormat("{0}. <color=#ffd479>{1}</color> vs <color=#ffd479>{2}</color>: {2}", (idx + 1), war.AttackerId, war.DefenderId, war.CassusBelli); sb.AppendLine(); } } user.SendChatMessage(sb); }
// ReSharper disable once InconsistentNaming private void initializeAPI() { Alliance = new Alliance(dataSource) { HTTP = http }; Assets = new Assets(dataSource) { HTTP = http }; Bookmarks = new Bookmarks(dataSource) { HTTP = http }; Calendar = new Calendar(dataSource) { HTTP = http }; Character = new Character(dataSource) { HTTP = http }; Clones = new Clones(dataSource) { HTTP = http }; Contacts = new Contacts(dataSource) { HTTP = http }; Contracts = new Contracts(dataSource) { HTTP = http }; Corporation = new Corporation(dataSource) { HTTP = http }; Dogma = new Dogma(dataSource) { HTTP = http }; FactionWarfare = new FactionWarfare(dataSource) { HTTP = http }; Fittings = new Fittings(dataSource) { HTTP = http }; Fleets = new Fleets(dataSource) { HTTP = http }; Incursion = new Incursions(dataSource) { HTTP = http }; Industry = new Industry(dataSource) { HTTP = http }; Insurance = new Insurance(dataSource) { HTTP = http }; Killmails = new Killmails(dataSource) { HTTP = http }; Location = new Location(dataSource) { HTTP = http }; Loyalty = new Loyalty(dataSource) { HTTP = http }; Mail = new Mail(dataSource) { HTTP = http }; Market = new Market(dataSource) { HTTP = http }; Opportunities = new Opportunities(dataSource) { HTTP = http }; PlanetaryInteraction = new PlanetaryInteraction(dataSource) { HTTP = http }; Routes = new Routes(dataSource) { HTTP = http }; Search = new Search(dataSource) { HTTP = http }; Skills = new Skills(dataSource) { HTTP = http }; Sovereignty = new Sovereignty(dataSource) { HTTP = http }; Status = new Status(dataSource) { HTTP = http }; Universe = new Universe(dataSource) { HTTP = http }; UserInterface = new UserInterface(dataSource) { HTTP = http }; Wallet = new Wallet(dataSource) { HTTP = http }; Wars = new Wars(dataSource) { HTTP = http }; }
public void LoadContent(Wars wars, Viewport viewport) { LoadGraphicsContent(wars, viewport); LoadAudioContent(wars); }
public void LoadGraphicsContent(Wars wars, Viewport viewport) { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(wars.GraphicsDevice); smallStar = wars.Content.Load <Texture2D>(".\\graphics\\smallStar"); middleStar = wars.Content.Load <Texture2D>(".\\graphics\\middleStar"); bigStar = wars.Content.Load <Texture2D>(".\\graphics\\bigStar"); earthMoonFull = wars.Content.Load <Texture2D>(".\\graphics\\EARTHMOONsm-full_alpha_small"); planet1 = wars.Content.Load <Texture2D>(".\\graphics\\planet1_orig_alpha_small"); planet2 = wars.Content.Load <Texture2D>(".\\graphics\\planet2_orig_alpha_small"); fume = wars.Content.Load <Texture2D>(".\\graphics\\fume"); redShot = wars.Content.Load <Texture2D>(".\\graphics\\redShot"); blueShot = wars.Content.Load <Texture2D>(".\\graphics\\blueShot"); // TODO: use this.Content to load your game content here ship1 = wars.Content.Load <Texture2D>(".\\graphics\\ship1"); pinkShipTexture = wars.Content.Load <Texture2D>(".\\graphics\\convoyinterceptrapier2t_alpha_small"); wraithShipTexture = wars.Content.Load <Texture2D>(".\\graphics\\GTF_Wraith_alpha_small"); wideShipTexture = wars.Content.Load <Texture2D>(".\\graphics\\arc170_plans_lg_alpha_small"); andromedaShipTexture = wars.Content.Load <Texture2D>(".\\graphics\\AndromedaOnline_alpha_small"); fighterShipTexture = wars.Content.Load <Texture2D>(".\\graphics\\3dsthc3_alpha_small"); blueBallTexture = wars.Content.Load <Texture2D>(".\\graphics\\blueball_small"); redShip = wars.Content.Load <Texture2D>(".\\graphics\\alienstars-fighter"); greenShipTexture = wars.Content.Load <Texture2D>(".\\graphics\\greenShip"); //Viewport viewport = wars.graphics.GraphicsDevice.Viewport; Vector2 screenpos; screenpos.X = viewport.Width / 2; screenpos.Y = viewport.Height / 2; /* * Ship newShip = new Ship(ref redShip, // texture * screenpos, // position * new Vector2(0, 0), // speed vector * MathHelper.PiOver2, // rotation angle * 1, // z plane position (1==fore most) * 0); // throttle * newShip.DrawCompensationRotationAngle = -MathHelper.PiOver2; * newShip.ThrottlePower = Constants.THROTTLE_POWER; * newShip.MaxSpeed = Constants.MAX_SPEED; * newShip.RedShotSpacing = Constants.REDSHOT_SPACING; * newShip.RedShotSpacingCounter = newShip.RedShotSpacing; * //ships.Add(newShip); //ships[0] NOT USED!! * ships.Add(newShip); // ==> ships[0] ==> playerIndex == 1 */ /* * public Texture2D greenShipTexture; * public Texture2D pinkShipTexture; * public Texture2D wraithShipTexture; * public Texture2D wideShipTexture; * public Texture2D andromedaShipTexture; * public Texture2D fighterShipTexture; */ Ship newShip = new Ship(ref pinkShipTexture, //fighterShipTexture,//andromedaShipTexture,//wideShipTexture, //pinkShipTexture, //ship1, // texture screenpos, // position new Vector2(0, 0), // speed vector MathHelper.PiOver2, // rotation angle 1, // z plane position (1==fore most) 0, // throttle Constants.SHIP_TYPE_MANUALLY_CONTROLLED); // type newShip.DrawCompensationRotationAngle = MathHelper.PiOver2; newShip.ThrottlePower = Constants.THROTTLE_POWER; newShip.MaxSpeed = Constants.MAX_SPEED; newShip.RedShotSpacing = Constants.REDSHOT_SPACING; newShip.RedShotSpacingCounter = newShip.RedShotSpacing; //ships.Add(newShip); //ships[0] NOT USED!! ships.Add(newShip); // ==> ships[0] ==> playerIndex == 1 Cat newCat = new Cat(ref blueBallTexture, //greenShipTexture, // texture 150, // ship distance MathHelper.ToRadians((float)random.Next(359)), // posRotAngle ref newShip, 1); //playerIndex newCat.DrawCompensationRotationAngle = -MathHelper.PiOver4 - MathHelper.ToRadians(16f); newCat.RedShotSpacing = Constants.REDSHOT_SPACING * 0.5f; newCat.RedShotSpacingCounter = newShip.RedShotSpacing; cats.Add(newCat); /* * newCat = new Cat(ref blueBallTexture, //greenShipTexture, // texture * 200, // ship distance * MathHelper.ToRadians((float)random.Next(359)), // posRotAngle * ref newShip, * 1); //playerIndex * newCat.DrawCompensationRotationAngle = -MathHelper.PiOver4 - MathHelper.ToRadians(16f); * newCat.RedShotSpacing = Constants.REDSHOT_SPACING * 0.5f; * newCat.RedShotSpacingCounter = newShip.RedShotSpacing; * cats.Add(newCat); * * newCat = new Cat(ref blueBallTexture, //greenShipTexture, // texture * 100, // ship distance * MathHelper.ToRadians((float)random.Next(359)), // posRotAngle * ref newShip, * 1); //playerIndex * newCat.DrawCompensationRotationAngle = -MathHelper.PiOver4 - MathHelper.ToRadians(16f); * newCat.RedShotSpacing = Constants.REDSHOT_SPACING * 0.5f; * newCat.RedShotSpacingCounter = newShip.RedShotSpacing; * cats.Add(newCat); * * newCat = new Cat(ref blueBallTexture, //greenShipTexture, // texture * 250, // ship distance * MathHelper.ToRadians((float)random.Next(359)), // posRotAngle * ref newShip, * 1); //playerIndex * newCat.DrawCompensationRotationAngle = -MathHelper.PiOver4 - MathHelper.ToRadians(16f); * newCat.RedShotSpacing = Constants.REDSHOT_SPACING * 0.1f; * newCat.RedShotSpacingCounter = newShip.RedShotSpacing; * cats.Add(newCat); */ Ship newShip2 = new Ship(ref wraithShipTexture, //greenShipTexture, // texture screenpos / 2, // position new Vector2(0, 0), // speed vector MathHelper.PiOver2, // rotation angle 1, // z plane position (1==fore most) 0, // throttle Constants.SHIP_TYPE_COMPUTER_CONTROLLED); // type newShip2.DrawCompensationRotationAngle = -MathHelper.PiOver4 - MathHelper.ToRadians(16f); newShip2.ThrottlePower = Constants.THROTTLE_POWER * 2f; newShip2.MaxSpeed = Constants.MAX_SPEED * 2f; newShip2.RedShotSpacing = Constants.ENEMY_REDSHOT_SPACING * 0.5f; newShip2.RedShotSpacingCounter = newShip.RedShotSpacing; ships.Add(newShip2); // ==> ships[1] ==> playerIndex == 2 int screenPosX; int screenPosY; Vector2 pos; for (int i = 0; i < Constants.NUMBER_OF_STARS; i++) { screenPosX = random.Next(Constants.RESOLUTION_WIDTH); screenPosY = random.Next(Constants.RESOLUTION_HEIGHT); pos = new Vector2(screenPosX, screenPosY); int size = random.Next(10); int z = 1 + random.Next(4); if (size > 5) { bgObjects.Add(new WarsObject(ref smallStar, pos, z)); } else if (size > 2) { bgObjects.Add(new WarsObject(ref middleStar, pos, z)); } else { bgObjects.Add(new WarsObject(ref bigStar, pos, z)); } } screenPosX = random.Next(Constants.RESOLUTION_WIDTH); screenPosY = random.Next(Constants.RESOLUTION_HEIGHT); pos = new Vector2(screenPosX, screenPosY); planetObjects.Add(new WarsObject(ref earthMoonFull, pos, 50)); screenPosX = random.Next(Constants.RESOLUTION_WIDTH); screenPosY = random.Next(Constants.RESOLUTION_HEIGHT); pos = new Vector2(screenPosX, screenPosY); planetObjects.Add(new WarsObject(ref planet2, pos, 10)); screenPosX = random.Next(Constants.RESOLUTION_WIDTH); screenPosY = random.Next(Constants.RESOLUTION_HEIGHT); pos = new Vector2(screenPosX, screenPosY); planetObjects.Add(new WarsObject(ref planet1, pos, 5)); }
public void setLifeEvents() { int randomNumber = 0; while (lifeEvents.Count < numberOfLifeEvents) { randomNumber = DiceRoll.roll(1, 100); if (1 <= randomNumber && randomNumber <= 10) { Tragedies tragedies = new Tragedies(parents, siblings); lifeEvents.Add($"You suffered a tragedy. {tragedies.Roll()}"); } else if (11 <= randomNumber && randomNumber <= 20) { Boons boons = new Boons(); lifeEvents.Add($"You gained a bit of good fortune. {boons.Roll()}"); equipment.Add(boons.GetItem()); } else if (21 <= randomNumber && randomNumber <= 30) { Individual individual = Individual.generateIndividual(); if (lifeEvents.Contains("You fell in love or got married")) { lifeEvents.Add($"You had a child.\n{individual.getString()}"); } else { lifeEvents.Add($"You fell in love or got married.\n{individual.getString()}"); } } else if (31 <= randomNumber && randomNumber <= 40) { Individual adventurer = Individual.generateIndividual(); adventurer.relationship = "Hostile"; adventurer.setLivingStatus(); lifeEvents.Add($"You made an enemy of an adventurer. You are {(DiceRoll.roll(1, 6) % 2 == 0 ? "to blame" : "blameless")} for the rift between you two. " + $"Work with your DM to determine this hostile character’s identity and the danger this enemy poses to you.\n{adventurer.getString()}"); } else if (41 <= randomNumber && randomNumber <= 50) { Individual adventurer = Individual.generateIndividual(); adventurer.relationship = "Friendly"; adventurer.setLivingStatus(); lifeEvents.Add($"You made a friend of an adventurer. Work with your DM to add more detail to this friendly character and establish how your friendship began.\n{adventurer.getString()}"); } else if (51 <= randomNumber && randomNumber <= 70) { lifeEvents.Add("You spent time working in a job related to your background. Start the game with an extra 2d6 gp."); } else if (71 <= randomNumber && randomNumber <= 75) { Individual individual = Individual.generateIndividual(); lifeEvents.Add($"You met someone important. Work out additional details with your DM as needed to fit this character into your backstory.\n{individual.getString()}"); } else if (76 <= randomNumber && randomNumber <= 80) { Adventures adventures = new Adventures(); lifeEvents.Add($"You went on an adventure. {adventures.Roll()} Work with your DM to determine the nature of the adventure and the creatures you encountered."); equipment.Add(adventures.GetItem()); } else if (81 <= randomNumber && randomNumber <= 85) { SupernaturalEvents supernaturalEvents = new SupernaturalEvents(); lifeEvents.Add($"You had a supernatural experience. {supernaturalEvents.Roll()}"); } else if (86 <= randomNumber && randomNumber <= 90) { Wars wars = new Wars(); lifeEvents.Add($"You fought in a battle. {wars.Roll()} Work with your DM to come up with the reason for the battle and the factions involved. It might have been a small conflict between your community and a band of orcs, or it could have been a major battle in a larger war."); } else if (91 <= randomNumber && randomNumber <= 95) { Crimes crimes = new Crimes(); Punishments punishments = new Punishments(); lifeEvents.Add($"You committed a crime or were wrong accused of doing so, the nature of which was was {crimes.Roll()}. {punishments.Roll()}"); } else if (96 <= randomNumber && randomNumber <= 99) { lifeEvents.Add($"You encountered something magical. {new ArcaneMatters().Roll()}"); } else if (randomNumber == 100) { WeirdStuff weirdStuff = new WeirdStuff(); lifeEvents.Add($"Something truly strange happened to you. {weirdStuff.Roll()}"); } } }