public eshShoppingListInvType UpdateMarketItemEnShoppingList(int listID, int itemID, int units) { eshShoppingListInvType slit = SelectMarketItemEnShoppingListPorID(listID, itemID); if (slit == null) { CreateMarketItemEnShoppingList(listID, itemID, units); } else { invType it = Contexto.invTypes.Where(it2 => it2.typeID == itemID).FirstOrDefault(); if (it == null) { throw new ApplicationException(Messages.err_itemNoExiste); } slit.units = units; if (slit.units < 0) { slit.units = 0; } RepositorioItems repoItems = new RepositorioItems(this.Contexto); slit.volume = slit.units * RepositorioItems.GetVolume(it); } Contexto.SaveChanges(); return(slit); }
public static IEnumerable <EVEMaterial> ProductionBaseMaterials(string typeName) { invType dcType = TypesHelper.GetType(typeName); Dictionary <int, EVEMaterial> matInfo = new Dictionary <int, EVEMaterial>(); foreach (invTypeMaterial m in TypesHelper.GetTypeMaterials(dcType)) { matInfo[m.materialTypeID] = new EVEMaterial(EVECache.GetItem(m.materialTypeID), m.quantity, 1.0, false); } invBlueprintType bpType = TypesHelper.GetBlueprintType(dcType); if (bpType != null) { foreach (ramTypeRequirement m in TypesHelper.GetRamTypeRequirements(bpType).Where(x => x.activityID == 1)) { if (m.recycle.Value) { IEnumerable <EVEMaterial> subMats = ProductionBaseMaterials(TypesHelper.GetType(m.requiredTypeID).typeName); foreach (EVEMaterial subMat in subMats) { if (matInfo.ContainsKey(subMat.item.TypeID)) { matInfo[subMat.item.TypeID].quantity -= subMat.quantity; } } } } } return(matInfo.Values.Where(x => x.quantity > 0).OrderByDescending(x => x.quantity).ToList()); }
private void QMMatsGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == 0) // change the default { this.defaultMETE = new METEData( double.Parse(this.QMMatsGrid.Rows[0].Cells[2].Value.ToString()), double.Parse(this.QMMatsGrid.Rows[0].Cells[3].Value.ToString()), double.Parse(this.QMMatsGrid.Rows[0].Cells[4].Value.ToString()), double.Parse(this.QMMatsGrid.Rows[0].Cells[5].Value.ToString()), double.Parse(this.QMMatsGrid.Rows[0].Cells[6].Value.ToString()), double.Parse(this.QMMatsGrid.Rows[0].Cells[7].Value.ToString()) ); refreshMatsTable(); } else if (e.RowIndex > 0) { string name = (string)this.QMMatsGrid.Rows[e.RowIndex].Cells[0].Value; name = name.Substring(name.LastIndexOf("-") + 1); invType item = MainForm._sde.GetTypeFromName(name).First(); METEData data = new METEData( (this.QMMatsGrid.Rows[e.RowIndex].Cells[2].Value == null || (string)this.QMMatsGrid.Rows[e.RowIndex].Cells[2].Value == "") ? -1 : int.Parse(this.QMMatsGrid.Rows[e.RowIndex].Cells[2].Value.ToString()), (this.QMMatsGrid.Rows[e.RowIndex].Cells[3].Value == null || (string)this.QMMatsGrid.Rows[e.RowIndex].Cells[3].Value == "") ? -1 : int.Parse(this.QMMatsGrid.Rows[e.RowIndex].Cells[3].Value.ToString()), (this.QMMatsGrid.Rows[e.RowIndex].Cells[4].Value == null || (string)this.QMMatsGrid.Rows[e.RowIndex].Cells[4].Value == "") ? -1 : int.Parse(this.QMMatsGrid.Rows[e.RowIndex].Cells[4].Value.ToString()), (this.QMMatsGrid.Rows[e.RowIndex].Cells[5].Value == null || (string)this.QMMatsGrid.Rows[e.RowIndex].Cells[5].Value == "") ? -1 : int.Parse(this.QMMatsGrid.Rows[e.RowIndex].Cells[5].Value.ToString()), (this.QMMatsGrid.Rows[e.RowIndex].Cells[6].Value == null || (string)this.QMMatsGrid.Rows[e.RowIndex].Cells[6].Value == "") ? -1 : int.Parse(this.QMMatsGrid.Rows[e.RowIndex].Cells[6].Value.ToString()), (this.QMMatsGrid.Rows[e.RowIndex].Cells[7].Value == null || (string)this.QMMatsGrid.Rows[e.RowIndex].Cells[7].Value == "") ? -1 : int.Parse(this.QMMatsGrid.Rows[e.RowIndex].Cells[7].Value.ToString()) ); this.meteDatas.Remove(item); this.meteDatas.Add(item, data); refreshMatsTable(); } }
public eshFitting MountFittingFromFittingAnalysed(FittingAnalyzed fit) { RepositorioItems repo = new RepositorioItems(); eshFitting salida = new eshFitting(); salida.name = fit.Name; salida.description = fit.Description; invType shipType = repo.SelectItemTypePorName(fit.Ship); if (shipType == null) { throw new ApplicationException(Messages.err_nombreItemAnalizadaNoExiste); } salida.shipTypeID = shipType.typeID; salida.shipVolume = RepositorioItems.GetVolume(shipType); double totalVol = salida.shipVolume; foreach (var item in fit.Items) { eshFittingHardware fhwd = MountFittingHardware(item, repo); salida.eshFittingHardwares.Add(fhwd); totalVol += fhwd.volume; } salida.volume = totalVol; return(salida); }
public static invGroup GetGroup(invType type) { if (type.groupID == null) { return(null); } return(GetGroup(type.groupID.Value)); }
public double TEMultiplier(invType buildingProduct) { double mult = 0.99; foreach (StructureRig rig in Rigs) { mult *= rig.MEMultiplier(buildingProduct); } return(mult); }
private EVMarketItem Copiar(invType inv) { EVMarketItem mi = new EVMarketItem(); mi.ItemID = inv.typeID; mi.ParentID = inv.marketGroupID; mi.Name = inv.typeName; mi.UrlIcon = string.Format("http://image.eveonline.com/Type/{0}_32.png", inv.typeID); mi.EsFinal = true; return(mi); }
private string GetShipName(int id) { EveShoppingContext contexto = new EveShoppingContext(); invType ship = contexto.invTypes.Where(i => i.typeID == id).FirstOrDefault(); if (ship == null) { throw new FittingFormatNotRecognisedException(Messages.err_notRecognisedItemInFitting); } return(ship.typeName); }
private IList <int> GetListOfGroupsToTop(invType item, List <TreeNode <int> > finalNodeList) { TreeNode <int> nodoFinal = finalNodeList.Where(n => n.Value == item.marketGroupID.Value).FirstOrDefault();; List <int> listaNodos = new List <int>(); listaNodos.Add(nodoFinal.Value); while (nodoFinal.Parent != null) { nodoFinal = nodoFinal.Parent; listaNodos.Add(nodoFinal.Value); } return(listaNodos); }
private void addMatR(invType mat, int amount, int depth, bool start = false) { if (mat == null) { return; } if (mat.isBaseMat()) { baseMats.Add(mat, amount); } else { METEData data = null; this.meteDatas.TryGetValue(mat, out data); bool hadMEData = true; if (data == null) { data = this.defaultMETE; hadMEData = false; } string matStr = ""; for (int i = 0; i < depth; i++) { matStr += "-"; } if (!hadMEData || start) { this.QMMatsGrid.Rows.Add(matStr + mat, amount, "", "", "", "", "", ""); } else { string[] mesStrs = data.ToStrArray(); this.QMMatsGrid.Rows.Add(matStr + mat, amount, mesStrs[0], mesStrs[1], mesStrs[2], mesStrs[3], mesStrs[4], mesStrs[5]); } var matlist = mat.getMats(amount, data.TotalMEAsMultiplier); foreach (KeyValuePair <invType, int> submat in matlist) { addMatR(submat.Key, submat.Value, depth + 1); } } }
public static IEnumerable <EVEMaterial> ProductionExtraMaterials(string typeName) { invType dcType = TypesHelper.GetType(typeName); List <EVEMaterial> matInfo = new List <EVEMaterial>(); invBlueprintType bpType = TypesHelper.GetBlueprintType(dcType); if (bpType != null) { foreach (ramTypeRequirement m in TypesHelper.GetRamTypeRequirements(bpType).Where(x => x.activityID == 1)) { matInfo.Add(new EVEMaterial(EVECache.GetItem(m.requiredTypeID), m.quantity.Value, m.damagePerJob.Value, true)); } } return(matInfo); }
public eshFittingHardware MountFittingHardware(FittingHardwareAnalyzed fithwd, RepositorioItems repo) { invType tipo = repo.SelectItemTypePorName(fithwd.Name); if (tipo == null) { throw new ApplicationException(string.Format("{0}: {1}", Messages.err_nombreItemAnalizadaNoExiste, fithwd.Name)); } eshFittingHardware salida = new eshFittingHardware(); salida.typeID = tipo.typeID; salida.positionInSlot = 0; salida.slotID = fithwd.Slot; salida.units = fithwd.Units; salida.volume = RepositorioItems.GetVolume(tipo) * fithwd.Units; return(salida); }
public static invType GetType(int typeID) { if (_cachedTypesByID.ContainsKey(typeID)) { return(_cachedTypesByID[typeID]); } invType loadedType = (from t in _typesContext.invTypes where t.typeID == typeID select t).FirstOrDefault(); if (loadedType != null) { _cachedTypesByID.Add(loadedType.typeID, loadedType); _cachedTypesByName.Add(loadedType.typeName, loadedType); } return(loadedType); }
public eshShoppingListInvType CreateMarketItemEnShoppingList(int listID, int itemID, int units) { eshShoppingListInvType slit = new eshShoppingListInvType(); slit.typeID = itemID; slit.shoppingListID = listID; slit.units = units; invType it = Contexto.invTypes.Where(it2 => it2.typeID == itemID).FirstOrDefault(); if (it == null) { throw new ApplicationException(Messages.err_itemNoExiste); } RepositorioItems repoItems = new RepositorioItems(); slit.volume = units * RepositorioItems.GetVolume(it); Contexto.eshShoppingListInvTypes.Add(slit); Contexto.SaveChanges(); return(slit); }
public static IEnumerable <EVEMaterial> GetInventionRequirements(string t2ItemName) { List <EVEMaterial> result = new List <EVEMaterial>(); invType t1type = TypesHelper.GetMeta0Type(t2ItemName); invBlueprintType bpType = TypesHelper.GetBlueprintType(t1type); IEnumerable <ramTypeRequirement> ramReqs = TypesHelper.GetRamTypeRequirements(bpType).Where(x => x.activityID == 8); foreach (ramTypeRequirement r in ramReqs) { invType reqType = TypesHelper.GetType(r.requiredTypeID); EVEMaterial newMat = new EVEMaterial(EVECache.GetItem(reqType), r.quantity.Value, r.damagePerJob.Value, true); if (reqType.groupID == 716) { newMat.damage = 0; } result.Add(newMat); } return(result); }
public void FillShipGroupsTable() { IDictionary <int, IList <int> > dicc = CreateShipGroupsDictionary(); EveShoppingContext contexto = new EveShoppingContext(); foreach (var item in dicc) { invType it = contexto.invTypes.Where(i => i.typeID == item.Key).FirstOrDefault(); IEnumerable <invMarketGroup> groups = contexto.invMarketGroups.Where(img => item.Value.Contains(img.marketGroupID)); foreach (var g in groups) { eshShipsMarketGroup smg = new eshShipsMarketGroup() { typeID = it.typeID, marketGroupID = g.marketGroupID }; contexto.eshShipsMarketGroups.Add(smg); } } contexto.SaveChanges(); }
protected IEnumerable <BlueprintMaterial> GetMaterials(invType type) { if (type == null) { return(new List <BlueprintMaterial>()); } return(type.industryActivityMaterials.Where(am => am.activityID == (int)IndustryActivityType.Manufacturing) .ToList() .Select(m => new BlueprintMaterial() { TypeId = m.materialTypeID, TypeName = m.materialType.typeName, Qty = m.quantity, Volume = m.materialType.volume, Skills = m.type.typeSkills.Where(a => a.activityID == (int)IndustryActivityType.Manufacturing).ToList().Select(s => new BlueprintSkill { SkillId = s.skillID, SkillName = s.skillType.typeName, MinimumLevel = s.level, }), Materials = GetMaterials(m.materialType.activityProducts.Where(p => p.activityID == (int)IndustryActivityType.Manufacturing).Select(p => p.type).SingleOrDefault()) })); }
public static invType GetMeta0Type(invType type) { return(GetMeta0Type(type.typeID)); }
public stringVal values; // dateVal, StringVal, ValueVal #endregion Fields #region Constructors public inverter(String company, String siteName, long sitePower, String serialNo, String otherName, long inverterPower, String model, invType type = invType.INVERTER, String sensorSN = null, Boolean bInDBFlag = false) { this.company = company; this.siteName = siteName; this.sitePower = sitePower; this.serialNo = serialNo; this.otherName = otherName; this.inverterPower=inverterPower; this.model = model; this.type = type; this.sensorSN = sensorSN; this.bInDb = bInDBFlag; this.dataTP = new List<valueDTP>(); this.measureInternalNameArray = new Dictionary<string, int>(); // internalNames if (inverterPower == 0) { string output = new string(model.Where(c => char.IsDigit(c)).ToArray()); inverterPower = 0; long.TryParse(output, out inverterPower); } if (this.otherName.ToLower().Contains("webbox")) this.type = invType.WEBBOX; else if (this.otherName.ToLower().Contains("sensor")) this.type = invType.SENSOR; this.values = new stringVal(); }
public dateVal values; // dateTime, measureName, 0=Mean [1 = Min, 2 = Max] #endregion Fields #region Constructors public inverter(String company, String name, String model, String serialNo, long power = 0, invType type = invType.INVERTER, int nbMeasures=30, int nbStrings=20, String sensorSN=null) { this.name = name; this.model = model; this.serialNo =serialNo; this.type = type; this.measureName = new Dictionary<string,List<int>>(); if (power == 0) { string output = new string(model.Where(c => char.IsDigit(c)).ToArray()); power = int.Parse(output); } this.company = company; this.nbMeasures = nbMeasures; this.nbStrings = nbStrings; this.sensorSN = sensorSN; }
private Location(long id) { ID = id; System = null; StructureType = null; Type = LocationType.Unknown; Name = "Unknown"; foreach (Character c in Character.KnownCharacters.Values) { JObject jobj; try { string url = "https://esi.tech.ccp.is/latest/universe/structures/" + ID + "/?datasource=tranquility&token=" + c.AuthToken; HttpWebRequest web = (HttpWebRequest)WebRequest.CreateHttp(url); web.Method = "GET"; web.ContentLength = 0; var response = web.GetResponse(); using (var sr = new StreamReader(response.GetResponseStream())) { jobj = JObject.Parse(sr.ReadToEnd()); } } catch (Exception e) { continue; } if (jobj["error"] == null) { continue; } Name = (string)jobj["name"]; StructureType = SDEEntities.SDE.GetTypeFromID((int)jobj["type_id"]).First(); System = SDEEntities.SDE.GetSystemFromID((int)jobj["solar_system_id"]).First(); Type = LocationType.Citadel; break; } if (Type == LocationType.Unknown) // didn't find it looking at structures, look at stations { foreach (Character c in Character.KnownCharacters.Values) { JObject jobj; try { string url = "https://esi.tech.ccp.is/latest/universe/stations/" + ID + "/?datasource=tranquility&token=" + c.AuthToken; HttpWebRequest web = (HttpWebRequest)WebRequest.CreateHttp(url); web.Method = "GET"; web.ContentLength = 0; var response = web.GetResponse(); using (var sr = new StreamReader(response.GetResponseStream())) { jobj = JObject.Parse(sr.ReadToEnd()); } } catch (Exception e) { continue; } if (jobj["error"] == null) { continue; } Name = (string)jobj["name"]; StructureType = SDEEntities.SDE.GetTypeFromID((int)jobj["type_id"]).First(); System = SDEEntities.SDE.GetSystemFromID((int)jobj["system_id"]).First(); Type = LocationType.Station; break; } } if (this.Type != LocationType.Unknown) { KnownLocations.Add(id, this); } }
public static double GetVolume(invType it) { switch (it.groupID) { //Assault frigate case 324: return(2500); //Attack battlecruiser case 1201: return(15000); //Battleship case 27: return(50000); //Black Ops case 898: return(50000); //Blockade Runner case 1202: return(20000); //Capital Industrial Ship case 883: return(1000000); //Capsule case 29: return(1); //Carrier case 547: return(1000000); //Combat Battlecruiser case 419: return(15000); //Combat Recon Ship case 906: return(10000); //Command Ship case 540: return(15000); //Covert Ops case 830: return(2500); //Cruiser case 26: return(10000); //Deep Space Transport case 380: return(20000); //Destroyer case 420: return(5000); //Dreadnought case 485: return(1000000); //Electronic Attack Ship case 893: return(2500); //Elite Battleship case 381: return(50000); //Exhumer case 543: return(3750); //Force Ship case 833: return(1000); //Freighter case 513: return(1000000); //Frigate case 25: return(2500); //Heavy Assault Cruiser case 358: return(10000); //Heavy Interdiction Cruiser case 894: return(10000); //Industrial case 28: return(20000); //Industrial Command Ship case 941: return(500000); //Interceptor case 831: return(2500); //Interdictor case 541: return(5000); //Jump Freighter case 902: return(1000000); //Logistics case 832: return(10000); //Marauder case 900: return(50000); //Mining Barge case 463: return(3750); //Prototype Exploration Ship case 1022: return(500); //Rookie ship case 237: return(2500); //Shuttle case 31: return(500); //Stealth Bomber case 834: return(2500); //Strategic Cruiser case 963: return(5000); //Supercarrier case 659: return(1000000); //Titan case 30: return(10000000); default: return(it.volume.Value); } }
public static IEnumerable <invTypeMaterial> GetTypeMaterials(invType type) { return(GetTypeMaterials(type.typeID)); }
public static EVEItem GetItem(invType type) { return(GetItem(type.typeID)); }
public static invBlueprintType GetBlueprintType(invType type) { return(GetBlueprintType(type.typeID)); }