Example #1
0
        public override void Execute(TriggerBase trigger)
        {
            foreach (var target in GetTargets(trigger))
            {
                if (trigger.IsArgumentDefined("demorph"))
                {
                    target.CustomLookActivated = false;
                    target.CustomLook          = null;
                    trigger.Reply("Demorphed");

                    target.Map.Area.ExecuteInContext(() =>
                                                     target.Map.Refresh(target));
                    return;
                }

                if (!trigger.IsArgumentDefined("look"))
                {
                    trigger.ReplyError("Look not defined");
                    return;
                }

                target.CustomLook          = ActorLook.Parse(trigger.Get <string>("look"));
                target.CustomLookActivated = true;

                target.RefreshActor();
            }
        }
        public override void Execute(TriggerBase trigger)
        {
            Character[] targets = base.GetTargets(trigger);

            int i = 0;

            while (i < targets.Length)
            {
                Character target = targets[i];
                if (!trigger.IsArgumentDefined("demorph"))
                {
                    if (trigger.IsArgumentDefined("look"))
                    {
                        target.CustomLook          = ActorLook.Parse(trigger.Get <string>("look"));
                        target.CustomLookActivated = true;
                        target.RefreshActor();
                        i++;
                        continue;
                    }
                    trigger.ReplyError("Look not defined");
                }
                else
                {
                    target.CustomLookActivated = false;
                    target.CustomLook          = null;
                    trigger.Reply("Demorphed");
                    target.Map.Area.ExecuteInContext(delegate
                    {
                        target.Map.Refresh(target);
                    });
                }
                return;
            }
        }
Example #3
0
        public override ActorLook UpdateItemSkin(ActorLook characterLook)
        {
            if (IsEquiped())
            {
                if (Owner.Guild != null)
                {
                    characterLook.AddSkin(1730);                                      //New ApparenceId

                    characterLook.AddSkin((short)Owner.Guild.Emblem.Template.SkinId); //Emblem Skin

                    characterLook.AddColor(7, Owner.Guild.Emblem.SymbolColor);
                    characterLook.AddColor(8, Owner.Guild.Emblem.BackgroundColor);
                }
            }
            else
            {
                characterLook.RemoveSkin(1730);  //New ApparenceId

                if (Owner.Guild != null)
                {
                    characterLook.RemoveSkin((short)Owner.Guild.Emblem.Template.SkinId); //Emblem Skin

                    characterLook.RemoveColor(7);
                    characterLook.RemoveColor(8);
                }
            }
            return(base.UpdateItemSkin(characterLook));
        }
Example #4
0
 public Npc(int id, NpcTemplate template, ObjectPosition position, ActorLook look)
 {
     this.Id       = id;
     this.Template = template;
     this.Position = position;
     this.Look     = look;
     this.m_gameContextActorInformations = new ObjectValidator <GameContextActorInformations>(new Func <GameContextActorInformations>(this.BuildGameContextActorInformations));
     this.m_actions.AddRange(this.Template.Actions);
 }
Example #5
0
        public Npc(int id, NpcTemplate template, ObjectPosition position, ActorLook look)
        {
            Id       = id;
            Template = template;
            Position = position;
            Look     = look;

            m_gameContextActorInformations = new ObjectValidator <GameContextActorInformations>(BuildGameContextActorInformations);
            m_actions.AddRange(Template.Actions);
        }
Example #6
0
 public override bool Apply()
 {
     foreach (FightActor current in base.GetAffectedActors())
     {
         ActorLook actorLook = current.Look.Clone();
         actorLook.BonesID = base.Dice.Value;
         SkinBuff buff = new SkinBuff(current.PopNextBuffId(), current, base.Caster, base.Dice, actorLook, base.Spell, true);
         current.AddAndApplyBuff(buff, true);
     }
     return(true);
 }
Example #7
0
        public virtual ActorLook UpdateItemSkin(ActorLook characterLook)
        {
            if (AppearanceId > 0)
            {
                var look = characterLook.GetRiderLook() ?? characterLook;

                if (IsEquiped())
                    look.AddSkin((short)AppearanceId);
                else
                    look.RemoveSkin((short)AppearanceId);
            }

            return characterLook;
        }
Example #8
0
        public ActorLook RefreshLook()
        {
            this.m_look = new ActorLook
            {
                BonesID = 714
            };
            if (this.Guild.Emblem.Template != null)
            {
                this.m_look.AddSkin((short)this.Guild.Emblem.Template.SkinId);
            }
            this.m_look.AddColor(7, this.Guild.Emblem.BackgroundColor);
            this.m_look.AddColor(8, this.Guild.Emblem.SymbolColor);

            return(this.m_look);
        }
Example #9
0
        public ActorLook RefreshLook()
        {
            m_look = new ActorLook
            {
                BonesID = TAXCOLLECTOR_BONES
            };
            if (Guild.Emblem.Template != null)
            {
                m_look.AddSkin((short)Guild.Emblem.Template.SkinId);
            }
            m_look.AddColor(8, Guild.Emblem.SymbolColor);
            m_look.AddColor(7, Guild.Emblem.BackgroundColor);

            return(m_look);
        }
Example #10
0
        public override ActorLook UpdateItemSkin(ActorLook characterLook)
        {
            characterLook.ResetScales();

            foreach (var subLook in characterLook.SubLooks)
            {
                subLook.Look.ResetScales();
            }

            if (IsEquiped())
            {
                characterLook.Rescale(0.8);

                foreach (var subLook in characterLook.SubLooks)
                {
                    subLook.Look.Rescale(0.8);
                }
            }

            return(characterLook);
        }
Example #11
0
        // METHODS
        public ActorLook RefreshLook()
        {
            this.m_look = new ActorLook
            {
                BonesID = 2211
            };
            //if (this.Alliance.Emblem.Template != null)
            //{
            //    this.m_look.AddSkin((short)this.Alliance.Emblem.Template.IconId);
            //    this.m_look.AddSkin((short)this.Alliance.Emblem.Template.SkinId);
            //}
            //this.m_look.AddColor(1, this.Alliance.Emblem.BackgroundColor);
            //this.m_look.AddColor(2, this.Alliance.Emblem.SymbolColor);
            //this.m_look.AddColor(3, this.Alliance.Emblem.BackgroundColor);
            //this.m_look.AddColor(4, this.Alliance.Emblem.SymbolColor);
            //this.m_look.AddColor(5, this.Alliance.Emblem.BackgroundColor);
            //this.m_look.AddColor(6, this.Alliance.Emblem.SymbolColor);
            //this.m_look.AddColor(7, this.Alliance.Emblem.BackgroundColor);
            //this.m_look.AddColor(8, this.Alliance.Emblem.SymbolColor);

            return(this.m_look);
        }
Example #12
0
        public Merchant(Character character)
        {
            ActorLook actorLook = character.Look.Clone();

            actorLook.RemoveAuras();
            actorLook.AddSubLook(new SubActorLook(0, SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_MERCHANT_BAG, new ActorLook
            {
                BonesID = 237
            }));
            this.m_record = new WorldMapMerchantRecord
            {
                CharacterId   = character.Id,
                AccountId     = character.Account.Id,
                Name          = character.Name,
                Map           = character.Map,
                Cell          = (int)character.Cell.Id,
                Direction     = (int)character.Direction,
                EntityLook    = actorLook,
                IsActive      = true,
                MerchantSince = System.DateTime.Now
            };
            this.Bag      = new MerchantBag(this, character.MerchantBag);
            this.Position = character.Position.Clone();
        }
Example #13
0
        public ActorLook UpdateEmoteLook(Character character, ActorLook look, bool apply)
        {
            if (!apply)
            {
                if (EmoteId == EmotesEnum.EMOTE_AURA_DE_PUISSANCE ||
                    EmoteId == EmotesEnum.EMOTE_AURA_VAMPYRIQUE||
                    EmoteId == EmotesEnum.EMOTE_AURA_BLEUTÉE_DE_L_ORNITHORYNQUE_ANCESTRAL||
                    EmoteId == EmotesEnum.EMOTE_AURA_DE_NELWEEN)
                    look.RemoveSubLook(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_BASE_FOREGROUND);

                if (EmoteId == EmotesEnum.EMOTE_GUILD)
                {
                    
                    if (character.Guild == null)
                     return look;

                    var playerLook = look.GetRiderLook() ?? look;

                    playerLook.RemoveSkin((short) character.Guild.Emblem.Template.SkinId);

                    playerLook.RemoveColor(7);
                    playerLook.RemoveColor(8);
                    playerLook.RemoveColor(9);
                }

                return look;
            }

            ActorLook auraLook = null;

            switch (EmoteId)
            {
                case EmotesEnum.EMOTE_AURA_DE_PUISSANCE:
                    auraLook = new ActorLook(character.Level == 200 ? (short) 170 : (short) 169);
                    break;

                case EmotesEnum.EMOTE_AURA_VAMPYRIQUE:
                    auraLook = new ActorLook(171);
                    break;

                case EmotesEnum.EMOTE_AURA_BLEUTÉE_DE_L_ORNITHORYNQUE_ANCESTRAL:
                    auraLook = new ActorLook(1465);
                    break;

                case EmotesEnum.EMOTE_AURA_DE_NELWEEN:
                    auraLook = new ActorLook(1501);
                    break;

                case EmotesEnum.EMOTE_GUILD:
                    {
                        if (character.Guild == null)
                            break;

                        var playerLook = look.GetRiderLook() ?? look;

                        playerLook.AddSkin((short) character.Guild.Emblem.Template.SkinId);

                        playerLook.AddColor(7, character.Guild.Emblem.BackgroundColor);
                        playerLook.AddColor(8, character.Guild.Emblem.SymbolColor);
                        playerLook.AddColor(9, character.Guild.Emblem.SymbolColor);
                    }
                    break;
            }

            if (auraLook != null)
                look.SetSubLook(new SubActorLook(0, SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_BASE_FOREGROUND, auraLook));

            return look;
        }
Example #14
0
 public override ActorLook UpdateItemSkin(ActorLook characterLook) => characterLook;
Example #15
0
 public SkinBuff(int id, FightActor target, FightActor caster, EffectBase effect, ActorLook look, Spell spell, bool dispelable, short customActionId) : base(id, target, caster, effect, spell, false, dispelable, customActionId)
 {
     this.Look = look;
 }
Example #16
0
 public override void Apply()
 {
     this.OriginalLook = base.Target.Look.Clone();
     base.Target.Look  = this.Look.Clone();
     ActionsHandler.SendGameActionFightChangeLookMessage(base.Target.Fight.Clients, base.Caster, base.Target, base.Target.Look);
 }
        private void PreLoading()
        {
            if (m_map == null)
            {
                return;
            }

            m_layers = new List <LayerContent>();
            foreach (var layer in m_map.Layers.OrderBy(x => x.LayerId))
            {
                LayerContent instanceLayer = null;


                if (!m_layers.Any(x => x.Type == (LayerEnum)layer.LayerId))
                {
                    m_layers.Add(new LayerContent()
                    {
                        Type = (LayerEnum)layer.LayerId
                    });
                }



                instanceLayer = m_layers.First(x => x.Type == (LayerEnum)layer.LayerId);

                // recupere Identifier qui est egale au ElementId que le serveur doit envoyer
                List <int> Identifierlist = (from i in layer.Cells
                                             from y in i.Elements
                                             where y is GraphicalElement && (y as GraphicalElement).Identifier != 0
                                             select(y as GraphicalElement).Identifier).ToList();

                List <int> ElementIdlist = (from i in layer.Cells
                                            from y in i.Elements
                                            where y is GraphicalElement && Identifierlist.Contains((y as GraphicalElement).Identifier)
                                            select(y as GraphicalElement).ElementId).ToList();

                foreach (var cell in layer.Cells.OrderBy(x => x.CellId))
                {
                    foreach (GraphicalElement element in cell.Elements.Where(x => x is GraphicalElement))
                    {
                        var graphicElement = TextureManager.Instance.GetElementData(element.ElementId);

                        if (graphicElement is NormalGraphicalElementData)
                        {
                            NormalGraphicalElementData g = graphicElement as NormalGraphicalElementData;


                            if (g != null && TextureManager.Instance.GetImageGfx(g.Gfx) != null)
                            {
                                var instance = new Test()
                                {
                                    CellID = cell.CellId, GraphicalElement = element, Sprite = new Sprite(TextureManager.Instance.GetImageGfx(g.Gfx)), GraphicElement = graphicElement, Manager = this
                                };
                                var test = instance.GetPosToDrawTexture();

                                var currentCell = GetCell(new System.Drawing.Point((int)test.X, (int)test.Y), false, instance.Sprite.TextureRect.Width, instance.Sprite.TextureRect.Height);
                                var d           = instance.Sprite.TextureRect;
                                var testg       = instance.GraphicalElement.PixelOffsetX;

                                instanceLayer.AddElement(cell.CellId, instance);
                            }
                        }
                        else if (graphicElement is EntityGraphicalElementData)
                        {
                            var d = ActorLook.Parse((graphicElement as EntityGraphicalElementData).EntityLook);
                            if (d.BonesID == 650)
                            {
                                var j = TextureManager.Instance.GetImageGfx(650);

                                var instance = new Test()
                                {
                                    CellID = cell.CellId, GraphicalElement = element, Sprite = new Sprite(new Texture(@"E:\Map Editor Britana\DesignEditeurMap\DesignEditeurMap\bin\Debug\data\img\655450.png")), GraphicElement = graphicElement, Manager = this
                                };

                                instanceLayer.AddElement(cell.CellId, instance);
                            }
                        }
                    }
                }
            }
        }
Example #18
0
 public static void SendGameActionFightChangeLookMessage(IPacketReceiver client, FightActor source, FightActor target, ActorLook look)
 {
     client.Send(new GameActionFightChangeLookMessage((short)ActionsEnum.ACTION_CHARACTER_CHANGE_LOOK, source.Id, target.Id, look.GetEntityLook()));
 }
Example #19
0
        public override ActorLook UpdateItemSkin(ActorLook characterLook)
        {
            var petLook = PetTemplate?.Look?.Clone();

            if (petLook == null)
            {
                if (Template.Type.ItemType != ItemTypeEnum.FAMILIER)
                {
                    return(characterLook);
                }

                if (IsEquiped())
                {
                    var appareanceId = Template.AppearanceId;

                    if (AppearanceId != 0)
                    {
                        appareanceId = AppearanceId;
                    }

                    characterLook.SetPetSkin((short)appareanceId, new short[] { 65 });
                }
                else
                {
                    characterLook.RemovePets();
                }

                return(characterLook);
            }

            switch (Template.Type.ItemType)
            {
            case ItemTypeEnum.FAMILIER:
                if (IsEquiped())
                {
                    if (AppearanceId != 0)
                    {
                        petLook.BonesID = (short)AppearanceId;
                    }

                    characterLook.SetPetSkin(petLook.BonesID, petLook.DefaultScales.ToArray());
                }
                else
                {
                    characterLook.RemovePets();
                }
                break;

            case ItemTypeEnum.MONTILIER:
                if (IsEquiped())
                {
                    characterLook = characterLook.GetRiderLook() ?? characterLook;

                    //KramKram
                    if (Template.Id == (int)ItemIdEnum.KRAMKRAM_13182)
                    {
                        if (characterLook.Colors.TryGetValue(3, out var color1) &&
                            characterLook.Colors.TryGetValue(4, out var color2))
                        {
                            petLook.AddColor(1, color1);
                            petLook.AddColor(2, color2);
                        }
                    }

                    if (AppearanceId != 0)
                    {
                        petLook.BonesID = (short)AppearanceId;
                    }

                    characterLook.BonesID = 2;
                    petLook.SetRiderLook(characterLook);

                    return(petLook);
                }
                else
                {
                    var look = characterLook.GetRiderLook();

                    if (look != null)
                    {
                        characterLook         = look;
                        characterLook.BonesID = 1;
                    }
                    return(characterLook);
                }
            }

            return(characterLook);
        }
Example #20
0
        public void CreateCharacter(WorldClient client, string name, sbyte breedId, bool sex, IEnumerable <int> colors, int headId, Action successCallback, Action <CharacterCreationResultEnum> failCallback)
        {
            if ((long)client.Characters.Count >= (long)((ulong)MaxCharacterSlot) && client.UserGroup.Role <= RoleEnum.Player)
            {
                failCallback(CharacterCreationResultEnum.ERR_TOO_MANY_CHARACTERS);
            }
            else
            {
                if (this.DoesNameExist(name))
                {
                    failCallback(CharacterCreationResultEnum.ERR_NAME_ALREADY_EXISTS);
                }
                else
                {
                    if (!m_nameCheckerRegex.IsMatch(name))
                    {
                        failCallback(CharacterCreationResultEnum.ERR_INVALID_NAME);
                    }
                    else
                    {
                        Breed breed = Singleton <BreedManager> .Instance.GetBreed((int)breedId);

                        if (breed == null || !client.Account.CanUseBreed((int)breedId) || !Singleton <BreedManager> .Instance.IsBreedAvailable((int)breedId))
                        {
                            failCallback(CharacterCreationResultEnum.ERR_NOT_ALLOWED);
                        }
                        else
                        {
                            Head head = Singleton <BreedManager> .Instance.GetHead(headId);

                            if ((ulong)head.Breed != (ulong)((long)breedId) || head.Gender == 1u != sex)
                            {
                                failCallback(CharacterCreationResultEnum.ERR_NO_REASON);
                            }
                            else
                            {
                                ActorLook look  = breed.GetLook(sex ? SexTypeEnum.SEX_FEMALE : SexTypeEnum.SEX_MALE, true);
                                int       num   = 0;
                                uint[]    array = (!sex) ? breed.MaleColors : breed.FemaleColors;
                                foreach (int current in colors)
                                {
                                    if (array.Length > num)
                                    {
                                        look.AddColor(num + 1, (current == -1) ? Color.FromArgb((int)array[num]) : Color.FromArgb(current));
                                    }
                                    num++;
                                }
                                short[] skins = head.Skins;
                                for (int i = 0; i < skins.Length; i++)
                                {
                                    short skin = skins[i];
                                    look.AddSkin(skin);
                                }
                                CharacterRecord record;
                                using (Transaction transaction = Database.GetTransaction())
                                {
                                    record = new CharacterRecord(breed)
                                    {
                                        Experience       = Singleton <ExperienceManager> .Instance.GetCharacterLevelExperience(breed.StartLevel),
                                        Name             = name,
                                        Sex              = sex ? SexTypeEnum.SEX_FEMALE : SexTypeEnum.SEX_MALE,
                                        Head             = headId,
                                        EntityLook       = look,
                                        CreationDate     = DateTime.Now,
                                        LastUsage        = new DateTime?(DateTime.Now),
                                        AlignmentSide    = AlignmentSideEnum.ALIGNMENT_NEUTRAL,
                                        WarnOnConnection = true,
                                        WarnOnLevel      = true
                                    };
                                    Database.Insert(record);
                                    IOrderedEnumerable <BreedSpell> source =
                                        from spell in breed.Spells
                                        where spell.ObtainLevel <= (int)breed.StartLevel
                                        orderby spell.ObtainLevel, spell.Spell
                                    select spell;
                                    int num2 = 0;
                                    foreach (CharacterSpellRecord current2 in
                                             from learnableSpell in source
                                             select Singleton <SpellManager> .Instance.CreateSpellRecord(record, Singleton <SpellManager> .Instance.GetSpellTemplate(learnableSpell.Spell)))
                                    {
                                        Database.Insert(current2);
                                        SpellShortcut poco = new SpellShortcut(record, num2, (short)current2.SpellId);
                                        Database.Insert(poco);
                                        num2++;
                                    }
                                    foreach (PlayerItemRecord current3 in
                                             from startItem in breed.Items
                                             select startItem.GenerateItemRecord(record))
                                    {
                                        Database.Insert(current3);
                                    }
                                    this.OnCreatingCharacter(record);
                                    if (client.Characters == null)
                                    {
                                        client.Characters = new List <CharacterRecord>();
                                    }
                                    client.Characters.Insert(0, record);
                                    transaction.Complete();
                                }
                                IPCAccessor.Instance.SendRequest(new AddCharacterMessage(client.Account.Id, record.Id), delegate(CommonOKMessage x)
                                {
                                    successCallback();
                                }, delegate(IPCErrorMessage x)
                                {
                                    this.Database.Delete(record);
                                    failCallback(CharacterCreationResultEnum.ERR_NO_REASON);
                                });
                                logger.Debug("Character {0} created", record.Name);
                            }
                        }
                    }
                }
            }
        }
 public SubActorLook(sbyte index, SubEntityBindingPointCategoryEnum category, ActorLook look)
 {
     this.m_bindingIndex    = index;
     this.m_bindingCategory = category;
     this.m_look            = look;
 }
Example #22
0
 public static void SendGameActionFightChangeLookMessage(IPacketReceiver client, FightActor source, FightActor target, ActorLook look)
 {
     client.Send(new GameActionFightChangeLookMessage(149, source.Id, target.Id, look.GetEntityLook()));
 }
Example #23
0
 public SkinBuff(int id, FightActor target, FightActor caster, SpellEffectHandler effect, ActorLook look, Spell spell, FightDispellableEnum dispelable)
     : base(id, target, caster, effect, spell, false, dispelable)
 {
     Look = look;
 }