Ejemplo n.º 1
0
        public bool OnCommand(Character chr, string args)
        {
            if (!GameTalent.GameTalentDictionary.ContainsKey(args))
            {
                chr.WriteToDisplay("The talent " + args + " does not exist.");
                return(true);
            }

            GameTalent gTalent = GameTalent.GameTalentDictionary[args];

            if (!chr.talentsDictionary.ContainsKey(gTalent.Command))
            {
                chr.WriteToDisplay("You do not know the " + gTalent.Name + " talent.");
                return(true);
            }

            if (!gTalent.IsPassive)
            {
                chr.WriteToDisplay("Only passive talents may be toggled.");
                return(true);
            }

            if (!chr.DisabledPassiveTalents.Contains(gTalent.Command))
            {
                chr.DisabledPassiveTalents.Add(gTalent.Command);
                chr.WriteToDisplay("Your " + gTalent.Name + " talent has been disabled.");
            }
            else
            {
                chr.DisabledPassiveTalents.Remove(gTalent.Command);
                chr.WriteToDisplay("Your " + gTalent.Name + " talent has been enabled.");
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool OnCommand(Character chr, string args)
        {
            if (chr.talentsDictionary.Count <= 0)
            {
                chr.WriteToDisplay("You have not learned any talents.");
            }
            else
            {
                foreach (string s in chr.talentsDictionary.Keys)
                {
                    if (!GameTalent.GameTalentDictionary.ContainsKey(s))
                    {
                        Utils.Log("Invalid talent in " + chr.GetLogString() + " list. String: " + s + " -- Deleting from PlayerTalents database.", Utils.LogType.SystemWarning);
                        chr.talentsDictionary.Remove(s);
                        DAL.DBPlayer.DeletePlayerTalent((chr as PC).UniqueID, s);
                        continue;
                    }

                    GameTalent gt = GameTalent.GameTalentDictionary[s];

                    string info = gt.Name + " - " + gt.Description + " (" + (gt.IsPassive ? "passive, " + gt.PerformanceCost.ToString() + " stamina" : gt.PerformanceCost.ToString() + " stamina") + ")";

                    if (!gt.IsPassive)
                    {
                        if (DateTime.UtcNow - gt.DownTime >= chr.talentsDictionary[s])
                        {
                            info += " [READY]";
                        }
                        else
                        {
                            int roundsRemaining = Utils.TimeSpanToRounds(gt.DownTime - (DateTime.UtcNow - chr.talentsDictionary[s]));
                            info += " [" + roundsRemaining + " RNDS]";
                        }
                    }
                    else if (chr.DisabledPassiveTalents.Contains(gt.Command))
                    {
                        info += " [DISABLED]";
                    }


                    chr.WriteToDisplay(info);
                    // TODO: add time until available
                }

                chr.WriteToDisplay("You have learned " + chr.talentsDictionary.Count + " talent" + (chr.talentsDictionary.Count > 1 ? "s" : "") + ".");
            }

            return(true);
        }