mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-25 22:30:52 -04:00
Fix money changes from zombie survival not being saved.
This commit is contained in:
parent
b171a9776d
commit
bdf297c4c1
@ -109,7 +109,7 @@ namespace MCGalaxy.Eco {
|
|||||||
case "maximumrank":
|
case "maximumrank":
|
||||||
Group grp = Group.Find(args[2]);
|
Group grp = Group.Find(args[2]);
|
||||||
if (grp == null) { Player.SendMessage(p, "%cThat wasn't a rank!"); return; }
|
if (grp == null) { Player.SendMessage(p, "%cThat wasn't a rank!"); return; }
|
||||||
if (p.group.Permission < grp.Permission) { Player.SendMessage(p, "%cCan't set a maxrank that is higher than yours!"); return; }
|
if (p != null && p.group.Permission < grp.Permission) { Player.SendMessage(p, "%cCan't set a maxrank that is higher than yours!"); return; }
|
||||||
MaxRank = args[2].ToLower();
|
MaxRank = args[2].ToLower();
|
||||||
Player.SendMessage(p, "%aSuccessfully set max rank to: " + grp.color + grp.name);
|
Player.SendMessage(p, "%aSuccessfully set max rank to: " + grp.color + grp.name);
|
||||||
UpdatePrices();
|
UpdatePrices();
|
||||||
|
@ -173,8 +173,8 @@ namespace MCGalaxy.Games {
|
|||||||
if (lastPlayerToInfect == pKiller.name) {
|
if (lastPlayerToInfect == pKiller.name) {
|
||||||
infectCombo++;
|
infectCombo++;
|
||||||
if (infectCombo >= 2) {
|
if (infectCombo >= 2) {
|
||||||
pKiller.SendMessage("You gained " + (4 + infectCombo) + " " + Server.moneys);
|
pKiller.SendMessage("You gained " + (2 + infectCombo) + " " + Server.moneys);
|
||||||
pKiller.money += 4 + infectCombo;
|
pKiller.money += 2 + infectCombo;
|
||||||
pKiller.OnMoneyChanged();
|
pKiller.OnMoneyChanged();
|
||||||
CurrentLevel.ChatLevel(pKiller.FullName + " is on a rampage! " + (infectCombo + 1) + " infections in a row!");
|
CurrentLevel.ChatLevel(pKiller.FullName + " is on a rampage! " + (infectCombo + 1) + " infections in a row!");
|
||||||
}
|
}
|
||||||
@ -320,8 +320,6 @@ namespace MCGalaxy.Games {
|
|||||||
if (p.level.name.CaselessEq(CurrentLevelName))
|
if (p.level.name.CaselessEq(CurrentLevelName))
|
||||||
playersString += p.color + p.DisplayName + Colors.white + ", ";
|
playersString += p.color + p.DisplayName + Colors.white + ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
static string Eq(string src, string a, string b) { return src == a || src == b; }
|
|
||||||
|
|
||||||
void ChooseNextLevel() {
|
void ChooseNextLevel() {
|
||||||
if (QueuedLevel != null) { ChangeLevel(QueuedLevel); return; }
|
if (QueuedLevel != null) { ChangeLevel(QueuedLevel); return; }
|
||||||
|
@ -140,7 +140,7 @@ namespace MCGalaxy {
|
|||||||
//Using for anything else can cause unintended effects!
|
//Using for anything else can cause unintended effects!
|
||||||
public bool canBuild = true;
|
public bool canBuild = true;
|
||||||
|
|
||||||
public int money = 0;
|
public int money = 0, loginMoney = 0;
|
||||||
public long overallBlocks = 0;
|
public long overallBlocks = 0;
|
||||||
|
|
||||||
public int loginBlocks = 0;
|
public int loginBlocks = 0;
|
||||||
@ -372,7 +372,7 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
//safe against SQL injects because no user input is provided
|
//safe against SQL injects because no user input is provided
|
||||||
string commandString =
|
string query =
|
||||||
"UPDATE Players SET IP='" + ip + "'" +
|
"UPDATE Players SET IP='" + ip + "'" +
|
||||||
", LastLogin='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'" +
|
", LastLogin='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'" +
|
||||||
", totalLogin=" + totalLogins +
|
", totalLogin=" + totalLogins +
|
||||||
@ -383,13 +383,18 @@ namespace MCGalaxy {
|
|||||||
", TimeSpent='" + time.ToDBTime() +
|
", TimeSpent='" + time.ToDBTime() +
|
||||||
"' WHERE Name='" + name + "'";
|
"' WHERE Name='" + name + "'";
|
||||||
if ( MySQLSave != null )
|
if ( MySQLSave != null )
|
||||||
MySQLSave(this, commandString);
|
MySQLSave(this, query);
|
||||||
OnMySQLSaveEvent.Call(this, commandString);
|
OnMySQLSaveEvent.Call(this, query);
|
||||||
if ( cancelmysql ) {
|
if ( cancelmysql ) {
|
||||||
cancelmysql = false;
|
cancelmysql = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Database.executeQuery(commandString);
|
Database.executeQuery(query);
|
||||||
|
if (Economy.Enabled && loginMoney != money) {
|
||||||
|
Economy.EcoStats ecos = Economy.RetrieveEcoStats(name);
|
||||||
|
ecos.money = money;
|
||||||
|
Economy.UpdateEcoStats(ecos);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( !smileySaved ) {
|
if ( !smileySaved ) {
|
||||||
|
@ -158,6 +158,7 @@ namespace MCGalaxy {
|
|||||||
p.overallBlocks = long.Parse(row["totalBlocks"].ToString().Trim());
|
p.overallBlocks = long.Parse(row["totalBlocks"].ToString().Trim());
|
||||||
//money = int.Parse(playerDb.Rows[0]["Money"].ToString());
|
//money = int.Parse(playerDb.Rows[0]["Money"].ToString());
|
||||||
p.money = Economy.RetrieveEcoStats(p.name).money;
|
p.money = Economy.RetrieveEcoStats(p.name).money;
|
||||||
|
p.loginMoney = p.money;
|
||||||
p.totalKicked = int.Parse(row["totalKicked"].ToString());
|
p.totalKicked = int.Parse(row["totalKicked"].ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user