Example #1
0
        protected override void ResolveEffect()
        {
            var emblem = new Emblem(_text, _score);

            var p = new ModifierParameters
            {
                SourceEffect = this,
                SourceCard   = Source.OwningCard,
                X            = X,
                IsStatic     = true
            };

            foreach (var modifier in _modifiers.Select(modifierFactory => modifierFactory()))
            {
                var lifetime = new EmblemLifetime(emblem);
                lifetime.Initialize(Game);

                modifier.AddLifetime(lifetime);

                if (modifier is IGameModifier gameModifier)
                {
                    Game.AddModifier(gameModifier, p);
                }
                else if (modifier is IPlayerModifier playerModifier)
                {
                    _controller.Value.AddModifier(playerModifier, p);
                }
            }

            _controller.Value.AddEmblem(emblem);
        }
Example #2
0
        public async Task <IActionResult> PutEmblem(int id, Emblem emblem)
        {
            if (id != emblem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(emblem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmblemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #3
0
        public async Task <ActionResult <Emblem> > PostEmblem(Emblem emblem)
        {
            _context.Emblems.Add(emblem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEmblem", new { id = emblem.Id }, emblem));
        }
Example #4
0
        public Guild(string name, string realm, string region, string locale)
        {
            var guildData = ApiHelper.GetJsonFromUrl(
                $"https://{region}.api.battle.net/wow/character/{realm}/{name}?fields=guild&locale={locale}&apikey={ApiHandler.ApiKey}"
                );

            if (guildData == null)
            {
                return;
            }

            if (guildData.guild != null)
            {
                Name              = guildData.guild["name"];
                Realm             = guildData.guild["realm"];
                BattleGroup       = guildData.guild["battlegroup"];
                Members           = guildData.guild["members"];
                AchievementPoints = guildData.guild["achievementPoints"];

                Emblem = new Emblem
                {
                    Icon              = guildData.guild.emblem["icon"],
                    IconColorId       = guildData.guild.emblem["iconColorId"],
                    Border            = guildData.guild.emblem["border"],
                    BorderColorId     = guildData.guild.emblem["borderColorId"],
                    BackgroundColorId = guildData.guild.emblem["backgroundColorId"],

                    IconColor       = guildData.guild.emblem["iconColor"],
                    BorderColor     = guildData.guild.emblem["borderColor"],
                    BackgroundColor = guildData.guild.emblem["backgroundColor"]
                };
            }
        }
Example #5
0
        public SocialGroupCreationResultEnum SetGuildEmblem(Character character, NetworkGuildEmblem emblem)
        {
            var potion = character.Inventory.TryGetItem(ItemManager.Instance.TryGetTemplate(ItemIdEnum.POTION_DE_CHANGEMENT_DE_BLASON_DE_GUILDE_13270));

            if (potion == null)
            {
                return(SocialGroupCreationResultEnum.SOCIAL_GROUP_CREATE_ERROR_REQUIREMENT_UNMET);
            }

            if (GuildManager.Instance.DoesEmblemExist(emblem))
            {
                return(SocialGroupCreationResultEnum.SOCIAL_GROUP_CREATE_ERROR_EMBLEM_ALREADY_EXISTS);
            }

            character.Inventory.RemoveItem(potion, 1);

            Emblem.ChangeEmblem(emblem);

            foreach (var taxCollector in TaxCollectors)
            {
                taxCollector.RefreshLook();
                taxCollector.Map.Refresh(taxCollector);
            }

            foreach (var member in Members.Where(x => x.IsConnected))
            {
                member.Character.SendInformationMessage(TextInformationTypeEnum.TEXT_INFORMATION_MESSAGE, 382);
                GuildHandler.SendGuildMembershipMessage(member.Character.Client, member.Character.GuildMember);

                member.Character.RefreshActor();
            }

            return(SocialGroupCreationResultEnum.SOCIAL_GROUP_CREATE_OK);
        }
Example #6
0
        public void ShouldCheckifEmblemisaSubsetofDecryptedMessage()
        {
            string decryptedMessage = "LADSWNWOO";
            Emblem emblem           = new Emblem("OWL");
            Dictionary <char, int> distinctCharCountDict = new Dictionary <char, int>()
            {
                { 'O', 1 }, { 'W', 1 }, { 'L', 1 }
            };

            Assert.True(emblem.IsSubsetofMessage(decryptedMessage, distinctCharCountDict));
        }
Example #7
0
        public void ShouldCreateDistinctCharCountDictofGivenEmblem()
        {
            Emblem emblem = new Emblem("MAMMOTH");
            Dictionary <char, int> expectedDistinctCharCountDict = new Dictionary <char, int>()
            {
                { 'M', 3 }, { 'A', 1 }, { 'O', 1 },
                { 'T', 1 }, { 'H', 1 }
            };
            Dictionary <char, int> actualDistinctCharCountDict = emblem.GetDistinctCharCount();

            Assert.Equal(expectedDistinctCharCountDict, actualDistinctCharCountDict);
        }
Example #8
0
 /// <summary>
 /// Serves as a hash function for a <see cref="T:Narivia.Models.Flag"/> object.
 /// </summary>
 /// <returns>A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a
 /// hash table.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Id != null ? Id.GetHashCode() : 0) * 397) ^
                (Layer1 != null ? Layer1.GetHashCode() : 0) ^
                (Emblem != null ? Emblem.GetHashCode() : 0) ^
                (Skin != null ? Skin.GetHashCode() : 0) ^
                Layer1Colour.GetHashCode() ^
                Layer2Colour.GetHashCode() ^
                EmblemColour.GetHashCode());
     }
 }
 public bool receiveMessageAndAddAllies(string message, Kingdom fromKingdom, Kingdom toKingdom, HighPriest p)
 {
     if (p.Compitetors.Contains(toKingdom.Name))
     {
         return(false);
     }
     if (Kingdom.ProcessreceivedMessage(message, Emblem.ToLower().ToCharArray()))
     {
         AddAllies(fromKingdom, toKingdom);
         return(true);
     }
     return(false);
 }
Example #10
0
        public static void Draw()
        {
            GraphicsDevice.Clear(BackgroundColor);

            if (SpriteBatch.Running)
            {
                SpriteBatch.EndBatch();
            }
            else
            {
                SpriteBatch.BeginBatch();

                GraphicsDevice.DepthStencilState = DepthStencilState.Default;

                GraphicsDevice.SamplerStates[0] = Sampler;
                CurrentScreen.Draw();

                if (Player != null)
                {
                    if (Player.IsGameJoltSave)
                    {
                        Emblem.DrawNewEmblems();
                    }
                    Player.DrawLevelUp();
                }

                //if (BaseJoinServerScreen.Online || Player.SandBoxMode || GameController.IS_DEBUG_ACTIVE)
                //{
                //    if (CurrentScreen.Identification != Screen.Identifications.ChatScreen)
                //        BaseChatScreen.DrawNewMessages();
                //}

                GameMessage.Draw();
                OnlineStatus.Draw();

                Logger.DrawLog();

                SpriteBatch.EndBatch();

                Render();
            }
        }
Example #11
0
        public GuildInfo(string realm, string guildName, string region, string locale)
        {
            var guildData = ApiHelper.GetJsonFromUrl(
                $"https://{region}.api.battle.net/wow/guild/{realm}/{guildName}?locale={locale}&apikey={ApiHandler.ApiKey}"
                );

            if (guildData == null)
            {
                return;
            }

            LastModified      = guildData["lastModified"];
            Name              = guildData["name"];
            Realm             = guildData["realm"];
            Battlegroup       = guildData["battlegroup"];
            Level             = guildData["level"];
            Side              = guildData["side"];
            AchievementPoints = guildData["achievementPoints"];
            Emblem            = guildData["emblem"].ToObject <Emblem>();
        }
Example #12
0
 void SaveData(bool isAuto)
 {
     isSaving = true;
     Emblem tmp = new Emblem();
     tmp.Set(Layers);
     if(!isAuto)
         PlayerPrefs.SetString("SavedData", tmp.GetBinary());
     else
         PlayerPrefs.SetString("AutoSavedData", tmp.GetBinary());
     nextAutoSave = Time.time + AutoSaveInterval;
     isSaving = false;
 }
Example #13
0
 //private Vector2 LoadWinScrollPos;
 // Use this for initialization
 void Start()
 {
     Move = new LayerMove();
     //DupLayer = new LayerDup();
     AutoSave = new Emblem();
     Save = new Emblem();
     AddNewLayer();
 }
Example #14
0
 public bool DisplayEmblemEditor(Vector2 pos, GUISkin GUIskin, out Emblem EmblemData, int LayerMax)
 {
     return EmblemEditor(pos, GUIskin, out EmblemData, LayerMax);
 }
Example #15
0
 public bool DisplayEmblemEditor(Vector2 pos, GUISkin GUIskin, out Emblem EmblemData, int LayerMax, Emblem emblem)
 {
     Layers = emblem.GetLayers();
     return EmblemEditor(pos, GUIskin, out EmblemData, LayerMax);
 }
Example #16
0
 void Update()
 {
     if(captureIMG)
     {
         FinalEmblem = new Emblem();
         FinalEmblem.Set(Layers);
     }
 }
Example #17
0
 public EmblemAddedEvent(Emblem emblem)
 {
     Emblem = emblem;
 }
Example #18
0
 void ExportWindow(int windowID)
 {
     if(GUI.Button(new Rect(ExportWinRect.width - 25, 5, 20, 20), "X"))
     {
         ExportWinClosing = true;
         flatComp = null;
     }
     if(flatComp == null)
     {
         GUI.Label(new Rect(10, 25, 500, 20), "Flattening layers, please wait...");
     }
     if(ExportWinRect.y >= Screen.height/2 -(250)-1)
     {
         if(flatComp == null)
         {
             Emblem tmpE = new Emblem();
             tmpE.Set(Layers);
             flatComp = tmpE.GetFlatTex();
         }else
         {
             GUI.Label(new Rect(10, 25, 100, 20), "Your current Image");
             GUI.BeginGroup(new Rect(10, 45, EmblemSize.width, EmblemSize.height));
             foreach(Layer l in Layers)
             {
                 GUI.DrawTexture(new Rect( l.posX, l.posY, EmblemSize.width, EmblemSize.height), l.texture, ScaleMode.StretchToFill);
             }
             GUI.EndGroup();
             GUI.Label(new Rect(ExportWinRect.width - 100 - 10, 25, 100, 20), "Your Flattened Image");
             GUI.DrawTexture(new Rect(ExportWinRect.width - EmblemSize.width - 10, 45, EmblemSize.width, EmblemSize.height), flatComp, ScaleMode.StretchToFill);
         }
     }
 }
Example #19
0
 public GuildInformations GetGuildInformations() => new GuildInformations(Id, Name, Level, Emblem.GetNetworkGuildEmblem());
Example #20
0
 public GuildFactSheetInformations GetGuildFactSheetInformations() => new GuildFactSheetInformations(Id, Name, Level, Emblem.GetNetworkGuildEmblem(), Boss.Id, (short)Members.Count);
Example #21
0
 public EmblemRemovedEvent(Emblem emblem)
 {
     Emblem = emblem;
 }
Example #22
0
 public EmblemLifetime(Emblem emblem)
 {
     _emblem = emblem;
 }
Example #23
0
 bool EmblemEditor(Vector2 pos, GUISkin GUIskin, out Emblem EmblemData, int LayerMax)
 {
     GUI.skin = GUIskin;
     if(!rectSet)
     {
         windowRect = new Rect(pos.x, pos.y, 700, 600);
         TargetPos = windowRect.x;
         windowRect.x = -700;
         MaxLayers = LayerMax;
         nextAutoSave = Time.time + AutoSaveInterval;
         rectSet = true;
     }
     if(rectSet)
         windowRect.x = Mathf.Lerp(windowRect.x, TargetPos, Time.deltaTime*2);
     CaptureRect = new Rect(windowRect.x + 20, windowRect.y + 55, EmblemSize.width, EmblemSize.height);
     if(showLoadWin)
     {
         GUI.enabled = false;
     }else
     {
         GUI.enabled = true;
     }
     GUI.Window(0, windowRect, EmblemEditorWindow, "Emblem Editor");
     if(!showLoadWin)
         GUI.FocusWindow(0);
     else
         GUI.UnfocusWindow();
     if(Time.time >= nextAutoSave)
     {
         SaveData(true);
         nextAutoSave = Time.time + AutoSaveInterval;
     }
     if(captureIMG && FinalEmblem != null)
     {
         EmblemData = FinalEmblem;
         return true;
     }else
     {
         EmblemData = null;
         return false;
     }
 }