void _menuItemCustomizeItem_Click(object sender, EventArgs e) { FormItemInstance form = new FormItemInstance(); form.CharacterSlot = _equipSlot; form.ItemInstance = _item.Clone(); if (form.ShowDialog(FormMain.Instance) == DialogResult.OK) { ItemInstance itemInstance = form.ItemInstance.Clone(); itemInstance.ForceDisplay = true; Character.CustomItemInstances.Add(itemInstance); Character.OnCalculationsInvalidated(); } }
public GameObject CreateItemHolder(Vector3 location, ItemInstance itemInst, GameObject islandGameObject) { GameObject temp = (GameObject)GameObject.Instantiate(itemHolderPrefab, location, Quaternion.identity); temp.GetComponent <ItemHolder> ().itemInst = itemInst.Clone(); temp.GetComponent <ItemHolder> ().islandGameObject = islandGameObject; //temp.GetComponent<ItemHolder> () = islandGameObject; //temp.GetComponent<ItemHolder> ().targetNetworkID = ID; return(temp); }
public MapItem PutItem(short amount, ItemInstance inv, ClientSession session) { Guid random2 = Guid.NewGuid(); MapItem droppedItem = null; List <MapCell> possibilities = new List <MapCell>(); for (short x = -2; x < 3; x++) { for (short y = -2; y < 3; y++) { possibilities.Add(new MapCell { X = x, Y = y }); } } short mapX = 0; short mapY = 0; var niceSpot = false; var orderedPossibilities = possibilities.OrderBy(_ => RandomFactory.Instance.RandomNumber()).ToList(); for (var i = 0; i < orderedPossibilities.Count && !niceSpot; i++) { mapX = (short)(session.Character.PositionX + orderedPossibilities[i].X); mapY = (short)(session.Character.PositionY + orderedPossibilities[i].Y); if (!Map.IsWalkable(Map[mapX, mapY])) { continue; } niceSpot = true; } if (!niceSpot) { return(null); } if (amount <= 0 || amount > inv.Amount) { return(null); } var newItemInstance = inv.Clone(); newItemInstance.Id = random2; newItemInstance.Amount = amount; droppedItem = new MapItem { MapInstance = this, VNum = newItemInstance.ItemVNum, PositionX = mapX, PositionY = mapY, Amount = amount }; DroppedList[droppedItem.VisualId] = droppedItem; inv.Amount -= amount; return(droppedItem); }
public CustomItemInstance(Character character, ItemInstance baseInstance) { InitializeComponent(); #if !SILVERLIGHT this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; this.WindowState = System.Windows.WindowState.Normal; #endif Character = character; CustomInstance = baseInstance.Clone(); }
public void EquipCustomisedItem(ItemInstance item, CharacterSlot equipSlot) { _item = item; _equipSlot = equipSlot; FormItemInstance form = new FormItemInstance(); form.CharacterSlot = _equipSlot; form.ItemInstance = _item.Clone(); if (form.ShowDialog(FormMain.Instance) == DialogResult.OK) { Character[_equipSlot] = form.ItemInstance == null ? null : form.ItemInstance.Clone(); } }
void CheckGrabItem() { if (itemOnTopOf != null && Input.GetKeyDown(KeyCode.E)) { if (itemOnTopOf.itemInst.GetItem().type == ItemType.weapon) { if (weaponInst.GetItem().baseName != "") { DropItem(weaponInst.Clone()); } //TODO make a function so there isn't so much copy pasta //TODO interrupt this perhaps? weaponInst = (itemOnTopOf.itemInst).Clone(); attackAction = GetWeapon().attackDetails; CmdUpdateWeapon(weaponInst); uiControl.UpdateAbilityIconFromItem(ItemType.weapon); actionsController.SetWeaponBasicAttackSpeed(); actionsController.AddWeaponAbility(); DestroyServerItem(itemOnTopOf.gameObject); } else if (itemOnTopOf.itemInst.GetItem().type == ItemType.armor) { if (armorInst.GetItem().baseName != "") { DropItem(armorInst.Clone()); } armorInst = (itemOnTopOf.itemInst).Clone(); movementController.SetupRolls(); CmdUpdateArmor(armorInst); uiControl.UpdateAbilityIconFromItem(ItemType.armor); actionsController.AddArmorAbility(); DestroyServerItem(itemOnTopOf.gameObject); } else if (itemOnTopOf.itemInst.GetItem().type == ItemType.artifact) { if (artifactInst.GetItem().baseName != "") { DropItem(artifactInst.Clone()); } artifactInst = (itemOnTopOf.itemInst).Clone(); CmdUpdateArtifact(artifactInst); uiControl.UpdateAbilityIconFromItem(ItemType.artifact); actionsController.AddArtifactAbility(); DestroyServerItem(itemOnTopOf.gameObject); } } }
public void AddItemToCollectionPerformance() { var itemDef = new ItemDefinition(Guid.NewGuid()) { maxStackSize = 999 }; var item = new ItemInstance(Guid.NewGuid(), itemDef); var c = new LayoutCollection <IItemInstance>(16, 4); BenchmarkUtility.Profile("Add item to collection of 4x4", 10000, () => { var added = c.Add((IItemInstance)item.Clone(), 1); }); }
public void Select(ItemInstance item) { if (_button != null) { _button.SelectedItemInstance = item == null ? null : item.Clone(); } //if (_buttonEnchant != null) //{ // ItemInstance copy = _buttonEnchant.SelectedItem.Clone(); // copy.EnchantId = item == null ? 0 : Math.Abs(item.Id % 10000); // _buttonEnchant.SelectedItem = copy; //} _characterSlot = CharacterSlot.None; ItemToolTip.Instance.Hide(this); this.Hide(); }
public void AddItemToCollectionPerformance() { var itemDef = new ItemDefinition(Guid.NewGuid()) { maxStackSize = 999 }; var item = new ItemInstance(Guid.NewGuid(), itemDef); var c = new Collection <IItemInstance>(16, new NullLogger()); var items = new IItemInstance[10001]; for (int j = 0; j < items.Length; j++) { items[j] = (IItemInstance)item.Clone(); } int i = 0; BenchmarkUtility.Profile("Add item to collection of 16", 10000, () => { var added = c.Add(items[i++], 1); }); }
public CustomItemInstance(Character character, ItemInstance baseInstance) { InitializeComponent(); Character = character; CustomInstance = baseInstance.Clone(); }