Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
362
Scripts/Services/CommunityCollections/BaseCollectionItem.cs
Normal file
362
Scripts/Services/CommunityCollections/BaseCollectionItem.cs
Normal file
@@ -0,0 +1,362 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Quests;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseCollectionItem : Item, IComunityCollection
|
||||
{
|
||||
#region IComunityCollection
|
||||
public abstract Collection CollectionID { get; }
|
||||
public abstract int MaxTier { get; }
|
||||
|
||||
private List<CollectionItem> m_Donations;
|
||||
private List<CollectionItem> m_Rewards;
|
||||
|
||||
public List<CollectionItem> Donations
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Donations;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CollectionItem> Rewards
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Rewards;
|
||||
}
|
||||
}
|
||||
|
||||
private long m_Points;
|
||||
private long m_StartTier;
|
||||
private long m_NextTier;
|
||||
private long m_DailyDecay;
|
||||
private int m_Tier;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long Points
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Points;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Points = value;
|
||||
|
||||
if (m_Points < 0)
|
||||
m_Points = 0;
|
||||
|
||||
while (m_Tier > 0 && m_Points < PreviousTier)
|
||||
DecreaseTier();
|
||||
|
||||
while (m_Tier < MaxTier && m_Points > CurrentTier)
|
||||
IncreaseTier();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long PreviousTier
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Tier > 2)
|
||||
{
|
||||
long tier = m_StartTier * 2;
|
||||
|
||||
for (int i = 0; i < m_Tier - 2; i ++)
|
||||
tier += (i + 3) * m_NextTier;
|
||||
|
||||
return tier;
|
||||
}
|
||||
|
||||
return m_StartTier * m_Tier;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long CurrentTier
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Tier > 1)
|
||||
return PreviousTier + (m_Tier + 1) * m_NextTier;
|
||||
|
||||
return m_StartTier + m_StartTier * m_Tier;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long StartTier
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_StartTier;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_StartTier = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long NextTier
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_NextTier;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_NextTier = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long DailyDecay
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DailyDecay;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_DailyDecay = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Tier
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Tier;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private List<List<object>> m_Tiers;
|
||||
|
||||
public List<List<object>> Tiers
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Tiers;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseCollectionItem(int itemID)
|
||||
: base(itemID)
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
public BaseCollectionItem(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.Alive)
|
||||
{
|
||||
if (from.NetState == null || !from.NetState.SupportsExpansion(Expansion.ML))
|
||||
{
|
||||
from.SendLocalizedMessage(1073651); // You must have Mondain's Legacy before proceeding...
|
||||
return;
|
||||
}
|
||||
else if (!MondainsLegacy.PublicDonations && (int)from.AccessLevel < (int)AccessLevel.GameMaster)
|
||||
{
|
||||
from.SendLocalizedMessage(1042753, "Public donations"); // ~1_SOMETHING~ has been temporarily disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.InRange(Location, 2) && from is PlayerMobile && CanDonate((PlayerMobile)from))
|
||||
{
|
||||
from.CloseGump(typeof(CommunityCollectionGump));
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, this, Location));
|
||||
}
|
||||
else
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
AddNameProperty(list);
|
||||
|
||||
list.Add(1072819, m_Tier.ToString()); // Current Tier: ~1_TIER~
|
||||
list.Add(1072820, m_Points.ToString()); // Current Points: ~1_POINTS~
|
||||
list.Add(1072821, m_Tier > MaxTier ? 0.ToString() : CurrentTier.ToString()); // Points until next tier: ~1_POINTS~
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write((long)m_Points);
|
||||
writer.Write((long)m_StartTier);
|
||||
writer.Write((long)m_NextTier);
|
||||
writer.Write((long)m_DailyDecay);
|
||||
writer.Write((int)m_Tier);
|
||||
|
||||
writer.Write((int)m_Tiers.Count);
|
||||
|
||||
for (int i = 0; i < m_Tiers.Count; i ++)
|
||||
{
|
||||
writer.Write((int)m_Tiers[i].Count);
|
||||
|
||||
for (int j = 0; j < m_Tiers[i].Count; j ++)
|
||||
QuestWriter.Object(writer, m_Tiers[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Points = reader.ReadLong();
|
||||
m_StartTier = reader.ReadLong();
|
||||
m_NextTier = reader.ReadLong();
|
||||
m_DailyDecay = reader.ReadLong();
|
||||
m_Tier = reader.ReadInt();
|
||||
|
||||
Init();
|
||||
|
||||
for (int i = reader.ReadInt(); i > 0; i --)
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
|
||||
for (int j = reader.ReadInt(); j > 0; j --)
|
||||
list.Add(QuestReader.Object(reader));
|
||||
|
||||
m_Tiers.Add(list);
|
||||
}
|
||||
}
|
||||
|
||||
#region IComunityCollection
|
||||
public virtual void Donate(PlayerMobile player, CollectionItem item, int amount)
|
||||
{
|
||||
int points = (int)Math.Round(amount * item.Points);
|
||||
|
||||
player.AddCollectionPoints(CollectionID, points);
|
||||
|
||||
player.SendLocalizedMessage(1072816); // Thank you for your donation!
|
||||
player.SendLocalizedMessage(1072817, points.ToString()); // You have earned ~1_POINTS~ reward points for this donation.
|
||||
player.SendLocalizedMessage(1072818, points.ToString()); // The Collection has been awarded ~1_POINTS~ points
|
||||
|
||||
Points += points;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public virtual void Reward(PlayerMobile player, CollectionItem reward, int hue)
|
||||
{
|
||||
Item item = QuestHelper.Construct(reward.Type) as Item;
|
||||
|
||||
if (item != null && player.AddToBackpack(item))
|
||||
{
|
||||
if (hue > 0)
|
||||
item.Hue = hue;
|
||||
|
||||
player.AddCollectionPoints(CollectionID, (int)reward.Points * -1);
|
||||
player.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
|
||||
player.PlaySound(0x5A7);
|
||||
|
||||
if (reward.QuestItem)
|
||||
CollectionsObtainObjective.CheckReward(player, item);
|
||||
|
||||
reward.OnGiveReward(player, item, this, hue);
|
||||
}
|
||||
else if (item != null)
|
||||
{
|
||||
player.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack.
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
player.CloseGump(typeof(CommunityCollectionGump));
|
||||
player.SendGump(new CommunityCollectionGump(player, this, Location));
|
||||
}
|
||||
|
||||
public virtual void DonatePet(PlayerMobile player, BaseCreature pet)
|
||||
{
|
||||
for (int i = 0; i < m_Donations.Count; i++)
|
||||
{
|
||||
if (m_Donations[i].Type == pet.GetType() || MoonglowDonationBox.HasGroup(pet.GetType(), m_Donations[i].Type))
|
||||
{
|
||||
pet.Delete();
|
||||
Donate(player, m_Donations[i], 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
player.SendLocalizedMessage(1073113); // This Collection is not accepting that type of creature.
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public virtual void IncreaseTier()
|
||||
{
|
||||
m_Tier += 1;
|
||||
}
|
||||
|
||||
public virtual void DecreaseTier()
|
||||
{
|
||||
m_Tier -= 1;
|
||||
|
||||
if (m_Tiers != null && m_Tiers.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < m_Tiers[m_Tiers.Count - 1].Count; i ++)
|
||||
{
|
||||
if (m_Tiers[m_Tiers.Count - 1][i] is Item)
|
||||
((Item)m_Tiers[m_Tiers.Count - 1][i]).Delete();
|
||||
else if (m_Tiers[m_Tiers.Count - 1][i] is Mobile)
|
||||
((Mobile)m_Tiers[m_Tiers.Count - 1][i]).Delete();
|
||||
}
|
||||
|
||||
m_Tiers.RemoveAt(m_Tiers.Count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
{
|
||||
if (m_Donations == null)
|
||||
m_Donations = new List<CollectionItem>();
|
||||
|
||||
if (m_Rewards == null)
|
||||
m_Rewards = new List<CollectionItem>();
|
||||
|
||||
if (m_Tiers == null)
|
||||
m_Tiers = new List<List<object>>();
|
||||
|
||||
// start decay timer
|
||||
if (m_DailyDecay > 0)
|
||||
{
|
||||
DateTime today = DateTime.Today.AddDays(1);
|
||||
|
||||
new CollectionDecayTimer(this, today - DateTime.UtcNow);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CanDonate(PlayerMobile player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
444
Scripts/Services/CommunityCollections/BaseCollectionMobile.cs
Normal file
444
Scripts/Services/CommunityCollections/BaseCollectionMobile.cs
Normal file
@@ -0,0 +1,444 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Quests;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Services.Community_Collections;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public abstract class BaseCollectionMobile : BaseVendor, IComunityCollection
|
||||
{
|
||||
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
|
||||
protected override List<SBInfo> SBInfos
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SBInfos;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsActiveVendor
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#region IComunityCollection
|
||||
public abstract Collection CollectionID { get; }
|
||||
public abstract int MaxTier { get; }
|
||||
|
||||
private List<CollectionItem> m_Donations;
|
||||
private List<CollectionItem> m_Rewards;
|
||||
|
||||
public List<CollectionItem> Donations
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Donations;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CollectionItem> Rewards
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Rewards;
|
||||
}
|
||||
}
|
||||
|
||||
private long m_Points;
|
||||
private long m_StartTier;
|
||||
private long m_NextTier;
|
||||
private long m_DailyDecay;
|
||||
private int m_Tier;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long Points
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Points;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Points = value;
|
||||
|
||||
if (m_Points < 0)
|
||||
m_Points = 0;
|
||||
|
||||
while (m_Tier > 0 && m_Points < PreviousTier)
|
||||
DecreaseTier();
|
||||
|
||||
while (m_Tier < MaxTier && m_Points > CurrentTier)
|
||||
IncreaseTier();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long PreviousTier
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Tier > 2)
|
||||
{
|
||||
long tier = m_StartTier * 2;
|
||||
|
||||
for (int i = 0; i < m_Tier - 2; i ++)
|
||||
tier += (i + 3) * m_NextTier;
|
||||
|
||||
return tier;
|
||||
}
|
||||
|
||||
return m_StartTier * m_Tier;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long CurrentTier
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Tier > 1)
|
||||
return PreviousTier + (m_Tier + 1) * m_NextTier;
|
||||
|
||||
return m_StartTier + m_StartTier * m_Tier;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long StartTier
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_StartTier;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_StartTier = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long NextTier
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_NextTier;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_NextTier = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public long DailyDecay
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DailyDecay;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_DailyDecay = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Tier
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Tier;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private List<List<object>> m_Tiers;
|
||||
private object m_DonationTitle;
|
||||
|
||||
public List<List<object>> Tiers
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Tiers;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int DonationLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DonationTitle is int ? (int)m_DonationTitle : 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_DonationTitle = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DonationString
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DonationTitle is string ? (string)m_DonationTitle : null;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_DonationTitle = value;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseCollectionMobile(string name, string title)
|
||||
: base(title)
|
||||
{
|
||||
Name = name;
|
||||
Frozen = true;
|
||||
CantWalk = true;
|
||||
|
||||
Init();
|
||||
|
||||
CollectionsSystem.RegisterMobile(this);
|
||||
}
|
||||
|
||||
public BaseCollectionMobile(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void InitSBInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.Alive)
|
||||
{
|
||||
if (from.NetState == null || !from.NetState.SupportsExpansion(Expansion.ML))
|
||||
{
|
||||
from.SendLocalizedMessage(1073651); // You must have Mondain's Legacy before proceeding...
|
||||
return;
|
||||
}
|
||||
else if (!MondainsLegacy.PublicDonations && (int)from.AccessLevel < (int)AccessLevel.GameMaster)
|
||||
{
|
||||
from.SendLocalizedMessage(1042753, "Public donations"); // ~1_SOMETHING~ has been temporarily disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.InRange(Location, 2) && from is PlayerMobile && CanDonate((PlayerMobile)from))
|
||||
{
|
||||
from.CloseGump(typeof(CommunityCollectionGump));
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, this, Location));
|
||||
}
|
||||
else
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1072819, m_Tier.ToString()); // Current Tier: ~1_TIER~
|
||||
list.Add(1072820, m_Points.ToString()); // Current Points: ~1_POINTS~
|
||||
list.Add(1072821, m_Tier > MaxTier ? 0.ToString() : CurrentTier.ToString()); // Points until next tier: ~1_POINTS~
|
||||
|
||||
if (DonationLabel > 0)
|
||||
list.Add(DonationLabel);
|
||||
else if (DonationString != null)
|
||||
list.Add(DonationString);
|
||||
}
|
||||
|
||||
public CollectionData GetData()
|
||||
{
|
||||
CollectionData ret = new CollectionData();
|
||||
|
||||
ret.Collection = CollectionID;
|
||||
ret.Points = Points;
|
||||
ret.StartTier = StartTier;
|
||||
ret.NextTier = NextTier;
|
||||
ret.DailyDecay = DailyDecay;
|
||||
ret.Tier = Tier;
|
||||
ret.DonationTitle = m_DonationTitle;
|
||||
ret.Tiers = m_Tiers;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void SetData(CollectionData data)
|
||||
{
|
||||
m_Points = data.Points;
|
||||
m_StartTier = data.StartTier;
|
||||
m_NextTier = data.NextTier;
|
||||
m_DailyDecay = data.DailyDecay;
|
||||
m_Tier = data.Tier;
|
||||
m_DonationTitle = data.DonationTitle;
|
||||
m_Tiers = data.Tiers;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Init();
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
m_Points = reader.ReadLong();
|
||||
m_StartTier = reader.ReadLong();
|
||||
m_NextTier = reader.ReadLong();
|
||||
m_DailyDecay = reader.ReadLong();
|
||||
m_Tier = reader.ReadInt();
|
||||
|
||||
m_DonationTitle = QuestReader.Object(reader);
|
||||
|
||||
for (int i = reader.ReadInt(); i > 0; i--)
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
|
||||
for (int j = reader.ReadInt(); j > 0; j--)
|
||||
list.Add(QuestReader.Object(reader));
|
||||
|
||||
m_Tiers.Add(list);
|
||||
}
|
||||
CollectionsSystem.RegisterMobile(this);
|
||||
}
|
||||
|
||||
if (CantWalk)
|
||||
Frozen = true;
|
||||
}
|
||||
|
||||
#region IComunityCollection
|
||||
public virtual void Donate(PlayerMobile player, CollectionItem item, int amount)
|
||||
{
|
||||
int points = (int)Math.Round(amount * item.Points);
|
||||
|
||||
player.AddCollectionPoints(CollectionID, points);
|
||||
|
||||
player.SendLocalizedMessage(1072816); // Thank you for your donation!
|
||||
player.SendLocalizedMessage(1072817, points.ToString()); // You have earned ~1_POINTS~ reward points for this donation.
|
||||
player.SendLocalizedMessage(1072818, points.ToString()); // The Collection has been awarded ~1_POINTS~ points
|
||||
|
||||
Points += points;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public virtual void Reward(PlayerMobile player, CollectionItem reward, int hue)
|
||||
{
|
||||
Item item = QuestHelper.Construct(reward.Type) as Item;
|
||||
|
||||
if (item != null && player.AddToBackpack(item))
|
||||
{
|
||||
if (hue > 0)
|
||||
item.Hue = hue;
|
||||
|
||||
player.AddCollectionPoints(CollectionID, (int)reward.Points * -1);
|
||||
player.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
|
||||
player.PlaySound(0x5A7);
|
||||
|
||||
if (reward.QuestItem)
|
||||
CollectionsObtainObjective.CheckReward(player, item);
|
||||
|
||||
reward.OnGiveReward(player, item, this, hue);
|
||||
}
|
||||
else if (item != null)
|
||||
{
|
||||
player.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack.
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
player.SendGump(new CommunityCollectionGump(player, this, Location));
|
||||
}
|
||||
|
||||
public virtual void DonatePet(PlayerMobile player, BaseCreature pet)
|
||||
{
|
||||
for (int i = 0; i < m_Donations.Count; i ++)
|
||||
if (m_Donations[i].Type == pet.GetType())
|
||||
{
|
||||
pet.Delete();
|
||||
Donate(player, m_Donations[i], 1);
|
||||
return;
|
||||
}
|
||||
|
||||
player.SendLocalizedMessage(1073113); // This Collection is not accepting that type of creature.
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public virtual void IncreaseTier()
|
||||
{
|
||||
m_Tier += 1;
|
||||
}
|
||||
|
||||
public virtual void DecreaseTier()
|
||||
{
|
||||
m_Tier -= 1;
|
||||
|
||||
if (m_Tiers != null && m_Tiers.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < m_Tiers[m_Tiers.Count - 1].Count; i ++)
|
||||
{
|
||||
if (m_Tiers[m_Tiers.Count - 1][i] is Item)
|
||||
((Item)m_Tiers[m_Tiers.Count - 1][i]).Delete();
|
||||
else if (m_Tiers[m_Tiers.Count - 1][i] is Mobile)
|
||||
((Mobile)m_Tiers[m_Tiers.Count - 1][i]).Delete();
|
||||
}
|
||||
|
||||
m_Tiers.RemoveAt(m_Tiers.Count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
{
|
||||
if (m_Donations == null)
|
||||
m_Donations = new List<CollectionItem>();
|
||||
|
||||
if (m_Rewards == null)
|
||||
m_Rewards = new List<CollectionItem>();
|
||||
|
||||
if (m_Tiers == null)
|
||||
m_Tiers = new List<List<object>>();
|
||||
|
||||
// start decay timer
|
||||
if (m_DailyDecay > 0)
|
||||
{
|
||||
DateTime today = DateTime.Today.AddDays(1);
|
||||
|
||||
|
||||
new CollectionDecayTimer(this, today - DateTime.UtcNow);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CanDonate(PlayerMobile player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
CollectionsSystem.UnregisterMobile(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class CollectionDecayTimer : Timer
|
||||
{
|
||||
private readonly IComunityCollection m_Collection;
|
||||
public CollectionDecayTimer(IComunityCollection collection, TimeSpan delay)
|
||||
: base(delay, TimeSpan.FromDays(1.0))
|
||||
{
|
||||
this.m_Collection = collection;
|
||||
this.Priority = TimerPriority.OneMinute;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (this.m_Collection != null && this.m_Collection.DailyDecay > 0)
|
||||
this.m_Collection.Points -= this.m_Collection.DailyDecay;
|
||||
}
|
||||
}
|
||||
}
|
||||
171
Scripts/Services/CommunityCollections/CollectionItem.cs
Normal file
171
Scripts/Services/CommunityCollections/CollectionItem.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class CollectionItem
|
||||
{
|
||||
private readonly Type m_Type;
|
||||
private readonly int m_ItemID;
|
||||
private readonly int m_X;
|
||||
private readonly int m_Y;
|
||||
private readonly int m_Width;
|
||||
private readonly int m_Height;
|
||||
private readonly int m_Tooltip;
|
||||
private readonly int m_Hue;
|
||||
private readonly double m_Points;
|
||||
private readonly bool m_QuestItem;
|
||||
|
||||
public CollectionItem(Type type, int itemID, int tooltip, int hue, double points, bool questitem = false)
|
||||
{
|
||||
m_Type = type;
|
||||
m_ItemID = itemID;
|
||||
m_Tooltip = tooltip;
|
||||
m_Hue = hue;
|
||||
m_Points = points;
|
||||
m_QuestItem = questitem;
|
||||
|
||||
Rectangle2D rec;
|
||||
|
||||
try
|
||||
{
|
||||
rec = ItemBounds.Table[m_ItemID];
|
||||
}
|
||||
catch
|
||||
{
|
||||
rec = new Rectangle2D(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (rec.X == 0 && rec.Y == 0 && rec.Width == 0 && rec.Height == 0)
|
||||
{
|
||||
int mx, my;
|
||||
mx = my = 0;
|
||||
|
||||
Item.Measure(Item.GetBitmap(m_ItemID), out m_X, out m_Y, out mx, out my);
|
||||
|
||||
m_Width = mx - m_X;
|
||||
m_Height = my - m_Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_X = rec.X;
|
||||
m_Y = rec.Y;
|
||||
m_Width = rec.Width;
|
||||
m_Height = rec.Height;
|
||||
}
|
||||
}
|
||||
|
||||
public Type Type { get { return m_Type; } } // image info
|
||||
public int ItemID { get { return m_ItemID; } }
|
||||
public int X { get { return m_X; } }
|
||||
public int Y { get { return m_Y; } }
|
||||
public int Width { get { return m_Width; } }
|
||||
public int Height { get { return m_Height; } }
|
||||
public int Tooltip { get { return m_Tooltip; } }
|
||||
public int Hue { get { return m_Hue; } }
|
||||
public double Points { get { return m_Points; } }
|
||||
public bool QuestItem { get { return m_QuestItem; } }
|
||||
|
||||
public virtual bool Validate(PlayerMobile from, Item item)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool CanSelect(PlayerMobile from)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void OnGiveReward(PlayerMobile to, Item item, IComunityCollection collection, int hue)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class CollectionHuedItem : CollectionItem
|
||||
{
|
||||
private readonly int[] m_Hues;
|
||||
|
||||
public CollectionHuedItem(Type type, int itemID, int tooltip, int hue, double points, int[] hues)
|
||||
: base(type, itemID, tooltip, hue, points)
|
||||
{
|
||||
m_Hues = hues;
|
||||
}
|
||||
|
||||
public int[] Hues { get { return m_Hues; } }
|
||||
}
|
||||
|
||||
public class CollectionTitle : CollectionItem
|
||||
{
|
||||
private readonly object m_Title;
|
||||
|
||||
public CollectionTitle(object title, int tooltip, double points)
|
||||
: base(null, 0xFF1, tooltip, 0x0, points)
|
||||
{
|
||||
m_Title = title;
|
||||
}
|
||||
|
||||
public object Title { get { return m_Title; } }
|
||||
|
||||
public override void OnGiveReward(PlayerMobile to, Item item, IComunityCollection collection, int hue)
|
||||
{
|
||||
if (to.AddRewardTitle(m_Title))
|
||||
{
|
||||
if (m_Title is int)
|
||||
to.SendLocalizedMessage(1073625, "#" + (int)m_Title); // The title "~1_TITLE~" has been bestowed upon you.
|
||||
else if (m_Title is string)
|
||||
to.SendLocalizedMessage(1073625, (string)m_Title); // The title "~1_TITLE~" has been bestowed upon you.
|
||||
|
||||
to.AddCollectionPoints(collection.CollectionID, (int)Points * -1);
|
||||
}
|
||||
else
|
||||
to.SendLocalizedMessage(1073626); // You already have that title!
|
||||
}
|
||||
}
|
||||
|
||||
public class CollectionTreasureMap : CollectionItem
|
||||
{
|
||||
private readonly int m_Level;
|
||||
|
||||
public CollectionTreasureMap(int level, int tooltip, double points)
|
||||
: base(typeof(TreasureMap), 0x14EB, tooltip, 0x0, points)
|
||||
{
|
||||
m_Level = level;
|
||||
}
|
||||
|
||||
public int Level { get { return m_Level; } }
|
||||
|
||||
public override bool Validate(PlayerMobile from, Item item)
|
||||
{
|
||||
TreasureMap map = item as TreasureMap;
|
||||
|
||||
if (map != null && map.Level == m_Level)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class CollectionSpellbook : CollectionItem
|
||||
{
|
||||
private readonly SpellbookType m_Type;
|
||||
|
||||
public CollectionSpellbook(SpellbookType type, int itemID, int tooltip, double points)
|
||||
: base(typeof(Spellbook), itemID, tooltip, 0x0, points)
|
||||
{
|
||||
m_Type = type;
|
||||
}
|
||||
|
||||
public SpellbookType SpellbookType { get { return m_Type; } }
|
||||
|
||||
public override bool Validate(PlayerMobile from, Item item)
|
||||
{
|
||||
Spellbook spellbook = item as Spellbook;
|
||||
|
||||
if (spellbook != null && spellbook.SpellbookType == m_Type && spellbook.Content == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
158
Scripts/Services/CommunityCollections/CollectionsSystem.cs
Normal file
158
Scripts/Services/CommunityCollections/CollectionsSystem.cs
Normal file
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Server.Engines.Quests;
|
||||
using Server.Mobiles;
|
||||
using System.IO;
|
||||
|
||||
namespace Server.Services.Community_Collections
|
||||
{
|
||||
public class CollectionsSystem
|
||||
{
|
||||
private static Dictionary<Collection, CollectionData> m_Collections = new Dictionary<Collection, CollectionData>();
|
||||
private static List<BaseCollectionMobile> m_Mobiles = new List<BaseCollectionMobile>();
|
||||
private static string m_Path = Path.Combine("Saves", "CommunityCollections.bin");
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
EventSink.WorldSave += EventSink_WorldSave;
|
||||
EventSink.WorldLoad += EventSink_WorldLoad;
|
||||
}
|
||||
|
||||
public static void RegisterMobile(BaseCollectionMobile mob)
|
||||
{
|
||||
if (!m_Mobiles.Contains(mob))
|
||||
{
|
||||
m_Mobiles.Add(mob);
|
||||
if (m_Collections.ContainsKey(mob.CollectionID))
|
||||
mob.SetData(m_Collections[mob.CollectionID]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnregisterMobile(BaseCollectionMobile mob)
|
||||
{
|
||||
m_Collections[mob.CollectionID] = mob.GetData();
|
||||
m_Mobiles.Remove(mob);
|
||||
}
|
||||
|
||||
private static void EventSink_WorldSave(WorldSaveEventArgs e)
|
||||
{
|
||||
List<BaseCollectionMobile> newMobiles = new List<BaseCollectionMobile>();
|
||||
foreach (BaseCollectionMobile mob in m_Mobiles)
|
||||
{
|
||||
if (!mob.Deleted)
|
||||
newMobiles.Add(mob);
|
||||
}
|
||||
m_Mobiles = newMobiles;
|
||||
|
||||
Persistence.Serialize(
|
||||
m_Path,
|
||||
writer =>
|
||||
{
|
||||
writer.WriteMobileList(m_Mobiles);
|
||||
writer.Write(m_Mobiles.Count);
|
||||
foreach(BaseCollectionMobile mob in m_Mobiles)
|
||||
{
|
||||
writer.Write((int)mob.CollectionID);
|
||||
CollectionData data = mob.GetData();
|
||||
data.Write(writer);
|
||||
m_Collections[mob.CollectionID] = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void EventSink_WorldLoad()
|
||||
{
|
||||
Persistence.Deserialize(
|
||||
m_Path,
|
||||
reader =>
|
||||
{
|
||||
m_Mobiles.AddRange(reader.ReadMobileList().Cast<BaseCollectionMobile>());
|
||||
List<BaseCollectionMobile> mobs = new List<BaseCollectionMobile>();
|
||||
mobs.AddRange(m_Mobiles);
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for(int i = 0; i < count; ++i)
|
||||
{
|
||||
int collection = reader.ReadInt();
|
||||
CollectionData data = new CollectionData();
|
||||
data.Read(reader);
|
||||
int toRemove = -1;
|
||||
foreach (BaseCollectionMobile mob in mobs)
|
||||
{
|
||||
if(mob.CollectionID == (Collection)collection)
|
||||
{
|
||||
mob.SetData(data);
|
||||
toRemove = mobs.IndexOf(mob);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (toRemove >= 0)
|
||||
mobs.RemoveAt(toRemove);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class CollectionData
|
||||
{
|
||||
public Collection Collection;
|
||||
public long Points;
|
||||
public long StartTier;
|
||||
public long NextTier;
|
||||
public long DailyDecay;
|
||||
public int Tier;
|
||||
public object DonationTitle;
|
||||
public List<List<object>> Tiers = new List<List<object>>();
|
||||
|
||||
public void Write(GenericWriter writer)
|
||||
{
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write((int)Collection);
|
||||
writer.Write((long)Points);
|
||||
writer.Write((long)StartTier);
|
||||
writer.Write((long)NextTier);
|
||||
writer.Write((long)DailyDecay);
|
||||
writer.Write((int)Tier);
|
||||
|
||||
QuestWriter.Object(writer, DonationTitle);
|
||||
|
||||
writer.Write((int)Tiers.Count);
|
||||
|
||||
for (int i = 0; i < Tiers.Count; i++)
|
||||
{
|
||||
writer.Write((int)Tiers[i].Count);
|
||||
|
||||
for (int j = 0; j < Tiers[i].Count; j++)
|
||||
QuestWriter.Object(writer, Tiers[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Collection = (Collection)reader.ReadInt();
|
||||
Points = reader.ReadLong();
|
||||
StartTier = reader.ReadLong();
|
||||
NextTier = reader.ReadLong();
|
||||
DailyDecay = reader.ReadLong();
|
||||
Tier = reader.ReadInt();
|
||||
|
||||
DonationTitle = QuestReader.Object(reader);
|
||||
|
||||
for (int i = reader.ReadInt(); i > 0; i--)
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
|
||||
for (int j = reader.ReadInt(); j > 0; j--)
|
||||
list.Add(QuestReader.Object(reader));
|
||||
|
||||
Tiers.Add(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
689
Scripts/Services/CommunityCollections/CommunityCollectionGump.cs
Normal file
689
Scripts/Services/CommunityCollections/CommunityCollectionGump.cs
Normal file
@@ -0,0 +1,689 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Prompts;
|
||||
using Server.Engines.Quests;
|
||||
using Server.Accounting;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class CommunityCollectionGump : Gump
|
||||
{
|
||||
private readonly PlayerMobile m_Owner;
|
||||
private readonly IComunityCollection m_Collection;
|
||||
private readonly Point3D m_Location;
|
||||
private readonly Section m_Section;
|
||||
private readonly CollectionHuedItem m_Item;
|
||||
private int m_Index;
|
||||
private int m_Page;
|
||||
private int m_Max;
|
||||
|
||||
public CommunityCollectionGump(PlayerMobile from, IComunityCollection collection, Point3D location)
|
||||
: this(from, collection, location, Section.Donates)
|
||||
{
|
||||
}
|
||||
|
||||
public CommunityCollectionGump(PlayerMobile from, IComunityCollection collection, Point3D location, Section section)
|
||||
: this(from, collection, location, section, null)
|
||||
{
|
||||
}
|
||||
|
||||
public CommunityCollectionGump(PlayerMobile from, IComunityCollection collection, Point3D location, Section section, CollectionHuedItem item)
|
||||
: base(250, 50)
|
||||
{
|
||||
m_Owner = from;
|
||||
m_Collection = collection;
|
||||
m_Location = location;
|
||||
m_Section = section;
|
||||
m_Item = item;
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddImage(0, 0, 0x1F40);
|
||||
AddImageTiled(20, 37, 300, 308, 0x1F42);
|
||||
AddImage(20, 325, 0x1F43);
|
||||
AddImage(35, 8, 0x39);
|
||||
AddImageTiled(65, 8, 257, 10, 0x3A);
|
||||
AddImage(290, 8, 0x3B);
|
||||
AddImage(32, 33, 0x2635);
|
||||
AddImageTiled(70, 55, 230, 2, 0x23C5);
|
||||
|
||||
AddHtmlLocalized(70, 35, 270, 20, 1072835, 0x1, false, false); // Community Collection
|
||||
|
||||
// add pages
|
||||
if (m_Collection == null)
|
||||
return;
|
||||
|
||||
m_Index = 0;
|
||||
m_Page = 1;
|
||||
|
||||
switch ( m_Section )
|
||||
{
|
||||
case Section.Donates:
|
||||
GetMax(m_Collection.Donations);
|
||||
|
||||
while (m_Collection.Donations != null && m_Index < m_Collection.Donations.Count)
|
||||
DisplayDonationPage();
|
||||
break;
|
||||
case Section.Rewards:
|
||||
GetMax(m_Collection.Rewards);
|
||||
|
||||
while (m_Collection.Rewards != null && m_Index < m_Collection.Rewards.Count)
|
||||
DisplayRewardPage();
|
||||
break;
|
||||
case Section.Hues:
|
||||
while (m_Item != null && m_Index < m_Item.Hues.Length)
|
||||
DisplayHuePage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Section
|
||||
{
|
||||
Donates,
|
||||
Rewards,
|
||||
Hues,
|
||||
}
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Close,
|
||||
Rewards,
|
||||
Status,
|
||||
Next,
|
||||
}
|
||||
public void GetMax(List<CollectionItem> list)
|
||||
{
|
||||
m_Max = 0;
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
for (int i = 0; i < list.Count; i ++)
|
||||
if (m_Max < list[i].Width)
|
||||
m_Max = list[i].Width;
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayDonationPage()
|
||||
{
|
||||
AddPage(m_Page);
|
||||
|
||||
// title
|
||||
AddHtmlLocalized(50, 65, 150, 20, 1072836, 0x1, false, false); // Current Tier:
|
||||
AddLabel(230, 65, 0x64, m_Collection.Tier.ToString());
|
||||
AddHtmlLocalized(50, 85, 150, 20, 1072837, 0x1, false, false); // Current Points:
|
||||
AddLabel(230, 85, 0x64, m_Collection.Points.ToString());
|
||||
AddHtmlLocalized(50, 105, 150, 20, 1072838, 0x1, false, false); // Points Until Next Tier:
|
||||
AddLabel(230, 105, 0x64, m_Collection.CurrentTier.ToString());
|
||||
|
||||
AddImageTiled(35, 125, 270, 2, 0x23C5);
|
||||
AddHtmlLocalized(35, 130, 270, 20, 1072840, 0x1, false, false); // Donations Accepted:
|
||||
|
||||
// donations
|
||||
int offset = 150;
|
||||
int next = 0;
|
||||
|
||||
while (offset + next < 330 && m_Index < m_Collection.Donations.Count)
|
||||
{
|
||||
CollectionItem item = m_Collection.Donations[m_Index];
|
||||
Type type = item.Type;
|
||||
Account acct = m_Owner.Account as Account;
|
||||
|
||||
int height = Math.Max(item.Height, 20);
|
||||
|
||||
int amount = 0;
|
||||
|
||||
/*if (item.Type == typeof(Gold) && acct != null)
|
||||
amount = acct.TotalGold + m_Owner.Backpack.GetAmount(item.Type);
|
||||
else if (item.Type == typeof(RedScales))
|
||||
amount = GetScales(m_Owner.Backpack);
|
||||
else if (item.Type == typeof(Fish))
|
||||
amount = GetFishyItems(m_Owner.Backpack);
|
||||
else if (item.Type == typeof(Crab) || item.Type == typeof(Lobster))
|
||||
amount = GetCrabsAndLobsters(m_Owner.Backpack);
|
||||
else if (m_Owner.Backpack != null)
|
||||
amount = m_Owner.Backpack.GetAmount(item.Type);*/
|
||||
if (item.Type == typeof(Gold) && acct != null)
|
||||
{
|
||||
amount = acct.TotalGold + m_Owner.Backpack.GetAmount(item.Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = GetTypes(m_Owner, item);
|
||||
}
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
AddButton(35, offset + (int)(height / 2) - 5, 0x837, 0x838, 300 + m_Index, GumpButtonType.Reply, 0);
|
||||
AddTooltip(item.Tooltip);
|
||||
}
|
||||
|
||||
int y = offset - item.Y;
|
||||
|
||||
if (item.Height < 20)
|
||||
y += (20 - item.Height) / 2;
|
||||
|
||||
AddItem(55 - item.X + m_Max / 2 - item.Width / 2, y, item.ItemID, item.Hue);
|
||||
AddTooltip(item.Tooltip);
|
||||
|
||||
if (item.Points < 1 && item.Points > 0)
|
||||
AddLabel(65 + m_Max, offset + (int)(height / 2) - 10, 0x64, "1 per " + ((int)Math.Pow(item.Points, -1)).ToString());
|
||||
else
|
||||
AddLabel(65 + m_Max, offset + (int)(height / 2) - 10, 0x64, item.Points.ToString());
|
||||
|
||||
AddTooltip(item.Tooltip);
|
||||
|
||||
if (amount > 0)
|
||||
AddLabel(235, offset + (int)(height / 2) - 5, 0xB1, amount.ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("en-US")));
|
||||
|
||||
offset += 5 + height;
|
||||
m_Index += 1;
|
||||
|
||||
if (m_Index < m_Collection.Donations.Count)
|
||||
next = Math.Max(m_Collection.Donations[m_Index].Height, 20);
|
||||
else
|
||||
next = 0;
|
||||
}
|
||||
|
||||
// buttons
|
||||
AddButton(50, 335, 0x15E3, 0x15E7, (int)Buttons.Rewards, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(75, 335, 100, 20, 1072842, 0x1, false, false); // Rewards
|
||||
|
||||
if (m_Page > 1)
|
||||
{
|
||||
AddButton(150, 335, 0x15E3, 0x15E7, (int)Buttons.Next, GumpButtonType.Page, m_Page - 1);
|
||||
AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
|
||||
}
|
||||
|
||||
m_Page += 1;
|
||||
|
||||
if (m_Index < m_Collection.Donations.Count)
|
||||
{
|
||||
AddButton(300, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, m_Page);
|
||||
AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayRewardPage()
|
||||
{
|
||||
int points = m_Owner.GetCollectionPoints(m_Collection.CollectionID);
|
||||
|
||||
AddPage(m_Page);
|
||||
|
||||
// title
|
||||
AddHtmlLocalized(50, 65, 150, 20, 1072843, 0x1, false, false); // Your Reward Points:
|
||||
AddLabel(230, 65, 0x64, points.ToString());
|
||||
AddImageTiled(35, 85, 270, 2, 0x23C5);
|
||||
AddHtmlLocalized(35, 90, 270, 20, 1072844, 0x1, false, false); // Please Choose a Reward:
|
||||
|
||||
// rewards
|
||||
int offset = 110;
|
||||
int next = 0;
|
||||
|
||||
while (offset + next < 300 && m_Index < m_Collection.Rewards.Count)
|
||||
{
|
||||
CollectionItem item = m_Collection.Rewards[m_Index];
|
||||
|
||||
if (item.QuestItem && SkipQuestReward(m_Owner, item))
|
||||
{
|
||||
m_Index++;
|
||||
continue;
|
||||
}
|
||||
|
||||
int height = Math.Max(item.Height, 20);
|
||||
|
||||
if (points >= item.Points && item.CanSelect(m_Owner))
|
||||
{
|
||||
AddButton(35, offset + (int)(height / 2) - 5, 0x837, 0x838, 200 + m_Index, GumpButtonType.Reply, 0);
|
||||
AddTooltip(item.Tooltip);
|
||||
}
|
||||
|
||||
int y = offset - item.Y;
|
||||
|
||||
if (item.Height < 20)
|
||||
y += (20 - item.Height) / 2;
|
||||
|
||||
AddItem(55 - item.X + m_Max / 2 - item.Width / 2, y, item.ItemID, points >= item.Points ? item.Hue : 0x3E9);
|
||||
AddTooltip(item.Tooltip);
|
||||
AddLabel(65 + m_Max, offset + (int)(height / 2) - 10, points >= item.Points ? 0x64 : 0x21, item.Points.ToString());
|
||||
AddTooltip(item.Tooltip);
|
||||
|
||||
offset += 5 + height;
|
||||
m_Index += 1;
|
||||
|
||||
if (m_Index < m_Collection.Donations.Count)
|
||||
next = Math.Max(m_Collection.Donations[m_Index].Height, 20);
|
||||
else
|
||||
next = 0;
|
||||
}
|
||||
|
||||
// buttons
|
||||
AddButton(50, 335, 0x15E3, 0x15E7, (int)Buttons.Status, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(75, 335, 100, 20, 1072845, 0x1, false, false); // Status
|
||||
|
||||
if (m_Page > 1)
|
||||
{
|
||||
AddButton(150, 335, 0x15E3, 0x15E7, (int)Buttons.Next, GumpButtonType.Page, m_Page - 1);
|
||||
AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
|
||||
}
|
||||
|
||||
m_Page += 1;
|
||||
|
||||
if (m_Index < m_Collection.Rewards.Count)
|
||||
{
|
||||
AddButton(300, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, m_Page);
|
||||
AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayHuePage()
|
||||
{
|
||||
int points = m_Owner.GetCollectionPoints(m_Collection.CollectionID);
|
||||
|
||||
AddPage(m_Page);
|
||||
|
||||
// title
|
||||
AddHtmlLocalized(50, 65, 150, 20, 1072843, 0x1, false, false); // Your Reward Points:
|
||||
AddLabel(230, 65, 0x64, points.ToString());
|
||||
|
||||
AddImageTiled(35, 85, 270, 2, 0x23C5);
|
||||
|
||||
AddHtmlLocalized(35, 90, 270, 20, 1074255, 0x1, false, false); // Please select a hue for your Reward:
|
||||
|
||||
// hues
|
||||
int height = Math.Max(m_Item.Height, 20);
|
||||
int offset = 110;
|
||||
|
||||
while (offset + height < 290 && m_Index < m_Item.Hues.Length)
|
||||
{
|
||||
AddButton(35, offset + (int)(height / 2) - 5, 0x837, 0x838, 100 + m_Index, GumpButtonType.Reply, 0);
|
||||
AddTooltip(m_Item.Tooltip);
|
||||
|
||||
AddItem(55 - m_Item.X, offset - m_Item.Y, m_Item.ItemID, m_Item.Hues[m_Index]);
|
||||
AddTooltip(m_Item.Tooltip);
|
||||
|
||||
offset += 5 + height;
|
||||
m_Index += 1;
|
||||
}
|
||||
|
||||
m_Page += 1;
|
||||
|
||||
// buttons
|
||||
AddButton(50, 335, 0x15E3, 0x15E7, (int)Buttons.Rewards, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(75, 335, 100, 20, 1072842, 0x1, false, false); // Rewards
|
||||
|
||||
if (m_Index < m_Item.Hues.Length && m_Page > 2)
|
||||
{
|
||||
if (m_Index < m_Item.Hues.Length)
|
||||
AddButton(270, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, m_Page);
|
||||
else
|
||||
AddButton(270, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, 1);
|
||||
|
||||
AddHtmlLocalized(210, 335, 60, 20, 1074256, 0x1, false, false); // More Hues
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(Server.Network.NetState state, RelayInfo info)
|
||||
{
|
||||
if (m_Collection == null || !m_Owner.InRange(m_Location, 2))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == (int)Buttons.Rewards)
|
||||
m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Rewards));
|
||||
else if (info.ButtonID == (int)Buttons.Status)
|
||||
m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Donates));
|
||||
else if (info.ButtonID >= 300 && m_Collection.Donations != null && info.ButtonID - 300 < m_Collection.Donations.Count && m_Section == Section.Donates)
|
||||
{
|
||||
CollectionItem item = m_Collection.Donations[info.ButtonID - 300];
|
||||
|
||||
m_Owner.SendLocalizedMessage(1073178); // Please enter how much of that item you wish to donate:
|
||||
m_Owner.Prompt = new InternalPrompt(m_Collection, item, m_Location);
|
||||
}
|
||||
else if (info.ButtonID >= 200 && m_Collection.Rewards != null && info.ButtonID - 200 < m_Collection.Rewards.Count && m_Section == Section.Rewards)
|
||||
{
|
||||
CollectionItem item = m_Collection.Rewards[info.ButtonID - 200];
|
||||
int points = m_Owner.GetCollectionPoints(m_Collection.CollectionID);
|
||||
|
||||
if (item.CanSelect(m_Owner))
|
||||
{
|
||||
if (item.Points <= points)
|
||||
{
|
||||
if (item is CollectionHuedItem)
|
||||
{
|
||||
m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Hues, (CollectionHuedItem)item));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Owner.CloseGump(typeof(ConfirmRewardGump));
|
||||
m_Owner.SendGump(new ConfirmRewardGump(m_Collection, m_Location, item, 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
m_Owner.SendLocalizedMessage(1073122); // You don't have enough points for that!
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID >= 100 && m_Item != null && info.ButtonID - 200 < m_Item.Hues.Length && m_Section == Section.Hues)
|
||||
{
|
||||
m_Owner.CloseGump(typeof(ConfirmRewardGump));
|
||||
m_Owner.SendGump(new ConfirmRewardGump(m_Collection, m_Location, m_Item, m_Item.Hues[info.ButtonID - 100]));
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalPrompt : Prompt
|
||||
{
|
||||
private readonly IComunityCollection m_Collection;
|
||||
private readonly CollectionItem m_Selected;
|
||||
private readonly Point3D m_Location;
|
||||
public InternalPrompt(IComunityCollection collection, CollectionItem selected, Point3D location)
|
||||
{
|
||||
m_Collection = collection;
|
||||
m_Selected = selected;
|
||||
m_Location = location;
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (!from.InRange(m_Location, 2) || !(from is PlayerMobile))
|
||||
return;
|
||||
|
||||
HandleResponse(from, text);
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
|
||||
}
|
||||
|
||||
private void HandleResponse(Mobile from, string text)
|
||||
{
|
||||
int amount = Utility.ToInt32(text);
|
||||
|
||||
if (amount <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1073181); // That is not a valid donation quantity.
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.Backpack == null)
|
||||
return;
|
||||
|
||||
if (m_Selected.Type == typeof(Gold))
|
||||
{
|
||||
if (amount * m_Selected.Points < 1)
|
||||
{
|
||||
from.SendLocalizedMessage(1073167); // You do not have enough of that item to make a donation!
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
|
||||
return;
|
||||
}
|
||||
|
||||
Item[] items = from.Backpack.FindItemsByType(m_Selected.Type, true);
|
||||
Account acct = from.Account as Account;
|
||||
|
||||
int goldcount = 0;
|
||||
int accountcount = acct == null ? 0 : acct.TotalGold;
|
||||
int amountRemaining = amount;
|
||||
foreach (Item item in items)
|
||||
goldcount += item.Amount;
|
||||
|
||||
if (goldcount >= amountRemaining)
|
||||
{
|
||||
foreach (Item item in items)
|
||||
{
|
||||
if (item.Amount <= amountRemaining)
|
||||
{
|
||||
item.Delete();
|
||||
amountRemaining -= item.Amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Amount -= amountRemaining;
|
||||
amountRemaining = 0;
|
||||
}
|
||||
|
||||
if (amountRemaining == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (goldcount + accountcount >= amountRemaining)
|
||||
{
|
||||
foreach (Item item in items)
|
||||
{
|
||||
amountRemaining -= item.Amount;
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
Banker.Withdraw(from, amountRemaining);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1073182); // You do not have enough to make a donation of that magnitude!
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
|
||||
return;
|
||||
}
|
||||
|
||||
from.Backpack.ConsumeTotal(m_Selected.Type, amount, true, true);
|
||||
m_Collection.Donate((PlayerMobile)from, m_Selected, amount);
|
||||
}
|
||||
else if(m_Selected.Type == typeof(BankCheck))
|
||||
{
|
||||
int count = from.Backpack.GetChecksWorth(true);
|
||||
|
||||
if(count < amount)
|
||||
{
|
||||
from.SendLocalizedMessage(1073182); // You do not have enough to make a donation of that magnitude!
|
||||
return;
|
||||
}
|
||||
|
||||
from.Backpack.TakeFromChecks(amount, true);
|
||||
m_Collection.Donate((PlayerMobile)from, m_Selected, amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (amount * m_Selected.Points < 1)
|
||||
{
|
||||
from.SendLocalizedMessage(1073167); // You do not have enough of that item to make a donation!
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
|
||||
return;
|
||||
}
|
||||
|
||||
var items = FindTypes((PlayerMobile)from, m_Selected);
|
||||
|
||||
if (items.Count > 0)
|
||||
{
|
||||
// count items
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
var item = GetActual(items[i]);
|
||||
|
||||
if (item != null && !item.Deleted)
|
||||
count += item.Amount;
|
||||
}
|
||||
|
||||
// check
|
||||
if (amount > count)
|
||||
{
|
||||
from.SendLocalizedMessage(1073182); // You do not have enough to make a donation of that magnitude!
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
|
||||
return;
|
||||
}
|
||||
else if (amount * m_Selected.Points < 1)
|
||||
{
|
||||
from.SendLocalizedMessage(m_Selected.Type == typeof(Gold) ? 1073182 : 1073167); // You do not have enough of that item to make a donation!
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
|
||||
return;
|
||||
}
|
||||
|
||||
// donate
|
||||
int deleted = 0;
|
||||
|
||||
for (int i = 0; i < items.Count && deleted < amount; i++)
|
||||
{
|
||||
var item = GetActual(items[i]);
|
||||
|
||||
if (item == null || item.Deleted)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.Stackable && item.Amount + deleted > amount && !item.Deleted)
|
||||
{
|
||||
item.Amount -= amount - deleted;
|
||||
deleted += amount - deleted;
|
||||
}
|
||||
else if (!item.Deleted)
|
||||
{
|
||||
deleted += item.Amount;
|
||||
items[i].Delete();
|
||||
}
|
||||
|
||||
if (items[i] is CommodityDeed && !items[i].Deleted)
|
||||
{
|
||||
items[i].InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
m_Collection.Donate((PlayerMobile)from, m_Selected, amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1073182); // You do not have enough to make a donation of that magnitude!
|
||||
}
|
||||
|
||||
ColUtility.Free(items);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (!(from is PlayerMobile))
|
||||
return;
|
||||
|
||||
from.SendLocalizedMessage(1073184); // You cancel your donation.
|
||||
|
||||
if (from.InRange(m_Location, 2))
|
||||
from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
|
||||
}
|
||||
}
|
||||
|
||||
private bool SkipQuestReward(PlayerMobile pm, CollectionItem item)
|
||||
{
|
||||
if (pm.Quests != null)
|
||||
{
|
||||
foreach (BaseQuest q in pm.Quests)
|
||||
{
|
||||
if (!q.Completed)
|
||||
{
|
||||
foreach (BaseObjective obj in q.Objectives)
|
||||
{
|
||||
if (obj is CollectionsObtainObjective && item.Type == ((CollectionsObtainObjective)obj).Obtain)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CheckType(Item item, Type type, bool checkDerives)
|
||||
{
|
||||
if (item is CommodityDeed && ((CommodityDeed)item).Commodity != null)
|
||||
{
|
||||
item = ((CommodityDeed)item).Commodity;
|
||||
}
|
||||
|
||||
var t = item.GetType();
|
||||
|
||||
if (type == t)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (!checkDerives)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == typeof(Lobster) && BaseHighseasFish.Lobsters.Any(x => x == t))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (type == typeof(Crab) && BaseHighseasFish.Crabs.Any(x => x == t))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (type == typeof(Fish) && t != typeof(BaseCrabAndLobster) && !t.IsSubclassOf(typeof(BaseCrabAndLobster)) && (t.IsSubclassOf(type) || t == typeof(BaseHighseasFish) || t.IsSubclassOf(typeof(BaseHighseasFish))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return t.IsSubclassOf(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetTypes(PlayerMobile pm, CollectionItem colItem)
|
||||
{
|
||||
var type = colItem.Type;
|
||||
bool derives = type == typeof(RedScales) || type == typeof(Fish) || type == typeof(Crab) || type == typeof(Lobster);
|
||||
|
||||
int count = 0;
|
||||
|
||||
foreach (var item in pm.Backpack.Items)
|
||||
{
|
||||
if (CheckType(item, type, derives) && colItem.Validate(pm, GetActual(item)))
|
||||
{
|
||||
if (type == typeof(BankCheck))
|
||||
{
|
||||
count += pm.Backpack.GetChecksWorth(true);
|
||||
}
|
||||
else if (item is CommodityDeed)
|
||||
{
|
||||
count += ((CommodityDeed)item).Commodity.Amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
count += item.Amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public static List<Item> FindTypes(PlayerMobile pm, CollectionItem colItem)
|
||||
{
|
||||
var type = colItem.Type;
|
||||
bool derives = type == typeof(RedScales) || type == typeof(Fish) || type == typeof(Crab) || type == typeof(Lobster);
|
||||
|
||||
var list = new List<Item>();
|
||||
|
||||
foreach (var item in pm.Backpack.Items)
|
||||
{
|
||||
if (CheckType(item, type, derives) && colItem.Validate(pm, GetActual(item)))
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Item GetActual(Item item)
|
||||
{
|
||||
if (item is CommodityDeed)
|
||||
{
|
||||
return ((CommodityDeed)item).Commodity;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Scripts/Services/CommunityCollections/ConfirmRewardGump.cs
Normal file
63
Scripts/Services/CommunityCollections/ConfirmRewardGump.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ConfirmRewardGump : BaseConfirmGump
|
||||
{
|
||||
private readonly IComunityCollection m_Collection;
|
||||
private readonly Point3D m_Location;
|
||||
private readonly CollectionItem m_Item;
|
||||
private readonly int m_Hue;
|
||||
|
||||
public ConfirmRewardGump(IComunityCollection collection, Point3D location, CollectionItem item)
|
||||
: this(collection, location, item, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public ConfirmRewardGump(IComunityCollection collection, Point3D location, CollectionItem item, int hue)
|
||||
: base()
|
||||
{
|
||||
m_Collection = collection;
|
||||
m_Location = location;
|
||||
m_Item = item;
|
||||
m_Hue = hue;
|
||||
|
||||
if (m_Item != null)
|
||||
AddItem(150, 100, m_Item.ItemID, m_Item.Hue);
|
||||
}
|
||||
|
||||
public override int TitleNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1074974;
|
||||
}
|
||||
}// Confirm Selection
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1074975;
|
||||
}
|
||||
}// Are you sure you wish to select this?
|
||||
public override void Confirm(Mobile from)
|
||||
{
|
||||
if (m_Collection == null || !from.InRange(m_Location, 2))
|
||||
return;
|
||||
|
||||
if (from is PlayerMobile)
|
||||
{
|
||||
PlayerMobile player = (PlayerMobile)from;
|
||||
if(player.GetCollectionPoints(m_Collection.CollectionID) < m_Item.Points)
|
||||
{
|
||||
player.SendLocalizedMessage(1073122); // You don't have enough points for that!
|
||||
}
|
||||
else if (m_Item.CanSelect(player))
|
||||
{
|
||||
m_Collection.Reward(player, m_Item, m_Hue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ConfirmTransferPetGump : Gump
|
||||
{
|
||||
private readonly IComunityCollection m_Collection;
|
||||
private readonly Point3D m_Location;
|
||||
private readonly BaseCreature m_Pet;
|
||||
public ConfirmTransferPetGump(IComunityCollection collection, Point3D location, BaseCreature pet)
|
||||
: base(50, 50)
|
||||
{
|
||||
this.m_Collection = collection;
|
||||
this.m_Location = location;
|
||||
this.m_Pet = pet;
|
||||
|
||||
this.Closable = true;
|
||||
this.Disposable = true;
|
||||
this.Dragable = true;
|
||||
this.Resizable = false;
|
||||
|
||||
this.AddPage(0);
|
||||
this.AddBackground(0, 0, 270, 120, 0x13BE);
|
||||
|
||||
this.AddHtmlLocalized(10, 10, 250, 75, 1073105, 0x0, true, false); // <div align=center>Are you sure you wish to transfer this pet away, with no possibility of recovery?</div>
|
||||
this.AddHtmlLocalized(55, 90, 75, 20, 1011011, 0x0, false, false); // CONTINUE
|
||||
this.AddHtmlLocalized(170, 90, 75, 20, 1011012, 0x0, false, false); // CANCEL
|
||||
|
||||
this.AddButton(20, 90, 0xFA5, 0xFA7, (int)Buttons.Continue, GumpButtonType.Reply, 0);
|
||||
this.AddButton(135, 90, 0xFA5, 0xFA7, (int)Buttons.Cancel, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
Continue,
|
||||
}
|
||||
public override void OnResponse(Server.Network.NetState state, RelayInfo info)
|
||||
{
|
||||
if (this.m_Collection == null || this.m_Pet == null || this.m_Pet.Deleted || this.m_Pet.ControlMaster != state.Mobile || !state.Mobile.InRange(this.m_Location, 2))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == (int)Buttons.Continue && state.Mobile is PlayerMobile)
|
||||
this.m_Collection.DonatePet((PlayerMobile)state.Mobile, this.m_Pet);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Scripts/Services/CommunityCollections/ICollection.cs
Normal file
52
Scripts/Services/CommunityCollections/ICollection.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public enum Collection
|
||||
{
|
||||
VesperMuseum,
|
||||
MoonglowZoo,
|
||||
|
||||
// Britain library
|
||||
MaceAndBlade,
|
||||
FoldedSteel,
|
||||
Trades,
|
||||
ArtsSection,
|
||||
SongsOfNote,
|
||||
UnderstandingAnimals,
|
||||
LightAndMight,
|
||||
OilAndOubliette,
|
||||
WizardsCompendium,
|
||||
BritanniaWaters,
|
||||
PastTreasures,
|
||||
SkeletonKey,
|
||||
|
||||
// Factions
|
||||
Minax,
|
||||
CouncilOfMages,
|
||||
TrueBritannians,
|
||||
Shadowlords
|
||||
}
|
||||
|
||||
public interface IComunityCollection
|
||||
{
|
||||
Collection CollectionID { get; }
|
||||
long Points { get; set; }
|
||||
long CurrentTier { get; }
|
||||
long PreviousTier { get; }
|
||||
long StartTier { get; set; }
|
||||
long NextTier { get; set; }
|
||||
long DailyDecay { get; set; }
|
||||
int Tier { get; }
|
||||
int MaxTier { get; }
|
||||
List<CollectionItem> Donations { get; }
|
||||
List<CollectionItem> Rewards { get; }
|
||||
void Donate(PlayerMobile player, CollectionItem item, int amount);
|
||||
|
||||
void Reward(PlayerMobile player, CollectionItem reward, int hue);
|
||||
|
||||
void DonatePet(PlayerMobile player, BaseCreature pet);
|
||||
}
|
||||
}
|
||||
482
Scripts/Services/CommunityCollections/MuseumDonationBox.cs
Normal file
482
Scripts/Services/CommunityCollections/MuseumDonationBox.cs
Normal file
@@ -0,0 +1,482 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class VesperDonationBox : BaseCollectionItem
|
||||
{
|
||||
[Constructable]
|
||||
public VesperDonationBox()
|
||||
: base(0xE7D)
|
||||
{
|
||||
this.Hue = 0x48D;
|
||||
this.StartTier = 10000000;
|
||||
this.NextTier = 5000000;
|
||||
this.DailyDecay = 100000;
|
||||
}
|
||||
|
||||
public VesperDonationBox(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1073407;
|
||||
}
|
||||
}// Please Contribute to the public Museum of Vesper.
|
||||
public override Collection CollectionID
|
||||
{
|
||||
get
|
||||
{
|
||||
return Collection.VesperMuseum;
|
||||
}
|
||||
}
|
||||
public override int MaxTier
|
||||
{
|
||||
get
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
this.Donations.Add(new CollectionItem(typeof(Gold), 0xEEF, 1073116, 0x0, 0.06666));
|
||||
if(!Core.TOL)
|
||||
this.Donations.Add(new CollectionItem(typeof(BankCheck), 0x14F0, 1075013, 0x34, 0.06666));
|
||||
this.Donations.Add(new CollectionItem(typeof(Board), 0x1BD7, 1015101, 0, 1));
|
||||
this.Donations.Add(new CollectionItem(typeof(OakBoard), 0x1BD7, 1075052, 0x7DA, 3));
|
||||
this.Donations.Add(new CollectionItem(typeof(AshBoard), 0x1BD7, 1075053, 0x4A7, 6));
|
||||
this.Donations.Add(new CollectionItem(typeof(YewBoard), 0x1BD7, 1075054, 0x4A8, 9));
|
||||
this.Donations.Add(new CollectionItem(typeof(HeartwoodBoard), 0x1BD7, 1075062, 0x4A9, 12));
|
||||
this.Donations.Add(new CollectionItem(typeof(BloodwoodBoard), 0x1BD7, 1075055, 0x4AA, 24));
|
||||
this.Donations.Add(new CollectionItem(typeof(FrostwoodBoard), 0x1BD7, 1075056, 0x47F, 48));
|
||||
this.Donations.Add(new CollectionItem(typeof(Hinge), 0x1055, 1044172, 0x0, 2));
|
||||
this.Donations.Add(new CollectionItem(typeof(Scorp), 0x10E7, 1075057, 0x0, 2));
|
||||
this.Donations.Add(new CollectionItem(typeof(DrawKnife), 0x10E4, 1075058, 0x0, 2));
|
||||
this.Donations.Add(new CollectionItem(typeof(JointingPlane), 0x1030, 1075059, 0x0, 4));
|
||||
this.Donations.Add(new CollectionItem(typeof(MouldingPlane), 0x102C, 1075060, 0x0, 4));
|
||||
this.Donations.Add(new CollectionItem(typeof(SmoothingPlane), 0x1032, 1075061, 0x0, 4));
|
||||
|
||||
int[] hues = new int[] { 0x581, 0x278, 0x318, 0x2FF };
|
||||
Rewards.Add(new CollectionItem(typeof(ShepherdsCrookOfHumility), 0xE81, 1075791, 0x0, 5000.0, true));
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(OdricsRobe), 0x1F03, 1073250, 0x581, 100000.0, hues));
|
||||
|
||||
hues = new int[] { 0x229, 0x18E, 0x215, 0xF5 };
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(MalabellesDress), 0x1516, 1073251, 0x229, 100000.0, hues));
|
||||
|
||||
hues = new int[] { 0x281, 0x173, 0x581, 0x300 };
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(BaronLenshiresCloak), 0x1515, 1073252, 0x281, 100000.0, hues));
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(Adranath), 0x1541, 1073253, 0x555, 100000.0, hues));
|
||||
this.Rewards.Add(new CollectionTitle(1073235, 1073637, 100000.0)); // Vesper Museum Contributor
|
||||
|
||||
hues = new int[] { 0x2A, 0x27D, 0xF7, 0x236 };
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(VesperCollectionRing), 0x108A, 1073234, 0x2A, 200000.0, hues));
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(VesperCollectionNecklace), 0x1088, 1073234, 0x2A, 200000.0, hues));
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(VesperCollectionBracelet), 0x1086, 1073234, 0x2A, 200000.0, hues));
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(VesperCollectionEarrings), 0x1087, 1073234, 0x2A, 200000.0, hues));
|
||||
this.Rewards.Add(new CollectionTitle(1073236, 1073638, 200000.0)); // Distinguished Vesper Museum Contributor
|
||||
this.Rewards.Add(new CollectionItem(typeof(LordBritishThroneDeed), 0x1F23, 1073243, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(TrollStatuette), 0x20E9, 1073242, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(CrystalBallStatuette), 0xE2D, 1073244, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(DevourerStatuette), 0x2623, 1073245, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(SnowLadyStatuette), 0x276C, 1075016, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(GolemStatuette), 0x2610, 1075017, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(ExodusOverseerStatuette), 0x260C, 1075018, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(JukaLordStatuette), 0x25FC, 1075019, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(MeerCaptainStatuette), 0x25FA, 1075020, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(MeerEternalStatuette), 0x25F8, 1075021, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(SolenQueenStatuette), 0x2602, 1075022, 0x0, 350000.0));
|
||||
this.Rewards.Add(new CollectionTitle(1073237, 1073639, 350000.0)); // Honored Vesper Museum Contributor
|
||||
this.Rewards.Add(new CollectionItem(typeof(MinaxsArmor), 0x1C02, 1073257, 0x281, 550000.0));
|
||||
|
||||
hues = new int[] { 0x281, 0x173, 0x581, 0x300 };
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(GypsyHeaddress), 0x1544, 1073254, 0x453, 550000.0, hues));
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(NystulsWizardsHat), 0x1718, 1073255, 0x453, 550000.0, hues));
|
||||
this.Rewards.Add(new CollectionHuedItem(typeof(JesterHatOfChuckles), 0x171C, 1073256, 0x453, 550000.0, hues));
|
||||
this.Rewards.Add(new CollectionItem(typeof(KeeoneansChainMail), 0x13BF, 1073264, 0x84E, 550000.0));
|
||||
this.Rewards.Add(new CollectionTitle(1073238, 1073640, 550000.0)); // Prominent Vesper Museum Contributor
|
||||
this.Rewards.Add(new CollectionItem(typeof(ClaininsSpellbook), 0xEFA, 1073262, 0x84D, 800000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(VesperOrderShield), 0x1BC4, 1073258, 0x835, 800000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(VesperChaosShield), 0x1BC3, 1073259, 0xFA, 800000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(BlackthornsKryss), 0x1401, 1073260, 0x5E5, 800000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(SwordOfJustice), 0x13B9, 1073261, 0x47E, 800000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(GeoffreysAxe), 0xF45, 1073263, 0x21, 800000.0));
|
||||
this.Rewards.Add(new CollectionItem(typeof(VesperSpecialAchievementReplica), 0x2D4E, 1073265, 0x0, 800000.0));
|
||||
this.Rewards.Add(new CollectionTitle(1073239, 1073641, 800000.0)); // Eminent Vesper Museum Contributor
|
||||
}
|
||||
|
||||
public override void IncreaseTier()
|
||||
{
|
||||
base.IncreaseTier();
|
||||
|
||||
List<object> list = new List<object>();
|
||||
Item c;
|
||||
|
||||
// don't know names above lev 6
|
||||
switch ( this.Tier )
|
||||
{
|
||||
case 1:
|
||||
c = new BookOfChivalry();
|
||||
c.MoveToWorld(new Point3D(2924, 979, -18), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Longsword();
|
||||
c.MoveToWorld(new Point3D(2923, 980, -18), this.Map);
|
||||
c.Movable = false;
|
||||
c.ItemID = 0x26CF;
|
||||
list.Add(c);
|
||||
|
||||
c = new Shirt();
|
||||
c.MoveToWorld(new Point3D(2924, 978, -18), this.Map);
|
||||
c.Movable = false;
|
||||
c.ItemID = 0x2662;
|
||||
c.Name = "Crisp White Shirt";
|
||||
list.Add(c);
|
||||
break;
|
||||
case 2:
|
||||
c = new GraveDust();
|
||||
c.MoveToWorld(new Point3D(2921, 972, -17), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new NoxCrystal();
|
||||
c.MoveToWorld(new Point3D(2921, 972, -17), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0xF91);
|
||||
c.MoveToWorld(new Point3D(2921, 972, -17), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new NecromancerSpellbook();
|
||||
c.MoveToWorld(new Point3D(2922, 972, -18), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new AnimateDeadScroll();
|
||||
c.MoveToWorld(new Point3D(2923, 972, -18), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new HorrificBeastScroll();
|
||||
c.MoveToWorld(new Point3D(2923, 972, -18), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new VampiricEmbraceScroll();
|
||||
c.MoveToWorld(new Point3D(2923, 971, -20), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0xFDD);
|
||||
c.MoveToWorld(new Point3D(2922, 971, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0xFDE);
|
||||
c.MoveToWorld(new Point3D(2923, 971, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
c = new JesterSuit();
|
||||
c.MoveToWorld(new Point3D(2919, 985, -16), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new LocalizedStatic(0xE74, 1073424);
|
||||
c.MoveToWorld(new Point3D(2919, 984, -11), this.Map);
|
||||
c.Movable = false;
|
||||
c.Weight = 50.0;
|
||||
c.Hue = 0x113;
|
||||
list.Add(c);
|
||||
|
||||
c = new JesterHat();
|
||||
c.MoveToWorld(new Point3D(2919, 983, -13), this.Map);
|
||||
c.Movable = false;
|
||||
c.Hue = 0x113;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 4:
|
||||
c = new Static(0xD25);
|
||||
c.MoveToWorld(new Point3D(2916, 984, -13), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x20D9);
|
||||
c.MoveToWorld(new Point3D(2916, 982, -12), this.Map);
|
||||
c.Name = "Gargoyle";
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x2132);
|
||||
c.MoveToWorld(new Point3D(2914, 982, -9), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x25B6);
|
||||
c.MoveToWorld(new Point3D(2913, 982, -13), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x25B6);
|
||||
c.MoveToWorld(new Point3D(2913, 982, -13), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x222E);
|
||||
c.MoveToWorld(new Point3D(2915, 983, -14), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x2211);
|
||||
c.MoveToWorld(new Point3D(2914, 984, -13), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 5:
|
||||
c = new LocalizedStatic(0xE30, 1073421);
|
||||
c.MoveToWorld(new Point3D(2911, 983, -12), this.Map);
|
||||
c.Weight = 10.0;
|
||||
list.Add(c);
|
||||
|
||||
c = new LocalizedStatic(0x2937, 1073422);
|
||||
c.MoveToWorld(new Point3D(2911, 984, -13), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new LocalizedStatic(0x12AA, 1073423);
|
||||
c.MoveToWorld(new Point3D(2911, 985, -14), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0xEAF);
|
||||
c.MoveToWorld(new Point3D(2910, 985, -21), this.Map);
|
||||
c.Weight = 5.0;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0xEAE);
|
||||
c.MoveToWorld(new Point3D(2910, 986, -21), this.Map);
|
||||
c.Weight = 5.0;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 6:
|
||||
c = new Tessen();
|
||||
c.MoveToWorld(new Point3D(2910, 966, -17), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Shuriken();
|
||||
c.MoveToWorld(new Point3D(2910, 965, -17), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x2855);
|
||||
c.MoveToWorld(new Point3D(2910, 964, -16), this.Map);
|
||||
c.Weight = 5.0;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x241D);
|
||||
c.MoveToWorld(new Point3D(2910, 963, -20), this.Map);
|
||||
c.Weight = 5.0;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x2409);
|
||||
c.MoveToWorld(new Point3D(2910, 963, -17), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x2416);
|
||||
c.MoveToWorld(new Point3D(2909, 965, -17), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 7:
|
||||
c = new Static(0x3069);
|
||||
c.MoveToWorld(new Point3D(2914, 964, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x306A);
|
||||
c.MoveToWorld(new Point3D(2913, 964, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x306B);
|
||||
c.MoveToWorld(new Point3D(2912, 964, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new ElvenLoveseatEastAddon();
|
||||
c.MoveToWorld(new Point3D(2913, 966, -21), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x2CFC);
|
||||
c.MoveToWorld(new Point3D(2912, 963, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new LocalizedStatic(0x2D74, 1073425);
|
||||
c.MoveToWorld(new Point3D(2914, 963, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 8:
|
||||
c = new Static(0x2);
|
||||
c.MoveToWorld(new Point3D(2905, 970, -15), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x3);
|
||||
c.MoveToWorld(new Point3D(2905, 969, -15), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new OrderShield();
|
||||
c.MoveToWorld(new Point3D(2905, 971, -17), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x1579);
|
||||
c.MoveToWorld(new Point3D(2904, 971, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x1613);
|
||||
c.MoveToWorld(new Point3D(2908, 969, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x1614);
|
||||
c.MoveToWorld(new Point3D(2908, 968, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 9:
|
||||
c = new Static(0x1526);
|
||||
c.MoveToWorld(new Point3D(2905, 976, -15), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x1527);
|
||||
c.MoveToWorld(new Point3D(2905, 975, -15), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x151A);
|
||||
c.MoveToWorld(new Point3D(2905, 972, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x151A);
|
||||
c.MoveToWorld(new Point3D(2905, 977, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x151A);
|
||||
c.MoveToWorld(new Point3D(2908, 972, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x151A);
|
||||
c.MoveToWorld(new Point3D(2908, 977, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x1514);
|
||||
c.MoveToWorld(new Point3D(2904, 975, -17), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 10:
|
||||
c = new Static(0x15C5);
|
||||
c.MoveToWorld(new Point3D(2904, 982, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x15C5);
|
||||
c.MoveToWorld(new Point3D(2904, 979, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x157B);
|
||||
c.MoveToWorld(new Point3D(2904, 981, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x14E3);
|
||||
c.MoveToWorld(new Point3D(2905, 980, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x14E4);
|
||||
c.MoveToWorld(new Point3D(2905, 981, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x14E5);
|
||||
c.MoveToWorld(new Point3D(2906, 981, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x14E6);
|
||||
c.MoveToWorld(new Point3D(2906, 980, -21), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new ChaosShield();
|
||||
c.MoveToWorld(new Point3D(2905, 978, -19), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 11:
|
||||
c = new FemaleStuddedChest();
|
||||
c.MoveToWorld(new Point3D(2912, 976, -16), this.Map);
|
||||
c.Movable = false;
|
||||
c.Hue = 0x497;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x1EA8);
|
||||
c.MoveToWorld(new Point3D(2913, 973, -13), this.Map);
|
||||
c.Hue = 0x497;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x20F8);
|
||||
c.MoveToWorld(new Point3D(2913, 975, -11), this.Map);
|
||||
c.Hue = 0x113;
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x20E9);
|
||||
c.MoveToWorld(new Point3D(2912, 974, -11), this.Map);
|
||||
c.Name = "Troll";
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x2607);
|
||||
c.MoveToWorld(new Point3D(2913, 974, -11), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x25F9);
|
||||
c.MoveToWorld(new Point3D(2912, 975, -11), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 12:
|
||||
c = new Static(0x1D8A);
|
||||
c.MoveToWorld(new Point3D(2915, 976, -13), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x1D8B);
|
||||
c.MoveToWorld(new Point3D(2916, 976, -13), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new Static(0x234D);
|
||||
c.MoveToWorld(new Point3D(2915, 975, -10), this.Map);
|
||||
list.Add(c);
|
||||
|
||||
c = new WizardsHat();
|
||||
c.MoveToWorld(new Point3D(2915, 974, -13), this.Map);
|
||||
c.Movable = false;
|
||||
list.Add(c);
|
||||
break;
|
||||
}
|
||||
|
||||
if (list.Count > 0)
|
||||
this.Tiers.Add(list);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
331
Scripts/Services/CommunityCollections/RoyalZooDonationBox.cs
Normal file
331
Scripts/Services/CommunityCollections/RoyalZooDonationBox.cs
Normal file
@@ -0,0 +1,331 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MoonglowDonationBox : BaseCollectionItem
|
||||
{
|
||||
[Constructable]
|
||||
public MoonglowDonationBox()
|
||||
: base(0x9AA)
|
||||
{
|
||||
Hue = 0x48D;
|
||||
StartTier = 1000000;
|
||||
NextTier = 500000;
|
||||
DailyDecay = 100000;
|
||||
}
|
||||
|
||||
public MoonglowDonationBox(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1073436;
|
||||
}
|
||||
}// Donation Box
|
||||
public override Collection CollectionID
|
||||
{
|
||||
get
|
||||
{
|
||||
return Collection.MoonglowZoo;
|
||||
}
|
||||
}
|
||||
public override int MaxTier
|
||||
{
|
||||
get
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
public override bool HandlesOnSpeech
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
Donations.Add(new CollectionItem(typeof(Gold), 0xEEF, 1073116, 0x0, 0.06666));
|
||||
|
||||
if (!Core.TOL)
|
||||
this.Donations.Add(new CollectionItem(typeof(BankCheck), 0x14F0, 1075013, 0x34, 0.06666));
|
||||
|
||||
Donations.Add(new CollectionItem(typeof(DireWolf), 0x25D0, 1073118, 0x0, 30.0));
|
||||
Donations.Add(new CollectionItem(typeof(TimberWolf), 0x25D3, 1073118, 0x0, 30.0));
|
||||
Donations.Add(new CollectionItem(typeof(GreyWolf), 0x25D1, 1073118, 0x0, 30.0));
|
||||
Donations.Add(new CollectionItem(typeof(WhiteWolf), 0x25D2, 1073118, 0x0, 30.0));
|
||||
Donations.Add(new CollectionItem(typeof(Slime), 0x20E8, 1073117, 0x0, 45.0));
|
||||
Donations.Add(new CollectionItem(typeof(PolarBear), 0x20E1, 1073120, 0x0, 45.0));
|
||||
//Donations.Add(new CollectionItem(typeof(Unicorn), 0x25CE, 1074821, 0x0, 250.0));
|
||||
Donations.Add(new CollectionItem(typeof(Kirin), 0x25A0, 1074821, 0x0, 250.0));
|
||||
//Donations.Add(new CollectionItem(typeof(Nightmare), 0x259C, 1074821, 0x0, 250.0));
|
||||
Donations.Add(new CollectionItem(typeof(FireSteed), 0x21F1, 1074821, 0x0, 250.0));
|
||||
Donations.Add(new CollectionItem(typeof(SwampDragon), 0x2619, 1074821, 0x0, 250.0));
|
||||
//Donations.Add(new CollectionItem(typeof(RuneBeetle), 0x276F, 1074820, 0x0, 300.0));
|
||||
Donations.Add(new CollectionItem(typeof(FireBeetle), 0x260F, 1074820, 0x489, 300.0));
|
||||
//Donations.Add(new CollectionItem(typeof(Beetle), 0x260F, 1074820, 0x0, 300.0));
|
||||
Donations.Add(new CollectionItem(typeof(Drake), 0x20D6, 1073119, 0x0, 400.0));
|
||||
//Donations.Add(new CollectionItem(typeof(Dragon), 0x20D6, 1073119, 0x0, 400.0));
|
||||
Donations.Add(new CollectionItem(typeof(Reptalon), 0x2D95, 1073121, 0x0, 550.0));
|
||||
|
||||
int[] hues = new int[]
|
||||
{
|
||||
0x555, 0xAE, 0x94, 0x278, 0x32, 0x28, 0x327, 0x41A
|
||||
};
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(ForTheLifeOfBritanniaSash), 0x1541, 1075792, 0x0, 5000.0, true));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ZooMemberCloak), 0x1515, 1073221, 0x555, 100000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ZooMemberRobe), 0x1F03, 1073221, 0x555, 100000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ZooMemberSkirt), 0x1F01, 1073221, 0x555, 100000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ZooMemberBodySash), 0x1541, 1073221, 0x555, 100000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ZooMemberThighBoots), 0x1711, 1073221, 0x555, 100000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ZooMemberFloppyHat), 0x1713, 1073221, 0x555, 100000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ZooMemberBonnet), 0x1719, 1073221, 0x555, 100000.0, hues));
|
||||
Rewards.Add(new CollectionTitle(1073201, 1073624, 100000.0)); // Britannia Zoo Contributor
|
||||
Rewards.Add(new CollectionItem(typeof(QuagmireStatue), 0x2614, 1073195, 0x0, 200000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(BakeKitsuneStatue), 0x2763, 1073189, 0x0, 200000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(WolfStatue), 0x25D3, 1073190, 0x0, 200000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(ChangelingStatue), 0x2D8A, 1073191, 0x0, 200000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(ReptalonStatue), 0x2D95, 1073192, 0x0, 200000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(PolarBearStatue), 0x20E1, 1073193, 0x0, 200000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(SnakeStatue), 0x25C2, 1073194, 0x0, 200000.0));
|
||||
Rewards.Add(new CollectionTitle(1073202, 1073627, 200000.0)); // Distinguished Britannia Zoo Contributor
|
||||
|
||||
hues = new int[]
|
||||
{
|
||||
0x34, 0x1C2, 0x2A3
|
||||
};
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(SilverSteedZooStatuette), 0x259D, 1073219, 0x0, 350000.0));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(QuagmireZooStatuette), 0x2614, 1074848, 0x34, 350000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(BakeKitsuneZooStatuette), 0x2763, 1074849, 0x34, 350000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(DireWolfZooStatuette), 0x25D0, 1073196, 0x34, 350000.0, hues));
|
||||
Rewards.Add(new CollectionItem(typeof(CraneZooStatuette), 0x2764, 1073197, 0x0, 350000.0));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(PolarBearZooStatuette), 0x20E1, 1074851, 0x34, 350000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ChangelingZooStatuette), 0x2D8A, 1074850, 0x34, 350000.0, hues));
|
||||
Rewards.Add(new CollectionHuedItem(typeof(ReptalonZooStatuette), 0x2D95, 1074852, 0x34, 350000.0, hues));
|
||||
Rewards.Add(new CollectionTitle(1073203, 1073628, 350000.0)); // Honored Britannia Zoo Contributor
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooLeatherLegs), 0x13CB, 1073222, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooLeatherGloves), 0x13C6, 1073222, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooLeatherGorget), 0x13C7, 1073222, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooLeatherArms), 0x13CD, 1073222, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooLeatherChest), 0x13CC, 1073222, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooLeatherFemaleChest), 0x1C06, 1073222, 0x109, 550000.0));
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooStuddedLegs), 0x13DA, 1073223, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooStuddedGloves), 0x13D5, 1073223, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooStuddedGorget), 0x13D6, 1073223, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooStuddedArms), 0x13DC, 1073223, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooStuddedChest), 0x13DB, 1073223, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooStuddedFemaleChest), 0x1C02, 1073223, 0x109, 550000.0));
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooPlateLegs), 0x1411, 1073224, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooPlateGloves), 0x1414, 1073224, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooPlateGorget), 0x1413, 1073224, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooPlateArms), 0x1410, 1073224, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooPlateChest), 0x1415, 1073224, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooPlateFemaleChest), 0x1C04, 1073224, 0x109, 550000.0));
|
||||
Rewards.Add(new CollectionItem(typeof(RoyalZooPlateHelm), 0x1412, 1073224, 0x109, 550000.0));
|
||||
|
||||
Rewards.Add(new CollectionTitle(1073204, 1073629, 550000.0)); // Prominent Britannia Zoo Contributor
|
||||
Rewards.Add(new CollectionItem(typeof(SpecialAchievementZooStatuette), 0x2FF6, 1073226, 0x109, 800000.0));
|
||||
Rewards.Add(new CollectionTitle(1073205, 1073630, 800000.0)); // Eminent Britannia Zoo Contribuer
|
||||
Rewards.Add(new CollectionTitle(1073206, 1073631, 800000.0)); // Royal Subject of the Britannia Zoo
|
||||
}
|
||||
|
||||
public static bool HasGroup(Type type, Type colType)
|
||||
{
|
||||
foreach (var typeList in _PetGroups)
|
||||
{
|
||||
if (typeList.Any(x => type == x) && typeList.Any(x => colType == x))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Type[][] _PetGroups =
|
||||
{
|
||||
new Type[] { typeof(Dragon), typeof(Drake) },
|
||||
new Type[] { typeof(Kirin), typeof(Nightmare), typeof(Unicorn) },
|
||||
new Type[] { typeof(FireBeetle), typeof(Beetle), typeof(RuneBeetle) },
|
||||
};
|
||||
|
||||
public override void IncreaseTier()
|
||||
{
|
||||
base.IncreaseTier();
|
||||
|
||||
List<object> list = new List<object>();
|
||||
BaseCreature c;
|
||||
|
||||
// haven't got a clue if levels are OSI
|
||||
switch ( this.Tier )
|
||||
{
|
||||
case 1:
|
||||
c = new Crane();
|
||||
c.MoveToWorld(new Point3D(4500, 1382, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
c = new DireWolf();
|
||||
c.MoveToWorld(new Point3D(4494, 1370, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new DireWolf();
|
||||
c.MoveToWorld(new Point3D(4494, 1360, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new WhiteWolf();
|
||||
c.MoveToWorld(new Point3D(4491, 1366, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new WhiteWolf();
|
||||
c.MoveToWorld(new Point3D(4497, 1366, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new GreyWolf();
|
||||
c.MoveToWorld(new Point3D(4497, 1366, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
c = new Quagmire();
|
||||
c.MoveToWorld(new Point3D(4483, 1392, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new BogThing();
|
||||
c.MoveToWorld(new Point3D(4486, 1385, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new PlagueBeast();
|
||||
c.MoveToWorld(new Point3D(4486, 1379, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 4:
|
||||
c = new PolarBear();
|
||||
c.MoveToWorld(new Point3D(4513, 1395, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new PolarBear();
|
||||
c.MoveToWorld(new Point3D(4508, 1393, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 5:
|
||||
c = new Yamandon();
|
||||
c.MoveToWorld(new Point3D(4498, 1393, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 6:
|
||||
c = new Changeling();
|
||||
c.MoveToWorld(new Point3D(4518, 1358, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 7:
|
||||
c = new Wyvern();
|
||||
c.MoveToWorld(new Point3D(4512, 1381, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 8:
|
||||
c = new Dragon();
|
||||
c.MoveToWorld(new Point3D(4511, 1372, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
c = new Drake();
|
||||
c.MoveToWorld(new Point3D(4516, 1371, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 9:
|
||||
c = new Reptalon();
|
||||
c.MoveToWorld(new Point3D(4530, 1387, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
break;
|
||||
case 10:
|
||||
c = new SilverSteed();
|
||||
c.MoveToWorld(new Point3D(4506, 1358, 23), this.Map);
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add(c);
|
||||
|
||||
/*
|
||||
c = new Sphynx();
|
||||
c.MoveToWorld( new Point3D( 4506, 1358, 23 ), Map );
|
||||
c.Blessed = true;
|
||||
c.Tamable = false;
|
||||
list.Add( c );*/
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (list.Count > 0)
|
||||
this.Tiers.Add(list);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
69
Scripts/Services/CommunityCollections/SelectTitleGump.cs
Normal file
69
Scripts/Services/CommunityCollections/SelectTitleGump.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class SelectTitleGump : Gump
|
||||
{
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly int m_Page;
|
||||
public SelectTitleGump(PlayerMobile from, int page)
|
||||
: base(50, 50)
|
||||
{
|
||||
this.m_From = from;
|
||||
this.m_Page = page;
|
||||
|
||||
this.Closable = true;
|
||||
this.Disposable = true;
|
||||
this.Dragable = true;
|
||||
this.Resizable = false;
|
||||
|
||||
this.AddPage(0);
|
||||
this.AddBackground(0, 0, 270, 120, 0x13BE);
|
||||
this.AddBackground(10, 10, 250, 100, 0xBB8);
|
||||
|
||||
this.AddHtmlLocalized(20, 15, 230, 20, 1073994, 0x1, false, false); // Your title will be:
|
||||
|
||||
if (page > -1 && page < from.RewardTitles.Count)
|
||||
{
|
||||
if (from.RewardTitles[page] is int)
|
||||
this.AddHtmlLocalized(20, 35, 230, 40, (int)from.RewardTitles[page], 0x32, true, false);
|
||||
else if (from.RewardTitles[page] is string)
|
||||
this.AddHtml(20, 35, 230, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", 0x32, (string)from.RewardTitles[page]), true, false);
|
||||
}
|
||||
else
|
||||
this.AddHtmlLocalized(20, 35, 230, 40, 1073995, 0x32, true, false);
|
||||
|
||||
this.AddHtmlLocalized(55, 80, 75, 20, 1073996, 0x0, false, false); // ACCEPT
|
||||
this.AddHtmlLocalized(170, 80, 75, 20, 1073997, 0x0, false, false); // NEXT
|
||||
|
||||
this.AddButton(20, 80, 0xFA5, 0xFA7, (int)Buttons.Accept, GumpButtonType.Reply, 0);
|
||||
this.AddButton(135, 80, 0xFA5, 0xFA7, (int)Buttons.Next, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
Next,
|
||||
Accept,
|
||||
}
|
||||
public override void OnResponse(Server.Network.NetState state, RelayInfo info)
|
||||
{
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case (int)Buttons.Accept:
|
||||
this.m_From.SelectRewardTitle(this.m_Page);
|
||||
break;
|
||||
case (int)Buttons.Next:
|
||||
if (this.m_Page == this.m_From.RewardTitles.Count - 1)
|
||||
this.m_From.SendGump(new SelectTitleGump(this.m_From, -1));
|
||||
else if (this.m_Page < this.m_From.RewardTitles.Count - 1 && this.m_Page > - 1)
|
||||
this.m_From.SendGump(new SelectTitleGump(this.m_From, this.m_Page + 1));
|
||||
else
|
||||
this.m_From.SendGump(new SelectTitleGump(this.m_From, 0));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user