mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-10 23:25:41 +12:00
add banks.
This commit is contained in:
parent
8781ca6b84
commit
26245c66c3
8 changed files with 127 additions and 24 deletions
1
DataCollection/Useful Info/bank_tests.txt
Normal file
1
DataCollection/Useful Info/bank_tests.txt
Normal file
|
@ -0,0 +1 @@
|
|||
bank total @ 1/01/2021 : 14,961
|
|
@ -12,6 +12,10 @@
|
|||
"click_nothing_message":"Nothing interesting here...",
|
||||
"playtime_timeout":"You have run out of playtime for now. In one minute you will be disconnected. You gain one minute of playtime every 8 minutes. Please come back later!",
|
||||
"random_movement":"You are sooo <B>%STAT%</B>. You wander dizzily in a different direction.",
|
||||
"bank":{
|
||||
"deposit_format":"You deposited $%MONEY% into the bank.",
|
||||
"withdraw_format":"You withdrew $%MONEY% from the bank."
|
||||
},
|
||||
"inn":{
|
||||
"cant_afford":"You cannot afford that service!",
|
||||
"enjoyed_service":"You enjoyed your %ITEM% for $%PRICE%.",
|
||||
|
@ -118,9 +122,15 @@
|
|||
"back_to_map":"^M",
|
||||
"long_full_line":"^L",
|
||||
"fountain":"Although it's not recommended, you could drink from this fountain if you are thirsty...^T6Drink from the public fountain. ^B1D^R1^X^Z",
|
||||
"bank":{
|
||||
"made_interest":"^LYou made $%MONEY% in interest since your last visit.^R1",
|
||||
"carrying_message":"^L(You are carrying $%MONEY% and have $%BANKMONEY% in the bank.)^R1",
|
||||
"what_to_do":"^LWhat would you like to do today?^R1",
|
||||
"options":"^PMDeposit (up to $%MONEY%)|0^PMWithdraw (up to $%BANKMONEY%)|0^PS1|MAKE TRANSACTION"
|
||||
},
|
||||
"wishing_well":{
|
||||
"no_coins":"<BR>Unfortunately you have no Wishing Well coins!",
|
||||
"wish_coins":"You have %AMOUNT% Wishing Well coins!",
|
||||
"wish_coins":"<BR>You have %AMOUNT% Wishing Well coins!",
|
||||
"wish_meta":"^I14^T6Toss a Coin in and wish for Money. ^BN1^R1^I14^T6Toss a Coin in and wish for Things. ^BN2^R1^I14^T6Toss a Coin in and wish for World Peace. ^BN3^R1",
|
||||
|
||||
"wish_things":"The Wishing Well granted you a %ITEM% and a %ITEM2%!",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
const util = require('util');
|
||||
const exec = util.promisify(require('child_process').exec)
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
const urlInput = document.getElementById("urlInput")
|
||||
const ipInput = document.getElementById("ipInput")
|
||||
const portInput = document.getElementById("portInput")
|
||||
const enterButton = document.getElementById("enterButton")
|
||||
const settingsButton = document.getElementById("settingsButton")
|
||||
|
||||
const path = require("path")
|
||||
let showServerList = false;
|
||||
|
||||
const lastDetails = JSON.parse(localStorage.getItem("lastDetails"));
|
||||
|
@ -16,7 +16,6 @@ if (lastDetails) {
|
|||
ipInput.value = lastDetails.ip;
|
||||
portInput.value = lastDetails.port;
|
||||
}
|
||||
|
||||
enterButton.addEventListener("click", async () => {
|
||||
const url = urlInput.value;
|
||||
const ip = ipInput.value;
|
||||
|
@ -27,22 +26,13 @@ enterButton.addEventListener("click", async () => {
|
|||
ip,
|
||||
port
|
||||
}))
|
||||
|
||||
runCommand(`hirunner.exe "${url}?SERVER=${ip}&PORT=${port}"`)
|
||||
setTimeout(() => {
|
||||
window.close()
|
||||
}, 500);
|
||||
|
||||
const _path = path.join(path.dirname(process.execPath), "hirunner.exe");
|
||||
spawn(_path, [`${url}?SERVER=${ip}&PORT=${port}`],{detached: true,stdio: 'ignore'})
|
||||
window.close();
|
||||
})
|
||||
|
||||
|
||||
async function runCommand(command) {
|
||||
const { stdout, stderr } = await exec(command);
|
||||
if(DEBUG_MODE)
|
||||
{
|
||||
console.log('stdout:', stdout);
|
||||
console.log('stderr:', stderr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
serversList.addEventListener("click", (event) => {
|
||||
|
|
|
@ -218,6 +218,15 @@ namespace HISP.Game
|
|||
public static string Sold1Format;
|
||||
public static string SoldAllFormat;
|
||||
|
||||
// Bank
|
||||
public static string BankMadeInIntrestFormat;
|
||||
public static string BankCarryingFormat;
|
||||
public static string BankWhatToDo;
|
||||
public static string BankOptionsFormat;
|
||||
|
||||
public static string BankWithdrewMoneyFormat;
|
||||
public static string BankDepositedMoneyFormat;
|
||||
|
||||
// Npc
|
||||
public static string NpcStartChatFormat;
|
||||
public static string NpcChatpointFormat;
|
||||
|
@ -320,6 +329,28 @@ namespace HISP.Game
|
|||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatBankIntrestMadeMeta(UInt64 intrestMade)
|
||||
{
|
||||
return BankMadeInIntrestFormat.Replace("%MONEY%", intrestMade.ToString("N0"));
|
||||
}
|
||||
public static string FormatBankCarryingMeta(int money, UInt64 bankMoney)
|
||||
{
|
||||
return BankCarryingFormat.Replace("%MONEY%", money.ToString("N0")).Replace("%BANKMONEY%", bankMoney.ToString("N0"));
|
||||
}
|
||||
public static string FormatBankOptionsMeta(int money, UInt64 bankMoney)
|
||||
{
|
||||
return BankOptionsFormat.Replace("%MONEY%", money.ToString("N0")).Replace("%BANKMONEY%", bankMoney.ToString("N0"));
|
||||
}
|
||||
|
||||
public static string FormatDepositedMoneyMessage(int money)
|
||||
{
|
||||
return BankDepositedMoneyFormat.Replace("%MONEY%", money.ToString("N0"));
|
||||
}
|
||||
public static string FormatWithdrawMoneyMessage(int money)
|
||||
{
|
||||
return BankWithdrewMoneyFormat.Replace("%MONEY%", money.ToString("N0"));
|
||||
}
|
||||
|
||||
public static string FormatNumberOfWishingCoins(int amount)
|
||||
{
|
||||
return YouHaveWishingCoinsFormat.Replace("%AMOUNT%", amount.ToString("N0"));
|
||||
|
|
|
@ -589,10 +589,22 @@ namespace HISP.Game
|
|||
return message;
|
||||
}
|
||||
|
||||
public static string buildFountain()
|
||||
private static string buildFountain()
|
||||
{
|
||||
return Messages.FountainMeta;
|
||||
}
|
||||
|
||||
private static string buildBank(User user)
|
||||
{
|
||||
string messages = Messages.FormatBankCarryingMeta(user.Money, user.BankMoney);
|
||||
messages += Messages.BankWhatToDo;
|
||||
messages += Messages.FormatBankOptionsMeta(user.Money, user.BankMoney);
|
||||
messages += Messages.ExitThisPlace;
|
||||
messages += Messages.MetaTerminator;
|
||||
return messages;
|
||||
}
|
||||
|
||||
|
||||
public static string BuildSpecialTileInfo(User user, World.SpecialTile specialTile)
|
||||
{
|
||||
string message = "";
|
||||
|
@ -650,9 +662,13 @@ namespace HISP.Game
|
|||
message += buildShopInfo(shop,user.Inventory);
|
||||
|
||||
}
|
||||
if(TileCode == "BANK")
|
||||
{
|
||||
message += buildBank(user);
|
||||
}
|
||||
if(TileCode == "WISHINGWELL")
|
||||
{
|
||||
message += Meta.buildWishingWell(user);
|
||||
message += buildWishingWell(user);
|
||||
}
|
||||
if(TileCode == "INN")
|
||||
{
|
||||
|
|
|
@ -191,6 +191,9 @@ namespace HISP.Player
|
|||
}
|
||||
set
|
||||
{
|
||||
if (value > 9999999999)
|
||||
value = 9999999999;
|
||||
|
||||
Database.SetPlayerBankMoney(value, Id);
|
||||
bankMoney = value;
|
||||
}
|
||||
|
@ -265,7 +268,7 @@ namespace HISP.Player
|
|||
value = 1000;
|
||||
if (value <= 0)
|
||||
value = 0;
|
||||
Database.SetPlayerHunger(Id, value);
|
||||
Database.SetPlayerThirst(Id, value);
|
||||
thirst = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -528,6 +528,16 @@ namespace HISP.Server
|
|||
Messages.AbuseReportFiled = gameData.messages.abuse_report.report_filed;
|
||||
Messages.AbuseReportProvideValidReason = gameData.messages.abuse_report.valid_reason;
|
||||
|
||||
// Bank
|
||||
Messages.BankMadeInIntrestFormat = gameData.messages.meta.bank.made_interest;
|
||||
Messages.BankCarryingFormat = gameData.messages.meta.bank.carrying_message;
|
||||
Messages.BankWhatToDo = gameData.messages.meta.bank.what_to_do;
|
||||
Messages.BankOptionsFormat = gameData.messages.meta.bank.options;
|
||||
|
||||
|
||||
Messages.BankDepositedMoneyFormat = gameData.messages.bank.deposit_format;
|
||||
Messages.BankWithdrewMoneyFormat = gameData.messages.bank.withdraw_format;
|
||||
|
||||
// Chat
|
||||
|
||||
Messages.ChatViolationMessageFormat = gameData.messages.chat.violation_format;
|
||||
|
|
|
@ -99,10 +99,52 @@ namespace HISP.Server
|
|||
return;
|
||||
}
|
||||
|
||||
switch(inputId) // Private Notes
|
||||
switch(inputId)
|
||||
{
|
||||
case 7:
|
||||
if(dynamicInput.Length >= 2)
|
||||
case 1: // Bank
|
||||
if (dynamicInput.Length >= 2)
|
||||
{
|
||||
int moneyDeposited = 0;
|
||||
int moneyWithdrawn = 0;
|
||||
try
|
||||
{
|
||||
moneyDeposited = int.Parse(dynamicInput[1]);
|
||||
moneyWithdrawn = int.Parse(dynamicInput[2]);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to deposit/witthdraw NaN money....");
|
||||
break;
|
||||
}
|
||||
|
||||
if((moneyDeposited <= sender.LoggedinUser.Money) && moneyDeposited != 0)
|
||||
{
|
||||
sender.LoggedinUser.Money -= moneyDeposited;
|
||||
sender.LoggedinUser.BankMoney += Convert.ToUInt64(moneyDeposited);
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatDepositedMoneyMessage(moneyDeposited), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(chatPacket);
|
||||
}
|
||||
|
||||
if ((Convert.ToUInt64(moneyWithdrawn) <= sender.LoggedinUser.BankMoney) && moneyWithdrawn != 0)
|
||||
{
|
||||
sender.LoggedinUser.BankMoney -= Convert.ToUInt64(moneyWithdrawn);
|
||||
sender.LoggedinUser.Money += moneyWithdrawn;
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatWithdrawMoneyMessage(moneyWithdrawn), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(chatPacket);
|
||||
}
|
||||
|
||||
Update(sender);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to send a invalid dynamic input (private notes, wrong size)");
|
||||
break;
|
||||
}
|
||||
case 7: // Private Notes
|
||||
if (dynamicInput.Length >= 2)
|
||||
{
|
||||
sender.LoggedinUser.PrivateNotes = dynamicInput[1];
|
||||
UpdateStats(sender);
|
||||
|
@ -115,7 +157,7 @@ namespace HISP.Server
|
|||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to send a invalid dynamic input (private notes, wrong size)");
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
case 12: // Abuse Report
|
||||
if (dynamicInput.Length >= 2)
|
||||
{
|
||||
string userName = dynamicInput[1];
|
||||
|
|
Loading…
Add table
Reference in a new issue