parent
096d39609e
commit
8e9221bb5a
400 changed files with 3688 additions and 5969 deletions
|
|
@ -252,15 +252,11 @@ namespace Server.Mobiles
|
|||
{
|
||||
Item buyItem;
|
||||
if (amount >= item.Amount)
|
||||
{
|
||||
buyItem = item;
|
||||
}
|
||||
else
|
||||
{
|
||||
buyItem = LiftItemDupe(item, item.Amount - amount) ?? item;
|
||||
}
|
||||
|
||||
if (cont == null || !cont.TryDropItem(buyer, buyItem, false))
|
||||
if (cont?.TryDropItem(buyer, buyItem, false) != true)
|
||||
buyItem.MoveToWorld(buyer.Location, buyer.Map);
|
||||
|
||||
break;
|
||||
|
|
@ -508,15 +504,15 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual int GetRandomHue()
|
||||
{
|
||||
switch (Utility.Random(5))
|
||||
return Utility.Random(5) switch
|
||||
{
|
||||
default:
|
||||
case 0: return Utility.RandomBlueHue();
|
||||
case 1: return Utility.RandomGreenHue();
|
||||
case 2: return Utility.RandomRedHue();
|
||||
case 3: return Utility.RandomYellowHue();
|
||||
case 4: return Utility.RandomNeutralHue();
|
||||
}
|
||||
0 => Utility.RandomBlueHue(),
|
||||
1 => Utility.RandomGreenHue(),
|
||||
2 => Utility.RandomRedHue(),
|
||||
3 => Utility.RandomYellowHue(),
|
||||
4 => Utility.RandomNeutralHue(),
|
||||
_ => Utility.RandomBlueHue()
|
||||
};
|
||||
}
|
||||
|
||||
public virtual int GetShoeHue() => 0.1 > Utility.RandomDouble() ? 0 : Utility.RandomNeutralHue();
|
||||
|
|
@ -598,12 +594,12 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual int GetRandomNecromancerHue()
|
||||
{
|
||||
switch (Utility.Random(20))
|
||||
return Utility.Random(20) switch
|
||||
{
|
||||
case 0: return 0;
|
||||
case 1: return 0x4E9;
|
||||
default: return Utility.RandomList(0x485, 0x497);
|
||||
}
|
||||
0 => 0,
|
||||
1 => 0x4E9,
|
||||
_ => Utility.RandomList(0x485, 0x497)
|
||||
};
|
||||
}
|
||||
|
||||
public virtual void TurnToNecromancer()
|
||||
|
|
@ -903,15 +899,13 @@ namespace Server.Mobiles
|
|||
List<SellItemState> list = new List<SellItemState>();
|
||||
|
||||
foreach (IShopSellInfo ssi in info)
|
||||
foreach (Item item in pack.FindItemsByType(ssi.Types))
|
||||
{
|
||||
foreach (Item item in pack.FindItemsByType(ssi.Types))
|
||||
{
|
||||
if (item is Container container && container.Items.Count != 0)
|
||||
continue;
|
||||
if (item is Container container && container.Items.Count != 0)
|
||||
continue;
|
||||
|
||||
if (item.IsStandardLoot() && item.Movable && ssi.IsSellable(item))
|
||||
list.Add(new SellItemState(item, ssi.GetSellPriceFor(item), ssi.GetNameFor(item)));
|
||||
}
|
||||
if (item.IsStandardLoot() && item.Movable && ssi.IsSellable(item))
|
||||
list.Add(new SellItemState(item, ssi.GetSellPriceFor(item), ssi.GetNameFor(item)));
|
||||
}
|
||||
|
||||
if (list.Count > 0)
|
||||
|
|
@ -992,10 +986,8 @@ namespace Server.Mobiles
|
|||
IBuyItemInfo[] buyInfo = GetBuyInfo();
|
||||
|
||||
for (int i = 0; i < buyInfo.Length; ++i)
|
||||
{
|
||||
if (buyInfo[i] is GenericBuyInfo gbi && gbi.GetDisplayEntity() == obj)
|
||||
return gbi;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1045,26 +1037,24 @@ namespace Server.Mobiles
|
|||
{
|
||||
item.Amount = amount;
|
||||
|
||||
if (cont == null || !cont.TryDropItem(buyer, item, false))
|
||||
if (cont?.TryDropItem(buyer, item, false) != true)
|
||||
item.MoveToWorld(buyer.Location, buyer.Map);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Amount = 1;
|
||||
|
||||
if (cont == null || !cont.TryDropItem(buyer, item, false))
|
||||
if (cont?.TryDropItem(buyer, item, false) != true)
|
||||
item.MoveToWorld(buyer.Location, buyer.Map);
|
||||
|
||||
for (int i = 1; i < amount; i++)
|
||||
{
|
||||
if (bii.GetEntity() is Item newItem)
|
||||
{
|
||||
newItem.Amount = 1;
|
||||
|
||||
if (cont == null || !cont.TryDropItem(buyer, newItem, false))
|
||||
if (cont?.TryDropItem(buyer, newItem, false) != true)
|
||||
newItem.MoveToWorld(buyer.Location, buyer.Map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (o is Mobile m)
|
||||
|
|
@ -1080,7 +1070,6 @@ namespace Server.Mobiles
|
|||
}
|
||||
|
||||
for (int i = 1; i < amount; ++i)
|
||||
{
|
||||
if (bii.GetEntity() is Mobile newMobile)
|
||||
{
|
||||
newMobile.Direction = (Direction)Utility.Random(8);
|
||||
|
|
@ -1092,7 +1081,6 @@ namespace Server.Mobiles
|
|||
newBc.ControlOrder = OrderType.Stop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1118,29 +1106,17 @@ namespace Server.Mobiles
|
|||
GenericBuyInfo gbi = buyInfo[j];
|
||||
|
||||
int maxAmount = gbi.MaxAmount;
|
||||
int doubled = 0;
|
||||
|
||||
switch (maxAmount)
|
||||
var doubled = maxAmount switch
|
||||
{
|
||||
case 40:
|
||||
doubled = 1;
|
||||
break;
|
||||
case 80:
|
||||
doubled = 2;
|
||||
break;
|
||||
case 160:
|
||||
doubled = 3;
|
||||
break;
|
||||
case 320:
|
||||
doubled = 4;
|
||||
break;
|
||||
case 640:
|
||||
doubled = 5;
|
||||
break;
|
||||
case 999:
|
||||
doubled = 6;
|
||||
break;
|
||||
}
|
||||
40 => 1,
|
||||
80 => 2,
|
||||
160 => 3,
|
||||
320 => 4,
|
||||
640 => 5,
|
||||
999 => 6,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
if (doubled > 0)
|
||||
{
|
||||
|
|
@ -1188,29 +1164,16 @@ namespace Server.Mobiles
|
|||
{
|
||||
GenericBuyInfo gbi = buyInfo[buyInfoIndex];
|
||||
|
||||
int amount = 20;
|
||||
|
||||
switch (doubled)
|
||||
var amount = doubled switch
|
||||
{
|
||||
case 1:
|
||||
amount = 40;
|
||||
break;
|
||||
case 2:
|
||||
amount = 80;
|
||||
break;
|
||||
case 3:
|
||||
amount = 160;
|
||||
break;
|
||||
case 4:
|
||||
amount = 320;
|
||||
break;
|
||||
case 5:
|
||||
amount = 640;
|
||||
break;
|
||||
case 6:
|
||||
amount = 999;
|
||||
break;
|
||||
}
|
||||
1 => 40,
|
||||
2 => 80,
|
||||
3 => 160,
|
||||
4 => 320,
|
||||
5 => 640,
|
||||
6 => 999,
|
||||
_ => 20
|
||||
};
|
||||
|
||||
gbi.Amount = gbi.MaxAmount = amount;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue