mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 21:55:42 +12:00
implement player stats
This commit is contained in:
parent
b6dd899372
commit
1fab8eb864
14 changed files with 991 additions and 147 deletions
|
@ -10,9 +10,14 @@
|
||||||
"drawing_notice":"Drawing not sent to other players when you are not a subscriber.",
|
"drawing_notice":"Drawing not sent to other players when you are not a subscriber.",
|
||||||
"click_nothing_message":"Nothing interesting here...",
|
"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!",
|
"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!",
|
||||||
"competition_gear":{
|
"random_movement":"You are sooo <B>%STAT%</B>. You wander dizzily in a different direction.",
|
||||||
|
"equips":{
|
||||||
"removed_competition_gear":"You removed selected competition gear.",
|
"removed_competition_gear":"You removed selected competition gear.",
|
||||||
"equip_competition_gear_format":"The %ITEM% are now selected as competition gear."
|
"removed_jewelry":"You removed selected jewelry.",
|
||||||
|
"equip_competition_gear_format":"The %ITEM% are now selected as competition gear.",
|
||||||
|
"max_jewelry":"Only 4 pieces of jewelry can be worn at one time.",
|
||||||
|
"equip_jewelry":"You are now wearing %ITEM%."
|
||||||
|
|
||||||
},
|
},
|
||||||
"sec_code":{
|
"sec_code":{
|
||||||
"invalid_sec_code":"Data Code Error. You did not get the bonus. You should reconnect if you get this message again.",
|
"invalid_sec_code":"Data Code Error. You did not get the bonus. You should reconnect if you get this message again.",
|
||||||
|
@ -55,7 +60,7 @@
|
||||||
"commands":{
|
"commands":{
|
||||||
"mute_help":"Mute Channel Not Recognized. (ALL/ADS/GLOBAL/ISLAND/NEAR/HERE/BUDDY/PM/BR/SOCIALS/LOGINS)",
|
"mute_help":"Mute Channel Not Recognized. (ALL/ADS/GLOBAL/ISLAND/NEAR/HERE/BUDDY/PM/BR/SOCIALS/LOGINS)",
|
||||||
"player_command_completed":"<FONT COLOR='#FF0000'><B>PLAYER COMMAND [%COMMAND%] COMPLETED</B></FONT>",
|
"player_command_completed":"<FONT COLOR='#FF0000'><B>PLAYER COMMAND [%COMMAND%] COMPLETED</B></FONT>",
|
||||||
"admin_command_completed":"<FONT COLOR='#FF0000'><B>COMMAND [%COMMAND%]:</B></FONT>"
|
"admin_command_completed":"<FONT COLOR='#FF0000'><B>COMMAND [%COMMAND%]:</B></FONT>",
|
||||||
},
|
},
|
||||||
"disconnect":{
|
"disconnect":{
|
||||||
"banned":"Your account has been BANNED. You will no longer be able to login",
|
"banned":"Your account has been BANNED. You will no longer be able to login",
|
||||||
|
@ -109,20 +114,26 @@
|
||||||
"legs_format":"^R1^I%ICON%^T7%ITEM% on your legs.^B4X3",
|
"legs_format":"^R1^I%ICON%^T7%ITEM% on your legs.^B4X3",
|
||||||
"feet_format":"^R1^I%ICON%^T7%ITEM% on your feet.^B4X4"
|
"feet_format":"^R1^I%ICON%^T7%ITEM% on your feet.^B4X4"
|
||||||
},
|
},
|
||||||
|
"jewelry":{
|
||||||
|
"slot_1":"^I%ICON%^T7%ITEM%^B4X5^R1",
|
||||||
|
"slot_2":"^I%ICON%^T7%ITEM%^B4X6^R1",
|
||||||
|
"slot_3":"^I%ICON%^T7%ITEM%^B4X7^R1",
|
||||||
|
"slot_4":"^I%ICON%^T7%ITEM%^B4X8^R1"
|
||||||
|
},
|
||||||
|
"hunger_stat_name":"hungry",
|
||||||
|
"thirst_stat_name":"thirsty",
|
||||||
|
"tired_stat_name":"tired",
|
||||||
|
"player_stats":[
|
||||||
|
"not at all %STAT%","a tiny bit %STAT%","a little bit %STAT%",
|
||||||
|
"kind of %STAT","%STAT%","really %STAT%","seriously %STAT%",
|
||||||
|
"desperately %STAT%","incredibly %STAT%","unbearably %STAT%"
|
||||||
|
],
|
||||||
"msg":{
|
"msg":{
|
||||||
"no_jewelry_equipped":"You have no Jewelry on.",
|
"no_jewelry_equipped":"You have no Jewelry on.",
|
||||||
"no_competition_gear":"^LYou have nothing interesting for special competition gear.",
|
"no_competition_gear":"^LYou have nothing interesting for special competition gear.",
|
||||||
"competition_gear_selected":"^LYou have the following selected for competition gear:",
|
"competition_gear_selected":"^LYou have the following selected for competition gear:",
|
||||||
|
"jewelry_selected":"You have the following lovely jewelry on:",
|
||||||
|
|
||||||
"incredibly":"incredibly %STAT%",
|
|
||||||
"desprately":"desperately %STAT%",
|
|
||||||
"seriously":"seriously %STAT%",
|
|
||||||
"really":"really %STAT%",
|
|
||||||
"normal":"%STAT%",
|
|
||||||
"kind_of":"kind of %STAT",
|
|
||||||
"little_bit":"a little bit %STAT%",
|
|
||||||
"tiny_bit":"a tiny bit %STAT%",
|
|
||||||
"not_at_all":"not at all %STAT%"
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"shop":{
|
"shop":{
|
||||||
|
@ -301,6 +312,7 @@
|
||||||
"for_sender":{
|
"for_sender":{
|
||||||
"here_format":"<FONT COLOR='#222222'><B>%USERNAME%:</B> %MESSAGE%</FONT> (%AMOUNT% here)",
|
"here_format":"<FONT COLOR='#222222'><B>%USERNAME%:</B> %MESSAGE%</FONT> (%AMOUNT% here)",
|
||||||
"isle_format":"<B>%USERNAME%:</B> %MESSAGE% [%AMOUNT% on isle]",
|
"isle_format":"<B>%USERNAME%:</B> %MESSAGE% [%AMOUNT% on isle]",
|
||||||
|
"ads_format":"<FONT COLOR='#550055'><B>%USERNAME:</B> %MESSAGE% [%AMOUNT% listening]</FONT>",
|
||||||
"near_format":"<B>%USERNAME%:</B> %MESSAGE% [%AMOUNT% near]",
|
"near_format":"<B>%USERNAME%:</B> %MESSAGE% [%AMOUNT% near]",
|
||||||
"mod_format":"<FONT COLOR='#880000'><B>%USERNAME%:</B> %MESSAGE%</FONT> [%AMOUNT% mods]",
|
"mod_format":"<FONT COLOR='#880000'><B>%USERNAME%:</B> %MESSAGE%</FONT> [%AMOUNT% mods]",
|
||||||
"admin_format":"<FONT COLOR='#800000'><B>%USERNAME%:</B> %MESSAGE%</FONT> [%AMOUNT% admins]",
|
"admin_format":"<FONT COLOR='#800000'><B>%USERNAME%:</B> %MESSAGE%</FONT> [%AMOUNT% admins]",
|
||||||
|
|
|
@ -55,9 +55,9 @@ namespace HISP.Game.Chat
|
||||||
if (message[0] == '%')
|
if (message[0] == '%')
|
||||||
{
|
{
|
||||||
if(message.StartsWith("%STICKBUG"))
|
if(message.StartsWith("%STICKBUG"))
|
||||||
{
|
|
||||||
return Command.Stickbug(message, args, user);
|
return Command.Stickbug(message, args, user);
|
||||||
}
|
if (message.StartsWith("%GIVE"))
|
||||||
|
return Command.Give(message, args, user); ;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (message[0] == '!')
|
if (message[0] == '!')
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using HISP.Player;
|
using HISP.Player;
|
||||||
using HISP.Server;
|
using HISP.Server;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace HISP.Game.Chat
|
namespace HISP.Game.Chat
|
||||||
|
@ -7,6 +8,46 @@ namespace HISP.Game.Chat
|
||||||
class Command
|
class Command
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static bool Give(string message, string[] args, User user)
|
||||||
|
{
|
||||||
|
if (args.Length <= 0)
|
||||||
|
return false;
|
||||||
|
if (!user.Administrator)
|
||||||
|
return false;
|
||||||
|
if(args[0] == "OBJECT")
|
||||||
|
{
|
||||||
|
int itemId = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
itemId = int.Parse(args[1]);
|
||||||
|
Item.GetItemById(itemId);
|
||||||
|
ItemInstance newItemInstance = new ItemInstance(itemId);
|
||||||
|
user.Inventory.AddIgnoringFull(newItemInstance);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (args[0] == "MONEY")
|
||||||
|
{
|
||||||
|
int money = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
money = int.Parse(args[1]);
|
||||||
|
user.Money += money;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||||
|
user.LoggedinClient.SendPacket(chatPacket);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
public static bool Stickbug(string message, string[] args, User user)
|
public static bool Stickbug(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
if (args.Length <= 0)
|
if (args.Length <= 0)
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace HISP.Game
|
namespace HISP.Game
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,8 @@ namespace HISP.Game
|
||||||
public static int RequiredChatViolations;
|
public static int RequiredChatViolations;
|
||||||
public static int DefaultInventoryMax;
|
public static int DefaultInventoryMax;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Tools
|
// Tools
|
||||||
public static string BinocularsNothing;
|
public static string BinocularsNothing;
|
||||||
public static string MagnifyNothing;
|
public static string MagnifyNothing;
|
||||||
|
@ -28,6 +30,11 @@ namespace HISP.Game
|
||||||
public static string StatsJewelFormat;
|
public static string StatsJewelFormat;
|
||||||
public static string StatsCompetitionGearFormat;
|
public static string StatsCompetitionGearFormat;
|
||||||
|
|
||||||
|
public static string JewelrySlot1Format;
|
||||||
|
public static string JewelrySlot2Format;
|
||||||
|
public static string JewelrySlot3Format;
|
||||||
|
public static string JewelrySlot4Format;
|
||||||
|
|
||||||
public static string CompetitionGearHeadFormat;
|
public static string CompetitionGearHeadFormat;
|
||||||
public static string CompetitionGearBodyFormat;
|
public static string CompetitionGearBodyFormat;
|
||||||
public static string CompetitionGearLegsFormat;
|
public static string CompetitionGearLegsFormat;
|
||||||
|
@ -41,8 +48,15 @@ namespace HISP.Game
|
||||||
|
|
||||||
public static string NoJewerlyEquipped;
|
public static string NoJewerlyEquipped;
|
||||||
public static string NoCompetitionGear;
|
public static string NoCompetitionGear;
|
||||||
|
public static string JewelrySelected;
|
||||||
public static string CompetitionGearSelected;
|
public static string CompetitionGearSelected;
|
||||||
|
|
||||||
|
public static string StatHunger;
|
||||||
|
public static string StatThirst;
|
||||||
|
public static string StatTired;
|
||||||
|
|
||||||
|
public static string[] StatPlayerFormats;
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
public static string NewUserMessage;
|
public static string NewUserMessage;
|
||||||
public static string WelcomeFormat;
|
public static string WelcomeFormat;
|
||||||
|
@ -87,6 +101,7 @@ namespace HISP.Game
|
||||||
public static string ChatViolationMessageFormat;
|
public static string ChatViolationMessageFormat;
|
||||||
public static string PasswordNotice;
|
public static string PasswordNotice;
|
||||||
public static string CapsNotice;
|
public static string CapsNotice;
|
||||||
|
public static string RandomMovement;
|
||||||
|
|
||||||
// Transport
|
// Transport
|
||||||
|
|
||||||
|
@ -109,8 +124,13 @@ namespace HISP.Game
|
||||||
|
|
||||||
|
|
||||||
// Competition Gear
|
// Competition Gear
|
||||||
public static string EquipItemFormat;
|
public static string EquipCompetitionGearFormat;
|
||||||
public static string UnequipItem;
|
public static string RemoveCompetitionGear;
|
||||||
|
|
||||||
|
// Jewelry
|
||||||
|
public static string EquipJewelryFormat;
|
||||||
|
public static string MaxJewelryMessage;
|
||||||
|
public static string RemoveJewelry;
|
||||||
|
|
||||||
// Inventory
|
// Inventory
|
||||||
public static string InventoryItemFormat;
|
public static string InventoryItemFormat;
|
||||||
|
@ -182,9 +202,10 @@ namespace HISP.Game
|
||||||
public static string MetaTerminator;
|
public static string MetaTerminator;
|
||||||
|
|
||||||
// Disconnect Messages
|
// Disconnect Messages
|
||||||
public static string BanMessage;
|
public static string KickReasonBanned;
|
||||||
public static string DuplicateLogin;
|
public static string KickReasonDuplicateLogin;
|
||||||
public static string IdleKickMessageFormat;
|
public static string KickReasonIdleFormat;
|
||||||
|
public static string KickReasonNoTime;
|
||||||
|
|
||||||
// Swf
|
// Swf
|
||||||
public static string BoatCutscene;
|
public static string BoatCutscene;
|
||||||
|
@ -194,6 +215,41 @@ namespace HISP.Game
|
||||||
// Click
|
// Click
|
||||||
public static string NothingInterestingHere;
|
public static string NothingInterestingHere;
|
||||||
|
|
||||||
|
public static string FormatRandomMovementMessage(string statName)
|
||||||
|
{
|
||||||
|
return RandomMovement.Replace("%STAT%", statName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatJewerlyEquipMessage(string itemName)
|
||||||
|
{
|
||||||
|
return EquipJewelryFormat.Replace("%ITEM%", itemName);
|
||||||
|
}
|
||||||
|
public static string FormatEquipCompetitionGearMessage(string name)
|
||||||
|
{
|
||||||
|
return EquipCompetitionGearFormat.Replace("%ITEM%", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatPlayerStat(string statFormat, string statName)
|
||||||
|
{
|
||||||
|
return statFormat.Replace("%STAT%", statName);
|
||||||
|
}
|
||||||
|
public static string FormatJewelrySlot1(string itemName, int icon)
|
||||||
|
{
|
||||||
|
return JewelrySlot1Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString());
|
||||||
|
}
|
||||||
|
public static string FormatJewelrySlot2(string itemName, int icon)
|
||||||
|
{
|
||||||
|
return JewelrySlot2Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString());
|
||||||
|
}
|
||||||
|
public static string FormatJewelrySlot3(string itemName, int icon)
|
||||||
|
{
|
||||||
|
return JewelrySlot3Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString());
|
||||||
|
}
|
||||||
|
public static string FormatJewelrySlot4(string itemName, int icon)
|
||||||
|
{
|
||||||
|
return JewelrySlot4Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
public static string FormatCompetitionGearHead(string itemName, int icon)
|
public static string FormatCompetitionGearHead(string itemName, int icon)
|
||||||
{
|
{
|
||||||
return CompetitionGearHeadFormat.Replace("%ITEM%", itemName).Replace("%ICON%",icon.ToString());
|
return CompetitionGearHeadFormat.Replace("%ITEM%", itemName).Replace("%ICON%",icon.ToString());
|
||||||
|
@ -273,10 +329,6 @@ namespace HISP.Game
|
||||||
return PlayerCommandFormat.Replace("%COMMAND%", command);
|
return PlayerCommandFormat.Replace("%COMMAND%", command);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FormatEquipItemMessage(string name)
|
|
||||||
{
|
|
||||||
return EquipItemFormat.Replace("%ITEM%", name);
|
|
||||||
}
|
|
||||||
public static string FormatYouEarnedAnItemMessage(string itemName)
|
public static string FormatYouEarnedAnItemMessage(string itemName)
|
||||||
{
|
{
|
||||||
return YouEarnedAnItemFormat.Replace("%ITEM%", itemName);
|
return YouEarnedAnItemFormat.Replace("%ITEM%", itemName);
|
||||||
|
@ -552,7 +604,7 @@ namespace HISP.Game
|
||||||
// Disconnect
|
// Disconnect
|
||||||
public static string FormatIdleKickMessage()
|
public static string FormatIdleKickMessage()
|
||||||
{
|
{
|
||||||
return IdleKickMessageFormat.Replace("%KICK%", GameServer.IdleTimeout.ToString());
|
return KickReasonIdleFormat.Replace("%KICK%", GameServer.IdleTimeout.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using HISP.Player;
|
using HISP.Player;
|
||||||
using HISP.Server;
|
using HISP.Server;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace HISP.Game
|
namespace HISP.Game
|
||||||
{
|
{
|
||||||
|
@ -160,7 +161,43 @@ namespace HISP.Game
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string buildNpc(User user, int x, int y)
|
private static string buildWornJewelery(User user)
|
||||||
|
{
|
||||||
|
string message = Messages.JewelrySelected;
|
||||||
|
if (user.EquipedJewelry.Slot1 != null)
|
||||||
|
message += Messages.FormatJewelrySlot1(user.EquipedJewelry.Slot1.Name, user.EquipedJewelry.Slot1.IconId);
|
||||||
|
if (user.EquipedJewelry.Slot2 != null)
|
||||||
|
message += Messages.FormatJewelrySlot2(user.EquipedJewelry.Slot2.Name, user.EquipedJewelry.Slot2.IconId);
|
||||||
|
if (user.EquipedJewelry.Slot3 != null)
|
||||||
|
message += Messages.FormatJewelrySlot3(user.EquipedJewelry.Slot3.Name, user.EquipedJewelry.Slot3.IconId);
|
||||||
|
if (user.EquipedJewelry.Slot4 != null)
|
||||||
|
message += Messages.FormatJewelrySlot4(user.EquipedJewelry.Slot4.Name, user.EquipedJewelry.Slot4.IconId);
|
||||||
|
|
||||||
|
if (message == Messages.JewelrySelected)
|
||||||
|
message = Messages.NoJewerlyEquipped;
|
||||||
|
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
private static string buildEquippedCompetitionGear(User user)
|
||||||
|
{
|
||||||
|
string message = Messages.CompetitionGearSelected;
|
||||||
|
if (user.EquipedCompetitionGear.Head != null)
|
||||||
|
message += Messages.FormatCompetitionGearHead(user.EquipedCompetitionGear.Head.Name, user.EquipedCompetitionGear.Head.IconId);
|
||||||
|
if (user.EquipedCompetitionGear.Body != null)
|
||||||
|
message += Messages.FormatCompetitionGearBody(user.EquipedCompetitionGear.Body.Name, user.EquipedCompetitionGear.Body.IconId);
|
||||||
|
if (user.EquipedCompetitionGear.Legs != null)
|
||||||
|
message += Messages.FormatCompetitionGearLegs(user.EquipedCompetitionGear.Legs.Name, user.EquipedCompetitionGear.Legs.IconId);
|
||||||
|
if (user.EquipedCompetitionGear.Feet != null)
|
||||||
|
message += Messages.FormatCompetitionGearFeet(user.EquipedCompetitionGear.Feet.Name, user.EquipedCompetitionGear.Feet.IconId);
|
||||||
|
|
||||||
|
if (message == Messages.CompetitionGearSelected)
|
||||||
|
message = Messages.NoCompetitionGear;
|
||||||
|
|
||||||
|
return message;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string buildNpc(User user, int x, int y)
|
||||||
{
|
{
|
||||||
string message = "";
|
string message = "";
|
||||||
Npc.NpcEntry[] entries = Npc.GetNpcByXAndY(x, y);
|
Npc.NpcEntry[] entries = Npc.GetNpcByXAndY(x, y);
|
||||||
|
@ -187,6 +224,22 @@ namespace HISP.Game
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string EvenUserStatDistribution(int statValue)
|
||||||
|
{
|
||||||
|
int curValue = 1000;
|
||||||
|
int devisibleBy = Convert.ToInt32(Math.Floor((decimal)curValue / Messages.StatPlayerFormats.Length));
|
||||||
|
|
||||||
|
for (int i = 0; i < Messages.StatPlayerFormats.Length; i++)
|
||||||
|
{
|
||||||
|
curValue -= devisibleBy;
|
||||||
|
if (statValue >= curValue)
|
||||||
|
return Messages.StatPlayerFormats[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
throw new Exception("A mathematically impossible error occured. please check wether the laws of physics still apply.");
|
||||||
|
}
|
||||||
public static string BuildNpcInfo(Npc.NpcEntry npcInfo)
|
public static string BuildNpcInfo(Npc.NpcEntry npcInfo)
|
||||||
{
|
{
|
||||||
string message = "";
|
string message = "";
|
||||||
|
@ -217,28 +270,6 @@ namespace HISP.Game
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
public static string BuildWornJewelery(User user)
|
|
||||||
{
|
|
||||||
return Messages.NoJewerlyEquipped;
|
|
||||||
}
|
|
||||||
public static string BuildEquippedCompetitionGear(User user)
|
|
||||||
{
|
|
||||||
string message = Messages.CompetitionGearSelected;
|
|
||||||
if (user.EquipedCompetitionGear.Head != null)
|
|
||||||
message += Messages.FormatCompetitionGearHead(user.EquipedCompetitionGear.Head.Name, user.EquipedCompetitionGear.Head.IconId);
|
|
||||||
if (user.EquipedCompetitionGear.Body != null)
|
|
||||||
message += Messages.FormatCompetitionGearBody(user.EquipedCompetitionGear.Body.Name, user.EquipedCompetitionGear.Body.IconId);
|
|
||||||
if (user.EquipedCompetitionGear.Legs != null)
|
|
||||||
message += Messages.FormatCompetitionGearLegs(user.EquipedCompetitionGear.Legs.Name, user.EquipedCompetitionGear.Legs.IconId);
|
|
||||||
if (user.EquipedCompetitionGear.Feet != null)
|
|
||||||
message += Messages.FormatCompetitionGearFeet(user.EquipedCompetitionGear.Feet.Name, user.EquipedCompetitionGear.Feet.IconId);
|
|
||||||
|
|
||||||
if (message == Messages.CompetitionGearSelected)
|
|
||||||
message = Messages.NoCompetitionGear;
|
|
||||||
|
|
||||||
return message;
|
|
||||||
|
|
||||||
}
|
|
||||||
public static string BuildStatsMenu(User user)
|
public static string BuildStatsMenu(User user)
|
||||||
{
|
{
|
||||||
string message = Messages.FormatStatsBar(user.Username);
|
string message = Messages.FormatStatsBar(user.Username);
|
||||||
|
@ -251,12 +282,12 @@ namespace HISP.Game
|
||||||
message += Messages.FormatFreeTime(user.FreeMinutes);
|
message += Messages.FormatFreeTime(user.FreeMinutes);
|
||||||
message += Messages.FormatPlayerDescriptionForStatsMenu(user.ProfilePage);
|
message += Messages.FormatPlayerDescriptionForStatsMenu(user.ProfilePage);
|
||||||
message += Messages.FormatExperience(user.Experience);
|
message += Messages.FormatExperience(user.Experience);
|
||||||
message += Messages.FormatHungryStat("Not implemented yet :3");
|
message += Messages.FormatHungryStat(Messages.FormatPlayerStat(EvenUserStatDistribution(user.Hunger), Messages.StatHunger));
|
||||||
message += Messages.FormatThirstStat("Not implemented yet :3");
|
message += Messages.FormatThirstStat(Messages.FormatPlayerStat(EvenUserStatDistribution(user.Thirst), Messages.StatThirst));
|
||||||
message += Messages.FormatTiredStat("Not implemented yet :3");
|
message += Messages.FormatTiredStat(Messages.FormatPlayerStat(EvenUserStatDistribution(user.Thirst), Messages.StatTired));
|
||||||
message += Messages.FormatGenderStat(user.Gender);
|
message += Messages.FormatGenderStat(user.Gender);
|
||||||
message += Messages.FormatJewelryStat(BuildWornJewelery(user));
|
message += Messages.FormatJewelryStat(buildWornJewelery(user));
|
||||||
message += Messages.FormatCompetitionGearStat(BuildEquippedCompetitionGear(user));
|
message += Messages.FormatCompetitionGearStat(buildEquippedCompetitionGear(user));
|
||||||
message += Messages.StatsPrivateNotes;
|
message += Messages.StatsPrivateNotes;
|
||||||
message += Messages.StatsQuests;
|
message += Messages.StatsQuests;
|
||||||
message += Messages.StatsMinigameRanking;
|
message += Messages.StatsMinigameRanking;
|
||||||
|
@ -346,11 +377,13 @@ namespace HISP.Game
|
||||||
message += Messages.FormatPlayerInventoryItemMeta(itemInfo.IconId, item.ItemInstances.Count, title);
|
message += Messages.FormatPlayerInventoryItemMeta(itemInfo.IconId, item.ItemInstances.Count, title);
|
||||||
|
|
||||||
int randomId = item.ItemInstances[0].RandomId;
|
int randomId = item.ItemInstances[0].RandomId;
|
||||||
|
if (itemInfo.Type != "QUEST" && itemInfo.Type != "TEXT" && World.CanDropItems(inv.BaseUser.X, inv.BaseUser.Y))
|
||||||
|
message += Messages.FormatItemDropButton(randomId);
|
||||||
|
|
||||||
if (itemInfo.Id == Item.Present || itemInfo.Id == Item.DorothyShoes || itemInfo.Id == Item.Telescope)
|
if (itemInfo.Id == Item.Present || itemInfo.Id == Item.DorothyShoes || itemInfo.Id == Item.Telescope)
|
||||||
message += Messages.FormatItemUseButton(randomId);
|
message += Messages.FormatItemUseButton(randomId);
|
||||||
|
|
||||||
if (itemInfo.Type == "CLOTHES")
|
if (itemInfo.Type == "CLOTHES" || itemInfo.Type == "JEWELRY")
|
||||||
message += Messages.FormatWearButton(randomId);
|
message += Messages.FormatWearButton(randomId);
|
||||||
|
|
||||||
if (itemInfo.Type == "TEXT")
|
if (itemInfo.Type == "TEXT")
|
||||||
|
@ -362,8 +395,6 @@ namespace HISP.Game
|
||||||
if (Item.IsThrowable(itemInfo.Id))
|
if (Item.IsThrowable(itemInfo.Id))
|
||||||
message += Messages.FormatItemThrowButton(randomId);
|
message += Messages.FormatItemThrowButton(randomId);
|
||||||
|
|
||||||
if (itemInfo.Type != "QUEST" && itemInfo.Type != "TEXT" && World.CanDropItems(inv.BaseUser.X, inv.BaseUser.Y))
|
|
||||||
message += Messages.FormatItemDropButton(randomId);
|
|
||||||
message += Messages.FormatItemInformationButton(randomId);
|
message += Messages.FormatItemInformationButton(randomId);
|
||||||
message += "^R1";
|
message += "^R1";
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,8 @@
|
||||||
<Compile Include="Game\Quest.cs" />
|
<Compile Include="Game\Quest.cs" />
|
||||||
<Compile Include="Game\Shop.cs" />
|
<Compile Include="Game\Shop.cs" />
|
||||||
<Compile Include="Game\Inventory\ShopInventory.cs" />
|
<Compile Include="Game\Inventory\ShopInventory.cs" />
|
||||||
<Compile Include="Player\CompetitionGear.cs" />
|
<Compile Include="Player\Equips\Jewelry.cs" />
|
||||||
|
<Compile Include="Player\Equips\CompetitionGear.cs" />
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
using HISP.Game;
|
using HISP.Game;
|
||||||
using HISP.Server;
|
using HISP.Server;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace HISP.Player
|
namespace HISP.Player.Equips
|
||||||
{
|
{
|
||||||
class CompetitionGear
|
class CompetitionGear
|
||||||
{
|
{
|
112
Horse Isle Server/Horse Isle Server/Player/Equips/Jewelry.cs
Normal file
112
Horse Isle Server/Horse Isle Server/Player/Equips/Jewelry.cs
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
using HISP.Game;
|
||||||
|
using HISP.Server;
|
||||||
|
|
||||||
|
namespace HISP.Player.Equips
|
||||||
|
{
|
||||||
|
class Jewelry
|
||||||
|
{
|
||||||
|
|
||||||
|
private int playerId;
|
||||||
|
public Jewelry(int PlayerId)
|
||||||
|
{
|
||||||
|
playerId = PlayerId;
|
||||||
|
if (!Database.HasJewelry(PlayerId))
|
||||||
|
Database.InitJewelry(PlayerId);
|
||||||
|
int itemId = Database.GetJewelrySlot1(PlayerId);
|
||||||
|
if (itemId != 0)
|
||||||
|
slot1 = Item.GetItemById(itemId);
|
||||||
|
|
||||||
|
itemId = Database.GetJewelrySlot2(PlayerId);
|
||||||
|
if (itemId != 0)
|
||||||
|
slot2 = Item.GetItemById(itemId);
|
||||||
|
|
||||||
|
itemId = Database.GetJewelrySlot3(PlayerId);
|
||||||
|
if (itemId != 0)
|
||||||
|
slot3 = Item.GetItemById(itemId);
|
||||||
|
|
||||||
|
itemId = Database.GetJewelrySlot4(PlayerId);
|
||||||
|
if (itemId != 0)
|
||||||
|
slot4 = Item.GetItemById(itemId);
|
||||||
|
|
||||||
|
}
|
||||||
|
public Item.ItemInformation Slot1
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return slot1;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
slot1 = null;
|
||||||
|
Database.SetJewelrySlot1(playerId, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Database.SetJewelrySlot1(playerId, value.Id);
|
||||||
|
slot1 = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Item.ItemInformation Slot2
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return slot2;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
slot2 = null;
|
||||||
|
Database.SetJewelrySlot2(playerId, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Database.SetJewelrySlot2(playerId, value.Id);
|
||||||
|
slot2 = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Item.ItemInformation Slot3
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return slot3;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
slot3 = null;
|
||||||
|
Database.SetJewelrySlot3(playerId, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Database.SetJewelrySlot3(playerId, value.Id);
|
||||||
|
slot3 = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Item.ItemInformation Slot4
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return slot4;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
slot4 = null;
|
||||||
|
Database.SetJewelrySlot4(playerId, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Database.SetJewelrySlot4(playerId, value.Id);
|
||||||
|
slot4 = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Item.ItemInformation slot1;
|
||||||
|
private Item.ItemInformation slot2;
|
||||||
|
private Item.ItemInformation slot3;
|
||||||
|
private Item.ItemInformation slot4;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using HISP.Game;
|
using HISP.Game;
|
||||||
using HISP.Server;
|
using HISP.Server;
|
||||||
|
using HISP.Player.Equips;
|
||||||
|
|
||||||
namespace HISP.Player
|
namespace HISP.Player
|
||||||
{
|
{
|
||||||
class User
|
class User
|
||||||
|
@ -14,6 +16,7 @@ namespace HISP.Player
|
||||||
public bool NewPlayer = false;
|
public bool NewPlayer = false;
|
||||||
public GameClient LoggedinClient;
|
public GameClient LoggedinClient;
|
||||||
public CompetitionGear EquipedCompetitionGear;
|
public CompetitionGear EquipedCompetitionGear;
|
||||||
|
public Jewelry EquipedJewelry;
|
||||||
public bool MuteAds = false;
|
public bool MuteAds = false;
|
||||||
public bool MuteGlobal = false;
|
public bool MuteGlobal = false;
|
||||||
public bool MuteIsland = false;
|
public bool MuteIsland = false;
|
||||||
|
@ -40,12 +43,17 @@ namespace HISP.Player
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return freeMinutes;
|
int freeTime = Database.GetFreeTime(Id);
|
||||||
|
if(freeTime > 360)
|
||||||
|
{
|
||||||
|
Database.SetFreeTime(Id, 360);
|
||||||
|
return 360;
|
||||||
|
}
|
||||||
|
return freeTime;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Database.SetFreeTime(Id, value);
|
Database.SetFreeTime(Id, value);
|
||||||
freeMinutes = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool Subscribed
|
public bool Subscribed
|
||||||
|
@ -98,6 +106,7 @@ namespace HISP.Player
|
||||||
chatViolations = value;
|
chatViolations = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ProfilePage {
|
public string ProfilePage {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -105,6 +114,7 @@ namespace HISP.Player
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|
||||||
Database.SetPlayerProfile(value, Id);
|
Database.SetPlayerProfile(value, Id);
|
||||||
profilePage = value;
|
profilePage = value;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +159,7 @@ namespace HISP.Player
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int BankMoney
|
public UInt64 BankMoney
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -201,6 +211,59 @@ namespace HISP.Player
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int Hunger
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return hunger;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value >= 1000)
|
||||||
|
value = 1000;
|
||||||
|
if (value <= 0)
|
||||||
|
value = 0;
|
||||||
|
Database.SetPlayerHunger(Id, value);
|
||||||
|
hunger = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Thirst
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return thirst;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value >= 1000)
|
||||||
|
value = 1000;
|
||||||
|
if (value <= 0)
|
||||||
|
value = 0;
|
||||||
|
Database.SetPlayerHunger(Id, value);
|
||||||
|
thirst = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Tiredness
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return tired;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value >= 1000)
|
||||||
|
value = 1000;
|
||||||
|
if (value <= 0)
|
||||||
|
value = 0;
|
||||||
|
Database.SetPlayerTiredness(Id, value);
|
||||||
|
tired = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private int chatViolations;
|
private int chatViolations;
|
||||||
private int charId;
|
private int charId;
|
||||||
private int subscribedUntil;
|
private int subscribedUntil;
|
||||||
|
@ -210,10 +273,13 @@ namespace HISP.Player
|
||||||
private bool stealth = false;
|
private bool stealth = false;
|
||||||
private int y;
|
private int y;
|
||||||
private int money;
|
private int money;
|
||||||
private int freeMinutes;
|
|
||||||
private int questPoints;
|
private int questPoints;
|
||||||
private int bankMoney;
|
private UInt64 bankMoney;
|
||||||
private int experience;
|
private int experience;
|
||||||
|
private int hunger;
|
||||||
|
private int thirst;
|
||||||
|
private int tired;
|
||||||
|
|
||||||
|
|
||||||
public byte[] SecCodeSeeds = new byte[3];
|
public byte[] SecCodeSeeds = new byte[3];
|
||||||
public int SecCodeInc = 0;
|
public int SecCodeInc = 0;
|
||||||
|
@ -230,6 +296,7 @@ namespace HISP.Player
|
||||||
LoggedinClient.SendPacket(MovementPacket);
|
LoggedinClient.SendPacket(MovementPacket);
|
||||||
GameServer.Update(LoggedinClient);
|
GameServer.Update(LoggedinClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GenerateSecCode()
|
public byte[] GenerateSecCode()
|
||||||
{
|
{
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
@ -249,6 +316,7 @@ namespace HISP.Player
|
||||||
return SecCode;
|
return SecCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public User(GameClient baseClient, int UserId)
|
public User(GameClient baseClient, int UserId)
|
||||||
{
|
{
|
||||||
if (!Database.CheckUserExist(UserId))
|
if (!Database.CheckUserExist(UserId))
|
||||||
|
@ -262,6 +330,7 @@ namespace HISP.Player
|
||||||
|
|
||||||
|
|
||||||
EquipedCompetitionGear = new CompetitionGear(UserId);
|
EquipedCompetitionGear = new CompetitionGear(UserId);
|
||||||
|
EquipedJewelry = new Jewelry(UserId);
|
||||||
|
|
||||||
Id = UserId;
|
Id = UserId;
|
||||||
Username = Database.GetUsername(UserId);
|
Username = Database.GetUsername(UserId);
|
||||||
|
@ -275,7 +344,6 @@ namespace HISP.Player
|
||||||
charId = Database.GetPlayerCharId(UserId);
|
charId = Database.GetPlayerCharId(UserId);
|
||||||
|
|
||||||
Facing = PacketBuilder.DIRECTION_DOWN;
|
Facing = PacketBuilder.DIRECTION_DOWN;
|
||||||
freeMinutes = Database.GetFreeTime(UserId);
|
|
||||||
experience = Database.GetExperience(UserId);
|
experience = Database.GetExperience(UserId);
|
||||||
money = Database.GetPlayerMoney(UserId);
|
money = Database.GetPlayerMoney(UserId);
|
||||||
bankMoney = Database.GetPlayerBankMoney(UserId);
|
bankMoney = Database.GetPlayerBankMoney(UserId);
|
||||||
|
@ -283,6 +351,11 @@ namespace HISP.Player
|
||||||
subscribed = Database.IsUserSubscribed(UserId);
|
subscribed = Database.IsUserSubscribed(UserId);
|
||||||
subscribedUntil = Database.GetUserSubscriptionExpireDate(UserId);
|
subscribedUntil = Database.GetUserSubscriptionExpireDate(UserId);
|
||||||
profilePage = Database.GetPlayerProfile(UserId);
|
profilePage = Database.GetPlayerProfile(UserId);
|
||||||
|
|
||||||
|
hunger = Database.GetPlayerHunger(UserId);
|
||||||
|
thirst = Database.GetPlayerThirst(UserId);
|
||||||
|
tired = Database.GetPlayerTiredness(UserId);
|
||||||
|
|
||||||
Gender = Database.GetGender(UserId);
|
Gender = Database.GetGender(UserId);
|
||||||
MailBox = new Mailbox(this);
|
MailBox = new Mailbox(this);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace HISP.Server
|
||||||
string TrackedQuest = "CREATE TABLE TrackedQuest(playerId INT, questId INT, timesCompleted INT)";
|
string TrackedQuest = "CREATE TABLE TrackedQuest(playerId INT, questId INT, timesCompleted INT)";
|
||||||
string OnlineUsers = "CREATE TABLE OnlineUsers(playerId INT, Admin TEXT(3), Moderator TEXT(3), Subscribed TEXT(3))";
|
string OnlineUsers = "CREATE TABLE OnlineUsers(playerId INT, Admin TEXT(3), Moderator TEXT(3), Subscribed TEXT(3))";
|
||||||
string CompetitionGear = "CREATE TABLE CompetitionGear(playerId INT, headItem INT, bodyItem INT, legItem INT, feetItem INT)";
|
string CompetitionGear = "CREATE TABLE CompetitionGear(playerId INT, headItem INT, bodyItem INT, legItem INT, feetItem INT)";
|
||||||
|
string Jewelry = "CREATE TABLE Jewelry(playerId INT, slot1 INT, slot2 INT, slot3 INT, slot4 INT)";
|
||||||
string DeleteOnlineUsers = "DELETE FROM OnlineUsers";
|
string DeleteOnlineUsers = "DELETE FROM OnlineUsers";
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +82,19 @@ namespace HISP.Server
|
||||||
Logger.WarnPrint(e.Message);
|
Logger.WarnPrint(e.Message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
sqlCommand.CommandText = Jewelry;
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.WarnPrint(e.Message);
|
||||||
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -312,6 +326,168 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool HasJewelry(int playerId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "SELECT COUNT(1) FROM jewelry WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
int timesComplete = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
return timesComplete > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InitJewelry(int playerId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "INSERT INTO jewelry VALUES(@playerId,0,0,0,0)";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetJewelrySlot1(int playerId, int itemId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "UPDATE jewelry SET slot1=@itemId WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
sqlCommand.Parameters.AddWithValue("@itemId", itemId);
|
||||||
|
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int GetJewelrySlot1(int playerId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "SELECT slot1 FROM jewelry WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
int timesComplete = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
return timesComplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetJewelrySlot2(int playerId, int itemId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "UPDATE jewelry SET slot2=@itemId WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
sqlCommand.Parameters.AddWithValue("@itemId", itemId);
|
||||||
|
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int GetJewelrySlot2(int playerId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "SELECT slot2 FROM jewelry WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
int timesComplete = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
return timesComplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void SetJewelrySlot3(int playerId, int itemId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "UPDATE jewelry SET slot3=@itemId WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
sqlCommand.Parameters.AddWithValue("@itemId", itemId);
|
||||||
|
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int GetJewelrySlot3(int playerId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "SELECT slot3 FROM jewelry WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
int timesComplete = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
return timesComplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetJewelrySlot4(int playerId, int itemId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "UPDATE jewelry SET slot4=@itemId WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
sqlCommand.Parameters.AddWithValue("@itemId", itemId);
|
||||||
|
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int GetJewelrySlot4(int playerId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "SELECT slot4 FROM jewelry WHERE playerId=@playerId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
int timesComplete = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
return timesComplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static bool HasCompetitionGear(int playerId)
|
public static bool HasCompetitionGear(int playerId)
|
||||||
{
|
{
|
||||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
@ -630,6 +806,20 @@ namespace HISP.Server
|
||||||
sqlCommand.Dispose();
|
sqlCommand.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void IncAllUsersFreeTime(int minutes)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
|
||||||
|
sqlCommand.CommandText = "UPDATE userExt SET FreeMinutes=FreeMinutes+@minutes";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@minutes", minutes);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
public static void SetFreeTime(int playerId, int minutes)
|
public static void SetFreeTime(int playerId, int minutes)
|
||||||
{
|
{
|
||||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
@ -1432,6 +1622,148 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int GetPlayerTiredness(int userId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
if (CheckUserExtExists(userId))
|
||||||
|
{
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
sqlCommand.CommandText = "SELECT Tiredness FROM UserExt WHERE Id=@id";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@id", userId);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
int tiredness = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||||
|
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
return tiredness;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new KeyNotFoundException("Id " + userId + " not found in database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetPlayerTiredness(int id, int tiredness)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
if (CheckUserExist(id))
|
||||||
|
{
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
sqlCommand.CommandText = "UPDATE UserExt SET Tiredness=@tiredness WHERE Id=@id";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@tiredness", tiredness);
|
||||||
|
sqlCommand.Parameters.AddWithValue("@id", id);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new KeyNotFoundException("Id " + id + " not found in database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetPlayerHunger(int id, int hunger)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
if (CheckUserExist(id))
|
||||||
|
{
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
sqlCommand.CommandText = "UPDATE UserExt SET Hunger=@hunger WHERE Id=@id";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@Hunger", hunger);
|
||||||
|
sqlCommand.Parameters.AddWithValue("@id", id);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new KeyNotFoundException("Id " + id + " not found in database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static int GetPlayerHunger(int userId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
if (CheckUserExtExists(userId))
|
||||||
|
{
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
sqlCommand.CommandText = "SELECT Hunger FROM UserExt WHERE Id=@id";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@id", userId);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
int hunger = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||||
|
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
return hunger;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new KeyNotFoundException("Id " + userId + " not found in database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetPlayerThirst(int id, int thirst)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
if (CheckUserExist(id))
|
||||||
|
{
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
sqlCommand.CommandText = "UPDATE UserExt SET Thirst=@thirst WHERE Id=@id";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@thirst", thirst);
|
||||||
|
sqlCommand.Parameters.AddWithValue("@id", id);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new KeyNotFoundException("Id " + id + " not found in database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GetPlayerThirst(int userId)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
if (CheckUserExtExists(userId))
|
||||||
|
{
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
sqlCommand.CommandText = "SELECT Thirst FROM UserExt WHERE Id=@id";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@id", userId);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
int tiredness = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||||
|
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
return tiredness;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new KeyNotFoundException("Id " + userId + " not found in database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int GetPlayerMoney(int userId)
|
public static int GetPlayerMoney(int userId)
|
||||||
{
|
{
|
||||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
@ -1455,7 +1787,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetPlayerBankMoney(int userId)
|
public static UInt64 GetPlayerBankMoney(int userId)
|
||||||
{
|
{
|
||||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
{
|
{
|
||||||
|
@ -1466,7 +1798,7 @@ namespace HISP.Server
|
||||||
sqlCommand.CommandText = "SELECT BankBalance FROM UserExt WHERE Id=@id";
|
sqlCommand.CommandText = "SELECT BankBalance FROM UserExt WHERE Id=@id";
|
||||||
sqlCommand.Parameters.AddWithValue("@id", userId);
|
sqlCommand.Parameters.AddWithValue("@id", userId);
|
||||||
sqlCommand.Prepare();
|
sqlCommand.Prepare();
|
||||||
int BankMoney = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
UInt64 BankMoney = Convert.ToUInt64(sqlCommand.ExecuteScalar());
|
||||||
|
|
||||||
sqlCommand.Dispose();
|
sqlCommand.Dispose();
|
||||||
return BankMoney;
|
return BankMoney;
|
||||||
|
@ -1478,7 +1810,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetPlayerBankMoney(int bankMoney, int id)
|
public static void SetPlayerBankMoney(UInt64 bankMoney, int id)
|
||||||
{
|
{
|
||||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,15 +23,53 @@ namespace HISP.Server
|
||||||
|
|
||||||
private Timer warnTimer;
|
private Timer warnTimer;
|
||||||
private Timer kickTimer;
|
private Timer kickTimer;
|
||||||
|
private Timer minuteTimer;
|
||||||
|
|
||||||
|
|
||||||
private int keepAliveInterval = 60 * 1000;
|
private int keepAliveInterval = 60 * 1000;
|
||||||
private int updateInterval = 60 * 1000;
|
private int updateInterval = 60 * 1000;
|
||||||
|
|
||||||
|
private int totalMinutesElapsed = 0;
|
||||||
|
private int oneMinute = 60 * 1000;
|
||||||
private int warnInterval = GameServer.IdleWarning * 60 * 1000;
|
private int warnInterval = GameServer.IdleWarning * 60 * 1000;
|
||||||
private int kickInterval = GameServer.IdleTimeout * 60 * 1000;
|
private int kickInterval = GameServer.IdleTimeout * 60 * 1000;
|
||||||
|
|
||||||
|
private void minuteTimerTick(object state)
|
||||||
|
{
|
||||||
|
totalMinutesElapsed++;
|
||||||
|
if (LoggedIn)
|
||||||
|
{
|
||||||
|
LoggedinUser.FreeMinutes -= 1;
|
||||||
|
if (LoggedinUser.FreeMinutes <= 0)
|
||||||
|
{
|
||||||
|
LoggedinUser.FreeMinutes = 0;
|
||||||
|
if (!LoggedinUser.Subscribed && !LoggedinUser.Moderator && !LoggedinUser.Administrator)
|
||||||
|
Kick(Messages.KickReasonNoTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// unsure of actural timings, would be more or less impossible to know
|
||||||
|
// without the original source code :(
|
||||||
|
// From testing hunger seemed to go down fastest, then thirst, and finally tiredness.
|
||||||
|
|
||||||
|
|
||||||
|
if(totalMinutesElapsed % 1 == 0)
|
||||||
|
{
|
||||||
|
LoggedinUser.Hunger -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalMinutesElapsed % 5 == 0)
|
||||||
|
{
|
||||||
|
LoggedinUser.Thirst -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalMinutesElapsed % 10 == 0)
|
||||||
|
{
|
||||||
|
LoggedinUser.Tiredness -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
minuteTimer.Change(oneMinute, oneMinute);
|
||||||
|
}
|
||||||
private void keepAliveTimerTick(object state)
|
private void keepAliveTimerTick(object state)
|
||||||
{
|
{
|
||||||
Logger.DebugPrint("Sending keep-alive packet to "+ LoggedinUser.Username);
|
Logger.DebugPrint("Sending keep-alive packet to "+ LoggedinUser.Username);
|
||||||
|
@ -67,7 +105,7 @@ namespace HISP.Server
|
||||||
if(Client.LoggedIn)
|
if(Client.LoggedIn)
|
||||||
{
|
{
|
||||||
if (Client.LoggedinUser.Id == id)
|
if (Client.LoggedinUser.Id == id)
|
||||||
Client.Kick(Messages.DuplicateLogin);
|
Client.Kick(Messages.KickReasonDuplicateLogin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,6 +285,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
kickTimer = new Timer(new TimerCallback(kickTimerTick), null, kickInterval, kickInterval);
|
kickTimer = new Timer(new TimerCallback(kickTimerTick), null, kickInterval, kickInterval);
|
||||||
warnTimer = new Timer(new TimerCallback(warnTimerTick), null, warnInterval, warnInterval);
|
warnTimer = new Timer(new TimerCallback(warnTimerTick), null, warnInterval, warnInterval);
|
||||||
|
minuteTimer = new Timer(new TimerCallback(minuteTimerTick), null, oneMinute, oneMinute);
|
||||||
|
|
||||||
recvPackets = new Thread(() =>
|
recvPackets = new Thread(() =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -407,6 +407,11 @@ namespace HISP.Server
|
||||||
Messages.StatsJewelFormat = gameData.messages.meta.stats_page.stats_equipped;
|
Messages.StatsJewelFormat = gameData.messages.meta.stats_page.stats_equipped;
|
||||||
Messages.StatsCompetitionGearFormat = gameData.messages.meta.stats_page.stats_competion_gear;
|
Messages.StatsCompetitionGearFormat = gameData.messages.meta.stats_page.stats_competion_gear;
|
||||||
|
|
||||||
|
Messages.JewelrySlot1Format = gameData.messages.meta.stats_page.jewelry.slot_1;
|
||||||
|
Messages.JewelrySlot2Format = gameData.messages.meta.stats_page.jewelry.slot_2;
|
||||||
|
Messages.JewelrySlot3Format = gameData.messages.meta.stats_page.jewelry.slot_3;
|
||||||
|
Messages.JewelrySlot4Format = gameData.messages.meta.stats_page.jewelry.slot_4;
|
||||||
|
|
||||||
Messages.CompetitionGearHeadFormat = gameData.messages.meta.stats_page.competition_gear.head_format;
|
Messages.CompetitionGearHeadFormat = gameData.messages.meta.stats_page.competition_gear.head_format;
|
||||||
Messages.CompetitionGearBodyFormat = gameData.messages.meta.stats_page.competition_gear.body_format;
|
Messages.CompetitionGearBodyFormat = gameData.messages.meta.stats_page.competition_gear.body_format;
|
||||||
Messages.CompetitionGearLegsFormat = gameData.messages.meta.stats_page.competition_gear.legs_format;
|
Messages.CompetitionGearLegsFormat = gameData.messages.meta.stats_page.competition_gear.legs_format;
|
||||||
|
@ -418,11 +423,17 @@ namespace HISP.Server
|
||||||
Messages.StatsAwards = gameData.messages.meta.stats_page.stats_awards;
|
Messages.StatsAwards = gameData.messages.meta.stats_page.stats_awards;
|
||||||
Messages.StatsMisc = gameData.messages.meta.stats_page.stats_misc;
|
Messages.StatsMisc = gameData.messages.meta.stats_page.stats_misc;
|
||||||
|
|
||||||
|
Messages.JewelrySelected = gameData.messages.meta.stats_page.msg.jewelry_selected;
|
||||||
Messages.NoJewerlyEquipped = gameData.messages.meta.stats_page.msg.no_jewelry_equipped;
|
Messages.NoJewerlyEquipped = gameData.messages.meta.stats_page.msg.no_jewelry_equipped;
|
||||||
Messages.NoCompetitionGear = gameData.messages.meta.stats_page.msg.no_competition_gear;
|
Messages.NoCompetitionGear = gameData.messages.meta.stats_page.msg.no_competition_gear;
|
||||||
Messages.CompetitionGearSelected = gameData.messages.meta.stats_page.msg.competition_gear_selected;
|
Messages.CompetitionGearSelected = gameData.messages.meta.stats_page.msg.competition_gear_selected;
|
||||||
|
|
||||||
|
Messages.StatHunger = gameData.messages.meta.stats_page.hunger_stat_name;
|
||||||
|
Messages.StatThirst = gameData.messages.meta.stats_page.thirst_stat_name;
|
||||||
|
Messages.StatTired = gameData.messages.meta.stats_page.tired_stat_name;
|
||||||
|
|
||||||
|
Messages.StatPlayerFormats = gameData.messages.meta.stats_page.player_stats.ToObject<string[]>();
|
||||||
|
Messages.RandomMovement = gameData.messages.random_movement;
|
||||||
// Transport
|
// Transport
|
||||||
|
|
||||||
Messages.CantAffordTransport = gameData.messages.transport.not_enough_money;
|
Messages.CantAffordTransport = gameData.messages.transport.not_enough_money;
|
||||||
|
@ -579,10 +590,11 @@ namespace HISP.Server
|
||||||
|
|
||||||
// Disconnect Reasons
|
// Disconnect Reasons
|
||||||
|
|
||||||
Messages.BanMessage = gameData.messages.disconnect.banned;
|
Messages.KickReasonBanned = gameData.messages.disconnect.banned;
|
||||||
Messages.IdleKickMessageFormat = gameData.messages.disconnect.client_timeout.kick_message;
|
Messages.KickReasonIdleFormat = gameData.messages.disconnect.client_timeout.kick_message;
|
||||||
|
Messages.KickReasonNoTime = gameData.messages.disconnect.no_playtime;
|
||||||
Messages.IdleWarningFormat = gameData.messages.disconnect.client_timeout.warn_message;
|
Messages.IdleWarningFormat = gameData.messages.disconnect.client_timeout.warn_message;
|
||||||
Messages.DuplicateLogin = gameData.messages.disconnect.dupe_login;
|
Messages.KickReasonDuplicateLogin = gameData.messages.disconnect.dupe_login;
|
||||||
|
|
||||||
Chat.PrivateMessageSound = gameData.messages.chat.pm_sound;
|
Chat.PrivateMessageSound = gameData.messages.chat.pm_sound;
|
||||||
|
|
||||||
|
@ -595,8 +607,13 @@ namespace HISP.Server
|
||||||
|
|
||||||
// Competition Gear
|
// Competition Gear
|
||||||
|
|
||||||
Messages.EquipItemFormat = gameData.messages.competition_gear.equip_competition_gear_format;
|
Messages.EquipCompetitionGearFormat = gameData.messages.equips.equip_competition_gear_format;
|
||||||
Messages.UnequipItem = gameData.messages.competition_gear.removed_competition_gear;
|
Messages.RemoveCompetitionGear = gameData.messages.equips.removed_competition_gear;
|
||||||
|
|
||||||
|
// Jewerly
|
||||||
|
Messages.EquipJewelryFormat = gameData.messages.equips.equip_jewelry;
|
||||||
|
Messages.MaxJewelryMessage = gameData.messages.equips.max_jewelry;
|
||||||
|
Messages.RemoveJewelry = gameData.messages.equips.removed_jewelry;
|
||||||
|
|
||||||
// Click
|
// Click
|
||||||
Messages.NothingInterestingHere = gameData.messages.click_nothing_message;
|
Messages.NothingInterestingHere = gameData.messages.click_nothing_message;
|
||||||
|
|
|
@ -9,6 +9,7 @@ using HISP.Player;
|
||||||
using HISP.Game;
|
using HISP.Game;
|
||||||
using HISP.Security;
|
using HISP.Security;
|
||||||
using HISP.Game.Chat;
|
using HISP.Game.Chat;
|
||||||
|
using HISP.Player.Equips;
|
||||||
|
|
||||||
namespace HISP.Server
|
namespace HISP.Server
|
||||||
{
|
{
|
||||||
|
@ -33,17 +34,29 @@ namespace HISP.Server
|
||||||
* Private stuff
|
* Private stuff
|
||||||
*/
|
*/
|
||||||
private static int gameTickSpeed = 4320; // Changing this to ANYTHING else will cause desync with the client.
|
private static int gameTickSpeed = 4320; // Changing this to ANYTHING else will cause desync with the client.
|
||||||
|
private static int totalMinutesElapsed = 0;
|
||||||
|
private static int oneMinute = 1000 * 60; // Change ONLY if you want minutely events to happen more frequently.
|
||||||
private static List<GameClient> connectedClients = new List<GameClient>();
|
private static List<GameClient> connectedClients = new List<GameClient>();
|
||||||
private static Timer serverTimer;
|
private static Timer gameTimer; // Controls in-game time.
|
||||||
private static void onTick(object state)
|
private static Timer minuteTimer; // ticks every real world minute.
|
||||||
|
private static void onGameTick(object state)
|
||||||
{
|
{
|
||||||
World.TickWorldClock();
|
World.TickWorldClock();
|
||||||
|
|
||||||
if (World.ServerTime.Minutes % 30 == 0)
|
gameTimer.Change(gameTickSpeed, gameTickSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void onMinuteTick(object state)
|
||||||
|
{
|
||||||
|
totalMinutesElapsed++;
|
||||||
|
|
||||||
|
if(totalMinutesElapsed % 8 == 0)
|
||||||
{
|
{
|
||||||
DroppedItems.Update();
|
Database.IncAllUsersFreeTime(1);
|
||||||
}
|
}
|
||||||
serverTimer.Change(gameTickSpeed, gameTickSpeed);
|
|
||||||
|
DroppedItems.Update();
|
||||||
|
minuteTimer.Change(oneMinute, oneMinute);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -304,7 +317,42 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
User loggedInUser = sender.LoggedinUser;
|
User loggedInUser = sender.LoggedinUser;
|
||||||
byte movementDirection = packet[1];
|
byte movementDirection = packet[1];
|
||||||
|
|
||||||
|
if (loggedInUser.Thirst <= 25 || loggedInUser.Hunger == 25 || loggedInUser.Tiredness == 25)
|
||||||
|
{
|
||||||
|
if (RandomNumberGenerator.Next(0, 15) == 10)
|
||||||
|
{
|
||||||
|
byte[] possibleDirections = new byte[] { PacketBuilder.MOVE_UP, PacketBuilder.MOVE_DOWN, PacketBuilder.MOVE_RIGHT, PacketBuilder.MOVE_LEFT };
|
||||||
|
|
||||||
|
if (possibleDirections.Contains(movementDirection))
|
||||||
|
{
|
||||||
|
byte newDirection = possibleDirections[RandomNumberGenerator.Next(0, possibleDirections.Length)];
|
||||||
|
if (newDirection != movementDirection)
|
||||||
|
{
|
||||||
|
movementDirection = newDirection;
|
||||||
|
if (loggedInUser.Thirst <= 25)
|
||||||
|
{
|
||||||
|
byte[] chatMessage = PacketBuilder.CreateChat(Messages.FormatRandomMovementMessage(Messages.StatThirst.ToUpper()), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(chatMessage);
|
||||||
|
}
|
||||||
|
else if (loggedInUser.Hunger <= 25)
|
||||||
|
{
|
||||||
|
byte[] chatMessage = PacketBuilder.CreateChat(Messages.FormatRandomMovementMessage(Messages.StatHunger.ToUpper()), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(chatMessage);
|
||||||
|
}
|
||||||
|
else if (loggedInUser.Tiredness <= 25)
|
||||||
|
{
|
||||||
|
byte[] chatMessage = PacketBuilder.CreateChat(Messages.FormatRandomMovementMessage(Messages.StatTired.ToUpper()), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(chatMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (movementDirection == PacketBuilder.MOVE_ESCAPE)
|
if (movementDirection == PacketBuilder.MOVE_ESCAPE)
|
||||||
{
|
{
|
||||||
|
@ -358,6 +406,8 @@ namespace HISP.Server
|
||||||
|
|
||||||
if (movementDirection == PacketBuilder.MOVE_UP)
|
if (movementDirection == PacketBuilder.MOVE_UP)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
loggedInUser.Facing = PacketBuilder.DIRECTION_UP;
|
loggedInUser.Facing = PacketBuilder.DIRECTION_UP;
|
||||||
if (Map.CheckPassable(loggedInUser.X, loggedInUser.Y - 1))
|
if (Map.CheckPassable(loggedInUser.X, loggedInUser.Y - 1))
|
||||||
{
|
{
|
||||||
|
@ -847,14 +897,70 @@ namespace HISP.Server
|
||||||
Logger.HackerPrint(sender.LoggedinUser.Username + " Attempted to remove competition gear when none was equipped.");
|
Logger.HackerPrint(sender.LoggedinUser.Username + " Attempted to remove competition gear when none was equipped.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case '5':
|
||||||
|
if (sender.LoggedinUser.EquipedJewelry.Slot1 != null)
|
||||||
|
{
|
||||||
|
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedJewelry.Slot1.Id);
|
||||||
|
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
||||||
|
sender.LoggedinUser.EquipedJewelry.Slot1 = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.HackerPrint(sender.LoggedinUser.Username + " Attempted to remove jewery when none was equipped.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '6':
|
||||||
|
if (sender.LoggedinUser.EquipedJewelry.Slot2 != null)
|
||||||
|
{
|
||||||
|
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedJewelry.Slot2.Id);
|
||||||
|
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
||||||
|
sender.LoggedinUser.EquipedJewelry.Slot2 = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.HackerPrint(sender.LoggedinUser.Username + " Attempted to remove jewery when none was equipped.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '7':
|
||||||
|
if (sender.LoggedinUser.EquipedJewelry.Slot3 != null)
|
||||||
|
{
|
||||||
|
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedJewelry.Slot3.Id);
|
||||||
|
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
||||||
|
sender.LoggedinUser.EquipedJewelry.Slot3 = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.HackerPrint(sender.LoggedinUser.Username + " Attempted to remove jewery when none was equipped.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '8':
|
||||||
|
if (sender.LoggedinUser.EquipedJewelry.Slot4 != null)
|
||||||
|
{
|
||||||
|
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedJewelry.Slot4.Id);
|
||||||
|
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
||||||
|
sender.LoggedinUser.EquipedJewelry.Slot4 = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.HackerPrint(sender.LoggedinUser.Username + " Attempted to remove jewery when none was equipped.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Logger.InfoPrint(sender.LoggedinUser.Username + "Unimplemented \"remove worn item\" ItemInteraction packet: " + BitConverter.ToString(packet).Replace("-", " "));
|
Logger.InfoPrint(sender.LoggedinUser.Username + "Unimplemented \"remove worn item\" ItemInteraction packet: " + BitConverter.ToString(packet).Replace("-", " "));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStats(sender);
|
UpdateStats(sender);
|
||||||
byte[] itemRemovedMessage = PacketBuilder.CreateChat(Messages.UnequipItem, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
if(toRemove >= '1' && toRemove <= '4')
|
||||||
sender.SendPacket(itemRemovedMessage);
|
{
|
||||||
|
byte[] itemRemovedMessage = PacketBuilder.CreateChat(Messages.RemoveCompetitionGear, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(itemRemovedMessage);
|
||||||
|
}
|
||||||
|
else if (toRemove >= '5' && toRemove <= '8')
|
||||||
|
{
|
||||||
|
byte[] itemRemovedMessage = PacketBuilder.CreateChat(Messages.RemoveJewelry, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(itemRemovedMessage);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_WEAR:
|
case PacketBuilder.ITEM_WEAR:
|
||||||
|
@ -875,62 +981,100 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
InventoryItem itm = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId);
|
InventoryItem itm = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId);
|
||||||
ItemInstance instance = itm.ItemInstances[0];
|
ItemInstance instance = itm.ItemInstances[0];
|
||||||
sender.LoggedinUser.Inventory.Remove(instance);
|
|
||||||
|
|
||||||
Item.ItemInformation itemInf = instance.GetItemInfo();
|
Item.ItemInformation itemInf = instance.GetItemInfo();
|
||||||
if(itemInf.MiscFlags.Length <= 0)
|
if(itemInf.Type == "CLOTHES")
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(itemInf.Name + " Has no misc flags.");
|
if (itemInf.MiscFlags.Length <= 0)
|
||||||
}
|
{
|
||||||
switch(itemInf.MiscFlags[0])
|
Logger.ErrorPrint(itemInf.Name + " Has no misc flags.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (itemInf.MiscFlags[0])
|
||||||
|
{
|
||||||
|
case CompetitionGear.MISC_FLAG_HEAD:
|
||||||
|
if (sender.LoggedinUser.EquipedCompetitionGear.Head == null)
|
||||||
|
sender.LoggedinUser.EquipedCompetitionGear.Head = itemInf;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedCompetitionGear.Head.Id);
|
||||||
|
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
||||||
|
sender.LoggedinUser.EquipedCompetitionGear.Head = itemInf;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CompetitionGear.MISC_FLAG_BODY:
|
||||||
|
if (sender.LoggedinUser.EquipedCompetitionGear.Body == null)
|
||||||
|
sender.LoggedinUser.EquipedCompetitionGear.Body = itemInf;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedCompetitionGear.Body.Id);
|
||||||
|
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
||||||
|
sender.LoggedinUser.EquipedCompetitionGear.Body = itemInf;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CompetitionGear.MISC_FLAG_LEGS:
|
||||||
|
if (sender.LoggedinUser.EquipedCompetitionGear.Legs == null)
|
||||||
|
sender.LoggedinUser.EquipedCompetitionGear.Legs = itemInf;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedCompetitionGear.Legs.Id);
|
||||||
|
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
||||||
|
sender.LoggedinUser.EquipedCompetitionGear.Legs = itemInf;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CompetitionGear.MISC_FLAG_FEET:
|
||||||
|
if (sender.LoggedinUser.EquipedCompetitionGear.Feet == null)
|
||||||
|
sender.LoggedinUser.EquipedCompetitionGear.Feet = itemInf;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedCompetitionGear.Feet.Id);
|
||||||
|
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
||||||
|
sender.LoggedinUser.EquipedCompetitionGear.Feet = itemInf;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sender.LoggedinUser.Inventory.Remove(instance);
|
||||||
|
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatEquipCompetitionGearMessage(itemInf.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(chatPacket);
|
||||||
|
}
|
||||||
|
else if(itemInf.Type == "JEWELRY")
|
||||||
{
|
{
|
||||||
case CompetitionGear.MISC_FLAG_HEAD:
|
bool addedJewelry = false;
|
||||||
if(sender.LoggedinUser.EquipedCompetitionGear.Head == null)
|
if (sender.LoggedinUser.EquipedJewelry.Slot1 == null)
|
||||||
sender.LoggedinUser.EquipedCompetitionGear.Head = itemInf;
|
{
|
||||||
else
|
sender.LoggedinUser.EquipedJewelry.Slot1 = itemInf;
|
||||||
{
|
addedJewelry = true;
|
||||||
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedCompetitionGear.Head.Id);
|
}
|
||||||
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
else if (sender.LoggedinUser.EquipedJewelry.Slot2 == null)
|
||||||
sender.LoggedinUser.EquipedCompetitionGear.Head = itemInf;
|
{
|
||||||
}
|
sender.LoggedinUser.EquipedJewelry.Slot2 = itemInf;
|
||||||
break;
|
addedJewelry = true;
|
||||||
case CompetitionGear.MISC_FLAG_BODY:
|
}
|
||||||
if (sender.LoggedinUser.EquipedCompetitionGear.Body == null)
|
else if (sender.LoggedinUser.EquipedJewelry.Slot3 == null)
|
||||||
sender.LoggedinUser.EquipedCompetitionGear.Body = itemInf;
|
{
|
||||||
else
|
sender.LoggedinUser.EquipedJewelry.Slot3 = itemInf;
|
||||||
{
|
addedJewelry = true;
|
||||||
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedCompetitionGear.Body.Id);
|
}
|
||||||
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
else if (sender.LoggedinUser.EquipedJewelry.Slot4 == null)
|
||||||
sender.LoggedinUser.EquipedCompetitionGear.Body = itemInf;
|
{
|
||||||
}
|
sender.LoggedinUser.EquipedJewelry.Slot4 = itemInf;
|
||||||
break;
|
addedJewelry = true;
|
||||||
case CompetitionGear.MISC_FLAG_LEGS:
|
}
|
||||||
if (sender.LoggedinUser.EquipedCompetitionGear.Legs == null)
|
|
||||||
sender.LoggedinUser.EquipedCompetitionGear.Legs = itemInf;
|
if(addedJewelry)
|
||||||
else
|
{
|
||||||
{
|
sender.LoggedinUser.Inventory.Remove(instance);
|
||||||
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedCompetitionGear.Legs.Id);
|
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatJewerlyEquipMessage(itemInf.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
sender.SendPacket(chatPacket);
|
||||||
sender.LoggedinUser.EquipedCompetitionGear.Legs = itemInf;
|
}
|
||||||
}
|
else
|
||||||
break;
|
{
|
||||||
case CompetitionGear.MISC_FLAG_FEET:
|
byte[] chatPacket = PacketBuilder.CreateChat(Messages.MaxJewelryMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
if (sender.LoggedinUser.EquipedCompetitionGear.Feet == null)
|
sender.SendPacket(chatPacket);
|
||||||
sender.LoggedinUser.EquipedCompetitionGear.Feet = itemInf;
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ItemInstance itemInstance = new ItemInstance(sender.LoggedinUser.EquipedCompetitionGear.Feet.Id);
|
|
||||||
sender.LoggedinUser.Inventory.AddIgnoringFull(itemInstance);
|
|
||||||
sender.LoggedinUser.EquipedCompetitionGear.Feet = itemInf;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatEquipItemMessage(itemInf.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
|
||||||
sender.SendPacket(chatPacket);
|
|
||||||
UpdateInventory(sender);
|
UpdateInventory(sender);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1437,7 +1581,6 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
return usersHere.ToArray();
|
return usersHere.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static User GetUserByName(string username)
|
public static User GetUserByName(string username)
|
||||||
{
|
{
|
||||||
foreach(GameClient client in ConnectedClients)
|
foreach(GameClient client in ConnectedClients)
|
||||||
|
@ -1450,7 +1593,6 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
throw new KeyNotFoundException("User was not found.");
|
throw new KeyNotFoundException("User was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static User[] GetNearbyUsers(int x, int y, bool includeStealth=false, bool includeMuted=false)
|
public static User[] GetNearbyUsers(int x, int y, bool includeStealth=false, bool includeMuted=false)
|
||||||
{
|
{
|
||||||
int startX = x - 15;
|
int startX = x - 15;
|
||||||
|
@ -1497,7 +1639,6 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetNumberOfAdminsOnline()
|
public static int GetNumberOfAdminsOnline()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -1662,7 +1803,8 @@ namespace HISP.Server
|
||||||
ServerSocket.Bind(ep);
|
ServerSocket.Bind(ep);
|
||||||
Logger.InfoPrint("Binding to ip: " + ConfigReader.BindIP + " On port: " + ConfigReader.Port.ToString());
|
Logger.InfoPrint("Binding to ip: " + ConfigReader.BindIP + " On port: " + ConfigReader.Port.ToString());
|
||||||
ServerSocket.Listen(10000);
|
ServerSocket.Listen(10000);
|
||||||
serverTimer = new Timer(new TimerCallback(onTick), null, gameTickSpeed, gameTickSpeed);
|
gameTimer = new Timer(new TimerCallback(onGameTick), null, gameTickSpeed, gameTickSpeed);
|
||||||
|
minuteTimer = new Timer(new TimerCallback(onMinuteTick), null, oneMinute, oneMinute);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Logger.InfoPrint("Waiting for new connections...");
|
Logger.InfoPrint("Waiting for new connections...");
|
||||||
|
|
Loading…
Add table
Reference in a new issue