public HUDInventory() { InventorySlot.Width = InventorySlot.Size / Engine.Singleton.Camera.AspectRatio; Slots = new InventorySlot[SlotsCount]; for (int i = 0; i < SlotsCount; i++) Slots[i] = new InventorySlot(SlotsSpacing, SlotsSpacing + i * (InventorySlot.Size + SlotsSpacing)); SelectQuad = Engine.Singleton.Labeler.NewSimpleQuad("HighlightMaterial", SlotsSpacing, SlotsSpacing, InventorySlot.Width, InventorySlot.Size, new ColourValue(1, 1, 1), 4); DescriptionBg = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.2f, 0.5f, 0.6f, 0.45f, ColourValue.White, 1); SelectedPicture = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.21f, 0.58f, 0.3f / Engine.Singleton.Camera.AspectRatio, 0.3f, ColourValue.White, 2); DescriptionLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.03f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2); DescriptionLabel.SetPosition(0.45f, 0.51f); GoldBg = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.7f, 0.1f, 0.2f, 0.1f, new ColourValue(1, 1, 1), 1); GoldLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.05f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2); GoldLabel.SetPosition(0.71f, 0.13f); InventoryBg = Engine.Singleton.Labeler.NewSimpleQuad("InventoryBgMaterial", 0.01f, 0.01f, 0.98f, 0.98f, new ColourValue(1, 1, 1), 0); CharacterPicture = Engine.Singleton.Labeler.NewSimpleQuad("Default", 0.4f, 0.1f, 0.2f / Engine.Singleton.Camera.AspectRatio, 0.2f, new ColourValue(1, 1, 1), 1); IsVisible = false; }
/// <summary> /// Utilise le consommable ou équipe l'arme du slot de raccourci envoyé en paramètres /// </summary> /// <param name="slot"></param> public void UseShortcutSlotItem(InventorySlot slot) { if (slot.IsEmpty) return; if (slot.Item.Type.Equals(ItemType.weapon)) // S'il s'agit d'une arme, on l'équipe { if (Inventory.leftHand.IsEmpty) Inventory.MoveOrMergeItem(slot, Inventory.leftHand, false); else Inventory.ExchangeItems(slot, Inventory.leftHand); LoadPlayingShortcutsSlots(); return; } if (isBoostActive || !slot.Item.Type.Equals(ItemType.consumable)) return; Inventory.UseConsumable(slot.Item, ref boostTimer, false); isBoostActive = true; boostItem = slot.Item; // conservation pour enlever les bonus à la fin du temps de boost slot.Amount--; if (slot.Amount <= 0) // On en enlève un en quantité, et supprime s'il s'agissait du dernier { slot.IsEmpty = true; slot.Item = new Item(); } LoadPlayingShortcutsSlots(); }
protected Rectangle GetSlotPosition(InventorySlot slot) { switch (slot) { case InventorySlot.Head: return new Rectangle(48, 8, 34, 34); case InventorySlot.Necklace: return new Rectangle(8, 30, 34, 34); case InventorySlot.Backpack: return new Rectangle(88, 30, 34, 34); case InventorySlot.Armor: return new Rectangle(48, 50, 34, 34); case InventorySlot.Right: return new Rectangle(88, 70, 34, 34); case InventorySlot.Left: return new Rectangle(8, 70, 34, 34); case InventorySlot.Legs: return new Rectangle(48, 90, 34, 34); case InventorySlot.Feet: return new Rectangle(48, 130, 34, 34); case InventorySlot.Ring: return new Rectangle(8, 110, 34, 34); case InventorySlot.Ammo: return new Rectangle(88, 110, 34, 34); } return new Rectangle(); }
public static PacketWriter DropInventoryItem(InventorySlot slot, byte amount) { var pw = GetWriter(ClientPacketID.DropInventoryItem); pw.Write(slot); pw.Write(amount); return pw; }
private static void OnUpdate(EventArgs args) { if (!Config.Item("enable").GetValue<bool>()) { return; } if (zzrotChecker) //if player has zzrot { if (Vector3.Distance(ObjectManager.Player.ServerPosition, exploitpos) < 1400 & Config.Item("key").GetValue<KeyBind>().Active && Items.CanUseItem(zzrot) && Environment.TickCount - timer > 5000) { ObjectManager.Player.Spellbook.CastSpell(zzrotslot.SpellSlot, exploitpos); //cast to the exploit location timer = Environment.TickCount; } } else if (zzrotChecker == false) //if player doesn't have it, keep finding { if (Environment.TickCount - searchingTimer > 1000) // don't try to find zzrot too many times. It might causes fps drops { foreach (var zz in ObjectManager.Player.InventoryItems.Where(zz => zz.Id == (ItemId)zzrot)) { zzrotChecker = true; zzrotslot = zz; } searchingTimer = Environment.TickCount; } } }
ResourceItem CreateNewSplittedResource(InventorySlot slotScript, int times = -1) { int id = this._splitSlot._inventoryRef._itemInfoList[this._splitSlot._slotNum - 1]._itemInfo._uniqueItemID; ResourceItem resource = slotScript._inventoryRef._itemContainerObject.GetComponent<ItemContainer>().GetItem(id).GetComponent<ResourceItem>(); int firstPopID = resource.PopStack(); int splitCount = 0; if (times == -1) { splitCount = this._splitCount - 1; } else { splitCount = times - 1; } GameObject splitResource = this._splitSlot._inventoryRef._itemContainerObject.GetComponent<ItemContainer>().GetItem(firstPopID); ResourceItem splitResourceScript = splitResource.GetComponent<ResourceItem>(); splitResourceScript.MaintainStack(); for (int i = 0; i < splitCount; i++) { int idToAdd = this._splitSlot._inventoryRef._itemContainerObject.GetComponent<ItemContainer>().GetItem(resource.PopStack()).GetComponent<ResourceItem>()._uniqueItemID; splitResourceScript.AddToStack(idToAdd); } return splitResourceScript; }
public void RemoveItem(InventorySlot iS) { if (iS != null) { iS.UnHighlight(); iS.m_currentHeldItem = null; } }
public void OnBeginDrag (PointerEventData eventData) { homeSlot = GetComponentInParent<InventorySlot> (); transform.SetParent (GetComponentInParent<Canvas> ().transform); GameManager.InventoryManager.Select (gameObject); GameManager.TakeTag (HasTag); GameManager.GiveTag (HoldTag); GetComponent<CanvasGroup> ().blocksRaycasts = false; }
/// <summary> /// Updates the client with the changes that have been made to the UserInventory. /// </summary> public void Update() { // Don't actually grab the PacketWriter from the pool until we know we will need it PacketWriter pw = null; try { // Loop through all slots for (var slot = 0; slot < GameData.MaxInventorySize; slot++) { // Skip unchanged slots if (!_slotChanged[slot]) continue; // Get the item in the slot var invSlot = new InventorySlot(slot); var item = UserInventory[invSlot]; // Get the values to send, which depends on if the slot is empty (item == null) or not GrhIndex sendItemGraphic; byte sendItemAmount; if (item == null) { sendItemGraphic = GrhIndex.Invalid; sendItemAmount = 0; } else { sendItemGraphic = item.GraphicIndex; sendItemAmount = item.Amount; } // Grab the PacketWriter if we have not already, or clear it if we have if (pw == null) pw = ServerPacket.GetWriter(); else pw.Reset(); // Pack the data and send it ServerPacket.SetInventorySlot(pw, invSlot, sendItemGraphic, sendItemAmount); OwnerUser.Send(pw, ServerMessageType.GUIItems); } } finally { // If we grabbed a PacketWriter, make sure we dispose of it! if (pw != null) pw.Dispose(); } // Changes complete _slotChanged.SetAll(false); }
public void PlaceItemInSlot(InventoryItem iI, InventorySlot iS) { iI.transform.position = iS.transform.position; iI.InventorySlot = iS; iS.m_currentHeldItem = iI; if (QuestManager.Instance.IsThisItemRequired(iI.gameObject)) { iS.Highlight(); QuestManager.Instance.PickedUpObject(); } }
public override void Read(StreamHandler reader) { ContainerSlot = (InventorySlot)reader.ReadByte(); Slot = (InventorySlot)reader.ReadByte(); CastId = reader.ReadByte(); SpellId = reader.ReadUInt32(); ItemGuid = reader.ReadGuid(); GlyphSlot = reader.ReadUInt32(); UnkFlags = reader.ReadByte(); TargetData.Read(reader); }
public void Resize( int size, InventorySlot c ) { int cur = m_Slots.Count; if( size < cur ) m_Slots.RemoveRange( size, cur - size ); else if( size > cur ) { if( size > m_Slots.Capacity )//this bit is purely an optimisation, to avoid multiple automatic capacity changes. m_Slots.Capacity = size; m_Slots.AddRange( Enumerable.Repeat( c, size - cur ) ); } }
public InventoryChangeInfo(ItemEntity item, ItemValueTracker oldValues, InventorySlot slot) { _slot = slot; _item = item; if (oldValues == null || oldValues.IsNull) _oldValues = null; else _oldValues = oldValues; Debug.Assert(_item != null || _oldValues != null, "item and oldValues can not both be null. " + "This would imply that the item changed from null to null."); }
public void ActivateSplit(GameObject splitObj, Sprite sprite) { if (this._splitItem == null) { this._splitItem = splitObj; this._splitSlot = splitObj.transform.parent.GetComponent<InventorySlot>(); this._splitItemSprite = sprite; this.transform.GetChild(0).GetComponent<Image>().sprite = this._splitItemSprite; this._splitSlotNum = this._splitItem.transform.parent.GetComponent<InventorySlot>()._slotNum; this.gameObject.SetActive(true); } this._splitCount++; this.transform.GetChild(0).GetChild(0).GetComponent<Text>().text = this._splitCount.ToString(); }
public void HandleDrop(InventorySlot slot) { if (Inventory == null) { Debug.LogError("AlchemyCircleUI has no Inventory reference"); return; } if (Inventory.SelectedItem != null && !HasItem(Inventory.SelectedItem.ID)) { slot.Item = Inventory.SelectedItem; Inventory.SelectedItem = null; } }
/// <summary> /// Moves the item to the specified slot. If that slot is full, tries to move to an unoccupied slot. If there aren't any, does nothing. /// </summary> /// <param name="slot">Slot.</param> public void MoveTo(InventorySlot slot){ if (!slot.Contents) { homeSlot = slot; transform.SetParent (slot.transform); transform.position = slot.transform.position; GetComponent<CanvasGroup> ().blocksRaycasts = true; GameManager.GiveTag (HasTag); GameManager.InventoryManager.Deselect (); } else if (GameManager.InventoryManager.FirstEmptySlot) { MoveTo (GameManager.InventoryManager.FirstEmptySlot); } else { #if (DEBUG) Debug.Log("Cannot put " + gameObject.name + " into inventory. There are no empty slots."); #endif } }
public static void CastTiamat() { if (Tiamat == null) { Tiamat = ObjectManager.Player.InventoryItems.FirstOrDefault( a => a.Id == ItemId.Tiamat_Melee_Only || a.Id == ItemId.Ravenous_Hydra_Melee_Only); } if (Tiamat != null && Tiamat.CanUseItem()) { Tiamat.Cast(); } else { Remove("H"); } }
public override void Start() { base.Start(); new ValueTracker<InventorySlot>(v => inventorySlot = v, () => inventorySlot); new ValueTracker<bool>(v => { ghostForm = v; SetSemitransparent(ghostForm); if (thrower != null) { Extensions.IgnoreCollision(thrower, this, v); } }, () => ghostForm); new ValueTracker<Unit>(v => thrower = v, () => thrower); bool ghost = GetComponent<NotCollidePlayer>() != null; if (ghost) { GhostFor(FindObjectOfType<Unit>()); } else { SetSemitransparent(false); } }
/// <summary> /// Gets an inventory item. /// </summary> /// <param name="slot">Index of the inventory item slot.</param> /// <returns>Item in the specified inventory slot, or null if the slot is empty or invalid</returns> public ItemEntity this[InventorySlot slot] { get { // Check for a valid index if (!slot.IsLegalValue()) { const string errmsg = "Tried to get invalid inventory slot `{0}`."; if (log.IsErrorEnabled) log.ErrorFormat(errmsg, slot); Debug.Fail(string.Format(errmsg, slot)); return null; } // If the item has an amount of 0, return null var item = _buffer[(int)slot]; if (item != null && item.Amount == 0) return null; // Item is either null or valid return _buffer[(int)slot]; } private set { // Check for a valid index if (!slot.IsLegalValue()) { const string errmsg = "Tried to set invalid inventory slot `{0}`."; if (log.IsErrorEnabled) log.ErrorFormat(errmsg, slot); Debug.Fail(string.Format(errmsg, slot)); return; } _buffer[(int)slot] = value; } }
/// <summary> /// Drops an item from the inventory onto the ground. If the user has just one item in the given <paramref name="slot"/>, /// then it is dropped. If they have multiple items in the <paramref name="slot"/>, then they are presented with an /// <see cref="InputBox"/> so they can enter in how much to drop. /// </summary> /// <param name="slot">The slot of the item to drop.</param> /// <param name="guiManager">The <see cref="IGUIManager"/> to use to create the <see cref="InputBox"/> if it is needed.</param> public void Drop(InventorySlot slot, IGUIManager guiManager) { // Check for a valid item var item = this[slot]; if (item == null) return; // Check the amount if (item.Amount > 1) { // Create an InputBox to ask how much to drop const string text = "Drop item"; const string message = "How much of the item do you wish to drop?\n(Enter a value from 1 to {0})"; var inBox = InputBox.CreateNumericInputBox(guiManager, text, string.Format(message, item.Amount)); inBox.Tag = slot; inBox.OptionSelected += DropInputBox_OptionSelected; } else { // Auto-drop if there is just one of the item Drop(slot, 1); } }
public async Task <IActionResult> EditSave(InventoryAreaEditViewModel model) { if (model == null) { return(NotFound()); } if (ModelState.IsValid) { try { //Get area from context var area = await(from a in _context.InventoryAreas.Include("ItemSlots.WildeRoverItem") where a.InventoryAreaId == model.InventoryAreaId select a).SingleOrDefaultAsync(); if (area == null) { return(NotFound()); //Validate } //Create dictionary of ItemSlots for O(1) updates var slotDict = area.ItemSlots.ToDictionary(t => t.InventorySlotId); //Loop through model.ItemSlots and update context int i = 0; while (i < model.SlotDisplayCount || i < area.ItemSlots.Count) { if (i < area.ItemSlots.Count && i < model.SlotDisplayCount) //Update { var temp = slotDict[model.SlotList[i].InventorySlotId]; if (model.SlotList[i].WildeRoverItemId == 0) { temp.WildeRoverItemId = null; } else { temp.WildeRoverItemId = model.SlotList[i].WildeRoverItemId; } _context.Slots.Update(temp); } else if (i < model.SlotDisplayCount && i >= area.ItemSlots.Count) //Add { InventorySlot newSlot = new InventorySlot(); newSlot.InventoryAreaId = area.InventoryAreaId; newSlot.Slot = i + 1; if (model.SlotList[i].WildeRoverItemId != 0) { newSlot.WildeRoverItemId = model.SlotList[i].WildeRoverItemId; } _context.Slots.Add(newSlot); } else if (i >= model.SlotDisplayCount && i < area.ItemSlots.Count) //Remove { var toRemove = area.ItemSlots[i]; area.ItemSlots.RemoveAt(i); _context.Slots.Remove(toRemove); } i++; } await _context.SaveChangesAsync(); //Save context return(RedirectToAction("Details", new { id = model.InventoryAreaId })); } catch (DbUpdateConcurrencyException) { throw; } } return(View(model)); }
/// <returns>whether the given InventorySlot is a backpack slot</returns> public static bool IsBackpackSlot(InventorySlot slot) { return(slot >= InventorySlot.BackPack1 && slot <= InventorySlot.BackPackLast); }
/// <summary> </summary> private void HandleLootRoll(object sender, LuaEventArgs e) { if (!AutoEquipSettings.Instance.RollForLootInDungeons) { return; } Log("Loot roll in progress"); string rollId = e.Args[0].ToString(); string itemLink = Lua.GetReturnVal <string>("return GetLootRollItemLink(" + rollId + ")", 0); string[] splitted = itemLink.Split(':'); uint itemId; if (string.IsNullOrEmpty(itemLink) || (splitted.Length == 0 || splitted.Length < 2) || (!uint.TryParse(splitted[1], out itemId) || itemId == 0)) { Log("Parsing ItemLink for lootroll failed!"); Log("ItemLink:{0}", itemLink); return; } ItemInfo rollItemInfo = ItemInfo.FromId(itemId); if (rollItemInfo == null) { Log("Retrieving item info for roll item failed"); Log("Item Id:{0} ItemLink:{1}", itemId, itemLink); return; } bool canDisenchant = Lua.GetReturnVal <bool>("return GetLootRollItemInfo(" + rollId + ")", 7); // Otherwise we just roll greed or disenchant if (AutoEquipSettings.Instance.RollForLootDE && canDisenchant) { Log("Rolling for disenchant"); Lua.DoString("RollOnLoot(" + rollId + ", 3)"); return; } // The name of the roll item. string rollItemName = rollItemInfo.Name; // Score of the item being rolled for. float rollItemScore = _weightSet.EvaluateItem(rollItemInfo, new ItemStats(itemLink)); // Score the equipped item if any. otherwise 0 float bestEquipItemScore = float.MinValue; // The best slot InventorySlot bestSlot = InventorySlot.None; var inventorySlots = InventoryManager.GetInventorySlotsByEquipSlot(rollItemInfo.EquipSlot); foreach (InventorySlot slot in inventorySlots) { WoWItem equipped = EquippedItems[slot]; if (equipped != null) { bestEquipItemScore = _weightSet.EvaluateItem(equipped, AutoEquipSettings.Instance.IncludeEnchants); bestSlot = slot; } } if (bestEquipItemScore != float.MinValue) { Log("Equipped item in slot:{0} scored {1} while loot-roll item scored:{2}", bestSlot, bestEquipItemScore, rollItemScore); } // Check if the item is better than the currently equipped item. if (bestEquipItemScore < rollItemScore && bestSlot != InventorySlot.None) { var inventoryTypes = GetInventoryTypesForWeaponStyle(AutoEquipSettings.Instance.WeaponStyle); var miscArmorType = new[] { InventoryType.Cloak, InventoryType.Trinket, InventoryType.Neck, InventoryType.Finger, }; // Make sure we only roll need if the item is of the wanted armor class for this player (or if it's a cloak, trinket, ring or neck). bool needRollForArmor = rollItemInfo.ItemClass == WoWItemClass.Armor && (rollItemInfo.ArmorClass == _weightSet.GetWantedArmorClass() || miscArmorType.Contains(rollItemInfo.InventoryType)); // Make sure we only roll need if the item is a weapon we might use. bool needRollForWeapon = rollItemInfo.ItemClass == WoWItemClass.Weapon && inventoryTypes.Contains(rollItemInfo.EquipSlot); bool canNeed = Lua.GetReturnVal <bool>("return GetLootRollItemInfo(" + rollId + ")", 5); if ((needRollForArmor || needRollForWeapon) && canNeed) { Log("{0} scored {1} while your equiped item only scored {2} - Rolling Need", rollItemName, rollItemScore, bestEquipItemScore); Lua.DoString("RollOnLoot(" + rollId + ", 1)"); return; } } Log("Rolling Greed"); Lua.DoString("RollOnLoot(" + rollId + ", 2)"); }
private static SpellDataInst GetItemSpell(InventorySlot invSlot) { return(ObjectManager.Player.Spellbook.Spells.FirstOrDefault(spell => (int)spell.Slot == invSlot.Slot + 4)); }
// Possible extensions for inventory system public virtual void RemoveItem(InventorySlot slot, int amount) { throw new System.NotImplementedException(); }
/// <summary> /// Called when this Item gets equipped. /// Requires map context. /// </summary> public void OnEquip() { if (IsApplied) { return; } IsApplied = true; InventorySlot slot = (InventorySlot)Slot; Character owningCharacter = OwningCharacter; if (slot < InventorySlot.Bag1) { int num = m_template.IsAmmo ? 1 : 0; } m_template.ApplyStatMods(owningCharacter); if (m_template.BondType == ItemBondType.OnEquip) { Flags |= ItemFlags.Soulbound; } if (owningCharacter.IsUsingSpell) { owningCharacter.SpellCast.Cancel(SpellFailedReason.Interrupted); } for (int index = 0; index < m_template.Resistances.Length; ++index) { int resistance = m_template.Resistances[index]; if (resistance > 0) { owningCharacter.ModBaseResistance((DamageSchool)index, resistance); } } if (slot == InventorySlot.Invalid) { owningCharacter.UpdateRangedDamage(); } else if (m_template.InventorySlotType == InventorySlotType.Shield) { owningCharacter.UpdateBlockChance(); } if (m_template.EquipSpells != null) { owningCharacter.SpellCast.TriggerAll(owningCharacter, m_template.EquipSpells); } if (m_template.Set != null) { Spell[] spellArray = m_template.Set.Boni.Get(owningCharacter.Inventory.GetSetCount(m_template.Set) - 1U); if (spellArray != null) { owningCharacter.SpellCast.TriggerAll(owningCharacter, spellArray); } } m_owner.PlayerAuras.OnEquip(this); if (m_owner.Inventory.m_ItemEquipmentEventHandlers != null) { foreach (IItemEquipmentEventHandler equipmentEventHandler in m_owner.Inventory .m_ItemEquipmentEventHandlers) { equipmentEventHandler.OnEquip(this); } } m_template.NotifyEquip(this); }
void ItemAdded(InventorySlot slot) { statusText.text = slot.item.name + " x" + slot.itemCount; statusText.enabled = true; textEndTime = Time.time + textDelayTime; }
/// <summary> /// Adds a new default Item to the given slot, if not already existing /// </summary> public void EnsureDefaultItem(InventorySlot slot) { }
/// <summary> /// Tries to add ONE new item with the given template to the given slot. /// Make sure the given targetSlot is valid before calling this method. /// </summary> public InventoryError TryAdd(ItemTemplate template, InventorySlot targetSlot) { var amount = 1; return TryAdd(template, ref amount, (int)targetSlot, true); }
/// <summary> /// Create a InventoryApply interaction performed by the local player using their active hand /// </summary> /// <param name="targetObjectSlot">slot of the object that the player is applying the active hand item to</param> /// <returns></returns> public static InventoryApply ByLocalPlayer(InventorySlot targetObjectSlot) { return(new InventoryApply(PlayerManager.LocalPlayer, UIManager.Hands.CurrentSlot.Item, targetObjectSlot, HandSlot.ForName(UIManager.Hands.CurrentSlot.equipSlot))); }
/// <summary> /// /// </summary> /// <param name="performer">The gameobject of the player performing the InventoryApply</param> /// <param name="handObject">Object in the player's active hand. Null if player's hand is empty.</param> /// <param name="targetSlot">object that the player applying the used object to</param> /// <param name="handSlot">hand slot of handObject</param> private InventoryApply(GameObject performer, GameObject handObject, InventorySlot targetSlot, HandSlot handSlot) : base(performer, handObject, targetSlot.Item) { this.handSlot = handSlot; this.targetSlot = targetSlot; }
public void GenerateInventory() { string generatedDirPath = $"Assets/Merlin/Inventory/_generated/{descriptorGUID}"; if (!Directory.Exists(generatedDirPath)) { Directory.CreateDirectory(generatedDirPath); } // Generate the stage parameters for the inventory toggles VRCExpressionParameters inventoryStageParams; string stageParameterPath = $"{generatedDirPath}/customStageParams.asset"; if (basisStageParameters != null) { AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(basisStageParameters), stageParameterPath); inventoryStageParams = AssetDatabase.LoadAssetAtPath <VRCExpressionParameters>(stageParameterPath); } else { inventoryStageParams = ScriptableObject.CreateInstance <VRCExpressionParameters>(); AssetDatabase.CreateAsset(inventoryStageParams, $"{generatedDirPath}/customStageParams.asset"); } List <VRCExpressionParameters.Parameter> originalParams = new List <VRCExpressionParameters.Parameter>(); if (inventoryStageParams.parameters != null) { foreach (VRCExpressionParameters.Parameter param in inventoryStageParams.parameters) { if (!string.IsNullOrEmpty(param.name)) { originalParams.Add(new VRCExpressionParameters.Parameter() { name = param.name, valueType = param.valueType }); } } } if (inventorySlots.Length + originalParams.Count > 128) { Debug.LogError($"Cannot have more than {128 - originalParams.Count} inventory slots"); return; } VRCExpressionParameters.Parameter[] basisParameters = inventoryStageParams.parameters; inventoryStageParams.parameters = new VRCExpressionParameters.Parameter[inventorySlots.Length]; for (int i = 0; i < originalParams.Count; ++i) { inventoryStageParams.parameters[i] = originalParams[i]; } for (int i = originalParams.Count; i < inventorySlots.Length + originalParams.Count; ++i) { inventoryStageParams.parameters[i] = new VRCExpressionParameters.Parameter() { name = $"GenInventorySlot{i - originalParams.Count}", valueType = VRCExpressionParameters.ValueType.Bool } } ; // for (int i = originalParams.Count + inventorySlots.Length; i < 16; ++i) // Clear out empty params // inventoryStageParams.parameters[i] = new VRCExpressionParameters.Parameter() { name = "", valueType = VRCExpressionParameters.ValueType.Float }; // Generate menu asset for (int menuNum = 0; menuNum < 8; ++menuNum) { VRCExpressionsMenu menuAsset; string menuPath = $"{generatedDirPath}/expressionMenu{menuNum}.asset"; if (basisMenu) { AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(basisMenu), menuPath); menuAsset = AssetDatabase.LoadAssetAtPath <VRCExpressionsMenu>(menuPath); } else { menuAsset = ScriptableObject.CreateInstance <VRCExpressionsMenu>(); AssetDatabase.CreateAsset(menuAsset, menuPath); } int offset = menuNum * 8; if (offset >= inventorySlots.Length) { break; } for (int i = 0; i < 8; ++i) { if (i + offset >= inventorySlots.Length) { break; } menuAsset.controls.Add(new VRCExpressionsMenu.Control() { icon = inventorySlots[i + offset].slotIcon, name = inventorySlots[i + offset].slotName, parameter = new VRCExpressionsMenu.Control.Parameter() { name = $"GenInventorySlot{i+offset}" }, type = VRCExpressionsMenu.Control.ControlType.Toggle, value = 1, }); } } // Generate controller AnimatorController controller; string controllerPath = $"{generatedDirPath}/inventoryController.controller"; if (basisAnimator) { AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(basisAnimator), controllerPath); controller = AssetDatabase.LoadAssetAtPath <AnimatorController>(controllerPath); } else { controller = AnimatorController.CreateAnimatorControllerAtPath(controllerPath); } AnimationClip[] inventoryClips = new AnimationClip[inventorySlots.Length]; AnimationClip[] inventoryResetClips = new AnimationClip[inventorySlots.Length]; // Generate layer mask AvatarMask maskEverything = new AvatarMask(); for (int i = 0; i < (int)AvatarMaskBodyPart.LastBodyPart; ++i) { maskEverything.SetHumanoidBodyPartActive((AvatarMaskBodyPart)i, false); } maskEverything.name = "maskEverythingMask"; AssetDatabase.AddObjectToAsset(maskEverything, controller); // Generate animation clips for (int i = 0; i < inventorySlots.Length; ++i) { InventorySlot slot = inventorySlots[i]; // Set initial object state // foreach (GameObject toggleObject in slot.slotToggleItems) // if (toggleObject) // toggleObject.SetActive(slot.startEnabled); string animationClipPath = $"{generatedDirPath}/Animations/_toggle{i}.anim"; AnimationClip toggleClip = GenerateToggleClip(slot.slotToggleItems, !slot.startEnabled); AnimationClip resetClip = GenerateToggleClip(slot.slotToggleItems, slot.startEnabled); //AssetDatabase.CreateAsset(toggleClip, animationClipPath); inventoryClips[i] = toggleClip; inventoryResetClips[i] = resetClip; toggleClip.name = $"toggleAnim{i}"; AssetDatabase.AddObjectToAsset(toggleClip, controller); resetClip.name = $"resetAnim{i}"; AssetDatabase.AddObjectToAsset(resetClip, controller); } // Generate controller layers for (int i = 0; i < inventorySlots.Length; ++i) { string paramName = $"GenInventorySlot{i}"; controller.AddParameter(paramName, AnimatorControllerParameterType.Bool); string layerName = $"GenToggleLayer{i}"; AnimatorControllerLayer toggleLayer = new AnimatorControllerLayer(); toggleLayer.name = layerName; toggleLayer.defaultWeight = 1f; toggleLayer.stateMachine = new AnimatorStateMachine(); toggleLayer.stateMachine.name = toggleLayer.name; toggleLayer.stateMachine.hideFlags = HideFlags.HideInHierarchy; toggleLayer.avatarMask = maskEverything; if (AssetDatabase.GetAssetPath(controller) != "") { AssetDatabase.AddObjectToAsset(toggleLayer.stateMachine, AssetDatabase.GetAssetPath(controller)); } AnimatorStateMachine stateMachine = toggleLayer.stateMachine; AnimatorState nullState = stateMachine.AddState("Null State", stateMachine.entryPosition + new Vector3(200f, 0f)); AnimatorState toggleState = stateMachine.AddState("Toggle Triggered", stateMachine.entryPosition + new Vector3(500f, 0f)); nullState.motion = inventoryResetClips[i]; toggleState.motion = inventoryClips[i]; AnimatorStateTransition toToggle = nullState.AddTransition(toggleState); toToggle.exitTime = 0f; toToggle.hasExitTime = false; toToggle.hasFixedDuration = true; toToggle.duration = 0f; AnimatorStateTransition toNull = toggleState.AddTransition(nullState); toNull.exitTime = 0f; toNull.hasExitTime = false; toNull.hasFixedDuration = true; toNull.duration = 0f; toToggle.AddCondition(AnimatorConditionMode.If, 0f, paramName); toNull.AddCondition(AnimatorConditionMode.IfNot, 0f, paramName); controller.AddLayer(toggleLayer); } // Setup layers on the avatar descriptor VRCAvatarDescriptor descriptor = GetComponent <VRCAvatarDescriptor>(); // descriptor.expressionsMenu = menuAsset; descriptor.expressionParameters = inventoryStageParams; VRCAvatarDescriptor.CustomAnimLayer layer = new VRCAvatarDescriptor.CustomAnimLayer(); layer.isDefault = false; layer.animatorController = controller; layer.type = inventoryAnimLayer; for (int i = 0; i < descriptor.baseAnimationLayers.Length; ++i) { if (descriptor.baseAnimationLayers[i].type == inventoryAnimLayer) { descriptor.baseAnimationLayers[i] = layer; break; } } AssetDatabase.SaveAssets(); }
void equip(Item_string item) { string part; string item_string = Inventory.instance.copy(item.code); Item_string target = null; if (!(item_string.Substring(1, 1) == "5" && sheild == false)) { Inventory.instance.pop_list(this.GetComponent <index>().Index); } switch (item_string.Substring(1, 1)) { case "1": Debug.Log("머리장착"); target = Inventory.instance.equipment_Head.GetComponent <Item_string>(); Debug.Log(target.code); if (target.code != null) { Inventory.instance.Add(Inventory.instance.equipment_Head.GetComponent <Item_string>().code); part = Inventory.instance.equipment_Head.GetComponent <Item_string>().code; Inventory.instance.player.Consume(false, part.Substring(0, 4), InventorySlot.GetType(part), ItemManager.instance.GetOpt1_1(int.Parse(part.Substring(0, 5))), ItemManager.instance.GetOpt2_1(int.Parse(part.Substring(0, 5)))); } break; case "2": target = Inventory.instance.equipment_Armor.GetComponent <Item_string>(); if (target.code != null) { Inventory.instance.Add(Inventory.instance.equipment_Armor.GetComponent <Item_string>().code); part = Inventory.instance.equipment_Armor.GetComponent <Item_string>().code; Inventory.instance.player.Consume(false, part.Substring(0, 4), InventorySlot.GetType(part), ItemManager.instance.GetOpt1_1(int.Parse(part.Substring(0, 5))), ItemManager.instance.GetOpt2_1(int.Parse(part.Substring(0, 5)))); } break; case "3": target = Inventory.instance.equipment_Shoes.GetComponent <Item_string>(); if (target.code != null) { Inventory.instance.Add(Inventory.instance.equipment_Shoes.GetComponent <Item_string>().code); part = Inventory.instance.equipment_Shoes.GetComponent <Item_string>().code; Inventory.instance.player.Consume(false, part.Substring(0, 4), InventorySlot.GetType(part), ItemManager.instance.GetOpt1_1(int.Parse(part.Substring(0, 5))), ItemManager.instance.GetOpt2_1(int.Parse(part.Substring(0, 5)))); } break; case "4": Debug.Log("무기장착"); target = Inventory.instance.equipment_weapon.GetComponent <Item_string>(); if (int.Parse(item_string.Substring(2, 1)) != 0) { if (Inventory.instance.current_count >= Inventory.instance.inventory_max - 1 && Inventory.instance.equipment_Shield.GetComponent <Item_string>().code != null) { Inventory.instance.Add(item_string); return; } Debug.Log("대검이다"); //방패빼기 GameObject Shield = Inventory.instance.equipment_Shield; Inventory.instance.Add(Shield.GetComponent <Item_string>().code); part = Shield.GetComponent <Item_string>().code; if (part != null) { //뺀 방패만큼 방어력 감소 Inventory.instance.player.Consume(false, part.Substring(0, 4), InventorySlot.GetType(part), ItemManager.instance.GetOpt1_1(int.Parse(part.Substring(0, 5))), ItemManager.instance.GetOpt2_1(int.Parse(part.Substring(0, 5)))); } //방패 금지 이미지 Shield.GetComponent <Image>().sprite = Inventory.instance.closeImage; Shield.GetComponent <Item_string>().code = null; sheild = false; if (int.Parse(item_string.Substring(2, 1)) == 1) { Skill_window.instance.slot_now = Skill_window.instance.two_slot; } else if (int.Parse(item_string.Substring(2, 1)) == 2) { Skill_window.instance.slot_now = Skill_window.instance.three_slot; } } else if (Inventory.instance.equipment_Shield.GetComponent <Item_string>().code == null) { Inventory.instance.equipment_Shield.GetComponent <Image>().sprite = Inventory.instance.defaultImage; sheild = true; if (int.Parse(item_string.Substring(2, 1)) == 0) { Debug.Log("1번슬롯으로 변경"); Skill_window.instance.slot_now = Skill_window.instance.one_slot; } } if (target.code != null) { Inventory.instance.Add(Inventory.instance.equipment_weapon.GetComponent <Item_string>().code); part = Inventory.instance.equipment_weapon.GetComponent <Item_string>().code; Inventory.instance.player.Consume(false, part.Substring(0, 4), InventorySlot.GetType(part), ItemManager.instance.GetOpt1_1(int.Parse(part.Substring(0, 5))), ItemManager.instance.GetOpt2_1(int.Parse(part.Substring(0, 5)))); } skillslot.instance.update(); break; case "5": target = Inventory.instance.equipment_Shield.GetComponent <Item_string>(); if (target.code != null) { Inventory.instance.Add(Inventory.instance.equipment_Shield.GetComponent <Item_string>().code); part = Inventory.instance.equipment_Shield.GetComponent <Item_string>().code; Inventory.instance.player.Consume(false, part.Substring(0, 4), InventorySlot.GetType(part), ItemManager.instance.GetOpt1_1(int.Parse(part.Substring(0, 5))), ItemManager.instance.GetOpt2_1(int.Parse(part.Substring(0, 5)))); } break; } Debug.Log(item.code); if (!(item_string.Substring(1, 1) == "5" && sheild == false)) { target.code = item_string; target.GetComponent <Image>().sprite = Resources.Load <Sprite>("Item/ItemStandard/" + target.code.Substring(0, 4)); Inventory.instance.player.Consume(true, target.code.Substring(0, 4), InventorySlot.GetType(target.code), ItemManager.instance.GetOpt1_1(int.Parse(target.code.Substring(0, 5))), ItemManager.instance.GetOpt2_1(int.Parse(target.code.Substring(0, 5)))); } }
/// <summary> /// </summary> /// <param name="client"> /// </param> public static void Send(Client client) { var fc = new FullCharacterMessage { Identity = client.Character.Identity, Unknown1 = 25 }; /* part 1 of data */ List <InventorySlot> inventory = new List <InventorySlot>(); foreach (IInventoryPage ivp in client.Character.BaseInventory.Pages.Values) { foreach (KeyValuePair <int, IItem> kv in ivp.List()) { var temp = new InventorySlot { Placement = kv.Key, Flags = (short)kv.Value.Flags, Count = (short)kv.Value.MultipleCount, Identity = kv.Value.Identity, ItemLowId = kv.Value.LowID, ItemHighId = kv.Value.HighID, Quality = kv.Value.Quality, Unknown = kv.Value.Nothing }; inventory.Add(temp); } } fc.InventorySlots = inventory.ToArray(); /* part 2 of data */ /* number of entries */ fc.UploadedNanoIds = client.Character.UploadedNanos.Select(n => n.Nano).ToArray(); /* part 3 of data */ /* number of entries */ fc.Unknown2 = new object[0]; /* No idea what these are */ /* used to be skill locks + some unknown data */ // TODO: Find out what following 6 ints are fc.Unknown3 = 1; fc.Unknown4 = 0; fc.Unknown5 = 1; fc.Unknown6 = 0; fc.Unknown7 = 1; fc.Unknown8 = 0; /* part 6 of data (1-st stats block) */ /* Int32 stat number * Int32 stat value */ var stats1 = new List <GameTuple <int, uint> >(); /* State */ AddStat3232(client, stats1, 7); /* UnarmedTemplateInstance */ AddStat3232(client, stats1, 418); /* Invaders Killed */ AddStat3232(client, stats1, 615); /* KilledByInvaders */ AddStat3232(client, stats1, 616); /* AccountFlags */ AddStat3232(client, stats1, 660); /* VP */ AddStat3232(client, stats1, 669); /* UnsavedXP */ AddStat3232(client, stats1, 592); /* NanoFocusLevel */ AddStat3232(client, stats1, 355); /* Specialization */ AddStat3232(client, stats1, 182); /* ShadowBreedTemplate */ AddStat3232(client, stats1, 579); /* ShadowBreed */ AddStat3232(client, stats1, 532); /* LastPerkResetTime */ AddStat3232(client, stats1, 577); /* SocialStatus */ AddStat3232(client, stats1, 521); /* PlayerOptions */ AddStat3232(client, stats1, 576); /* TempSaveTeamID */ AddStat3232(client, stats1, 594); /* TempSavePlayfield */ AddStat3232(client, stats1, 595); /* TempSaveX */ AddStat3232(client, stats1, 596); /* TempSaveY */ AddStat3232(client, stats1, 597); /* VisualFlags */ AddStat3232(client, stats1, 673); /* PvPDuelKills */ AddStat3232(client, stats1, 674); /* PvPDuelDeaths */ AddStat3232(client, stats1, 675); /* PvPProfessionDuelKills */ AddStat3232(client, stats1, 676); /* PvPProfessionDuelDeaths */ AddStat3232(client, stats1, 677); /* PvPRankedSoloKills */ AddStat3232(client, stats1, 678); /* PvPRankedSoloDeaths */ AddStat3232(client, stats1, 679); /* PvPRankedTeamKills */ AddStat3232(client, stats1, 680); /* PvPRankedTeamDeaths */ AddStat3232(client, stats1, 681); /* PvPSoloScore */ AddStat3232(client, stats1, 682); /* PvPTeamScore */ AddStat3232(client, stats1, 683); /* PvPDuelScore */ AddStat3232(client, stats1, 684); AddStat3232(client, stats1, 0x289); AddStat3232(client, stats1, 0x28a); /* SavedXP */ AddStat3232(client, stats1, 334); /* Flags */ AddStat3232(client, stats1, 0); /* Features */ AddStat3232(client, stats1, 224); /* ApartmentsAllowed */ AddStat3232(client, stats1, 582); /* ApartmentsOwned */ AddStat3232(client, stats1, 583); /* MonsterScale */ AddStat3232(client, stats1, 360); /* VisualProfession */ AddStat3232(client, stats1, 368); /* NanoAC */ AddStat3232(client, stats1, 168); AddStat3232(client, stats1, 214); AddStat3232(client, stats1, 221); /* LastConcretePlayfieldInstance */ AddStat3232(client, stats1, 191); /* MapOptions */ AddStat3232(client, stats1, 470); /* MapAreaPart1 */ AddStat3232(client, stats1, 471); /* MapAreaPart2 */ AddStat3232(client, stats1, 472); /* MapAreaPart3 */ AddStat3232(client, stats1, 585); /* MapAreaPart4 */ AddStat3232(client, stats1, 586); /* MissionBits1 */ AddStat3232(client, stats1, 256); /* MissionBits2 */ AddStat3232(client, stats1, 257); /* MissionBits3 */ AddStat3232(client, stats1, 303); /* MissionBits4 */ AddStat3232(client, stats1, 432); /* MissionBits5 */ AddStat3232(client, stats1, 65); /* MissionBits6 */ AddStat3232(client, stats1, 66); /* MissionBits7 */ AddStat3232(client, stats1, 67); /* MissionBits8 */ AddStat3232(client, stats1, 544); /* MissionBits9 */ AddStat3232(client, stats1, 545); /* MissionBits10 */ AddStat3232(client, stats1, 617); AddStat3232(client, stats1, 618); AddStat3232(client, stats1, 619); AddStat3232(client, stats1, 198); /* AutoAttackFlags */ AddStat3232(client, stats1, 349); /* PersonalResearchLevel */ AddStat3232(client, stats1, 263); /* GlobalResearchLevel */ AddStat3232(client, stats1, 264); /* PersonalResearchGoal */ AddStat3232(client, stats1, 265); /* GlobalResearchGoal */ AddStat3232(client, stats1, 266); /* BattlestationSide */ AddStat3232(client, stats1, 668); /* BattlestationRep */ AddStat3232(client, stats1, 670); /* Members */ AddStat3232(client, stats1, 300); fc.Stats1 = stats1.ToArray(); /* Int32 stat number * Int32 stat value */ var stats2 = new List <GameTuple <int, uint> >(); /* VeteranPoints */ AddStat3232(client, stats2, 68); /* MonthsPaid */ AddStat3232(client, stats2, 69); /* PaidPoints */ AddStat3232(client, stats2, 672); /* AutoAttackFlags */ AddStat3232(client, stats2, 349); /* XPKillRange */ AddStat3232(client, stats2, 275); /* InPlay */ AddStat3232(client, stats2, 194); /* Health (current health)*/ AddStat3232(client, stats2, 27); /* Life (max health)*/ AddStat3232(client, stats2, 1); /* Psychic */ AddStat3232(client, stats2, 21); /* Sense */ AddStat3232(client, stats2, 20); /* Intelligence */ AddStat3232(client, stats2, 19); /* Stamina */ AddStat3232(client, stats2, 18); /* Agility */ AddStat3232(client, stats2, 17); /* Strength */ AddStat3232(client, stats2, 16); /* Attitude */ AddStat3232(client, stats2, 63); /* Alignment (Clan Tokens) */ AddStat3232(client, stats2, 62); /* Cash */ AddStat3232(client, stats2, 61); /* Profession */ AddStat3232(client, stats2, 60); /* AggDef */ AddStat3232(client, stats2, 51); /* Icon */ AddStat3232(client, stats2, 79); /* Mesh */ AddStat3232(client, stats2, 12); /* RunSpeed */ AddStat3232(client, stats2, 156); /* DeadTimer */ AddStat3232(client, stats2, 34); /* Team */ AddStat3232(client, stats2, 6); /* Breed */ AddStat3232(client, stats2, 4); /* Sex */ AddStat3232(client, stats2, 59); /* LastSaveXP */ AddStat3232(client, stats2, 372); /* NextXP */ AddStat3232(client, stats2, 350); /* LastXP */ AddStat3232(client, stats2, 57); /* Level */ AddStat3232(client, stats2, 54); /* XP */ AddStat3232(client, stats2, 52); /* IP */ AddStat3232(client, stats2, 53); /* CurrentMass */ AddStat3232(client, stats2, 78); /* ItemType */ AddStat3232(client, stats2, 72); /* PreviousHealth */ AddStat3232(client, stats2, 11); /* CurrentState */ AddStat3232(client, stats2, 423); /* Age */ AddStat3232(client, stats2, 58); /* Side */ AddStat3232(client, stats2, 33); /* WaitState */ AddStat3232(client, stats2, 430); /* DriveWater */ AddStat3232(client, stats2, 117); /* MeleeMultiple */ AddStat3232(client, stats2, 101); /* LR_MultipleWeapon */ AddStat3232(client, stats2, 134); /* LR_EnergyWeapon */ AddStat3232(client, stats2, 133); /* RadiationAC */ AddStat3232(client, stats2, 94); /* SenseImprovement */ AddStat3232(client, stats2, 122); /* BowSpecialAttack */ AddStat3232(client, stats2, 121); /* Burst */ AddStat3232(client, stats2, 148); /* FullAuto */ AddStat3232(client, stats2, 167); /* MapNavigation */ AddStat3232(client, stats2, 140); /* DriveAir */ AddStat3232(client, stats2, 139); /* DriveGround */ AddStat3232(client, stats2, 166); /* BreakingEntry */ AddStat3232(client, stats2, 165); /* Concealment */ AddStat3232(client, stats2, 164); /* Chemistry */ AddStat3232(client, stats2, 163); /* Psychology */ AddStat3232(client, stats2, 162); /* ComputerLiteracy */ AddStat3232(client, stats2, 161); /* NanoProgramming */ AddStat3232(client, stats2, 160); /* Pharmaceuticals */ AddStat3232(client, stats2, 159); /* WeaponSmithing */ AddStat3232(client, stats2, 158); /* FieldQuantumPhysics */ AddStat3232(client, stats2, 157); /* AttackSpeed */ AddStat3232(client, stats2, 3); /* Evade */ AddStat3232(client, stats2, 155); /* Dodge */ AddStat3232(client, stats2, 154); /* Duck */ AddStat3232(client, stats2, 153); /* BodyDevelopment */ AddStat3232(client, stats2, 152); /* AimedShot */ AddStat3232(client, stats2, 151); /* FlingShot */ AddStat3232(client, stats2, 150); /* NanoProwessInitiative */ AddStat3232(client, stats2, 149); /* FastAttack */ AddStat3232(client, stats2, 147); /* SneakAttack */ AddStat3232(client, stats2, 146); /* Parry */ AddStat3232(client, stats2, 145); /* Dimach */ AddStat3232(client, stats2, 144); /* Riposte */ AddStat3232(client, stats2, 143); /* Brawl */ AddStat3232(client, stats2, 142); /* Tutoring */ AddStat3232(client, stats2, 141); /* Swim */ AddStat3232(client, stats2, 138); /* Adventuring */ AddStat3232(client, stats2, 137); /* Perception */ AddStat3232(client, stats2, 136); /* DisarmTraps */ AddStat3232(client, stats2, 135); /* NanoEnergyPool */ AddStat3232(client, stats2, 132); /* MaterialLocation */ AddStat3232(client, stats2, 131); /* MaterialCreation */ AddStat3232(client, stats2, 130); /* PsychologicalModification */ AddStat3232(client, stats2, 129); /* BiologicalMetamorphose */ AddStat3232(client, stats2, 128); /* MaterialMetamorphose */ AddStat3232(client, stats2, 127); /* ElectricalEngineering */ AddStat3232(client, stats2, 126); /* MechanicalEngineering */ AddStat3232(client, stats2, 125); /* Treatment */ AddStat3232(client, stats2, 124); /* FirstAid */ AddStat3232(client, stats2, 123); /* PhysicalProwessInitiative */ AddStat3232(client, stats2, 120); /* DistanceWeaponInitiative */ AddStat3232(client, stats2, 119); /* CloseCombatInitiative */ AddStat3232(client, stats2, 118); /* AssaultRifle */ AddStat3232(client, stats2, 116); /* Shotgun */ AddStat3232(client, stats2, 115); /* SubMachineGun */ AddStat3232(client, stats2, 114); /* Rifle */ AddStat3232(client, stats2, 113); /* Pistol */ AddStat3232(client, stats2, 112); /* Bow */ AddStat3232(client, stats2, 111); /* ThrownGrapplingWeapons */ AddStat3232(client, stats2, 110); /* Grenade */ AddStat3232(client, stats2, 109); /* ThrowingKnife */ AddStat3232(client, stats2, 108); /* 2HBluntWeapons */ AddStat3232(client, stats2, 107); /* Piercing */ AddStat3232(client, stats2, 106); /* 2HEdgedWeapons */ AddStat3232(client, stats2, 105); /* MeleeEnergyWeapon */ AddStat3232(client, stats2, 104); /* 1HEdgedWeapons */ AddStat3232(client, stats2, 103); /* 1HBluntWeapons */ AddStat3232(client, stats2, 102); /* MartialArts */ AddStat3232(client, stats2, 100); /* Alignment (Clan Tokens) */ AddStat3232(client, stats2, 62); /* MetaType (Omni Tokens) */ AddStat3232(client, stats2, 75); /* TitleLevel */ AddStat3232(client, stats2, 37); /* GmLevel */ AddStat3232(client, stats2, 215); /* FireAC */ AddStat3232(client, stats2, 97); /* PoisonAC */ AddStat3232(client, stats2, 96); /* ColdAC */ AddStat3232(client, stats2, 95); /* RadiationAC */ AddStat3232(client, stats2, 94); /* ChemicalAC */ AddStat3232(client, stats2, 93); /* EnergyAC */ AddStat3232(client, stats2, 92); /* MeleeAC */ AddStat3232(client, stats2, 91); /* ProjectileAC */ AddStat3232(client, stats2, 90); /* RP */ AddStat3232(client, stats2, 199); /* SpecialCondition */ AddStat3232(client, stats2, 348); /* SK */ AddStat3232(client, stats2, 573); /* Expansions */ AddStat3232(client, stats2, 389); /* ClanRedeemed */ AddStat3232(client, stats2, 572); /* ClanConserver */ AddStat3232(client, stats2, 571); /* ClanDevoted */ AddStat3232(client, stats2, 570); /* OTUnredeemed */ AddStat3232(client, stats2, 569); /* OTOperator */ AddStat3232(client, stats2, 568); /* OTFollowers */ AddStat3232(client, stats2, 567); /* GOS */ AddStat3232(client, stats2, 566); /* ClanVanguards */ AddStat3232(client, stats2, 565); /* OTTrans */ AddStat3232(client, stats2, 564); /* ClanGaia */ AddStat3232(client, stats2, 563); /* OTMed*/ AddStat3232(client, stats2, 562); /* ClanSentinels */ AddStat3232(client, stats2, 561); /* OTArmedForces */ AddStat3232(client, stats2, 560); /* SocialStatus */ AddStat3232(client, stats2, 521); /* PlayerID */ AddStat3232(client, stats2, 607); /* KilledByInvaders */ AddStat3232(client, stats2, 616); /* InvadersKilled */ AddStat3232(client, stats2, 615); /* AlienLevel */ AddStat3232(client, stats2, 169); /* AlienNextXP */ AddStat3232(client, stats2, 178); /* AlienXP */ AddStat3232(client, stats2, 40); fc.Stats2 = stats2.ToArray(); /* Byte stat number * Byte stat value */ var stats3 = new List <GameTuple <byte, byte> >(); /* InsurancePercentage */ AddStat88(client, stats3, 236); /* ProfessionLevel */ AddStat88(client, stats3, 10); /* PrevMovementMode */ AddStat88(client, stats3, 174); /* CurrentMovementMode */ AddStat88(client, stats3, 173); /* Fatness */ AddStat88(client, stats3, 47); /* Race */ AddStat88(client, stats3, 89); /* TeamSide */ AddStat88(client, stats3, 213); /* BeltSlots */ AddStat88(client, stats3, 45); fc.Stats3 = stats3.ToArray(); /* Byte stat number * Int16 (short) stat value */ var stats4 = new List <GameTuple <byte, short> >(); /* AbsorbProjectileAC */ AddStat816(client, stats4, 238); /* AbsorbMeleeAC */ AddStat816(client, stats4, 239); /* AbsorbEnergyAC */ AddStat816(client, stats4, 240); /* AbsorbChemicalAC */ AddStat816(client, stats4, 241); /* AbsorbRadiationAC */ AddStat816(client, stats4, 242); /* AbsorbColdAC */ AddStat816(client, stats4, 243); /* AbsorbNanoAC */ AddStat816(client, stats4, 246); /* AbsorbFireAC */ AddStat816(client, stats4, 244); /* AbsorbPoisonAC */ AddStat816(client, stats4, 245); /* TemporarySkillReduction */ AddStat816(client, stats4, 247); /* InsuranceTime */ AddStat816(client, stats4, 49); /* CurrentNano */ AddStat816(client, stats4, 214); /* maxMaxNanoEnergyEnergy */ AddStat816(client, stats4, 221); /* MaxNCU */ AddStat816(client, stats4, 181); /* MapFlags */ AddStat816(client, stats4, 9); /* ChangeSideCount */ AddStat816(client, stats4, 237); fc.Stats4 = stats4.ToArray(); /* ? */ fc.Unknown9 = 0; /* ? */ fc.Unknown10 = 0; fc.Unknown11 = new object[0]; #region Data11 (Empty) fc.Unknown12 = new object[0]; #endregion #region Data12 (Empty) fc.Unknown13 = new object[0]; #endregion client.SendCompressed(fc); }
public void GrabHalfStack(ItemHolder _itemHolder, InventorySlot onDropSlot) //middle click { }
/// <summary> /// Adds a new default Item to the given slot, if not already existing /// </summary> public Item EnsureItem(InventorySlot contSlot, int slot) { Setup.EnsureItemsLoaded(); var cont = m_inventory.GetContainer(contSlot, true); Assert.IsTrue(cont.IsValidSlot(slot)); var item = cont[slot]; if (item == null) { var msg = cont.TryAdd(Setup.ItemPool.DefaultItemTemplate, slot); Assert.AreEqual(InventoryError.OK, msg); item = cont[slot]; } return item; }
/// <summary> /// Called when this Item gets unequipped. /// Requires map context. /// </summary> public void OnUnEquip(InventorySlot slot) { if (!IsApplied) { return; } IsApplied = false; if (!m_template.IsAmmo) { m_owner.SetVisibleItem(slot, null); } m_template.RemoveStatMods(m_owner); if (m_template.EquipSpells != null) { foreach (Spell equipSpell in m_template.EquipSpells) { if (equipSpell.IsAura) { m_owner.Auras.Remove(equipSpell); } } } for (int index = 0; index < m_template.Resistances.Length; ++index) { int resistance = m_template.Resistances[index]; if (resistance > 0) { m_owner.ModBaseResistance((DamageSchool)index, -resistance); } } if (slot == InventorySlot.Invalid) { m_owner.UpdateRangedDamage(); } else if (m_template.InventorySlotType == InventorySlotType.Shield) { m_owner.UpdateBlockChance(); } if (m_template.Set != null) { Spell[] spellArray = m_template.Set.Boni.Get(m_owner.Inventory.GetSetCount(m_template.Set) - 1U); if (spellArray != null) { foreach (Spell index in spellArray) { Aura aura = m_owner.Auras[index, true]; if (aura != null) { aura.Remove(false); } } } } if (m_hitProc != null) { m_owner.RemoveProcHandler(m_hitProc); m_hitProc = null; } m_owner.PlayerAuras.OnBeforeUnEquip(this); if (m_owner.Inventory.m_ItemEquipmentEventHandlers != null) { foreach (IItemEquipmentEventHandler equipmentEventHandler in m_owner.Inventory .m_ItemEquipmentEventHandlers) { equipmentEventHandler.OnBeforeUnEquip(this); } } m_template.NotifyUnequip(this); }
protected override Item GetEquipment(InventorySlot invSlot) { InventoryItem invItem = _invMgr[(int)invSlot]; if (invItem == null) return null; return invItem.Item; }
/// <summary> /// Remove slot from th einventory /// </summary> /// <param name="slot"></param> public virtual void RemoveItem(InventorySlot slot) { EventManager.instance.ItemRemoved.Invoke(slot); _container.Remove(slot); }
/// <summary> /// Invokes the <see cref="RequestUseItem"/> event. /// </summary> /// <param name="slot">The <see cref="InventorySlot"/> to use.</param> public void InvokeRequestUseItem(InventorySlot slot) { if (RequestUseItem != null) RequestUseItem.Raise(this, EventArgsHelper.Create(slot)); }
public void OnDragEnd(GameObject obj) { //obj = object which is dragged Destroy(MouseData.tempItemBeingDragged); if (slotsOnInterface[obj].item.id <= -1) { return; } if (MouseData.interfaceMouseIsOver == null) { //TODO : IMPLEMENT DROP ITEM slotsOnInterface[obj].RemoveItem(); return; } if (MouseData.additiveSlotHoveredOver) { //CREATE INVENTORY SLOT InventorySlot emptySlot = new InventorySlot(); //Debug.Log("Additive Slot dragged to"); UserInterface ui = MouseData.additiveSlotHoveredOver.GetComponent <AdditiveSlot>().ui; InventoryObject invObject = MouseData.additiveSlotHoveredOver.GetComponent <AdditiveSlot>().ui.inventory; //Debug.Log("Before : " + invObject.GetSlots.Length); //Find Empty Slot if (invObject.EmptySlotCount <= 0) { invObject.container.SetSlots(invObject.container.slots.Length + 1); emptySlot = ui.InstantiateNewSlot(); emptySlot = invObject.GetSlots[invObject.container.slots.Length - 1]; } else { for (int i = 0; i < invObject.GetSlots.Length; i++) { if (invObject.GetSlots[i].item.id <= -1) { emptySlot = invObject.GetSlots[i]; break; } } } //Debug.Log("After : " + invObject.GetSlots.Length); //SWAP ITEMS BETWEEN SLOTS //InventorySlot addSlot = ui.slotsOnInterface[firstEmptySlot]; inventory.SwapItems(emptySlot, slotsOnInterface[obj]); emptySlot.OnAfterUpdate.Invoke(emptySlot); //Debug.Log(emptySlot.item.id); //OnSlotUpdate(emptySlot); } else if (MouseData.slotHoveredOver) { InventorySlot mouseHoverSlotData = MouseData.interfaceMouseIsOver.slotsOnInterface[MouseData.slotHoveredOver]; inventory.SwapItems(slotsOnInterface[obj], mouseHoverSlotData); } }
public static void UseItems(List <Obj_AI_Base> enemies, bool ks) { #region Item Initialization InventorySlot QSS = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Civali kullan")) ? Camille.GetItem(ItemId.Quicksilver_Sash) : null, MercurialsScimitar = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Kullan Mercurials Scimitar")) ? Camille.GetItem(ItemId.Mercurial_Scimitar) : null, RavenousHydra = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Kullan vahsi Hydra")) ? Camille.GetItem(ItemId.Ravenous_Hydra) : null, TitanicHydra = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Kullan hasmetli Hydra")) ? Camille.GetItem(ItemId.Titanic_Hydra) : null, Tiamat = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Kullan Tiamat")) ? Camille.GetItem(ItemId.Tiamat) : null, Youmuus = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Kullan Youmuus")) ? Camille.GetItem(ItemId.Youmuus_Ghostblade) : null, BOTRK = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Kullan Mahvolmus")) ? Camille.GetItem(ItemId.Blade_of_the_Ruined_King) : null, BilgewaterCutlass = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Kullan Bilgewater Palasi")) ? Camille.GetItem(ItemId.Bilgewater_Cutlass) : null, HextechGunblade = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Kullan Hextech Silahkilic")) ? Camille.GetItem(ItemId.Hextech_Gunblade) : null; #endregion #region QSS if (!hasDoneActionThisTick && QSS.MeetsCriteria() && (Camille.HasBuffOfType(BuffType.Blind) || Camille.HasBuffOfType(BuffType.Charm) || Camille.HasBuffOfType(BuffType.Fear) || Camille.HasBuffOfType(BuffType.Knockback) || Camille.HasBuffOfType(BuffType.Silence) || Camille.HasBuffOfType(BuffType.Snare) || Camille.HasBuffOfType(BuffType.Stun) || Camille.HasBuffOfType(BuffType.Taunt)) //not being knocked back by dragon && !Camille.HasBuff("moveawaycollision") //not standing on raka silence && !Camille.HasBuff("sorakaepacify")) { hasDoneActionThisTick = QSS.Cast(); } #endregion #region Mercurials Scimitar if (!hasDoneActionThisTick && MercurialsScimitar.MeetsCriteria() && (Camille.HasBuffOfType(BuffType.Blind) || Camille.HasBuffOfType(BuffType.Charm) || Camille.HasBuffOfType(BuffType.Fear) || Camille.HasBuffOfType(BuffType.Knockback) || Camille.HasBuffOfType(BuffType.Silence) || Camille.HasBuffOfType(BuffType.Snare) || Camille.HasBuffOfType(BuffType.Stun) || Camille.HasBuffOfType(BuffType.Taunt)) //not being knocked back by dragon && !Camille.HasBuff("moveawaycollision") //not standing on raka silence && !Camille.HasBuff("sorakaepacify")) { hasDoneActionThisTick = MercurialsScimitar.Cast(); } #endregion #region Ravenous Hydra if (!hasDoneActionThisTick && RavenousHydra.MeetsCriteria() && Camille.IsAutoCanceling(enemies) && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Camille, a, ItemId.Ravenous_Hydra)).FirstOrDefault() != null) && ( enemies.Where(a => a.Type == GameObjectType.AIHeroClient && a.IsInRange(Camille, 400)).Count() >= MenuHandler.Items.GetSliderValue("Champions to use Tiamat/Ravenous Hydra on") || enemies.Where(a => a.Type != GameObjectType.AIHeroClient && a.IsInRange(Camille, 400)).Count() >= MenuHandler.Items.GetSliderValue("Minions to use Tiamat/Ravenous Hydra on"))) { hasDoneActionThisTick = RavenousHydra.Cast(); } #endregion #region Titanic Hydra if (!hasDoneActionThisTick && TitanicHydra.MeetsCriteria() && enemies.Where(a => a.IsInRange(Camille, Camille.GetAutoAttackRange())).FirstOrDefault() != null && Camille.IsAutoCanceling(enemies) && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Camille, a, ItemId.Titanic_Hydra)).FirstOrDefault() != null)) { hasDoneActionThisTick = TitanicHydra.Cast(); } #endregion #region Tiamat if (!hasDoneActionThisTick && Tiamat.MeetsCriteria() && Camille.IsAutoCanceling(enemies) && enemies.Where(a => a.IsInRange(Camille, 400)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Camille, a, ItemId.Tiamat)).FirstOrDefault() != null) && ( enemies.Where(a => a.Type == GameObjectType.AIHeroClient && a.IsInRange(Camille, 400)).Count() >= MenuHandler.Items.GetSliderValue("Champions to use Tiamat/Ravenous Hydra on") || enemies.Where(a => a.Type != GameObjectType.AIHeroClient && a.IsInRange(Camille, 400)).Count() >= MenuHandler.Items.GetSliderValue("Minions to use Tiamat/Ravenous Hydra on"))) { hasDoneActionThisTick = Tiamat.Cast(); } #endregion #region Youmuus if (!hasDoneActionThisTick && Youmuus.MeetsCriteria() && Camille.CountEnemyHeroesInRangeWithPrediction((int)Camille.GetAutoAttackRange(), 0) >= 1) { hasDoneActionThisTick = Youmuus.Cast(); } #endregion //all targeted spells that must be used on champions must be called after this enemies = enemies.Where(a => a.Type == GameObjectType.AIHeroClient).ToList(); var target = enemies.OrderBy(a => a.Health).FirstOrDefault(); #region Hextech Gunblade if (!hasDoneActionThisTick && target != null && HextechGunblade.MeetsCriteria() && enemies.Where(a => a.IsInRange(Camille, 700)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Camille, a, ItemId.Hextech_Gunblade)).FirstOrDefault() != null)) { hasDoneActionThisTick = HextechGunblade.Cast(target); } #endregion #region BOTRK if (!hasDoneActionThisTick && target != null && BOTRK.MeetsCriteria() && enemies.Where(a => a.IsInRange(Camille, 550)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Camille, a, ItemId.Blade_of_the_Ruined_King)).FirstOrDefault() != null)) { hasDoneActionThisTick = BOTRK.Cast(target); } #endregion #region Bilgewater Cutlass if (!hasDoneActionThisTick && target != null && BilgewaterCutlass.MeetsCriteria() && enemies.Where(a => a.IsInRange(Camille, 550)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Camille, a, ItemId.Bilgewater_Cutlass)).FirstOrDefault() != null)) { hasDoneActionThisTick = BilgewaterCutlass.Cast(target); } #endregion }
private static void updateItems() { hpSlot = BrutalItemInfo.GetHPotionSlot(); seraphs = myHero.InventoryItems.FirstOrDefault(it => (int)it.Id == 3040); Core.DelayAction(updateItems, 5000); }
public InventoryViewModel(Model.Inventories.Inventory inventory, InventorySlot interactionSlot) { SlotViewModels = inventory.Slots.Select(slot => new InventorySlotViewModel(slot, interactionSlot)).ToList(); }
private static void EquipItemIntoSlot(WoWItem item, InventorySlot slot) { EquipItem(item.BagIndex, item.BagSlot, (int)slot); }
private void Game_OnWndProc(WndEventArgs args) { //http://msdn.microsoft.com/en-us/library/windows/desktop/ms632585(v=vs.85).aspx const int WM_KEYDOWN = 0x100; const int WM_LBUTTONUP = 0x202; const int WM_LBUTTONDOWN = 0x201; const int WM_RBUTTONUP = 0x205; const int WM_RBUTTONDOWN = 0x204; if (!IsActive()) { return; } if (MenuGUI.IsChatOpen) { return; } uint trinketKey = WardCorrector_Wards.GetMenuItem("SAssembliesWardsWardCorrectorKey").GetValue <KeyBind>().Key; if (args.Msg == WM_KEYDOWN) { //Console.WriteLine("Hero: " + ObjectManager.Player.ServerPosition); //Console.WriteLine("Cursor: " + Drawing.ScreenToWorld(Utils.GetCursorPos())); InventorySlot inventoryItem = null; int inventoryItemId = -1; if (trinketKey == args.WParam) { _latestSpellSlot = SpellSlot.Trinket; inventoryItemId = 6; } else { _latestSpellSlot = SpellSlot.Unknown; } if (_latestSpellSlot == SpellSlot.Unknown) { switch (args.WParam) { case '1': _latestSpellSlot = SpellSlot.Item1; inventoryItemId = 0; break; case '2': _latestSpellSlot = SpellSlot.Item2; inventoryItemId = 1; break; case '3': _latestSpellSlot = SpellSlot.Item3; inventoryItemId = 2; break; //case trinketKey: // _latestSpellSlot = SpellSlot.Trinket; // inventoryItemId = 6; // break; case '5': _latestSpellSlot = SpellSlot.Item5; inventoryItemId = 3; break; case '6': _latestSpellSlot = SpellSlot.Item6; inventoryItemId = 4; break; case '7': _latestSpellSlot = SpellSlot.Item4; inventoryItemId = 5; break; default: _drawSpots = false; _latestSpellSlot = SpellSlot.Unknown; break; } } foreach (InventorySlot inventorySlot in ObjectManager.Player.InventoryItems) { if (inventorySlot.Slot == inventoryItemId) { inventoryItem = inventorySlot; break; } } if (_latestSpellSlot != SpellSlot.Unknown) { if (inventoryItem != null) { foreach (SAssemblies.Ward.WardItem wardItem in SAssemblies.Ward.WardItems) { if ((int)inventoryItem.Id == wardItem.Id && wardItem.Type != SAssemblies.Ward.WardType.Temp && wardItem.Type != SAssemblies.Ward.WardType.TempVision && ObjectManager.Player.Spellbook.CanUseSpell(_latestSpellSlot) == SpellState.Ready || ObjectManager.Player.Spellbook.CanUseSpell(_latestSpellSlot) == (SpellState)1) { _drawSpots = true; } } if (_drawSpots == false) { _latestSpellSlot = SpellSlot.Unknown; } } } } else if (args.Msg == WM_LBUTTONUP && _drawSpots) { _drawSpots = false; } else if (args.Msg == WM_RBUTTONDOWN && _drawSpots) { _drawSpots = false; } else if (args.Msg == WM_RBUTTONDOWN) { _latestWardSpot = null; } }
public static bool IsValidSlot(this InventorySlot slot) { return(slot != null && slot.SpellSlot != SpellSlot.Unknown); }
public override void Render(SpriteBatch graphics, BFBContentManager content) { base.Render(graphics, content); #region DrawHotbarBorder if (_slotId == _inventory.ActiveSlot && _hotBarMode) { graphics.DrawBorder( new Rectangle( RenderAttributes.X - 2, RenderAttributes.Y - 2, RenderAttributes.Width + 2 * 2, RenderAttributes.Height + 2 * 2), 5, Color.Silver, content.GetTexture("default")); } #endregion #region Draw Item if (_inventory.GetSlots().ContainsKey(_slotId)) { InventorySlot slot = _inventory.GetSlots()[_slotId]; if (string.IsNullOrEmpty(slot.TextureKey)) { return; } AtlasTexture atlas = content.GetAtlasTexture(slot.TextureKey); int padding = Padding; if (_hover) { padding -= 3; } int maxHeight = RenderAttributes.Height - padding * 2; int scale = maxHeight / atlas.Height; int width = atlas.Width * scale; int height = atlas.Height * scale; int x = RenderAttributes.X + padding; int y = RenderAttributes.Y + padding; graphics.DrawAtlas(atlas, new Rectangle(x, y, width, height), Color.White); if (slot.ItemType == ItemType.Wall) { graphics.DrawAtlas(atlas, new Rectangle(x, y, width, height), new Color(0, 0, 0, 0.4f)); } //draw count if (slot.Count <= 1) { return; } #region Draw Stack Count SpriteFont font = content.GetFont(RenderAttributes.FontKey); graphics.DrawString( font, slot.Count.ToString(), new Vector2( RenderAttributes.X + padding, RenderAttributes.Y + padding), Color.White, 0, Vector2.Zero, RenderAttributes.FontSize * (graphics.GraphicsDevice.Viewport.Width / 25f) / font.MeasureString(" ").Y, SpriteEffects.None, 1); #endregion } #endregion }
/// <summary> /// For server only. Create an InventoryApply interaction initiated by the client. /// </summary> /// <param name="clientPlayer">gameobject of the client's player</param> /// <param name="targetObjectSlot">slot of the object that the player is applying their active /// hand to</param> /// <param name="handObject">object in the player's active hand. This parameter is used so /// it doesn't need to be looked up again, since it already should've been looked up in /// the message processing logic. Should match SentByPlayer.Script.playerNetworkActions.GetActiveHandItem().</param> /// <param name="handSlot">Player's active hand. This parameter is used so /// it doesn't need to be looked up again, since it already should've been looked up in /// the message processing logic. Should match SentByPlayer.Script.playerNetworkActions.activeHand.</param> /// <returns>a hand apply by the client, targeting the specified object with the item in the active hand</returns> public static InventoryApply ByClient(GameObject clientPlayer, InventorySlot targetObjectSlot, GameObject handObject, HandSlot handSlot) { return(new InventoryApply(clientPlayer, handObject, targetObjectSlot, handSlot)); }
public static void FleeMode(Vector2 Position, float MinimumRange, float MaximumRange, bool WardTrick = false, List <AIHeroClient> ignore = null) { if (!Q.IsReady() || Player.Mana < Q.ManaCost) { return; } Vector2 PlayerPosition = Player.ServerPosition.To2D(); Obj_AI_Base BestDashingTarget = null; Vector2 BestLocaltion = PlayerPosition + (Vector2.Normalize(Position - PlayerPosition) * (Player.MoveSpeed * 0.35f)); float BestDistance = Position.Distance(PlayerPosition) - 50; foreach (Obj_AI_Base PotancialTarget in ObjectManager.Get <Obj_AI_Base>().Where(target => !target.IsDead && target.IsTargetable && target.IsValidTarget())) { float RealQRange = MaximumRange + PotancialTarget.BoundingRadius; float DistanceToEnemy = Player.Distance(PotancialTarget); //Declaring Minimum And Maximum Range => if (DistanceToEnemy > MinimumRange && DistanceToEnemy < RealQRange) { Vector2 PositionAfterQ = PotancialTarget.ServerPosition.To2D(); float DistanceQ = Position.Distance(PositionAfterQ); if (BestDistance > DistanceQ) { BestDashingTarget = PotancialTarget; BestDistance = DistanceQ; BestLocaltion = PositionAfterQ; } } } if (BestDashingTarget != null) { Q.CastOnUnit(BestDashingTarget); return; } if (BestDashingTarget == null) { if (WardTrick) { SkyLv_Jax.WardPos = Game.CursorPos; Obj_AI_Minion WardObject; if (Game.CursorPos.Distance(Player.Position) <= 700) { WardObject = ObjectManager.Get <Obj_AI_Minion>().Where(Ward => Ward.Distance(Game.CursorPos) < 200 && !Ward.IsDead).MinOrDefault(i => i.Distance(Game.CursorPos)); } else { Vector3 DWpos = Game.CursorPos - Player.ServerPosition; DWpos.Normalize(); SkyLv_Jax.WardPos = Player.ServerPosition + DWpos * (600); WardObject = ObjectManager.Get <Obj_AI_Minion>().Where(Ward => Ward.Distance(SkyLv_Jax.WardPos) < 200 && !Ward.IsDead).MinOrDefault(i => i.Distance(Game.CursorPos)); } if (WardObject == null) { if (!SkyLv_Jax.WardPos.IsWall()) { InventorySlot WardSlot = Items.GetWardSlot(); Items.UseItem((int)WardSlot.Id, SkyLv_Jax.WardPos); } } else if (WardObject != null) { Q.CastOnUnit(WardObject); return; } } } }
public bool Iterate(InventorySlot[] slots, Func<Item, bool> validator) { var contLookup = ItemMgr.ContainerSlotsWithBank; for (var i1 = 0; i1 < slots.Length; i1++) { var avlblSlot = (int)slots[i1]; var item = m_Items[avlblSlot]; if (contLookup[avlblSlot]) { // container var container = item as Container; if (container != null) { var contInv = container.BaseInventory; var contItems = contInv.Items; for (var i = 0; i < contItems.Length; i++) { item = contItems[i]; if (item != null && !validator(item)) { return false; } } } } else if (item != null && !validator(item)) { return false; } } return true; }
public void SetNewUiSlot(InventorySlot slot) { UiSlotList[slot.index].SetUiSlot(slot); }
/// <summary> /// Adds a new default Item to the given slot, if not already existing /// </summary> public void EnsureItem(InventorySlot slot) { Setup.EnsureItemsLoaded(); EnsureItem(InventorySlot.Invalid, (int)slot); }
public void SetUiSlotAmont(InventorySlot slot) { UiSlotList[slot.index].SetAmount(slot.Amount); }
private static SpellDataInst GetItemSpell(InventorySlot invSlot) { return ObjectManager.Player.Spellbook.Spells.FirstOrDefault(spell => (int)spell.Slot == invSlot.Slot + 4); }
/// <summary> /// Add item to the inventory /// </summary> /// <param name="itemPos">Index to add the item</param> /// <param name="item">Item to add</param> public virtual void AddItem(int itemPos, Item item, InventorySlot slot) { inventory[itemPos] = item; slot.AddItemToSlot(item); onInventoryChange.Invoke(); }
/// <summary> /// </summary> /// <param name="client"> /// </param> /// <returns> /// </returns> public static FullCharacterMessage Create(IZoneClient client) { var fullCharacterMessage = new FullCharacterMessage { Identity = client.Character.Identity, Unknown1 = 25 }; /* part 1 of data */ List<InventorySlot> inventory = new List<InventorySlot>(); foreach (IInventoryPage ivp in client.Character.BaseInventory.Pages.Values) { foreach (KeyValuePair<int, IItem> kv in ivp.List()) { var temp = new InventorySlot { Placement = kv.Key, Flags = (short)kv.Value.Flags, Count = (short)kv.Value.MultipleCount, Identity = kv.Value.Identity, ItemLowId = kv.Value.LowID, ItemHighId = kv.Value.HighID, Quality = kv.Value.Quality, Unknown = kv.Value.Nothing }; inventory.Add(temp); } } fullCharacterMessage.InventorySlots = inventory.ToArray(); /* part 2 of data */ /* number of entries */ fullCharacterMessage.UploadedNanoIds = client.Character.UploadedNanos.Select(n => n.NanoId).ToArray(); /* part 3 of data */ /* number of entries */ fullCharacterMessage.Unknown2 = new object[0]; /* No idea what these are */ /* used to be skill locks + some unknown data */ // TODO: Find out what following 6 ints are fullCharacterMessage.Unknown3 = 1; fullCharacterMessage.Unknown4 = 0; fullCharacterMessage.Unknown5 = 1; fullCharacterMessage.Unknown6 = 0; fullCharacterMessage.Unknown7 = 1; fullCharacterMessage.Unknown8 = 0; /* part 6 of data (1-st stats block) */ /* Int32 stat number Int32 stat value */ var stats1 = new List<GameTuple<int, uint>>(); /* State */ AddStat3232(client, stats1, 7); /* UnarmedTemplateInstance */ AddStat3232(client, stats1, 418); /* Invaders Killed */ AddStat3232(client, stats1, 615); /* KilledByInvaders */ AddStat3232(client, stats1, 616); /* AccountFlags */ AddStat3232(client, stats1, 660); /* VP */ AddStat3232(client, stats1, 669); /* UnsavedXP */ AddStat3232(client, stats1, 592); /* NanoFocusLevel */ AddStat3232(client, stats1, 355); /* Specialization */ AddStat3232(client, stats1, 182); /* ShadowBreedTemplate */ AddStat3232(client, stats1, 579); /* ShadowBreed */ AddStat3232(client, stats1, 532); /* LastPerkResetTime */ AddStat3232(client, stats1, 577); /* SocialStatus */ AddStat3232(client, stats1, 521); /* PlayerOptions */ AddStat3232(client, stats1, 576); /* TempSaveTeamID */ AddStat3232(client, stats1, 594); /* TempSavePlayfield */ AddStat3232(client, stats1, 595); /* TempSaveX */ AddStat3232(client, stats1, 596); /* TempSaveY */ AddStat3232(client, stats1, 597); /* VisualFlags */ AddStat3232(client, stats1, 673); /* PvPDuelKills */ AddStat3232(client, stats1, 674); /* PvPDuelDeaths */ AddStat3232(client, stats1, 675); /* PvPProfessionDuelKills */ AddStat3232(client, stats1, 676); /* PvPProfessionDuelDeaths */ AddStat3232(client, stats1, 677); /* PvPRankedSoloKills */ AddStat3232(client, stats1, 678); /* PvPRankedSoloDeaths */ AddStat3232(client, stats1, 679); /* PvPRankedTeamKills */ AddStat3232(client, stats1, 680); /* PvPRankedTeamDeaths */ AddStat3232(client, stats1, 681); /* PvPSoloScore */ AddStat3232(client, stats1, 682); /* PvPTeamScore */ AddStat3232(client, stats1, 683); /* PvPDuelScore */ AddStat3232(client, stats1, 684); AddStat3232(client, stats1, 0x289); AddStat3232(client, stats1, 0x28a); /* SavedXP */ AddStat3232(client, stats1, 334); /* Flags */ AddStat3232(client, stats1, 0); /* Features */ AddStat3232(client, stats1, 224); /* ApartmentsAllowed */ AddStat3232(client, stats1, 582); /* ApartmentsOwned */ AddStat3232(client, stats1, 583); /* MonsterScale */ AddStat3232(client, stats1, 360); /* VisualProfession */ AddStat3232(client, stats1, 368); /* NanoAC */ AddStat3232(client, stats1, 168); AddStat3232(client, stats1, 214); AddStat3232(client, stats1, 221); /* LastConcretePlayfieldInstance */ AddStat3232(client, stats1, 191); /* MapOptions */ AddStat3232(client, stats1, 470); /* MapAreaPart1 */ AddStat3232(client, stats1, 471); /* MapAreaPart2 */ AddStat3232(client, stats1, 472); /* MapAreaPart3 */ AddStat3232(client, stats1, 585); /* MapAreaPart4 */ AddStat3232(client, stats1, 586); /* MissionBits1 */ AddStat3232(client, stats1, 256); /* MissionBits2 */ AddStat3232(client, stats1, 257); /* MissionBits3 */ AddStat3232(client, stats1, 303); /* MissionBits4 */ AddStat3232(client, stats1, 432); /* MissionBits5 */ AddStat3232(client, stats1, 65); /* MissionBits6 */ AddStat3232(client, stats1, 66); /* MissionBits7 */ AddStat3232(client, stats1, 67); /* MissionBits8 */ AddStat3232(client, stats1, 544); /* MissionBits9 */ AddStat3232(client, stats1, 545); /* MissionBits10 */ AddStat3232(client, stats1, 617); AddStat3232(client, stats1, 618); AddStat3232(client, stats1, 619); AddStat3232(client, stats1, 198); /* AutoAttackFlags */ AddStat3232(client, stats1, 349); /* PersonalResearchLevel */ AddStat3232(client, stats1, 263); /* GlobalResearchLevel */ AddStat3232(client, stats1, 264); /* PersonalResearchGoal */ AddStat3232(client, stats1, 265); /* GlobalResearchGoal */ AddStat3232(client, stats1, 266); /* BattlestationSide */ AddStat3232(client, stats1, 668); /* BattlestationRep */ AddStat3232(client, stats1, 670); /* Members */ AddStat3232(client, stats1, 300); fullCharacterMessage.Stats1 = stats1.ToArray(); /* Int32 stat number Int32 stat value */ var stats2 = new List<GameTuple<int, uint>>(); /* VeteranPoints */ AddStat3232(client, stats2, 68); /* MonthsPaid */ AddStat3232(client, stats2, 69); /* PaidPoints */ AddStat3232(client, stats2, 672); /* AutoAttackFlags */ AddStat3232(client, stats2, 349); /* XPKillRange */ AddStat3232(client, stats2, 275); /* InPlay */ AddStat3232(client, stats2, 194); /* Health (current health)*/ AddStat3232(client, stats2, 27); /* Life (max health)*/ AddStat3232(client, stats2, 1); /* Psychic */ AddStat3232(client, stats2, 21); /* Sense */ AddStat3232(client, stats2, 20); /* Intelligence */ AddStat3232(client, stats2, 19); /* Stamina */ AddStat3232(client, stats2, 18); /* Agility */ AddStat3232(client, stats2, 17); /* Strength */ AddStat3232(client, stats2, 16); /* Attitude */ AddStat3232(client, stats2, 63); /* Alignment (Clan Tokens) */ AddStat3232(client, stats2, 62); /* Cash */ AddStat3232(client, stats2, 61); /* Profession */ AddStat3232(client, stats2, 60); /* AggDef */ AddStat3232(client, stats2, 51); /* Icon */ AddStat3232(client, stats2, 79); /* Mesh */ AddStat3232(client, stats2, 12); /* RunSpeed */ AddStat3232(client, stats2, 156); /* DeadTimer */ AddStat3232(client, stats2, 34); /* Team */ AddStat3232(client, stats2, 6); /* Breed */ AddStat3232(client, stats2, 4); /* Sex */ AddStat3232(client, stats2, 59); /* LastSaveXP */ AddStat3232(client, stats2, 372); /* NextXP */ AddStat3232(client, stats2, 350); /* LastXP */ AddStat3232(client, stats2, 57); /* Level */ AddStat3232(client, stats2, 54); /* XP */ AddStat3232(client, stats2, 52); /* IP */ AddStat3232(client, stats2, 53); /* CurrentMass */ AddStat3232(client, stats2, 78); /* ItemType */ AddStat3232(client, stats2, 72); /* PreviousHealth */ AddStat3232(client, stats2, 11); /* CurrentState */ AddStat3232(client, stats2, 423); /* Age */ AddStat3232(client, stats2, 58); /* Side */ AddStat3232(client, stats2, 33); /* WaitState */ AddStat3232(client, stats2, 430); /* DriveWater */ AddStat3232(client, stats2, 117); /* MeleeMultiple */ AddStat3232(client, stats2, 101); /* LR_MultipleWeapon */ AddStat3232(client, stats2, 134); /* LR_EnergyWeapon */ AddStat3232(client, stats2, 133); /* RadiationAC */ AddStat3232(client, stats2, 94); /* SenseImprovement */ AddStat3232(client, stats2, 122); /* BowSpecialAttack */ AddStat3232(client, stats2, 121); /* Burst */ AddStat3232(client, stats2, 148); /* FullAuto */ AddStat3232(client, stats2, 167); /* MapNavigation */ AddStat3232(client, stats2, 140); /* DriveAir */ AddStat3232(client, stats2, 139); /* DriveGround */ AddStat3232(client, stats2, 166); /* BreakingEntry */ AddStat3232(client, stats2, 165); /* Concealment */ AddStat3232(client, stats2, 164); /* Chemistry */ AddStat3232(client, stats2, 163); /* Psychology */ AddStat3232(client, stats2, 162); /* ComputerLiteracy */ AddStat3232(client, stats2, 161); /* NanoProgramming */ AddStat3232(client, stats2, 160); /* Pharmaceuticals */ AddStat3232(client, stats2, 159); /* WeaponSmithing */ AddStat3232(client, stats2, 158); /* FieldQuantumPhysics */ AddStat3232(client, stats2, 157); /* AttackSpeed */ AddStat3232(client, stats2, 3); /* Evade */ AddStat3232(client, stats2, 155); /* Dodge */ AddStat3232(client, stats2, 154); /* Duck */ AddStat3232(client, stats2, 153); /* BodyDevelopment */ AddStat3232(client, stats2, 152); /* AimedShot */ AddStat3232(client, stats2, 151); /* FlingShot */ AddStat3232(client, stats2, 150); /* NanoProwessInitiative */ AddStat3232(client, stats2, 149); /* FastAttack */ AddStat3232(client, stats2, 147); /* SneakAttack */ AddStat3232(client, stats2, 146); /* Parry */ AddStat3232(client, stats2, 145); /* Dimach */ AddStat3232(client, stats2, 144); /* Riposte */ AddStat3232(client, stats2, 143); /* Brawl */ AddStat3232(client, stats2, 142); /* Tutoring */ AddStat3232(client, stats2, 141); /* Swim */ AddStat3232(client, stats2, 138); /* Adventuring */ AddStat3232(client, stats2, 137); /* Perception */ AddStat3232(client, stats2, 136); /* DisarmTraps */ AddStat3232(client, stats2, 135); /* NanoEnergyPool */ AddStat3232(client, stats2, 132); /* MaterialLocation */ AddStat3232(client, stats2, 131); /* MaterialCreation */ AddStat3232(client, stats2, 130); /* PsychologicalModification */ AddStat3232(client, stats2, 129); /* BiologicalMetamorphose */ AddStat3232(client, stats2, 128); /* MaterialMetamorphose */ AddStat3232(client, stats2, 127); /* ElectricalEngineering */ AddStat3232(client, stats2, 126); /* MechanicalEngineering */ AddStat3232(client, stats2, 125); /* Treatment */ AddStat3232(client, stats2, 124); /* FirstAid */ AddStat3232(client, stats2, 123); /* PhysicalProwessInitiative */ AddStat3232(client, stats2, 120); /* DistanceWeaponInitiative */ AddStat3232(client, stats2, 119); /* CloseCombatInitiative */ AddStat3232(client, stats2, 118); /* AssaultRifle */ AddStat3232(client, stats2, 116); /* Shotgun */ AddStat3232(client, stats2, 115); /* SubMachineGun */ AddStat3232(client, stats2, 114); /* Rifle */ AddStat3232(client, stats2, 113); /* Pistol */ AddStat3232(client, stats2, 112); /* Bow */ AddStat3232(client, stats2, 111); /* ThrownGrapplingWeapons */ AddStat3232(client, stats2, 110); /* Grenade */ AddStat3232(client, stats2, 109); /* ThrowingKnife */ AddStat3232(client, stats2, 108); /* 2HBluntWeapons */ AddStat3232(client, stats2, 107); /* Piercing */ AddStat3232(client, stats2, 106); /* 2HEdgedWeapons */ AddStat3232(client, stats2, 105); /* MeleeEnergyWeapon */ AddStat3232(client, stats2, 104); /* 1HEdgedWeapons */ AddStat3232(client, stats2, 103); /* 1HBluntWeapons */ AddStat3232(client, stats2, 102); /* MartialArts */ AddStat3232(client, stats2, 100); /* Alignment (Clan Tokens) */ AddStat3232(client, stats2, 62); /* MetaType (Omni Tokens) */ AddStat3232(client, stats2, 75); /* TitleLevel */ AddStat3232(client, stats2, 37); /* GmLevel */ AddStat3232(client, stats2, 215); /* FireAC */ AddStat3232(client, stats2, 97); /* PoisonAC */ AddStat3232(client, stats2, 96); /* ColdAC */ AddStat3232(client, stats2, 95); /* RadiationAC */ AddStat3232(client, stats2, 94); /* ChemicalAC */ AddStat3232(client, stats2, 93); /* EnergyAC */ AddStat3232(client, stats2, 92); /* MeleeAC */ AddStat3232(client, stats2, 91); /* ProjectileAC */ AddStat3232(client, stats2, 90); /* RP */ AddStat3232(client, stats2, 199); /* SpecialCondition */ AddStat3232(client, stats2, 348); /* SK */ AddStat3232(client, stats2, 573); /* Expansions */ AddStat3232(client, stats2, 389); /* ClanRedeemed */ AddStat3232(client, stats2, 572); /* ClanConserver */ AddStat3232(client, stats2, 571); /* ClanDevoted */ AddStat3232(client, stats2, 570); /* OTUnredeemed */ AddStat3232(client, stats2, 569); /* OTOperator */ AddStat3232(client, stats2, 568); /* OTFollowers */ AddStat3232(client, stats2, 567); /* GOS */ AddStat3232(client, stats2, 566); /* ClanVanguards */ AddStat3232(client, stats2, 565); /* OTTrans */ AddStat3232(client, stats2, 564); /* ClanGaia */ AddStat3232(client, stats2, 563); /* OTMed*/ AddStat3232(client, stats2, 562); /* ClanSentinels */ AddStat3232(client, stats2, 561); /* OTArmedForces */ AddStat3232(client, stats2, 560); /* SocialStatus */ AddStat3232(client, stats2, 521); /* PlayerID */ AddStat3232(client, stats2, 607); /* KilledByInvaders */ AddStat3232(client, stats2, 616); /* InvadersKilled */ AddStat3232(client, stats2, 615); /* AlienLevel */ AddStat3232(client, stats2, 169); /* AlienNextXP */ AddStat3232(client, stats2, 178); /* AlienXP */ AddStat3232(client, stats2, 40); fullCharacterMessage.Stats2 = stats2.ToArray(); /* Byte stat number Byte stat value */ var stats3 = new List<GameTuple<byte, byte>>(); /* InsurancePercentage */ AddStat88(client, stats3, 236); /* ProfessionLevel */ AddStat88(client, stats3, 10); /* PrevMovementMode */ AddStat88(client, stats3, 174); /* CurrentMovementMode */ AddStat88(client, stats3, 173); /* Fatness */ AddStat88(client, stats3, 47); /* Race */ AddStat88(client, stats3, 89); /* TeamSide */ AddStat88(client, stats3, 213); /* BeltSlots */ AddStat88(client, stats3, 45); fullCharacterMessage.Stats3 = stats3.ToArray(); /* Byte stat number Int16 (short) stat value */ var stats4 = new List<GameTuple<byte, short>>(); /* AbsorbProjectileAC */ AddStat816(client, stats4, 238); /* AbsorbMeleeAC */ AddStat816(client, stats4, 239); /* AbsorbEnergyAC */ AddStat816(client, stats4, 240); /* AbsorbChemicalAC */ AddStat816(client, stats4, 241); /* AbsorbRadiationAC */ AddStat816(client, stats4, 242); /* AbsorbColdAC */ AddStat816(client, stats4, 243); /* AbsorbNanoAC */ AddStat816(client, stats4, 246); /* AbsorbFireAC */ AddStat816(client, stats4, 244); /* AbsorbPoisonAC */ AddStat816(client, stats4, 245); /* TemporarySkillReduction */ AddStat816(client, stats4, 247); /* InsuranceTime */ AddStat816(client, stats4, 49); /* CurrentNano */ AddStat816(client, stats4, 214); /* maxMaxNanoEnergyEnergy */ AddStat816(client, stats4, 221); /* MaxNCU */ AddStat816(client, stats4, 181); /* MapFlags */ AddStat816(client, stats4, 9); /* ChangeSideCount */ AddStat816(client, stats4, 237); fullCharacterMessage.Stats4 = stats4.ToArray(); /* ? */ fullCharacterMessage.Unknown9 = 0; /* ? */ fullCharacterMessage.Unknown10 = 0; fullCharacterMessage.Unknown11 = new object[0]; fullCharacterMessage.Unknown12 = new object[0]; fullCharacterMessage.Unknown13 = new object[0]; return fullCharacterMessage; }
public void SetItemSlot(InventorySlot slot) { this.slot = slot; }
/// <summary> /// Initializes a new instance of the <see cref="InventoryItemPB"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="pos">The relative position of the control.</param> /// <param name="slot">The <see cref="InventorySlot"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="parent" /> is <c>null</c>.</exception> public InventoryItemPB(InventoryForm parent, Vector2 pos, InventorySlot slot) : base(parent, pos, _itemSize) { if (parent == null) throw new ArgumentNullException("parent"); _slot = slot; Tooltip = _tooltipHandler; }
void GetText(SelectionState selectionState) { if (selectionState.selectionMode == SelectionMode.Conveyor) { sb.Append("<color=#"); sb.Append(colorTextHex); sb.AppendLine("><b>Conveyor</b>"); sb.Append("<color=#"); sb.Append(colorPriceHex); sb.Append(">Price: </b>$"); sb.Append(CurrencySystem.instance.conveyorCost); sb.Append("</b><color=#"); sb.Append(colorTextHex); sb.AppendLine(">"); sb.AppendFormat("Transfers items from one machine to another. Transfers up to <b>{0}</b> items per second.", Conveyor.throughput.ToString("#")); } else if (selectionState.selectionMode == SelectionMode.Machine && selectionState.machineInfo) { MachineInfo machineInfo = selectionState.machineInfo; Machine machine = selectionState.machine; sb.Append("<color=#"); sb.Append(colorTextHex); sb.Append("><b>"); sb.Append(machineInfo.name); sb.AppendLine("</b>"); if (machine) { sb.Append("<color=#"); sb.Append(colorTextHex); sb.Append(">"); sb.Append("Efficiency: <b>"); sb.Append("<color=#"); sb.Append(colorEfficiencyHex); sb.Append(">"); sb.Append(Mathf.RoundToInt(machine.machineEfficiency.efficiency * 100)); sb.Append("%</b>"); sb.AppendLine(); } else { sb.Append("<color=#"); sb.Append(colorTextHex); sb.Append(">Price: <color=#"); sb.Append(colorPriceHex); sb.Append("><b>$"); sb.Append(machineInfo.cost); sb.Append("</b>"); sb.AppendLine(); } if (machineInfo.purchaseItem.itemInfo) { string cost = machineInfo.purchaseItem.itemInfo.value == 0 ? "" : string.Format("for <color=#{0}><b>${1}</b><color=#{2}>", colorPriceHex, machineInfo.purchaseItem.itemInfo.value * machineInfo.purchaseItem.count, colorTextHex); sb.AppendFormat("<color=#{0}>Buys <color=#{1}><b>{2}</b> {3}<color=#{4}> {5} every <b>{6}</b> {7} and outputs it to conveyors.", colorTextHex, machineInfo.purchaseItem.itemInfo.colorHex, machineInfo.purchaseItem.count, machineInfo.purchaseItem.itemInfo.itemName, colorTextHex, cost, machineInfo.placeInterval, Mathf.Approximately(machineInfo.placeInterval, 1f) ? "second" : "seconds"); } else if (machineInfo.sellItem.itemInfo) { sb.AppendFormat("<color=#{0}>Sells <color=#{1}><b>{2}</b> {3}<color=#{4}> for <color=#{5}><b>${6}</b><color=#{7}> every <b>{8}</b> {9}.", colorTextHex, machineInfo.sellItem.itemInfo.colorHex, machineInfo.sellItem.count, machineInfo.sellItem.itemInfo.itemName, colorTextHex, colorPriceHex, machineInfo.sellItem.itemInfo.value * machineInfo.sellItem.count, colorTextHex, machineInfo.placeInterval, Mathf.Approximately(machineInfo.placeInterval, 1f) ? "second" : "seconds"); } else if (machineInfo.assembler) { sbInputs.Clear(); for (int i = 0, len = machineInfo.assembleInputs.Length; i < len; ++i) { if (i > 0) { if (i != len - 1) { sbInputs.Append(", "); } else { sbInputs.Append(" and "); } } sbInputs.Append("<color=#"); sbInputs.Append(machineInfo.assembleInputs[i].itemInfo.colorHex); sbInputs.Append("><b>"); sbInputs.Append(machineInfo.assembleInputs[i].count); sbInputs.Append("</b> "); sbInputs.Append(machineInfo.assembleInputs[i].itemInfo.itemNameLower); sbInputs.Append("<color=#"); sbInputs.Append(colorTextHex); sbInputs.Append(">"); } sb.AppendFormat("<color=#{0}>Consumes {1} to produce <color=#{2}><b>{3}</b> {4}<color=#{5}> every <b>{6}</b> {7} and outputs it to conveyors.", colorTextHex, sbInputs, machineInfo.assembleOutput.itemInfo.colorHex, machineInfo.assembleOutput.count, machineInfo.assembleOutput.itemInfo.itemName, colorTextHex, machineInfo.placeInterval, Mathf.Approximately(machineInfo.placeInterval, 1f) ? "second" : "seconds"); } if (selectionState.machine && selectionState.machine.inventory.slots.Length > 0) { InventorySlot[] inventory = selectionState.machine.inventory.slots; sb.AppendLine(); sb.AppendFormat("<b>Inventory</b>"); for (int i = 0, len = inventory.Length; i < len; ++i) { InventorySlot slot = inventory[i]; sb.Append(" <color=#"); sb.Append(slot.itemInfo.colorHex); sb.Append('>'); sb.Append(slot.itemInfo.itemName); sb.Append(":<color=#"); sb.Append(colorTextHex); sb.Append("> <b>"); sb.Append(slot.count); sb.Append("</b>/"); sb.Append(slot.capacity); } } } }