Examples of Auction


Examples of models.Auction

    PrintWriter p = response.getWriter();

    if(servletPath.equals("/admin/auctions/save")) {
      if(session.getAttribute("admin") != null && session.getAttribute("admin").equals("true")) {

                            Auction auction = new Auction();

        MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");

                                auction.setProduct(multi.getParameter("newProduct"));
       
                                auction.setCatId(new Integer(multi.getParameter("newCat")));

                                File f = multi.getFile("newImage");

                                String fileName = multi.getFilesystemName("newImage");

        auction.setPhoto(fileName);
       
                                auction.setStartingPrice(new Float (multi.getParameter("newStartingPrice")));
        auction.setLastPrice(new Float (multi.getParameter("newStartingPrice")));
                                auction.setMinPrice( new Float (multi.getParameter("newMinPrice")));

                                Integer duration,i = new Integer(multi.getParameter("newDuration"));
                                if(i == 1) duration = 4;
                                else if(i == 2) duration = 6;
                                else duration = 10;

                                Calendar cal = Calendar.getInstance();
                                cal.add(Calendar.DAY_OF_YEAR, duration );
                                Long e = (cal.getTimeInMillis());
                                java.sql.Date expire = new java.sql.Date(e);
                                auction.setExpire(expire);
                               
                                auction.setShipping(multi.getParameter("newShip"));
                               
                                auction.setUserId(new Integer(multi.getParameter("newCat")));
                                auction.setLastPrice(null);
                                auction.setLastUserId(null);
                                auction.setDescription(multi.getParameter("newDesc"));
                               
                                auction.save();
      }
          }
        else if(servletPath.equals("/admin/auctions/update")) {
      if(session.getAttribute("admin") != null && session.getAttribute("admin").equals("true")) {

                            Auction auction = new Auction();

        MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");
                                auction.setId(new Integer(multi.getParameter("editId")));
                                auction.setProduct(multi.getParameter("editProduct"));
       
                                auction.setCatId(new Integer(multi.getParameter("editCat")));

                                String fileName = multi.getFilesystemName("editImage");

        File f = null;

        if(fileName == null || fileName.equals("")) {
          fileName = multi.getParameter("oldImage");
        }
        else {
          f = multi.getFile("editImage");
        }

        auction.setPhoto(fileName);
        //auction.setStartingPrice(new Float (multi.getParameter("editStartingPrice")));
                                //auction.setMinPrice( new Float (multi.getParameter("editMinPrice")));
                                auction.setShipping(multi.getParameter("editShip"));
                                auction.setUserId(new Integer(multi.getParameter("editCat")));
                                auction.setDescription(multi.getParameter("editDesc"));
                                auction.update();
      }
          }

                response.sendRedirect(request.getContextPath() + "/admin/auctions");
View Full Code Here

Examples of models.Auction

             if(servletPath.equals("/auctions/show")) {

            page += "_show";

            String[] tokens = request.getRequestURI().split("/");
            Auction auction = Auction.getById(new Integer(tokens[tokens.length - 1]));

    request.setAttribute("auction", auction);
            
         }
            if(servletPath.equals("/auctions/new")) {
View Full Code Here

Examples of models.Auction

        if(servletPath.equals("/auctions/bid")) {

            User u = (User) session.getAttribute("user");
            String bid = request.getParameter("bid");
            Integer id = new Integer(request.getParameter("id"));
            Auction a = Auction.getById(id);
            a.setLastPrice(new Float(bid));
            a.setLastUserId(u.getId());
            a.update();

            response.sendRedirect(request.getContextPath());
       
        }
        else if(servletPath.equals("/auctions/save"))
        {
     
                            User u = (User) session.getAttribute("user");
                            Auction auction = new Auction();

        MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");

                                auction.setProduct(multi.getParameter("newProduct"));

                                auction.setCatId(new Integer(multi.getParameter("newCat")));

                                File f = multi.getFile("newImage");

                                String fileName = multi.getFilesystemName("newImage");

        auction.setPhoto(fileName);

                                auction.setStartingPrice(new Float (multi.getParameter("newStartingPrice")));
        auction.setLastPrice(new Float (multi.getParameter("newStartingPrice")));
                                auction.setMinPrice( new Float (multi.getParameter("newMinPrice")));

                                Integer duration,i = new Integer(multi.getParameter("newDuration"));
                                if(i == 1) duration = 4;
                                else if(i == 2) duration = 6;
                                else duration = 10;

                                Calendar cal = Calendar.getInstance();
                                cal.add(Calendar.DAY_OF_YEAR, duration );
                                Long e = (cal.getTimeInMillis());
                                java.sql.Date expire = new java.sql.Date(e);
                                auction.setExpire(expire);

                                auction.setShipping(multi.getParameter("newShip"));

                                auction.setUserId(u.getId());
                                auction.setLastPrice(null);
                                auction.setLastUserId(null);
                                auction.setDescription(multi.getParameter("newDesc"));

                                auction.save();
                                response.sendRedirect(request.getContextPath());
          }
}
View Full Code Here

Examples of net.sf.l2j.gameserver.model.entity.Auction

                    {
                      SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm");
                        int bid = 0;
                        if (st.countTokens() >= 1) bid = Integer.parseInt(st.nextToken());

                        Auction a = new Auction(player.getClan().getHasHideout(), player.getClan(), days*86400000L, bid, ClanHallManager.getInstance().getClanHallByOwner(player.getClan()).getName());
                        if (_pendingAuctions.get(a.getId()) != null)
                            _pendingAuctions.remove(a.getId());

                        _pendingAuctions.put(a.getId(), a);

                        String filename = "data/html/auction/AgitSale3.htm";
                        NpcHtmlMessage html = new NpcHtmlMessage(1);
                        html.setFile(filename);
                        html.replace("%x%", val);
                        html.replace("%AGIT_AUCTION_END%", String.valueOf(format.format(a.getEndDate())));
                        html.replace("%AGIT_AUCTION_MINBID%", String.valueOf(a.getStartingBid()));
                        html.replace("%AGIT_AUCTION_MIN%", String.valueOf(a.getStartingBid()));
                        html.replace("%AGIT_AUCTION_DESC%", ClanHallManager.getInstance().getClanHallByOwner(player.getClan()).getDesc());
                      html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_sale2");
                        html.replace("%objectId%", String.valueOf((getObjectId())));
                        player.sendPacket(html);
                    }
                    catch (Exception e)
                    {
                        player.sendMessage("Invalid bid!");
                    }
                }
                catch (Exception e)
                {
                    player.sendMessage("Invalid auction duration!");
                }
                return;
            }
            if (actualCommand.equalsIgnoreCase("confirmAuction"))
            {
                try
                {
                    Auction a = _pendingAuctions.get(player.getClan().getHasHideout());
                    a.confirmAuction();
                    _pendingAuctions.remove(player.getClan().getHasHideout());
                }
                catch (Exception e)
                {
                    player.sendMessage("Invalid auction");
                }
                return;
            }
            else if (actualCommand.equalsIgnoreCase("bidding"))
            {
                if (val == "") return;
                if(Config.DEBUG) player.sendMessage("bidding show successful");

                try
                {
                  SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm");
                    int auctionId = Integer.parseInt(val);
                    if(Config.DEBUG) player.sendMessage("auction test started");
                    String filename = "data/html/auction/AgitAuctionInfo.htm";
                    Auction a = AuctionManager.getInstance().getAuction(auctionId);

                    NpcHtmlMessage html = new NpcHtmlMessage(1);
                    html.setFile(filename);
                    if(a != null){
                      html.replace("%AGIT_NAME%", a.getItemName());
                      html.replace("%OWNER_PLEDGE_NAME%", a.getSellerClanName());
                      html.replace("%OWNER_PLEDGE_MASTER%", a.getSellerName());
                      html.replace("%AGIT_SIZE%", "30 ");
                      html.replace("%AGIT_LEASE%", String.valueOf(ClanHallManager.getInstance().getClanHallById(a.getItemId()).getLease()));
                      html.replace("%AGIT_LOCATION%", ClanHallManager.getInstance().getClanHallById(a.getItemId()).getLocation());
                      html.replace("%AGIT_AUCTION_END%", String.valueOf(format.format(a.getEndDate())));
                      html.replace("%AGIT_AUCTION_REMAIN%", String.valueOf((a.getEndDate()- System.currentTimeMillis())/3600000)+" hours "+String.valueOf((((a.getEndDate() - System.currentTimeMillis()) / 60000) % 60))+" minutes");
                      html.replace("%AGIT_AUCTION_MINBID%", String.valueOf(a.getStartingBid()));
                      html.replace("%AGIT_AUCTION_COUNT%", String.valueOf(a.getBidders().size()));
                      html.replace("%AGIT_AUCTION_DESC%", ClanHallManager.getInstance().getClanHallById(a.getItemId()).getDesc());
                      html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_list");
                      html.replace("%AGIT_LINK_BIDLIST%", "bypass -h npc_"+getObjectId()+"_bidlist "+a.getId());
                      html.replace("%AGIT_LINK_RE%", "bypass -h npc_"+getObjectId()+"_bid1 "+a.getId());
                    }else{
                      _log.warning("Auctioneer Auction null for AuctionId : "+auctionId);
                    }
                  player.sendPacket(html);
                }
                catch (Exception e)
                {
                    player.sendMessage("Invalid auction!");
                }

                return;
            }
            else if (actualCommand.equalsIgnoreCase("bid"))
            {
                if (val == "") return;

                try
                {
                    int auctionId = Integer.parseInt(val);
                    try
                    {
                        int bid = 0;
                        if (st.countTokens() >= 1) bid = Integer.parseInt(st.nextToken());

                        AuctionManager.getInstance().getAuction(auctionId).setBid(player, bid);
                    }
                    catch (Exception e)
                    {
                        player.sendMessage("Invalid bid!");
                    }
                }
                catch (Exception e)
                {
                    player.sendMessage("Invalid auction!");
                }

                return;
            }
            else if (actualCommand.equalsIgnoreCase("bid1"))
            {
                if (player.getClan() == null || player.getClan().getLevel() < 2)
                {
                    player.sendMessage("Your clan's level needs to be at least 2, before you can bid in an auction");
                    return;
                }

                if (val == "") return;
                if ((player.getClan().getAuctionBiddedAt() > 0 && player.getClan().getAuctionBiddedAt() != Integer.parseInt(val)) || player.getClan().getHasHideout() > 0)
                {
                    player.sendMessage("You can't bid at more than one auction");
                    return;
                }

                try
                {
                    String filename = "data/html/auction/AgitBid1.htm";

                    int minimumBid = AuctionManager.getInstance().getAuction(Integer.parseInt(val)).getHighestBidderMaxBid();
                    if (minimumBid == 0) minimumBid = AuctionManager.getInstance().getAuction(Integer.parseInt(val)).getStartingBid();

                    NpcHtmlMessage html = new NpcHtmlMessage(1);
                    html.setFile(filename);
                    html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_bidding "+val);
                    html.replace("%PLEDGE_ADENA%", String.valueOf(player.getClan().getWarehouse().getAdena()));
                    html.replace("%AGIT_AUCTION_MINBID%", String.valueOf(minimumBid));
                    html.replace("npc_%objectId%_bid", "npc_"+getObjectId()+"_bid "+val);
                    player.sendPacket(html);
                    return;
                }
                catch (Exception e)
                {
                    player.sendMessage("Invalid auction!");
                }
                return;
            }
            else if (actualCommand.equalsIgnoreCase("list"))
            {
                List<Auction> auctions =AuctionManager.getInstance().getAuctions();
              SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
                /** Limit for make new page, prevent client crash **/
                int limit = 15;
                int start;
              int i = 1;
              double npage = Math.ceil((float)auctions.size()/limit);
              if (val == ""){
                start = 1;
              }else{
                start = limit*(Integer.parseInt(val)-1)+1;
                limit *= Integer.parseInt(val);
              }
              if (Config.DEBUG) player.sendMessage("cmd list: auction test started");
                String items = "";
              items+= "<table width=280 border=0><tr>";
                for(int j=1;j<=npage;j++)
                      items+= "<td><center><a action=\"bypass -h npc_"+getObjectId()+"_list "+j+"\"> Page "+j+" </a></center></td>";
                items+= "</tr></table>" +
                    "<table width=280 border=0>";
                for(Auction a:auctions)
                {
                  if(i > limit) break;
                  else if(i < start){
                    i++;
                    continue;
                  }else i++;
                    items+="<tr>" +
                              "<td>"+ClanHallManager.getInstance().getClanHallById(a.getItemId()).getLocation()+"</td>" +
                              "<td><a action=\"bypass -h npc_"+getObjectId()+"_bidding "+a.getId()+"\">"+a.getItemName()+"</a></td>" +
                              "<td>"+format.format(a.getEndDate())+"</td>" +
                              "<td>"+a.getStartingBid()+"</td>" +
                            "</tr>";

                }
                items+= "</table>";
                String filename = "data/html/auction/AgitAuctionList.htm";

                NpcHtmlMessage html = new NpcHtmlMessage(1);
                html.setFile(filename);
                html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_start");
                html.replace("%itemsField%", items);
                player.sendPacket(html);
                return;
            }
            else if (actualCommand.equalsIgnoreCase("bidlist"))
            {
                int auctionId = 0;
                if (val == "")
                {
                    if (player.getClan().getAuctionBiddedAt() <= 0)
                        return;
          auctionId = player.getClan().getAuctionBiddedAt();
                }
                else
                    auctionId = Integer.parseInt(val);
                if (Config.DEBUG) player.sendMessage("cmd bidlist: auction test started");
                String biders = "";
                Map<Integer, Bidder> bidders = AuctionManager.getInstance().getAuction(auctionId).getBidders();
                for(Bidder b :bidders.values())
                {
                    biders+="<tr>" +
                            "<td>"+b.getClanName()+"</td><td>"+b.getName()+"</td><td>"+b.getTimeBid().get(Calendar.YEAR)+"/"+(b.getTimeBid().get(Calendar.MONTH)+1)+"/"+b.getTimeBid().get(Calendar.DATE)+"</td><td>"+b.getBid()+"</td>" +
                            "</tr>";
                }
                String filename = "data/html/auction/AgitBidderList.htm";

                NpcHtmlMessage html = new NpcHtmlMessage(1);
                html.setFile(filename);
                html.replace("%AGIT_LIST%", biders);
                html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_selectedItems");
                html.replace("%x%", val);
                html.replace("%objectId%", String.valueOf(getObjectId()));
                player.sendPacket(html);
                return;
            }
            else if (actualCommand.equalsIgnoreCase("selectedItems"))
            {
                if (player.getClan() != null && player.getClan().getHasHideout() == 0 && player.getClan().getAuctionBiddedAt() > 0)
                {
                  SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm");
                    String filename = "data/html/auction/AgitBidInfo.htm";
                    NpcHtmlMessage html = new NpcHtmlMessage(1);
                    html.setFile(filename);
                    Auction a = AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt());
                    if(a != null){
                    html.replace("%AGIT_NAME%", a.getItemName());
                    html.replace("%OWNER_PLEDGE_NAME%", a.getSellerClanName());
                    html.replace("%OWNER_PLEDGE_MASTER%", a.getSellerName());
                    html.replace("%AGIT_SIZE%", "30 ");
                    html.replace("%AGIT_LEASE%", String.valueOf(ClanHallManager.getInstance().getClanHallById(a.getItemId()).getLease()));
                    html.replace("%AGIT_LOCATION%", ClanHallManager.getInstance().getClanHallById(a.getItemId()).getLocation());
                    html.replace("%AGIT_AUCTION_END%", String.valueOf(format.format(a.getEndDate())));
                    html.replace("%AGIT_AUCTION_REMAIN%", String.valueOf((a.getEndDate()-System.currentTimeMillis()) / 3600000)+" hours "+String.valueOf((((a.getEndDate()-System.currentTimeMillis()) / 60000) % 60))+" minutes");
                    html.replace("%AGIT_AUCTION_MINBID%", String.valueOf(a.getStartingBid()));
                    html.replace("%AGIT_AUCTION_MYBID%", String.valueOf(a.getBidders().get(player.getClanId()).getBid()));
                    html.replace("%AGIT_AUCTION_DESC%", ClanHallManager.getInstance().getClanHallById(a.getItemId()).getDesc());
                    html.replace("%objectId%", String.valueOf(getObjectId()));
                    html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_start");
                    }else{
                      _log.warning("Auctioneer Auction null for AuctionBiddedAt : "+player.getClan().getAuctionBiddedAt());
                    }
                player.sendPacket(html);
                    return;
                }
                else if (player.getClan() != null && AuctionManager.getInstance().getAuction(player.getClan().getHasHideout()) != null)
                {
                  SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm");
                    String filename = "data/html/auction/AgitSaleInfo.htm";
                    NpcHtmlMessage html = new NpcHtmlMessage(1);
                    html.setFile(filename);
                    Auction a = AuctionManager.getInstance().getAuction(player.getClan().getHasHideout());
                    if(a != null){
                      html.replace("%AGIT_NAME%", a.getItemName());
                      html.replace("%AGIT_OWNER_PLEDGE_NAME%", a.getSellerClanName());
                      html.replace("%OWNER_PLEDGE_MASTER%", a.getSellerName());
                      html.replace("%AGIT_SIZE%", "30 ");
                      html.replace("%AGIT_LEASE%", String.valueOf(ClanHallManager.getInstance().getClanHallById(a.getItemId()).getLease()));
                      html.replace("%AGIT_LOCATION%", ClanHallManager.getInstance().getClanHallById(a.getItemId()).getLocation());
                      html.replace("%AGIT_AUCTION_END%", String.valueOf(format.format(a.getEndDate())));
                      html.replace("%AGIT_AUCTION_REMAIN%", String.valueOf((a.getEndDate()-System.currentTimeMillis()) / 3600000)+" hours "+String.valueOf((((a.getEndDate()-System.currentTimeMillis()) / 60000) % 60))+" minutes");
                      html.replace("%AGIT_AUCTION_MINBID%", String.valueOf(a.getStartingBid()));
                      html.replace("%AGIT_AUCTION_BIDCOUNT%", String.valueOf(a.getBidders().size()));
                      html.replace("%AGIT_AUCTION_DESC%", ClanHallManager.getInstance().getClanHallById(a.getItemId()).getDesc());
                      html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_start");
                      html.replace("%id%", String.valueOf(a.getId()));
                      html.replace("%objectId%", String.valueOf(getObjectId()));
                    }else{
                      _log.warning("Auctioneer Auction null for getHasHideout : "+player.getClan().getHasHideout());
                    }
                  player.sendPacket(html);
                    return;
                }
                else if(player.getClan() != null && player.getClan().getHasHideout() != 0)
                {
                    int ItemId = player.getClan().getHasHideout();
                    String filename = "data/html/auction/AgitInfo.htm";
                    NpcHtmlMessage html = new NpcHtmlMessage(1);
                    html.setFile(filename);
                    if(ClanHallManager.getInstance().getClanHallById(ItemId) != null){
                      html.replace("%AGIT_NAME%", ClanHallManager.getInstance().getClanHallById(ItemId).getName());
                      html.replace("%AGIT_OWNER_PLEDGE_NAME%", player.getClan().getName());
                      html.replace("%OWNER_PLEDGE_MASTER%", player.getClan().getLeaderName());
                      html.replace("%AGIT_SIZE%", "30 ");
                      html.replace("%AGIT_LEASE%", String.valueOf(ClanHallManager.getInstance().getClanHallById(ItemId).getLease()));
                      html.replace("%AGIT_LOCATION%", ClanHallManager.getInstance().getClanHallById(ItemId).getLocation());
                      html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_start");
                      html.replace("%objectId%", String.valueOf(getObjectId()));
                    }else
                      _log.warning("Clan Hall ID NULL : "+ItemId+" Can be caused by concurent write in ClanHallManager");
                  player.sendPacket(html);
                    return;
                }
            }
            else if (actualCommand.equalsIgnoreCase("cancelBid"))
            {
                int bid = AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()).getBidders().get(player.getClanId()).getBid();
                String filename = "data/html/auction/AgitBidCancel.htm";
                NpcHtmlMessage html = new NpcHtmlMessage(1);
                html.setFile(filename);
                html.replace("%AGIT_BID%", String.valueOf(bid));
                html.replace("%AGIT_BID_REMAIN%", String.valueOf((int)(bid*0.9)));
                html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_selectedItems");
                html.replace("%objectId%", String.valueOf(getObjectId()));
                player.sendPacket(html);
                return;
            }
            else if (actualCommand.equalsIgnoreCase("doCancelBid"))
            {
                if (AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()) != null)
                {
                    AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()).cancelBid(player.getClanId());
                    player.sendMessage("You have succesfully canceled your bidding at the auction");
                }
                return;
            }
            else if (actualCommand.equalsIgnoreCase("cancelAuction"))
            {
                if (!((player.getClanPrivileges() & L2Clan.CP_CH_AUCTION) == L2Clan.CP_CH_AUCTION))
                {
                    player.sendMessage("You don't have the right privilleges to do this");
                    return;
                }
                String filename = "data/html/auction/AgitSaleCancel.htm";
                NpcHtmlMessage html = new NpcHtmlMessage(1);
                html.setFile(filename);
                html.replace("%AGIT_DEPOSIT%", String.valueOf(ClanHallManager.getInstance().getClanHallByOwner(player.getClan()).getLease()));
                html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_selectedItems");
                html.replace("%objectId%", String.valueOf(getObjectId()));
                player.sendPacket(html);
                return;
            }
            else if (actualCommand.equalsIgnoreCase("doCancelAuction"))
            {
                if (AuctionManager.getInstance().getAuction(player.getClan().getHasHideout()) != null)
                {
                    AuctionManager.getInstance().getAuction(player.getClan().getHasHideout()).cancelAuction();
                    player.sendMessage("Your auction has been canceled");
                }
                return;
            }
            else if (actualCommand.equalsIgnoreCase("sale2"))
            {
                String filename = "data/html/auction/AgitSale2.htm";
                NpcHtmlMessage html = new NpcHtmlMessage(1);
                html.setFile(filename);
                html.replace("%AGIT_LAST_PRICE%", String.valueOf(ClanHallManager.getInstance().getClanHallByOwner(player.getClan()).getLease()));
                html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_sale");
                html.replace("%objectId%", String.valueOf(getObjectId()));
                player.sendPacket(html);
                return;
            }
            else if (actualCommand.equalsIgnoreCase("sale"))
            {
                if (!((player.getClanPrivileges() & L2Clan.CP_CH_AUCTION) == L2Clan.CP_CH_AUCTION))
                {
                    player.sendMessage("You don't have the right privilleges to do this");
                    return;
                }
                String filename = "data/html/auction/AgitSale1.htm";
                NpcHtmlMessage html = new NpcHtmlMessage(1);
                html.setFile(filename);
                html.replace("%AGIT_DEPOSIT%", String.valueOf(ClanHallManager.getInstance().getClanHallByOwner(player.getClan()).getLease()));
                html.replace("%AGIT_PLEDGE_ADENA%", String.valueOf(player.getClan().getWarehouse().getAdena()));
                html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_selectedItems");
                html.replace("%objectId%", String.valueOf(getObjectId()));
                player.sendPacket(html);
                return;
            }
            else if (actualCommand.equalsIgnoreCase("rebid"))
            {
              SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm");
                if (!((player.getClanPrivileges() & L2Clan.CP_CH_AUCTION) == L2Clan.CP_CH_AUCTION))
                {
                    player.sendMessage("You don't have the right privileges to do this");
                    return;
                }
                try
                {
                String filename = "data/html/auction/AgitBid2.htm";
                NpcHtmlMessage html = new NpcHtmlMessage(1);
                html.setFile(filename);
                Auction a = AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt());
                if(a != null){
                  html.replace("%AGIT_AUCTION_BID%", String.valueOf(a.getBidders().get(player.getClanId()).getBid()));
                  html.replace("%AGIT_AUCTION_MINBID%", String.valueOf(a.getStartingBid()));
                  html.replace("%AGIT_AUCTION_END%",String.valueOf(format.format(a.getEndDate())));
                  html.replace("%AGIT_LINK_BACK%", "bypass -h npc_"+getObjectId()+"_selectedItems");
                  html.replace("npc_%objectId%_bid1", "npc_"+getObjectId()+"_bid1 "+a.getId());
                }else{
                  _log.warning("Auctioneer Auction null for AuctionBiddedAt : "+player.getClan().getAuctionBiddedAt());
                }
              player.sendPacket(html);
                }
View Full Code Here

Examples of net.sf.l2j.gameserver.model.entity.Auction

            ResultSet rs;
            con = L2DatabaseFactory.getInstance().getConnection();
            statement = con.prepareStatement("SELECT id FROM auction ORDER BY id");
            rs = statement.executeQuery();
            while (rs.next())
              _auctions.add(new Auction(rs.getInt("id")));
            statement.close();
            System.out.println("Loaded: " + getAuctions().size() + " auction(s)");
        }
        catch (Exception e)
        {
View Full Code Here

Examples of net.sf.l2j.gameserver.model.entity.Auction

        return null;
    }

    public final int getAuctionIndex(int auctionId)
    {
        Auction auction;
        for (int i = 0; i < getAuctions().size(); i++)
        {
          auction = getAuctions().get(i);
            if (auction != null && auction.getId() == auctionId)
              return i;
        }
        return -1;
    }
View Full Code Here

Examples of net.sf.l2j.gameserver.model.entity.Auction

            con = L2DatabaseFactory.getInstance().getConnection();
            PreparedStatement statement;
            statement = con.prepareStatement("INSERT INTO `auction` VALUES "+ITEM_INIT_DATA[i]);
            statement.execute();
            statement.close();
            _auctions.add(new Auction(id));
        }
        catch (Exception e)
        {
           _log.log(Level.SEVERE, "Exception: Auction.initNPC(): " + e.getMessage(),e);
        }
View Full Code Here

Examples of org.jboss.seam.example.seambay.Auction

         }
        
         @Override
         protected void renderResponse()
         {
            Auction auction = (Auction) getValue("#{auctionAction.auction}");
            assert auction != null;
         }
      }.run();
           
      new FacesRequest("/sell.xhtml", cid)
      {
         @Override
         protected void updateModelValues() throws Exception
         {
            setValue("#{auctionAction.auction.title}", "A Widget");
         }
      }.run();
     
     
      new FacesRequest("/sell2.xhtml", cid)
      {
         @Override
         protected void updateModelValues() throws Exception
         {
            List<Category> categories = (List<Category>) getValue("#{allCategories}");
           
            setValue("#{auctionAction.auction.category}", categories.get(0));
         }
      }.run();     
     
      new FacesRequest("/sell3.xhtml", cid)
      {
         @Override
         protected void updateModelValues() throws Exception
         {
            setValue("#{auctionAction.duration}", 3);
            setValue("#{auctionAction.auction.startingPrice}", 100.0);
         }
        
      }.run();
     
      new FacesRequest("/sell5.xhtml", cid)
      {
         @Override
         protected void updateModelValues() throws Exception
         {
            setValue("#{auctionAction.auction.description}", "foo");
         }        
      }.run();     
     
      new FacesRequest("/preview.xhtml", cid)
      {
         @Override
         protected void invokeApplication() throws Exception
         {
            Auction auction = (Auction) getValue("#{auctionAction.auction}");
            invokeAction("#{auctionAction.confirm}");
            assert auction.getStatus() == Auction.STATUS_LIVE;
         }        
      }.run();
     
      new FacesRequest()
      {
View Full Code Here

Examples of org.jboss.seam.example.seambay.Auction

            setValue("#{auctionAction.auction.title}", "BidTestZZZ");
            setValue("#{auctionAction.auction.startingPrice}", 1);        
            setValue("#{auctionAction.auction.description}", "bar");
            setValue("#{auctionAction.categoryId}", 1001);
           
            Auction auction = (Auction) getValue("#{auctionAction.auction}");

            assert auction.getStatus() == Auction.STATUS_UNLISTED;
           
            invokeAction("#{auctionAction.confirm}");
           
            assert auction.getStatus() == Auction.STATUS_LIVE;           
            assert auction.getHighBid() == null;
         }
      }.run();     
     
      new FacesRequest()
      {
         @Override
         protected void updateModelValues() throws Exception
         {
            setValue("#{auctionSearch.searchTerm}", "BidTestZZZ");
         }
        
         @Override
         protected void invokeApplication() throws Exception
         {
            assert invokeAction("#{auctionSearch.queryAuctions}") == null;
         }
        
         @Override
         protected void renderResponse() throws Exception
         {
            DataModel auctions = (DataModel) Contexts.getSessionContext().get("auctions");
            assert auctions.getRowCount() == 1;
            Auction auction = ((Auction) auctions.getRowData());
            assert auction.getTitle().equals("BidTestZZZ");
            assert auction.getHighBid() == null;
         }
        
      }.run();
        
      new FacesRequest()
      {
         @Override
         protected void invokeApplication() throws Exception
         {
            Contexts.getEventContext().set("auction", getValue("#{auctionSearch.auctions[0]}"));
           
            assert invokeAction("#{bidAction.placeBid}") == null;
            assert getValue("#{bidAction.outcome}").equals("required");
            Contexts.getEventContext().set("bidAmount", "5.00");
           
            assert invokeAction("#{bidAction.placeBid}") == null;
            assert getValue("#{bidAction.outcome}").equals("confirm");
           
            assert invokeAction("#{bidAction.confirmBid}").equals("success");
         }
      }.run();
     
      new FacesRequest()
      {
         @Override
         protected void invokeApplication() throws Exception
         {
            assert invokeAction("#{auctionSearch.queryAuctions}") == null;
         }
        
         protected void renderResponse() throws Exception
         {
            DataModel auctions = (DataModel) Contexts.getSessionContext().get("auctions");
            Auction auction = ((Auction) auctions.getRowData());
            assert auction.getHighBid() != null;
         }
      }.run();
     
     
   }
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.