/// <summary> /// Parses the item list from a delivery. The format is an array of 2-element arrays, /// where element 0 is the quantity and element 1 is the type ID. /// </summary> /// <param name="typeIDs">The type IDs and quantities of delivered items</param> /// <returns></returns> private static string BuildItemList(YamlSequenceNode typeIDs) { string items; if (!typeIDs.Any()) { items = "No items were delivered"; } else { int type, qty; var sb = new StringBuilder(512); // Add all valid types to the string foreach (var typeAndQty in typeIDs) { // Convert to array, proceed only if successful and has 2 elements var array = (typeAndQty as YamlSequenceNode)?.Children; if (array?.Count == 2 && array[0].ToString().TryParseInv(out qty) && qty > 0 && array[1].ToString().TryParseInv(out type) && type > 0) { sb.AppendLine(string.Format("{0}x {1}", qty.ToNumericString(0), StaticItems.GetItemName(type))); } } items = sb.ToString(); } return(items); }
/// <summary> /// Gets the volume. /// </summary> /// <returns></returns> private double GetVolume() { Item item = StaticItems.GetItemByID(ContentTypeID); return(item != null && m_volumeProperty != null?m_volumeProperty. GetNumericValue(item) * ContentQuantity : 0.0); }
/// <summary> /// Imports data from an ESI deserialization object. /// </summary> public void Import(EsiAPIClones serial) { if (serial == null) { return; } m_cloneSets.Clear(); // Jump clones foreach (var clone in serial.JumpClones) { int cloneID = clone.JumpCloneID; var set = new ImplantSet(m_character, GetCloneName(clone.Name, clone. LocationID)); // Jump clone implants var jcImplants = new LinkedList <SerializableNewImplant>(); foreach (int implant in clone.Implants) { jcImplants.AddLast(new SerializableNewImplant() { ID = implant, Name = StaticItems.GetItemName(implant) }); } set.Import(jcImplants); m_cloneSets.Add(set); } EveMonClient.OnCharacterImplantSetCollectionChanged(m_character); }
/// <summary> /// Scans for prices. /// </summary> /// <returns></returns> private static IEnumerable <MineralPrice> GetPrices(IMineralParser parser) { string content = String.Empty; try { content = HttpWebClientService.DownloadString(parser.URL).Result; } catch (HttpWebClientServiceException ex) { ExceptionHandler.LogException(ex, false); } // Scan for prices MatchCollection mc = parser.Tokenizer.Matches(content); return(mc.Cast <Match>().Select(match => { int typeID; string name = Int32.TryParse(match.Groups["name"].Value, out typeID) ? StaticItems.GetItemByID(typeID).Name : match.Groups["name"].Value; return new MineralPrice { Name = name, Price = Decimal.Parse(match.Groups["price"].Value, NumberStyles.Currency, CultureInfo.InvariantCulture) }; })); }
/// <summary> /// Populates the serialization object order with the info from the API. /// </summary> /// <param name="src">The source.</param> private void PopulateOrderInfo(SerializableOrderListItem src) { OwnerID = src.OwnerID; ID = src.OrderID; Item = StaticItems.GetItemByID(src.ItemID); UnitaryPrice = src.UnitaryPrice; InitialVolume = src.InitialVolume; RemainingVolume = src.RemainingVolume; MinVolume = src.MinVolume; Duration = src.Duration; Issued = src.Issued; IssuedFor = src.IssuedFor; m_stationID = src.StationID; UpdateStation(); if (src.IsBuyOrder == 0) { return; } BuyOrder buyOrder = (BuyOrder)this; buyOrder.Escrow = src.Escrow; buyOrder.Range = src.Range; }
/// <summary> /// Handles the MouseDown event of the pictureBox control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param> private void pictureBox_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } PictureBox pictureBox = sender as PictureBox; if (pictureBox == null) { return; } // Right click reset the cursor pictureBox.Cursor = Cursors.Default; int typeId = pictureBox == ShipPictureBox ? m_attacker.ShipTypeID : pictureBox == WeaponPictureBox ? m_attacker.WeaponTypeID : Item.UnknownItem.ID; // Set the selected item m_selectedItem = StaticItems.GetItemByID(typeId); // Display the context menu contextMenuStrip.Show(pictureBox, e.Location); }
/// <summary> /// Handles the Click event of the showInBrowserMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void showInBrowserMenuItem_Click(object sender, EventArgs e) { ToolStripItem menuItem = sender as ToolStripItem; if (menuItem == null) { return; } PlanetaryPin pin = lvPlanetary.SelectedItems[0]?.Tag as PlanetaryPin; // showInstallationInBrowserMenuItem if (menuItem == showInstallationInBrowserMenuItem) { if (pin?.TypeID == null) { return; } Item installation = StaticItems.GetItemByID(pin.TypeID); if (installation != null) { PlanWindow.ShowPlanWindow(Character).ShowItemInBrowser(installation); } return; } // showCommodityInBrowserMenuItem if (menuItem == showCommodityInBrowserMenuItem) { if (pin?.ContentTypeID == null) { return; } Item commmodity = StaticItems.GetItemByID(pin.ContentTypeID); if (commmodity != null) { PlanWindow.ShowPlanWindow(Character).ShowItemInBrowser(commmodity); } return; } if (pin?.Colony?.PlanetTypeID == null) { return; } Item planet = StaticItems.GetItemByID(pin.Colony.PlanetTypeID); if (planet != null) { PlanWindow.ShowPlanWindow(Character).ShowItemInBrowser(planet); } }
/// <summary> /// Gets the output item by its ID (can be a blueprint or an item). /// </summary> /// <param name="id">The itemID of the blueprint.</param> /// <returns>The output item from the bluperint.</returns> private Item GetOutputItem(int id) { switch (Activity) { case BlueprintActivity.Manufacturing: return(StaticBlueprints.GetBlueprintByID(InstalledItem.ID).ProducesItem ?? StaticItems.GetItemByID(0)); case BlueprintActivity.ResearchingMaterialEfficiency: case BlueprintActivity.ResearchingTimeEfficiency: case BlueprintActivity.Copying: return(InstalledItem); case BlueprintActivity.Invention: case BlueprintActivity.ReverseEngineering: return(StaticBlueprints.GetBlueprintByID(id) ?? StaticItems.GetItemByID(0)); case BlueprintActivity.SimpleReactions: case BlueprintActivity.Reactions: return(StaticItems.GetItemByID(InstalledItem?.ReactionOutcome?.Item?.ID ?? 0)); default: return(StaticItems.GetItemByID(0)); } }
public SerializablePlanetaryColony ToXMLItem() { // Determine planet type from type name // Planet type is a type ID CCPAPIPlanetTypes type = CCPAPIPlanetTypes.Unknown; if (!string.IsNullOrEmpty(PlanetType)) { Enum.TryParse(PlanetType, true, out type); } int planetType = (int)type; var ret = new SerializablePlanetaryColony() { LastUpdate = LastUpdate, NumberOfPins = NumberOfPins, OwnerID = OwnerID, PlanetID = PlanetID, SolarSystemID = SolarSystemID, SolarSystemName = StaticGeography.GetSolarSystemName(SolarSystemID), PlanetTypeID = planetType, PlanetTypeName = StaticItems.GetItemName(planetType), UpgradeLevel = UpgradeLevel }; return(ret); }
public SerializableJobListItem ToXMLItem() { return(new SerializableJobListItem() { ActivityID = ActivityID, BlueprintID = BlueprintID, BlueprintLocationID = BlueprintLocationID, BlueprintTypeID = BlueprintTypeID, BlueprintTypeName = StaticItems.GetItemName(BlueprintTypeID), CompletedCharacterID = CompletedCharacterID, CompletedDate = CompletedDate, Cost = Cost, EndDate = EndDate, FacilityID = FacilityID, InstallerID = InstallerID, JobID = JobID, LicensedRuns = LicensedRuns, OutputLocationID = OutputLocationID, PauseDate = PauseDate, Probability = Probability, ProductTypeID = ProductTypeID, ProductTypeName = StaticItems.GetItemName(ProductTypeID), Runs = Runs, StartDate = StartDate, StationID = BlueprintLocationID, Status = (int)Status, SuccessfulRuns = SuccessfulRuns, TimeInSeconds = TimeInSeconds }); }
/// <summary> /// Updates the given slot with the provided serialization object. /// </summary> /// <param name="slot"></param> /// <param name="name"></param> private void Import(ImplantSlots slot, string name) { // Backwards compatibility for older versions name = name.Replace("<", String.Empty).Replace(">", String.Empty); m_values[(int)slot] = StaticItems.GetImplants(slot)[name] ?? new Implant(slot); }
public void ResearchComplete(object sender, ResearchCompleteEventArgs e) { foreach (var p in e.Manager.Colony.Owners) { StaticItems.AddStaticItemToStockpile(p); } }
/// <summary> /// Updates the content. /// </summary> private void UpdateContent() { Task.WhenAll( GetImageForAsync(CharacterPictureBox), GetImageForAsync(ShipPictureBox), GetImageForAsync(CorpPictureBox)); if (m_killLog.Victim.AllianceID != 0) { Task.WhenAll(GetImageForAsync(AlliancePictureBox)); AllianceNameLabel.Text = m_killLog.Victim.AllianceName; } else { CorpAllianceFlowLayoutPanel.Controls.Remove(AllianceNameLabel); CorpAllianceFlowLayoutPanel.Padding = new Padding(0, 12, 0, 0); } CharacterNameLabel.Text = m_killLog.Victim.Name; CorpNameLabel.Text = m_killLog.Victim.CorporationName; Item ship = StaticItems.GetItemByID(m_killLog.Victim.ShipTypeID); ShipNameLabel.Text = ship.Name; ShipGroupLabel.Text = String.Format(CultureConstants.DefaultCulture, ShipGroupLabel.Text, ship.GroupName); KillTimeLabel.Text = m_killLog.KillTime.ToLocalTime().DateTimeToDotFormattedString(); SolarSystemLabel.Text = m_killLog.SolarSystem?.Name; SecStatusLabel.Text = m_killLog.SolarSystem?.SecurityLevel.ToNumericString(1); SecStatusLabel.ForeColor = m_killLog.SolarSystem?.SecurityLevelColor ?? SystemColors.ControlText; ConstelationLabel.Text = m_killLog.SolarSystem?.Constellation?.Name; RegionLabel.Text = m_killLog.SolarSystem?.Constellation?.Region?.Name; }
/// <summary> /// Gets the implant name for the given slot and the provided set. /// </summary> /// <param name="set"></param> /// <param name="slot"></param> /// <returns></returns> private static Implant GetImplant(SerializableSettingsImplantSet set, ImplantSlots slot) { // Invoke the property getter with the matching name through reflection object implantName = typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).GetValue(set, null); return(StaticItems.GetImplants(slot)[(string)implantName]); }
static void Main(string[] args) { serverLevel = new ServerLevel(); Network.Config = new NetPeerConfiguration("TestGame") { Port = 25232 }; // The server and the client program must also use this name, so that can communicate with each other. Network.Server = new NetServer(Network.Config); Network.Config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest); Network.Server.Start(); Console.Title = "TestGame Server GAMMA"; WriteLine("Server started on Port: " + Network.Config.Port, ConsoleColor.Blue); WriteLine("Waiting for connections...", ConsoleColor.Blue); serverLevel.LoadEntities(); //INIT Global.rdm = new Random(); StaticItems s = new StaticItems(); while (true) { TimerTick(); } }
//change to the choosed anim and start the anim, then swipe to the second screen automatically public void onStartSport() { RuntimeAnimatorController choosedAnim = Resources.Load("Anim/AnimController/" + StaticItems.AnimName) as RuntimeAnimatorController; //check which joints to evaluate from Playfab database if (PlayFabClientAPI.IsClientLoggedIn()) { try { StaticItems.ClientGetTitleData(StaticItems.AnimName); } finally { Debug.Log("finished"); } } //if not login, assum evaluate default joints else { StaticItems.ChoosedAngles = StaticItems.ChoosedAngles_default; } StaticItems.Coach.GetComponent <Animator>().runtimeAnimatorController = choosedAnim; GameObject.Find("Screens").GetComponent <LeanSnap>().SnapWrapper(-1000f); GameObject.Find("LeanWindowCloser").GetComponent <LeanWindowCloser>().CloseAll(); }
/// <summary> /// Imports data from the given character ship information. /// </summary> /// <param name="result">The serialized character ship information</param> internal void Import(EsiResult <EsiAPIShip> result) { var ship = result.Result; ShipName = ship.ShipName; ShipTypeName = StaticItems.GetItemName(ship.ShipTypeID); EveMonClient.OnCharacterInfoUpdated(this); }
private string GetShipTypeName(int characterId, string dataSource, string accessToken) { var location = _locationApi.GetCharactersCharacterIdShip(characterId, dataSource, accessToken); var shipTypeId = location.ShipTypeId.GetValueOrDefault(); var ship = StaticItems.GetItemByID(shipTypeId); return(ship == null || shipTypeId == 0 ? EveMonConstants.UnknownText : ship.Name); }
public void CrossedLane() { StaticItems.scoreValue += 100f; if (Mathf.FloorToInt(lanesCrossed) >= maxLanes) { StartCoroutine(StaticItems.LevelTransition()); } }
/// <summary> /// Imports data from an API serialization object. /// </summary> /// <param name="src">The source.</param> internal void Import(IEnumerable <SerializableNewImplant> src) { for (int i = 0; i < SlotNumbers; i++) { m_values[i] = StaticItems.GetImplants((ImplantSlots)i).FirstOrDefault(x => src.Any(y => y.ID == x.ID)) ?? new Implant((ImplantSlots)i); } }
/// <summary> /// Handles the Click event of the showInShipBrowserMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void showInShipBrowserMenuItem_Click(object sender, EventArgs e) { Item item = StaticItems.GetItemByID(m_killLog.Victim.ShipTypeID); if (item != null) { PlanWindow.ShowPlanWindow(m_killLog.Character).ShowShipInBrowser(item); } }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src">The source.</param> internal ContractItem(EsiContractItemsListItem src) { RecordID = src.RecordID; Item = StaticItems.GetItemByID(src.TypeID); Quantity = src.Quantity; RawQuantity = src.RawQuantity; Singleton = src.Singleton; Included = src.Included; }
private IEnumerable <SerializableCharacterJumpCloneImplant> GetJumpCloneImplants(List <GetCharactersCharacterIdClonesJumpClone> characterClones) { var implants = characterClones.SelectMany(x => x.Implants, (jc, imp) => new SerializableCharacterJumpCloneImplant { JumpCloneID = jc.JumpCloneId.GetValueOrDefault(), TypeID = imp.GetValueOrDefault(), TypeName = StaticItems.GetItemByID(imp.GetValueOrDefault()).Name }); return(implants); }
private IEnumerable <SerializableNewImplant> GetImplants(int characterId, string dataSource, string accessToken) { var characterImplants = _clonesApi.GetCharactersCharacterIdImplants(characterId, dataSource, accessToken); var implants = characterImplants.Select(x => new SerializableNewImplant { ID = x.GetValueOrDefault(), Name = StaticItems.GetItemByID(x.GetValueOrDefault()).Name }); return(implants); }
/// <summary> /// Occurs when we downloaded a loadout from Battleclinic /// </summary> /// <param name="feed"></param> /// <param name="errorMessage"></param> /// <returns></returns> private void OnLoadoutDownloaded(SerializableLoadoutFeed loadoutFeed, string errorMessage) { if (this.IsDisposed) { return; } // Reset the controls btnPlan.Enabled = false; m_prerequisites.Clear(); tvLoadout.Nodes.Clear(); Cursor.Current = Cursors.Default; // Was there an error ? if (!String.IsNullOrEmpty(errorMessage) || loadoutFeed.Race.Loadouts.Length == 0) { lblTrainTime.Text = "Couldn't download that loadout.\r\n" + errorMessage; lblTrainTime.Visible = true; return; } var loadout = loadoutFeed.Race.Loadouts[0]; // Fill the items tree var slotTypes = loadout.Slots.GroupBy(x => x.SlotType); foreach (var slotType in slotTypes) { TreeNode typeNode = new TreeNode(s_typeMap[slotType.Key]); foreach (var slot in slotType) { Item item = StaticItems.GetItem(slot.ItemID); if (item == null) { continue; } TreeNode slotNode = new TreeNode(); slotNode.Text = item.Name; slotNode.Tag = item; typeNode.Nodes.Add(slotNode); m_prerequisites.AddRange(item.Prerequisites); } tvLoadout.Nodes.Add(typeNode); } // Compute the training time UpdatePlanningControls(); tvLoadout.ExpandAll(); }
/// <summary> /// Deserializes an XML loadout text. /// </summary> /// <param name="text">The text.</param> /// <returns></returns> public static ILoadoutInfo DeserializeXmlFormat(string text) { SerializableXmlFittings fittings = Util.DeserializeXmlFromString <SerializableXmlFittings>(text); ILoadoutInfo loadoutInfo = new LoadoutInfo(); // Nothing to evaluate if (fittings == null) { return(loadoutInfo); } // Retrieve the ship loadoutInfo.Ship = StaticItems.GetItemByName(fittings.Fitting.ShipType.Name); if (loadoutInfo.Ship == null) { return(loadoutInfo); } // Special case to avoid displaying gzCLF block from Osmium if (fittings.Fitting.Description.Text.StartsWith("BEGIN gzCLF BLOCK", StringComparison.InvariantCultureIgnoreCase)) { fittings.Fitting.Description.Text = String.Empty; } Loadout loadout = new Loadout(fittings.Fitting.Name, fittings.Fitting.Description.Text); IEnumerable <Item> listOfItems = fittings.Fitting.FittingHardware .Where(hardware => hardware != null && hardware.Item != null && hardware.Slot != "drone bay") .Select(hardware => hardware.Item); IEnumerable <SerializableXmlFittingHardware> listOfXmlDrones = fittings.Fitting.FittingHardware .Where(hardware => hardware != null && hardware.Item != null && hardware.Slot == "drone bay"); var listOfDrones = new List <Item>(); foreach (SerializableXmlFittingHardware drone in listOfXmlDrones) { for (int i = 0; i < drone.Quantity; i++) { listOfDrones.Add(drone.Item); } } loadout.Items = listOfItems.Concat(listOfDrones); loadoutInfo.Loadouts.Add(loadout); return(loadoutInfo); }
/// <summary> /// Adds the groups. /// </summary> /// <returns></returns> private IEnumerable <ListViewItem> AddGroups() { var items = new List <ListViewItem>(); double materiaEffModifier = 1d - (double)nudME.Value / 100; foreach (var marketGroup in StaticItems.AllGroups) { // Create the groups var group = new ListViewGroup(marketGroup.CategoryPath); bool hasItem = false; foreach (var material in m_blueprint.MaterialRequirements) { if (material.Activity == m_activity && marketGroup.Items.Any(y => y.ID == material.ID)) { hasItem = true; // Create the item var item = new ListViewItem(group) { Tag = StaticItems.GetItemByID(material.ID), Text = material.Name }; // Add the item to the list items.Add(item); // Calculate the base material quantity long baseMaterialQuantity = material.Quantity; // Calculate the actual material quantity long actualMaterialQuantity = (long)Math.Ceiling(material.Quantity * materiaEffModifier * m_materialFacilityMultiplier); // Add the base quantity for every item var subItemBase = new ListViewItem.ListViewSubItem(item, baseMaterialQuantity.ToString("N0")); item.SubItems.Add(subItemBase); // Add the quantity needed according to the character's skills for every item var subItem = new ListViewItem.ListViewSubItem(item, actualMaterialQuantity.ToString("N0")); item.SubItems.Add(subItem); } } // Add the group that has an item if (hasItem) { PropertiesList.Groups.Add(group); } } return(items); }
/// <summary> /// Gets an item by its ID or its name. /// </summary> /// <param name="src"></param> /// <returns></returns> private static Item GetItem(SerializableOrderBase src) { // Try get item by its ID Item item = StaticItems.GetItemByID(src.ItemID); // We failed? Try get item by its name if (item == null) { item = StaticItems.GetItemByName(src.Item); } return(item); }
/// <summary> /// Gets the output item by its ID (can be a blueprint or an item). /// </summary> /// <param name="id">The itemID of the blueprint.</param> /// <returns>The output item from the bluperint.</returns> private static Item GetOutputItem(long id) { // Is it a blueprint ? Item item = StaticBlueprints.GetBlueprintByID(id); // Then it's an item if (item == null) { item = StaticItems.GetItemByID(id); } return(item); }
/// <summary> /// Gets an items ID either by source or by name. /// </summary> /// <param name="src"></param> /// <returns></returns> private static long GetItemID(SerializableOrderBase src) { // Try get item ID by source var itemID = src.ItemID; // We failed? Try get item ID by name if (itemID == 0) { var item = StaticItems.GetItemByName(src.Item); itemID = (item == null ? 0 : item.ID); } return(itemID); }