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..
Re: Snowlight Coins & GiveBadge Command
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;
}
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;
}
Re: Snowlight Coins & GiveBadge Command
Snowlight is not even complete.
And you are making commands for it.
Why not completes it instead.
Re: Snowlight Coins & GiveBadge Command
Quote:
Originally Posted by
Zak©
Snowlight is not even complete.
And you are making commands for it.
Why not completes it instead.
Quote:
Hi, I'm not really good at C# yet, but I'll release it just for others.
At least he's trying.
Re: Snowlight Coins & GiveBadge Command
Re: Snowlight Coins & GiveBadge Command
Quote:
Originally Posted by
Zak©
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
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 ? :sleep:
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..
Re: Snowlight Coins & GiveBadge Command
Quote:
Originally Posted by
BetterWay
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 :sleep:
Re: Snowlight Coins & GiveBadge Command
Lol'd show the GiveBadge, if it is released? or the coins? it needs to be totally different ;)
Re: Snowlight Coins & GiveBadge Command
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
Re: Snowlight Coins & GiveBadge Command
Quote:
Originally Posted by
PoyzenCookie
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.