protected override bool Process(Player player, RealmTime time, string[] args) { if (String.IsNullOrWhiteSpace(args[0])) { player.SendInfo("Usage: /join <guild name>"); return false; } if (!player.Invited) { player.SendInfoWithTokens("server.guild_not_invited", new KeyValuePair<string, object>[1] { new KeyValuePair<string, object>("guild", args[0]) }); return false; } player.Manager.Database.DoActionAsync(db => { var gStruct = db.GetGuild(args[0]); if (player.Invited == false) { player.SendInfo("You need to be invited to join a guild!"); } if (gStruct != null) { var g = db.ChangeGuild(player.Client.Account, gStruct.Id, 0, 0, false); if (g != null) { player.Client.Account.Guild = g; GuildManager.CurrentManagers[args[0]].JoinGuild(player); } } else { player.SendInfoWithTokens("server.guild_join_fail", new KeyValuePair<string, object>[1] { new KeyValuePair<string, object>("error", "Guild does not exist") }); } }); return true; }
protected override bool Process(Player player, RealmTime time, string[] args) { if (String.IsNullOrWhiteSpace(args[0])) { player.SendInfo("Usage: /invite <player name>"); return false; } if (player.Guild[player.AccountId].Rank >= 20) { foreach (var i in player.Owner.Players.Values) { Player target = player.Owner.GetPlayerByName(args[0]); if (target == null) { player.SendInfoWithTokens("server.invite_notfound", new KeyValuePair<string, object>[1] { new KeyValuePair<string, object>("player", args[0]) }); return false; } if (!target.NameChosen || player.Dist(target) > 20) { player.SendInfoWithTokens("server.invite_notfound", new KeyValuePair<string, object>[1] { new KeyValuePair<string, object>("player", args[0]) }); return false; } if (target.Guild.IsDefault) { target.Client.SendPacket(new InvitedToGuildPacket() { Name = player.Name, GuildName = player.Guild[player.AccountId].Name }); target.Invited = true; player.SendInfoWithTokens("server.invite_succeed", new KeyValuePair<string, object>[2] { new KeyValuePair<string, object>("player", args[0]), new KeyValuePair<string, object>("guild", player.Guild[player.AccountId].Name) }); return true; } else { player.SendError("Player is already in a guild!"); return false; } } } else { player.Client.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Members and initiates cannot invite!" }); } return false; }