Even if the item is invisible, if you are using an Xmlspawner, it will "see" the item anyway.
item.OPLPacket
I cant recompile, is there different way to handle it?It's more than likely all going to be in CanSee in Mobile, in the core.
//////////////////////////////////////////////////////////////////////
// Custom DetectHidden by ViWinfii
// Version 3.1415
// Date: 3-14-15
//////////////////////////////////////////////////////////////////////
using System;
using Server;
using Server.Multis;
using Server.Targeting;
using Server.Items;
using Server.Regions;
using System.Collections;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Commands;
using Server.Factions;
using Server.Gumps;
namespace Server.SkillHandlers
{
public class DetectHidden
{
public static void Initialize()
{
SkillInfo.Table[(int)SkillName.DetectHidden].Callback = new SkillUseCallback(OnUse);
//CommandSystem.Register("detect", AccessLevel.Player, new CommandEventHandler(Detection));
//CommandSystem.Register("reveal", AccessLevel.Player, new CommandEventHandler(Revealing));
}
public static TimeSpan OnUse(Mobile src)
{
//src.SendLocalizedMessage( 500819 );//Where will you search?
//src.Target = new InternalTarget();
src.CloseGump(typeof(DetectHiddenMenu));
src.SendGump(new DetectHiddenMenu());
return TimeSpan.FromSeconds(0.0);
}
//[Usage( "Detect" )]
//[Description( "Allows you to detect hidden creatures near you. Does not require line of sight." )]
public static void Detection(Mobile from)
{
Mobile src = from;
if (DateTime.Now < src.NextSkillTime)
{
src.SendSkillMessage();
return;
}
double srcSkill = src.Skills[SkillName.DetectHidden].Value;
int range = (int)(srcSkill / 5.0);
if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
range /= 2;
bool detectedanyone = false;
if ( range > 0 )
{
ArrayList inRangeArray = new ArrayList();
foreach ( Mobile trg in src.GetMobilesInRange( range ) )
{
if( trg is PlayerMobile )
{
PlayerMobile test = trg as PlayerMobile;
if ( trg.Hidden && src != trg )
{
double ss = srcSkill + Utility.Random( 21 ) - 10;
double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random( 21 ) - 10;
if ( (src.AccessLevel >= trg.AccessLevel) && (ss >= ts) )
{
detectedanyone = true;
Detecting(src, trg);
inRangeArray.Add(trg);
}
}
}
}
if(detectedanyone)
src.SendMessage("You detect someone nearby!");
else
src.SendMessage("You didn't detect anyone nearby.");
InternalTimer pause = new InternalTimer( src, inRangeArray );
pause.Start();
src.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(6.0);
}
}
private static void Detecting(Mobile from, Mobile targ)
{
PlayerMobile pm = (PlayerMobile)targ;
List<Mobile> list = pm.VisibilityList;
list.Add( from );
if ( Utility.InUpdateRange( from, targ ) )
{
if ( from.CanSee( targ ) )
{
from.Send( new Network.MobileIncoming( from, targ ) );
//from.SendMessage("You have detected " + targ.Name);
}
}
}
private class InternalTimer : Timer
{
private Mobile m_From;
private ArrayList m_InRange;
public InternalTimer(Mobile from, ArrayList inRange2)
: base(TimeSpan.FromSeconds(6.0))
{
m_From = from;
m_InRange = inRange2;
}
protected override void OnTick()
{
foreach (Mobile target in m_InRange)
{
Mobile TargetMobile = target;
PlayerMobile TargetPlayerMobile = target as PlayerMobile;
TargetPlayerMobile.VisibilityList.Remove(m_From);
if (TargetMobile.Hidden && m_From != TargetPlayerMobile)
{
if (!m_From.CanSee(TargetPlayerMobile) && Utility.InUpdateRange(m_From, TargetMobile))
m_From.Send(TargetPlayerMobile.RemovePacket);
}
}
m_InRange.Clear();
}
}
//[Usage( "Reveal" )]
//[Description( "Reveals creatures and traps that are hidden near you. Requires line of sight." )]
public static void Revealing(Mobile from)
{
PlayerMobile m_From = from as PlayerMobile;
m_From.RevealingAction();
Rev(from, from);
}
private static void Rev( Mobile src, object targ )
{
if (DateTime.Now < src.NextSkillTime)
{
src.SendSkillMessage();
return;
}
double srcSkill = src.Skills[SkillName.DetectHidden].Value;
int range = (int)(srcSkill / 10.0);
if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
range = 0;
bool foundAnyone = false;
bool foundTrap = false;
Point3D p;
p = ((Mobile)targ).Location;
BaseHouse house = BaseHouse.FindHouseAt( p, src.Map, 16 );
bool inHouse = ( house != null && house.IsFriend( src ) );
if ( inHouse )
range = 22;
if ( range > 0 )
{
foreach ( Mobile trg in src.GetMobilesInRange( range ) )
{
if ( trg.Hidden && src != trg )
{
double ss = srcSkill + Utility.Random( 21 ) - 10;
double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random( 21 ) - 10;
if ( (src.AccessLevel >= trg.AccessLevel) && ( (ss >= ts) || ( inHouse && house.IsInside( trg ) )) && (src.InLOS(trg)) )
{
trg.RevealingAction();
trg.SendLocalizedMessage( 500814 ); // You have been revealed!
foundAnyone = true;
}
}
}
if (Faction.Find(src) != null)
{
IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);
foreach (Item item in itemsInRange)
{
if (item is BaseFactionTrap)
{
BaseFactionTrap trap = (BaseFactionTrap)item;
if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 80.0, 100.0))
{
src.SendLocalizedMessage(1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName)); // You reveal a trap placed by a faction:
trap.Visible = true;
trap.BeginConceal();
foundTrap = true;
}
}
}
itemsInRange.Free();
}
}
if (!foundAnyone && !foundTrap)
{
src.SendLocalizedMessage(500817); // You can see nothing hidden there.
}
else
{
if (foundTrap)
src.SendMessage("You find a trap hidden in the shadows!");
if (foundAnyone)
src.SendMessage("You find someone in the shadows!");
}
src.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(6.0);
}
}
}
just hooked into the join party and leave party
public void OnAccept( Mobile from, bool force )
{
Faction ourFaction = Faction.Find( m_Leader );
Faction theirFaction = Faction.Find( from );
if ( !force && ourFaction != null && theirFaction != null && ourFaction != theirFaction )
return;
///////////////see hidden party members///////////////////
List<Mobile> list = from.VisibilityList;
Party p = Get( from );
list.Add( p );
if ( Utility.InUpdateRange( p, from ) )
{
NetState ns = p.NetState;
if (ns != null)
{
if (p.CanSee(from))
{
if (ns.StygianAbyss)
ns.Send(new MobileIncoming(p ,from));
else
ns.Send(new MobileIncomingOld(p,from));
if (ObjectPropertyList.Enabled)
{
ns.Send(m.OPLPacket);
foreach (Item item in from.Items)
ns.Send(item.OPLPacket);
}
}
else
{
ns.Send(from.RemovePacket);
}
}
}
/////////////// end see ally////////////////////
// : joined the party.
SendToAll( new MessageLocalizedAffix( Serial.MinusOne, -1, MessageType.Label, 0x3B2, 3, 1008094, "", AffixType.Prepend | AffixType.System, from.Name, "" ) );
from.SendLocalizedMessage( 1005445 ); // You have been added to the party.
m_Candidates.Remove( from );
Add( from );
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.