Loot Notifications!

Posts 1–15 of 16 · Page 1 of 2
Loot Notifications!
heyo, so this tutorial will cover how to add loot notifications (works on fsod, nr-core, and maybe loe).

First in wServer/logic/loot/Loots.cs, Ctrl+F for "public class Loot", then inside of that class, add this code
Code:
 private static string[] notifItem = {
            "placeholder item",
            "placeholder item",
            "placeholder item"
};
now (also in Loots.cs), look for "public static void ShowBags", then inside of that void, add this code
Code:
if (notifItem.Contains(i.ObjectId))
                    foreach (var p in enemy.Owner.Players.Values)
                        p.SendHelp(owners[0].Name + " has just gotten (a): '"
+ i.ObjectId + "'!");
You can end off here, but if you want to use a color that isn't orange, go to wServer/realm/entities/player/Player.Chat.cs and add this code
Code:
public void SendNotif(string text)
        {
            _client.SendPacket(new Text()
            {
                BubbleTime = 0,
                NumStars = -1,
                Name = "<Notification>",
                Txt = text
                TextColor = 0x(hexcode)
            });
}
then go back to Loots.cs and change the p.SendHelp from the second instance of code to p.SendNotif

That's it, folks.
Quote Originally Posted by wycuhmi View Post
heyo, so this tutorial will cover how to add loot notifications (works on fsod, nr-core, and maybe loe).

First in wServer/logic/loot/Loots.cs, Ctrl+F for "public class Loot", then inside of that class, add this code
Code:
 private static string[] notifItem = {
            "placeholder item",
            "placeholder item",
            "placeholder item"
};
now (also in Loots.cs), look for "public static void ShowBags", then inside of that void, add this code
Code:
if (notifItem.Contains(i.ObjectId))
                    foreach (var p in enemy.Owner.Players.Values)
                        p.SendHelp(owners[0].Name + " has just gotten (a): '"
+ i.ObjectId + "'!");
You can end off here, but if you want to use a color that isn't orange, go to wServer/realm/entities/player/Player.Chat.cs and add this code
Code:
public void SendNotif(string text)
        {
            _client.SendPacket(new Text()
            {
                BubbleTime = 0,
                NumStars = -1,
                Name = "<Notification>",
                Txt = text
                TextColor = 0x(hexcode)
            });
}
then go back to Loots.cs and change the p.SendHelp from the second instance of code to p.SendNotif

That's it, folks.
Good job!

But instead of making a function for every notification type u can just make a base notification function to handle it:
Code:
public void SendNotification(string name, string text, int namecolor = 0xFFFFFF, int color = 0xFFFFFF)
etc
ah gotcha. thanks for your feedback!
bump //10chars
now (also in Loots.cs), look for "public static void ShowBags", then inside of that void, add this code
Code:
-----------------------------------------------------------------------
if (notifItem.Contains(i.ObjectId))
foreach (var p in enemy.Owner.Players.Values)
p.SendHelp(owners[0].Name + " has just gotten (a): '"
+ i.ObjectId + "'!");
-----------------------------------------------------------------------
in loots.cs "public static void ShowBags" Dont Show up
Quote Originally Posted by dewewe1 View Post
now (also in Loots.cs), look for "public static void ShowBags", then inside of that void, add this code
Code:
-----------------------------------------------------------------------
if (notifItem.Contains(i.ObjectId))
foreach (var p in enemy.Owner.Players.Values)
p.SendHelp(owners[0].Name + " has just gotten (a): '"
+ i.ObjectId + "'!");
-----------------------------------------------------------------------
in loots.cs "public static void ShowBags" Dont Show up
It might just depends on what source that you have.
@dewewe1 what source are you using, i may be able to help you
public static void ShowBags Dosent shows up
I am using Cakes Domain and in Loots.cs dosent is any thing like public static void ShowBags just private static void ShowBag(Enemy enemy, string[] owners, int bagType, Item[] items)
Quote Originally Posted by Magiertoasti View Post
I am using Cakes Domain and in Loots.cs dosent is any thing like public static void ShowBags just private static void ShowBag(Enemy enemy, string[] owners, int bagType, Item[] items)
im also using cakes domain (fsod)
Quote Originally Posted by Magiertoasti View Post
I am using Cakes Domain and in Loots.cs dosent is any thing like public static void ShowBags just private static void ShowBag(Enemy enemy, string[] owners, int bagType, Item[] items)
It probably uses this in a for loop?
copy pasting valor code is just like lol
also, this is pretty inefficient as it does a foreach loop of all players in the world like 20 times when a boss dies, it's better to just queue messages and send them every 3rd tick, with a for loop instead of the foreach loop
Quote Originally Posted by FlutterM4rk View Post
copy pasting valor code is just like lol
also, this is pretty inefficient as it does a foreach loop of all players in the world like 20 times when a boss dies, it's better to just queue messages and send them every 3rd tick, with a for loop instead of the foreach loop
Valor must be a garbage source if it had that quality of code. And not really; qeueing messages is unnessary and could create delay; especially in each third itteration.

In general looping through 10-20 players a single world instance isn't even tasking for the program at all. Only thing you would need to be careful about would be more of the lower level things and how the are processed.
Hello Mr!

I have a few Question!

Where can i find public static void ShowBags in Fsod source? i can't find it
Quote Originally Posted by wycuhmi View Post
heyo, so this tutorial will cover how to add loot notifications (works on fsod, nr-core, and maybe loe).

First in wServer/logic/loot/Loots.cs, Ctrl+F for "public class Loot", then inside of that class, add this code
Code:
 private static string[] notifItem = {
            "placeholder item",
            "placeholder item",
            "placeholder item"
};
now (also in Loots.cs), look for "public static void ShowBags", then inside of that void, add this code
Code:
if (notifItem.Contains(i.ObjectId))
                    foreach (var p in enemy.Owner.Players.Values)
                        p.SendHelp(owners[0].Name + " has just gotten (a): '"
+ i.ObjectId + "'!");
You can end off here, but if you want to use a color that isn't orange, go to wServer/realm/entities/player/Player.Chat.cs and add this code
Code:
public void SendNotif(string text)
        {
            _client.SendPacket(new Text()
            {
                BubbleTime = 0,
                NumStars = -1,
                Name = "<Notification>",
                Txt = text
                TextColor = 0x(hexcode)
            });
}
then go back to Loots.cs and change the p.SendHelp from the second instance of code to p.SendNotif

That's it, folks.
i got error in

public void SendNotif(string text)
{
_client.SendPacket(new Text()
{
BubbleTime = 0,
NumStars = -1,
Name = "<Notification>",
Txt = text
TextColor = 0x(hexcode)
});
}

SOURCE:FSOD
Quote Originally Posted by DarknessRealmsPs View Post
i got error in

public void SendNotif(string text)
{
_client.SendPacket(new Text()
{
BubbleTime = 0,
NumStars = -1,
Name = "<Notification>",
Txt = text
TextColor = 0x(hexcode)
});
}

SOURCE:FSOD

Have you tried changing the hexcode
Posts 1–15 of 16 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us