namespace Otaku.Virtual.Users { using Otaku; using Otaku.Managers; using Otaku.Virtual.Rooms; using System; using System.Collections; using System.Runtime.CompilerServices; using System.Threading; public class virtualRoomUserStatusManager { private Hashtable _Statuses; private Thread itemCarrier; private int roomID; private int userID; public virtualRoomUserStatusManager(int userID, int roomID) { this.userID = userID; this.roomID = roomID; this._Statuses = new Hashtable(); } internal void addStatus(string Key, string Value) { if (this._Statuses.ContainsKey(Key)) { this._Statuses.Remove(Key); } this._Statuses.Add(Key, Value); } internal void carryItem(string Item) { this.dropCarrydItem(); this._Statuses.Remove("dance"); this.itemCarrier = new Thread(new ParameterizedThreadStart(this.itemCarrierLoop)); this.itemCarrier.Priority = ThreadPriority.Lowest; this.itemCarrier.Start(Item); } internal void Clear() { try { this.itemCarrier.Abort(); this._Statuses.Clear(); this._Statuses = null; } catch { } } internal bool containsStatus(string Key) { return this._Statuses.ContainsKey(Key); } internal void dropCarrydItem() { if ((this.itemCarrier != null) && this.itemCarrier.IsAlive) { this.itemCarrier.Abort(); } this.removeStatus("carryd"); this.removeStatus("drink"); } internal void handleStatus(string Key, string Value, int Length) { if (this._Statuses.ContainsKey(Key)) { this._Statuses.Remove(Key); } new statusVoid(this.HANDLESTATUS).BeginInvoke(Key, Value, Length, null, null); } private void HANDLESTATUS(string Key, string Value, int Length) { try { this._Statuses.Add(Key, Value); this.roomUser.Refresh(); Thread.Sleep(Length); this._Statuses.Remove(Key); this.roomUser.Refresh(); } catch { } } private void itemCarrierLoop(object s) { string str = (string) s; for (int i = 1; i <= Config.Statuses_itemCarrying_SipAmount; i++) { virtualUser user3; this.addStatus("carryd", str); this.roomUser.Refresh(); Thread.Sleep(Config.Statuses_itemCarrying_SipInterval); this._Statuses.Remove("carryd"); this.addStatus("drink", str); this.roomUser.Refresh(); string str2 = str; if (str2 != null) { if (!(str2 == "24")) { if (str2 == "3") { goto Label_009B; } } else { virtualUser user = this.User; user._alcohol++; } } goto Label_00D8; Label_009B: user3 = this.User; user3._hunger -= 5; if (this.User._hunger < 0) { this.User._hunger = 0; } Label_00D8: Thread.Sleep(Config.Statuses_itemCarrying_SipDuration); this._Statuses.Remove("drink"); } this.roomUser.Refresh(); } internal void Refresh() { this.roomUser.Refresh(); } internal void removeStatus(string Key) { try { if (this._Statuses.ContainsKey(Key)) { this._Statuses.Remove(Key); } } catch { } } public override string ToString() { string str = ""; foreach (string str2 in this._Statuses.Keys) { str = str + str2; string str3 = (string) this._Statuses[str2]; if (str3 != "") { str = str + " " + str3; } str = str + "/"; } return str; } private virtualRoom Room { get { return roomManager.getRoom(this.roomID); } } private virtualRoomUser roomUser { get { return userManager.getUser(this.userID).roomUser; } } private virtualUser User { get { return userManager.getUser(this.userID); } } private delegate void statusVoid(string Key, string Value, int Length); } }