use of de.gg.game.model.entities.Position in project ProjektGG by eskalon.
the class ServersideActionHandler method onAppliedForPosition.
@Override
public boolean onAppliedForPosition(PositionType t, short clientId) {
Position pos = world.getPositions().get(t);
if (pos.getCurrentHolder() == (short) -1 && pos.getApplicants().size() < 4) {
pos.getApplicants().add(world.getPlayer(clientId).getCurrentlyPlayedCharacterId());
clientResultListeners.onAppliedForPosition(clientId, t);
return true;
}
return false;
}
use of de.gg.game.model.entities.Position in project ProjektGG by eskalon.
the class FirstEventWaveClientSystem method process.
@Override
public void process(short id, Player p) {
if (id == localPlayerId) {
Character c = p.getCurrentlyPlayedCharacter(world);
// Inform about open positions
for (Entry<PositionType, Position> e : world.getPositions().entrySet()) {
if (!e.getValue().isHeld()) {
if (e.getKey().getLevel() - 1 <= c.getHighestPositionLevel()) {
if (e.getKey().getStatusRequirement() == null || e.getKey().getStatusRequirement().getLevel() <= c.getStatus().getLevel()) {
NotificationData not = new NotificationData(Lang.get("notification.pos_available.title"), Lang.get("notification.pos_available.text", e.getKey()), null);
eventBus.post(new NotificationCreationEvent(not));
}
}
}
}
if (c.getStatus() == SocialStatus.NON_CITIZEN) {
if (p.getFortune(world) >= SocialStatus.NON_CITIZEN.getFortuneRequirement()) {
// TODO inform about possibility to buy citizen status
}
}
}
}
use of de.gg.game.model.entities.Position in project ProjektGG by eskalon.
the class WorldGenerator method generateCharacters.
private void generateCharacters() {
// Add characters that have a position
for (PositionType posType : PositionType.values()) {
world.characters.put(world.characterIndex, CharacterFactory.createCharacterForPosition(random, posType));
world.positions.put(posType, new Position(world.characterIndex));
world.characterIndex++;
}
// Add the other characters
for (short i = (short) (29 + players.size()); i <= 100; i++) {
world.characters.put(world.characterIndex, CharacterFactory.createRandomCharacter(random));
world.characterIndex++;
}
}
use of de.gg.game.model.entities.Position in project ProjektGG by eskalon.
the class WorldGenerator method generate.
public void generate() {
generateBuildings();
generatePlayers();
generateCharacters();
// Player Vote Test
world.getCharacter((short) 1).setPosition(PositionType.COUNCILMAN_1);
world.positions.put(PositionType.COUNCILMAN_1, new Position((short) 1));
}
Aggregations