private void AddGroup(Groups.Group group) { var coldef = new ColumnDefinition(); coldef.Width = new GridLength(200); GroupGrid.ColumnDefinitions.Insert(GroupGrid.ColumnDefinitions.Count - 1, coldef); Grid.SetColumn(ButtonAddGroup, GroupGrid.ColumnDefinitions.Count); var label = new Label(); label.Content = group.name; label.MouseDoubleClick += (sender, e) => { Pages.Properties.Handle.SetSelected(group); }; Grid.SetColumn(label, GroupGrid.ColumnDefinitions.Count - 2); Grid.SetRow(label, 0); GroupGrid.Children.Add(label); var list = new Controls.GroupMemberList(); list.SetGroup(group); Grid.SetColumn(list, GroupGrid.ColumnDefinitions.Count - 2); Grid.SetRow(list, 1); GroupGrid.Children.Add(list); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { StringBuilder Message = new StringBuilder().Append("<----- Territórios de Gangue ----->\n\n"); if (TurfManager.TurfList.Count == 0) { Message.Append("Não há territórios de gangues disponíveis!\n"); } lock (TurfManager.TurfList) { foreach (Turf Turf in TurfManager.TurfList.Values) { if (Turf == null) { continue; } Room TurfRoom = RoleplayManager.GenerateRoom(Turf.RoomId, false); Groups.Group Gang = Groups.GroupManager.GetGang(Turf.GangId); if (TurfRoom != null) { Message.Append(TurfRoom.Name + " [Quarto ID: " + Turf.RoomId + "] --- Controlado por: " + Gang.Name + "\n"); Message.Append("----------\n"); } } } Session.SendMessage(new MOTDNotificationComposer(Message.ToString())); }
private void ButtonAddGroup_Click(object sender, RoutedEventArgs e) { var window = new Dialogs.GetString("Group Name"); window.ShowDialog(); if (window.DialogResult == true) { var name = window.Result; var group = new Groups.Group(name); groups.AddGroup(group); AddGroup(group); } }
public virtual void Remove(Groups.Group group) { if (group == null) { throw new ValidationException("Group can't be empty"); } if (!this.groupIds.Contains(group.Id)) { throw new ValidationException("User was not invited to this group"); } this.groupIds.Remove(group.Id); }
public void SetGroup(Groups.Group group) { this.group = group; List.ItemsSource = group.Members; }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length < 2) { Session.SendWhisper("Ha ocurrido un error, especifica ON / OFF"); return; } if (!Room.CheckRights(Session, true)) { Session.SendWhisper("No tienes permisos."); return; } if (Room.Group == null) { Session.SendWhisper("Esta sala no tiene grupo, si lo acabas de crear haz :unload"); return; } if (Room.Group.Id != Session.GetHabbo().GetStats().FavouriteGroupId) { Session.SendWhisper("Solo se puede crear un grupo si lo tienes como favorito."); return; } string mode = Params[1].ToLower(); Groups.Group group = Room.Group; if (mode == "on") { if (group.HasChat) { Session.SendWhisper("Este grupo ya tiene chat."); return; } group.HasChat = true; using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE groups SET has_chat = '1' WHERE id = @id"); dbClient.AddParameter("id", group.Id); dbClient.RunQuery(); } GameClient Client = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(Session.GetHabbo().Id); if (Client != null) { Client.SendMessage(new FriendListUpdateComposer(group, 1)); } } else if (mode == "off") { if (!group.HasChat) { Session.SendWhisper("Este grupo no tiene chat aun."); return; } group.HasChat = false; using (IQueryAdapter adap = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { adap.SetQuery("UPDATE groups SET has_chat = '0' WHERE id = @id"); adap.AddParameter("id", group.Id); adap.RunQuery(); } GameClient Client = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(Session.GetHabbo().Id); if (Client != null) { Client.SendMessage(new FriendListUpdateComposer(group, -1)); } } else { Session.SendNotification("Ha ocurrido un error"); } }
public bool Loot(User.User looter, List <string> commands, bool byPassCheck = false) { bool looted = false; if (IsDead()) { List <Items.Iitem> result = new List <Items.Iitem>(); StringBuilder sb = new StringBuilder(); if (!byPassCheck) { //Let's see if who's looting was the killer otherwise we check the time of death //also check if looter is part of a group if so then the group will provide the loot logic. if (!string.Equals(looter.UserID, ((Iactor)this).KillerID, StringComparison.InvariantCultureIgnoreCase)) { if (!CanLoot(looter.UserID)) { //looter not the killer not in group and time to loot has not expired looter.MessageHandler("You did not deal the killing blow and can not loot this corpse at this time."); return(false); } } //let's check if looter is in a group if (!string.IsNullOrEmpty(looter.GroupName)) { //looter is part of a group, let's see if the group loot rule is free for all first Groups.Group group = Groups.Groups.GetInstance().GetGroup(looter.GroupName); if (group.GroupRuleForLooting != Groups.GroupLootRule.First_to_loot) { group.Loot(looter, commands, this); return(false); } } } if (commands.Contains("all")) { sb.AppendLine("You loot the following items from " + FirstName + ":"); Inventory.GetInventoryAsItemList().ForEach(i => { sb.AppendLine(i.Name); looter.Player.Inventory.AddItemToInventory(Inventory.RemoveInventoryItem(i, this.Equipment)); }); looted = true; } else if (commands.Count > 2) //the big one, should allow to loot individual item from the inventory { string itemName = Items.Items.ParseItemName(commands); int index = 1; int position = 1; string[] positionString = commands[0].Split('.'); //we are separating based on using the decimal operator after the name of the npc/item if (positionString.Count() > 1) { int.TryParse(positionString[positionString.Count() - 1], out position); } Inventory.GetInventoryAsItemList().ForEach(i => { if (string.Equals(i.Name, itemName, StringComparison.InvariantCultureIgnoreCase) && index == position) { looter.Player.Inventory.AddItemToInventory(Inventory.RemoveInventoryItem(i, this.Equipment)); sb.AppendLine("You loot " + i.Name + " from " + FirstName); Rooms.Room.GetRoom(looter.Player.Location).InformPlayersInRoom(string.Format("{0} loots {1} from {3}'s lifeless body.", looter.Player.FirstName, i.Name, FirstName), new List <string>() { ID }); index = -1; //we found it and don't need this to match anymore looted = true; } else { index++; } }); } else { sb.AppendLine(FirstName + " was carrying: "); Inventory.GetInventoryAsItemList().ForEach(i => sb.AppendLine(i.Name)); } looter.MessageHandler(sb.ToString()); } return(looted); }