fix: Codegens lockable containers and cleans up lockpickable (#976)

This commit is contained in:
Kamron Batman 2022-03-26 21:48:18 -07:00 • committed by GitHub
parent fc0594f87c
commit 8f922c94ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 762 additions and 833 deletions

View file

@ -30,13 +30,10 @@ namespace Server.Spells.Third
}
else if (BaseHouse.CheckLockedDownOrSecured(cont))
{
Caster.LocalOverheadMessage(
MessageType.Regular,
0x22,
501761
); // You cannot cast this on a locked down item.
// You cannot cast this on a locked down item.
Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761);
}
else if (cont.Locked || cont.LockLevel == 0 || cont is ParagonChest)
else if (cont.Locked || cont.LockLevel == ILockpickable.CannotPick || cont is ParagonChest)
{
Caster.SendLocalizedMessage(501762); // Target must be an unlocked chest.
}
@ -59,7 +56,7 @@ namespace Server.Spells.Third
// The chest is now locked!
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);
cont.LockLevel = -255; // signal magic lock
cont.LockLevel = ILockpickable.MagicLock; // signal magic lock
cont.Locked = true;
}

View file

@ -40,52 +40,44 @@ namespace Server.Spells.Third
if (p is Mobile)
{
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked.
// That did not need to be unlocked.
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101);
}
else if (p is not LockableContainer cont)
{
Caster.SendLocalizedMessage(501666); // You can't unlock that!
}
else if (BaseHouse.CheckSecured(cont))
{
Caster.SendLocalizedMessage(503098); // You cannot cast this on a secure item.
}
else if (!cont.Locked)
{
// That did not need to be unlocked.
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101);
}
else if (cont.LockLevel == ILockpickable.CannotPick)
{
Caster.SendLocalizedMessage(501666); // You can't unlock that!
}
else
{
if (BaseHouse.CheckSecured(cont))
var level = (int)(Caster.Skills.Magery.Value * 0.8) - 4;
if (level >= cont.RequiredSkill &&
!(cont is TreasureMapChest chest && chest.Level > 2))
{
Caster.SendLocalizedMessage(503098); // You cannot cast this on a secure item.
}
else if (!cont.Locked)
{
Caster.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
503101
); // That did not need to be unlocked.
}
else if (cont.LockLevel == 0)
{
Caster.SendLocalizedMessage(501666); // You can't unlock that!
cont.Locked = false;
if (cont.LockLevel == ILockpickable.MagicLock)
{
cont.LockLevel = cont.RequiredSkill - 10;
}
}
else
{
var level = (int)(Caster.Skills.Magery.Value * 0.8) - 4;
if (level >= cont.RequiredSkill &&
!(cont is TreasureMapChest chest && chest.Level > 2))
{
cont.Locked = false;
if (cont.LockLevel == -255)
{
cont.LockLevel = cont.RequiredSkill - 10;
}
}
else
{
Caster.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
503099
); // My spell does not seem to have an effect on that lock.
}
// My spell does not seem to have an effect on that lock.
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099);
}
}
}