Beispiel #1
0
        public void TeachDiscipline(NWCreature teacher, int teachableIndex, int curLev)
        {
            LeaderBrain   party = (LeaderBrain)fBrain;
            int           id    = StaticData.dbTeachable[teachableIndex].Id;
            TeachableKind kind  = StaticData.dbTeachable[teachableIndex].Kind;

            int price = (int)Space.GetTeachablePrice(teachableIndex, curLev);

            SubMoney(price);
            teacher.AddMoney(price);

            switch (kind)
            {
            case TeachableKind.Ability:
            {
                SetAbility((AbilityID)id, curLev + 1);

                int num2 = party.Members.Count;
                for (int i = 1; i < num2; i++)
                {
                    NWCreature j = party.Members[i];
                    j.SetAbility((AbilityID)id, curLev + 1);
                }
            }
            break;

            case TeachableKind.Skill:
            {
                SetSkill((SkillID)id, curLev + 1);

                int num = party.Members.Count;
                for (int i = 1; i < num; i++)
                {
                    NWCreature j = party.Members[i];
                    j.SetSkill((SkillID)id, curLev + 1);
                }
            }
            break;
            }
        }
Beispiel #2
0
 public TeachableRec(int id, TeachableKind kind, int comment)
 {
     Id        = id;
     Kind      = kind;
     CommentRS = comment;
 }
        private void UpdateView()
        {
            fDisciplinesList.Items.BeginUpdate();
            fDisciplinesList.Items.Clear();
            NWCreature clt = fCollocutor;
            Player     p   = GlobalVars.nwrGame.Player;

            for (int i = 0; i < StaticData.dbTeachable.Length; i++)
            {
                int           id   = StaticData.dbTeachable[i].Id;
                bool          res  = false;
                TeachableKind kind = StaticData.dbTeachable[i].Kind;

                string s          = "";
                int    imageIndex = -1;
                int    curLev     = 0;
                switch (kind)
                {
                case TeachableKind.Ability:
                    AbilityRec abRec = StaticData.dbAbilities[id];
                    AbilityID  ab    = (AbilityID)id;
                    if (clt.GetAbility(ab) > 0)
                    {
                        s          = BaseLocale.GetStr(abRec.Name);
                        imageIndex = -1;
                        curLev     = p.GetAbility(ab);
                        res        = (curLev < clt.GetAbility(ab));
                    }
                    break;

                case TeachableKind.Skill:
                    SkillRec skRec = StaticData.dbSkills[id];
                    SkillID  sk    = (SkillID)id;
                    if (clt.GetSkill(sk) >= 0)
                    {
                        s          = BaseLocale.GetStr(skRec.Name);
                        imageIndex = skRec.ImageIndex;
                        curLev     = p.GetSkill(sk);
                        res        = (curLev < clt.GetSkill(sk));
                    }
                    break;
                }

                int price = (int)GlobalVars.nwrGame.GetTeachablePrice(i, curLev);

                if (res)
                {
                    string st       = " ( " + Convert.ToString(curLev) + " -> " + Convert.ToString(curLev + 1) + " )";
                    LBItem listItem = fDisciplinesList.Items.Add(s + st, new TeachItem(i, curLev, price));
                    if (price > p.Money)
                    {
                        listItem.Color = Colors.Red;
                    }
                    else
                    {
                        listItem.Color = Colors.Gold;
                    }
                    listItem.ImageIndex = imageIndex;
                    listItem.SubItems.Add(Convert.ToString(price), null);
                }
            }

            fDisciplinesList.Items.EndUpdate();
        }