The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A questions about the BuffInfo
Author Message
galandeo
Apprentice
*

Posts: 6
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Nov 2015
Reputation: 0



Post: #1
A questions about the BuffInfo
Hi Guys,I found this code on RunUO and it looks very useful.
Is there something like this on sphere?
I am not good at English, I hope you known what I mean.

Quote:using System;
using Server.Mobiles;
using Server.Network;

namespace Server
{
public class BuffInfo
{
public static bool Enabled
{
get
{
return Core.ML;
}
}

public static void Initialize()
{
if (Enabled)
{
EventSink.ClientVersionReceived += new ClientVersionReceivedHandler(delegate(ClientVersionReceivedArgs args)
{
PlayerMobile pm = args.State.Mobile as PlayerMobile;

if (pm != null)
Timer.DelayCall(TimeSpan.Zero, pm.ResendBuffs);
});
}
}

#region Properties
private readonly BuffIcon m_ID;
public BuffIcon ID
{
get
{
return this.m_ID;
}
}

private readonly int m_TitleCliloc;
public int TitleCliloc
{
get
{
return this.m_TitleCliloc;
}
}

private readonly int m_SecondaryCliloc;
public int SecondaryCliloc
{
get
{
return this.m_SecondaryCliloc;
}
}

private readonly TimeSpan m_TimeLength;
public TimeSpan TimeLength
{
get
{
return this.m_TimeLength;
}
}

private readonly DateTime m_TimeStart;
public DateTime TimeStart
{
get
{
return this.m_TimeStart;
}
}

private readonly Timer m_Timer;
public Timer Timer
{
get
{
return this.m_Timer;
}
}

private readonly bool m_RetainThroughDeath;
public bool RetainThroughDeath
{
get
{
return this.m_RetainThroughDeath;
}
}

private readonly TextDefinition m_Args;
public TextDefinition Args
{
get
{
return this.m_Args;
}
}

#endregion

#region Constructors
public BuffInfo(BuffIcon iconID, int titleCliloc)
: this(iconID, titleCliloc, titleCliloc + 1)
{
}

public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc)
{
this.m_ID = iconID;
this.m_TitleCliloc = titleCliloc;
this.m_SecondaryCliloc = secondaryCliloc;
}

public BuffInfo(BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m)
: this(iconID, titleCliloc, titleCliloc + 1, length, m)
{
}

//Only the timed one needs to Mobile to know when to automagically remove it.
public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m)
: this(iconID, titleCliloc, secondaryCliloc)
{
this.m_TimeLength = length;
this.m_TimeStart = DateTime.UtcNow;

this.m_Timer = Timer.DelayCall(length, new TimerCallback(
delegate
{
PlayerMobile pm = m as PlayerMobile;

if (pm == null)
return;

pm.RemoveBuff(this);
}));
}

public BuffInfo(BuffIcon iconID, int titleCliloc, TextDefinition args)
: this(iconID, titleCliloc, titleCliloc + 1, args)
{
}

public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args)
: this(iconID, titleCliloc, secondaryCliloc)
{
this.m_Args = args;
}

public BuffInfo(BuffIcon iconID, int titleCliloc, bool retainThroughDeath)
: this(iconID, titleCliloc, titleCliloc + 1, retainThroughDeath)
{
}

public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, bool retainThroughDeath)
: this(iconID, titleCliloc, secondaryCliloc)
{
this.m_RetainThroughDeath = retainThroughDeath;
}

public BuffInfo(BuffIcon iconID, int titleCliloc, TextDefinition args, bool retainThroughDeath)
: this(iconID, titleCliloc, titleCliloc + 1, args, retainThroughDeath)
{
}

public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args, bool retainThroughDeath)
: this(iconID, titleCliloc, secondaryCliloc, args)
{
this.m_RetainThroughDeath = retainThroughDeath;
}

public BuffInfo(BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m, TextDefinition args)
: this(iconID, titleCliloc, titleCliloc + 1, length, m, args)
{
}

public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m, TextDefinition args)
: this(iconID, titleCliloc, secondaryCliloc, length, m)
{
this.m_Args = args;
}

public BuffInfo(BuffIcon iconID, int titleCliloc, TimeSpan length, Mobile m, TextDefinition args, bool retainThroughDeath)
: this(iconID, titleCliloc, titleCliloc + 1, length, m, args, retainThroughDeath)
{
}

public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m, TextDefinition args, bool retainThroughDeath)
: this(iconID, titleCliloc, secondaryCliloc, length, m)
{
this.m_Args = args;
this.m_RetainThroughDeath = retainThroughDeath;
}

#endregion

#region Convenience Methods
public static void AddBuff(Mobile m, BuffInfo b)
{
PlayerMobile pm = m as PlayerMobile;

if (pm != null)
pm.AddBuff(b);
}

public static void RemoveBuff(Mobile m, BuffInfo b)
{
PlayerMobile pm = m as PlayerMobile;

if (pm != null)
pm.RemoveBuff(b);
}

public static void RemoveBuff(Mobile m, BuffIcon b)
{
PlayerMobile pm = m as PlayerMobile;

if (pm != null)
pm.RemoveBuff(b);
}
#endregion
}

public enum BuffIcon : short
{
DismountPrevention = 0x3E9,
NoRearm = 0x3EA,
//Currently, no 0x3EB or 0x3EC
NightSight = 0x3ED, //*
DeathStrike,
EvilOmen,
UnknownStandingSwirl, //Which is healing throttle & Stamina throttle?
UnknownKneelingSword,
DivineFury, //*
EnemyOfOne, //*
HidingAndOrStealth, //*
ActiveMeditation, //*
BloodOathCaster, //*
BloodOathCurse, //*
CorpseSkin, //*
Mindrot, //*
PainSpike, //*
Strangle,
GiftOfRenewal, //*
AttuneWeapon, //*
Thunderstorm, //*
EssenceOfWind, //*
EtherealVoyage, //*
GiftOfLife, //*
ArcaneEmpowerment, //*
MortalStrike,
ReactiveArmor, //*
Protection, //*
ArchProtection,
MagicReflection, //*
Incognito, //*
Disguised,
AnimalForm,
Polymorph,
Invisibility, //*
Paralyze, //*
Poison,
Bleed,
Clumsy, //*
FeebleMind, //*
Weaken, //*
Curse, //*
MassCurse,
Agility, //*
Cunning, //*
Strength, //*
Bless, //*
Sleep,
StoneForm,
SpellPlague,
SpellTrigger,
NetherBolt,
Fly
}

public sealed class AddBuffPacket : Packet
{
public AddBuffPacket(Mobile m, BuffInfo info)
: this(m, info.ID, info.TitleCliloc, info.SecondaryCliloc, info.Args, (info.TimeStart != DateTime.MinValue) ? ((info.TimeStart + info.TimeLength) - DateTime.UtcNow) : TimeSpan.Zero)
{
}

public AddBuffPacket(Mobile mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args, TimeSpan length)
: base(0xDF)
{
bool hasArgs = (args != null);

this.EnsureCapacity((hasArgs ? (48 + args.ToString().Length * 2) : 44));
this.m_Stream.Write((int)mob.Serial);

this.m_Stream.Write((short)iconID); //ID
this.m_Stream.Write((short)0x1); //Type 0 for removal. 1 for add 2 for Data

this.m_Stream.Fill(4);

this.m_Stream.Write((short)iconID); //ID
this.m_Stream.Write((short)0x01); //Type 0 for removal. 1 for add 2 for Data

this.m_Stream.Fill(4);

if (length < TimeSpan.Zero)
length = TimeSpan.Zero;

this.m_Stream.Write((short)length.TotalSeconds); //Time in seconds

this.m_Stream.Fill(3);
this.m_Stream.Write((int)titleCliloc);
this.m_Stream.Write((int)secondaryCliloc);

if (!hasArgs)
{
//m_Stream.Fill( 2 );
this.m_Stream.Fill(10);
}
else
{
this.m_Stream.Fill(4);
this.m_Stream.Write((short)0x1); //Unknown -> Possibly something saying 'hey, I have more data!'?
this.m_Stream.Fill(2);

//m_Stream.WriteLittleUniNull( "\t#1018280" );
this.m_Stream.WriteLittleUniNull(String.Format("\t{0}", args.ToString()));

this.m_Stream.Write((short)0x1); //Even more Unknown -> Possibly something saying 'hey, I have more data!'?
this.m_Stream.Fill(2);
}
}
}

public sealed class RemoveBuffPacket : Packet
{
public RemoveBuffPacket(Mobile mob, BuffInfo info)
: this(mob, info.ID)
{
}

public RemoveBuffPacket(Mobile mob, BuffIcon iconID)
: base(0xDF)
{
this.EnsureCapacity(13);
this.m_Stream.Write((int)mob.Serial);

this.m_Stream.Write((short)iconID); //ID
this.m_Stream.Write((short)0x0); //Type 0 for removal. 1 for add 2 for Data

this.m_Stream.Fill(4);
}
}
}
(This post was last modified: 11-26-2015 04:10 PM by galandeo.)
11-26-2015 04:09 PM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #2
RE: A questions about the BuffInfo
sphere.ini -> // OF_Buffs 00002000 // Enable the buff/debuff bar on ML clients >= 5.0.2b
11-26-2015 05:44 PM
Find all posts by this user Like Post Quote this message in a reply
galandeo
Apprentice
*

Posts: 6
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Nov 2015
Reputation: 0



Post: #3
RE: A questions about the BuffInfo
(11-26-2015 05:44 PM)XuN Wrote:  sphere.ini -> // OF_Buffs 00002000 // Enable the buff/debuff bar on ML clients >= 5.0.2b

Thanks


// Option flags
// Flags for options that affect server behaviour but not compatibility
// See the revisions.txt file for more details on this
// OF_Command_Sysmsgs = 00000008 //Shows status of hearall, allshow, allmove... commands after toggling them
// OF_OSIMultiSight = 00000020
// OF_Items_AutoName = 00000040
// OF_FileCommands = 00000080
// OF_NoItemNaming = 00000100
// OF_NoHouseMuteSpeech = 00000200
// OF_Flood_Protection = 00001000
// OF_Buffs = 00002000
// OF_NoPrefix = 00004000 // Add prefix "A" and "An" to itemnames or not
// OF_DyeType = 00008000 // if set allows using i_dye on all t_dye_vat instead of only i_dye_tub
// OF_DrinkIsFood = 00010000 // type T_DRINK will increase FOOD lvl like T_FOOD
// OF_DClickNoTurn = 00020000 // the player won't turn when dclick or targ an item
// OF_Specific = 01000000 // Specific behaviour, not completly tested
OptionFlags=00002208


I set it like this,My clients 6.0.1.10.but it do not work.
Am I wrong? Why
(This post was last modified: 11-26-2015 06:28 PM by galandeo.)
11-26-2015 06:28 PM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #4
RE: A questions about the BuffInfo
You have to have the correct resdisp on your account (6 in your case), minimum required is 5.
11-26-2015 09:49 PM
Find all posts by this user Like Post Quote this message in a reply
galandeo
Apprentice
*

Posts: 6
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Nov 2015
Reputation: 0



Post: #5
RE: A questions about the BuffInfo
(11-26-2015 09:49 PM)XuN Wrote:  You have to have the correct resdisp on your account (6 in your case), minimum required is 5.

So I need the "Kingdom Reborn"?
11-26-2015 10:10 PM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #6
RE: A questions about the BuffInfo
Why would you? Kingdom Reborn was a new client released in the Stygian Abyss expansion (was it with SA or with ML?? can't remember). You can use buffs on it too, but you don't need it, RESDISP refers to the expansion 'level', 6 means Stygian Abyss or ... client 6x.
11-26-2015 10:21 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)