static void SelectSpell(Actor *perkOwner, System.Int32 result, System.Byte resultCount, System.IntPtr results, BGSEntryPointFunctionData *entryPointFunctionData)
            {
                // perkOwner				!= null
                // results					!= System.IntPtr.Zero
                // entryPointFunctionData	!= null

                if ((EntryPointFunctionResult)result != EntryPointFunctionResult.SpellItem)
                {
                    return;
                }

                if (resultCount != *(System.UInt32 *)ScrambledBugs.Offsets.Patches.ApplySpellPerkEntryPoints.MultipleSpells.SelectSpellResultCount)
                {
                    return;
                }

                if (entryPointFunctionData->GetDataType() != EntryPointFunctionDataType.SpellItem)
                {
                    return;
                }

                var spells = *(BSTArray **)results;
                var spell  = ((BGSEntryPointFunctionDataSpellItem *)entryPointFunctionData)->Spell();

                spells->Push(&spell);
            }
Beispiel #2
0
            static void ApplySpell(Actor *target, SpellItem *spell, Actor *caster)
            {
                // target	!= null
                // spell	!= null
                // caster	!= null

                spell->Apply(caster, target);
            }
            static void HandleEquippedItem(Actor *actor, TESBoundObject *item, ExtraDataList *extraDataList, System.Byte leftHand)
            {
                if (item == null)
                {
                    return;
                }

                var player    = PlayerCharacter.Instance;
                var rightHand = leftHand == 0;

                if (actor == player)
                {
                    player->RemoveEquippedItemFlags((System.Byte)((rightHand ? 1 : 0) + 1));
                }

                var enchantment = item->GetEnchantment(extraDataList);

                if (enchantment == null)
                {
                    return;
                }

                var castingType = enchantment->GetCastingType();

                if (castingType == CastingType.ConstantEffect)
                {
                    return;
                }

                var actorValue = enchantment->GetCostActorValue(rightHand);

                if (actorValue != ActorValue.None)
                {
                    actor->RemoveActorValueModifiers(actorValue);

                    var maximumCharge = item->GetMaximumCharge(extraDataList);
                    actor->ActorValueOwner()->SetActorValue(actorValue, maximumCharge);

                    if (extraDataList != null && extraDataList->HasExtraData(ExtraDataType.Charge))
                    {
                        var charge = extraDataList->GetCharge();
                        actor->ActorValueOwner()->RestoreActorValue(ActorValueModifier.Damage, actorValue, -(maximumCharge - charge));
                    }
                }

                actor->RevertSelectedSpell((EquipType)(rightHand ? 1 : 0), enchantment);
            }
 static System.Single GetActorValuePercentage(Actor *actor, System.Int32 actorValue)
 {
     return(ActorValuePercentage.GetActorValuePercentage(actor, (ActorValue)actorValue));
 }