Fix pirate invasion
This commit is contained in:
parent
38a8bbc1d3
commit
92da91522b
1 changed files with 12 additions and 22 deletions
|
|
@ -3169,43 +3169,33 @@ namespace TShockAPI
|
||||||
|
|
||||||
private static bool HandleSpawnBoss(GetDataHandlerArgs args)
|
private static bool HandleSpawnBoss(GetDataHandlerArgs args)
|
||||||
{
|
{
|
||||||
var spawnboss = false;
|
|
||||||
var invasion = -1;
|
|
||||||
var plr = args.Data.ReadInt32();
|
var plr = args.Data.ReadInt32();
|
||||||
var Type = args.Data.ReadInt32();
|
var Type = args.Data.ReadInt32();
|
||||||
|
int invasion = -1 * Type;
|
||||||
NPC npc = new NPC();
|
NPC npc = new NPC();
|
||||||
npc.SetDefaults(Type);
|
npc.SetDefaults(Type);
|
||||||
spawnboss = npc.boss;
|
|
||||||
if (!spawnboss)
|
if (invasion <= 0 && !args.Player.Group.HasPermission(Permissions.summonboss))
|
||||||
{
|
|
||||||
switch (Type)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
invasion = 1;
|
|
||||||
break;
|
|
||||||
case -2:
|
|
||||||
invasion = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (spawnboss && !args.Player.Group.HasPermission(Permissions.summonboss))
|
|
||||||
{
|
{
|
||||||
args.Player.SendMessage("You don't have permission to summon a boss.", Color.Red);
|
args.Player.SendMessage("You don't have permission to summon a boss.", Color.Red);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (invasion != -1 && !args.Player.Group.HasPermission(Permissions.startinvasion))
|
if (invasion > 0 && !args.Player.Group.HasPermission(Permissions.startinvasion))
|
||||||
{
|
{
|
||||||
args.Player.SendMessage("You don't have permission to start an invasion.", Color.Red);
|
args.Player.SendMessage("You don't have permission to start an invasion.", Color.Red);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!spawnboss && invasion == -1)
|
if (!npc.boss || invasion > 3 || plr != args.Player.Index)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
if (plr != args.Player.Index)
|
}
|
||||||
return true;
|
|
||||||
|
|
||||||
string boss;
|
string boss;
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
|
case -3:
|
||||||
|
boss = "the pirates";
|
||||||
|
break;
|
||||||
case -2:
|
case -2:
|
||||||
boss = "the Snow Legion";
|
boss = "the Snow Legion";
|
||||||
break;
|
break;
|
||||||
|
|
@ -3217,7 +3207,7 @@ namespace TShockAPI
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TShock.Utils.SendLogs(string.Format("{0} summoned {1}", args.Player.Name, boss), Color.PaleVioletRed, args.Player);
|
TShock.Utils.SendLogs(string.Format("{0} summoned {1}.", args.Player.Name, boss), Color.PaleVioletRed, args.Player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue