Ejemplo n.º 1
0
 public void OnItemLocationChanged(IItem item, ItemLocation from, ItemLocation to)
 {
     if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Necromancer)
     {
         return;
     }
     if (to != ItemLocation.RightHand)
     {
         return;
     }
     if (item.SnoItem.Sno == Hud.Sno.SnoItems.P6_Unique_Phylactery_02.Sno)
     {
         foreach (var perfection in item.Perfections)
         {
             if (perfection.Attribute == Hud.Sno.Attributes.Item_Power_Passive)
             {
                 legpower     = (int)(perfection.Cur * 100);
                 ActiveTarget = null;
                 ResetRinger(true);
                 return;
             }
         }
     }
     else
     {
         ActiveTarget = null;
         ResetRinger(true);
         return;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete <see cref="Item"/> at supplied <see cref="ItemLocation"/>, this is called directly from a packet hander.
        /// </summary>
        public Item ItemDelete(ItemLocation from)
        {
            Bag srcBag = GetBag(from.Location);

            if (srcBag == null)
            {
                throw new InvalidPacketValueException();
            }

            Item srcItem = srcBag.GetItem(from.BagIndex);

            if (srcItem == null)
            {
                throw new InvalidPacketValueException();
            }

            srcBag.RemoveItem(srcItem);
            srcItem.EnqueueDelete();
            deletedItems.Add(srcItem);

            player.Session.EnqueueMessageEncrypted(new ServerItemDelete
            {
                Guid = srcItem.Guid
            });

            return(srcItem);
        }
Ejemplo n.º 3
0
        public static ItemBase newInstance(ItemBase a)
        {
            VicisMod.log(LOGGER_PREFIX, "Creating new instance of " + a.GetDisplayString());
            switch (a.mType)
            {
            case ItemType.ItemCubeStack:
                ItemCubeStack ics = a as ItemCubeStack;
                return(new ItemCubeStack(ics.mCubeType, ics.mCubeValue, ics.mnAmount));

            case ItemType.ItemStack:
                ItemStack its = a as ItemStack;
                return(new ItemStack(its.mnItemID, its.mnAmount));

            case ItemType.ItemCharge:
                ItemCharge ic = a as ItemCharge;
                return(new ItemCharge(ic.mnItemID, (int)ic.mChargeLevel));

            case ItemType.ItemDurability:
                ItemDurability id = a as ItemDurability;
                return(new ItemDurability(id.mnItemID, id.mnCurrentDurability, id.mnMaxDurability));

            case ItemType.ItemLocation:
                ItemLocation il = a as ItemLocation;
                return(new ItemLocation(il.mnItemID, il.mLocX, il.mLocY, il.mLocZ, il.mLookVector));

            case ItemType.ItemSingle:
                return(new ItemSingle(a.mnItemID));
            }
            return(null);
        }
Ejemplo n.º 4
0
        private void InsertInDb()
        {
            Location = ItemLocation.Inventory;
            ItemContract contract = MapItemModel();

            _itemCrudService.Add(contract);
        }
        protected virtual IList <PendingItem> CollectClasspathItems(ItemLocation location)
        {
            List <PendingItem> result = new List <PendingItem>();
            string             prefix = location.Assembly.GetName().Name + "." + location.Location + ".";

            foreach (var resource in location.Assembly.GetManifestResourceNames())
            {
                if (!resource.StartsWith(prefix))
                {
                    continue;
                }

                string itemName = resource.Substring(prefix.Length);

                using (var stream = location.Assembly.GetManifestResourceStream(resource))
                {
                    Assert.NotNull(stream);

                    PendingItem item = BuildClasspathItem(location, itemName, stream);

                    if (item != null)
                    {
                        result.Add(item);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 6
0
 public void Equip(L2Player owner)
 {
     Location      = ItemLocation.Paperdoll;
     SlotLocation  = Inventory.GetPaperdollIndex(Template.BodyPart);
     PaperdollSlot = Inventory.GetPaperdollIndex(Template.BodyPart);
     IsEquipped    = 1;
 }
 public void OnItemLocationChanged(IItem item, ItemLocation from, ItemLocation to)
 {
     if ((from >= ItemLocation.Head && from <= ItemLocation.Neck) || (to >= ItemLocation.Head && to <= ItemLocation.Neck))
     {
         items = null;
     }
 }
        public override void Handle(NecClient client, NecPacket packet)
        {
            ItemZoneType zone = (ItemZoneType)packet.data.ReadByte();
            byte         bag  = packet.data.ReadByte();
            short        slot = packet.data.ReadInt16();
            //9 bytes left TODO investigate, probably one is identify price which is irrelevant, check price server side

            ItemLocation location    = new ItemLocation(zone, bag, slot);
            ItemService  itemService = new ItemService(client.character);
            ItemInstance identifiedItem;
            int          error = 0;

            try
            {
                identifiedItem = itemService.GetIdentifiedItem(location);
                RecvItemInstance recvItemInstance = new RecvItemInstance(client, identifiedItem);
                router.Send(recvItemInstance);

                identifiedItem.currentDurability = identifiedItem.maximumDurability;
                RecvItemUpdateDurability recvItemUpdateDurability = new RecvItemUpdateDurability(client, identifiedItem);
                router.Send(recvItemUpdateDurability);
            }
            catch (ItemException e)
            {
                error = (int)e.type;
            }

            RecvShopIdentify recvShopIdentify = new RecvShopIdentify(client, error);

            router.Send(recvShopIdentify);
        }
Ejemplo n.º 9
0
 public L2Item(ItemTemplate template, int objectId) : base(objectId)
 {
     ObjId    = objectId != 0 ? objectId : IdFactory.Instance.NextId();
     Template = template;
     Count    = 1;
     Location = ItemLocation.Void;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Unlock costume item for <see cref="Item"/> at supplied <see cref="ItemLocation"/>.
        /// </summary>
        public void UnlockItem(ItemLocation location)
        {
            Item item = player.Inventory.GetItem(location);

            if (item == null)
            {
                SendCostumeItemUnlock(CostumeUnlockResult.InvalidItem);
                return;
            }

            if (costumeUnlocks.TryGetValue(item.Id, out CostumeUnlock costumeUnlock) && !costumeUnlock.PendingDelete)
            {
                SendCostumeItemUnlock(CostumeUnlockResult.AlreadyKnown);
                return;
            }

            if (costumeUnlocks.Count >= GetMaxUnlockItemCount())
            {
                SendCostumeItemUnlock(CostumeUnlockResult.OutOfSpace);
                return;
            }

            // TODO: make item soulbound

            if (costumeUnlock != null)
            {
                costumeUnlock.EnqueueDelete(false);
            }
            else
            {
                costumeUnlocks.Add(item.Id, new CostumeUnlock(player.Session.Account, item.Id));
            }

            SendCostumeItemUnlock(CostumeUnlockResult.UnlockSuccess, item.Id);
        }
Ejemplo n.º 11
0
        protected override void UpdateTarget(SegmentEntity entity, Byte[] inputValues, Boolean reset)
        {
            Teleporter   teleporter = entity as Teleporter;
            ItemLocation marker     = teleporter?.mTargetMarker;

            if (marker == null)
            {
                return;
            }

            // Left input adjusts 0 to 255, and right input adjusts (-128 to 127) * 256
            Int32 distance = (SByte)inputValues[1] * 256 + inputValues[0];

            _distance = distance;

            if (TargetXOffset != 0)
            {
                marker.mLocX = teleporter.mnX + distance;
            }
            else if (TargetYOffset != 0)
            {
                marker.mLocY = teleporter.mnY + distance;
            }
            else
            {
                marker.mLocZ = teleporter.mnZ + distance;
            }

            teleporter.SwapMarker(marker); // Force the teleporter to update the power costs
        }
Ejemplo n.º 12
0
 public L2Item(ItemTemplate template)
 {
     ObjId    = IdFactory.Instance.NextId();
     Template = template;
     Count    = 1;
     Location = ItemLocation.Void;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Invokes a serializer to store some data.
        /// </summary>
        /// <returns>Unique id for stored value.</returns>
        public PageableStoreId Write(Action <BuildXLWriter> serializer)
        {
            Contract.RequiresNotNull(serializer);

            PageStreamBase writablePageStream;

            if (!m_availableWritablePageStreams.TryPop(out writablePageStream))
            {
                writablePageStream = new MemoryPageStream(this);
                Contract.Assert(writablePageStream.CanWrite);
                lock (m_pageStreams)
                {
                    m_pageStreams.Add(writablePageStream);
                }
            }

            Contract.AssertNotNull(writablePageStream);

            var idValue = (uint)Interlocked.Increment(ref m_lastId);

            Contract.Assume(idValue > 0);
            bool gotSealed;
            int  offset = writablePageStream.Write(this, serializer, out gotSealed);

            m_itemLocations[idValue] = new ItemLocation(writablePageStream, offset);
            if (!gotSealed)
            {
                m_availableWritablePageStreams.Push(writablePageStream);
            }

            return(new PageableStoreId(idValue));
        }
Ejemplo n.º 14
0
        public void TestEquality()
        {
            var one = new ItemLocation("a", "b");
            var two = new ItemLocation("a", "b");

            Assert.AreEqual(one, two);
        }
Ejemplo n.º 15
0
        public override void Handle(NecClient client, NecPacket packet)
        {
            ItemZoneType fromZone      = (ItemZoneType)packet.data.ReadByte();
            byte         fromContainer = packet.data.ReadByte();
            short        fromSlot      = packet.data.ReadInt16();
            short        toSlot        = packet.data.ReadInt16();
            byte         quantity      = packet.data.ReadByte();

            ItemLocation fromLoc     = new ItemLocation(fromZone, fromContainer, fromSlot);
            ItemService  itemService = new ItemService(client.character);

            _itemInstance = itemService.GetIdentifiedItem(fromLoc); //To do; get regular item instead of identified item. Mark item as in trade.
            client.character.tradeWindowSlot[toSlot] = _itemInstance.instanceId;

            ItemLocation originalLocation = _itemInstance.location;

            _itemInstance.location = new ItemLocation(ItemZoneType.TradeWindow, 0, toSlot); //This is bad. it changes the stored location?

            NecClient targetClient = server.clients.GetByCharacterInstanceId((uint)client.character.eventSelectExecCode);

            IBuffer res = BufferProvider.Provide();

            res.WriteInt32(0); // error check?
            router.Send(client, (ushort)AreaPacketId.recv_trade_add_item_r, res, ServerType.Area);

            if (targetClient != null)
            {
                RecvItemInstance itemInstance = new RecvItemInstance(targetClient, _itemInstance);
                router.Send(itemInstance);
            }

            _itemInstance.location = originalLocation;
        }
Ejemplo n.º 16
0
            public void TestItemMovePlaceInEquippedBag()
            {
                const ulong  INSTANCE_ID  = 756366;
                const ulong  BAG_ID       = 534577777;
                const byte   BAG_SIZE     = 10;
                const int    QUANTITY     = 1;
                ItemInstance itemInstance = new ItemInstance(INSTANCE_ID);
                ItemLocation fromLoc      = new ItemLocation(ItemZoneType.AdventureBag, 0, 0);

                _dummyCharacter.itemLocationVerifier.PutItem(fromLoc, itemInstance);

                ItemInstance equippedBag = new ItemInstance(BAG_ID);

                equippedBag.bagSize = BAG_SIZE;
                ItemLocation bagLocation = new ItemLocation(ItemZoneType.BagSlot, 0, 0);

                _dummyCharacter.itemLocationVerifier.PutItem(bagLocation, equippedBag);
                ItemLocation toLoc = new ItemLocation(ItemZoneType.EquippedBags, 0, 1);

                MoveResult moveResult = _itemService.Move(fromLoc, toLoc, QUANTITY);

                Assert.Equal(MoveType.Place, moveResult.type);
                Assert.Equal(INSTANCE_ID, moveResult.destItem.instanceId);

                Assert.Null(_dummyCharacter.itemLocationVerifier.GetItem(fromLoc));
                Assert.Equal(INSTANCE_ID, _dummyCharacter.itemLocationVerifier.GetItem(toLoc).instanceId);
                Assert.Equal(itemInstance.location, toLoc);
                Assert.Equal(QUANTITY, itemInstance.quantity);
                Assert.Equal(BAG_SIZE - 1, _dummyCharacter.itemLocationVerifier.GetTotalFreeSpace(ItemZoneType.EquippedBags));
            }
Ejemplo n.º 17
0
            public void TestItemMovePlaceAllQuantity()
            {
                const ulong FROM_ID       = 34151555;
                const ulong TO_ID         = 234987915;
                const int   FROM_QUANTITY = 10;
                const int   TO_QUANTITY   = 30;

                ItemInstance fromItem = new ItemInstance(FROM_ID);

                fromItem.quantity = FROM_QUANTITY;
                ItemLocation fromLoc = new ItemLocation(ItemZoneType.AdventureBag, 0, 0);

                _dummyCharacter.itemLocationVerifier.PutItem(fromLoc, fromItem);

                ItemInstance toItem = new ItemInstance(TO_ID);

                toItem.maxStackSize = TO_QUANTITY + FROM_QUANTITY + 5;
                toItem.quantity     = TO_QUANTITY;
                ItemLocation toLoc = new ItemLocation(ItemZoneType.AdventureBag, 0, 1);

                _dummyCharacter.itemLocationVerifier.PutItem(toLoc, toItem);

                MoveResult moveResult = _itemService.Move(fromLoc, toLoc, FROM_QUANTITY);

                Assert.Equal(MoveType.AllQuantity, moveResult.type);
                Assert.Null(moveResult.originItem);
                Assert.Equal(TO_ID, moveResult.destItem.instanceId);

                Assert.Null(_dummyCharacter.itemLocationVerifier.GetItem(fromLoc));
                Assert.Equal(FROM_QUANTITY + TO_QUANTITY, toItem.quantity);
                Assert.Equal(TO_ID, _dummyCharacter.itemLocationVerifier.GetItem(toLoc).instanceId);
            }
Ejemplo n.º 18
0
        public override void Handle(NecClient client, NecPacket packet)
        {
            ItemZoneType fromZone = (ItemZoneType)packet.data.ReadByte();
            byte         fromBag  = packet.data.ReadByte();
            short        fromSlot = packet.data.ReadInt16();
            ItemZoneType toZone   = (ItemZoneType)packet.data.ReadByte();
            byte         toBag    = packet.data.ReadByte();
            short        toSlot   = packet.data.ReadInt16();
            byte         quantity = packet.data.ReadByte();

            _Logger.Debug($"fromStoreType byte [{fromZone}] toStoreType byte [{toZone}]");
            _Logger.Debug($"fromBagId byte [{fromBag}] toBagId byte [{toBag}]");
            _Logger.Debug($"fromSlot byte [{fromSlot}] toSlot[{toSlot}]");
            _Logger.Debug($"itemCount [{quantity}]");

            ItemLocation fromLoc     = new ItemLocation(fromZone, fromBag, fromSlot);
            ItemLocation toLoc       = new ItemLocation(toZone, toBag, toSlot);
            ItemService  itemService = new ItemService(client.character);
            int          error       = 0;

            try
            {
                MoveResult            moveResult = itemService.Move(fromLoc, toLoc, quantity);
                List <PacketResponse> responses  = itemService.GetMoveResponses(client, moveResult);
                router.Send(client, responses);
            }
            catch (ItemException e)
            {
                error = (int)e.type;
            }

            RecvStorageDrawItem2 recvStorageDrawItem2 = new RecvStorageDrawItem2(client, error);

            router.Send(recvStorageDrawItem2);
        }
Ejemplo n.º 19
0
        public void ValidConstructorWorks()
        {
            ItemLocation a = new ItemLocation("a", "b");

            Assert.AreEqual("a", a.Folders.First());
            Assert.AreEqual("b", a.ItemName);
        }
        public override void Handle(NecClient client, NecPacket packet)
        {
            ItemZoneType zone     = (ItemZoneType)packet.data.ReadByte();
            byte         bag      = packet.data.ReadByte();
            short        slot     = packet.data.ReadInt16();
            ulong        saleGold = packet.data.ReadUInt64(); //irrelevant, check sale price server side
            byte         quantity = packet.data.ReadByte();

            ItemLocation location    = new ItemLocation(zone, bag, slot);
            ItemService  itemService = new ItemService(client.character);
            int          error       = 0;

            try
            {
                //ulong currentGold = itemService.Sell(location, quantity);
                ulong currentGold = itemService.AddGold(saleGold);
                RecvSelfMoneyNotify recvSelfMoneyNotify = new RecvSelfMoneyNotify(client, currentGold);
                router.Send(recvSelfMoneyNotify);

                ItemInstance   itemInstance   = itemService.Remove(new ItemLocation(zone, bag, slot), quantity);
                RecvItemRemove recvItemRemove = new RecvItemRemove(client, itemInstance);
                router.Send(recvItemRemove);
            }
            catch (ItemException e)
            {
                error = (int)e.type;
            }

            RecvShopSell recvShopSell = new RecvShopSell(client, error);

            router.Send(recvShopSell);
        }
Ejemplo n.º 21
0
            public void TestItemMoveAddQuantityWrongItem()
            {
                const ulong TO_ID         = 234987915;
                const int   BASE_TO_ID    = 1234;
                const ulong FROM_ID       = 34151555;
                const int   BASE_FROM_ID  = 5678;
                const int   FROM_QUANTITY = 10;
                const int   TO_QUANTITY   = 30;
                const int   MOVE_QUANTITY = FROM_QUANTITY - 1;

                ItemInstance fromItem = new ItemInstance(FROM_ID);

                fromItem.quantity = FROM_QUANTITY;
                fromItem.baseId   = BASE_FROM_ID;
                ItemLocation fromLoc = new ItemLocation(ItemZoneType.AdventureBag, 0, 0);

                _dummyCharacter.itemLocationVerifier.PutItem(fromLoc, fromItem);

                ItemInstance toItem = new ItemInstance(TO_ID);

                toItem.maxStackSize = TO_QUANTITY + MOVE_QUANTITY + 5;
                toItem.quantity     = TO_QUANTITY;
                toItem.baseId       = BASE_TO_ID;
                ItemLocation toLoc = new ItemLocation(ItemZoneType.AdventureBag, 0, 1);

                _dummyCharacter.itemLocationVerifier.PutItem(toLoc, toItem);

                ItemException e = Assert.Throws <ItemException>(() => _itemService.Move(fromLoc, toLoc, MOVE_QUANTITY));

                Assert.Equal(ItemExceptionType.BagLocation, e.type);
            }
Ejemplo n.º 22
0
        public override void Handle(NecClient client, NecPacket packet)
        {
            ItemZoneType zone     = (ItemZoneType)packet.data.ReadByte();
            byte         bag      = packet.data.ReadByte();
            short        slot     = packet.data.ReadInt16();
            byte         quantity = packet.data.ReadByte();

            ItemLocation location    = new ItemLocation(zone, bag, slot);
            ItemService  itemService = new ItemService(client.character);
            int          error       = 0;

            try
            {
                ItemInstance   item           = itemService.Remove(location, quantity);
                RecvItemRemove recvItemRemove = new RecvItemRemove(client, item);
                router.Send(recvItemRemove);
            }
            catch (ItemException e)
            {
                error = (int)e.type;
            }

            RecvItemDrop recvItemDrop = new RecvItemDrop(client, error);

            router.Send(recvItemDrop);
        }
Ejemplo n.º 23
0
 public OrbPedestal(Mobile typedObject, ItemLocation itemInfo) : base(typedObject, itemInfo)
 {
     if (Level != null)
     {
         menuIcons = Level.GCM.SpMenuIcons;
     }
 }
Ejemplo n.º 24
0
        private void ItemLoc_TextChanged(object sender, TextChangedEventArgs e)
        {
            ItemLocation k = new ItemLocation();

            ItemLocReff.Text = ItemLoc.Text;
            k.GetValue11();
        }
Ejemplo n.º 25
0
            public void TestItemMovePlaceQuantity()
            {
                const ulong  INSTANCE_ID    = 756366;
                const int    START_QUANTITY = 10;
                const int    MOVE_QUANTITY  = 6;
                ItemInstance itemOriginal   = new ItemInstance(INSTANCE_ID);

                itemOriginal.quantity = START_QUANTITY;
                ItemLocation fromLoc = new ItemLocation(ItemZoneType.AdventureBag, 0, 0);

                _dummyCharacter.itemLocationVerifier.PutItem(fromLoc, itemOriginal);
                ItemLocation toLoc = new ItemLocation(ItemZoneType.AdventureBag, 0, 1);

                MoveResult moveResult = _itemService.Move(fromLoc, toLoc, MOVE_QUANTITY);

                Assert.Equal(MoveType.PlaceQuantity, moveResult.type);
                Assert.Equal(INSTANCE_ID, moveResult.originItem.instanceId);

                Assert.Equal(fromLoc, itemOriginal.location);
                Assert.Equal(START_QUANTITY - MOVE_QUANTITY, itemOriginal.quantity);
                Assert.NotNull(_dummyCharacter.itemLocationVerifier.GetItem(fromLoc));
                Assert.Equal(INSTANCE_ID, _dummyCharacter.itemLocationVerifier.GetItem(fromLoc).instanceId);

                Assert.Equal(itemOriginal.baseId, moveResult.destItem.baseId);
                Assert.Equal(toLoc, moveResult.destItem.location);
                Assert.Equal(MOVE_QUANTITY, moveResult.destItem.quantity);
                Assert.NotNull(_dummyCharacter.itemLocationVerifier.GetItem(toLoc));
            }
Ejemplo n.º 26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="manifest"></param>
        /// <exception cref="ArgumentNullException">The provided manifest was null.</exception>
        /// <exception cref="ArgumentException">The provided manifest failed validation.</exception>
        /// <exception cref="InvalidOperationException">A site wth the same domain name and path already exists.</exception>
        public void AddSite(SiteManifest manifest)
        {
            if (manifest == null)
            {
                throw new ArgumentNullException(nameof(manifest));
            }

            if (!manifest.Validate().isValid)
            {
                throw new ArgumentException("Manifest is not valid for saving.");
            }

            //TODO: Check for duplicates.
            string potentialName = GenerateName(manifest);

            if (AvailableSites.Contains(potentialName))
            {
                throw new InvalidOperationException($"A site with the name: {potentialName} already exists.");
            }

            var folder = new ItemLocation(potentialName, "");

            this.fileViewer.CreateFolder(folder);
            new SiteManifestManager(this.fileViewer).CreateManifest(folder, manifest);
        }
Ejemplo n.º 27
0
            public void TestItemMoveSwap(byte fromQuantity, byte toQuantity)
            {
                const ulong FROM_ID = 234987915;
                const ulong TO_ID   = 33388888;

                ItemInstance fromItem = new ItemInstance(FROM_ID);

                fromItem.quantity     = fromQuantity;
                fromItem.maxStackSize = fromQuantity;
                ItemLocation fromLoc = new ItemLocation(ItemZoneType.AdventureBag, 0, 0);

                _dummyCharacter.itemLocationVerifier.PutItem(fromLoc, fromItem);

                ItemInstance toItem = new ItemInstance(TO_ID);

                toItem.quantity = toQuantity;
                ItemLocation toLoc = new ItemLocation(ItemZoneType.AdventureBag, 0, 1);

                _dummyCharacter.itemLocationVerifier.PutItem(toLoc, toItem);

                MoveResult moveResult = _itemService.Move(fromLoc, toLoc, fromQuantity);

                Assert.Equal(MoveType.Swap, moveResult.type);
                Assert.Equal(FROM_ID, moveResult.destItem.instanceId);
                Assert.Equal(TO_ID, moveResult.originItem.instanceId);

                Assert.Equal(fromItem.location, toLoc);
                Assert.Equal(FROM_ID, _dummyCharacter.itemLocationVerifier.GetItem(toLoc).instanceId);
                Assert.Equal(fromQuantity, fromItem.quantity);
                Assert.Equal(toItem.location, fromLoc);
                Assert.Equal(TO_ID, _dummyCharacter.itemLocationVerifier.GetItem(fromLoc).instanceId);
                Assert.Equal(toQuantity, toItem.quantity);
            }
Ejemplo n.º 28
0
 private void SetItemLocation(System.Windows.Forms.Control control, ItemLocation thisItem)
 {
     control.Top    = thisItem.Top;
     control.Left   = thisItem.Left;
     control.Width  = thisItem.Width;
     control.Height = thisItem.Height;
 }
Ejemplo n.º 29
0
        public static async Task RemoveItemLocation(this PrimaryDbContext db, ItemLocation model)
        {
            var il = await db.ItemLocations.FindAsync(model.Id);

            db.ItemLocations.Remove(il);
            await db.SaveChangesAsync();
        }
Ejemplo n.º 30
0
 public override void Awake()
 {
     base.Awake();
     toiletWater       = GameObject.Find("ToiletWater");
     inToilet          = GameObject.Find("InToilet").GetComponent <ItemLocation>();
     r_dreamController = GameObject.Find("MainController").GetComponent <DreamController>();
 }
Ejemplo n.º 31
0
 public ItemContainer(int itemId, int itemCount, ItemLocation itemLocation, int indexX, int indexY)
 {
     ItemId = itemId;
     ItemCount = itemCount;
     ItemLocation = itemLocation;
     IndexX = indexX;
     IndexY = indexY;
 }
 private void PopulateEach(ItemLocation sourceToAddorEdit)
 {
     NotFound_PopulateInfo(sourceToAddorEdit); isChanging = false;
     Unknown_PopulateInfo(sourceToAddorEdit); isChanging = false;
     Vendor_PopulateInfo(sourceToAddorEdit); isChanging = false;
     Faction_PopulateInfo(sourceToAddorEdit); isChanging = false;
     PvP_PopulateInfo(sourceToAddorEdit); isChanging = false;
     Crafted_PopulateInfo(sourceToAddorEdit); isChanging = false;
     WorldDrop_PopulateInfo(sourceToAddorEdit); isChanging = false;
     StaticDrop_PopulateInfo(sourceToAddorEdit); isChanging = false;
     Quest_PopulateInfo(sourceToAddorEdit); isChanging = false;
     Container_PopulateInfo(sourceToAddorEdit); isChanging = false;
     Achievement_PopulateInfo(sourceToAddorEdit); isChanging = false;
 }
        public ItemSourceEditorChild(ItemLocation sourceToAddorEdit)
        {
            NewSource = sourceToAddorEdit;
            InitializeComponent();

#if !SILVERLIGHT
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            this.WindowState = System.Windows.WindowState.Normal;
#endif

            HideAllPoints();
            isChanging = true;
            CB_Type.SelectedItem = LocTypeToString(sourceToAddorEdit);
            PopulateEach(sourceToAddorEdit);
            isChanging = false;
        }
 private String LocTypeToString(ItemLocation src)
 {
     string retVal = "";
     if (src is NoSource) { retVal = "None"; }
     else if (src is UnknownItem) { retVal = "Unknown"; }
     else if (src is VendorItem) { retVal = "Vendor"; }
     else if (src is FactionItem) { retVal = "Faction"; }
     else if (src is PvpItem) { retVal = "PvP"; }
     else if (src is StaticDrop) { retVal = "Static Drop"; }
     else if (src is WorldDrop) { retVal = "World Drop"; }
     else if (src is CraftedItem) { retVal = "Crafted"; }
     else if (src is QuestItem) { retVal = "Quest"; }
     else if (src is ContainerItem) { retVal = "Container"; }
     else if (src is AchievementItem) { retVal = "Achievement"; }
     else if (src is ItemLocation) { retVal = "Not Found"; }
     return retVal;
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Get the item at the specified location.
 /// </summary>
 /// <param name="location"></param>
 /// <returns></returns>
 public Item GetItem(ItemLocation location)
 {
     if (location.Type == Tibia.Constants.ItemLocationType.Slot)
     {
         return GetItemInSlot(location.Slot);
     }
     else if (location.Type == Tibia.Constants.ItemLocationType.Container)
     {
         long address = Addresses.Container.Start +
                       Addresses.Container.StepContainer * (int)location.ContainerId +
                       Addresses.Container.StepSlot * (int)location.Slot;
         return new Item(client,
             client.Memory.ReadUInt32(address + Addresses.Container.DistanceItemId),
             client.Memory.ReadByte(address + Addresses.Container.DistanceItemCount),
             "", location);
     }
     return null;
 }
Ejemplo n.º 36
0
 public void Execute(Creature creature, Inventory inventory)
 {
     switch (this.Type)
     {
         case FightExtra.ItemEquip:
             ItemLocation loc = new ItemLocation();
             this.Item.Move(inventory.GetItemInSlot(this.Slot).Location);
             break;
         case FightExtra.ItemUse:
             this.Item.Use(creature);
             break;
         case FightExtra.Spell:
             this.Item.Client.Console.Say(this.Spell);
             break;
         case FightExtra.AutoSpell:
             DamageType type = creature.Data.GetWeakness(SpellTypes.Keys.ToList());
             this.Item.Client.Console.Say(SpellTypes[type]);
             break;
     }
 }
 private void StaticDrop_InfoChanged()
 {
     if (isChanging) { return; }
     if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
     if ((CB_Type.SelectedItem as String) != "Static Drop") { return; }
     //
     isChanging = true;
     if (CB_StaticDrop_Heroic.IsChecked.Value.Equals(true))
         CB_StaticDrop_LFR.IsChecked = false;
     else if (CB_StaticDrop_LFR.IsChecked.Value.Equals(true))
         CB_StaticDrop_Heroic.IsChecked = false;
     //
     NewSource = new StaticDrop()
     {
         Heroic = CB_StaticDrop_Heroic.IsChecked.GetValueOrDefault(false),
         LFR = CB_StaticDrop_LFR.IsChecked.GetValueOrDefault(false),
         Area = TB_StaticDrop_Name.Text,
         Boss = TB_StaticDrop_Token_1.Text,
         Count = (int)NUD_StaticDrop_Count.Value,
         OutOf = (int)NUD_StaticDrop_OutOf.Value,
     };
     //
     UpdateString();
     //
     isChanging = false;
 }
Ejemplo n.º 38
0
        internal static Item LocationToSearchResult(SectorMap.Milieu map, ResourceManager resourceManager, ItemLocation location)
        {
            if (location is WorldLocation)
            {
                Sector sector;
                World world;
                ((WorldLocation)location).Resolve(map, resourceManager, out sector, out world);

                if (sector == null || world == null)
                    return null;

                WorldResult r = new WorldResult();
                r.SectorX = sector.X;
                r.SectorY = sector.Y;
                r.SectorTags = sector.TagString;
                r.HexX = world.X;
                r.HexY = world.Y;
                r.Name = world.Name;
                r.Sector = sector.Names[0].Text;
                r.Uwp = world.UWP;
                r.Importance = world.ImportanceValue;

                return r;
            }

            if (location is SubsectorLocation)
            {
                Sector sector;
                Subsector subsector;
                ((SubsectorLocation)location).Resolve(map, out sector, out subsector);

                if (sector == null || subsector == null)
                    return null;

                SubsectorResult r = new SubsectorResult();
                r.SectorX = sector.X;
                r.SectorY = sector.Y;
                r.SectorTags = sector.TagString;
                r.Name = subsector.Name;
                r.Index = subsector.Index;
                r.Sector = sector.Names[0].Text;

                return r;
            }

            if (location is SectorLocation)
            {
                Sector sector = ((SectorLocation)location).Resolve(map);

                if (sector == null)
                    return null;

                SectorResult r = new SectorResult();
                r.SectorX = sector.X;
                r.SectorY = sector.Y;
                r.SectorTags = sector.TagString;
                r.Name = sector.Names[0].Text;

                return r;
            }

            if (location is LabelLocation)
            {
                LabelLocation label = location as LabelLocation;
                Location l = Astrometrics.CoordinatesToLocation(label.Coords);
                Sector sector = label.Resolve(map);

                LabelResult r = new LabelResult();
                r.Name = label.Label;
                r.SectorX = l.Sector.X;
                r.SectorY = l.Sector.Y;
                r.HexX = l.Hex.X;;
                r.HexY = l.Hex.Y;
                r.Scale =
                    label.Radius > 80 ? 4 :
                    label.Radius > 40 ? 8 :
                    label.Radius > 20 ? 32 : 64;
                r.SectorTags = sector.TagString;

                return r;
            }

            throw new ArgumentException(string.Format("Unexpected result type: {0}", location.GetType().Name), "location");
        }
Ejemplo n.º 39
0
        private bool PerformWaypoint(Waypoint wpt)
        {
            if (!Enabled)
                return false;

            if (wpt == null)
            {
                iterator++;
                return false;
            }

            if (Program.Player.Z != wpt.wLocation.Z)
                return true;

            switch (wpt.wType)
            {
                case Constants.WaypointType.Conditional:
                    return true;
                case Constants.WaypointType.DepositItem:
                    Container container = Program.Client.Inventory.GetContainers().FirstOrDefault(c => c.Name == "Depot Chest");
                    if (container == null)
                        return false;
                    if (!container.HasFreeSpace())
                        return false;
                    ItemLocation itLoc = new ItemLocation();
                    itLoc.Type = ItemLocationType.Container;
                    itLoc.ContainerId = (byte)container.Id;
                    List<Container> cont = Program.Client.Inventory.GetContainers().ToList();
                    cont.Remove(container);
                    foreach (Container c in cont)
                    {
                        foreach (Item i in c.GetItems())
                            if (i.Id == wpt.wItemID)
                                i.Move(itLoc);
                    }
                    return true;
                case Constants.WaypointType.GotoLabel:
                    iterator = Waypoints.FindIndex(w => w.wLabelName == wpt.wLabelName);
                    return true;
                case Constants.WaypointType.Label:
                    return true;
                case Constants.WaypointType.Ladder:
                    uint oldZ = Program.Player.Z;
                    Tile ladderTile = Program.Client.Map.GetTile(wpt.wLocation);
                    ladderTile.Items.FirstOrDefault(tItem => tItem.LensHelp == Tibia.Addresses.DatItem.Help.IsLadder).Use();
                    if (Program.Player.Z != oldZ)
                        return true;
                    else
                        return false;
                case Constants.WaypointType.Move:
                    if (Program.Player.Location != wpt.wLocation)
                    {
                        if (!Program.Player.IsWalking)
                            Program.Player.GoTo = wpt.wLocation;
                        return false;
                    }
                    return true;
                case Constants.WaypointType.ReachAndOpenDepot:
                    return true;
                case Constants.WaypointType.Rope:
                    oldZ = Program.Player.Z;
                    Tile ropeTile = Program.Client.Map.GetTile(wpt.wLocation);
                    Program.Client.Inventory.UseItemOnTile(Rope.Id, ropeTile);
                    if (Program.Player.Z != oldZ)
                        return true;
                    else
                        return false;
                case Constants.WaypointType.Say:
                    return true;
                case Constants.WaypointType.Shop:
                    if (wpt.wShopAction == Constants.ShopAction.Buy)
                        Tibia.Packets.Outgoing.ShopBuyPacket.Send(Program.Client, (ushort)wpt.wItemID, (byte)0, (byte)wpt.wAmount, false);
                    else if (wpt.wShopAction == Constants.ShopAction.BuyWithBPs)
                        Tibia.Packets.Outgoing.ShopBuyPacket.Send(Program.Client, (ushort)wpt.wItemID, (byte)0, (byte)wpt.wAmount, true);
                    else if (wpt.wShopAction == Constants.ShopAction.Sell)
                        Tibia.Packets.Outgoing.ShopSellPacket.Send(Program.Client, (ushort)wpt.wItemID, (byte)0, (byte)wpt.wAmount);
                    return true;
                case Constants.WaypointType.Shovel:
                    Tile shovelTile = Program.Client.Map.GetTile(wpt.wLocation);
                    Program.Client.Inventory.UseItemOnTile(Shovel.Id, shovelTile);
                    return true;
                case Constants.WaypointType.Sleep:
                    return true;
                case Constants.WaypointType.StackItems:
                    Program.Client.Inventory.StackItems();
                    return true;
            }
            return true;
        }
 private void Faction_PopulateInfo(ItemLocation src)
 {
     if ((src is FactionItem) == false) { return; }
     //
     FactionItem topop = src as FactionItem;
     // Name & Area
     TB_Faction_Name.Text = topop.FactionName;
     CB_Faction_Level.SelectedIndex = (int)topop.Level;
     // Money Cost
     int total = topop.Cost;
     int gold = total / 10000;
     total -= gold * 10000;
     int silver = total / 100;
     total -= silver * 100;
     TB_Faction_Money_1.Value = gold;
     TB_Faction_Money_2.Value = silver;
     TB_Faction_Money_3.Value = total;
     // Token Map Cost (TODO)
     //
     isChanging = false;
     Faction_InfoChanged();
     isChanging = true;
 }
Ejemplo n.º 41
0
            public static SearchResultItem LocationToSearchResult(SectorMap map, ResourceManager resourceManager, ItemLocation location)
            {
                if (location is WorldLocation)
                {
                    Sector sector;
                    World world;
                    ((WorldLocation)location).Resolve(map, resourceManager, out sector, out world);

                    if (sector == null || world == null)
                        return null;

                    WorldResult r = new WorldResult();
                    r.SectorX = sector.X;
                    r.SectorY = sector.Y;
                    r.SectorTags = sector.TagString;
                    r.HexX = world.X;
                    r.HexY = world.Y;
                    r.Name = world.Name;
                    r.Sector = sector.Names[0].Text;
                    r.Uwp = world.UWP;
                    r.Importance = world.ImportanceValue;

                    return r;
                }
                else if (location is SubsectorLocation)
                {
                    Sector sector;
                    Subsector subsector;
                    ((SubsectorLocation)location).Resolve(map, out sector, out subsector);

                    if (sector == null || subsector == null)
                        return null;

                    SubsectorResult r = new SubsectorResult();
                    r.SectorX = sector.X;
                    r.SectorY = sector.Y;
                    r.SectorTags = sector.TagString;
                    r.Name = subsector.Name;
                    r.Index = subsector.Index;
                    r.Sector = sector.Names[0].Text;

                    return r;
                }
                else if (location is SectorLocation)
                {
                    Sector sector = ((SectorLocation)location).Resolve(map);

                    if (sector == null)
                        return null;

                    SectorResult r = new SectorResult();
                    r.SectorX = sector.X;
                    r.SectorY = sector.Y;
                    r.SectorTags = sector.TagString;
                    r.Name = sector.Names[0].Text;

                    return r;
                }

                return null;
            }
 private void PvP_PopulateInfo(ItemLocation src)
 {
     if ((src is PvpItem) == false) { return; }
     //
     PvpItem topop = src as PvpItem;
     // Points Type and Cost
     if (topop.PointType == null) { topop.PointType = "Honor"; }
     if (topop.TokenType == null) { topop.TokenType = ""; }
     TB_PvP_Points.SelectedItem = topop.PointType;
     NUD_PvP_Points.Value = topop.Points;
     // Token Map Cost (TODO)
     TB_PvP_Token.Text = topop.TokenType;
     NUD_PvP_Token.Value = topop.TokenCount;
     // Arena Rating Cost
     NUD_PvP_Arena.Value = topop.ArenaRating;
     //
     isChanging = false;
     PvP_InfoChanged();
     isChanging = true;
 }
 private void Crafted_PopulateInfo(ItemLocation src)
 {
     if ((src is CraftedItem) == false) { return; }
     //
     CraftedItem topop = src as CraftedItem;
     //
     if (topop.Skill == null) { topop.Skill = "Unknown"; }
     //if (topop.Level == null) { topop.Level = 0; }
     if (topop.SpellName == null) { topop.SpellName = ""; }
     //if (topop.Bind == null) { topop.Bind = BindsOn.BoE; }
     // Points Type and Cost
     TB_Crafted_Name.Text = topop.Skill;
     TB_Crafted_Money_1.Value = topop.Level;
     // Token Map Cost (TODO)
     TB_Crafted_Token_1.Text = topop.SpellName;
     TB_Crafted_Token_2.SelectedIndex = (int)topop.Bind;
     //
     isChanging = false;
     Crafted_InfoChanged();
     isChanging = true;
 }
 private void Achievement_InfoChanged()
 {
     if (isChanging) { return; }
     if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
     if ((CB_Type.SelectedItem as String) != "Achievement") { return; }
     //
     isChanging = true;
     //
     NewSource = new AchievementItem()
     {
         AchievementName = TB_Achievement_Name.Text,
     };
     //
     UpdateString();
     //
     isChanging = false;
 }
 private void Achievement_PopulateInfo(ItemLocation src)
 {
     if ((src is AchievementItem) == false) { return; }
     //
     AchievementItem topop = src as AchievementItem;
     // Zone, Name, Party Size, Minimum Level
     if (topop.AchievementName == null) { topop.AchievementName = "Unknown Achievement"; }
     TB_Achievement_Name.Text = topop.AchievementName;
     //
     isChanging = false;
     Achievement_InfoChanged();
     isChanging = true;
 }
Ejemplo n.º 46
0
        void autoLoot()
        {
            var containers = _client.Inventory.GetContainers();

            foreach (Tibia.Objects.Container c in containers)
            {
                if (isLootContainer(c.Number) && !Tibia.Constants.ItemLists.Container.ContainsKey((uint)c.Id))
                {
                    var cItems = c.GetItems();

                    foreach (Item item in cItems)
                    {
                        var lootItem = _lootItems.Find(delegate(LootItem lItem) { return lItem.Id == item.Id; });

                        if (lootItem != null)
                        {
                            var lootContainer = _client.Inventory.GetContainer(lootItem.Container);

                            if (lootContainer != null)
                            {
                                if (item.GetFlag(Tibia.Addresses.DatItem.Flag.IsStackable))
                                {
                                    //o item é "stackable"
                                    var lootContainerItem = lootContainer.GetItems().FirstOrDefault(lCItem => lCItem.Id == item.Id && lCItem.Count < 100);

                                    if (lootContainerItem != null && (lootContainerItem.Count + item.Count <= 100 || lootContainer.Amount < lootContainer.Volume))
                                    {
                                        item.Move(lootContainerItem.Location);

                                        //change others items location;
                                        foreach (Item i in cItems)
                                        {
                                            if (i.Location.StackOrder > item.Location.StackOrder)
                                            {
                                                i.Location.StackOrder--;
                                                i.Location.ContainerSlot--;
                                            }
                                        }

                                        _container = lootContainer.Number;
                                        _autoLootWait = AutoLootWait_t.MOVE_ITEM;
                                        _autoLootAutoEvent.WaitOne();

                                        //sleep.. para a msg chegar no client..
                                        Thread.Sleep(50);
                                    }
                                    else if (lootContainerItem == null && lootContainer.Amount < lootContainer.Volume)
                                    {
                                        var iLoc = new ItemLocation();
                                        iLoc.Type = Tibia.Constants.ItemLocationType.Container;
                                        iLoc.ContainerId = lootContainer.Number;
                                        iLoc.ContainerSlot = (byte)(lootContainer.Volume - 1);
                                        item.Move(iLoc);

                                        //change others items location...
                                        foreach (Item i in cItems)
                                        {
                                            if (i.Location.StackOrder > item.Location.StackOrder)
                                            {
                                                i.Location.StackOrder--;
                                                i.Location.ContainerSlot--;
                                            }
                                        }

                                        _container = lootContainer.Number;
                                        _autoLootWait = AutoLootWait_t.MOVE_ITEM;
                                        _autoLootAutoEvent.WaitOne();

                                        //sleep.. para a msg chegar no client..
                                        Thread.Sleep(50);
                                    }
                                    else
                                    {

                                        if (lootContainerItem != null)
                                        {
                                            item.Move(lootContainerItem.Location);
                                            _container = lootContainer.Number;
                                            _autoLootWait = AutoLootWait_t.MOVE_ITEM;
                                            _autoLootAutoEvent.WaitOne();

                                        }

                                        //abrir um novo container...
                                        var newContainer = lootContainer.GetItems().FirstOrDefault(newItemContainer => newItemContainer.GetFlag(Tibia.Addresses.DatItem.Flag.IsContainer));

                                        if (newContainer != null)
                                        {
                                            newContainer.OpenAsContainer(lootContainer.Number);

                                            _container = lootContainer.Number;
                                            _autoLootWait = AutoLootWait_t.OPEN_NEW_LOOT_CONTAINER;
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    if (lootContainer.Amount < lootContainer.Volume)
                                    {
                                        var iLoc = new ItemLocation();
                                        iLoc.Type = Tibia.Constants.ItemLocationType.Container;
                                        iLoc.ContainerId = lootContainer.Number;
                                        iLoc.ContainerSlot = (byte)(lootContainer.Volume - 1);
                                        item.Move(iLoc);

                                        //change others items location...
                                        foreach (Item i in cItems)
                                        {
                                            if (i.Location.StackOrder > item.Location.StackOrder)
                                            {
                                                i.Location.StackOrder--;
                                                i.Location.ContainerSlot--;
                                            }
                                        }


                                        //esperar a chegada do item move?
                                        _container = lootContainer.Number;
                                        _autoLootWait = AutoLootWait_t.MOVE_ITEM;
                                        _autoLootAutoEvent.WaitOne();

                                        //sleep.. para a msg chegar no client..
                                        Thread.Sleep(50);
                                    }
                                    else
                                    {
                                        //abrir um novo container
                                        var newContainer = lootContainer.GetItems().FirstOrDefault(newItemContainer => newItemContainer.GetFlag(Tibia.Addresses.DatItem.Flag.IsContainer));

                                        if (newContainer != null)
                                        {
                                            newContainer.OpenAsContainer(lootContainer.Number);
                                            _container = lootContainer.Number;
                                            _autoLootWait = AutoLootWait_t.OPEN_NEW_LOOT_CONTAINER;
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    //abrir bag se tiver.. no mesmo container?

                    var bag = cItems.FirstOrDefault(i => i.GetFlag(Tibia.Addresses.DatItem.Flag.IsContainer));

                    if (bag != null)
                    {
                        bag.OpenAsContainer(c.Number);
                        return;
                    }
                    else if (_autoEatFoodFromBodys)
                    {
                        var food = cItems.FirstOrDefault(i => Tibia.Constants.ItemLists.Foods.ContainsKey(i.Id));

                        if (food != null)
                        {
                            food.Use();

                            _container = c.Number;
                            _autoLootWait = AutoLootWait_t.EAT_FOOD;
                            _autoLootAutoEvent.WaitOne();

                            //sleep.. para a msg chegar no client..
                            Thread.Sleep(50);
                        }
                    }
                }
            }
        }
Ejemplo n.º 47
0
        public static ItemComponent CreateNewItem(MessageProvider messageProvider, GameState state,
            string name, string imageLocation, string description,
            string modelPath, Vector2i size, Vector3 offset, Quaternion rotation, Shape shape, ItemLocation location,
            AttackClass attackClasses, ItemUsage itemUsages, Protection protection, Material physicsMaterial,
            float mass, float healthDelta, float usageDeltaPerUsage, float attackStrength, float throwPower, float usage)
        {
            var entity = EntityFactory.Instance.CreateWith(name, messageProvider,
                systems: new[] { typeof(ItemSystem), typeof(ModelSystem), typeof(PhysicsSystem) });

            var item = entity.GetComponent<ItemComponent>();
            item.ImageLocation = imageLocation;
            item.Description = description;
            item.Size = size;
            item.Location = location;
            item.AttackClasses = attackClasses;
            item.ItemUsages = itemUsages;
            item.Protection = protection;
            item.HealthDelta = healthDelta;
            item.AttackStrength = attackStrength;
            item.ThrowPower = throwPower;
            item.Usage = usage;
            item.UsageDeltaPerUsage = usageDeltaPerUsage;
            item.Mass = mass;
            item.PhysicsMaterial = physicsMaterial;
            item.PositionOffset = offset;
            item.Rotation = rotation;
            item.ItemUsageHandler = new MazeItemUseHandler();

            var model = new ModelSceneObject(modelPath);
            model.Enabled = true;
            state.Scene.AddObject(model);
            entity.GetComponent<ModelComponent>().Model = model;

            var transform = entity.GetComponent<TransformComponent>();
            var physics = entity.GetComponent<PhysicsComponent> ();

            if (shape == null)
            {
                List<JVector> vertices = new List<JVector>();
                model.Model.Meshes[0].Vertices.ForEach(x => vertices.Add(x.ToJitterVector()));

                List<TriangleVertexIndices> indices = new List<TriangleVertexIndices>();

                for(int i = 0; i < model.Model.Meshes[0].Indices.Length; i+= 3)
                {
                    int i0 = model.Model.Meshes[0].Indices[i+0];
                    int i1 = model.Model.Meshes[0].Indices[i+1];
                    int i2 = model.Model.Meshes[0].Indices[i+2];

                    indices.Add(new TriangleVertexIndices(i0, i1, i2));
                }

                shape = new TriangleMeshShape(new Octree(vertices, indices));
            }

            var body = new RigidBody(shape);
            body.Position = transform.Position.ToJitterVector ();
            if (mass >= 0)
                body.Mass = mass;
            body.Material = physicsMaterial;
            body.AllowDeactivation = true;
            body.Tag = entity;

            state.PhysicsManager.World.AddBody(body);
            physics.RigidBody = body;
            physics.World = state.PhysicsManager.World;
            physics.PhysicsApplying = AffectedByPhysics.Orientation | AffectedByPhysics.Position;
            physics.RigidBody.IsStatic = false;
            physics.RigidBody.IsActive = false;
            physics.RigidBody.Position = transform.Position.ToJitterVector();
            model.Position = transform.Position;

            return item;
        }
 private void WorldDrop_PopulateInfo(ItemLocation src)
 {
     if ((src is WorldDrop) == false) { return; }
     //
     WorldDrop topop = src as WorldDrop;
     // Heroic Mode and Location
     if (topop.Location == null) { topop.Location = "Unknown Zone"; }
     TB_WorldDrop_Name.Text = topop.Location;
     TB_WorldDrop_Money_1.IsChecked = topop.Heroic;
     //
     isChanging = false;
     WorldDrop_InfoChanged();
     isChanging = true;
 }
 private void WorldDrop_InfoChanged()
 {
     if (isChanging) { return; }
     if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
     if ((CB_Type.SelectedItem as String) != "World Drop") { return; }
     //
     isChanging = true;
     //
     NewSource = new WorldDrop()
     {
         Heroic = TB_WorldDrop_Money_1.IsChecked.GetValueOrDefault(false),
         Location = TB_WorldDrop_Name.Text,
     };
     //
     UpdateString();
     //
     isChanging = false;
 }
 private void Container_PopulateInfo(ItemLocation src)
 {
     if ((src is ContainerItem) == false) { return; }
     //
     ContainerItem topop = src as ContainerItem;
     // Points Type and Cost
     TB_Container_Name.Text = topop.Area;
     TB_Container_Money_1.Text = topop.Container;
     CB_Container_Heroic.IsChecked = topop.Heroic;
     CB_Container_LFR.IsChecked = topop.LFR;
     TB_Container_Money_2.Value = topop.MinLevel;
     TB_Container_Money_3.Value = topop.Party;
     //
     isChanging = false;
     Container_InfoChanged();
     isChanging = true;
 }
 private void Crafted_InfoChanged()
 {
     if (isChanging) { return; }
     if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
     if ((CB_Type.SelectedItem as String) != "Crafted") { return; }
     //
     isChanging = true;
     //
     NewSource = new CraftedItem()
     {
         Skill = TB_Crafted_Name.Text,
         Level = (int)TB_Crafted_Money_1.Value,
         SpellName = TB_Crafted_Token_1.Text,
         Bind = (BindsOn)TB_Crafted_Token_2.SelectedIndex,
     };
     //
     UpdateString();
     //
     isChanging = false;
 }
        private void Container_InfoChanged()
        {
            if (isChanging) { return; }
            if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
            if ((CB_Type.SelectedItem as String) != "Container") { return; }
            
            isChanging = true;

            if (CB_Container_Heroic.IsChecked.Value.Equals(true))
                CB_Container_LFR.IsChecked = false;
            else if (CB_Container_LFR.IsChecked.Value.Equals(true))
                CB_Container_Heroic.IsChecked = false;

            NewSource = new ContainerItem()
            {
                Area = TB_Container_Name.Text,
                Container = TB_Container_Money_1.Text,
                Heroic = CB_Container_Heroic.IsChecked.GetValueOrDefault(false),
                LFR = CB_Container_LFR.IsChecked.GetValueOrDefault(false),
                MinLevel = (int)TB_Container_Money_2.Value,
                Party = (int)TB_Container_Money_3.Value,
            };
            //
            UpdateString();
            //
            isChanging = false;
        }
 private void Quest_PopulateInfo(ItemLocation src)
 {
     if ((src is QuestItem) == false) { return; }
     //
     QuestItem topop = src as QuestItem;
     // Zone, Name, Party Size, Minimum Level
     TB_Quest_Name.Text = topop.Area;
     TB_Quest_Money_1.Text = topop.Quest;
     TB_Quest_Money_2.Value = topop.Party;
     TB_Quest_Money_3.Value = topop.MinLevel;
     //
     isChanging = false;
     Quest_InfoChanged();
     isChanging = true;
 }
 private void Quest_InfoChanged()
 {
     if (isChanging) { return; }
     if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
     if ((CB_Type.SelectedItem as String) != "Quest") { return; }
     //
     isChanging = true;
     //
     NewSource = new QuestItem()
     {
         Area = TB_Quest_Name.Text,
         Quest = TB_Quest_Money_1.Text,
         Party = (int)TB_Quest_Money_2.Value,
         MinLevel = (int)TB_Quest_Money_3.Value,
     };
     //
     UpdateString();
     //
     isChanging = false;
 }
 private void PvP_InfoChanged()
 {
     if (isChanging) { return; }
     if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
     if ((CB_Type.SelectedItem as String) != "PvP") { return; }
     //
     isChanging = true;
     //
     NewSource = new PvpItem() {
         PointType = TB_PvP_Points.SelectedItem as String,
         Points = (int)NUD_PvP_Points.Value,
         TokenType = TB_PvP_Token.Text,
         TokenCount = (int)NUD_PvP_Token.Value,
         ArenaRating = (int)NUD_PvP_Arena.Value,
     };
     //
     UpdateString();
     //
     isChanging = false;
 }
 private void StaticDrop_PopulateInfo(ItemLocation src)
 {
     if ((src is StaticDrop) == false) { return; }
     //
     StaticDrop topop = src as StaticDrop;
     // Points Type and Cost
     if (topop.Area == null) { topop.Area = "Unknown Area"; }
     if (topop.Boss == null) { topop.Boss = "Unknown Boss"; }
     //if (topop.Count == null) { topop.Count = 0; }
     //if (topop.OutOf == null) { topop.OutOf = 0; }
     TB_StaticDrop_Name.Text = topop.Area;
     CB_StaticDrop_Heroic.IsChecked = topop.Heroic;
     CB_StaticDrop_LFR.IsChecked = topop.LFR;
     TB_StaticDrop_Token_1.Text = topop.Boss;
     NUD_StaticDrop_Count.Value = topop.Count;
     NUD_StaticDrop_OutOf.Value = topop.OutOf;
     //
     isChanging = false;
     StaticDrop_InfoChanged();
     isChanging = true;
 }
Ejemplo n.º 57
0
        private void GetItem(Item item, Container container)
        {
            if (item.GetFlag(Tibia.Addresses.DatItem.Flag.IsStackable))
            {
                var lootContainerItem = container.GetItems().FirstOrDefault(lCItem => lCItem.Id == item.Id && lCItem.Count < 100);

                if (lootContainerItem != null && (lootContainerItem.Count + item.Count <= 100 || container.Amount < container.Volume))
                {
                    item.Move(lootContainerItem.Location);
                }
                else if (lootContainerItem == null && container.Amount < container.Volume)
                {
                    var itemLocation = new ItemLocation();
                    itemLocation.Type = ItemLocationType.Container;
                    itemLocation.ContainerId = container.Number;
                    itemLocation.ContainerSlot = (byte)(container.Volume - 1);
                    item.Move(itemLocation);
                }
                else if (OpenNextContainer)
                {
                    if (lootContainerItem != null)
                    {
                        item.Move(lootContainerItem.Location);
                    }

                    var newContainer = container.GetItems().FirstOrDefault(newItemContainer => newItemContainer.GetFlag(Tibia.Addresses.DatItem.Flag.IsContainer));

                    if (newContainer != null)
                    {
                        OpenNewContainer(newContainer, container.Number);
                    }
                }
            }
            else
            {
                if (container.Amount < container.Volume)
                {
                    var itemLocation = new ItemLocation();
                    itemLocation.Type = ItemLocationType.Container;
                    itemLocation.ContainerId = container.Number;
                    itemLocation.ContainerSlot = (byte)(container.Volume - 1);
                    item.Move(itemLocation);
                }
                else if (OpenNextContainer)
                {
                    var newContainer = container.GetItems().FirstOrDefault(newItemContainer => newItemContainer.GetFlag(Tibia.Addresses.DatItem.Flag.IsContainer));

                    if (newContainer != null)
                    {
                        OpenNewContainer(newContainer, container.Number);
                    }
                }
            }
        }
 private void Faction_InfoChanged()
 {
     if (isChanging) { return; }
     if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
     if ((CB_Type.SelectedItem as String) != "Faction") { return; }
     //
     isChanging = true;
     //
     int total = 0;
     int gold = (int)TB_Faction_Money_1.Value; total += gold * 10000;
     int silver = (int)TB_Faction_Money_2.Value; total += silver * 100;
     int copper = (int)TB_Faction_Money_3.Value; total += copper;
     //
     NewSource = new FactionItem() {
         Cost = total,
         FactionName = TB_Faction_Name.Text,
         Level = (ReputationLevel)CB_Faction_Level.SelectedIndex,
     };
     //
     UpdateString();
     //
     isChanging = false;
 }
 private void Vendor_InfoChanged()
 {
     if (isChanging) { return; }
     if (CB_Type == null || CB_Type.SelectedItem == null) { return; }
     if ((CB_Type.SelectedItem as String) != "Vendor") { return; }
     //
     isChanging = true;
     // Money
     int total = 0;
     int gold = (int)TB_Vendor_Money_1.Value; total += gold * 10000;
     int silver = (int)TB_Vendor_Money_2.Value; total += silver * 100;
     int copper = (int)TB_Vendor_Money_3.Value; total += copper;
     // Tokens
     SerializableDictionary<string, int> tokenMap = new SerializableDictionary<string, int>();
     switch (TB_Vendor_Token_Level.SelectedIndex)
         {
         case 2:
             TB_Vendor_Token_1.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11N.Visibility = Visibility.Visible;
             TB_Vendor_Token_11H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13LFR.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13H.Visibility = Visibility.Collapsed;
             // The way that these two add in, even if Token one is bad and Token 2 is ok, we'll get the result we want in the item source
             if (!String.IsNullOrEmpty(TB_Vendor_Token_11N.SelectedItem as String))
             {
                 tokenMap.Add(TB_Vendor_Token_11N.SelectedItem as String, (int)TB_Vendor_TokenCount_1.Value);
             }
             break;
         case 3:
             TB_Vendor_Token_1.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11H.Visibility = Visibility.Visible;
             TB_Vendor_Token_12N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13LFR.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13H.Visibility = Visibility.Collapsed;
             // The way that these two add in, even if Token one is bad and Token 2 is ok, we'll get the result we want in the item source
             if (!String.IsNullOrEmpty(TB_Vendor_Token_11H.SelectedItem as String))
             {
                 tokenMap.Add(TB_Vendor_Token_11H.SelectedItem as String, (int)TB_Vendor_TokenCount_1.Value);
             }
             break;
         case 4:
             TB_Vendor_Token_1.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12N.Visibility = Visibility.Visible;
             TB_Vendor_Token_12H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13LFR.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13H.Visibility = Visibility.Collapsed;
             // The way that these two add in, even if Token one is bad and Token 2 is ok, we'll get the result we want in the item source
             if (!String.IsNullOrEmpty(TB_Vendor_Token_12N.SelectedItem as String))
             {
                 tokenMap.Add(TB_Vendor_Token_12N.SelectedItem as String, (int)TB_Vendor_TokenCount_1.Value);
             }
             break;
         case 5:
             TB_Vendor_Token_1.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12H.Visibility = Visibility.Visible;
             TB_Vendor_Token_13LFR.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13H.Visibility = Visibility.Collapsed;
             // The way that these two add in, even if Token one is bad and Token 2 is ok, we'll get the result we want in the item source
             if (!String.IsNullOrEmpty(TB_Vendor_Token_12H.SelectedItem as String))
             {
                 tokenMap.Add(TB_Vendor_Token_12H.SelectedItem as String, (int)TB_Vendor_TokenCount_1.Value);
             }
             break;
         case 6:
             TB_Vendor_Token_1.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13LFR.Visibility = Visibility.Visible;
             TB_Vendor_Token_13N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13H.Visibility = Visibility.Collapsed;
             // The way that these two add in, even if Token one is bad and Token 2 is ok, we'll get the result we want in the item source
             if (!String.IsNullOrEmpty(TB_Vendor_Token_13LFR.SelectedItem as String))
             {
                 tokenMap.Add(TB_Vendor_Token_13LFR.SelectedItem as String, (int)TB_Vendor_TokenCount_1.Value);
             }
             break;
         case 7:
             TB_Vendor_Token_1.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13LFR.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13N.Visibility = Visibility.Visible;
             TB_Vendor_Token_13H.Visibility = Visibility.Collapsed;
             // The way that these two add in, even if Token one is bad and Token 2 is ok, we'll get the result we want in the item source
             if (!String.IsNullOrEmpty(TB_Vendor_Token_13N.SelectedItem as String))
             {
                 tokenMap.Add(TB_Vendor_Token_13N.SelectedItem as String, (int)TB_Vendor_TokenCount_1.Value);
             }
             break;
         case 8:
             TB_Vendor_Token_1.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13LFR.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13H.Visibility = Visibility.Visible;
             // The way that these two add in, even if Token one is bad and Token 2 is ok, we'll get the result we want in the item source
             if (!String.IsNullOrEmpty(TB_Vendor_Token_13H.SelectedItem as String))
             {
                 tokenMap.Add(TB_Vendor_Token_13H.SelectedItem as String, (int)TB_Vendor_TokenCount_1.Value);
             }
             break;
         default:
             TB_Vendor_Token_Level.SelectedIndex = 1;
             TB_Vendor_Token_1.Visibility = Visibility.Visible;
             TB_Vendor_Token_11N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_11H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_12H.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13LFR.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13N.Visibility = Visibility.Collapsed;
             TB_Vendor_Token_13H.Visibility = Visibility.Collapsed;
             // The way that these two add in, even if Token one is bad and Token 2 is ok, we'll get the result we want in the item source
             if (!String.IsNullOrEmpty(TB_Vendor_Token_1.SelectedItem as String))
             {
                 tokenMap.Add(TB_Vendor_Token_1.SelectedItem as String, (int)TB_Vendor_TokenCount_1.Value);
             }
             break;
         }
     if (TB_Vendor_Token_2.Text != "") {
         tokenMap.Add(TB_Vendor_Token_2.Text, (int)TB_Vendor_TokenCount_2.Value);
     }
     //
     NewSource = new VendorItem()
     {
         VendorName = TB_Vendor_Name.Text,
         VendorArea = TB_Vendor_Area.Text,
         Cost = total,
         TokenMap = tokenMap,
     };
     //
     UpdateString();
     //
     isChanging = false;
 }
 private void Vendor_PopulateInfo(ItemLocation src) {
     if ((src is VendorItem) == false) { return; }
     //
     VendorItem topop = src as VendorItem;
     // Name & Area
     if (topop.VendorName == null) { topop.VendorName = ""; }
     if (topop.VendorArea == null) { topop.VendorArea = ""; }
     TB_Vendor_Name.Text = topop.VendorName;
     TB_Vendor_Area.Text = topop.VendorArea;
     // Money Cost
     int total = topop.Cost;
     int gold = total / 10000;
     total -= gold * 10000;
     int silver = total / 100;
     total -= silver * 100;
     TB_Vendor_Money_1.Value = gold;
     TB_Vendor_Money_2.Value = silver;
     TB_Vendor_Money_3.Value = total;
     // Token Map Cost
     if (topop.TokenMap != null && topop.TokenMap.Keys.Count > 0)
     {
         // There's only one token and it is in the Token 1 List
         if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_1.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_Level.SelectedIndex = 1;
             TB_Vendor_Token_1.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
         }
         else if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_11N.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_Level.SelectedIndex = 2;
             TB_Vendor_Token_11N.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
         }
         else if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_11H.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_Level.SelectedIndex = 3;
             TB_Vendor_Token_11H.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
         }
         else if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_12N.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_Level.SelectedIndex = 4;
             TB_Vendor_Token_12N.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
         }
         else if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_12H.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_Level.SelectedIndex = 5;
             TB_Vendor_Token_12H.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
         }
         else if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_13LFR.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_Level.SelectedIndex = 6;
             TB_Vendor_Token_13LFR.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
         }
         else if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_13N.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_Level.SelectedIndex = 7;
             TB_Vendor_Token_13N.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
         }
         else if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_13H.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_Level.SelectedIndex = 8;
             TB_Vendor_Token_13H.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
         }
         // There's only one token and it is NOT in the Token 1 List, so we put it in Token 2's box
         else if (topop.TokenMap.Keys.Count == 1 && TB_Vendor_Token_1.Items.Contains(topop.TokenMap.Keys.ToList()[0]))
         {
             TB_Vendor_Token_2.Text = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_2.Value = topop.TokenMap.Values.ToList()[0];
         }
         // There's two tokens and they are both valid
         else if (topop.TokenMap.Keys.Count > 1 && topop.TokenMap.Keys.ToList()[1] != null)
         {
             TB_Vendor_Token_1.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
             TB_Vendor_Token_2.Text = topop.TokenMap.Keys.ToList()[1];
             TB_Vendor_TokenCount_2.Value = topop.TokenMap.Values.ToList()[1];
         }
         // There's two tokens and the second one is invalid
         else if (topop.TokenMap.Keys.Count > 1 && topop.TokenMap.Keys.ToList()[1] == null)
         {
             TB_Vendor_Token_1.SelectedItem = topop.TokenMap.Keys.ToList()[0];
             TB_Vendor_TokenCount_1.Value = topop.TokenMap.Values.ToList()[0];
             TB_Vendor_Token_2.Text = "";
             TB_Vendor_TokenCount_2.Value = 0;
         }
         // We didn't fit any other valid situation, so let's just blank them and let the user fill it in
         else
         {
             TB_Vendor_Token_1.SelectedItem = "";
             TB_Vendor_TokenCount_1.Value = 0;
             TB_Vendor_Token_2.Text = "";
             TB_Vendor_TokenCount_2.Value = 0;
         }
     } else {
         TB_Vendor_Token_1.SelectedItem = "";
         TB_Vendor_TokenCount_1.Value = 0;
         TB_Vendor_Token_2.Text = "";
         TB_Vendor_TokenCount_2.Value = 0;
     }
     //
     isChanging = false;
     Vendor_InfoChanged();
     isChanging = true;
 }