Пример #1
0
 static internal bool IsCrafter(EntityJob job)
 {
     return(job == EntityJob.CRP ||
            job == EntityJob.BSM ||
            job == EntityJob.ARM ||
            job == EntityJob.GSM ||
            job == EntityJob.LTW ||
            job == EntityJob.WVR ||
            job == EntityJob.ALC ||
            job == EntityJob.CUL);
 }
Пример #2
0
        public unsafe override JObject GetJobSpecificData(EntityJob job)
        {
            if (!HasProcess() || job_data_outer_addr_ == IntPtr.Zero)
            {
                return(null);
            }

            IntPtr job_inner_ptr = ReadIntPtr(job_data_outer_addr_);

            if (job_inner_ptr == IntPtr.Zero)
            {
                // The pointer can be null when not logged in.
                return(null);
            }
            job_inner_ptr = IntPtr.Add(job_inner_ptr, kJobDataInnerStructOffset);

            fixed(byte *p = Read8(job_inner_ptr, kJobDataInnerStructSize))
            {
                if (p == null)
                {
                    return(null);
                }
                else
                {
                    switch (job)
                    {
                    case EntityJob.RDM: {
                        return(JObject.FromObject(*(RedMageJobMemory *)&p[0]));
                    };

                    case EntityJob.MRD: {
                        return(null);
                    };

                    case EntityJob.WAR: {
                        return(JObject.FromObject(*(WarriorJobMemory *)&p[0]));
                    };

                    case EntityJob.DRK: {
                        return(JObject.FromObject(*(DarkKnightJobMemory *)&p[0]));
                    };

                    case EntityJob.GLA: {
                        return(null);
                    };

                    case EntityJob.PLD: {
                        return(JObject.FromObject(*(PaladinJobMemory *)&p[0]));
                    };

                    case EntityJob.GNB: {
                        return(JObject.FromObject(*(GunbreakerJobMemory *)&p[0]));
                    };

                    case EntityJob.BRD: {
                        return(JObject.FromObject(*(BardJobMemory *)&p[0]));
                    }

                    case EntityJob.DNC: {
                        return(JObject.FromObject(*(DancerJobMemory *)&p[0]));
                    };

                    case EntityJob.LNC: {
                        return(null);
                    };

                    case EntityJob.DRG: {
                        return(JObject.FromObject(*(DragoonJobMemory *)&p[0]));
                    };

                    case EntityJob.NIN: {
                        return(JObject.FromObject(*(NinjaJobMemory *)&p[0]));
                    };

                    case EntityJob.THM: {
                        return(JObject.FromObject(*(ThaumaturgeJobMemory *)&p[0]));
                    }

                    case EntityJob.BLM: {
                        return(JObject.FromObject(*(BlackMageJobMemory *)&p[0]));
                    };

                    case EntityJob.CNJ: {
                        return(null);
                    };

                    case EntityJob.WHM: {
                        return(JObject.FromObject(*(WhiteMageJobMemory *)&p[0]));
                    };

                    case EntityJob.ACN: {
                        return(JObject.FromObject(*(ArcanistJobMemory *)&p[0]));
                    };

                    case EntityJob.SMN: {
                        return(JObject.FromObject(*(SummonerJobMemory *)&p[0]));
                    };

                    case EntityJob.SCH: {
                        return(JObject.FromObject(*(ScholarJobMemory *)&p[0]));
                    };

                    case EntityJob.PGL: {
                        return(JObject.FromObject(*(PuglistJobMemory *)&p[0]));
                    };

                    case EntityJob.MNK: {
                        return(JObject.FromObject(*(MonkJobMemory *)&p[0]));
                    };

                    case EntityJob.MCH: {
                        return(JObject.FromObject(*(MachinistJobMemory *)&p[0]));
                    };

                    case EntityJob.AST: {
                        return(JObject.FromObject(*(AstrologianJobMemory *)&p[0]));
                    };

                    case EntityJob.SAM: {
                        return(JObject.FromObject(*(SamuraiJobMemory *)&p[0]));
                    };

                    default: {
                        logger_.LogError("GetJobSpecificData: {0}", job);
                        return(null);
                    };
                    }
                }
            }
        }
Пример #3
0
 public unsafe abstract JObject GetJobSpecificData(EntityJob job);
Пример #4
0
 static internal bool IsGatherer(EntityJob job)
 {
     return(job == EntityJob.FSH || job == EntityJob.MIN || job == EntityJob.BTN);
 }
Пример #5
0
        public void Update(GameTime gameTime)
        {
            thoughttime += gameTime.ElapsedGameTime.Milliseconds;

            if (_assignedJobs.Count == 0)
            {
                _assignedJobs.Add(GW.JM.GetNextJob());
                _activeJob = _assignedJobs[0];
            }

            if (_activeJob != null)
            {
                if (_pathFinder.Path.Count == 0)
                {
                    if (_activeJob is EntityJob)
                    {
                        EntityJob activeEntityJob = _activeJob as EntityJob;
                        if (activeEntityJob.EntityID == -1)
                        {
                            activeEntityJob.EntityID = GW.EC.GetClosestEntityByType(Position,
                                                                                    activeEntityJob.SchematicRequired).ID;
                        }
                        else
                        {
                            if (GW.EC.GetByID(activeEntityJob.EntityID).Position == Position)
                            {
                                GW.EC.GetByID(activeEntityJob.EntityID).GetProperty <Harvestable>().Harvest(GW.EC.GetByID(activeEntityJob.EntityID));
                                activeEntityJob.EntityID = -1;
                            }
                            else
                            {
                                _pathFinder.GeneratePath(Position, GW.EC.GetByID(activeEntityJob.EntityID).Position);
                            }
                        }
                    }
                }
            }


            if (thoughttime > thinkingtime)
            {
                // act!
                thoughttime = thoughttime - thinkingtime;

                if (_pathFinder.Path.Count > 0)
                {
                    Vector3 nextLocation = _pathFinder.Path[0];
                    _pathFinder.Path.RemoveAt(0);
                    if (nextLocation - Position == WorldDirection.North)
                    {
                        MoveNorth();
                    }
                    else if (nextLocation - Position == WorldDirection.East)
                    {
                        MoveEast();
                    }
                    else if (nextLocation - Position == WorldDirection.South)
                    {
                        MoveSouth();
                    }
                    else if (nextLocation - Position == WorldDirection.West)
                    {
                        MoveWest();
                    }
                    else if (nextLocation - Position == WorldDirection.NorthEast)
                    {
                        MoveNorthEast();
                    }
                    else if (nextLocation - Position == WorldDirection.NorthWest)
                    {
                        MoveNorthWest();
                    }
                    else if (nextLocation - Position == WorldDirection.SouthEast)
                    {
                        MoveSouthEast();
                    }
                    else if (nextLocation - Position == WorldDirection.SouthWest)
                    {
                        MoveSouthWest();
                    }
                }
            }
        }