I said I would post this like two days ago, but I didn't. But now I am so there you go.
This uses my
TossEnemyAtPlayer Behavior, so add that to your server before doing this.
Adding the behavior:
-----------------------------------------------------------------------------------------------------------------------------------
Step 1: Open up your server solution and navigate to wserver > logic in the solution explorer.
Step 2: Right click on your "logic" folder > add > new item.
Step 3: Call it MonsterSetPiece.cs and click add.
Step 4: Replace the contents of the file with these, and then rebuild
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wServer.realm;
using wServer.realm.entities;
using wServer.svrPackets;
using wServer.realm.setpieces;
using db;
using wServer.realm.worlds;
namespace wServer.logic
{
class MonsterSetPiece : Behavior
{
string SetPiece;
int offsetFix;
private MonsterSetPiece(string SetPiece, int offsetFix)
{
this.SetPiece = SetPiece;
this.offsetFix = offsetFix;
}
static readonly Dictionary<Tuple<string, int>, MonsterSetPiece> instances = new Dictionary<Tuple<string, int>, MonsterSetPiece>();
public static MonsterSetPiece Instance(string SetPiece, int offsetFix)
{
var key = new Tuple<string, int>(SetPiece, offsetFix);
MonsterSetPiece ret;
if (!instances.TryGetValue(key, out ret))
ret = instances[key] = new MonsterSetPiece(SetPiece, offsetFix);
return ret;
}
protected override bool TickCore(RealmTime time)
{
var chr = Host as Character;
Position target = new Position()
{
X = Host.Self.X,
Y = Host.Self.Y
};
ISetPiece piece = (ISetPiece)Activator.CreateInstance(Type.GetType(
"wServer.realm.setpieces." + SetPiece));
piece.RenderSetPiece(Host.Self.Owner, new IntPoint((int)Host.Self.X -offsetFix, (int)Host.Self.Y - offsetFix));
return true;
}
}
}
Adding the setpieces
-----------------------------------------------------------------------------------------------------------------------------------
Step 1: Navigate to wserver > realm > setpieces
Step 2: Right click the setpiece folder and as we did with the behavior, add > new item.
Step 3: Name it TempLava.cs and click "add"
Step 4: Replace it's contents with these codes:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wServer.logic.loot;
using terrain;
namespace wServer.realm.setpieces
{
class TempLava1 : ISetPiece
{
public int Size { get { return 1; } }
static readonly byte Lava = (byte)XmlData*****ToType["Lava Blend"];
Random rand = new Random();
public void RenderSetPiece(World world, IntPoint pos)
{
int[,] t = new int[1, 1];
t[0, 0] = 1;
for (int x = 0; x < 1; x++) //Rendering
for (int y = 0; y < 1; y++)
{
if (t[x, y] == 1)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Lava; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
}
}
}
class TempLava2 : ISetPiece
{
public int Size { get { return 3; } }
static readonly byte Lava = (byte)XmlData*****ToType["Lava Blend"];
Random rand = new Random();
public void RenderSetPiece(World world, IntPoint pos)
{
int[,] t = new int[3, 3];
t[0, 1] = 1;
t[1, 1] = 1;
t[2, 1] = 1;
t[1, 0] = 1;
t[1, 2] = 1;
for (int x = 0; x < 3; x++) //Rendering
for (int y = 0; y < 3; y++)
{
if (t[x, y] == 1)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Lava; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
}
}
}
class TempLava3 : ISetPiece
{
public int Size { get { return 5; } }
static readonly byte Lava = (byte)XmlData*****ToType["Lava Blend"];
Random rand = new Random();
public void RenderSetPiece(World world, IntPoint pos)
{
int[,] t = new int[5, 5];
t[0, 2] = 1;
t[1, 2] = 1;
t[2, 2] = 1;
t[3, 2] = 1;
t[4, 2] = 1;
t[2, 0] = 1;
t[2, 1] = 1;
t[2, 3] = 1;
t[2, 4] = 1;
t[1, 1] = 1;
t[1, 3] = 1;
t[3, 3] = 1;
t[3, 1] = 1;
for (int x = 0; x < 5; x++) //Rendering
for (int y = 0; y < 5; y++)
{
if (t[x, y] == 1)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Lava; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
}
}
}
class TempLava4 : ISetPiece
{
public int Size { get { return 5; } }
static readonly byte Lava = (byte)XmlData*****ToType["Lava Blend"];
Random rand = new Random();
public void RenderSetPiece(World world, IntPoint pos)
{
int[,] t = new int[5, 5];
t[0, 1] = 1;
t[0, 2] = 1;
t[0, 3] = 1;
t[1, 2] = 1;
t[2, 2] = 1;
t[3, 2] = 1;
t[4, 1] = 1;
t[4, 2] = 1;
t[4, 3] = 1;
t[2, 0] = 1;
t[2, 1] = 1;
t[2, 3] = 1;
t[2, 4] = 1;
t[1, 1] = 1;
t[1, 3] = 1;
t[3, 3] = 1;
t[3, 1] = 1;
t[1, 0] = 1;
t[3, 0] = 1;
t[1, 4] = 1;
t[3, 4] = 1;
for (int x = 0; x < 5; x++) //Rendering
for (int y = 0; y < 5; y++)
{
if (t[x, y] == 1)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Lava; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
}
}
}
class TempLava5 : ISetPiece
{
public int Size { get { return 5; } }
static readonly byte Lava = (byte)XmlData*****ToType["Lava Blend"];
static readonly byte Floor = (byte)XmlData*****ToType["Red Quad"];
Random rand = new Random();
public void RenderSetPiece(World world, IntPoint pos)
{
int[,] t = new int[5, 5];
t[0, 1] = 2;
t[0, 2] = 1;
t[0, 3] = 2;
t[1, 2] = 1;
t[2, 2] = 1;
t[3, 2] = 1;
t[4, 1] = 2;
t[4, 2] = 1;
t[4, 3] = 2;
t[2, 0] = 1;
t[2, 1] = 1;
t[2, 3] = 1;
t[2, 4] = 1;
t[1, 1] = 1;
t[1, 3] = 1;
t[3, 3] = 1;
t[3, 1] = 1;
t[1, 0] = 2;
t[3, 0] = 2;
t[1, 4] = 2;
t[3, 4] = 2;
for (int x = 0; x < 5; x++) //Rendering
for (int y = 0; y < 5; y++)
{
if (t[x, y] == 1)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Lava; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
if (t[x, y] == 2)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Floor; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
}
}
}
class TempLava6 : ISetPiece
{
public int Size { get { return 5; } }
static readonly byte Lava = (byte)XmlData*****ToType["Lava Blend"];
static readonly byte Floor = (byte)XmlData*****ToType["Red Quad"];
Random rand = new Random();
public void RenderSetPiece(World world, IntPoint pos)
{
int[,] t = new int[5, 5];
t[0, 2] = 2;
t[1, 2] = 1;
t[2, 2] = 1;
t[3, 2] = 1;
t[4, 2] = 2;
t[2, 0] = 2;
t[2, 1] = 1;
t[2, 3] = 1;
t[2, 4] = 2;
t[1, 1] = 2;
t[1, 3] = 2;
t[3, 3] = 2;
t[3, 1] = 2;
for (int x = 0; x < 5; x++) //Rendering
for (int y = 0; y < 5; y++)
{
if (t[x, y] == 1)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Lava; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
if (t[x, y] == 2)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Floor; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
}
}
}
class TempLava7 : ISetPiece
{
public int Size { get { return 3; } }
static readonly byte Lava = (byte)XmlData*****ToType["Lava Blend"];
static readonly byte Floor = (byte)XmlData*****ToType["Red Quad"];
Random rand = new Random();
public void RenderSetPiece(World world, IntPoint pos)
{
int[,] t = new int[3, 3];
t[0, 1] = 2;
t[1, 1] = 1;
t[2, 1] = 2;
t[1, 0] = 2;
t[1, 2] = 2;
for (int x = 0; x < 3; x++) //Rendering
for (int y = 0; y < 3; y++)
{
if (t[x, y] == 1)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Lava; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
if (t[x, y] == 2)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Floor; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
}
}
}
class TempLava8 : ISetPiece
{
public int Size { get { return 1; } }
static readonly byte Floor = (byte)XmlData*****ToType["Red Quad"];
Random rand = new Random();
public void RenderSetPiece(World world, IntPoint pos)
{
int[,] t = new int[1, 1];
t[0, 0] = 1;
for (int x = 0; x < 1; x++) //Rendering
for (int y = 0; y < 1; y++)
{
if (t[x, y] == 1)
{
var tile = world.Map[x + pos.X, y + pos.Y].Clone();
tile.TileId = Floor; tile.ObjType = 0;
if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
world.Map[x + pos.X, y + pos.Y] = tile;
}
}
}
}
}
Adding the Idol Behaviors
-----------------------------------------------------------------------------------------------------------------------------------
Step 1: Navigate to wserver > logic > db and open up BehaviorDb.Abyss.cs
Step 2: Scroll down untill you find the abyss idol behaviors
Step 3: Replace the Abyss Idol Behaviors with this these:
Code:
.Init(0x0e1d, Behaves("Abyss Idol",
HpLesserPercent.Instance(0.999f,
new RunBehaviors(
Cooldown.Instance(500, RingAttack.Instance(8, 0, 0, 0)),
Cooldown.Instance(1000, RingAttack.Instance(4, 0, 45 * (float)Math.PI / 180, 1)),
Cooldown.Instance(1000, MultiAttack.Instance(12, 10 * (float)Math.PI / 180, 3, 0, 2)),
Cooldown.Instance(2500, If.Instance(EntityLesserThan.Instance(20, 4, 0x0e1a), TossEnemyAtPlayer.Instance(8, 0x0e1a)))
)),
loot: new LootBehavior(LootDef.Empty,
Tuple.Create(100, new LootDef(0, 5, 0, 10,
Tuple.Create(0.5, (ILoot)new ItemLoot("Potion of Defense")),
Tuple.Create(0.5, (ILoot)new ItemLoot("Potion of Vitality")),
Tuple.Create(0.005, (ILoot)new ItemLoot("Wine Cellar Incantation")),
Tuple.Create(0.005, (ILoot)new ItemLoot("Demon Blade"))
)))))
.Init(0x0e1a, Behaves("AbyssTreasureLavaBomb",
new RunBehaviors(
SetConditionEffect.Instance(ConditionEffectIndex.Invincible),
new QueuedBehavior(
CooldownExact.Instance(2000),
MonsterSetPiece.Instance("TempLava1", 1),
CooldownExact.Instance(1000),
MonsterSetPiece.Instance("TempLava2", 2),
CooldownExact.Instance(1000),
MonsterSetPiece.Instance("TempLava3", 3),
CooldownExact.Instance(1000),
MonsterSetPiece.Instance("TempLava4", 3),
CooldownExact.Instance(10000),
MonsterSetPiece.Instance("TempLava5", 3),
CooldownExact.Instance(1000),
MonsterSetPiece.Instance("TempLava6", 3),
CooldownExact.Instance(1000),
MonsterSetPiece.Instance("TempLava7", 2),
CooldownExact.Instance(1000),
MonsterSetPiece.Instance("TempLava8", 1),
Despawn.Instance
)
))
)
Rebuild and then you're done, the idol should now be working.
For anyone wondering, the usage is:
Code:
MonsterSetPiece.Instance("setpiecename", offsetfix),
The name is pretty explanatory, the offsetfix not so much, so I'll explain that.
The offsetfix is used to center the setpiece on the monster. Usually you wanna set this to the (setpiece size + 1) / 2
For example, if the size is 5, you wanna set the offsetfix to 3. because 5 + 1 = 6 and 6 / 2 = 3. The size can be found at the top of the setpiece's cs file.
Leave a thanks if this helped you out.