UO-Dev Arama


Yazar: Bilinmiyor
Tarih: 18-08-2009 12:57


Paylaş : Paylaş

Kod:
using System;
using System.Collections;
using Server.Items;
using Server.Mobiles;
using Server.Gumps;
using Server.Network;

namespace Server.Items
{
public class CustomMoongate : Item
{
private AccessLevel m_AccessLevel = (AccessLevel)3;//4 = Admin, 3 = Seer, 2 = Gm etc

private ArrayList m_Destinations = new ArrayList();
private ArrayList m_DestX = new ArrayList();
private ArrayList m_DestY = new ArrayList();
private ArrayList m_DestZ = new ArrayList();
private ArrayList m_DestMaps = new ArrayList();

[Constructable]
public CustomMoongate() : base( 3948 )//moongate
{
Movable = false;
Light = LightType.Circle225;
}

public CustomMoongate( Serial serial ) : base( serial )
{
}

public override bool OnMoveOver( Mobile m )
{
if ( m_Destinations.Count > 0 )
{
m.SendGump( new CustomMoongateGump( m, this,false ));
}
else
{
m.SendMessage("The moongate doesn't appear to go anywhere...");
if ( m.AccessLevel >= m_AccessLevel )
m.SendMessage("Double-Click this to configure it");
}
return true;
}

public override void OnDoubleClick( Mobile from )
{
if ( from.AccessLevel >= m_AccessLevel )
from.SendGump(new CustomMoongateGump(from, this,true));
else
{
if ( m_Destinations.Count > 0 )
{
if ( Utility.InRange( this.Location, from.Location, 1 ) )
from.SendGump( new CustomMoongateGump( from, this, false ));
else
from.SendMessage("That is too far away");
}
else
from.SendMessage("The moongate doesn't appear to go anywhere...");
}
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version

writer.Write( (int)m_Destinations.Count );
for ( int i = 0; i < m_Destinations.Count; ++i )
{
writer.Write( (string)m_Destinations );
writer.Write( (int)m_DestX );
writer.Write( (int)m_DestY );
writer.Write( (int)m_DestZ );
writer.Write( (int)m_DestMaps );
}
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
switch ( version )
{
case 0:
{
int count = reader.ReadInt();
for ( int i = 0; i < count; ++i )
{
m_Destinations.Add( reader.ReadString() );
m_DestX.Add( reader.ReadInt() );
m_DestY.Add( reader.ReadInt() );
m_DestZ.Add( reader.ReadInt() );
m_DestMaps.Add( reader.ReadInt() );
}
break;
}
}
}

private class CustomMoongateGump : Gump
{
private CustomMoongate m_Gate;
private bool EditMode;
public void AddTextField( int x, int y, int width, int height, int index )
{
AddBackground( x - 2, y - 2, width + 4, height + 4, 0x2486 );
AddTextEntry( x + 2, y + 2, width - 4, height - 4, 0, index, "" );
}

public CustomMoongateGump( Mobile from, CustomMoongate gate, bool editmode ) : base( 100,50 )
{
EditMode = editmode;
from.CloseGump( typeof( CustomMoongateGump ) );
PlayerMobile pm = from as PlayerMobile;
m_Gate = gate;
int width = 248;
if ( EditMode == true )
width = 435;
else
Effects.PlaySound( from.Location, from.Map, 0x20E );
int height = 224;
if ( m_Gate.m_Destinations.Count > 3 )
height = ((m_Gate.m_Destinations.Count*32)+95);//350;//Varies for no. Entries
AddBackground( 0, 0, width, height, 2600 );
if ( EditMode == true )
AddLabel( (width/2)-128, 16, 33, "Nokta Ekleme Modu" );
else
AddLabel( (width/2)-80, 16, 33, "Gideceğiniz yeri seçin" );
AddPage( 1 );

if ( EditMode == true )
{
AddButton( 128, 48, 4029, 4031, 11, GumpButtonType.Reply, 0 );// Add Destination
AddLabel(160, 48, 33, "Yeni Gidilecek Noktayı Ekle" );
AddTextField( 128, 96, 150, 20, 1 );
AddLabel(128, 72, 33, "Mapin Adı" );
AddTextField( 128, 144, 150, 20, 0 );
AddLabel(128, 120, 33, "Noktanın Adı" );
AddTextField( 148, 168, 80, 20, 2 );
AddLabel(128, 168, 33, "X" );
AddTextField( 248, 168, 80, 20, 3 );
AddLabel(228, 168, 33, "Y" );
AddTextField( 348, 168, 60, 20, 4 );
AddLabel(328, 168, 33, "Z" );
}

for ( int i = 0; i < m_Gate.m_Destinations.Count; ++i )
{
AddLabel( 48, (32*i)+40, 33, (string)m_Gate.m_Destinations );
if ( EditMode == true )
AddButton( 16, (32*i)+40, 4017, 4019, i+12, GumpButtonType.Reply, 0 );//Del Destination
else
AddButton( 16, (32*i)+40, 4005, 4007, i+1, GumpButtonType.Reply, 0 );//Teleport
}

AddPage( 0 );
}

public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
string name = "";
Point3D dest = new Point3D( 0, 0, 0 );
string map = "";
int m_Map = 0;
int x = 0;
int y = 0;
int z = 0;

foreach( TextRelay tr in info.TextEntries )
{
switch ( tr.EntryID )
{
case 0: //Name
{
if ( tr.Text != null )
{
if ( tr.Text != "" )
{
name = tr.Text;
}
}
break;
}
case 1://Map
{
if ( tr.Text != null )
{
if ( tr.Text != "" )
{
map = tr.Text;
}
}
break;
}
case 2://X
{
if ( tr.Text != null )
{
if ( tr.Text != "" )
{
x = int.Parse(tr.Text);
}
}
break;
}
case 3://Y
{
if ( tr.Text != null )
{
if ( tr.Text != "" )
{
y = int.Parse(tr.Text);
}
}
break;
}
case 4://Z
{
if ( tr.Text != null )
{
if ( tr.Text != "" )
{
z = int.Parse(tr.Text);//Convert to Int
}
}
break;
}
}
}

if ( info.ButtonID == 0 )
{
}
else if ( info.ButtonID >= 1 && info.ButtonID <= 10 )
{//Go
if ( Utility.InRange( m_Gate.Location, from.Location, 2 ) )
{
dest = new Point3D(((int)m_Gate.m_DestX[info.ButtonID-1]), ((int)m_Gate.m_DestY[info.ButtonID-1]), ((int)m_Gate.m_DestZ[info.ButtonID-1]) );
m_Map = (int)m_Gate.m_DestMaps[info.ButtonID-1];

Map mp = Map.Internal;
if ( dest == Point3D.Zero )
dest = from.Location;

if ( m_Map == 0 )
mp = Map.Felucca;
else if ( m_Map == 1 )
mp = Map.Trammel;
else if ( m_Map == 2 )
mp = Map.Ilshenar;
else if ( m_Map == 3 )
mp = Map.Malas;

if ( m_Map == 0 )
{
from.Location = dest;
}
else
{//Swap comments inside brackets if beta36
//from.Location = dest;
//from.Map = (Map)mp;
from.MoveToWorld( dest, (Map)mp );
}

Effects.PlaySound( from.Location, from.Map, 0x1FE );
}
else
from.SendMessage("You are too far away");
}
else if ( info.ButtonID == 11 )
{//ADD
if ( m_Gate.m_Destinations.Count <= 14 )//Change to max. entries, more than about 15 will be offscreen to some players
{
if ( ( ( x != 0 ) || ( y != 0 ) ) && ( name != "" ) )
{
if ( map == "felucca" || map == "Felucca" )
m_Gate.m_DestMaps.Add( 0 );
else if ( map == "trammel" || map == "Trammel" )
m_Gate.m_DestMaps.Add( 1 );
else if ( map == "ilshenar" || map == "Ilshenar" )
m_Gate.m_DestMaps.Add( 2 );
else if ( map == "malas" || map == "Malas" )
m_Gate.m_DestMaps.Add( 3 );
else
{
if ( m_Gate.Map == Map.Felucca )
m_Gate.m_DestMaps.Add( 0 );
else if ( m_Gate.Map == Map.Trammel )
m_Gate.m_DestMaps.Add( 1 );
else if ( m_Gate.Map == Map.Ilshenar )
m_Gate.m_DestMaps.Add( 2 );
else if ( m_Gate.Map == Map.Malas )
m_Gate.m_DestMaps.Add( 3 );
}
m_Gate.m_DestX.Add( x );
m_Gate.m_DestY.Add( y );
m_Gate.m_DestZ.Add( z );
m_Gate.m_Destinations.Add( name );
from.SendMessage("Nokta Eklendi");
}
else
from.SendMessage("Lütfen (x,y,z'leri) veya Map adı , Nokta adı yazıp tekrar deneyin!!!");
}
else
from.SendMessage("Birşey ekleyemezsiniz.Çünkü gate doldu!");
from.SendGump( new CustomMoongateGump( from, m_Gate,true ));
}
else if ( info.ButtonID >= 12 && info.ButtonID <= 21 )
{//DEL
m_Gate.m_DestMaps.RemoveAt( info.ButtonID-12 );
m_Gate.m_DestX.RemoveAt( info.ButtonID-12 );
m_Gate.m_DestY.RemoveAt( info.ButtonID-12 );
m_Gate.m_DestZ.RemoveAt( info.ButtonID-12 );
m_Gate.m_Destinations.RemoveAt( info.ButtonID-12 );
from.SendMessage("Nokta silindi");
from.SendGump( new CustomMoongateGump( from, m_Gate,true ));
}
}
}
}
}



Yorumlar

Henüz yorum yapılmamıştır.

Oylamalar

Oylama :
Üyelerin oylama ortalaması (10 dışında) : Henüz Oylanmamış   
Oylar: 0

Benzer Sayfalar

SayfalarYorumlarGönderenTarih
Moongate v6 (Power Play)0xwerswoodx22-01-2012
Moongate0yalova04-09-2010
Moongate Sistemi0aldarson27-06-2010
Moongate System0TheRaskol05-11-2009
Moongate0aldarson18-10-2009


Keywords:

ultima online, RunUO, ultima online download, sphere scripting, role play, uo grafik, second age ultima, uo loop, macroman, pvp server, server kurulumu, sphere, multool, ml mulls, 56b 55r 55i, htmlgumps, client 4x, client edit, sphere release, osi, rp server, sunucular, ghost mouse, inside uo, kingdom reborn, stygian abyss, uo nasıl oynanır, mondain's legacy, age of shadows, world build, grandmaster, ultima online pvp, player dosyaları, ultima online indir, frp game, RunUO 1.0.0, razor, uo rice, hue editör, skill tools, ultima online patch, axis, world build, verdata, verdata patcher, map editör, gump editör, mul patcher, aos mulls, scriptler, anim edit, anim publish, hues mul, hosting vps, event dialog, account sistemi, skill gain, static yapımı,