Bots log in at the town of their level and leave for the spot in waves (gear and buffs first); party distribution type never null (sweeper NPE)
This commit is contained in:
+23
-3
@@ -48,6 +48,7 @@ import org.l2jmobius.gameserver.entity.actor.enums.player.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.entity.actor.instance.Monster;
|
||||
import org.l2jmobius.gameserver.entity.clan.Clan;
|
||||
import org.l2jmobius.gameserver.entity.groups.Party;
|
||||
import org.l2jmobius.gameserver.entity.groups.PartyDistributionType;
|
||||
import org.l2jmobius.gameserver.entity.item.enums.ItemProcessType;
|
||||
import org.l2jmobius.gameserver.entity.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.managers.FakePlayerChatManager.Understanding;
|
||||
@@ -170,6 +171,7 @@ public class FakePlayerHeadlessManager
|
||||
return null;
|
||||
}
|
||||
player.setHeadlessBot(true);
|
||||
player.setPartyDistributionType(org.l2jmobius.gameserver.entity.groups.PartyDistributionType.FINDERS_KEEPERS); // Never null: bots open parties themselves.
|
||||
|
||||
// Identity from the seeded population: personality, race, home zone.
|
||||
final FakePlayerBotState state = new FakePlayerBotState();
|
||||
@@ -233,12 +235,30 @@ public class FakePlayerHeadlessManager
|
||||
}
|
||||
}
|
||||
state.spot = spot;
|
||||
state.combat.nextLeashCheck = System.currentTimeMillis() + 240000; // The leash must not drag the bot out of town early.
|
||||
player.getStatus().setCurrentHp(player.getMaxHp());
|
||||
player.getStatus().setCurrentMp(player.getMaxMp());
|
||||
player.getStatus().setCurrentCp(player.getMaxCp());
|
||||
player.spawnMe(spot.getX() + Rnd.get(-400, 400), spot.getY() + Rnd.get(-400, 400), spot.getZ());
|
||||
// Like a login: appear in the town of the level, gear up and buff there, then leave for the spot.
|
||||
Location start = spot;
|
||||
final Object[] town = FakePlayerProgressionManager.getInstance().pickTownSpot(player.getLevel(), state.race);
|
||||
if (town != null)
|
||||
{
|
||||
start = (Location) town[0];
|
||||
}
|
||||
player.spawnMe(start.getX() + Rnd.get(-150, 150), start.getY() + Rnd.get(-150, 150), start.getZ());
|
||||
player.setRunning();
|
||||
_bots.add(player);
|
||||
state.action("logged in");
|
||||
final Location destination = spot;
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
if (!player.isDead() && (stateOf(player) != null) && (stateOf(player).siegeSide == 0) && (stateOf(player).raidBossId == 0) && !player.isInStoreMode())
|
||||
{
|
||||
teleport(player, destination.getX() + Rnd.get(-300, 300), destination.getY() + Rnd.get(-300, 300), destination.getZ());
|
||||
state.action("to spot");
|
||||
}
|
||||
}, 6000 + Rnd.get(_bots.size() * 150, 20000 + (_bots.size() * 250)));
|
||||
return player;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -409,7 +429,7 @@ public class FakePlayerHeadlessManager
|
||||
}
|
||||
else
|
||||
{
|
||||
requestor.setParty(new Party(requestor, requestor.getPartyDistributionType()));
|
||||
requestor.setParty(new Party(requestor, (requestor.getPartyDistributionType() != null) ? requestor.getPartyDistributionType() : org.l2jmobius.gameserver.entity.groups.PartyDistributionType.FINDERS_KEEPERS));
|
||||
target.joinParty(requestor.getParty());
|
||||
}
|
||||
target.setActiveRequester(null);
|
||||
@@ -1564,7 +1584,7 @@ public class FakePlayerHeadlessManager
|
||||
teleport(bot, target.getLocation());
|
||||
if (target.getParty() == null)
|
||||
{
|
||||
final Party party = new Party(target, target.getPartyDistributionType());
|
||||
final Party party = new Party(target, (target.getPartyDistributionType() != null) ? target.getPartyDistributionType() : org.l2jmobius.gameserver.entity.groups.PartyDistributionType.FINDERS_KEEPERS);
|
||||
target.setParty(party);
|
||||
bot.joinParty(party);
|
||||
}
|
||||
|
||||
+2
-1
@@ -34,6 +34,7 @@ import org.l2jmobius.gameserver.entity.actor.Npc;
|
||||
import org.l2jmobius.gameserver.entity.actor.Player;
|
||||
import org.l2jmobius.gameserver.entity.actor.instance.RaidBoss;
|
||||
import org.l2jmobius.gameserver.entity.groups.Party;
|
||||
import org.l2jmobius.gameserver.entity.groups.PartyDistributionType;
|
||||
|
||||
/**
|
||||
* Raid boss hunts by headless bots: every 30-90 minutes a real party of 5-9
|
||||
@@ -151,7 +152,7 @@ public class FakePlayerRaidManager
|
||||
}
|
||||
}
|
||||
final Player leader = party.get(0);
|
||||
final Party group = new Party(leader, leader.getPartyDistributionType());
|
||||
final Party group = new Party(leader, PartyDistributionType.FINDERS_KEEPERS);
|
||||
leader.setParty(group);
|
||||
int index = 0;
|
||||
for (Player bot : party)
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ public class FakePlayerSocial
|
||||
}
|
||||
else
|
||||
{
|
||||
squad = new Party(bot, bot.getPartyDistributionType());
|
||||
squad = new Party(bot, PartyDistributionType.FINDERS_KEEPERS);
|
||||
bot.setParty(squad);
|
||||
mate.joinParty(squad);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user