Example #1
0
        public void RemoveItemFromActorPC(ActorPC pc, int itemID, byte amount, ITEM_UPDATE_REASON reason)
        {
            ActorEventHandlers.PC_EventHandler eh = (SagaMap.ActorEventHandlers.PC_EventHandler)pc.e;
            DeleteItemResult res;
            byte             namount, index;
            Item             item = pc.inv.GetItem(CONTAINER_TYPE.INVENTORY, itemID);

            res = pc.inv.DeleteItem(CONTAINER_TYPE.INVENTORY, itemID, amount, out index, out namount);
            if (res == DeleteItemResult.ERROR || res == DeleteItemResult.WRONG_ITEMID)
            {
                return;
            }
            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(namount);
                p2.SetUpdateType(SagaMap.Packets.Server.ITEM_UPDATE_TYPE.AMOUNT);
                p2.SetUpdateReason(reason);
                eh.C.netIO.SendPacket(p2, eh.C.SessionID);
                MapServer.charDB.UpdateItem(pc, 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);
                eh.C.netIO.SendPacket(delI, eh.C.SessionID);
                MapServer.charDB.DeleteItem(pc, item);
                break;
            }
        }
Example #2
0
        public void OnUseMap(Packets.Client.UseMap p)
        {
            byte index;
            Item item;

            index = p.GetIndex();
            item  = this.Char.inv.GetItem(CONTAINER_TYPE.INVENTORY, index);
            byte map, value;

            map   = (byte)(item.skillID / 10);
            value = (byte)(item.skillID % 10);
            this.Pc.OnUseMap(map, value);
            byte             newAmount;
            DeleteItemResult res = this.Char.inv.DeleteItem(CONTAINER_TYPE.INVENTORY, index, item.id, 1, out newAmount);

            MapServer.charDB.DeleteItem(this.Char, item);
            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);
            Packets.Server.ShowMap p2 = new SagaMap.Packets.Server.ShowMap();
            p2.SetMap(map);
            p2.SetZone(value);
            this.netIO.SendPacket(p2, this.SessionID);;
        }
Example #3
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;
            }
        }
Example #4
0
        public void OnWeaponAuge(SagaMap.Packets.Client.WeaponAuge p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }

            Actor            sActor = (Actor)this.Char;
            int              id;
            byte             index = p.GetSlot();
            byte             slot  = p.GetWeaponSlot();
            byte             amount;
            Item             item = this.Char.inv.GetItem(CONTAINER_TYPE.INVENTORY, index);
            DeleteItemResult res;
            Weapon           weapon = WeaponFactory.GetActiveWeapon(this.Char);

            if (slot == 0)
            {
                weapon.augeSkillID = item.skillID;
            }
            weapon.stones[slot] = item.skillID;
            Packets.Server.WeaponStone p3 = new SagaMap.Packets.Server.WeaponStone();
            p3.SetUnknown(1);
            p3.SetWeaponSlot(slot);
            p3.SetValue(item.skillID);
            this.netIO.SendPacket(p3, this.SessionID);
            id  = item.id;
            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;
            }
        }
Example #5
0
        public void OnWeaponAuge(SagaMap.Packets.Client.WeaponAuge p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED) return;

            Actor sActor = (Actor)this.Char;
            int id;
            byte index = p.GetSlot();
            byte slot = p.GetWeaponSlot();
            byte amount;
            Item item = this.Char.inv.GetItem(CONTAINER_TYPE.INVENTORY, index);
            DeleteItemResult res;
            Weapon weapon = WeaponFactory.GetActiveWeapon(this.Char);
            if (slot == 0)
            {
                weapon.augeSkillID = item.skillID;
            }
            weapon.stones[slot] = item.skillID;
            Packets.Server.WeaponStone p3 = new SagaMap.Packets.Server.WeaponStone();
            p3.SetUnknown(1);
            p3.SetWeaponSlot(slot);
            p3.SetValue(item.skillID);
            this.netIO.SendPacket(p3, this.SessionID);
            id = item.id;
            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;
            }
        }
Example #6
0
 public void OnUseMap(Packets.Client.UseMap p)
 {
     byte index;
     Item item;
     index = p.GetIndex();
     item = this.Char.inv.GetItem(CONTAINER_TYPE.INVENTORY, index);
     byte map, value;
     map = (byte)(item.skillID / 10);
     value = (byte)(item.skillID % 10);
     this.Pc.OnUseMap(map, value);
     byte newAmount;
     DeleteItemResult res = this.Char.inv.DeleteItem(CONTAINER_TYPE.INVENTORY, index, item.id, 1, out newAmount);
     MapServer.charDB.DeleteItem(this.Char, item);
     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);
     Packets.Server.ShowMap p2 = new SagaMap.Packets.Server.ShowMap();
     p2.SetMap(map);
     p2.SetZone(value);
     this.netIO.SendPacket(p2, this.SessionID); ;
 }
Example #7
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;
            }
        }
Example #8
0
 public void RemoveItemFromActorPC(ActorPC pc, int itemID, byte amount,ITEM_UPDATE_REASON reason)
 {
     ActorEventHandlers.PC_EventHandler eh = (SagaMap.ActorEventHandlers.PC_EventHandler)pc.e;
     DeleteItemResult res;
     byte namount, index;
     Item item = pc.inv.GetItem(CONTAINER_TYPE.INVENTORY, itemID);
     res = pc.inv.DeleteItem(CONTAINER_TYPE.INVENTORY, itemID, amount, out index, out namount);
     if (res == DeleteItemResult.ERROR || res == DeleteItemResult.WRONG_ITEMID) return;
     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(namount);
             p2.SetUpdateType(SagaMap.Packets.Server.ITEM_UPDATE_TYPE.AMOUNT);
             p2.SetUpdateReason(reason);
             eh.C.netIO.SendPacket(p2, eh.C.SessionID);
             MapServer.charDB.UpdateItem(pc, 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);
             eh.C.netIO.SendPacket(delI, eh.C.SessionID);
             MapServer.charDB.DeleteItem(pc, item);
             break;
     }
 }