コード例 #1
0
        public ActionResult Delete(string id = null)
        {
            TrainerList         tList = new TrainerList();
            List <TrainerClass> obj   = tList.GetTrainerClasses(id);

            return(View(obj.FirstOrDefault()));
        }
コード例 #2
0
        public ActionResult Delete(TrainerClass t)
        {
            TrainerList tList = new TrainerList();

            tList.DeleteTrainer(t);
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public void SendSpells(Creature npc, Player player, LocaleConstant locale)
        {
            float reputationDiscount = player.GetReputationPriceDiscount(npc);

            TrainerList trainerList = new TrainerList();

            trainerList.TrainerGUID = npc.GetGUID();
            trainerList.TrainerType = (int)_type;
            trainerList.TrainerID   = (int)_id;
            trainerList.Greeting    = GetGreeting(locale);

            foreach (TrainerSpell trainerSpell in _spells)
            {
                if (!player.IsSpellFitByClassAndRace(trainerSpell.SpellId))
                {
                    continue;
                }

                TrainerListSpell trainerListSpell = new TrainerListSpell();
                trainerListSpell.SpellID      = trainerSpell.SpellId;
                trainerListSpell.MoneyCost    = (uint)(trainerSpell.MoneyCost * reputationDiscount);
                trainerListSpell.ReqSkillLine = trainerSpell.ReqSkillLine;
                trainerListSpell.ReqSkillRank = trainerSpell.ReqSkillRank;
                trainerListSpell.ReqAbility   = trainerSpell.ReqAbility.ToArray();
                trainerListSpell.Usable       = GetSpellState(player, trainerSpell);
                trainerListSpell.ReqLevel     = trainerSpell.ReqLevel;
                trainerList.Spells.Add(trainerListSpell);
            }

            player.SendPacket(trainerList);
        }
コード例 #4
0
 public void DeleteTrainer()
 {
     if (selectedTrainer >= 0 && selectedTrainer < TrainerList.Count)
     {
         TrainerList.RemoveAt(selectedTrainer);
         OnPropertyChanged("TrainerList");
     }
 }
コード例 #5
0
 public ActionResult Create(TrainerClass t)
 {
     if (ModelState.IsValid)
     {
         TrainerList tList = new TrainerList();
         tList.AddTrainer(t);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
コード例 #6
0
        private void LoadTrainer()
        {
            core = new Core();
            TrainerList.Clear();

            foreach (var item in core.UnitOfWork.GetRepo <Trainer>().Query().OrderBy(x => x.Name).ToList())
            {
                TrainerList.Add(item);
            }
        }
コード例 #7
0
        // GET: Trainer
        public ActionResult Index(string strSearch)
        {
            TrainerList         tList = new TrainerList();
            List <TrainerClass> obj   = tList.GetTrainerClasses(string.Empty).OrderBy(x => x.Id_Trainer).ToList();

            if (!string.IsNullOrEmpty(strSearch))
            {
                obj = obj.Where(x => x.Name.Contains(strSearch) || x.ExOrInType.Contains(strSearch) || x.Topic.Contains(strSearch)).ToList();
            }
            @ViewBag.strSearch = strSearch;
            return(View(obj));
        }
コード例 #8
0
        private void LoadMannschaft()
        {
            MannschaftList.Clear();
            foreach (var item in core.UnitOfWork.GetRepo <Mannschaft>().Query().OrderBy(x => x.Name).ToList())
            {
                MannschaftList.Add(item);
            }
            TrainerList.Clear();

            foreach (var item in core.UnitOfWork.GetRepo <Trainer>().Query().OrderBy(x => x.Name).ToList())
            {
                TrainerList.Add(item);
            }
        }
コード例 #9
0
 private void UserWantsToAddTrainer(object obj)
 {
     try
     {
         var trainer = new Trainer {
             Name = "NewTrainer", Geschlecht = Geschlecht.Divers,
             Trainerlizenzstufe = Trainerlizenzstufe.A
         };
         core.UnitOfWork.GetRepo <Trainer>().Add(trainer);
         TrainerList.Add(trainer);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #10
0
ファイル: NPCHandler.cs プロジェクト: mygithome002/CypherCore
        void SendTrainerList(ObjectGuid guid, string title, uint index = 0)
        {
            Creature unit = GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Trainer);

            if (unit == null)
            {
                Log.outDebug(LogFilter.Network, "WORLD: SendTrainerList - {0} not found or you can not interact with him.", guid.ToString());
                return;
            }

            // remove fake death
            if (GetPlayer().HasUnitState(UnitState.Died))
            {
                GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
            }

            TrainerSpellData trainer_spells = unit.GetTrainerSpells();

            if (trainer_spells == null)
            {
                Log.outDebug(LogFilter.Network, "WORLD: SendTrainerList - Training spells not found for {0}", guid.ToString());
                return;
            }

            TrainerList packet = new TrainerList();

            packet.TrainerGUID = guid;
            packet.TrainerType = (int)trainer_spells.trainerType;
            packet.Greeting    = title;

            // reputation discount
            float fDiscountMod = GetPlayer().GetReputationPriceDiscount(unit);

            foreach (var tSpell in trainer_spells.spellList.Values)
            {
                if (index != 0 && tSpell.Index != index)
                {
                    continue;
                }

                bool valid = true;
                for (var i = 0; i < SharedConst.MaxTrainerspellAbilityReqs; i++)
                {
                    if (tSpell.ReqAbility[i] == 0)
                    {
                        continue;
                    }

                    if (!GetPlayer().IsSpellFitByClassAndRace(tSpell.ReqAbility[i]))
                    {
                        valid = false;
                        break;
                    }
                }

                if (!valid)
                {
                    continue;
                }

                TrainerSpellState state = GetPlayer().GetTrainerSpellState(tSpell);

                TrainerListSpell spell = new TrainerListSpell();
                spell.SpellID      = (int)tSpell.SpellID;
                spell.MoneyCost    = (int)Math.Floor(tSpell.MoneyCost * fDiscountMod);
                spell.ReqSkillLine = (int)tSpell.ReqSkillLine;
                spell.ReqSkillRank = (int)tSpell.ReqSkillRank;
                spell.ReqLevel     = (byte)tSpell.ReqLevel;
                spell.Usable       = (state == TrainerSpellState.GreenDisabled ? TrainerSpellState.Green : state);

                byte maxReq = 0;
                for (var i = 0; i < SharedConst.MaxTrainerspellAbilityReqs; ++i)
                {
                    if (tSpell.ReqAbility[i] == 0)
                    {
                        continue;
                    }

                    uint prevSpellId = Global.SpellMgr.GetPrevSpellInChain(tSpell.ReqAbility[i]);
                    if (prevSpellId != 0)
                    {
                        spell.ReqAbility[maxReq] = (int)prevSpellId;
                        ++maxReq;
                    }

                    if (maxReq == 2)
                    {
                        break;
                    }

                    var spellsRequired = Global.SpellMgr.GetSpellsRequiredForSpellBounds(tSpell.ReqAbility[i]);
                    for (var c = 0; c < spellsRequired.Count && maxReq < SharedConst.MaxTrainerspellAbilityReqs; ++c)
                    {
                        spell.ReqAbility[maxReq] = (int)spellsRequired[c];
                        ++maxReq;
                    }

                    if (maxReq == 2)
                    {
                        break;
                    }
                }

                packet.Spells.Add(spell);
            }

            SendPacket(packet);
        }
コード例 #11
0
        private void Button_Trainer(object sender, RoutedEventArgs e)
        {
            var trainer = new TrainerList();

            trainer.Show();
        }