Skip to content

Commit 0be59e9

Browse files
authored
Merge pull request Suprcode#137 from Suprcode/superman-command
SUPERMAN GM command
2 parents 0733cb8 + 4a94640 commit 0be59e9

File tree

3 files changed

+61
-5
lines changed

3 files changed

+61
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Library;
2+
using Server.Models;
3+
4+
namespace Server.Envir.Commands.Command.Admin
5+
{
6+
class ToggleSuperman : AbstractCommand<IAdminCommand>
7+
{
8+
public override string VALUE => "SUPERMAN";
9+
10+
public override void Action(PlayerObject player)
11+
{
12+
player.Superman = !player.Superman;
13+
player.Connection.ReceiveChat($"{VALUE} {(player.Superman ? "activated" : "deactivated")}", MessageType.System);
14+
}
15+
}
16+
}

Diff for: ServerLibrary/Models/MapObject.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ public virtual Cell GetDropLocation(int distance, PlayerObject player)
12231223
return bestCell;
12241224
}
12251225

1226-
public void SetHP(int amount)
1226+
public virtual void SetHP(int amount)
12271227
{
12281228
if (Dead) return;
12291229

@@ -1245,7 +1245,7 @@ public void SetHP(int amount)
12451245
Die();
12461246
}
12471247
}
1248-
public void ChangeHP(int amount)
1248+
public virtual void ChangeHP(int amount)
12491249
{
12501250
if (Dead) return;
12511251

@@ -1286,7 +1286,7 @@ public void ChangeHP(int amount)
12861286
}
12871287
}
12881288

1289-
public void SetMP(int amount)
1289+
public virtual void SetMP(int amount)
12901290
{
12911291
CurrentMP = Math.Min(amount, Stats[Stat.Mana]);
12921292
}
@@ -1296,7 +1296,7 @@ public void SetFP(int amount)
12961296
CurrentFP = Math.Min(amount, Stats[Stat.Focus]);
12971297
}
12981298

1299-
public void ChangeMP(int amount)
1299+
public virtual void ChangeMP(int amount)
13001300
{
13011301
if (CurrentMP + amount > Stats[Stat.Mana])
13021302
amount = Stats[Stat.Mana] - CurrentMP;

Diff for: ServerLibrary/Models/PlayerObject.cs

+41-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public override MirDirection Direction
110110
public DateTime ShoutTime, UseItemTime, TorchTime, CombatTime, PvPTime, SentCombatTime, AutoPotionTime, AutoPotionCheckTime, ItemTime, RevivalTime, TeleportTime, DailyQuestTime, FishingCastTime, MailTime, ExperienceTime;
111111
public bool PacketWaiting;
112112

113-
public bool GameMaster, Observer;
113+
public bool GameMaster, Observer, Superman;
114114

115115
public override bool Blocking => base.Blocking && !Observer;
116116

@@ -15370,6 +15370,46 @@ public void SendChangeUpdate()
1537015370
Broadcast(p);
1537115371
}
1537215372

15373+
public override void SetHP(int amount)
15374+
{
15375+
if (Superman)
15376+
{
15377+
CurrentHP = Stats[Stat.Health];
15378+
return;
15379+
}
15380+
base.SetHP(amount);
15381+
}
15382+
15383+
public override void ChangeHP(int amount)
15384+
{
15385+
if (Superman)
15386+
{
15387+
CurrentHP = Stats[Stat.Health];
15388+
return;
15389+
}
15390+
base.ChangeHP(amount);
15391+
}
15392+
15393+
public override void SetMP(int amount)
15394+
{
15395+
if (Superman)
15396+
{
15397+
CurrentMP = Stats[Stat.Mana];
15398+
return;
15399+
}
15400+
base.SetMP(amount);
15401+
}
15402+
15403+
public override void ChangeMP(int amount)
15404+
{
15405+
if (Superman)
15406+
{
15407+
CurrentMP = Stats[Stat.Mana];
15408+
return;
15409+
}
15410+
base.ChangeMP(amount);
15411+
}
15412+
1537315413
#region Instance / Dungeon Finder
1537415414

1537515415
public void JoinInstance(C.JoinInstance p)

0 commit comments

Comments
 (0)