internal OrePriorityCheck(int idx, ItemProfile o, ItemProfile i, int t) { index = idx; ore = o; ingot = i; threshold = t; }
private IMapper GetMapper() { var profile = new ItemProfile(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(profile)); return(new Mapper(configuration)); }
public override void contributeToTreeView(TreeView treeView) { TreeNode rootNode = new TreeNode(this.GetType().Name); rootNode.Expand(); ContextInfo.AddToList(new ContextInfo { DataType = DataType.ClientToServerHeader }); rootNode.Nodes.Add("i_vendorID = " + Utility.FormatHex(i_vendorID)); ContextInfo.AddToList(new ContextInfo { DataType = DataType.ObjectID }); TreeNode stuffNode = rootNode.Nodes.Add("i_stuff = "); ContextInfo.AddToList(new ContextInfo { Length = i_stuff.Length }, updateDataIndex: false); // Now skip PList count dword ContextInfo.DataIndex += 4; for (int i = 0; i < i_stuff.list.Count; i++) { TreeNode itemProfileNode = stuffNode.Nodes.Add("itemProfile = "); ItemProfile thisProfile = i_stuff.list[i]; ContextInfo.AddToList(new ContextInfo { Length = thisProfile.Length }, updateDataIndex: false); thisProfile.contributeToTreeNode(itemProfileNode); } treeView.Nodes.Add(rootNode); }
public static void Handle(ClientMessage message, Session session) { uint vendorID = message.Payload.ReadUInt32(); uint itemcount = message.Payload.ReadUInt32(); List <ItemProfile> items = new List <ItemProfile>(); while (itemcount > 0) { itemcount--; ItemProfile item = new ItemProfile(); item.Amount = message.Payload.ReadUInt32(); item.Amount = item.Amount & 0xFFFFFF; item.Iid = message.Payload.ReadUInt32(); items.Add(item); } // curancy 0 default, if else then currancy is set other then money uint i_alternateCurrencyID = message.Payload.ReadUInt32(); // todo: take into account other currencyIds other then assuming default QueuedGameAction action = new QueuedGameAction(vendorID, items, GameActionType.Buy); session.Player.AddToActionQueue(action); return; }
public bool Compare(ItemProfile source) { if (source == null) { return(false); } if ( this.ID != source.ID || this.UseEffectTypeValue != source.UseEffectTypeValue || this.ThrowEffectTypeValue != source.ThrowEffectTypeValue || this.UsableTime != source.UsableTime || this.EffectValue != source.EffectValue || this.GainFoodValue != source.GainFoodValue || this.stackable != source.stackable || this.Attack != source.Attack || this.AttackCriticalRate != source.AttackCriticalRate || this.AttackTimes != source.AttackTimes ) { return(false); } return(true); }
public static void Handle(ClientMessage message, Session session) { ObjectGuid vendorId = new ObjectGuid(message.Payload.ReadUInt32()); uint itemcount = message.Payload.ReadUInt32(); List <ItemProfile> items = new List <ItemProfile>(); while (itemcount > 0) { itemcount--; ItemProfile item = new ItemProfile(); item.Amount = message.Payload.ReadUInt32(); // item.Amount = item.Amount & 0xFFFFFF; item.Guid = message.Payload.ReadGuid(); items.Add(item); } // curancy 0 default, if else then currancy is set other then money uint i_alternateCurrencyID = message.Payload.ReadUInt32(); // todo: take into account other currencyIds other then assuming default session.Player.HandleActionBuy(vendorId, items); }
static ItemProfile ReadItems(BinaryReader reader) { var item = new ItemProfile(); item.Unpack(reader); return(item); }
public FieldsFormatter() { var context = HttpContext.Current.Request; var profileName = context.QueryString["profile"]; ItemProfile = new ItemProfileRepository().Get(!string.IsNullOrEmpty(profileName) ? profileName : "default"); }
/// <summary> /// this method is used for deleting ICR Items.- JJ /// </summary> /// <param name="Id">Id of ICR Detail</param> /// <param name="item">object of ItemProfile</param> private void DeleteICRItem(int id, ItemProfile item) { var icrQuantities = _icrQuantityContext.Fetch(x => x.IcrId == id).ToList(); foreach (var quantity in icrQuantities) { if (quantity.ModifyingQuantity > 0) { ItemQuantity itemQuantity; if (item.IsParentItem) { itemQuantity = _itemQuantityContext.FirstOrDefault(x => x.ItemId == item.Id && x.BranchId == quantity.BranchId); } else { itemQuantity = _itemQuantityContext.FirstOrDefault(x => x.ItemId == item.ParentItemId && x.BranchId == quantity.BranchId); } itemQuantity.IsICRGenerated = false; itemQuantity.ModifiedDateTime = DateTime.UtcNow; _itemQuantityContext.Update(itemQuantity); _itemQuantityContext.SaveChanges(); } _icrQuantityContext.Delete(quantity); _icrQuantityContext.SaveChanges(); } }
private void cacheSources() { show("Rebuilding item cache."); sourceCache.Clear(); inventoryAmounts.Clear(); foreach (IMyCargoContainer box in cargo) { List <MyInventoryItem> li = new List <MyInventoryItem>(); box.GetInventory().GetItems(li); if (li.Count > 0) { foreach (MyInventoryItem item in li) { //if (prof.itemType == "ore") { addToCache(item, box); //} int has = 0; ItemProfile prof = new ItemProfile(item); if (!inventoryAmounts.TryGetValue(prof, out has)) { has = 0; } has += item.Amount.ToIntSafe(); inventoryAmounts[prof] = has; } } usedVolume += box.GetInventory().CurrentVolume.ToIntSafe(); maxCapacity += box.GetInventory().MaxVolume.ToIntSafe(); } }
private float getItemFraction(ItemProfile p) { if (totalItems <= 0 || !allItems.ContainsKey(p)) { return(0); } return(allItems[p] / (float)totalItems); }
// ---------------------------------------------------------------------------------------- /// <!-- Copy --> /// <summary> /// /// </summary> /// <returns></returns> public EndemeObject Copy_simple() { EndemeObject enObj = new EndemeObject(ItemLabel, ItemProfile.Copy(), _value_0.Copy()); //ToArray()); enObj.Item.Label = ItemLabel; enObj.ItemKey = this.ItemKey; // should this be copied? enObj.TempMatch = 0.0; return(enObj); }
public POSItemDetail(CustomerProfile customerProfile, ItemProfile itemProfile, ItemOffer itemOffer, List <BalanceBarcodeAc> ListOfBalanceBarcodeConfiguration) { _customerProfile = customerProfile; _itemProfile = itemProfile; _itemOffer = itemOffer; _listOfBalanceBarcodeConfiguration = ListOfBalanceBarcodeConfiguration; _isOfferItem = itemOffer != null; _itemPrice = GetItemPrice(_customerProfile, _itemProfile, _itemOffer, _listOfBalanceBarcodeConfiguration); }
public bool Add(Item item) { ItemProfile profile = ItemProfile.Create(item); items.Add(profile); dirty = true; return(true); }
public void WeaponsFactoryCreateRandomWeapon() { ItemsFactory factory = new ItemsFactory(); var creationProfile = new ItemProfile(1, EntityOccupation.Warrior); IItem item1 = factory.Create(creationProfile); Assert.IsNotNull(item1); Assert.AreEqual(item1.Quality, item1.Quality); }
public void WeaponsFactoryCreateSpecifiedWeapon() { ItemsFactory factory = new ItemsFactory(); var creationProfile = new ItemProfile(1, ItemType.Crossbow, ItemQualityCode.Flawless); IItem item1 = factory.Create(creationProfile); Assert.IsNotNull(item1); Assert.AreEqual(creationProfile.qualityCode, item1.Quality); Assert.AreEqual(creationProfile.Type, item1.Info.TypeCode); }
/// <summary> /// Update the Item Profiles as per Purchase Order Items - JJ /// </summary> /// <param name="spoId"></param> private void UpdateItem(int spoId) { SupplierPurchaseOrder spo = _supplierPOContext.Find(spoId); List <PurchaseOrderBranch> spoBranches = _purchaseOrderBranchContext.Fetch(x => x.PurchaseOrderId == spoId).ToList(); List <PurchaseOrderItem> poItems = _purchaseOrderItemContext.Fetch(x => x.PurchaseOrderId == spoId).ToList(); foreach (PurchaseOrderItem item in poItems) { ItemProfile itemProfile = _itemProfileContext.Find(item.ItemId); itemProfile.PreviousCostPrice = itemProfile.CostPrice; itemProfile.CostPrice = GetItemPrice(item, itemProfile, spoBranches); var icr = _icrDetailContext.FirstOrDefault(x => x.SPOItemId == item.Id && !x.IsDeleted); if (icr != null) { var icrPrice = _icrPriceContext.FirstOrDefault(x => x.IcrId == icr.Id); if (icrPrice != null) { itemProfile.SellPrice = icrPrice.ModifyingSellPrice; itemProfile.SellPriceA = icrPrice.ModifyingSellPriceA; itemProfile.SellPriceB = icrPrice.ModifyingSellPriceB; itemProfile.SellPriceC = icrPrice.ModifyingSellPriceC; itemProfile.SellPriceD = icrPrice.ModifyingSellPriceD; } } _itemProfileContext.Update(itemProfile); _itemProfileContext.SaveChanges(); foreach (PurchaseOrderBranch branch in spoBranches) { var itemQuantity = _itemQuantityContext.FirstOrDefault(x => x.ItemId == item.ItemId && x.BranchId == branch.BranchId); if (itemQuantity != null) { itemQuantity.ActualQuantity += item.ReceivingQuantity; _itemQuantityContext.Update(itemQuantity); _itemQuantityContext.SaveChanges(); } else { var newItemQuantity = new ItemQuantity { ActualQuantity = item.ReceivingQuantity, BranchId = branch.BranchId, CreatedDateTime = DateTime.UtcNow, ItemId = item.ItemId, //client asked to keep test data for the time being MaxQuantity = item.ReceivingQuantity, MinQuantity = item.ReceivingQuantity }; _itemQuantityContext.Add(newItemQuantity); _itemQuantityContext.SaveChanges(); } } } }
public static ItemProfile read(BinaryReader binaryReader) { ItemProfile newObj = new ItemProfile(); newObj.amount = binaryReader.ReadUInt32(); newObj.iid = binaryReader.ReadUInt32(); // TODO: If (amt & (1 << 24)) != 0, then this should actually read an OldPublicWeenieDesc! newObj.pwd = CM_Physics.PublicWeenieDesc.read(binaryReader); newObj.amount = newObj.amount & 0xFFFFFF; return(newObj); }
public int AddUnregisteredItem(ItemProfile item) { var jsonString = JsonConvert.SerializeObject(item); var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json"); var response = httpClient.PostAsync("api/item/insertitemprofileforpos", httpContent); if (response.IsSuccessStatusCode) { return(response.Content.ReadAsAsync <int>().Result); } return(0); }
public virtual void Initialize(ItemProfile _profile, int _id) { profile = _profile; id = _id; if (nameDisplay != null) { nameDisplay.text = profile.name; } icoDisplay.sprite = profile.Icon; icoDisplay.enabled = profile.Icon != null; }
protected override void UpdateStatus() { Status.life_max = (Status.level - 1) * 5 + 25; Status.AttackBase = CurrentJob.Level + Status.level; Status.Dodge = 0; Status.Aim = 0; Status.Defence = 0; Status.CritOffset = 0; Status.AdditionalAttackTimes = 0; // 装備の適用 if (Equip.Armor != null) { ItemProfile tmp = Equip.Armor.GetProfile(); if (tmp != null) { Status.Dodge += Equip.Armor.GetProfile().Dodge; Status.Defence += Equip.Armor.GetProfile().Defence; } } // スキルの適用 SkillData ActiveSkill = JobManager.instance.GetSkillFromID(ActiveSkillID); List <SkillData> UsableSkill = JobManager.instance.GetUsableSkill(this); if (ActiveSkill != null) { foreach (SkillEffect b in ActiveSkill.SkillEffect) { PatchSkillEffect(b); } } foreach (SkillData s in UsableSkill) { if (s.IsActiveSkill) { continue; } foreach (SkillEffect b in s.SkillEffect) { PatchSkillEffect(b); } } //上限下限処理 base.UpdateStatus(); }
private void tryPrepareEjection(ItemProfile p) { FoundItem f = findItem(p); if (f != null) { foreach (IMyShipConnector conn in ejectors) { if (conn.Enabled && moveItem(f.source, conn.GetInventory(), f.item)) { conn.ThrowOut = true; } } } }
public Item GenerateItemFromNode(ItemNode node, Vector2 pos) { ItemProfile p = GetItemProfileFromID(node.ID); if (p == null) { return(null); } Item item = Instantiate(GetItemTempleteFromGfxId(p.GfxID), pos, new Quaternion()); item.Node = new ItemNode(node); item.Profile = p; return(item); }
public override void contributeToTreeView(TreeView treeView) { TreeNode rootNode = new TreeNode(this.GetType().Name); rootNode.Expand(); rootNode.Nodes.Add("i_vendorID = " + Utility.FormatGuid(i_vendorID)); TreeNode stuffNode = rootNode.Nodes.Add("i_stuff = "); for (int i = 0; i < i_stuff.list.Count; i++) { TreeNode itemProfileNode = stuffNode.Nodes.Add("itemProfile = "); ItemProfile thisProfile = i_stuff.list[i]; thisProfile.contributeToTreeNode(itemProfileNode); } treeView.Nodes.Add(rootNode); }
// ---------------------------------------------------------------------------------------- /// <!-- HeaderString --> /// <summary> /// /// </summary> /// <returns></returns> public string HeaderString() { string str = ""; str += "<" + ItemLabel + ">"; if (ItemProfile == null) { str += "endeme object has null profile"; } else { str += ItemProfile.ToString(); } return(str); }
// ========================= // Helper Functions - Buying // ========================= /// <summary> /// Used to convert Weenie based objects / not used for unique items /// </summary> private List <WorldObject> ItemProfileToWorldObjects(ItemProfile itemprofile) { List <WorldObject> worldobjects = new List <WorldObject>(); while (itemprofile.Amount > 0) { WorldObject wo = WorldObjectFactory.CreateNewWorldObject(itemprofile.WeenieClassId); if (itemprofile.Palette.HasValue) { wo.PaletteTemplate = itemprofile.Palette; } if (itemprofile.Shade.HasValue) { wo.Shade = itemprofile.Shade; } // can we stack this ? if (wo.MaxStackSize.HasValue) { if ((wo.MaxStackSize.Value != 0) & (wo.MaxStackSize.Value <= itemprofile.Amount)) { wo.SetStackSize(wo.MaxStackSize.Value); worldobjects.Add(wo); itemprofile.Amount = itemprofile.Amount - wo.MaxStackSize.Value; } else // we cant stack this but its not a single item { wo.SetStackSize((int)itemprofile.Amount); worldobjects.Add(wo); itemprofile.Amount = itemprofile.Amount - itemprofile.Amount; } } else { // if there multiple items of the same type.. if (itemprofile.Amount > 0) { // single item with no stack options. itemprofile.Amount = itemprofile.Amount - 1; wo.StackSize = null; worldobjects.Add(wo); } } } return(worldobjects); }
// コピーコンストラクタ public ItemProfile(ItemProfile source) { this.Name = source.Name; this.ID = source.ID; this.UseEffectTypeValue = source.UseEffectTypeValue; this.ThrowEffectTypeValue = source.ThrowEffectTypeValue; this.UsableTime = source.UsableTime; this.Stack = source.Stack; this.EffectValue = source.EffectValue; this.GainFoodValue = source.GainFoodValue; this.stackable = source.stackable; // 武器性能 this.Attack = source.Attack; this.AttackCriticalRate = source.AttackCriticalRate; this.AttackTimes = source.AttackTimes; }
public ItemConverter(ItemProfile itemProfile) { ItemProfile = itemProfile; var methodInfo = typeof(IPropertyFormatter).GetMethods().SingleOrDefault(n => n.Name.Equals("Format")); ItemProfile.PropertyFormatters = new Dictionary <string, FormatterArgs> { { "id", new FormatterArgs { Type = typeof(IdFormatter), Method = methodInfo } }, { "fields", new FormatterArgs { Type = typeof(FieldsFormatter), Method = methodInfo } }, { "foo", new FormatterArgs { Type = typeof(FooFormatter), Method = methodInfo } } }; if (ItemProfile.ShowFields && ItemProfile.FieldPropertyNames.Any()) { ItemProfile.ItemPropertyNames.Add("Fields"); } else //make sure it doesn't get accidentally added { ItemProfile.ItemPropertyNames.Remove( ItemProfile.ItemPropertyNames.SingleOrDefault(n => n.Equals("Fields", StringComparison.OrdinalIgnoreCase))); } }
void GenerateItemAtRandom(int minimum, int maximum) { int objectCount = Random.Range(minimum, maximum + 1); for (int i = 0; i < objectCount; i++) { Vector3 randomPosition; do { randomPosition = RandomPosition(); } while (GameManager.instance.ExitstItem(randomPosition)); string id = Profile.GetRandomItemID(level); ItemProfile p = ItemManager.instance.GetItemProfileFromID(id); ItemNode node = new ItemNode(id, p.Stack, p.UsableTime); ItemManager.instance.GenerateItemFromNode(node, randomPosition); //ItemManager.instance.GenerateRandomItem(randomPosition); } }
public static ItemProfile read(BinaryReader binaryReader) { ItemProfile newObj = new ItemProfile(); newObj.amount = binaryReader.ReadInt32(); newObj.iid = binaryReader.ReadUInt32(); int descType = (newObj.amount >> 24); if (descType == -1) { newObj.pwd = CM_Physics.PublicWeenieDesc.read(binaryReader); } else if (descType == 1) { newObj.opwd = CM_Physics.OldPublicWeenieDesc.read(binaryReader); // NOTE: I've not found an actual instance of this method being used. } newObj.amount = newObj.amount & 0xFFFFFF; return(newObj); }