Esempio n. 1
0
        private static void ProcessGuildPutPerceptorRequest(WorldClient Client, string Packet)
        {
            if (!Client.GetCharacter().HasGuild() || !Client.GetCharacter().getCharacterGuild().Can(GuildRightEnum.RIGHT_PUT_PERCEPTOR) || Client.GetCharacter().GetGuild().CharactersGuildCache.Count < 10)
            {
                Client.Send(new BasicNoOperationMessage());
            }
            else
            {
                short price = (short)(1000 + 10 * Client.GetCharacter().GetGuild().Level);

                if (Client.GetCharacter().Kamas < price)
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 82));
                }
                if (TaxCollectorTable.Cache.Where(x => x.Value.Mapid == Client.Character.myMap.Id).Count() > 0)
                {
                    Client.Send(new ImMessage("1168;1"));
                    return;
                }
                if (Client.Character.myMap.FightCell.Length < 5)
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 13));
                }
                if (TaxCollectorTable.Cache.Values.Where(x => x.GuildID == Client.Character.GetGuild().ID).Count() >= Client.Character.GetGuild().PerceptorMaxCount)
                {
                    return;
                }

                short random1 = (short)Random.Next(1, 39);
                short random2 = (short)Random.Next(1, 71);

                TaxCollector perco = new TaxCollector()
                {
                    ActorId     = TaxCollectorTable.getNextGuid(),
                    Mapid       = Client.Character.myMap.Id,
                    CellId      = Client.Character.CellId,
                    Orientation = 3,
                    GuildID     = Client.Character.GetGuild().ID,
                    N1          = random1,
                    N2          = random2,
                    ItemList    = "",
                    Kamas       = 0L,
                    XP          = 0L,
                };
                TaxCollectorTable.Add(perco);
                Client.Character.myMap.SpawnActor(perco);
                Client.Send(new GameActorShowMessage(GameActorShowEnum.SHOW_SPAWN, perco));
                Client.Send(new GuildFightInformationsMesssage(Client.Character.GetGuild()));
                Client.Character.GetGuild().Send(new GuildTaxCollectorMessage("S" + perco.N1 + "," + perco.N2 + "|" + perco.Mapid + "|" + perco.Map.X + "|" + perco.Map.Y + "|" + Client.Character.Name));
            }
        }