mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-10 23:25:41 +12:00
Change Dropped Items spawning Algorithm
This commit is contained in:
parent
02f5af9995
commit
29fe3ec024
9 changed files with 311 additions and 57 deletions
DataCollection
Horse Isle Server/HorseIsleServer
Game
Server
|
@ -61,7 +61,8 @@
|
|||
"grab_all_message":"You grabbed all objects off the ground.",
|
||||
"dropped_item_message":"You dropped an item on the ground.",
|
||||
"grab_but_inv_full":"Your inventory is full! Cannot grab items.",
|
||||
"grab_all_but_inv_full":"You grabbed what you could, but your inventory is full."
|
||||
"grab_all_but_inv_full":"You grabbed what you could, but your inventory is full.",
|
||||
"drop_tile_full":"Cannot drop any more objects here, too many on ground already."
|
||||
},
|
||||
"shop":{
|
||||
"cant_afford_1":"You cannot afford that item!",
|
||||
|
@ -138,7 +139,9 @@
|
|||
"saved":"Current contents of the Drawing Room saved in your slot #%SLOT%.",
|
||||
"load":"Current contents of the Drawing Room loaded from your slot #%SLOT%.",
|
||||
"plz_clear_load":"Drawing room memory is full. Please CLEAR to start a new drawing.",
|
||||
"plz_clear_draw":"Drawing room memory is full. Your additional drawing is not being seen. Please CLEAR to start a new drawing."
|
||||
"plz_clear_draw":"Drawing room memory is full. Your additional drawing is not being seen. Please CLEAR to start a new drawing.",
|
||||
"not_subscribed_draw":"Drawing not sent to other players when you are not a subscriber.",
|
||||
"not_subscribed_load":"Cannot load drawings when you are not a subscriber.",
|
||||
},
|
||||
"groomer":{
|
||||
"groomed_best_it_can":"Your horse %HORSEBREED% is now groomed as best as this groomer can!",
|
||||
|
@ -147,8 +150,6 @@
|
|||
"apply_service":"^I258^T8Apply grooming services for $%PRICE% ^B3G%RANDOMID%^R1",
|
||||
"apply_all":"^R1^R1^I258^T8Groom all %COUNT% horses for $%PRICE% ^B3g^R1",
|
||||
"cannot_improve":"^I258^T9This groomer cannot improve this horse's groom.^R1",
|
||||
"not_subscribed_draw":"Drawing not sent to other players when you are not a subscriber.",
|
||||
"not_subscribed_load":"Cannot load drawings when you are not a subscriber.",
|
||||
},
|
||||
"farrier":{
|
||||
"shoes_total":"^LYour horse %HORSENAME%: shoes currently %TOTAL%/%MAX%^R1",
|
||||
|
|
|
@ -7,4 +7,8 @@ namespace HISP.Game
|
|||
public class InventoryException : Exception { };
|
||||
public class InventoryFullException : InventoryException { };
|
||||
public class InventoryMaxStackException : InventoryException { };
|
||||
|
||||
// Drawingroom
|
||||
public class DrawingroomException : Exception { };
|
||||
public class DrawingroomFullException : DrawingroomException { };
|
||||
}
|
||||
|
|
|
@ -93,40 +93,43 @@ namespace HISP.Game.Horse
|
|||
|
||||
public void RandomWander()
|
||||
{
|
||||
int direction = GameServer.RandomNumberGenerator.Next(0, 3);
|
||||
int tryX = this.X;
|
||||
int tryY = this.Y;
|
||||
|
||||
switch(direction)
|
||||
while(true)
|
||||
{
|
||||
case 0:
|
||||
tryX += 1;
|
||||
break;
|
||||
case 1:
|
||||
tryX -= 1;
|
||||
break;
|
||||
case 2:
|
||||
tryY += 1;
|
||||
break;
|
||||
case 3:
|
||||
tryY -= 1;
|
||||
break;
|
||||
int direction = GameServer.RandomNumberGenerator.Next(0, 3);
|
||||
int tryX = this.X;
|
||||
int tryY = this.Y;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 0:
|
||||
tryX += 1;
|
||||
break;
|
||||
case 1:
|
||||
tryX -= 1;
|
||||
break;
|
||||
case 2:
|
||||
tryY += 1;
|
||||
break;
|
||||
case 3:
|
||||
tryY -= 1;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
// Horses cannot be in towns.
|
||||
if (World.InTown(tryX, tryY))
|
||||
continue;
|
||||
if (World.InSpecialTile(tryX, tryY))
|
||||
continue;
|
||||
|
||||
if (Map.CheckPassable(tryX, tryY)) // Can the player stand here?
|
||||
{
|
||||
Logger.DebugPrint(this.Instance.Breed.Name + " Randomly wandered to: " + tryX.ToString() + ", " + tryY.ToString());
|
||||
X = tryX;
|
||||
Y = tryY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Horses cannot be in towns.
|
||||
if (World.InTown(tryX, tryY))
|
||||
return;
|
||||
if (World.InSpecialTile(tryX, tryY))
|
||||
return;
|
||||
|
||||
if (Map.CheckPassable(tryX, tryY))
|
||||
{
|
||||
X = tryX;
|
||||
Y = tryY;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Escape()
|
||||
|
@ -239,9 +242,8 @@ namespace HISP.Game.Horse
|
|||
if (wildHorse.Timeout <= 0)
|
||||
Despawn(wildHorse);
|
||||
|
||||
if(wildHorse.Timeout % 5 == 0)
|
||||
if (GameServer.RandomNumberGenerator.Next(0, 100) > 50)
|
||||
wildHorse.RandomWander();
|
||||
if (GameServer.RandomNumberGenerator.Next(0, 100) >= 50)
|
||||
wildHorse.RandomWander();
|
||||
}
|
||||
if(WildHorses.Length < 40)
|
||||
{
|
||||
|
|
|
@ -112,6 +112,7 @@ namespace HISP.Game.Items
|
|||
{
|
||||
if(GameServer.GetUsersAt(item.X, item.Y,true,true).Length == 0)
|
||||
{
|
||||
Logger.DebugPrint("Despawned Item at " + item.X + ", " + item.Y);
|
||||
RemoveDroppedItem(item);
|
||||
removedCount++;
|
||||
}
|
||||
|
@ -132,6 +133,9 @@ namespace HISP.Game.Items
|
|||
}
|
||||
public static void GenerateItems()
|
||||
{
|
||||
|
||||
Logger.InfoPrint("Generating items, (this may take awhile on a fresh database!)");
|
||||
|
||||
int newItems = 0;
|
||||
foreach (Item.ItemInformation item in Item.Items)
|
||||
{
|
||||
|
@ -165,6 +169,9 @@ namespace HISP.Game.Items
|
|||
|
||||
if (item.SpawnParamaters.SpawnOnTileType == TileType)
|
||||
{
|
||||
if (GetItemsAt(tryX, tryY).Length > 26) // Max here
|
||||
continue;
|
||||
|
||||
ItemInstance instance = new ItemInstance(item.Id);
|
||||
DroppedItem droppedItem = new DroppedItem();
|
||||
droppedItem.X = tryX;
|
||||
|
@ -199,6 +206,9 @@ namespace HISP.Game.Items
|
|||
|
||||
if (Map.CheckPassable(spawnOn.X, spawnOn.Y))
|
||||
{
|
||||
if (GetItemsAt(spawnOn.X, spawnOn.Y).Length > 26) // Max here
|
||||
continue;
|
||||
|
||||
ItemInstance instance = new ItemInstance(item.Id);
|
||||
DroppedItem droppedItem = new DroppedItem();
|
||||
droppedItem.X = spawnOn.X;
|
||||
|
@ -260,6 +270,8 @@ namespace HISP.Game.Items
|
|||
|
||||
if (Map.CheckPassable(tryX, tryY))
|
||||
{
|
||||
if (GetItemsAt(tryX, tryY).Length > 26) // Max here
|
||||
continue;
|
||||
|
||||
ItemInstance instance = new ItemInstance(item.Id);
|
||||
DroppedItem droppedItem = new DroppedItem();
|
||||
|
@ -286,13 +298,14 @@ namespace HISP.Game.Items
|
|||
while (true)
|
||||
{
|
||||
// Pick a random isle:
|
||||
int isleId = GameServer.RandomNumberGenerator.Next(0, World.Isles.Count);
|
||||
World.Isle isle = World.Isles[isleId];
|
||||
//int isleId = GameServer.RandomNumberGenerator.Next(0, World.Isles.Count);
|
||||
//World.Isle isle = World.Isles[isleId];
|
||||
|
||||
// Pick a random location inside the isle
|
||||
int tryX = GameServer.RandomNumberGenerator.Next(isle.StartX, isle.EndX);
|
||||
int tryY = GameServer.RandomNumberGenerator.Next(isle.StartY, isle.EndY);
|
||||
|
||||
//int tryX = GameServer.RandomNumberGenerator.Next(isle.StartX, isle.EndX);
|
||||
//int tryY = GameServer.RandomNumberGenerator.Next(isle.StartY, isle.EndY);
|
||||
int tryX = GameServer.RandomNumberGenerator.Next(0, Map.Width);
|
||||
int tryY = GameServer.RandomNumberGenerator.Next(0, Map.Height);
|
||||
|
||||
if (World.InSpecialTile(tryX, tryY))
|
||||
continue;
|
||||
|
@ -304,6 +317,9 @@ namespace HISP.Game.Items
|
|||
|
||||
if (item.SpawnParamaters.SpawnOnTileType == TileType)
|
||||
{
|
||||
if (GetItemsAt(tryX, tryY).Length > 26) // Max here
|
||||
continue;
|
||||
|
||||
ItemInstance instance = new ItemInstance(item.Id);
|
||||
DroppedItem droppedItem = new DroppedItem();
|
||||
droppedItem.X = tryX;
|
||||
|
@ -312,7 +328,7 @@ namespace HISP.Game.Items
|
|||
droppedItem.instance = instance;
|
||||
droppedItemsList.Add(droppedItem);
|
||||
Database.AddDroppedItem(droppedItem);
|
||||
Logger.DebugPrint("Created Item ID: " + instance.ItemId + " in " + isle.Name + " at: X: " + droppedItem.X + " Y: " + droppedItem.Y);
|
||||
Logger.DebugPrint("Created Item ID: " + instance.ItemId + " at: X: " + droppedItem.X + " Y: " + droppedItem.Y);
|
||||
newItems++;
|
||||
break;
|
||||
|
||||
|
@ -340,7 +356,6 @@ namespace HISP.Game.Items
|
|||
public static void Init()
|
||||
{
|
||||
ReadFromDatabase();
|
||||
Logger.InfoPrint("Generating items, (this may take awhile on a fresh database!)");
|
||||
GenerateItems();
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ namespace HISP.Game
|
|||
public static string GrabbedAllItemsButInventoryFull;
|
||||
public static string GrabbedAllItemsMessage;
|
||||
public static string DroppedAnItemMessage;
|
||||
public static string DroppedItemTileIsFull;
|
||||
public static string ItemInformationFormat;
|
||||
|
||||
// Pond
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
using HISP.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Game.SwfModules
|
||||
{
|
||||
class Drawingroom
|
||||
{
|
||||
private string drawing;
|
||||
public string Drawing
|
||||
{
|
||||
get
|
||||
{
|
||||
return drawing;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(value.Length < 65535)
|
||||
{
|
||||
Database.SetDrawingRoomDrawing(Id, value);
|
||||
drawing = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new DrawingroomFullException();
|
||||
}
|
||||
}
|
||||
}
|
||||
public int Id;
|
||||
public Drawingroom(int roomId)
|
||||
{
|
||||
if (!Database.DrawingRoomExists(roomId))
|
||||
Database.CreateDrawingRoom(roomId);
|
||||
drawing = Database.GetDrawingRoomDrawing(roomId);
|
||||
Id = roomId;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -37,6 +37,8 @@ namespace HISP.Server
|
|||
string Leaderboards = "CREATE TABLE Leaderboards(playerId INT, minigame TEXT(128), wins INT, looses INT, timesplayed INT, score INT, type TEXT(128))";
|
||||
string NpcStartPoint = "CREATE TABLE NpcStartPoint(playerId INT, npcId INT, chatpointId INT)";
|
||||
string PoetryRooms = "CREATE TABLE PoetryRooms(poetId INT, X INT, Y INT, roomId INT)";
|
||||
string SavedDrawings = "CREATE TABLE SavedDrawings(playerId INT, Drawing1 TEXT(65535), Drawing2 TEXT(65535), Drawing3 TEXT(65535))";
|
||||
string DrawingRooms = "CREATE TABLE DrawingRooms(roomId INT, Drawing TEXT(65535))";
|
||||
string Horses = "CREATE TABLE Horses(randomId INT, ownerId INT, ranchId INT, leaser INT, breed INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT)";
|
||||
string WildHorse = "CREATE TABLE WildHorse(randomId INT, originalOwner INT, breed INT, x INT, y INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, timeout INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT)";
|
||||
string LastPlayer = "CREATE TABLE LastPlayer(roomId TEXT(1028), playerId INT)";
|
||||
|
@ -44,6 +46,33 @@ namespace HISP.Server
|
|||
string BannedPlayers = "CREATE TABLE BannedPlayers(playerId INT, ipAddress TEXT(1028), reason TEXT(1028))";
|
||||
string DeleteOnlineUsers = "DELETE FROM OnlineUsers";
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = SavedDrawings;
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.WarnPrint(e.Message);
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = DrawingRooms;
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.WarnPrint(e.Message);
|
||||
};
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -264,7 +293,7 @@ namespace HISP.Server
|
|||
{
|
||||
Logger.WarnPrint(e.Message);
|
||||
};
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -306,7 +335,7 @@ namespace HISP.Server
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -365,9 +394,10 @@ namespace HISP.Server
|
|||
Logger.WarnPrint(e.Message);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void AddTrackedItem(int playerId, Tracking.TrackableItem what, int count)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
|
@ -403,7 +433,7 @@ namespace HISP.Server
|
|||
}
|
||||
public static int GetTrackedCount(int playerId, Tracking.TrackableItem what)
|
||||
{
|
||||
|
||||
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
|
@ -610,7 +640,7 @@ namespace HISP.Server
|
|||
{
|
||||
int randomId = reader.GetInt32(0);
|
||||
int breedId = reader.GetInt32(4);
|
||||
|
||||
|
||||
HorseInfo.Breed horseBreed = HorseInfo.GetBreedById(breedId);
|
||||
string name = reader.GetString(5);
|
||||
string description = reader.GetString(6);
|
||||
|
@ -721,12 +751,12 @@ namespace HISP.Server
|
|||
sqlCommand.Dispose();
|
||||
return count >= 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void AddWildHorse(WildHorse horse)
|
||||
{
|
||||
|
||||
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
|
@ -761,7 +791,7 @@ namespace HISP.Server
|
|||
sqlCommand.Parameters.AddWithValue("@personality", horse.Instance.AdvancedStats.Personality);
|
||||
sqlCommand.Parameters.AddWithValue("@height", horse.Instance.AdvancedStats.Height);
|
||||
|
||||
if(horse.Instance.Equipment.Saddle != null)
|
||||
if (horse.Instance.Equipment.Saddle != null)
|
||||
sqlCommand.Parameters.AddWithValue("@saddle", horse.Instance.Equipment.Saddle.Id);
|
||||
else
|
||||
sqlCommand.Parameters.AddWithValue("@saddle", null);
|
||||
|
@ -781,7 +811,7 @@ namespace HISP.Server
|
|||
else
|
||||
sqlCommand.Parameters.AddWithValue("@companion", null);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -797,7 +827,7 @@ namespace HISP.Server
|
|||
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void LoadWildHorses()
|
||||
|
@ -812,7 +842,7 @@ namespace HISP.Server
|
|||
sqlCommand.Prepare();
|
||||
MySqlDataReader reader = sqlCommand.ExecuteReader();
|
||||
|
||||
while(reader.Read())
|
||||
while (reader.Read())
|
||||
{
|
||||
int randomId = reader.GetInt32(0);
|
||||
int breedId = reader.GetInt32(2);
|
||||
|
@ -861,7 +891,7 @@ namespace HISP.Server
|
|||
int y = reader.GetInt32(4);
|
||||
int timeout = reader.GetInt32(29);
|
||||
WildHorse WildHorse = new WildHorse(inst, x, y, timeout, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
sqlCommand.Dispose();
|
||||
|
@ -886,6 +916,9 @@ namespace HISP.Server
|
|||
|
||||
public static int GetLastPlayer(string roomId)
|
||||
{
|
||||
if (!Database.LastPlayerExist(roomId))
|
||||
Database.AddLastPlayer(roomId, -1);
|
||||
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
|
@ -903,6 +936,8 @@ namespace HISP.Server
|
|||
|
||||
public static void SetLastPlayer(string roomId, int playerId)
|
||||
{
|
||||
if (!Database.LastPlayerExist(roomId))
|
||||
Database.AddLastPlayer(roomId, -1);
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
|
@ -980,7 +1015,7 @@ namespace HISP.Server
|
|||
sqlCommand.Parameters.AddWithValue("@room", room);
|
||||
sqlCommand.Prepare();
|
||||
int xpos = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||
|
||||
|
||||
sqlCommand.Dispose();
|
||||
return xpos;
|
||||
}
|
||||
|
@ -1003,6 +1038,152 @@ namespace HISP.Server
|
|||
}
|
||||
}
|
||||
|
||||
public static bool SavedDrawingsExist(int playerId)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "SELECT COUNT(*) FROM SavedDrawings WHERE playerId=@playerId";
|
||||
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||
sqlCommand.Prepare();
|
||||
int count = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||
|
||||
sqlCommand.Dispose();
|
||||
return count >= 1;
|
||||
}
|
||||
}
|
||||
public static void CreateSavedDrawings(int playerId)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "INSERT INTO SavedDrawings VALUES(@playerId,'','','')";
|
||||
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DrawingRoomExists(int room)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "SELECT COUNT(*) FROM DrawingRooms WHERE roomId=@room";
|
||||
sqlCommand.Parameters.AddWithValue("@room", room);
|
||||
sqlCommand.Prepare();
|
||||
int count = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||
|
||||
sqlCommand.Dispose();
|
||||
return count >= 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateDrawingRoom(int room)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "INSERT INTO DrawingRooms VALUES(@roomId,'')";
|
||||
sqlCommand.Parameters.AddWithValue("@roomId", room);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDrawingRoomDrawing(int room, string Drawing)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE DrawingRooms SET Drawing=@drawing WHERE roomId=@room";
|
||||
sqlCommand.Parameters.AddWithValue("@drawing", Drawing);
|
||||
sqlCommand.Parameters.AddWithValue("@room", room);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
public static string GetDrawingRoomDrawing(int room)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "SELECT Drawing FROM DrawingRooms WHERE roomId=@room";
|
||||
sqlCommand.Parameters.AddWithValue("@room", room);
|
||||
sqlCommand.Prepare();
|
||||
string drawing = sqlCommand.ExecuteScalar().ToString();
|
||||
|
||||
sqlCommand.Dispose();
|
||||
return drawing;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveDrawingSlot1(int playerId, string drawing)
|
||||
{
|
||||
if (!SavedDrawingsExist(playerId))
|
||||
CreateSavedDrawings(playerId);
|
||||
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE SavedDrawings SET Drawing1=@drawing WHERE playerId=@playerId";
|
||||
sqlCommand.Parameters.AddWithValue("@drawing", drawing);
|
||||
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveDrawingSlot2(int playerId, string drawing)
|
||||
{
|
||||
if (!SavedDrawingsExist(playerId))
|
||||
CreateSavedDrawings(playerId);
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE SavedDrawings SET Drawing2=@drawing WHERE playerId=@playerId";
|
||||
sqlCommand.Parameters.AddWithValue("@drawing", drawing);
|
||||
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveDrawingSlot3(int playerId, string drawing)
|
||||
{
|
||||
if (!SavedDrawingsExist(playerId))
|
||||
CreateSavedDrawings(playerId);
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE SavedDrawings SET Drawing3=@drawing WHERE playerId=@playerId";
|
||||
sqlCommand.Parameters.AddWithValue("@drawing", drawing);
|
||||
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetServerTime(int time, int day, int year)
|
||||
{
|
||||
|
|
|
@ -912,6 +912,7 @@ namespace HISP.Server
|
|||
Messages.ItemInformationFormat = gameData.messages.meta.dropped_items.item_information_format;
|
||||
Messages.GrabAllItemsButton = gameData.messages.meta.dropped_items.grab_all;
|
||||
Messages.DroppedAnItemMessage = gameData.messages.dropped_items.dropped_item_message;
|
||||
Messages.DroppedItemTileIsFull = gameData.messages.dropped_items.drop_tile_full;
|
||||
Messages.GrabbedAllItemsMessage = gameData.messages.dropped_items.grab_all_message;
|
||||
Messages.GrabbedItemMessage = gameData.messages.dropped_items.grab_message;
|
||||
Messages.GrabAllItemsMessage = gameData.messages.dropped_items.grab_all_message;
|
||||
|
|
|
@ -3107,6 +3107,12 @@ namespace HISP.Server
|
|||
{
|
||||
InventoryItem itm = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId);
|
||||
ItemInstance instance = itm.ItemInstances[0];
|
||||
if(DroppedItems.GetItemsAt(sender.LoggedinUser.X, sender.LoggedinUser.Y).Length > 26)
|
||||
{
|
||||
byte[] tileIsFullPacket = PacketBuilder.CreateChat(Messages.DroppedItemTileIsFull, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(tileIsFullPacket);
|
||||
break;
|
||||
}
|
||||
DroppedItems.AddItem(instance, sender.LoggedinUser.X, sender.LoggedinUser.Y);
|
||||
sender.LoggedinUser.Inventory.Remove(instance);
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.DroppedAnItemMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
|
|
Loading…
Add table
Reference in a new issue