Пример #1
0
        private static void ProcessChannelStatus(PlayerInstance ch, string argument,
                                                 Action <CharacterInstance, ChannelTypes> clearAction, Action <CharacterInstance, ChannelTypes> verifyAction)
        {
            if (argument.EqualsIgnoreCase("all"))
            {
                foreach (var chType in ClearAllList)
                {
                    clearAction.Invoke(ch, chType);
                }
                return;
            }

            var channelType = EnumerationExtensions.GetEnumByName <ChannelTypes>(argument);

            var attrib = channelType.GetAttribute <ChannelAttribute>();

            if (attrib == null)
            {
                throw new InvalidOperationException();
            }

            var minTrust    = 0;
            var trustAttrib = channelType.GetAttribute <RequireTrustChannelAttribute>();

            if (trustAttrib != null)
            {
                minTrust = GameConstants.GetConstant <int>(trustAttrib.TrustType);
            }

            if (attrib.Verify(channelType, ch, minTrust))
            {
                verifyAction.Invoke(ch, channelType);
            }
        }
Пример #2
0
 private static int GetDuration(int level)
 {
     checked
     {
         return(10 * level * GameConstants.GetConstant <int>("AffectDurationConversionValue"));
     }
 }
Пример #3
0
        private static string GetChannelText(ChannelTypes channelType, PlayerInstance ch)
        {
            var attrib = channelType.GetAttribute <ChannelAttribute>();

            if (attrib == null)
            {
                throw new InvalidOperationException();
            }

            var minTrust    = 0;
            var trustAttrib = channelType.GetAttribute <RequireTrustChannelAttribute>();

            if (trustAttrib != null)
            {
                minTrust = GameConstants.GetConstant <int>(trustAttrib.TrustType);
            }

            if (attrib.Verify(channelType, ch, minTrust))
            {
                var print = channelType.GetAttribute <ChannelPrintAttribute>();
                if (print == null)
                {
                    throw new InvalidOperationException("ChannelPrint attribute missing from ChannelType");
                }

                return(!ch.Deaf.IsSet(channelType) ? print.On : print.Off);
            }
            return(string.Empty);
        }
Пример #4
0
        public static int GetAdjustedRepairCost(MobileInstance keeper, ObjectInstance obj)
        {
            if (obj == null || keeper.MobIndex.Shop == null)
            {
                return(0);
            }

            var shop = keeper.MobIndex.RepairShop;
            var cost = shop.ItemTypes.ToList().Any(x => x == obj.ItemType) ? obj.Cost * shop.ProfitFix / 1000 : 0;

            if (cost <= 0)
            {
                cost = 1;
            }

            switch (obj.ItemType)
            {
            case ItemTypes.Armor:
                cost = obj.GetArmorRepairCost(cost);
                break;

            case ItemTypes.Weapon:
                cost = obj.GetWeaponRepairCost(cost, GameConstants.GetConstant <int>("InitWeaponCondition"));
                break;

            case ItemTypes.Wand:
            case ItemTypes.Staff:
                cost = obj.GetImplementRepairCost(cost);
                break;
            }

            return(cost);
        }
Пример #5
0
        public static ReturnTypes spell_create_mob(int sn, int level, CharacterInstance ch, object vo)
        {
            var skill = RepositoryManager.Instance.SKILLS.Get(sn);

            var targetName = Cast.TargetName;

            var lvl = GetMobLevel(skill, level);
            var id  = skill.value;

            if (id == 0)
            {
                if (!targetName.Equals("cityguard"))
                {
                    id = GameConstants.GetVnum("cityguard");
                }
                else if (!targetName.Equals("vampire"))
                {
                    id = GameConstants.GetVnum("vampire");
                }
            }

            var mi = RepositoryManager.Instance.MOBILETEMPLATES.Get(id);

            if (CheckFunctions.CheckIfNullObjectCasting(mi, skill, ch))
            {
                return(ReturnTypes.None);
            }

            var mob = RepositoryManager.Instance.CHARACTERS.Create(mi);

            if (CheckFunctions.CheckIfNullObjectCasting(mob, skill, ch))
            {
                return(ReturnTypes.None);
            }

            mob.Level         = lvl.GetLowestOfTwoNumbers(!string.IsNullOrEmpty(skill.Dice) ? magic.ParseDiceExpression(ch, skill.Dice) : mob.Level);
            mob.ArmorClass    = mob.Level.Interpolate(100, -100);
            mob.MaximumHealth = mob.Level * 8 + SmaugRandom.Between(mob.Level * mob.Level / 4, mob.Level * mob.Level);
            mob.CurrentHealth = mob.MaximumHealth;
            mob.CurrentCoin   = 0;

            ch.SuccessfulCast(skill, mob);
            ch.CurrentRoom.AddTo(mob);
            mob.AddFollower(ch);

            var af = new AffectData
            {
                Type     = EnumerationExtensions.GetEnum <AffectedByTypes>((int)skill.ID),
                Duration = (SmaugRandom.Fuzzy((level + 1) / 3) + 1) *
                           GameConstants.GetConstant <int>("AffectDurationConversionValue")
            };

            mob.AddAffect(af);

            return(ReturnTypes.None);
        }
Пример #6
0
 public override void Load()
 {
     Kernel.Bind <IWeatherManager>().To <WeatherManager>().InSingletonScope()
     .WithConstructorArgument("logManager", Kernel.Get <ILogManager>())
     .WithConstructorArgument("kernel", Kernel)
     .WithConstructorArgument("dbContext", Kernel.Get <ISmaugDbContext>())
     .OnActivation(x => x.Initialize(Kernel.Get <IGameManager>().GameTime,
                                     GameConstants.GetConstant <int>("WeatherWidth"),
                                     GameConstants.GetConstant <int>("WeatherHeight")));
 }
Пример #7
0
        /// <summary>
        /// PArse a name for acceptability
        /// </summary>
        /// <param name="name"></param>
        /// <param name="newchar"></param>
        /// <returns></returns>
        /// <remarks> Name checking should really only be done on new characters, otherwise
        /// we could end up with people who can't access their characters.
        /// </remarks>
        public static bool check_parse_name(string name, bool newchar)
        {
            if (name.Length < GameConstants.GetConstant <int>("MinNameLength") ||
                name.Length > GameConstants.GetConstant <int>("MaxNameLength"))
            {
                return(false);
            }

            return(name.IsAlphaNum());
        }
Пример #8
0
        public override void Load()
        {
            Kernel.Bind <ITimer>().To <CommonTimer>().Named("LogDumpTimer")
            .OnActivation(x => x.Interval = GameConstants.GetConstant <int>("LogDumpFrequencyMS"));

            Kernel.Bind <ILogManager>().To <LogManager>().InSingletonScope()
            .WithConstructorArgument("logWrapper", Kernel.Get <ILogWrapper>())
            .WithConstructorArgument("kernel", Kernel)
            .WithConstructorArgument("timer", Kernel.Get <ITimer>("LogDumpTimer"))
            .WithConstructorArgument("dbContext", Kernel.Get <ISmaugDbContext>())
            .WithConstructorArgument("sessionId", _sessionId);
        }
Пример #9
0
        private static void AddAffectToTarget(CharacterInstance ch, int sn, int level, ApplyTypes appLocation)
        {
            int duration = 4 * level * GameConstants.GetConstant <int>("AffectDurationConversionValue");
            var af       = new AffectData
            {
                SkillNumber = sn,
                Duration    = duration,
                Location    = appLocation,
                Modifier    = -1
            };

            ch.AddAffect(af);
        }
Пример #10
0
        public override void Load()
        {
            Kernel.Bind <ITimer>().To <CommonTimer>().Named("AuctionPulseTimer")
            .OnActivation(x => x.Interval = GameConstants.GetConstant <int>("AuctionPulseSeconds"));

            Kernel.Bind <IAuctionRepository>().To <AuctionRepository>()
            .WithConstructorArgument("logManager", Kernel.Get <ILogManager>())
            .WithConstructorArgument("dbContext", Kernel.Get <ISmaugDbContext>());

            Kernel.Bind <IAuctionManager>().To <AuctionManager>().InSingletonScope()
            .WithConstructorArgument("kernel", Kernel)
            .WithConstructorArgument("timer", Kernel.Get <ITimer>("AuctionPulseTimer"))
            .WithConstructorArgument("repository", Kernel.Get <IAuctionRepository>())
            .OnActivation(x => x.Initialize());
        }
Пример #11
0
 private static void UpdateWeapon(ObjectInstance obj)
 {
     if (obj.Value.ToList()[1] > 0 && obj.Value.ToList()[2] > 0)
     {
         obj.Value.ToList()[2] = obj.Value.ToList()[1];
     }
     else
     {
         obj.Value.ToList()[1] = SmaugRandom.Fuzzy(1 * obj.Level / 4 + 2);
         obj.Value.ToList()[2] = SmaugRandom.Fuzzy(3 * obj.Level / 4 + 6);
     }
     if (obj.Value.ToList()[0] == 0)
     {
         obj.Value.ToList()[0] = GameConstants.GetConstant <int>("InitWeaponCondition");
     }
 }
Пример #12
0
        private static void RemoveDevotion(PlayerInstance ch)
        {
            if (CheckFunctions.CheckIfNullObject(ch, ch.PlayerData.CurrentDeity,
                                                 "You have already chosen to worship no deities."))
            {
                return;
            }

            var deity = ch.PlayerData.CurrentDeity;

            --deity.Worshippers;
            if (deity.Worshippers < 0)
            {
                deity.Worshippers = 0;
            }

            ch.PlayerData.Favor = -2500;
            ch.MentalState      = -80;
            ch.SendTo("A terrible curse afflicts you as you forsake a deity!");

            ch.AffectedBy.RemoveBits(deity.Affected);
            ch.Resistance.RemoveBit(deity.Element);
            ch.Susceptibility.RemoveBit(deity.Suscept);

            var af = new AffectData
            {
                Type      = AffectedByTypes.Blind,
                Location  = ApplyTypes.HitRoll,
                Modifier  = -4,
                Duration  = 50 * GameConstants.GetConstant <int>("AffectDurationConversionValue"),
                BitVector = ExtendedBitvector.Meb((int)AffectedByTypes.Blind)
            };

            ch.AddAffect(af);

            // TODO Save the deity data to the database
            // save_deity(ch->pcdata->deity);

            ch.SendTo("You cease to worship any deity.");
            ch.PlayerData.CurrentDeity = null;
            save.save_char_obj(ch);
        }
Пример #13
0
 private static int GetMaxKillTrack()
 {
     return(GameConstants.GetConstant <int>("MaxKillTrack"));
 }
Пример #14
0
 private static int GetDuration(int level)
 {
     return((1 + level / 3) * GameConstants.GetConstant <int>("AffectDurationConversionValue"));
 }
Пример #15
0
 private static int GetGodLevel()
 {
     return(GameConstants.GetConstant <int>("MaximumLevel") - 7);
 }
Пример #16
0
 private static int GetMaximumCondition()
 {
     return(GameConstants.GetConstant <int>("MaximumConditionValue"));
 }
Пример #17
0
        private static void LowerVictimLevel(CharacterInstance ch, CharacterInstance victim, int level)
        {
            victim.SetColor(ATTypes.AT_IMMORT);

            if (victim.Level >= LevelConstants.AvatarLevel && victim.IsImmortal())
            {
                var victimPc = (PlayerInstance)victim;

                if (victimPc.PlayerData.Bestowments.Any())
                {
                    victimPc.PlayerData.Bestowments.Clear();
                }

                victim.Act.RemoveBit((int)PlayerFlags.HolyLight);
                if (!((PlayerInstance)victim).IsRetired())
                {
                    // todo remove immortal data
                    // snprintf(buf, MAX_INPUT_LENGTH, "%s%s", GOD_DIR, capitalize(victim->name));

                    //if (!remove(buf))
                    //    send_to_char("Player's immortal data destroyed.\r\n", ch);
                }
            }

            if (level < victim.Level)
            {
                int tempLevel = victim.Level;
                victim.Level = level;
                handler.check_switch(victim, false);
                victim.Level = tempLevel;

                ch.Printf("Demoting %s from level %d to level %d!", victim.Name, victim.Level);
                victim.SendTo("Cursed and forsaken!  The gods have lowered your level...");
            }
            else
            {
                ch.Printf("%s is already level %d.  Re-advancing...", victim.Name, level);
                victim.SendTo("Deja vu!  Your mind reels as you re-live your past levels!");
            }

            victim.Level           = 1;
            victim.Experience      = victim.GetExperienceLevel(1);
            victim.MaximumHealth   = GameConstants.GetConstant <int>("DefaultMaximumHealth");
            victim.MaximumMana     = GameConstants.GetConstant <int>("DefaultMaximumMana");
            victim.MaximumMovement = GameConstants.GetConstant <int>("DefaultMaximumMovement");

            if (victim is PlayerInstance)
            {
                var player = victim as PlayerInstance;
                player.PlayerData.ClearLearnedSkills();
            }

            victim.Practice        = 0;
            victim.CurrentHealth   = victim.MaximumHealth;
            victim.CurrentMana     = victim.MaximumMana;
            victim.CurrentMovement = victim.MaximumMovement;

            if (!(victim is PlayerInstance))
            {
                return;
            }

            PlayerInstance playerVictim = (PlayerInstance)victim;

            playerVictim.AdvanceLevel();
            playerVictim.PlayerData.rank            = string.Empty;
            playerVictim.PlayerData.WizardInvisible = playerVictim.Trust;
            if (playerVictim.Level > LevelConstants.AvatarLevel)
            {
                return;
            }

            playerVictim.Act.RemoveBit((int)PlayerFlags.WizardInvisibility);
            playerVictim.PlayerData.WizardInvisible = 0;
        }
Пример #18
0
        public static void do_advance(CharacterInstance ch, string argument)
        {
            ch.SetColor(ATTypes.AT_IMMORT);

            string firstArg  = argument.FirstWord();
            string secondArg = argument.SecondWord();

            if (CheckFunctions.CheckIf(ch,
                                       () => string.IsNullOrEmpty(firstArg) || string.IsNullOrEmpty(secondArg) || !secondArg.IsNumeric(),
                                       "Syntax:  advance <character> <Level>"))
            {
                return;
            }

            var victim = ch.GetCharacterInRoom(firstArg);

            if (CheckFunctions.CheckIfNullObject(ch, victim, "That character is not in the room."))
            {
                return;
            }
            if (CheckFunctions.CheckIfNpc(ch, victim, "You cannot advance a non-player-character."))
            {
                return;
            }
            if (CheckFunctions.CheckIf(ch, () => ch.Trust <= victim.Trust || ch == victim, "You can't do that."))
            {
                return;
            }

            var level = Convert.ToInt32(secondArg);

            if (CheckFunctions.CheckIf(ch, () => level < 1 || level > GameConstants.GetConstant <int>("MaximumLevel"),
                                       $"Level range is 1 to {GameConstants.GetConstant<int>("MaximumLevel")}."))
            {
                return;
            }
            if (CheckFunctions.CheckIf(ch, () => level > ch.Trust, "Level limited to your trust level."))
            {
                return;
            }

            if (level <= victim.Level)
            {
                LowerVictimLevel(ch, victim, level);
            }
            else
            {
                RaiseVictimLevel(ch, victim, level);
            }

            for (int i = victim.Level; i < level; i++)
            {
                if (level < LevelConstants.ImmortalLevel)
                {
                    victim.SendTo("You raise a level!");
                }
                victim.Level += 1;
                if (victim is PlayerInstance)
                {
                    ((PlayerInstance)victim).AdvanceLevel();
                }
            }

            victim.Experience = victim.GetExperienceLevel(victim.Level);
            victim.Trust      = 0;
        }
Пример #19
0
 private static int GetMaximumFight()
 {
     return(GameConstants.GetConstant <int>("MaximumFight"));
 }
Пример #20
0
 private static int GetDuration(int level)
 {
     return((SmaugRandom.Fuzzy((level + 1) / 5) + 1) *
            GameConstants.GetConstant <int>("AffectDurationConversionValue"));
 }
Пример #21
0
 private static int GetLevelAvatar()
 {
     return(GameConstants.GetConstant <int>("level_avatar"));
 }
Пример #22
0
        public static ReturnTypes ranged_attack(CharacterInstance ch, string argument, ObjectInstance weapon,
                                                ObjectInstance projectile, int sn, int range)
        {
            var firstArg  = argument.FirstWord();
            var secondArg = argument.SecondWord();

            if (firstArg.IsNullOrEmpty())
            {
                ch.SendTo("Where?  At whom?");
                return(ReturnTypes.None);
            }

            CharacterInstance victim = null;
            var exit = ch.CurrentRoom.GetExit(firstArg);

            if (exit == null)
            {
                victim = ch.GetCharacterInRoom(firstArg);
                if (victim == null)
                {
                    ch.SendTo("Aim in what direction?");
                    return(ReturnTypes.None);
                }

                if (ch.CurrentFighting.Who == victim)
                {
                    ch.SendTo("They are too close to release that type of attack!");
                    return(ReturnTypes.None);
                }
            }

            if (victim != null)
            {
                if (ch.CurrentRoom.IsPrivate() || ch.CurrentRoom.Flags.IsSet(RoomFlags.Solitary))
                {
                    ch.SendTo("You cannot perform a ranged attack from a private room.");
                    return(ReturnTypes.None);
                }

                if (ch.CurrentRoom.Tunnel > 0)
                {
                    if (ch.CurrentRoom.Contents.OfType <CharacterInstance>().Count() >= ch.CurrentRoom.Tunnel)
                    {
                        ch.SendTo("This room is too cramped to perform such an attack.");
                        return(ReturnTypes.None);
                    }
                }
            }

            SkillData skill = null;

            if (Macros.IS_VALID_SN(sn))
            {
                skill = RepositoryManager.Instance.GetEntity <SkillData>(sn);
            }

            if (exit != null && exit.GetDestination() == null)
            {
                ch.SendTo("Are you expecting to fire through a wall?!");
                return(ReturnTypes.None);
            }

            if (exit != null && exit.Flags.IsSet(ExitFlags.Closed))
            {
                if (exit.Flags.IsSet(ExitFlags.Secret) || exit.Flags.IsSet(ExitFlags.Dig))
                {
                    ch.SendTo("Are you expecting to fire through a wall?!");
                }
                else
                {
                    ch.SendTo("Are you expecting to fire through a door?!");
                }
                return(ReturnTypes.None);
            }

            CharacterInstance vch = null;

            if (exit != null && !string.IsNullOrEmpty(secondArg))
            {
                vch = scan_for_victim(ch, exit, secondArg);
                if (vch == null)
                {
                    ch.SendTo("You cannot see your target.");
                    return(ReturnTypes.None);
                }

                if (vch.CurrentRoom.Flags.IsSet(RoomFlags.NoMissile))
                {
                    ch.SendTo("You can't get a clean shot off.");
                    return(ReturnTypes.None);
                }

                if (vch.NumberFighting > GameConstants.GetConstant <int>("MaximumCombatants"))
                {
                    ch.SendTo("There is too much activity there for you to get a clear shot.");
                    return(ReturnTypes.None);
                }
            }

            if (vch != null)
            {
                if (!vch.IsNpc() && !ch.IsNpc() && ch.Act.IsSet((int)PlayerFlags.Nice))
                {
                    ch.SendTo("You're too nice to do that!");
                    return(ReturnTypes.None);
                }
                if (fight.is_safe(ch, vch, true))
                {
                    return(ReturnTypes.None);
                }
            }

            var was_in_room = ch.CurrentRoom;

            if (projectile != null)
            {
                //todo handler.separate_obj(projectile);

                var action = weapon != null ? "fire" : "throw";
                if (exit != null)
                {
                    comm.act(ATTypes.AT_GREY, $"You {action} $p $T.", ch, projectile, exit.Direction.GetName(),
                             ToTypes.Character);
                    comm.act(ATTypes.AT_GREY, $"$n {action}s $p $T.", ch, projectile, exit.Direction.GetName(),
                             ToTypes.Room);
                }
                else
                {
                    comm.act(ATTypes.AT_GREY, $"You {action} $p at $N.", ch, projectile, victim, ToTypes.Character);
                    comm.act(ATTypes.AT_GREY, $"$n {action}s $p at $N.", ch, projectile, victim, ToTypes.NotVictim);
                    comm.act(ATTypes.AT_GREY, $"$n {action}s $p at you!", ch, projectile, victim, ToTypes.Victim);
                }
            }
            else if (skill != null)
            {
                var skillText = GetSkillText(skill);

                if (skill.Type == SkillTypes.Spell)
                {
                    var color = ATTypes.AT_MAGIC;
                    if (exit != null)
                    {
                        comm.act(color, "You release $t $T.", ch, skillText.AddArticle(ArticleAppendOptions.TheToFront),
                                 exit.Direction.GetName(), ToTypes.Character);
                        comm.act(color, "$n releases $s $t $T.", ch, skillText, exit.Direction.GetName(), ToTypes.Room);
                    }
                    else
                    {
                        comm.act(color, "You release $t at $N.", ch, skillText.AddArticle(ArticleAppendOptions.TheToFront),
                                 victim, ToTypes.Character);
                        comm.act(color, "$n releases $s $t at $N.", ch, skillText, victim, ToTypes.NotVictim);
                        comm.act(color, "$n releases $s $t at you!", ch, skillText, victim, ToTypes.Victim);
                    }
                }
            }
            else
            {
                //todo record bug, missing projectile and skill
                return(ReturnTypes.None);
            }

            if (victim != null)
            {
                fight.check_illegal_pk(ch, victim);
                ch.CheckAttackForAttackerFlag(victim);
                return(ranged_got_target(ch, victim, weapon, projectile, 0, sn, "burst of energy", ATTypes.AT_GREY));
            }

            victim = vch;
            var dtxt = act_move.rev_exit(exit.Direction);

            var dist = 0;

            while (dist <= range)
            {
                ch.CurrentRoom.RemoveFrom(ch);
                exit.GetDestination().AddTo(ch);

                if (exit.Flags.IsSet(ExitFlags.Closed))
                {
                    var color = projectile != null ? ATTypes.AT_GREY : ATTypes.AT_MAGIC;

                    var txt =
                        $"You see your {(projectile != null ? projectile.Name : GetSkillText(skill))} {(projectile != null ? "pierce" : "hit")} a door in the distance to the {exit.Direction.GetName()}.";
                    comm.act(color, txt, ch, null, null, ToTypes.Character);

                    if (projectile != null)
                    {
                    }
                }
            }

            ch.CurrentRoom.RemoveFrom(ch);
            was_in_room.AddTo(ch);

            return(ReturnTypes.None);
        }
Пример #23
0
        public static void repair_one_obj(CharacterInstance ch, MobileInstance keeper, ObjectInstance obj,
                                          string arg, int maxgold, string fixstr, string fixstr2)
        {
            int    cost;
            string buffer;

            if (!ch.CanDrop(obj))
            {
                ch.Printf("You can't let go of %s.\r\n", obj.Name);
            }
            else if ((cost = Appraise.GetAdjustedRepairCost(keeper, obj)) < 0)
            {
                if (cost < 0)
                {
                    comm.act(ATTypes.AT_TELL,
                             cost != -2
                                 ? "$n tells you, 'Sorry, I can't do anything with $p.'"
                                 : "$n tells you, '$p looks fine to me!'", keeper, obj, ch, ToTypes.Victim);
                }
            }

            // repair all gets a 10% surcharge
            else if ((cost = arg.Equals("all") ? cost : 11 * (cost / 10)) > ch.CurrentCoin)
            {
                buffer =
                    $"$N tells you, 'It will cost {cost} piece{(cost == 1 ? "" : "s")} of gold to {fixstr} {obj.Name}...'";
                comm.act(ATTypes.AT_TELL, buffer, ch, null, keeper, ToTypes.Character);
                comm.act(ATTypes.AT_TELL, "$n tells you, 'Which I see you can't afford.'", ch, null, keeper, ToTypes.Character);
            }
            else
            {
                buffer = $"$n gives $p to $N, who quickly {fixstr2} it.";
                comm.act(ATTypes.AT_ACTION, buffer, ch, obj, keeper, ToTypes.Room);

                buffer = $"$n charges you {cost} gold piece{(cost == 1 ? "" : "s")} to {fixstr} $p.";
                comm.act(ATTypes.AT_ACTION, buffer, ch, obj, keeper, ToTypes.Character);

                ch.CurrentCoin     -= cost;
                keeper.CurrentCoin += cost;

                if (keeper.CurrentCoin < 0)
                {
                    keeper.CurrentCoin = 0;
                }
                else if (keeper.CurrentCoin > maxgold)
                {
                    keeper.CurrentRoom.Area.BoostEconomy(keeper.CurrentCoin - maxgold / 2);
                    keeper.CurrentCoin = maxgold / 2;
                    comm.act(ATTypes.AT_ACTION, "$n puts some gold into a large safe.", keeper, null, null, ToTypes.Room);
                }

                switch (obj.ItemType)
                {
                default:
                    ch.SendTo("For some reason, you think you got ripped off...");
                    break;

                case ItemTypes.Armor:
                    obj.Values.CurrentAC = obj.Values.OriginalAC;
                    break;

                case ItemTypes.Weapon:
                    obj.Values.Condition = GameConstants.GetConstant <int>("InitWeaponCondition");
                    break;

                case ItemTypes.Wand:
                case ItemTypes.Staff:
                    obj.Values.Charges = obj.Values.MaxCharges;
                    break;
                }

                MudProgHandler.ExecuteObjectProg(MudProgTypes.Repair, ch, obj);
            }
        }