Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions Challenger/Challenger/Challenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Challenger : TerrariaPlugin

public override string Name => "Challenger";

public override Version Version => new Version(1, 0, 1, 1);
public override Version Version => new Version(1, 0, 1, 2);

public Challenger(Main game)
: base(game)
Expand Down Expand Up @@ -1408,27 +1408,38 @@ private void OnServerLeave(LeaveEventArgs args)
{
return;
}

try
{
if (Collect.cplayers[args.Who] != null)
var playerData = Collect.cplayers[args.Who];
if (playerData != null)
{
if (Collect.cplayers[args.Who].ExtraLife > 0)
if (playerData.ExtraLife > 0)
{
Player obj = Main.player[args.Who];
obj.statLifeMax -= Collect.cplayers[args.Who].ExtraLife;
NetMessage.SendData(16, -1, -1, NetworkText.Empty, args.Who, 0f, 0f, 0f, 0, 0, 0);
var player = Main.player[args.Who];
if (player != null)
{
player.statLifeMax -= playerData.ExtraLife;
NetMessage.SendData(16, -1, -1, NetworkText.Empty, args.Who, 0f, 0f, 0f, 0, 0, 0);
}
}
if (Collect.cplayers[args.Who].ExtraMana > 0)

if (playerData.ExtraMana > 0)
{
Player obj2 = Main.player[args.Who];
obj2.statManaMax -= Collect.cplayers[args.Who].ExtraMana;
NetMessage.SendData(42, -1, -1, NetworkText.Empty, args.Who, 0f, 0f, 0f, 0, 0, 0);
var player2 = Main.player[args.Who];
if (player2 != null)
{
player2.statManaMax -= playerData.ExtraMana;
NetMessage.SendData(42, -1, -1, NetworkText.Empty, args.Who, 0f, 0f, 0f, 0, 0, 0);
}
}

for (int i = 0; i < 1000; i++)
{
if (Collect.cprojs[i] != null && Collect.cprojs[i].isActive)
var proj = Collect.cprojs[i];
if (proj != null && proj.isActive)
{
Collect.cprojs[i].CKill();
proj.CKill();
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions Challenger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@

```
更新日志
1.1.2
修复玩家退出服务器时空引用

1.1.1
给【皇家凝胶】加了随机生成概率与间隔

Expand Down