[Release] Recieve presents on Christmas (From Santa)

Results 1 to 5 of 5
  1. #1
    Alpha Member Anujan is offline
    MemberRank
    May 2008 Join Date
    Ontario, CanadaLocation
    1,633Posts

    [Release] Recieve presents on Christmas (From Santa)

    MapleCharacter
    PHP Code:
    private boolean santaCame false;

    public 
    void giveGift() {
            if (
    santaCame)
                return;
            
    int[] giftsM = {}; //Fill with Male Gifts
            
    int[] giftsF = {}; //Fill with Female Gifts
            
    int r Randomizer.getInstance().nextInt(getGender() == giftsF.length giftsM.length);
            
    int gift getGender() == giftsF[r] : giftsM[r];
            if (!
    canHold(gift)) {
                
    dropMessage(1"Santa came to visit you but unfortunately you didn't have any space in your inventory for his gift. Make some space and change channels and Santa will return (:");
                return;
            }
            
    PreparedStatement ps null;
            try {
                
    Connection con DatabaseConnection.getConnection();
                
    ps con.prepareStatement("INSERT INTO santasSled VALUES (?, ? , ? ,?)");
                
    ps.setInt(1accountid);
                
    ps.setInt(2id);
                
    ps.setString(3name);
                
    ps.setInt(4gift);
                
    ps.executeUpdate();
                
    ps.close();
                
    MapleInventoryManipulator.addById(clientgift, (short1"Santa came to visit :D");
                
    dropMessage(1"HO HO HO~\r\n Santa came to visit you. \r\nYou check your presents to find a " getItemName(gift) + ".\r\nSeems like you've been a " + (gift == 2022278 "naughty" "nice") + (getGender() == " girl" " boy") + " this year.\r\n Have a Merry Christmas and Happy New Year (:");
            } catch (
    SQLException sex) {
                
    log.error("Santa caused an SQL Error! Table doesn't exist?"sex);
            } catch (
    Exception dafak) {
                
    log.error("Santa's been screwing around with some shit"dafak);
            } finally {
                try {
                    if (
    ps != null && !ps.isClosed()) {
                        
    ps.close();
                    }
                } catch (
    Exception fukinerrorshitpissingmeoff) {}
            }
            
    santaCame true//Incase.
        

    loadCharFromDB
    PHP Code:
    Date time Calendar.getInstance(TimeZone.getTimeZone("GMT-5")).getTime();
                if (
    time.getDate() == 25 && time.getMonth() == Calendar.DECEMBER) {
                    
    ps con.prepareStatement("SELECT * FROM santasSled WHERE accountid = ?");
                    
    ps.setInt(1ret.accountid);
                    
    rs ps.executeQuery();
                    
    ret.santaCame rs.first();
                    
    rs.close();
                    
    ps.close();
                } 
    PlayerLoggedInHandler
    PHP Code:
    Date cal Calendar.getInstance(TimeZone.getTimeZone("GMT-5")).getTime();
            if (
    cal.getDate() == 23 && cal.getMonth() == Calendar.DECEMBER) { //Deprecated but the other shit is returning some BS
                
    player.giveGift();
            } 
    SQL
    Code:
    DROP TABLE IF EXISTS `santassled`;
    CREATE TABLE `santassled` (
      `accountid` int(10) unsigned NOT NULL,
      `characterid` int(10) unsigned NOT NULL,
      `charname` varchar(13) NOT NULL,
      `itemid` int(10) unsigned NOT NULL,
      PRIMARY KEY (`accountid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


  2. #2
    Alpha Member Surface is offline
    MemberRank
    Jul 2009 Join Date
    New York CityLocation
    1,505Posts

    Re: [Release] Recieve presents on Christmas (From Santa)

    Interesting, sad that its 12/26 and Christmas is over.

  3. #3
    Alpha Member Anujan is offline
    MemberRank
    May 2008 Join Date
    Ontario, CanadaLocation
    1,633Posts

    Re: [Release] Recieve presents on Christmas (From Santa)

    Quote Originally Posted by Surface View Post
    Interesting, sad that its 12/26 and Christmas is over.
    That's basically why I released it. (Yeah, I'm selfish ^^)
    It can be modified for other events/holidays though

  4. #4
    Alpha Member Surface is offline
    MemberRank
    Jul 2009 Join Date
    New York CityLocation
    1,505Posts

    Re: [Release] Recieve presents on Christmas (From Santa)

    Quote Originally Posted by Anujan View Post
    That's basically why I released it. (Yeah, I'm selfish ^^)
    It can be modified for other events/holidays though

    Yeah, I noticed how the thread was made/released on 12:01 AM -_-...
    Yeah I'm EST too.

  5. #5
    Account Upgraded | Title Enabled! .:LastBreath:. is offline
    MemberRank
    Oct 2009 Join Date
    Under your bedLocation
    1,315Posts

    Re: [Release] Recieve presents on Christmas (From Santa)

    Ah, lol nice release tho :P



Advertisement