// 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();
        }
Esempio n. 2
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);
 }
Esempio n. 3
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();
        }
Esempio n. 4
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();
 }
Esempio n. 5
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();
 }
Esempio n. 6
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");
 }
Esempio n. 7
0
 public ItemFarmAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
 {
     this._growth = data.readUInt32("Growth");
     this._grow   = data.readUInt16("Grow");
 }
Esempio n. 8
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;
                }
            }
        }
Esempio n. 9
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;
                }
            }
        }
Esempio n. 10
0
        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;
                }
            }
        }
Esempio n. 11
0
        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;
                }
            }
        }