Beispiel #1
0
 public void RemoveEquip(EquipSlot.Id slot)
 {
     _equips.RemoveEquip(slot);
     if (slot == EquipSlot.Id.Weapon)
     {
         UpdateTwoHanded();
     }
 }
Beispiel #2
0
 public bool IsVisible(EquipSlot.Id slot)
 {
     if (!_clothes.ContainsKey(slot))
     {
         return(false);
     }
     return(_clothes[slot].TransParent == false);
 }
Beispiel #3
0
 public void Draw(EquipSlot.Id slot, Stance.Id stance, Clothing.Layer layer, short frame, DrawArgument args)
 {
     if (!_clothes.ContainsKey(slot))
     {
         return;
     }
     _clothes[slot].Draw(stance, layer, frame, args);
 }
Beispiel #4
0
        public EquipData(int id)
        {
            ItemData = new ItemData(id);
            var strId = $"0{id}";
            var src   = (WzSubProperty)Wz.Character[ItemData.category][$"{strId}.img"]["info"];

            Cash       = ((WzIntProperty)src["cash"])?.Value == 1;
            TradeBlock = ((WzIntProperty)src["tradeBlock"])?.Value == 1;

            Slots = (short)(((WzIntProperty)src["tuc"])?.Value ?? 0);
            _reqStats[MapleStat.Id.LEVEL] = (short)src["reqLevel"];
            _reqStats[MapleStat.Id.JOB]   = (short)src["reqJob"];
            _reqStats[MapleStat.Id.STR]   = (short)src["reqSTR"];
            _reqStats[MapleStat.Id.DEX]   = (short)src["reqDEX"];
            _reqStats[MapleStat.Id.INT]   = (short)src["reqINT"];
            _reqStats[MapleStat.Id.LUK]   = (short)src["reqLUK"];
            SetDefStatsValue(EquipStat.Id.STR, src, "incSTR");
            SetDefStatsValue(EquipStat.Id.DEX, src, "incDEX");
            SetDefStatsValue(EquipStat.Id.INT, src, "incINT");
            SetDefStatsValue(EquipStat.Id.LUK, src, "incLUK");
            SetDefStatsValue(EquipStat.Id.WATK, src, "incPAD");
            SetDefStatsValue(EquipStat.Id.WDEF, src, "incPDD");
            SetDefStatsValue(EquipStat.Id.MAGIC, src, "incMAD");
            SetDefStatsValue(EquipStat.Id.MDEF, src, "incMDD");
            SetDefStatsValue(EquipStat.Id.HP, src, "incMHP");
            SetDefStatsValue(EquipStat.Id.MP, src, "incMMP");
            SetDefStatsValue(EquipStat.Id.ACC, src, "incACC");
            SetDefStatsValue(EquipStat.Id.AVOID, src, "incEVA");
            SetDefStatsValue(EquipStat.Id.HANDS, src, "incHANDS");
            SetDefStatsValue(EquipStat.Id.SPEED, src, "incSPEED");
            SetDefStatsValue(EquipStat.Id.JUMP, src, "incJUMP");
            const int noneWeaponTypes = 15;
            const int weaponOffset    = noneWeaponTypes + 15;
            const int weaponTypes     = 20;
            var       index           = (id / 10000) - 100;

            string[] types;
            if (index < noneWeaponTypes)
            {
                types = new[]
                {
                    "HAT", "FACE ACCESSORY", "EYE ACCESSORY", "EARRINGS", "TOP", "OVERALL", "BOTTOM", "SHOES", "GLOVES",
                    "SHIELD", "CAPE", "RING", "PENDANT", "BELT", "MEDAL"
                };

                var equipSlots = new[]
                {
                    EquipSlot.Id.Hat, EquipSlot.Id.Face, EquipSlot.Id.EyeAcc, EquipSlot.Id.EarAcc, EquipSlot.Id.Top,
                    EquipSlot.Id.Top, EquipSlot.Id.Bottom, EquipSlot.Id.Shoes, EquipSlot.Id.Gloves, EquipSlot.Id.Shield,
                    EquipSlot.Id.Cape, EquipSlot.Id.Ring1, EquipSlot.Id.Pendant1, EquipSlot.Id.Belt, EquipSlot.Id.Medal
                };

                Type   = types[index];
                EqSlot = equipSlots[index];
            }
            else if (index >= weaponOffset && index < weaponOffset + weaponTypes)
            {
                types = new[]
                {
                    "单手剑",      // "ONE-HANDED SWORD",
                    "单手斧",      // "ONE-HANDED AXE",
                    "单手钝器",     // "ONE-HANDED MACE",
                    "短刀",       // "DAGGER",
                    "", "", "", // "", "", "",
                    "短杖",       // "WAND",
                    "长杖",       // "STAFF",
                    "",         // "",
                    "双手剑",      // "TWO-HANDED SWORD",
                    "双手斧",      // "TWO-HANDED AXE",
                    "双手钝器",     // "TWO-HANDED MACE",
                    "长枪",       // "SPEAR",
                    "长杖",       // "POLEARM",
                    "弓",        // "BOW",
                    "弩",        // "CROSSBOW",
                    "拳套",       // "CLAW",
                    "指节",       // "KNUCKLE",
                    "短枪"        // "GUN"
                };

                var weaponIndex = index - weaponOffset;
                Type   = types[weaponIndex];
                EqSlot = EquipSlot.Id.Weapon;
            }
            else
            {
                Type   = "现金道具";
                EqSlot = EquipSlot.Id.None;
            }
        }
Beispiel #5
0
        public Clothing(int id, BodyDrawInfo drawInfo)
        {
            _stances = new Dictionary <Stance.Id, Dictionary <Layer, Dictionary <Short, TextureD> > >();
            ItemId   = id;
            var equipData = GameUtil.GetEquipData(ItemId);

            EqSlot    = equipData.EqSlot;
            TwoHanded = EqSlot == EquipSlot.Id.Weapon && new WeaponData(ItemId).TwoHanded;
            const int noneWeaponTypes = 15;
            const int weaponOffset    = noneWeaponTypes + 15;
            const int weaponTypes     = 20;
            var       index           = (ItemId / 10000) - 100;
            Layer     chLayer;

            if (index < noneWeaponTypes)
            {
                chLayer = _layers[index];
            }
            else if (index >= weaponOffset && index < weaponOffset + weaponTypes)
            {
                chLayer = Layer.Weapon;
            }
            else
            {
                chLayer = Layer.Cape;
            }
            var strId    = $"0{ItemId}";
            var category = equipData.ItemData.category;
            var src      = (WzImage)Wz.Character[category][$"{strId}.img"];
            var info     = (WzSubProperty)src["info"];

            VsLot = info.GetString("vslot");
            switch ((int)info["stand"])
            {
            case 1:
                Stand = Stance.Id.Stand1;
                break;

            case 2:
                Stand = Stance.Id.Stand2;
                break;

            default:
                Stand = TwoHanded ? Stance.Id.Stand2 : Stance.Id.Stand1;
                break;
            }

            switch ((int)info["walk"])
            {
            case 1:
                Walk = Stance.Id.Walk1;
                break;

            case 2:
                Walk = Stance.Id.Walk2;
                break;

            default:
                Walk = TwoHanded ? Stance.Id.Walk2 : Stance.Id.Walk1;
                break;
            }

            foreach (var iter in Stance.Names)
            {
                var stanceName = iter.Value;
                var stance     = iter.Key;
                var stanceNode = src[stanceName];
                if (stanceNode == null)
                {
                    continue;
                }
                for (short frame = 0; frame < stanceNode.WzProperties.Count; frame++)
                {
                    var frameNode = (WzSubProperty)stanceNode[$"{frame}"].GetByUol();
                    foreach (var partNode0 in frameNode.WzProperties)
                    {
                        if (partNode0.GetByUol() is WzCanvasProperty)
                        {
                            var partNode = (WzCanvasProperty)partNode0.GetByUol();
                            var part     = partNode.Name;
                            var z        = chLayer;
                            var zs       = partNode.GetString("z");
                            if (part.Equals("mailArm"))
                            {
                                z = Layer.MailArm;
                            }
                            else
                            {
                                if (SubLayerNames.ContainsKey(zs))
                                {
                                    z = SubLayerNames[zs];
                                }
                            }

                            var parent    = "";
                            var parentPos = new Vector2();
                            foreach (var mapNode0 in partNode["map"].WzProperties)
                            {
                                var mapNode = mapNode0.GetByUol();
                                if (mapNode is WzVectorProperty)
                                {
                                    parent    = mapNode.Name;
                                    parentPos = ((WzVectorProperty)mapNode).Pos();
                                }
                            }

                            var shift = new Vector2();
                            switch (EqSlot)
                            {
                            case EquipSlot.Id.Face:
                                shift -= parentPos;
                                break;

                            case EquipSlot.Id.Shoes:
                            case EquipSlot.Id.Gloves:
                            case EquipSlot.Id.Top:
                            case EquipSlot.Id.Bottom:
                            case EquipSlot.Id.Cape:
                                shift = drawInfo.GetBodyPosition(stance, frame) - parentPos;
                                break;

                            case EquipSlot.Id.Hat:
                            case EquipSlot.Id.EarAcc:
                            case EquipSlot.Id.EyeAcc:
                                shift = drawInfo.GetFacePosition(stance, frame) - parentPos;
                                break;

                            case EquipSlot.Id.Shield:
                            case EquipSlot.Id.Weapon:
                                if (parent.Equals("handMove"))
                                {
                                    shift += drawInfo.GetHeadPosition(stance, frame);
                                }
                                else if (parent.Equals("hand"))
                                {
                                    shift += drawInfo.GetArmPosition(stance, frame);
                                }
                                else if (parent.Equals("navel"))
                                {
                                    shift += drawInfo.GetBodyPosition(stance, frame);
                                }
                                shift -= parentPos;
                                break;
                            }

                            if (!_stances.ContainsKey(stance))
                            {
                                _stances[stance] = new Dictionary <Layer, Dictionary <Short, TextureD> >();
                            }
                            if (!_stances[stance].ContainsKey(z))
                            {
                                _stances[stance][z] = new Dictionary <Short, TextureD>();
                            }
                            _stances[stance][z][new Short(frame)] = new TextureD(partNode).Shift(shift);
                        }
                    }
                }
            }

            var transParents = new HashSet <int>()
            {
                1002186
            };

            TransParent = transParents.Contains(ItemId);
        }
Beispiel #6
0
 // 是否已装备
 public bool HasEquipped(EquipSlot.Id slot)
 {
     return(_inventories.ContainsKey(InventoryType.Id.EQUIPPED) &&
            _inventories[InventoryType.Id.EQUIPPED].ContainsKey((short)slot));
 }
Beispiel #7
0
 public int GetEquip(EquipSlot.Id slot)
 {
     return(!_clothes.ContainsKey(slot) ? 0 : _clothes[slot].ItemId);
 }
Beispiel #8
0
 public bool CompareLayer(EquipSlot.Id slot, Stance.Id stance, Clothing.Layer layer)
 {
     return(_clothes.ContainsKey(slot) && _clothes[slot].ContainsLayer(stance, layer));
 }
Beispiel #9
0
 public void RemoveEquip(EquipSlot.Id slot)
 {
     _clothes.Remove(slot);
 }