Adds BufferReader and BufferWriter. Updates UOP handling. (#101)
This commit is contained in:
parent
2c0d97cd36
commit
038c3be258
98 changed files with 2458 additions and 2185 deletions
|
|
@ -1,15 +1,15 @@
|
|||
namespace Server.Chat
|
||||
{
|
||||
public class ChatSystem
|
||||
public static class ChatSystem
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
EventSink.ChatRequest += EventSink_ChatRequest;
|
||||
}
|
||||
|
||||
private static void EventSink_ChatRequest(ChatRequestEventArgs e)
|
||||
private static void EventSink_ChatRequest(Mobile m)
|
||||
{
|
||||
e.Mobile.SendMessage("Chat is not currently supported.");
|
||||
m.SendMessage("Chat is not currently supported.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Engines.PartySystem;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
|
|
@ -160,7 +161,7 @@ namespace Server.Engines.ConPVP
|
|||
if (spell is RecallSpell)
|
||||
from.SendMessage("You may not cast this spell.");
|
||||
|
||||
string title = null;
|
||||
string title;
|
||||
string option;
|
||||
|
||||
switch (spell)
|
||||
|
|
@ -498,7 +499,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(mob);
|
||||
|
||||
if (pl?.Eliminated == true || m_EventGame?.OnDeath(mob, corpse) == false)
|
||||
if (pl?.Eliminated != false || m_EventGame?.OnDeath(mob, corpse) == false)
|
||||
return;
|
||||
|
||||
pl.Eliminated = true;
|
||||
|
|
@ -1075,30 +1076,13 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
public static bool CheckCombat(Mobile m)
|
||||
public static bool CheckCombat(Mobile m) =>
|
||||
m.Aggressed.Any(info => info.Defender.Player && DateTime.UtcNow - info.LastCombatTime < CombatDelay) ||
|
||||
m.Aggressors.Any(info => info.Attacker.Player && DateTime.UtcNow - info.LastCombatTime < CombatDelay);
|
||||
|
||||
private static void EventSink_Login(Mobile m)
|
||||
{
|
||||
for (int i = 0; i < m.Aggressed.Count; ++i)
|
||||
{
|
||||
AggressorInfo info = m.Aggressed[i];
|
||||
|
||||
if (info.Defender.Player && DateTime.UtcNow - info.LastCombatTime < CombatDelay)
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m.Aggressors.Count; ++i)
|
||||
{
|
||||
AggressorInfo info = m.Aggressors[i];
|
||||
|
||||
if (info.Attacker.Player && DateTime.UtcNow - info.LastCombatTime < CombatDelay)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void EventSink_Login(LoginEventArgs e)
|
||||
{
|
||||
if (!(e.Mobile is PlayerMobile pm))
|
||||
if (!(m is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
DuelContext dc = pm.DuelContext;
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@ namespace Server.Engines.Doom
|
|||
EventSink.Login += OnLogin;
|
||||
}
|
||||
|
||||
public static void OnLogin(LoginEventArgs e)
|
||||
public static void OnLogin(Mobile m)
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
Rectangle2D rect = LeverPuzzleController.lr_Rect;
|
||||
if (m.X >= rect.X && m.X <= rect.X + 10 && m.Y >= rect.Y && m.Y <= rect.Y + 10 && m.Map == Map.Internal)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -940,7 +940,7 @@ namespace Server.Factions
|
|||
int silver = killerState.Faction.AwardSilver(killer, bc.FactionSilverWorth);
|
||||
|
||||
if (silver > 0)
|
||||
killer.SendLocalizedMessage(1042748,
|
||||
killer?.SendLocalizedMessage(1042748,
|
||||
silver.ToString("N0")); // Thou hast earned ~1_AMOUNT~ silver for vanquishing the vile creature.
|
||||
}
|
||||
|
||||
|
|
@ -981,7 +981,7 @@ namespace Server.Factions
|
|||
{
|
||||
if (victimState.KillPoints <= -6)
|
||||
{
|
||||
killer.SendLocalizedMessage(501693); // This victim is not worth enough to get kill points from.
|
||||
killer?.SendLocalizedMessage(501693); // This victim is not worth enough to get kill points from.
|
||||
|
||||
#region Ethics
|
||||
|
||||
|
|
@ -1029,7 +1029,7 @@ namespace Server.Factions
|
|||
int silver = killerState.Faction.AwardSilver(killer, award * 40);
|
||||
|
||||
if (silver > 0)
|
||||
killer.SendLocalizedMessage(1042736,
|
||||
killer?.SendLocalizedMessage(1042736,
|
||||
$"{silver:N0} silver\t{victim.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
|
||||
}
|
||||
|
||||
|
|
@ -1038,9 +1038,9 @@ namespace Server.Factions
|
|||
|
||||
int offset = award != 1 ? 0 : 2; // for pluralization
|
||||
|
||||
string args = $"{award}\t{victim.Name}\t{killer.Name}";
|
||||
string args = $"{award}\t{victim.Name}\t{killer?.Name}";
|
||||
|
||||
killer.SendLocalizedMessage(1042737 + offset,
|
||||
killer?.SendLocalizedMessage(1042737 + offset,
|
||||
args); // Thou hast been honored with ~1_KILL_POINTS~ kill point(s) for vanquishing ~2_DEAD_PLAYER~!
|
||||
victim.SendLocalizedMessage(1042738 + offset,
|
||||
args); // Thou has lost ~1_KILL_POINTS~ kill point(s) to ~3_ATTACKER_NAME~ for being vanquished!
|
||||
|
|
@ -1072,24 +1072,19 @@ namespace Server.Factions
|
|||
}
|
||||
else
|
||||
{
|
||||
killer.SendLocalizedMessage(
|
||||
killer?.SendLocalizedMessage(
|
||||
1042231); // You have recently defeated this enemy and thus their death brings you no honor.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_Logout(LogoutEventArgs e)
|
||||
private static void EventSink_Logout(Mobile m)
|
||||
{
|
||||
e.Mobile.Backpack?.FindItemsByType<Sigil>().ForEach(sigil => sigil.ReturnHome());
|
||||
m.Backpack?.FindItemsByType<Sigil>().ForEach(sigil => sigil.ReturnHome());
|
||||
}
|
||||
|
||||
private static void EventSink_Login(LoginEventArgs e)
|
||||
{
|
||||
Mobile mob = e.Mobile;
|
||||
|
||||
CheckLeaveTimer(mob);
|
||||
}
|
||||
private static void EventSink_Login(Mobile m) => CheckLeaveTimer(m);
|
||||
|
||||
public static void WriteReference(IGenericWriter writer, Faction fact)
|
||||
{
|
||||
|
|
@ -1102,10 +1097,7 @@ namespace Server.Factions
|
|||
{
|
||||
int idx = reader.ReadEncodedInt() - 1;
|
||||
|
||||
if (idx >= 0 && idx < Factions.Count)
|
||||
return Factions[idx];
|
||||
|
||||
return null;
|
||||
return idx >= 0 && idx < Factions.Count ? Factions[idx] : null;
|
||||
}
|
||||
|
||||
public static Faction Find(Mobile mob, bool inherit = false, bool creatureAllegiances = false)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Network;
|
|||
|
||||
namespace Server.Factions
|
||||
{
|
||||
public class Keywords
|
||||
public static class Keywords
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
|
|
@ -194,19 +195,17 @@ namespace Server.Engines.Help
|
|||
EventSink.HelpRequest += EventSink_HelpRequest;
|
||||
}
|
||||
|
||||
private static void EventSink_HelpRequest(HelpRequestEventArgs e)
|
||||
private static void EventSink_HelpRequest(Mobile m)
|
||||
{
|
||||
foreach (Gump g in e.Mobile.NetState.Gumps)
|
||||
if (g is HelpGump)
|
||||
return;
|
||||
if (m.NetState.Gumps.OfType<HelpGump>().Any()) return;
|
||||
|
||||
if (!PageQueue.CheckAllowedToPage(e.Mobile))
|
||||
if (!PageQueue.CheckAllowedToPage(m))
|
||||
return;
|
||||
|
||||
if (PageQueue.Contains(e.Mobile))
|
||||
e.Mobile.SendMenu(new ContainedMenu(e.Mobile));
|
||||
if (PageQueue.Contains(m))
|
||||
m.SendMenu(new ContainedMenu(m));
|
||||
else
|
||||
e.Mobile.SendGump(new HelpGump(e.Mobile));
|
||||
m.SendGump(new HelpGump(m));
|
||||
}
|
||||
|
||||
private static bool IsYoung(Mobile m) => m is PlayerMobile mobile && mobile.Young;
|
||||
|
|
|
|||
|
|
@ -535,9 +535,9 @@ namespace Server.Engines.MLQuests
|
|||
}
|
||||
}
|
||||
|
||||
public static void EventSink_QuestGumpRequest(QuestGumpRequestArgs args)
|
||||
public static void EventSink_QuestGumpRequest(Mobile m)
|
||||
{
|
||||
if (!Enabled || !(args.Mobile is PlayerMobile pm))
|
||||
if (!Enabled || !(m is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
pm.SendGump(new QuestLogGump(pm));
|
||||
|
|
|
|||
|
|
@ -134,9 +134,8 @@ namespace Server.Engines.PartySystem
|
|||
}
|
||||
}
|
||||
|
||||
public static void EventSink_PlayerDeath(PlayerDeathEventArgs e)
|
||||
public static void EventSink_PlayerDeath(Mobile from)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
Party p = Get(from);
|
||||
|
||||
if (p != null)
|
||||
|
|
@ -152,9 +151,8 @@ namespace Server.Engines.PartySystem
|
|||
}
|
||||
}
|
||||
|
||||
public static void EventSink_Login(LoginEventArgs e)
|
||||
public static void EventSink_Login(Mobile from)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
Party p = Get(from);
|
||||
|
||||
if (p != null)
|
||||
|
|
@ -163,9 +161,8 @@ namespace Server.Engines.PartySystem
|
|||
from.Party = null;
|
||||
}
|
||||
|
||||
public static void EventSink_Logout(LogoutEventArgs e)
|
||||
public static void EventSink_Logout(Mobile from)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
Party p = Get(from);
|
||||
|
||||
p?.Remove(from);
|
||||
|
|
|
|||
|
|
@ -407,10 +407,8 @@ namespace Server.Engines.Plants
|
|||
EventSink.Login += EventSink_Login;
|
||||
}
|
||||
|
||||
private static void EventSink_Login(LoginEventArgs args)
|
||||
private static void EventSink_Login(Mobile from)
|
||||
{
|
||||
Mobile from = args.Mobile;
|
||||
|
||||
from.Backpack?.FindItemsByType<PlantItem>().ForEach(plant =>
|
||||
{
|
||||
if (plant.IsGrowable)
|
||||
|
|
@ -443,7 +441,7 @@ namespace Server.Engines.Plants
|
|||
GrowAll();
|
||||
}
|
||||
|
||||
private static void EventSink_WorldSave(WorldSaveEventArgs args)
|
||||
private static void EventSink_WorldSave(bool message)
|
||||
{
|
||||
GrowAll();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ namespace Server.Engines.VeteranRewards
|
|||
if (args == null && entries[j].Args.Length == 0)
|
||||
return i + 1;
|
||||
|
||||
if (args.Length == entries[j].Args.Length)
|
||||
if (args?.Length == entries[j].Args.Length)
|
||||
{
|
||||
bool match = true;
|
||||
|
||||
|
|
@ -467,15 +467,15 @@ namespace Server.Engines.VeteranRewards
|
|||
EventSink.Login += EventSink_Login;
|
||||
}
|
||||
|
||||
private static void EventSink_Login(LoginEventArgs e)
|
||||
private static void EventSink_Login(Mobile m)
|
||||
{
|
||||
if (!e.Mobile.Alive)
|
||||
if (!m.Alive)
|
||||
return;
|
||||
|
||||
ComputeRewardInfo(e.Mobile, out int cur, out int max, out int level);
|
||||
ComputeRewardInfo(m, out int cur, out int max, out int level);
|
||||
|
||||
if (e.Mobile.SkillsCap == 7000 || e.Mobile.SkillsCap == 7050 || e.Mobile.SkillsCap == 7100 ||
|
||||
e.Mobile.SkillsCap == 7150 || e.Mobile.SkillsCap == 7200)
|
||||
if (m.SkillsCap == 7000 || m.SkillsCap == 7050 || m.SkillsCap == 7100 ||
|
||||
m.SkillsCap == 7150 || m.SkillsCap == 7200)
|
||||
{
|
||||
if (level > 4)
|
||||
level = 4;
|
||||
|
|
@ -483,19 +483,19 @@ namespace Server.Engines.VeteranRewards
|
|||
level = 0;
|
||||
|
||||
if (SkillCapRewards)
|
||||
e.Mobile.SkillsCap = 7000 + level * 50;
|
||||
m.SkillsCap = 7000 + level * 50;
|
||||
else
|
||||
e.Mobile.SkillsCap = 7000;
|
||||
m.SkillsCap = 7000;
|
||||
}
|
||||
|
||||
if (Core.ML && e.Mobile is PlayerMobile mobile && !mobile.HasStatReward && HasHalfLevel(mobile))
|
||||
if (Core.ML && m is PlayerMobile pm && !pm.HasStatReward && HasHalfLevel(pm))
|
||||
{
|
||||
mobile.HasStatReward = true;
|
||||
mobile.StatCap += 5;
|
||||
pm.HasStatReward = true;
|
||||
pm.StatCap += 5;
|
||||
}
|
||||
|
||||
if (cur < max)
|
||||
e.Mobile.SendGump(new RewardNoticeGump(e.Mobile));
|
||||
m.SendGump(new RewardNoticeGump(m));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,47 +64,41 @@ namespace Server
|
|||
m_Callbacks[gumpID] = callback;
|
||||
}
|
||||
|
||||
private static void EventSink_VirtueItemRequest(VirtueItemRequestEventArgs e)
|
||||
private static void EventSink_VirtueItemRequest(Mobile beholder, Mobile beheld, int gumpID)
|
||||
{
|
||||
if (e.Beholder != e.Beheld)
|
||||
if (beholder != beheld)
|
||||
return;
|
||||
|
||||
e.Beholder.CloseGump<VirtueGump>();
|
||||
beholder.CloseGump<VirtueGump>();
|
||||
|
||||
if (e.Beholder.Kills >= 5)
|
||||
if (beholder.Kills >= 5)
|
||||
{
|
||||
e.Beholder.SendLocalizedMessage(1049609); // Murderers cannot invoke this virtue.
|
||||
beholder.SendLocalizedMessage(1049609); // Murderers cannot invoke this virtue.
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_Callbacks.TryGetValue(e.GumpID, out OnVirtueUsed callback))
|
||||
callback(e.Beholder);
|
||||
if (m_Callbacks.TryGetValue(gumpID, out OnVirtueUsed callback))
|
||||
callback(beholder);
|
||||
else
|
||||
e.Beholder.SendLocalizedMessage(1052066); // That virtue is not active yet.
|
||||
beholder.SendLocalizedMessage(1052066); // That virtue is not active yet.
|
||||
}
|
||||
|
||||
|
||||
private static void EventSink_VirtueMacroRequest(VirtueMacroRequestEventArgs e)
|
||||
private static void EventSink_VirtueMacroRequest(Mobile beholder, int virtue)
|
||||
{
|
||||
var virtueID = e.VirtueID switch
|
||||
var virtueID = virtue switch
|
||||
{
|
||||
0 => // Honor
|
||||
107,
|
||||
1 => // Sacrifice
|
||||
110,
|
||||
2 => // Valor;
|
||||
112,
|
||||
0 => 107, // Honor
|
||||
1 => 110, // Sacrifice
|
||||
2 => 112, // Valor;
|
||||
_ => 0
|
||||
};
|
||||
|
||||
EventSink_VirtueItemRequest(new VirtueItemRequestEventArgs(e.Mobile, e.Mobile, virtueID));
|
||||
EventSink_VirtueItemRequest(beholder, beholder, virtueID);
|
||||
}
|
||||
|
||||
private static void EventSink_VirtueGumpRequest(VirtueGumpRequestEventArgs e)
|
||||
private static void EventSink_VirtueGumpRequest(Mobile beholder, Mobile beheld)
|
||||
{
|
||||
Mobile beholder = e.Beholder;
|
||||
Mobile beheld = e.Beheld;
|
||||
|
||||
if (beholder == beheld && beholder.Kills >= 5)
|
||||
{
|
||||
beholder.SendLocalizedMessage(1049609); // Murderers cannot invoke this virtue.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue