- Fixed spawner to correctly spawn sea creatures on water tiles.

- Fixed the individual clear button in the spawner gump.
- The spawner gump now reloads unless it is closed or cancel is pressed.
- Fixed conflicting button IDs in AdminGump.
- Fixed the Developer and Owner accesslevel buttons for accounts in AdminGump.
- Owners are now allowed to set other accounts as Owner.
- The client gump now accounts for the visibility list when checking visibility of higher accesslevel focus mobs.
- The hue of the Protector shroud is now picked randomly as well, it is no longer the inverse of their boots hue.
This commit is contained in:
eos 2012-05-13 01:51:14 +00:00
parent 6962ed06bf
commit e372d20b00
5 changed files with 98 additions and 33 deletions

View file

@ -544,21 +544,21 @@ namespace Server.Mobiles
ISpawnable spawned = CreateSpawnedObject( index );
if (spawned == null)
if ( spawned == null )
return;
spawned.Spawner = this;
m_Spawned.Add(spawned);
m_Spawned.Add( spawned );
Point3D loc = (spawned is BaseVendor ? this.Location : GetSpawnPosition());
Point3D loc = ( spawned is BaseVendor ? this.Location : GetSpawnPosition( spawned ) );
spawned.OnBeforeSpawn(loc, map);
spawned.OnBeforeSpawn( loc, map );
InvalidateProperties();
spawned.MoveToWorld(loc, map);
spawned.MoveToWorld( loc, map );
if (spawned is BaseCreature)
if ( spawned is BaseCreature )
{
BaseCreature bc = (BaseCreature)spawned;
@ -577,36 +577,93 @@ namespace Server.Mobiles
}
public Point3D GetSpawnPosition()
{
return GetSpawnPosition( null );
}
public Point3D GetSpawnPosition( ISpawnable spawned )
{
Map map = Map;
if ( map == null )
return Location;
// Try 10 times to find a Spawnable location.
for ( int i = 0; i < 10; i++ )
bool waterMob, waterOnlyMob;
if ( spawned is Mobile )
{
Mobile mob = (Mobile)spawned;
waterMob = mob.CanSwim;
waterOnlyMob = ( mob.CanSwim && mob.CantWalk );
}
else
{
waterMob = false;
waterOnlyMob = false;
}
// Try 10 times to find a spawnable location.
for ( int i = 0; i < 10; ++i )
{
int x, y;
if ( m_HomeRange > 0 ) {
x = Location.X + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
y = Location.Y + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
} else {
if ( m_HomeRange > 0 )
{
x = Location.X + ( Utility.Random( ( m_HomeRange * 2 ) + 1 ) - m_HomeRange );
y = Location.Y + ( Utility.Random( ( m_HomeRange * 2 ) + 1 ) - m_HomeRange );
}
else
{
x = Location.X;
y = Location.Y;
}
int z = Map.GetAverageZ( x, y );
int mapZ = map.GetAverageZ( x, y );
if ( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) )
return new Point3D( x, y, this.Z );
else if ( Map.CanSpawnMobile( new Point2D( x, y ), z ) )
return new Point3D( x, y, z );
if ( waterMob )
{
if ( IsValidWater( map, x, y, this.Z ) )
return new Point3D( x, y, this.Z );
else if ( IsValidWater( map, x, y, mapZ ) )
return new Point3D( x, y, mapZ );
}
if ( !waterOnlyMob )
{
if ( map.CanSpawnMobile( x, y, this.Z ) )
return new Point3D( x, y, this.Z );
else if ( map.CanSpawnMobile( x, y, mapZ ) )
return new Point3D( x, y, mapZ );
}
}
return this.Location;
}
public static bool IsValidWater( Map map, int x, int y, int z )
{
if ( !Region.Find( new Point3D( x, y, z ), map ).AllowSpawn() || !map.CanFit( x, y, z, 16, false, true, false ) )
return false;
LandTile landTile = map.Tiles.GetLandTile( x, y );
if ( landTile.Z == z && ( TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Wet ) != 0 )
return true;
StaticTile[] staticTiles = map.Tiles.GetStaticTiles( x, y, true );
for ( int i = 0; i < staticTiles.Length; ++i )
{
StaticTile staticTile = staticTiles[i];
if ( staticTile.Z == z && ( TileData.ItemTable[staticTile.ID & TileData.MaxItemValue].Flags & TileFlag.Wet ) != 0 )
return true;
}
return false;
}
public void DoTimer()
{
if ( !m_Running )
@ -710,7 +767,7 @@ namespace Server.Mobiles
{
Defrag();
for ( int i = 0; i < m_Spawned.Count; ++i )
for ( int i = m_Spawned.Count - 1; i >= 0; --i )
{
IEntity e = m_Spawned[i];

View file

@ -18,13 +18,13 @@ namespace Server.Mobiles
AddBackground( 0, 0, 410, 371, 5054 );
AddLabel( 95, 1, 0, "Creatures List" );
AddLabel( 160, 1, 0, "Creatures List" );
AddButton( 5, 347, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0 );
AddLabel( 38, 347, 0x384, "Cancel" );
AddButton( 5, 325, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0 );
AddLabel( 38, 325, 0x384, "Okay" );
AddLabel( 38, 325, 0x384, "Apply" );
AddButton( 110, 325, 0xFB4, 0xFB6, 2, GumpButtonType.Reply, 0 );
AddLabel( 143, 325, 0x384, "Bring to Home" );
@ -87,28 +87,28 @@ namespace Server.Mobiles
public override void OnResponse( NetState state, RelayInfo info )
{
if ( m_Spawner.Deleted )
if ( m_Spawner.Deleted || state.Mobile.AccessLevel < AccessLevel.GameMaster )
return;
switch ( info.ButtonID )
{
case 0: // Closed
{
break;
return;
}
case 1: // Okay
case 1: // Apply
{
m_Spawner.SpawnNames = CreateArray( info, state.Mobile );
break;
}
case 2: // Bring everything home
case 2: // Bring to Home
{
m_Spawner.BringToHome();
break;
}
case 3: // Complete respawn
case 3: // Total Respawn
{
m_Spawner.Respawn();
@ -135,6 +135,8 @@ namespace Server.Mobiles
break;
}
}
state.Mobile.SendGump( new SpawnerGump( m_Spawner ) );
}
}
}

View file

@ -759,7 +759,7 @@ namespace Server.Gumps
AddButtonLabeled( 10, 410, GetButtonID( 5, 28 ), "Delete marked" );
AddButtonLabeled( 210, 390, GetButtonID( 5, 29 ), "Mark all" );
AddButtonLabeled( 210, 410, GetButtonID( 5, 33 ), "Unmark house owners" );
AddButtonLabeled( 210, 410, GetButtonID( 5, 35 ), "Unmark house owners" );
}
for ( int i = 0, index = (listPage * 12); i < 12 && index >= 0 && index < m_List.Count; ++i, ++index )
@ -983,7 +983,7 @@ namespace Server.Gumps
AddButtonLabeled( 227, 225, GetButtonID( 5, 16 ), "View all shared accounts" );
AddButtonLabeled( 227, 245, GetButtonID( 5, 17 ), "Ban all shared accounts" );
AddButtonLabeled( 227, 265, GetButtonID( 5, 18 ), "Firewall all addresses" );
AddButtonLabeled( 227, 285, GetButtonID( 5, 34 ), "Clear all addresses" );
AddButtonLabeled( 227, 285, GetButtonID( 5, 36 ), "Clear all addresses" );
AddHtml( 225, 315, 180, 80, Color( "List of IP addresses which have accessed this account.", LabelColor32 ), false, false );
@ -2301,7 +2301,7 @@ namespace Server.Gumps
break;
}
case 20:
case 20: // Change access level
case 21:
case 22:
case 23:
@ -2326,7 +2326,7 @@ namespace Server.Gumps
case 34: newLevel = AccessLevel.Owner; break;
}
if ( newLevel < from.AccessLevel )
if ( newLevel < from.AccessLevel || from.AccessLevel == AccessLevel.Owner )
{
a.AccessLevel = newLevel;
@ -2449,7 +2449,12 @@ namespace Server.Gumps
break;
}
case 33: // Unmark house owners
case 33: // Change access level (extended)
case 34:
{
goto case 20;
}
case 35: // Unmark house owners
{
ArrayList list = m_List;
ArrayList rads = m_State as ArrayList;
@ -2475,7 +2480,7 @@ namespace Server.Gumps
break;
}
case 34: // Clear login addresses
case 36: // Clear login addresses
{
Account a = m_State as Account;

View file

@ -2,6 +2,7 @@ using System;
using System.Net;
using Server;
using Server.Accounting;
using Server.Mobiles;
using Server.Network;
using Server.Targets;
using Server.Commands;
@ -38,7 +39,7 @@ namespace Server.Gumps
from.SendMessage( "That character no longer exists." );
return;
}
else if ( from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel )
else if ( from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel && ( !( focus is PlayerMobile ) || !((PlayerMobile)focus).VisibilityList.Contains( from ) ) )
{
from.SendMessage( "That character is no longer visible." );
return;

View file

@ -51,7 +51,7 @@ namespace Server.Mobiles
Item shroud = new Item( 0x204E );
shroud.Layer = Layer.OuterTorso;
shroud.Movable = false;
shroud.Hue = boots.Hue ^ 1;
shroud.Hue = Utility.Random( 2 );
AddItem( boots );
AddItem( shroud );