Adds BufferReader and BufferWriter. Updates UOP handling. (#101)

This commit is contained in:
Kamron Batman 2020-04-12 21:33:24 -07:00 committed by GitHub
parent 2c0d97cd36
commit 038c3be258
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
98 changed files with 2458 additions and 2185 deletions

View file

@ -245,6 +245,7 @@ namespace Server.Items
{
EventSink.OpenSpellbookRequest += EventSink_OpenSpellbookRequest;
EventSink.CastSpellRequest += EventSink_CastSpellRequest;
EventSink.TargetedSpell += EventSink_TargetedSpell;
CommandSystem.Register("AllSpells", AccessLevel.GameMaster, AllSpells_OnCommand);
}
@ -278,14 +279,12 @@ namespace Server.Items
}
}
private static void EventSink_OpenSpellbookRequest(OpenSpellbookRequestEventArgs e)
private static void EventSink_OpenSpellbookRequest(Mobile from, int typeID)
{
Mobile from = e.Mobile;
if (!DesignContext.Check(from))
return; // They are customizing
var type = e.Type switch
var type = typeID switch
{
1 => SpellbookType.Regular,
2 => SpellbookType.Necromancer,
@ -302,15 +301,32 @@ namespace Server.Items
book?.DisplayTo(from);
}
private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
private static void EventSink_TargetedSpell(Mobile from, IEntity target, int spellId)
{
Mobile from = e.Mobile;
if (!DesignContext.Check(from)) return; // They are customizing
Spellbook book = Find(from, spellId);
if (book?.HasSpell(spellId) != true)
{
from.SendLocalizedMessage(500015); // You do not have that spell!
return;
}
SpecialMove move = SpellRegistry.GetSpecialMove(spellId);
if (move != null)
SpecialMove.SetCurrentMove(from, move);
else
SpellRegistry.NewSpell(spellId, @from, null)?.Cast();
}
private static void EventSink_CastSpellRequest(Mobile from, int spellID, Item item)
{
if (!DesignContext.Check(from))
return; // They are customizing
Spellbook book = e.Spellbook as Spellbook;
int spellID = e.SpellID;
Spellbook book = item as Spellbook;
if (book?.HasSpell(spellID) != true)
book = Find(from, spellID);
@ -688,7 +704,7 @@ namespace Server.Items
if ((prop = Attributes.RegenMana) != 0)
list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~
if ((prop = Attributes.NightSight) != 0)
if ((Attributes.NightSight) != 0)
list.Add(1060441); // night sight
if ((prop = Attributes.ReflectPhysical) != 0)
@ -700,7 +716,7 @@ namespace Server.Items
if ((prop = Attributes.RegenHits) != 0)
list.Add(1060444, prop.ToString()); // hit point regeneration ~1_val~
if ((prop = Attributes.SpellChanneling) != 0)
if ((Attributes.SpellChanneling) != 0)
list.Add(1060482); // spell channeling
if ((prop = Attributes.SpellDamage) != 0)

View file

@ -70,30 +70,27 @@ namespace Server.Items
}
}
private static void EventSink_BandageTargetRequest(BandageTargetRequestEventArgs e)
private static void EventSink_BandageTargetRequest(Mobile from, Item item, Mobile target)
{
if (!(e.Bandage is Bandage b) || b.Deleted)
if (!(item is Bandage b) || b.Deleted)
return;
Mobile from = e.Mobile;
if (from.InRange(b.GetWorldLocation(), Range))
{
if (from.Target != null)
{
Target.Cancel(from);
from.Target = null;
}
from.RevealingAction();
from.SendLocalizedMessage(500948); // Who will you use the bandages on?
new InternalTarget(b).Invoke(from, e.Target);
}
else
if (!from.InRange(b.GetWorldLocation(), Range))
{
from.SendLocalizedMessage(500295); // You are too far away to do that.
return;
}
if (from.Target != null)
{
Target.Cancel(from);
from.Target = null;
}
from.RevealingAction();
from.SendLocalizedMessage(500948); // Who will you use the bandages on?
new InternalTarget(b).Invoke(from, target);
}
private class InternalTarget : Target
@ -203,7 +200,7 @@ namespace Server.Items
{
StopHeal();
int healerNumber = -1, patientNumber = -1;
int healerNumber, patientNumber;
bool playSound = true;
bool checkSkills = false;