Fixes expressions that are always true, null, or flase.
This commit is contained in:
parent
970fd563b2
commit
7321fa1b63
6 changed files with 14 additions and 29 deletions
|
|
@ -77,17 +77,17 @@ namespace Server.Commands
|
||||||
|
|
||||||
IPooledEnumerable<IEntity> eable;
|
IPooledEnumerable<IEntity> eable;
|
||||||
|
|
||||||
if ((items || multis) && mobiles)
|
if (!items && !multis || !mobiles)
|
||||||
eable = map.GetObjectsInBounds(rect, items || multis, mobiles);
|
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
eable = map.GetObjectsInBounds(rect, true, true);
|
||||||
|
|
||||||
foreach (IEntity obj in eable)
|
foreach (IEntity obj in eable)
|
||||||
if (items && obj is Item && !(obj is BaseMulti || obj is HouseSign))
|
if (items && obj is Item && !(obj is BaseMulti || obj is HouseSign))
|
||||||
toDelete.Add(obj);
|
toDelete.Add(obj);
|
||||||
else if (multis && obj is BaseMulti)
|
else if (multis && obj is BaseMulti)
|
||||||
toDelete.Add(obj);
|
toDelete.Add(obj);
|
||||||
else if (mobiles && obj is Mobile mobile && !mobile.Player)
|
else if (obj is Mobile mobile && !mobile.Player)
|
||||||
toDelete.Add(mobile);
|
toDelete.Add(mobile);
|
||||||
|
|
||||||
eable.Free();
|
eable.Free();
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,7 @@ namespace Server.Engines.BulkOrders
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
Container pack = m_From.Backpack;
|
Container pack = m_From.Backpack;
|
||||||
if (pack == null || pack != null && !pack.CheckHold(m_From, item, true, true, 0,
|
if (pack == null || !pack.CheckHold(m_From, item, true, true, 0,
|
||||||
item.PileWeight + item.TotalWeight))
|
item.PileWeight + item.TotalWeight))
|
||||||
{
|
{
|
||||||
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
|
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ namespace Server.Engines.BulkOrders
|
||||||
|
|
||||||
Container pack = m_From.Backpack;
|
Container pack = m_From.Backpack;
|
||||||
|
|
||||||
if (pack == null || pack != null && !pack.CheckHold(m_From, item, true, true, 0,
|
if (pack == null || !pack.CheckHold(m_From, item, true, true, 0,
|
||||||
item.PileWeight + item.TotalWeight))
|
item.PileWeight + item.TotalWeight))
|
||||||
{
|
{
|
||||||
pv.SayTo(m_From, 503204); // You do not have room in your backpack for this
|
pv.SayTo(m_From, 503204); // You do not have room in your backpack for this
|
||||||
|
|
@ -94,7 +94,7 @@ namespace Server.Engines.BulkOrders
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pack != null && pack.ConsumeTotal(typeof(Gold), price) || Banker.Withdraw(m_From, price))
|
if (pack.ConsumeTotal(typeof(Gold), price) || Banker.Withdraw(m_From, price))
|
||||||
{
|
{
|
||||||
m_Book.Entries.Remove(m_Object);
|
m_Book.Entries.Remove(m_Object);
|
||||||
m_Book.InvalidateProperties();
|
m_Book.InvalidateProperties();
|
||||||
|
|
|
||||||
|
|
@ -53,14 +53,14 @@ namespace Server.Engines.Chat
|
||||||
|
|
||||||
accountChatName = accountChatName?.Trim();
|
accountChatName = accountChatName?.Trim();
|
||||||
|
|
||||||
if (accountChatName != null && accountChatName.Length > 0)
|
if (!string.IsNullOrEmpty(accountChatName))
|
||||||
{
|
{
|
||||||
if (chatName.Length > 0 && chatName != accountChatName)
|
if (chatName.Length > 0 && chatName != accountChatName)
|
||||||
from.SendMessage("You cannot change chat nickname once it has been set.");
|
from.SendMessage("You cannot change chat nickname once it has been set.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (chatName == null || chatName.Length == 0)
|
if (chatName.Length == 0)
|
||||||
{
|
{
|
||||||
SendCommandTo(from, ChatCommand.AskNewNickname);
|
SendCommandTo(from, ChatCommand.AskNewNickname);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1609,16 +1609,16 @@ namespace Server.Engines.ConPVP
|
||||||
Item[] bombs = corpse.FindItemsByType(typeof(BRBomb), false);
|
Item[] bombs = corpse.FindItemsByType(typeof(BRBomb), false);
|
||||||
|
|
||||||
for (int i = 0; i < bombs.Length; ++i)
|
for (int i = 0; i < bombs.Length; ++i)
|
||||||
(bombs[i] as BRBomb).DropTo(mob, killer);
|
(bombs[i] as BRBomb)?.DropTo(mob, killer);
|
||||||
|
|
||||||
hadBomb = hadBomb || bombs.Length > 0;
|
hadBomb = bombs.Length > 0;
|
||||||
|
|
||||||
if (mob.Backpack != null)
|
if (mob.Backpack != null)
|
||||||
{
|
{
|
||||||
bombs = mob.Backpack.FindItemsByType(typeof(BRBomb), false);
|
bombs = mob.Backpack.FindItemsByType(typeof(BRBomb), false);
|
||||||
|
|
||||||
for (int i = 0; i < bombs.Length; ++i)
|
for (int i = 0; i < bombs.Length; ++i)
|
||||||
(bombs[i] as BRBomb).DropTo(mob, killer);
|
(bombs[i] as BRBomb)?.DropTo(mob, killer);
|
||||||
|
|
||||||
hadBomb = hadBomb || bombs.Length > 0;
|
hadBomb = hadBomb || bombs.Length > 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1081,17 +1081,7 @@ namespace Server.Items
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ConsumeTotal(Type[][] types, int[] amounts)
|
public int ConsumeTotal(Type[][] types, int[] amounts, bool recurse = true, OnItemConsumed callback = null)
|
||||||
{
|
|
||||||
return ConsumeTotal(types, amounts, true, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ConsumeTotal(Type[][] types, int[] amounts, bool recurse)
|
|
||||||
{
|
|
||||||
return ConsumeTotal(types, amounts, recurse, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ConsumeTotal(Type[][] types, int[] amounts, bool recurse, OnItemConsumed callback)
|
|
||||||
{
|
{
|
||||||
if (types.Length != amounts.Length)
|
if (types.Length != amounts.Length)
|
||||||
throw new ArgumentException();
|
throw new ArgumentException();
|
||||||
|
|
@ -1507,12 +1497,7 @@ namespace Server.Items
|
||||||
|
|
||||||
#region Non-Generic FindItem[s] by Type
|
#region Non-Generic FindItem[s] by Type
|
||||||
|
|
||||||
public Item[] FindItemsByType(Type type)
|
public Item[] FindItemsByType(Type type, bool recurse = true)
|
||||||
{
|
|
||||||
return FindItemsByType(type, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Item[] FindItemsByType(Type type, bool recurse)
|
|
||||||
{
|
{
|
||||||
if (m_FindItemsList.Count > 0)
|
if (m_FindItemsList.Count > 0)
|
||||||
m_FindItemsList.Clear();
|
m_FindItemsList.Clear();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue