Update the money framework to allow sending the new style linden "serverside is now viewerside" messages regarding currency

This will require all money modules to be refactored!
user_profiles
Melanie 2013-05-25 02:08:54 +01:00
parent 1821372634
commit 533bbf033d
9 changed files with 32 additions and 44 deletions

View File

@ -766,7 +766,7 @@ namespace OpenSim.Groups
remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group.");
return UUID.Zero;
}
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, "Group Creation");
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
}
string reason = string.Empty;
UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment,

View File

@ -1159,7 +1159,8 @@ namespace OpenSim.Framework
void SendTeleportStart(uint flags);
void SendTeleportProgress(uint flags, string message);
void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance);
void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item);
void SendPayPrice(UUID objectID, int[] payPrice);
void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations);
@ -1254,8 +1255,6 @@ namespace OpenSim.Framework
void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch,
string[] buttonlabels);
bool AddMoney(int debit);
/// <summary>
/// Update the client as to where the sun is currently located.
/// </summary>

View File

@ -38,7 +38,8 @@ namespace OpenSim.Framework
int GetBalance(UUID agentID);
bool UploadCovered(UUID agentID, int amount);
bool AmountCovered(UUID agentID, int amount);
void ApplyCharge(UUID agentID, int amount, string text);
void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type);
void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData);
void ApplyUploadCharge(UUID agentID, int amount, string text);
int UploadCharge { get; }

View File

@ -345,7 +345,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// protected HashSet<uint> m_attachmentsSent;
private int m_moneyBalance;
private int m_animationSequenceNumber = 1;
private bool m_SendLogoutPacketWhenClosing = true;
@ -420,7 +419,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public string Name { get { return FirstName + " " + LastName; } }
public uint CircuitCode { get { return m_circuitCode; } }
public int MoneyBalance { get { return m_moneyBalance; } }
public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
/// <summary>
@ -483,7 +481,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_firstName = sessionInfo.LoginInfo.First;
m_lastName = sessionInfo.LoginInfo.Last;
m_startpos = sessionInfo.LoginInfo.StartPos;
m_moneyBalance = 1000;
m_udpServer = udpServer;
m_udpClient = udpClient;
@ -1538,7 +1535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(tpProgress, ThrottleOutPacketType.Unknown);
}
public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item)
{
MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket)PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply);
money.MoneyData.AgentID = AgentId;
@ -1546,7 +1543,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
money.MoneyData.TransactionSuccess = success;
money.MoneyData.Description = description;
money.MoneyData.MoneyBalance = balance;
money.TransactionInfo.ItemDescription = Util.StringToBytes256("NONE");
money.TransactionInfo.TransactionType = transactionType;
money.TransactionInfo.SourceID = sourceID;
money.TransactionInfo.IsSourceGroup = sourceIsGroup;
money.TransactionInfo.DestID = destID;
money.TransactionInfo.IsDestGroup = destIsGroup;
money.TransactionInfo.Amount = amount;
money.TransactionInfo.ItemDescription = Util.StringToBytes256(item);
OutPacket(money, ThrottleOutPacketType.Task);
}
@ -2279,6 +2283,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <returns></returns>
public AgentAlertMessagePacket BuildAgentAlertPacket(string message, bool modal)
{
// Prepend a slash to make the message come up in the top right
// again.
// Allow special formats to be sent from aware modules.
if (!modal && !message.StartsWith("ALERT: ") && !message.StartsWith("NOTIFY: ") && message != "Home position set." && message != "You died and have been teleported to your home location")
message = "/" + message;
AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage);
alertPack.AgentData.AgentID = AgentId;
alertPack.AlertData.Message = Util.StringToBytes256(message);
@ -11933,17 +11942,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method);
}
public bool AddMoney(int debit)
{
if (m_moneyBalance + debit >= 0)
{
m_moneyBalance += debit;
SendMoneyBalance(UUID.Zero, true, Util.StringToBytes256("Poof Poof!"), m_moneyBalance);
return true;
}
return false;
}
protected void HandleAutopilot(Object sender, string method, List<String> args)
{
float locx = 0;

View File

@ -1056,7 +1056,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
{
}
public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item)
{
}
@ -1196,11 +1196,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public bool AddMoney(int debit)
{
return true;
}
public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition)
{

View File

@ -764,7 +764,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group.");
return UUID.Zero;
}
money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation");
money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
}
UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient));

View File

@ -191,9 +191,14 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
// Please do not refactor these to be just one method
// Existing implementations need the distinction
//
public void ApplyCharge(UUID agentID, int amount, string text)
public void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData)
{
}
public void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type)
{
}
public void ApplyUploadCharge(UUID agentID, int amount, string text)
{
}
@ -322,7 +327,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
client.SendAlertMessage(e.Message + " ");
}
client.SendMoneyBalance(TransactionID, true, new byte[0], returnfunds);
client.SendMoneyBalance(TransactionID, true, new byte[0], returnfunds, 0, UUID.Zero, false, UUID.Zero, false, 0, String.Empty);
}
else
{
@ -385,12 +390,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
{
if (sender != null)
{
sender.SendMoneyBalance(UUID.Random(), transactionresult, Utils.StringToBytes(description), GetFundsForAgentID(senderID));
sender.SendMoneyBalance(UUID.Random(), transactionresult, Utils.StringToBytes(description), GetFundsForAgentID(senderID), 0, UUID.Zero, false, UUID.Zero, false, 0, String.Empty);
}
if (receiver != null)
{
receiver.SendMoneyBalance(UUID.Random(), transactionresult, Utils.StringToBytes(description), GetFundsForAgentID(receiverID));
receiver.SendMoneyBalance(UUID.Random(), transactionresult, Utils.StringToBytes(description), GetFundsForAgentID(receiverID), 0, UUID.Zero, false, UUID.Zero, false, 0, String.Empty);
}
}
}

View File

@ -694,7 +694,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
}
public virtual void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
public virtual void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item)
{
}
@ -866,11 +866,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
}
public bool AddMoney(int debit)
{
return false;
}
public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong time, uint dlen, uint ylen, float phase)
{
}

View File

@ -651,7 +651,7 @@ namespace OpenSim.Tests.Common.Mock
{
}
public virtual void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
public virtual void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item)
{
}
@ -875,11 +875,6 @@ namespace OpenSim.Tests.Common.Mock
}
public bool AddMoney(int debit)
{
return false;
}
public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong time, uint dlen, uint ylen, float phase)
{
}