Ejemplo n.º 1
0
        public void Init()
        {
            RogueEncampmentWp = null;
            RedPortal         = null;
            InGame            = false;
            FullyEnteredGame  = false;
            LastTeleport      = 0;
            Experience        = 0;
            Me = new Player();
            Logger.Write("Reset GameData");

            SkillLevels.Clear();
            ItemSkillLevels.Clear();
            Players.Clear();
            Npcs.Clear();
            Items.Clear();
            WorldObjects.Clear();

            Inventory = new Container("Inventory", ContainerType.Inventory, InventoryWidth, InventoryHeight);
            Stash     = new Container("Stash", ContainerType.Stash, StashWidth, StashHeight);
            Cube      = new Container("Cube", ContainerType.Cube, CubeWidth, CubeHeight); //todo make configurable
            Belt      = new Container("Belt", ContainerType.Belt, 4, 4);                  //todo make size depend on belt type...

            MalahId                  = 0;
            CurrentLife              = 0;
            FirstNpcInfoPacket       = true;
            AttacksSinceLastTeleport = 0;
            WeaponSet                = 0;
            HasMerc                  = false;
        }
Ejemplo n.º 2
0
        public void Init()
        {
            RogueEncampmentWp = null;
            RedPortal         = null;
            InGame            = false;
            FullyEnteredGame  = false;
            LastTeleport      = 0;
            Experience        = 0;
            Me = new Player();
            Logging.Logger.Write("Reset self");

            SkillLevels.Clear();
            ItemSkillLevels.Clear();
            Logging.Logger.Write("Cleared Skills");
            Players.Clear();
            Logging.Logger.Write("Cleared Players");
            Npcs.Clear();
            Logging.Logger.Write("Cleared Npcs");
            Items.Clear();
            WorldObjects.Clear();

            Inventory = new Container("Inventory", GameData.InventoryWidth, GameData.InventoryHeight);
            Stash     = new Container("Stash", GameData.StashWidth, GameData.StashHeight);
            Cube      = new Container("Cube", GameData.CubeWidth, GameData.CubeHeight);
            Belt      = new Container("Belt", 4, 4);

            MalahId                  = 0;
            CurrentLife              = 0;
            FirstNpcInfoPacket       = true;
            AttacksSinceLastTeleport = 0;
            WeaponSet                = 0;
            HasMerc                  = false;
        }
Ejemplo n.º 3
0
    public void UpdateWeaponSkillExperience(SkillLevels skillLevels)
    {
        for (int i = 0; i < 4; i++)
        {
            weaponExperienceBars[i].fillAmount = skillLevels.weaponLevelsExperience[i] / 100f;
            weaponRankText[i].text             = skillLevels.GetWeaponRank(skillLevels.weaponLevels[i]);
        }
        weaponExperienceBars[4].fillAmount = skillLevels.magicLevelsExperience[0] / 100f;
        weaponRankText[4].text             = skillLevels.GetWeaponRank(skillLevels.magicLevels[0]);

        weaponExperienceBars[5].fillAmount = skillLevels.magicLevelsExperience[1] / 100f;
        weaponRankText[5].text             = skillLevels.GetWeaponRank(skillLevels.magicLevels[1]);
    }
Ejemplo n.º 4
0
        public async void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (Skills?.Count == 0)
            {
                Init();
            }
            InitUsers();
            var parameters = navigationContext.Parameters;

            if (parameters["QueryId"] != null)
            {
                using (var _database = new ITManagerEntities())
                {
                    var queryId        = int.Parse((string)parameters["QueryId"]);
                    var queryString    = (await _database.Queries.Where(q => q.Id == queryId).FirstOrDefaultAsync()).QueryString;
                    var splittedQuery  = queryString.Split('&');
                    var skillsQuery    = splittedQuery[0];
                    var languagesQuery = splittedQuery[1];
                    var projectsQuery  = splittedQuery[2];

                    SkillsConditions = new ObservableCollection <SkillCondition>(skillsQuery.Split(',').Select(q => new SkillCondition
                    {
                        Skill = Skills.Where(s => s.Id == int.Parse(q.Split(':')[0])).FirstOrDefault(),
                        From  = SkillLevels.Where(s => s.Id == int.Parse(q.Split(':')[1].Split('-')[0])).FirstOrDefault(),
                        To    = SkillLevels.Where(s => s.Id == int.Parse(q.Split(':')[1].Split('-')[1])).FirstOrDefault()
                    }));

                    SelectedSkills = new ObservableCollection <Models.UserPageModel.ProfessionalSkill>(Skills.Where(s => SkillsConditions.Any(sc => sc.Skill.Id == s.Id)));

                    LanguagesConditions = new ObservableCollection <LanguageCondition>(languagesQuery.Split(',').Select(q => new LanguageCondition
                    {
                        Language = Languages.Where(l => l.Id == int.Parse(q.Split(':')[0])).FirstOrDefault(),
                        From     = LanguageLevels.Where(l => l.Id == int.Parse(q.Split(':')[1].Split('-')[0])).FirstOrDefault(),
                        To       = LanguageLevels.Where(l => l.Id == int.Parse(q.Split(':')[1].Split('-')[1])).FirstOrDefault()
                    }));

                    SelectedLanguages = new ObservableCollection <Models.UserPageModel.LanguagesList>(Languages.Where(l => LanguagesConditions.Any(lc => lc.Language.Id == l.Id)));

                    var projectsIds = projectsQuery.Split(',').Select(pId => int.Parse(pId));
                    SelectedProjects = new ObservableCollection <Models.ProjectsManagementPageModels.Project>(Projects.Where(p => projectsIds.Contains(p.Id)));
                }

                SearchMethod();
            }
        }
Ejemplo n.º 5
0
        private void SkillsSelectionChangedMethod()
        {
            if (SelectedSkills == null)
            {
                SelectedSkills = new ObservableCollection <Models.UserPageModel.ProfessionalSkill>();
            }
            if (SelectedSkills.Count > SkillsConditions.Count)
            {
                foreach (var selectedSkill in SelectedSkills)
                {
                    if (SkillsConditions.Where(s => s.Skill.Id == selectedSkill.Id).FirstOrDefault() == null)
                    {
                        SkillsConditions.Add(new SkillCondition
                        {
                            Skill = selectedSkill,
                            From  = SkillLevels.First(),
                            To    = SkillLevels.Last()
                        });
                        return;
                    }
                }
            }

            if (SelectedSkills.Count < SkillsConditions.Count)
            {
                foreach (var skillCondition in SkillsConditions)
                {
                    if (SelectedSkills.Where(s => s.Id == skillCondition.Skill.Id).FirstOrDefault() == null)
                    {
                        var skill = SkillsConditions.Where(s => s.Skill.Id == skillCondition.Skill.Id).FirstOrDefault();
                        if (skill == null)
                        {
                            return;
                        }
                        SkillsConditions.Remove(skill);
                        return;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// @UE3 Parse each individual row of meta data
        /// </summary>
        /// <param name="match"></param>
        /// <returns></returns>
        private string ParseMetadataRow(Match match, TransformationData data, bool full = true)
        {
            var metaValue        = match.Groups["MetadataValue"].Value;
            var metaDataCategory = match.Groups["MetadataKey"].Value;

            if (metaDataCategory.Contains(' '))
            {
                data.ErrorList.Add(
                    Markdown.GenerateError(
                        Language.Message("MetadataNamesMustNotContainSpaces", metaDataCategory),
                        MessageClass.Warning,
                        metaDataCategory,
                        data.ErrorList.Count,
                        data));
            }

            var metaDataCategoryLowerCase = metaDataCategory.ToLower();

            // If value is blank change to paragraph for table creation classification form
            if (!String.IsNullOrWhiteSpace(match.Groups["MetadataValue"].Value))
            {
                if (metaDataCategoryLowerCase == "title")
                {
                    DocumentTitle = metaValue;
                }

                if (metaDataCategoryLowerCase == "seo-title")
                {
                    SEOTitle = metaValue;
                }

                if (metaDataCategoryLowerCase == "crumbs")
                {
                    CrumbsLinks.Add(metaValue);
                }

                if (metaDataCategoryLowerCase == "related" && full)
                {
                    RelatedLinks.Add(data.Markdown.ProcessRelated(metaValue, data));
                }

                if (metaDataCategoryLowerCase == "prereq" && full)
                {
                    PrereqLinks.Add(data.Markdown.ProcessPrereqs(metaValue, data));
                }

                if (metaDataCategoryLowerCase == "version")
                {
                    EngineVersions.Add(Hash.FromAnonymousObject(new { version = metaValue, label = metaValue.Replace('.', '_') }));
                }

                if (metaDataCategoryLowerCase == "skilllevel")
                {
                    SkillLevels.Add(metaValue);
                }

                if (metaDataCategoryLowerCase == "tags")
                {
                    Tags.Add(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaValue));
                }
            }

            // Add meta data to the list, we require some specific meta data keys to be unique others can be duplicates
            if (metaDataCategoryLowerCase.Equals("title") || metaDataCategoryLowerCase.Equals("seo-title") ||
                metaDataCategoryLowerCase.Equals("description") || metaDataCategoryLowerCase.Equals("seo-description") ||
                metaDataCategoryLowerCase.Equals("template") || metaDataCategoryLowerCase.Equals("forcepublishfiles"))
            {
                if (MetadataMap.ContainsKey(metaDataCategoryLowerCase))
                {
                    data.ErrorList.Add(
                        new ErrorDetail(
                            Language.Message("DuplicateMetadataDetected", metaDataCategory),
                            MessageClass.Info,
                            "",
                            "",
                            0,
                            0));
                }
                else
                {
                    var valueList = new List <string>();
                    valueList.Add(match.Groups["MetadataValue"].Value);
                    MetadataMap.Add(metaDataCategoryLowerCase, valueList);
                }
            }
            else
            {
                if (MetadataMap.ContainsKey(metaDataCategoryLowerCase))
                {
                    MetadataMap[metaDataCategoryLowerCase].Add(match.Groups["MetadataValue"].Value);
                }
                else
                {
                    var valueList = new List <string>();
                    valueList.Add(match.Groups["MetadataValue"].Value);
                    MetadataMap.Add(metaDataCategoryLowerCase, valueList);
                }
            }

            // Return empty string, we are removing the meta data from the document
            return("");
        }
        public override Task InitializeAsync(object navigationData)
        {
            var parameter = navigationData as Plan;

            if (parameter != null)
            {
                isEditing  = true;
                ButtonText = "MODIFICAR PLAN";
                plan       = parameter;
                if (plan.Latitude != Double.NaN && plan.Longitude != Double.NaN)
                {
                    pins = new ObservableCollection <Plan>();
                    pins.Add(plan);
                }

                RaisePropertyChanged("MinimumDate");

                selectedCategory = Categories.Find(item => item.Id == plan.PlanType);
                RaisePropertyChanged("SelectedCategory");

                RaisePropertyChanged("Name");
                RaisePropertyChanged("Description");
                RaisePropertyChanged("PlanDate");
                RaisePropertyChanged("PlanTime");
                RaisePropertyChanged("EndPlanDate");
                RaisePropertyChanged("EndPlanTime");
                LocationText    = plan.Address;
                DestinationText = plan.DestinationAddress;
                RaisePropertyChanged("Pins");

                selectedCategory = Categories.Find(item => item.Id == plan.PlanType);
                RaisePropertyChanged("SelectedCategory");

                selectedRecommendedLevel = SkillLevels.Find(item => item.Id == plan.RecommendedLevel);
                RaisePropertyChanged("SelectedRecommendedLevel");

                selectedLanguage1 = Languages.Find(item => item.Id == plan.Language1);
                RaisePropertyChanged("SelectedLanguage1");

                selectedLanguage2 = Languages.Find(item => item.Id == plan.Language2);
                RaisePropertyChanged("SelectedLanguage2");

                selectedFoodType = FoodTypes.Find(item => item.Id == plan.Language2);
                RaisePropertyChanged("SelectedLanguage2");

                if (plan.Images.Count > 0)
                {
                    Image1 = ImageSource.FromUri(new Uri(plan.Images[0].ImageFullPath));
                }
                if (plan.Images.Count > 1)
                {
                    Image2 = ImageSource.FromUri(new Uri(plan.Images[1].ImageFullPath));
                }
                if (plan.Images.Count > 2)
                {
                    Image3 = ImageSource.FromUri(new Uri(plan.Images[2].ImageFullPath));
                }
            }

            return(base.InitializeAsync(navigationData));
        }
Ejemplo n.º 8
0
 private void expertToolStripMenuItem_Click(object sender, EventArgs e)
 {
     beginnerToolStripMenuItem.Checked = false;
     randomToolStripMenuItem.Checked   = false;
     SkillLevel = SkillLevels.Expert;
 }
Ejemplo n.º 9
0
        public Character(string CharacterPath, ContentManager Content, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect,
                         Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget, Dictionary <string, ManualSkillTarget> DicManualSkillTarget)
            : this()
        {
            FileStream   FS = new FileStream("Content/Characters/" + CharacterPath + ".pec", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            //Init variables.
            Name         = BR.ReadString();
            PortraitPath = BR.ReadString();

            ArrayPortraitBustPath = new string[BR.ReadInt32()];
            for (int B = 0; B < ArrayPortraitBustPath.Length; ++B)
            {
                ArrayPortraitBustPath[B] = BR.ReadString();
            }

            ArrayPortraitBoxPath = new string[BR.ReadInt32()];
            for (int B = 0; B < ArrayPortraitBoxPath.Length; ++B)
            {
                ArrayPortraitBoxPath[B] = BR.ReadString();
            }

            Tags            = BR.ReadString();
            FullName        = CharacterPath;
            EXPValue        = BR.ReadInt32();
            CanPilot        = BR.ReadBoolean();
            BattleThemeName = BR.ReadString();
            string AceBonus        = BR.ReadString();
            string PersonalityName = BR.ReadString();
            string SlaveName       = BR.ReadString();

            Personality = new CharacterPersonality(PersonalityName);

            if (!string.IsNullOrWhiteSpace(SlaveName) && SlaveName != "None")
            {
                Slave = new Character(SlaveName, Content, DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget);
            }

            Int32 SpiritListCount = BR.ReadInt32();

            ArrayPilotSpirit = new ManualSkill[SpiritListCount];

            for (int S = 0; S < SpiritListCount; ++S)
            {
                ArrayPilotSpirit[S]                  = new ManualSkill("Content/Characters/Spirits/" + BR.ReadString() + ".pecs", DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget);
                ArrayPilotSpirit[S].SPCost           = BR.ReadInt32();
                ArrayPilotSpirit[S].LevelRequirement = BR.ReadInt32();
            }

            Int32 SkillListCount = BR.ReadInt32();

            ArrayPilotSkill       = new BaseAutomaticSkill[SkillListCount];
            ArrayPilotSkillLocked = new bool[SkillListCount];
            ArrayPilotSkillLevels = new SkillLevels[SkillListCount];

            for (int S = 0; S < SkillListCount; ++S)
            {
                string RelativePath = BR.ReadString();
                ArrayPilotSkill[S]       = new BaseAutomaticSkill("Content/Characters/Skills/" + RelativePath + ".pecs", RelativePath, DicRequirement, DicEffect, DicAutomaticSkillTarget);
                ArrayPilotSkillLocked[S] = BR.ReadBoolean();
                Int32 SkillLevelsCount = BR.ReadInt32();
                ArrayPilotSkillLevels[S] = new SkillLevels(BR, SkillLevelsCount);
            }

            Int32 RelationshipBonusCount = BR.ReadInt32();

            ArrayRelationshipBonus = new BaseAutomaticSkill[RelationshipBonusCount];

            for (int S = 0; S < RelationshipBonusCount; ++S)
            {
                string RelationshipBonusName = BR.ReadString();
                int    RelationshipLevel     = BR.ReadInt32();
                ArrayRelationshipBonus[S] = new BaseAutomaticSkill("Content/Characters/Relationships/" + RelationshipBonusName + ".pecr", RelationshipBonusName, DicRequirement, DicEffect, DicAutomaticSkillTarget);

                ArrayRelationshipBonus[S].CurrentLevel = RelationshipLevel;

                for (int L = 0; L < ArrayRelationshipBonus[S].ListSkillLevel.Count; ++L)
                {
                    BaseSkillRequirement NewSkillRequirement = BaseSkillRequirement.LoadCopy(BR, DicRequirement);
                    ArrayRelationshipBonus[S].ListSkillLevel[L].ListActivation[0].ListRequirement.Add(NewSkillRequirement);
                }
            }

            //If it's a pilot, read its stats.
            if (CanPilot)
            {
                MaxLevel        = BR.ReadInt32();
                ArrayLevelMEL   = new int[MaxLevel];
                ArrayLevelRNG   = new int[MaxLevel];
                ArrayLevelDEF   = new int[MaxLevel];
                ArrayLevelSKL   = new int[MaxLevel];
                ArrayLevelEVA   = new int[MaxLevel];
                ArrayLevelHIT   = new int[MaxLevel];
                ArrayLevelMaxSP = new int[MaxLevel];

                for (int L = 0; L < MaxLevel; ++L)
                {
                    ArrayLevelMEL[L]   = BR.ReadInt32();
                    ArrayLevelRNG[L]   = BR.ReadInt32();
                    ArrayLevelDEF[L]   = BR.ReadInt32();
                    ArrayLevelSKL[L]   = BR.ReadInt32();
                    ArrayLevelEVA[L]   = BR.ReadInt32();
                    ArrayLevelHIT[L]   = BR.ReadInt32();
                    ArrayLevelMaxSP[L] = BR.ReadInt32();
                }

                int TerrainGradeAir   = BR.ReadInt32();
                int TerrainGradeLand  = BR.ReadInt32();
                int TerrainGradeSea   = BR.ReadInt32();
                int TerrainGradeSpace = BR.ReadInt32();

                TerrainGrade = new TerrainGrades(TerrainGradeAir, TerrainGradeLand, TerrainGradeSea, TerrainGradeSpace);
            }

            int ListQuoteSetVersusNameCount = BR.ReadInt32();

            for (int Q = 0; Q < ListQuoteSetVersusNameCount; Q++)
            {
                ListQuoteSetVersusName.Add(BR.ReadString());
            }

            //Base quotes
            for (int I = 0; I < 6; I++)
            {
                ArrayBaseQuoteSet[I] = new QuoteSet();

                int ListQuoteCount = BR.ReadInt32();
                for (int Q = 0; Q < ListQuoteCount; Q++)
                {
                    ArrayBaseQuoteSet[I].ListQuote.Add(BR.ReadString());
                }

                //Versus quotes.
                int ListQuoteVersusCount = BR.ReadInt32();
                for (int Q = 0; Q < ListQuoteVersusCount; Q++)
                {
                    ArrayBaseQuoteSet[I].ListQuoteVersus.Add(BR.ReadString());
                }

                ArrayBaseQuoteSet[I].PortraitPath = BR.ReadString();
            }

            int DicAttackQuoteSetCount = BR.ReadInt32();

            for (int i = 0; i < DicAttackQuoteSetCount; i++)
            {
                QuoteSet NewQuoteSet = new QuoteSet();

                string QuoteSetName = BR.ReadString();

                int ListQuoteCount = BR.ReadInt32();
                for (int Q = 0; Q < ListQuoteCount; Q++)
                {
                    NewQuoteSet.ListQuote.Add(BR.ReadString());
                }

                int ListQuoteVersusCount = BR.ReadInt32();
                for (int Q = 0; Q < ListQuoteVersusCount; Q++)
                {
                    NewQuoteSet.ListQuoteVersus.Add(BR.ReadString());
                }

                NewQuoteSet.PortraitPath = BR.ReadString();

                DicAttackQuoteSet.Add(QuoteSetName, NewQuoteSet);
            }

            FS.Close();
            BR.Close();

            if (Content != null)
            {
                string SpritePath = Path.GetFileNameWithoutExtension(CharacterPath);
                if (!string.IsNullOrEmpty(PortraitPath))
                {
                    SpritePath = PortraitPath;
                }

                if (File.Exists("Content\\Visual Novels\\Portraits\\" + SpritePath + ".xnb"))
                {
                    this.sprPortrait = Content.Load <Texture2D>("Visual Novels\\Portraits\\" + SpritePath);
                }
                else
                {
                    this.sprPortrait = Content.Load <Texture2D>("Characters\\Portraits\\Default");
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Deep Loads the <see cref="IEntity"/> object with criteria based of the child
        /// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
        /// </summary>
        /// <remarks>
        /// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
        /// </remarks>
        /// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
        /// <param name="entity">The <see cref="EmployeeDB.BLL.EmployeeSkills"/> object to load.</param>
        /// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
        /// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
        /// <param name="childTypes">EmployeeDB.BLL.EmployeeSkills Property Collection Type Array To Include or Exclude from Load</param>
        /// <param name="innerList">A collection of child types for easy access.</param>
        /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
        /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
        public override void DeepLoad(TransactionManager transactionManager, EmployeeDB.BLL.EmployeeSkills entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
        {
            if (entity == null)
            {
                return;
            }

            #region SkillCodeSource
            if (CanDeepLoad(entity, "Skill|SkillCodeSource", deepLoadType, innerList) &&
                entity.SkillCodeSource == null)
            {
                object[] pkItems = new object[1];
                pkItems[0] = (entity.SkillCode ?? string.Empty);
                Skill tmpEntity = EntityManager.LocateEntity <Skill>(EntityLocator.ConstructKeyFromPkItems(typeof(Skill), pkItems), DataRepository.Provider.EnableEntityTracking);
                if (tmpEntity != null)
                {
                    entity.SkillCodeSource = tmpEntity;
                }
                else
                {
                    entity.SkillCodeSource = DataRepository.SkillProvider.GetBySkillCode(transactionManager, (entity.SkillCode ?? string.Empty));
                }

                                #if NETTIERS_DEBUG
                System.Diagnostics.Debug.WriteLine("- property 'SkillCodeSource' loaded. key " + entity.EntityTrackingKey);
                                #endif

                if (deep && entity.SkillCodeSource != null)
                {
                    innerList.SkipChildren = true;
                    DataRepository.SkillProvider.DeepLoad(transactionManager, entity.SkillCodeSource, deep, deepLoadType, childTypes, innerList);
                    innerList.SkipChildren = false;
                }
            }
            #endregion SkillCodeSource

            #region SkillLevelSource
            if (CanDeepLoad(entity, "SkillLevels|SkillLevelSource", deepLoadType, innerList) &&
                entity.SkillLevelSource == null)
            {
                object[] pkItems = new object[1];
                pkItems[0] = (entity.SkillLevel ?? string.Empty);
                SkillLevels tmpEntity = EntityManager.LocateEntity <SkillLevels>(EntityLocator.ConstructKeyFromPkItems(typeof(SkillLevels), pkItems), DataRepository.Provider.EnableEntityTracking);
                if (tmpEntity != null)
                {
                    entity.SkillLevelSource = tmpEntity;
                }
                else
                {
                    entity.SkillLevelSource = DataRepository.SkillLevelsProvider.GetByLevelCode(transactionManager, (entity.SkillLevel ?? string.Empty));
                }

                                #if NETTIERS_DEBUG
                System.Diagnostics.Debug.WriteLine("- property 'SkillLevelSource' loaded. key " + entity.EntityTrackingKey);
                                #endif

                if (deep && entity.SkillLevelSource != null)
                {
                    innerList.SkipChildren = true;
                    DataRepository.SkillLevelsProvider.DeepLoad(transactionManager, entity.SkillLevelSource, deep, deepLoadType, childTypes, innerList);
                    innerList.SkipChildren = false;
                }
            }
            #endregion SkillLevelSource

            #region EmployeeIdSource
            if (CanDeepLoad(entity, "Employee|EmployeeIdSource", deepLoadType, innerList) &&
                entity.EmployeeIdSource == null)
            {
                object[] pkItems = new object[1];
                pkItems[0] = (entity.EmployeeId ?? (int)0);
                Employee tmpEntity = EntityManager.LocateEntity <Employee>(EntityLocator.ConstructKeyFromPkItems(typeof(Employee), pkItems), DataRepository.Provider.EnableEntityTracking);
                if (tmpEntity != null)
                {
                    entity.EmployeeIdSource = tmpEntity;
                }
                else
                {
                    entity.EmployeeIdSource = DataRepository.EmployeeProvider.GetByEmployeeId(transactionManager, (entity.EmployeeId ?? (int)0));
                }

                                #if NETTIERS_DEBUG
                System.Diagnostics.Debug.WriteLine("- property 'EmployeeIdSource' loaded. key " + entity.EntityTrackingKey);
                                #endif

                if (deep && entity.EmployeeIdSource != null)
                {
                    innerList.SkipChildren = true;
                    DataRepository.EmployeeProvider.DeepLoad(transactionManager, entity.EmployeeIdSource, deep, deepLoadType, childTypes, innerList);
                    innerList.SkipChildren = false;
                }
            }
            #endregion EmployeeIdSource

            //used to hold DeepLoad method delegates and fire after all the local children have been loaded.
            Dictionary <string, KeyValuePair <Delegate, object> > deepHandles = new Dictionary <string, KeyValuePair <Delegate, object> >();

            //Fire all DeepLoad Items
            foreach (KeyValuePair <Delegate, object> pair in deepHandles.Values)
            {
                pair.Key.DynamicInvoke((object[])pair.Value);
            }
            deepHandles = null;
        }
Ejemplo n.º 11
0
        public PlayerUnitData(AllyStats stats)
        {
            magicList  = new List <string>();
            blackMagic = new List <string>();
            whiteMagic = new List <string>();
            inventory  = new List <InventoryItem>();

            level      = stats.level;
            experience = stats.experience;

            baseHP  = stats.baseHP;
            baseSTR = stats.baseSTR;
            baseMAG = stats.baseMAG;
            baseDEF = stats.baseDEF;
            baseRES = stats.baseRES;
            baseSKL = stats.baseSKL;
            baseSPD = stats.baseSPD;

            hp  = stats.hp;
            str = stats.str;
            mag = stats.mag;
            def = stats.def;
            res = stats.res;
            skl = stats.skl;
            spd = stats.spd;

            hpGrowth  = stats.hpGrowth;
            strGrowth = stats.strGrowth;
            magGrowth = stats.magGrowth;
            defGrowth = stats.defGrowth;
            resGrowth = stats.resGrowth;
            sklGrowth = stats.sklGrowth;
            spdGrowth = stats.spdGrowth;

            maxHP = stats.maxHP;

            skillLevels = stats.skillLevels;

            classType      = stats.classType.name;
            equippedWeapon = equippedWhiteMagic = equippedBlackMagic = null;
            if (stats.equippedWeapon)
            {
                equippedWeapon = stats.equippedWeapon.name;
            }
            if (stats.equippedWhiteMagic)
            {
                equippedWhiteMagic = stats.equippedWhiteMagic.name;
            }
            if (stats.equippedBlackMagic)
            {
                equippedBlackMagic = stats.equippedBlackMagic.name;
            }


            foreach (Magic spell in stats.magicList)
            {
                magicList.Add(spell.name);
            }
            foreach (Magic spell in stats.blackMagic)
            {
                blackMagic.Add(spell.name);
            }
            foreach (Magic spell in stats.whiteMagic)
            {
                whiteMagic.Add(spell.name);
            }
            foreach (Item item in stats.inventory)
            {
                if (item)
                {
                    inventory.Add(new InventoryItem(item));
                }
            }

            attackMethod = stats.attackMethod;
        }