コード例 #1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(this, 2) && from.CanSee(this))
            {

                int Spawned = 0;
                int Team = 0;

                //Guage the amount of army members spawned.
                int RedSpawned = 0;
                int BlueSpawned = 0;

                //Changes the hues used to define the colors for Red and Blue teams.
                int RedTeamHue = 3;
                int BlueTeamHue = 5;

                //Use this to change the spawn locations of the army members.
                int XOffset = Utility.Random(4) - 2;
                int YOffset = Utility.Random(4) - 2;
                int ZOffset = 0;

                Mobile m;

                if (from.GuildTitle == "Red Team" || from.GuildTitle == "Blue Team")
                {
                    switch(from.GuildTitle)
                    {
                        case "Red Team":
                            {
                                Team = RedTeamHue;
                                break;
                            }
                        case "Blue Team":
                            {
                                Team = BlueTeamHue;
                                break;
                            }
                    }

                    Container pack = from.Backpack;
                    while (pack.FindItemByType(typeof(ToughGem)) != null)
                    {
                        m = new ArmyBaseMace(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(ToughGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    while (pack.FindItemByType(typeof(SharpGem)) != null)
                    {
                        m = new ArmyBaseFence(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(SharpGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    while (pack.FindItemByType(typeof(CutGem)) != null)
                    {
                        m = new ArmyBaseSword(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(CutGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    while (pack.FindItemByType(typeof(NoxGem)) != null)
                    {
                        m = new ArmyBaseNox(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(NoxGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    while (pack.FindItemByType(typeof(ElectricGem)) != null)
                    {
                        m = new ArmyBaseStun(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(ElectricGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    while (pack.FindItemByType(typeof(FlawlessGem)) != null)
                    {
                        m = new ArmyBaseSuper(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(FlawlessGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    while (pack.FindItemByType(typeof(BlackGem)) != null)
                    {
                        m = new ArmyBaseAssassin(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(BlackGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    while (pack.FindItemByType(typeof(SwiftGem)) != null)
                    {
                        m = new ArmyBaseThief(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(SwiftGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    while (pack.FindItemByType(typeof(ClearGem)) != null)
                    {
                        m = new ArmyBaseHealer(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(ClearGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                            case 3:
                                {
                                    RedSpawned++;
                                    break;
                                }
                            case 5:
                                {
                                    BlueSpawned++;
                                    break;
                                }
                        }
                    }

                    if (Spawned == 0)
                    {
                        from.SendMessage("You do not have any spawn items!");
                    }

                    if (RedSpawned > 0)
                    {
                        string SpawnMessage = string.Concat(RedSpawned, " Red Army members spawned.");
                        from.SendMessage(SpawnMessage);
                    }

                    if (BlueSpawned > 0)
                    {
                        string SpawnMessage = string.Concat(BlueSpawned, " Blue Army members spawned.");
                        from.SendMessage(SpawnMessage);
                    }
                }

                else
                {
                    from.SendMessage("You must be a member of the red or blue team to build an army!");
                }
            }

            else
            {
                from.SendLocalizedMessage(500446); // That is too far away. 
            }
        }
コード例 #2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(this, 2) && from.CanSee(this))
            {
                int Spawned = 0;
                int Team    = 0;

                //Guage the amount of army members spawned.
                int RedSpawned  = 0;
                int BlueSpawned = 0;

                //Changes the hues used to define the colors for Red and Blue teams.
                int RedTeamHue  = 3;
                int BlueTeamHue = 5;

                //Use this to change the spawn locations of the army members.
                int XOffset = Utility.Random(4) - 2;
                int YOffset = Utility.Random(4) - 2;
                int ZOffset = 0;

                Mobile m;

                if (from.GuildTitle == "Red Team" || from.GuildTitle == "Blue Team")
                {
                    switch (from.GuildTitle)
                    {
                    case "Red Team":
                    {
                        Team = RedTeamHue;
                        break;
                    }

                    case "Blue Team":
                    {
                        Team = BlueTeamHue;
                        break;
                    }
                    }

                    Container pack = from.Backpack;
                    while (pack.FindItemByType(typeof(ToughGem)) != null)
                    {
                        m = new ArmyBaseMace(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(ToughGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    while (pack.FindItemByType(typeof(SharpGem)) != null)
                    {
                        m = new ArmyBaseFence(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(SharpGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    while (pack.FindItemByType(typeof(CutGem)) != null)
                    {
                        m = new ArmyBaseSword(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(CutGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    while (pack.FindItemByType(typeof(NoxGem)) != null)
                    {
                        m = new ArmyBaseNox(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(NoxGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    while (pack.FindItemByType(typeof(ElectricGem)) != null)
                    {
                        m = new ArmyBaseStun(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(ElectricGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    while (pack.FindItemByType(typeof(FlawlessGem)) != null)
                    {
                        m = new ArmyBaseSuper(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(FlawlessGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    while (pack.FindItemByType(typeof(BlackGem)) != null)
                    {
                        m = new ArmyBaseAssassin(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(BlackGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    while (pack.FindItemByType(typeof(SwiftGem)) != null)
                    {
                        m = new ArmyBaseThief(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(SwiftGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    while (pack.FindItemByType(typeof(ClearGem)) != null)
                    {
                        m = new ArmyBaseHealer(Team);
                        m.MoveToWorld(new Point3D(X + XOffset, Y + YOffset, Z + ZOffset), Map);
                        Item item = pack.FindItemByType(typeof(ClearGem));
                        item.Delete();
                        Spawned++;
                        switch (Team)
                        {
                        case 3:
                        {
                            RedSpawned++;
                            break;
                        }

                        case 5:
                        {
                            BlueSpawned++;
                            break;
                        }
                        }
                    }

                    if (Spawned == 0)
                    {
                        from.SendMessage("You do not have any spawn items!");
                    }

                    if (RedSpawned > 0)
                    {
                        string SpawnMessage = string.Concat(RedSpawned, " Red Army members spawned.");
                        from.SendMessage(SpawnMessage);
                    }

                    if (BlueSpawned > 0)
                    {
                        string SpawnMessage = string.Concat(BlueSpawned, " Blue Army members spawned.");
                        from.SendMessage(SpawnMessage);
                    }
                }

                else
                {
                    from.SendMessage("You must be a member of the red or blue team to build an army!");
                }
            }

            else
            {
                from.SendLocalizedMessage(500446); // That is too far away.
            }
        }