|
Newbie
Join Date: Jul 2007
Age: 28
Posts: 35
|
Server crash, help me~! Thanks~!
Crash log like this :
Quote:
Server Crash Report
===================
RunUO Version 2.0, Build 3080.42667
Operating System: Microsoft Windows NT 5.2.3790 Service Pack 2
.NET Framework: 2.0.50727.1433
Time: 2008-6-23 13:45:26
Mobiles: 10385
Items: 257349
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.CombineBox.CombineGump..ctor(CombineB ox cb)
at Server.Items.CombineBox.AddItemIDByTarget.OnTarget (Mobile from, Object targeted)
at Server.Targeting.Target.Invoke(Mobile from, Object targeted)
at Server.Network.PacketHandlers.TargetResponse(NetSt ate state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
Clients:
- Count: 1
+ 222.175.134.162: (account = admin) (mobile = 0x2 'Admin')
|
The script file like this :
Quote:
using System;
using Server.Gumps;
using Server.Network;
using Server.Targeting;
using Server.Mobiles;
using System.Collections;
namespace Server.Items
{
[Furniture]
[Flipable(0x2DF3, 0x2DF4)]
public class CombineBox : Item
{
public override int LabelNumber { get { return 1073403; } } // decorative box
private BaseWeapon m_FWeapon;
public BaseWeapon m_fweapon { get { return m_FWeapon; } set { m_FWeapon = value; InvalidateProperties(); } }
private BaseWeapon m_SWeapon;
public BaseWeapon m_sweapon { get { return m_SWeapon; } set { m_SWeapon = value; InvalidateProperties(); } }
//private Mobile m_Combiner;
//public Mobile m_combiner { get { return m_Combiner; } set { m_Combiner = value; InvalidateProperties(); } }
[Constructable]
public CombineBox() : base(0x2DF3)
{
Name = "a weapon combine box";
LootType = LootType.Blessed;
Weight = 10;
Hue = 1174;
Light = LightType.Circle300;
m_FWeapon = null;
m_SWeapon = null;
}
public override void OnDoubleClick( Mobile from )
{
if (from != null && from is PlayerMobile && IsChildOf(from.Backpack))
{
from.CloseGump(typeof(CombineGump));
from.SendGump(new CombineGump(this));
}
}
public CombineBox( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( ( int ) 0 ); // version
writer.Write( (BaseWeapon) m_FWeapon);
writer.Write( (BaseWeapon) m_SWeapon);
// writer.Write( (Mobile)m_Combiner);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_FWeapon = reader.ReadItem() as BaseWeapon;
m_SWeapon = reader.ReadItem() as BaseWeapon;
// m_Combiner = reader.ReadMobile();
}
public class CombineGump: Gump
{
CombineBox CBox;
public CombineGump( CombineBox cb ) : base( 200, 50 )
{
CBox = cb;
//int m_FWeaponID = CB.m_fweapon.ItemID;
//int m_SWeaponID = CB.m_sweapon.ItemID;
this.Closable = true;
this.Disposable = true;
this.Dragable = true;
this.Resizable = false;
this.AddPage( 0 );
this.AddBackground(0, 0, 350, 400, 9270);
this.AddBackground(10, 10, 330, 380, 83);
this.AddLabel(70, 20, 1153, @"晨风大陆原创合成系统-武器合成");
this.AddLabel(30, 40, 1152, @"================================================ ");
this.AddLabel(30, 220, 1152, @"*****************************");
this.AddLabel(30, 330, 1152, @"*****************************");
this.AddLabel(30, 240, 1126, @"物品一");
if ( CBox.m_fweapon != null )
{
this.AddLabel(120, 240, 1126, @"" + CBox.m_fweapon.Name.ToString());
this.AddItem(60, 250, +CBox.m_fweapon.ItemID);
}
this.AddLabel(30, 265, 1126, @"物品二");
if ( CBox.m_sweapon != null )
{
this.AddLabel(120, 265, 1126, @"" + CBox.m_sweapon.Name.ToString());
this.AddItem(240, 250, +CBox.m_sweapon.ItemID);
}
this.AddLabel(30, 305, 1126, @"合 成");
this.AddButton(90, 240, 4029, 4031, 1, GumpButtonType.Reply, 0);
this.AddButton(90, 265, 4029, 4031, 2, GumpButtonType.Reply, 0);
this.AddButton(90, 305, 4026, 4028, 3, GumpButtonType.Reply, 0);
this.AddButton(90, 305, 4026, 4028, 3, GumpButtonType.Reply, 0);
this.AddButton(25, 350, 4017, 4019, 0, GumpButtonType.Reply, 0);
this.AddLabel(60, 351, 64, @"Exit / Close");
/* this.AddHtml(30, 60, 290, 160, "<BODY>" +
// Administration Text...
"<BASEFONT COLOR=#00EEFF>" + // Heading Colour
"</BODY>", (bool)false, (bool)true);
*/
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
if ( info.ButtonID == 1 )
{
from.Target = new AddItemIDByTarget(CBox,1);
}
else if ( info.ButtonID == 2 )
{
from.Target = new AddItemIDByTarget(CBox,2);
}
else if (info.ButtonID == 3 || info.ButtonID == 0)
{
return;
}
}
}
public class AddItemIDByTarget : Target
{
private CombineBox CB;
private int ORDER;
public AddItemIDByTarget( CombineBox cb, int order ) : base( 4, false, TargetFlags.None )
{
CB = cb;
ORDER = order;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is BaseWeapon )
{
BaseWeapon it = (BaseWeapon)targeted;
if (ORDER == 1)
{
CB.m_fweapon = it;
it.Delete();
from.SendMessage("Add 1 weapon.");
}
else if (ORDER == 2)
{
CB.m_sweapon = it;
it.Delete();
from.SendMessage("Add 2 weapon.");
}
}
else from.SendMessage( "That is not a weapon." );
from.CloseGump( typeof( CombineGump) );
from.SendGump( new CombineGump( CB ) );
}
}
}
}
|
THe runuo core is rc2, when i point button 1 and click a weapon ,the message is show out : ("Add 1 weapon."); but when open gump ,the sever has crashed.
I can't find any problem in ths script ,but who can help me to solve the problem ,thanks very much.
Last edited by zillafan; 06-23-2008 at 03:08 AM.
|