コード例 #1
0
 public void SetIdleJob(CharacterJob idleJob)
 {
     this.idleJob = idleJob;
     // Try-start candidate job
     idleJob.OnStartJob();
     currentJob = idleJob;
 }
コード例 #2
0
    void AddJob()
    {
        CharacterJob newJob = new CharacterJob();

        newJob.JobName = "New Job";
        CharacterJobList.JobList.Add(newJob);
        viewIndex = CharacterJobList.JobList.Count;
    }
コード例 #3
0
 private void ChangeJobs()
 {
     SaveLevel();
     currentJob     = selectedJob;
     currentJobName = currentJob.jobName;
     UpdateStats();
     LoadLevel();
 }
コード例 #4
0
    public IEnumerator DelayThenIncrementJobState(float delayFor, CharacterJob jobToIncrement)
    {
        yield return(new WaitForSeconds(delayFor));

        if (jobToIncrement == currentJob)
        {
            currentJob.JobState++;
        }
    }
コード例 #5
0
        public void Collect()
        {
            if (State == StatedElementStatesType.Used)
            {
                CharacterJob job = Character.GetJob(Skill.Template.ParentJobIdEnum);

                uint quantity = FormulasProvider.Instance.GetCollectedItemQuantity((short)(job != null ? job.Level : 1), Skill.Template);

                this.Character.Inventory.AddItem((ushort)Skill.Template.GatheredRessourceItem, quantity);
                this.Character.Client.Send(new ObtainedItemMessage((ushort)Skill.Template.GatheredRessourceItem, quantity));

                if (job != null)
                {
                    this.Character.AddJobExp(Skill.Template.ParentJobIdEnum, (ulong)(5 * Skill.Template.MinLevel * WorldConfiguration.Instance.JobXpRate));
                }
                this.Character.Collecting = false;
                this.Character            = null;
            }
        }
コード例 #6
0
        public void UseStated(Character character)
        {
            this.Character = character;

            CharacterJob job = Character.GetJob(Skill.Template.ParentJobIdEnum);

            if (job != null && job.Level < Skill.Template.MinLevel)
            {
                return;
            }
            if (State == StatedElementStatesType.Active)
            {
                this.Character.Collecting = true;
                this.UpdateState(StatedElementStatesType.Used);
                this.GrowCallback       = new ActionTimer(GrowInterval * 1000, Grow, false);
                OnUsedCallback          = new Timer(Skill.Template.Duration * 100);
                OnUsedCallback.Elapsed += OnUsedCallback_Elapsed;
                OnUsedCallback.Start();
            }
        }
コード例 #7
0
    // Trigger interrupt of out dated current job, assign and start new current job
    void AssignCurrentJob()
    {
        // Get the next candidate job
        CharacterJob candidateNewJob = null;

        if (activeJobsList.Count == 0 && idleJob != null)
        {
            currentJob = idleJob;
            currentJob.OnResumeJob();

            return;
        }
        else
        {
            candidateNewJob = activeJobsList[activeJobsList.Count - 1];
        }

        // Try-start candidate job
        if (candidateNewJob.OnStartJob())
        {
            // Successful new startup, interrupt current job
            if (currentJob != null)
            {
                currentJob.OnInterruptJob();
            }

            // Re-assign current for tracking
            currentJob = candidateNewJob;
        }
        else
        {
            // Clean up the false start job
            candidateNewJob.OnEndJob();
            // Remove from top of priority
            activeJobsList.Remove(candidateNewJob);

            AssignCurrentJob();
        }
    }
コード例 #8
0
        public static CharacterRecord New(long id, string name, int accountId, ContextActorLook look, sbyte breedId, ushort cosmeticId,
                                          bool sex)
        {
            ushort level  = WorldConfiguration.Instance.StartLevel;
            var    record = new CharacterRecord(id, name, accountId, look, breedId, cosmeticId, sex
                                                , WorldConfiguration.Instance.StartMapId,
                                                WorldConfiguration.Instance.StartCellId, 1, WorldConfiguration.Instance.StartKamas,
                                                ExperienceRecord.GetExperienceForLevel(level).Player, -1
                                                , new List <byte>()
            {
                1
            }, Stats.New(level, breedId), 0, 0
                                                , CharacterAlignment.New(), new List <ushort>(), new List <ushort>(), CharacterJob.New().ToList(),
                                                new List <short>(), new List <CharacterSpell>(), new List <CharacterHumanOption>(), ArenaRank.New(), new List <CharacterShortcut>(), 0, 0, 0, 0);

            return(record);
        }
コード例 #9
0
 // Add new job(s) to the list
 public void AddNewJob(CharacterJob newJob)
 {
     activeJobsList = new List <CharacterJob>();
     activeJobsList.Add(newJob);
     AssignCurrentJob();
 }