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)); }
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); }
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); } } } } } }