Ejemplo n.º 1
0
            /// <summary>
            /// Called on every timer tick
            /// </summary>
            protected override void OnTick()
            {
                // Check for Old Callback first

                string key = string.Format("LOS C:0x{0} T:0x{1}", m_checkerOid, m_targetOid);

                GamePlayer player = (GamePlayer)m_actionSource;

                CheckLOSResponse callback = player.TempProperties.getProperty <CheckLOSResponse>(key, null);

                if (callback != null)
                {
                    callback(player, (ushort)m_response, (ushort)m_targetOid);
                    player.TempProperties.removeProperty(key);
                }

                string newkey = string.Format("LOSMGR C:0x{0} T:0x{1}", m_checkerOid, m_targetOid);

                CheckLOSMgrResponse new_callback = player.TempProperties.getProperty <CheckLOSMgrResponse>(newkey, null);

                if (new_callback != null)
                {
                    new_callback(player, (ushort)m_response, (ushort)m_checkerOid, (ushort)m_targetOid);
                    player.TempProperties.removeProperty(newkey);
                }
            }
Ejemplo n.º 2
0
		public virtual void SendCheckLOS(GameObject source, GameObject target, CheckLOSMgrResponse callback)
		{
			if (m_gameClient.Player == null)
				return;
			
			int TargetOID = (target != null ? target.ObjectID : 0);
			int SourceOID = (source != null ? source.ObjectID : 0);
			
			string key = string.Format("LOSMGR C:0x{0} T:0x{1}", SourceOID, TargetOID);
			
			CheckLOSMgrResponse old_callback = null;
			lock (m_gameClient.Player.TempProperties)
			{
				old_callback = (CheckLOSMgrResponse) m_gameClient.Player.TempProperties.getProperty<object>(key, null);
				m_gameClient.Player.TempProperties.setProperty(key, callback);
			}
			if (old_callback != null)
				old_callback(m_gameClient.Player, 0, 0, 0);

			using (var pak = new GSTCPPacketOut(0xD0))
			{
				pak.WriteShort((ushort) SourceOID);
				pak.WriteShort((ushort) TargetOID);
				pak.WriteShort(0x00); // ?
				pak.WriteShort(0x00); // ?
				SendTCP(pak);
			}
		}
Ejemplo n.º 3
0
		public void SendCheckLOS(GameObject source, GameObject target, CheckLOSMgrResponse callback)
		{
			if (SendCheckLOSMgrMethod != null) SendCheckLOSMgrMethod(this, source, target, callback);
		}