Search in sources :

Example 1 with NotificationCreationEvent

use of de.gg.game.events.NotificationCreationEvent 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
            }
        }
    }
}
Also used : PositionType(de.gg.game.model.types.PositionType) Character(de.gg.game.model.entities.Character) Position(de.gg.game.model.entities.Position) NotificationData(de.gg.game.ui.data.NotificationData) NotificationCreationEvent(de.gg.game.events.NotificationCreationEvent)

Aggregations

NotificationCreationEvent (de.gg.game.events.NotificationCreationEvent)1 Character (de.gg.game.model.entities.Character)1 Position (de.gg.game.model.entities.Position)1 PositionType (de.gg.game.model.types.PositionType)1 NotificationData (de.gg.game.ui.data.NotificationData)1