コード例 #1
0
 public override TextFile.Token[] MagicPowers(TextFile.Formatting format)
 {   // %mpw
     if (parent.IsArtifact)
     {
         // Use appropriate artifact description message. (8700-8721)
         try {
             ArtifactsSubTypes artifactType = ItemHelper.GetArtifactSubType(parent.shortName);
             return(DaggerfallUnity.Instance.TextProvider.GetRSCTokens(8700 + (int)artifactType));
         } catch (KeyNotFoundException e) {
             Debug.Log(e.Message);
             return(null);
         }
     }
     else if (!parent.IsIdentified)
     {
         // Powers unknown.
         TextFile.Token nopowersToken = TextFile.CreateTextToken(HardStrings.powersUnknown);
         return(new TextFile.Token[] { nopowersToken });
     }
     else
     {
         // List item powers.
         // TODO: Update once magic effects have been implemented. (just puts "Power number N" for now)
         // Pretty sure low numbers are type of application, and higher ones are effects.
         // e.g. shield of fortitude is [1, 87] which maps to "Cast when held: Fortitude" in classic.
         List <TextFile.Token> magicPowersTokens = new List <TextFile.Token>();
         for (int i = 0; i < parent.legacyMagic.Length; i++)
         {
             if (parent.legacyMagic[i] == 0xffff)
             {
                 break;
             }
             magicPowersTokens.Add(TextFile.CreateTextToken("Power number " + parent.legacyMagic[i]));
             magicPowersTokens.Add(TextFile.CreateFormatToken(format));
         }
         return(magicPowersTokens.ToArray());
     }
 }
コード例 #2
0
            public override TextFile.Token[] MagicPowers(TextFile.Formatting format)
            {   // %mpw
                if (parent.IsArtifact)
                {
                    // Use appropriate artifact description message. (8700-8721)
                    try {
                        ArtifactsSubTypes artifactType = ItemHelper.GetArtifactSubType(parent.shortName);
                        return(DaggerfallUnity.Instance.TextProvider.GetRSCTokens(8700 + (int)artifactType));
                    } catch (KeyNotFoundException e) {
                        Debug.Log(e.Message);
                        return(null);
                    }
                }
                else if (!parent.IsIdentified)
                {
                    // Powers unknown.
                    TextFile.Token nopowersToken = TextFile.CreateTextToken(HardStrings.powersUnknown);
                    return(new TextFile.Token[] { nopowersToken });
                }
                else
                {
                    // List item powers.
                    List <TextFile.Token> magicPowersTokens = new List <TextFile.Token>();
                    for (int i = 0; i < parent.legacyMagic.Length; i++)
                    {
                        // Also 65535 to handle saves from when the type was read as an unsigned value
                        if (parent.legacyMagic[i].type == EnchantmentTypes.None || (int)parent.legacyMagic[i].type == 65535)
                        {
                            break;
                        }

                        string firstPart = HardStrings.itemPowers[(int)parent.legacyMagic[i].type] + " ";

                        if (parent.legacyMagic[i].type == EnchantmentTypes.SoulBound && parent.legacyMagic[i].param != -1)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.enemyNames[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.ExtraSpellPts)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.extraSpellPtsTimes[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.PotentVs || parent.legacyMagic[i].type == EnchantmentTypes.LowDamageVs)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.enemyGroupNames[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.RegensHealth)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.regensHealthTimes[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.VampiricEffect)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.vampiricEffectRanges[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.IncreasedWeightAllowance)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.increasedWeightAllowances[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.EnhancesSkill)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + DaggerfallUnity.Instance.TextProvider.GetSkillName((DaggerfallConnect.DFCareer.Skills)parent.legacyMagic[i].param)));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.ImprovesTalents)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.improvedTalents[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.GoodRepWith || parent.legacyMagic[i].type == EnchantmentTypes.BadRepWith)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.repWithGroups[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.ItemDeteriorates)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.itemDeteriorateLocations[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.UserTakesDamage)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.userTakesDamageLocations[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.HealthLeech)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.healthLeechStopConditions[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type == EnchantmentTypes.BadReactionsFrom)
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + HardStrings.badReactionFromEnemyGroups[parent.legacyMagic[i].param]));
                        }
                        else if (parent.legacyMagic[i].type <= EnchantmentTypes.CastWhenStrikes)
                        {
                            List <DaggerfallConnect.Save.SpellRecord.SpellRecordData> spells = DaggerfallSpellReader.ReadSpellsFile();
                            bool found = false;

                            foreach (DaggerfallConnect.Save.SpellRecord.SpellRecordData spell in spells)
                            {
                                if (spell.index == parent.legacyMagic[i].param)
                                {
                                    magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + spell.spellName));
                                    found = true;
                                    break;
                                }
                            }

                            if (!found)
                            {
                                magicPowersTokens.Add(TextFile.CreateTextToken(firstPart + "ERROR"));
                            }
                        }
                        else
                        {
                            magicPowersTokens.Add(TextFile.CreateTextToken(firstPart));
                        }

                        magicPowersTokens.Add(TextFile.CreateFormatToken(format));
                    }
                    return(magicPowersTokens.ToArray());
                }
            }
コード例 #3
0
 /// <summary>
 /// Gets artifact texture indices
 /// </summary>
 /// <param name="type">Artifact subtype.</param>
 /// <param name="textureArchiveOut">Texture archive out.</param>
 /// <param name="textureRecordOut">Texture record out.</param>
 public void GetArtifactTextureIndices(ArtifactsSubTypes type, out int textureArchiveOut, out int textureRecordOut)
 {
     textureArchiveOut = (GameManager.Instance.PlayerEntity.Gender == Genders.Male) ? artifactMaleTextureArchive : artifactFemaleTextureArchive;
     textureRecordOut  = artifactTextureIndexMappings[(int)type];
 }
コード例 #4
0
 /// <summary>
 /// Gets name of artifact.
 /// </summary>
 /// <param name="type">Artifact subtype.</param>
 /// <returns>Artifact name.</returns>
 public string GetArtifactName(ArtifactsSubTypes type)
 {
     return(artifactItemTemplates[(int)type].name);
 }