Skip to content

Commit

Permalink
- Vice Vs. Virtue
Browse files Browse the repository at this point in the history
- Factions Disabled by default in config.  At start up, all players in factions will be removed and monoliths/sigils/regions will be removed.
- Enabled MovementPath with IPoint3D, as opposed to Mobile. Gives it more flexibility in creating a movement path when an instance of a mobile isn't available/needed.
  • Loading branch information
kevin-10 committed Dec 10, 2016
1 parent db877e2 commit 5624fe9
Show file tree
Hide file tree
Showing 102 changed files with 9,600 additions and 207 deletions.
2 changes: 2 additions & 0 deletions Config/Factions.cfg
Expand Up @@ -2,3 +2,5 @@
# Moonglow Island will be used instead of the old location in the Magincia
# Parlament Building.
NewCoMLocation=True
Enabled=False
# New VvV Systems replaces factions
77 changes: 69 additions & 8 deletions Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs
Expand Up @@ -9,15 +9,18 @@ namespace Server.Guilds
public class GuildInfoGump : BaseGuildGump
{
private readonly bool m_IsResigning;
private readonly bool m_IsResigningVvV;

public GuildInfoGump(PlayerMobile pm, Guild g)
: this(pm, g, false)
: this(pm, g, false, false)
{
}

public GuildInfoGump(PlayerMobile pm, Guild g, bool isResigning)
public GuildInfoGump(PlayerMobile pm, Guild g, bool isResigning, bool isResigningVvV)
: base(pm, g)
{
this.m_IsResigning = isResigning;
this.m_IsResigningVvV = isResigningVvV;
this.PopulateGump();
}

Expand Down Expand Up @@ -62,18 +65,41 @@ public override void PopulateGump()
this.AddButton(40, 251, 0x4B9, 0x4BA, 4, GumpButtonType.Reply, 0); //Charter Edit button

s = this.guild.Website;

if (string.IsNullOrEmpty(s))
s = "Guild website not yet set.";

this.AddHtml(65, 306, 480, 30, s, true, false);

if (isLeader)
this.AddButton(40, 313, 0x4B9, 0x4BA, 5, GumpButtonType.Reply, 0); //Website Edit button

/*this.AddCheck(65, 370, 0xD2, 0xD3, this.player.DisplayGuildTitle, 0);
this.AddHtmlLocalized(95, 370, 150, 26, 1063085, 0x0, false, false); // Show Guild Title
this.AddBackground(450, 370, 100, 26, 0x2486);*/
AddBackground(65, 370, 170, 26, 0x2486);

this.AddButton(455, 375, 0x845, 0x846, 7, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(480, 373, 60, 26, 3006115, (this.m_IsResigning) ? 0x5000 : 0, false, false); // Resign
if (Server.Engines.VvV.ViceVsVirtueSystem.Enabled)
{
if (Server.Engines.VvV.ViceVsVirtueSystem.IsVvV(player))
{
if (isLeader)
{
AddButton(67, 375, 0x4B9, 0x4BA, 9, GumpButtonType.Reply, 0); // Resign Vice vs Virtue
AddHtmlLocalized(92, 373, 170, 26, 1155557, m_IsResigningVvV ? 0x5000 : 0, false, false);
}

AddBackground(255, 370, 170, 26, 0x2486);
AddButton(257, 375, 0x4B9, 0x4BA, 10, GumpButtonType.Reply, 0);
AddHtmlLocalized(282, 373, 150, 26, 1114982, false, false); // Leaderboards
}
else if (isLeader)
{
AddButton(67, 375, 0x4B9, 0x4BA, 8, GumpButtonType.Reply, 0);
AddHtmlLocalized(92, 373, 170, 26, 1155556, false, false); // Join Vice vs Virtue
}
}

AddBackground(445, 370, 100, 26, 0x2486);
AddButton(447, 375, 0x845, 0x846, 7, GumpButtonType.Reply, 0);
AddHtmlLocalized(472, 373, 60, 26, 3006115, (this.m_IsResigning) ? 0x5000 : 0, false, false); // Resign
}

public override void OnResponse(NetState sender, RelayInfo info)
Expand Down Expand Up @@ -123,14 +149,49 @@ public override void OnResponse(NetState sender, RelayInfo info)
if (!this.m_IsResigning)
{
pm.SendLocalizedMessage(1063332); // Are you sure you wish to resign from your guild?
pm.SendGump(new GuildInfoGump(pm, this.guild, true));
pm.SendGump(new GuildInfoGump(pm, this.guild, true, false));
}
else
{
this.guild.RemoveMember(pm, 1063411); // You resign from your guild.
}
break;
}
case 8:
if (IsLeader(pm, guild))
{
if (pm.Young)
{
pm.SendLocalizedMessage(1155562); // Young players may not join Vice vs Virtue. Renounce your young player status by saying, "I renounce my young player status" and try again.
}
else
{
pm.SendGump(new Server.Engines.VvV.ConfirmSignupGump(pm));
}
}
break;
case 9:
if (IsLeader(pm, guild))
{
if (Server.Engines.Points.PointsSystem.ViceVsVirtue.IsResigning(pm, guild))
{
pm.SendLocalizedMessage(1155560); // You are currently in the process of quitting Vice vs Virtue.
}
else if (m_IsResigningVvV)
{
pm.SendLocalizedMessage(1155559); // You have begun the Vice vs Virtue resignation process. You will be removed from VvV in 3 days.
Server.Engines.Points.PointsSystem.ViceVsVirtue.ResignGuild(guild);
}
else
{
pm.SendLocalizedMessage(1155558); // Are you sure you wish to resign from Vice vs Virtue? You will not be allowed to rejoin for 3 days.
pm.SendGump(new GuildInfoGump(pm, guild, false, true));
}
}
break;
case 10:
pm.SendGump(new Server.Engines.VvV.ViceVsVirtueLeaderboardGump(pm));
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Scripts/Items/Consumables/BaseExplosionPotion.cs
Expand Up @@ -174,7 +174,7 @@ public void Explode(Mobile from, bool direct, Point3D loc, Map map)
foreach (object o in eable)
{
if (o is Mobile &&
(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false) && from.InLOS((Mobile)o))))
{
toExplode.Add(o);
++toDamage;
Expand Down
51 changes: 26 additions & 25 deletions Scripts/Items/Consumables/ScrollofTranscendence.cs
@@ -1,9 +1,10 @@
using System;
using Server.Mobiles;
using Server.Accounting;

namespace Server.Items
{
public class ScrollofTranscendence : SpecialScroll
public class ScrollofTranscendence : SpecialScroll, IAccountRestricted
{
public override int LabelNumber
{
Expand Down Expand Up @@ -38,6 +39,9 @@ public static ScrollofTranscendence CreateRandom(int min, int max)
return new ScrollofTranscendence(skill, Utility.RandomMinMax(min, max) * 0.1);
}

[CommandProperty(AccessLevel.GameMaster)]
public string Account { get; set; }

public ScrollofTranscendence()
: this(SkillName.Alchemy, 0.0)
{
Expand All @@ -64,6 +68,9 @@ public override void GetProperties(ObjectPropertyList list)
list.Add(1076759, "{0}\t{1}.0 Skill Points", this.GetName(), this.Value);
else
list.Add(1076759, "{0}\t{1} Skill Points", this.GetName(), this.Value);

if (!String.IsNullOrEmpty(Account))
list.Add(1155526); // Account Bound
}

public override bool CanUse(Mobile from)
Expand All @@ -76,36 +83,25 @@ public override bool CanUse(Mobile from)
if (pm == null)
return false;

#region Mondain's Legacy
/* to add when skillgain quests will be implemented
for (int i = pm.Quests.Count - 1; i >= 0; i--)
{
BaseQuest quest = pm.Quests[i];
for (int j = quest.Objectives.Count - 1; j >= 0; j--)
{
BaseObjective objective = quest.Objectives[j];
if (objective is ApprenticeObjective)
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
*/
#endregion

#region Scroll of Alacrity
if (pm.AcceleratedStart > DateTime.UtcNow)
{
from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
return false;
}
#endregion


if (!String.IsNullOrEmpty(Account))
{
Account acct = pm.Account as Account;

if (acct == null || acct.Username != Account)
{
from.SendLocalizedMessage(1151920); // This item is Account Bound, you are not permitted to take this action.
return false;
}
}

return true;
}

Expand Down Expand Up @@ -166,7 +162,9 @@ public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

writer.Write((int)0); // version
writer.Write((int)1); // version

writer.Write(Account);
}

public override void Deserialize(GenericReader reader)
Expand All @@ -175,6 +173,9 @@ public override void Deserialize(GenericReader reader)

int version = (this.InheritsItem ? 0 : reader.ReadInt()); //Required for SpecialScroll insertion

if (version > 0)
Account = reader.ReadString();

this.LootType = LootType.Cursed;
this.Insured = false;

Expand Down
5 changes: 3 additions & 2 deletions Scripts/Items/Decorative/DamageableItem.cs
Expand Up @@ -282,9 +282,8 @@ public virtual bool OnBeforeDestroyed()
return true;
}

public virtual void OnDestroyed(WoodenBox lootbox)
public virtual void OnAfterDestroyed()
{
return;
}

public virtual void Damage(int amount, Mobile from)
Expand Down Expand Up @@ -371,6 +370,8 @@ public bool Destroy()
}

Destroyed = true;
OnAfterDestroyed();

return true;
}

Expand Down
86 changes: 84 additions & 2 deletions Scripts/Items/Equipment/Armor/BaseArmor.cs
Expand Up @@ -12,7 +12,7 @@

namespace Server.Items
{
public abstract class BaseArmor : Item, IScissorable, IFactionItem, ICraftable, IWearableDurability, ISetItem
public abstract class BaseArmor : Item, IScissorable, IFactionItem, ICraftable, IWearableDurability, ISetItem, IVvVItem, IOwnerRestricted
{
#region Factions
private FactionItem m_FactionState;
Expand All @@ -35,6 +35,30 @@ public FactionItem FactionItemState
}
#endregion

private bool _VvVItem;
private Mobile _Owner;
private string _OwnerName;

[CommandProperty(AccessLevel.GameMaster)]
public bool IsVvVItem
{
get { return _VvVItem; }
set { _VvVItem = value; InvalidateProperties(); }
}

[CommandProperty(AccessLevel.GameMaster)]
public Mobile Owner
{
get { return _Owner; }
set { _Owner = value; if (_Owner != null) _OwnerName = _Owner.Name; InvalidateProperties(); }
}

public virtual string OwnerName
{
get { return _OwnerName; }
set { _OwnerName = value; InvalidateProperties(); }
}

/* Armor internals work differently now (Jun 19 2003)
*
* The attributes defined below default to -1.
Expand Down Expand Up @@ -916,6 +940,17 @@ public virtual int ArtifactRarity
}
}

public override bool DisplayWeight
{
get
{
if (IsVvVItem)
return true;

return base.DisplayWeight;
}
}

[CommandProperty(AccessLevel.GameMaster)]
public ArmorProtectionLevel ProtectionLevel
{
Expand Down Expand Up @@ -1599,7 +1634,11 @@ public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

writer.Write((int)11); // version
writer.Write((int)12); // version

writer.Write(_VvVItem);
writer.Write(_Owner);
writer.Write(_OwnerName);

//Version 11
writer.Write(m_RefinedPhysical);
Expand Down Expand Up @@ -1804,6 +1843,13 @@ public override void Deserialize(GenericReader reader)

switch ( version )
{
case 12:
{
_VvVItem = reader.ReadBool();
_Owner = reader.ReadMobile();
_OwnerName = reader.ReadString();
goto case 11;
}
case 11:
{
m_RefinedPhysical = reader.ReadInt();
Expand Down Expand Up @@ -2286,6 +2332,29 @@ public override bool CanEquip(Mobile from)

if (from.IsPlayer())
{
if (_Owner != null && _Owner != from)
{
from.SendLocalizedMessage(501023); // You must be the owner to use this item.
return false;
}

if (this is IAccountRestricted && ((IAccountRestricted)this).Account != null)
{
Accounting.Account acct = from.Account as Accounting.Account;

if (acct == null || acct.Username != ((IAccountRestricted)this).Account)
{
from.SendLocalizedMessage(1071296); // This item is Account Bound and your character is not bound to it. You cannot use this item.
return false;
}
}

if (IsVvVItem && !Engines.VvV.ViceVsVirtueSystem.IsVvV(from))
{
from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
return false;
}

if (from.Race == Race.Gargoyle && !this.CanBeWornByGargoyles)
{
from.SendLocalizedMessage(1111708); // Gargoyles can't wear this.
Expand Down Expand Up @@ -2660,10 +2729,23 @@ public virtual int GetLuckBonus()
return attrInfo.ArmorLuck;
}

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

if (IsVvVItem)
list.Add(1154937); // VvV Item
}

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

if (OwnerName != null)
{
list.Add(1153213, OwnerName);
}

#region Stygian Abyss
if (this.IsImbued)
list.Add(1080418); // (Imbued)
Expand Down

0 comments on commit 5624fe9

Please sign in to comment.