public void PlayerAttackMonster(Connection client, AttackTargetRequest atr) { if (!_monsters.ContainsKey(atr.TargetID)) { LogInterface.Log(string.Format("Character({0}) attacking non existant monster {1} on map {2}", client.Character.ID, atr.TargetID, client.Character.MapID), LogInterface.LogMessageType.Game); client.SendPacket(new SeePlayerAttack(atr.TargetID, 0, client.Character, atr, 6)); // Wrong target } else { Monster m = _monsters[atr.TargetID]; client.Character.AttackTarget(m, atr); SeePlayerAttack pkt = new SeePlayerAttack(m.ID, m.CurHP, client.Character, atr); foreach (Connection c in _players.Values) { c.SendPacket(pkt); } if (m.Dead) { // Do loot! m.GiveLoot(client); } } }
public void Database_OnQueryComplete(object sender, EventArgs e) { DBQuery q = (DBQuery)sender; _pqLock.WaitOne(); LogInterface.Log("Finishing Query with key: " + q.Key, LogInterface.LogMessageType.Debug); Task task = _pendingQueries[q.Key]; _pendingQueries.Remove(q.Key); _pqLock.ReleaseMutex(); // reschedule the task to deal with the new data\ if (task.Type >= 0) { AddTask(task); } }
public DBQuery AddDBQuery(string sql, Task task, bool read = true) { if (task == null) { task = new Task(-1); } long key = UniqueKey(); DBQuery q = new DBQuery(sql, read, key); task.Query = q; _pqLock.WaitOne(); LogInterface.Log("Adding Query with key: " + key, LogInterface.LogMessageType.Debug); _pendingQueries[key] = task; _pqLock.ReleaseMutex(); _db.AddQuery(q); return(q); }
public void RegisterAuthString(string authString, int accountId, int hardCurrency, int vip, string displayName) { if (_accounts.Count > MAX_CACHED_ACCOUNTS) { int preDump = _accounts.Count; // Dump accounts that are a day old or more DumpAccounts(24 * 60 * 60); LogInterface.Log(string.Format("Dumping cached accounts: ({0}) -> ({1})", preDump, _accounts.Count), LogInterface.LogMessageType.System, true); } AuthAccountInfo aai = new AuthAccountInfo(); aai.AccountID = accountId; aai.HardCurrency = hardCurrency; aai.Vip = vip; aai.Timestamp = DateTime.Now.Ticks; aai.DisplayName = displayName; _accounts[authString] = aai; }
public static void Log(string text, bool addTimeStamp) { m_logInterface.Log(text, addTimeStamp); }
void BeginPacket(HPacketType type) { LogInterface.Log(string.Format("BeginPacket({0})", type), LogInterface.LogMessageType.Debug); BeginPacket((ushort)type); }