Hi, today i will show you the RIGHT pet heal (hp/mp)! (without Pet Attack)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wServer.realm;
using wServer.logic.attack;
using wServer.logic.movement;
using wServer.logic.loot;
using wServer.logic.taunt;
using wServer.logic.cond;
namespace wServer.logic
{
partial class BehaviorDb
{
static _ Pets = Behav()
.InitMany(0x1600, 0x1641, Behaves("Pet",
If.Instance(new PetBehaves(), PetChasing.Instance(9, 5, 1)),
Cooldown.Instance(1750, new PetHealHpMp()),
Cooldown.Instance(1750, new PetHealHpMp())
));
}
}
And now make a new .cs file and rename it to: PetHealHpMp.cs
Edit the PetHealHpMp.cs to:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wServer.realm;
using wServer.realm.entities;
using wServer.svrPackets;
namespace wServer.logic.cond
{
class PetHealHpMp : Behavior
{
protected override bool TickCore(RealmTime time)
{
float dist = 20;
Player entity = (Host.Self.PlayerOwner) as Player;
while (entity != null)
{
int mp = entity.MP;
int maxMp = entity.Stats[1] + entity.Boost[1];
mp = Math.Min(mp + 15, maxMp);
if (mp != entity.MP)
{
int n = mp - entity.MP;
entity.MP = mp;
entity.UpdateCount++;
entity.Owner.BroadcastPacket(new ShowEffectPacket()
{
EffectType = EffectType.Potion,
TargetId = entity.Id,
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new NotificationPacket()
{
ObjectId = entity.Id,
Text = "+" + n,
Color = new ARGB(0xff0000ff)
}, null);
}
int hp = entity.HP;
int maxHp = entity.Stats[0] + entity.Boost[0];
hp = Math.Min(hp + 35, maxHp);
if (hp != entity.HP)
{
int m = hp - entity.HP;
entity.HP = hp;
entity.UpdateCount++;
entity.Owner.BroadcastPacket(new ShowEffectPacket()
{
EffectType = EffectType.Potion,
TargetId = entity.Id,
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new ShowEffectPacket()
{
EffectType = EffectType.Trail,
TargetId = Host.Self.Id,
PosA = new Position() { X = entity.X, Y = entity.Y },
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new NotificationPacket()
{
ObjectId = entity.Id,
Text = "+" + m,
Color = new ARGB(0xffff0000)
}, null);
return true;
}
entity = null;
}
return false;
}
}
}
Save it and open SharpDevelop, go to wServer\logic and move the PetHealHpMp.cs file in the "cond" folder
And now Rebuild the Solution!
(U can change the hp and mp! go to: PetHealHpMp.cs and find: mp = Math.Min(mp + 15, maxMp); for MP or:
hp = Math.Min(hp + 35, maxHp); for hp (change the blue numbers)
Enjoy!