public ArkTribeProfile(string pathname, ArkWorld world) { //Set values linkedWorld = world; //Open inline file var indes = new Deserializer.Inline.InlineFileDeserializer(); source = indes.ReadInlineFile(pathname); //Grab tribe data struct. var tribeData = (InlineStructProperty)source.props[0]; tribeDataStruct = (InlineStructProperty.ArkStructInlineProps)tribeData.data; //Grab data InlineProperty temp; temp = GetPropertyByName("TribeName"); if (temp != null) { tribeName = ((InlineStrProperty)temp).value; } temp = GetPropertyByName("OwnerPlayerDataID"); if (temp != null) { tribeOwnerId = ((InlineUInt32Property)temp).value; } temp = GetPropertyByName("TribeID"); if (temp != null) { tribeId = ((InlineIntProperty)temp).value; } }
/// <summary> /// Loads from a GameObject /// </summary> /// <returns></returns> public static ArkInventory LoadFromAsset(ArkWorld world, DotArkGameObject r) { //Get a list of all items List <ObjectProperty> inventoryItems; if (!r.PropExistsName("InventoryItems")) { inventoryItems = new List <ObjectProperty>(); } else { inventoryItems = ((ArrayProperty <ObjectProperty>)r.GetPropsByName("InventoryItems")[0]).items; } //Now, loop through and create items ArkInventory inventory = new ArkInventory(); inventory.items = new List <ArkPrimalItem>(); foreach (var o in inventoryItems) { ArkPrimalItem item = new ArkPrimalItem(world, o.gameObjectRef); if (item.isEngram) { continue; } inventory.items.Add(item); } //Return return(inventory); }
static void Main(string[] args) { Console.WriteLine("Loading..."); ArkImports.ImportContent("imports\\"); ArkWorld world = new ArkWorld("save\\", "Extinction", @"C:\Program Files (x86)\Steam\steamapps\common\ARK\ShooterGame\SavedV\Config\WindowsServer\", null, true); Console.WriteLine("World loaded."); RunTestNamed(world, "Blake", "Yutyrannus", 2300.8f, 3091.2f, 4200f, 644.8f); RunTestNamed(world, "Kato", "Rock Drake", 2268.8f, 1578.4f, 3120f, 642.8f); Console.WriteLine("Tests completed."); Console.ReadLine(); }
static void RunTestNamed(ArkWorld w, string name, string species, float expectedHealth, float expectedStamina, float expectedFood, float expectedWeight) { //Find ArkDinosaur dino = null; foreach (ArkDinosaur d in w.dinos) { if (d.dino_entry == null) { continue; } if (d.dino_entry.screen_name == species && name == d.tamedName) { dino = d; } } RunTest(dino, expectedHealth, expectedStamina, expectedFood, expectedWeight); }
public ArkPlayer(ArkWorld world, DotArkGameObject orig) : base(world, orig) { playerName = GetStringProperty("PlayerName"); steamName = GetStringProperty("PlatformProfileName"); arkId = GetUInt64Property("LinkedPlayerDataID"); //Read the struct containing Steam ID StructProperty sprop = (StructProperty)GetSingleProperty("PlatformProfileID"); ArkStructUniqueNetId nsprop = (ArkStructUniqueNetId)sprop.structData; steamId = nsprop.netId; //Tribe stuff if (HasProperty("TribeName")) { tribeName = GetStringProperty("TribeName"); tribeId = GetInt32Property("TargetingTeam"); isInTribe = true; } else { tribeName = "No Tribe"; tribeId = -1; isInTribe = false; } //Check if alive try { HighLevelArkGameObjectRef statusComponent = GetGameObjectRef("MyCharacterStatusComponent"); currentStats = ArkDinosaurStats.ReadStats(statusComponent, "CurrentStatusValues", false); isAlive = currentStats.health > 0.1f; } catch { isAlive = false; } }
public ArkStructure(ArkWorld world, DotArkGameObject orig, StructureDisplayMetadata displayMetadata) : base(world, orig) { tribeId = GetInt32Property("TargetingTeam"); isInTribe = true; hasInventory = HasProperty("MyInventoryComponent"); this.displayMetadata = displayMetadata; if (HasProperty("CurrentItemCount")) { currentItemCount = GetInt32Property("CurrentItemCount"); } if (HasProperty("MaxItemCount")) { currentItemCount = GetInt32Property("MaxItemCount"); } if (HasProperty("Health")) { currentHealth = GetFloatProperty("Health"); } if (HasProperty("MaxHealth")) { maxHealth = GetFloatProperty("MaxHealth"); } }
/// <summary> /// Loads from a reference /// </summary> /// <returns></returns> public static ArkInventory LoadFromReference(ArkWorld world, ObjectProperty r) { return(LoadFromAsset(world, r.gameObjectRef)); }
public ArkDinosaur(ArkWorld world, DotArkGameObject orig) : base(world, orig) { //Grab the data and save it here. //Get the other components of this dinosaur. HighLevelArkGameObjectRef statusComponent = GetGameObjectRef("MyCharacterStatusComponent"); //Check if this dinosaur is tamed. isTamed = CheckIfValueExists("TamedName") && CheckIfValueExists("TribeName") && CheckIfValueExists("TargetingTeam"); //Grab the values that will exist on both tamed and untamed dinosaurs. isFemale = GetBooleanProperty("bIsFemale"); //Convert the colors into a byte array and hex. var colorAttrib = GetPropertiesByName("ColorSetIndices"); //Get all of the color properties from the dinosaur. These are indexes in the color table. colors = new byte[colorAttrib.Length]; //Initialize the array for storing the indexes. These will be saved to the file. colors_hex = new string[colorAttrib.Length]; //Initialize the array for reading nice HTML color values. for (int i = 0; i < colors.Length; i++) //For each color region this dinosaur has. Each "ColorSetIndices" value is a color region. { colors[i] = ((ByteProperty)colorAttrib[i]).byteValue; //Get the index in the color table by getting the byte value out of the property //Validate that the color is in range byte color = colors[i]; if (color <= 0 || color > ArkColorIds.ARK_COLOR_IDS.Length) { colors_hex[i] = "#FFF"; } else { colors_hex[i] = ArkColorIds.ARK_COLOR_IDS[colors[i] - 1]; //Look this up in the color table to get the nice HTML value. } } //Read the dinosaur ID by combining the the bytes of the two UInt32 values. byte[] buf = new byte[8]; BitConverter.GetBytes(GetUInt32Property("DinoID1")).CopyTo(buf, 0); BitConverter.GetBytes(GetUInt32Property("DinoID2")).CopyTo(buf, 4); //Convert this to a ulong dinosaurId = BitConverter.ToUInt64(buf, 0); //Read in levels currentStats = ArkDinosaurStats.ReadStats(statusComponent, "CurrentStatusValues", false); baseLevelupsApplied = ArkDinosaurStats.ReadStats(statusComponent, "NumberOfLevelUpPointsApplied", true); baseLevel = 1; if (statusComponent.CheckIfValueExists("BaseCharacterLevel")) { baseLevel = statusComponent.GetInt32Property("BaseCharacterLevel"); } level = baseLevel; //Now, convert attributes that only exist on tamed dinosaurs. isInTribe = isTamed; if (isTamed) { tamedName = GetStringProperty("TamedName"); tribeId = GetInt32Property("TargetingTeam"); tamerName = GetStringProperty("TribeName"); tamedLevelupsApplied = ArkDinosaurStats.ReadStats(statusComponent, "NumberOfLevelUpPointsAppliedTamed", true); if (statusComponent.CheckIfValueExists("ExtraCharacterLevel")) { level += statusComponent.GetUInt16Property("ExtraCharacterLevel"); } if (statusComponent.HasProperty("ExperiencePoints")) { experience = statusComponent.GetFloatProperty("ExperiencePoints"); } else { experience = 0; } isBaby = GetBooleanProperty("bIsBaby"); if (isBaby) { babyAge = GetFloatProperty("BabyAge"); nextImprintTime = -1; if (HasProperty("BabyNextCuddleTime")) { nextImprintTime = GetDoubleProperty("BabyNextCuddleTime"); } if (statusComponent.HasProperty("DinoImprintingQuality")) { imprintQuality = statusComponent.GetFloatProperty("DinoImprintingQuality"); } else { imprintQuality = 0; } } } //Get the dino entry data dino_entry = ArkImports.GetDinoDataByClassname(classname.classname); isInit = true; }
public ArkPrimalItem(ArkWorld world, DotArkGameObject orig) : base(world, orig) { //Check if this is claimed not to be an item if (!isItem) { throw new Exception("Cannot read ArkPrimalItem when property 'isItem' is false!"); } //Read in values. Start with values that will never be null classname = orig.classname.classname; stackSize = 1; if (orig.PropExistsName("ItemQuantity")) { stackSize = (int)orig.GetPropByName("ItemQuantity").data; } owner = new HighLevelArkGameObjectRef(world, (orig.GetPropsByName <ObjectProperty>("OwnerInventory")[0]).gameObjectRef); //Convert ItemID ArkStructProps itemIdStruct = (ArkStructProps)orig.GetPropsByName <StructProperty>("ItemId")[0].structData; byte[] buf = new byte[8]; BitConverter.GetBytes((UInt32)itemIdStruct.props_string["ItemID1"].data).CopyTo(buf, 0); BitConverter.GetBytes((UInt32)itemIdStruct.props_string["ItemID2"].data).CopyTo(buf, 4); itemId = BitConverter.ToUInt64(buf, 0); //Read booleans isBlueprint = GetBooleanProperty("bIsBlueprint"); isEngram = GetBooleanProperty("bIsEngram"); //Read props that may not exist if (CheckIfValueExists("SavedDurability")) { savedDurability = GetFloatProperty("SavedDurability"); } else { savedDurability = 1; } if (CheckIfValueExists("CrafterCharacterName")) { crafterName = GetStringProperty("CrafterCharacterName"); } else { crafterName = null; } if (CheckIfValueExists("CrafterTribeName")) { crafterTribe = GetStringProperty("CrafterTribeName"); } else { crafterTribe = null; } if (CheckIfValueExists("LastAutoDurabilityDecreaseTime")) { lastDurabilityDecreaseTime = (double)orig.GetPropsByName <DoubleProperty>("LastAutoDurabilityDecreaseTime")[0].data; } else { lastDurabilityDecreaseTime = -1; } }
public ArkCharacter(ArkWorld world, DotArkGameObject orig) : base(world, orig) { }