Skip to content

Commit

Permalink
Merge pull request #4 from Pustalorc/master
Browse files Browse the repository at this point in the history
Small code cleanup & Updated MySql.Data to 8.0.18
  • Loading branch information
Trojaner authored Nov 1, 2019
2 parents e6fd28a + 16cec54 commit 438ee54
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
7 changes: 5 additions & 2 deletions CommandApay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ public void Execute(IRocketPlayer caller, string[] msg)

var newbal = Uconomy.Instance.Database.IncreaseBalance(rp.CSteamID.ToString(), amt);
UnturnedChat.Say(rp.CSteamID,
UconomyEssentials.Instance.Translate("apaid_msg", playerid.CharacterName, amt, Uconomy.Instance.Configuration.Instance.MoneyName, newbal, Uconomy.Instance.Configuration.Instance.MoneyName));
UconomyEssentials.Instance.Translate("apaid_msg", playerid.CharacterName, amt,
Uconomy.Instance.Configuration.Instance.MoneyName, newbal,
Uconomy.Instance.Configuration.Instance.MoneyName));
UnturnedChat.Say(playerid,
UconomyEssentials.Instance.Translate("apay_msg", rp.CharacterName, amt, Uconomy.Instance.Configuration.Instance.MoneyName));
UconomyEssentials.Instance.Translate("apay_msg", rp.CharacterName, amt,
Uconomy.Instance.Configuration.Instance.MoneyName));
UconomyEssentials.HandleEvent(rp, amt, "paid");
}
}
Expand Down
12 changes: 8 additions & 4 deletions CommandExchange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public void Execute(IRocketPlayer caller, string[] amt)
var bal = Uconomy.Instance.Database.GetBalance(playerid.CSteamID.ToString());
if (amt.Length > 1 && bal < examt)
{
message = UconomyEssentials.Instance.Translate("exchange_insufficient_money", examt.ToString(), Uconomy.Instance.Configuration.Instance.MoneyName);
message = UconomyEssentials.Instance.Translate("exchange_insufficient_money", examt.ToString(),
Uconomy.Instance.Configuration.Instance.MoneyName);
UnturnedChat.Say(playerid, message);
return;
}
Expand All @@ -87,7 +88,8 @@ public void Execute(IRocketPlayer caller, string[] amt)
// Just to make sure to avoid any errors
gain = decimal.Round(gain, 2);
var newbal = Uconomy.Instance.Database.IncreaseBalance(playerid.CSteamID.ToString(), gain);
message = UconomyEssentials.Instance.Translate("new_balance_msg", newbal, Uconomy.Instance.Configuration.Instance.MoneyName);
message = UconomyEssentials.Instance.Translate("new_balance_msg", newbal,
Uconomy.Instance.Configuration.Instance.MoneyName);
UnturnedChat.Say(playerid, message);
playerid.Experience -= examt;
UconomyEssentials.HandleEvent(playerid, gain, "exchange", examt);
Expand All @@ -97,14 +99,16 @@ public void Execute(IRocketPlayer caller, string[] amt)
UconomyEssentials.Instance.Configuration.Instance.MoneyExchangerate);
// Just to make sure to avoid any errors
newbal = Uconomy.Instance.Database.IncreaseBalance(playerid.CSteamID.ToString(), examt * -1.0m);
message = UconomyEssentials.Instance.Translate("new_balance_msg", newbal, Uconomy.Instance.Configuration.Instance.MoneyName);
message = UconomyEssentials.Instance.Translate("new_balance_msg", newbal,
Uconomy.Instance.Configuration.Instance.MoneyName);
UnturnedChat.Say(playerid, message);
playerid.Experience += gainm;
UconomyEssentials.HandleEvent(playerid, gainm, "exchange", examt, "money");
break;
}

playerid.Player.channel.send("tellExperience", ESteamCall.OWNER, ESteamPacket.UPDATE_RELIABLE_BUFFER, playerid.Experience);
playerid.Player.channel.send("tellExperience", ESteamCall.OWNER, ESteamPacket.UPDATE_RELIABLE_BUFFER,
playerid.Experience);
}
}
}
Binary file modified Libraries/MySql.Data.dll
Binary file not shown.
32 changes: 23 additions & 9 deletions PlayerUE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ private static void rpe_OnPlayerDeath(UnturnedPlayer player, EDeathCause cause,
var bal1 = u.Database.IncreaseBalance(player.CSteamID.ToString(), loss);
UconomyEssentials.HandleEvent(player, loss * -1.0m, "loss");
UnturnedChat.Say(player.CSteamID,
UconomyEssentials.Instance.Translate("lose_suicide_msg", UconomyEssentials.Instance.Configuration.Instance.LoseSuicideAmt, u.Configuration.Instance.MoneyName));
UconomyEssentials.Instance.Translate("lose_suicide_msg",
UconomyEssentials.Instance.Configuration.Instance.LoseSuicideAmt,
u.Configuration.Instance.MoneyName));
if (bal1 != 0m)
UnturnedChat.Say(player.CSteamID,
UconomyEssentials.Instance.Translate("new_balance_msg", bal1, u.Configuration.Instance.MoneyName));
UconomyEssentials.Instance.Translate("new_balance_msg", bal1,
u.Configuration.Instance.MoneyName));
return;
}

Expand All @@ -63,7 +66,9 @@ private static void rpe_OnPlayerDeath(UnturnedPlayer player, EDeathCause cause,
u.Database.IncreaseBalance(player.CSteamID.ToString(), loss);
UconomyEssentials.HandleEvent(player, loss * -1.0m, "loss");
UnturnedChat.Say(player.CSteamID,
UconomyEssentials.Instance.Translate("lose_money_on_death_msg", UconomyEssentials.Instance.Configuration.Instance.LoseMoneyOnDeathAmt, u.Configuration.Instance.MoneyName));
UconomyEssentials.Instance.Translate("lose_money_on_death_msg",
UconomyEssentials.Instance.Configuration.Instance.LoseMoneyOnDeathAmt,
u.Configuration.Instance.MoneyName));
}

// Pay the other player for the kill
Expand All @@ -75,7 +80,9 @@ private static void rpe_OnPlayerDeath(UnturnedPlayer player, EDeathCause cause,
return; // No message is to be sent, so job is done.

UnturnedChat.Say(murderer,
UconomyEssentials.Instance.Translate("to_killer_msg", UconomyEssentials.Instance.Configuration.Instance.PayHitAmt, u.Configuration.Instance.MoneyName, player.CharacterName));
UconomyEssentials.Instance.Translate("to_killer_msg",
UconomyEssentials.Instance.Configuration.Instance.PayHitAmt, u.Configuration.Instance.MoneyName,
player.CharacterName));
if (bal != 0m)
UnturnedChat.Say(murderer,
UconomyEssentials.Instance.Translate("new_balance_msg", balk, u.Configuration.Instance.MoneyName));
Expand All @@ -97,7 +104,9 @@ private static void rpe_OnUpdateStat(UnturnedPlayer player, EPlayerStat stat)
return; // No message is to be sent, so job is done.

UnturnedChat.Say(player.CSteamID,
UconomyEssentials.Instance.Translate("zombie_kill_paid_msg", UconomyEssentials.Instance.Configuration.Instance.PayZombieAmt, u.Configuration.Instance.MoneyName, balzk, u.Configuration.Instance.MoneyName));
UconomyEssentials.Instance.Translate("zombie_kill_paid_msg",
UconomyEssentials.Instance.Configuration.Instance.PayZombieAmt,
u.Configuration.Instance.MoneyName, balzk, u.Configuration.Instance.MoneyName));
}
else if (UconomyEssentials.Instance.Configuration.Instance.PayMegaZombie &&
stat == EPlayerStat.KILLS_ZOMBIES_MEGA)
Expand All @@ -110,7 +119,9 @@ private static void rpe_OnUpdateStat(UnturnedPlayer player, EPlayerStat stat)
return; // No message is to be sent, so job is done.

UnturnedChat.Say(player.CSteamID,
UconomyEssentials.Instance.Translate("mega_zombie_kill_paid_msg", UconomyEssentials.Instance.Configuration.Instance.PayMegaZombieAmt, u.Configuration.Instance.MoneyName, balzk, u.Configuration.Instance.MoneyName));
UconomyEssentials.Instance.Translate("mega_zombie_kill_paid_msg",
UconomyEssentials.Instance.Configuration.Instance.PayMegaZombieAmt,
u.Configuration.Instance.MoneyName, balzk, u.Configuration.Instance.MoneyName));
}
}

Expand Down Expand Up @@ -161,7 +172,8 @@ private void FixedUpdate()
{
// There was an error. End it.
Logger.Log(
UconomyEssentials.Instance.Translate("unable_to_pay_group_msg", Player.CharacterName, ""));
UconomyEssentials.Instance.Translate("unable_to_pay_group_msg", Player.CharacterName,
""));
return;
}
}
Expand All @@ -171,10 +183,12 @@ private void FixedUpdate()
var bal = Uconomy.Instance.Database.IncreaseBalance(Player.CSteamID.ToString(), pay);
UconomyEssentials.HandleEvent(Player, pay, "paid");
UnturnedChat.Say(Player.CSteamID,
UconomyEssentials.Instance.Translate("pay_time_msg", pay, Uconomy.Instance.Configuration.Instance.MoneyName, paygroup));
UconomyEssentials.Instance.Translate("pay_time_msg", pay,
Uconomy.Instance.Configuration.Instance.MoneyName, paygroup));
if (bal >= 0.0m)
UnturnedChat.Say(Player.CSteamID,
UconomyEssentials.Instance.Translate("new_balance_msg", bal, Uconomy.Instance.Configuration.Instance.MoneyName));
UconomyEssentials.Instance.Translate("new_balance_msg", bal,
Uconomy.Instance.Configuration.Instance.MoneyName));
}
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion ZaupUconomyEssentials.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<Compile Include="PlayerUE.cs" />
<Compile Include="UconomyEConfiguration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Uconomy_Essentials.cs" />
<Compile Include="UconomyEssentials.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Libraries\BouncyCastle.Crypto.dll">
Expand Down

0 comments on commit 438ee54

Please sign in to comment.