コード例 #1
0
ファイル: NewChrAsm.cs プロジェクト: Hal47/DSAnimStudio
 public void LoadArmorPartsbnd(string partsbndPath, EquipSlot slot)
 {
     if (System.IO.File.Exists(partsbndPath))
     {
         if (BND3.Is(partsbndPath))
         {
             LoadArmorPartsbnd(BND3.Read(partsbndPath), slot);
         }
         else
         {
             LoadArmorPartsbnd(BND4.Read(partsbndPath), slot);
         }
     }
     else
     {
         if (slot == EquipSlot.Head)
         {
             HeadMesh?.Dispose();
         }
         else if (slot == EquipSlot.Body)
         {
             BodyMesh?.Dispose();
         }
         else if (slot == EquipSlot.Arms)
         {
             ArmsMesh?.Dispose();
         }
         else if (slot == EquipSlot.Legs)
         {
             LegsMesh?.Dispose();
         }
     }
 }
コード例 #2
0
ファイル: Item.cs プロジェクト: TheCommieDuck/DarkRL
 public Item(Level l)
     : base(l)
 {
     Slot = EquipSlot.None;
     IsEquipped = false;
     ViewPriority = 0;
 }
コード例 #3
0
    public void CmdRequestMeleeAttackSlot(GameObject victim, EquipSlot slot, Vector2 stabDirection,
                                          BodyPartType damageZone, LayerType layerType)
    {
        var weapon = playerScript.playerNetworkActions.Inventory[slot].Item;

        CmdRequestMeleeAttack(victim, weapon, stabDirection, damageZone, layerType);
    }
コード例 #4
0
    public void EquipItem(EquipSlot item) //Item item, Transform visualLocation).
    {
        if (item.visualLocation == null)
        {
            return;
        }

        foreach (Transform child in item.visualLocation)
        {
            GameObject.Destroy(child.gameObject);
        }

        if (item.EquipedItem.Mesh == null)
        {
            return;
        }

        GameObject meshInstance = Instantiate(item.EquipedItem.Mesh, item.visualLocation);

        meshInstance.transform.localPosition = item.offset;
        OffsetLocation offset = meshInstance.GetComponent <OffsetLocation>();

        if (offset != null)
        {
            meshInstance.transform.localPosition += offset.postionOffset;
            meshInstance.transform.localRotation  = Quaternion.Euler(offset.rotationOffset);
            meshInstance.transform.localScale     = offset.scaleOffset;
        }
    }
コード例 #5
0
        //will generalize and move this
        private string GetNameForSlot(EquipSlot slot, CharacterModel pModel)
        {
            if (!pModel.Equipped.ContainsKey(slot))
            {
                return("none");
            }

            InventoryItemInstance itemInstance = pModel.Equipped[slot];

            if (itemInstance != null)
            {
                var def = InventoryModel.GetDef(itemInstance.ItemModel.Name);
                if (def != null)
                {
                    return(def.NiceName);
                }
                else
                {
                    return(itemInstance.ItemModel.Name);
                }
            }
            else
            {
                return("none");
            }
        }
コード例 #6
0
 public void OnDeselect(ItemSlot slot)
 {
     if (equipSlots.Contains(slot as EquipSlot))
     {
         currentSelectedSlot = null;
     }
 }
コード例 #7
0
ファイル: GameManager.cs プロジェクト: maqqr/7drl2019
        internal void PlayerThrowItem(EquipSlot slot)
        {
            var player = playerObject.GetComponent <Creature>();

            if (player.Equipment.ContainsKey(slot))
            {
                var removedItem = player.Equipment[slot];
                player.RemoveItem(removedItem, 1);

                if (removedItem.Count == 1 && player.HasItemInSlot(removedItem, EquipSlot.LeftHand) && player.HasItemInSlot(removedItem, EquipSlot.RightHand))
                {
                    PlayerUnequip(slot);
                }

                if (removedItem.Count <= 0)
                {
                    PlayerUnequip(slot);
                }

                // var spawnRot = Quaternion.LookRotation(Camera.transform.right);
                Vector3 spawnPos = Utils.ConvertToWorldCoord(player.Position) + new Vector3(0f, 0.5f, 0f)
                                   + player.gameObject.transform.forward * 0.4f;
                var spawnedItem = SpawnItem(removedItem.ItemKey, spawnPos, Quaternion.identity);
                Utils.Alignment(spawnedItem.transform, spawnedItem.transform.Find("Grab").transform, Camera.transform);

                var rigidbody = spawnedItem.GetComponent <Rigidbody>();
                rigidbody.isKinematic            = false;
                rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
                rigidbody.AddForce(Camera.transform.forward * 10f, ForceMode.Impulse);
                AdvanceTime(playerObject.GetComponent <Creature>().Speed);
                lightingDirty = 15;
            }
        }
コード例 #8
0
        /// <summary>
        /// Handles an <see cref="InventoryActionPkt"/> to handle. Ran on server and client.
        /// </summary>
        /// <param name="action">The <see cref="InventoryAction"/> to run</param>
        /// <param name="relatedInt">The item related to the action.</param>
        /// <returns>Weather the action failed or not.</returns>
        public bool HandleAction(InventoryAction action, int[] intList)
        {
            switch (action)
            {
            case InventoryAction.Equip:
                Inventory.Drive.EquipItem(intList[0]);
                return(true);

            case InventoryAction.Unequip:
                EquipSlot Slot = (EquipSlot)intList[0];
                Inventory.Drive.UnequipSlot(Slot);
                return(true);

            case InventoryAction.Use:
                EquipSlot UseSlot = (EquipSlot)intList[0];
                Item      UseItem = Inventory.Drive.GetSlot(UseSlot);
                if (UseItem != null && UseItem.Action != null && Character != null &&
                    (!Client.IsRunning() || Client.GetConnectedPlayer().Character != Character))
                {
                    // Item exists, it has an action, and the character
                    // isn't controlled by the client (no double-actions).
                    UseItem.Action(Character);
                    return(true);
                }
                return(false);

            case InventoryAction.Switch:
                if (!Client.IsRunning() || Client.GetConnectedPlayer().Character != Character)
                {
                    Inventory.Drive.SwitchSlots(intList[0], intList[1]);
                }
                return(true);
            }
            return(false);
        }
コード例 #9
0
        public void RemoveItem(EquipSlot slot)
        {
            // Already nothing in that slot.
            if (Items[(int)slot - 1] == null)
            {
                // TODO: generate warning?
                return;
            }

            // Subtract the item's stats from the summary.
            GearItem item = Items[(int)slot - 1];

            foreach (Materia materia in item.Materia)
            {
                StatSummary[materia.Stat] -= materia.Value;
            }
            foreach (CharacterStat stat in item.Stats.Keys)
            {
                StatSummary[stat] -= item.Stats[stat];
            }

            // Remove the item.
            Items[(int)slot - 1] = null;

            return;
        }
コード例 #10
0
        public void EquipItemTo(InventoryData inventory, int islot, EquipSlot eslot)
        {
            InventoryItemData invt_slot  = inventory.GetItem(islot);
            InventoryItemData invt_equip = EquipData.GetEquippedItem(eslot);
            ItemData          idata      = ItemData.Get(invt_slot?.item_id);
            ItemData          edata      = ItemData.Get(invt_equip?.item_id);

            if (invt_slot != null && inventory != EquipData && invt_slot.quantity > 0 && idata != null && eslot > 0)
            {
                if (edata == null)
                {
                    //Equip only
                    EquipData.EquipItem(eslot, idata.id, invt_slot.durability, invt_slot.uid);
                    inventory.RemoveItemAt(islot, 1);
                }
                else if (invt_slot.quantity == 1 && idata.type == ItemType.Equipment)
                {
                    //Swap
                    inventory.RemoveItemAt(islot, 1);
                    EquipData.UnequipItem(eslot);
                    EquipData.EquipItem(eslot, idata.id, invt_slot.durability, invt_slot.uid);
                    inventory.AddItemAt(edata.id, islot, 1, invt_equip.durability, invt_equip.uid);
                }
            }
        }
コード例 #11
0
        public void UnequipItemTo(InventoryData inventory, EquipSlot eslot, int islot)
        {
            InventoryItemData invt_slot  = inventory.GetItem(islot);
            InventoryItemData invt_equip = EquipData.GetEquippedItem(eslot);
            ItemData          idata      = ItemData.Get(invt_slot?.item_id);
            ItemData          edata      = ItemData.Get(invt_equip?.item_id);

            if (edata != null && inventory != EquipData && inventory.uid != invt_equip.uid)
            {
                bool same_item  = idata != null && invt_slot != null && invt_slot.quantity > 0 && idata.id == edata.id && invt_slot.quantity < idata.inventory_max;
                bool slot_empty = invt_slot == null || invt_slot.quantity <= 0;
                if (same_item || slot_empty)
                {
                    //Unequip
                    EquipData.UnequipItem(eslot);
                    inventory.AddItemAt(edata.id, islot, 1, invt_equip.durability, invt_equip.uid);
                }
                else if (idata != null && invt_slot != null && !same_item && idata.type == ItemType.Equipment && idata.equip_slot == edata.equip_slot && invt_slot.quantity == 1)
                {
                    //swap
                    inventory.RemoveItemAt(islot, 1);
                    EquipData.UnequipItem(eslot);
                    EquipData.EquipItem(eslot, idata.id, invt_slot.durability, invt_slot.uid);
                    inventory.AddItemAt(edata.id, islot, 1, invt_equip.durability, invt_equip.uid);
                }
            }
        }
コード例 #12
0
    [Command]     //Remember with the parent you can only send networked objects:
    public void CmdPlaceItem(EquipSlot equipSlot, Vector3 pos, GameObject newParent, bool isTileMap)
    {
        if (playerScript.canNotInteract() || !playerScript.IsInReach(pos, true))
        {
            return;
        }

        var        inventorySlot = Inventory[equipSlot];
        GameObject item          = inventorySlot.Item;

        if (item != null && newParent != null)
        {
            InventoryManager.DropItem(inventorySlot.Item, pos, this);
            if (isTileMap)
            {
                TileChangeManager tileChangeManager = newParent.GetComponentInParent <TileChangeManager>();
                //item.transform.parent = tileChangeManager.ObjectParent.transform; TODO
            }
            else
            {
                item.transform.parent = newParent.transform;
            }

            // TODO
            //ReorderGameobjectsOnTile(pos);
        }
    }
コード例 #13
0
        // ----- Equip Items ----

        public void EquipItem(EquipSlot equip_slot, string item_id, float durability, string uid)
        {
            int eslot = (int)equip_slot;
            InventoryItemData idata = new InventoryItemData(item_id, 1, durability, uid);

            items[eslot] = idata;
        }
コード例 #14
0
    public void CmdThrow(EquipSlot equipSlot, Vector3 worldTargetPos, int aim)
    {
        var inventorySlot = Inventory[equipSlot];

        if (playerScript.canNotInteract() || equipSlot != EquipSlot.leftHand && equipSlot != EquipSlot.rightHand ||
            !SlotNotEmpty(equipSlot))
        {
            return;
        }

        GameObject throwable = inventorySlot.Item;
        Vector3    playerPos = playerScript.PlayerSync.ServerState.WorldPosition;

        InventoryManager.ClearInvSlot(inventorySlot);

        var throwInfo = new ThrowInfo
        {
            ThrownBy  = gameObject,
            Aim       = (BodyPartType)aim,
            OriginPos = playerPos,
            TargetPos = worldTargetPos,
            //Clockwise spin from left hand and Counterclockwise from the right hand
            SpinMode = equipSlot == EquipSlot.leftHand ? SpinMode.Clockwise : SpinMode.CounterClockwise,
        };

        throwable.GetComponent <CustomNetTransform>().Throw(throwInfo);

        //Simplified counter-impulse for players in space
        if (playerScript.PlayerSync.IsWeightlessServer)
        {
            playerScript.PlayerSync.Push(Vector2Int.RoundToInt(-throwInfo.Trajectory.normalized));
        }
    }
コード例 #15
0
ファイル: Equipment.cs プロジェクト: ccTam/RPG_Project
 public void ItemInit(int ID, string name, Sprite icon, bool isDefaultItem, EquipSlot equipSlot, WeaponType weaponID, bool isUsable, int maxStack, string tooltip, int goldValue, float str, float dex, float inte, float will, float luck, float minDam, float maxDam, float bal, float crit, float pDef, float pPro, float mDef, float mPro)
 {
     this.itemID        = ID;
     this.itemType      = ItemType.EQUIPMENT;
     this._name         = name;
     this.name          = "I" + name;
     this.icon          = icon;
     this.isDefaultItem = isDefaultItem;
     this.equipSlot     = equipSlot;
     this.weaponID      = weaponID;
     this.isUsable      = isUsable;
     this.maxStack      = maxStack;
     this.tooltip       = tooltip;
     this.str           = str;
     this.dex           = dex;
     this.inte          = inte;
     this.will          = will;
     this.luck          = luck;
     this.minDam        = minDam;
     this.maxDam        = maxDam;
     this.bal           = bal;
     this.critr         = crit;
     this.pDef          = pDef;
     this.pPro          = pPro;
     this.mDef          = mDef;
     this.mPro          = mPro;
     this.goldValue     = goldValue;
     this.resellValue   = (int)(this.goldValue * .1f);
 }
コード例 #16
0
ファイル: StatsInterface.cs プロジェクト: nalgol/WarEmu
        public int CalculDamage(EquipSlot Slot, Unit Target)
        {
            if (!HasUnit())
                return 0;

            Unit Me = GetUnit();

            if (Me.IsPlayer())
            {
                float Str = GetTotalStat((byte)GameData.Stats.STATS_STRENGTH);
                float Tou = GetTotalStat((byte)GameData.Stats.STATS_TOUGHNESS);
                float Wdps = (float)Me.ItmInterface.GetAttackDamage(Slot) / 10f;
                if (Slot == EquipSlot.MAIN_DROITE)
                    Wdps = (Wdps * 45f) * 0.01f;

                float WSpeed = Me.ItmInterface.GetAttackTime(Slot);
                WSpeed /= 100;

                return (int)(((Str / 10) + Wdps) * WSpeed);
            }
            else if (Me.IsCreature())
            {
                float Damage = (int)(20f + (5f * (float)Me.Level + (float)Me.Rank * 10f));

                if (Me.Level > Target.Level)
                    Damage += ((float)Me.Level - (float)Target.Level) * 8f;
                else if (Target.Level > Me.Level)
                    Damage = Damage - ((float)Target.Level - (float)Me.Level) * 3f;

                return (int)Damage;
            }

            return 1;
        }
コード例 #17
0
        /// <summary>
        ///     Get the model for the current item and a specific character type.
        /// </summary>
        /// <param name="characterType">Character type to get the model for.</param>
        /// <param name="materialVersion">When this method returns contains the variant of the model for the current item.</param>
        /// <returns>The model for the current item and <c>characterType</c>.</returns>
        public ModelDefinition GetModel(int characterType, out Graphics.ImcVariant variant)
        {
            variant = Graphics.ImcVariant.Default;
            EquipSlot slot = EquipSlotCategory.PossibleSlots.FirstOrDefault();

            return(slot == null ? null : GetModel(slot, characterType, out variant));
        }
コード例 #18
0
ファイル: AutoEquipScript.cs プロジェクト: wampirr/IceFlake
        private void EquipItem(WoWItem item, EquipSlot slot)
        {
            int bi, bs;

            item.GetSlotIndexes(out bi, out bs);
            WoWScript.ExecuteNoResults(string.Format("ClearCursor(); PickupContainerItem({0}, {1}); EquipCursorItem({2})", bi, bs, (int)slot));
        }
コード例 #19
0
    //Server only:
    /// <summary>
    /// Get an Inventory slot from originators hand id (i.e leftHand)
    /// Can only be used ont he server
    /// </summary>
    /// <param name="originator"></param>
    /// <param name="hand"></param>
    /// <returns></returns>
    public static InventorySlot GetSlotFromOriginatorHand(GameObject originator, EquipSlot hand)
    {
        var pna  = originator.GetComponent <PlayerNetworkActions>();
        var slot = pna.Inventory[hand];

        return(slot);
    }
コード例 #20
0
 public void EquipSlotHoverOver(EquipSlot slot)
 {
     if (slot.Equipment() != null)
     {
         slot.Equipment().OpenStatWindow("Inventory");
     }
 }
コード例 #21
0
ファイル: WoWLocalPlayer.cs プロジェクト: Fernir/cleanLayer
        public WoWItem GetEquippedItem(EquipSlot slot)
        {
            var entry = GetDescriptor <uint>((int)PlayerField.PLAYER_VISIBLE_ITEM_1_ENTRYID + ((int)slot * 0x8));
            var item  = Items.Where(x => x.Entry == entry).FirstOrDefault() ?? WoWItem.Invalid;

            return(item);
        }
コード例 #22
0
    public void EquipSlotLeftClicked(EquipSlot slot)
    {
        MouseSlot mouseSlot = MouseSlot.instance;
        Item      mouseItem = MouseSlot.instance.Item();

        if (slotClickHelper.CheckItemType() == false)
        {
            return;
        }

        if (mouseItem == null && slot.Equipment() == null) //or slot.Equipment() == naked or unarmed?
        {
            Debug.Log("BOTH SLOTS EMPTY");
            return;
        }

        if (mouseItem == null && slot.Equipment() != null)
        {
            slotClickHelper.PickUpItemIntoEmptyMouseSlot(mouseSlot, slot);
            return;
        }

        if (mouseItem != null && slot.Equipment() == null) //or slot.Equipment() == naked or unarmed?
        {
            slotClickHelper.PlaceItemInEmptySlot(mouseSlot, slot);
            return;
        }

        if (mouseItem != null && slot.Equipment() != null) //or slot.Equipment() == naked or unarmed?
        {
            slotClickHelper.SwapItems(mouseSlot, slot);
            return;
        }
    }
コード例 #23
0
    void ShowUpgradeConsume(int _quality, EquipSlot _slot)
    {
        MountEquQuailtRef upgradeConsumeRef = ConfigMng.Instance.GetMountEquipQualityRef(_quality, _slot);

        if (upgradeConsumeRef != null && upgradeConsume != null)
        {
            StringBuilder builder = new StringBuilder();
            for (int i = 0, max = upgradeConsumeRef.consume.Count; i < max; i++)
            {
                ItemValue item = upgradeConsumeRef.consume[i];
                if (item.eid == 5 || item.eid == 6)
                {
                    builder.Append(GameHelper.GetStringWithBagNumber(item));
                }
                else
                {
                    builder.Append(GameHelper.GetStringWithBagNumber(item, out enoughUpgrade, out lackUpgradeItem));
                }
                if (i < max - 1)
                {
                    builder.Append("\n");
                }
            }
            if (upgradeConsume != null)
            {
                upgradeConsume.text = builder.ToString();
            }
        }
    }
コード例 #24
0
        public ViewModelOptions(InventoryItemInstance itemInstance, EquipSlot slot, PlayerWeaponComponent weaponComponent, WeaponViewShakeScript shakeComponent, WeaponMovebobComponent movebobComponent)
        {
            var wim = itemInstance.ItemModel as WeaponItemModel;

            UseShake     = wim.CheckFlag(ItemFlag.WeaponShake);
            UseMovebob   = !wim.CheckFlag(ItemFlag.WeaponNoMovebob);
            UseCrosshair = wim.CheckFlag(ItemFlag.WeaponUseCrosshair);
            AdsCrosshair = wim.CheckFlag(ItemFlag.WeaponCrosshairInADS);
            UseCharge    = wim.CheckFlag(ItemFlag.WeaponHasCharge);
            UseRecock    = wim.CheckFlag(ItemFlag.WeaponHasRecock);

            switch (slot)
            {
            case EquipSlot.LeftWeapon:
                Side = ViewModelSide.Left;
                break;

            case EquipSlot.RightWeapon:
                Side = ViewModelSide.Right;
                break;

            default:
                Side = ViewModelSide.Undefined;
                break;
            }

            WeaponItemInstance = itemInstance;
            WeaponComponent    = weaponComponent;
            ShakeComponent     = shakeComponent;
            MovebobComponent   = movebobComponent;
        }
コード例 #25
0
ファイル: GameManager.cs プロジェクト: maqqr/7drl2019
        internal void PlayerEquip(InventoryItem item, EquipSlot slot)
        {
            var       player    = playerCreature;
            EquipSlot otherHand = slot == EquipSlot.LeftHand ? EquipSlot.RightHand : EquipSlot.LeftHand;

            // Unequip old item
            if (player.Equipment.ContainsKey(slot))
            {
                PlayerUnequip(slot);
            }

            // One item cannot be held in both hands
            if (item.Count == 1 && player.HasItemInSlot(item, otherHand))
            {
                PlayerUnequip(otherHand);
            }

            player.Equipment[slot] = item;
            lightingDirty          = 5;

            var handObj = GetEquipTransformForSlot(playerCreature, slot);

            if (handObj == null)
            {
                Debug.Log("asd");
            }
            SpawnItemToHand(handObj.transform, item.ItemKey);
        }
コード例 #26
0
 public void TryEquipItem(EquipSlot equipSlot, Item item)
 {
     if (CanEquipItem(equipSlot, item))
     {
         EquipItem(item);
     }
 }
コード例 #27
0
 /// <summary>
 /// 筛选继承副装备,只需根据槽位筛选
 /// </summary>
 void ShowEquipmentBySlot(EquipSlot slot)
 {
     curSlot = slot;
     if (toggleEquip.value)
     {
         if (slot != EquipSlot.None)           //筛选副装备
         {
             ShowEquipItems(GameCenter.inventoryMng.GetPlayerEquipDic(), false);
         }
         else            //筛选主装备(必须能继承)
         {
             ShowEquipItems(FilterItemsByType(GameCenter.inventoryMng.GetPlayerEquipDic(), CurEquipmentTrainingType), false);
         }
     }
     else
     {
         if (slot != EquipSlot.None)
         {
             ShowBagItems(GameCenter.inventoryMng.GetBackpackEquipDic(), false);
         }
         else
         {
             ShowBagItems(FilterItemsByType(GameCenter.inventoryMng.GetBackpackEquipDic(), CurEquipmentTrainingType), false);
         }
     }
 }
コード例 #28
0
        protected void WriteEquipedItem(EquipmentStorage storage, EquipSlot slot)
        {
            if (storage.IsEquip(slot))
            {
                var item = storage.GetItemByEquipSlot(slot);

                _writer.Write((short)item.ItemId);                                           // id
                _writer.Write((short)0);                                                     // enchant
                _writer.Write((long)1);                                                      // count
                _writer.Write((long)-1);                                                     // expiration
                _writer.Write((byte)0);                                                      // unk
                _writer.Write((long)0);                                                      // price maybe
                _writer.Write((short)1);                                                     // unk
                _writer.Write((short)50);                                                    // cur endurance
                _writer.Write((short)50);                                                    // max endurance
                _writer.Write((long)1);                                                      // obj id
                _writer.Write("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".ToBytes()); // dye data - 12 * 2
                _writer.Write((int)0);                                                       // unk
                _writer.Write((byte)0);                                                      // unk
                _writer.Write("000000000000000000000000000000000000000000000000".ToBytes()); // jewel/crystal data - 6 * 4
            }
            else //GAG
            {
                _writer.Write("0000000000C0C200000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF00001010441501000000FEFFFFFFFFFFFFFF00000000000000005F978756000000001010441501000000A96BD0ED85BE3F01000000".ToBytes());
            }
        }
コード例 #29
0
ファイル: Equipment.cs プロジェクト: travisj15/unitystation
 /// <summary>
 /// Does it have SpriteSheetData for Equiped sprites or does it contain a prefab?
 /// Else don't spawn it
 /// </summary>
 private void AddifPresent(Dictionary <EquipSlot, ClothOrPrefab> gear, EquipSlot key, ClothOrPrefab clothOrPrefab)
 {
     if (clothOrPrefab?.Clothing?.Base?.Equipped != null || clothOrPrefab?.Prefab != null)
     {
         gear[key] = clothOrPrefab;
     }
 }
コード例 #30
0
 public EquippableItem(string n, string i, string g, int v, string d, EquipSlot es, List <IModifyEffect> equipEffects, IEffectPerTurn ept)
     : base(n, i, g, v, d, Usage.World)
 {
     EquipSlot         = es;
     this.equipEffects = equipEffects;
     effectPerTurn     = ept;
 }
コード例 #31
0
 protected virtual void EquipUpdate(EquipSlot _slot)
 {
     if (rendererCtrl != null)
     {
         rendererCtrl.EquipUpdate(_slot);
     }
 }
コード例 #32
0
ファイル: Inventory.cs プロジェクト: macmillaninc/melia
        /// <summary>
        /// Puts item into equip slot without updating the client.
        /// </summary>
        /// <param name="item"></param>
        public void SetEquipSilent(EquipSlot slot, Item item)
        {
            lock (_syncLock)
                _equip[slot] = item;

            _character.UpdateStance();
        }
コード例 #33
0
        public int GetItemIdBySlot(EquipSlot slot)
        {
            var target = StorageItems[slot.GetHashCode()];
            if (target != null)
                return target.ItemId;

            return 0;
        }
コード例 #34
0
	// Use this for initialization
	public void Start () {
		// FIXME: MAYBE DEPEND ON THE ENABLED/ACTIVE PLAYER IF SO ADD if(playeEnabled)
		position.x = Screen.width - position.width;
		position.y = Screen.height - position.height - Screen.height * 0.2f;
		amuletSlot = new EquipSlot(new Rect(), typeof(Amulet));
		ringSlot = new EquipSlot(new Rect(ringOffsetX + position.x, ringOffsetY + position.y, ringPixelHeight, ringPixelWidth), typeof(Ring));
		equipSlots.Add(amuletSlot);
		equipSlots.Add(ringSlot);
	}
コード例 #35
0
ファイル: Item.cs プロジェクト: Hyftar/ZodFortress
 /// <summary>
 /// Instantiates an item container.
 /// </summary>
 /// <param name="name">Name of the item</param>
 /// <param name="sellValue">Value at which a player can sell the item in a shop.</param>
 /// <param name="buyValue">Value at which a player can buy the item in a shop.</param>
 /// <param name="attackMultiplier">Attack multiplier of the item</param>
 /// <param name="defenseMultiplier">Defense multiplier of the item</param>
 /// <param name="itemSlot">The EquipSlot in which the item must be equiped in.</param>
 public Item(string name, int sellValue, int buyValue, double attackMultiplier, double defenseMultiplier, EquipSlot itemSlot)
 {
     this.Name = name;
     this.SellValue = sellValue;
     this.BuyValue = buyValue;
     this.AttackMultiplier = attackMultiplier;
     this.DefenseMultiplier = defenseMultiplier;
     this.ItemSlot = itemSlot;
 }
コード例 #36
0
	void setSlots(){
		// FIXME: MAYBE DEPEND ON THE ENABLED/ACTIVE PLAYER IF SO ADD if(playeEnabled)
		position.x = Screen.width - position.width;
		position.y = Screen.height - position.height - Screen.height * 0.2f;
		chestSlot = new EquipSlot(new Rect(chestOffsetX + position.x, chestOffsetY + position.y, chestPixelHeight, chestPixelWidth), typeof(Chest));
		bootsSlot = new EquipSlot(new Rect(), typeof(Boots));
		weaponSlot = new EquipSlot(new Rect(weaponOffsetX + position.x, weaponOffsetY + position.y, weaponPixelHeight, weaponPixelWidth), typeof(Weapon));
		equipSlots.Add(chestSlot);
		equipSlots.Add(bootsSlot);
		equipSlots.Add(weaponSlot); // set to dynamic weapon then have weapon check parent to make sure its a weapon
	}
コード例 #37
0
ファイル: Item.cs プロジェクト: nra153/TD_Code
 //constructor (e.g. __init__)
 public Item(string name, int ID, string type, string description, bool stackable, int value, float weight, int slot_count, string slot)
 {
     item_name = name;
     //item_ID = Convert.ToInt32(ID);
     item_ID = ID;
     item_type = (ItemType)Enum.Parse(typeof(ItemType), type, true);
     item_description = description;
     item_icon = Resources.Load<Texture2D>((icon_path+name.Replace(" ", "_")+"_Icon"));
     item_prefab = Resources.Load<GameObject>(prefab_path+name.Replace(" ", "_")+"_Prefab");
     item_broken_prefab = Resources.Load<GameObject>(prefab_path+name.Replace(" ", "_")+"_Broken_Prefab");
     item_stackable = stackable;
     item_value = value;
     item_weight = weight;
     item_slot_count = slot_count;
     item_slot = (EquipSlot)Enum.Parse(typeof(EquipSlot), slot, true);
 }
コード例 #38
0
 //0000000012000000f10bb8740000000059e7994b0f00000070808b0204000000000000ffffffffffffffff000000000000e1f505000000002a8000000000000000000000000000000000000000000000000000000000000000000000000000
 protected void WriteEquipedItem(EquipmentStorage storage, EquipSlot slot)
 {
     if (storage.IsEquip(slot))
     {
         var item = storage.GetItemByEquipSlot(slot);
         _writer.WriteH(item.ItemId);
         _writer.WriteH(0); //Enchant
         _writer.WriteQ(1); //Cannot trade
         _writer.WriteB("FFFFFFFFFFFFFFFF0000000000000000000100" +
                        "3200" + //current health
                        "3200" + //max health
                        "A72CE56FF2862300FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000000000000");
     }
     else //GAG
         _writer.WriteB("0000000000C0C200000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF00001010441501000000FEFFFFFFFFFFFFFF00000000000000005F978756000000001010441501000000A96BD0ED85BE3F01000000");
     
 }
コード例 #39
0
ファイル: Item.cs プロジェクト: rmforr2/FFACETools_ffevo.net
            } // @ public byte GetEquippedItemIndex(EquipSlot slot)

            /// <summary>
            /// Gets the location of an item for the passed equipment slot
            /// </summary>
            /// <param name="slot">Slot to get the location for</param>
            public byte GetEquippedItemLocation(EquipSlot slot)
            {
                byte Location = FFACE.GetEquippedItemLocation(_InstanceID, slot);
                return Location;
            } // @ public byte GetEquippedItemLocation(EquipSlot slot)
コード例 #40
0
ファイル: Item.cs プロジェクト: rmforr2/FFACETools_ffevo.net
            } // @ public short GetEquippedItemID(EquipSlot slot)

            /// <summary>
            /// Gets the index of an item for the passed equipment slot
            /// </summary>
            /// <param name="slot">Slot to get the index for</param>
            public byte GetEquippedItemIndex(EquipSlot slot)
            {
                byte Index = FFACE.GetEquippedItemIndex(_InstanceID, slot);
                if (Index > 80) return 0;
                return Index;
            } // @ public byte GetEquippedItemIndex(EquipSlot slot)
コード例 #41
0
ファイル: Item.cs プロジェクト: rmforr2/FFACETools_ffevo.net
            } // @ public byte GetEquippedItemCount(EquipSlot slot)

            /// <summary>
            /// Gets the item id for passed equipment slot
            /// </summary>
            /// <param name="slot">Slot to get the ID for</param>
            public int GetEquippedItemID(EquipSlot slot)
            {
                byte index = GetEquippedItemIndex(slot);
                if (index > 0)
                {
                    if (GetEquippedItemLocation(slot) == 8)
                        return GetItemIDByIndex(index, InventoryType.Wardrobe);// GetInventoryItem(index).Count;
                    else
                        return GetItemIDByIndex(index, InventoryType.Inventory);// GetInventoryItem(index).Count;
                }
                return 0;
            } // @ public short GetEquippedItemID(EquipSlot slot)
コード例 #42
0
ファイル: Unit.cs プロジェクト: dzikun/WarEmu
        public virtual void Strike(Unit Target, EquipSlot Slot = EquipSlot.MAIN_DROITE)
        {
            if (Target == null || Target.IsDead)
                return;

            float Damage = 0;
            float DmgReduce = 0;
            float RealDamage = 0;

            Damage = StsInterface.CalculDamage(Slot, Target);
            DmgReduce = Target.StsInterface.CalculReduce();
            DmgReduce = Math.Min(75, DmgReduce);

            RealDamage = (Damage-((DmgReduce/100f * DmgReduce)));
            if (RealDamage <= 2)
                RealDamage = 2;

            SendAttackMovement(Target);
            DealDamages(Target, null, (uint)RealDamage);
        }
コード例 #43
0
ファイル: Item.cs プロジェクト: rinyun/ffacetools
 /// <summary>
 /// Gets the item id for passed equipment slot
 /// </summary>
 /// <param name="slot">Slot to get the ID for</param>
 public int GetEquippedItemID(EquipSlot slot)
 {
     byte index = GetEquippedItemIndex(slot);
     if (index != 0)
         return GetItemIDByIndex(index, InventoryType.Inventory);// GetInventoryItem(index).ID;
     return 0;
 }
コード例 #44
0
        public Armor(EquipSlot Slot)
        {

        }
コード例 #45
0
 /// <summary>
 ///     Get the model for the current item and a specific character type and in a speific <see cref="EquipSlot" />.
 /// </summary>
 /// <param name="equipSlot"><see cref="EquipSlot" /> for which to get the model.</param>
 /// <param name="characterType">Character type to get the model for.</param>
 /// <param name="materialVersion">When this method returns contains the variant of the model for the current item.</param>
 /// <returns>The model for the current item and <c>characterType</c> in <c>equipSlot</c>.</returns>
 public ModelDefinition GetModel(EquipSlot equipSlot, int characterType, out Graphics.ImcVariant variant)
 {
     return equipSlot.GetModel(PrimaryModelKey, characterType, out variant);
 }
コード例 #46
0
ファイル: ItemsInterface.cs プロジェクト: dzikun/WarEmu
        public ushort GetAttackDamage(EquipSlot Slot)
        {
            Item Itm = Items[(UInt16)Slot];
            if(Itm == null)
                return 0;
            else
                return Itm.Info.Dps;

        }
コード例 #47
0
ファイル: ItemsInterface.cs プロジェクト: dzikun/WarEmu
 public ushort GetAttackTime(EquipSlot Slot)
 {
     Item Itm = Items[(UInt16)Slot];
     if (Itm == null)
     {
         return 200;
     }
     else
         return Itm.Info.Speed;
 }
コード例 #48
0
ファイル: Player.cs プロジェクト: TheCommieDuck/DarkRL
 public Item Unequip(EquipSlot e)
 {
     Item i = null;
     switch (e)
     {
         case EquipSlot.Lantern:
             i = this.LanternSlot;
             this.LanternSlot.IsEquipped = false;
             this.LanternSlot = null;
             break;
         case EquipSlot.None:
             return null;
     }
     DarkRL.WriteMessage("You unequip the " + i.Name + ".");
     return i;
 }
コード例 #49
0
ファイル: ItemType.cs プロジェクト: scienide00/MayaRoguelike
 //for item db purposes
 public ItemType(BaseType baseItemType, int subItemType, EquipSlot equipSlot)
 {
     this.itemBaseType = baseItemType;
     this.subItemType = subItemType;
     this.itemSlot = equipSlot;
 }
コード例 #50
0
ファイル: WoWLocalPlayer.cs プロジェクト: TyrelBaux/IceFlake
 public WoWItem GetEquippedItem(EquipSlot slot)
 {
     return GetEquippedItem((int)slot);
 }
コード例 #51
0
ファイル: ItemType.cs プロジェクト: scienide00/MayaRoguelike
 public ItemType(WeaponType weaponType, EquipSlot itemSlot)
     : this(BaseType.Weapon, (int)weaponType)
 {
     if (itemSlot >= EquipSlot.MainHand && itemSlot <= EquipSlot.RangedOrRelic)
         this.itemSlot = itemSlot;
     else throw new ArgumentException("Item slot given is not weapon!");
 }
コード例 #52
0
ファイル: Item.cs プロジェクト: rinyun/ffacetools
 /// <summary>
 /// Gets the index of an item for the passed equipment slot
 /// </summary>
 /// <param name="slot">Slot to get the index for</param>
 public byte GetEquippedItemIndex(EquipSlot slot)
 {
     return FFACE.GetEquippedItemIndex(_InstanceID, slot);
 }
コード例 #53
0
ファイル: ItemType.cs プロジェクト: scienide00/MayaRoguelike
 public ItemType(ArmorType armorType, EquipSlot itemSlot)
     : this(BaseType.Armor, (int)armorType)
 {
     if (itemSlot <= EquipSlot.Feet)
         this.itemSlot = itemSlot;
     else throw new ArgumentException("Item slot given is not armor!");
 }
コード例 #54
0
ファイル: ItemType.cs プロジェクト: scienide00/MayaRoguelike
 public ItemType(ProjectileType projectileType)
     : this(BaseType.Projectile, (int)projectileType)
 {
     this.itemSlot = EquipSlot.Ammo;
 }
コード例 #55
0
ファイル: ItemType.cs プロジェクト: scienide00/MayaRoguelike
 public ItemType(JewelleryType jewelleryType, EquipSlot itemSlot)
     : this(BaseType.Jewellery, (int)jewelleryType)
 {
     if (itemSlot >= EquipSlot.Neck && itemSlot <= EquipSlot.FingerB)
         this.itemSlot = itemSlot;
     else throw new ArgumentException("Item slot given is not jewellery!");
 }
コード例 #56
0
ファイル: Imports.cs プロジェクト: mpermana/mitaru
 private static extern byte GetEquippedItemIndex(int instanceID, EquipSlot slot);
コード例 #57
0
ファイル: ItemType.cs プロジェクト: scienide00/MayaRoguelike
 public void SwitchSlot()
 {
     switch (this.Slot)
     {
         case EquipSlot.AmuletA:
             this.itemSlot = EquipSlot.AmuletB;
             return;
         case EquipSlot.AmuletB:
             this.itemSlot = EquipSlot.AmuletA;
             return;
         case EquipSlot.FingerA:
             this.itemSlot = EquipSlot.FingerB;
             return;
         case EquipSlot.FingerB:
             this.itemSlot = EquipSlot.FingerA;
             return;
         case EquipSlot.MainHand:
             this.itemSlot = EquipSlot.OffHand;
             return;
         case EquipSlot.OffHand:
             this.itemSlot = EquipSlot.MainHand;
             return;
         default:
             return;
     }
 }
コード例 #58
0
ファイル: Storage.cs プロジェクト: marouen-lamiri/Second-Soul
	public static bool validEquipSlot(EquipSlot slot, Item item){
		return (item.GetType().IsSubclassOf(slot.type) || item.GetType() == slot.type);
		/*if(slot.type == typeof(Weapon)){
			return (slot.type == targetItem.GetType().BaseType);
		}
		return (slot.type == targetItem.GetType());*/
	}
コード例 #59
0
 private void EquipItem(WoWItem item, EquipSlot slot)
 {
     int bi, bs;
     item.GetSlotIndexes(out bi, out bs);
     WoWScript.ExecuteNoResults(string.Format("ClearCursor(); PickupContainerItem({0}, {1}); EquipCursorItem({2})", bi, bs, (int)slot));
 }
コード例 #60
0
ファイル: Item.cs プロジェクト: rinyun/ffacetools
 /// <summary>
 /// The count of an item in a specific equipment slot
 /// </summary>
 /// <param name="slot">Slot to count</param>
 public uint GetEquippedItemCount(EquipSlot slot)
 {
     byte index = GetEquippedItemIndex(slot);
     if (index != 0)
         return GetItemCountByIndex(index, InventoryType.Inventory);// GetInventoryItem(index).Count;
     return 0;
 }