Exemplo n.º 1
0
        public static bool Invite(string[] args, CommandGroup command)
        {
            if (args.Count() < 1)
            {
                return(false);
            }

            Player target;

            if (!command.extractPlayerTarget(args[0], out target))
            {
                return(false);
            }

            string guildName = command.extractQuotedArg(args[0] == "\"" ? args[0] : args[1]);

            if (guildName == null)
            {
                return(false);
            }

            Guild targetGuild = GuildMgr.GetGuildByName(guildName);

            if (targetGuild == null)
            {
                return(false);
            }

            targetGuild.AddMember(target.GetGUIDLow());

            return(true);
        }
Exemplo n.º 2
0
        public static bool Create(string[] args, CommandGroup command)
        {
            if (args.Count() < 1)
            {
                return(false);
            }

            Player target;

            if (!command.extractPlayerTarget(args[0], out target))
            {
                return(false);
            }

            string guildname = command.extractQuotedArg(args[0].Contains("\"") ? args[0] : args[1]);

            if (guildname == null)
            {
                return(false);
            }

            if (target.GuildGuid != 0)
            {
                return(command.SendErrorMessage(CypherStrings.PlayerInGuild));
            }

            Guild guild = new Guild();

            if (!GuildMgr.CreateGuild(target, guildname))
            {
                return(command.SendErrorMessage(CypherStrings.GuildNotCreated));
            }

            return(true);
        }
Exemplo n.º 3
0
        public static bool UnInvite(string[] args, CommandGroup command)
        {
            if (args.Count() == 0)
            {
                return(false);
            }

            Player target;

            if (!command.extractPlayerTarget(args[0], out target))
            {
                return(command.SendErrorMessage(CypherStrings.NoPlayer));
            }

            Guild targetGuild = GuildMgr.GetGuildByGuid(target.GuildGuid);

            if (targetGuild == null)
            {
                return(false);
            }

            targetGuild.DeleteMember(target.GetGUIDLow());

            return(true);
        }
Exemplo n.º 4
0
        public static bool HandleModifyLevelCommand(string[] args, CommandGroup cmd)
        {
            if (args.Count() < 1)
                return false;

            Player target;
            int level;

            if (!cmd.extractPlayerTarget(args[0], out target))
                return cmd.SendErrorMessage(CypherStrings.PlayerNotFound);

            int.TryParse(args[0] == "\"" ? args[1] : args[0], out level);

            int oldlevel = (int)(target != null ? target.getLevel() : 0);//Player::GetLevelFromDB(targetGuid);
            int newlevel = level != 0 ? level : oldlevel;

            if (newlevel < 1)
                return true;

            if (newlevel > 255)
                newlevel = 255;

            if (cmd.GetSession().GetPlayer() != target)
                target.SendNotification(CypherStrings.YouChangeLvl, cmd.GetNameLink(target), newlevel);

            if (target != null)
            {
                target.GiveLevel((uint)newlevel);
                //player->InitTalentForLevel();
                target.SetValue<uint>(PlayerFields.XP, 0);

                if (oldlevel == newlevel)
                    cmd.SendSysMessage(CypherStrings.YoursLevelProgressReset, cmd.GetNameLink(target));
                else if (oldlevel < newlevel)
                    cmd.SendSysMessage(CypherStrings.YoursLevelUp, cmd.GetNameLink(target), newlevel);
                else
                    cmd.SendSysMessage(CypherStrings.YoursLevelDown, cmd.GetNameLink(target), newlevel);
            }
            else
            {
                // Update level and reset XP, everything else will be updated at login
                PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.CHAR_UPD_LEVEL);
                stmt.AddValue(0, (byte)newlevel);
                stmt.AddValue(1, target.GetGUIDLow());
                DB.Characters.Execute(stmt);                
            }
            return true;
        }
Exemplo n.º 5
0
        public static bool Rank(string[] args, CommandGroup command)
        {
            Player target;
            int    rankId;

            if (!command.extractPlayerTarget(args[0], out target))
            {
                return(command.SendErrorMessage(CypherStrings.NoPlayer));
            }

            int.TryParse(Regex.IsMatch(args[0], @"\d") ? args[0] : args[1], out rankId);

            Guild targetGuild = GuildMgr.GetGuildByGuid(target.GuildGuid);

            if (targetGuild == null)
            {
                return(false);
            }

            targetGuild.GetMember(target.GetGUIDLow()).ChangeRank((uint)rankId);

            return(true);
        }