/max Command

Posts 1–15 of 29 · Page 1 of 2
/max Command
Sick and tired of /giving yourself a maxy? well this will help you!

Goto wserver>realm>commands>admincommands.cs
and add this code in


Code:
    class Max : Command
    {
        public Max()
            : base("max", 1)
        {
        }

        protected override bool Process(Player player, RealmTime time, string args)
        {
            try
            {
                player.Stats[0] = player.ObjectDesc.MaxHitPoints;
                player.Stats[1] = player.ObjectDesc.MaxMagicPoints;
                player.Stats[2] = player.ObjectDesc.MaxAttack;
                player.Stats[3] = player.ObjectDesc.MaxDefense;
                player.Stats[4] = player.ObjectDesc.MaxSpeed;
                player.Stats[5] = player.ObjectDesc.MaxHpRegen;
                player.Stats[6] = player.ObjectDesc.MaxMpRegen;
                player.Stats[7] = player.ObjectDesc.MaxDexterity;
                player.SaveToCharacter();
                player.Client.Save();
                player.UpdateCount++;
                player.SendInfo("Success");
            }
            catch
            {
                player.SendError("Unable to max!");
                return false;
            }
            return true;
        }
    }
You will get 8 errors don't worry about this we are not done...

Goto Db>descriptors.cs and find this:

Code:
    public ushort ObjectType { get; private set; }
Above it add these

Code:
    public int MaxHitPoints { get; private set; }
    public int MaxMagicPoints { get; private set; }
    public int MaxAttack { get; private set; }
    public int MaxDefense { get; private set; }
    public int MaxSpeed { get; private set; }
    public int MaxDexterity { get; private set; }
    public int MaxHpRegen { get; private set; }
    public int MaxMpRegen { get; private set; }
after that find this

Code:
        if ((n = elem.Element("Terrain")) != null)
            Terrain = n.Value;
Above it add this

Code:
        if ((n = elem.Element("MaxHitPoints")) != null)
            MaxHP = Utils.FromString(n.Value);
        if ((n = elem.Element("Defense")) != null)
            Defense = Utils.FromString(n.Value);
Next find

Code:
        StasisImmune = elem.Element("StasisImmune") != null;
        Oryx = elem.Element("Oryx") != null;
        Hero = elem.Element("Hero") != null;
Under it add this code

Code:
        if ((n = elem.Element("MaxHitPoints")) != null)
        {
            MaxHitPoints = n.Attribute("max") != null ? Utils.FromString(n.Attribute("max").Value) : -1;
            MaxHP = Utils.FromString(n.Value);
        }
        if ((n = elem.Element("MaxMagicPoints")) != null)
            MaxMagicPoints = n.Attribute("max") != null ? Utils.FromString(n.Attribute("max").Value) : -1;

        if ((n = elem.Element("Attack")) != null)
            MaxAttack = n.Attribute("max") != null ? Utils.FromString(n.Attribute("max").Value) : -1;
        if ((n = elem.Element("Dexterity")) != null)
            MaxDexterity = n.Attribute("max") != null ? Utils.FromString(n.Attribute("max").Value) : -1;
        if ((n = elem.Element("Speed")) != null)
            MaxSpeed = n.Attribute("max") != null ? Utils.FromString(n.Attribute("max").Value) : -1;
        if ((n = elem.Element("HpRegen")) != null)
            MaxHpRegen = n.Attribute("max") != null ? Utils.FromString(n.Attribute("max").Value) : -1;
        if ((n = elem.Element("MpRegen")) != null)
            MaxMpRegen = n.Attribute("max") != null ? Utils.FromString(n.Attribute("max").Value) : -1;

        if ((n = elem.Element("Defense")) != null)
        {
            Defense = Utils.FromString(n.Value);
            MaxDefense = n.Attribute("max") != null ? Utils.FromString(n.Attribute("max").Value) : -1;
        }
 
Credits
Thanks I guess?

Much better than giving myself a maxy
Something that is not useless

Thanks
This is actually a nice and useful command. Good Job.
For club source, there is no descriptor.cs in db.
Quote Originally Posted by Chrisrocks126 View Post
For club source, there is no descriptor.cs in db.
db/data
Could someone help me add this to my server (Club source)?
Quote Originally Posted by qpadones1 View Post
Could someone help me add this to my server (Club source)?
You just asked if somebody could help you adding this?! There is a tutorial right above your head. Look up
I know, but for some reason i get errors when i added it.
Quote Originally Posted by qpadones1 View Post
I know, but for some reason i get errors when i added it.
then show us the errors (screenys pl0x)
i forgot to give credits to @ossimc82 for making this
Lel it don't worked for me!

Quote Originally Posted by Daemonmann View Post
Lel it don't worked for me!

You have to add it to the objectdesc xml element...
Posts 1–15 of 29 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?