public Gather CreateGather(GSpawnTemplate gSpawn) { var gather = new Gather { Id = gSpawn.CollectionId, Position = new WorldPosition { MapId = gSpawn.WorldPosition.MapId, X = gSpawn.WorldPosition.X, Y = gSpawn.WorldPosition.Y, Z = gSpawn.WorldPosition.Z + 10, }, CurrentGatherCounter = new Random().Next(1, 3), //todo gather counter }; AiLogic.InitAi(gather); return gather; }
private static void ParseSpawn() { GatherSpawnTemplates = new List<GSpawnTemplate>(); foreach (var dcObject in DC.GetMainObjectsByName("StrSheet_CollectionLoc")) { foreach (var data in (List<Dictionary<string, object>>)DC.GetValues(dcObject)["String"]) { int templateId = int.Parse(data["templateId"].ToString()); string[] arr = data["string"].ToString().Split(new[] {'|', '#'}); for (int i = 0; i < arr.Length; i++) { int mapId = int.Parse(arr[i++]); string[] coords = arr[i].Split(new[] {','}); float x = float.Parse(coords[0].Replace('.', ',')); float y = float.Parse(coords[1].Replace('.', ',')); float z = float.Parse(coords[2].Replace('.', ',')); GSpawnTemplate template = new GSpawnTemplate { CollectionId = templateId, WorldPosition = new WorldPosition { MapId = mapId, X = x, Y = y, Z = z, } }; GatherSpawnTemplates.Add(template); } } } }