예제 #1
0
        public static void IdentityComplete(Client player, identityType type, string parameter)
        {
            switch (type)
            {
            case identityType.Birthdate:
                API.shared.consoleOutput("Count('/'): " + parameter.Count(x => x == '/'));
                if (parameter.Count(x => x == '/') == 2)
                {
                    var splitted = parameter.Split('/');
                    if (splitted[0].Length == 2 && splitted[1].Length == 2 && splitted[2].Length == 4)
                    {
                        DateTime d = new DateTime();
                        try
                        {
                            d = DateTime.ParseExact(parameter, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None);
                        }
                        catch (Exception ex)
                        {
                            if (ex.GetType() == typeof(FormatException))
                            {
                                API.shared.sendChatMessageToPlayer(player, "~r~HATA: ~s~Doğum tarihi hatalı girildi.");
                            }
                            API.shared.consoleOutput(LogCat.Warn, ex.ToString());
                            return;
                        }
                        API.shared.setEntityData(player, "BirthDate", d);
                        API.shared.resetEntityData(player, IDENTITY_B);
                        API.shared.setEntityData(player, IDENTITY_O, true);
                        API.shared.sendChatMessageToPlayer(player, "Yetkili: ~y~Doğum yerinizi söyleyebilir misiniz?");
                        return;
                    }
                    else
                    {
                        API.shared.sendChatMessageToPlayer(player, "~r~HATA: ~s~Lütfen geçerli bir doğum tarihi girin. (gg/aa/yyyy ) ");
                        return;
                    }
                }
                else
                {
                    API.shared.sendChatMessageToPlayer(player, "~r~HATA: ~s~Lütfen geçerli bir doğum tarihi girin. (gg/aa/yyyy ) ");
                }
                break;

            case identityType.Origin:

                int money         = API.shared.getEntityData(player, "Money");
                var licenseTaking = db_LicensePoints.CurrentLicenseTakings.Item1.FirstOrDefault(x => x.LicenseType == 1);

                if (money >= licenseTaking.Price)
                {
                    API.shared.setEntityData(player, "Origin", parameter);
                    API.shared.resetEntityData(player, IDENTITY_O);
                    var _inventory = (Inventory)API.shared.getEntityData(player, "inventory");
                    money -= licenseTaking.Price;
                    API.shared.setEntityData(player, "Money", money);
                    API.shared.triggerClientEvent(player, "update_money_display", money);
                    API.shared.sendNotificationToPlayer(player, "~r~-" + licenseTaking.Price + "$");
                    _inventory.ItemList.Add(new ClientItem
                    {
                        ItemId         = db_Items.GameItems.Values.FirstOrDefault(x => x.Type == ItemType.License && x.Value_0 == "1").ID,
                        Count          = 1,
                        SpecifiedValue = player.socialClubName
                    });
                    int mission = API.shared.getEntityData(player, "Mission");
                    if (mission <= 1)
                    {
                        API.shared.setEntityData(player, "Mission", 1);
                    }
                    RPGManager rpgMgr = new RPGManager();
                    rpgMgr.Me(player, " elini parmak izi okuyucuya uzatır ve parmak izinin taranmasını sağlar.");
                    string _generatedFingerPrint = Guid.NewGuid().ToString().Substring(0, 8);
                    API.shared.consoleOutput("FingerPrint" + _generatedFingerPrint);
                    API.shared.setEntityData(player, "FingerPrint", _generatedFingerPrint);
                    API.shared.sendChatMessageToPlayer(player, "Yetkili: ~y~Buyrun, kimliğiniz.  ~w~(( Kimliğiniz envanterinize eklendi.))");
                    Clients.ClientManager.RemoveMissionMarker(player);
                    API.shared.setEntityData(player, "Mission", 1);
                    UserManager.TriggerUserMission(player);
                    db_Accounts.SavePlayerAccount(player);
                }
                else
                {
                    API.shared.sendChatMessageToPlayer(player, "~r~UYARI: ~s~Bunun için yeterli paranız yok. Ödenmesi gereken: " + licenseTaking.Price);
                }

                break;

            default:
                break;
            }
        }
예제 #2
0
        private ruleset CreateOMAPresRulesDocument()
        {
            ruleset document = new ruleset();

            //<cr:conditions>
            //  <cr:identity>
            //    <cr:one id="sip:[email protected]" />
            //  </cr:identity>
            //</cr:conditions>
            identityType identityCond = new identityType();

            identityCond.Items = new oneType[1];
            oneType otype = new oneType();

            otype.id = this.xcapStack.XUI;
            identityCond.Items[0] = otype;

            //<cr:conditions>
            //  <anonymous-request xmlns="urn:oma:xml:xdm:common-policy" />
            //</cr:conditions>
            anonymousRequest anonymousCond = new anonymousRequest();

            // <cr:conditions>
            //  <other-identity xmlns="urn:oma:xml:xdm:common-policy" />
            //</cr:conditions>
            otherIdentity otherIdentityCond = new otherIdentity();

            // <cr:conditions>
            //  <external-list xmlns="urn:oma:xml:xdm:common-policy">
            //    <entry anc="http://doubango.org:8080/services/resource-lists/users/sip:[email protected]/index/~~/resource-lists/list%5B@name=%22oma_grantedcontacts%22%5D" />
            //  </external-list>
            //</cr:conditions>
            externallist omaGrantedCond = this.CreatePresRulesExternalList(SpecialNames.SHARED_OMA_GRANTEDCONTACTS);

            //<cr:conditions>
            //  <external-list xmlns="urn:oma:xml:xdm:common-policy">
            //    <entry anc="http://doubango.org:8080/services/resource-lists/users/sip:[email protected]/index/~~/resource-lists/list%5B@name=%22oma_blockedcontacts%22%5D" />
            //  </external-list>
            //</cr:conditions>
            externallist omaBlockedCond = this.CreatePresRulesExternalList(SpecialNames.SHARED_OMA_BLOCKEDCONTACTS);

            document.rule = new ruleType[]
            {
                CreatePresRule(SpecialNames.PRESRULES_OMA_ALLOW_OWN, "allow", true, identityCond),
                CreatePresRule(SpecialNames.PRESRULES_RCS_ALLOW_SERVICE_ANONYMOUS, "allow", true, anonymousCond),
                CreatePresRule(SpecialNames.PRESRULES_OMA_UNLISTED, "confirm", false, otherIdentityCond),
                CreatePresRule(SpecialNames.PRESRULES_OMA_GRANTED_CONTACTS, "allow", true, omaGrantedCond),
                CreatePresRule(SpecialNames.PRESRULES_OMA_BLOCKED_CONTACTS, "block", false, omaBlockedCond)
            };


            String documentUrl;

            //if(this.xcapDocumentsUris.ContainsKey())
            lock (this.xcapSelector)
            {
                this.xcapSelector.reset();
                this.xcapSelector.setAUID(XcapService.XCAP_AUID_OMA_PRES_RULES_ID);
                documentUrl = this.xcapSelector.getString();
            }
            byte[] payload = this.Serialize(document, true, true, this.GetSerializerNSFromAUID(XcapService.XCAP_AUID_OMA_PRES_RULES_ID));

            MyXcapMessage xcapMessage = this.xcapStack.PutDocument(documentUrl, payload, (uint)payload.Length, XcapService.XCAP_AUID_OMA_PRES_RULES_MIME_TYPE);

            if (xcapMessage != null && XcapService.IsSuccessCode(xcapMessage.Code))
            {
                return(document);
            }
            return(null);
        }