/
GMbody.cs
164 lines (136 loc) · 5.76 KB
/
GMbody.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
using System;
using System.Collections;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Commands
{
public class GMbody
{
public static void Initialize()
{
CommandSystem.Register("GMbody", AccessLevel.Counselor, new CommandEventHandler(GM_OnCommand));
}
[Usage("GMbody")]
[Description("Helps staff members get going.")]
public static void GM_OnCommand(CommandEventArgs e)
{
e.Mobile.Target = new GMmeTarget();
}
private class GMmeTarget : Target
{
private static Mobile m_Mobile;
public GMmeTarget()
: base(-1, false, TargetFlags.None)
{
}
protected override void OnTarget(Mobile from, object targeted)
{
if (targeted is Mobile)
{
Mobile targ = (Mobile)targeted;
if (from != targ)
from.SendMessage("You may only set your own body to GM style.");
else
{
m_Mobile = from;
CommandLogging.WriteLine(from, "{0} {1} is assuming a GM body", from.AccessLevel, CommandLogging.Format(from));
Container pack = from.Backpack;
ArrayList ItemsToDelete = new ArrayList();
foreach (Item item in from.Items)
{
if (item.Layer != Layer.Bank && item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Layer != Layer.Mount && item.Layer != Layer.Backpack)
{
ItemsToDelete.Add(item);
}
}
foreach (Item item in ItemsToDelete)
item.Delete();
if (pack == null)
{
pack = new Backpack();
pack.Movable = false;
from.AddItem(pack);
}
else
{
pack.Delete();
pack = new Backpack();
pack.Movable = false;
from.AddItem(pack);
}
from.Hunger = 20;
from.Thirst = 20;
from.Fame = 0;
from.Karma = 0;
from.Kills = 0;
from.Hidden = true;
from.Blessed = true;
from.Hits = from.HitsMax;
from.Mana = from.ManaMax;
from.Stam = from.StamMax;
if (from.IsStaff())
{
EquipItem(new StaffRing());
EquipItem(new StaffRobe());
PackItem(new GMHidingStone());
PackItem(new GMEthereal());
PackItem(new StaffOrb(from));
PackItem(new Spellbook((ulong)18446744073709551615));
PackItem(new NecromancerSpellbook((ulong)0xffff));
PackItem(new BookOfChivalry());
PackItem(new BookOfBushido());
PackItem(new SpellweavingBook((ulong)0xffff));
from.RawStr = 100;
from.RawDex = 100;
from.RawInt = 100;
from.Hits = from.HitsMax;
from.Mana = from.ManaMax;
from.Stam = from.StamMax;
for (int i = 0; i < targ.Skills.Length; ++i)
targ.Skills[i].Base = 120;
}
if (from.IsStaff() && from.AccessLevel <= AccessLevel.Spawner)
EquipItem(new FurBoots(3));
else if (from.AccessLevel == AccessLevel.GameMaster)
EquipItem(new FurBoots(39));
if (from.AccessLevel == AccessLevel.Seer)
EquipItem(new FurBoots(467));
if (from.AccessLevel == AccessLevel.Administrator)
EquipItem(new FurBoots(1001));
if (from.AccessLevel == AccessLevel.Developer)
EquipItem(new FurBoots(1001));
if (from.AccessLevel >= AccessLevel.CoOwner)
EquipItem(new FurBoots(1001));
}
}
}
private static void EquipItem(Item item)
{
EquipItem(item, false);
}
private static void EquipItem(Item item, bool mustEquip)
{
if (!Core.AOS)
item.LootType = LootType.Blessed;
if (m_Mobile != null && m_Mobile.EquipItem(item))
return;
Container pack = m_Mobile.Backpack;
if (!mustEquip && pack != null)
pack.DropItem(item);
else
item.Delete();
}
private static void PackItem(Item item)
{
if (!Core.AOS)
item.LootType = LootType.Blessed;
Container pack = m_Mobile.Backpack;
if (pack != null)
pack.DropItem(item);
else
item.Delete();
}
}
}
}