Пример #1
0
        //09 0C
        public void OnSkillAddSpecial(SagaMap.Packets.Client.SkillAddSpecial p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }

            Actor            sActor = (Actor)this.Char;
            Item             item;
            byte             amount;
            int              id;
            byte             index = p.GetIndex();
            DeleteItemResult res;

            SkillHandler.SkillAddResault res2;
            item = this.Char.inv.GetItem(CONTAINER_TYPE.INVENTORY, index);
            id   = item.id;
            res2 = SkillHandler.SkillAddSpecial(ref this.Char, item.skillID);
            Packets.Server.SkillLearned p3 = new SagaMap.Packets.Server.SkillLearned();
            if (res2 != SkillHandler.SkillAddResault.OK)
            {
                p3.SetResult(res2);
                this.netIO.SendPacket(p3, this.SessionID);
                return;
            }
            else
            {
                p3.SetResult(res2);
            }
            SkillHandler.SendAddSkill(this.Char, item.skillID, 0);
            this.netIO.SendPacket(p3, this.SessionID);
            res = this.Char.inv.DeleteItem(CONTAINER_TYPE.INVENTORY, index, id, 1, out amount);
            switch (res)
            {
            case DeleteItemResult.NOT_ALL_DELETED:
                Packets.Server.UpdateItem p2 = new SagaMap.Packets.Server.UpdateItem();
                p2.SetContainer(CONTAINER_TYPE.INVENTORY);
                p2.SetItemIndex(index);
                p2.SetAmount(amount);
                p2.SetUpdateType(SagaMap.Packets.Server.ITEM_UPDATE_TYPE.AMOUNT);
                p2.SetUpdateReason(ITEM_UPDATE_REASON.PURCHASED);
                this.netIO.SendPacket(p2, this.SessionID);
                MapServer.charDB.UpdateItem(this.Char, item);
                break;

            case DeleteItemResult.ALL_DELETED:
                Packets.Server.DeleteItem delI = new SagaMap.Packets.Server.DeleteItem();
                delI.SetContainer(CONTAINER_TYPE.INVENTORY);
                delI.SetAmount(1);
                delI.SetIndex(index);
                this.netIO.SendPacket(delI, this.SessionID);
                MapServer.charDB.DeleteItem(this.Char, item);
                break;
            }
        }