Skip to content

Commit

Permalink
Ranger Equipment fix, Additem delete (ServUO#5012)
Browse files Browse the repository at this point in the history
* Ranger Equipment fix, Additem delete
- add parameter with default value to AddItem
- On Conflict, still log conflict, but delete the conflicting Item by default

- Delete the base boots of Rangers befor adding the new boots

* Updated Mobile Scripts

- went through all scripts to update them to SetWearable
- reverted change to AddItem

* Update to SetWearable

- last item being set will be worn (if no override to OnEquip returns false
- delete the item on the layer that is the same as the new item (if existend)
- used ifs to cap item.Movable, therefor no need to call to Random if <= 0 or >= 1

* Update base InitOutFit

- replaced the Additem for Backpack with SetWearable, Movable is getting set this way too
- altered the other SetWearable calls, to allow the items to be moved / dropped (as they should normally)

* Null reference sanity check.

Co-authored-by: Voxpire <[email protected]>
  • Loading branch information
pyro17 and Voxpire committed Jun 16, 2022
1 parent 1ae6152 commit bebc100
Show file tree
Hide file tree
Showing 351 changed files with 10,075 additions and 11,157 deletions.
14 changes: 7 additions & 7 deletions Scripts/Mobiles/Bosses/Barracoon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public Barracoon()
SetSkill(SkillName.Wrestling, 118.4, 122.7);

Fame = 22500;
Karma = -22500;

AddItem(new FancyShirt(Utility.RandomGreenHue()));
AddItem(new LongPants(Utility.RandomYellowHue()));
AddItem(new JesterHat(Utility.RandomPinkHue()));
AddItem(new Cloak(Utility.RandomPinkHue()));
AddItem(new Sandals());
Karma = -22500;

SetWearable(new FancyShirt(), Utility.RandomGreenHue(), 1);
SetWearable(new LongPants(), Utility.RandomYellowHue(), 1);
SetWearable(new JesterHat(), Utility.RandomPinkHue(), 1);
SetWearable(new Cloak(), Utility.RandomPinkHue(), 1);
SetWearable(new Sandals(), 1);

HairItemID = 0x203B; // Short Hair
HairHue = 0x94;
Expand Down
18 changes: 9 additions & 9 deletions Scripts/Mobiles/Bosses/Corgul/SoulboundPirateCaptain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public SoulboundPirateCaptain()
SetSkill(SkillName.Anatomy, 110.0, 120.0);

Fame = 8000;
Karma = -8000;

AddItem(new TricorneHat(1));
AddItem(new LeatherArms());
AddItem(new FancyShirt(1));
AddItem(new ShortPants(1));
AddItem(new Cutlass());
AddItem(new Boots(Utility.RandomNeutralHue()));
AddItem(new GoldEarrings());
Karma = -8000;

SetWearable(new TricorneHat(), 1, 1);
SetWearable(new LeatherArms(), dropChance: 1);
SetWearable(new FancyShirt(), 1, 1);
SetWearable(new ShortPants(), 1, 1);
SetWearable(new Cutlass(), dropChance: 1);
SetWearable(new Boots(), Utility.RandomNeutralHue(), 1);
SetWearable(new GoldEarrings(), dropChance: 1);

}

Expand Down
38 changes: 16 additions & 22 deletions Scripts/Mobiles/Bosses/Corgul/SoulboundPirateRaider.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Server.Items;

namespace Server.Mobiles
Expand Down Expand Up @@ -55,30 +56,23 @@ public SoulboundPirateRaider()
SetSkill(SkillName.Anatomy, 90.0, 105.5);

Fame = 2000;
Karma = -2000;

AddItem(new TricorneHat());
AddItem(new LeatherArms());
AddItem(new FancyShirt());
AddItem(new ShortPants());
AddItem(new Cutlass());
AddItem(new Boots(Utility.RandomNeutralHue()));
AddItem(new GoldEarrings());

Item bow;

switch (Utility.Random(4))
{
default:
case 0: bow = new CompositeBow();break;
case 1: bow = new Crossbow(); break;
case 2: bow = new Bow(); break;
case 3: bow = new HeavyCrossbow(); break;
}

AddItem(bow);
Karma = -2000;

SetWearable(new TricorneHat(), dropChance: 1);
SetWearable(new LeatherArms(), dropChance: 1);
SetWearable(new FancyShirt(), dropChance: 1);
SetWearable(new ShortPants(), dropChance: 1);
SetWearable(new Cutlass(), dropChance: 1);
SetWearable(new Boots(), Utility.RandomNeutralHue(), 1);
SetWearable(new GoldEarrings(), dropChance: 1);
SetWearable((Item)Activator.CreateInstance(Utility.RandomList(_WeaponsList)), dropChance: 1);
}

private static readonly Type[] _WeaponsList = new Type[]
{
typeof(CompositeBow), typeof(Crossbow), typeof(Bow), typeof(HeavyCrossbow)
};

public override void GenerateLoot()
{
AddLoot(LootPack.FilthyRich, 2);
Expand Down
18 changes: 9 additions & 9 deletions Scripts/Mobiles/Bosses/Corgul/SoulboundSwashbuckler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public SoulboundSwashbuckler()
SetSkill(SkillName.Anatomy, 65.0, 87.5);

Fame = 2000;
Karma = -2000;

AddItem(new Bandana());
AddItem(new LeatherArms());
AddItem(new FancyShirt());
AddItem(new ShortPants());
AddItem(new Cutlass());
AddItem(new Boots(Utility.RandomNeutralHue()));
AddItem(new SilverEarrings());
Karma = -2000;

SetWearable(new Bandana(), dropChance: 1);
SetWearable(new LeatherArms(), dropChance: 1);
SetWearable(new FancyShirt(), dropChance: 1);
SetWearable(new ShortPants(), dropChance: 1);
SetWearable(new Cutlass(), dropChance: 1);
SetWearable(new Boots(), Utility.RandomNeutralHue(), 1);
SetWearable(new SilverEarrings(), dropChance: 1);

}

Expand Down
38 changes: 14 additions & 24 deletions Scripts/Mobiles/Bosses/DespiseBosses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ public DespiseBoss(AIType ai, FightMode fightmode) : base(ai, fightmode, 10, 1,
FollowersMax = 100;
}

public void SetNonMovable(Item item)
{
item.Movable = false;
AddItem(item);
}

public override int Damage(int amount, Mobile from, bool informMount, bool checkDisrupt)
{
if (from is DespiseCreature)
Expand Down Expand Up @@ -216,13 +210,13 @@ public AdrianTheGloriousLord() : base(AIType.AI_Mage, FightMode.Closest)
{
Hue = 1818,
Layer = Layer.OneHanded
};

SetNonMovable(boots);
SetNonMovable(scimitar);
SetNonMovable(new LongPants(1818));
SetNonMovable(new FancyShirt(194));
SetNonMovable(new Doublet(1281));
};

SetWearable(boots);
SetWearable(scimitar);
SetWearable(new LongPants(), 1818);
SetWearable(new FancyShirt(), 194);
SetWearable(new Doublet(), 1281);
}

public override bool InitialInnocent => true;
Expand Down Expand Up @@ -295,21 +289,17 @@ public AndrosTheDreadLord() : base(AIType.AI_Mage, FightMode.Closest)
Fame = 22000;
Karma = -22000;

Item boots = new ThighBoots
{
Hue = 1
};

Item staff = new Item(3721)
{
Layer = Layer.TwoHanded
};

SetNonMovable(boots);
SetNonMovable(new LongPants(1818));
SetNonMovable(new FancyShirt(2726));
SetNonMovable(new Doublet(1153));
SetNonMovable(staff);
};

SetWearable(new ThighBoots(), 1);
SetWearable(new LongPants(), 1818);
SetWearable(new FancyShirt(), 2726);
SetWearable(new Doublet(), 1153);
SetWearable(staff);
}

public override bool AlwaysMurderer => true;
Expand Down
12 changes: 4 additions & 8 deletions Scripts/Mobiles/Bosses/Medusa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@ public Medusa()

Fame = 22000;
Karma = -22000;

IronwoodCompositeBow Bow = new IronwoodCompositeBow
{
Movable = false
};
AddItem(Bow);

SetWearable(new IronwoodCompositeBow());

m_Scales = Utility.RandomMinMax(1, 2) + 7;

Expand Down Expand Up @@ -701,8 +697,8 @@ public void Clone(Mobile m)

for (int i = 0; i < m.Items.Count; i++)
{
if (m.Items[i].Layer != Layer.Backpack && m.Items[i].Layer != Layer.Mount && m.Items[i].Layer != Layer.Bank)
AddItem(CloneItem(m.Items[i]));
if (m.Items[i].Layer != Layer.Backpack && m.Items[i].Layer != Layer.Mount && m.Items[i].Layer != Layer.Bank)
SetWearable(CloneItem(m.Items[i]));
}
}

Expand Down
22 changes: 4 additions & 18 deletions Scripts/Mobiles/Bosses/Neira.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,10 @@ public Neira()
Karma = -22500;

Female = true;

Item shroud = new HoodedShroudOfShadows
{
Movable = false
};

AddItem(shroud);

Scimitar weapon = new Scimitar
{
Skill = SkillName.Wrestling,
Hue = 38,
Movable = false
};

AddItem(weapon);

AddItem(new VirtualMountItem(this));

SetWearable(new HoodedShroudOfShadows());
SetWearable(new Scimitar { Skill = SkillName.Wrestling }, 38);
SetWearable(new VirtualMountItem(this));
}

public Neira(Serial serial)
Expand Down
23 changes: 6 additions & 17 deletions Scripts/Mobiles/Bosses/Travesty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,28 +194,17 @@ public void ChangeBody()
var crItem = Engines.Craft.CraftItem.GetCraftItem(item.GetType(), true);

if (crItem != null)
{
// Is this necessary? Was this check already done?
Item i = FindItemOnLayer(Layer.TwoHanded);

if (i != null)
i.Delete();

i = FindItemOnLayer(Layer.OneHanded);

if (i != null)
i.Delete();

AddItem(Loot.Construct(crItem.ItemType));
{
SetWearable(Loot.Construct(crItem.ItemType));
}
else
{
AddItem(new ClonedItem(item));
{
SetWearable(new ClonedItem(item));
}
}
else
{
AddItem(new ClonedItem(item));
{
SetWearable(new ClonedItem(item));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Scripts/Mobiles/NPCs/Abbein.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public override void InitBody()

public override void InitOutfit()
{
AddItem(new ElvenBoots(0x74B));
AddItem(new FemaleElvenRobe(0x8A8));
AddItem(new RoyalCirclet());
SetWearable(new ElvenBoots(), 0x74B, 1);
SetWearable(new FemaleElvenRobe(), 0x8A8, 1);
SetWearable(new RoyalCirclet(), dropChance: 1);
}

public override void Serialize(GenericWriter writer)
Expand Down
8 changes: 4 additions & 4 deletions Scripts/Mobiles/NPCs/Acob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,10 @@ public override void InitBody()

public override void InitOutfit()
{
AddItem(new Backpack());
AddItem(new ElvenBoots(0x73D));
AddItem(new HidePants());
AddItem(new ElvenShirt(0x71));
SetWearable(new Backpack());
SetWearable(new ElvenBoots(), 0x73D, 1);
SetWearable(new HidePants(), dropChance: 1);
SetWearable(new ElvenShirt(), 0x71, 1);
}

public override void Serialize(GenericWriter writer)
Expand Down
16 changes: 7 additions & 9 deletions Scripts/Mobiles/NPCs/Actor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,28 @@ public Actor()
if (Female = Utility.RandomBool())
{
Body = 0x191;
Name = NameList.RandomName("female");
AddItem(new FancyDress(Utility.RandomDyedHue()));
Name = NameList.RandomName("female");
SetWearable(new FancyDress(), Utility.RandomDyedHue(), 1);
Title = "the actress";
}
else
{
Body = 0x190;
Name = NameList.RandomName("male");
AddItem(new LongPants(Utility.RandomNeutralHue()));
AddItem(new FancyShirt(Utility.RandomDyedHue()));
Name = NameList.RandomName("male");
SetWearable(new LongPants(), Utility.RandomNeutralHue(), 1);
SetWearable(new FancyShirt(), Utility.RandomDyedHue(), 1);
Title = "the actor";
}

AddItem(new Boots(Utility.RandomNeutralHue()));
SetWearable(new Boots(), Utility.RandomNeutralHue(), 1);

Utility.AssignRandomHair(this);

Container pack = new Backpack();

pack.DropItem(new Gold(250, 300));

pack.Movable = false;

AddItem(pack);
SetWearable(pack);
}

public Actor(Serial serial)
Expand Down
16 changes: 8 additions & 8 deletions Scripts/Mobiles/NPCs/Aelorn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ public override void InitBody()

public override void InitOutfit()
{
AddItem(new Backpack());
AddItem(new VikingSword());
AddItem(new PlateChest());
AddItem(new PlateLegs());
AddItem(new PlateGloves());
AddItem(new PlateArms());
AddItem(new PlateGorget());
AddItem(new OrderShield());
SetWearable(new Backpack(), dropChance: 1);
SetWearable(new VikingSword(), dropChance: 1);
SetWearable(new PlateChest(), dropChance: 1);
SetWearable(new PlateLegs(), dropChance: 1);
SetWearable(new PlateGloves(), dropChance: 1);
SetWearable(new PlateArms(), dropChance: 1);
SetWearable(new PlateGorget(), dropChance: 1);
SetWearable(new OrderShield(), dropChance: 1);
}

public override void Serialize(GenericWriter writer)
Expand Down
8 changes: 4 additions & 4 deletions Scripts/Mobiles/NPCs/Aeluva.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public override void InitBody()

public override void InitOutfit()
{
AddItem(new ElvenBoots());
AddItem(new ElvenShirt());
AddItem(new Skirt());
AddItem(new Circlet());
SetWearable(new ElvenBoots(), dropChance: 1);
SetWearable(new ElvenShirt(), dropChance: 1);
SetWearable(new Skirt(), dropChance: 1);
SetWearable(new Circlet(), dropChance: 1);
}

public override void Serialize(GenericWriter writer)
Expand Down
10 changes: 5 additions & 5 deletions Scripts/Mobiles/NPCs/Aernya.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public override void InitBody()

public override void InitOutfit()
{
AddItem(new Backpack());
AddItem(new Sandals(0x743));
AddItem(new FancyShirt(0x3B3));
AddItem(new Cloak(0x3));
AddItem(new Skirt());
SetWearable(new Backpack(), dropChance: 1);
SetWearable(new Sandals(), 0x743, 1);
SetWearable(new FancyShirt(), 0x3B3, 1);
SetWearable(new Cloak(), 0x3, 1);
SetWearable(new Skirt(), dropChance: 1);
}

public override void Serialize(GenericWriter writer)
Expand Down
Loading

0 comments on commit bebc100

Please sign in to comment.