-
Notifications
You must be signed in to change notification settings - Fork 524
/
IceWyrm.cs
130 lines (106 loc) · 3.8 KB
/
IceWyrm.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
121
122
123
124
125
126
127
128
129
130
using System;
using Server.Items;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Server.Engines.Quests;
namespace Server.Mobiles
{
[CorpseName("an ice wyrm corpse")]
public class IceWyrm : WhiteWyrm
{
private static readonly ArrayList m_Instances = new ArrayList();
public static ArrayList Instances { get { return m_Instances; } }
[Constructable]
public IceWyrm()
: base()
{
m_Instances.Add(this);
this.Name = "Ice Wyrm";
this.Hue = 2729;
this.Body = 180;
Timer SelfDeleteTimer = new InternalSelfDeleteTimer(this);
SelfDeleteTimer.Start();
Tamable = false;
}
public static IceWyrm Spawn(Point3D platLoc, Map platMap)
{
if (m_Instances.Count > 0)
return null;
IceWyrm creature = new IceWyrm();
creature.Home = platLoc;
creature.RangeHome = 4;
creature.MoveToWorld(platLoc, platMap);
return creature;
}
public class InternalSelfDeleteTimer : Timer
{
private IceWyrm Mare;
public InternalSelfDeleteTimer(Mobile p) : base(TimeSpan.FromMinutes(60))
{
Priority = TimerPriority.FiveSeconds;
Mare = ((IceWyrm)p);
}
protected override void OnTick()
{
if (Mare.Map != Map.Internal)
{
Mare.Delete();
this.Stop();
}
}
}
public override void OnDeath(Container c)
{
List<DamageStore> rights = GetLootingRights();
foreach (Mobile m in rights.Select(x => x.m_Mobile).Distinct())
{
if (m is PlayerMobile)
{
PlayerMobile pm = m as PlayerMobile;
if (pm.ExploringTheDeepQuest == ExploringTheDeepQuestChain.CusteauPerron)
{
Item item = new IceWyrmScale();
if (m.Backpack == null || !m.Backpack.TryDropItem(m, item, false))
{
m.BankBox.DropItem(item);
}
m.SendLocalizedMessage(1154489); // You received a Quest Item!
}
}
}
base.OnDeath(c);
}
public override bool ReacquireOnMovement { get { return true; } }
public override int TreasureMapLevel { get { return 4; } }
public override int Meat { get { return 20; } }
public override int Hides { get { return 25; } }
public override HideType HideType { get { return HideType.Barbed; } }
public override FoodType FavoriteFood { get { return FoodType.Meat | FoodType.Gold; } }
public override bool CanAngerOnTame { get { return true; } }
public override bool CanRummageCorpses { get { return true; } }
public override void OnAfterDelete()
{
m_Instances.Remove(this);
base.OnAfterDelete();
}
public IceWyrm(Serial serial) : base(serial)
{
m_Instances.Add(this);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Timer SelfDeleteTimer = new InternalSelfDeleteTimer(this);
SelfDeleteTimer.Start();
if (Tamable)
Tamable = false;
}
}
}