Skip to content

Commit f5800cd

Browse files
authored
Merge pull request #62 from genonullfree/minimal-display
Minimal display
2 parents 3f05a84 + 330b137 commit f5800cd

File tree

7 files changed

+136
-81
lines changed

7 files changed

+136
-81
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "idlecoin"
3-
version = "0.3.5"
3+
version = "0.3.6"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

README.md

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,35 @@ nc 127.0.0.1 7654
2626
telnet localhost 7654
2727
```
2828

29-
The stats are written out to a file `.idlecoin` in the working directory of the server upon exit. On start, `idlecoin` will attempt to open `.idlecoin` and ingest the stats file to allow loading of previous stats.
29+
The stats are written out to a file `.idlecoin` in the working directory of the server upon exit. On start, `idlecoin` will attempt to open `.idlecoin` and ingest the stats file to allow loading of previous stats. The stats file will currently autosave every 5 minutes.
3030

3131
## Output
3232

3333
```
34-
[004] Wallet 0xe7299d9f952a6c31 Coins: 0:16324
35-
[+] Miner 0x91e5e95a Cps: 603 Level: 2
36-
[003] Wallet 0xe8b26b26f8b447f9 Coins: 0:58426
37-
[+] Miner 0xedadbfe7 Cps: 342 Level: 2
38-
[001] Wallet 0x7d3ce1ed74b2c05f Coins: 0:261941
39-
[+] Miner 0x3b7c1ffb Cps: 430 Level: 2
40-
[+] Miner 0x2c37118e Cps: 546 Level: 3
41-
34+
[012] Wallet 0xd259fac86ad34f98 Coins: 0:3543 Miner Licenses: 5 Total Cps: 280
35+
[*] Miners:
36+
[M:0x4768b820 Cps:73 B:0 L:1 ] [M:0x19b1eb90 Cps:70 B:0 L:1 ] [M:0x5af31ad8 Cps:70 B:0 L:1 ] [M:0xdfac45f1 Cps:67 B:0 L:1 ]
37+
[001] Wallet 0x7d3ce1ed74b2c05f Coins: 455111110:4595339597215277250 Miner Licenses: 25 Total Cps: 1493
38+
[*] Miners:
39+
[M:0x566369be Cps:124 B:0 L:2 ] [M:0xa7f6aa75 Cps:118.1K B:1920 L:12] [M:0x7b104097 Cps:118 B:0 L:2 ] [M:0x81599875 Cps:118 B:0 L:2 ]
40+
[M:0x05d175f8 Cps:118 B:0 L:2 ] [M:0x7107c253 Cps:112 B:0 L:2 ] [M:0x932c39cf Cps:112 B:0 L:2 ] [M:0xb21f74cf Cps:112 B:0 L:2 ]
41+
[M:0x6bb92dd6 Cps:106 B:0 L:2 ] [M:0x7a55897f Cps:106 B:0 L:2 ] [M:0xfbef289d Cps:106 B:0 L:2 ] [M:0xacbf46a9 Cps:100 B:0 L:1 ]
42+
[M:0x5b0f4b06 Cps:94 B:0 L:1 ] [M:0x7cd638c2 Cps:49 B:0 L:1 ]
43+
44+
Logged in as Wallet: 0x7d3ce1ed74b2c05f Miner: 0x7cd638c2
4245
Events:
43-
[!] Miner 0x91e5e95a gained 10% CPS boost
44-
[!] Miner 0x2c37118e leveled up
45-
[!] Miner 0xedadbfe7 gained 10% CPS boost
46-
[!] Miner 0x2c37118e gained 10% CPS boost
47-
[!] Miner 0x2c37118e gained 10% CPS boost
48-
49-
Logged in as: 0x7d3ce1ed74b2c05f%
46+
[2022-04-03 09:41:12] Miner 0xa7f6aa75 bought 1920 boost seconds with 15360 idlecoin
5047
```
5148

5249
The display is updated every second. Only Wallets with active miners will be displayed, but the rank number will be accurate for all Wallets on the server.
5350

5451
### Wallet
5552

5653
```
57-
[002] Wallet 0xe8b26b26f8b447f9 Coins: 0:58426
58-
^ ^ ^
54+
[002] Wallet 0xc5bef0bd52e469b7 Coins: 0:4969441343 Miner Licenses: 5 Total Cps: 2742
55+
^ ^ ^ ^ ^
56+
| | | | Total amount of Cps for all Miners
57+
| | | Max Number of Miners for Wallet
5958
| | Supercoins:Idlecoins
6059
| Unique Wallet ID
6160
Rank number
@@ -64,33 +63,32 @@ Rank number
6463
### Miners
6564

6665
```
67-
[+] Miner 0x2c37118e Cps: 546 Level: 3
68-
^ ^ ^
69-
| | Miner level
70-
| Miner Coins-Per-Second
71-
Unique Miner ID
66+
[*] Miners:
67+
[M:0xa7f6aa75 Cps:118.1K B:1920 L:12]
68+
^ ^ ^ ^
69+
| | | Miner level
70+
| | Boost seconds
71+
| Miner Coins-Per-Second
72+
Unique Miner ID
7273
```
7374

74-
Each wallet supports at least 5 miners.
75+
Each wallet supports at least 5 miners, with options to purchase more once the wallet has enough to purchase additional licenses.
7576

7677
### Events
7778

7879
```
7980
Events:
80-
[!] Miner 0x91e5e95a gained 10% CPS boost
81-
[!] Miner 0x2c37118e leveled up
82-
[!] Miner 0xedadbfe7 gained 10% CPS boost
83-
[!] Miner 0x2c37118e gained 10% CPS boost
84-
[!] Miner 0x2c37118e gained 10% CPS boost
81+
[2022-04-03 09:41:12] Miner 0x876be1c6 bought 1920 boost seconds with 15360 idlecoin
8582
```
8683

8784
These events are newest on top, and only the most recent 5 are displayed.
8885

89-
These events are special random events that can happen:
86+
These events can be a mix of users purchasing upgrades for their miners or special random events that can happen:
9087

9188
1. Gain 10% CPS -- 0.01% chance
9289
1. Gain 1 Level -- 0.02% chance
9390
1. Lose 1 Level -- 0.01% chance
91+
1. IRS auditing -- 0.00000006430041152263% chance
9492

9593

9694
## Auto-Login

src/commands.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ fn buy_boost(connection: &mut Connection, wallet: &mut Wallet) -> u64 {
9999
.push("You need at least 1024 Cps to be able to purchase boost\n".to_string());
100100
return 0;
101101
}
102+
if connection.miner.boost > u16::MAX as u64 {
103+
connection
104+
.updates
105+
.push("You cannot purchase any more boost right now\n".to_string());
106+
return 0;
107+
}
102108
let cost = boost_cost(connection.miner.cps);
103109
if wallet.idlecoin < cost && wallet.supercoin == 0 {
104110
connection
@@ -113,15 +119,23 @@ fn buy_boost(connection: &mut Connection, wallet: &mut Wallet) -> u64 {
113119
cost
114120
}
115121

122+
pub fn miner_cost(max_miners: u64) -> u64 {
123+
if max_miners < 5 {
124+
u64::MAX
125+
} else {
126+
u64::MAX / (0x100000 >> (max_miners - 5))
127+
}
128+
}
129+
116130
fn buy_miner(connection: &mut Connection, mut wallet: &mut Wallet) -> u64 {
117-
if wallet.max_miners >= 10 {
131+
if wallet.max_miners >= ABS_MAX_MINERS {
118132
connection
119133
.updates
120134
.push("You cannot purchase any more miners\n".to_string());
121135
return 0;
122136
}
123137

124-
let cost = u64::MAX / (100000 >> (wallet.max_miners - 5));
138+
let cost = miner_cost(wallet.max_miners);
125139
if wallet.idlecoin > cost || wallet.supercoin > 0 {
126140
miner::sub_idlecoins(wallet, cost);
127141
wallet.max_miners += 1;

src/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn load_stats(wallets: &Arc<Mutex<Vec<Wallet>>>) -> Result<(), Error> {
3737
Ok(())
3838
}
3939

40-
pub fn save_stats(wallets: Arc<Mutex<Vec<Wallet>>>) {
40+
pub fn save_stats(wallets: &Arc<Mutex<Vec<Wallet>>>) {
4141
// Serialize the stats data to json
4242
println!("Saving stats...");
4343
let gens = wallets.lock().unwrap();

0 commit comments

Comments
 (0)