Ejemplo n.º 1
0
        public static void SetVisual(this uint pc, string[] chatArray)
        {
            var item = GetItemInSlot(InventorySlotType.RightHand, pc);

            if (GetIsObjectValid(item))
            {
                BiowareXP2.IPRemoveMatchingItemProperties(item, ItemPropertyType.Visualeffect, DurationType.Permanent, -1);
                ItemProperty type;

                switch (chatArray[1])
                {
                case "acid": type = ItemPropertyVisualEffect(ItemVisualType.Acid); break;

                case "cold": type = ItemPropertyVisualEffect(ItemVisualType.Cold); break;

                case "electric": type = ItemPropertyVisualEffect(ItemVisualType.Electrical); break;

                case "evil": type = ItemPropertyVisualEffect(ItemVisualType.Evil); break;

                case "fire": type = ItemPropertyVisualEffect(ItemVisualType.Fire); break;

                case "holy": type = ItemPropertyVisualEffect(ItemVisualType.Holy); break;

                case "sonic": type = ItemPropertyVisualEffect(ItemVisualType.Sonic); break;

                default:
                    SendMessageToPC(pc, $"Cannot set weapon visual to {chatArray}.");
                    throw new ArgumentException($"Name:{GetName(pc)} | BIC:{Player.GetBicFileName(pc)} failed to set weapon visual to {chatArray}.");
                }

                BiowareXP2.IPSafeAddItemProperty(item, type, 0.0f, AddItemPropertyPolicy.ReplaceExisting, true, true);
            }
        }
Ejemplo n.º 2
0
        void WildshapeCopyWeaponProperties(uint pc, uint oldWeapon, uint newWeapon)
        {
            if (GetIsObjectValid(oldWeapon) && GetIsObjectValid(newWeapon))
            {
                ItemProperty ip = GetFirstItemProperty(oldWeapon);
                // If both are Melee Weapons
                if (!GetWeaponRanged(oldWeapon) && !GetWeaponRanged(newWeapon))
                {
                    while (GetIsItemPropertyValid(ip))
                    {
                        AddItemProperty(DurationType.Permanent, ip, newWeapon);
                        ip = GetNextItemProperty(oldWeapon);
                    }// while
                }

                // If both are Ranged Weapons
                else if (GetWeaponRanged(oldWeapon) && GetWeaponRanged(newWeapon))
                {
                    bool         unlimitedAmmoFound = false;
                    ItemProperty ipNew;
                    int          oldMightyValue = 0;
                    uint         ammo;

                    while (GetIsItemPropertyValid(ip))
                    {
                        if (GetItemPropertyType(ip) == ItemPropertyType.UnlimitedAmmunition) // 61 = Unlimited Ammo
                        {
                            // For some reason, when removing/replacing an unlimited
                            // ammo property, the corresponding missile type will get
                            // dropped in the player's inventory, so we have to remove
                            // that missile again to prevent abuse.
                            unlimitedAmmoFound = true;
                            ammo = GetItemInSlot(InventorySlotType.Arrows, pc);

                            if (!GetIsObjectValid(ammo))
                            {
                                ammo = GetItemInSlot(InventorySlotType.Bolts, pc);
                            }
                            if (!GetIsObjectValid(ammo))
                            {
                                ammo = GetItemInSlot(InventorySlotType.Bullets, pc);
                            }

                            BiowareXP2.IPRemoveMatchingItemProperties(newWeapon, ItemPropertyType.UnlimitedAmmunition, DurationType.Permanent, -1);
                            AddItemProperty(DurationType.Permanent, ip, newWeapon);
                            DestroyObject(ammo);
                        }
                        else if (GetItemPropertyType(ip) == ItemPropertyType.Mighty) // 45 = Mighty
                        {
                            ipNew = GetFirstItemProperty(newWeapon);
                            // Find the mighty value of the Polymorph's weapon
                            while (GetIsItemPropertyValid(ipNew))
                            {
                                if (GetItemPropertyType(ipNew) == ItemPropertyType.Mighty)
                                {
                                    oldMightyValue = GetItemPropertyCostTableValue(ipNew);
                                    break;
                                }
                                ipNew = GetNextItemProperty(newWeapon);
                            } // while
                              // If new mighty value bigger, remove old one and add new one.
                            if (GetItemPropertyCostTableValue(ip) > oldMightyValue)
                            {
                                RemoveItemProperty(newWeapon, ipNew);
                                AddItemProperty(DurationType.Permanent, ip, newWeapon);
                            }
                        }
                        else
                        {
                            AddItemProperty(DurationType.Permanent, ip, newWeapon);
                        }
                        ip = GetNextItemProperty(oldWeapon);
                    } // while
                      // Add basic unlimited ammo if necessary
                    if (unlimitedAmmoFound == false && !GetItemHasItemProperty(newWeapon, ItemPropertyType.UnlimitedAmmunition))
                    {
                        AddItemProperty(DurationType.Permanent, ItemPropertyUnlimitedAmmo(ItemPropertyUnlimitedType.Basic), newWeapon);
                    }
                }
            }
            else if (GetWeaponRanged(newWeapon))
            {
                // Add basic unlimited ammo if necessary
                if (!GetItemHasItemProperty(newWeapon, ItemPropertyType.UnlimitedAmmunition))
                {
                    AddItemProperty(DurationType.Permanent, ItemPropertyUnlimitedAmmo(ItemPropertyUnlimitedType.Basic), newWeapon);
                }
            }
        }