public static void Main() { Buffer b = new Buffer(); Plus p1 = new Plus(b, "right1"); Plus p2 = new Plus(b, "right2"); //hold open console Console.WriteLine("Output files are in debug directory ... Hit any key to exit."); Console.ReadLine(); }
//Конструктор public Engine(int fieldWidth, int fieldHeight, int squareHeight) { this.fieldHeight = fieldHeight; this.fieldWidth = fieldWidth; this.squareHeight = squareHeight; plus = new Plus(); gameMass = new GameMass(fieldWidth,fieldHeight); squares = new List<Square>(); rand = new Random(); CreateSquareList(); NewActiveSquare(); }
/// <summary> /// Adds the new item. /// </summary> /// <param name="id">The identifier.</param> /// <param name="baseItem">The base item.</param> /// <param name="extraData">The extra data.</param> /// <param name="group">The group.</param> /// <param name="insert">if set to <c>true</c> [insert].</param> /// <param name="fromRoom">if set to <c>true</c> [from room].</param> /// <param name="limno">The limno.</param> /// <param name="limtot">The limtot.</param> /// <param name="songCode">The song code.</param> /// <returns>UserItem.</returns> internal UserItem AddNewItem(uint id, uint baseItem, string extraData, uint group, bool insert, bool fromRoom, int limno, int limtot, string songCode = "") { _isUpdated = false; if (insert) { if (fromRoom) { using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor.RunFastQuery("UPDATE items_rooms SET room_id = '0' WHERE id = " + id); } } else { using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery( string.Format( "INSERT INTO items_rooms (base_item, user_id, group_id) VALUES ('{0}', '{1}', '{2}');", baseItem, UserId, group)); if (id == 0) { id = ((uint)queryReactor.InsertQuery()); } SendNewItems(id); if (!string.IsNullOrEmpty(extraData)) { queryReactor.SetQuery("UPDATE items_rooms SET extra_data = @extraData WHERE id = " + id); queryReactor.AddParameter("extraData", extraData); queryReactor.RunQuery(); } if (limno > 0) { queryReactor.RunFastQuery( string.Format("INSERT INTO items_limited VALUES ('{0}', '{1}', '{2}');", id, limno, limtot)); } if (!string.IsNullOrEmpty(songCode)) { queryReactor.SetQuery( string.Format("UPDATE items_rooms SET songcode='{0}' WHERE id='{1}' LIMIT 1", songCode, id)); queryReactor.RunQuery(); } } } } if (id == 0) { return(null); } var userItem = new UserItem(id, baseItem, extraData, @group, songCode); if (UserHoldsItem(id)) { RemoveItem(id, false); } if (userItem.BaseItem.InteractionType == Interaction.MusicDisc) { SongDisks.Add(userItem.Id, userItem); } if (userItem.IsWallItem) { _wallItems.Add(userItem.Id, userItem); } else { _floorItems.Add(userItem.Id, userItem); } if (_mRemovedItems.Contains(id)) { _mRemovedItems.Remove(id); } if (!_mAddedItems.Contains(id)) { _mAddedItems.Add(id, userItem); } return(userItem); }
/// <summary> /// Gets the client. /// </summary> /// <returns>GameClient.</returns> private GameClient GetClient() { return(Plus.GetGame().GetClientManager().GetClientByUserId(UserId)); }
/// <summary> /// Serializes the floor. /// </summary> /// <param name="message">The message.</param> /// <param name="inventory">if set to <c>true</c> [inventory].</param> internal void SerializeFloor(ServerMessage message, bool inventory) { message.AppendInteger(Id); message.AppendString(BaseItem.Type.ToString(CultureInfo.InvariantCulture).ToUpper()); message.AppendInteger(Id); message.AppendInteger(BaseItem.SpriteId); var extraParam = 0; try { if (BaseItem.InteractionType == Interaction.Gift) { var split = ExtraData.Split((char)9); int ribbon, color; int.TryParse(split[2], out ribbon); int.TryParse(split[3], out color); extraParam = (ribbon * 1000) + color; } } catch { extraParam = 1001; } message.AppendInteger(extraParam); if (BaseItem.IsGroupItem) { var group = Plus.GetGame().GetGroupManager().GetGroup(GroupId); if (group != null) { message.AppendInteger(2); message.AppendInteger(5); message.AppendString(ExtraData); message.AppendString(group.Id.ToString(CultureInfo.InvariantCulture)); message.AppendString(group.Badge); message.AppendString(Plus.GetGame().GetGroupManager().GetGroupColour(group.Colour1, true)); message.AppendString(Plus.GetGame().GetGroupManager().GetGroupColour(group.Colour2, false)); } else { message.AppendInteger(0); message.AppendString(string.Empty); } } else if (LimitedStack > 0) { message.AppendString(string.Empty); message.AppendBool(true); message.AppendBool(false); message.AppendString(ExtraData); } else if (BaseItem.InteractionType == Interaction.Moplaseed) { message.AppendInteger(1); message.AppendInteger(1); message.AppendString("rarity"); message.AppendString(ExtraData); } else { switch (BaseItem.InteractionType) { case Interaction.BadgeDisplay: message.AppendInteger(2); message.AppendInteger(4); // Count of Values message.AppendString("0"); message.AppendString(ExtraData); message.AppendString(string.Empty); // owner name message.AppendString(string.Empty); // date buyed. break; case Interaction.YoutubeTv: message.AppendInteger(1); message.AppendInteger(1); message.AppendString("THUMBNAIL_URL"); message.AppendString(ExtraData); break; case Interaction.Mannequin: message.AppendInteger(1); if (ExtraData.Length <= 0 || !ExtraData.Contains(";") || ExtraData.Split(';').Length < 3) { message.AppendInteger(3); // Coun Of Values message.AppendString("GENDER"); message.AppendString("m"); message.AppendString("FIGURE"); message.AppendString(string.Empty); message.AppendString("OUTFIT_NAME"); message.AppendString(string.Empty); } else { var extradatas = ExtraData.Split(';'); message.AppendInteger(3); // Count Of Values message.AppendString("GENDER"); message.AppendString(extradatas[0]); message.AppendString("FIGURE"); message.AppendString(extradatas[1]); message.AppendString("OUTFIT_NAME"); message.AppendString(extradatas[2]); } break; default: message.AppendInteger(0); if (BaseItem.IsGroupItem) { } else { message.AppendString(ExtraData); } break; } } if (LimitedSellId > 0) { message.AppendInteger(LimitedSellId); message.AppendInteger(LimitedStack); } /* message.AppendInteger((BaseItem.InteractionType == InteractionType.gift) ? 9 : 0); * message.AppendInteger(0); * message.AppendString((BaseItem.InteractionType == InteractionType.gift) * ? string.Empty * : ExtraData);*/ message.AppendBool(BaseItem.AllowRecycle); message.AppendBool(BaseItem.AllowTrade); message.AppendBool(LimitedSellId <= 0 && BaseItem.AllowInventoryStack); message.AppendBool(false); // sellable message.AppendInteger(-1); // expireTime message.AppendBool(true); // hasRentPeriodStarted message.AppendInteger(-1); // flatId if (BaseItem.Type != 's') { return; } message.AppendString(string.Empty); //slotId message.AppendInteger(0); }
public String Visit(Plus node) { return(Visit((dynamic)node[0]) + Visit((dynamic)node[1]) + " i32.add\n"); }
public static string GetPlusExpresstionType(Plus expression, VHDLCompilerInterface compiler) { string destination = GetExpressionType(expression.Expression, compiler); return(destination); }
/// <summary> /// Informations the retrieve. /// </summary> internal void InfoRetrieve() { if (Session == null || Session.GetHabbo() == null) { return; } var habbo = Session.GetHabbo(); Response.Init(LibraryParser.OutgoingRequest("UserObjectMessageComposer")); Response.AppendInteger(habbo.Id); Response.AppendString(habbo.UserName); Response.AppendString(habbo.Look); Response.AppendString(habbo.Gender.ToUpper()); Response.AppendString(habbo.Motto); Response.AppendString(""); Response.AppendBool(false); Response.AppendInteger(habbo.Respect); Response.AppendInteger(habbo.DailyRespectPoints); Response.AppendInteger(habbo.DailyPetRespectPoints); Response.AppendBool(true); Response.AppendString(habbo.LastOnline.ToString(CultureInfo.InvariantCulture)); Response.AppendBool(habbo.CanChangeName); Response.AppendBool(false); SendResponse(); Response.Init(LibraryParser.OutgoingRequest("BuildersClubMembershipMessageComposer")); Response.AppendInteger(Session.GetHabbo().BuildersExpire); Response.AppendInteger(Session.GetHabbo().BuildersItemsMax); Response.AppendInteger(2); SendResponse(); var tradeLocked = Session.GetHabbo().CheckTrading(); var canUseFloorEditor = (ExtraSettings.EVERYONE_USE_FLOOR || Session.GetHabbo().VIP || Session.GetHabbo().Rank >= 4); Response.Init(LibraryParser.OutgoingRequest("SendPerkAllowancesMessageComposer")); Response.AppendInteger(11); Response.AppendString("BUILDER_AT_WORK"); Response.AppendString(""); Response.AppendBool(canUseFloorEditor); Response.AppendString("VOTE_IN_COMPETITIONS"); Response.AppendString("requirement.unfulfilled.helper_level_2"); Response.AppendBool(false); Response.AppendString("USE_GUIDE_TOOL"); Response.AppendString("requirement.unfulfilled.helper_level_4"); Response.AppendBool(false); Response.AppendString("JUDGE_CHAT_REVIEWS"); Response.AppendString("requirement.unfulfilled.helper_level_6"); Response.AppendBool(false); Response.AppendString("NAVIGATOR_ROOM_THUMBNAIL_CAMERA"); Response.AppendString(""); Response.AppendBool(true); Response.AppendString("CALL_ON_HELPERS"); Response.AppendString(""); Response.AppendBool(true); Response.AppendString("CITIZEN"); Response.AppendString(""); Response.AppendBool(Session.GetHabbo().TalentStatus == "helper" || Session.GetHabbo().CurrentTalentLevel >= 4); Response.AppendString("MOUSE_ZOOM"); Response.AppendString(""); Response.AppendBool(false); Response.AppendString("TRADE"); Response.AppendString(tradeLocked ? "" : "requirement.unfulfilled.no_trade_lock"); Response.AppendBool(tradeLocked); Response.AppendString("CAMERA"); Response.AppendString(""); Response.AppendBool(ExtraSettings.ENABLE_BETA_CAMERA); Response.AppendString("NAVIGATOR_PHASE_TWO_2014"); Response.AppendString(""); Response.AppendBool(true); SendResponse(); Session.GetHabbo().InitMessenger(); GetResponse().Init(LibraryParser.OutgoingRequest("CitizenshipStatusMessageComposer")); GetResponse().AppendString("citizenship"); GetResponse().AppendInteger(1); GetResponse().AppendInteger(4); SendResponse(); GetResponse().Init(LibraryParser.OutgoingRequest("GameCenterGamesListMessageComposer")); GetResponse().AppendInteger(1); GetResponse().AppendInteger(18); GetResponse().AppendString("elisa_habbo_stories"); GetResponse().AppendString("000000"); GetResponse().AppendString("ffffff"); GetResponse().AppendString(""); GetResponse().AppendString(""); SendResponse(); GetResponse().Init(LibraryParser.OutgoingRequest("AchievementPointsMessageComposer")); GetResponse().AppendInteger(Session.GetHabbo().AchievementPoints); SendResponse(); GetResponse().Init(LibraryParser.OutgoingRequest("FigureSetIdsMessageComposer")); Session.GetHabbo()._clothingManager.Serialize(GetResponse()); SendResponse(); /*Response.Init(LibraryParser.OutgoingRequest("NewbieStatusMessageComposer")); * Response.AppendInteger(2);// 2 = new - 1 = nothing - 0 = not new * SendResponse();*/ Session.SendMessage(Plus.GetGame().GetNavigator().SerializePromotionCategories()); }
public virtual void Visit(Plus node) { }
/// <summary> /// Handles all requests. /// </summary> internal void HandleAllRequests() { using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) queryReactor.RunFastQuery("DELETE FROM messenger_requests WHERE from_id = " + _userId + " OR to_id = " + _userId); ClearRequests(); }
//check public string Visit(Plus node) { return(VisitChildren(node) + putS(Indentar() + "add.ovf")); }
//----------------------------------------------------------- public string Visit(Plus node) { return(VisitBinaryOperator("add.ovf", node)); }
void Start() { obj = gameObject; plus = GetComponent <Plus>(); }
/// <summary> /// Progresses the user achievement. /// </summary> /// <param name="Session">The session.</param> /// <param name="AchievementGroup">The achievement group.</param> /// <param name="ProgressAmount">The progress amount.</param> /// <param name="FromZero">if set to <c>true</c> [from zero].</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> internal bool ProgressUserAchievement(GameClient Session, string AchievementGroup, int ProgressAmount, bool FromZero = false) { if (!this.Achievements.ContainsKey(AchievementGroup) || Session == null) { return(false); } Achievement achievement = null; achievement = this.Achievements[AchievementGroup]; UserAchievement userAchievement = Session.GetHabbo().GetAchievementData(AchievementGroup); if (userAchievement == null) { userAchievement = new UserAchievement(AchievementGroup, 0, 0); Session.GetHabbo().Achievements.Add(AchievementGroup, userAchievement); } int count = achievement.Levels.Count; if (userAchievement != null && userAchievement.Level == count) { return(false); } { int num = (userAchievement != null) ? (userAchievement.Level + 1) : 1; if (num > count) { num = count; } AchievementLevel targetLevelData = achievement.Levels[num]; int num2 = 0; if (FromZero) { num2 = ProgressAmount; } else { num2 = ((userAchievement != null) ? (userAchievement.Progress + ProgressAmount) : ProgressAmount); } int num3 = (userAchievement != null) ? userAchievement.Level : 0; int num4 = num3 + 1; if (num4 > count) { num4 = count; } if (num2 >= targetLevelData.Requirement) { num3++; num4++; int argE60 = num2 - targetLevelData.Requirement; num2 = 0; if (num == 1) { Session.GetHabbo().GetBadgeComponent().GiveBadge(string.Format("{0}{1}", AchievementGroup, num), true, Session, false); } else { Session.GetHabbo().GetBadgeComponent().RemoveBadge(Convert.ToString(string.Format("{0}{1}", AchievementGroup, num - 1)), Session); Session.GetHabbo().GetBadgeComponent().GiveBadge(string.Format("{0}{1}", AchievementGroup, num), true, Session, false); } if (num4 > count) { num4 = count; } Session.GetHabbo().ActivityPoints += targetLevelData.RewardPixels; Session.GetHabbo().NotifyNewPixels(targetLevelData.RewardPixels); Session.GetHabbo().UpdateActivityPointsBalance(); Session.SendMessage(AchievementUnlockedComposer.Compose(achievement, num, targetLevelData.RewardPoints, targetLevelData.RewardPixels)); using (IQueryAdapter queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery(string.Concat(new object[] { "REPLACE INTO users_achievements VALUES (", Session.GetHabbo().Id, ", @group, ", num3, ", ", num2, ")" })); queryReactor.AddParameter("group", AchievementGroup); queryReactor.RunQuery(); } userAchievement.Level = num3; userAchievement.Progress = num2; Session.GetHabbo().AchievementPoints += targetLevelData.RewardPoints; Session.GetHabbo().NotifyNewPixels(targetLevelData.RewardPixels); Session.GetHabbo().ActivityPoints += targetLevelData.RewardPixels; Session.GetHabbo().UpdateActivityPointsBalance(); Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints)); AchievementLevel targetLevelData2 = achievement.Levels[num4]; Session.SendMessage(AchievementProgressComposer.Compose(achievement, num4, targetLevelData2, count, Session.GetHabbo().GetAchievementData(AchievementGroup))); Talent talent = null; if (Plus.GetGame().GetTalentManager().TryGetTalent(AchievementGroup, out talent)) { Plus.GetGame().GetTalentManager().CompleteUserTalent(Session, talent); } return(true); } userAchievement.Level = num3; userAchievement.Progress = num2; using (IQueryAdapter queryreactor2 = Plus.GetDatabaseManager().GetQueryReactor()) { queryreactor2.SetQuery(string.Concat(new object[] { "REPLACE INTO users_achievements VALUES (", Session.GetHabbo().Id, ", @group, ", num3, ", ", num2, ")" })); queryreactor2.AddParameter("group", AchievementGroup); queryreactor2.RunQuery(); } Session.SendMessage(AchievementProgressComposer.Compose(achievement, num, targetLevelData, count, Session.GetHabbo().GetAchievementData(AchievementGroup))); Session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer")); Session.GetMessageHandler().GetResponse().AppendInteger(-1); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToLower()); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Motto); Session.GetMessageHandler().GetResponse().AppendInteger(Session.GetHabbo().AchievementPoints); Session.GetMessageHandler().SendResponse(); return(false); } }
void PlusMinus(out Expression exp) { Expression second; MulDivMod(out exp); while (la.kind == 40 || la.kind == 41) { if (la.kind == 40) { Get(); } else { Get(); } Token tok = t; MulDivMod(out second); if (!ExpectInt(exp, tok, false)) { return; } if (!ExpectInt(second, tok, true)) { return; } if (tok.val == "+") { exp = new Plus((TypedExpression<int>)exp, (TypedExpression<int>)second); } else if (tok.val == "-") { exp = new Minus((TypedExpression<int>)exp, (TypedExpression<int>)second); } } }
static void Main() { Plus plus = new Plus(); plus.setData(27, 32); plus.answer(); }
public String Visit(Plus node) { return("(" + Visit((dynamic)node[0]) + "+" + Visit((dynamic)node[1]) + ")"); }
/// <summary> /// Called when [new friendship]. /// </summary> /// <param name="friendId">The friend identifier.</param> internal void OnNewFriendship(uint friendId) { var clientByUserId = Plus.GetGame().GetClientManager().GetClientByUserId(friendId); MessengerBuddy messengerBuddy; if (clientByUserId == null || clientByUserId.GetHabbo() == null) { DataRow row; using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery( string.Format( "SELECT id,username,motto,look,last_online,hide_inroom,hide_online FROM users WHERE id = {0}", friendId)); row = queryReactor.GetRow(); } messengerBuddy = new MessengerBuddy(friendId, (string)row["Username"], (string)row["look"], (string)row["motto"], (int)row["last_online"], Plus.EnumToBool(row["hide_online"].ToString()), Plus.EnumToBool(row["hide_inroom"].ToString())); } else { var habbo = clientByUserId.GetHabbo(); messengerBuddy = new MessengerBuddy(friendId, habbo.UserName, habbo.Look, habbo.Motto, 0, habbo.AppearOffline, habbo.HideInRoom); messengerBuddy.UpdateUser(); } if (!Friends.ContainsKey(friendId)) { Friends.Add(friendId, messengerBuddy); } GetClient().SendMessage(SerializeUpdate(messengerBuddy)); }
public static void Main() { Buffer b = new Buffer(); Plus p1 = new Plus(b, "right1"); Plus p2 = new Plus(b, "right2"); }
/// <summary> /// Requests the buddy. /// </summary> /// <param name="userQuery">The user query.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> internal bool RequestBuddy(string userQuery) { var clientByUsername = Plus.GetGame().GetClientManager().GetClientByUserName(userQuery); uint num; bool flag; if (GetClient().GetRoleplay().Phone == 0) { GetClient().SendNotif("You do not have a phone to add contacts!"); return(true); } if (clientByUsername == null) { DataRow dataRow; using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("SELECT id,block_newfriends FROM users WHERE Username = @query"); queryReactor.AddParameter("query", userQuery.ToLower()); dataRow = queryReactor.GetRow(); } if (dataRow == null) { return(false); } num = Convert.ToUInt32(dataRow["id"]); flag = Plus.EnumToBool(dataRow["block_newfriends"].ToString()); } else { num = clientByUsername.GetHabbo().Id; flag = clientByUsername.GetHabbo().HasFriendRequestsDisabled; } if (flag && GetClient().GetHabbo().Rank < 4u) { GetClient() .GetMessageHandler() .GetResponse() .Init(LibraryParser.OutgoingRequest("NotAcceptingRequestsMessageComposer")); GetClient().GetMessageHandler().GetResponse().AppendInteger(39); GetClient().GetMessageHandler().GetResponse().AppendInteger(3); GetClient().GetMessageHandler().SendResponse(); return(false); } var num2 = num; if (RequestExists(num2)) { GetClient().SendNotif("Ya le has enviado una petición anteriormente."); return(true); } using (var queryreactor2 = Plus.GetDatabaseManager().GetQueryReactor()) queryreactor2.RunFastQuery(string.Concat(new object[] { "REPLACE INTO messenger_requests (from_id,to_id) VALUES (", _userId, ",", num2, ")" })); Plus.GetGame().GetQuestManager().ProgressUserQuest(GetClient(), QuestType.AddFriends, 0u); var clientByUserId = Plus.GetGame().GetClientManager().GetClientByUserId(num2); if (clientByUserId == null || clientByUserId.GetHabbo() == null) { return(true); } var messengerRequest = new MessengerRequest(num2, _userId, Plus.GetGame().GetClientManager().GetNameById(_userId)); clientByUserId.GetHabbo().GetMessenger().OnNewRequest(_userId); var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ConsoleSendFriendRequestMessageComposer")); messengerRequest.Serialize(serverMessage); clientByUserId.SendMessage(serverMessage); Requests.Add(num2, messengerRequest); return(true); }
/// <summary> /// Habboes the camera. /// </summary> internal void HabboCamera() { //string one = this.Request.GetString(); /*var two = */ using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery(string.Format("SELECT * FROM cms_stories_photos WHERE user_id = {0} AND type = 'PHOTO' ORDER BY id DESC LIMIT 1", Session.GetHabbo().Id)); DataTable table = queryReactor.GetTable(); foreach (DataRow dataRow in table.Rows) { var date = dataRow["date"]; var room = dataRow["room_id"]; var photo = dataRow["id"]; var image = dataRow["image_url"]; using (var queryReactor2 = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor2.SetQuery("INSERT INTO cms_stories_photos (user_id,user_name,room_id,image_preview_url,image_url,type,date,tags) VALUES (@user_id,@user_name,@room_id,@image_url,@image_url,@type,@date,@tags)"); queryReactor2.AddParameter("user_id", Session.GetHabbo().Id); queryReactor2.AddParameter("user_name", Session.GetHabbo().UserName); queryReactor2.AddParameter("room_id", room); queryReactor2.AddParameter("image_url", image); queryReactor2.AddParameter("type", "PHOTO"); queryReactor2.AddParameter("date", date); queryReactor2.AddParameter("tags", ""); queryReactor2.RunQuery(); var new_photo_data = "{\"t\":" + date + ",\"u\":\"" + photo + "\",\"m\":\"\",\"s\":" + room + ",\"w\":\"" + image + "\"}"; var item = Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Plus.GetGame().GetItemManager().PhotoId, new_photo_data, 0, true, false, 0, 0); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); Session.GetHabbo().Credits -= 2; Session.GetHabbo().UpdateCreditsBalance(); Session.GetHabbo().GetInventoryComponent().SendNewItems(item.Id); } } } var message = new ServerMessage(LibraryParser.OutgoingRequest("CameraPurchaseOk")); Session.SendMessage(message); }
/// <summary> /// Sends the instant message. /// </summary> /// <param name="toId">To identifier.</param> /// <param name="message">The message.</param> internal void SendInstantMessage(uint toId, string message) { int credit = new Random().Next(1, 15); if (!GetClient().GetHabbo().HasFuse("fuse_owner") && AntiPublicistas.CheckPublicistas(message)) { GetClient().PublicistCount++; GetClient().HandlePublicista(message); return; } if (!FriendshipExists(toId)) { DeliverInstantMessageError(6, toId); return; } if (GetClient().GetRoleplay().Phone == 0) { GetClient().SendWhisperBubble("Você não tem telefone! Você pode comprar um na loja de telefone! [Room ID: 5]", 1); return; } if (GetClient().GetHabbo().ActivityPoints < credit) { GetClient().SendWhisperBubble("Você tem fundos de crédito insuficientes! Você pode comprar mais na loja de telefone! [Room ID: 5]", 1); return; } if (toId == 0) // Staff Chat { var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ConsoleChatMessageComposer")); serverMessage.AppendInteger(0); //userid serverMessage.AppendString(GetClient().GetHabbo().UserName + " : " + message); serverMessage.AppendInteger(0); Plus.GetGame().GetClientManager().StaffAlert(serverMessage, GetClient().GetHabbo().Id); } else { var clientByUserId = Plus.GetGame().GetClientManager().GetClientByUserId(toId); if (clientByUserId == null || clientByUserId.GetHabbo().GetMessenger() == null) { if (Plus.OfflineMessages.ContainsKey(toId)) { Plus.OfflineMessages[toId].Add(new OfflineMessage(GetClient().GetHabbo().Id, message, Plus.GetUnixTimeStamp())); } else { Plus.OfflineMessages.Add(toId, new List <OfflineMessage>()); Plus.OfflineMessages[toId].Add(new OfflineMessage(GetClient().GetHabbo().Id, message, Plus.GetUnixTimeStamp())); } OfflineMessage.SaveMessage(Plus.GetDatabaseManager().GetQueryReactor(), toId, GetClient().GetHabbo().Id, message); return; } if (GetClient().GetHabbo().Muted) { DeliverInstantMessageError(4, toId); return; } if (clientByUserId.GetHabbo().Muted) { DeliverInstantMessageError(3, toId); } if (message == "") { return; } clientByUserId.GetHabbo().GetMessenger().DeliverInstantMessage(message, _userId); #region Whisper if (GetClient().GetHabbo().CurrentRoomId != 0) { var roomUserByRank = GetClient().GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByRank(2); RoomUser u = GetClient().GetHabbo().GetRoomUser(); RoomUser u2 = clientByUserId.GetHabbo().GetRoomUser(); foreach (var current2 in roomUserByRank) { if (current2 != null && current2.HabboId != u2.HabboId && current2.HabboId != u.HabboId && current2.GetClient() != null) { if (RoleplayManager.BypassRights(current2.GetClient())) { var whispStaff = new ServerMessage(LibraryParser.OutgoingRequest("WhisperMessageComposer")); whispStaff.AppendInteger(u.VirtualId); whispStaff.AppendString(string.Format("PM to {0}: {1}", clientByUserId.GetHabbo().UserName, message)); whispStaff.AppendInteger(0); whispStaff.AppendInteger(0); whispStaff.AppendInteger(0); whispStaff.AppendInteger(-1); current2.GetClient().SendMessage(whispStaff); } } } } #endregion RoleplayManager.GiveCredit(GetClient(), -credit); } LogPM(_userId, toId, message); }
public void Visit(Plus node) { Visit((dynamic)node[0]); Visit((dynamic)node[1]); }
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { if (!item.ExtraData.Contains(Convert.ToChar(5).ToString())) { return; } string[] array = item.ExtraData.Split(new[] { Convert.ToChar(5) }); session.GetHabbo().Gender = array[0].ToUpper(); var dictionary = new Dictionary <string, string>(); dictionary.Clear(); string[] array2 = array[1].Split('.'); foreach (string text in array2) { string[] array3 = session.GetHabbo().Look.Split('.'); foreach (string text2 in array3) { if (text2.Split('-')[0] == text.Split('-')[0]) { if (dictionary.ContainsKey(text2.Split('-')[0]) && !dictionary.ContainsValue(text)) { dictionary.Remove(text2.Split('-')[0]); dictionary.Add(text2.Split('-')[0], text); } else { if (!dictionary.ContainsKey(text2.Split('-')[0]) && !dictionary.ContainsValue(text)) { dictionary.Add(text2.Split('-')[0], text); } } } else { if (!dictionary.ContainsKey(text2.Split('-')[0])) { dictionary.Add(text2.Split('-')[0], text2); } } } } string text3 = dictionary.Values.Aggregate("", (current1, current) => string.Format("{0}{1}.", current1, current)); session.GetHabbo().Look = text3.TrimEnd('.'); using (IQueryAdapter queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery(string.Format("UPDATE users SET look = @look, gender = @gender WHERE id = {0}", session.GetHabbo().Id)); queryReactor.AddParameter("look", session.GetHabbo().Look); queryReactor.AddParameter("gender", session.GetHabbo().Gender); queryReactor.RunQuery(); } session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer")); session.GetMessageHandler().GetResponse().AppendInteger(-1); session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Look); session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Gender.ToLower()); session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Motto); session.GetMessageHandler().GetResponse().AppendInteger(session.GetHabbo().AchievementPoints); session.GetMessageHandler().SendResponse(); RoomUser roomUserByHabbo = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer")); serverMessage.AppendInteger(roomUserByHabbo.VirtualId); serverMessage.AppendString(session.GetHabbo().Look); serverMessage.AppendString(session.GetHabbo().Gender.ToLower()); serverMessage.AppendString(session.GetHabbo().Motto); serverMessage.AppendInteger(session.GetHabbo().AchievementPoints); session.GetHabbo().CurrentRoom.SendMessage(serverMessage); }
static void Main(string[] args) { Console.WriteLine("Dostępne produkty: mleko, chleb, cukier. \nAby dodać mleko wybierz 1, chleb - wybierz 2, cukier - wybierz 3"); string input = Console.ReadLine(); int produkt = Convert.ToInt32(input); switch (produkt) { case 1: Milk milk = new Milk(); milk.AddToCart(); break; case 2: Bread bread = new Bread(); bread.AddToCart(); break; default: Console.WriteLine("Wybrany produkt nie istnieje "); break; } //if int x = 5; if (x == 1) { Console.WriteLine("1"); } else if (x == 2) { Console.WriteLine("2"); } else if (x == 3) { Console.WriteLine("3"); } else if (x == 4) { Console.WriteLine("4"); Console.WriteLine("4"); Console.WriteLine("4"); } //default else { Console.WriteLine("Nic nie zostało wybrane"); } if (x < 5) { Console.WriteLine("<5"); } else if (x > 5) { Console.WriteLine(">5"); } //default else { Console.WriteLine("Nic nie zostało wybrane"); } int z = 11; switch (z) { case 1: Plus plus = new Plus(); plus.Add(5, 6); break; case 2: Minus minus = new Minus(); minus.Subtract(10, 3); break; default: Console.WriteLine("Brak"); break; } List <int> numList = new List <int>() { 11, 22, 33, 88 }; for (int i = 0; i < numList.Count(); i++) { Console.WriteLine(numList[1]); } //list of strings List <string> elementKolekcji = new List <string>() { "string", "spring", "sphinx", "bring" }; //list of strings foreach (string e in elementKolekcji) { Console.WriteLine(e); } Console.ReadLine(); //tab of int int[] tab = { 1, 2, 3, 7, 9 }; foreach (int y in tab) { Console.WriteLine(y); } Console.ReadLine(); //tab of strings string[] dong = { "ping", "pong", "strong" }; foreach (string d in dong) { Console.WriteLine(d); } Console.ReadLine(); }
/// <summary> /// Checks if timer completed /// </summary> public void timerDone(object info) { if (Session != null && Session.GetHabbo() != null) { try { var user = Session.GetHabbo().GetRoomUser(); var room = Misc.RoleplayManager.GenerateRoom(slot.RoomId); if (timeleft <= 0) { if (slot != null) { RemoveTiles1(); CalculatePrize(); #region Debug Check /* * timeleft = 8000; PlaceTiles2(); * timeleft = 6000; PlaceTiles2(); * timeleft = 4000; PlaceTiles2(); * timeleft = 2000; PlaceTiles2(); * timeleft = 0; PlaceTiles2(); */ #endregion RoleplayManager.GiveMoney(Session, +Prize); if (Prize != 0) { RoleplayManager.Shout(Session, "*Looks at the bottom of the slot machine and collects their reward of $" + Prize + "!*", 5); } if (Prize == 0) { RoleplayManager.Shout(Session, "*Feels ashamed to look at the bottom of the slot machine as they have won nothing*", 5); } #region Jackpot Check if (Jackpot == true) { string Notice = Session.GetHabbo().UserName + " has just won the " + JackpotType + " Jackpot of: $" + Prize + "!"; lock (Plus.GetGame().GetClientManager().Clients.Values) { foreach (GameClient mClient in Plus.GetGame().GetClientManager().Clients.Values) { if (mClient == null) { continue; } if (mClient.GetHabbo() == null) { continue; } if (mClient.GetHabbo().CurrentRoom == null) { continue; } if (mClient.GetConnection() == null) { continue; } mClient.GetHabbo().GetRoomUser().LastBubble = 33; mClient.SendWhisper("[Casino]: " + Notice); mClient.GetHabbo().GetRoomUser().LastBubble = 0; } } } #endregion Session.GetRoleplay().inSlotMachine = false; Session.GetHabbo().GetRoomUser().CanWalk = true; slot.beingRolled = false; timer.Dispose(); } } else { timeleft -= 500; timer.Change(500, Timeout.Infinite); PlaceTiles2(); SlotUpdater(); SlotCheck(); RemoveTiles1(); PlaceTiles1(); } } catch { slot.beingRolled = false; timer.Dispose(); } } else { slot.beingRolled = false; timer.Dispose(); } }
public String Visit(Plus node) { return(Visit((dynamic)node[0]) + Visit((dynamic)node[1]) + "\t\tadd.ovf\n"); }
/// <summary> /// Opens the guide tool. /// </summary> internal void OpenGuideTool() { if (Session.GetRoleplay().JobId == 3) { var guideManager = Plus.GetGame().GetGuideManager(); var onDuty = Request.GetBool(); Request.GetBool(); // guide Request.GetBool(); // helper Request.GetBool(); // guardian if (onDuty) { if (Session.GetRoleplay().JobHasRights("police") || Session.GetRoleplay().JobHasRights("swat")) { if (RoleplayManager.PurgeTime) { Session.SendWhisperBubble("Você não pode trabalhar como oficial durante a purga!", 1); onDuty = false; return; } if (Session.GetRoleplay().IsNoob) { Session.SendWhisperBubble("Você não pode cumprir seus deveres na Aplicação da Lei com a Proteção de Deus Habilitada!", 1); onDuty = false; return; } if (Session.GetHabbo().CurrentRoom.RoomData.Description.Contains("NOCOP")) { Session.SendWhisperBubble("Desculpe, mas esta é uma zona de territorio", 1); onDuty = false; return; } } if (Session.GetRoleplay().SentHome) { Session.SendWhisperBubble("Você foi mandado para casa por um gerente. Você deve esperar " + Session.GetRoleplay().SendHomeTimer + " minutos para começar a trabalhar novamente", 1); onDuty = false; return; } if (Session.GetRoleplay().Working) { Session.SendWhisperBubble("Você já está trabalhando!", 1); onDuty = false; return; } if (Session.GetRoleplay().ATMRobbery) { Session.SendWhisperBubble("Você não pode trabalhar enquanto rouba um caixa eletrônico!", 1); onDuty = false; return; } if (Session.GetRoleplay().Robbery) { Session.SendWhisperBubble("Você não pode trabalhar enquanto rouba o cofre!", 1); onDuty = false; return; } if (Session.GetRoleplay().Learning) { Session.SendWhisperBubble("Você não pode trabalhar enquanto está lendo!", 1); onDuty = false; return; } if (Session.GetRoleplay().WeightLifting) { Session.SendWhisperBubble("Você não pode trabalhar enquanto está malhando!", 1); onDuty = false; return; } if (Session.GetRoleplay().WorkingOut) { Session.SendWhisperBubble("Você não pode trabalhar enquanto trabalha fora!", 1); onDuty = false; return; } if (Session.GetRoleplay().Dead) { Session.SendWhisperBubble("Você não pode trabalhar enquanto estiver morto!", 1); onDuty = false; return; } if (Session.GetRoleplay().Jailed) { Session.SendWhisperBubble("Você não pode trabalhar enquanto estiver preso!", 1); onDuty = false; return; } if (Session.GetRoleplay().JobRank == 1 || Session.GetRoleplay().JobRank == 2 && Session.GetRoleplay().JobId == 3) { guideManager.AddGuide(Session); } Session.GetHabbo().GetRoomUser().ApplyEffect(178); if (Session.GetRoleplay().JobRank > 2 && Session.GetRoleplay().JobRank < 8 && Session.GetRoleplay().JobId == 3) { guideManager.AddOfficer(Session); } Session.GetHabbo().GetRoomUser().ApplyEffect(178); if (Session.GetRoleplay().JobRank == 8 || Session.GetRoleplay().JobRank == 9 && Session.GetRoleplay().JobId == 3) { guideManager.AddChief(Session); } Session.GetHabbo().GetRoomUser().ApplyEffect(178); int JobId = Session.GetRoleplay().JobId; int JobRank = Session.GetRoleplay().JobRank; string JobName = JobManager.JobData[JobId].Name; string RankName = JobManager.JobRankData[JobId, JobRank].Name; Session.GetRoleplay().FigBeforeWork = Session.GetHabbo().Look; Session.GetRoleplay().MottBeforeWork = Session.GetHabbo().Motto; if (Session.GetRoleplay().JobId != 1 && !JobManager.JobRankData[JobId, JobRank].MaleFig.Contains("*") && !JobManager.JobRankData[JobId, JobRank].FemaleFig.Contains("*")) // Set Figure if not Unemployed { if (!JobManager.JobRankData[JobId, JobRank].MaleFig.ToLower().Contains("none") && !JobManager.JobRankData[JobId, JobRank].FemaleFig.ToLower().Contains("none")) { if (Session.GetHabbo().Gender.ToLower().StartsWith("m")) { Session.GetHabbo().Look = RoleplayManager.SplitFigure(Session.GetHabbo().Look) + JobManager.JobRankData[JobId, JobRank].MaleFig; Session.GetRoleplay().FigWork = RoleplayManager.SplitFigure(Session.GetHabbo().Look) + JobManager.JobRankData[JobId, JobRank].MaleFig; } else { Session.GetHabbo().Look = RoleplayManager.SplitFigure(Session.GetHabbo().Look) + JobManager.JobRankData[JobId, JobRank].FemaleFig; Session.GetRoleplay().FigWork = RoleplayManager.SplitFigure(Session.GetHabbo().Look) + JobManager.JobRankData[JobId, JobRank].FemaleFig; } } } Session.GetHabbo().Motto = "[Trabalhando] " + JobName + " " + RankName; Session.GetRoleplay().RefreshVals(); Session.GetRoleplay().Working = true; Session.GetRoleplay().workingTimer = new workingTimer(Session); Session.GetRoleplay().SaveJobComponents(); RoleplayManager.Shout(Session, "*Começa a trabalhar*"); Session.SendWhisperBubble("Você tem " + Session.GetRoleplay().workingTimer.getTime() + " minuto(s) até que você receba seu próximo salário", 1); Session.GetRoleplay().MultiCoolDown["work_cooldown"] = 5; Session.GetRoleplay().CheckingMultiCooldown = true; } else { if (Session.GetRoleplay().Working) { Session.GetRoleplay().StopWork(true); if (Session.GetRoleplay().Equiped != null) { if (Session.GetRoleplay().Equiped.ToLower().Equals("npa")) { Session.GetHabbo().GetRoomUser().ApplyEffect(0); Session.GetRoleplay().Equiped = null; onDuty = false; Session.GetRoleplay().Working = false; } } } guideManager.RemoveGuide(Session); guideManager.RemoveOfficer(Session); guideManager.RemoveChief(Session); Session.GetHabbo().GetRoomUser().ApplyEffect(0); } Session.GetHabbo().OnDuty = onDuty; Response.Init(LibraryParser.OutgoingRequest("HelperToolConfigurationMessageComposer")); Response.AppendBool(onDuty); // on duty Response.AppendInteger(guideManager.GuidesCount); // guides Response.AppendInteger(guideManager.OfficerCount); // helpers Response.AppendInteger(guideManager.ChiefCount); // guardians SendResponse(); } else { Session.SendWhisper("Você deve ser polícia para usar as ferramentas da polícia"); } }
/// <summary> /// Loads the inventory. /// </summary> internal void LoadInventory() { _floorItems.Clear(); _wallItems.Clear(); DataTable table; using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("SELECT * FROM items_rooms WHERE user_id=@userid AND room_id='0' LIMIT 8000;"); queryReactor.AddParameter("userid", ((int)UserId)); table = queryReactor.GetTable(); } foreach (DataRow dataRow in table.Rows) { var id = Convert.ToUInt32(dataRow[0]); var itemId = Convert.ToUInt32(dataRow[3]); if (!Plus.GetGame().GetItemManager().ContainsItem(itemId)) { continue; } string extraData; if (!DBNull.Value.Equals(dataRow[4])) { extraData = (string)dataRow[4]; } else { extraData = string.Empty; } var group = Convert.ToUInt32(dataRow["group_id"]); string songCode; if (!DBNull.Value.Equals(dataRow["songcode"])) { songCode = (string)dataRow["songcode"]; } else { songCode = string.Empty; } var userItem = new UserItem(id, itemId, extraData, group, songCode); if (userItem.BaseItem.InteractionType == Interaction.MusicDisc && !SongDisks.Contains(id)) { SongDisks.Add(id, userItem); } if (userItem.IsWallItem) { if (!_wallItems.Contains(id)) { _wallItems.Add(id, userItem); } } else if (!_floorItems.Contains(id)) { _floorItems.Add(id, userItem); } } SongDisks.Clear(); _inventoryPets.Clear(); _inventoryBots.Clear(); using (var queryReactor2 = Plus.GetDatabaseManager().GetQueryReactor()) { queryReactor2.SetQuery( string.Format("SELECT * FROM bots WHERE user_id = {0} AND room_id = 0", UserId)); var table2 = queryReactor2.GetTable(); if (table2 == null) { return; } foreach (DataRow botRow in table2.Rows) { switch ((string)botRow["ai_type"]) { case "pet": { queryReactor2.SetQuery(string.Format("SELECT * FROM pets_data WHERE id={0} LIMIT 1", botRow[0])); var row = queryReactor2.GetRow(); if (row == null) { continue; } var pet = Catalog.GeneratePetFromRow(botRow, row); AddPet(pet); } break; case "fightpet": { queryReactor2.SetQuery(string.Format("SELECT * FROM pets_data WHERE id={0} LIMIT 1", botRow[0])); var row = queryReactor2.GetRow(); if (row == null) { continue; } var pet = Catalog.GeneratePetFromRow(botRow, row); AddPet(pet); } break; case "generic": AddBot(BotManager.GenerateBotFromRow(botRow)); break; } } } }
// ОПС для всей программы public List <RPN_elem> Parse(List <Lexeme> lexemes) { rpn = new List <RPN_elem>(); Stack <int> label_stack = new Stack <int>(); Stack <State> state_stack = new Stack <State>(); Stack <Action_type> additional_stack = new Stack <Action_type>(); state_stack.Push(new State(Lexical_analyser.TYPE.Eof)); state_stack.Push(new State(Non_terminal.Start)); additional_stack.Push(Action_type.Empty); additional_stack.Push(Action_type.Empty); Stack <int> array_size_stack = new Stack <int>(); String my_name = ""; cur_lexeme = 0; //Таблица переменных Dictionary <string, Data_type> Table_of_vars = new Dictionary <string, Data_type>(); while (state_stack.Count > 0) { State Top_state = state_stack.Pop(); Action_type Top_action = additional_stack.Pop(); Lexeme cur_lex = lexemes[cur_lexeme]; if (Top_action != Action_type.Empty) { int i; RPN_elem rpnElement = null; switch (Top_action) { case Action_type.Get_name: my_name = cur_lex.val; break; case Action_type.Int_declaration: var newVariable = new Type_int_var(); Table_of_vars[my_name] = newVariable; break; case Action_type.Array_declaration: var newArray = new Type_array(array_size_stack.Pop()); Table_of_vars[my_name] = newArray; break; case Action_type.Array_size: array_size_stack.Push(int.Parse(cur_lex.val)); break; case Action_type.Read: rpnElement = new Read(); break; case Action_type.Write: rpnElement = new Write(); break; case Action_type.Plus: rpnElement = new Plus(); break; case Action_type.Minus: rpnElement = new Minus(); break; case Action_type.Mul: rpnElement = new Mul(); break; case Action_type.Div: rpnElement = new Div(); break; case Action_type.Unar_plus: rpnElement = new Unar_plus(); break; case Action_type.Unar_minus: rpnElement = new Unar_minus(); break; case Action_type.Less: rpnElement = new Less(); break; case Action_type.Less_or_equal: rpnElement = new Less_or_equal(); break; case Action_type.More: rpnElement = new More(); break; case Action_type.More_or_equal: rpnElement = new More_or_equal(); break; case Action_type.Equal: rpnElement = new Equal(); break; case Action_type.Index: rpnElement = new Index(); break; case Action_type.Get: rpnElement = new Get(); break; case Action_type.Id: if (Table_of_vars.ContainsKey(cur_lex.val)) { rpnElement = new Put_data_type_to_stack(Table_of_vars[cur_lex.val]); } else { throw new Syntax_analyser_exception("Переменная не объявлена", cur_lex.line, cur_lex.char_pos); } break; case Action_type.Num: rpnElement = new Put_data_type_to_stack(new Type_number(int.Parse(cur_lex.val))); break; case Action_type.Auxiliary_action_1: label_stack.Push(rpn.Count); rpn.Add(new Put_data_type_to_stack(new Type_number())); rpnElement = new Jf(); break; case Action_type.Auxiliary_action_2: i = label_stack.Pop(); rpn[i] = new Put_data_type_to_stack(new Type_number(rpn.Count + 2)); label_stack.Push(rpn.Count); rpn.Add(new Put_data_type_to_stack(new Type_number(-1))); rpnElement = new J(); break; case Action_type.Auxiliary_action_3: i = label_stack.Pop(); rpn[i] = new Put_data_type_to_stack(new Type_number(rpn.Count)); break; case Action_type.Auxiliary_action_4: label_stack.Push(rpn.Count); break; case Action_type.Auxiliary_action_5: i = label_stack.Pop(); rpn[i] = new Put_data_type_to_stack(new Type_number(rpn.Count + 2)); i = label_stack.Pop(); rpn.Add(new Put_data_type_to_stack(new Type_number(i))); rpn.Add(new J()); break; default: throw new Exception("Действие не выполнено"); } if (rpnElement != null) { rpn.Add(rpnElement); } } if (Top_state.Is_empty) { continue; } if (Top_state.Is_terminal) { //на вершине стека терминал if (Top_state.Terminal == cur_lex.Type) { cur_lexeme++; } else { throw new Syntax_analyser_exception("Неожиданный символ " + cur_lex.Type.ToString(), cur_lex.line, cur_lex.char_pos); } } else { //на вершине стека нетерминал Non_terminal nt = Top_state.Non_terminal; if (!Table_of_rules.ContainsKey(nt) || !Table_of_rules[nt].ContainsKey(cur_lex.Type)) { throw new Syntax_analyser_exception("Неожиданный символ ", cur_lex.line, cur_lex.char_pos); } Table_of_rules[nt][cur_lex.Type].Apply(state_stack); Table_of_actions[nt][cur_lex.Type].Apply(additional_stack); } } return(rpn); }
/// <summary> /// Runs the database update. /// </summary> internal void RunDbUpdate() { try { if (_mRemovedItems.Count <= 0 && _mAddedItems.Count <= 0 && _inventoryPets.Count <= 0) { return; } var queryChunk = new QueryChunk(); if (_mAddedItems.Count > 0) { foreach (UserItem userItem in _mAddedItems.Values) { queryChunk.AddQuery(string.Format("UPDATE items_rooms SET user_id='{0}', room_id='0' WHERE id='{1}'", UserId, userItem.Id)); } _mAddedItems.Clear(); } if (_mRemovedItems.Count > 0) { try { foreach (UserItem userItem2 in _mRemovedItems.Values) { using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor()) GetClient() .GetHabbo() .CurrentRoom.GetRoomItemHandler() .SaveFurniture(queryReactor); if (SongDisks.Contains(userItem2.Id)) { SongDisks.Remove(userItem2.Id); } } } catch (Exception) { } _mRemovedItems.Clear(); } foreach (Pet current in _inventoryPets.Values) { if (current.DbState == DatabaseUpdateState.NeedsUpdate) { queryChunk.AddParameter(string.Format("{0}name", current.PetId), current.Name); queryChunk.AddParameter(string.Format("{0}race", current.PetId), current.Race); queryChunk.AddParameter(string.Format("{0}color", current.PetId), current.Color); queryChunk.AddQuery(string.Concat(new object[] { "UPDATE bots SET room_id = ", current.RoomId, ", name = @", current.PetId, "name, x = ", current.X, ", Y = ", current.Y, ", Z = ", current.Z, " WHERE id = ", current.PetId })); queryChunk.AddQuery(string.Concat(new object[] { "UPDATE pets_data SET race = @", current.PetId, "race, color = @", current.PetId, "color, type = ", current.Type, ", experience = ", current.Experience, ", energy = ", current.Energy, ", nutrition = ", current.Nutrition, ", respect = ", current.Respect, ", createstamp = '", current.CreationStamp, "', lasthealth_stamp = ", Plus.DateTimeToUnix(current.LastHealth), ", untilgrown_stamp = ", Plus.DateTimeToUnix(current.UntilGrown), " WHERE id = ", current.PetId })); } current.DbState = DatabaseUpdateState.Updated; } using (var queryreactor2 = Plus.GetDatabaseManager().GetQueryReactor()) queryChunk.Execute(queryreactor2); } catch (Exception ex) { Logging.LogCacheError(string.Format("FATAL ERROR DURING USER INVENTORY DB UPDATE: {0}", ex)); } }
public void timerDone(object info) { try { timeLeft -= 60000; #region Conditions if (Session == null) { stopTimer(); return; } if (!Session.GetHabbo().CurrentRoom.RoomData.Description.Contains("HOSP")) { return; } if (timeLeft > 0) { if (!Session.GetRoleplay().Dead) { timeLeft = -1; } if (Session.GetRoleplay().DeadTimer <= 0) { timeLeft = -1; } int minutesRemaining = timeLeft / 60000; Session.GetRoleplay().DeadTimer--; Session.GetRoleplay().SaveStatusComponents("dead"); Session.SendWhisper("Você tem " + Session.GetRoleplay().DeadTimer + " minutos restantes para ser levado ao hospital."); timer.Change(60000, Timeout.Infinite); return; } #endregion #region Restore Session.GetRoleplay().DeadTimer = 0; RoomUser RoomUser = Session.GetHabbo().GetRoomUser(); if (RoomUser == null) { return; } RoomUser.Frozen = false; RoleplayManager.Shout(Session, "*Regains their consciousness*", 0); Session.GetRoleplay().DeadTimer = 0; Session.GetRoleplay().Dead = false; Session.GetRoleplay().SaveStatusComponents("dead"); if (Session.GetRoleplay().FigBeforeSpecial != null && Session.GetRoleplay().MottBeforeSpecial != null) { Session.GetHabbo().Look = Session.GetRoleplay().FigBeforeSpecial; Session.GetHabbo().Motto = Session.GetRoleplay().MottBeforeSpecial; } else { DataRow User = null; using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT look,motto FROM users WHERE id = '" + Session.GetHabbo().Id + "'"); User = dbClient.GetRow(); } Session.GetHabbo().Look = Convert.ToString(User["look"]); Session.GetHabbo().Motto = Convert.ToString(User["motto"]); } Session.GetRoleplay().RefreshVals(); stopTimer(); #endregion } catch { stopTimer(); } }
public int Visit(Plus node) { return(Visit((dynamic)node[0]) + Visit((dynamic)node[1])); }
private void manager_connectionEvent(ConnectionInformation connection) { connection.connectionChanged += connectionChanged; Plus.GetGame().GetClientManager().CreateAndStartClient((uint)connection.getConnectionID(), connection); }
public virtual void VisitPlus(Plus n) { }
public void TestDynamicActivityWithInvokeMethod() { var a = new DynamicActivity { DisplayName = "Dynamic Plus", Properties = { new DynamicActivityProperty() { Name = "ZZ", Type = typeof(OutArgument <int>), } }, Implementation = () => { Variable <int> t1 = new Variable <int>("t1"); var plus = new Plus() { X = new ArgumentValue <int>() { ArgumentName = "XX" }, Y = new ArgumentValue <int>() { ArgumentName = "YY" }, Z = t1, }; var s = new System.Activities.Statements.Sequence() { Variables = { t1 }, Activities = { new InvokeMethod <string>() { MethodName = "DoSomething", TargetObject = new InArgument <InvokeMethodTests>(c => this), Parameters = { new InArgument <string>("Abcd") }, }, new InvokeMethod <int>() { MethodName = "GetSomething", TargetType = this.GetType(), Result = t1, }, new System.Activities.Statements.Assign <int> { To = new ArgumentReference <int>{ ArgumentName = "ZZ" }, //So the Value will be assigned to property ZZ. Noted that ArgumentReference<> is a CodeActivity<> Value = new InArgument <int>(env => t1.Get(env)), //So the Value will be wired from t1 in context. }, }, }; return(s); }, }; var r = WorkflowInvoker.Invoke(a); var threadId = (int)r["ZZ"]; Assert.Equal(System.Threading.Thread.CurrentThread.ManagedThreadId, threadId); }
/// <summary> /// Adds the staff pick. /// </summary> internal void AddStaffPick() { this.Session.SendNotif(Plus.GetLanguage().GetVar("addstaffpick_error_1")); }
private RegularExpression Factor() { var a = this.Atom(); while (this.More() && (this.Peek() == '*' || this.Peek() == '?' || this.Peek() == '+')) { switch (this.Peek()) { case '*': { this.Eat('*'); var greedy = true; if (this.More() && this.Peek() == '?') { greedy = false; this.Eat('?'); } a = new Star { Greedy = greedy, Re = a }; break; } case '?': { this.Eat('?'); var greedy = true; if (this.More() && this.Peek() == '?') { greedy = false; this.Eat('?'); } a = new Question { Greedy = greedy, Re = a }; break; } case '+': { this.Eat('+'); var greedy = true; if (this.More() && this.Peek() == '?') { greedy = false; this.Eat('?'); } a = new Plus { Greedy = greedy, Re = a }; break; } } } return a; }