-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathWayStones.cs
120 lines (106 loc) · 2.86 KB
/
WayStones.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using System;
using Server;
using Server.Engines.PartySystem;
using Server.Gumps;
using Server.Network;
namespace Server.Items
{
public class WayStone : Item
{
[Constructable]
public WayStone() : base( 0x023B )
{
Name = "Way Stone.";
}
public override void OnDoubleClick(Mobile from) {
if(from.AccessLevel > AccessLevel.Player || from.Backpack == this.Parent)
{
Party p = Party.Get(from);
if(p != null && p.Members.Count > 1)
{
for(int i = 0; i < p.Members.Count; i++)
{
Mobile m = ((PartyMemberInfo)p.Members[i]).Mobile;
if(m != from)
{
m.SendGump(new InternalGump(from));
object[] arg = new object[] {m};
Timer.DelayCall( TimeSpan.FromMinutes( 2.0 ), new TimerStateCallback( CloseInternalGump ), arg);
}
else
{
m.SendMessage("You open a request to join you at your location for each of your party members.");
}
}
this.Delete();
}
else
{
from.SendMessage("You can not use this while not in a party.");
}
}
else
{
from.SendMessage("That must be in your backpack to be used.");
}
}
public static void CloseInternalGump(object state)
{
object[] states = (object[])state;
Mobile m = (Mobile)states[0];
if(m.HasGump(typeof(InternalGump)))
m.CloseGump(typeof(InternalGump));
}
public WayStone( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
break;
}
}
}
}
public class InternalGump : Gump
{
private Mobile m_Summoner;
public InternalGump(Mobile from) : base( 0, 0 )
{
m_Summoner = from;
this.Closable=true;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
AddPage(0);
AddBackground(180, 57, 396, 100, 2600);
AddImage(264, 35, 1419);
AddImageTiled(338, 34, 86, 43, 2601);
AddLabel(338, 47, 0, "Way Stone");
AddLabel(278, 76, 0, String.Format("You Are Being Summond By {0}.", from.Name));
AddLabel(300, 90, 0, "Do You Want To Accept?");
AddButton(304, 113, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(385, 114, 243, 241, 0, GumpButtonType.Reply, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
if(info.ButtonID == 1)
{
from.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
from.MoveToWorld(m_Summoner.Location, m_Summoner.Map);
from.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
}
}
}
}