Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
I'm curious. We've had so many reiterations of the EE server code and such. Has anyone published the inner workings of how the Magic Coin algorithm worked?
Pure curiosity. Google couldn't help me find solid answers. I think.
Thanks
edit: It seems I never read the wiki. Thanks everyone for this info, but I'm still curious about the whole affair
Offline
The wiki might not be up-to-date on this. Atilla published a few versions of the server code as part of EEmulator, and for convenience I'll put them below:
Coin collect code from EverybodyEdits.cs in v89, an early 2012 version:
player.coins = m.GetInt(0U);
this.coinscollected++;
if (player.canWinEnergy && (DateTime.Now - player.lastCoin).TotalMinutes > 20.0 && DateTime.Now > player.coinTimer && this.coinscollected < 4 * this.PlayerCount && this.coinscollected < 40 && (DateTime.Now - this.coinanticheat).TotalMilliseconds > 100.0 && (DateTime.Now - player.lastmove).TotalSeconds < 15.0 && !this.coinbanned)
{
if (this.rd.Next(0, 75) == 1)
{
if (this.rd.Next(0, 50) == 1)
{
if (!player.PayVault.Has("smileywizard"))
{
player.Send("info", new object[]
{
"Congratulations you just found the wizard smiley!",
"You found an extra magical coin! Upon touching the coin you found that you had a wizard hat and beard..."
});
base.Broadcast("write", new object[]
{
"* MAGIC",
player.name.ToUpper() + " just became a wizard!"
});
player.PayVault.Give(new BuyItemInfo[]
{
new BuyItemInfo("smileywizard")
}, delegate ()
{
});
player.PlayerObject.Set("lastcoin", DateTime.Now);
player.PlayerObject.Save();
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
base.Broadcast("face", new object[]
{
player.Id,
22
});
player.Send("givewizard", new object[0]);
}
else if (!player.PayVault.Has("smileywizard2"))
{
player.Send("info", new object[]
{
"Congratulations you just found the rare wizard smiley!",
"You found an extra magical coin! Upon touching the coin you found that you had a red wizard hat and beard..."
});
base.Broadcast("write", new object[]
{
"* MAGIC",
player.name.ToUpper() + " just became a fire wizard!"
});
player.PayVault.Give(new BuyItemInfo[]
{
new BuyItemInfo("smileywizard2")
}, delegate ()
{
});
player.PlayerObject.Set("lastcoin", DateTime.Now);
player.PlayerObject.Save();
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
base.Broadcast("face", new object[]
{
player.Id,
32
});
player.Send("givewizard2", new object[0]);
}
else if (!player.PayVault.Has("smileywitch"))
{
player.Send("info", new object[]
{
"Congratulations you just found the rare witch smiley!",
"You found an ultra magical coin! Upon touching the coin you found that you had become a witch..."
});
base.Broadcast("write", new object[]
{
"* MAGIC",
player.name.ToUpper() + " just became a witch!"
});
player.PayVault.Give(new BuyItemInfo[]
{
new BuyItemInfo("smileywitch")
}, delegate ()
{
});
player.PlayerObject.Set("lastcoin", DateTime.Now);
player.PlayerObject.Save();
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
base.Broadcast("face", new object[]
{
player.Id,
32
});
player.Send("givewitch", new object[0]);
}
}
else if (this.rd.Next(0, 100) == 1)
{
var maxe = player.PlayerObject.GetInt("maxEnergy", 200);
maxe += 15;
player.Send("info", new object[]
{
"Congratulations you just found a rare magical coin!",
"Magical coins are very rare and sought after as they increase your energy!\n\nYour new maximum energy is now " + maxe + "!\nYour energy has also been fully recharged!"
});
base.Broadcast("write", new object[]
{
"* MAGIC",
player.name.ToUpper() + " just found a rare magical coin and was awarded 15 extra total energy and a full energy bar!"
});
player.PlayerObject.Remove("shopDate");
player.PlayerObject.Set("maxEnergy", maxe);
player.PlayerObject.Set("lastcoin", DateTime.Now);
player.PlayerObject.Save();
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.Send("refreshshop", new object[0]);
}
else if (this.rd.Next(0, 75) == 1)
{
var maxe = player.PlayerObject.GetInt("maxEnergy", 200);
maxe += 10;
player.Send("info", new object[]
{
"Congratulations you just found an extra magical coin!",
"Magical coins are very rare and sought after as they increase your energy!\n\nYour new maximum energy is now " + maxe + "!\nYour energy has also been fully recharged!"
});
base.Broadcast("write", new object[]
{
"* MAGIC",
player.name.ToUpper() + " just found an extra magical coin and was awarded 10 extra total energy and a full energy bar!"
});
player.PlayerObject.Remove("shopDate");
player.PlayerObject.Set("maxEnergy", maxe);
player.PlayerObject.Set("lastcoin", DateTime.Now);
player.PlayerObject.Save();
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.Send("refreshshop", new object[0]);
}
else if (this.rd.Next(0, 2) == 1)
{
var maxe = player.PlayerObject.GetInt("maxEnergy", 200);
maxe += 2;
player.Send("info", new object[]
{
"Congratulations you just found an magical coin!",
"Magical coins are very rare and sought after as they increase your energy!\n\nYour new maximum energy is now " + maxe + "!"
});
base.Broadcast("write", new object[]
{
"* MAGIC",
player.name.ToUpper() + " just found a magical coin and was awarded 2 extra total energy!"
});
player.PlayerObject.Set("maxEnergy", maxe);
player.PlayerObject.Set("lastcoin", DateTime.Now);
player.PlayerObject.Save();
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.Send("refreshshop", new object[0]);
}
else
{
var maxe = player.PlayerObject.GetInt("maxEnergy", 200);
maxe++;
player.Send("info", new object[]
{
"Congratulations you just found an minor magical coin!",
"Magical coins are very rare and sought after as they increase your energy!\n\nYour new maximum energy is now " + maxe + "!"
});
base.Broadcast("write", new object[]
{
"* MAGIC",
player.name.ToUpper() + " just found a minor magical coin and was awarded 1 extra total energy!"
});
player.PlayerObject.Set("maxEnergy", maxe);
player.PlayerObject.Set("lastcoin", DateTime.Now);
player.PlayerObject.Save();
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.Send("refreshshop", new object[0]);
}
}
else if (this.rd.Next(0, 15) == 1)
{
if (!player.PayVault.Has("smileyxmasgrinch"))
{
player.Send("info", new object[]
{
"Congratulations you just found the grinch smiley!",
"You found an magical Christmas coin! Upon touching the coin you found that you where the feared Grinch who stole Christmas."
});
base.Broadcast("write", new object[]
{
"* MAGIC",
player.name.ToUpper() + " just became the feared Christmas Grinch!"
});
player.PayVault.Give(new BuyItemInfo[]
{
new BuyItemInfo("smileyxmasgrinch")
}, delegate ()
{
});
player.PlayerObject.Set("lastcoin", DateTime.Now);
player.PlayerObject.Save();
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
base.Broadcast("face", new object[]
{
player.Id,
48
});
player.Send("givegrinch", new object[0]);
}
}
player.coinTimer = DateTime.Now.AddMinutes(1.0);
}
this.coinanticheat = DateTime.Now;
base.Broadcast("c", new object[]
{
player.Id,
player.coins
});
return;
Coin collect code from Game.cs in v188, from 2015:
player.coins = m.GetInt(0);
player.bcoins = m.GetInt(1);
this.coinscollected++;
if (m.Count < 4) return;
var cx = m.GetInt(2);
var cy = m.GetInt(3);
//Console.WriteLine("collect coin at " + cx + "/" + cy + ". Already collected? " + player.isCoinCollected(cx, cy));
if (
// There is a coin on the position
(this.baseworld.getBrickType(0, cx, cy) == (uint)ItemTypes.Coin) &&
// Player has not collected all more coins than is possible
player.coins <= this.baseworld.coinCount() &&
// Player is moving
(DateTime.Now - player.lastmove).TotalSeconds < 15 &&
// Some time has passed since last coin pickup
(DateTime.Now - this.coinanticheat).TotalMilliseconds > 100 &&
// world has not been banned for woot coins
!this.baseworld.coinbanned &&
// It is not the players own world
!player.owner &&
// The player is not able to edit
(!player.canEdit || player.ismod) &&
// Player has not already picked up a coin at that position
!player.isCoinCollected(cx, cy)
)
{
// Set the coin as collected by the player
player.setCoinCollected(cx, cy);
// Check against percentage of world that is coins
if ((this.baseworld.coinPercentage() * 2) * 100 < this.rd.Next(0, 100))
{
//var playerlevel = player.level;
player.doCoinCollect(delegate (bool success)
{
if (success)
{
this.magiccollected++;
this.BroadcastMessage(Message.Create("w", player.Id));
//if (player.level > playerlevel)
//{
// this.BroadcastMessage(Message.Create("levelup", player.Id, 1 /* woot level */));
//}
}
});
}
}
if (
player.canWinEnergy &&
(DateTime.Now - player.lastCoin).TotalMinutes > 20 &&
(DateTime.Now > player.coinTimer) &&
this.coinscollected < 4 * this.PlayerCount &&
this.coinscollected < 40 &&
(DateTime.Now - this.coinanticheat).TotalMilliseconds > 100 &&
(DateTime.Now - player.lastmove).TotalSeconds < 15 &&
!this.baseworld.coinbanned
)
{
// 1.3 % chance
if (this.rd.Next(0, 75) == 1)
{
// 4 % chance
if (this.rd.Next(0, 50) <= 2)
{
// 25% chance each
if (this.rd.Next(0, 100) < 25)
{
// Smileys
if (!player.PayVault.Has("smileywizard"))
{
player.SendMessage(Message.Create("info", "Congratulations!",
"You found an extra magical coin! Upon touching the coin you found that you had a wizard hat and beard..."));
this.Broadcast("write", "* MAGIC",
player.name.ToUpper() + " just became a wizard!");
player.PayVault.Give(new[] { new BuyItemInfo("smileywizard") }, delegate { });
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.face = 22;
this.BroadcastPlayerUpdate(player, Message.Create("face", player.Id, 22));
player.SendMessage(Message.Create("givemagicsmiley", "smileywizard"));
}
else if (!player.PayVault.Has("smileywizard2"))
{
// Energy Coins
var rand = rd.Next(0, 100);
if (rand <= 5)
{
player.SendMessage(Message.Create("info", "Congratulations!", "You found a magical coin! Upon touching the coin you were awarded 15 total Energy and a full Energy bar!"));
Broadcast("write", "* MAGIC", player.name.ToUpper() + " just found a magical coin and was awarded 15 total energy.");
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.PlayerObject.Set("maxEnergy", player.PlayerObject.GetInt("maxEnergy") + 15);
var full = new TimeSpan(0, 0, 150 * player.maxEnergy);
player.PlayerObject.Set("shopDate", DateTime.Now + full);
player.PlayerObject.Save();
}
else if (rand <= 35)
{
player.SendMessage(Message.Create("info", "Congratulations!", "You found a magical coin! Upon touching the coin you found 10 total Energy and a full Energy bar!"));
Broadcast("write", "* MAGIC", player.name.ToUpper() + " just found a magical coin and was awarded 10 total energy.");
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.PlayerObject.Set("maxEnergy", player.PlayerObject.GetInt("maxEnergy") + 10);
var full = new TimeSpan(0, 0, 150 * player.maxEnergy);
player.PlayerObject.Set("shopDate", DateTime.Now + full);
player.PlayerObject.Save();
}
else if (rand <= 53)
{
player.SendMessage(Message.Create("info", "Congratulations!", "You found a magical coin! Upon touching the coin you found 5 total Energy!"));
Broadcast("write", "* MAGIC", player.name.ToUpper() + " just found a magical coin and was awarded 5 total energy.");
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.PlayerObject.Set("maxEnergy", player.PlayerObject.GetInt("maxEnergy") + 5);
player.PlayerObject.Save();
}
else if (rand <= 100)
{
player.SendMessage(Message.Create("info", "Congratulations!", "You found a magical coin! Upon touching the coin you found 1 total Energy!"));
Broadcast("write", "* MAGIC", player.name.ToUpper() + " just found a magical coin and was awarded 1 total energy.");
player.lastCoin = DateTime.Now;
player.canWinEnergy = true;
player.PlayerObject.Set("maxEnergy", player.PlayerObject.GetInt("maxEnergy") + 1);
player.PlayerObject.Save();
}
}
}
else // 75% Chance
{
// Energy Coins
var rand = this.rd.Next(0, 100);
if (rand <= 5)
{
player.SendMessage(Message.Create("info", "Congratulations!",
"You found a magical coin! Upon touching the coin you were awarded 15 total Energy and a full Energy bar!"));
this.Broadcast("write", "* MAGIC",
player.name.ToUpper() +
" just found a magical coin and was awarded 15 total energy.");
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.PlayerObject.Set("maxEnergy",
player.PlayerObject.GetInt("maxEnergy") + 15);
player.PlayerObject.Set("Energy", player.PlayerObject.GetInt("maxEnergy"));
player.PlayerObject.Save();
}
else if (rand <= 35)
{
player.SendMessage(Message.Create("info", "Congratulations!",
"You found a magical coin! Upon touching the coin you found 10 total Energy and a full Energy bar!"));
this.Broadcast("write", "* MAGIC",
player.name.ToUpper() +
" just found a magical coin and was awarded 10 total energy.");
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.PlayerObject.Set("maxEnergy",
player.PlayerObject.GetInt("maxEnergy") + 10);
player.PlayerObject.Set("Energy", player.PlayerObject.GetInt("maxEnergy"));
player.PlayerObject.Save();
}
else if (rand <= 53)
{
player.SendMessage(Message.Create("info", "Congratulations!",
"You found a magical coin! Upon touching the coin you found 5 total Energy!"));
this.Broadcast("write", "* MAGIC",
player.name.ToUpper() +
" just found a magical coin and was awarded 5 total energy.");
player.lastCoin = DateTime.Now;
player.canWinEnergy = false;
player.PlayerObject.Set("maxEnergy", player.PlayerObject.GetInt("maxEnergy") + 5);
player.PlayerObject.Save();
}
else if (rand <= 100)
{
player.SendMessage(Message.Create("info", "Congratulations!",
"You found a magical coin! Upon touching the coin you found 1 total Energy!"));
this.Broadcast("write", "* MAGIC",
player.name.ToUpper() +
" just found a magical coin and was awarded 1 total energy.");
player.lastCoin = DateTime.Now;
player.canWinEnergy = true;
player.PlayerObject.Set("maxEnergy", player.PlayerObject.GetInt("maxEnergy") + 1);
player.PlayerObject.Save();
}
}
}
player.coinTimer = DateTime.Now.AddMinutes(1);
}
}
this.coinanticheat = DateTime.Now;
this.BroadcastPlayerUpdate(player, Message.Create("c", player.Id, player.coins, player.bcoins));
//Broadcast("c", player.Id, player.coins);
break;
Magic.cs from v225, in 2017:
using System;
using PlayerIO.GameLibrary;
namespace EverybodyEdits.Game
{
public class Magic
{
private readonly EverybodyEdits game;
private bool enabled;
public Magic(EverybodyEdits game)
{
this.game = game;
this.game.PlayerIO.BigDB.LoadOrCreate("Config", "magic",
magicSettings => { this.enabled = magicSettings.GetBool("enabled", true); });
}
private double Multiplier
{
get
{
var multiplier = this.game.Random.NextDouble();
if (multiplier < .65)
{
multiplier = .80;
}
return multiplier;
}
}
public void OnCoin(Player player, bool isBlue, int goldCoins, int blueCoins)
{
// Magic is disabled :(
if (!this.enabled)
{
return;
}
// Guests can't get magic
if (player.ConnectUserId == "simpleguest")
{
return;
}
// Bots can't get magic
if (player.IsBot ?? true)
{
return;
}
// Can't get magic twice
if (!player.CanWinEnergy)
{
return;
}
// There can't be more than 400 coins
if (goldCoins + blueCoins > 400)
{
return;
}
// Don't give magic when player didn't move for more than 15 seconds.
if ((DateTime.UtcNow - player.LastMove).TotalSeconds > 15)
{
return;
}
var minSinceLastMagic = (int)(DateTime.UtcNow - player.LastMagic).TotalMinutes;
// Need to wait at least 1 hour after getting magic
if (minSinceLastMagic < 60)
{
return;
}
// There should be at least 15 seconds difference between coins
if (this.CalculateDifference(player).TotalSeconds > 15)
{
return;
}
var chance = this.CalculateChance(minSinceLastMagic, goldCoins, blueCoins, player.MaxEnergy);
var multiplier = this.Multiplier;
if (this.IsLucky(chance, multiplier))
{
this.GivePlayerMagic(player, isBlue);
}
else
{
// Bonus chance to get smileys or blocks
chance = this.CalculateChance(minSinceLastMagic, goldCoins, blueCoins);
if (this.IsLucky(chance, multiplier))
{
this.GivePlayerMagic(player, isBlue, true);
}
}
}
private void GivePlayerMagic(Player player, bool isBlue, bool isBonus = false)
{
var received = false;
var rand = this.game.Random.Next(0, 100);
if (rand < 10 || (isBlue && rand < 55))
{
received = isBlue
? this.GiveBlock(player)
: this.GiveSmiley(player);
}
if (!received && !isBonus)
{
this.GiveEnergy(player);
received = true;
}
if (received)
{
player.SendMessage("magic");
}
}
private void GiveEnergy(Player player)
{
var rand = this.game.Random.Next(0, 100);
if (rand <= 1)
{
this.SendInfo(player,
"You found a magical coin! Upon touching the coin you were awarded 30 total Energy and a full Energy bar!",
player.Name.ToUpper() + " just found a magical coin and was awarded 30 total energy and a full energy bar.");
this.AwardMaxEnergy(player, 30, true);
}
else if (rand <= 7)
{
this.SendInfo(player,
"You found a magical coin! Upon touching the coin you were awarded 15 total Energy and a full Energy bar!",
player.Name.ToUpper() + " just found a magical coin and was awarded 15 total energy and a full energy bar.");
this.AwardMaxEnergy(player, 15, true);
}
else if (rand <= 17)
{
this.SendInfo(player,
"You found a magical coin! Upon touching the coin you found 10 total Energy and a full Energy bar!",
player.Name.ToUpper() + " just found a magical coin and was awarded 10 total energy and a full energy bar.");
this.AwardMaxEnergy(player, 10, true);
}
else if (rand <= 35)
{
this.SendInfo(player,
"You found a magical coin! Upon touching the coin you found 5 total Energy!",
player.Name.ToUpper() + " just found a magical coin and was awarded 5 total energy.");
this.AwardMaxEnergy(player, 5, false);
}
else if (rand <= 58)
{
this.SendInfo(player,
"You found a magical coin! Upon touching the coin you found 2 total Energy!",
player.Name.ToUpper() + " just found a magical coin and was awarded 2 total energy.");
this.AwardMaxEnergy(player, 2, false);
}
else
{
this.SendInfo(player,
"You found a magical coin! Upon touching the coin you found 1 total Energy!",
player.Name.ToUpper() + " just found a magical coin and was awarded 1 total energy.");
this.AwardMaxEnergy(player, 1, false);
}
}
private bool GiveBlock(Player player)
{
for (var i = 1; i <= 6; i++)
{
var id = i == 1 ? "" : i.ToString();
var brickId = "brickmagic" + id;
if (player.PayVault.Has(brickId))
{
continue;
}
player.PayVault.Give(new[] { new BuyItemInfo(brickId) }, () =>
{
this.SendInfo(player,
"You found an extra magical coin! Upon touching the coin you found that you got yourself a neat magic brick...",
player.Name.ToUpper() + " just got a magic brick!");
});
this.DisableRewarding(player);
player.SendMessage("givemagicbrickpackage", "magic");
return true;
}
return false;
}
private bool GiveSmiley(Player player)
{
if (!player.PayVault.Has("smileywizard"))
{
this.AwardSmiley(player, 22, "smileywizard", () =>
{
this.SendInfo(player,
"You found an extra magical coin! Upon touching the coin you found that you had a wizard hat and beard...",
player.Name.ToUpper() + " just became a wizard!");
});
return true;
}
if (!player.PayVault.Has("smileywizard2"))
{
this.AwardSmiley(player, 32, "smileywizard2", () =>
{
this.SendInfo(player,
"You found an extra magical coin! Upon touching the coin you found that you had a red wizard hat and beard...",
player.Name.ToUpper() + " just became a fire wizard!");
});
return true;
}
if (!player.PayVault.Has("smileywitch"))
{
this.AwardSmiley(player, 41, "smileywitch", () =>
{
this.SendInfo(player,
"You found an extra magical coin! Upon touching the coin you found that you became a witch...",
player.Name.ToUpper() + " just became a witch!");
});
return true;
}
if (!player.PayVault.Has("smileydarkwizard"))
{
this.AwardSmiley(player, 94, "smileydarkwizard", () =>
{
this.SendInfo(player,
"You found an extra dark magical coin! Upon touching the coin you found that you became a dark wizard...",
player.Name.ToUpper() + " just became a dark wizard!");
});
return true;
}
if (!player.PayVault.Has("smileylightwizard"))
{
this.AwardSmiley(player, 122, "smileylightwizard", () =>
{
this.SendInfo(player,
"You found an extra light magical coin! Upon touching the coin you found that you had a white wizard hat and a beard...",
player.Name.ToUpper() + " just became a light wizard!");
});
return true;
}
return false;
}
private void AwardMaxEnergy(Player player, int energy, bool refill)
{
this.DisableRewarding(player);
player.RefreshPlayerObject(() =>
{
player.MaxEnergy += energy;
if (refill)
{
player.RefillEnergy();
}
player.PlayerObject.Save();
});
}
private void AwardSmiley(Player player, int smileyId, string smileyPayVaultId, Callback callback)
{
this.DisableRewarding(player);
player.PayVault.Give(new[] { new BuyItemInfo(smileyPayVaultId) }, callback);
this.game.SetPlayerFace(player, smileyId);
player.SendMessage("givemagicsmiley", smileyPayVaultId);
}
private void DisableRewarding(Player player)
{
player.LastMagic = DateTime.UtcNow;
player.CanWinEnergy = false;
}
private void SendInfo(Player player, string text, string broadcastText)
{
player.SendMessage("info2", "Congratulations!", text);
this.game.BroadcastMessage("write", "* MAGIC", broadcastText);
}
private bool IsLucky(int chance, double multiplier)
{
return this.game.Random.Next(0, (int)(chance * multiplier)) <= 5;
}
private int CalculateChance(int minSinceLastMagic, int goldCoins, int blueCoins, int maxEnergy = 0)
{
var chance = 1000;
// The more energy you have the lower is your chance
chance += maxEnergy;
// If there are at least 15 gold or blue coins chance gets much lower
if (goldCoins >= 15 || blueCoins >= 15)
{
chance += goldCoins * 5;
chance += blueCoins * 5;
}
// Time since last magic also has impact on chance
if (minSinceLastMagic < 1000)
{
chance += (1000 - minSinceLastMagic) * 2;
}
if (minSinceLastMagic < 500)
{
chance += (500 - minSinceLastMagic) * 3;
}
return chance;
}
private TimeSpan CalculateDifference(Player player)
{
if (player.CoinTimer < DateTime.UtcNow)
{
player.CoinTimer = DateTime.UtcNow;
}
player.CoinTimer += TimeSpan.FromSeconds(10);
var difference = player.CoinTimer - DateTime.UtcNow;
if (difference.TotalMinutes < 1)
{
player.CoinTimer += difference;
}
else
{
player.CoinTimer -= TimeSpan.FromSeconds(difference.TotalSeconds / 20);
}
return difference;
}
}
}
The magic code was apparently tweaked a lot, so the 2017 code might not be the most recent.
Offline
Offline
Upon touching the coin you found that you had a wizard hat and beard...
The typos, sovl....
Offline
Just curious, I see the variable
player.IsBot
. How was this determined in EE?
I don't have enough context to fully understand this, but maybe based on this, it's something that's passed in by bots when they connect to self-identify?
https://github.com/EEmulator/EEmulator/ … and.cs#L11
It's the only place I see where it can be assigned anything but false.
"Sometimes failing a leap of faith is better than inching forward"
- ShinsukeIto
Offline
player.IsBot
At the start of the world client sends "smiley" message to set your smiley.
Bots usually don't do that
that's the whole check lol
Offline
Here is late 2018 version of magic:
basically to get magic:
1) magic is enabled
2) user is not guest
3) user is not a bot (has sent "smiley" message)
4) user haven't received magic in this world already
5) there can't be more than 444 and less than 6 coins in total in the world
6) user moved less than 15 seconds ago
7) user have not received magic in last hour
8) last coin has been collected more than 15 seconds ago
9) more than 5 seconds after last teleport (user moved within 16 by 16 blocks from their last position)
if you have all that, then we calculate your chances of getting magic by doing this:
1) base chance is 1000 (higher = worse)
2) your max energy is added to that chance
3) if there are more than 15 gold or blue coins in the world, they are multipled by 5 and added to your chance
4) if you've gotten magic in last 1000 minutes (16 hours), then we make your chances much lower (depending on your minutes)
5) if you've gotten magic in last 500 minutes (8 hours), then we make your chances EVEN lower (depending on your minutes)
After we've gotten our `chance`
now we calculate the multiplier. It's a random value between 0 and 1
if the value is less than 0.65 then it's set to 0.8
Now we have chance and multipler
We do this:
this.game.Random.Next(0, (int) (chance*multiplier/1.02)) <= 5
we get a random value between 0 and `chance*multipler / 1.02` and check if it's less than 5.
So. If for example the conditions are perfect, you are a new player with 200 energy, never gotten magic and the world is great
and also multiplier was great and it have you 0.65
then the equation is
0.65 * 1200 / 1.02 = 764
which means if a random value between 0 and 764 is less than or equals to 5, you get magic
which is about 1 in 152
that will give you regular magic OR smileys/blocks
BUT!! if you fail to get magic, you get the same calculation again. If you succeed, you can get blocks/smileys but not max energy
(there is also an exploit on how to get a lot of max energy using bots in no time but it's really really hard to pull off)
Offline
Pages: 1
[ Started around 1743377522.9376 - Generated in 0.399 seconds, 12 queries executed - Memory usage: 1.62 MiB (Peak: 1.86 MiB) ]