예제 #1
0
        public UpdateSkillBar(ushort conId, ushort slot, BarSlotType slotType, ushort id)
        {
            _slot     = slot;
            _slotType = slotType;
            _id       = id;

            Opcode   = (ushort)GameOpcode.UpdateSkillBar;
            SenderId = conId;
        }
예제 #2
0
        public void UpdateSkillBar(byte slot, BarSlotType slotType, ushort id)
        {
            var isOk = true;

            if (id == 0)
            {
                _skillBars[slot] = null;
                if (!_removedSlots.Contains(slot))
                {
                    _removedSlots.Add(slot);
                }
            }
            else
            {
                switch (slotType)
                {
                case BarSlotType.Skill:
                {
                    var skillData = _character.Skills.GetSkillx(id);
                    if (skillData == null)
                    {
                        return;
                    }
                    var template = new Skillbar
                    {
                        Slot      = slot,
                        SlotId    = skillData.SkillId,
                        SlotType  = BarSlotType.Skill,
                        SkillData = skillData
                    };
                    _skillBars[slot] = template;
                    if (_removedSlots.Contains(slot))
                    {
                        _removedSlots.Remove(slot);
                    }
                }
                break;

                case BarSlotType.Item:
                    // TODO - Implement item
                    isOk = false;
                    break;

                default:
                    isOk = false;
                    break;
                }
            }

            if (!isOk)
            {
                return;
            }
            _character.SendPacket(new UpdateSkillBar(_character.Connection.Id, slot, slotType, id));
            _character.Save(SaveType.SkillBars);
        }