コード例 #1
0
        private void setupData(DataRow r)
        {
            int objectType = int.Parse(r["type"].ToString());
            String oType = "";
            switch (objectType)
            {
                case 0:
                    oType = "Mobs";
                    break;
                case 3:
                    oType = "Planets";
                    break;
                case 11:
                    oType = "Stargates";
                    break;
                case 12:
                    oType = "Starbases";
                    break;
                case 37:
                    oType = "Decorations";
                    break;
                case 38:
                    oType = "Harvestables";
                    break;
            }

            dp = new MobProps();
            dp.SectorID = int.Parse(r["sector_id"].ToString());
            dp.NavType = r["nav_type"].ToString();
            dp.Signature = float.Parse(r["signature"].ToString());
            dp.IsHuge = (Boolean) r["is_huge"];
            dp.BaseXP = int.Parse(r["base_xp"].ToString());
            dp.ExplorationRange = float.Parse(r["exploration_range"].ToString());

            dp.BaseAssetID = int.Parse(r["base_asset_id"].ToString());

            AdobeColors.HSL hslColor = new AdobeColors.HSL();
            hslColor.H = float.Parse(r["h"].ToString());
            hslColor.S = float.Parse(r["s"].ToString());
            hslColor.L = float.Parse(r["v"].ToString());
            Color newColor = AdobeColors.HSL_to_RGB(hslColor);
            dp.Color = newColor;

            dp.Type = oType;
            dp.Scale = float.Parse(r["scale"].ToString()); ;
            dp.PositionX = float.Parse(r["position_x"].ToString());
            dp.PositionY = float.Parse(r["position_y"].ToString());
            dp.PositionZ = float.Parse(r["position_z"].ToString()); ;

            double[] quat1 = new double[4];
            quat1[0] = double.Parse(r["orientation_z"].ToString());
            quat1[1] = double.Parse(r["orientation_u"].ToString());
            quat1[2] = double.Parse(r["orientation_v"].ToString());
            quat1[3] = double.Parse(r["orientation_w"].ToString());

            QuaternionCalc qc1 = new QuaternionCalc();
            double[] ang1 = qc1.QuatToAngle(quat1);
            if (ang1[0] == double.NaN)
            {
                ang1[0] = 0;
            }
            if (ang1[1] == double.NaN)
            {
                ang1[1] = 0;
            }
            if (ang1[2] == double.NaN)
            {
                ang1[2] = 0;
            }
            dp.Orientation_Yaw = Math.Round(ang1[0], 0);
            dp.Orientation_Pitch = Math.Round(ang1[1], 0);
            dp.Orientation_Roll = Math.Round(ang1[2], 0);

            dp.Name = r["name"].ToString();
            dp.AppearsInRadar = (Boolean) r["appears_in_radar"];
            dp.RadarRange = float.Parse(r["radar_range"].ToString());
            dp.Destination = int.Parse(r["gate_to"].ToString());
            dp.SoundEffect = int.Parse(r["sound_effect_id"].ToString());
            dp.SoundEffectRange = float.Parse(r["sound_effect_range"].ToString());

            dp.SpawnGroup = "<Collection...>";
            dp.Count = int.Parse(r["mob_count"].ToString());
            dp.SpawnRadius = float.Parse(r["mob_spawn_radius"].ToString());
            dp.RespawnTime = float.Parse(r["respawn_time"].ToString());
            dp.DelayedSpawn = (Boolean) r["delayed_spawn"];
        }
コード例 #2
0
        private void setupData(DataRow r)
        {
            int objectType = int.Parse(r["type"].ToString());
            String oType = "";
            switch (objectType)
            {
                case 0:
                    oType = "Mobs";
                    break;
                case 3:
                    oType = "Planets";
                    break;
                case 11:
                    oType = "Stargates";
                    break;
                case 12:
                    oType = "Starbases";
                    break;
                case 37:
                    oType = "Decorations";
                    break;
                case 38:
                    oType = "Harvestables";
                    break;
            }

            dp = new StargateProps();

            //Base Props + Nav Point Props
            dp.SectorID = int.Parse(r["sector_id"].ToString());
            dp.NavType = r["nav_type"].ToString();
            dp.Signature = float.Parse(r["signature"].ToString());
            dp.IsHuge = (Boolean) r["is_huge"];
            dp.BaseXP = int.Parse(r["base_xp"].ToString());
            dp.ExplorationRange = float.Parse(r["exploration_range"].ToString());

            dp.BaseAssetID = int.Parse(r["base_asset_id"].ToString());

            AdobeColors.HSL hslColor = new AdobeColors.HSL();
            hslColor.H = float.Parse(r["h"].ToString());
            hslColor.S = float.Parse(r["s"].ToString());
            hslColor.L = float.Parse(r["v"].ToString());
            Color newColor = AdobeColors.HSL_to_RGB(hslColor);
            dp.Color = newColor;

            dp.Type = oType;
            dp.Scale = float.Parse(r["scale"].ToString()); ;
            dp.PositionX = float.Parse(r["position_x"].ToString());
            dp.PositionY = float.Parse(r["position_y"].ToString());
            dp.PositionZ = float.Parse(r["position_z"].ToString()); ;

            double[] quat1 = new double[4];
            quat1[0] = double.Parse(r["orientation_z"].ToString());
            quat1[1] = double.Parse(r["orientation_u"].ToString());
            quat1[2] = double.Parse(r["orientation_v"].ToString());
            quat1[3] = double.Parse(r["orientation_w"].ToString());

            QuaternionCalc qc1 = new QuaternionCalc();
            double[] ang1 = qc1.QuatToAngle(quat1);
            if (ang1[0] == double.NaN)
            {
                ang1[0] = 0;
            }
            if (ang1[1] == double.NaN)
            {
                ang1[1] = 0;
            }
            if (ang1[2] == double.NaN)
            {
                ang1[2] = 0;
            }
            dp.Orientation_Yaw = Math.Round(ang1[0], 0);
            dp.Orientation_Pitch = Math.Round(ang1[1], 0);
            dp.Orientation_Roll = Math.Round(ang1[2], 0);

            dp.Name = r["name"].ToString();
            dp.AppearsInRadar = (Boolean) r["appears_in_radar"];
            dp.RadarRange = float.Parse(r["radar_range"].ToString());
            dp.Destination = int.Parse(r["gate_to"].ToString());
            dp.SoundEffect = int.Parse(r["sound_effect_id"].ToString());
            dp.SoundEffectRange = float.Parse(r["sound_effect_range"].ToString());

            //Stargate Specific Props
            dp.IsClassSpecific = (Boolean)r["classSpecific"];

            //TODO: Get Faction Name from ID;
            String factionName = mainFrm.factions.findNameByID(int.Parse(r["faction_id"].ToString()));
            dp.FactionID = factionName;
        }
コード例 #3
0
        private void setupData(DataRow r)
        {
            int objectType = int.Parse(r["type"].ToString());
            String oType = "";
            switch (objectType)
            {
                case 0:
                    oType = "Mobs";
                    break;
                case 3:
                    oType = "Planets";
                    break;
                case 11:
                    oType = "Stargates";
                    break;
                case 12:
                    oType = "Starbases";
                    break;
                case 37:
                    oType = "Decorations";
                    break;
                case 38:
                    oType = "Harvestables";
                    break;
            }

            dp = new HarvestableProps();

            //Base Props
            dp.SectorID = int.Parse(r["sector_id"].ToString());
            dp.NavType = r["nav_type"].ToString();
            dp.Signature = float.Parse(r["signature"].ToString());
            dp.IsHuge = (Boolean) r["is_huge"];
            dp.BaseXP = int.Parse(r["base_xp"].ToString());
            dp.ExplorationRange = float.Parse(r["exploration_range"].ToString());

            dp.BaseAssetID = int.Parse(r["base_asset_id"].ToString());

            AdobeColors.HSL hslColor = new AdobeColors.HSL();
            hslColor.H = float.Parse(r["h"].ToString());
            hslColor.S = float.Parse(r["s"].ToString());
            hslColor.L = float.Parse(r["v"].ToString());
            Color newColor = AdobeColors.HSL_to_RGB(hslColor);
            dp.Color = newColor;

            dp.Type = oType;
            dp.Scale = float.Parse(r["scale"].ToString()); ;
            dp.PositionX = float.Parse(r["position_x"].ToString());
            dp.PositionY = float.Parse(r["position_y"].ToString());
            dp.PositionZ = float.Parse(r["position_z"].ToString()); ;

            double[] quat1 = new double[4];
            quat1[0] = double.Parse(r["orientation_z"].ToString());
            quat1[1] = double.Parse(r["orientation_u"].ToString());
            quat1[2] = double.Parse(r["orientation_v"].ToString());
            quat1[3] = double.Parse(r["orientation_w"].ToString());

            QuaternionCalc qc1 = new QuaternionCalc();
            double[] ang1 = qc1.QuatToAngle(quat1);
            if (ang1[0] == double.NaN)
            {
                ang1[0] = 0;
            }
            if (ang1[1] == double.NaN)
            {
                ang1[1] = 0;
            }
            if (ang1[2] == double.NaN)
            {
                ang1[2] = 0;
            }
            dp.Orientation_Yaw = Math.Round(ang1[0], 0);
            dp.Orientation_Pitch = Math.Round(ang1[1], 0);
            dp.Orientation_Roll = Math.Round(ang1[2], 0);

            dp.Name = r["name"].ToString();
            dp.AppearsInRadar = (Boolean) r["appears_in_radar"];
            dp.RadarRange = float.Parse(r["radar_range"].ToString());
            dp.Destination = int.Parse(r["gate_to"].ToString());
            dp.SoundEffect = int.Parse(r["sound_effect_id"].ToString());
            dp.SoundEffectRange = float.Parse(r["sound_effect_range"].ToString());

            //Harvestable Props
            try
            {
                dp.Level = r["level"].ToString();
                dp.ResType = "<Collection...>";
                dp.ResCount = int.Parse(r["res_count"].ToString());
                dp.MobSpawnRadius = float.Parse(r["spawn_radius"].ToString());
                dp.PopRockChance = int.Parse(r["pop_rock_chance"].ToString());
                dp.SpawnGroup = "<Collection...>";
                dp.MaxFieldRadius = float.Parse(r["max_field_radius"].ToString());

                String fieldName = "";
                switch(int.Parse(r["field"].ToString()))
                {
                    case 0:
                        fieldName = "Random";
                        break;
                    case 1:
                        fieldName = "Ring";
                        break;
                    case 2:
                        fieldName = "Donut";
                        break;
                    case 3:
                        fieldName = "Cylinder";
                        break;
                    case 4:
                        fieldName = "Sphere";
                        break;
                    case 5:
                        fieldName = "Gas Cloud Clump";
                        break;
                }

                dp.Field = fieldName;
            }
            catch (Exception)
            {
                dp.Level = "1";
                dp.Field = "Single";
                dp.ResCount = 0;
                dp.MaxFieldRadius = 0;
                dp.MobSpawnRadius = 0;
                dp.PopRockChance = 0;
                dp.SpawnGroup = "<Collection...>";
            }
        }
コード例 #4
0
        private void populateFields(int objectID)
        {
            equippedAmmoGroup = new ListViewGroup("Ammo", HorizontalAlignment.Left);
            equippedDevicesGroup = new ListViewGroup("Devices", HorizontalAlignment.Left);
            equippedEnginesGroup = new ListViewGroup("Engines", HorizontalAlignment.Left);
            equippedReactorsGroup = new ListViewGroup("Reactors", HorizontalAlignment.Left);
            equippedShieldsGroup = new ListViewGroup("Shields", HorizontalAlignment.Left);
            equippedMissileGroup = new ListViewGroup("Missile Weapon", HorizontalAlignment.Left);
            equippedProjectileGroup = new ListViewGroup("Projectile Weapon", HorizontalAlignment.Left);
            equippedBeamGroup = new ListViewGroup("Beam Weapon", HorizontalAlignment.Left);

            listView1.Groups.AddRange(new ListViewGroup[] { equippedAmmoGroup, equippedDevicesGroup, equippedEnginesGroup,
                                        equippedReactorsGroup, equippedShieldsGroup, equippedMissileGroup,
                                        equippedProjectileGroup, equippedBeamGroup});

            inventoryAmmoGroup = new ListViewGroup("Ammo", HorizontalAlignment.Left);
            inventoryDevicesGroup = new ListViewGroup("Devices", HorizontalAlignment.Left);
            inventoryEnginesGroup = new ListViewGroup("Engines", HorizontalAlignment.Left);
            inventoryReactorsGroup = new ListViewGroup("Reactors", HorizontalAlignment.Left);
            inventoryShieldsGroup = new ListViewGroup("Shields", HorizontalAlignment.Left);
            inventoryMissileGroup = new ListViewGroup("Missile Weapon", HorizontalAlignment.Left);
            inventoryProjectileGroup = new ListViewGroup("Projectile Weapon", HorizontalAlignment.Left);
            inventoryBeamGroup = new ListViewGroup("Beam Weapon", HorizontalAlignment.Left);
            inventoryComponentsGroup = new ListViewGroup("Components", HorizontalAlignment.Left);
            inventoryOreGroup = new ListViewGroup("Ore & Resources", HorizontalAlignment.Left);
            inventoryMiscGroup = new ListViewGroup("Misc. Loot", HorizontalAlignment.Left);

            listView2.Groups.AddRange(new ListViewGroup[] { inventoryAmmoGroup, inventoryDevicesGroup,
                    inventoryEnginesGroup, inventoryReactorsGroup, inventoryShieldsGroup,
                    inventoryMissileGroup, inventoryProjectileGroup, inventoryBeamGroup,
                    inventoryComponentsGroup, inventoryOreGroup, inventoryMiscGroup });

            selectedRow = mobs.getRowByID(objectID);

            //General Details.
            String name = selectedRow["name"].ToString();
            int level = int.Parse(selectedRow["level"].ToString());
            int type = int.Parse(selectedRow["type"].ToString());
            int intelligence = int.Parse(selectedRow["intelligence"].ToString());
            int bravery = int.Parse(selectedRow["bravery"].ToString());
            int factionID = int.Parse(selectedRow["faction_id"].ToString());
            int baseAssetID = int.Parse(selectedRow["base_asset_id"].ToString());
            int altruism = int.Parse(selectedRow["altruism"].ToString());
            int aggressiveness = int.Parse(selectedRow["aggressiveness"].ToString());
            float h = float.Parse(selectedRow["h"].ToString());
            float s = float.Parse(selectedRow["s"].ToString());
            float v = float.Parse(selectedRow["v"].ToString());
            float scale = float.Parse(selectedRow["scale"].ToString());
            String ai = selectedRow["ai"].ToString();

            nameText.Text = name;
            levelCombo.SelectedItem = level;
            baseAssetText.Text = baseAssetID.ToString();
            scaleText.Text = scale.ToString();
            aiText.Text = ai;

            AdobeColors.HSL hsl = new AdobeColors.HSL();
            hsl.H = h;
            hsl.S = s;
            hsl.L = v;
            cPicker1.Color = AdobeColors.HSL_to_RGB(hsl);

            switch (type)
            {
                case 0:
                    typeCombo.SelectedItem = "Cybernetic";
                    break;
                case 1:
                    typeCombo.SelectedItem = "Structural";
                    break;
                case 2:
                    typeCombo.SelectedItem = "Organic_Red";
                    break;
                case 3:
                    typeCombo.SelectedItem = "Organic_Green";
                    break;
                case 4:
                    typeCombo.SelectedItem = "Crystalline";
                    break;
                case 5:
                    typeCombo.SelectedItem = "Energy";
                    break;
                case 6:
                    typeCombo.SelectedItem = "Rock Based";
                    break;
            }

            String factionName = factions.findNameByID(factionID);
            if (factionName != "None")
            {
                factionCombo.SelectedItem = factionName;
            }
            else
            {
                factionCombo.SelectedItem = "Please Make A Selection";
            }

            //Equipped Items & Inventory
            DataRow[] mobItems = mobItemsSql.getRowsByID(objectID);

            listView1.Items.Clear();
            listView2.Items.Clear();

            for (int i = 0; i < mobItems.Length; i++)
            {
                int itemBaseID = int.Parse(mobItems[i]["item_base_id"].ToString());
                int itemType = int.Parse(mobItems[i]["type"].ToString());
                int itemUsage = int.Parse(mobItems[i]["usage_chance"].ToString());
                int itemDrop = int.Parse(mobItems[i]["drop_chance"].ToString());

                DataRow inDR = itemBase.getRowByID(itemBaseID);
                String itemName = inDR["name"].ToString();
                int itemCat = int.Parse(inDR["sub_category"].ToString());
                int asset_2d = int.Parse(inDR["2d_asset"].ToString());

                String imageFileName = baseAssets.getFileNameByID(asset_2d);

                if (itemType == 0)
                {
                    ListViewItem lvi1 = new ListViewItem(itemName, imageFileName);
                    lvi1.Tag = mobItems[i];
                    lvi1.ToolTipText = itemName;

                    switch (itemCat)
                    {
                        case 100:
                            lvi1.Group = equippedBeamGroup;
                            break;
                        case 101:
                            lvi1.Group = equippedProjectileGroup;
                            break;
                        case 102:
                            lvi1.Group = equippedMissileGroup;
                            break;
                        case 103:
                            lvi1.Group = equippedAmmoGroup;
                            break;
                        case 110:
                            lvi1.Group = equippedDevicesGroup;
                            break;
                        case 120:
                            lvi1.Group = equippedReactorsGroup;
                            break;
                        case 121:
                            lvi1.Group = equippedEnginesGroup;
                            break;
                        case 122:
                            lvi1.Group = equippedShieldsGroup;
                            break;
                    }

                    listView1.Items.Add(lvi1);
                }
                else
                {
                    ListViewItem lvi2 = new ListViewItem(itemName, imageFileName);
                    lvi2.ToolTipText = itemName;
                    lvi2.Tag = mobItems[i];

                    switch (itemCat)
                    {
                        case -1:
                            lvi2.Group = inventoryMiscGroup;
                            break;
                        case 100:
                            lvi2.Group = inventoryBeamGroup;
                            break;
                        case 101:
                            lvi2.Group = inventoryProjectileGroup;
                            break;
                        case 102:
                            lvi2.Group = inventoryMissileGroup;
                            break;
                        case 103:
                            lvi2.Group = inventoryAmmoGroup;
                            break;
                        case 110:
                            lvi2.Group = inventoryDevicesGroup;
                            break;
                        case 120:
                            lvi2.Group = inventoryReactorsGroup;
                            break;
                        case 121:
                            lvi2.Group = inventoryEnginesGroup;
                            break;
                        case 122:
                            lvi2.Group = inventoryShieldsGroup;
                            break;
                        case 500:
                            lvi2.Group = inventoryComponentsGroup;
                            break;
                        case 800:
                            lvi2.Group = inventoryOreGroup;
                            break;
                    }

                    listView2.Items.Add(lvi2);
                }
            }

            //Skills

            setupMainImage(baseAssetID);
        }