コード例 #1
0
 // Token: 0x06001B4E RID: 6990 RVA: 0x000945B0 File Offset: 0x000929B0
 public ItemWeaponAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this.bladeID = data.readByte("BladeID");
     this.range   = data.readSingle("Range");
     this.playerDamageMultiplier = new PlayerDamageMultiplier(data.readSingle("Player_Damage"), data.readSingle("Player_Leg_Multiplier"), data.readSingle("Player_Arm_Multiplier"), data.readSingle("Player_Spine_Multiplier"), data.readSingle("Player_Skull_Multiplier"));
     this.zombieDamageMultiplier = new ZombieDamageMultiplier(data.readSingle("Zombie_Damage"), data.readSingle("Zombie_Leg_Multiplier"), data.readSingle("Zombie_Arm_Multiplier"), data.readSingle("Zombie_Spine_Multiplier"), data.readSingle("Zombie_Skull_Multiplier"));
     this.animalDamageMultiplier = new AnimalDamageMultiplier(data.readSingle("Animal_Damage"), data.readSingle("Animal_Leg_Multiplier"), data.readSingle("Animal_Spine_Multiplier"), data.readSingle("Animal_Skull_Multiplier"));
     this.barricadeDamage        = data.readSingle("Barricade_Damage");
     this.structureDamage        = data.readSingle("Structure_Damage");
     this.vehicleDamage          = data.readSingle("Vehicle_Damage");
     this.resourceDamage         = data.readSingle("Resource_Damage");
     if (data.has("Object_Damage"))
     {
         this.objectDamage = data.readSingle("Object_Damage");
     }
     else
     {
         this.objectDamage = this.resourceDamage;
     }
     this.durability = data.readSingle("Durability");
     this.wear       = data.readByte("Wear");
     if (this.wear < 1)
     {
         this.wear = 1;
     }
     this.isInvulnerable = data.has("Invulnerable");
 }
コード例 #2
0
 // Token: 0x06001A42 RID: 6722 RVA: 0x00093CBD File Offset: 0x000920BD
 public ItemBagAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     if (!this.isPro)
     {
         this._width  = data.readByte("Width");
         this._height = data.readByte("Height");
     }
 }
コード例 #3
0
 // Token: 0x06001C53 RID: 7251 RVA: 0x0009AAE8 File Offset: 0x00098EE8
 public ObjectNPCAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this.npcName    = localization.format("Character");
     this.npcName    = ItemTool.filterRarityRichText(this.npcName);
     this.shirt      = data.readUInt16("Shirt");
     this.pants      = data.readUInt16("Pants");
     this.hat        = data.readUInt16("Hat");
     this.backpack   = data.readUInt16("Backpack");
     this.vest       = data.readUInt16("Vest");
     this.mask       = data.readUInt16("Mask");
     this.glasses    = data.readUInt16("Glasses");
     this.face       = data.readByte("Face");
     this.hair       = data.readByte("Hair");
     this.beard      = data.readByte("Beard");
     this.skin       = Palette.hex(data.readString("Color_Skin"));
     this.color      = Palette.hex(data.readString("Color_Hair"));
     this.isBackward = data.has("Backward");
     this.primary    = data.readUInt16("Primary");
     this.secondary  = data.readUInt16("Secondary");
     this.tertiary   = data.readUInt16("Tertiary");
     if (data.has("Equipped"))
     {
         this.equipped = (ESlotType)Enum.Parse(typeof(ESlotType), data.readString("Equipped"), true);
     }
     else
     {
         this.equipped = ESlotType.NONE;
     }
     this.dialogue = data.readUInt16("Dialogue");
     if (data.has("Pose"))
     {
         this.pose = (ENPCPose)Enum.Parse(typeof(ENPCPose), data.readString("Pose"), true);
     }
     else
     {
         this.pose = ENPCPose.STAND;
     }
     if (data.has("Pose_Lean"))
     {
         this.poseLean = data.readSingle("Pose_Lean");
     }
     if (data.has("Pose_Pitch"))
     {
         this.posePitch = data.readSingle("Pose_Pitch");
     }
     else
     {
         this.posePitch = 90f;
     }
     if (data.has("Pose_Head_Offset"))
     {
         this.poseHeadOffset = data.readSingle("Pose_Head_Offset");
     }
     else if (this.pose == ENPCPose.CROUCH)
     {
         this.poseHeadOffset = 0.1f;
     }
 }
コード例 #4
0
 public ItemStorageAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._storage_x = data.readByte("Storage_X");
     if (this.storage_x < 1)
     {
         this._storage_x = 1;
     }
     this._storage_y = data.readByte("Storage_Y");
     if (this.storage_y < 1)
     {
         this._storage_y = 1;
     }
     this._isDisplay = data.has("Display");
 }
コード例 #5
0
        // Token: 0x06001D2C RID: 7468 RVA: 0x0009D240 File Offset: 0x0009B640
        public VendorAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
        {
            if (id < 2000 && !bundle.hasResource && !data.has("Bypass_ID_Limit"))
            {
                throw new NotSupportedException("ID < 2000");
            }
            this.vendorName        = localization.format("Name");
            this.vendorName        = ItemTool.filterRarityRichText(this.vendorName);
            this.vendorDescription = localization.format("Description");
            this.vendorDescription = ItemTool.filterRarityRichText(this.vendorDescription);
            this.buying            = new VendorBuying[(int)data.readByte("Buying")];
            byte b = 0;

            while ((int)b < this.buying.Length)
            {
                ushort          newID   = data.readUInt16("Buying_" + b + "_ID");
                uint            newCost = data.readUInt32("Buying_" + b + "_Cost");
                INPCCondition[] array   = new INPCCondition[(int)data.readByte("Buying_" + b + "_Conditions")];
                NPCTool.readConditions(data, localization, "Buying_" + b + "_Condition_", array, string.Concat(new object[]
                {
                    "vendor ",
                    id,
                    " buying ",
                    b
                }));
                this.buying[(int)b] = new VendorBuying(b, newID, newCost, array);
                b += 1;
            }
            this.selling = new VendorSelling[(int)data.readByte("Selling")];
            byte b2 = 0;

            while ((int)b2 < this.selling.Length)
            {
                ushort          newID2   = data.readUInt16("Selling_" + b2 + "_ID");
                uint            newCost2 = data.readUInt32("Selling_" + b2 + "_Cost");
                INPCCondition[] array2   = new INPCCondition[(int)data.readByte("Selling_" + b2 + "_Conditions")];
                NPCTool.readConditions(data, localization, "Selling_" + b2 + "_Condition_", array2, string.Concat(new object[]
                {
                    "vendor ",
                    id,
                    " selling ",
                    b2
                }));
                this.selling[(int)b2] = new VendorSelling(b2, newID2, newCost2, array2);
                b2 += 1;
            }
            bundle.unload();
        }
コード例 #6
0
ファイル: ItemMeleeAsset.cs プロジェクト: sky-xk-nge/Unturned
 public ItemMeleeAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._use      = (AudioClip)bundle.load("Use");
     this._strength = data.readSingle("Strength");
     this._weak     = data.readSingle("Weak");
     if ((double)this.weak < 0.01)
     {
         this._weak = 0.5f;
     }
     this._strong = data.readSingle("Strong");
     if ((double)this.strong < 0.01)
     {
         this._strong = 0.33f;
     }
     this._stamina    = data.readByte("Stamina");
     this._isRepair   = data.has("Repair");
     this._isRepeated = data.has("Repeated");
     this._isLight    = data.has("Light");
     if (data.has("Alert_Radius"))
     {
         this.alertRadius = data.readSingle("Alert_Radius");
     }
     else
     {
         this.alertRadius = 8f;
     }
     bundle.unload();
 }
コード例 #7
0
 public QuestAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     if (id < 2000 && !bundle.hasResource && !data.has("Bypass_ID_Limit"))
     {
         throw new NotSupportedException("ID < 2000");
     }
     this.questName        = localization.format("Name");
     this.questName        = ItemTool.filterRarityRichText(this.questName);
     this.questDescription = localization.format("Description");
     this.questDescription = ItemTool.filterRarityRichText(this.questDescription);
     this.conditions       = new INPCCondition[(int)data.readByte("Conditions")];
     NPCTool.readConditions(data, localization, "Condition_", this.conditions);
     this.rewards = new INPCReward[(int)data.readByte("Rewards")];
     NPCTool.readRewards(data, localization, "Reward_", this.rewards);
     bundle.unload();
 }
コード例 #8
0
        // Token: 0x06001A67 RID: 6759 RVA: 0x00093D44 File Offset: 0x00092144
        public ItemCaliberAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
        {
            this._calibers = new ushort[(int)data.readByte("Calibers")];
            byte b = 0;

            while ((int)b < this.calibers.Length)
            {
                this._calibers[(int)b] = data.readUInt16("Caliber_" + b);
                b += 1;
            }
            this._recoil_x = data.readSingle("Recoil_X");
            if ((double)this.recoil_x < 0.01)
            {
                this._recoil_x = 1f;
            }
            this._recoil_y = data.readSingle("Recoil_Y");
            if ((double)this.recoil_y < 0.01)
            {
                this._recoil_y = 1f;
            }
            this._spread = data.readSingle("Spread");
            if ((double)this.spread < 0.01)
            {
                this._spread = 1f;
            }
            this._sway = data.readSingle("Sway");
            if ((double)this.sway < 0.01)
            {
                this._sway = 1f;
            }
            this._shake = data.readSingle("Shake");
            if ((double)this.shake < 0.01)
            {
                this._shake = 1f;
            }
            this._damage = data.readSingle("Damage");
            if ((double)this.damage < 0.01)
            {
                this._damage = 1f;
            }
            this._firerate    = data.readByte("Firerate");
            this._isPaintable = data.has("Paintable");
        }
コード例 #9
0
 // Token: 0x06001AD9 RID: 6873 RVA: 0x000965B0 File Offset: 0x000949B0
 public ItemMagazineAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._magazine = (GameObject)bundle.load("Magazine");
     this._pellets  = data.readByte("Pellets");
     if (this.pellets < 1)
     {
         this._pellets = 1;
     }
     this._stuck          = data.readByte("Stuck");
     this._range          = data.readSingle("Range");
     this.playerDamage    = data.readSingle("Player_Damage");
     this.zombieDamage    = data.readSingle("Zombie_Damage");
     this.animalDamage    = data.readSingle("Animal_Damage");
     this.barricadeDamage = data.readSingle("Barricade_Damage");
     this.structureDamage = data.readSingle("Structure_Damage");
     this.vehicleDamage   = data.readSingle("Vehicle_Damage");
     this.resourceDamage  = data.readSingle("Resource_Damage");
     this._explosion      = data.readUInt16("Explosion");
     if (data.has("Object_Damage"))
     {
         this.objectDamage = data.readSingle("Object_Damage");
     }
     else
     {
         this.objectDamage = this.resourceDamage;
     }
     this._tracer = data.readUInt16("Tracer");
     this._impact = data.readUInt16("Impact");
     this._speed  = data.readSingle("Speed");
     if (this.speed < 0.01f)
     {
         this._speed = 1f;
     }
     this._isExplosive = data.has("Explosive");
     this._deleteEmpty = data.has("Delete_Empty");
     bundle.unload();
 }
コード例 #10
0
 public ItemConsumeableAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._use                = (AudioClip)bundle.load("Use");
     this._health             = data.readByte("Health");
     this._food               = data.readByte("Food");
     this._water              = data.readByte("Water");
     this._virus              = data.readByte("Virus");
     this._disinfectant       = data.readByte("Disinfectant");
     this._energy             = data.readByte("Energy");
     this._vision             = data.readByte("Vision");
     this._warmth             = data.readUInt32("Warmth");
     this._hasBleeding        = data.has("Bleeding");
     this._hasBroken          = data.has("Broken");
     this._hasAid             = data.has("Aid");
     this.foodConstrainsWater = (this.food >= this.water);
 }
コード例 #11
0
 public ItemBarrelAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._shoot      = (AudioClip)bundle.load("Shoot");
     this._barrel     = (GameObject)bundle.load("Barrel");
     this._isBraked   = data.has("Braked");
     this._isSilenced = data.has("Silenced");
     this._volume     = data.readSingle("Volume");
     this._durability = data.readByte("Durability");
     if (data.has("Ballistic_Drop"))
     {
         this._ballisticDrop = data.readSingle("Ballistic_Drop");
     }
     else
     {
         this._ballisticDrop = 1f;
     }
     bundle.unload();
 }
コード例 #12
0
 public ItemSightAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._sight = (GameObject)bundle.load("Sight");
     if (data.has("Vision"))
     {
         this._vision = (ELightingVision)Enum.Parse(typeof(ELightingVision), data.readString("Vision"), true);
     }
     else
     {
         this._vision = ELightingVision.NONE;
     }
     if (data.has("Zoom"))
     {
         this._zoom = 90f / (float)data.readByte("Zoom");
     }
     else
     {
         this._zoom = 90f;
     }
     this._isHolographic = data.has("Holographic");
     bundle.unload();
 }
コード例 #13
0
        // Token: 0x06001CDC RID: 7388 RVA: 0x0009C460 File Offset: 0x0009A860
        public VehicleAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
        {
            if (id < 200 && !bundle.hasResource && !data.has("Bypass_ID_Limit"))
            {
                throw new NotSupportedException("ID < 200");
            }
            this._vehicleName = localization.format("Name");
            this._vehicle     = (GameObject)bundle.load("Vehicle");
            if (this.vehicle == null)
            {
                throw new NotSupportedException("Missing vehicle gameobject");
            }
            this._clip           = (GameObject)bundle.load("Clip");
            this._size2_z        = data.readSingle("Size2_Z");
            this._sharedSkinName = data.readString("Shared_Skin_Name");
            if (data.has("Shared_Skin_Lookup_ID"))
            {
                this._sharedSkinLookupID = data.readUInt16("Shared_Skin_Lookup_ID");
            }
            else
            {
                this._sharedSkinLookupID = id;
            }
            if (data.has("Engine"))
            {
                this._engine = (EEngine)Enum.Parse(typeof(EEngine), data.readString("Engine"), true);
                if (this.engine == EEngine.BOAT || this.engine == EEngine.BLIMP)
                {
                    if (this.vehicle.transform.FindChild("Buoyancy") == null)
                    {
                        this._engine = EEngine.CAR;
                    }
                }
                else if (this.engine != EEngine.CAR && this.engine != EEngine.TRAIN && this.vehicle.transform.FindChild("Rotors") == null)
                {
                    this._engine = EEngine.CAR;
                }
            }
            else
            {
                this._engine = EEngine.CAR;
            }
            if (data.has("Rarity"))
            {
                this._rarity = (EItemRarity)Enum.Parse(typeof(EItemRarity), data.readString("Rarity"), true);
            }
            else
            {
                this._rarity = EItemRarity.COMMON;
            }
            this._hasHeadlights = (this.vehicle.transform.FindChild("Headlights") != null);
            this._hasSirens     = (this.vehicle.transform.FindChild("Sirens") != null);
            this._hasHook       = (this.vehicle.transform.FindChild("Hook") != null);
            this._hasZip        = data.has("Zip");
            this._hasBicycle    = data.has("Bicycle");
            this.isReclined     = data.has("Reclined");
            this._hasCrawler    = data.has("Crawler");
            this._hasLockMouse  = data.has("LockMouse");
            this._hasTraction   = data.has("Traction");
            this._hasSleds      = data.has("Sleds");
            this._ignition      = (AudioClip)bundle.load("Ignition");
            this._horn          = (AudioClip)bundle.load("Horn");
            if (this.clip == null)
            {
                Assets.errors.Add(this.vehicleName + " is missing collision data. Highly recommended to fix.");
            }
            if (this.vehicle != null && this.vehicle.transform.FindChild("Seats") == null)
            {
                Assets.errors.Add(this.vehicleName + " vehicle is missing seats.");
            }
            if (this.clip != null && this.clip.transform.FindChild("Seats") == null)
            {
                Assets.errors.Add(this.vehicleName + " clip is missing seats.");
            }
            if (data.has("Pitch_Idle"))
            {
                this._pitchIdle = data.readSingle("Pitch_Idle");
            }
            else
            {
                this._pitchIdle = 0.5f;
                AudioSource component = this.vehicle.GetComponent <AudioSource>();
                if (component != null)
                {
                    AudioClip clip = component.clip;
                    if (clip != null)
                    {
                        if (clip.name == "Engine_Large")
                        {
                            this._pitchIdle = 0.625f;
                        }
                        else if (clip.name == "Engine_Small")
                        {
                            this._pitchIdle = 0.75f;
                        }
                    }
                    else
                    {
                        Assets.errors.Add(this.vehicleName + " missing engine audio!");
                    }
                }
            }
            if (data.has("Pitch_Drive"))
            {
                this._pitchDrive = data.readSingle("Pitch_Drive");
            }
            else
            {
                this._pitchDrive = 0.05f;
                AudioSource component2 = this.vehicle.GetComponent <AudioSource>();
                if (component2 != null)
                {
                    AudioClip clip2 = component2.clip;
                    if (clip2 != null)
                    {
                        if (clip2.name == "Engine_Large")
                        {
                            this._pitchDrive = 0.025f;
                        }
                        else if (clip2.name == "Engine_Small")
                        {
                            this._pitchDrive = 0.075f;
                        }
                    }
                    else
                    {
                        Assets.errors.Add(this.vehicleName + " missing engine audio!");
                    }
                }
            }
            this._speedMin = data.readSingle("Speed_Min");
            this._speedMax = data.readSingle("Speed_Max");
            if (this.engine != EEngine.TRAIN)
            {
                this._speedMax *= 1.25f;
            }
            this._steerMin  = data.readSingle("Steer_Min");
            this._steerMax  = data.readSingle("Steer_Max") * 0.75f;
            this._brake     = data.readSingle("Brake");
            this._lift      = data.readSingle("Lift");
            this._fuelMin   = data.readUInt16("Fuel_Min");
            this._fuelMax   = data.readUInt16("Fuel_Max");
            this._fuel      = data.readUInt16("Fuel");
            this._healthMin = data.readUInt16("Health_Min");
            this._healthMax = data.readUInt16("Health_Max");
            this._health    = data.readUInt16("Health");
            this._explosion = data.readUInt16("Explosion");
            if (data.has("Explosion_Min_Force_Y"))
            {
                this.minExplosionForce = data.readVector3("Explosion_Min_Force");
            }
            else
            {
                this.minExplosionForce = new Vector3(0f, 1024f, 0f);
            }
            if (data.has("Explosion_Max_Force_Y"))
            {
                this.maxExplosionForce = data.readVector3("Explosion_Max_Force");
            }
            else
            {
                this.maxExplosionForce = new Vector3(0f, 1024f, 0f);
            }
            if (data.has("Exit"))
            {
                this._exit = data.readSingle("Exit");
            }
            else
            {
                this._exit = 2f;
            }
            if (data.has("Cam_Follow_Distance"))
            {
                this._camFollowDistance = data.readSingle("Cam_Follow_Distance");
            }
            else
            {
                this._camFollowDistance = 5.5f;
            }
            this._camDriverOffset = data.readSingle("Cam_Driver_Offset");
            if (data.has("Bumper_Multiplier"))
            {
                this._bumperMultiplier = data.readSingle("Bumper_Multiplier");
            }
            else
            {
                this._bumperMultiplier = 1f;
            }
            if (data.has("Passenger_Explosion_Armor"))
            {
                this._passengerExplosionArmor = data.readSingle("Passenger_Explosion_Armor");
            }
            else
            {
                this._passengerExplosionArmor = 1f;
            }
            if (this.engine == EEngine.HELICOPTER || this.engine == EEngine.BLIMP)
            {
                this._sqrDelta = Mathf.Pow(this.speedMax * 0.125f, 2f);
            }
            else
            {
                this._sqrDelta = Mathf.Pow(this.speedMax * 0.1f, 2f);
            }
            this._turrets = new TurretInfo[(int)data.readByte("Turrets")];
            byte b = 0;

            while ((int)b < this.turrets.Length)
            {
                TurretInfo turretInfo = new TurretInfo();
                turretInfo.seatIndex    = data.readByte("Turret_" + b + "_Seat_Index");
                turretInfo.itemID       = data.readUInt16("Turret_" + b + "_Item_ID");
                turretInfo.yawMin       = data.readSingle("Turret_" + b + "_Yaw_Min");
                turretInfo.yawMax       = data.readSingle("Turret_" + b + "_Yaw_Max");
                turretInfo.pitchMin     = data.readSingle("Turret_" + b + "_Pitch_Min");
                turretInfo.pitchMax     = data.readSingle("Turret_" + b + "_Pitch_Max");
                turretInfo.useAimCamera = !data.has("Turret_" + b + "_Ignore_Aim_Camera");
                turretInfo.aimOffset    = data.readSingle("Turret_" + b + "_Aim_Offset");
                this._turrets[(int)b]   = turretInfo;
                b += 1;
            }
            this.isVulnerable              = !data.has("Invulnerable");
            this.isVulnerableToExplosions  = !data.has("Explosions_Invulnerable");
            this.isVulnerableToEnvironment = !data.has("Environment_Invulnerable");
            this.isVulnerableToBumper      = !data.has("Bumper_Invulnerable");
            this.canTiresBeDamaged         = !data.has("Tires_Invulnerable");
            if (data.has("Air_Turn_Responsiveness"))
            {
                this.airTurnResponsiveness = data.readSingle("Air_Turn_Responsiveness");
            }
            else
            {
                this.airTurnResponsiveness = 2f;
            }
            if (data.has("Air_Steer_Min"))
            {
                this.airSteerMin = data.readSingle("Air_Steer_Min");
            }
            else
            {
                this.airSteerMin = this.steerMin;
            }
            if (data.has("Air_Steer_Max"))
            {
                this.airSteerMax = data.readSingle("Air_Steer_Max");
            }
            else
            {
                this.airSteerMax = this.steerMax;
            }
            this.bicycleAnimSpeed         = data.readSingle("Bicycle_Anim_Speed");
            this.staminaBoost             = data.readSingle("Stamina_Boost");
            this.useStaminaBoost          = data.has("Stamina_Boost");
            this.isStaminaPowered         = data.has("Stamina_Powered");
            this.supportsMobileBuildables = data.has("Supports_Mobile_Buildables");
            this.trunkStorage_X           = data.readByte("Trunk_Storage_X");
            this.trunkStorage_Y           = data.readByte("Trunk_Storage_Y");
            this.trainTrackOffset         = data.readSingle("Train_Track_Offset");
            this.trainWheelOffset         = data.readSingle("Train_Wheel_Offset");
            this.trainCarLength           = data.readSingle("Train_Car_Length");
            this._shouldVerifyHash        = !data.has("Bypass_Hash_Verification");
            if (!Dedicator.isDedicated)
            {
                this._albedoBase   = (Texture2D)bundle.load("Albedo_Base");
                this._metallicBase = (Texture2D)bundle.load("Metallic_Base");
                this._emissionBase = (Texture2D)bundle.load("Emission_Base");
            }
            bundle.unload();
        }
コード例 #14
0
        public DialogueAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
        {
            if (id < 2000 && !bundle.hasResource && !data.has("Bypass_ID_Limit"))
            {
                throw new NotSupportedException("ID < 2000");
            }
            this.messages = new DialogueMessage[(int)data.readByte("Messages")];
            byte b = 0;

            while ((int)b < this.messages.Length)
            {
                DialoguePage[] array = new DialoguePage[(int)data.readByte("Message_" + b + "_Pages")];
                byte           b2    = 0;
                while ((int)b2 < array.Length)
                {
                    string text = localization.format(string.Concat(new object[]
                    {
                        "Message_",
                        b,
                        "_Page_",
                        b2
                    }));
                    text           = ItemTool.filterRarityRichText(text);
                    array[(int)b2] = new DialoguePage(text);
                    b2            += 1;
                }
                byte[] array2 = new byte[(int)data.readByte("Message_" + b + "_Responses")];
                byte   b3     = 0;
                while ((int)b3 < array2.Length)
                {
                    array2[(int)b3] = data.readByte(string.Concat(new object[]
                    {
                        "Message_",
                        b,
                        "_Response_",
                        b3
                    }));
                    b3 += 1;
                }
                ushort          newPrev = data.readUInt16("Message_" + b + "_Prev");
                INPCCondition[] array3  = new INPCCondition[(int)data.readByte("Message_" + b + "_Conditions")];
                NPCTool.readConditions(data, localization, "Message_" + b + "_Condition_", array3);
                INPCReward[] array4 = new INPCReward[(int)data.readByte("Message_" + b + "_Rewards")];
                NPCTool.readRewards(data, localization, "Message_" + b + "_Reward_", array4);
                this.messages[(int)b] = new DialogueMessage(b, array, array2, newPrev, array3, array4);
                b += 1;
            }
            this.responses = new DialogueResponse[(int)data.readByte("Responses")];
            byte b4 = 0;

            while ((int)b4 < this.responses.Length)
            {
                byte[] array5 = new byte[(int)data.readByte("Response_" + b4 + "_Messages")];
                byte   b5     = 0;
                while ((int)b5 < array5.Length)
                {
                    array5[(int)b5] = data.readByte(string.Concat(new object[]
                    {
                        "Response_",
                        b4,
                        "_Message_",
                        b5
                    }));
                    b5 += 1;
                }
                ushort newDialogue = data.readUInt16("Response_" + b4 + "_Dialogue");
                ushort newQuest    = data.readUInt16("Response_" + b4 + "_Quest");
                ushort newVendor   = data.readUInt16("Response_" + b4 + "_Vendor");
                string text2       = localization.format("Response_" + b4);
                text2 = ItemTool.filterRarityRichText(text2);
                INPCCondition[] array6 = new INPCCondition[(int)data.readByte("Response_" + b4 + "_Conditions")];
                NPCTool.readConditions(data, localization, "Response_" + b4 + "_Condition_", array6);
                INPCReward[] array7 = new INPCReward[(int)data.readByte("Response_" + b4 + "_Rewards")];
                NPCTool.readRewards(data, localization, "Response_" + b4 + "_Reward_", array7);
                this.responses[(int)b4] = new DialogueResponse(b4, array5, newDialogue, newQuest, newVendor, text2, array6, array7);
                b4 += 1;
            }
            bundle.unload();
        }
コード例 #15
0
 public ItemBeaconAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._wave     = data.readUInt16("Wave");
     this._rewards  = data.readByte("Rewards");
     this._rewardID = data.readUInt16("Reward_ID");
 }
コード例 #16
0
        public ItemGunAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
        {
            this._shoot      = (AudioClip)bundle.load("Shoot");
            this._reload     = (AudioClip)bundle.load("Reload");
            this._hammer     = (AudioClip)bundle.load("Hammer");
            this._aim        = (AudioClip)bundle.load("Aim");
            this._minigun    = (AudioClip)bundle.load("Minigun");
            this._projectile = (GameObject)bundle.load("Projectile");
            this.ammoMin     = data.readByte("Ammo_Min");
            this.ammoMax     = data.readByte("Ammo_Max");
            this.sightID     = data.readUInt16("Sight");
            this.tacticalID  = data.readUInt16("Tactical");
            this.gripID      = data.readUInt16("Grip");
            this.barrelID    = data.readUInt16("Barrel");
            this.magazineID  = data.readUInt16("Magazine");
            int num = data.readInt32("Magazine_Replacements");

            this.magazineReplacements = new MagazineReplacement[num];
            for (int i = 0; i < num; i++)
            {
                ushort id2 = data.readUInt16("Magazine_Replacement_" + i + "_ID");
                string map = data.readString("Magazine_Replacement_" + i + "_Map");
                MagazineReplacement magazineReplacement = default(MagazineReplacement);
                magazineReplacement.id       = id2;
                magazineReplacement.map      = map;
                this.magazineReplacements[i] = magazineReplacement;
            }
            this.unplace = data.readSingle("Unplace");
            this.replace = data.readSingle("Replace");
            if ((double)this.replace < 0.01)
            {
                this.replace = 1f;
            }
            this.hasSight    = data.has("Hook_Sight");
            this.hasTactical = data.has("Hook_Tactical");
            this.hasGrip     = data.has("Hook_Grip");
            this.hasBarrel   = data.has("Hook_Barrel");
            int num2 = data.readInt32("Magazine_Calibers");

            if (num2 > 0)
            {
                this.magazineCalibers = new ushort[num2];
                for (int j = 0; j < num2; j++)
                {
                    this.magazineCalibers[j] = data.readUInt16("Magazine_Caliber_" + j);
                }
                int num3 = data.readInt32("Attachment_Calibers");
                if (num3 > 0)
                {
                    this.attachmentCalibers = new ushort[num3];
                    for (int k = 0; k < num3; k++)
                    {
                        this.attachmentCalibers[k] = data.readUInt16("Attachment_Caliber_" + k);
                    }
                }
                else
                {
                    this.attachmentCalibers = this.magazineCalibers;
                }
            }
            else
            {
                this.magazineCalibers    = new ushort[1];
                this.magazineCalibers[0] = data.readUInt16("Caliber");
                this.attachmentCalibers  = this.magazineCalibers;
            }
            this.firerate             = data.readByte("Firerate");
            this.action               = (EAction)Enum.Parse(typeof(EAction), data.readString("Action"), true);
            this.deleteEmptyMagazines = data.has("Delete_Empty_Magazines");
            this.bursts               = data.readInt32("Bursts");
            this.hasSafety            = data.has("Safety");
            this.hasSemi              = data.has("Semi");
            this.hasAuto              = data.has("Auto");
            this.hasBurst             = (this.bursts > 0);
            this.isTurret             = data.has("Turret");
            if (this.hasAuto)
            {
                this.firemode = EFiremode.AUTO;
            }
            else if (this.hasSemi)
            {
                this.firemode = EFiremode.SEMI;
            }
            else if (this.hasBurst)
            {
                this.firemode = EFiremode.BURST;
            }
            else if (this.hasSafety)
            {
                this.firemode = EFiremode.SAFETY;
            }
            this.spreadAim = data.readSingle("Spread_Aim");
            this.spreadHip = data.readSingle("Spread_Hip");
            if (data.has("Recoil_Aim"))
            {
                this.recoilAim    = data.readSingle("Recoil_Aim");
                this.useRecoilAim = true;
            }
            else
            {
                this.recoilAim    = 1f;
                this.useRecoilAim = false;
            }
            this.recoilMin_x     = data.readSingle("Recoil_Min_X");
            this.recoilMin_y     = data.readSingle("Recoil_Min_Y");
            this.recoilMax_x     = data.readSingle("Recoil_Max_X");
            this.recoilMax_y     = data.readSingle("Recoil_Max_Y");
            this.recover_x       = data.readSingle("Recover_X");
            this.recover_y       = data.readSingle("Recover_Y");
            this.shakeMin_x      = data.readSingle("Shake_Min_X");
            this.shakeMin_y      = data.readSingle("Shake_Min_Y");
            this.shakeMin_z      = data.readSingle("Shake_Min_Z");
            this.shakeMax_x      = data.readSingle("Shake_Max_X");
            this.shakeMax_y      = data.readSingle("Shake_Max_Y");
            this.shakeMax_z      = data.readSingle("Shake_Max_Z");
            this.ballisticSteps  = data.readByte("Ballistic_Steps");
            this.ballisticTravel = data.readSingle("Ballistic_Travel");
            if (data.has("Ballistic_Steps"))
            {
                this.ballisticSteps  = data.readByte("Ballistic_Steps");
                this.ballisticTravel = data.readSingle("Ballistic_Travel");
            }
            else
            {
                this.ballisticTravel = 10f;
                this.ballisticSteps  = (byte)Mathf.CeilToInt(this.range / this.ballisticTravel);
            }
            if (data.has("Ballistic_Drop"))
            {
                this.ballisticDrop = data.readSingle("Ballistic_Drop");
            }
            else
            {
                this.ballisticDrop = 0.002f;
            }
            if (data.has("Ballistic_Force"))
            {
                this.ballisticForce = data.readSingle("Ballistic_Force");
            }
            else
            {
                this.ballisticForce = 0.002f;
            }
            this.reloadTime = data.readSingle("Reload_Time");
            this.hammerTime = data.readSingle("Hammer_Time");
            this.muzzle     = data.readUInt16("Muzzle");
            this.explosion  = data.readUInt16("Explosion");
            if (data.has("Shell"))
            {
                this.shell = data.readUInt16("Shell");
            }
            else if (this.action == EAction.Pump || this.action == EAction.Break)
            {
                this.shell = 33;
            }
            else if (this.action != EAction.Rail)
            {
                this.shell = 1;
            }
            else
            {
                this.shell = 0;
            }
            if (data.has("Alert_Radius"))
            {
                this.alertRadius = data.readSingle("Alert_Radius");
            }
            else
            {
                this.alertRadius = 48f;
            }
            bundle.unload();
        }
コード例 #17
0
 // Token: 0x06001C8F RID: 7311 RVA: 0x0009B100 File Offset: 0x00099500
 public ResourceAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     if (id < 50 && !bundle.hasResource && !data.has("Bypass_ID_Limit"))
     {
         throw new NotSupportedException("ID < 50");
     }
     if (Dedicator.isDedicated || GraphicsSettings.treeMode == ETreeGraphicMode.LEGACY)
     {
         this.isSpeedTree = false;
     }
     else
     {
         this.isSpeedTree = data.has("SpeedTree");
     }
     this.defaultLODWeights = data.has("SpeedTree_Default_LOD_Weights");
     this._resourceName     = localization.format("Name");
     if (Dedicator.isDedicated)
     {
         this._modelGameObject = (GameObject)bundle.load("Resource_Clip");
         if (this.modelGameObject == null)
         {
             Assets.errors.Add(this.resourceName + " is missing collision data. Highly recommended to fix.");
         }
         this._stumpGameObject = (GameObject)bundle.load("Stump_Clip");
         if (this.stumpGameObject == null)
         {
             Assets.errors.Add(this.resourceName + " is missing collision data. Highly recommended to fix.");
         }
     }
     else
     {
         this._modelGameObject  = null;
         this._stumpGameObject  = null;
         this._skyboxGameObject = null;
         this._debrisGameObject = null;
         if (GraphicsSettings.treeMode == ETreeGraphicMode.LEGACY)
         {
             this._modelGameObject = (GameObject)bundle.load("Resource_Old");
         }
         if (this._modelGameObject == null)
         {
             this._modelGameObject = (GameObject)bundle.load("Resource");
         }
         if (this.defaultLODWeights)
         {
             Transform transform = this.modelGameObject.transform.FindChild("Billboard");
             if (transform != null)
             {
                 BillboardRenderer component = transform.GetComponent <BillboardRenderer>();
                 if (component != null)
                 {
                     component.shadowCastingMode = ShadowCastingMode.Off;
                 }
             }
         }
         if (GraphicsSettings.treeMode == ETreeGraphicMode.LEGACY)
         {
             this._stumpGameObject = (GameObject)bundle.load("Stump_Old");
         }
         if (this._stumpGameObject == null)
         {
             this._stumpGameObject = (GameObject)bundle.load("Stump");
         }
         if (GraphicsSettings.treeMode == ETreeGraphicMode.LEGACY)
         {
             this._skyboxGameObject = (GameObject)bundle.load("Skybox_Old");
         }
         if (this._skyboxGameObject == null)
         {
             this._skyboxGameObject = (GameObject)bundle.load("Skybox");
         }
         if (this.defaultLODWeights)
         {
             Transform transform2 = this.skyboxGameObject.transform.FindChild("Model_0");
             if (transform2 != null)
             {
                 BillboardRenderer component2 = transform2.GetComponent <BillboardRenderer>();
                 if (component2 != null)
                 {
                     component2.shadowCastingMode = ShadowCastingMode.Off;
                 }
             }
         }
         if (this.isSpeedTree)
         {
             this._debrisGameObject = (GameObject)bundle.load("Debris");
             if (this.modelGameObject != null)
             {
                 LODGroup component3 = this.modelGameObject.GetComponent <LODGroup>();
                 if (component3 != null)
                 {
                     if (GraphicsSettings.treeMode == ETreeGraphicMode.SPEEDTREE_FADE_SPEEDTREE)
                     {
                         component3.fadeMode = LODFadeMode.SpeedTree;
                         if (this.defaultLODWeights && GraphicsSettings.treeMode != ETreeGraphicMode.LEGACY)
                         {
                             this.applyDefaultLODs(component3, true);
                         }
                     }
                     else
                     {
                         component3.fadeMode = LODFadeMode.None;
                         if (this.defaultLODWeights && GraphicsSettings.treeMode != ETreeGraphicMode.LEGACY)
                         {
                             this.applyDefaultLODs(component3, false);
                         }
                     }
                 }
             }
             if (this.debrisGameObject != null)
             {
                 LODGroup component4 = this.debrisGameObject.GetComponent <LODGroup>();
                 if (component4 != null)
                 {
                     if (GraphicsSettings.treeMode == ETreeGraphicMode.SPEEDTREE_FADE_SPEEDTREE)
                     {
                         component4.fadeMode = LODFadeMode.SpeedTree;
                         if (this.defaultLODWeights && GraphicsSettings.treeMode != ETreeGraphicMode.LEGACY)
                         {
                             this.applyDefaultLODs(component4, true);
                         }
                     }
                     else
                     {
                         component4.fadeMode = LODFadeMode.None;
                         if (this.defaultLODWeights && GraphicsSettings.treeMode != ETreeGraphicMode.LEGACY)
                         {
                             this.applyDefaultLODs(component4, false);
                         }
                     }
                 }
             }
         }
         if (data.has("Auto_Skybox") && !this.isSpeedTree && this.skyboxGameObject)
         {
             Transform transform3 = this.modelGameObject.transform.FindChild("Model_0");
             if (transform3)
             {
                 ResourceAsset.meshes.Clear();
                 transform3.GetComponentsInChildren <MeshFilter>(true, ResourceAsset.meshes);
                 if (ResourceAsset.meshes.Count > 0)
                 {
                     Bounds bounds = default(Bounds);
                     for (int i = 0; i < ResourceAsset.meshes.Count; i++)
                     {
                         Mesh sharedMesh = ResourceAsset.meshes[i].sharedMesh;
                         if (!(sharedMesh == null))
                         {
                             Bounds bounds2 = sharedMesh.bounds;
                             bounds.Encapsulate(bounds2.min);
                             bounds.Encapsulate(bounds2.max);
                         }
                     }
                     if (bounds.min.y < 0f)
                     {
                         float num = Mathf.Abs(bounds.min.z);
                         bounds.center += new Vector3(0f, 0f, num / 2f);
                         bounds.size   -= new Vector3(0f, 0f, num);
                     }
                     float num2 = Mathf.Max(bounds.size.x, bounds.size.y);
                     float z    = bounds.size.z;
                     this.skyboxGameObject.transform.localScale = new Vector3(z, z, z);
                     Transform transform4 = UnityEngine.Object.Instantiate <GameObject>(this.modelGameObject).transform;
                     Transform transform5 = new GameObject().transform;
                     transform5.parent        = transform4;
                     transform5.localPosition = new Vector3(0f, z / 2f, -num2 / 2f);
                     transform5.localRotation = Quaternion.identity;
                     Transform transform6 = new GameObject().transform;
                     transform6.parent        = transform4;
                     transform6.localPosition = new Vector3(-num2 / 2f, z / 2f, 0f);
                     transform6.localRotation = Quaternion.Euler(0f, 90f, 0f);
                     if (!ResourceAsset.shader)
                     {
                         ResourceAsset.shader = Shader.Find("Custom/Card");
                     }
                     Texture2D card = ItemTool.getCard(transform4, transform5, transform6, 64, 64, z / 2f, num2);
                     this.skyboxMaterial             = new Material(ResourceAsset.shader);
                     this.skyboxMaterial.mainTexture = card;
                 }
             }
         }
     }
     this.health    = data.readUInt16("Health");
     this.radius    = data.readSingle("Radius");
     this.scale     = data.readSingle("Scale");
     this.explosion = data.readUInt16("Explosion");
     this.log       = data.readUInt16("Log");
     this.stick     = data.readUInt16("Stick");
     this.rewardID  = data.readUInt16("Reward_ID");
     this.rewardXP  = data.readUInt32("Reward_XP");
     if (data.has("Reward_Min"))
     {
         this.rewardMin = data.readByte("Reward_Min");
     }
     else
     {
         this.rewardMin = 6;
     }
     if (data.has("Reward_Max"))
     {
         this.rewardMax = data.readByte("Reward_Max");
     }
     else
     {
         this.rewardMax = 9;
     }
     this.bladeID   = data.readByte("BladeID");
     this.reset     = data.readSingle("Reset");
     this.isForage  = data.has("Forage");
     this.hasDebris = !data.has("No_Debris");
     bundle.unload();
 }
コード例 #18
0
ファイル: EffectAsset.cs プロジェクト: sky-xk-nge/Unturned
 public EffectAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     if (id < 200 && !bundle.hasResource && !data.has("Bypass_ID_Limit"))
     {
         throw new NotSupportedException("ID < 200");
     }
     this._effect = (GameObject)bundle.load("Effect");
     if (this.effect == null)
     {
         throw new NotSupportedException("Missing effect gameobject");
     }
     this._gore      = data.has("Gore");
     this._splatters = new GameObject[(int)data.readByte("Splatter")];
     for (int i = 0; i < this.splatters.Length; i++)
     {
         this.splatters[i] = (GameObject)bundle.load("Splatter_" + i);
     }
     this._splatter       = data.readByte("Splatters");
     this._splatterLiquid = data.has("Splatter_Liquid");
     if (data.has("Splatter_Temperature"))
     {
         this._splatterTemperature = (EPlayerTemperature)Enum.Parse(typeof(EPlayerTemperature), data.readString("Splatter_Temperature"), true);
     }
     else
     {
         this._splatterTemperature = EPlayerTemperature.NONE;
     }
     this._splatterLifetime = data.readSingle("Splatter_Lifetime");
     if (data.has("Splatter_Lifetime_Spread"))
     {
         this._splatterLifetimeSpread = data.readSingle("Splatter_Lifetime_Spread");
     }
     else
     {
         this._splatterLifetimeSpread = 1f;
     }
     this._lifetime = data.readSingle("Lifetime");
     if (data.has("Lifetime_Spread"))
     {
         this._lifetimeSpread = data.readSingle("Lifetime_Spread");
     }
     else
     {
         this._lifetimeSpread = 4f;
     }
     this._isStatic = data.has("Static");
     if (data.has("Preload"))
     {
         this._preload = data.readByte("Preload");
     }
     else
     {
         this._preload = 1;
     }
     if (data.has("Splatter_Preload"))
     {
         this._splatterPreload = data.readByte("Splatter_Preload");
     }
     else
     {
         this._splatterPreload = (byte)(Mathf.CeilToInt((float)this.splatter / (float)this.splatters.Length) * (int)this.preload);
     }
     this._blast = data.readUInt16("Blast");
     bundle.unload();
 }
コード例 #19
0
 public ItemRefillAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._use   = (AudioClip)bundle.load("Use");
     this._water = data.readByte("Water");
     bundle.unload();
 }
コード例 #20
0
        // Token: 0x06003447 RID: 13383 RVA: 0x00154C10 File Offset: 0x00153010
        public static void readConditions(Data data, Local localization, string prefix, INPCCondition[] conditions, string errorMessageSource)
        {
            for (int i = 0; i < conditions.Length; i++)
            {
                if (!data.has(prefix + i + "_Type"))
                {
                    Assets.errors.Add(string.Concat(new object[]
                    {
                        "Missing condition ",
                        prefix,
                        i,
                        " type"
                    }));
                    throw new NotSupportedException(string.Concat(new object[]
                    {
                        "Missing condition ",
                        prefix,
                        i,
                        " type"
                    }));
                }
                ENPCConditionType enpcconditionType = (ENPCConditionType)Enum.Parse(typeof(ENPCConditionType), data.readString(prefix + i + "_Type"), true);
                string            text = localization.read(prefix + i);
                text = ItemTool.filterRarityRichText(text);
                bool          newShouldReset = data.has(prefix + i + "_Reset");
                ENPCLogicType newLogicType   = ENPCLogicType.NONE;
                if (data.has(prefix + i + "_Logic"))
                {
                    newLogicType = (ENPCLogicType)Enum.Parse(typeof(ENPCLogicType), data.readString(prefix + i + "_Logic"), true);
                }
                switch (enpcconditionType)
                {
                case ENPCConditionType.EXPERIENCE:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Experience condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCExperienceCondition(data.readUInt32(prefix + i + "_Value"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.REPUTATION:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Reputation condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCReputationCondition(data.readInt32(prefix + i + "_Value"), newLogicType, text);
                    break;

                case ENPCConditionType.FLAG_BOOL:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Bool flag condition ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Bool flag condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCBoolFlagCondition(data.readUInt16(prefix + i + "_ID"), data.readBoolean(prefix + i + "_Value"), data.has(prefix + i + "_Allow_Unset"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.FLAG_SHORT:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Short flag condition ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Short flag condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCShortFlagCondition(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), data.has(prefix + i + "_Allow_Unset"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.QUEST:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Quest condition ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Status"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Quest condition ",
                            prefix,
                            i,
                            " missing _Status in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCQuestCondition(data.readUInt16(prefix + i + "_ID"), (ENPCQuestStatus)Enum.Parse(typeof(ENPCQuestStatus), data.readString(prefix + i + "_Status"), true), data.has(prefix + i + "_Ignore_NPC"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.SKILLSET:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Skillset condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCSkillsetCondition((EPlayerSkillset)Enum.Parse(typeof(EPlayerSkillset), data.readString(prefix + i + "_Value"), true), newLogicType, text);
                    break;

                case ENPCConditionType.ITEM:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Item condition ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Amount"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Item condition ",
                            prefix,
                            i,
                            " missing _Amount in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCItemCondition(data.readUInt16(prefix + i + "_ID"), data.readUInt16(prefix + i + "_Amount"), text, newShouldReset);
                    break;

                case ENPCConditionType.KILLS_ZOMBIE:
                {
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                            {
                                "Zombie kills condition ",
                                prefix,
                                i,
                                " missing _ID in: ",
                                errorMessageSource
                            }));
                    }
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                            {
                                "Zombie kills condition ",
                                prefix,
                                i,
                                " missing _Value in: ",
                                errorMessageSource
                            }));
                    }
                    EZombieSpeciality newZombie = EZombieSpeciality.NONE;
                    if (data.has(prefix + i + "_Zombie"))
                    {
                        newZombie = (EZombieSpeciality)Enum.Parse(typeof(EZombieSpeciality), data.readString(prefix + i + "_Zombie"), true);
                    }
                    else
                    {
                        Assets.errors.Add(string.Concat(new object[]
                            {
                                "Zombie kills condition ",
                                prefix,
                                i,
                                " missing _Zombie in: ",
                                errorMessageSource
                            }));
                    }
                    conditions[i] = new NPCZombieKillsCondition(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), newZombie, data.has(prefix + i + "_Spawn"), data.readByte(prefix + i + "_Nav"), text, newShouldReset);
                    break;
                }

                case ENPCConditionType.KILLS_HORDE:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Horde kills condition ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Horde kills condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Nav"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Horde kills condition ",
                            prefix,
                            i,
                            " missing _Nav in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCHordeKillsCondition(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), data.readByte(prefix + i + "_Nav"), text, newShouldReset);
                    break;

                case ENPCConditionType.KILLS_ANIMAL:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Animal kills condition ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Animal kills condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Animal"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Animal kills condition ",
                            prefix,
                            i,
                            " missing _Animal in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCAnimalKillsCondition(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), data.readUInt16(prefix + i + "_Animal"), text, newShouldReset);
                    break;

                case ENPCConditionType.COMPARE_FLAGS:
                    if (!data.has(prefix + i + "_A_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Compare flags condition ",
                            prefix,
                            i,
                            " missing _A_ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_B_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Compare flags condition ",
                            prefix,
                            i,
                            " missing _B_ID in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCCompareFlagsCondition(data.readUInt16(prefix + i + "_A_ID"), data.readUInt16(prefix + i + "_B_ID"), data.has(prefix + i + "_Allow_A_Unset"), data.has(prefix + i + "_Allow_B_Unset"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.TIME_OF_DAY:
                    if (!data.has(prefix + i + "_Second"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Time of day condition ",
                            prefix,
                            i,
                            " missing _Second in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCTimeOfDayCondition(data.readInt32(prefix + i + "_Second"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.PLAYER_LIFE_HEALTH:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Player life health condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCPlayerLifeHealthCondition(data.readInt32(prefix + i + "_Value"), newLogicType, text);
                    break;

                case ENPCConditionType.PLAYER_LIFE_FOOD:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Player life food condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCPlayerLifeFoodCondition(data.readInt32(prefix + i + "_Value"), newLogicType, text);
                    break;

                case ENPCConditionType.PLAYER_LIFE_WATER:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Player life water condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCPlayerLifeWaterCondition(data.readInt32(prefix + i + "_Value"), newLogicType, text);
                    break;

                case ENPCConditionType.PLAYER_LIFE_VIRUS:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Player life virus condition ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    conditions[i] = new NPCPlayerLifeVirusCondition(data.readInt32(prefix + i + "_Value"), newLogicType, text);
                    break;
                }
            }
        }
コード例 #21
0
ファイル: ItemOpticAsset.cs プロジェクト: sky-xk-nge/Unturned
 public ItemOpticAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._zoom = 90f / (float)data.readByte("Zoom");
     bundle.unload();
 }
コード例 #22
0
 public ObjectAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     if (id < 2000 && !bundle.hasResource && !data.has("Bypass_ID_Limit"))
     {
         throw new NotSupportedException("ID < 2000");
     }
     this._objectName = localization.format("Name");
     this.type        = (EObjectType)Enum.Parse(typeof(EObjectType), data.readString("Type"), true);
     if (this.type == EObjectType.NPC)
     {
         if (Dedicator.isDedicated)
         {
             this._modelGameObject = (GameObject)Resources.Load("Characters/NPC_Server");
         }
         else
         {
             this._modelGameObject = (GameObject)Resources.Load("Characters/NPC_Client");
         }
         this.useScale        = true;
         this.interactability = EObjectInteractability.NPC;
     }
     else if (this.type == EObjectType.DECAL)
     {
         float num  = data.readSingle("Decal_X");
         float num2 = data.readSingle("Decal_Y");
         float num3 = 1f;
         if (data.has("Decal_LOD_Bias"))
         {
             num3 = data.readSingle("Decal_LOD_Bias");
         }
         Texture2D texture2D = (Texture2D)bundle.load("Decal");
         this._modelGameObject           = Object.Instantiate <GameObject>(Resources.Load <GameObject>("Materials/Decal_Template"));
         this._modelGameObject.hideFlags = 61;
         Object.DontDestroyOnLoad(this._modelGameObject);
         BoxCollider component = this.modelGameObject.GetComponent <BoxCollider>();
         component.size = new Vector3(num2, num, 1f);
         Decal    component2 = this.modelGameObject.transform.FindChild("Decal").GetComponent <Decal>();
         Material material   = Object.Instantiate <Material>(component2.material);
         material.name      = "Decal_Deferred";
         material.hideFlags = 52;
         material.SetTexture("_MainTex", texture2D);
         component2.material             = material;
         component2.lodBias              = num3;
         component2.transform.localScale = new Vector3(num, num2, 1f);
         MeshRenderer component3 = this.modelGameObject.transform.FindChild("Mesh").GetComponent <MeshRenderer>();
         Material     material2  = Object.Instantiate <Material>(component3.sharedMaterial);
         material2.name      = "Decal_Forward";
         material2.hideFlags = 52;
         material2.SetTexture("_MainTex", texture2D);
         component3.sharedMaterial       = material2;
         component3.transform.localScale = new Vector3(num2, num, 1f);
         this.useScale = true;
     }
     else
     {
         if (Dedicator.isDedicated)
         {
             this._modelGameObject = (GameObject)bundle.load("Clip");
             if (this.modelGameObject == null && this.type != EObjectType.SMALL)
             {
                 Debug.LogError(this.objectName + " is missing collision data. Highly recommended to fix.");
             }
         }
         else
         {
             this._modelGameObject = (GameObject)bundle.load("Object");
             if (this.modelGameObject == null)
             {
                 throw new NotSupportedException("Missing object gameobject");
             }
             this._skyboxGameObject = (GameObject)bundle.load("Skybox");
         }
         if (this.modelGameObject != null)
         {
             if (Mathf.Abs(this.modelGameObject.transform.localScale.x - 1f) > 0.01f || Mathf.Abs(this.modelGameObject.transform.localScale.y - 1f) > 0.01f || Mathf.Abs(this.modelGameObject.transform.localScale.z - 1f) > 0.01f)
             {
                 this.useScale = false;
                 Assets.errors.Add(this.objectName + " should have a scale of one.");
             }
             else
             {
                 this.useScale = true;
             }
             Transform transform = this.modelGameObject.transform.FindChild("Block");
             if (transform != null && transform.GetComponent <Collider>() != null && transform.GetComponent <Collider>().sharedMaterial == null)
             {
                 Assets.errors.Add(this.objectName + " has a clip object but no physics material.");
             }
             Transform transform2 = this.modelGameObject.transform.FindChild("Model_0");
             if (this.type == EObjectType.SMALL)
             {
                 if (!this.modelGameObject.CompareTag("Small"))
                 {
                     Assets.errors.Add(this.objectName + " is set up as small, but is not tagged as small.");
                 }
                 if (this.modelGameObject.layer != LayerMasks.SMALL)
                 {
                     Assets.errors.Add(this.objectName + " is set up as small, but is not layered as small.");
                 }
                 if (transform2 != null)
                 {
                     if (!transform2.CompareTag("Small"))
                     {
                         Assets.errors.Add(this.objectName + " is set up as small, but is not tagged as small.");
                     }
                     if (transform2.gameObject.layer != LayerMasks.SMALL)
                     {
                         Assets.errors.Add(this.objectName + " is set up as small, but is not layered as small.");
                     }
                 }
             }
             else if (this.type == EObjectType.MEDIUM)
             {
                 if (!this.modelGameObject.CompareTag("Medium"))
                 {
                     Assets.errors.Add(this.objectName + " is set up as medium, but is not tagged as medium.");
                 }
                 if (this.modelGameObject.layer != LayerMasks.MEDIUM)
                 {
                     Assets.errors.Add(this.objectName + " is set up as medium, but is not layered as medium.");
                 }
                 if (transform2 != null)
                 {
                     if (!transform2.CompareTag("Medium"))
                     {
                         Assets.errors.Add(this.objectName + " is set up as medium, but is not tagged as medium.");
                     }
                     if (transform2.gameObject.layer != LayerMasks.MEDIUM)
                     {
                         Assets.errors.Add(this.objectName + " is set up as medium, but is not layered as medium.");
                     }
                 }
             }
             else if (this.type == EObjectType.LARGE)
             {
                 if (!this.modelGameObject.CompareTag("Large"))
                 {
                     Assets.errors.Add(this.objectName + " is set up as large, but is not tagged as large.");
                 }
                 if (this.modelGameObject.layer != LayerMasks.LARGE)
                 {
                     Assets.errors.Add(this.objectName + " is set up as large, but is not layered as large.");
                 }
                 if (transform2 != null)
                 {
                     if (!transform2.CompareTag("Large"))
                     {
                         Assets.errors.Add(this.objectName + " is set up as large, but is not tagged as large.");
                     }
                     if (transform2.gameObject.layer != LayerMasks.LARGE)
                     {
                         Assets.errors.Add(this.objectName + " is set up as large, but is not layered as large.");
                     }
                 }
             }
         }
         this._navGameObject = (GameObject)bundle.load("Nav");
         if (this.navGameObject == null && this.type == EObjectType.LARGE)
         {
             Assets.errors.Add(this.objectName + " is missing navigation data. Highly recommended to fix.");
         }
         if (this.navGameObject != null)
         {
             if (!this.navGameObject.CompareTag("Navmesh"))
             {
                 Assets.errors.Add(this.objectName + " is set up as navmesh, but is not tagged as navmesh.");
             }
             if (this.navGameObject.layer != LayerMasks.NAVMESH)
             {
                 Assets.errors.Add(this.objectName + " is set up as navmesh, but is not layered as navmesh.");
             }
         }
         this._slotsGameObject    = (GameObject)bundle.load("Slots");
         this._triggersGameObject = (GameObject)bundle.load("Triggers");
         this.isSnowshoe          = data.has("Snowshoe");
         if (data.has("Chart"))
         {
             this.chart = (EObjectChart)Enum.Parse(typeof(EObjectChart), data.readString("Chart"), true);
         }
         else
         {
             this.chart = EObjectChart.NONE;
         }
         this.isFuel               = data.has("Fuel");
         this.isRefill             = data.has("Refill");
         this.isSoft               = data.has("Soft");
         this.isCollisionImportant = data.has("Collision_Important");
         if (this.isFuel || this.isRefill)
         {
             Assets.errors.Add(this.objectName + " is using the legacy fuel/water system.");
         }
         if (data.has("LOD"))
         {
             this.lod     = (EObjectLOD)Enum.Parse(typeof(EObjectLOD), data.readString("LOD"), true);
             this.lodBias = data.readSingle("LOD_Bias");
             if (this.lodBias < 0.01f)
             {
                 this.lodBias = 1f;
             }
             this.lodCenter = data.readVector3("LOD_Center");
             this.lodSize   = data.readVector3("LOD_Size");
         }
         if (data.has("Interactability"))
         {
             this.interactability       = (EObjectInteractability)Enum.Parse(typeof(EObjectInteractability), data.readString("Interactability"), true);
             this.interactabilityRemote = data.has("Interactability_Remote");
             this.interactabilityDelay  = data.readSingle("Interactability_Delay");
             this.interactabilityReset  = data.readSingle("Interactability_Reset");
             if (data.has("Interactability_Hint"))
             {
                 this.interactabilityHint = (EObjectInteractabilityHint)Enum.Parse(typeof(EObjectInteractabilityHint), data.readString("Interactability_Hint"), true);
             }
             this.interactabilityEmission = data.has("Interactability_Emission");
             if (this.interactability == EObjectInteractability.NOTE)
             {
                 ushort        num4          = data.readUInt16("Interactability_Text_Lines");
                 StringBuilder stringBuilder = new StringBuilder();
                 for (ushort num5 = 0; num5 < num4; num5 += 1)
                 {
                     string value = localization.format("Interactability_Text_Line_" + num5);
                     stringBuilder.AppendLine(value);
                 }
                 this.interactabilityText = stringBuilder.ToString();
             }
             else
             {
                 this.interactabilityText = localization.read("Interact");
             }
             if (data.has("Interactability_Power"))
             {
                 this.interactabilityPower = (EObjectInteractabilityPower)Enum.Parse(typeof(EObjectInteractabilityPower), data.readString("Interactability_Power"), true);
             }
             else
             {
                 this.interactabilityPower = EObjectInteractabilityPower.NONE;
             }
             if (data.has("Interactability_Editor"))
             {
                 this.interactabilityEditor = (EObjectInteractabilityEditor)Enum.Parse(typeof(EObjectInteractabilityEditor), data.readString("Interactability_Editor"), true);
             }
             else
             {
                 this.interactabilityEditor = EObjectInteractabilityEditor.NONE;
             }
             if (data.has("Interactability_Nav"))
             {
                 this.interactabilityNav = (EObjectInteractabilityNav)Enum.Parse(typeof(EObjectInteractabilityNav), data.readString("Interactability_Nav"), true);
             }
             else
             {
                 this.interactabilityNav = EObjectInteractabilityNav.NONE;
             }
             this.interactabilityDrops = new ushort[(int)data.readByte("Interactability_Drops")];
             byte b = 0;
             while ((int)b < this.interactabilityDrops.Length)
             {
                 this.interactabilityDrops[(int)b] = data.readUInt16("Interactability_Drop_" + b);
                 b += 1;
             }
             this.interactabilityRewardID   = data.readUInt16("Interactability_Reward_ID");
             this.interactabilityEffect     = data.readUInt16("Interactability_Effect");
             this.interactabilityConditions = new INPCCondition[(int)data.readByte("Interactability_Conditions")];
             NPCTool.readConditions(data, localization, "Interactability_Condition_", this.interactabilityConditions);
             this.interactabilityRewards = new INPCReward[(int)data.readByte("Interactability_Rewards")];
             NPCTool.readRewards(data, localization, "Interactability_Reward_", this.interactabilityRewards);
             this.interactabilityResource      = data.readUInt16("Interactability_Resource");
             this.interactabilityResourceState = BitConverter.GetBytes(this.interactabilityResource);
         }
         else
         {
             this.interactability       = EObjectInteractability.NONE;
             this.interactabilityPower  = EObjectInteractabilityPower.NONE;
             this.interactabilityEditor = EObjectInteractabilityEditor.NONE;
         }
         if (this.interactability == EObjectInteractability.RUBBLE)
         {
             this.rubble               = EObjectRubble.DESTROY;
             this.rubbleReset          = data.readSingle("Interactability_Reset");
             this.rubbleHealth         = data.readUInt16("Interactability_Health");
             this.rubbleEffect         = data.readUInt16("Interactability_Effect");
             this.rubbleFinale         = data.readUInt16("Interactability_Finale");
             this.rubbleRewardID       = data.readUInt16("Interactability_Reward_ID");
             this.rubbleRewardXP       = data.readUInt32("Interactability_Reward_XP");
             this.rubbleIsVulnerable   = !data.has("Interactability_Invulnerable");
             this.rubbleProofExplosion = data.has("Interactability_Proof_Explosion");
         }
         else if (data.has("Rubble"))
         {
             this.rubble               = (EObjectRubble)Enum.Parse(typeof(EObjectRubble), data.readString("Rubble"), true);
             this.rubbleReset          = data.readSingle("Rubble_Reset");
             this.rubbleHealth         = data.readUInt16("Rubble_Health");
             this.rubbleEffect         = data.readUInt16("Rubble_Effect");
             this.rubbleFinale         = data.readUInt16("Rubble_Finale");
             this.rubbleRewardID       = data.readUInt16("Rubble_Reward_ID");
             this.rubbleRewardXP       = data.readUInt32("Rubble_Reward_XP");
             this.rubbleIsVulnerable   = !data.has("Rubble_Invulnerable");
             this.rubbleProofExplosion = data.has("Rubble_Proof_Explosion");
             if (data.has("Rubble_Editor"))
             {
                 this.rubbleEditor = (EObjectRubbleEditor)Enum.Parse(typeof(EObjectRubbleEditor), data.readString("Rubble_Editor"), true);
             }
             else
             {
                 this.rubbleEditor = EObjectRubbleEditor.ALIVE;
             }
         }
         if (data.has("Foliage"))
         {
             this.foliage = new AssetReference <FoliageInfoCollectionAsset>(new Guid(data.readString("Foliage")));
         }
         this.useWaterHeightTransparentSort = data.has("Use_Water_Height_Transparent_Sort");
         if (data.has("Material_Palette"))
         {
             this.materialPalette = new AssetReference <MaterialPaletteAsset>(data.readGUID("Material_Palette"));
         }
         if (data.has("Landmark_Quality"))
         {
             this.landmarkQuality = (EGraphicQuality)Enum.Parse(typeof(EGraphicQuality), data.readString("Landmark_Quality"), true);
         }
         else
         {
             this.landmarkQuality = EGraphicQuality.LOW;
         }
     }
     this.conditions = new INPCCondition[(int)data.readByte("Conditions")];
     NPCTool.readConditions(data, localization, "Condition_", this.conditions);
     bundle.unload();
 }
コード例 #23
0
ファイル: NPCTool.cs プロジェクト: sky-xk-nge/Unturned
        public static void readRewards(Data data, Local localization, string prefix, INPCReward[] rewards)
        {
            for (int i = 0; i < rewards.Length; i++)
            {
                if (!data.has(prefix + i + "_Type"))
                {
                    throw new NotSupportedException("Missing reward type");
                }
                ENPCRewardType enpcrewardType = (ENPCRewardType)Enum.Parse(typeof(ENPCRewardType), data.readString(prefix + i + "_Type"), true);
                string         text           = localization.read(prefix + i);
                text = ItemTool.filterRarityRichText(text);
                switch (enpcrewardType)
                {
                case ENPCRewardType.EXPERIENCE:
                    rewards[i] = new NPCExperienceReward(data.readUInt32(prefix + i + "_Value"), text);
                    break;

                case ENPCRewardType.REPUTATION:
                    rewards[i] = new NPCReputationReward(data.readInt32(prefix + i + "_Value"), text);
                    break;

                case ENPCRewardType.FLAG_BOOL:
                    rewards[i] = new NPCBoolFlagReward(data.readUInt16(prefix + i + "_ID"), data.readBoolean(prefix + i + "_Value"), text);
                    break;

                case ENPCRewardType.FLAG_SHORT:
                    rewards[i] = new NPCShortFlagReward(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), (ENPCModificationType)Enum.Parse(typeof(ENPCModificationType), data.readString(prefix + i + "_Modification"), true), text);
                    break;

                case ENPCRewardType.FLAG_SHORT_RANDOM:
                    rewards[i] = new NPCRandomShortFlagReward(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Min_Value"), data.readInt16(prefix + i + "_Max_Value"), (ENPCModificationType)Enum.Parse(typeof(ENPCModificationType), data.readString(prefix + i + "_Modification"), true), text);
                    break;

                case ENPCRewardType.QUEST:
                    rewards[i] = new NPCQuestReward(data.readUInt16(prefix + i + "_ID"), text);
                    break;

                case ENPCRewardType.ITEM:
                    rewards[i] = new NPCItemReward(data.readUInt16(prefix + i + "_ID"), data.readByte(prefix + i + "_Amount"), data.readUInt16(prefix + i + "_Sight"), data.readUInt16(prefix + i + "_Tactical"), data.readUInt16(prefix + i + "_Grip"), data.readUInt16(prefix + i + "_Barrel"), data.readUInt16(prefix + i + "_Magazine"), data.readByte(prefix + i + "_Ammo"), text);
                    break;

                case ENPCRewardType.ITEM_RANDOM:
                    rewards[i] = new NPCRandomItemReward(data.readUInt16(prefix + i + "_ID"), data.readByte(prefix + i + "_Amount"), text);
                    break;

                case ENPCRewardType.ACHIEVEMENT:
                    rewards[i] = new NPCAchievementReward(data.readString(prefix + i + "_ID"), text);
                    break;

                case ENPCRewardType.VEHICLE:
                    rewards[i] = new NPCVehicleReward(data.readUInt16(prefix + i + "_ID"), data.readString(prefix + i + "_Spawnpoint"), text);
                    break;

                case ENPCRewardType.TELEPORT:
                    rewards[i] = new NPCTeleportReward(data.readString(prefix + i + "_Spawnpoint"), text);
                    break;

                case ENPCRewardType.EVENT:
                    rewards[i] = new NPCEventReward(data.readString(prefix + i + "_ID"), text);
                    break;
                }
            }
        }
コード例 #24
0
        // Token: 0x060018FE RID: 6398 RVA: 0x0008CD50 File Offset: 0x0008B150
        public AnimalAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
        {
            if (id < 50 && !bundle.hasResource && !data.has("Bypass_ID_Limit"))
            {
                throw new NotSupportedException("ID < 50");
            }
            this._animalName = localization.format("Name");
            this._client     = (GameObject)bundle.load("Animal_Client");
            this._server     = (GameObject)bundle.load("Animal_Server");
            this._dedicated  = (GameObject)bundle.load("Animal_Dedicated");
            this._ragdoll    = (GameObject)bundle.load("Ragdoll");
            if (this.client == null)
            {
                Assets.errors.Add(this.animalName + " is missing client data. Highly recommended to fix.");
            }
            if (this.server == null)
            {
                Assets.errors.Add(this.animalName + " is missing server data. Highly recommended to fix.");
            }
            if (this.dedicated == null)
            {
                Assets.errors.Add(this.animalName + " is missing dedicated data. Highly recommended to fix.");
            }
            if (this.ragdoll == null)
            {
                Assets.errors.Add(this.animalName + " is missing ragdoll data. Highly recommended to fix.");
            }
            this._speedRun  = data.readSingle("Speed_Run");
            this._speedWalk = data.readSingle("Speed_Walk");
            this._behaviour = (EAnimalBehaviour)Enum.Parse(typeof(EAnimalBehaviour), data.readString("Behaviour"), true);
            this._health    = data.readUInt16("Health");
            this._regen     = data.readSingle("Regen");
            if (!data.has("Regen"))
            {
                this._regen = 10f;
            }
            this._damage   = data.readByte("Damage");
            this._meat     = data.readUInt16("Meat");
            this._pelt     = data.readUInt16("Pelt");
            this._rewardID = data.readUInt16("Reward_ID");
            if (data.has("Reward_Min"))
            {
                this._rewardMin = data.readByte("Reward_Min");
            }
            else
            {
                this._rewardMin = 3;
            }
            if (data.has("Reward_Max"))
            {
                this._rewardMax = data.readByte("Reward_Max");
            }
            else
            {
                this._rewardMax = 4;
            }
            this._roars = new AudioClip[(int)data.readByte("Roars")];
            byte b = 0;

            while ((int)b < this.roars.Length)
            {
                this.roars[(int)b] = (AudioClip)bundle.load("Roar_" + b);
                b += 1;
            }
            this._panics = new AudioClip[(int)data.readByte("Panics")];
            byte b2 = 0;

            while ((int)b2 < this.panics.Length)
            {
                this.panics[(int)b2] = (AudioClip)bundle.load("Panic_" + b2);
                b2 += 1;
            }
            this._rewardXP = data.readUInt32("Reward_XP");
            bundle.unload();
        }
コード例 #25
0
 public ItemLibraryAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._capacity = data.readUInt32("Capacity");
     this._tax      = data.readByte("Tax");
 }
コード例 #26
0
        // Token: 0x06003448 RID: 13384 RVA: 0x00155AC4 File Offset: 0x00153EC4
        public static void readRewards(Data data, Local localization, string prefix, INPCReward[] rewards, string errorMessageSource)
        {
            for (int i = 0; i < rewards.Length; i++)
            {
                if (!data.has(prefix + i + "_Type"))
                {
                    Assets.errors.Add(string.Concat(new object[]
                    {
                        "Missing ",
                        prefix,
                        i,
                        " reward type"
                    }));
                    throw new NotSupportedException(string.Concat(new object[]
                    {
                        "Missing ",
                        prefix,
                        i,
                        " reward type"
                    }));
                }
                ENPCRewardType enpcrewardType = (ENPCRewardType)Enum.Parse(typeof(ENPCRewardType), data.readString(prefix + i + "_Type"), true);
                string         text           = localization.read(prefix + i);
                text = ItemTool.filterRarityRichText(text);
                switch (enpcrewardType)
                {
                case ENPCRewardType.EXPERIENCE:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Experience reward ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCExperienceReward(data.readUInt32(prefix + i + "_Value"), text);
                    break;

                case ENPCRewardType.REPUTATION:
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Reputation reward ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCReputationReward(data.readInt32(prefix + i + "_Value"), text);
                    break;

                case ENPCRewardType.FLAG_BOOL:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Bool flag reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Bool flag reward ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCBoolFlagReward(data.readUInt16(prefix + i + "_ID"), data.readBoolean(prefix + i + "_Value"), text);
                    break;

                case ENPCRewardType.FLAG_SHORT:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Short flag reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Short flag reward ",
                            prefix,
                            i,
                            " missing _Value in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCShortFlagReward(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), (ENPCModificationType)Enum.Parse(typeof(ENPCModificationType), data.readString(prefix + i + "_Modification"), true), text);
                    break;

                case ENPCRewardType.FLAG_SHORT_RANDOM:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Random short flag reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Min_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Random short flag reward ",
                            prefix,
                            i,
                            " missing _Min_Value in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Max_Value"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Random short flag reward ",
                            prefix,
                            i,
                            " missing _Max_Value in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCRandomShortFlagReward(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Min_Value"), data.readInt16(prefix + i + "_Max_Value"), (ENPCModificationType)Enum.Parse(typeof(ENPCModificationType), data.readString(prefix + i + "_Modification"), true), text);
                    break;

                case ENPCRewardType.QUEST:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Quest reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCQuestReward(data.readUInt16(prefix + i + "_ID"), text);
                    break;

                case ENPCRewardType.ITEM:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Item reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Amount"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Item reward ",
                            prefix,
                            i,
                            " missing _Amount in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCItemReward(data.readUInt16(prefix + i + "_ID"), data.readByte(prefix + i + "_Amount"), data.readUInt16(prefix + i + "_Sight"), data.readUInt16(prefix + i + "_Tactical"), data.readUInt16(prefix + i + "_Grip"), data.readUInt16(prefix + i + "_Barrel"), data.readUInt16(prefix + i + "_Magazine"), data.readByte(prefix + i + "_Ammo"), text);
                    break;

                case ENPCRewardType.ITEM_RANDOM:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Random item reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Amount"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Random item reward ",
                            prefix,
                            i,
                            " missing _Amount in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCRandomItemReward(data.readUInt16(prefix + i + "_ID"), data.readByte(prefix + i + "_Amount"), text);
                    break;

                case ENPCRewardType.ACHIEVEMENT:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Achievement reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCAchievementReward(data.readString(prefix + i + "_ID"), text);
                    break;

                case ENPCRewardType.VEHICLE:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Vehicle reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_Spawnpoint"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Vehicle reward ",
                            prefix,
                            i,
                            " missing _Spawnpoint in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCVehicleReward(data.readUInt16(prefix + i + "_ID"), data.readString(prefix + i + "_Spawnpoint"), text);
                    break;

                case ENPCRewardType.TELEPORT:
                    if (!data.has(prefix + i + "_Spawnpoint"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Teleport reward ",
                            prefix,
                            i,
                            " missing _Spawnpoint in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCTeleportReward(data.readString(prefix + i + "_Spawnpoint"), text);
                    break;

                case ENPCRewardType.EVENT:
                    if (!data.has(prefix + i + "_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Event reward ",
                            prefix,
                            i,
                            " missing _ID in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCEventReward(data.readString(prefix + i + "_ID"), text);
                    break;

                case ENPCRewardType.FLAG_MATH:
                    if (!data.has(prefix + i + "_A_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Math reward ",
                            prefix,
                            i,
                            " missing _A_ID in: ",
                            errorMessageSource
                        }));
                    }
                    if (!data.has(prefix + i + "_B_ID"))
                    {
                        Assets.errors.Add(string.Concat(new object[]
                        {
                            "Math reward ",
                            prefix,
                            i,
                            " missing _B_ID in: ",
                            errorMessageSource
                        }));
                    }
                    rewards[i] = new NPCFlagMathReward(data.readUInt16(prefix + i + "_A_ID"), data.readUInt16(prefix + i + "_B_ID"), (ENPCOperationType)Enum.Parse(typeof(ENPCOperationType), data.readString(prefix + i + "_Operation"), true), text);
                    break;
                }
            }
        }
コード例 #27
0
        // Token: 0x06001A26 RID: 6694 RVA: 0x00092038 File Offset: 0x00090438
        public ItemAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
        {
            this.isPro = data.has("Pro");
            if (id < 2000 && !bundle.hasResource && !this.isPro && !data.has("Bypass_ID_Limit"))
            {
                throw new NotSupportedException("ID < 2000");
            }
            if (!this.isPro)
            {
                this._itemName        = localization.format("Name");
                this._itemDescription = localization.format("Description");
                this._itemDescription = ItemTool.filterRarityRichText(this.itemDescription);
            }
            this.type = (EItemType)Enum.Parse(typeof(EItemType), data.readString("Type"), true);
            if (data.has("Rarity"))
            {
                this.rarity = (EItemRarity)Enum.Parse(typeof(EItemRarity), data.readString("Rarity"), true);
            }
            else
            {
                this.rarity = EItemRarity.COMMON;
            }
            if (this.isPro)
            {
                if (this.type == EItemType.SHIRT)
                {
                    this._proPath = "/Shirts";
                }
                else if (this.type == EItemType.PANTS)
                {
                    this._proPath = "/Pants";
                }
                else if (this.type == EItemType.HAT)
                {
                    this._proPath = "/Hats";
                }
                else if (this.type == EItemType.BACKPACK)
                {
                    this._proPath = "/Backpacks";
                }
                else if (this.type == EItemType.VEST)
                {
                    this._proPath = "/Vests";
                }
                else if (this.type == EItemType.MASK)
                {
                    this._proPath = "/Masks";
                }
                else if (this.type == EItemType.GLASSES)
                {
                    this._proPath = "/Glasses";
                }
                else if (this.type == EItemType.KEY)
                {
                    this._proPath = "/Keys";
                }
                else if (this.type == EItemType.BOX)
                {
                    this._proPath = "/Boxes";
                }
                this._proPath = this._proPath + "/" + this.name;
            }
            this.size_x = data.readByte("Size_X");
            if (this.size_x < 1)
            {
                this.size_x = 1;
            }
            this.size_y = data.readByte("Size_Y");
            if (this.size_y < 1)
            {
                this.size_y = 1;
            }
            this.size_z  = data.readSingle("Size_Z");
            this.size2_z = data.readSingle("Size2_Z");
            this.amount  = data.readByte("Amount");
            if (this.amount < 1)
            {
                this.amount = 1;
            }
            this.countMin = data.readByte("Count_Min");
            if (this.countMin < 1)
            {
                this.countMin = 1;
            }
            this.countMax = data.readByte("Count_Max");
            if (this.countMax < 1)
            {
                this.countMax = 1;
            }
            if (data.has("Quality_Min"))
            {
                this.qualityMin = data.readByte("Quality_Min");
            }
            else
            {
                this.qualityMin = 10;
            }
            if (data.has("Quality_Max"))
            {
                this.qualityMax = data.readByte("Quality_Max");
            }
            else
            {
                this.qualityMax = 90;
            }
            this.isBackward = data.has("Backward");
            this.useable    = data.readString("Useable");
            this.isUseable  = !string.IsNullOrEmpty(this.useable);
            if (this.isUseable)
            {
                this._equip = (AudioClip)bundle.load("Equip");
                if (!this.isPro)
                {
                    GameObject gameObject = (GameObject)bundle.load("Animations");
                    if (gameObject != null)
                    {
                        Animation component = gameObject.GetComponent <Animation>();
                        this._animations = new AnimationClip[component.GetClipCount()];
                        int         num        = 0;
                        IEnumerator enumerator = component.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                object         obj            = enumerator.Current;
                                AnimationState animationState = (AnimationState)obj;
                                this.animations[num] = animationState.clip;
                                num++;
                            }
                        }
                        finally
                        {
                            IDisposable disposable;
                            if ((disposable = (enumerator as IDisposable)) != null)
                            {
                                disposable.Dispose();
                            }
                        }
                    }
                    else
                    {
                        this._animations = new AnimationClip[0];
                    }
                }
            }
            string text = data.readString("Slot");

            if (text == null)
            {
                this.slot = ESlotType.NONE;
            }
            else
            {
                this.slot = (ESlotType)Enum.Parse(typeof(ESlotType), text, true);
            }
            if (!Dedicator.isDedicated || this.type == EItemType.GUN || this.type == EItemType.MELEE)
            {
                this._item = (GameObject)bundle.load("Item");
                if (this.item == null)
                {
                    throw new NotSupportedException("Missing item gameobject");
                }
                if (this.item.transform.FindChild("Icon") != null && this.item.transform.FindChild("Icon").GetComponent <Camera>() != null)
                {
                    Assets.errors.Add(this.itemName + " icon has a camera attached!");
                }
                if (id < 2000 && (this.type == EItemType.GUN || this.type == EItemType.MELEE) && this.item.transform.FindChild("Stat_Tracker") == null)
                {
                    Assets.errors.Add(this.itemName + " missing stat tracker hook!");
                }
            }
            byte b  = data.readByte("Blueprints");
            byte b2 = data.readByte("Actions");

            this._blueprints = new List <Blueprint>((int)b);
            this._actions    = new List <Action>((int)b2);
            for (byte b3 = 0; b3 < b; b3 += 1)
            {
                if (!data.has("Blueprint_" + b3 + "_Type"))
                {
                    throw new NotSupportedException("Missing blueprint type");
                }
                EBlueprintType newType = (EBlueprintType)Enum.Parse(typeof(EBlueprintType), data.readString("Blueprint_" + b3 + "_Type"), true);
                byte           b4      = data.readByte("Blueprint_" + b3 + "_Supplies");
                if (b4 < 1)
                {
                    b4 = 1;
                }
                BlueprintSupply[] array = new BlueprintSupply[(int)b4];
                byte b5 = 0;
                while ((int)b5 < array.Length)
                {
                    ushort newID = data.readUInt16(string.Concat(new object[]
                    {
                        "Blueprint_",
                        b3,
                        "_Supply_",
                        b5,
                        "_ID"
                    }));
                    bool newCritical = data.has(string.Concat(new object[]
                    {
                        "Blueprint_",
                        b3,
                        "_Supply_",
                        b5,
                        "_Critical"
                    }));
                    byte b6 = data.readByte(string.Concat(new object[]
                    {
                        "Blueprint_",
                        b3,
                        "_Supply_",
                        b5,
                        "_Amount"
                    }));
                    if (b6 < 1)
                    {
                        b6 = 1;
                    }
                    array[(int)b5] = new BlueprintSupply(newID, newCritical, b6);
                    b5            += 1;
                }
                byte b7 = data.readByte("Blueprint_" + b3 + "_Outputs");
                BlueprintOutput[] array2;
                if (b7 > 0)
                {
                    array2 = new BlueprintOutput[(int)b7];
                    byte b8 = 0;
                    while ((int)b8 < array2.Length)
                    {
                        ushort newID2 = data.readUInt16(string.Concat(new object[]
                        {
                            "Blueprint_",
                            b3,
                            "_Output_",
                            b8,
                            "_ID"
                        }));
                        byte b9 = data.readByte(string.Concat(new object[]
                        {
                            "Blueprint_",
                            b3,
                            "_Output_",
                            b8,
                            "_Amount"
                        }));
                        if (b9 < 1)
                        {
                            b9 = 1;
                        }
                        array2[(int)b8] = new BlueprintOutput(newID2, b9);
                        b8 += 1;
                    }
                }
                else
                {
                    array2 = new BlueprintOutput[1];
                    ushort num2 = data.readUInt16("Blueprint_" + b3 + "_Product");
                    if (num2 == 0)
                    {
                        num2 = id;
                    }
                    byte b10 = data.readByte("Blueprint_" + b3 + "_Products");
                    if (b10 < 1)
                    {
                        b10 = 1;
                    }
                    array2[0] = new BlueprintOutput(num2, b10);
                }
                ushort          newTool         = data.readUInt16("Blueprint_" + b3 + "_Tool");
                bool            newToolCritical = data.has("Blueprint_" + b3 + "_Tool_Critical");
                ushort          newBuild        = data.readUInt16("Blueprint_" + b3 + "_Build");
                byte            b11             = data.readByte("Blueprint_" + b3 + "_Level");
                EBlueprintSkill newSkill        = EBlueprintSkill.NONE;
                if (b11 > 0)
                {
                    newSkill = (EBlueprintSkill)Enum.Parse(typeof(EBlueprintSkill), data.readString("Blueprint_" + b3 + "_Skill"), true);
                }
                bool            newTransferState = data.has("Blueprint_" + b3 + "_State_Transfer");
                string          newMap           = data.readString("Blueprint_" + b3 + "_Map");
                INPCCondition[] array3           = new INPCCondition[(int)data.readByte("Blueprint_" + b3 + "_Conditions")];
                NPCTool.readConditions(data, localization, "Blueprint_" + b3 + "_Condition_", array3, string.Concat(new object[]
                {
                    "item ",
                    id,
                    " blueprint ",
                    b3
                }));
                INPCReward[] array4 = new INPCReward[(int)data.readByte("Blueprint_" + b3 + "_Rewards")];
                NPCTool.readRewards(data, localization, "Blueprint_" + b3 + "_Reward_", array4, string.Concat(new object[]
                {
                    "item ",
                    id,
                    " blueprint ",
                    b3
                }));
                this.blueprints.Add(new Blueprint(id, b3, newType, array, array2, newTool, newToolCritical, newBuild, b11, newSkill, newTransferState, newMap, array3, array4));
            }
            for (byte b12 = 0; b12 < b2; b12 += 1)
            {
                if (!data.has("Action_" + b12 + "_Type"))
                {
                    throw new NotSupportedException("Missing action type");
                }
                EActionType newType2 = (EActionType)Enum.Parse(typeof(EActionType), data.readString("Action_" + b12 + "_Type"), true);
                byte        b13      = data.readByte("Action_" + b12 + "_Blueprints");
                if (b13 < 1)
                {
                    b13 = 1;
                }
                ActionBlueprint[] array5 = new ActionBlueprint[(int)b13];
                byte b14 = 0;
                while ((int)b14 < array5.Length)
                {
                    byte newID3 = data.readByte(string.Concat(new object[]
                    {
                        "Action_",
                        b12,
                        "_Blueprint_",
                        b14,
                        "_Index"
                    }));
                    bool newLink = data.has(string.Concat(new object[]
                    {
                        "Action_",
                        b12,
                        "_Blueprint_",
                        b14,
                        "_Link"
                    }));
                    array5[(int)b14] = new ActionBlueprint(newID3, newLink);
                    b14 += 1;
                }
                string newText    = data.readString("Action_" + b12 + "_Text");
                string newTooltip = data.readString("Action_" + b12 + "_Tooltip");
                string newKey     = data.readString("Action_" + b12 + "_Key");
                ushort num3       = data.readUInt16("Action_" + b12 + "_Source");
                if (num3 == 0)
                {
                    num3 = id;
                }
                this.actions.Add(new Action(num3, newType2, array5, newText, newTooltip, newKey));
            }
            if (b2 == 0)
            {
                bool flag = false;
                byte b15  = 0;
                while ((int)b15 < this.blueprints.Count)
                {
                    Blueprint blueprint = this.blueprints[(int)b15];
                    if (blueprint.type == EBlueprintType.REPAIR)
                    {
                        Action item = new Action(id, EActionType.BLUEPRINT, new ActionBlueprint[]
                        {
                            new ActionBlueprint(b15, true)
                        }, null, null, "Repair");
                        this.actions.Insert(0, item);
                    }
                    else if (blueprint.type == EBlueprintType.AMMO)
                    {
                        flag = true;
                    }
                    else if (blueprint.supplies.Length == 1 && blueprint.supplies[0].id == id)
                    {
                        Action item2 = new Action(id, EActionType.BLUEPRINT, new ActionBlueprint[]
                        {
                            new ActionBlueprint(b15, this.type == EItemType.GUN || this.type == EItemType.MELEE)
                        }, null, null, "Salvage");
                        this.actions.Add(item2);
                    }
                    b15 += 1;
                }
                if (flag)
                {
                    List <ActionBlueprint> list = new List <ActionBlueprint>();
                    byte b16 = 0;
                    while ((int)b16 < this.blueprints.Count)
                    {
                        Blueprint blueprint2 = this.blueprints[(int)b16];
                        if (blueprint2.type == EBlueprintType.AMMO)
                        {
                            ActionBlueprint item3 = new ActionBlueprint(b16, true);
                            list.Add(item3);
                        }
                        b16 += 1;
                    }
                    Action item4 = new Action(id, EActionType.BLUEPRINT, list.ToArray(), null, null, "Refill");
                    this.actions.Add(item4);
                }
            }
            this._shouldVerifyHash   = !data.has("Bypass_Hash_Verification");
            this.overrideShowQuality = data.has("Override_Show_Quality");
            if (!Dedicator.isDedicated)
            {
                this._albedoBase   = (Texture2D)bundle.load("Albedo_Base");
                this._metallicBase = (Texture2D)bundle.load("Metallic_Base");
                this._emissionBase = (Texture2D)bundle.load("Emission_Base");
            }
        }
コード例 #28
0
ファイル: NPCTool.cs プロジェクト: sky-xk-nge/Unturned
        public static void readConditions(Data data, Local localization, string prefix, INPCCondition[] conditions)
        {
            for (int i = 0; i < conditions.Length; i++)
            {
                if (!data.has(prefix + i + "_Type"))
                {
                    throw new NotSupportedException("Missing condition type");
                }
                ENPCConditionType enpcconditionType = (ENPCConditionType)Enum.Parse(typeof(ENPCConditionType), data.readString(prefix + i + "_Type"), true);
                string            text = localization.read(prefix + i);
                text = ItemTool.filterRarityRichText(text);
                bool          newShouldReset = data.has(prefix + i + "_Reset");
                ENPCLogicType newLogicType   = ENPCLogicType.NONE;
                if (data.has(prefix + i + "_Logic"))
                {
                    newLogicType = (ENPCLogicType)Enum.Parse(typeof(ENPCLogicType), data.readString(prefix + i + "_Logic"), true);
                }
                switch (enpcconditionType)
                {
                case ENPCConditionType.EXPERIENCE:
                    conditions[i] = new NPCExperienceCondition(data.readUInt32(prefix + i + "_Value"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.REPUTATION:
                    conditions[i] = new NPCReputationCondition(data.readInt32(prefix + i + "_Value"), newLogicType, text);
                    break;

                case ENPCConditionType.FLAG_BOOL:
                    conditions[i] = new NPCBoolFlagCondition(data.readUInt16(prefix + i + "_ID"), data.readBoolean(prefix + i + "_Value"), data.has(prefix + i + "_Allow_Unset"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.FLAG_SHORT:
                    conditions[i] = new NPCShortFlagCondition(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), data.has(prefix + i + "_Allow_Unset"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.QUEST:
                    conditions[i] = new NPCQuestCondition(data.readUInt16(prefix + i + "_ID"), (ENPCQuestStatus)Enum.Parse(typeof(ENPCQuestStatus), data.readString(prefix + i + "_Status"), true), data.has(prefix + i + "_Ignore_NPC"), newLogicType, text, newShouldReset);
                    break;

                case ENPCConditionType.SKILLSET:
                    conditions[i] = new NPCSkillsetCondition((EPlayerSkillset)Enum.Parse(typeof(EPlayerSkillset), data.readString(prefix + i + "_Value"), true), newLogicType, text);
                    break;

                case ENPCConditionType.ITEM:
                    conditions[i] = new NPCItemCondition(data.readUInt16(prefix + i + "_ID"), data.readUInt16(prefix + i + "_Amount"), text, newShouldReset);
                    break;

                case ENPCConditionType.KILLS_ZOMBIE:
                {
                    EZombieSpeciality newZombie = EZombieSpeciality.NONE;
                    if (data.has(prefix + i + "_Zombie"))
                    {
                        newZombie = (EZombieSpeciality)Enum.Parse(typeof(EZombieSpeciality), data.readString(prefix + i + "_Zombie"), true);
                    }
                    conditions[i] = new NPCZombieKillsCondition(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), newZombie, data.has(prefix + i + "_Spawn"), data.readByte(prefix + i + "_Nav"), text, newShouldReset);
                    break;
                }

                case ENPCConditionType.KILLS_HORDE:
                    conditions[i] = new NPCHordeKillsCondition(data.readUInt16(prefix + i + "_ID"), data.readInt16(prefix + i + "_Value"), data.readByte(prefix + i + "_Nav"), text, newShouldReset);
                    break;
                }
            }
        }