示例#1
0
    public void SetData(MindData mindData)
    {
        GatheringData data = mindData as GatheringData;

        carryingObjects   = new List <GameObject>();
        gatheredResources = new List <string>();
        inventory         = new Dictionary <ResourceType, int>();
        for (int i = 0; i < data.InventoryKeys.Count; i++)
        {
            inventory[data.InventoryKeys[i]] = data.InventoryValues[i];
        }
        IsScout            = data.IsScout;
        nextHarvest        = data.NextHarvest;
        preparingReturn    = data.PreparingReturn;
        scouting           = data.Scouting;
        busy               = data.Busy;
        leavingBase        = data.LeavingBase;
        state              = data.State;
        nextState          = data.NextState;
        prefferedType      = data.PrefferedType;
        carryWeight        = data.CarryWeight;
        prefferedDirection = data.PrefferedDirection;
        enterBase          = data.EnterBase;
        if (data.AntGuid != "")
        {
            Initiate(GameWorld.Instance.FindAnt(Guid.Parse(data.AntGuid)));
            foreach (string guid in data.GatheredResources)
            {
                carryResource(GameWorld.Instance.FindResourceNode(Guid.Parse(guid)));
            }
            ant.UpdateSpeed();
            ant.StopAllCoroutines();
            if (scouting)
            {
                ant.StartCoroutine(Scout(data.ScoutSeconds, new Vector3(data.ScoutDestinationX, data.ScoutDestinationY, data.ScoutDestinationZ)));
            }
            if (preparingReturn)
            {
                ant.StartCoroutine(ReturnToBase(data.ReturnSeconds));
            }
            if (data.TargetGuid != "")
            {
                target = GameWorld.Instance.FindResourceNode(Guid.Parse(data.TargetGuid));
                ant.GetAgent().SetDestination(target.GetPosition());
            }
            if (leavingBase)
            {
                ant.StartCoroutine(ExitBase(nextState));
            }
            else if (enterBase || state == State.MovingToStorage)
            {
                ant.StartCoroutine(EnterBase(ant.GetBaseController().GetPosition()));
            }
        }
    }
示例#2
0
        private void ParseGather(GatheringPoint g, IEnumerable <MapMarker> maps)
        {
            //Beast Tribe and Leve Quests get Territory type 1 most of the time....
            if (g.Base.Key == 0 || g.TerritoryType.Key == 1 || g.Base.GatheringLevel == 0 || !g.Base.Items.Any() || g.Base.Items.All(i => i.Item.Key >= 2000000 && i.Item.Key < 3000000))
            {
                return;
            }
            var ng = new GatheringData();

            ng.NodeId = Convert.ToUInt32(g.Key);

            if (g.GatheringPointBonus.Length >= 1)
            {
                ng.Bonus = Convert.ToUInt32(g.GatheringPointBonus[0].Key);
            }


            ng.Level = Convert.ToUInt32(g.TerritoryType.Key);

            ng.Position = LevelBuilder.Level(_Realm.GameData.GetSheet <SaintCoinach.Xiv.Level>().FirstOrDefault(i => i.Object == g));



            /// <summary>
            /// 0 -> Mining
            /// 1 -> Quarrying
            /// 2 -> Logging
            /// 3 -> Harrvesting
            /// 4 -> SpearFishing
            /// </summary>

            var type = Convert.ToByte(g.Base.Type.Key); //

            if (type < 2)
            {
                ng.Job = 16; //miner
            }
            else if (type < 4)
            {
                ng.Job = 17; //bot
            }
            else
            {
                ng.Job = 18; //fisher
            }
            if (g.GatheringSubCategory == null)
            {
                ng.RequiredBook = 0;
            }
            else
            {
                ng.RequiredBook = Convert.ToUInt32(g.GatheringSubCategory.Item.Key);
            }



            ng.Territory = Convert.ToUInt32(g.TerritoryType.Key);

            ng.TerritoryName = g.TerritoryType.Name.ToString();


            if (g.PlaceName.Key != 0)
            {
                ng.Place = Convert.ToUInt32(g.PlaceName.Key);

                ng.PlaceName = g.PlaceName.Name.ToString();

                var map = g.TerritoryType.Map;
                var X   = maps.Where(i => i.Place.Key == g.PlaceName.Key);
                //hard coded fix for hell's lid
                if (g.PlaceName.Key == 2762)
                {
                    X = X.Where(i => i.Key == 17);
                }
                if (X.Count() == 0)
                {
                    var Y = _Realm.GameData.GetSheet <SpearfishingNotebook>().Where(t => t.PlaceName.Key == g.PlaceName.Key);
                    if (Y.Count() == 0 || Y.Count() > 1)
                    {
                        Debugger.Break();
                    }

                    ng.PlaceX = (float)map.ToMapCoordinate3d(Y.First().X, map.OffsetX);
                    ng.PlaceY = (float)map.ToMapCoordinate3d(Y.First().Y, map.OffsetY);
                }
                else if (X.Count() > 1)
                {
                    Debugger.Break();
                }
                else
                {
                    ng.PlaceX = (float)map.ToMapCoordinate3d(X.First().X, map.OffsetX);
                    ng.PlaceY = (float)map.ToMapCoordinate3d(X.First().Y, map.OffsetY);
                }
            }
            ng.Timed = g.Base.IsLimited;
            var bg = g.Base.Key;

            MappyNPC npc = mappyDataResult.First(i => i.ENpcResidentID == ng.NodeId);

            //OutputInformation($"{g.Base.Key} count - {mappyDataResult.Count(i => i.ENpcResidentID == ng.NodeId)} ");
            if (ng.Timed)
            {
                var garland = GarlandBellGathering.First(i => i.Id == bg);
                ng.Timer    = new List <uint>(garland.Time);
                ng.Duration = garland.Uptime;
            }
            if (ng.Position != null)
            {
                OutputInformation($"{ng.NodeId} {g.Base.Key}  {ng.Position.ZoneId} {ng.NodeId} {ng.Position.ToVec3<Vector3>()}");
            }
            else
            {
                OutputInformation($"{ng.NodeId} {g.Base.Items.FirstOrDefault().Item.Name} ({npc.CoordinateX}, {npc.CoordinateZ}, {npc.CoordinateY})");
            }
            GatherData.Add(ng.NodeId, ng);
        }