mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
"Players Here" shows up, but doesnt do anything
This commit is contained in:
parent
bd18415bbf
commit
c3585b655a
7 changed files with 157 additions and 12 deletions
|
@ -216,14 +216,15 @@
|
|||
"last_poet":"^R1^LLast Player Poet:%USERNAME% ^R1",
|
||||
"hammock":"You and all of your horses have fully rested.",
|
||||
"player_interaction":{
|
||||
"players_here":"<B>Players Here:</B>",
|
||||
"menu":"^I%PLAYERICON%^T1%PLAYERNAME%%BUTTONS%^R1",
|
||||
"queston_button":"^B1L%PLAYERID%",
|
||||
"multiple_players_menu":"^B5AHUG^B5BDOG PILE^B5CDANCE^B5DHUDDLE^B5EHOWL^R1",
|
||||
"profiile_button":"^B1L%PLAYERID%",
|
||||
"social_button":"^B1S%PLAYERID%",
|
||||
"trade_button":"^B1T%PLAYERID%",
|
||||
"buddy_button":"^B1B%PLAYERID%",
|
||||
"tag_button":"^B1X%PLAYERID%",
|
||||
"pm_button":"^B1P%PLAYERNAME%",
|
||||
"multiple_players_menu":"^B5AHUG^B5BDOG PILE^B5CDANCE^B5DHUDDLE^B5EHOWL^R1",
|
||||
"trade":{
|
||||
"trading_with":"^ATTrading with %PLAYERNAME%^H",
|
||||
|
||||
|
|
|
@ -13,6 +13,18 @@ namespace HISP.Game
|
|||
// Mod isle
|
||||
public static string ModIsleMessage;
|
||||
|
||||
// Player Interaction
|
||||
public static string PlayerHereMenuFormat;
|
||||
public static string PlayerHereMulitpleMenuFormat;
|
||||
|
||||
public static string PlayerHereProfileButton;
|
||||
public static string PlayerHereSocialButton;
|
||||
public static string PlayerHereTradeButton;
|
||||
public static string PlayerHereAddBuddyButton;
|
||||
public static string PlayerHereTagButton;
|
||||
|
||||
public static string PlayerHerePmButton;
|
||||
|
||||
// Auction House
|
||||
public static string AuctionsRunning;
|
||||
public static string AuctionHorseEntryFormat;
|
||||
|
@ -56,7 +68,7 @@ namespace HISP.Game
|
|||
public static string FailedToUnderstandLocation;
|
||||
|
||||
// Click
|
||||
public static string PlayerHereFormat;
|
||||
public static string ClickPlayerHereFormat;
|
||||
|
||||
// Hammock
|
||||
public static string HammockText;
|
||||
|
@ -804,6 +816,7 @@ namespace HISP.Game
|
|||
public static string TownFormat;
|
||||
public static string AreaFormat;
|
||||
public static string LocationFormat;
|
||||
public static string PlayersHere;
|
||||
public static string NearbyPlayers;
|
||||
public static string North;
|
||||
public static string East;
|
||||
|
@ -900,6 +913,38 @@ namespace HISP.Game
|
|||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
|
||||
// Player Interactions
|
||||
public static string FormatPlayerHerePMButton(string playerName)
|
||||
{
|
||||
return PlayerHerePmButton.Replace("%PLAYERNAME%", playerName);
|
||||
}
|
||||
public static string FormatPlayerHereTagButton(int playerId)
|
||||
{
|
||||
return PlayerHereTagButton.Replace("%PLAYERID%", playerId.ToString());
|
||||
}
|
||||
public static string FormatPlayerHereBuddyButton(int playerId)
|
||||
{
|
||||
return PlayerHereAddBuddyButton.Replace("%PLAYERID%", playerId.ToString());
|
||||
}
|
||||
public static string FormatPlayerHereTradeButton(int playerId)
|
||||
{
|
||||
return PlayerHereTradeButton.Replace("%PLAYERID%", playerId.ToString());
|
||||
}
|
||||
public static string FormatPlayerHereSocialButtton(int playerId)
|
||||
{
|
||||
return PlayerHereSocialButton.Replace("%PLAYERID%", playerId.ToString());
|
||||
}
|
||||
public static string FormatPlayerHereProfileButton(int playerId)
|
||||
{
|
||||
return PlayerHereProfileButton.Replace("%PLAYERID%", playerId.ToString());
|
||||
}
|
||||
public static string FormatPlayerHereMenu(int playerIcon, string playerName, string button)
|
||||
{
|
||||
return PlayerHereMenuFormat.Replace("%PLAYERICON%", playerIcon.ToString()).Replace("%PLAYERNAME%", playerName).Replace("%BUTTONS%", button);
|
||||
}
|
||||
|
||||
// Auctions
|
||||
public static string FormatAuctionSoldTo(string playerName, int money)
|
||||
{
|
||||
return AuctionSoldToFormat.Replace("%PLAYERNAME%", playerName).Replace("%PRICE%", money.ToString("N0", CultureInfo.InvariantCulture));
|
||||
|
@ -1115,7 +1160,7 @@ namespace HISP.Game
|
|||
|
||||
public static string FormatPlayerHereMessage(string playerName)
|
||||
{
|
||||
return PlayerHereFormat.Replace("%USERNAME%", playerName);
|
||||
return ClickPlayerHereFormat.Replace("%USERNAME%", playerName);
|
||||
}
|
||||
|
||||
// Barn Formats
|
||||
|
|
|
@ -35,12 +35,48 @@ namespace HISP.Game
|
|||
return locationString;
|
||||
}
|
||||
|
||||
private static string buildPlayersHere(User fromUser, int x, int y)
|
||||
{
|
||||
string playersHere = "";
|
||||
User[] playersAt = GameServer.GetUsersAt(x, y, true, true);
|
||||
if(playersAt.Length > 1)
|
||||
{
|
||||
playersHere += Messages.PlayersHere;
|
||||
int count = 0;
|
||||
foreach(User playerAt in playersAt)
|
||||
{
|
||||
if (playerAt.Id == fromUser.Id)
|
||||
continue;
|
||||
string buttons = "";
|
||||
buttons += Messages.FormatPlayerHereProfileButton(playerAt.Id);
|
||||
buttons += Messages.FormatPlayerHereSocialButtton(playerAt.Id);
|
||||
buttons += Messages.FormatPlayerHereTradeButton(playerAt.Id);
|
||||
if (fromUser.Friends.IsFriend(playerAt.Id))
|
||||
buttons += Messages.FormatPlayerHereTagButton(playerAt.Id);
|
||||
else
|
||||
buttons += Messages.FormatPlayerHereBuddyButton(playerAt.Id);
|
||||
buttons += Messages.FormatPlayerHerePMButton(playerAt.Username);
|
||||
|
||||
playersHere += Messages.FormatPlayerHereMenu(playerAt.GetPlayerListIcon(), playerAt.Username,buttons);
|
||||
count++;
|
||||
}
|
||||
|
||||
if(count >= 2)
|
||||
playersHere += Messages.PlayerHereMulitpleMenuFormat;
|
||||
|
||||
if (count <= 0)
|
||||
return "";
|
||||
}
|
||||
|
||||
return playersHere;
|
||||
}
|
||||
|
||||
private static string buildNearbyString(int x, int y)
|
||||
{
|
||||
string playersNearby = "";
|
||||
|
||||
User[] nearbyUsers = GameServer.GetNearbyUsers(x, y, true, true);
|
||||
int count = 0;
|
||||
if (nearbyUsers.Length > 1)
|
||||
{
|
||||
playersNearby += Messages.Seperator;
|
||||
|
@ -71,6 +107,9 @@ namespace HISP.Game
|
|||
usersSouth += " " + nearbyUser.Username + " ";
|
||||
else if (angle >= 0 && angle <= 90)
|
||||
usersNorth += " " + nearbyUser.Username + " ";
|
||||
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
if (usersEast != "")
|
||||
|
@ -85,7 +124,10 @@ namespace HISP.Game
|
|||
|
||||
|
||||
}
|
||||
|
||||
if(count <= 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return playersNearby;
|
||||
|
||||
}
|
||||
|
@ -171,9 +213,10 @@ namespace HISP.Game
|
|||
|
||||
}
|
||||
|
||||
private static string buildCommonInfo(int x, int y)
|
||||
private static string buildCommonInfo(User user, int x, int y)
|
||||
{
|
||||
string message = "";
|
||||
message += buildPlayersHere(user, x, y);
|
||||
message += buildNearbyString(x, y);
|
||||
|
||||
// Dropped Items
|
||||
|
@ -2152,8 +2195,7 @@ namespace HISP.Game
|
|||
message += BuildWildHorseList(user);
|
||||
message += buildNpc(user, x, y);
|
||||
|
||||
|
||||
message += buildCommonInfo(x, y);
|
||||
message += buildCommonInfo(user, x, y);
|
||||
return message;
|
||||
}
|
||||
public static string BuildPawneerOrderFound(HorseInstance instance)
|
||||
|
@ -2408,7 +2450,7 @@ namespace HISP.Game
|
|||
message += npc;
|
||||
|
||||
if (specialTile.Code == null || specialTile.Code == "")
|
||||
message += buildCommonInfo(specialTile.X, specialTile.Y);
|
||||
message += buildCommonInfo(user, specialTile.X, specialTile.Y);
|
||||
else
|
||||
{
|
||||
|
||||
|
|
|
@ -29,6 +29,14 @@ namespace HISP.Player
|
|||
|
||||
}
|
||||
|
||||
public bool IsFriend(int friendUserId)
|
||||
{
|
||||
foreach (int userId in List)
|
||||
if (userId == friendUserId)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RemoveFriend(int userid)
|
||||
{
|
||||
Database.RemoveBuddy(baseUser.Id, userid);
|
||||
|
@ -39,9 +47,10 @@ namespace HISP.Player
|
|||
|
||||
User removeFrom = GameServer.GetUserById(userid);
|
||||
removeFrom.Friends.List.Remove(baseUser.Id);
|
||||
|
||||
}
|
||||
catch (KeyNotFoundException) { /* User is ofline, remove from database is sufficent */ };
|
||||
|
||||
|
||||
|
||||
baseUser.Friends.List.Remove(userid);
|
||||
}
|
||||
|
|
31
Horse Isle Server/HorseIsleServer/Player/Trade.cs
Normal file
31
Horse Isle Server/HorseIsleServer/Player/Trade.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using HISP.Game.Horse;
|
||||
using HISP.Game.Items;
|
||||
using HISP.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Player
|
||||
{
|
||||
public class Trade
|
||||
{
|
||||
public Trade(User me)
|
||||
{
|
||||
RandomId = RandomID.NextRandomId();
|
||||
Trader = me;
|
||||
}
|
||||
|
||||
public int RandomId;
|
||||
public User Trader;
|
||||
public Trade OtherTrade;
|
||||
|
||||
public string Stage = "OPEN";
|
||||
|
||||
public int MoenyOffered = 0;
|
||||
public List<HorseInstance> HorsesOffered = new List<HorseInstance>();
|
||||
public List<ItemInstance> ItemsOffered = new List<ItemInstance>();
|
||||
|
||||
}
|
||||
}
|
|
@ -420,7 +420,7 @@ namespace HISP.Player
|
|||
private int thirst;
|
||||
private int tired;
|
||||
|
||||
|
||||
public Trade TradingWith = null;
|
||||
public byte[] SecCodeSeeds = new byte[3];
|
||||
public int SecCodeInc = 0;
|
||||
public int SecCodeCount = 0;
|
||||
|
|
|
@ -806,21 +806,37 @@ namespace HISP.Server
|
|||
Item.Earthworm = gameData.item.special.earthworm;
|
||||
|
||||
// New Users
|
||||
|
||||
Messages.NewUserMessage = gameData.messages.new_user.starting_message;
|
||||
Map.NewUserStartX = gameData.messages.new_user.starting_x;
|
||||
Map.NewUserStartY = gameData.messages.new_user.starting_y;
|
||||
|
||||
// Warp Command
|
||||
|
||||
Messages.SuccessfullyWarpedToPlayer = gameData.messages.commands.warp.player;
|
||||
Messages.SuccessfullyWarpedToLocation = gameData.messages.commands.warp.location;
|
||||
Messages.OnlyUnicornCanWarp = gameData.messages.commands.warp.only_unicorn;
|
||||
Messages.FailedToUnderstandLocation = gameData.messages.commands.warp.location_unknown;
|
||||
|
||||
// Mod Isle
|
||||
|
||||
Messages.ModIsleMessage = gameData.messages.commands.mod_isle.message;
|
||||
Map.ModIsleX = gameData.messages.commands.mod_isle.x;
|
||||
Map.ModIsleY = gameData.messages.commands.mod_isle.y;
|
||||
|
||||
// Player Interation
|
||||
|
||||
Messages.PlayerHereMenuFormat = gameData.messages.meta.player_interaction.menu;
|
||||
Messages.PlayerHereMulitpleMenuFormat = gameData.messages.meta.player_interaction.multiple_players_menu;
|
||||
|
||||
Messages.PlayerHereProfileButton = gameData.messages.meta.player_interaction.profiile_button;
|
||||
Messages.PlayerHereSocialButton = gameData.messages.meta.player_interaction.social_button;
|
||||
Messages.PlayerHereTradeButton = gameData.messages.meta.player_interaction.trade_button;
|
||||
Messages.PlayerHereAddBuddyButton = gameData.messages.meta.player_interaction.buddy_button;
|
||||
Messages.PlayerHereTagButton = gameData.messages.meta.player_interaction.tag_button;
|
||||
Messages.PlayerHerePmButton = gameData.messages.meta.player_interaction.pm_button;
|
||||
|
||||
|
||||
// Auction
|
||||
Messages.AuctionsRunning = gameData.messages.meta.auction.auctions_running;
|
||||
Messages.AuctionPlayersHereFormat = gameData.messages.meta.auction.players_here;
|
||||
|
@ -957,7 +973,7 @@ namespace HISP.Server
|
|||
Messages.MailRippedMessage = gameData.messages.meta.mail.mail_ripped;
|
||||
|
||||
// Click
|
||||
Messages.PlayerHereFormat = gameData.messages.player_here;
|
||||
Messages.ClickPlayerHereFormat = gameData.messages.player_here;
|
||||
|
||||
|
||||
// Ranch
|
||||
|
@ -1565,6 +1581,7 @@ namespace HISP.Server
|
|||
Messages.LongFullLine = gameData.messages.meta.long_full_line;
|
||||
Messages.MetaTerminator = gameData.messages.meta.end_of_meta;
|
||||
|
||||
Messages.PlayersHere = gameData.messages.meta.player_interaction.players_here;
|
||||
Messages.NearbyPlayers = gameData.messages.meta.nearby.players_nearby;
|
||||
Messages.North = gameData.messages.meta.nearby.north;
|
||||
Messages.East = gameData.messages.meta.nearby.east;
|
||||
|
|
Loading…
Add table
Reference in a new issue