/// <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); } }
public override void SendCheckLOS(GameObject Checker, GameObject Target, CheckLOSResponse callback) { }
public virtual void SendCheckLOS(GameObject Checker, GameObject Target, CheckLOSResponse callback) { if (m_gameClient.Player == null) return; int TargetOID = (Target != null ? Target.ObjectID : 0); string key = string.Format("LOS C:0x{0} T:0x{1}", Checker.ObjectID, TargetOID); CheckLOSResponse old_callback = null; lock (m_gameClient.Player.TempProperties) { old_callback = (CheckLOSResponse) 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); // not sure for this, i want targetOID there using (var pak = new GSTCPPacketOut(0xD0)) { pak.WriteShort((ushort) Checker.ObjectID); pak.WriteShort((ushort) TargetOID); pak.WriteShort(0x00); // ? pak.WriteShort(0x00); // ? SendTCP(pak); } }
public void SendCheckLOS(GameObject Checker, GameObject Target, CheckLOSResponse callback) { if (SendCheckLOSMethod != null) SendCheckLOSMethod(this, Checker, Target, callback); }