mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
Add throwable items
This commit is contained in:
parent
811bc70ea2
commit
b773e7c423
7 changed files with 122 additions and 18 deletions
|
@ -66,6 +66,10 @@
|
||||||
"ads_once_per_minute":"Ads may only be posted once per minute.",
|
"ads_once_per_minute":"Ads may only be posted once per minute.",
|
||||||
"global_chats_limited":"<B>CHAT NOT SENT:</B> Global chats are limited (+1 earned per 2 minutes). Please chat using CHAT NEAR/ISLAND/BUDDIES when possible."
|
"global_chats_limited":"<B>CHAT NOT SENT:</B> Global chats are limited (+1 earned per 2 minutes). Please chat using CHAT NEAR/ISLAND/BUDDIES when possible."
|
||||||
},
|
},
|
||||||
|
"mods_revenge":{
|
||||||
|
"awareded_others":"You earned $500 from Moderator %USERNAME%'s Splatterball!",
|
||||||
|
"awarded_you":"Mod Revenge taken upon %USERNAME%! $50 earned."
|
||||||
|
},
|
||||||
"events":{
|
"events":{
|
||||||
"real_time_riddle":{
|
"real_time_riddle":{
|
||||||
"event_start":"<B>CHAT RIDDLE:</B> %RIDDLETEXT% <I>(answer first via any chat method)</I>",
|
"event_start":"<B>CHAT RIDDLE:</B> %RIDDLETEXT% <I>(answer first via any chat method)</I>",
|
||||||
|
@ -1104,7 +1108,7 @@
|
||||||
"item_info_itemid_button":"^B4LN%ITEMID%",
|
"item_info_itemid_button":"^B4LN%ITEMID%",
|
||||||
"item_wear_button":"^B4W%RANDOMID%",
|
"item_wear_button":"^B4W%RANDOMID%",
|
||||||
"item_consume_button":"^B4E%RANDOMID%",
|
"item_consume_button":"^B4E%RANDOMID%",
|
||||||
"item_throw_button":"^B4T%RANDOMID%",
|
"item_throw_button":"^B4T%ITEMID%",
|
||||||
"item_use_button":"^B4UD%RANDOMID%",
|
"item_use_button":"^B4UD%RANDOMID%",
|
||||||
"item_open_button":"^B4O%RANDOMID%",
|
"item_open_button":"^B4O%RANDOMID%",
|
||||||
"item_read_button":"^B4VL%ITEMID%",
|
"item_read_button":"^B4VL%ITEMID%",
|
||||||
|
@ -8879,17 +8883,18 @@
|
||||||
"telescope":182,
|
"telescope":182,
|
||||||
"pitchfork":152,
|
"pitchfork":152,
|
||||||
"wishing_coin":50,
|
"wishing_coin":50,
|
||||||
|
"mod_splatterball":713,
|
||||||
"fishing_poll":146,
|
"fishing_poll":146,
|
||||||
"earthworm":83,
|
"earthworm":83,
|
||||||
"birthday_token":1082
|
"birthday_token":1082
|
||||||
},
|
},
|
||||||
"throwable":[
|
"throwable":[
|
||||||
{"id":144,"message":"blanketing wet snow on "},
|
{"id":144,"message_hit":"SMACK!! %USERNAME% hit you with a Snowball, blanketing wet snow on you.", "message_throw":"SMACK!! You nailed %USERNAME% with a Snowball, blanketing wet snow on them.", "message_hit_yourself":"You toss the Snowball high into the air! SMACK! It comes back down and hits you on the head, blanketing wet snow on you."},
|
||||||
{"id":333,"message":"bright red chunks are covering "},
|
{"id":333,"message_hit":"SMACK!! %USERNAME% hit you with a Rotten Tomato, bright red chunks are covering you.", "message_throw":"SMACK!! You nailed %USERNAME% with a Rotten Tomato, bright red chunks are covering them.", "message_hit_yourself":"You toss the Rotten Tomato high into the air! SMACK! It comes back down and hits you on the head, bright red chunks are covering you"},
|
||||||
{"id":334,"message":"soaking "},
|
{"id":334,"message_hit":"SMACK!! %USERNAME% hit you with a Water Balloon, soaking you.", "message_throw":"SMACK!! You nailed %USERNAME% with a Water Balloon, soaking them.", "message_hit_yourself":"You toss the Water Balloon high into the air! SMACK! It comes back down and hits you on the head, soaking you."},
|
||||||
{"id":639,"message":"twinkling magic on "},
|
{"id":639,"message_hit":"SMACK!! %USERNAME% hit you with a Pixie Dust, twinkling magic on you", "message_throw":"SMACK!! You nailed %USERNAME% with a Pixie Dust, twinkling magic on them.", "message_hit_yourself":"You toss the Pixie Dust high into the air! SMACK! It comes back down and hits you on the head, twinkling magic on you."},
|
||||||
{"id":640,"message":"lightly bouncing off "},
|
{"id":640,"message_hit":"SMACK!! %USERNAME% hit you with a Marshmallow, lightly bouncing off you.", "message_throw":"SMACK!! You nailed %USERNAME% with a Marshmallow, lightly bouncing off them.", "message_hit_yourself":"You toss the Marshmallow high into the air! SMACK! It comes back down and hits you on the head, lightly bouncing off you."},
|
||||||
{"id":713,"message":"slimy goop exploded and dripped on "}
|
{"id":713,"message_hit":"SMACK!! %USERNAME% hit you with a Mod Splatterball, slimy goop exploded and dripped on you.", "message_throw":"SMACK!! You nailed %USERNAME% with a Mod Splatterball, slimy goop exploded and dripped on them.", "message_hit_yourself":"You toss the Mod Splatterball high into the air! SMACK! It comes back down and hits you on the head, slimy goop exploded and dripped on you."}
|
||||||
],
|
],
|
||||||
"item_list":[
|
"item_list":[
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,9 @@ namespace HISP.Game.Items
|
||||||
public struct ThrowableItem
|
public struct ThrowableItem
|
||||||
{
|
{
|
||||||
public int Id;
|
public int Id;
|
||||||
public string Message;
|
public string HitMessage;
|
||||||
|
public string ThrowMessage;
|
||||||
|
public string HitYourselfMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ItemInformation> Items = new List<ItemInformation>();
|
public static List<ItemInformation> Items = new List<ItemInformation>();
|
||||||
|
@ -66,6 +68,7 @@ namespace HISP.Game.Items
|
||||||
public static int Telescope;
|
public static int Telescope;
|
||||||
public static int Pitchfork;
|
public static int Pitchfork;
|
||||||
public static int WishingCoin;
|
public static int WishingCoin;
|
||||||
|
public static int ModSplatterball;
|
||||||
public static int FishingPole;
|
public static int FishingPole;
|
||||||
public static int Earthworm;
|
public static int Earthworm;
|
||||||
public static int BirthdayToken;
|
public static int BirthdayToken;
|
||||||
|
|
|
@ -13,8 +13,10 @@ namespace HISP.Game
|
||||||
// Message Queue
|
// Message Queue
|
||||||
public static string MessageQueueHeader;
|
public static string MessageQueueHeader;
|
||||||
|
|
||||||
// Mod isle
|
// Mod
|
||||||
public static string ModIsleMessage;
|
public static string ModIsleMessage;
|
||||||
|
public static string ModSplatterballEarnedYouFormat;
|
||||||
|
public static string ModSplatterballEarnedOtherFormat;
|
||||||
|
|
||||||
// Add Buddy
|
// Add Buddy
|
||||||
public static string AddBuddyPending;
|
public static string AddBuddyPending;
|
||||||
|
@ -1114,6 +1116,22 @@ namespace HISP.Game
|
||||||
|
|
||||||
// Event : Tack Shop Giveaway
|
// Event : Tack Shop Giveaway
|
||||||
|
|
||||||
|
|
||||||
|
// Throwables
|
||||||
|
public static string FormatModSplatterBallAwardedOther(string username)
|
||||||
|
{
|
||||||
|
return ModSplatterballEarnedOtherFormat.Replace("%USERNAME%", username);
|
||||||
|
}
|
||||||
|
public static string FormatModSplatterBallAwardedYou(string username)
|
||||||
|
{
|
||||||
|
return ModSplatterballEarnedYouFormat.Replace("%USERNAME%", username);
|
||||||
|
}
|
||||||
|
public static string FormatThrownItemMessage(string itemFormat, string username)
|
||||||
|
{
|
||||||
|
return itemFormat.Replace("%USERNAME%", username);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tack Shop Giveaway
|
||||||
public static string FormatEventTackShopGiveawayEnd(string shopName, string townName)
|
public static string FormatEventTackShopGiveawayEnd(string shopName, string townName)
|
||||||
{
|
{
|
||||||
return EventEndTackShopGiveawayFormat.Replace("%SHOPNAME%", shopName).Replace("%TOWN%", townName);
|
return EventEndTackShopGiveawayFormat.Replace("%SHOPNAME%", shopName).Replace("%TOWN%", townName);
|
||||||
|
@ -2617,9 +2635,9 @@ namespace HISP.Game
|
||||||
return InventoryItemFormat.Replace("%ICONID%", iconid.ToString()).Replace("%COUNT%", count.ToString()).Replace("%TITLE%", name);
|
return InventoryItemFormat.Replace("%ICONID%", iconid.ToString()).Replace("%COUNT%", count.ToString()).Replace("%TITLE%", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FormatItemThrowButton(int randomid)
|
public static string FormatItemThrowButton(int itemId)
|
||||||
{
|
{
|
||||||
return ItemThrowButton.Replace("%RANDOMID%", randomid.ToString());
|
return ItemThrowButton.Replace("%ITEMID%", itemId.ToString());
|
||||||
}
|
}
|
||||||
public static string FormatItemConsumeButton(int randomid)
|
public static string FormatItemConsumeButton(int randomid)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2180,7 +2180,7 @@ namespace HISP.Game
|
||||||
message += Messages.FormatItemConsumeButton(randomId);
|
message += Messages.FormatItemConsumeButton(randomId);
|
||||||
|
|
||||||
if (Item.IsThrowable(itemInfo.Id))
|
if (Item.IsThrowable(itemInfo.Id))
|
||||||
message += Messages.FormatItemThrowButton(randomId);
|
message += Messages.FormatItemThrowButton(itemInfo.Id);
|
||||||
|
|
||||||
message += Messages.FormatItemInformationButton(randomId);
|
message += Messages.FormatItemInformationButton(randomId);
|
||||||
message += Messages.R1;
|
message += Messages.R1;
|
||||||
|
|
|
@ -232,13 +232,15 @@ namespace HISP.Server
|
||||||
Logger.DebugPrint("Registered Item ID: " + item.Id + " Name: " + item.Name + " spawns on: " + item.SpawnParamaters.SpawnOnTileType);
|
Logger.DebugPrint("Registered Item ID: " + item.Id + " Name: " + item.Name + " spawns on: " + item.SpawnParamaters.SpawnOnTileType);
|
||||||
Item.Items.Add(item);
|
Item.Items.Add(item);
|
||||||
}
|
}
|
||||||
|
// Register Throwables
|
||||||
int totalThrowable = gameData.item.throwable.Count;
|
int totalThrowable = gameData.item.throwable.Count;
|
||||||
for (int i = 0; i < totalThrowable; i++)
|
for (int i = 0; i < totalThrowable; i++)
|
||||||
{
|
{
|
||||||
Item.ThrowableItem throwableItem = new Item.ThrowableItem();
|
Item.ThrowableItem throwableItem = new Item.ThrowableItem();
|
||||||
throwableItem.Id = gameData.item.throwable[i].id;
|
throwableItem.Id = gameData.item.throwable[i].id;
|
||||||
throwableItem.Message = gameData.item.throwable[i].message;
|
throwableItem.HitMessage = gameData.item.throwable[i].message_hit;
|
||||||
|
throwableItem.ThrowMessage = gameData.item.throwable[i].message_throw;
|
||||||
|
throwableItem.HitYourselfMessage = gameData.item.throwable[i].message_hit_yourself;
|
||||||
Item.ThrowableItems.Add(throwableItem);
|
Item.ThrowableItems.Add(throwableItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,6 +845,7 @@ namespace HISP.Server
|
||||||
Item.FishingPole = gameData.item.special.fishing_poll;
|
Item.FishingPole = gameData.item.special.fishing_poll;
|
||||||
Item.Earthworm = gameData.item.special.earthworm;
|
Item.Earthworm = gameData.item.special.earthworm;
|
||||||
Item.BirthdayToken = gameData.item.special.birthday_token;
|
Item.BirthdayToken = gameData.item.special.birthday_token;
|
||||||
|
Item.ModSplatterball = gameData.item.special.mod_splatterball;
|
||||||
|
|
||||||
GameServer.IdleWarning = Convert.ToInt32(gameData.messages.disconnect.client_timeout.warn_after);
|
GameServer.IdleWarning = Convert.ToInt32(gameData.messages.disconnect.client_timeout.warn_after);
|
||||||
GameServer.IdleTimeout = Convert.ToInt32(gameData.messages.disconnect.client_timeout.kick_after);
|
GameServer.IdleTimeout = Convert.ToInt32(gameData.messages.disconnect.client_timeout.kick_after);
|
||||||
|
@ -894,8 +897,9 @@ namespace HISP.Server
|
||||||
Messages.OnlyUnicornCanWarp = gameData.messages.commands.warp.only_unicorn;
|
Messages.OnlyUnicornCanWarp = gameData.messages.commands.warp.only_unicorn;
|
||||||
Messages.FailedToUnderstandLocation = gameData.messages.commands.warp.location_unknown;
|
Messages.FailedToUnderstandLocation = gameData.messages.commands.warp.location_unknown;
|
||||||
|
|
||||||
// Mod Isle
|
// Mod
|
||||||
|
Messages.ModSplatterballEarnedYouFormat = gameData.messages.mods_revenge.awarded_you;
|
||||||
|
Messages.ModSplatterballEarnedOtherFormat = gameData.messages.mods_revenge.awareded_others;
|
||||||
Messages.ModIsleMessage = gameData.messages.commands.mod_isle.message;
|
Messages.ModIsleMessage = gameData.messages.commands.mod_isle.message;
|
||||||
Map.ModIsleX = gameData.messages.commands.mod_isle.x;
|
Map.ModIsleX = gameData.messages.commands.mod_isle.x;
|
||||||
Map.ModIsleY = gameData.messages.commands.mod_isle.y;
|
Map.ModIsleY = gameData.messages.commands.mod_isle.y;
|
||||||
|
|
|
@ -143,6 +143,11 @@ namespace HISP.Server
|
||||||
isle.Weather = isle.SelectRandomWeather();
|
isle.Weather = isle.SelectRandomWeather();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// Water Balloon Game
|
||||||
|
if(totalMinutesElapsed % (60 * 2) == 0)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
// Tack Shop Giveaway
|
// Tack Shop Giveaway
|
||||||
if(totalMinutesElapsed % (60 * 3) == 0)
|
if(totalMinutesElapsed % (60 * 3) == 0)
|
||||||
|
@ -154,7 +159,7 @@ namespace HISP.Server
|
||||||
if(totalMinutesElapsed % 30 == 0)
|
if(totalMinutesElapsed % 30 == 0)
|
||||||
{
|
{
|
||||||
RiddleEvent = RealTimeRiddle.GetRandomRiddle();
|
RiddleEvent = RealTimeRiddle.GetRandomRiddle();
|
||||||
RiddleEvent.StartEvent();
|
RiddleEvent.StartEvent();
|
||||||
}
|
}
|
||||||
// Real Time Quiz
|
// Real Time Quiz
|
||||||
if(totalMinutesElapsed % 75 == 0)
|
if(totalMinutesElapsed % 75 == 0)
|
||||||
|
@ -5851,6 +5856,74 @@ namespace HISP.Server
|
||||||
sender.SendPacket(itemRemovedMessage);
|
sender.SendPacket(itemRemovedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case PacketBuilder.ITEM_THROW:
|
||||||
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
|
string itemidStr = packetStr.Substring(2, packet.Length - 2);
|
||||||
|
int itemId = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
itemId = Int32.Parse(itemidStr);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. (THROW)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (sender.LoggedinUser.Inventory.HasItemId(itemId))
|
||||||
|
{
|
||||||
|
if (!Item.IsThrowable(itemId))
|
||||||
|
{
|
||||||
|
Logger.HackerPrint(sender.LoggedinUser.Username + " Tried to throw an item that isnt throwable.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemInstance curItem = sender.LoggedinUser.Inventory.GetItemByItemId(itemId).ItemInstances[0];
|
||||||
|
User[] userAt = GetUsersAt(sender.LoggedinUser.X, sender.LoggedinUser.Y, false, true);
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
int userIndx = RandomNumberGenerator.Next(0, userAt.Length);
|
||||||
|
|
||||||
|
if (userAt.Length > 1)
|
||||||
|
if (userAt[userIndx].Id == sender.LoggedinUser.Id)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Item.ThrowableItem throwableItem = Item.GetThrowableItem(curItem.ItemId);
|
||||||
|
|
||||||
|
if (userAt[userIndx].Id == sender.LoggedinUser.Id)
|
||||||
|
{
|
||||||
|
byte[] thrownHitYourself = PacketBuilder.CreateChat(throwableItem.HitYourselfMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(thrownHitYourself);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(itemId == Item.ModSplatterball)
|
||||||
|
{
|
||||||
|
byte[] otherEarned = PacketBuilder.CreateChat(Messages.FormatModSplatterBallAwardedOther(sender.LoggedinUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
byte[] youEarned = PacketBuilder.CreateChat(Messages.FormatModSplatterBallAwardedYou(userAt[userIndx].Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
|
||||||
|
sender.LoggedinUser.Money += 50;
|
||||||
|
userAt[userIndx].Money += 500;
|
||||||
|
|
||||||
|
sender.SendPacket(youEarned);
|
||||||
|
userAt[userIndx].LoggedinClient.SendPacket(otherEarned);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] thrownForYou = PacketBuilder.CreateChat(Messages.FormatThrownItemMessage(throwableItem.ThrowMessage, userAt[userIndx].Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
byte[] thrownForOthers = PacketBuilder.CreateChat(Messages.FormatThrownItemMessage(throwableItem.HitMessage, sender.LoggedinUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
|
||||||
|
sender.SendPacket(thrownForYou);
|
||||||
|
userAt[userIndx].LoggedinClient.SendPacket(thrownForOthers);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.LoggedinUser.Inventory.Remove(curItem);
|
||||||
|
UpdateInventory(sender);
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_WRAP:
|
case PacketBuilder.ITEM_WRAP:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
|
@ -6326,7 +6399,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryItem invItem = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId);
|
InventoryItem invItem = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId);
|
||||||
int itemId = invItem.ItemId;
|
itemId = invItem.ItemId;
|
||||||
goto doSell;
|
goto doSell;
|
||||||
case PacketBuilder.ITEM_SELL_ALL:
|
case PacketBuilder.ITEM_SELL_ALL:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
|
|
|
@ -206,6 +206,7 @@ namespace HISP.Server
|
||||||
public const byte ITEM_CONSUME = 0x51;
|
public const byte ITEM_CONSUME = 0x51;
|
||||||
public const byte ITEM_DRINK = 0x52;
|
public const byte ITEM_DRINK = 0x52;
|
||||||
public const byte ITEM_BINOCULARS = 0x5C;
|
public const byte ITEM_BINOCULARS = 0x5C;
|
||||||
|
public const byte ITEM_THROW = 0x1F;
|
||||||
public const byte ITEM_MAGNIFYING = 0x5D;
|
public const byte ITEM_MAGNIFYING = 0x5D;
|
||||||
public const byte ITEM_CRAFT = 0x64;
|
public const byte ITEM_CRAFT = 0x64;
|
||||||
public const byte ITEM_USE = 0x5F;
|
public const byte ITEM_USE = 0x5F;
|
||||||
|
|
Loading…
Add table
Reference in a new issue