/* Constructors */ /// <summary> /// Initializes a new instance of the Celestial class. /// </summary> /// <param name="repository"> /// The <see cref="IEveRepository" /> which contains the entity adapter. /// </param> /// <param name="entity"> /// The data entity that forms the basis of the adapter. /// </param> internal Celestial(IEveRepository repository, ItemEntity entity) : base(repository, entity) { Contract.Requires(repository != null, "The repository associated with the object cannot be null."); Contract.Requires(entity != null, "The entity cannot be null."); Contract.Requires(entity.IsCelestial, "The entity must be a celestial object."); }
/// <summary> /// Initializes a new instance of the SolarSystem class. /// </summary> /// <param name="repository"> /// The <see cref="IEveRepository" /> which contains the entity adapter. /// </param> /// <param name="entity"> /// The data entity that forms the basis of the adapter. /// </param> internal SolarSystem(IEveRepository repository, ItemEntity entity) : base(repository, entity) { Contract.Requires(repository != null, "The repository associated with the object cannot be null."); Contract.Requires(entity != null, "The entity cannot be null."); Contract.Requires(entity.IsSolarSystem, "The entity must be a solar system."); }
/* Constructors */ /// <summary> /// Initializes a new instance of the Station class. /// </summary> /// <param name="repository"> /// The <see cref="IEveRepository" /> which contains the entity adapter. /// </param> /// <param name="entity"> /// The data entity that forms the basis of the adapter. /// </param> internal Station(IEveRepository repository, ItemEntity entity) : base(repository, entity) { Contract.Requires(repository != null, "The repository associated with the object cannot be null."); Contract.Requires(entity != null, "The entity cannot be null."); Contract.Requires(entity.IsStation, "The entity must be a station."); }
public FlyItem(MyCharacterController owner, ItemEntity item, Collider2D[] hits, Vector2 end) : base(owner) { ItemEntity = item; Name = item.Object.Name; HitTargets = hits; EndPosition = end; }
public Item CreateItem(ItemEntity e) { GameObject obj = GameObject.Instantiate(m_itemFab, Vector3.zero, Quaternion.identity) as GameObject; Item item = obj.GetComponent<Item>(); item.Initialize(e); obj.transform.parent = m_itemParent.transform; return item; }
/// <summary> /// get the amount from item /// </summary> /// <param name="item"></param> /// <returns></returns> private CurrencyAmount getAmountFromItem(ItemEntity item) { if (_type == MasterDataType.BUSINESS_AREA) { MasterDataIdentity business = item.BusinessArea; if (this._id.Equals(business)) { if (item.CdIndicator == CreditDebitIndicator.DEBIT) { return item.Amount; } else { CurrencyAmount amount = item.Amount; amount.Negate(); return amount; } } } else if (_type == MasterDataType.CUSTOMER) { MasterDataIdentity customer = item.Customer; if (this._id.Equals(customer)) { if (item.CdIndicator == CreditDebitIndicator.DEBIT) { return item.Amount; } else { CurrencyAmount amount = item.Amount; amount.Negate(); return amount; } } } else if (_type == MasterDataType.VENDOR) { MasterDataIdentity vendor = item.Vendor; if (this._id.Equals(vendor)) { if (item.CdIndicator == CreditDebitIndicator.DEBIT) { return item.Amount; } else { CurrencyAmount amount = item.Amount; amount.Negate(); return amount; } } } return new CurrencyAmount(); }
bool canputItem(ItemEntity org, Vector2 pos) { var info = GameController.DungeonInformation; var item = info.getItem(pos); var trap = info.getTrap(pos); var gateway = info.StairsPosition != pos; bool b1 = (item == null) || (item != null && item == org); bool b2 = trap == null; return b1 && b2 && gateway; }
public static void disableItemEntity(ItemEntity entity) { //Debug.LogFormat("Before Item Count:{0}",GameController.DungeonInformation.Items.Count); GameController.GameActionEvent.despawnObject(entity); //Debug.logger.LogFormat(LogType.Log,"GCGen:{0}",GC.GetGeneration(entity.Object)); if (entity.Object != null) entity.Object.FiledEntity = null; entity.setActive(false); //Debug.LogFormat("After Item Count:{0}", GameController.DungeonInformation.Items.Count); //GameController.DungeonInformation.Items.ForEach(item => Debug.Log(item.ToString())); entity.Object = null; }
//快速添加消费 protected void LinkButton1_Click(object sender, EventArgs e) { string itemName = this.ItemNameEmpIns.Text.Trim(); if (itemName == "") { Utility.Alert(this, "商品名称未填写!"); return; } string itemType = this.ItemTypeEmpIns.SelectedValue; int catTypeId = Int32.Parse(this.CatTypeEmpIns.SelectedValue); Response.Cookies["CatTypeID"].Value = catTypeId.ToString(); Response.Cookies["CatTypeID"].Expires = DateTime.MaxValue; string itemPrice = this.ItemPriceEmpIns.Text.Trim(); if (!ValidHelper.CheckDouble(itemPrice)) { Utility.Alert(this, "商品价格填写错误!"); return; } string itemBuyDateStr = this.ItemBuyDateEmpIns.Text; DateTime itemBuyDate = DateTime.Parse(itemBuyDateStr + " " + DateTime.Now.ToString("HH:mm:ss")); ItemEntity item = new ItemEntity(); item.ItemType = itemType; item.ItemName = itemName; item.CategoryTypeID = catTypeId; item.ItemPrice = Double.Parse(itemPrice); item.ItemBuyDate = itemBuyDate; item.UserID = userId; item.RegionID = 0; item.RegionType = ""; item.Synchronize = 1; item.ZhuanTiID = zhuanTiId; bool success = ItemAccess.InsertItem(item, 1); if (success) { Session["TodayDate"] = itemBuyDate.ToString("yyyy-MM-dd"); this.ItemNameEmpIns.Text = ""; this.ItemPriceEmpIns.Text = ""; List.EditIndex = -1; BindGrid(); } else { Utility.Alert(this, "添加失败!"); return; } }
/// <summary> /// 修改顺序 /// </summary> /// <param name="en"></param> /// <returns></returns> public bool UpdateSort(ItemEntity en) { string comstr = "Update Item set ItemSort=@ItemSort where ItemID=@ItemID"; SqlParameter[] param = new SqlParameter[2]; param[1] = new SqlParameter("@ItemSort", SqlDbType.Int); param[1].Value = en.ItemSort; param[0] = new SqlParameter("@ItemID", SqlDbType.Int); param[0].Value = en.ItemID; if (ExecuteSql(comstr, param) == 1) { return(true); } else { return(false); } }
public ItemId(ItemEntity e) { var collection = new List <SubItemId>(); Id = e.Id; var validSubitems = e.SubItems.Where(x => x.IsRelated == true); foreach (var si in validSubitems) { if (si.IsRelated) { var SubItem = new SubItemId(si); collection.Add(SubItem); } } SubItems = collection; }
public IActionResult ShowView(Form form) { var vm = new FormAdded { NumOfCharsInDecription = form.Description.Length, NumOfCharsInName = form.Name.Length, IsHidden = !form.IsVisible }; var vmm = new ItemEntity { Name = form.Name, Description = form.Description, IsVisible = form.IsVisible }; _dbContext.Items.AddAsync(vmm); _dbContext.SaveChanges(); return(View("Add", vm)); }
public CraftingProjectData(UnitEntityData crafter, int targetCost, int goldSpent, int casterLevel, ItemEntity resultItem, string itemType, string recipeName = null, BlueprintAbility[] spellPrerequisites = null, BlueprintFeature[] featPrerequisites = null, bool prerequisitesMandatory = false, bool anyPrerequisite = false, ItemEntity upgradeItem = null, CrafterPrerequisiteType[] crafterPrerequisites = null) { Crafter = crafter; TargetCost = targetCost; GoldSpent = goldSpent; CasterLevel = casterLevel; ResultItem = resultItem; ItemType = itemType.Contains("Armour") ? itemType.Replace("Armour", "Armor") : itemType; RecipeName = recipeName; SpellPrerequisites = spellPrerequisites; FeatPrerequisites = featPrerequisites; PrerequisitesMandatory = prerequisitesMandatory; AnyPrerequisite = anyPrerequisite; Progress = 0; UpgradeItem = upgradeItem; CrafterPrerequisites = crafterPrerequisites; }
public async Task <IActionResult> Create(ItemEntity item, string comment) { try { var ads = new ItemEntity { Project = new ProjectEntity() }; //TODO //if (!ModelState.IsValid) return View(item); var itemId = _itemRepo.Add(item); if (!string.IsNullOrEmpty(comment)) { var commentEntity = new ItemCommentsEntity(); commentEntity.Comment = comment; commentEntity.Item = item; commentEntity.CreUser = await CurrentUser; _commentRepo.Add(commentEntity); } _logRepo.LogInfo($"{item.Title} Saved.", Request.Path, Microsoft.Extensions.Logging.LogLevel.Information); var user = await _userManager.FindByIdAsync(item.AssignedUser.Id); if (user != null) { var email = user.Email; await MailHelper.SendMailAsync("BUG CATCHER", "Yeni bir item atandı.", null, itemId, user.Email); } Response.Redirect("/" + Url.FriendlyUrl(item.Title) + "/" + item.Id); return(View(item)); } catch (Exception ex) { _logRepo.LogError(ex, Request.Path, Microsoft.Extensions.Logging.LogLevel.Error); return(View()); } }
private void btnSalvarItem_Click(object sender, EventArgs e) { string erros = ""; //Validações if (txtNomeItem.Text == "") { erros += "- Preencha o campo Nome;\n"; } if (cbTipoItem.Text == "") { erros += "- Preencha o campo Tipo;\n"; } if (txtDescricaoItem.Text == "") { erros += "- Preencha o campo Descrição;\n"; } if (cbDeposito.Text == "") { erros += "- Preencha o campo Deposito;\n"; } if (!string.IsNullOrEmpty(erros)) { MessageBox.Show(erros); } else { ItemEntity item = new ItemEntity(); { item.Nome = txtNomeItem.Text; item.DescricaoItem = txtDescricaoItem.Text; item.IdTipoItem = _tipoItemSelecionado; item.IdDeposito = _depositoSelecionado; } ItemDao.AlterarItem(item, this.CodigoItem); MessageBox.Show("Item alterado com sucesso"); this.Close(); } }
//TODO: convert all this stuff and get the image from spoonacular private async Task <ShoppingListItem> ConvertToShoppingListItem(ItemShoppingListLinkEntity itemShoppingListLink, int storeId, CancellationToken ct) { /* * public class ShoppingListItem * { * public int Id { get; set; } * * public string Image { get; set; } * * public string Name { get; set; } * * public decimal Price { get; set; } * * public bool InStock { get; set; } * * public int StockAmount { get; set; } * * public string Aisle { get; set; } * * public string Section { get; set; } * * public int QuantityBought { get; set; } * } * */ ItemEntity itemEntity = await _itemRepository.GetEntityAsync(itemShoppingListLink.ItemId, ct); ItemStoreLinkEntity itemStoreLink = await _itemStoreLinkRepository.GetEntityAsync(itemEntity.Id, storeId, ct); ShoppingListItem shoppingListItem = new ShoppingListItem { LinkId = itemShoppingListLink.Id, Name = itemEntity.Name, Price = itemStoreLink.Price, InStock = itemStoreLink.InStock, StockAmount = itemStoreLink.StockAmount, ItemQuantity = itemShoppingListLink.ItemQuantity }; return(shoppingListItem); }
public DataTable GetNewsByParentDepartid(ItemEntity en) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@ParentID", SqlDbType.Int); p[0].Value = en.ParentID; p[1] = new SqlParameter("@DepartID", SqlDbType.Int); p[1].Value = en.DepartID; string sql; if (en.DepartID != 0) { sql = "select ItemID,ItemUrl,IsTop,IsHome,DepartID,ItemID,ParentID,ItemName,ItemContent,ItemSort,ItemKind from Item where (ItemKind=1 or ItemKind=3) and DepartID=@DepartID and ParentID=@ParentID order by ItemSort ASC"; } else { sql = "select ItemID,ItemUrl,IsTop,IsHome,DepartID,ItemID,ParentID,ItemName,ItemContent,ItemSort,ItemKind from Item where (ItemKind=1 or ItemKind=3) and DepartID is null and ParentID=@ParentID order by ItemSort ASC"; } return(GetDataTable(sql, p)); }
public PyDataType RemoveImplantFromCharacter(PyInteger itemID, CallInformation call) { Character character = this.ItemManager.GetItem(call.Client.EnsureCharacterIsSelected()) as Character; if (character.Items.ContainsKey(itemID) == false) { throw new CustomError("This implant is not in your brain!"); } // move the item to the recycler and then remove it ItemEntity item = character.Items[itemID]; // now destroy the item this.ItemManager.DestroyItem(item); // notify the change call.Client.NotifyItemLocationChange(item, item.Flag, character.ID); return(null); }
// called when the player collides with another surface void OnCollisionEnter2D(Collision2D col) { // if that other surface was an itemEntity if (col.collider.tag == "ItemEntity") { // get the item that the entity was storing ItemEntity itemEntity = col.collider.gameObject.GetComponent <ItemEntity>(); // if the item was succefully added to the inventory then destroy it int remainder = addItemToInventory(itemEntity); if (remainder == -1) { Destroy(col.collider.gameObject); } else { itemEntity.amount = remainder; } } }
public DataTable GetByParentID(ItemEntity en) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@ParentID", SqlDbType.Int); p[0].Value = en.ParentID; p[1] = new SqlParameter("@DepartID", SqlDbType.Int); p[1].Value = en.DepartID; string sql; if (en.DepartID != 0) { sql = "select (case when istop=1 then '取消导航' else '点击作为导航' end) as TopName,(case when IsHome=1 then '取消首页显示' else '点击首页显示' end) as HomeName,(case when ItemKind=3 then '取消图片新闻' when ItemKind=1 then '点击设为图片新闻' else ' ' end) as ImageName,ItemUrl,IsTop,IsHome,ItemID,ParentID,ItemName,ItemContent,ItemSort,ItemKind from Item where ParentID=@ParentID and DepartID=@DepartID order by ItemSort asc"; } else { sql = "select (case when istop=1 then '取消导航' else '点击作为导航' end) as TopName,(case when IsHome=1 then '取消首页显示' else '点击首页显示' end) as HomeName,(case when ItemKind=3 then '取消图片新闻' when ItemKind=1 then '点击设为图片新闻' else ' ' end) as ImageName,ItemUrl,IsTop,IsHome,ItemID,ParentID,ItemName,ItemContent,ItemSort,ItemKind from Item where ParentID=@ParentID and DepartID is null order by ItemSort asc"; } return(GetDataTable(sql, p)); }
//单纯根据父ID获得子ID public DataTable GetAllByItemID(ItemEntity en) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@ItemID", SqlDbType.Int); p[0].Value = en.ItemID; p[1] = new SqlParameter("@DepartID", SqlDbType.Int); p[1].Value = en.DepartID; string sql; if (en.DepartID != 0) { sql = "select (case when ItemKind=0 then '介绍性' when ItemKind=1 then '新闻性' when ItemKind=2 then '链接性' when ItemKind=3 then '图片性新闻' else '错误类型' end) as kind ,(case when itemkind=2 then 'UpdateLinkItem.aspx?id='+left(itemid,5) else 'UpdateItem.aspx?id='+left(itemid,5) end ) as ItemLink,(select count(*) from item i where i.parentid=item.itemid) as ChildCount,ItemUrl,IsTop,ItemID,ParentID,ItemName,ItemContent,ItemSort,ItemKind,DepartID from Item where ItemID=@ItemID and DepartID=@DepartID order by ItemSort ASC"; } else { sql = "select (case when ItemKind=0 then '介绍性' when ItemKind=1 then '新闻性' when ItemKind=2 then '链接性' when ItemKind=3 then '图片性新闻' else '错误类型' end) as kind ,(case when itemkind=2 then 'UpdateLinkItem.aspx?id='+left(itemid,5) else 'UpdateItem.aspx?id='+left(itemid,5) end ) as ItemLink,(select count(*) from item i where i.parentid=item.itemid) as ChildCount,ItemUrl,IsTop,ItemID,ParentID,ItemName,ItemContent,ItemSort,ItemKind,DepartID from Item where ItemID=@ItemID and DepartID is null order by ItemSort ASC"; } return(GetDataTable(sql, p)); }
public DataTable GetItemByKindDepart(ItemEntity en) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@ItemKind", SqlDbType.Int); p[0].Value = en.ItemKind; p[1] = new SqlParameter("@DepartID", SqlDbType.Int); p[1].Value = en.DepartID; string sql; if (en.DepartID != 0) { sql = "select * from Item where ItemKind=@ItemKind and DepartID=@DepartID order by ItemSort ASC,NewsSort ASC"; } else { sql = "select * from Item where ItemKind=@ItemKind and DepartID is null order by ItemSort ASC,NewsSort ASC"; } return(GetDataTable(sql, p)); }
public AddNewItemResponse Post(ItemModel item) { var entity = new ItemEntity { Name = item.Name, Description = item.Description, IsVisible = item.IsVisible, }; _dbContext.Items.Add(entity); _dbContext.SaveChanges(); var response = new AddNewItemResponse() { Success = true, }; return(response); }
public static void Delete(ItemEntity entity) { try { string query; query = $@"UPDATE Item SET is_activo = 0 WHERE id = @Id"; using (var db = new MySqlConnection(Conexion.CadenaDeConexion)) { db.Query <int>(query, new { Id = entity.Id }); } } catch (Exception) { throw; } }
public void AddObject(ItemEntity entity) { Vector3 pos; Vector3 dimension; FromWorldPosAndDimToGridPos(entity, out pos, out dimension); for (int x = 0; x < dimension.x; x++) { for (int y = 0; y < dimension.y; y++) { for (int z = 0; z < dimension.z; z++) { //if ((pos.x < 0 || pos.x >= MapSizeX) || (pos.y < 0 || pos.y >= MapSizeY) || (pos.z < 0 || pos.z >= MapSizeZ)) // continue; gridInfo[(int)pos.x + x][(int)pos.y + y][(int)pos.z + z] = entity; } } } }
// -- Awake && Start -------------------------------- private void Awake() { // Init Grid gridInfo = new ItemEntity[MapSizeX][][]; for (int x = 0; x < MapSizeX; x++) { gridInfo[x] = new ItemEntity[MapSizeY][]; for (int y = 0; y < MapSizeY; y++) { gridInfo[x][y] = new ItemEntity[MapSizeZ]; for (int z = 0; z < MapSizeZ; z++) { gridInfo[x][y][z] = null; } } } }
public override void Execute() { if (this.LeftSide is OpcodeATT att) { if (this.Value is OpcodeDEFINT defint) { ItemEntity item = att.ItemToAffect.GetItem(); Attributes attribute = att.AttributeToAffect.Attribute; item.Attributes[att.AttributeToAffect.Attribute].Integer = defint.Value; // notify the character this.Interpreter.Environment.Client?.NotifyAttributeChange(attribute, item); } } else { throw new DogmaMachineException("Unexpected parameter for left side of SET opcode"); } }
// Todo: Make string into BaseItem when we get item system working. public static void CreatePhysicalItem(BaseItem item, Vector3 pos, Angles ang) { if (item == null) { return; } var ent = new ItemEntity(); ent.SetItem(item); ent.Position = pos; ent.Rotation = Rotation.From(ang); // Todo: Think about moving this to the item instead; ent.SetModel(ent.Item.ItemModel); Log.Info($"Item is: {item}, Position: {pos}, Angles: {ang}"); }
public override int CalculateProjectileDamage(ItemEntity item, MobileEntity defender) { if (item is ProjectileWeapon weapon) { var baseMinimumDamage = weapon.MinimumDamage; var baseMaximumDamage = weapon.MaximumDamage; var hitAdds = Stats.DexterityAdds + weapon.GetAttackBonus(this, defender); var skillLevel = GetSkillLevel(Skill.Bow); var skillMultiplier = (skillLevel * 0.1 + 1.0); var minimumDamage = (int)((baseMinimumDamage + hitAdds) * skillMultiplier); var maximumDamage = (int)((baseMaximumDamage + hitAdds) * skillMultiplier); return(Utility.RandomBetween(Math.Max(1, minimumDamage), Math.Max(1, maximumDamage))); } return(0); }
public override bool BlockRightClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user) { var window = new CraftingBenchWindow(user.Server.CraftingRepository, (InventoryWindow)user.Inventory); user.OpenWindow(window); window.Disposed += (sender, e) => { var entityManager = user.Server.GetEntityManagerForWorld(world); for (int i = 0; i < window.CraftingGrid.StartIndex + window.CraftingGrid.Length; i++) { var item = window[i]; if (!item.Empty) { var entity = new ItemEntity(descriptor.Coordinates + Coordinates3D.Up, item); entityManager.SpawnEntity(entity); } } }; return(false); }
internal bool RemoveItem(ItemEntity item) { if (!Items.Contains(item)) { Debug.LogError("The given item is not a content of this container"); return(false); } SlotsAvailable[ItemSlotIndex[item]] = true; Items.Remove(item); ItemSlotIndex.Remove(item); item.gameObject.SetActive(true); EmptySlots += item.Description.ContentSize; return(true); }
public void AddBid(int itemId, int bid, int userId) { ItemEntity item = db.Set <ItemEntity>().Find(itemId); if (item != null) { foreach (BidEntity b in item.Bids) { if (b.Bid >= bid) { return; } } item.Bids.Add(new BidEntity { Bid = bid, UserIdBuyer = userId }); } }
/** <summary> * Instantiates the bubble associated with the `item` property at the position of the * `spawnTransform`, or at the position of this GameObject if none is provided. * </summary> */ public void Spawn() { if (!this.CanSpawnItem()) { this.PlayBubbleSound(); return; } var spawnTransform = this.spawnTransform != null ? this.spawnTransform : this.transform; this.lastSpawnedItem = GameObject.Instantiate(this.item.itemEntityPrefab, spawnTransform.position, Quaternion.identity).GetComponent <ItemEntity>(); if (this.entity != null) { this.lastSpawnedItem.SetLayer(this.entity.GetLayer()); } else { this.lastSpawnedItem.SetLayer(this.defaultLayer); } }
public JsonResult Index(ItemModel item) { if (item.DueDateTime == DateTime.MinValue) { item.DueDateTime = DateTime.MaxValue; } item.Note = item.Note ?? ""; item.Name = item.Name ?? ""; ItemEntity entity = mapper.Map <ItemModel, ItemEntity>(item); if (item.Id != 0) { itemService.Update(entity); } else { itemService.Create(entity); } return(GetItems(item.ToDoListId)); }
public static int Add(ItemEntity entity) { try { string query; query = $@" INSERT INTO Item ( tarea_id, usuario_id, is_completado, nombre, fecha_de_registro ) VALUES ( @TareaId, @UsuarioId, @IsCompletado, @Nombre, NOW() ); SELECT LAST_INSERT_ID();"; using (var db = new MySqlConnection(Conexion.CadenaDeConexion)) { entity.Id = db.Query <int>(query, new { TareaId = entity.TareaId, UsuarioId = entity.UsuarioId, IsCompletado = entity.IsCompletado, Nombre = entity.Nombre }).FirstOrDefault(); } return(entity.Id); } catch (Exception) { throw; } }
public void GetMeasureSize() { DataTable dt = new DataTable(); List <ItemEntity> lstItemEntity = new List <ItemEntity>(); try { Execute objExecute = new Execute(); string Query = "[dbo].[spGetPackingMethods]"; SqlParameter[] para = new SqlParameter[] { Execute.AddParameter("@intMeasureUnitID", Convert.ToInt32(cmbMeasureUnit.SelectedValue)), }; dt = (DataTable)objExecute.Executes(Query, ReturnType.DataTable, para, CommandType.StoredProcedure); foreach (DataRow dr1 in dt.Rows) { ItemEntity objMeasure = new ItemEntity { intPackingMethodID = Convert.ToInt32(dr1["intPackingMethodID"]), decQty = Convert.ToInt32(dr1["decQty"]), vcMeasureUnit = dr1["vcMeasureUnit"].ToString(), }; lstItemEntity.Add(objMeasure); } dgvMeasureSize.DataSource = null; dgvMeasureSize.AutoGenerateColumns = false; dgvMeasureSize.DataSource = lstItemEntity.ToList(); GlobleMeasureSizes = lstItemEntity; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static void HandleClickWindowPacket(IPacket _packet, IRemoteClient _client, IMultiPlayerServer server) { var packet = (ClickWindowPacket)_packet; var client = (RemoteClient)_client; var window = client.CurrentWindow; if (packet.SlotIndex == -999) { // Throwing item ItemEntity item; if (packet.RightClick) { var spawned = client.ItemStaging; spawned.Count = 1; var inventory = client.ItemStaging; inventory.Count--; item = new ItemEntity(client.Entity.Position + new Vector3(0, (float)PlayerEntity.Height, 0), spawned); client.ItemStaging = inventory; } else { item = new ItemEntity(client.Entity.Position + new Vector3(0, (float)PlayerEntity.Height, 0), client.ItemStaging); client.ItemStaging = ItemStack.EmptyStack; } item.Velocity = MathHelper.FowardVector(client.Entity.Yaw) * 0.3f; server.GetEntityManagerForWorld(client.World).SpawnEntity(item); return; } var staging = (ItemStack)client.ItemStaging.Clone(); Window.HandleClickPacket(packet, window, ref staging); client.ItemStaging = staging; if (packet.SlotIndex >= window.Length || packet.SlotIndex < 0) { return; } client.QueuePacket(new WindowItemsPacket(packet.WindowID, window.GetSlots())); }
public override void Apply(AbilityExecutionContext context, TargetWrapper target) { UnitDescriptor unit = context.MaybeOwner.Descriptor; AbilityData spell = context.Ability.ParamSpellSlot.Spell; ItemEntity item = spell.SourceItem; BlueprintItemEquipmentUsable blueprintItm = spell.SourceItemUsableBlueprint; int spellLevel = blueprintItm.SpellLevel; unit.Resources.Restore(ArcaneReservoir.resource, spellLevel / 2); if (blueprintItm.Type == UsableItemType.Wand) { for (int i = 1; i <= 5; i++) { item.SpendCharges(unit); } } else { item.SpendCharges(unit); } }
private bool CheckCondition(RuleAttackRoll evt) { Main.logger.Log(evt.Weapon.Blueprint.name); ItemEntity owner = (this.Fact as ItemEnchantment)?.Owner; if (owner != null && owner != evt.Weapon || (this.WeaponType != null && this.WeaponType != evt.Weapon.Blueprint.Type || this.CheckWeaponCategory && this.Category != evt.Weapon.Blueprint.Category) || (this.CheckWeaponRangeType && !AttackTypeAttackBonus.CheckRangeType(evt.Weapon.Blueprint, this.RangeType)) || this.AllNaturalAndUnarmed && !evt.Weapon.Blueprint.Type.IsNatural && !evt.Weapon.Blueprint.Type.IsUnarmed) { return(false); } if (this.CheckDistance && (double)evt.Target.DistanceTo(evt.Initiator) > (double)this.DistanceLessEqual.Meters) { return(false); } bool flag = evt.Weapon.Blueprint.Category.HasSubCategory(WeaponSubCategory.Light) || evt.Weapon.Blueprint.Category.HasSubCategory(WeaponSubCategory.OneHandedPiercing) || (bool)evt.Initiator.Descriptor.State.Features.DuelingMastery && evt.Weapon.Blueprint.Category == WeaponCategory.DuelingSword || evt.Initiator.Descriptor.Ensure <DamageGracePart>().HasEntry(evt.Weapon.Blueprint.Category); return(!this.DuelistWeapon || flag); }
//更新消费商品// public static bool UpdateItem(ItemEntity item, int type) { DbCommand comm = GenericDataAccess.CreateCommand(); comm.CommandText = "UpdateItem_v4"; DbParameter param = comm.CreateParameter(); param.ParameterName = "@ItemID"; param.Value = item.ItemID; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@ItemType"; param.Value = item.ItemType; param.DbType = DbType.String; param.Size = 10; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@ItemName"; param.Value = item.ItemName; param.DbType = DbType.String; param.Size = 20; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@CategoryTypeID"; param.Value = item.CategoryTypeID; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@ItemPrice"; param.Value = item.ItemPrice; param.DbType = DbType.Double; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@ItemBuyDate"; param.Value = item.ItemBuyDate; param.DbType = DbType.DateTime; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@UserID"; param.Value = item.UserID; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@Recommend"; param.Value = item.Recommend; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@Synchronize"; param.Value = item.Synchronize; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@ItemAppID"; param.Value = item.ItemAppID; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@RegionID"; param.Value = item.RegionID; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@RegionType"; param.Value = item.RegionType; param.DbType = DbType.String; param.Size = 10; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@ZhuanTiID"; param.Value = item.ZhuanTiID; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@CardID"; param.Value = item.CardID; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@Type"; param.Value = type; param.DbType = DbType.Int32; comm.Parameters.Add(param); int result = -1; try { result = GenericDataAccess.ExecuteNonQuery(comm); } catch { } return (result != -1); }
public void Initialize(ItemEntity e) { m_itemEntry = e; m_sprite.SetSprite(e.icon); }
private void PickupItem(ItemEntity item) { if (!Server.GetEntities().Contains(item)) return; Server.RemoveEntity(item); foreach (Client c in Server.GetNearbyPlayers(item.World, item.Position.X, item.Position.Y, item.Position.Z)) { c.PacketHandler.SendPacket(new CollectItemPacket { EntityId = item.EntityId, PlayerId = EntityId }); } Inventory.AddItem(item.ItemId, (sbyte)item.Count, item.Durability); }
public static void AddItem(ItemEntity item) { Items.Add(item); }
public static void RemoveItem(ItemEntity item) { Items.Remove(item); }
public void ApplyLevelUp(ItemEntity e, ElementType t) { }
//导入保存 protected int[] SaveExcel(DataTable dt) { int[] arr = new int[2]; all = UserAccess.ExportUserData(userId); catTypeList = UserCategoryAccess.GetCategoryTypeList(userId); string dbProviderName = WebConfiguration.DbProviderName; string dbConnectionString = WebConfiguration.DbConnectionString; DbProviderFactory factory = DbProviderFactories.GetFactory(dbProviderName); using (DbConnection conn = factory.CreateConnection()) { conn.ConnectionString = dbConnectionString; conn.Open(); DbTransaction tran = conn.BeginTransaction(); DbCommand comm = conn.CreateCommand(); comm.Connection = conn; comm.Transaction = tran; try { int n1 = 0; int n2 = 0; StringBuilder sb = new StringBuilder(); foreach (DataRow dr in dt.Rows) { string _itemType = GetItemTypeValue(dr["分类"].ToString()); string _itemName = dr["商品名称"].ToString(); int _catTypeId = GetCategoryTypeId(dr["商品类别"].ToString(), catTypeList); string _itemPrice = dr["商品价格"].ToString(); DateTime _itemBuyDate = DateTime.Parse(dr["购买日期"].ToString()); int _recommend = (dr["推荐否"].ToString() == "否" ? 0 : 1); ItemEntity item = new ItemEntity(); item.ItemType = _itemType; item.ItemName = _itemName; item.CategoryTypeID = _catTypeId; item.ItemPrice = (_itemPrice== "" ? 0 : Double.Parse(_itemPrice)); item.ItemBuyDate = _itemBuyDate; item.Recommend = _recommend; if (CheckRepeat(item, catTypeList)) { n2++; continue; } sb.AppendLine("INSERT INTO ItemTable(ItemType, ItemName, CategoryTypeID, ItemPrice, ItemBuyDate, UserID, Recommend) VALUES('" + item.ItemType + "','" + item.ItemName + "','" + item.CategoryTypeID + "','" + item.ItemPrice + "','" + item.ItemBuyDate.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss") + "','" + userId + "','" + item.Recommend + "');"); n1++; } arr[0] = n1; arr[1] = n2; if (sb.ToString() == "") return arr; comm.CommandText = sb.ToString(); comm.ExecuteNonQuery(); tran.Commit(); } catch { tran.Rollback(); throw; } finally { conn.Close(); } } return arr; }
//保存方法 protected int SaveItem() { string itemName = this.ItemNameEmpIns.Text.Trim(); if (itemName == "") { Utility.Alert(this, "商品名称未填写!"); return 2; } string itemType = this.ItemTypeEmpIns.SelectedValue; int catTypeId = Int32.Parse(this.CatTypeEmpIns.SelectedValue); Response.Cookies["CatTypeID"].Value = catTypeId.ToString(); Response.Cookies["CatTypeID"].Expires = DateTime.MaxValue; string itemPrice = this.ItemPriceEmpIns.Text.Trim(); if (!ValidHelper.CheckDouble(itemPrice)) { Utility.Alert(this, "商品价格填写错误!"); return 2; } DateTime itemBuyDate = DateTime.Parse(today + " " + DateTime.Now.ToString("HH:mm:ss")); int cardId = Int32.Parse(this.CardEmpIns.SelectedValue); Response.Cookies["CardID"].Value = cardId.ToString(); Response.Cookies["CardID"].Expires = DateTime.MaxValue; ItemEntity item = new ItemEntity(); item.ItemType = itemType; item.ItemName = itemName; item.CategoryTypeID = catTypeId; item.ItemPrice = Double.Parse(itemPrice); item.ItemBuyDate = itemBuyDate; item.UserID = userId; item.RegionID = 0; item.RegionType = ""; item.Synchronize = 1; item.CardID = cardId; bool success = ItemAccess.InsertItem(item, 1); if (success) { Session["TodayDate"] = itemBuyDate.ToString("yyyy-MM-dd"); return 1; } else { return 0; } }
public static ItemEntity[] getAllItems() { var ret = new ItemEntity[Items.childCount]; int i = 0; foreach (Transform t in Items.transform) { ret[i++] = t.GetComponent<ItemEntity>(); } return ret; }
//取消费列表根据ItemID用于更新消费// public static ItemEntity GetItemListById(int itemId) { DbCommand comm = GenericDataAccess.CreateCommand(); comm.CommandText = "GetItemListById_v4"; DbParameter param = comm.CreateParameter(); param.ParameterName = "@ItemID"; param.Value = itemId; param.DbType = DbType.Int32; comm.Parameters.Add(param); DataTable dt = GenericDataAccess.ExecuteCommand(comm); ItemEntity item = new ItemEntity(); if (dt.Rows.Count > 0) { item.ItemID = Int32.Parse(dt.Rows[0]["ItemID"].ToString()); item.ItemType = dt.Rows[0]["ItemType"].ToString(); item.ItemName = dt.Rows[0]["ItemName"].ToString(); item.CategoryTypeID = Int32.Parse(dt.Rows[0]["CategoryTypeID"].ToString()); item.ItemPrice = Double.Parse(dt.Rows[0]["ItemPrice"].ToString()); item.ItemBuyDate = DateTime.Parse(dt.Rows[0]["ItemBuyDate"].ToString()); item.UserID = Int32.Parse(dt.Rows[0]["UserID"].ToString()); item.Recommend = Int32.Parse(dt.Rows[0]["Recommend"].ToString()); item.Synchronize = Int32.Parse(dt.Rows[0]["Synchronize"].ToString()); item.ItemAppID = Int32.Parse(dt.Rows[0]["ItemAppID"].ToString()); item.RegionID = Int32.Parse(dt.Rows[0]["RegionID"].ToString()); item.RegionType = dt.Rows[0]["RegionType"].ToString(); item.ZhuanTiID = Int32.Parse(dt.Rows[0]["ZhuanTiID"].ToString()); } return item; }
public void trade(ItemBasis invitem, ItemEntity onItemEntity) { trade(invitem, onItemEntity.Object); //inventory[inventory.IndexOf(invitem)] = onItemEntity.Entity; //inventory.Remove(invitem); }
protected void Page_Load(object sender, EventArgs e) { string itemName = Request.Form["itemname"].ToString(); int itemAppId = Int32.Parse(Request.Form["itemid"].ToString()); int itemId = Int32.Parse(Request.Form["itemwebid"].ToString()); int catId = Int32.Parse(Request.Form["catid"].ToString()); double itemPrice = Double.Parse(Request.Form["itemprice"].ToString()); DateTime itemBuyDate = DateTime.Parse(Request.Form["itembuydate"].ToString()); int userId = Int32.Parse(Request.Form["userid"].ToString()); int recommend = Int32.Parse(Request.Form["recommend"].ToString()); int regionId = Int32.Parse(Request.Form["regionid"].ToString()); string regionType = (regionId == 0 ? "" : Request.Form["regiontype"] ?? "m"); string itemType = Request.Form["itemtype"].ToString(); string ztId = Request.Form["ztid"] ?? "0"; string cardId = Request.Form["cardid"] ?? "0"; ItemEntity item = new ItemEntity(); item.ItemID = itemId; item.ItemType = itemType; item.ItemName = itemName; item.CategoryTypeID = catId; item.ItemPrice = itemPrice; item.ItemBuyDate = itemBuyDate; item.ItemAppID = itemAppId; item.Recommend = recommend; item.RegionID = regionId; item.RegionType = regionType; item.Synchronize = 0; item.UserID = userId; item.ZhuanTiID = Int32.Parse(ztId); item.CardID = Int32.Parse(cardId); bool success = false; DataTable dt = SyncHelper.SyncCheckItemListByItemAppId(itemAppId, userId); if (dt.Rows.Count > 0) { success = SyncHelper.SyncItemListUpdateByItemAppId(item); } else if (itemId > 0) { dt = SyncHelper.GetItemListById(itemId); if (dt.Rows.Count > 0) { success = ItemAccess.UpdateItem(item, 0); } else { success = ItemAccess.InsertItem(item, 0); } } else { success = ItemAccess.InsertItem(item, 0); } dt = SyncHelper.SyncCheckItemListByItemAppId(itemAppId, userId); if (dt.Rows.Count > 0) { itemId = Int32.Parse(dt.Rows[0]["ItemID"].ToString()); } string result = "{"; if (success) { result += "\"result\":\"" + itemId + "\""; } else { result += "\"result\":\"0\""; } result += "}"; Response.Write(result); Response.End(); }
void Update(){ if(activated){ if(entity == null){ entity = ItemManagement.Instance.GetItem(item); if(entity != null){ DrawItem(); } } else{ UpdateScrollers(); if(Input.GetKey(KeyCode.Mouse0)){ Ray ray = customizerCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray, out hit, 100)){ string name = hit.collider.name; for(int i=0; i<entity.Parameters.Count; i++){ if(name == entity.Parameters[i].name){ if(i < 4){ downParam = i; // hit.collider.gameObject.renderer.material.color = new Color(1,1,0.5f,1); } } } } } else{ if(downParam != -1){ selectedParameter = downParam; if(currentObject != null){ SetObjectColors(currentObject.transform); } downParam = -1; } } if(icon.Texture == null){ icon.Texture = PhotoManager.Instance.GetImage(entity.Id); } } } if(animating){ time = Mathf.Clamp01(2f*Time.deltaTime + time); float val = Smoothing.QuinticEaseOut(time); val = val*xTarget + (1-val)*xStart; uiTransform.RelativePosition = new Vector2(val, 0); //SetCameraX(Screen.width*val); if(time == 1){ animating = false; if(!activating){ gameObject.SetActive(false); } } } pitch = Smoothing.SpringSmooth(pitch, targetPitch, ref pitchVelocity, 0.2f, Time.deltaTime); float tYaw = Mathf.DeltaAngle(yaw, targetYaw); yaw = Smoothing.SpringSmooth(yaw, targetYaw, ref yawVelocity, 0.2f, Time.deltaTime); cameraParent.rotation = Quaternion.AngleAxis(yaw, Vector3.up) * Quaternion.AngleAxis(pitch, Vector3.right); }
public Texture GetIconGraphicOfItem(ItemEntity e) { foreach(MenuItemIcon i in m_itemIcons) { if(i.icon == e.icon) { return i.image; } } return m_itemIcons[0].image; }
/* * ItemEntry instance may be overrided by a few unique items * * if item is equiped by attacker and hit target. */ public static bool AttackBy(ItemEntity item, Actor target, Actor attacker, float jumpCoeff) { if( item != null ) { return item.AttackBy(target, attacker, jumpCoeff); } else { int dmg = attacker.CalcurateAttackDamage(item, target, ElementType.ET_Physical, jumpCoeff); if( dmg > 0 ) { GUIManager.GetManager().Message(target.charName + " に " + dmg + " の ダメージあたえた!" ); return target.ApplyDamage(dmg); } else { GUIManager.GetManager().Message(target.charName + " に ダメージをあたえられない!" ); return true; } } }
public void SetItem(int item){ icon.Texture = null; this.item = item; entity = null; selectedParameter = 0; }
public static void PlayerDigging(RemoteClient client, MinecraftServer server, IPacket _packet) { var packet = (PlayerDiggingPacket)_packet; var position = new Coordinates3D(packet.X, packet.Y, packet.Z); // TODO: Enforce line-of-sight var block = client.World.GetBlock(position); short damage; switch (packet.Action) { case PlayerDiggingPacket.PlayerAction.StartedDigging: if (client.Entity.Position.DistanceTo(position) <= client.MaxDigDistance) { if (client.GameMode == GameMode.Creative || client.Entity.Abilities.InstantMine || Block.GetLogicDescriptor(block).Hardness == 0) { //Block.OnBlockMined(block, client.World, position, null); // TODO: See if we really need to call this client.World.SetBlockId(position, 0); client.World.SetMetadata(position, 0); } else { int time = Block.GetHarvestTime(new ItemDescriptor(client.Entity.SelectedItem.Id), block, out damage); client.ExpectedMiningEnd = DateTime.Now.AddMilliseconds(time - (client.Ping + 100)); client.ExpectedBlockToMine = position; var knownClients = server.EntityManager.GetKnownClients(client.Entity); client.BlockBreakStageTime = time / 8; client.BlockBreakStartTime = DateTime.Now; foreach (var c in knownClients) c.SendPacket(new BlockBreakAnimationPacket(client.Entity.EntityId, position.X, position.Y, position.Z, 0)); } } break; case PlayerDiggingPacket.PlayerAction.CancelDigging: { client.BlockBreakStartTime = null; var knownClients = server.EntityManager.GetKnownClients(client.Entity); foreach (var c in knownClients) c.SendPacket(new BlockBreakAnimationPacket(client.Entity.EntityId, position.X, position.Y, position.Z, 0xFF)); // reset } break; case PlayerDiggingPacket.PlayerAction.FinishedDigging: if (client.Entity.Position.DistanceTo(position) <= client.MaxDigDistance) { client.BlockBreakStartTime = null; var knownClients = server.EntityManager.GetKnownClients(client.Entity); foreach (var c in knownClients) c.SendPacket(new BlockBreakAnimationPacket(client.Entity.EntityId, position.X, position.Y, position.Z, 0xFF)); // reset if (client.ExpectedMiningEnd > DateTime.Now || client.ExpectedBlockToMine != position) return; Block.GetHarvestTime(new ItemDescriptor(client.Entity.SelectedItem.Id), block, out damage); if (damage != 0) { var slot = client.Entity.Inventory[client.Entity.SelectedSlot]; if (!slot.Empty) { //if (slot.AsItem() is ToolItem) //{ // var tool = slot.AsItem() as ToolItem; // bool destroy = tool.Damage(damage); // slot.Metadata = tool.Data; // if (destroy) // client.Entity.SetSlot(client.Entity.SelectedSlot, ItemStack.EmptyStack); // else // client.Entity.SetSlot(client.Entity.SelectedSlot, slot); //} } } Block.OnBlockMined(block, client.World, position, null); client.Entity.FoodExhaustion += 0.025f; } break; case PlayerDiggingPacket.PlayerAction.DropItem: case PlayerDiggingPacket.PlayerAction.DropStack: var SlotItem = client.Entity.Inventory[client.Entity.SelectedSlot]; if (!SlotItem.Empty) { var ItemCopy = (ItemStack)SlotItem.Clone(); if (packet.Action == PlayerDiggingPacket.PlayerAction.DropStack) client.Entity.Inventory[client.Entity.SelectedSlot] = ItemStack.EmptyStack; else { ItemCopy.Count = 1; SlotItem.Count--; // Decrease the player's item by 1 if (SlotItem.Count == 0) client.Entity.Inventory[client.Entity.SelectedSlot] = ItemStack.EmptyStack; else client.Entity.Inventory[client.Entity.SelectedSlot] = SlotItem; } var entity = new ItemEntity(client.Entity.Position + new Vector3(0, client.Entity.Size.Height, 0), ItemCopy); entity.Velocity = MathHelper.FowardVector(client.Entity.Yaw) * new Vector3(0.25); server.EntityManager.SpawnEntity(client.World, entity); } break; } }
public static void disableItemEntity(ItemEntity[] entitys) { foreach (ItemEntity entity in entitys) { disableItemEntity(entity); } }
Texture2D writeItemPoisition(Texture2D tex, ItemEntity[] items) { int x, y; Color c = Item; //GameController.PlayingLogger.addLog("Write Item Position!"); foreach (ItemEntity item in items) { bool b1 = !item.IsDetected && !ItemClairvoyanceFromAbility; //GameController.PlayingLogger.addLogFormat("{0}:{1} {2}",item.Object.Name,!item.IsDetected,!ItemClairvoyanceFromAbility); if (b1) continue; x = (int)item.Position.x; y = (int)item.Position.y; tex.SetPixel(x,y,c); } tex.Apply(false); return tex; }
public ItemLogical(Game game, ItemEntity owner) : base(game, owner) { }
//检查数据重复 protected bool CheckRepeat(ItemEntity _item, DataTable catList) { foreach (DataRow dr in all.Rows) { string _itemName = dr["商品名称"].ToString(); DateTime _itemBuyDate = DateTime.Parse(dr["购买日期"].ToString()); int _recommend = (dr["推荐否"].ToString() == "否" ? 0 : 1); ItemEntity item = new ItemEntity(); item.ItemName = _itemName; item.ItemBuyDate = _itemBuyDate; item.Recommend = _recommend; if (item.Equals(_item)) { return true; } } return false; }