public ItemForm( GameVersion version, ItemDat itemDat, TSSFile TSS, T8BTSK.T8BTSK skills, T8BTEMST.T8BTEMST enemies, COOKDAT.COOKDAT cookdat, WRLDDAT.WRLDDAT locations )
        {
            InitializeComponent();

            this.Version = version;
            this.itemDat = itemDat;
            this.TSS = TSS;
            this.Skills = skills;
            this.Enemies = enemies;
            this.Recipes = cookdat;
            this.Locations = locations;
            this.InGameIdDict = TSS.GenerateInGameIdDictionary();

            labels = new List<Label>();
            textboxes = new List<TextBox>();

            for ( int i = 0; i < ItemDatSingle.size / 4; ++i ) {
                Label l = new Label();
                l.Text = "";
                l.Size = new System.Drawing.Size( 100, 20 );
                TextBox b = new TextBox();
                b.Size = new System.Drawing.Size( 50, 20 );
                b.Text = "";

                labels.Add( l );
                textboxes.Add( b );

                FlowLayoutPanel p = new FlowLayoutPanel();
                p.Size = new System.Drawing.Size( 200, 20 );
                p.FlowDirection = FlowDirection.LeftToRight;
                p.Controls.Add( l );
                p.Controls.Add( b );

                switch ( (ItemData)i ) {
                    case ItemData.NamePointer:
                    case ItemData.DescriptionPointer:
                    case ItemData.UnknownTextPointer:
                    case ItemData.TextIDPart1:
                    case ItemData.TextIDPart2:
                    case ItemData.TextIDPart3:
                    case ItemData.TextIDPart4:
                    case ItemData.TextIDPart5:
                    case ItemData.TextIDPart6:
                    case ItemData.TextIDPart7:
                    case ItemData.TextIDPart8:
                        break;
                    default:
                        flowLayoutPanel1.Controls.Add( p );
                        break;
                }
            }

            foreach ( ItemDatSingle i in itemDat.items ) {
                var entry = GetEntry( i.Data[(int)ItemData.NamePointer] );
                listBox1.Items.Add( entry.StringEngOrJpn );
            }
        }
 public string GetDataAsHtml( GameVersion version, ItemDat.ItemDat items, TSSFile stringDic, Dictionary<uint, TSSEntry> inGameIdDict, List<SearchPointItem> searchPointItems, bool phpLinks = false )
 {
     StringBuilder sb = new StringBuilder();
     //sb.Append( "Percentage: " ).Append( Percentage ).Append( "%" ).Append( "<br>" );
     for ( uint i = 0; i < SearchPointItemCount; ++i ) {
         //sb.Append( "Item #" ).Append( i ).Append( ":" );
         sb.Append( searchPointItems[(int)( SearchPointItemIndex + i )].GetDataAsHtml( version, items, stringDic, inGameIdDict, phpLinks: phpLinks ) );
         sb.Append( "<br>" );
     }
     return sb.ToString();
 }
        public string GetDataAsHtml( GameVersion version, ItemDat.ItemDat items, Dictionary<uint, TSS.TSSEntry> inGameIdDict, bool phpLinks = false )
        {
            StringBuilder sb = new StringBuilder();

            var item = items.itemIdDict[ItemID];
            sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
            sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon] ) + "\">" );
            sb.Append( inGameIdDict[item.NamePointer].StringEngOrJpnHtml( version ) + "</a>" );

            return sb.ToString();
        }
Exemple #4
0
        private void buttonGenerateText_Click(object sender, EventArgs e)
        {
            var sb = new StringBuilder();

            foreach (var item in itemDat.items)
            {
                sb.AppendLine(ItemDat.GetItemDataAsText(Version, itemDat, item, Skills, Enemies, Recipes, Locations, TSS, InGameIdDict));
                sb.AppendLine();
                sb.AppendLine();
            }
            Clipboard.SetText(sb.ToString());
        }
Exemple #5
0
        public static int Execute(List <string> args)
        {
            if (args.Count < 7)
            {
                Console.WriteLine("Usage: [360/PS3] ITEM.DAT STRING_DIC.SO T8BTSK T8BTEMST COOKDAT WRLDDAT");
                return(-1);
            }

            GameVersion version = GameVersion.None;

            switch (args[0].ToUpperInvariant())
            {
            case "360":
                version = GameVersion.X360;
                break;

            case "PS3":
                version = GameVersion.PS3;
                break;
            }

            if (version == GameVersion.None)
            {
                Console.WriteLine("First parameter must indicate game version!");
                return(-1);
            }

            ItemDat items = new ItemDat(args[1]);

            TSSFile TSS;

            try {
                TSS = new TSSFile(System.IO.File.ReadAllBytes(args[2]));
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }

            T8BTSK.T8BTSK     skills    = new T8BTSK.T8BTSK(args[3]);
            T8BTEMST.T8BTEMST enemies   = new T8BTEMST.T8BTEMST(args[4]);
            COOKDAT.COOKDAT   cookdat   = new COOKDAT.COOKDAT(args[5]);
            WRLDDAT.WRLDDAT   locations = new WRLDDAT.WRLDDAT(args[6]);

            Console.WriteLine("Initializing GUI...");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ItemForm itemForm = new ItemForm(version, items, TSS, skills, enemies, cookdat, locations);

            Application.Run(itemForm);
            return(0);
        }
        public static int Execute( List<string> args )
        {
            if ( args.Count < 7 ) {
                Console.WriteLine( "Usage: [360/PS3] ITEM.DAT STRING_DIC.SO T8BTSK T8BTEMST COOKDAT WRLDDAT" );
                return -1;
            }

            GameVersion version = GameVersion.None;
            switch ( args[0].ToUpperInvariant() ) {
                case "360":
                    version = GameVersion.X360;
                    break;
                case "PS3":
                    version = GameVersion.PS3;
                    break;
            }

            if ( version == GameVersion.None ) {
                Console.WriteLine( "First parameter must indicate game version!" );
                return -1;
            }

            ItemDat items = new ItemDat( args[1] );

            TSSFile TSS;
            try {
                TSS = new TSSFile( System.IO.File.ReadAllBytes( args[2] ) );
            } catch ( System.IO.FileNotFoundException ) {
                Console.WriteLine( "Could not open STRING_DIC.SO, exiting." );
                return -1;
            }

            T8BTSK.T8BTSK skills = new T8BTSK.T8BTSK( args[3] );
            T8BTEMST.T8BTEMST enemies = new T8BTEMST.T8BTEMST( args[4] );
            COOKDAT.COOKDAT cookdat = new COOKDAT.COOKDAT( args[5] );
            WRLDDAT.WRLDDAT locations = new WRLDDAT.WRLDDAT( args[6] );

            Console.WriteLine( "Initializing GUI..." );
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault( false );
            ItemForm itemForm = new ItemForm( version, items, TSS, skills, enemies, cookdat, locations );
            Application.Run( itemForm );
            return 0;
        }
Exemple #7
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ItemDatSingle item = itemDat.items[listBox1.SelectedIndex];

            for (int i = 0; i < ItemDatSingle.size / 4; ++i)
            {
                labels[i].Text    = ((ItemData)i).ToString();
                textboxes[i].Text = item.Data[i].ToString();
            }

            TSSEntry entry = GetEntry(item.Data[(int)ItemData.NamePointer]);

            labelName.Text            = entry.StringEngOrJpn;
            entry                     = GetEntry(item.Data[(int)ItemData.DescriptionPointer]);
            labelDescription.Text     = entry.StringEngOrJpn;
            entry                     = GetEntry(item.Data[(int)ItemData.UnknownTextPointer]);
            labelUnknown.Text         = entry.StringEngOrJpn;
            textBoxGeneratedText.Text = ItemDat.GetItemDataAsText(Version, itemDat, item, Skills, Enemies, Recipes, Locations, TSS, InGameIdDict);
        }
        public static string GetItemDataAsText( GameVersion version, ItemDat items, ItemDatSingle item, T8BTSK.T8BTSK skills, T8BTEMST.T8BTEMST enemies, COOKDAT.COOKDAT Recipes, WRLDDAT.WRLDDAT Locations, TSS.TSSFile tss, Dictionary<uint, TSS.TSSEntry> dict = null )
        {
            if ( dict == null ) { dict = tss.GenerateInGameIdDictionary(); }
            var sb = new StringBuilder();

            sb.AppendLine( "[" + item.ItemString.TrimNull() + "]" );
            sb.Append( "[Icon" + item.Data[(int)ItemData.Icon] + "] " );
            var nameEntry = dict[item.NamePointer];
            sb.AppendLine( nameEntry.StringEngOrJpn );
            var descEntry = dict[item.DescriptionPointer];
            sb.AppendLine( descEntry.StringEngOrJpn );

            switch ( item.Data[(int)ItemData.Category] ) {
                case 2: sb.AppendLine( "<Tools>" ); break;
                case 3: sb.AppendLine( "<Main>" ); break;
                case 4: sb.AppendLine( "<Sub>" ); break;
                case 5: sb.AppendLine( "<Head>" ); break;
                case 6: sb.AppendLine( "<Body>" ); break;
                case 7: sb.AppendLine( "<Accessories>" ); break;
                case 8: sb.AppendLine( "<Ingredients>" ); break;
                case 9: sb.AppendLine( "<Synthesis Materials>" ); break;
                case 10: sb.AppendLine( "<Valuables>" ); break;
                case 11: sb.AppendLine( "<DLC>" ); break;
                default: sb.AppendLine( "<UNKNOWN>" ); break;
            }

            sb.AppendLine( "Price in shops: " + item.Data[(int)ItemData.ShopPrice] + " Gald" );

            if ( item.Data[(int)ItemData.BuyableIn1] > 0 || item.Data[(int)ItemData.BuyableIn2] > 0 || item.Data[(int)ItemData.BuyableIn3] > 0 ) {
                sb.Append( "Available at shops in: " );
                if ( item.Data[(int)ItemData.BuyableIn1] > 0 ) { sb.Append( Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn1]].GetLastValidName( dict ).StringEngOrJpn ); }
                if ( item.Data[(int)ItemData.BuyableIn2] > 0 ) { sb.Append( "; " + Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn2]].GetLastValidName( dict ).StringEngOrJpn ); }
                if ( item.Data[(int)ItemData.BuyableIn3] > 0 ) { sb.Append( "; " + Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn3]].GetLastValidName( dict ).StringEngOrJpn ); }
                sb.AppendLine();
            }

            uint equip = item.Data[(int)ItemData.EquippableByBitfield];
            if ( equip > 0 ) {
                sb.Append( "Equippable by: " );
                if ( ( equip & 1 ) == 1 ) { sb.Append( "[YUR]" ); }
                if ( ( equip & 2 ) == 2 ) { sb.Append( "[EST]" ); }
                if ( ( equip & 4 ) == 4 ) { sb.Append( "[KAR]" ); }
                if ( ( equip & 8 ) == 8 ) { sb.Append( "[RIT]" ); }
                if ( ( equip & 16 ) == 16 ) { sb.Append( "[RAV]" ); }
                if ( ( equip & 32 ) == 32 ) { sb.Append( "[JUD]" ); }
                if ( ( equip & 64 ) == 64 ) { sb.Append( "[RAP]" ); }
                if ( ( equip & 128 ) == 128 ) { sb.Append( "[FRE]" ); }
                if ( version == GameVersion.PS3 && ( equip & 256 ) == 256 ) { sb.Append( "[PAT]" ); }
                sb.AppendLine();
            }

            uint synthCount = item.Data[(int)ItemData.SynthRecipeCount];
            switch ( synthCount ) {
                case 0: sb.AppendLine( "Can't be synthesized." ); break;
                case 1: sb.AppendLine( "Can be synthesized in 1 way." ); break;
                default: sb.AppendLine( "Can be synthesized in " + synthCount + " ways." ); break;
            }
            for ( int j = 0; j < synthCount; ++j ) {
                uint synthItemCount = item.Data[(int)ItemData.Synth1ItemSlotCount + j * 16];
                sb.AppendLine( "Synthesis method #" + ( j + 1 ) );
                sb.AppendLine( " Required Synthesis Level: " + item.Data[(int)ItemData._Synth1Level + j * 16] );
                sb.AppendLine( " Price: " + item.Data[(int)ItemData.Synth1Price + j * 16] + " Gald" );
                sb.AppendLine( " Requires " + synthItemCount + " items:" );
                for ( int i = 0; i < synthItemCount; ++i ) {
                    var otherItem = items.itemIdDict[item.Data[(int)ItemData.Synth1Item1Type + i * 2 + j * 16]];
                    var otherItemNameEntry = dict[otherItem.NamePointer];
                    string otherItemName = otherItemNameEntry.StringEngOrJpn;
                    sb.AppendLine( "  Item " + ( i + 1 ) + ": " + otherItemName + " x" + item.Data[(int)ItemData.Synth1Item1Count + i * 2 + j * 16] );
                }
            }

            switch ( item.Data[(int)ItemData.Category] ) {
                case 2:
                default:
                    // seems to be some kind of singletarget/multitarget flag maybe?
                    //sb.AppendLine( "~19: " + item.Data[(int)ItemData.PATK] );

                    // seems to be a bitfield regarding what stuff it heals, 1 == death, 2 = magical ailment, 4 == physical ailment
                    // this is already covered below so don't print it
                    //sb.AppendLine( "~20: " + item.Data[(int)ItemData.MATK] );

                    if ( item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0 ) { sb.AppendLine( "HP Heal %: " + item.Data[(int)ItemData.MDEF_or_HPHealPercent] ); }
                    if ( item.Data[(int)ItemData.AGL_TPHealPercent] > 0 ) { sb.AppendLine( "TP Heal %: " + item.Data[(int)ItemData.AGL_TPHealPercent] ); }

                    // why is this here twice?
                    uint physAilAlt = item.Data[(int)ItemData.PDEF];
                    uint physAil = item.Data[(int)ItemData._LUCK];
                    if ( physAil != physAilAlt ) { throw new Exception(); }

                    if ( physAil > 0 ) {
                        sb.Append( "Cures physical ailments: " );
                        if ( ( physAil & 1 ) == 1 ) { sb.Append( "Death " ); }
                        if ( ( physAil & 2 ) == 2 ) { sb.Append( "Poison " ); }
                        if ( ( physAil & 4 ) == 4 ) { sb.Append( "Paralysis " ); }
                        if ( ( physAil & 8 ) == 8 ) { sb.Append( "Petrification " ); }
                        if ( ( physAil & 16 ) == 16 ) { sb.Append( "Weak " ); }
                        if ( ( physAil & 32 ) == 32 ) { sb.Append( "SealedArtes " ); }
                        if ( ( physAil & 64 ) == 64 ) { sb.Append( "SealedSkills " ); }
                        if ( ( physAil & 128 ) == 128 ) { sb.Append( "Contamination " ); }
                        sb.AppendLine();
                    }

                    if ( item.Data[(int)ItemData._AGL_Again] > 0 ) {
                        sb.AppendLine( "Cures magical ailments" );
                    }

                    if ( item.Data[26] > 0 ) { sb.AppendLine( "Permanent PATK increase: " + item.Data[26] ); }
                    if ( item.Data[27] > 0 ) { sb.AppendLine( "Permanent PDEF increase: " + item.Data[27] ); }
                    if ( item.Data[(int)ItemData.AttrFire] > 0 ) { sb.AppendLine( "Permanent MATK increase: " + item.Data[(int)ItemData.AttrFire] ); }
                    if ( item.Data[(int)ItemData.AttrWater] > 0 ) { sb.AppendLine( "Permanent MDEF increase: " + item.Data[(int)ItemData.AttrWater] ); }
                    if ( item.Data[(int)ItemData.AttrWind] > 0 ) { sb.AppendLine( "Permanent AGL increase: " + item.Data[(int)ItemData.AttrWind] ); }
                    if ( item.Data[(int)ItemData.Skill1] > 0 ) { sb.AppendLine( "Max HP increase: " + item.Data[(int)ItemData.Skill1] ); }
                    if ( item.Data[(int)ItemData.Skill1Metadata] > 0 ) { sb.AppendLine( "Max TP increase: " + item.Data[(int)ItemData.Skill1Metadata] ); }
                    break;

                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                    if ( (int)item.Data[(int)ItemData.PATK] > 0 ) { sb.AppendLine( "PATK: " + (int)item.Data[(int)ItemData.PATK] ); }
                    if ( (int)item.Data[(int)ItemData.MATK] > 0 ) { sb.AppendLine( "MATK: " + (int)item.Data[(int)ItemData.MATK] ); }
                    if ( (int)item.Data[(int)ItemData.PDEF] > 0 ) { sb.AppendLine( "PDEF: " + (int)item.Data[(int)ItemData.PDEF] ); }
                    if ( (int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0 ) { sb.AppendLine( "MDEF: " + (int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] ); }

                    int agl1 = (int)item.Data[(int)ItemData.AGL_TPHealPercent];
                    int agl2 = (int)item.Data[(int)ItemData._AGL_Again];

                    if ( agl1 != agl2 ) {
                        sb.AppendLine( "!!! AGL1: " + agl1 + " / AGL2: " + agl2 );
                    } else {
                        if ( agl1 > 0 ) { sb.AppendLine( "AGL: " + agl1 ); }
                    }

                    if ( (int)item.Data[(int)ItemData._LUCK] > 0 ) { sb.AppendLine( "LUCK: " + (int)item.Data[(int)ItemData._LUCK] ); }

                    if ( (int)item.Data[(int)ItemData.AttrFire] != 0 ) { sb.AppendLine( "Attribute Fire: " + (int)item.Data[(int)ItemData.AttrFire] ); }
                    if ( (int)item.Data[(int)ItemData.AttrWater] != 0 ) { sb.AppendLine( "Attribute Water: " + (int)item.Data[(int)ItemData.AttrWater] ); }
                    if ( (int)item.Data[(int)ItemData.AttrWind] != 0 ) { sb.AppendLine( "Attribute Wind: " + (int)item.Data[(int)ItemData.AttrWind] ); }
                    if ( (int)item.Data[(int)ItemData.AttrEarth] != 0 ) { sb.AppendLine( "Attribute Earth: " + (int)item.Data[(int)ItemData.AttrEarth] ); }
                    if ( (int)item.Data[(int)ItemData.AttrLight] != 0 ) { sb.AppendLine( "Attribute Light: " + (int)item.Data[(int)ItemData.AttrLight] ); }
                    if ( (int)item.Data[(int)ItemData.AttrDark] != 0 ) { sb.AppendLine( "Attribute Darkness: " + (int)item.Data[(int)ItemData.AttrDark] ); }

                    for ( int i = 0; i < 3; ++i ) {
                        uint skillId = item.Data[(int)ItemData.Skill1 + i * 2];
                        if ( skillId != 0 ) {
                            var skill = skills.SkillIdDict[skillId];
                            var skillNameEntry = dict[skill.NameStringDicID];
                            string skillName = skillNameEntry.StringEngOrJpn;
                            sb.AppendLine( "Skill #" + ( i + 1 ) + " Name: " + skillName );
                            sb.AppendLine( "Skill #" + ( i + 1 ) + " Metadata: " + item.Data[(int)ItemData.Skill1Metadata + i * 2] );
                        }
                    }
                    break;
            }

            for ( int j = 0; j < 2; ++j ) {
                for ( int i = 0; i < 16; ++i ) {
                    uint enemyId = item.Data[(int)ItemData.Drop1Enemy + i + j * 32];
                    if ( enemyId != 0 ) {
                        var enemy = enemies.EnemyIdDict[enemyId];
                        var enemyNameEntry = dict[enemy.NameStringDicID];
                        string enemyName = enemyNameEntry.StringEngOrJpn;
                        sb.AppendLine( "Enemy " + ( j == 0 ? "Drop" : "Steal" ) + " #" + ( i + 1 ) + ": " + enemyName + ", " + item.Data[(int)ItemData.Drop1Chance + i + j * 32] + "%" );
                    }
                }
            }

            for ( int i = 0; i < 8; ++i ) {
                if ( item.Data[(int)ItemData.UsedInRecipe1 + i] != 0 ) {
                    sb.AppendLine( "Used in Recipe #" + ( i + 1 ) + ": " + item.Data[(int)ItemData.UsedInRecipe1 + i] );
                }
            }

            //sb.AppendLine( "~3: " + item.Data[3] );
            //sb.AppendLine( "~5: " + item.Data[5] );
            //sb.AppendLine( "~18: " + item.Data[18] );

            /* all of these values make no sense to me, probably useless for the reader
            sb.AppendLine( "~169: " + item.Data[169] );
            sb.AppendLine( "~170: " + item.Data[170] );
            sb.AppendLine( "~171: " + item.Data[171] );
            sb.AppendLine( "~172: " + item.Data[172] );
            sb.AppendLine( "~173: " + item.Data[173] );
            sb.AppendLine( "~174: " + item.Data[174] );
             */

            // no idea, maybe related to what shows up on the character model?
            //sb.AppendLine( "~175: " + (int)item.Data[175] );

            // seems to be some sort of ID, useless for the reader
            //sb.AppendLine( "~176: " + item.Data[176] );

            if ( item.Data[(int)ItemData.UsableInBattle] > 0 ) { sb.AppendLine( "Usable in battle" ); };
            if ( item.Data[(int)ItemData.InCollectorsBook] == 0 ) { sb.AppendLine( "Not in Collector's Book" ); }

            return sb.ToString();
        }
        public static string GetItemDataAsHtml( GameVersion version, ItemDat items, ItemDatSingle item, T8BTSK.T8BTSK skills, T8BTEMST.T8BTEMST enemies, COOKDAT.COOKDAT Recipes, WRLDDAT.WRLDDAT Locations, TSS.TSSFile tss, Dictionary<uint, TSS.TSSEntry> dict = null, bool phpLinks = false )
        {
            if ( dict == null ) { dict = tss.GenerateInGameIdDictionary(); }
            var sb = new StringBuilder();

            sb.Append( "<tr id=\"item" + item.Data[(int)ItemData.ID] + "\">" );
            sb.Append( "<td rowspan=\"3\">" );

            sb.Append( "<img src=\"items/U_" + item.ItemString.TrimNull() + ".png\" height=\"128\" width=\"128\">" );
            sb.Append( "</td><td colspan=\"2\">" );

            uint equip = item.Data[(int)ItemData.EquippableByBitfield];
            if ( equip > 0 ) {
                sb.Append( "<span class=\"equip\">" );
                Website.GenerateWebsite.AppendCharacterBitfieldAsImageString( sb, version, equip );
                sb.Append( "</span>" );
            }

            var nameEntry = dict[item.NamePointer];
            var descEntry = dict[item.DescriptionPointer];

            sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
            sb.Append( "<span class=\"itemname\">" );
            sb.Append( nameEntry.StringJpnHtml( version ) );
            sb.Append( "</span>" );
            sb.Append( "<br>" );
            sb.Append( "<span class=\"itemdesc\">" );
            sb.Append( descEntry.StringJpnHtml( version ) );
            sb.Append( "</span>" );
            sb.Append( "<br>" );
            sb.Append( "<br>" );

            sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
            sb.Append( "<span class=\"itemname\">" );
            sb.Append( nameEntry.StringEngHtml( version ) );
            sb.Append( "</span>" );
            sb.Append( "<br>" );
            sb.Append( "<span class=\"itemdesc\">" );
            sb.Append( descEntry.StringEngHtml( version ) );
            sb.Append( "</span>" );

            sb.Append( "<span class=\"special\">" );
            if ( item.Data[(int)ItemData.UsableInBattle] > 0 ) { sb.Append( "Usable in battle" ); };
            if ( item.Data[(int)ItemData.InCollectorsBook] == 0 ) { sb.Append( "Not in Collector's Book" ); }
            sb.Append( "</span>" );
            sb.Append( "</td>" );

            uint synthCount = item.Data[(int)ItemData.SynthRecipeCount];
            switch ( synthCount ) {
                case 0: break;
                case 1: sb.Append( "<td colspan=\"2\">" ); break;
                default: sb.Append( "<td>" ); break;
            }
            for ( int j = 0; j < synthCount; ++j ) {
                uint synthItemCount = item.Data[(int)ItemData.Synth1ItemSlotCount + j * 16];
                sb.Append( "Synthesis Level: " + item.Data[(int)ItemData._Synth1Level + j * 16] );
                sb.Append( "<br>" );
                sb.Append( "Price: " + item.Data[(int)ItemData.Synth1Price + j * 16] + " Gald" );
                for ( int i = 0; i < synthItemCount; ++i ) {
                    sb.Append( "<br>" );
                    var otherItem = items.itemIdDict[item.Data[(int)ItemData.Synth1Item1Type + i * 2 + j * 16]];
                    var otherItemNameEntry = dict[otherItem.NamePointer];
                    string otherItemName = otherItemNameEntry.StringEngOrJpnHtml( version );
                    sb.Append( "<img src=\"item-icons/ICON" + otherItem.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
                    sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)otherItem.Data[(int)ItemData.ID], icon: (int)otherItem.Data[(int)ItemData.Icon] ) + "\">" );
                    sb.Append( otherItemName + "</a> x" + item.Data[(int)ItemData.Synth1Item1Count + i * 2 + j * 16] );
                }
                if ( synthCount > 1 && j == 0 ) { sb.Append( "</td><td>" ); }
            }

            sb.Append( "</td></tr><tr>" );

            uint category = item.Data[(int)ItemData.Category];
            switch ( category ) {
                case 2:
                default:
                    sb.Append( "<td colspan=\"2\">" );
                    if ( item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0 ) { sb.Append( "HP Heal %: " + item.Data[(int)ItemData.MDEF_or_HPHealPercent] + "<br>" ); }
                    if ( item.Data[(int)ItemData.AGL_TPHealPercent] > 0 ) { sb.Append( "TP Heal %: " + item.Data[(int)ItemData.AGL_TPHealPercent] + "<br>" ); }

                    // why is this here twice?
                    uint physAilAlt = item.Data[(int)ItemData.PDEF];
                    uint physAil = item.Data[(int)ItemData._LUCK];
                    if ( physAil != physAilAlt ) { throw new Exception(); }

                    if ( physAil > 0 ) {
                        sb.Append( "Cures physical ailments: " );
                        if ( ( physAil & 1 ) == 1 ) { sb.Append( "<img src=\"text-icons/icon-status-13.png\" height=\"32\" width=\"32\">" ); }
                        if ( ( physAil & 2 ) == 2 ) { sb.Append( "<img src=\"text-icons/icon-status-01.png\" height=\"32\" width=\"32\">" ); }
                        if ( ( physAil & 4 ) == 4 ) { sb.Append( "<img src=\"text-icons/icon-status-02.png\" height=\"32\" width=\"32\">" ); }
                        if ( ( physAil & 8 ) == 8 ) { sb.Append( "<img src=\"text-icons/icon-status-03.png\" height=\"32\" width=\"32\">" ); }
                        if ( ( physAil & 16 ) == 16 ) { sb.Append( "<img src=\"text-icons/icon-status-04.png\" height=\"32\" width=\"32\">" ); }
                        if ( ( physAil & 32 ) == 32 ) { sb.Append( "<img src=\"text-icons/icon-status-05.png\" height=\"32\" width=\"32\">" ); }
                        if ( ( physAil & 64 ) == 64 ) { sb.Append( "<img src=\"text-icons/icon-status-06.png\" height=\"32\" width=\"32\">" ); }
                        if ( ( physAil & 128 ) == 128 ) { sb.Append( "<img src=\"text-icons/icon-status-07.png\" height=\"32\" width=\"32\">" ); }
                        sb.Append( "<br>" );
                    }

                    if ( item.Data[(int)ItemData._AGL_Again] > 0 ) {
                        sb.Append( "Cures magical ailments<br>" );
                    }

                    if ( item.Data[(int)ItemData.PermanentPAtkIncrease] > 0 ) { sb.Append( "Permanent PATK increase: " + item.Data[(int)ItemData.PermanentPAtkIncrease] + "<br>" ); }
                    if ( item.Data[(int)ItemData.PermanentPDefIncrease] > 0 ) { sb.Append( "Permanent PDEF increase: " + item.Data[(int)ItemData.PermanentPDefIncrease] + "<br>" ); }
                    if ( item.Data[(int)ItemData.AttrFire] > 0 ) { sb.Append( "Permanent MATK increase: " + item.Data[(int)ItemData.AttrFire] + "<br>" ); }
                    if ( item.Data[(int)ItemData.AttrWater] > 0 ) { sb.Append( "Permanent MDEF increase: " + item.Data[(int)ItemData.AttrWater] + "<br>" ); }
                    if ( item.Data[(int)ItemData.AttrWind] > 0 ) { sb.Append( "Permanent AGL increase: " + item.Data[(int)ItemData.AttrWind] + "<br>" ); }
                    if ( item.Data[(int)ItemData.Skill1] > 0 ) { sb.Append( "Max HP increase: " + item.Data[(int)ItemData.Skill1] + "<br>" ); }
                    if ( item.Data[(int)ItemData.Skill1Metadata] > 0 ) { sb.Append( "Max TP increase: " + item.Data[(int)ItemData.Skill1Metadata] + "<br>" ); }

                    for ( int i = 0; i < 8; ++i ) {
                        int recipeId = (int)item.Data[(int)ItemData.UsedInRecipe1 + i];
                        if ( recipeId != 0 ) {
                            var recipe = Recipes.RecipeList[recipeId];
                            var recipeNameEntry = dict[recipe.NameStringDicID];
                            sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Recipe, version, phpLinks, id: (int)recipe.ID ) + "\">" + recipeNameEntry.StringEngOrJpnHtml( version ) + "</a><br>" );
                        }
                    }

                    sb.Append( "</td>" );
                    break;

                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                    sb.Append( "<td>" );
                    if ( (int)item.Data[(int)ItemData.PATK] > 0 ) { sb.Append( "PATK: " + (int)item.Data[(int)ItemData.PATK] + "<br>" ); }
                    if ( (int)item.Data[(int)ItemData.MATK] > 0 ) { sb.Append( "MATK: " + (int)item.Data[(int)ItemData.MATK] + "<br>" ); }
                    if ( (int)item.Data[(int)ItemData.PDEF] > 0 ) { sb.Append( "PDEF: " + (int)item.Data[(int)ItemData.PDEF] + "<br>" ); }
                    if ( (int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0 ) { sb.Append( "MDEF: " + (int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] + "<br>" ); }

                    int agl1 = (int)item.Data[(int)ItemData.AGL_TPHealPercent];
                    int agl2 = (int)item.Data[(int)ItemData._AGL_Again];

                    if ( agl2 > 0 ) { sb.Append( "AGL: " + agl2 + "<br>" ); }

                    if ( (int)item.Data[(int)ItemData._LUCK] > 0 ) { sb.Append( "LUCK: " + (int)item.Data[(int)ItemData._LUCK] + "<br>" ); }

                    int attackElementCount = 0;
                    int defenseElementCount = 0;
                    for ( int i = 0; i < 6; ++i ) {
                        if ( (int)item.Data[(int)ItemData.AttrFire + i] > 0 ) { attackElementCount++; }
                        if ( (int)item.Data[(int)ItemData.AttrFire + i] < 0 ) { defenseElementCount++; }
                    }

                    if ( attackElementCount > 0 || defenseElementCount > 0 ) {
                        int fire = (int)item.Data[(int)ItemData.AttrFire];
                        int watr = (int)item.Data[(int)ItemData.AttrWater];
                        int wind = (int)item.Data[(int)ItemData.AttrWind];
                        int eart = (int)item.Data[(int)ItemData.AttrEarth];
                        int lght = (int)item.Data[(int)ItemData.AttrLight];
                        int dark = (int)item.Data[(int)ItemData.AttrDark];
                        if ( defenseElementCount > 0 ) {
                            sb.Append( "<table class=\"element\"><tr>" );
                            sb.Append( "<td colspan=\"" + defenseElementCount + "\">Resistance</td>" );
                            sb.Append( "</tr><tr>" );
                            if ( fire < 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-02.png\"></td>" ); }
                            if ( eart < 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-04.png\"></td>" ); }
                            if ( wind < 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-01.png\"></td>" ); }
                            if ( watr < 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-05.png\"></td>" ); }
                            if ( lght < 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-03.png\"></td>" ); }
                            if ( dark < 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-06.png\"></td>" ); }
                            sb.Append( "</tr><tr>" );
                            if ( fire < 0 ) { sb.Append( "<td>" + -fire + "%</td>" ); }
                            if ( eart < 0 ) { sb.Append( "<td>" + -eart + "%</td>" ); }
                            if ( wind < 0 ) { sb.Append( "<td>" + -wind + "%</td>" ); }
                            if ( watr < 0 ) { sb.Append( "<td>" + -watr + "%</td>" ); }
                            if ( lght < 0 ) { sb.Append( "<td>" + -lght + "%</td>" ); }
                            if ( dark < 0 ) { sb.Append( "<td>" + -dark + "%</td>" ); }
                            sb.Append( "</tr></table>" );
                        }
                        if ( attackElementCount > 0 ) {
                            sb.Append( "<table class=\"element\"><tr>" );
                            if ( category == 3 || category == 4 ) {
                                // weapons and sub-weapons add elemental attributes to your attack
                                sb.Append( "<td colspan=\"" + attackElementCount + "\">Attack Element</td>" );
                            } else {
                                // defensive equipment instead uses this field as a weak/resist, with weak as positive and resist as negative values
                                sb.Append( "<td colspan=\"" + attackElementCount + "\">Weakness</td>" );
                            }
                            sb.Append( "</tr><tr>" );
                            if ( fire > 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-02.png\"></td>" ); }
                            if ( eart > 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-04.png\"></td>" ); }
                            if ( wind > 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-01.png\"></td>" ); }
                            if ( watr > 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-05.png\"></td>" ); }
                            if ( lght > 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-03.png\"></td>" ); }
                            if ( dark > 0 ) { sb.Append( "<td><img src=\"text-icons/icon-element-06.png\"></td>" ); }
                            if ( !( category == 3 || category == 4 ) ) {
                                // weapons always have a "1" here, don't print that, it's not useful
                                sb.Append( "</tr><tr>" );
                                if ( fire > 0 ) { sb.Append( "<td>" + fire + "%</td>" ); }
                                if ( eart > 0 ) { sb.Append( "<td>" + eart + "%</td>" ); }
                                if ( wind > 0 ) { sb.Append( "<td>" + wind + "%</td>" ); }
                                if ( watr > 0 ) { sb.Append( "<td>" + watr + "%</td>" ); }
                                if ( lght > 0 ) { sb.Append( "<td>" + lght + "%</td>" ); }
                                if ( dark > 0 ) { sb.Append( "<td>" + dark + "%</td>" ); }
                            }
                            sb.Append( "</tr></table>" );
                        }
                    }

                    sb.Append( "</td><td>" );

                    for ( int i = 0; i < 3; ++i ) {
                        uint skillId = item.Data[(int)ItemData.Skill1 + i * 2];
                        if ( skillId != 0 ) {
                            var skill = skills.SkillIdDict[skillId];
                            var skillNameEntry = dict[skill.NameStringDicID];
                            string skillName = skillNameEntry.StringEngOrJpnHtml( version );
                            string skillCat = "<img src=\"skill-icons/category-" + skill.Category.ToString() + ".png\" height=\"16\" width=\"16\">";
                            sb.Append( skillCat );
                            sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Skill, version, phpLinks, id: (int)skill.InGameID ) + "\">" );
                            sb.Append( skillName );
                            sb.Append( "</a>, " + item.Data[(int)ItemData.Skill1Metadata + i * 2] + "<br>" );
                        }
                    }
                    sb.Append( "</td>" );
                    break;
            }

            sb.Append( "<td colspan=\"2\">" );

            sb.Append( item.Data[(int)ItemData.ShopPrice] + " Gald" );

            if ( item.Data[(int)ItemData.BuyableIn1] > 0 || item.Data[(int)ItemData.BuyableIn2] > 0 || item.Data[(int)ItemData.BuyableIn3] > 0 ) {
                //sb.Append( "<br>Available at shops in:" );
                for ( int i = 0; i < 3; ++i ) {
                    if ( item.Data[(int)ItemData.BuyableIn1 + i] > 0 ) {
                        var loc = Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn1 + i]];
                        sb.Append( "<br><a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Location, version, phpLinks, id: (int)loc.LocationID ) + "\">" );
                        sb.Append( loc.GetLastValidName( dict ).StringEngOrJpnHtml( version ) + "</a>" );
                    }
                }
                sb.AppendLine();
            }

            sb.Append( "</td></tr><tr>" );

            // read how many drops and steals this item lists
            int[] dropStealCount = new int[2];
            for ( int j = 0; j < 2; ++j ) {
                dropStealCount[j] = 0;
                for ( int i = 0; i < 16; ++i ) {
                    uint enemyId = item.Data[(int)ItemData.Drop1Enemy + i + j * 32];
                    if ( enemyId != 0 ) { dropStealCount[j]++; }
                }
            }

            for ( int j = 0; j < 2; ++j ) {
                sb.Append( "<td colspan=\"2\">" );
                if ( dropStealCount[j] > 0 ) {
                    int colCount = Math.Min( 4, dropStealCount[j] );
                    int rowCount = ( dropStealCount[j] - 1 ) / 4 + 1;

                    sb.Append( "<table class=\"element\">" );
                    sb.Append( "<tr><td colspan=\"" + colCount + "\">" );
                    sb.Append( j == 0 ? "Drop" : "Steal" );
                    sb.Append( "</td></tr>" );

                    int cellCount = 0;
                    for ( int i = 0; i < 16; ++i ) {
                        uint enemyId = item.Data[(int)ItemData.Drop1Enemy + i + j * 32];

                        if ( enemyId != 0 ) {
                            if ( cellCount % 4 == 0 ) {
                                sb.Append( "<tr>" );
                            }
                            sb.Append( "<td>" );
                            var enemy = enemies.EnemyIdDict[enemyId];
                            var enemyNameEntry = dict[enemy.NameStringDicID];
                            string enemyName = enemyNameEntry.StringEngOrJpnHtml( version );
                            sb.Append( "<img src=\"monster-icons/44px/monster-" + enemy.IconID.ToString( "D3" ) + ".png\"><br>" );
                            sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Enemy, version, phpLinks, category: (int)enemy.Category, id: (int)enemy.InGameID ) + "\">" );
                            sb.Append( enemyName + "</a><br>" + item.Data[(int)ItemData.Drop1Chance + i + j * 32] + "%" );
                            sb.Append( "</td>" );
                            if ( cellCount % 4 == 3 ) {
                                sb.Append( "</tr>" );
                            }
                            cellCount++;
                        }
                    }
                    if ( cellCount % 4 != 0 ) {
                        if ( cellCount > 4 ) {
                            for ( int i = cellCount % 4; i < 4; ++i ) {
                                sb.Append( "<td></td>" );
                            }
                        }
                        sb.Append( "</tr>" );
                    }
                    sb.Append( "</table>" );
                }
                sb.Append( "</td>" );
            }

            sb.Append( "</tr>" );
            return sb.ToString();
        }
Exemple #10
0
        public string GetDataAsHtml( string stratum, int floor, T8BTEMST.T8BTEMST Enemies, T8BTEMGP.T8BTEMGP EnemyGroups, T8BTEMEG.T8BTEMEG EncounterGroups, GameVersion version, T8BTXTMT treasures, ItemDat.ItemDat items, Dictionary<uint, TSS.TSSEntry> inGameIdDict, bool phpLinks = false )
        {
            StringBuilder sb = new StringBuilder();
            bool printEnemies = Enemies != null && EnemyGroups != null && EncounterGroups != null;

            sb.Append( "<td class=\"necropolistile" + RoomType + "\">" );
            if ( RoomType != 0 ) {
                sb.Append( "<div class=\"necropolis-arrow-up\">" );
                if ( MoveUpAllowed > 0 ) { sb.Append( "<img src=\"etc/up.png\" width=\"16\" height=\"16\">" ); }
                sb.Append( "</div>" );
                sb.Append( "<div class=\"necropolis-arrow-side\">" );
                if ( MoveLeftAllowed > 0 ) { sb.Append( "<img src=\"etc/left.png\" width=\"16\" height=\"16\">" ); }
                sb.Append( "</div>" );

                sb.Append( "<div class=\"necropolis-data\">" );

                if ( printEnemies ) {
                    foreach ( uint groupId in EncounterGroups.EncounterGroupIdDict[EnemyGroup].EnemyGroupIDs ) {
                        if ( groupId == 0xFFFFFFFFu ) { continue; }
                        foreach ( int enemyId in EnemyGroups.EnemyGroupIdDict[groupId].EnemyIDs ) {
                            if ( enemyId < 0 ) { continue; }
                            var enemy = Enemies.EnemyIdDict[(uint)enemyId];
                            sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Enemy, version, phpLinks, category: (int)enemy.Category, id: (int)enemy.InGameID ) + "\">" );
                            sb.Append( "<img src=\"monster-icons/46px/monster-" + enemy.IconID.ToString( "D3" ) + ".png\" title=\"" + inGameIdDict[enemy.NameStringDicID].StringEngOrJpnHtml( version ) + "\" width=\"23\" height=\"23\">" );
                            sb.Append( "</a>" );
                        }
                        sb.Append( "<br>" );
                    }
                } else {
                    sb.Append( "<img src=\"item-icons/ICON60.png\" width=\"16\" height=\"16\"> " + ( FramesToMove / 60 ) + " sec<br>" );

                    int targetFloor;
                    string targetID;
                    switch ( RoomType ) {
                        case 1: sb.Append( "Entrance<br>" ); break;
                        case 2:
                        case 5:
                            if ( RoomType == 5 ) {
                                targetFloor = ( floor + FloorExitDiff );
                            } else {
                                targetFloor = ( floor + 1 );
                            }
                            if ( targetFloor == 11 ) {
                                targetID = (char)( ( (int)stratum[0] ) + 1 ) + "1";
                            } else {
                                targetID = stratum + targetFloor;
                            }

                            sb.Append( "Exit to <a href=\"" );
                            if ( phpLinks ) {
                                sb.Append( "?version=ps3&section=necropolis&map=" + targetID );
                            } else {
                                sb.Append( "#" + targetID );
                            }
                            sb.Append( "\">" + stratum + "-" + targetFloor + "</a><br>" );

                            break;
                        case 3:
                            //sb.Append( "Regular Room<br>" );
                            break;
                        case 4:
                            //sb.Append( "Treasure Room<br>" );
                            break;
                    }

                    if ( RegularTreasure > 0 ) {
                        // not a generic solution, but the unmodified game has all four slots identical for regular treasures
                        var treasureInfo = treasures.TreasureInfoList[(int)RegularTreasure];
                        sb.Append( "<table>" );
                        sb.Append( "<tr>" );
                        for ( int i = 0; i < 3; ++i ) {
                            var item = items.itemIdDict[treasureInfo.Items[i]];
                            sb.Append( "<td>" );
                            sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon] ) + "\">" );
                            sb.Append( "<img src=\"items/U_" + item.ItemString.TrimNull() + ".png\" height=\"32\" width=\"32\" title=\"" + inGameIdDict[item.NamePointer].StringEngOrJpnHtml( version ) + "\">" );
                            sb.Append( "</a>" );
                            sb.Append( "</td>" );
                        }
                        sb.Append( "</tr>" );
                        sb.Append( "<tr>" );
                        for ( int i = 0; i < 3; ++i ) {
                            sb.Append( "<td>" );
                            sb.Append( treasureInfo.Chances[i] + "%" );
                            sb.Append( "</td>" );
                        }
                        sb.Append( "</tr>" );
                        sb.Append( "</table>" );
                    }

                    if ( SpecialTreasure > 0 ) {
                        // unmodified game always has special treasures as one in the first slot with 100% chance
                        var treasureInfo = treasures.TreasureInfoList[(int)SpecialTreasure];
                        var item = items.itemIdDict[treasureInfo.Items[0]];
                        sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemDat.ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
                        sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon] ) + "\">" );
                        sb.Append( inGameIdDict[item.NamePointer].StringEngOrJpnHtml( version ) + "</a><br>" );
                    }
                }

                sb.Append( "</div>" );

                sb.Append( "<div class=\"necropolis-arrow-side\">" );
                if ( MoveRightAllowed > 0 ) { sb.Append( "<img src=\"etc/right.png\" width=\"16\" height=\"16\">" ); }
                sb.Append( "</div>" );
                sb.Append( "<div class=\"necropolis-arrow-down\">" );
                if ( MoveDownAllowed > 0 ) { sb.Append( "<img src=\"etc/down.png\" width=\"16\" height=\"16\">" ); }
                sb.Append( "</div>" );
            }
            sb.Append( "</td>" );

            return sb.ToString();
        }
Exemple #11
0
        public static string GetItemDataAsText(GameVersion version, ItemDat items, ItemDatSingle item, T8BTSK.T8BTSK skills, T8BTEMST.T8BTEMST enemies, COOKDAT.COOKDAT Recipes, WRLDDAT.WRLDDAT Locations, TSS.TSSFile tss, Dictionary <uint, TSS.TSSEntry> dict = null)
        {
            if (dict == null)
            {
                dict = tss.GenerateInGameIdDictionary();
            }
            var sb = new StringBuilder();

            sb.AppendLine("[" + item.ItemString.TrimNull() + "]");
            sb.Append("[Icon" + item.Data[(int)ItemData.Icon] + "] ");
            var nameEntry = dict[item.NamePointer];

            sb.AppendLine(nameEntry.StringEngOrJpn);
            var descEntry = dict[item.DescriptionPointer];

            sb.AppendLine(descEntry.StringEngOrJpn);

            switch (item.Data[(int)ItemData.Category])
            {
            case 2: sb.AppendLine("<Tools>"); break;

            case 3: sb.AppendLine("<Main>"); break;

            case 4: sb.AppendLine("<Sub>"); break;

            case 5: sb.AppendLine("<Head>"); break;

            case 6: sb.AppendLine("<Body>"); break;

            case 7: sb.AppendLine("<Accessories>"); break;

            case 8: sb.AppendLine("<Ingredients>"); break;

            case 9: sb.AppendLine("<Synthesis Materials>"); break;

            case 10: sb.AppendLine("<Valuables>"); break;

            case 11: sb.AppendLine("<DLC>"); break;

            default: sb.AppendLine("<UNKNOWN>"); break;
            }

            sb.AppendLine("Price in shops: " + item.Data[(int)ItemData.ShopPrice] + " Gald");

            if (item.Data[(int)ItemData.BuyableIn1] > 0 || item.Data[(int)ItemData.BuyableIn2] > 0 || item.Data[(int)ItemData.BuyableIn3] > 0)
            {
                sb.Append("Available at shops in: ");
                if (item.Data[(int)ItemData.BuyableIn1] > 0)
                {
                    sb.Append(Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn1]].GetLastValidName(dict).StringEngOrJpn);
                }
                if (item.Data[(int)ItemData.BuyableIn2] > 0)
                {
                    sb.Append("; " + Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn2]].GetLastValidName(dict).StringEngOrJpn);
                }
                if (item.Data[(int)ItemData.BuyableIn3] > 0)
                {
                    sb.Append("; " + Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn3]].GetLastValidName(dict).StringEngOrJpn);
                }
                sb.AppendLine();
            }

            uint equip = item.Data[(int)ItemData.EquippableByBitfield];

            if (equip > 0)
            {
                sb.Append("Equippable by: ");
                if ((equip & 1) == 1)
                {
                    sb.Append("[YUR]");
                }
                if ((equip & 2) == 2)
                {
                    sb.Append("[EST]");
                }
                if ((equip & 4) == 4)
                {
                    sb.Append("[KAR]");
                }
                if ((equip & 8) == 8)
                {
                    sb.Append("[RIT]");
                }
                if ((equip & 16) == 16)
                {
                    sb.Append("[RAV]");
                }
                if ((equip & 32) == 32)
                {
                    sb.Append("[JUD]");
                }
                if ((equip & 64) == 64)
                {
                    sb.Append("[RAP]");
                }
                if ((equip & 128) == 128)
                {
                    sb.Append("[FRE]");
                }
                if (version.HasPS3Content() && (equip & 256) == 256)
                {
                    sb.Append("[PAT]");
                }
                sb.AppendLine();
            }

            uint synthCount = item.Data[(int)ItemData.SynthRecipeCount];

            switch (synthCount)
            {
            case 0: sb.AppendLine("Can't be synthesized."); break;

            case 1: sb.AppendLine("Can be synthesized in 1 way."); break;

            default: sb.AppendLine("Can be synthesized in " + synthCount + " ways."); break;
            }
            for (int j = 0; j < synthCount; ++j)
            {
                uint synthItemCount = item.Data[(int)ItemData.Synth1ItemSlotCount + j * 16];
                sb.AppendLine("Synthesis method #" + (j + 1));
                sb.AppendLine(" Required Synthesis Level: " + item.Data[(int)ItemData._Synth1Level + j * 16]);
                sb.AppendLine(" Price: " + item.Data[(int)ItemData.Synth1Price + j * 16] + " Gald");
                sb.AppendLine(" Requires " + synthItemCount + " items:");
                for (int i = 0; i < synthItemCount; ++i)
                {
                    var    otherItem          = items.itemIdDict[item.Data[(int)ItemData.Synth1Item1Type + i * 2 + j * 16]];
                    var    otherItemNameEntry = dict[otherItem.NamePointer];
                    string otherItemName      = otherItemNameEntry.StringEngOrJpn;
                    sb.AppendLine("  Item " + (i + 1) + ": " + otherItemName + " x" + item.Data[(int)ItemData.Synth1Item1Count + i * 2 + j * 16]);
                }
            }


            switch (item.Data[(int)ItemData.Category])
            {
            case 2:
            default:
                // seems to be some kind of singletarget/multitarget flag maybe?
                //sb.AppendLine( "~19: " + item.Data[(int)ItemData.PATK] );

                // seems to be a bitfield regarding what stuff it heals, 1 == death, 2 = magical ailment, 4 == physical ailment
                // this is already covered below so don't print it
                //sb.AppendLine( "~20: " + item.Data[(int)ItemData.MATK] );

                if (item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0)
                {
                    sb.AppendLine("HP Heal %: " + item.Data[(int)ItemData.MDEF_or_HPHealPercent]);
                }
                if (item.Data[(int)ItemData.AGL_TPHealPercent] > 0)
                {
                    sb.AppendLine("TP Heal %: " + item.Data[(int)ItemData.AGL_TPHealPercent]);
                }

                // why is this here twice?
                uint physAilAlt = item.Data[(int)ItemData.PDEF];
                uint physAil    = item.Data[(int)ItemData._LUCK];
                if (physAil != physAilAlt)
                {
                    throw new Exception();
                }

                if (physAil > 0)
                {
                    sb.Append("Cures physical ailments: ");
                    if ((physAil & 1) == 1)
                    {
                        sb.Append("Death ");
                    }
                    if ((physAil & 2) == 2)
                    {
                        sb.Append("Poison ");
                    }
                    if ((physAil & 4) == 4)
                    {
                        sb.Append("Paralysis ");
                    }
                    if ((physAil & 8) == 8)
                    {
                        sb.Append("Petrification ");
                    }
                    if ((physAil & 16) == 16)
                    {
                        sb.Append("Weak ");
                    }
                    if ((physAil & 32) == 32)
                    {
                        sb.Append("SealedArtes ");
                    }
                    if ((physAil & 64) == 64)
                    {
                        sb.Append("SealedSkills ");
                    }
                    if ((physAil & 128) == 128)
                    {
                        sb.Append("Contamination ");
                    }
                    sb.AppendLine();
                }

                if (item.Data[(int)ItemData._AGL_Again] > 0)
                {
                    sb.AppendLine("Cures magical ailments");
                }

                if (item.Data[26] > 0)
                {
                    sb.AppendLine("Permanent PATK increase: " + item.Data[26]);
                }
                if (item.Data[27] > 0)
                {
                    sb.AppendLine("Permanent PDEF increase: " + item.Data[27]);
                }
                if (item.Data[(int)ItemData.AttrFire] > 0)
                {
                    sb.AppendLine("Permanent MATK increase: " + item.Data[(int)ItemData.AttrFire]);
                }
                if (item.Data[(int)ItemData.AttrWater] > 0)
                {
                    sb.AppendLine("Permanent MDEF increase: " + item.Data[(int)ItemData.AttrWater]);
                }
                if (item.Data[(int)ItemData.AttrWind] > 0)
                {
                    sb.AppendLine("Permanent AGL increase: " + item.Data[(int)ItemData.AttrWind]);
                }
                if (item.Data[(int)ItemData.Skill1] > 0)
                {
                    sb.AppendLine("Max HP increase: " + item.Data[(int)ItemData.Skill1]);
                }
                if (item.Data[(int)ItemData.Skill1Metadata] > 0)
                {
                    sb.AppendLine("Max TP increase: " + item.Data[(int)ItemData.Skill1Metadata]);
                }
                break;

            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                if ((int)item.Data[(int)ItemData.PATK] > 0)
                {
                    sb.AppendLine("PATK: " + (int)item.Data[(int)ItemData.PATK]);
                }
                if ((int)item.Data[(int)ItemData.MATK] > 0)
                {
                    sb.AppendLine("MATK: " + (int)item.Data[(int)ItemData.MATK]);
                }
                if ((int)item.Data[(int)ItemData.PDEF] > 0)
                {
                    sb.AppendLine("PDEF: " + (int)item.Data[(int)ItemData.PDEF]);
                }
                if ((int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0)
                {
                    sb.AppendLine("MDEF: " + (int)item.Data[(int)ItemData.MDEF_or_HPHealPercent]);
                }

                int agl1 = (int)item.Data[(int)ItemData.AGL_TPHealPercent];
                int agl2 = (int)item.Data[(int)ItemData._AGL_Again];

                if (agl1 != agl2)
                {
                    sb.AppendLine("!!! AGL1: " + agl1 + " / AGL2: " + agl2);
                }
                else
                {
                    if (agl1 > 0)
                    {
                        sb.AppendLine("AGL: " + agl1);
                    }
                }

                if ((int)item.Data[(int)ItemData._LUCK] > 0)
                {
                    sb.AppendLine("LUCK: " + (int)item.Data[(int)ItemData._LUCK]);
                }

                if ((int)item.Data[(int)ItemData.AttrFire] != 0)
                {
                    sb.AppendLine("Attribute Fire: " + (int)item.Data[(int)ItemData.AttrFire]);
                }
                if ((int)item.Data[(int)ItemData.AttrWater] != 0)
                {
                    sb.AppendLine("Attribute Water: " + (int)item.Data[(int)ItemData.AttrWater]);
                }
                if ((int)item.Data[(int)ItemData.AttrWind] != 0)
                {
                    sb.AppendLine("Attribute Wind: " + (int)item.Data[(int)ItemData.AttrWind]);
                }
                if ((int)item.Data[(int)ItemData.AttrEarth] != 0)
                {
                    sb.AppendLine("Attribute Earth: " + (int)item.Data[(int)ItemData.AttrEarth]);
                }
                if ((int)item.Data[(int)ItemData.AttrLight] != 0)
                {
                    sb.AppendLine("Attribute Light: " + (int)item.Data[(int)ItemData.AttrLight]);
                }
                if ((int)item.Data[(int)ItemData.AttrDark] != 0)
                {
                    sb.AppendLine("Attribute Darkness: " + (int)item.Data[(int)ItemData.AttrDark]);
                }

                for (int i = 0; i < 3; ++i)
                {
                    uint skillId = item.Data[(int)ItemData.Skill1 + i * 2];
                    if (skillId != 0)
                    {
                        var    skill          = skills.SkillIdDict[skillId];
                        var    skillNameEntry = dict[skill.NameStringDicID];
                        string skillName      = skillNameEntry.StringEngOrJpn;
                        sb.AppendLine("Skill #" + (i + 1) + " Name: " + skillName);
                        sb.AppendLine("Skill #" + (i + 1) + " Metadata: " + item.Data[(int)ItemData.Skill1Metadata + i * 2]);
                    }
                }
                break;
            }



            for (int j = 0; j < 2; ++j)
            {
                for (int i = 0; i < 16; ++i)
                {
                    uint enemyId = item.Data[(int)ItemData.Drop1Enemy + i + j * 32];
                    if (enemyId != 0)
                    {
                        var    enemy          = enemies.EnemyIdDict[enemyId];
                        var    enemyNameEntry = dict[enemy.NameStringDicID];
                        string enemyName      = enemyNameEntry.StringEngOrJpn;
                        sb.AppendLine("Enemy " + (j == 0 ? "Drop" : "Steal") + " #" + (i + 1) + ": " + enemyName + ", " + item.Data[(int)ItemData.Drop1Chance + i + j * 32] + "%");
                    }
                }
            }

            for (int i = 0; i < 8; ++i)
            {
                if (item.Data[(int)ItemData.UsedInRecipe1 + i] != 0)
                {
                    sb.AppendLine("Used in Recipe #" + (i + 1) + ": " + item.Data[(int)ItemData.UsedInRecipe1 + i]);
                }
            }

            //sb.AppendLine( "~3: " + item.Data[3] );
            //sb.AppendLine( "~5: " + item.Data[5] );
            //sb.AppendLine( "~18: " + item.Data[18] );

            /* all of these values make no sense to me, probably useless for the reader
             * sb.AppendLine( "~169: " + item.Data[169] );
             * sb.AppendLine( "~170: " + item.Data[170] );
             * sb.AppendLine( "~171: " + item.Data[171] );
             * sb.AppendLine( "~172: " + item.Data[172] );
             * sb.AppendLine( "~173: " + item.Data[173] );
             * sb.AppendLine( "~174: " + item.Data[174] );
             */

            // no idea, maybe related to what shows up on the character model?
            //sb.AppendLine( "~175: " + (int)item.Data[175] );

            // seems to be some sort of ID, useless for the reader
            //sb.AppendLine( "~176: " + item.Data[176] );

            if (item.Data[(int)ItemData.UsableInBattle] > 0)
            {
                sb.AppendLine("Usable in battle");
            }
            ;
            if (item.Data[(int)ItemData.InCollectorsBook] == 0)
            {
                sb.AppendLine("Not in Collector's Book");
            }

            return(sb.ToString());
        }
Exemple #12
0
        public static string GetItemDataAsHtml(GameVersion version, string versionPostfix, GameLocale locale, WebsiteLanguage websiteLanguage, ItemDat items, ItemDatSingle item, T8BTSK.T8BTSK skills, T8BTEMST.T8BTEMST enemies, COOKDAT.COOKDAT Recipes, WRLDDAT.WRLDDAT Locations, ShopData.ShopData shopData, TOVSEAF.TOVSEAF searchPoints, TSS.TSSFile tss, Dictionary <uint, TSS.TSSEntry> dict, bool phpLinks = false)
        {
            if (dict == null)
            {
                dict = tss.GenerateInGameIdDictionary();
            }
            bool trustItemBookForShops   = true;           // true to use the values of the item book for shop locations; false to parse it out from the actual data
            bool trustItemBookForEnemies = false;          // true to use the values of the item book for enemy drop/steal lists; false to parse it out from the actual data

            var sb = new StringBuilder();

            sb.Append("<tr id=\"item" + item.Data[(int)ItemData.ID] + "\">");
            sb.Append("<td rowspan=\"3\">");

            sb.Append("<img src=\"items/U_" + item.ItemString.TrimNull() + ".png\" height=\"128\" width=\"128\">");
            sb.Append("</td><td colspan=\"2\">");

            uint equip = item.Data[(int)ItemData.EquippableByBitfield];

            if (equip > 0)
            {
                sb.Append("<span class=\"equip\">");
                Website.WebsiteGenerator.AppendCharacterBitfieldAsImageString(sb, dict, version, equip, websiteLanguage.MainJp());
                sb.Append("</span>");
            }


            var nameEntry = dict[item.NamePointer];
            var descEntry = dict[item.DescriptionPointer];

            if (websiteLanguage.WantsJp())
            {
                sb.Append("<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> ");
                sb.Append("<span class=\"itemname\">");
                sb.Append(nameEntry.StringJpnHtml(version, dict));
                sb.Append("</span>");
                sb.Append("<br>");
                sb.Append("<span class=\"itemdesc\">");
                sb.Append(descEntry.StringJpnHtml(version, dict));
                sb.Append("</span>");
            }

            if (websiteLanguage.WantsBoth())
            {
                sb.Append("<br>");
                sb.Append("<br>");
            }

            if (websiteLanguage.WantsEn())
            {
                sb.Append("<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> ");
                sb.Append("<span class=\"itemname\">");
                sb.Append(nameEntry.StringEngHtml(version, dict));
                sb.Append("</span>");
                sb.Append("<br>");
                sb.Append("<span class=\"itemdesc\">");
                sb.Append(descEntry.StringEngHtml(version, dict));
                sb.Append("</span>");
            }

            sb.Append("<span class=\"special\">");
            if (item.Data[(int)ItemData.UsableInBattle] > 0)
            {
                sb.Append("Usable in battle");
            }
            ;
            if (item.Data[(int)ItemData.InCollectorsBook] == 0)
            {
                sb.Append("Not in Collector's Book");
            }
            sb.Append("</span>");
            sb.Append("</td>");

            uint synthCount = item.Data[(int)ItemData.SynthRecipeCount];

            switch (synthCount)
            {
            case 0: break;

            case 1: sb.Append("<td colspan=\"2\">"); break;

            default: sb.Append("<td>"); break;
            }
            for (int j = 0; j < synthCount; ++j)
            {
                uint synthItemCount = item.Data[(int)ItemData.Synth1ItemSlotCount + j * 16];
                sb.Append("Synthesis Level: " + item.Data[(int)ItemData._Synth1Level + j * 16]);
                sb.Append("<br>");
                sb.Append("Price: " + item.Data[(int)ItemData.Synth1Price + j * 16] + " Gald");
                for (int i = 0; i < synthItemCount; ++i)
                {
                    sb.Append("<br>");
                    var    otherItem          = items.itemIdDict[item.Data[(int)ItemData.Synth1Item1Type + i * 2 + j * 16]];
                    var    otherItemNameEntry = dict[otherItem.NamePointer];
                    string otherItemName      = otherItemNameEntry.StringEngOrJpnHtml(version, dict, websiteLanguage);
                    sb.Append("<img src=\"item-icons/ICON" + otherItem.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> ");
                    sb.Append("<a href=\"" + Website.WebsiteGenerator.GetUrl(Website.WebsiteSection.Item, version, versionPostfix, locale, websiteLanguage, phpLinks, id: (int)otherItem.Data[(int)ItemData.ID], icon: (int)otherItem.Data[(int)ItemData.Icon]) + "\">");
                    sb.Append(otherItemName + "</a> x" + item.Data[(int)ItemData.Synth1Item1Count + i * 2 + j * 16]);
                }
                if (synthCount > 1 && j == 0)
                {
                    sb.Append("</td><td>");
                }
            }

            sb.Append("</td></tr><tr>");

            uint category = item.Data[(int)ItemData.Category];

            switch (category)
            {
            case 2:
            default:
                sb.Append("<td colspan=\"2\">");
                if (item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0)
                {
                    sb.Append("HP Heal %: " + item.Data[(int)ItemData.MDEF_or_HPHealPercent] + "<br>");
                }
                if (item.Data[(int)ItemData.AGL_TPHealPercent] > 0)
                {
                    sb.Append("TP Heal %: " + item.Data[(int)ItemData.AGL_TPHealPercent] + "<br>");
                }

                // why is this here twice?
                uint physAilAlt = item.Data[(int)ItemData.PDEF];
                uint physAil    = item.Data[(int)ItemData._LUCK];
                if (physAil != physAilAlt)
                {
                    throw new Exception();
                }

                if (physAil > 0)
                {
                    sb.Append("Cures physical ailments: ");
                    if ((physAil & 1) == 1)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-13.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 2) == 2)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-01.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 4) == 4)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-02.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 8) == 8)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-03.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 16) == 16)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-04.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 32) == 32)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-05.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 64) == 64)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-06.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 128) == 128)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-07.png\" height=\"32\" width=\"32\">");
                    }
                    sb.Append("<br>");
                }

                if (item.Data[(int)ItemData._AGL_Again] > 0)
                {
                    sb.Append("Cures magical ailments<br>");
                }

                if (item.Data[(int)ItemData.PermanentPAtkIncrease] > 0)
                {
                    sb.Append("Permanent PATK increase: " + item.Data[(int)ItemData.PermanentPAtkIncrease] + "<br>");
                }
                if (item.Data[(int)ItemData.PermanentPDefIncrease] > 0)
                {
                    sb.Append("Permanent PDEF increase: " + item.Data[(int)ItemData.PermanentPDefIncrease] + "<br>");
                }
                if (item.Data[(int)ItemData.AttrFire] > 0)
                {
                    sb.Append("Permanent MATK increase: " + item.Data[(int)ItemData.AttrFire] + "<br>");
                }
                if (item.Data[(int)ItemData.AttrWater] > 0)
                {
                    sb.Append("Permanent MDEF increase: " + item.Data[(int)ItemData.AttrWater] + "<br>");
                }
                if (item.Data[(int)ItemData.AttrWind] > 0)
                {
                    sb.Append("Permanent AGL increase: " + item.Data[(int)ItemData.AttrWind] + "<br>");
                }
                if (item.Data[(int)ItemData.Skill1] > 0)
                {
                    sb.Append("Max HP increase: " + item.Data[(int)ItemData.Skill1] + "<br>");
                }
                if (item.Data[(int)ItemData.Skill1Metadata] > 0)
                {
                    sb.Append("Max TP increase: " + item.Data[(int)ItemData.Skill1Metadata] + "<br>");
                }

                for (int i = 0; i < 8; ++i)
                {
                    int recipeId = (int)item.Data[(int)ItemData.UsedInRecipe1 + i];
                    if (recipeId != 0)
                    {
                        var recipe          = Recipes.RecipeList[recipeId];
                        var recipeNameEntry = dict[recipe.NameStringDicID];
                        sb.Append("<a href=\"" + Website.WebsiteGenerator.GetUrl(Website.WebsiteSection.Recipe, version, versionPostfix, locale, websiteLanguage, phpLinks, id: (int)recipe.ID) + "\">" + recipeNameEntry.StringEngOrJpnHtml(version, dict, websiteLanguage) + "</a><br>");
                    }
                }

                sb.Append("</td>");
                break;

            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                sb.Append("<td>");
                if ((int)item.Data[(int)ItemData.PATK] > 0)
                {
                    sb.Append("PATK: " + (int)item.Data[(int)ItemData.PATK] + "<br>");
                }
                if ((int)item.Data[(int)ItemData.MATK] > 0)
                {
                    sb.Append("MATK: " + (int)item.Data[(int)ItemData.MATK] + "<br>");
                }
                if ((int)item.Data[(int)ItemData.PDEF] > 0)
                {
                    sb.Append("PDEF: " + (int)item.Data[(int)ItemData.PDEF] + "<br>");
                }
                if ((int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0)
                {
                    sb.Append("MDEF: " + (int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] + "<br>");
                }

                int agl1 = (int)item.Data[(int)ItemData.AGL_TPHealPercent];
                int agl2 = (int)item.Data[(int)ItemData._AGL_Again];

                if (agl2 > 0)
                {
                    sb.Append("AGL: " + agl2 + "<br>");
                }

                if ((int)item.Data[(int)ItemData._LUCK] > 0)
                {
                    sb.Append("LUCK: " + (int)item.Data[(int)ItemData._LUCK] + "<br>");
                }


                int attackElementCount  = 0;
                int defenseElementCount = 0;
                for (int i = 0; i < 6; ++i)
                {
                    if ((int)item.Data[(int)ItemData.AttrFire + i] > 0)
                    {
                        attackElementCount++;
                    }
                    if ((int)item.Data[(int)ItemData.AttrFire + i] < 0)
                    {
                        defenseElementCount++;
                    }
                }

                if (attackElementCount > 0 || defenseElementCount > 0)
                {
                    int fire = (int)item.Data[(int)ItemData.AttrFire];
                    int watr = (int)item.Data[(int)ItemData.AttrWater];
                    int wind = (int)item.Data[(int)ItemData.AttrWind];
                    int eart = (int)item.Data[(int)ItemData.AttrEarth];
                    int lght = (int)item.Data[(int)ItemData.AttrLight];
                    int dark = (int)item.Data[(int)ItemData.AttrDark];
                    if (defenseElementCount > 0)
                    {
                        sb.Append("<table class=\"element\"><tr>");
                        sb.Append("<td colspan=\"" + defenseElementCount + "\">Resistance</td>");
                        sb.Append("</tr><tr>");
                        if (fire < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-02.png\"></td>");
                        }
                        if (eart < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-04.png\"></td>");
                        }
                        if (wind < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-01.png\"></td>");
                        }
                        if (watr < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-05.png\"></td>");
                        }
                        if (lght < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-03.png\"></td>");
                        }
                        if (dark < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-06.png\"></td>");
                        }
                        sb.Append("</tr><tr>");
                        if (fire < 0)
                        {
                            sb.Append("<td>" + -fire + "%</td>");
                        }
                        if (eart < 0)
                        {
                            sb.Append("<td>" + -eart + "%</td>");
                        }
                        if (wind < 0)
                        {
                            sb.Append("<td>" + -wind + "%</td>");
                        }
                        if (watr < 0)
                        {
                            sb.Append("<td>" + -watr + "%</td>");
                        }
                        if (lght < 0)
                        {
                            sb.Append("<td>" + -lght + "%</td>");
                        }
                        if (dark < 0)
                        {
                            sb.Append("<td>" + -dark + "%</td>");
                        }
                        sb.Append("</tr></table>");
                    }
                    if (attackElementCount > 0)
                    {
                        sb.Append("<table class=\"element\"><tr>");
                        if (category == 3 || category == 4)
                        {
                            // weapons and sub-weapons add elemental attributes to your attack
                            sb.Append("<td colspan=\"" + attackElementCount + "\">Attack Element</td>");
                        }
                        else
                        {
                            // defensive equipment instead uses this field as a weak/resist, with weak as positive and resist as negative values
                            sb.Append("<td colspan=\"" + attackElementCount + "\">Weakness</td>");
                        }
                        sb.Append("</tr><tr>");
                        if (fire > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-02.png\"></td>");
                        }
                        if (eart > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-04.png\"></td>");
                        }
                        if (wind > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-01.png\"></td>");
                        }
                        if (watr > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-05.png\"></td>");
                        }
                        if (lght > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-03.png\"></td>");
                        }
                        if (dark > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-06.png\"></td>");
                        }
                        if (!(category == 3 || category == 4))
                        {
                            // weapons always have a "1" here, don't print that, it's not useful
                            sb.Append("</tr><tr>");
                            if (fire > 0)
                            {
                                sb.Append("<td>" + fire + "%</td>");
                            }
                            if (eart > 0)
                            {
                                sb.Append("<td>" + eart + "%</td>");
                            }
                            if (wind > 0)
                            {
                                sb.Append("<td>" + wind + "%</td>");
                            }
                            if (watr > 0)
                            {
                                sb.Append("<td>" + watr + "%</td>");
                            }
                            if (lght > 0)
                            {
                                sb.Append("<td>" + lght + "%</td>");
                            }
                            if (dark > 0)
                            {
                                sb.Append("<td>" + dark + "%</td>");
                            }
                        }
                        sb.Append("</tr></table>");
                    }
                }

                sb.Append("</td><td>");

                for (int i = 0; i < 3; ++i)
                {
                    uint skillId = item.Data[(int)ItemData.Skill1 + i * 2];
                    if (skillId != 0)
                    {
                        var    skill          = skills.SkillIdDict[skillId];
                        var    skillNameEntry = dict[skill.NameStringDicID];
                        string skillName      = skillNameEntry.StringEngOrJpnHtml(version, dict, websiteLanguage);
                        string skillCat       = "<img src=\"skill-icons/category-" + skill.Category.ToString() + ".png\" height=\"16\" width=\"16\">";
                        sb.Append(skillCat);
                        sb.Append("<a href=\"" + Website.WebsiteGenerator.GetUrl(Website.WebsiteSection.Skill, version, versionPostfix, locale, websiteLanguage, phpLinks, id: (int)skill.InGameID) + "\">");
                        sb.Append(skillName);
                        sb.Append("</a>, " + item.Data[(int)ItemData.Skill1Metadata + i * 2] + "<br>");
                    }
                }
                sb.Append("</td>");
                break;
            }



            sb.Append("<td>");


            sb.Append(item.Data[(int)ItemData.ShopPrice] + " Gald");

            if (trustItemBookForShops)
            {
                if (item.Data[(int)ItemData.BuyableIn1] > 0 || item.Data[(int)ItemData.BuyableIn2] > 0 || item.Data[(int)ItemData.BuyableIn3] > 0)
                {
                    //sb.Append( "<br>Available at shops in:" );
                    for (int i = 0; i < 3; ++i)
                    {
                        if (item.Data[(int)ItemData.BuyableIn1 + i] > 0)
                        {
                            var loc = Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn1 + i]];
                            sb.Append("<br><a href=\"" + Website.WebsiteGenerator.GetUrl(Website.WebsiteSection.Location, version, versionPostfix, locale, websiteLanguage, phpLinks, id: (int)loc.LocationID) + "\">");
                            sb.Append(loc.GetLastValidName(dict).StringEngOrJpnHtml(version, dict, websiteLanguage) + "</a>");
                        }
                    }
                }
            }
            else
            {
                List <ShopData.ShopDefinition> shops = new List <ShopData.ShopDefinition>();
                foreach (var kvp in shopData.ShopDictionary)
                {
                    ShopData.ShopDefinition shop = kvp.Value;
                    foreach (var shopItem in shop.ShopItems)
                    {
                        if (shopItem.ItemID == item.Data[(int)ItemData.ID])
                        {
                            shops.Add(shop);
                            break;
                        }
                    }
                }

                bool printShopsDirectly = false;
                if (printShopsDirectly)
                {
                    foreach (var shop in shops)
                    {
                        sb.Append("<br><a href=\"" + Website.WebsiteGenerator.GetUrl(Website.WebsiteSection.Shop, version, versionPostfix, locale, websiteLanguage, phpLinks, id: (int)shop.InGameID) + "\">");
                        sb.Append(dict[shop.StringDicID].StringEngOrJpnHtml(version, dict, websiteLanguage) + "</a>");
                    }
                }
                else
                {
                    foreach (var shop in shops)
                    {
                        WRLDDAT.Location loc = FindLocationOfShop(shop, shopData, Locations);
                        if (loc != null)
                        {
                            sb.Append("<br><a href=\"" + Website.WebsiteGenerator.GetUrl(Website.WebsiteSection.Location, version, versionPostfix, locale, websiteLanguage, phpLinks, id: (int)loc.LocationID) + "\">");
                            sb.Append(loc.GetLastValidName(dict).StringEngOrJpnHtml(version, dict, websiteLanguage) + "</a>");
                        }
                        else
                        {
                            sb.Append("<br><a href=\"" + Website.WebsiteGenerator.GetUrl(Website.WebsiteSection.Shop, version, versionPostfix, locale, websiteLanguage, phpLinks, id: (int)shop.InGameID) + "\">");
                            sb.Append(dict[shop.StringDicID].StringEngOrJpnHtml(version, dict, websiteLanguage) + "</a>");
                        }
                    }
                }
            }

            sb.Append("</td><td>");

            List <uint> itemsRequireSynth = FindItemsThatRequireForSynth(item.Data[(int)ItemData.ID], items);

            if (itemsRequireSynth.Count > 0)
            {
                sb.Append("Can be used to synthesize");
                foreach (uint otherItemId in itemsRequireSynth)
                {
                    ItemDatSingle otherItem = items.itemIdDict[otherItemId];
                    sb.Append("<br>");
                    var    otherItemNameEntry = dict[otherItem.NamePointer];
                    string otherItemName      = otherItemNameEntry.StringEngOrJpnHtml(version, dict, websiteLanguage);
                    sb.Append("<img src=\"item-icons/ICON" + otherItem.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> ");
                    sb.Append("<a href=\"" + Website.WebsiteGenerator.GetUrl(Website.WebsiteSection.Item, version, versionPostfix, locale, websiteLanguage, phpLinks, id: (int)otherItem.Data[(int)ItemData.ID], icon: (int)otherItem.Data[(int)ItemData.Icon]) + "\">");
                    sb.Append(otherItemName + "</a>");
                }
            }

            sb.Append("</td></tr><tr>");

            // drops and steals
            List <(uint enemyId, uint dropChance, uint?fatalType, uint?fatalIncrease)>[] enemyIds = new List <(uint enemyId, uint dropChance, uint?fatalType, uint?fatalIncrease)> [3];
Exemple #13
0
        public string GetDataAsHtml( GameVersion version, ItemDat.ItemDat items, TSSFile stringDic, Dictionary<uint, TSSEntry> inGameIdDict, List<SearchPointContent> searchPointContents, List<SearchPointItem> searchPointItems, int index, bool phpLinks = false )
        {
            StringBuilder sb = new StringBuilder();

            sb.Append( "<tr id=\"searchpoint").Append( Index ).Append( "\">" );
            sb.Append( "<td colspan=\"5\">" );
            sb.Append( "[#" ).Append( index ).Append( "] " );
            switch ( SearchPointType ) {
                case 0: sb.Append( "Tree Stump" ); break;
                case 1: sb.Append( "Shell" ); break;
                case 2: sb.Append( "Bones" ); break;
                case 3: sb.Append( "Seagulls" ); break;
                default: sb.Append( SearchPointType ); break;
            }
            if ( CoordY < 0 ) {
                sb.Append( " (Underwater)" );
            }
            if ( ScenarioBegin > 1000999 ) {
                switch ( ScenarioBegin ) {
                    case 3000000: sb.Append( " (Chapter 3 only)" ); break;
                    case 3590000: sb.Append( " (once Erealumen Crystallands accessible)" ); break;
                    default: sb.Append( " (Appears after scenario " ).Append( ScenarioBegin ).Append( ")" ); break;
                }
            }
            //sb.Append( "<br>" )
            //sb.Append( "9: " ).Append( Unknown9 ).Append( "<br>" );
            //sb.Append( "11: " ).Append( Unknown11 ).Append( "<br>" );
            //sb.Append( "14a: " ).Append( Unknown14a ).Append( "<br>" );

            sb.Append( "</td>" );
            sb.Append( "</tr>" );

            sb.Append( "<tr>" );
            for ( uint i = 0; i < SearchPointContentCount; ++i ) {
                sb.Append( "<td>" );
                sb.Append( searchPointContents[(int)( SearchPointContentIndex + i )].GetDataAsHtml( version, items, stringDic, inGameIdDict, searchPointItems, phpLinks: phpLinks ) );
                sb.Append( "</td>" );
            }
            for ( uint i = SearchPointContentCount; i < 5; ++i ) {
                sb.Append( "<td>" );
                sb.Append( "</td>" );
            }
            sb.Append( "</tr>" );

            return sb.ToString();
        }
Exemple #14
0
        public string GetDataAsHtml( GameVersion version, COOKDAT recipes, ItemDat.ItemDat items, TSS.TSSFile stringDic, Dictionary<uint, TSS.TSSEntry> inGameIdDict, bool phpLinks = false )
        {
            StringBuilder sb = new StringBuilder();
            sb.Append( "<tr id=\"recipe" + ID + "\"><td>" );
            sb.Append( "<img src=\"recipes/U_" + RefString + ".png\">" );
            sb.Append( "</td><td>" );
            sb.Append( "<span class=\"itemname\">" + inGameIdDict[NameStringDicID].StringJpnHtml( version ) + "</span><br>" );
            sb.Append( inGameIdDict[DescriptionStringDicID].StringJpnHtml( version ) + "<br>" );
            sb.Append( inGameIdDict[EffectStringDicID].StringJpnHtml( version ) + "<br>" );
            sb.Append( "<br>" );
            sb.Append( "<span class=\"itemname\">" + inGameIdDict[NameStringDicID].StringEngHtml( version ) + "</span><br>" );
            sb.Append( inGameIdDict[DescriptionStringDicID].StringEngHtml( version ) + "<br>" );
            sb.Append( inGameIdDict[EffectStringDicID].StringEngHtml( version ) + "<br>" );

            sb.Append( "</td><td>" );
            for ( int i = 0; i < IngredientGroups.Length; ++i ) {
                if ( IngredientGroups[i] != 0 ) {
                    uint stringDicId;
                    stringDicId = IngredientGroupDict[IngredientGroups[i]];
                    var entry = inGameIdDict[stringDicId];
                    sb.Append( "<img src=\"item-icons/ICON" + IngredientGroups[i] + ".png\" height=\"16\" width=\"16\"> " );
                    sb.Append( entry.StringEngOrJpnHtml( version ) + " x" + IngredientGroupCount[i] + "<br>" );
                }
            }
            for ( int i = 0; i < Ingredients.Length; ++i ) {
                if ( Ingredients[i] != 0 ) {
                    var item = items.itemIdDict[Ingredients[i]];
                    sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
                    sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon] ) + "\">" );
                    sb.Append( inGameIdDict[item.NamePointer].StringEngOrJpnHtml( version ) + "</a> x" + IngredientCount[i] + "<br>" );
                }
            }

            sb.Append( "</td><td>" );
            if ( HP > 0 ) { sb.Append( "HP Heal: " + HP + "%<br>" ); }
            if ( TP > 0 ) { sb.Append( "TP Heal: " + TP + "%<br>" ); }

            if ( PhysicalAilmentHeal > 0 || DeathHeal > 0 ) {
                sb.Append( "Cures Ailments: " );
                if ( DeathHeal > 0 ) { sb.Append( "<img src=\"text-icons/icon-status-13.png\" height=\"16\" width=\"16\" title=\"Death\">" ); }
                if ( ( PhysicalAilmentHeal & 1 ) == 1 ) { sb.Append( "<img src=\"text-icons/icon-status-01.png\" height=\"16\" width=\"16\" title=\"Poison\">" ); }
                if ( ( PhysicalAilmentHeal & 2 ) == 2 ) { sb.Append( "<img src=\"text-icons/icon-status-07.png\" height=\"16\" width=\"16\" title=\"Contamination\">" ); }
                if ( ( PhysicalAilmentHeal & 4 ) == 4 ) { sb.Append( "<img src=\"text-icons/icon-status-02.png\" height=\"16\" width=\"16\" title=\"Paralysis\">" ); }
                if ( ( PhysicalAilmentHeal & 8 ) == 8 ) { sb.Append( "<img src=\"text-icons/icon-status-03.png\" height=\"16\" width=\"16\" title=\"Petrification\">" ); }
                if ( ( PhysicalAilmentHeal & 16 ) == 16 ) { sb.Append( "<img src=\"text-icons/icon-status-04.png\" height=\"16\" width=\"16\" title=\"Weakness\">" ); }
                if ( ( PhysicalAilmentHeal & 32 ) == 32 ) { sb.Append( "<img src=\"text-icons/icon-status-05.png\" height=\"16\" width=\"16\" title=\"Sealed Artes\">" ); }
                if ( ( PhysicalAilmentHeal & 64 ) == 64 ) { sb.Append( "<img src=\"text-icons/icon-status-06.png\" height=\"16\" width=\"16\" title=\"Sealed Skills\">" ); }
                sb.Append( "<br>" );
            }

            if ( StatValue > 0 ) {
                //sb.Append( "Stat Type: " + StatType + "<br>" );
                switch ( StatType ) {
                    case 1: sb.Append( "P. ATK" ); break;
                    case 2: sb.Append( "P. DEF" ); break;
                    case 3: sb.Append( "M. ATK" ); break;
                    case 4: sb.Append( "M. DEF" ); break;
                    case 5: sb.Append( "AGL" ); break;
                    case 11: sb.Append( "Over Limit gauge increases<br>" ); break;
                }
                if ( StatType != 11 ) {
                    sb.Append( " +" + StatValue + ( StatType < 5 ? "%" : "" ) + "<br>" );
                    sb.Append( "Duration: " + StatTime + " seconds<br>" );
                }
            }

            if ( RecipeCreationCharacter.Count( x => x != 0 ) > 0 ) {
                sb.Append( "Recipe Evolutions:<br>" );
                for ( int i = 0; i < RecipeCreationCharacter.Length; ++i ) {
                    if ( RecipeCreationCharacter[i] != 0 ) {
                        var otherRecipe = recipes.RecipeList[(int)RecipeCreationRecipe[i]];
                        Website.GenerateWebsite.AppendCharacterBitfieldAsImageString( sb, version, (uint)( 1 << (int)( RecipeCreationCharacter[i] - 1 ) ) );
                        sb.Append( " <a href=\"#recipe" + otherRecipe.ID + "\">" );
                        sb.Append( inGameIdDict[otherRecipe.NameStringDicID].StringEngOrJpnHtml( version ) );
                        sb.Append( "</a>" );
                        sb.Append( "<br>" );
                    }
                }
            }

            sb.Append( "<table class=\"element\">" );
            sb.Append( "<tr>" );
            sb.Append( "<td>Likes</td>" );
            sb.Append( "<td>Dislikes</td>" );
            sb.Append( "</tr>" );

            sb.Append( "<tr>" );
            sb.Append( "<td>" );
            Website.GenerateWebsite.AppendCharacterBitfieldAsImageString( sb, version, CharactersLike );
            sb.Append( "</td>" );
            sb.Append( "<td>" );
            Website.GenerateWebsite.AppendCharacterBitfieldAsImageString( sb, version, CharactersDislike );
            sb.Append( "</td>" );
            sb.Append( "</tr>" );
            sb.Append( "<tr>" );
            sb.Append( "<td>Good at</td>" );
            sb.Append( "<td>Bad at</td>" );
            sb.Append( "</tr>" );
            sb.Append( "<tr>" );
            sb.Append( "<td>" );
            Website.GenerateWebsite.AppendCharacterBitfieldAsImageString( sb, version, CharactersGoodAtMaking );
            sb.Append( "</td>" );
            sb.Append( "<td>" );
            Website.GenerateWebsite.AppendCharacterBitfieldAsImageString( sb, version, CharactersBadAtMaking );
            sb.Append( "</td>" );
            sb.Append( "</tr>" );

            sb.Append( "</table>" );

            sb.Append( "</td></tr>" );
            return sb.ToString();
        }
Exemple #15
0
        public ItemForm(GameVersion version, ItemDat itemDat, TSSFile TSS, T8BTSK.T8BTSK skills, T8BTEMST.T8BTEMST enemies, COOKDAT.COOKDAT cookdat, WRLDDAT.WRLDDAT locations)
        {
            InitializeComponent();

            this.Version      = version;
            this.itemDat      = itemDat;
            this.TSS          = TSS;
            this.Skills       = skills;
            this.Enemies      = enemies;
            this.Recipes      = cookdat;
            this.Locations    = locations;
            this.InGameIdDict = TSS.GenerateInGameIdDictionary();

            labels    = new List <Label>();
            textboxes = new List <TextBox>();

            for (int i = 0; i < ItemDatSingle.size / 4; ++i)
            {
                Label l = new Label();
                l.Text = "";
                l.Size = new System.Drawing.Size(100, 20);
                TextBox b = new TextBox();
                b.Size = new System.Drawing.Size(50, 20);
                b.Text = "";

                labels.Add(l);
                textboxes.Add(b);

                FlowLayoutPanel p = new FlowLayoutPanel();
                p.Size          = new System.Drawing.Size(200, 20);
                p.FlowDirection = FlowDirection.LeftToRight;
                p.Controls.Add(l);
                p.Controls.Add(b);

                switch ((ItemData)i)
                {
                case ItemData.NamePointer:
                case ItemData.DescriptionPointer:
                case ItemData.UnknownTextPointer:
                case ItemData.TextIDPart1:
                case ItemData.TextIDPart2:
                case ItemData.TextIDPart3:
                case ItemData.TextIDPart4:
                case ItemData.TextIDPart5:
                case ItemData.TextIDPart6:
                case ItemData.TextIDPart7:
                case ItemData.TextIDPart8:
                    break;

                default:
                    flowLayoutPanel1.Controls.Add(p);
                    break;
                }
            }

            foreach (ItemDatSingle i in itemDat.items)
            {
                var entry = GetEntry(i.Data[(int)ItemData.NamePointer]);
                listBox1.Items.Add(entry.StringEngOrJpn);
            }
        }
Exemple #16
0
        public string GetDataAsHtml( GameVersion version, ItemDat.ItemDat items, WRLDDAT.WRLDDAT locations, TSS.TSSFile stringDic, Dictionary<uint, TSS.TSSEntry> inGameIdDict, bool phpLinks = false )
        {
            var sb = new StringBuilder();

            sb.Append( "<tr id=\"enemy" + InGameID + "\">" );

            sb.Append( "<td style=\"height: 46px;\">" );
            var enemyNameEntry = inGameIdDict[NameStringDicID];
            sb.Append( "<img src=\"monster-icons/44px/monster-" + IconID.ToString( "D3" ) + ".png\" title=\"" + RefString + "\">" );
            sb.Append( "</td>" );
            sb.Append( "<td style=\"height: 46px;\">" );
            sb.Append( "<span class=\"itemname\">" + enemyNameEntry.StringJpnHtml( version ) + "</span><br>" );
            sb.Append( "<span class=\"itemname\">" + enemyNameEntry.StringEngHtml( version ) + "</span><br>" );
            //sb.Append( RefString2 + "<br>" );
            //sb.Append( RefString3 + "<br>" );
            //sb.Append( RefString4 + "<br>" );
            //sb.Append( RefString5 + "<br>" );
            sb.Append( "</td>" );
            //sb.Append( " / Category: " + Category + "<br>" );

            AppendStats( sb, "Easy", 0 );
            AppendStats( sb, "Normal", 1 );
            AppendStats( sb, "Hard", 2 );
            AppendStats( sb, "Unknown", 3 );

            sb.Append( "<td rowspan=\"2\">" );
            sb.Append( "EXP: " + EXP + ", " );
            Website.GenerateWebsite.AppendFatalStrikeIcon( sb, FatalTypeExp );
            sb.Append( " +" + EXPModifier + "<br>" );
            sb.Append( "LP: " + LP + ", " );
            Website.GenerateWebsite.AppendFatalStrikeIcon( sb, FatalTypeLP );
            sb.Append( " +" + LPModifier + "<br>" );
            sb.Append( "Gald: " + Gald + "<br>" );

            sb.Append( "Fatal Strike Resistances:<br>" );
            Website.GenerateWebsite.AppendFatalStrikeIcon( sb, 0 );
            sb.Append( FatalBlue );
            sb.Append( " " );
            Website.GenerateWebsite.AppendFatalStrikeIcon( sb, 1 );
            sb.Append( FatalRed );
            sb.Append( " " );
            Website.GenerateWebsite.AppendFatalStrikeIcon( sb, 2 );
            sb.Append( FatalGreen );
            sb.Append( "<br>" );

            int weakCount = 0;
            int strongCount = 0;
            int immuneCount = 0;
            int absorbCount = 0;
            for ( int i = 0; i < Attributes.Length; ++i ) {
                if ( Attributes[i] > 100 ) { weakCount++; }
                if ( Attributes[i] > 0 && Attributes[i] < 100 ) { strongCount++; }
                if ( Attributes[i] == 0 ) { immuneCount++; }
                if ( Attributes[i] < 0 ) { absorbCount++; }
            }

            if ( weakCount > 0 ) {
                sb.Append( "Weak: " );
                for ( int i = 0; i < Attributes.Length; ++i ) {
                    if ( Attributes[i] > 100 ) {
                        Website.GenerateWebsite.AppendElementIcon( sb, (Element)i );
                        sb.Append( Attributes[i] - 100 );
                        sb.Append( "% " );
                    }
                }
                sb.Append( "<br>" );
            }
            if ( strongCount > 0 ) {
                sb.Append( "Strong: " );
                for ( int i = 0; i < Attributes.Length; ++i ) {
                    if ( Attributes[i] > 0 && Attributes[i] < 100 ) {
                        Website.GenerateWebsite.AppendElementIcon( sb, (Element)i );
                        sb.Append( Attributes[i] );
                        sb.Append( "% " );
                    }
                }
                sb.Append( "<br>" );
            }
            if ( immuneCount > 0 ) {
                sb.Append( "Immune: " );
                for ( int i = 0; i < Attributes.Length; ++i ) {
                    if ( Attributes[i] == 0 ) {
                        Website.GenerateWebsite.AppendElementIcon( sb, (Element)i );
                    }
                }
                sb.Append( "<br>" );
            }
            if ( absorbCount > 0 ) {
                sb.Append( "Absorb: " );
                for ( int i = 0; i < Attributes.Length; ++i ) {
                    if ( Attributes[i] < 0 ) {
                        Website.GenerateWebsite.AppendElementIcon( sb, (Element)i );
                        sb.Append( -Attributes[i] );
                        sb.Append( "% " );
                    }
                }
                sb.Append( "<br>" );
            }

            if ( KillableWithFS == 0 ) {
                sb.AppendLine( "Immune to Fatal Strike.<br>" );
            }

            sb.Append( "</td>" );

            /*
            sb.Append( "<td rowspan=\"2\">" );
            sb.AppendLine();
            for ( int i = 0; i < 62; ++i ) {
                if ( !KnownValues.Contains( i ) ) {
                    sb.Append( "~" + i + ": " + Data[i] );
                    sb.Append( " [" + Category + "/" + enemyNameEntry.StringEngOrJpn + "]" );
                    sb.AppendLine( "<br>" );
                }
            }
            for ( int i = 62; i < Data.Length; ++i ) {
                if ( !KnownValues.Contains( i ) ) {
                    sb.Append( "~" + i + ": " + DataFloat[i] );
                    sb.Append( " [" + Category + "/" + enemyNameEntry.StringEngOrJpn + "]" );
                    sb.AppendLine( "<br>" );
                }
            }
            sb.Append( "</td>" );
            //*/

            sb.Append( "</tr>" );

            sb.Append( "<tr>" );
            sb.Append( "<td colspan=\"2\">" );

            if ( InMonsterBook == 0 ) {
                sb.AppendLine( "Not in Monster Book.<br>" );
            }

            if ( Location != 0 ) {
                var loc = locations.LocationIdDict[Location];
                sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Location, version, phpLinks, id: (int)loc.LocationID ) + "\">" );
                if ( LocationWeather > -1 ) {
                    sb.AppendLine( "<img src=\"menu-icons/weather-" + LocationWeather + ".png\" width=\"16\" height=\"16\">" );
                }
                sb.AppendLine( loc.GetLastValidName( inGameIdDict ).StringEngOrJpnHtml( version ) + "</a><br>" );
            }

            for ( int i = 0; i < DropItems.Length; ++i ) {
                if ( DropItems[i] != 0 ) {
                    sb.Append( "Drops:<br>" );
                    break;
                }
            }
            for ( int i = 0; i < DropItems.Length; ++i ) {
                if ( DropItems[i] != 0 ) {
                    var item = items.itemIdDict[DropItems[i]];
                    sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
                    sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon] ) + "\">" );
                    sb.Append( inGameIdDict[item.NamePointer].StringEngOrJpnHtml( version ) + "</a>" );
                    sb.Append( ", " + DropChances[i] + "%" );
                    if ( DropChances[i] < 100 ) {
                        sb.Append( ", " );
                        Website.GenerateWebsite.AppendFatalStrikeIcon( sb, FatalTypeDrop );
                        sb.Append( " +" + DropModifier[i] + "%" );
                    }
                    sb.Append( "<br>" );
                }
            }
            if ( SecretMissionDrop != 0 && SecretMissionDropChance > 0 ) {
                sb.Append( "Secret Mission Reward:<br>" );
                var item = items.itemIdDict[SecretMissionDrop];
                sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
                sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon] ) + "\">" );
                sb.Append( inGameIdDict[item.NamePointer].StringEngOrJpnHtml( version ) + "</a>, " + SecretMissionDropChance + "%<br>" );
            }
            if ( StealItem != 0 ) {
                sb.Append( "Steal:<br>" );
                var item = items.itemIdDict[StealItem];
                sb.Append( "<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> " );
                sb.Append( "<a href=\"" + Website.GenerateWebsite.GetUrl( Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon] ) + "\">" );
                sb.Append( inGameIdDict[item.NamePointer].StringEngOrJpnHtml( version ) + "</a>, " + StealChance + "%<br>" );
            }
            sb.Append( "</td>" );

            sb.AppendLine( "</tr>" );

            return sb.ToString();
        }
Exemple #17
0
        public static string GetItemDataAsHtml(GameVersion version, ItemDat items, ItemDatSingle item, T8BTSK.T8BTSK skills, T8BTEMST.T8BTEMST enemies, COOKDAT.COOKDAT Recipes, WRLDDAT.WRLDDAT Locations, TSS.TSSFile tss, Dictionary <uint, TSS.TSSEntry> dict = null, bool phpLinks = false)
        {
            if (dict == null)
            {
                dict = tss.GenerateInGameIdDictionary();
            }
            var sb = new StringBuilder();

            sb.Append("<tr id=\"item" + item.Data[(int)ItemData.ID] + "\">");
            sb.Append("<td rowspan=\"3\">");

            sb.Append("<img src=\"items/U_" + item.ItemString.TrimNull() + ".png\" height=\"128\" width=\"128\">");
            sb.Append("</td><td colspan=\"2\">");

            uint equip = item.Data[(int)ItemData.EquippableByBitfield];

            if (equip > 0)
            {
                sb.Append("<span class=\"equip\">");
                Website.GenerateWebsite.AppendCharacterBitfieldAsImageString(sb, version, equip);
                sb.Append("</span>");
            }


            var nameEntry = dict[item.NamePointer];
            var descEntry = dict[item.DescriptionPointer];

            sb.Append("<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> ");
            sb.Append("<span class=\"itemname\">");
            sb.Append(nameEntry.StringJpnHtml(version));
            sb.Append("</span>");
            sb.Append("<br>");
            sb.Append("<span class=\"itemdesc\">");
            sb.Append(descEntry.StringJpnHtml(version));
            sb.Append("</span>");
            sb.Append("<br>");
            sb.Append("<br>");

            sb.Append("<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> ");
            sb.Append("<span class=\"itemname\">");
            sb.Append(nameEntry.StringEngHtml(version));
            sb.Append("</span>");
            sb.Append("<br>");
            sb.Append("<span class=\"itemdesc\">");
            sb.Append(descEntry.StringEngHtml(version));
            sb.Append("</span>");

            sb.Append("<span class=\"special\">");
            if (item.Data[(int)ItemData.UsableInBattle] > 0)
            {
                sb.Append("Usable in battle");
            }
            ;
            if (item.Data[(int)ItemData.InCollectorsBook] == 0)
            {
                sb.Append("Not in Collector's Book");
            }
            sb.Append("</span>");
            sb.Append("</td>");

            uint synthCount = item.Data[(int)ItemData.SynthRecipeCount];

            switch (synthCount)
            {
            case 0: break;

            case 1: sb.Append("<td colspan=\"2\">"); break;

            default: sb.Append("<td>"); break;
            }
            for (int j = 0; j < synthCount; ++j)
            {
                uint synthItemCount = item.Data[(int)ItemData.Synth1ItemSlotCount + j * 16];
                sb.Append("Synthesis Level: " + item.Data[(int)ItemData._Synth1Level + j * 16]);
                sb.Append("<br>");
                sb.Append("Price: " + item.Data[(int)ItemData.Synth1Price + j * 16] + " Gald");
                for (int i = 0; i < synthItemCount; ++i)
                {
                    sb.Append("<br>");
                    var    otherItem          = items.itemIdDict[item.Data[(int)ItemData.Synth1Item1Type + i * 2 + j * 16]];
                    var    otherItemNameEntry = dict[otherItem.NamePointer];
                    string otherItemName      = otherItemNameEntry.StringEngOrJpnHtml(version);
                    sb.Append("<img src=\"item-icons/ICON" + otherItem.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> ");
                    sb.Append("<a href=\"" + Website.GenerateWebsite.GetUrl(Website.WebsiteSection.Item, version, phpLinks, id: (int)otherItem.Data[(int)ItemData.ID], icon: (int)otherItem.Data[(int)ItemData.Icon]) + "\">");
                    sb.Append(otherItemName + "</a> x" + item.Data[(int)ItemData.Synth1Item1Count + i * 2 + j * 16]);
                }
                if (synthCount > 1 && j == 0)
                {
                    sb.Append("</td><td>");
                }
            }

            sb.Append("</td></tr><tr>");

            uint category = item.Data[(int)ItemData.Category];

            switch (category)
            {
            case 2:
            default:
                sb.Append("<td colspan=\"2\">");
                if (item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0)
                {
                    sb.Append("HP Heal %: " + item.Data[(int)ItemData.MDEF_or_HPHealPercent] + "<br>");
                }
                if (item.Data[(int)ItemData.AGL_TPHealPercent] > 0)
                {
                    sb.Append("TP Heal %: " + item.Data[(int)ItemData.AGL_TPHealPercent] + "<br>");
                }

                // why is this here twice?
                uint physAilAlt = item.Data[(int)ItemData.PDEF];
                uint physAil    = item.Data[(int)ItemData._LUCK];
                if (physAil != physAilAlt)
                {
                    throw new Exception();
                }

                if (physAil > 0)
                {
                    sb.Append("Cures physical ailments: ");
                    if ((physAil & 1) == 1)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-13.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 2) == 2)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-01.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 4) == 4)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-02.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 8) == 8)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-03.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 16) == 16)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-04.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 32) == 32)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-05.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 64) == 64)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-06.png\" height=\"32\" width=\"32\">");
                    }
                    if ((physAil & 128) == 128)
                    {
                        sb.Append("<img src=\"text-icons/icon-status-07.png\" height=\"32\" width=\"32\">");
                    }
                    sb.Append("<br>");
                }

                if (item.Data[(int)ItemData._AGL_Again] > 0)
                {
                    sb.Append("Cures magical ailments<br>");
                }

                if (item.Data[(int)ItemData.PermanentPAtkIncrease] > 0)
                {
                    sb.Append("Permanent PATK increase: " + item.Data[(int)ItemData.PermanentPAtkIncrease] + "<br>");
                }
                if (item.Data[(int)ItemData.PermanentPDefIncrease] > 0)
                {
                    sb.Append("Permanent PDEF increase: " + item.Data[(int)ItemData.PermanentPDefIncrease] + "<br>");
                }
                if (item.Data[(int)ItemData.AttrFire] > 0)
                {
                    sb.Append("Permanent MATK increase: " + item.Data[(int)ItemData.AttrFire] + "<br>");
                }
                if (item.Data[(int)ItemData.AttrWater] > 0)
                {
                    sb.Append("Permanent MDEF increase: " + item.Data[(int)ItemData.AttrWater] + "<br>");
                }
                if (item.Data[(int)ItemData.AttrWind] > 0)
                {
                    sb.Append("Permanent AGL increase: " + item.Data[(int)ItemData.AttrWind] + "<br>");
                }
                if (item.Data[(int)ItemData.Skill1] > 0)
                {
                    sb.Append("Max HP increase: " + item.Data[(int)ItemData.Skill1] + "<br>");
                }
                if (item.Data[(int)ItemData.Skill1Metadata] > 0)
                {
                    sb.Append("Max TP increase: " + item.Data[(int)ItemData.Skill1Metadata] + "<br>");
                }

                for (int i = 0; i < 8; ++i)
                {
                    int recipeId = (int)item.Data[(int)ItemData.UsedInRecipe1 + i];
                    if (recipeId != 0)
                    {
                        var recipe          = Recipes.RecipeList[recipeId];
                        var recipeNameEntry = dict[recipe.NameStringDicID];
                        sb.Append("<a href=\"" + Website.GenerateWebsite.GetUrl(Website.WebsiteSection.Recipe, version, phpLinks, id: (int)recipe.ID) + "\">" + recipeNameEntry.StringEngOrJpnHtml(version) + "</a><br>");
                    }
                }

                sb.Append("</td>");
                break;

            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                sb.Append("<td>");
                if ((int)item.Data[(int)ItemData.PATK] > 0)
                {
                    sb.Append("PATK: " + (int)item.Data[(int)ItemData.PATK] + "<br>");
                }
                if ((int)item.Data[(int)ItemData.MATK] > 0)
                {
                    sb.Append("MATK: " + (int)item.Data[(int)ItemData.MATK] + "<br>");
                }
                if ((int)item.Data[(int)ItemData.PDEF] > 0)
                {
                    sb.Append("PDEF: " + (int)item.Data[(int)ItemData.PDEF] + "<br>");
                }
                if ((int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] > 0)
                {
                    sb.Append("MDEF: " + (int)item.Data[(int)ItemData.MDEF_or_HPHealPercent] + "<br>");
                }

                int agl1 = (int)item.Data[(int)ItemData.AGL_TPHealPercent];
                int agl2 = (int)item.Data[(int)ItemData._AGL_Again];

                if (agl2 > 0)
                {
                    sb.Append("AGL: " + agl2 + "<br>");
                }

                if ((int)item.Data[(int)ItemData._LUCK] > 0)
                {
                    sb.Append("LUCK: " + (int)item.Data[(int)ItemData._LUCK] + "<br>");
                }


                int attackElementCount  = 0;
                int defenseElementCount = 0;
                for (int i = 0; i < 6; ++i)
                {
                    if ((int)item.Data[(int)ItemData.AttrFire + i] > 0)
                    {
                        attackElementCount++;
                    }
                    if ((int)item.Data[(int)ItemData.AttrFire + i] < 0)
                    {
                        defenseElementCount++;
                    }
                }

                if (attackElementCount > 0 || defenseElementCount > 0)
                {
                    int fire = (int)item.Data[(int)ItemData.AttrFire];
                    int watr = (int)item.Data[(int)ItemData.AttrWater];
                    int wind = (int)item.Data[(int)ItemData.AttrWind];
                    int eart = (int)item.Data[(int)ItemData.AttrEarth];
                    int lght = (int)item.Data[(int)ItemData.AttrLight];
                    int dark = (int)item.Data[(int)ItemData.AttrDark];
                    if (defenseElementCount > 0)
                    {
                        sb.Append("<table class=\"element\"><tr>");
                        sb.Append("<td colspan=\"" + defenseElementCount + "\">Resistance</td>");
                        sb.Append("</tr><tr>");
                        if (fire < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-02.png\"></td>");
                        }
                        if (eart < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-04.png\"></td>");
                        }
                        if (wind < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-01.png\"></td>");
                        }
                        if (watr < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-05.png\"></td>");
                        }
                        if (lght < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-03.png\"></td>");
                        }
                        if (dark < 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-06.png\"></td>");
                        }
                        sb.Append("</tr><tr>");
                        if (fire < 0)
                        {
                            sb.Append("<td>" + -fire + "%</td>");
                        }
                        if (eart < 0)
                        {
                            sb.Append("<td>" + -eart + "%</td>");
                        }
                        if (wind < 0)
                        {
                            sb.Append("<td>" + -wind + "%</td>");
                        }
                        if (watr < 0)
                        {
                            sb.Append("<td>" + -watr + "%</td>");
                        }
                        if (lght < 0)
                        {
                            sb.Append("<td>" + -lght + "%</td>");
                        }
                        if (dark < 0)
                        {
                            sb.Append("<td>" + -dark + "%</td>");
                        }
                        sb.Append("</tr></table>");
                    }
                    if (attackElementCount > 0)
                    {
                        sb.Append("<table class=\"element\"><tr>");
                        if (category == 3 || category == 4)
                        {
                            // weapons and sub-weapons add elemental attributes to your attack
                            sb.Append("<td colspan=\"" + attackElementCount + "\">Attack Element</td>");
                        }
                        else
                        {
                            // defensive equipment instead uses this field as a weak/resist, with weak as positive and resist as negative values
                            sb.Append("<td colspan=\"" + attackElementCount + "\">Weakness</td>");
                        }
                        sb.Append("</tr><tr>");
                        if (fire > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-02.png\"></td>");
                        }
                        if (eart > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-04.png\"></td>");
                        }
                        if (wind > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-01.png\"></td>");
                        }
                        if (watr > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-05.png\"></td>");
                        }
                        if (lght > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-03.png\"></td>");
                        }
                        if (dark > 0)
                        {
                            sb.Append("<td><img src=\"text-icons/icon-element-06.png\"></td>");
                        }
                        if (!(category == 3 || category == 4))
                        {
                            // weapons always have a "1" here, don't print that, it's not useful
                            sb.Append("</tr><tr>");
                            if (fire > 0)
                            {
                                sb.Append("<td>" + fire + "%</td>");
                            }
                            if (eart > 0)
                            {
                                sb.Append("<td>" + eart + "%</td>");
                            }
                            if (wind > 0)
                            {
                                sb.Append("<td>" + wind + "%</td>");
                            }
                            if (watr > 0)
                            {
                                sb.Append("<td>" + watr + "%</td>");
                            }
                            if (lght > 0)
                            {
                                sb.Append("<td>" + lght + "%</td>");
                            }
                            if (dark > 0)
                            {
                                sb.Append("<td>" + dark + "%</td>");
                            }
                        }
                        sb.Append("</tr></table>");
                    }
                }

                sb.Append("</td><td>");

                for (int i = 0; i < 3; ++i)
                {
                    uint skillId = item.Data[(int)ItemData.Skill1 + i * 2];
                    if (skillId != 0)
                    {
                        var    skill          = skills.SkillIdDict[skillId];
                        var    skillNameEntry = dict[skill.NameStringDicID];
                        string skillName      = skillNameEntry.StringEngOrJpnHtml(version);
                        string skillCat       = "<img src=\"skill-icons/category-" + skill.Category.ToString() + ".png\" height=\"16\" width=\"16\">";
                        sb.Append(skillCat);
                        sb.Append("<a href=\"" + Website.GenerateWebsite.GetUrl(Website.WebsiteSection.Skill, version, phpLinks, id: (int)skill.InGameID) + "\">");
                        sb.Append(skillName);
                        sb.Append("</a>, " + item.Data[(int)ItemData.Skill1Metadata + i * 2] + "<br>");
                    }
                }
                sb.Append("</td>");
                break;
            }



            sb.Append("<td colspan=\"2\">");


            sb.Append(item.Data[(int)ItemData.ShopPrice] + " Gald");

            if (item.Data[(int)ItemData.BuyableIn1] > 0 || item.Data[(int)ItemData.BuyableIn2] > 0 || item.Data[(int)ItemData.BuyableIn3] > 0)
            {
                //sb.Append( "<br>Available at shops in:" );
                for (int i = 0; i < 3; ++i)
                {
                    if (item.Data[(int)ItemData.BuyableIn1 + i] > 0)
                    {
                        var loc = Locations.LocationIdDict[item.Data[(int)ItemData.BuyableIn1 + i]];
                        sb.Append("<br><a href=\"" + Website.GenerateWebsite.GetUrl(Website.WebsiteSection.Location, version, phpLinks, id: (int)loc.LocationID) + "\">");
                        sb.Append(loc.GetLastValidName(dict).StringEngOrJpnHtml(version) + "</a>");
                    }
                }
                sb.AppendLine();
            }

            sb.Append("</td></tr><tr>");



            // read how many drops and steals this item lists
            int[] dropStealCount = new int[2];
            for (int j = 0; j < 2; ++j)
            {
                dropStealCount[j] = 0;
                for (int i = 0; i < 16; ++i)
                {
                    uint enemyId = item.Data[(int)ItemData.Drop1Enemy + i + j * 32];
                    if (enemyId != 0)
                    {
                        dropStealCount[j]++;
                    }
                }
            }

            for (int j = 0; j < 2; ++j)
            {
                sb.Append("<td colspan=\"2\">");
                if (dropStealCount[j] > 0)
                {
                    int colCount = Math.Min(4, dropStealCount[j]);
                    int rowCount = (dropStealCount[j] - 1) / 4 + 1;

                    sb.Append("<table class=\"element\">");
                    sb.Append("<tr><td colspan=\"" + colCount + "\">");
                    sb.Append(j == 0 ? "Drop" : "Steal");
                    sb.Append("</td></tr>");

                    int cellCount = 0;
                    for (int i = 0; i < 16; ++i)
                    {
                        uint enemyId = item.Data[(int)ItemData.Drop1Enemy + i + j * 32];

                        if (enemyId != 0)
                        {
                            if (cellCount % 4 == 0)
                            {
                                sb.Append("<tr>");
                            }
                            sb.Append("<td>");
                            var    enemy          = enemies.EnemyIdDict[enemyId];
                            var    enemyNameEntry = dict[enemy.NameStringDicID];
                            string enemyName      = enemyNameEntry.StringEngOrJpnHtml(version);
                            sb.Append("<img src=\"monster-icons/44px/monster-" + enemy.IconID.ToString("D3") + ".png\"><br>");
                            sb.Append("<a href=\"" + Website.GenerateWebsite.GetUrl(Website.WebsiteSection.Enemy, version, phpLinks, category: (int)enemy.Category, id: (int)enemy.InGameID) + "\">");
                            sb.Append(enemyName + "</a><br>" + item.Data[(int)ItemData.Drop1Chance + i + j * 32] + "%");
                            sb.Append("</td>");
                            if (cellCount % 4 == 3)
                            {
                                sb.Append("</tr>");
                            }
                            cellCount++;
                        }
                    }
                    if (cellCount % 4 != 0)
                    {
                        if (cellCount > 4)
                        {
                            for (int i = cellCount % 4; i < 4; ++i)
                            {
                                sb.Append("<td></td>");
                            }
                        }
                        sb.Append("</tr>");
                    }
                    sb.Append("</table>");
                }
                sb.Append("</td>");
            }

            sb.Append("</tr>");
            return(sb.ToString());
        }