示例#1
0
		public PetitionRecord(string name, uint ownerId, uint itemId, PetitionType type)
		{
            Name = name;
			OwnerId = ownerId;
			ItemId = (int)itemId;
			SignedIds = new List<uint>(9);
            Type = type;
		}
示例#2
0
 public PetitionRecord(string name, uint ownerId, uint itemId, PetitionType type)
 {
     Name      = name;
     OwnerId   = ownerId;
     ItemId    = (int)itemId;
     SignedIds = new List <uint>(9);
     Type      = type;
 }
示例#3
0
 public PetitionRecord(string name, uint ownerId, uint itemId, PetitionType type)
 {
     this.Name      = name;
     this.OwnerId   = ownerId;
     this.ItemId    = (int)itemId;
     this.SignedIds = new List <uint>(9);
     this.Type      = type;
 }
示例#4
0
 public static string guardar_partida(string usuario, Dictionary <string, string> datos)
 {
     type     = PetitionType.SAVE;
     peticion = "username="******"&" + item.Key + "=" + item.Value;
     }
     return(Upload(peticion, "guardar_partida.php"));
 }
示例#5
0
        public static void HandlePetitionBuy(IRealmClient client, RealmPacketIn packet)
        {
            var chr = client.ActiveCharacter;

            var petitionerId = packet.ReadEntityId();
            var petitioner   = chr.Map.GetObject(petitionerId) as NPC;

            //var petitionId = packet.ReadInt32();
            //var petitionCreator = packet.ReadEntityId();
            //packet.SkipBytes(4 + 8);
            packet.Position += 4 + 8;
            var name = packet.ReadCString().Trim();

            //var bodytext = packet.ReadCString().Trim();
            //var minSignatures = packet.ReadInt32();
            //var maxSignatures = packet.ReadInt32();
            //var deadline = packet.ReadInt32();
            //var issueDate = packet.ReadInt32();
            //var allowedGuildId = packet.ReadInt32();
            //var allowedClassMask = packet.ReadInt32();
            //var allowedRaceMask = packet.ReadInt32();
            //var allowedGender = packet.ReadInt32(); // wow is sexist... :(
            //var allowedMinLevel = packet.ReadInt32();
            //var allowedMaxLevel = packet.ReadInt32();
            //packet.SkipBytes(4 * 10);
            //packet.Position += (7 * 8) + 2 + 1 + 8;
            packet.Position += 4 * 10;
            var choice = packet.ReadInt32();

            //var petitionType = packet.ReadInt32();
            //packet.SkipBytes(4);
            packet.Position += 4;

            if (petitioner != null && petitioner.IsPetitioner && petitioner.CheckVendorInteraction(chr))
            {
                ItemId       itemId = 0;
                uint         cost   = 0;
                PetitionType type   = PetitionType.None;

                if (petitioner.IsGuildPetitioner)
                {
                    if (chr.IsInGuild)
                    {
                        GuildHandler.SendResult(chr, GuildCommandId.CREATE, name, GuildResult.ALREADY_IN_GUILD);
                        return;
                    }
                    if (!GuildMgr.IsValidGuildName(name))
                    {
                        GuildHandler.SendResult(chr, GuildCommandId.CREATE, name, GuildResult.NAME_INVALID);
                        return;
                    }
                    else if (GuildMgr.DoesGuildExist(name))
                    {
                        GuildHandler.SendResult(chr, GuildCommandId.CREATE, name, GuildResult.NAME_EXISTS);
                        return;
                    }
                    itemId = PetitionerEntry.GuildPetitionEntry.ItemId;
                    cost   = GuildMgr.GuildCharterCost;
                    type   = PetitionType.Guild;
                }
                else if (petitioner.IsArenaPetitioner)
                {
                    switch (choice)
                    {
                    case 1:
                        itemId = PetitionerEntry.ArenaPetition2v2Entry.ItemId;
                        cost   = PetitionerEntry.ArenaPetition2v2Entry.Cost;
                        type   = PetitionType.Arena2vs2;
                        break;

                    case 2:
                        itemId = PetitionerEntry.ArenaPetition3v3Entry.ItemId;
                        cost   = PetitionerEntry.ArenaPetition3v3Entry.Cost;
                        type   = PetitionType.Arena3vs3;
                        break;

                    case 3:
                        itemId = PetitionerEntry.ArenaPetition5v5Entry.ItemId;
                        cost   = PetitionerEntry.ArenaPetition5v5Entry.Cost;
                        type   = PetitionType.Arena5vs5;
                        break;

                    default:
                        return;
                    }
                    if (!ArenaMgr.IsValidArenaTeamName(name))
                    {
                        ArenaTeamHandler.SendResult(chr, ArenaTeamCommandId.CREATE, name, string.Empty, ArenaTeamResult.NAME_INVALID);
                        return;
                    }
                    else if (ArenaMgr.DoesArenaTeamExist(name))
                    {
                        ArenaTeamHandler.SendResult(chr, ArenaTeamCommandId.CREATE, name, string.Empty, ArenaTeamResult.NAME_EXISTS);
                        return;
                    }
                }
                if (itemId != 0 && cost != 0 && type != PetitionType.None)
                {
                    var templ = ItemMgr.GetTemplate(itemId);
                    if (templ == null)
                    {
                        SendBuyError(chr, petitioner, itemId, BuyItemError.CantFindItem);
                    }
                    else if (chr.Money < cost)
                    {
                        SendBuyError(chr, petitioner, itemId, BuyItemError.NotEnoughMoney);
                    }
                    else if (!PetitionRecord.CanBuyPetition(chr.EntityId.Low))
                    {
                        chr.SendSystemMessage("You can't buy another petition !");
                    }
                    else
                    {
                        var slotId = chr.Inventory.FindFreeSlot(templ, 1);
                        if (slotId.Container == null)
                        {
                            SendBuyError(chr, petitioner, itemId, BuyItemError.CantCarryAnymore);
                        }
                        else
                        {
                            var item = slotId.Container.AddUnchecked(slotId.Slot, templ, 1, true) as PetitionCharter;
                            item.Petition = new PetitionRecord(name, chr.EntityId.Low, item.EntityId.Low, type);
                            item.Petition.Create();

                            chr.Money -= cost;

                            item.SetEnchantId(EnchantSlot.Permanent, item.EntityId.Low);
                        }
                    }
                }
            }
        }
示例#6
0
    public void TestAddPetitionTypes()
    {
        var go = _context.RuleOfProcedures.FirstOrDefault();

        var gv   = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-gv");
        var ha3  = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-ha3");
        var wiso = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-wiso");
        var sek  = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-sek");
        var sr   = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-sr");
        var kfk  = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-kfk");
        var mrr  = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-mrr");
        var uv   = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-uv");
        //var gr1 = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-gr1");
        //var gr2 = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-gr2");
        //var gr3 = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-gr3");
        //var gr4 = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-gr4");
        //var gr5 = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-gr5");
        //var gr6 = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-gr6");
        //var ego = _context.Committees.FirstOrDefault(n => n.CommitteeId == "munsh22-ego");

        List <Committee> committees = new List <Committee>();

        committees.Add(gv);
        committees.Add(ha3);
        committees.Add(wiso);
        committees.Add(sek);
        committees.Add(sr);
        committees.Add(kfk);
        committees.Add(mrr);
        committees.Add(uv);
        //committees.Add(gr1);
        //committees.Add(gr2);
        //committees.Add(gr3);
        //committees.Add(gr4);
        //committees.Add(gr5);
        //committees.Add(gr6);
        //committees.Add(ego);

        // Persönliche Anträge

        var p1 = new PetitionType()
        {
            Category                 = "Persönlicher Antrag",
            SortOrder                = 1,
            RuleOfProcedure          = go,
            Description              = "Für Fragen zur Geschäftsordnung oder zum Verfahren (z.B.zu Anträgen, Einreichen von Arbeitspapieren). Außerdem für Bitten(z.B.Fenster öffnen, Licht einschalten, lauter sprechen).",
            Name                     = "Recht auf Information",
            Ruling                   = Base.PetitionRulings.Chairs,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = true,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p1.AllowedCommittees.Add(p));


        var p2 = new PetitionType()
        {
            Category                 = "Persönlicher Antrag",
            SortOrder                = 2,
            RuleOfProcedure          = go,
            Description              = "Um Verfahrensfehler oder Verstöße gegen die Geschäftsordnung zur Sprache zu bringen.",
            Name                     = "Recht auf Wiederherstellung der Ordnung",
            Ruling                   = Base.PetitionRulings.Chairs,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = true,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p2.AllowedCommittees.Add(p));


        var p3 = new PetitionType()
        {
            Category                 = "Persönlicher Antrag",
            SortOrder                = 3,
            RuleOfProcedure          = go,
            Description              = "Nur nach einer Erwiderung des Redners/der Rednerin auf eine eigene missverstandene und unbeantwortet gelassene Frage oder Kurzbemerkung möglich.",
            Name                     = "Recht auf Klärung eines Missverständnisses",
            Ruling                   = Base.PetitionRulings.Chairs,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = true,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p3.AllowedCommittees.Add(p));



        // Anträge an die Geschäftsordnung

        var p4 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 4,
            RuleOfProcedure          = go,
            Description              = "Abstimmung, bei der die Staaten in alphabetischer Reihenfolge aufgerufen werden und ihre Stimme verkünden. Nur bei knappen oder unklaren Ergebnissen möglich.",
            Name                     = "mündliche Abstimmung",
            Ruling                   = Base.PetitionRulings.Chairs,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = true,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p4.AllowedCommittees.Add(p));


        var p5 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 5,
            RuleOfProcedure          = go,
            Description              = "Entscheidungen des Vorsitzes können vorbehaltlich anderer Regelungen revidiert werden. Vor der Abstimmung soll der Vorsitz seine Entscheidung begründen.",
            Name                     = "Revision einer Entscheidung des Vorsitzes",
            Ruling                   = Base.PetitionRulings.TwoThirds,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p5.AllowedCommittees.Add(p));


        var p6 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 6,
            RuleOfProcedure          = go,
            Description              = "Der Vorsitz kann über diesen Antrag entscheiden",
            Name                     = "informelle Sitzung",
            Ruling                   = Base.PetitionRulings.simpleMajority,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = true,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p6.AllowedCommittees.Add(p));


        var p7 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 7,
            RuleOfProcedure          = go,
            Description              = "Der neue Tagesordnungspunkt wird unmittelbar behandelt. Der aktuelle Tagesordnungspunkt wird automatisch zum nächsten Tagesordnungspunkt.",
            Name                     = "Aufnahme eines neuen Tagesordnungspunktes",
            Ruling                   = Base.PetitionRulings.TwoThirdsPlusPermanentMembers,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        p7.AllowedCommittees.Add(sr);

        var p8 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 8,
            RuleOfProcedure          = go,
            Description              = "Der/die Antragsteller*in erklärt, welche Punkte beim verabschiedeten Resolutionsentwurf geändert werden sollen. Es können mehrere Anträge dieser Art angenommen werden.",
            Name                     = "Zurückschicken eines Resolutionsentwurfes",
            Ruling                   = Base.PetitionRulings.simpleMajority,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p8.AllowedCommittees.Add(p));


        var p9 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 9,
            RuleOfProcedure          = go,
            Description              = "Der aktuelle Tagesordnungspunkt wird an das Ende der Tagesordnung verschoben. Der / die Antragsteller *in muss denjenigen Tagesordnungspunkt nennen, mit dem das Gremium als nächstes fortfahren soll.",
            Name                     = "Vertagung eines Tagesordnungspunktes",
            Ruling                   = Base.PetitionRulings.simpleMajority,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p9.AllowedCommittees.Add(p));


        var p10 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 10,
            RuleOfProcedure          = go,
            Description              = "Es verfallen alle Resolutionsentwürfe und Änderungsanträge und die Allgemeine Debatte beginnt von Neuem.",
            Name                     = "Rückkehr zur Allgemeinen Debatte",
            Ruling                   = Base.PetitionRulings.TwoThirds,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p10.AllowedCommittees.Add(p));


        var p11 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 11,
            RuleOfProcedure          = go,
            Description              = "Die aktuelle Debatte wird sofort beendet und mit dem nächsten Verfahrensbestandteil fortgefahren.",
            Name                     = "Ende der aktuellen Debatte",
            Ruling                   = Base.PetitionRulings.TwoThirds,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p11.AllowedCommittees.Add(p));


        var p12 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 12,
            RuleOfProcedure          = go,
            Description              = "Sofortige Abstimmung über den Resolutionsentwurf in´seiner jetzigen Form. Es werden weder die ausstehenden Änderungsanträge behandelt noch erfolgt eine Abstimmung über die einzelnen operativen Absätze.",
            Name                     = "Vorgezogene Abstimmung über den Resolutionsentwurf als Ganzes",
            Ruling                   = Base.PetitionRulings.TwoThirds,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p12.AllowedCommittees.Add(p));


        var p13 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 13,
            RuleOfProcedure          = go,
            Description              = "Bezieht sich entweder auf die Redeliste für Redebeiträge oder auf die Redeliste für Fragen und Kurzbemerkungen. Der Vorsitz kann über diesen Antrag entscheiden.",
            Name                     = "Abschluss oder Wiedereröffnung der Redeliste",
            Ruling                   = Base.PetitionRulings.simpleMajority,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p13.AllowedCommittees.Add(p));


        var p14 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 14,
            RuleOfProcedure          = go,
            Description              = "Der Antrag kann sich sowohl auf die Redezeit für Redebeiträge als auch für Fragen und Kurzbemerkungen beziehen. Der Vorsitz kann über diesen Antrag entscheiden. ",
            Name                     = "Änderung der Redezeit",
            Ruling                   = Base.PetitionRulings.simpleMajority,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p14.AllowedCommittees.Add(p));


        var p15 = new PetitionType()
        {
            Category                 = "Antrag an die Geschäftsordnung",
            SortOrder                = 15,
            RuleOfProcedure          = go,
            Description              = "Nur zum aktuellen Tagesordnungspunkt möglich",
            Name                     = "Anhörung eines Gastredners/ einer Gastrednerin",
            Ruling                   = Base.PetitionRulings.simpleMajority,
            AllowCountyDelegates     = true,
            AllowNonCountryDelegates = false,
            AllowedCommittees        = new List <Committee>()
        };

        committees.ForEach(p => p15.AllowedCommittees.Add(p));



        _context.PetitionTypes.Add(p1);
        _context.PetitionTypes.Add(p2);
        _context.PetitionTypes.Add(p3);

        _context.PetitionTypes.Add(p4);
        _context.PetitionTypes.Add(p5);
        _context.PetitionTypes.Add(p6);
        _context.PetitionTypes.Add(p7);
        _context.PetitionTypes.Add(p8);
        _context.PetitionTypes.Add(p9);
        _context.PetitionTypes.Add(p10);
        _context.PetitionTypes.Add(p11);
        _context.PetitionTypes.Add(p12);
        _context.PetitionTypes.Add(p13);
        _context.PetitionTypes.Add(p14);
        _context.PetitionTypes.Add(p15);

        _context.SaveChanges();

        Assert.AreEqual(15, _context.PetitionTypes.Count(), "Expected a petition type to be saved");
        Assert.AreEqual(14, _context.Committees.Where(n => n.CommitteeId == "munsh22-gv").Select(n => n.AllowedPetitionTypes.Count).FirstOrDefault(), "Expected the 'Generalversammlung' to know about this petition type.");
    }
示例#7
0
 public static string guardar_estadisticas(string usuario)
 {
     type     = PetitionType.STATISTICS;
     peticion = "username="******"guardar_estadisticas.php"));
 }
示例#8
0
 public static string borrar_usuario(string usuario)
 {
     type     = PetitionType.DELETE_USER;
     peticion = "username="******"borrar_usuario.php"));
 }
示例#9
0
 public static string cargar_partida(string usuario)
 {
     type     = PetitionType.LOAD;
     peticion = "username="******"cargar_partida.php"));
 }
示例#10
0
 public static string nuevo_juego(string usuario)
 {
     type     = PetitionType.NEW_GAME;
     peticion = "username="******"nuevo_juego.php"));
 }
示例#11
0
 public static string register_user(string usuario, string email, string pass, string pass2)
 {
     type     = PetitionType.REGISTER;
     peticion = "username="******"&email=" + email + "&pass="******"&pass2=" + pass2;
     return(Upload(peticion, "register_user.php"));
 }
示例#12
0
 public static string login_user(string usuario, string pass)
 {
     type     = PetitionType.LOGIN;
     peticion = "username="******"&pass="******"login_user.php"));
 }