Beispiel #1
0
        public bool AddRoom(TreeNode root, int id, int pos)
        {
            int lba = RamDisk.GetS32(pos + 8 * id);

            try {
                string url = GetUrl() + "/Room/" + id;
                DirRec mpd = Iso9660.GetByLba(lba);
                Room   obj = new Room(mpd.GetUrl(), 0, mpd, this, zoneid, id);
                rooms.Add(obj);
                Model.Add(url, obj);
                Publisher.Register(obj);

                TreeNode node = root.Nodes.Add(url, mpd.GetFileName(), 1, 1);
                obj.AddRoom(node, url, id, pos);
                return(true);
            } catch {
                return(false);
            }
        }
Beispiel #2
0
        public bool AddActor(TreeNode root, int id, int pos, int lba)
        {
            try {
                // ************************************************************
                // Add the actor
                string url      = GetUrl() + "/Actors/Actor_" + id;
                string znd_file = GetRec().GetFileName();
                DirRec zud      = Iso9660.GetByLba(lba);
                Actor  obj      = new Actor(url, pos, GetRec(), this, zoneid, id, zud);
                actors.Add(obj);
                Model.Add(url, obj);
                Publisher.Register(obj);
                TreeNode node = root.Nodes.Add(url, obj.Name, 2, 2);

                // ************************************************************
                // Add the ZUD file
                TreeNode tv_model = node.Nodes.Add(url + "/Model", zud.GetFileName(), 28, 28);
                tv_model.Nodes.Add(url + "/Model/SHP", "SHP", 28, 28);
                tv_model.Nodes.Add(url + "/Model/WEP", "WEP", 28, 28);
                tv_model.Nodes.Add(url + "/Model/SEQ", "SEQ Common", 29, 29);
                tv_model.Nodes.Add(url + "/Model/SEQ", "SEQ Battle", 29, 29);

                // ************************************************************
                // Add bodyparts
                for (int j = 0; j < 6; j++)
                {
                    string[] part_name = new string[] {
                        "L.ARM", "R.ARM", "HEAD", "BODY", "LEGS", "OTHER",
                    };

                    int           ptr_part = pos + 0x238 + j * 0x5C;
                    string        k1       = url + "/BodyParts/" + part_name[j];
                    ActorBodyPart part     = new ActorBodyPart(k1, ptr_part, GetRec());
                    bodyparts.Add(part);
                    Model.Add(k1, part);
                    Publisher.Register(part);
                }
                TreeNode tv_body = node.Nodes.Add(url + "/BodyParts", "BodyParts", 5, 5);
                tv_body.Nodes.Add(url + "/BodyParts/L.ARM", "L.ARM", 8, 8);
                tv_body.Nodes.Add(url + "/BodyParts/R.ARM", "R.ARM", 8, 8);
                tv_body.Nodes.Add(url + "/BodyParts/HEAD", "HEAD", 6, 6);
                tv_body.Nodes.Add(url + "/BodyParts/BODY", "BODY", 7, 7);
                tv_body.Nodes.Add(url + "/BodyParts/LEGS", "LEGS", 9, 9);
                tv_body.Nodes.Add(url + "/BodyParts/OTHER", "OTHER", 5, 5);

                // ************************************************************
                // Add armours
                for (int j = 0; j < 6; j++)
                {
                    string[] part_name = new string[] {
                        "L.ARM", "R.ARM", "HEAD", "BODY", "LEGS", "OTHER",
                    };

                    int         ptr_part = pos + 0x238 + j * 0x5C + 0x20;
                    string      k2       = url + "/Equip/" + part_name[j];
                    ActorArmour armour   = new ActorArmour(k2, ptr_part, GetRec());
                    armours.Add(armour);
                    Model.Add(k2, armour);
                    Publisher.Register(armour);
                }
                TreeNode tv_equip = node.Nodes.Add(url + "/Equip", "Equipment", 39, 39);
                tv_equip.Nodes.Add(url + "/Equip/L.ARM", "L.ARM", 8, 8);
                tv_equip.Nodes.Add(url + "/Equip/R.ARM", "R.ARM", 8, 8);
                tv_equip.Nodes.Add(url + "/Equip/HEAD", "HEAD", 6, 6);
                tv_equip.Nodes.Add(url + "/Equip/BODY", "BODY", 7, 7);
                tv_equip.Nodes.Add(url + "/Equip/LEGS", "LEGS", 9, 9);
                tv_equip.Nodes.Add(url + "/Equip/OTHER", "OTHER", 5, 5);

                // ************************************************************
                // Add weapon
                ActorWeapon weapon = new ActorWeapon(url + "/Weapon", pos + 0x34, GetRec());
                weapons.Add(weapon);
                Model.Add(url + "/Weapon", weapon);
                Publisher.Register(weapon);

                ActorBlade blade = new ActorBlade(url + "/Weapon/Blade", pos + 0x34, GetRec());
                blades.Add(blade);
                Model.Add(url + "/Weapon/Blade", blade);
                Publisher.Register(blade);

                ActorGrip grip = new ActorGrip(url + "/Weapon/Grip", pos + 0x64, GetRec());
                grips.Add(grip);
                Model.Add(url + "/Weapon/Grip", grip);
                Publisher.Register(grip);
                for (int j = 0; j < 3; j++)
                {
                    int      ptr_gem = pos + 0x94 + j * 0x30;
                    string   key     = url + "/Weapon/Gem" + (j + 1);
                    ActorGem gem     = new ActorGem(key, ptr_gem, GetRec());
                    weapon_gems.Add(gem);
                    Model.Add(key, gem);
                    Publisher.Register(gem);
                }

                TreeNode tv_weapon = node.Nodes.Add(url + "/Weapon", "Weapon", 12, 12);
                tv_weapon.Nodes.Add(url + "/Weapon/Blade", "Blade", 13, 13);
                tv_weapon.Nodes.Add(url + "/Weapon/Grip", "Grip", 14, 14);
                tv_weapon.Nodes.Add(url + "/Weapon/Gem1", "Gem1", 24, 24);
                tv_weapon.Nodes.Add(url + "/Weapon/Gem2", "Gem2", 25, 25);
                tv_weapon.Nodes.Add(url + "/Weapon/Gem3", "Gem3", 26, 26);

                // ************************************************************
                // Add shield
                ActorShield shield = new ActorShield(url + "/Shield", pos + 0x140, GetRec());
                shields.Add(shield);
                Model.Add(url + "/Shield", shield);
                Publisher.Register(shield);
                for (int j = 0; j < 3; j++)
                {
                    int      ptr_gem = pos + 0x170 + j * 0x30;
                    string   key     = url + "/Shield/Gem" + (j + 1);
                    ActorGem gem     = new ActorGem(key, ptr_gem, GetRec());
                    shield_gems.Add(gem);
                    Model.Add(key, gem);
                    Publisher.Register(gem);
                }

                TreeNode tv_shield = node.Nodes.Add(url + "/Shield", "Shield", 11, 11);
                tv_shield.Nodes.Add(url + "/Shield/Gem1", "Gem1", 24, 24);
                tv_shield.Nodes.Add(url + "/Shield/Gem2", "Gem2", 25, 25);
                tv_shield.Nodes.Add(url + "/Shield/Gem3", "Gem3", 26, 26);

                // ************************************************************
                // Add accessory
                TreeNode       tv_accessory = node.Nodes.Add(url + "/Accessory", "Accessory", 10, 10);
                ActorAccessory accessory    = new ActorAccessory(url + "/Accessory", pos + 0x204, GetRec());
                accessories.Add(accessory);
                Model.Add(url + "/Accessory", accessory);
                Publisher.Register(accessory);
                return(true);
            } catch {
                return(false);
            }
        }