Beispiel #1
0
        public static void OnAcquireItem()
        {
            uint acquired = GetModuleItemAcquired();
            uint by       = GetModuleItemAcquiredBy();
            uint from     = GetModuleItemAcquiredFrom();

            string name   = GetName(acquired);
            string byName = GetName(by);

            from.PrintGPValue();
            BiowareXP2.IPRemoveAllItemProperties(acquired, DurationType.Temporary);

            if (GetIsDM(by))
            {
                return;
            }

            by.BarterFix(from);

            if (String.IsNullOrEmpty(name))
            {
                by.SendMessageToAllPartyWithinDistance($"{byName} acquired Gold Pieces.", 40.0f);
                return;
            }

            //Stop spam to combat log upon login
            by.SendMessageToAllPartyWithinDistance($"{byName} acquired {name}.", 40.0f);
        }
Beispiel #2
0
        public static void OnUnAcquireItem()
        {
            var unAcquired   = NWScript.GetModuleItemLost();
            var unAcquiredBy = NWScript.GetModuleItemLostBy();

            unAcquired.PrintGPValue();
            PlayerCharacter.Extensions.Save(unAcquiredBy);
            BiowareXP2.IPRemoveAllItemProperties(unAcquired, DurationType.Temporary);

            if (NWScript.GetIsDM(unAcquired))
            {
                return;
            }

            //Hopefully temp fix for disarm feat
            if (NWScript.GetIsInCombat(unAcquiredBy) && !NWScript.GetStolenFlag(unAcquired) && NWScript.GetIsWeaponEffective(NWScript.GetLastAttacker(unAcquired)))
            {
                NWScript.CopyItem(unAcquired, unAcquiredBy, true);
                NWScript.DestroyObject(unAcquired, 0.2f);
                return;
            }
        }
        private static void ProcessVersion6ItemChanges(NWPlayer player)
        {
            List <SerializedObjectData> serializedItems = new List <SerializedObjectData>();

            // Start with equipped items.
            foreach (var item in player.EquippedItems)
            {
                ProcessVersion6_DeflateItemStats(item);
                var data = ProcessVersion6LightsaberItem(item);
                if (data.Data != null)
                {
                    serializedItems.Add(data);
                }
            }
            // Next do all inventory items.
            foreach (var item in player.InventoryItems)
            {
                ProcessVersion6_DeflateItemStats(item);
                var data = ProcessVersion6LightsaberItem(item);
                if (data.Data != null)
                {
                    serializedItems.Add(data);
                }
            }

            // Deserialize all items onto the player now.
            foreach (var serialized in serializedItems)
            {
                var item = SerializationService.DeserializeItem(serialized.Data, player);
                BiowareXP2.IPRemoveAllItemProperties(item, DurationType.Permanent);
                foreach (var ip in serialized.ItemPropertiesToAdd)
                {
                    BiowareXP2.IPSafeAddItemProperty(item, ip, 0.0f, AddItemPropertyPolicy.ReplaceExisting, false, false);
                }
            }
        }