Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
51
Scripts/Services/BulkOrders/Rewards/ConfirmBankPointsGump.cs
Normal file
51
Scripts/Services/BulkOrders/Rewards/ConfirmBankPointsGump.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class ConfirmBankPointsGump : ConfirmCallbackGump
|
||||
{
|
||||
public int Points { get; set; }
|
||||
public double Banked { get; set; }
|
||||
|
||||
public Mobile Owner { get; set; }
|
||||
public BODType BODType { get; set; }
|
||||
|
||||
public ConfirmBankPointsGump(PlayerMobile user, Mobile owner, BODType type, int points, double banked)
|
||||
: base(user, 1157076, 1157077, new object[] { points, banked, type, owner }, String.Format("{0}\t{1}", banked.ToString("0.000000"), points.ToString()), OnSave, OnClaim)
|
||||
{
|
||||
Closable = false;
|
||||
user.CloseGump(typeof(ConfirmBankPointsGump));
|
||||
|
||||
Points = points;
|
||||
Banked = banked;
|
||||
this.BODType = type;
|
||||
|
||||
Owner = owner;
|
||||
|
||||
Rectangle2D rec = ItemBounds.Table[0x2258];
|
||||
|
||||
AddItem(115 + rec.Width / 2 - rec.X, 110 + rec.Height / 2 - rec.Y, 0x2258, BulkOrderSystem.GetBodHue(this.BODType));
|
||||
}
|
||||
|
||||
private static void OnSave(Mobile m, object state)
|
||||
{
|
||||
object[] ohs = (object[])state;
|
||||
|
||||
BulkOrderSystem.SetPoints(m, (BODType)ohs[2], (double)ohs[1]);
|
||||
BulkOrderSystem.RemovePending(m, (BODType)ohs[2]);
|
||||
|
||||
if (m is PlayerMobile)
|
||||
m.SendGump(new RewardsGump((Mobile)ohs[3], (PlayerMobile)m, (BODType)ohs[2]));
|
||||
}
|
||||
|
||||
private static void OnClaim(Mobile m, object state)
|
||||
{
|
||||
object[] ohs = (object[])state;
|
||||
|
||||
if (m is PlayerMobile)
|
||||
m.SendGump(new RewardsGump((Mobile)ohs[3], (PlayerMobile)m, (BODType)ohs[2], (int)ohs[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
1949
Scripts/Services/BulkOrders/Rewards/Rewards.cs
Normal file
1949
Scripts/Services/BulkOrders/Rewards/Rewards.cs
Normal file
File diff suppressed because it is too large
Load Diff
80
Scripts/Services/BulkOrders/Rewards/RewardsGump.cs
Normal file
80
Scripts/Services/BulkOrders/Rewards/RewardsGump.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using Server.Engines.BulkOrders;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class RewardsGump : BaseRewardGump
|
||||
{
|
||||
public BODType BODType { get; private set; }
|
||||
|
||||
public bool UsingBanked { get; set; }
|
||||
|
||||
public RewardsGump(Mobile owner, PlayerMobile user, BODType type, int points = 0)
|
||||
: base(owner, user, BulkOrderSystem.GetRewardCollection(type), 1157082, points == 0 ? BulkOrderSystem.GetPoints(user, type) : points)
|
||||
{
|
||||
BODType = type;
|
||||
UsingBanked = points == 0;
|
||||
|
||||
var entry = new GumpLabel(230, 65, 0x64, GetPoints(user).ToString("0.000000"));
|
||||
entry.Parent = this;
|
||||
|
||||
Entries.Insert(10, entry);
|
||||
}
|
||||
|
||||
public override int GetYOffset(int id)
|
||||
{
|
||||
if (id == 0x182B)
|
||||
{
|
||||
return 34;
|
||||
}
|
||||
|
||||
return 15;
|
||||
}
|
||||
|
||||
protected override void AddPoints()
|
||||
{
|
||||
}
|
||||
|
||||
public override double GetPoints(Mobile m)
|
||||
{
|
||||
if (Points > 0)
|
||||
return Points;
|
||||
|
||||
return BulkOrderSystem.GetPoints(m, this.BODType);
|
||||
}
|
||||
|
||||
public override void OnConfirmed(CollectionItem citem, int index)
|
||||
{
|
||||
BODCollectionItem item = citem as BODCollectionItem;
|
||||
|
||||
if (item != null && GetPoints(User) >= item.Points && item.Constructor != null)
|
||||
{
|
||||
Item i = item.Constructor(item.RewardType);
|
||||
|
||||
if (User.Backpack == null || !User.Backpack.TryDropItem(User, i, false))
|
||||
{
|
||||
User.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack.
|
||||
i.Delete();
|
||||
|
||||
User.SendGump(new RewardsGump(Owner, User, this.BODType, (int)Points));
|
||||
}
|
||||
else
|
||||
{
|
||||
User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
|
||||
User.PlaySound(0x5A7);
|
||||
|
||||
if (UsingBanked)
|
||||
{
|
||||
BulkOrderSystem.DeductPoints(User, this.BODType, item.Points);
|
||||
}
|
||||
else
|
||||
{
|
||||
BulkOrderSystem.RemovePending(User, this.BODType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user