Examples of GameManager


Examples of com.threerings.parlor.game.server.GameManager

     */
    protected int createGame (final Table table)
        throws InvocationException
    {
        try {
            GameManager gmgr = createGameManager(createConfig(table));
            GameObject gobj = (GameObject)gmgr.getPlaceObject();
            gameCreated(table, gobj, gmgr);
            return gobj.getOid();

        } catch (Throwable t) {
            log.warning("Failed to create manager for game", "config", table.config, t);
View Full Code Here

Examples of managers.GameManager

*/
public class StocksFormatter {

    public static ArrayNode getStockList(Game currentGame) {
        ArrayNode stockListJson = Json.newObject().arrayNode();
        List<Stock> stockList = Stock.find.filter().eq("isEnabled", 1).filter((new GameManager()).getStockList());
        GameManager gm = new GameManager();
        for (Stock stk : stockList) {
            ObjectNode stock = Json.newObject();
            stock.put("id", stk.getId());
            stock.put("ticker", stk.getTicker());
            stock.put("company", stk.getCompanyName());
            if(currentGame != null && currentGame.getVirtualCurrentDate() != null){
                stock.put("price", gm.getStockPriceAmount(stk.getTicker(), currentGame.getVirtualCurrentDate()));
            }else{
                stock.put("price", 0);
            }
           
            stockListJson.add(stock);
View Full Code Here

Examples of managers.GameManager

        Timestamp currentGameDate = TimeKeeper.round_to_day(game.getVirtualCurrentDate());
        StockPrice currentStockPrice;
        try {
            //get current stock price
            currentStockPrice = (new GameManager()).getStockPrice(ticker, currentGameDate);
            if (currentStockPrice == null) {
                return false;
            }
        } catch (IOException ex) {
            play.Logger.warn("could not retrieve stock Price\n", ex);
View Full Code Here

Examples of managers.GameManager

            return false;
        }

        StockPrice currentStockPrice;
        try {
            currentStockPrice = (new GameManager()).getStockPrice(ticker, game.getVirtualCurrentDate());
            if (currentStockPrice == null) {
                return false;
            }
        } catch (IOException ex) {
            play.Logger.warn("Could not sell stock... ", ex);
View Full Code Here

Examples of managers.GameManager

    public double getNetWorth() {
        double totalPortfolio = 0;
        // calculates portfolio value
        Timestamp referenceDate = game.isEnded() ? TimeKeeper.getLastTradingDay(game)
                : game.getVirtualCurrentDate();
        GameManager gm = new GameManager();
        for (PortfolioStock portfolioStock : portfolios) {
            int quantity = portfolioStock.getQuantity();

            StockPrice stockPrice;
            double stockPriceAmount = 0;
            try {
                stockPrice = gm.getStockPrice(portfolioStock.getStock().getTicker(), referenceDate);
                stockPriceAmount = game.isEnded()
                        ? stockPrice.getClose()
                        : stockPrice.getStockPrice();
            } catch (IOException ex) {
                play.Logger.warn("Could not get stock price: ", ex);
View Full Code Here

Examples of managers.GameManager

        return gmState;
    }

    protected ArrayNode getPortfolio() {
        ArrayNode stocks = Json.newObject().arrayNode();
        GameManager gm = new GameManager();
        for (PortfolioStock portfoilioStock : gameState.getCurrentPlayer().getPortfolios()) {
            ObjectNode stockNode = Json.newObject();
            stockNode.put("id", portfoilioStock.getId());
            String ticker = portfoilioStock.getStock().getTicker();
            stockNode.put("ticker", ticker);
            stockNode.put("company", portfoilioStock.getStock().getCompanyName());
            stockNode.put("quantity", portfoilioStock.getQuantity());
            StockPrice currentStockPrice = null;
            try {
                currentStockPrice = gm.getStockPrice(ticker, gameState.getGame().getVirtualCurrentDate());
            } catch (IOException ex) {
                play.Logger.warn("error occured while retrieving price", ex);
            }
            stockNode.put("currentPrice", currentStockPrice != null ? currentStockPrice.getStockPrice() : 0);
            //stockNode.put("purchasePrice", purchasePrice);
View Full Code Here

Examples of managers.GameManager

        return playerNode;
    }

    public static ObjectNode getGameStateJson(Integer gameId) {
        try {
            GameState gs = (new GameManager()).getGameState(gameId);
            if (gs == null) {
                return null;
            }
            GameStateJSONFormatter gsj = new GameStateJSONFormatter(gs);
            return gsj.getJSON();
View Full Code Here

Examples of managers.GameManager

    public static Result index() {
        return ok(application_index.render(Form.form(LoginForm.class), Form.form(RegisterForm.class), null));
    }

    public static Result dashboard() {
        GameManager gm = new GameManager();
        return ok(application_dashboard.render(gm.getListOfAvailableGames(),Form.form(GameForm.class)));
    }
View Full Code Here

Examples of managers.GameManager

        }

        if (Ebean.find(Stock.class).findRowCount() == 0) {

          GameManager gameManager = new GameManager();
          if (Stock.findAll().isEmpty()) // Insert player first
          {
            List<Object> stocks = all.get("stocks");
            for (Object stockObj : stocks) {
              Stock stock = (Stock) stockObj;
              gameManager.addStock(stock.getTicker(),
                  stock.getCompanyName(),ApplicationConstants.TRUE);
            }

          }
        }
View Full Code Here

Examples of managers.GameManager

import models.data.User;

public class ManagementController extends Controller {

    public static Result index() {
        GameManager gm = new GameManager();
        User user = UserManager.getCurrentLoggedInUser();
        if (user != null && user.isAdmin()) {
            return ok(management.render(gm.getStockList(), "", "stockTab"));
        } else {
            return ok("You don't have acess to Admin DashBoard!");
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.