December 14, 2018, 05:37:51 AM

Vita-Nex: Core



ServUO
Ultima Shards: Multiverse

JetBrains

User Info

 
 
Welcome, Guest. Please login or register.

Who's Online

  • Dot Guests: 5
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

Advertisment

Show Posts

* Messages | Topics | Attachments

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Greed

Pages: [1] 2
1
Module Support / Re: Battle Rewards that are tied to the PlayerMobile
« on: October 01, 2015, 08:37:35 PM »
That's brilliant, thanks Lee.  ;D

2
Module Support / Battle Rewards that are tied to the PlayerMobile
« on: September 29, 2015, 11:40:06 PM »
Hi Lee,

Just have a quick question (hopefully) hehe. Specifically, I'm interested in using a battle reward that is tied to the playermobile. I have already tied PvPPoints to the playermobile but I'm unsure on how to use them as a reward for your most excellent battles system. Of course I've already figured out using items as rewards, and that works just swell, but a PlayerMobile currency as a battle reward seems to be a little confusing for me. Thanks so much any reply.

Best,

Jeff (Greed)

3
Module Support / Re: ADM Assistance
« on: July 29, 2015, 06:22:07 AM »
Wowwww awesome!!!!! =D

Btw Lee, I finally figured out this was my issue all along. I stupidly didn't realize the webserver uses 5.6.22 (a thousand apologies for wasting your time before). Please forgive me! Also super excited about the next release. Woohoo!

5
Looks like you're missing this file

C:\Users\WB\Documents\RunUOTest\Scripts\Vita-Nex Core 2.2.0.0\LICE
NSE'

6
Custom Support / Re: Customizing the Skill Codex
« on: February 12, 2015, 04:07:40 PM »
Oh Ok  ;D

Now that does compile but it doesn't seem to get rid of the ignored skills. Hmm.

Code: [Select]
#region Header
//   Vorspire    _,-'/-'/  SkillCodex.cs
//   .      __,-; ,'( '/
//    \.    `-.__`-._`:_,-._       _ , . ``
//     `:-._,------' ` _,`--` -: `_ , ` ,' :
//        `---..__,,--'  (C) 2014  ` -'. -'
//        #  Vita-Nex [http://core.vita-nex.com]  #
//  {o)xxx|===============-   #   -===============|xxx(o}
//        #        The MIT License (MIT)          #
#endregion

#region References
using System;
using System.Collections.Generic;
using System.Drawing;

using Server;
using Server.Mobiles;

using VitaNex.Items;
using VitaNex.SuperGumps;
using VitaNex.SuperGumps.UI;
#endregion

namespace Server.Items
{
    public abstract class SkillCodexBase : SkillCodex
    {
        private static readonly SkillName[] DefaultIgnoredSkills = { SkillName.Mysticism, SkillName.Imbuing };

        public SkillCodexBase(int count, double value, bool deleteWhenEmpty, SkillCodexMode mode, SkillCodexFlags flags)
            : base(count, value, deleteWhenEmpty, mode, flags)
        {
            IgnoredSkills.AddRange(new[] { SkillName.Alchemy, SkillName.Macing, SkillName.Imbuing });
        }

        public SkillCodexBase(Serial serial)
            : base(serial)
        { }

        public override bool ValidateSkill(Mobile user, Skill skill, bool message)
        {
            if (user is PlayerMobile)
            {
                var pm = (PlayerMobile)user;

                if (skill.SkillName == SkillName.Spellweaving)
                {
                    if (!pm.Spellweaving)
                    {
                        if (message)
                        {
                            pm.SendMessage(
                                SuperGump.DefaultErrorHue,
                                "You must complete the Patience or Discipline quest chains to unlock {0}.",
                                skill.Name);
                        }

                        return false;
                    }
                }
            }

            return base.ValidateSkill(user, skill, message);
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            var version = 0;

            writer.Write(version);

            switch (version)
            {
                case 0:
                    { }
                    break;
            }
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    { }
                    break;
            }
        }
    }

    public abstract class SkillCodexFixedBase : SkillCodexBase
    {
        public SkillCodexFixedBase(int count, double value)
            : base(count, value, true, SkillCodexMode.Fixed, SkillCodexFlags.Base)
        { }

        public SkillCodexFixedBase(Serial serial)
            : base(serial)
        { }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            var version = 0;

            writer.Write(version);

            switch (version)
            {
                case 0:
                    { }
                    break;
            }
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    { }
                    break;
            }
        }
    }
}

namespace VitaNex.Items
{
public enum SkillCodexFlags : byte
{
Base = 0x00,
Cap = 0x01,
Both = 0x02
}

public enum SkillCodexMode : byte
{
Fixed = 0x00,
Increase = 0x01,
Decrease = 0x02
}

public class SkillCodex : Item
{
private SuperGump SelectionGump { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public SkillCodexMode Mode { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public SkillCodexFlags Flags { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public int Count { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public double Value { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public int ValueFixed { get { return (int)(Value * 10); } set { Value = value / 10; } }

[CommandProperty(AccessLevel.GameMaster)]
public bool DeleteWhenEmpty { get; set; }

public List<SkillName> IgnoredSkills { get; protected set; }
public List<SkillName> SelectedSkills { get; protected set; }

[Constructable]
public SkillCodex()
: this(1)
{ }

[Constructable]
public SkillCodex(int count)
: this(count, 100.0)
{ }

[Constructable]
public SkillCodex(int count, double value)
: this(count, value, true)
{ }

[Constructable]
public SkillCodex(int count, double value, bool deleteWhenEmpty)
: this(count, value, deleteWhenEmpty, SkillCodexMode.Fixed)
{ }

[Constructable]
public SkillCodex(int count, double value, bool deleteWhenEmpty, SkillCodexMode mode)
: this(count, value, deleteWhenEmpty, mode, SkillCodexFlags.Base)
{ }

[Constructable]
public SkillCodex(int count, double value, bool deleteWhenEmpty, SkillCodexMode mode, SkillCodexFlags flags)
: base(8793)
{
SelectedSkills = new List<SkillName>();
IgnoredSkills = new List<SkillName>();

Mode = mode;
Flags = flags;
Count = count;
Value = value;
DeleteWhenEmpty = deleteWhenEmpty;

Name = "Codex of Wisdom";
LootType = LootType.Blessed;
Stackable = false;
}

public SkillCodex(Serial serial)
: base(serial)
{ }

public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);

string html = String.Empty, flags = String.Empty;

html += String.Format("<basefont color=#{0:X6}>Use: ", Color.Cyan.ToArgb());

switch (Flags)
{
case SkillCodexFlags.Base:
flags = "value";
break;
case SkillCodexFlags.Cap:
flags = "cap";
break;
case SkillCodexFlags.Both:
flags = "value and cap";
break;
}

switch (Mode)
{
case SkillCodexMode.Increase:
{
html += String.Format(
"Increase {0} skill{1} {2} by {3:F2}%", Count, Count == 1 ? String.Empty : "s", flags, Value);
}
break;
case SkillCodexMode.Decrease:
{
html += String.Format(
"Decrease {0} skill{1} {2} by {3:F2}%", Count, Count == 1 ? String.Empty : "s", flags, Value);
}
break;
case SkillCodexMode.Fixed:
{
html += String.Format("Set {0} skill{1} {2} to {3:F2}%", Count, Count == 1 ? String.Empty : "s", flags, Value);
}
break;
}

list.Add(html);
}

public override void OnDoubleClick(Mobile from)
{
if (from == null || from.Deleted || !Validate(from, true))
{
return;
}

SelectSkills(from);
InvalidateProperties();
}

public virtual bool ValidateSkill(Mobile user, Skill skill, bool message)
{
if (user == null || user.Deleted || skill == null)
{
return false;
}

switch (Mode)
{
case SkillCodexMode.Increase:
{
if (Flags == SkillCodexFlags.Base || Flags == SkillCodexFlags.Both)
{
if (user.SkillsTotal + ValueFixed > user.SkillsCap)
{
if (!CanReduceSkills(user))
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue,
"You already know everything this codex can offer, reduce some skills to make room for more knowledge.");
}

return false;
}
}

if (skill.IsCapped() || skill.WillCap(Value, false))
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue, "You already know everything this codex can offer about {0}.", skill.Name);
}

return false;
}

if (!skill.IsLocked(SkillLock.Up))
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "The skill {0} is locked.", skill.Name);
}

return false;
}
}
}
break;
case SkillCodexMode.Decrease:
{
if (Flags == SkillCodexFlags.Base || Flags == SkillCodexFlags.Both)
{
if (user.SkillsTotal - ValueFixed < 0)
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "You already forgot everything this codex can offer.");
}

return false;
}

if (skill.IsZero() || skill.WillZero(Value, false))
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue,
"You already forgot everything this codex can offer about {0}, any further and you'll forget how to breath!",
skill.Name);
}

return false;
}

if (!skill.IsLocked(SkillLock.Down))
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "The skill {0} is locked.", skill.Name);
}

return false;
}
}
}
break;
case SkillCodexMode.Fixed:
{
if (Flags == SkillCodexFlags.Cap)
{
if (skill.CapFixedPoint == ValueFixed)
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue, "You already know everything this codex can offer about {0}.", skill.Name);
}

return false;
}
}

if (Flags == SkillCodexFlags.Base || Flags == SkillCodexFlags.Both)
{
if (ValueFixed < skill.BaseFixedPoint)
{
if (user.SkillsTotal - (skill.BaseFixedPoint - ValueFixed) < 0)
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue,
"You already forgot everything this codex can offer, any further and you'll forget how to breath!");
}

return false;
}
}
else if (ValueFixed > skill.BaseFixedPoint)
{
if (user.SkillsTotal + (ValueFixed - skill.BaseFixedPoint) > user.SkillsCap)
{
if (!CanReduceSkills(user))
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue,
"You already know everything this codex can offer, reduce some skills to make room for more knowledge.");
}

return false;
}
}
}
else
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue, "You already know everything this codex can offer about {0}.", skill.Name);
}

return false;
}

if (skill.IsLocked(SkillLock.Locked))
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "The skill {0} is locked.", skill.Name);
}

return false;
}
}
}
break;
}

return true;
}

public virtual bool Validate(Mobile user, bool message)
{
if (user == null || user.Deleted || !user.CanSee(this))
{
return false;
}

if (!IsChildOf(user.Backpack))
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "This codex must be in your backpack to read it.");
}

return false;
}

if (Count <= 0)
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "This codex does not contain any skills to learn.");
}

return false;
}

return true;
}

public virtual void SelectSkills(Mobile user)
{
if (user == null || user.Deleted || !Validate(user, true) || !(user is PlayerMobile))
{
return;
}

if (SelectionGump != null)
{
SelectionGump.Close(true);
}

SelectionGump = new SkillSelectionGump(
user as PlayerMobile,
null,
Count,
null,
null,
skills =>
{
if (!ApplySkills(user, skills))
{
SelectSkills(user);
}
},
IgnoredSkills.ToArray()).Send();
}

public virtual bool ApplySkills(Mobile user, SkillName[] skills)
{
if (user == null || user.Deleted || skills == null || skills.Length == 0 || !Validate(user, true))
{
return false;
}

foreach (SkillName sn in skills)
{
if (user.Deleted || !Validate(user, true))
{
return false;
}

Skill skill = user.Skills[sn];

if (!ValidateSkill(user, skill, true))
{
continue;
}

bool charge = false;

if (Flags == SkillCodexFlags.Cap || Flags == SkillCodexFlags.Both)
{
switch (Mode)
{
case SkillCodexMode.Increase:
{
skill.IncreaseCap(Value);
}
break;
case SkillCodexMode.Decrease:
{
skill.DecreaseCap(Value);
}
break;
case SkillCodexMode.Fixed:
{
skill.SetCap(Value);
}
break;
}

if (Flags != SkillCodexFlags.Both)
{
EndApply(skill);
return true;
}

charge = true;
}

if (Flags == SkillCodexFlags.Base || Flags == SkillCodexFlags.Both)
{
charge = false;

switch (Mode)
{
case SkillCodexMode.Increase:
{
if (user.SkillsTotal + ValueFixed > user.SkillsCap)
{
if (TryReduceSkills(user) && skill.IncreaseBase(Value))
{
charge = true;
}
}
else if (skill.IncreaseBase(Value))
{
charge = true;
}
}
break;
case SkillCodexMode.Decrease:
{
if (skill.DecreaseBase(Value))
{
charge = true;
}
}
break;
case SkillCodexMode.Fixed:
{
if (ValueFixed > skill.BaseFixedPoint)
{
if (user.SkillsTotal + ValueFixed > user.SkillsCap)
{
if (TryReduceSkills(user) && skill.SetBase(Value))
{
charge = true;
}
}
else if (skill.SetBase(Value))
{
charge = true;
}
}
else if (ValueFixed < skill.BaseFixedPoint && skill.SetBase(Value))
{
charge = true;
}
}
break;
}
}

if (charge)
{
EndApply(skill);
}
}

return true;
}

protected void EndApply(Skill skill)
{
skill.Normalize();
UseCharges();

if (Count <= 0)
{
if (DeleteWhenEmpty)
{
Delete();
}
}
}

protected bool CanReduceSkills(Mobile user)
{
int target = (user.SkillsTotal + ValueFixed) - user.SkillsCap;
int canReduceBy = 0;

foreach (Skill s in user.Skills)
{
if (s.IsLocked(SkillLock.Down))
{
if (canReduceBy + s.BaseFixedPoint > target)
{
canReduceBy += (target - canReduceBy);
}
else
{
canReduceBy += s.BaseFixedPoint;
}
}

if (canReduceBy >= target)
{
return true;
}
}

return false;
}

protected bool TryReduceSkills(Mobile user)
{
if (!CanReduceSkills(user))
{
return false;
}

int target = (user.SkillsTotal + ValueFixed) - user.SkillsCap;
int reducedBy = 0;

foreach (Skill s in user.Skills)
{
if (s.IsLocked(SkillLock.Down))
{
if (reducedBy + s.BaseFixedPoint > target)
{
int diff = (target - reducedBy);

if (s.DecreaseBase(diff / 10))
{
reducedBy += diff;
}
}
else
{
if (s.SetBase(0))
{
reducedBy += s.BaseFixedPoint;
}
}
}

if (reducedBy >= target)
{
return true;
}
}

return false;
}

public virtual void UseCharges(int count = 1)
{
Count = Math.Max(0, Count - count);
InvalidateProperties();
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

int version = writer.SetVersion(1);

switch (version)
{
case 1:
{
writer.WriteFlag(Mode);
writer.WriteFlag(Flags);
writer.Write(Count);
writer.Write(Value);
writer.Write(DeleteWhenEmpty);
writer.WriteList(IgnoredSkills, skill => writer.WriteFlag(skill));
}
break;
case 0:
{
writer.Write((byte)Mode);
writer.Write((byte)Flags);
writer.Write(Count);
writer.Write(Value);
writer.Write(DeleteWhenEmpty);
writer.WriteList(IgnoredSkills, skill => writer.Write((short)skill));
}
break;
}
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);

int version = reader.GetVersion();

switch (version)
{
case 1:
{
Mode = reader.ReadFlag<SkillCodexMode>();
Flags = reader.ReadFlag<SkillCodexFlags>();
Count = reader.ReadInt();
Value = reader.ReadDouble();
DeleteWhenEmpty = reader.ReadBool();
IgnoredSkills = reader.ReadList(r => r.ReadFlag<SkillName>());
}
break;
case 0:
{
Mode = (SkillCodexMode)reader.ReadByte();
Flags = (SkillCodexFlags)reader.ReadByte();
Count = reader.ReadInt();
Value = reader.ReadDouble();
DeleteWhenEmpty = reader.ReadBool();
IgnoredSkills = reader.ReadList(() => (SkillName)reader.ReadShort());
}
break;
}
}
}
}


Edit - I ended up making my own skill thingies. They aren't as nice as yours but they are still pretty cool and get the job done.  ;)

7
Module Support / Re: ADM and MySQL ODBC Drivers
« on: February 12, 2015, 03:59:03 AM »
Just noticed I've been getting this error, probably is not something new since the previous post as I didn't touch the donation module since then:

http://imgur.com/I6J6Lv5

However I do get 0 errors when I do [donatesync so that's good.  :)

Edit - Reading this thread from someone else's donation store system, will try to learn from it and post results later: http://www.runuo.com/community/threads/runuo-2-0-fully-automated-donation-store-system.98542/


Edit #2 - Making some progress using that one:
http://imgur.com/FGIc6dp

Edit #3 - Just realized there is an extra download necessary for the web component of the donate module durp
http://core.vita-nex.com/index.php?action=downloads;sa=view;down=12

Edit #4 - Successful IPN sent message on the IPN.php

Edit #5 - I think if I can just get the button working I will be set

Edit #6 - Stuck on the button part of it. Hmm.

8
Custom Support / Re: Cast Bars Suggestion
« on: February 12, 2015, 01:55:57 AM »
Here's another suggestion: if possible make it so that the cast bars work with Sallos too.  ;)

9
Custom Support / Re: Customizing the Skill Codex
« on: February 12, 2015, 12:30:27 AM »
Okay, and by the way thank you again, now I tried those excellent changes and of course they compiled perfectly however when I edited the part about addrange with regard to ignoring I get this message:

http://imgur.com/Pkbnw7D

Here is the code I'm running:

Code: [Select]

#region Header
//   Vorspire    _,-'/-'/  SkillCodex.cs
//   .      __,-; ,'( '/
//    \.    `-.__`-._`:_,-._       _ , . ``
//     `:-._,------' ` _,`--` -: `_ , ` ,' :
//        `---..__,,--'  (C) 2014  ` -'. -'
//        #  Vita-Nex [http://core.vita-nex.com]  #
//  {o)xxx|===============-   #   -===============|xxx(o}
//        #        The MIT License (MIT)          #
#endregion

#region References
using System;
using System.Collections.Generic;
using System.Drawing;

using Server;
using Server.Mobiles;

using VitaNex.Items;
using VitaNex.SuperGumps;
using VitaNex.SuperGumps.UI;
#endregion

namespace Server.Items
{
    public abstract class SkillCodexBase : SkillCodex
    {
        private static readonly SkillName[] DefaultIgnoredSkills = { SkillName.Mysticism, SkillName.Imbuing };

        public SkillCodexBase(int count, double value, bool deleteWhenEmpty, SkillCodexMode mode, SkillCodexFlags flags)
            : base(count, value, deleteWhenEmpty, mode, flags)
        {
            IgnoredSkills.AddRange(SkillName.Alchemy, SkillName.Macing, SkillName.Imbuing);
        }

        public SkillCodexBase(Serial serial)
            : base(serial)
        { }

        public override bool ValidateSkill(Mobile user, Skill skill, bool message)
        {
            if (user is PlayerMobile)
            {
                var pm = (PlayerMobile)user;

                if (skill.SkillName == SkillName.Spellweaving)
                {
                    if (!pm.Spellweaving)
                    {
                        if (message)
                        {
                            pm.SendMessage(
                                SuperGump.DefaultErrorHue,
                                "You must complete the Patience or Discipline quest chains to unlock {0}.",
                                skill.Name);
                        }

                        return false;
                    }
                }
            }

            return base.ValidateSkill(user, skill, message);
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            var version = 0;

            writer.Write(version);

            switch (version)
            {
                case 0:
                    { }
                    break;
            }
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    { }
                    break;
            }
        }
    }

    public abstract class SkillCodexFixedBase : SkillCodexBase
    {
        public SkillCodexFixedBase(int count, double value)
            : base(count, value, true, SkillCodexMode.Fixed, SkillCodexFlags.Base)
        { }

        public SkillCodexFixedBase(Serial serial)
            : base(serial)
        { }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            var version = 0;

            writer.Write(version);

            switch (version)
            {
                case 0:
                    { }
                    break;
            }
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    { }
                    break;
            }
        }
    }
}

namespace VitaNex.Items
{
public enum SkillCodexFlags : byte
{
Base = 0x00,
Cap = 0x01,
Both = 0x02
}

public enum SkillCodexMode : byte
{
Fixed = 0x00,
Increase = 0x01,
Decrease = 0x02
}

public class SkillCodex : Item
{
private SuperGump SelectionGump { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public SkillCodexMode Mode { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public SkillCodexFlags Flags { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public int Count { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public double Value { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public int ValueFixed { get { return (int)(Value * 10); } set { Value = value / 10; } }

[CommandProperty(AccessLevel.GameMaster)]
public bool DeleteWhenEmpty { get; set; }

public List<SkillName> IgnoredSkills { get; protected set; }
public List<SkillName> SelectedSkills { get; protected set; }

[Constructable]
public SkillCodex()
: this(1)
{ }

[Constructable]
public SkillCodex(int count)
: this(count, 100.0)
{ }

[Constructable]
public SkillCodex(int count, double value)
: this(count, value, true)
{ }

[Constructable]
public SkillCodex(int count, double value, bool deleteWhenEmpty)
: this(count, value, deleteWhenEmpty, SkillCodexMode.Fixed)
{ }

[Constructable]
public SkillCodex(int count, double value, bool deleteWhenEmpty, SkillCodexMode mode)
: this(count, value, deleteWhenEmpty, mode, SkillCodexFlags.Base)
{ }

[Constructable]
public SkillCodex(int count, double value, bool deleteWhenEmpty, SkillCodexMode mode, SkillCodexFlags flags)
: base(8793)
{
SelectedSkills = new List<SkillName>();
IgnoredSkills = new List<SkillName>();

Mode = mode;
Flags = flags;
Count = count;
Value = value;
DeleteWhenEmpty = deleteWhenEmpty;

Name = "Codex of Wisdom";
LootType = LootType.Blessed;
Stackable = false;
}

public SkillCodex(Serial serial)
: base(serial)
{ }

public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);

string html = String.Empty, flags = String.Empty;

html += String.Format("<basefont color=#{0:X6}>Use: ", Color.Cyan.ToArgb());

switch (Flags)
{
case SkillCodexFlags.Base:
flags = "value";
break;
case SkillCodexFlags.Cap:
flags = "cap";
break;
case SkillCodexFlags.Both:
flags = "value and cap";
break;
}

switch (Mode)
{
case SkillCodexMode.Increase:
{
html += String.Format(
"Increase {0} skill{1} {2} by {3:F2}%", Count, Count == 1 ? String.Empty : "s", flags, Value);
}
break;
case SkillCodexMode.Decrease:
{
html += String.Format(
"Decrease {0} skill{1} {2} by {3:F2}%", Count, Count == 1 ? String.Empty : "s", flags, Value);
}
break;
case SkillCodexMode.Fixed:
{
html += String.Format("Set {0} skill{1} {2} to {3:F2}%", Count, Count == 1 ? String.Empty : "s", flags, Value);
}
break;
}

list.Add(html);
}

public override void OnDoubleClick(Mobile from)
{
if (from == null || from.Deleted || !Validate(from, true))
{
return;
}

SelectSkills(from);
InvalidateProperties();
}

public virtual bool ValidateSkill(Mobile user, Skill skill, bool message)
{
if (user == null || user.Deleted || skill == null)
{
return false;
}

switch (Mode)
{
case SkillCodexMode.Increase:
{
if (Flags == SkillCodexFlags.Base || Flags == SkillCodexFlags.Both)
{
if (user.SkillsTotal + ValueFixed > user.SkillsCap)
{
if (!CanReduceSkills(user))
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue,
"You already know everything this codex can offer, reduce some skills to make room for more knowledge.");
}

return false;
}
}

if (skill.IsCapped() || skill.WillCap(Value, false))
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue, "You already know everything this codex can offer about {0}.", skill.Name);
}

return false;
}

if (!skill.IsLocked(SkillLock.Up))
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "The skill {0} is locked.", skill.Name);
}

return false;
}
}
}
break;
case SkillCodexMode.Decrease:
{
if (Flags == SkillCodexFlags.Base || Flags == SkillCodexFlags.Both)
{
if (user.SkillsTotal - ValueFixed < 0)
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "You already forgot everything this codex can offer.");
}

return false;
}

if (skill.IsZero() || skill.WillZero(Value, false))
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue,
"You already forgot everything this codex can offer about {0}, any further and you'll forget how to breath!",
skill.Name);
}

return false;
}

if (!skill.IsLocked(SkillLock.Down))
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "The skill {0} is locked.", skill.Name);
}

return false;
}
}
}
break;
case SkillCodexMode.Fixed:
{
if (Flags == SkillCodexFlags.Cap)
{
if (skill.CapFixedPoint == ValueFixed)
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue, "You already know everything this codex can offer about {0}.", skill.Name);
}

return false;
}
}

if (Flags == SkillCodexFlags.Base || Flags == SkillCodexFlags.Both)
{
if (ValueFixed < skill.BaseFixedPoint)
{
if (user.SkillsTotal - (skill.BaseFixedPoint - ValueFixed) < 0)
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue,
"You already forgot everything this codex can offer, any further and you'll forget how to breath!");
}

return false;
}
}
else if (ValueFixed > skill.BaseFixedPoint)
{
if (user.SkillsTotal + (ValueFixed - skill.BaseFixedPoint) > user.SkillsCap)
{
if (!CanReduceSkills(user))
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue,
"You already know everything this codex can offer, reduce some skills to make room for more knowledge.");
}

return false;
}
}
}
else
{
if (message)
{
user.SendMessage(
SuperGump.DefaultErrorHue, "You already know everything this codex can offer about {0}.", skill.Name);
}

return false;
}

if (skill.IsLocked(SkillLock.Locked))
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "The skill {0} is locked.", skill.Name);
}

return false;
}
}
}
break;
}

return true;
}

public virtual bool Validate(Mobile user, bool message)
{
if (user == null || user.Deleted || !user.CanSee(this))
{
return false;
}

if (!IsChildOf(user.Backpack))
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "This codex must be in your backpack to read it.");
}

return false;
}

if (Count <= 0)
{
if (message)
{
user.SendMessage(SuperGump.DefaultErrorHue, "This codex does not contain any skills to learn.");
}

return false;
}

return true;
}

public virtual void SelectSkills(Mobile user)
{
if (user == null || user.Deleted || !Validate(user, true) || !(user is PlayerMobile))
{
return;
}

if (SelectionGump != null)
{
SelectionGump.Close(true);
}

SelectionGump = new SkillSelectionGump(
user as PlayerMobile,
null,
Count,
null,
null,
skills =>
{
if (!ApplySkills(user, skills))
{
SelectSkills(user);
}
},
IgnoredSkills.ToArray()).Send();
}

public virtual bool ApplySkills(Mobile user, SkillName[] skills)
{
if (user == null || user.Deleted || skills == null || skills.Length == 0 || !Validate(user, true))
{
return false;
}

foreach (SkillName sn in skills)
{
if (user.Deleted || !Validate(user, true))
{
return false;
}

Skill skill = user.Skills[sn];

if (!ValidateSkill(user, skill, true))
{
continue;
}

bool charge = false;

if (Flags == SkillCodexFlags.Cap || Flags == SkillCodexFlags.Both)
{
switch (Mode)
{
case SkillCodexMode.Increase:
{
skill.IncreaseCap(Value);
}
break;
case SkillCodexMode.Decrease:
{
skill.DecreaseCap(Value);
}
break;
case SkillCodexMode.Fixed:
{
skill.SetCap(Value);
}
break;
}

if (Flags != SkillCodexFlags.Both)
{
EndApply(skill);
return true;
}

charge = true;
}

if (Flags == SkillCodexFlags.Base || Flags == SkillCodexFlags.Both)
{
charge = false;

switch (Mode)
{
case SkillCodexMode.Increase:
{
if (user.SkillsTotal + ValueFixed > user.SkillsCap)
{
if (TryReduceSkills(user) && skill.IncreaseBase(Value))
{
charge = true;
}
}
else if (skill.IncreaseBase(Value))
{
charge = true;
}
}
break;
case SkillCodexMode.Decrease:
{
if (skill.DecreaseBase(Value))
{
charge = true;
}
}
break;
case SkillCodexMode.Fixed:
{
if (ValueFixed > skill.BaseFixedPoint)
{
if (user.SkillsTotal + ValueFixed > user.SkillsCap)
{
if (TryReduceSkills(user) && skill.SetBase(Value))
{
charge = true;
}
}
else if (skill.SetBase(Value))
{
charge = true;
}
}
else if (ValueFixed < skill.BaseFixedPoint && skill.SetBase(Value))
{
charge = true;
}
}
break;
}
}

if (charge)
{
EndApply(skill);
}
}

return true;
}

protected void EndApply(Skill skill)
{
skill.Normalize();
UseCharges();

if (Count <= 0)
{
if (DeleteWhenEmpty)
{
Delete();
}
}
}

protected bool CanReduceSkills(Mobile user)
{
int target = (user.SkillsTotal + ValueFixed) - user.SkillsCap;
int canReduceBy = 0;

foreach (Skill s in user.Skills)
{
if (s.IsLocked(SkillLock.Down))
{
if (canReduceBy + s.BaseFixedPoint > target)
{
canReduceBy += (target - canReduceBy);
}
else
{
canReduceBy += s.BaseFixedPoint;
}
}

if (canReduceBy >= target)
{
return true;
}
}

return false;
}

protected bool TryReduceSkills(Mobile user)
{
if (!CanReduceSkills(user))
{
return false;
}

int target = (user.SkillsTotal + ValueFixed) - user.SkillsCap;
int reducedBy = 0;

foreach (Skill s in user.Skills)
{
if (s.IsLocked(SkillLock.Down))
{
if (reducedBy + s.BaseFixedPoint > target)
{
int diff = (target - reducedBy);

if (s.DecreaseBase(diff / 10))
{
reducedBy += diff;
}
}
else
{
if (s.SetBase(0))
{
reducedBy += s.BaseFixedPoint;
}
}
}

if (reducedBy >= target)
{
return true;
}
}

return false;
}

public virtual void UseCharges(int count = 1)
{
Count = Math.Max(0, Count - count);
InvalidateProperties();
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

int version = writer.SetVersion(1);

switch (version)
{
case 1:
{
writer.WriteFlag(Mode);
writer.WriteFlag(Flags);
writer.Write(Count);
writer.Write(Value);
writer.Write(DeleteWhenEmpty);
writer.WriteList(IgnoredSkills, skill => writer.WriteFlag(skill));
}
break;
case 0:
{
writer.Write((byte)Mode);
writer.Write((byte)Flags);
writer.Write(Count);
writer.Write(Value);
writer.Write(DeleteWhenEmpty);
writer.WriteList(IgnoredSkills, skill => writer.Write((short)skill));
}
break;
}
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);

int version = reader.GetVersion();

switch (version)
{
case 1:
{
Mode = reader.ReadFlag<SkillCodexMode>();
Flags = reader.ReadFlag<SkillCodexFlags>();
Count = reader.ReadInt();
Value = reader.ReadDouble();
DeleteWhenEmpty = reader.ReadBool();
IgnoredSkills = reader.ReadList(r => r.ReadFlag<SkillName>());
}
break;
case 0:
{
Mode = (SkillCodexMode)reader.ReadByte();
Flags = (SkillCodexFlags)reader.ReadByte();
Count = reader.ReadInt();
Value = reader.ReadDouble();
DeleteWhenEmpty = reader.ReadBool();
IgnoredSkills = reader.ReadList(() => (SkillName)reader.ReadShort());
}
break;
}
}
}
}


10
Custom Support / Re: Customizing the Skill Codex
« on: February 10, 2015, 12:11:09 PM »
Awesome thanks so much! I'll check it out later today :D

11
Custom Support / Customizing the Skill Codex
« on: February 10, 2015, 08:30:58 AM »
Hi Vorspire,

I'm interested in changing the skill codex, as great as it is, to only offer pre-AOS skills when used. If it isn't too much trouble would you mind pointing me in the direction of how to do that? Thanks so much for any reply. Oh and also I was curious how to make it not delete on use/not require to be in my backpack have an infinite number of uses

Edit - Figured out the strikethrough'd part on my own

Best,

Greed

P.S. Sorry for so many threads as of late. Not trying to spam it's just that you've done such a marvelous job creating and developing your VNC I can't help but enjoy learning more about it.

12
Module Support / Re: ADM and MySQL ODBC Drivers
« on: February 09, 2015, 11:38:59 PM »
No errors :D

Now I just need to figure out how to hook it up to my paypal/a webpage and I'm all set. Thanks again  ;D

13
Module Support / Re: ADM and MySQL ODBC Drivers
« on: February 09, 2015, 03:23:24 PM »
Hmm If I'm understanding correctly I didn't hardcode it, I just used the module itself. See here are my settings with the password changed because even though I do trust you I don't know the other folks here:

MySQlConnection info
http://imgur.com/Vf1D1Bc

AutoDonate Options
http://imgur.com/ENOsWcy






14
Module Support / Re: ADM and MySQL ODBC Drivers
« on: February 09, 2015, 12:15:58 AM »
Thanks for the reply. Unfortunately I believe I am typing in the correct password as the same password allows me to login to mysql as user root in the cmd prompt and get the connection successful message in odbc as well.  :o

In fact myrunuo successfully connects to another db using the exact same settings, meanwhile autodonate can't connect to it's own db. It seems very strange.

http://imgur.com/MSEsI3E

15
Module Support / Re: ADM and MySQL ODBC Drivers
« on: February 07, 2015, 12:48:49 PM »
Hi Vorspire  ;D

I'm just having a bit of an issue in this same regard and was curious if you could point me in the right direction please. I'm getting this error:

http://imgur.com/UR7r3ue

As far as I can tell I have my odbc set up and working properly along with apache, mysql, and and php but I can't seem to quite get this last step correct. Any help is greatly appreciated sir.

Best,

Greed

Edit -
with 32 bit 3.51 ODBC the MySQL database doesn't show up in ODBC

with 64 bit 3.51 ODBC  the MySQL database does show up in ODBC and only gets 1 error message from AutoDonate if I change the driver to v_5_1
http://imgur.com/m1PypA7
but gets 2 error message if the driver is set at V_3_51
http://imgur.com/UR7r3ue

with 32 bit 5.1 ODBC  the MySQL database doesn't show up in ODBC

with 64 bit 5.1 ODBC it is the same result as 3.51 64 bit except in reverse with 3_51 getting 1 error and 5_1 getting 2.

Edit again -
Just tried 5.2 and 2 errors from both 5.2 ansi and unicode for 32 and 64 bit versions.

Same goes for 5.3 with 32 and 64 bit versions

Another edit - I also added a user to mysql that has no name and a user named odbc both with the same password as root and autodonate didn't like those either.

Additionally I tried changing the ip in autodonate to localhost, 127.0.0.1, and my actual ip and there was no change unfortunately.

Also I'm using JustUO and I tried it with both my somewhat modified copy and their stock latest release (release 1) and it was the same result.

Lastly here are images of the

MySQlConnection info
http://imgur.com/Vf1D1Bc

AutoDonate Options
http://imgur.com/ENOsWcy

The odbc data source admin
http://imgur.com/wRtIBdN

and as well as the odbc configuration which gets a Connection Successful message when I click on Test
http://imgur.com/WO1G7qM

Another edit - One thing that might be worth mentioning is that I have another apache installation for WordPress but it is turned off. Could this be the issue? Hmm...
http://imgur.com/kZAvReW

Another edit (sorry for such a big post)  - I tried it all again on my laptop instead of my pc and went with the following and got the same result:

MYSQL 5.1 community server 32 bit
apache 2.41.12 32 bit
php 5.65 32 bit
3.5.1.3 32 bit obc (didn't work in odbc with mysql)
3.5.1.3 64 bit odc (does work in odbc with mysql)

Now I'm wondering if the issue is related to the database "donate_db" and the table name "donate_trans" because I didn't create either manually

Thanks again for any reply, and thanks so much for making so many great things for the UO community Vorspire :)

Pages: [1] 2

Download VNc

Recent Topics

Vita-Nex: Core 5.1.0.0 Released! by Vorspire
[July 10, 2018, 09:25:40 PM]


Effects Help by Vorspire
[January 15, 2017, 06:47:33 PM]


Ultima Online Phoenix is Ready to Begin! by Abracadabra2.0
[December 13, 2016, 01:14:49 AM]


How To: Deceit Braziers Spawn/Despawn by Abracadabra2.0
[November 26, 2016, 07:34:13 PM]


Installing VNC 3.0.0.1 by Johnny
[August 27, 2016, 06:49:40 PM]


JSON Web Stats Stuck Problem by Argalep
[May 27, 2016, 06:16:55 AM]


Modules not Working after being Enabled by ProfessorChaos
[May 19, 2016, 02:44:06 AM]


Issues Installing VitaNex Core 3.0.0.1 on RunUO 2.7 by ProfessorChaos
[May 18, 2016, 09:30:37 PM]


ADM Assistance by Vorspire
[May 18, 2016, 09:23:25 PM]


Suggestion by Vorspire
[April 24, 2016, 06:23:15 PM]

Comments

Refresh History
  • Moderated
  • Terrapin: Hello - and thanks - thought I would check VNC out since using it in JustUO server...
    April 22, 2015, 10:20:17 PM
  • Vorspire: Hello!
    December 16, 2014, 07:11:55 PM
  • Tek: Hello
    December 15, 2014, 08:51:25 AM
  • magnus_mythos: hello
    November 18, 2014, 05:30:22 AM
  • Antares_UO: thanks Vospire
    June 15, 2014, 06:52:17 PM
  • jezika: Thank you is not enough Vorspire! This system is exactly what I was looking for.
    June 04, 2014, 06:01:11 AM
  • Vorspire: VNc 2.1.1.0 Released!
    March 10, 2014, 01:33:06 AM
  • Vorspire: VNc 2.1.0.0 Released!
    January 27, 2014, 12:57:51 PM
  • Kassandra: Many thanks for building my shard for me.  It is awesome, I'm extremely pleased with what you've done and the ongoing support!!!
    November 20, 2013, 01:31:08 AM
  • Regnak: Great news ! Thanks Vorspire :)
    November 16, 2013, 01:55:16 PM
  • Vorspire: VNc: 2.1.0.0 is being developed!
    November 13, 2013, 08:38:35 AM
  • Vorspire: VNc 2.0.0.5 Released!
    September 11, 2013, 12:49:42 AM
  • Vorspire: VNc 2.0.0.4 Released!
    August 23, 2013, 12:47:54 AM
  • Vorspire: VNc 2.0.0.3 Released!
    July 05, 2013, 12:50:13 AM
  • Kaemalux: :-)
    July 01, 2013, 01:51:13 PM
  • Vorspire: VNc 2.0.0.2 Released!
    June 20, 2013, 08:29:19 PM
  • scrlked: I am trying it out on my shard. This is taking UO to the next level.
    June 13, 2013, 11:11:16 AM
  • Vorspire: VNc 2.0.0.0 Released!
    June 03, 2013, 12:53:33 AM
  • ST33LDI9ITAL: huzzah, going on vacation in for 2 weeks soon, plan to catch up on some runuo stuff. looking forward to taking some time with it. good job!
    February 26, 2013, 06:02:30 AM
  • Vorspire: The latest, most optimised version of VNc is not far from release.
    February 22, 2013, 03:16:51 AM

Carbonate design by Bloc
variant: carbon
SMF 2.0.11 | SMF © 2015, Simple Machines
SimplePortal 2.3.6 © 2008-2014, SimplePortal