The 'Party Party Groupie Groupie Life is a game' commit:

* Added prototypical MoneyBalance support
  * Finalized konceptual touch wiring
  * Turned SimpleApp into a tedious harvesting game.
afrisby
lbsa71 2007-08-15 21:24:25 +00:00
parent 6831c42fe2
commit 94af938742
11 changed files with 124 additions and 28 deletions

View File

@ -216,5 +216,6 @@ namespace OpenSim.Framework.Interfaces
void SendAlertMessage(string message);
void SendAgentAlertMessage(string message, bool modal);
void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
bool AddMoney( int debit );
}
}

View File

@ -145,6 +145,11 @@ namespace OpenSim.Framework
public void SendAgentAlertMessage(string message, bool modal) { }
public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { }
public bool AddMoney(int debit)
{
return false;
}
}
}

View File

@ -38,6 +38,27 @@ namespace OpenSim.Region.ClientStack
{
public partial class ClientView
{
private int m_moneyBalance;
public int MoneyBalance
{
get { return m_moneyBalance; }
}
public bool AddMoney( int debit )
{
if( m_moneyBalance + debit >= 0 )
{
m_moneyBalance += debit;
SendMoneyBalance( LLUUID.Zero, true, Helpers.StringToField("Poof Poof!"), m_moneyBalance );
return true;
}
else
{
return false;
}
}
protected override void ProcessInPacket(Packet Pack)
{
ack_pack(Pack);
@ -521,7 +542,7 @@ namespace OpenSim.Region.ClientStack
#endregion
case PacketType.MoneyBalanceRequest:
this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000);
SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance);
break;
case PacketType.UUIDNameRequest:
UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack;

View File

@ -87,6 +87,8 @@ namespace OpenSim.Region.ClientStack
public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AgentCircuitManager authenSessions )
{
m_moneyBalance = 1000;
m_scene = scene;
m_clientThreads = clientThreads;
m_assetCache = assetCache;

View File

@ -91,16 +91,23 @@ namespace OpenSim.Region.Environment
#region Object Permissions
protected virtual bool GenericObjectPermission(LLUUID user, LLUUID obj)
protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId)
{
// Default: deny
bool permission = false;
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[obj] is SceneObjectGroup))
if( !m_scene.Entities.ContainsKey( objId ))
{
return false;
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[objId] is SceneObjectGroup))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId];
LLUUID taskOwner = null;
// Object owners should be able to edit their own content

View File

@ -752,7 +752,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
{
this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);
}

View File

@ -863,5 +863,28 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.Text = text;
m_rootPart.ScheduleTerseUpdate();
}
public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient)
{
if( m_rootPart.LocalID == localId )
{
OnGrabGroup(offsetPos, remoteClient);
}
else
{
SceneObjectPart part = GetChildPrim(localId);
OnGrabPart(part, offsetPos, remoteClient);
}
}
public virtual void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient)
{
part.OnGrab(offsetPos, remoteClient);
}
public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
{
}
}
}

View File

@ -566,6 +566,10 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void UpdateMovement()
{
}
public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient)
{
}
}
}

View File

@ -5,6 +5,7 @@ using OpenSim.Region.Environment.Scenes;
using Axiom.Math;
using libsecondlife;
using OpenSim.Framework.Types;
using OpenSim.Framework.Interfaces;
namespace SimpleApp
{
@ -35,6 +36,8 @@ namespace SimpleApp
base.UpdateMovement();
}
public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos )
: base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default )
{
@ -51,5 +54,25 @@ namespace SimpleApp
UpdateParentIDs();
}
public override void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient)
{
m_parts.Remove(part.UUID);
remoteClient.SendKillObject(m_regionHandle, part.LocalID);
remoteClient.AddMoney(1);
remoteClient.SendChatMessage("Poof!", 1, Pos, "Party Party", LLUUID.Zero);
}
public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient)
{
if( m_parts.Count == 1 )
{
m_parts.Remove(m_rootPart.UUID);
m_scene.RemoveEntity(this);
remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID);
remoteClient.AddMoney(50);
remoteClient.SendChatMessage("KABLAM!!!", 1, Pos, "Groupie Groupie", LLUUID.Zero);
}
}
}
}

View File

@ -202,5 +202,10 @@ namespace SimpleApp
count++;
}
public bool AddMoney(int debit)
{
return false;
}
}
}

View File

@ -41,38 +41,43 @@ namespace SimpleApp
this.CreateTerrainTexture();
}
public override void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
{
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
SceneObjectGroup obj = ent as SceneObjectGroup;
if( obj.HasChildPrim( localID ) )
{
obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
return;
}
}
}
base.ProcessObjectGrab(localID, offsetPos, remoteClient);
}
#region IWorld Members
override public void AddNewClient(IClientAPI client, bool child)
{
SubscribeToClientEvents(client);
ScenePresence avatar = CreateAndAddScenePresence(client);
avatar.Pos = new LLVector3(128, 128, 26);
LLVector3 pos = new LLVector3(128, 128, 128);
client.OnRegionHandShakeReply += SendLayerData;
/*client.OnChatFromViewer +=
delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
// Echo it (so you know what you typed)
client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero );
};
*/
client.OnChatFromViewer += this.SimChat;
client.OnAddPrim += AddNewPrim;
client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition;
client.OnRequestMapBlocks += this.RequestMapBlocks;
client.OnTeleportLocationRequest += this.RequestTeleportLocation;
client.OnGrabUpdate += this.MoveObject;
client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
client.OnCompleteMovementToRegion += delegate()
{
client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero );
};
client.SendRegionHandshake(m_regInfo);
ScenePresence avatar = CreateAndAddScenePresence(client);
avatar.Pos = new LLVector3(128, 128, 26);
client.SendRegionHandshake(m_regInfo);
}
#endregion