Exemple #1
0
        public SkillSet(ToonClass @class, Toon toon)
        {
            this.@Class = @class;
            var dbToon = DBSessions.AccountSession.Get <DBToon>(toon.PersistentID);

            if (dbToon.DBActiveSkills == null)
            {
                int[] ActiveSkillsList = Skills.GetAllActiveSkillsByClass(this.@Class).Take(1).ToArray();

                this.ActiveSkills = new ActiveSkillSavedData[6] {
                    new ActiveSkillSavedData {
                        snoSkill = ActiveSkillsList[0], snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    }
                };

                this.PassiveSkills = new int[3] {
                    -1, -1, -1,
                };


                dbToon.DBActiveSkills = new DBActiveSkills
                {
                    Skill0   = ActiveSkillsList[0],
                    Skill1   = -1,
                    Skill2   = -1,
                    Skill3   = -1,
                    Skill4   = -1,
                    Skill5   = -1,
                    Rune0    = -1,
                    Rune1    = -1,
                    Rune2    = -1,
                    Rune3    = -1,
                    Rune4    = -1,
                    Rune5    = -1,
                    Passive0 = -1,
                    Passive1 = -1,
                    Passive2 = -1
                };
                DBSessions.AccountSession.SaveOrUpdate(dbToon.DBActiveSkills);
                DBSessions.AccountSession.Flush();
            }
            else
            {
                this.ActiveSkills = new ActiveSkillSavedData[6] {
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill0,
                        snoRune  = dbToon.DBActiveSkills.Rune0
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill1,
                        snoRune  = dbToon.DBActiveSkills.Rune1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill2,
                        snoRune  = dbToon.DBActiveSkills.Rune2
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill3,
                        snoRune  = dbToon.DBActiveSkills.Rune3
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill4,
                        snoRune  = dbToon.DBActiveSkills.Rune4
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill5,
                        snoRune  = dbToon.DBActiveSkills.Rune5
                    },
                };
                this.PassiveSkills = new int[3] {
                    dbToon.DBActiveSkills.Passive0,
                    dbToon.DBActiveSkills.Passive1,
                    dbToon.DBActiveSkills.Passive2,
                };
            }

            this.HotBarSkills = new HotbarButtonData[6] {
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[0].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // left-click
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[1].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // right-click
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[2].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // bar-1
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[3].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // bar-2
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[4].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // bar-3
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[5].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // bar-4
            };
        }