All pastes #519752 Raw Edit

petchooser.cs

public text v1 · immutable
#519752 ·published 2007-05-29 19:12 UTC
rendered paste body
/*
 * DAWN OF LIGHT - The first free open source DAoC server emulator
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
/***[ petchooser.cs ]****
 * DOL:	1.8+
 * author|date:	Nanowish |	2007/05/29
 * description: permet de choisir l'arme et/ou le skin des familier, (1.83).
 ******************/

using System;
using System.Reflection;
using System.Collections;
using DOL;
using DOL.GS;
using DOL.AI.Brain;
using DOL.Events;
using DOL.Database;
using DOL.Language;
using DOL.GS.Scripts;
using DOL.GS.Effects;
using DOL.GS.PacketHandler;
using DOL.GS.SkillHandler;
using log4net;

namespace DOL.GS.Scripts
{
    [CmdAttribute("&pet", //command to handle
                  (int)ePrivLevel.Player, //minimum privelege level
                  "[Pet Skinner]","Pour plus d'informations utiliser la commande:","/pet info")]
    /// <summary>
    /// Description of petchooser.
    /// </summary>
    public class PetChooserCommand : AbstractCommandHandler, ICommandHandler
    {
        /// <summary>
        /// Defines a logger for this class.
        /// </summary>
        private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        private static string petinfo = "U2NyaXB0IGNvZGVkIGJ5IE5hbm93aXNoLCBmb3Igd3d3LmRvbHNlcnZlci5uZXQu";
        private static GamePlayer player = null;
        private static InventoryItem item = null;
        private static IControlledBrain pet = null;

        public const int dmgCrush = (int)GS.eWeaponDamageType.Crush;
        public const int dmgSlash = (int)GS.eWeaponDamageType.Slash;
        public const int dmgThrust = (int)GS.eWeaponDamageType.Thrust;

        public const int typeSword = (int)eObjectType.Sword;
        public const int typeHammer = (int)eObjectType.Hammer;
        public const int typeAxe = (int)eObjectType.Axe;
        public const int typeSpear = (int)eObjectType.Spear;

        public const int slotRightHand = (int)eInventorySlot.RightHandWeapon;
        public const int slotTwoHand = (int)eInventorySlot.TwoHandWeapon;

        public const int handRight = 0;
        public const int handTwo = 1;

        private static ItemTemplate spiritLongSwordTemplate = null;
        private static ItemTemplate spiritBeardedAxeTemplate = null;
        private static ItemTemplate spiritWarHammerTemplate = null;
        private static ItemTemplate spiritLongSpearTemplate = null;

        private static ItemTemplate bonedancer1HandedSwordTemplate = null;
        private static ItemTemplate bonedancer1HandedHammerTemplate = null;
        private static ItemTemplate bonedancer1HandedAxeTemplate = null;
        private static ItemTemplate bonedancer2HandedSwordTemplate = null;
        private static ItemTemplate bonedancer2HandedHammerTemplate = null;
        private static ItemTemplate bonedancer2HandedAxeTemplate = null;

        private static ushort norsemanModel;
        private static ushort trollModel;
        private static ushort dwarfModel;
        private static ushort koboldModel;
        private static ushort valkynModel;
        private static ushort elfModel;
        private static ushort luriModel;
        private static ushort lynxModel;
        private static ushort treeModel;
        private static ushort wolfModel;

        [GameServerStartedEvent]
        public static void OnServerStartup(DOLEvent e, object sender, EventArgs args)
        {
            #region [Spiritmaster Weapons]
            #region -Spirit Long Sword-
            spiritLongSwordTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "spirit_long_sword");
            if (spiritLongSwordTemplate == null)
            {
                spiritLongSwordTemplate = new ItemTemplate();
                spiritLongSwordTemplate.Name = "spirit long sword";
                spiritLongSwordTemplate.Level = 45;
                spiritLongSwordTemplate.Durability = 100;
                spiritLongSwordTemplate.MaxDurability = 100;
                spiritLongSwordTemplate.Condition = 50000;
                spiritLongSwordTemplate.MaxCondition = 50000;
                spiritLongSwordTemplate.Quality = 100;
                spiritLongSwordTemplate.DPS_AF = 145;
                spiritLongSwordTemplate.SPD_ABS = 30;
                spiritLongSwordTemplate.Hand = handRight;
                spiritLongSwordTemplate.Type_Damage = dmgSlash;
                spiritLongSwordTemplate.Object_Type = typeSword;
                spiritLongSwordTemplate.Item_Type = slotRightHand;
                spiritLongSwordTemplate.Weight = 10;
                spiritLongSwordTemplate.Model = 311;
                spiritLongSwordTemplate.IsPickable = false;
                spiritLongSwordTemplate.IsDropable = false;
                spiritLongSwordTemplate.Id_nb = "spirit_long_sword";
                GameServer.Database.AddNewObject(spiritLongSwordTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + spiritLongSwordTemplate.Id_nb);
            }
            #endregion

            #region -Spirit Bearded Axe-
            ItemTemplate spiritBeardedAxeTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "spirit_bearded_axe");
            if (spiritBeardedAxeTemplate == null)
            {
                spiritBeardedAxeTemplate = new ItemTemplate();
                spiritBeardedAxeTemplate.Name = "spirit bearded axe";
                spiritBeardedAxeTemplate.Level = 45;
                spiritBeardedAxeTemplate.Durability = 100;
                spiritBeardedAxeTemplate.MaxDurability = 100;
                spiritBeardedAxeTemplate.Condition = 50000;
                spiritBeardedAxeTemplate.MaxCondition = 50000;
                spiritBeardedAxeTemplate.Quality = 100;
                spiritBeardedAxeTemplate.DPS_AF = 145;
                spiritBeardedAxeTemplate.SPD_ABS = 32;
                spiritBeardedAxeTemplate.Hand = handRight;
                spiritBeardedAxeTemplate.Type_Damage = dmgSlash;
                spiritBeardedAxeTemplate.Object_Type = typeAxe;
                spiritBeardedAxeTemplate.Item_Type = slotRightHand;
                spiritBeardedAxeTemplate.Weight = 10;
                spiritBeardedAxeTemplate.Model = 316;
                spiritBeardedAxeTemplate.IsPickable = false;
                spiritBeardedAxeTemplate.IsDropable = false;
                spiritBeardedAxeTemplate.Id_nb = "spirit_bearded_axe";
                GameServer.Database.AddNewObject(spiritBeardedAxeTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + spiritBeardedAxeTemplate.Id_nb);
            }
            #endregion

            #region -Spirit War Hammer-
            ItemTemplate spiritWarHammerTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "spirit_war_hammer");
            if (spiritWarHammerTemplate == null)
            {
                spiritWarHammerTemplate = new ItemTemplate();
                spiritWarHammerTemplate.Name = "spirit war hammer";
                spiritWarHammerTemplate.Level = 45;
                spiritWarHammerTemplate.Durability = 100;
                spiritWarHammerTemplate.MaxDurability = 100;
                spiritWarHammerTemplate.Condition = 50000;
                spiritWarHammerTemplate.MaxCondition = 50000;
                spiritWarHammerTemplate.Quality = 100;
                spiritWarHammerTemplate.DPS_AF = 145;
                spiritWarHammerTemplate.SPD_ABS = 35;
                spiritWarHammerTemplate.Hand = handRight;
                spiritWarHammerTemplate.Type_Damage = dmgCrush;
                spiritWarHammerTemplate.Object_Type = typeHammer;
                spiritWarHammerTemplate.Item_Type = slotRightHand;
                spiritWarHammerTemplate.Weight = 10;
                spiritWarHammerTemplate.Model = 322;
                spiritWarHammerTemplate.IsPickable = false;
                spiritWarHammerTemplate.IsDropable = false;
                spiritWarHammerTemplate.Id_nb = "spirit_war_hammer";
                GameServer.Database.AddNewObject(spiritWarHammerTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + spiritWarHammerTemplate.Id_nb);
            }
            #endregion

            #region -Spirit Long Spear-
            ItemTemplate spiritLongSpearTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "spirit_long_spear");
            if (spiritLongSpearTemplate == null)
            {
                spiritLongSpearTemplate = new ItemTemplate();
                spiritLongSpearTemplate.Name = "spirit long spear";
                spiritLongSpearTemplate.Level = 45;
                spiritLongSpearTemplate.Durability = 100;
                spiritLongSpearTemplate.MaxDurability = 100;
                spiritLongSpearTemplate.Condition = 50000;
                spiritLongSpearTemplate.MaxCondition = 50000;
                spiritLongSpearTemplate.Quality = 100;
                spiritLongSpearTemplate.DPS_AF = 145;
                spiritLongSpearTemplate.SPD_ABS = 48;
                spiritLongSpearTemplate.Hand = handTwo;
                spiritLongSpearTemplate.Type_Damage = dmgSlash;
                spiritLongSpearTemplate.Object_Type = typeSpear;
                spiritLongSpearTemplate.Item_Type = slotTwoHand;
                spiritLongSpearTemplate.Weight = 10;
                spiritLongSpearTemplate.Model = 329;
                spiritLongSpearTemplate.IsPickable = false;
                spiritLongSpearTemplate.IsDropable = false;
                spiritLongSpearTemplate.Id_nb = "spirit_long_spear";
                GameServer.Database.AddNewObject(spiritLongSpearTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + spiritLongSpearTemplate.Id_nb);
            }
            #endregion
            #endregion

            #region [Commander Weapons]
            #region -Bonedancer 1 Handed Sword-
            ItemTemplate bonedancer1HandedSwordTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_1_handed_sword");
            if (bonedancer1HandedSwordTemplate == null)
            {
                bonedancer1HandedSwordTemplate = new ItemTemplate();
                bonedancer1HandedSwordTemplate.Name = "bonedancer 1 handed sword";
                bonedancer1HandedSwordTemplate.Level = 50;
                bonedancer1HandedSwordTemplate.Durability = 100;
                bonedancer1HandedSwordTemplate.MaxDurability = 100;
                bonedancer1HandedSwordTemplate.Condition = 50000;
                bonedancer1HandedSwordTemplate.MaxCondition = 50000;
                bonedancer1HandedSwordTemplate.Quality = 100;
                bonedancer1HandedSwordTemplate.DPS_AF = 165;
                bonedancer1HandedSwordTemplate.SPD_ABS = 36;
                bonedancer1HandedSwordTemplate.Hand = handRight;
                bonedancer1HandedSwordTemplate.Type_Damage = dmgSlash;
                bonedancer1HandedSwordTemplate.Object_Type = typeSword;
                bonedancer1HandedSwordTemplate.Item_Type = slotRightHand;
                bonedancer1HandedSwordTemplate.Weight = 10;
                bonedancer1HandedSwordTemplate.Model = 3463;
                bonedancer1HandedSwordTemplate.IsPickable = false;
                bonedancer1HandedSwordTemplate.IsDropable = false;
                bonedancer1HandedSwordTemplate.Id_nb = "bonedancer_1_handed_sword";
                GameServer.Database.AddNewObject(bonedancer1HandedSwordTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + bonedancer1HandedSwordTemplate.Id_nb);
            }
            #endregion

            #region -Bonedancer 2 Handed Sword-
            ItemTemplate bonedancer2HandedSwordTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_2_handed_sword");
            if (bonedancer2HandedSwordTemplate == null)
            {
                bonedancer2HandedSwordTemplate = new ItemTemplate();
                bonedancer2HandedSwordTemplate.Name = "bonedancer 2 handed sword";
                bonedancer2HandedSwordTemplate.Level = 50;
                bonedancer2HandedSwordTemplate.Durability = 100;
                bonedancer2HandedSwordTemplate.MaxDurability = 100;
                bonedancer2HandedSwordTemplate.Condition = 50000;
                bonedancer2HandedSwordTemplate.MaxCondition = 50000;
                bonedancer2HandedSwordTemplate.Quality = 100;
                bonedancer2HandedSwordTemplate.DPS_AF = 165;
                bonedancer2HandedSwordTemplate.SPD_ABS = 41;
                bonedancer2HandedSwordTemplate.Hand = handTwo;
                bonedancer2HandedSwordTemplate.Type_Damage = dmgSlash;
                bonedancer2HandedSwordTemplate.Object_Type = typeSword;
                bonedancer2HandedSwordTemplate.Item_Type = slotTwoHand;
                bonedancer2HandedSwordTemplate.Weight = 10;
                bonedancer2HandedSwordTemplate.Model = 3462;
                bonedancer2HandedSwordTemplate.IsPickable = false;
                bonedancer2HandedSwordTemplate.IsDropable = false;
                bonedancer2HandedSwordTemplate.Id_nb = "bonedancer_2_handed_sword";
                GameServer.Database.AddNewObject(bonedancer2HandedSwordTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + bonedancer2HandedSwordTemplate.Id_nb);
            }
            #endregion

            #region -Bonedancer 1 Handed Hammer-
            ItemTemplate bonedancer1HandedHammerTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_1_handed_hammer");
            if (bonedancer1HandedHammerTemplate == null)
            {
                bonedancer1HandedHammerTemplate = new ItemTemplate();
                bonedancer1HandedHammerTemplate.Name = "bonedancer 1 handed hammer";
                bonedancer1HandedHammerTemplate.Level = 50;
                bonedancer1HandedHammerTemplate.Durability = 100;
                bonedancer1HandedHammerTemplate.MaxDurability = 100;
                bonedancer1HandedHammerTemplate.Condition = 50000;
                bonedancer1HandedHammerTemplate.MaxCondition = 50000;
                bonedancer1HandedHammerTemplate.Quality = 100;
                bonedancer1HandedHammerTemplate.DPS_AF = 165;
                bonedancer1HandedHammerTemplate.SPD_ABS = 36;
                bonedancer1HandedHammerTemplate.Hand = handRight;
                bonedancer1HandedHammerTemplate.Type_Damage = dmgCrush;
                bonedancer1HandedHammerTemplate.Object_Type = typeHammer;
                bonedancer1HandedHammerTemplate.Item_Type = slotRightHand;
                bonedancer1HandedHammerTemplate.Weight = 10;
                bonedancer1HandedHammerTemplate.Model = 3466;
                bonedancer1HandedHammerTemplate.IsPickable = false;
                bonedancer1HandedHammerTemplate.IsDropable = false;
                bonedancer1HandedHammerTemplate.Id_nb = "bonedancer_1_handed_hammer";
                GameServer.Database.AddNewObject(bonedancer1HandedHammerTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + bonedancer1HandedHammerTemplate.Id_nb);
            }
            #endregion

            #region -Bonedancer 2 Handed Hammer-
            ItemTemplate bonedancer2HandedHammerTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_2_handed_hammer");
            if (bonedancer2HandedHammerTemplate == null)
            {
                bonedancer2HandedHammerTemplate = new ItemTemplate();
                bonedancer2HandedHammerTemplate.Name = "bonedancer 2 handed hammer";
                bonedancer2HandedHammerTemplate.Level = 50;
                bonedancer2HandedHammerTemplate.Durability = 100;
                bonedancer2HandedHammerTemplate.MaxDurability = 100;
                bonedancer2HandedHammerTemplate.Condition = 50000;
                bonedancer2HandedHammerTemplate.MaxCondition = 50000;
                bonedancer2HandedHammerTemplate.Quality = 100;
                bonedancer2HandedHammerTemplate.DPS_AF = 165;
                bonedancer2HandedHammerTemplate.SPD_ABS = 41;
                bonedancer2HandedHammerTemplate.Hand = handTwo;
                bonedancer2HandedHammerTemplate.Type_Damage = dmgCrush;
                bonedancer2HandedHammerTemplate.Object_Type = typeHammer;
                bonedancer2HandedHammerTemplate.Item_Type = slotTwoHand;
                bonedancer2HandedHammerTemplate.Weight = 10;
                bonedancer2HandedHammerTemplate.Model = 3465;
                bonedancer2HandedHammerTemplate.IsPickable = false;
                bonedancer2HandedHammerTemplate.IsDropable = false;
                bonedancer2HandedHammerTemplate.Id_nb = "bonedancer_2_handed_hammer";
                GameServer.Database.AddNewObject(bonedancer2HandedHammerTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + bonedancer2HandedHammerTemplate.Id_nb);
            }
            #endregion

            #region -Bonedancer 1 Handed Axe-
            ItemTemplate bonedancer1HandedAxeTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_1_handed_axe");
            if (bonedancer1HandedAxeTemplate == null)
            {
                bonedancer1HandedAxeTemplate = new ItemTemplate();
                bonedancer1HandedAxeTemplate.Name = "bonedancer 1 handed axe";
                bonedancer1HandedAxeTemplate.Level = 50;
                bonedancer1HandedAxeTemplate.Durability = 100;
                bonedancer1HandedAxeTemplate.MaxDurability = 100;
                bonedancer1HandedAxeTemplate.Condition = 50000;
                bonedancer1HandedAxeTemplate.MaxCondition = 50000;
                bonedancer1HandedAxeTemplate.Quality = 100;
                bonedancer1HandedAxeTemplate.DPS_AF = 165;
                bonedancer1HandedAxeTemplate.SPD_ABS = 36;
                bonedancer1HandedAxeTemplate.Hand = handRight;
                bonedancer1HandedAxeTemplate.Type_Damage = dmgSlash;
                bonedancer1HandedAxeTemplate.Object_Type = typeAxe;
                bonedancer1HandedAxeTemplate.Item_Type = slotRightHand;
                bonedancer1HandedAxeTemplate.Weight = 10;
                bonedancer1HandedAxeTemplate.Model = 3469;
                bonedancer1HandedAxeTemplate.IsPickable = false;
                bonedancer1HandedAxeTemplate.IsDropable = false;
                bonedancer1HandedAxeTemplate.Id_nb = "bonedancer_1_handed_axe";
                GameServer.Database.AddNewObject(bonedancer1HandedAxeTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + bonedancer1HandedAxeTemplate.Id_nb);
            }
            #endregion

            #region -Bonedancer 2 Handed Axe-
            ItemTemplate bonedancer2HandedAxeTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_2_handed_axe");
            if (bonedancer2HandedAxeTemplate == null)
            {
                bonedancer2HandedAxeTemplate = new ItemTemplate();
                bonedancer2HandedAxeTemplate.Name = "bonedancer 2 handed axe";
                bonedancer2HandedAxeTemplate.Level = 50;
                bonedancer2HandedAxeTemplate.Durability = 100;
                bonedancer2HandedAxeTemplate.MaxDurability = 100;
                bonedancer2HandedAxeTemplate.Condition = 50000;
                bonedancer2HandedAxeTemplate.MaxCondition = 50000;
                bonedancer2HandedAxeTemplate.Quality = 100;
                bonedancer2HandedAxeTemplate.DPS_AF = 165;
                bonedancer2HandedAxeTemplate.SPD_ABS = 41;
                bonedancer2HandedAxeTemplate.Hand = handTwo;
                bonedancer2HandedAxeTemplate.Type_Damage = dmgSlash;
                bonedancer2HandedAxeTemplate.Object_Type = typeAxe;
                bonedancer2HandedAxeTemplate.Item_Type = slotTwoHand;
                bonedancer2HandedAxeTemplate.Weight = 10;
                bonedancer2HandedAxeTemplate.Model = 3468;
                bonedancer2HandedAxeTemplate.IsPickable = false;
                bonedancer2HandedAxeTemplate.IsDropable = false;
                bonedancer2HandedAxeTemplate.Id_nb = "bonedancer_2_handed_axe";
                GameServer.Database.AddNewObject(bonedancer2HandedAxeTemplate);
                if (log.IsDebugEnabled)
                    log.Debug("Added " + bonedancer2HandedAxeTemplate.Id_nb);
            }
            #endregion
            #endregion

        }

        public void SetWeapon(ItemTemplate weapon, eInventorySlot slot)
        {
            item = pet.Body.Inventory.GetItem(eInventorySlot.RightHandWeapon);
            pet.Body.Inventory.RemoveItem(item);
            pet.Body.Inventory.RemoveItem(pet.Body.Inventory.GetItem(eInventorySlot.LeftHandWeapon));
            pet.Body.Inventory.RemoveItem(pet.Body.Inventory.GetItem(eInventorySlot.TwoHandWeapon));
            pet.Body.Inventory.AddTemplate(weapon, 1, slot, slot);
            pet.Body.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
            pet.Body.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);
        }


        public int OnCommand(GameClient client, string[] args)
        {

            pet = client.Player.ControlledNpc;
            player = client.Player;

            #region -spirit weapons var-
            spiritLongSwordTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "spirit_long_sword");
            spiritBeardedAxeTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "spirit_bearded_axe");
            spiritWarHammerTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "spirit_war_hammer");
            spiritLongSpearTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "spirit_long_spear");
            #endregion

            #region -commander weapons var-
            bonedancer1HandedAxeTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_1_handed_axe");
            bonedancer1HandedHammerTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_1_handed_hammer");
            bonedancer1HandedSwordTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_1_handed_sword");
            bonedancer2HandedAxeTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_2_handed_axe");
            bonedancer2HandedHammerTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_2_handed_hammer");
            bonedancer2HandedSwordTemplate = (ItemTemplate)GameServer.Database.FindObjectByKey(typeof(ItemTemplate), "bonedancer_2_handed_sword");
            #endregion

            elfModel = (ushort)Util.Random(334, 349);
            luriModel = (ushort)Util.Random(318, 333);
            norsemanModel = (ushort)Util.Random(503, 510);
            trollModel = (ushort)Util.Random(511, 518);
            dwarfModel = (ushort)Util.Random(519, 526);
            koboldModel = (ushort)Util.Random(527, 534);
            valkynModel = (ushort)Util.Random(832, 839);
            lynxModel = (ushort)135;
            treeModel = (ushort)97;
            wolfModel = (ushort)650;

            if (player.CharacterClass.ID != (int)eCharacterClass.Bonedancer && args.Length > 4)
            {
                return DisplaySyntax(client);
            }

            if (args.Length == 1)
            {
                return DisplaySyntax(client);
            }

            if (pet == null)
            {
                client.Out.SendMessage("Vous n'avez pas de familier sous votre contrôle.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return 0;
            }

            switch (args[1])
            {
                #region [Commande info]
                case "info":
                    {
                        if (player.CharacterClass.ID == (int)eCharacterClass.Spiritmaster)
                        {
                            player.Out.SendMessage(
                                "Pour personnaliser votre familier, en tant que Prêtre de Hel, il vous suffit d'utiliser les commandes suivante: \n" +
                                "Choisir la race de votre familier: \n" +
                                "/pet race <viking | troll | kobold | nain | valkyn> \n" +
                                "Pour choisir l'arme de votre familier: \n" +
                                "/pet arme <epee | hache | marteau | lance> \n\n\n" + PetInfo(petinfo)
                                , eChatType.CT_Staff, eChatLoc.CL_PopupWindow);
                        }

                        if (player.CharacterClass.ID == (int)eCharacterClass.Bonedancer)
                        {
                            player.Out.SendMessage(
                                "Pour personnaliser votre familier, en tant que Prêtre de Bogdar, il vous suffit d'utiliser la commande suivante: \n" +
                                "Pour choisir l'arme de votre familier: \n" +
                                "/pet arme <epee | hache | marteau> 1|2 (1: arme à une main, 2: arme à deux mains) \n\n\n" + PetInfo(petinfo)
                                , eChatType.CT_Staff, eChatLoc.CL_PopupWindow);
                        }

                        if (player.CharacterClass.ID == (int)eCharacterClass.Enchanter)
                        {
                            player.Out.SendMessage(
                                "Pour personnaliser votre familier, en tant qu'Enchanteur, il vous suffit d'utiliser les commandes suivante: \n" +
                                "Choisir la race de votre familier: \n" +
                                "/pet race <elfe|luri> \n\n\n" + PetInfo(petinfo)
                                , eChatType.CT_Staff, eChatLoc.CL_PopupWindow);
                        }

                        if (player.CharacterClass.ID == (int)eCharacterClass.Druid)
                        {
                            player.Out.SendMessage(
                                "Pour personnaliser votre familier, en tant que Druid, il vous suffit d'utiliser les commandes suivante: \n" +
                                "Choisir la race de votre familier: \n" +
                                "/pet race <lynx|arbre|loup> \n\n\n" + PetInfo(petinfo)
                                , eChatType.CT_Staff, eChatLoc.CL_PopupWindow);
                        }
                    } 
                    break;
                #endregion
                #region [Race]
                case "race":
                    {
                        #region [SpiritMaster Race]
                        //[Mid]race: troll, viking, nain, kobold et valkyn uniquement pour les spiritmaster.
                        if (player.CharacterClass.ID == (int)eCharacterClass.Spiritmaster)
                        {
                            try
                            {
                                switch (args[2])
                                {
                                    case "viking":
                                        { pet.Body.Model = norsemanModel; } break;
                                    case "troll":
                                        { pet.Body.Model = trollModel; } break;
                                    case "nain":
                                        { pet.Body.Model = dwarfModel; } break;
                                    case "kobold":
                                        { pet.Body.Model = koboldModel; } break;
                                    case "valkyn":
                                        { pet.Body.Model = valkynModel; } break;
                                }
                            }
                            catch (Exception) { return DisplaySyntax(client); }
                        }
                        #endregion
                        #region [Enchanter Race]
                        //[Hib]race: elfe, luri pour les enchanteurs.
                        if (player.CharacterClass.ID == (int)eCharacterClass.Enchanter)
                        {
                            try
                            {
                                switch (args[2])
                                {
                                    case "elfe":
                                        { pet.Body.Model = elfModel; } break;
                                    case "luri":
                                        { pet.Body.Model = luriModel; } break;
                                }
                            }
                            catch (Exception) { return DisplaySyntax(client); }
                        }
                        #endregion
                        #region [Druid Race]
                        //[Hib]race: lynx,arbre,loup pour les druides.
                        if (player.CharacterClass.ID == (int)eCharacterClass.Druid)
                        {
                            try
                            {
                                switch (args[2])
                                {
                                    case "lynx":
                                        { pet.Body.Model = lynxModel; } break;
                                    case "arbre":
                                        { pet.Body.Model = treeModel; } break;
                                    case "loup":
                                        { pet.Body.Model = wolfModel; } break;
                                }
                            }
                            catch (Exception) { return DisplaySyntax(client); }
                        }
                        #endregion
                        #region [Classe invalide]
                        //Si aucune classe ne correspond...
                        if (player.CharacterClass.ID == (int)eCharacterClass.Bonedancer)
                        {
                            player.Out.SendMessage("Votre classe ne vous permet pas de choisir la race de votre familier !", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                            return 0;
                        }
                        #endregion
                    }
                    break;
                #endregion
                #region [Weapons]
                case "arme":
                    {
                        if (!pet.Body.InCombat)
                        {
                            try
                            {
                                switch (args[2])
                                {
                                    #region [épée]
                                    case "epee":
                                        {
                                            if (player.CharacterClass.ID == (int)eCharacterClass.Spiritmaster)
                                            {
                                                SetWeapon(spiritLongSwordTemplate, eInventorySlot.RightHandWeapon);
                                            }
                                            if (player.CharacterClass.ID == (int)eCharacterClass.Bonedancer)
                                            {
                                                switch (args[3])
                                                {
                                                    case "1":
                                                        {
                                                            SetWeapon(bonedancer1HandedSwordTemplate, eInventorySlot.RightHandWeapon);
                                                        }
                                                        break;
                                                    case "2":
                                                        {
                                                            SetWeapon(bonedancer2HandedSwordTemplate, eInventorySlot.TwoHandWeapon);
                                                            pet.Body.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
                                                        }
                                                        break;
                                                }
                                            }
                                        }
                                        break;
                                    #endregion
                                    #region [hache]
                                    case "hache":
                                        {
                                            if (player.CharacterClass.ID == (int)eCharacterClass.Spiritmaster)
                                            {
                                                SetWeapon(spiritBeardedAxeTemplate, eInventorySlot.RightHandWeapon);
                                            }
                                            if (player.CharacterClass.ID == (int)eCharacterClass.Bonedancer)
                                            {
                                                switch (args[3])
                                                {
                                                    case "1":
                                                        {
                                                            SetWeapon(bonedancer1HandedAxeTemplate, eInventorySlot.RightHandWeapon);
                                                        }
                                                        break;
                                                    case "2":
                                                        {
                                                            SetWeapon(bonedancer2HandedAxeTemplate, eInventorySlot.TwoHandWeapon);
                                                            pet.Body.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
                                                        }
                                                        break;
                                                }
                                            }
                                        }
                                        break;
                                    #endregion
                                    #region [marteau]
                                    case "marteau":
                                        {
                                            if (player.CharacterClass.ID == (int)eCharacterClass.Spiritmaster)
                                            {
                                                SetWeapon(spiritWarHammerTemplate, eInventorySlot.RightHandWeapon);
                                            }
                                            if (player.CharacterClass.ID == (int)eCharacterClass.Bonedancer)
                                            {
                                                switch (args[3])
                                                {
                                                    case "1":
                                                        {
                                                            SetWeapon(bonedancer1HandedHammerTemplate, eInventorySlot.RightHandWeapon);
                                                        }
                                                        break;
                                                    case "2":
                                                        {
                                                            SetWeapon(bonedancer2HandedHammerTemplate, eInventorySlot.TwoHandWeapon);
                                                            pet.Body.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
                                                        }
                                                        break;
                                                }
                                            }
                                        }
                                        break;
                                    #endregion]
                                    #region [lance]
                                    case "lance":
                                        {
                                            if (player.CharacterClass.ID == (int)eCharacterClass.Spiritmaster)
                                            {
                                                SetWeapon(spiritLongSpearTemplate, eInventorySlot.TwoHandWeapon); ;
                                                pet.Body.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
                                            }
                                            else
                                            {
                                                player.Out.SendMessage("Vote familier n'a pas accès à ce type d'arme !", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                                            }
                                        }
                                        break;
                                    #endregion]
                                }
                            }
                            catch (Exception)
                            {
                                return DisplaySyntax(client);
                            }
                        }
                        else
                        {
                            player.Out.SendMessage("Vous ne pouvez pas changer l'arme de votre familier lorsqu'il est en combat !", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                        }
                        break;
                    }
                #endregion
            }
                    return 1;
            }
        public string PetInfo(string str)
        {byte[] decbuff = Convert.FromBase64String(str); return System.Text.Encoding.UTF8.GetString(decbuff);}
    }
}