Snowlight Coins & GiveBadge Command

Results 1 to 17 of 17
  1. #1
    Valued Member BetterWay is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    146Posts

    Snowlight Coins & GiveBadge Command

    Hi, I'm not really good at C# yet, but I'll release it just for others.

    Search for:
    Code:
    case "update_catalog":
    Put BOFORE this command:
    Code:
                    case "givebadge":
                        {
                            if (!Session.HasRight("hotel_admin"))
                            {
                                return false;
                            }
                            string Username = UserInputFilter.FilterString(Bits[1].Trim());
                            Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));
                            if (TargetSession == null)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a valid user."));
                                return false;
                            }
    
                            if (Bits[2].Trim() == "")
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a badge ID"));
                            }
                            using (SqlDatabaseClient MysqlClient = SqlDatabaseManager.GetClient())
                            {
                                DataRow row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                MysqlClient.ExecuteScalar("INSERT INTO badges (user_id, badge_id, source_type) VALUES('" + CharacterResolverCache.GetUidFromName(Username) + "', '" + row["id"] + "', 'static')");
                            }
                            TargetSession.SendData(RoomUserBadgesComposer.Compose(TargetSession.CharacterId, TargetSession.BadgeCache.EquippedBadges));
                            TargetSession.SendData(UserAlertModernComposer.Compose("Badges", "You just got a new badge, relog for showing off with it!"));
                            return true;
                        }
    And after this:
    Code:
                    case "coins":
                        {
                            if (!Session.HasRight("hotel_admin"))
                            {
                                return false;
                            }
    
                            string Username = UserInputFilter.FilterString(Bits[1].Trim());
                            Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));
                            int coins = -1;
                            string trimmer = Bits[2];
                            if (!int.TryParse(MergeInputs(Bits, 2), out coins))
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Credits", "Not an int value"));
                                return false;
                            }
                            if (coins <= 0)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Credits", "Not an int value"));
                                return false;
                            }
                            if (coins >= 1000000)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Credits", "Please fill an normal value."));
                                return false;
                            }
                            int oldcoins = TargetSession.CharacterInfo.CreditsBalance;
                            TargetSession.CharacterInfo.CreditsBalance = oldcoins + coins;
                            TargetSession.SendData(CreditsBalanceComposer.Compose(oldcoins+coins));
                            using (SqlDatabaseClient MysqlClient = SqlDatabaseManager.GetClient())
                            {
                                int newcoins = oldcoins + coins;
                                MysqlClient.ExecuteQuerySet("UPDATE characters SET credits_balance = '" + newcoins + "' WHERE id = '" + CharacterResolverCache.GetUidFromName(Username) + "' LIMIT 1");
                            }
                            TargetSession.SendData(UserAlertModernComposer.Compose("Credit","Your credit balance is updated, check it!"));
                            return true;
                        }
    I hope you guys like it :)

    Regards,
    BetterWay

    EDIT:
    For the GiveBadge command, you NEED to add all badge codes (likes JKR/SG4 etc.) into your database table badge_definitions..


  2. #2
    PHP & C# Developer Stevehabbz is offline
    MemberRank
    Nov 2011 Join Date
    244Posts

    Re: Snowlight Coins & GiveBadge Command

    Are this for uber?

  3. #3
    Valued Member BetterWay is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    146Posts

    Re: Snowlight Coins & GiveBadge Command

    Like the title says, SnowLight Emulator.
    So no it isn't for Uber, sorry.

    Fix for Givebadge command (U dont need to add badge_definitions now):

    Code:
                    case "givebadge":
                        {
                            if (!Session.HasRight("hotel_admin"))
                            {
                                return false;
                            }
                            string Username = UserInputFilter.FilterString(Bits[1].Trim());
                            Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));
                            if (TargetSession == null)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a valid user."));
                                return false;
                            }
    
                            if (Bits[2].Trim() == "")
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a badge ID"));
                            }
                            using (SqlDatabaseClient MysqlClient = SqlDatabaseManager.GetClient())
                            {
                                DataRow row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");;
                                if (row == null)
                                {
                                    MysqlClient.ExecuteScalar("INSERT INTO badge_definitions (code) VALUES('" + Bits[2].Trim() + "')");
                                    row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                }
                                else
                                {
                                    row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                }
                                MysqlClient.ExecuteScalar("INSERT INTO badges (user_id, badge_id, source_type) VALUES('" + CharacterResolverCache.GetUidFromName(Username) + "', '" + row["id"] + "', 'static')");
                            }
                            TargetSession.SendData(RoomUserBadgesComposer.Compose(TargetSession.CharacterId, TargetSession.BadgeCache.EquippedBadges));
                            TargetSession.SendData(UserAlertModernComposer.Compose("Badges", "You just got a new badge, relog for showing off with it!"));
                            return true;
                        }

  4. #4
    Valued Member BetterWay is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    146Posts

    Re: Snowlight Coins & GiveBadge Command

    Fix for Givebadge command (U dont need to add badge_definitions now):

    Code:
                    case "givebadge":
                        {
                            if (!Session.HasRight("hotel_admin"))
                            {
                                return false;
                            }
                            string Username = UserInputFilter.FilterString(Bits[1].Trim());
                            Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));
                            if (TargetSession == null)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a valid user."));
                                return false;
                            }
    
                            if (Bits[2].Trim() == "")
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a badge ID"));
                            }
                            using (SqlDatabaseClient MysqlClient = SqlDatabaseManager.GetClient())
                            {
                                DataRow row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");;
                                if (row == null)
                                {
                                    MysqlClient.ExecuteScalar("INSERT INTO badge_definitions (code) VALUES('" + Bits[2].Trim() + "')");
                                    row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                }
                                else
                                {
                                    row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                }
                                MysqlClient.ExecuteScalar("INSERT INTO badges (user_id, badge_id, source_type) VALUES('" + CharacterResolverCache.GetUidFromName(Username) + "', '" + row["id"] + "', 'static')");
                            }
                            TargetSession.SendData(RoomUserBadgesComposer.Compose(TargetSession.CharacterId, TargetSession.BadgeCache.EquippedBadges));
                            TargetSession.SendData(UserAlertModernComposer.Compose("Badges", "You just got a new badge, relog for showing off with it!"));
                            return true;
                        }

  5. #5
    Alpha Member Zak© is offline
    MemberRank
    Oct 2007 Join Date
    2,693Posts

    Re: Snowlight Coins & GiveBadge Command

    Snowlight is not even complete.

    And you are making commands for it.

    Why not completes it instead.

  6. #6
    No, Just no. Matthew is offline
    MemberRank
    Jul 2008 Join Date
    United KingdomLocation
    1,408Posts

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by Zak© View Post
    Snowlight is not even complete.

    And you are making commands for it.

    Why not completes it instead.
    Hi, I'm not really good at C# yet, but I'll release it just for others.
    At least he's trying.

  7. #7
    Account Upgraded | Title Enabled! Pookie is offline
    MemberRank
    Mar 2011 Join Date
    1,038Posts

    Re: Snowlight Coins & GiveBadge Command

    Thanks.

  8. #8
    Valued Member BetterWay is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    146Posts

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by Zak© View Post
    Snowlight is not even complete.

    And you are making commands for it.

    Why not completes it instead.
    Yes it isn't completed, but when I have more experience I'll do more..

    For now this 2 commands, and next I'll try make more updates for it :)

    Regards,
    BetterWay

  9. #9
    Gamma Spamma Liam is offline
    MemberRank
    Dec 2011 Join Date
    Down UnderLocation
    2,945Posts

    Re: Snowlight Coins & GiveBadge Command

    Nice release I guess :D Really coded by you? Because you said you're not really good at C#, yet, how did you code this? Possibly a Ctrl+C & Ctrl+V ?

  10. #10
    Valued Member BetterWay is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    146Posts

    Re: Snowlight Coins & GiveBadge Command

    It's totally coded by me, and meth0d for Snowlight..

    And no possibility of C&P because there are no other releases for givebadge/coins commands :)

    And I'm coding for 2 years C++ and that because I said I'm not really good at it yet..

  11. #11
    Gamma Spamma Liam is offline
    MemberRank
    Dec 2011 Join Date
    Down UnderLocation
    2,945Posts

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by BetterWay View Post
    It's totally coded by me, and meth0d for Snowlight..

    And no possibility of C&P because there are no other releases for givebadge/coins commands :)

    And I'm coding for 2 years C++ and that because I said I'm not really good at it yet..
    You've been coding C++ for 2 years, and you're not really got at it?

    Anyways, I saw this release on Snowlights forum

  12. #12
    Valued Member BetterWay is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    146Posts

    Re: Snowlight Coins & GiveBadge Command

    Lol'd show the GiveBadge, if it is released? or the coins? it needs to be totally different ;)

  13. #13
    Infraction Banned HallaHotel is offline
    MemberRank
    Mar 2011 Join Date
    AustriaLocation
    60Posts

    Re: Snowlight Coins & GiveBadge Command

    Snowlight is ****

  14. #14
    Epic Member ;) PoyzenCookie is offline
    MemberRank
    Aug 2011 Join Date
    EnglandLocation
    659Posts

    Re: Snowlight Coins & GiveBadge Command

    Snowlight would of been the best EMU available IMO .. Roy is an amazing coder. Why do you think Phoenix is so popular....Only Aaron is even more lazy than Roy .. which sucks balls

  15. #15
    What about no. Davidaap is offline
    MemberRank
    Nov 2009 Join Date
    773Posts

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by PoyzenCookie View Post
    Snowlight would of been the best EMU available IMO .. Roy is an amazing coder. Why do you think Phoenix is so popular....Only Aaron is even more lazy than Roy .. which sucks balls
    Lol no just no.

  16. #16
    Alpha Member Caustik is offline
    MemberRank
    May 2011 Join Date
    LondonLocation
    1,837Posts
    Quote Originally Posted by PoyzenCookie View Post
    Snowlight would of been the best EMU available IMO .. Roy is an amazing coder. Why do you think Phoenix is so popular....Only Aaron is even more lazy than Roy .. which sucks balls
    You need to get your brain checked. Snowlight sucks. Badly.
    It wasn't finished because Roy didn't have a fucking clue on how to finish it.
    @MyKi, C++ isn't an easy language to learn, if you delve into it headfirst.
    @OP - not bad for a first try ;)
    Posted via Mobile Device

  17. #17
    Account Upgraded | Title Enabled! Kristopher is offline
    MemberRank
    Sep 2011 Join Date
    266Posts

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by PoyzenCookie View Post
    Snowlight would of been the best EMU available IMO .. Roy is an amazing coder. Why do you think Phoenix is so popular....Only Aaron is even more lazy than Roy .. which sucks balls
    Seems like your banner in your sig spelled hiring wrong..

    Nice release i havent seen any people using snowlight tho..



Advertisement