Exemplo n.º 1
0
    public string DefinedToString(AStuff <TModuleType> stuff, List <ObjectAttribute> objectAttri, int i = 0, bool useColor = false)
    {
        string result = "";

        for (; i < objectAttri.Count; i++)
        {
            bool isFloatAttribute = IsFloatEquipmentAttribute(objectAttri[i].name);

            string color = "<color=white>";

            if (useColor)
            {
                if (objectAttri[i].value > 0)
                {
                    color = "<color=#00FF00FF>+";
                }
                else if (objectAttri[i].value < 0)
                {
                    color = "<color=red>";
                }
            }

            result += "<b>" + GetDisplayEquipmentAttribute(objectAttri[i].name) + "</b>: " + color +
                      ((isFloatAttribute) ? objectAttri[i].value.ToString("F2") : objectAttri[i].value.ToString()) +
                      GetFinalSignEquipmentAttribute(objectAttri[i].name) + "</color>\n";
        }

        return(result);
    }
Exemplo n.º 2
0
 void EquipInteraction(ref float posX, ref float posY, AStuff <TModuleType> stuff)
 {
     if (stuff.equipmentEmplacement == e_equipmentEmplacement.Left_Hand || stuff.equipmentEmplacement == e_equipmentEmplacement.Right_Hand)
     {
         if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Equiper(L)</b></color>" + "</size>"))
         {
             stuff.equipmentEmplacement = e_equipmentEmplacement.Left_Hand;
             this.itemMgr.Equip(stuff);
         }
         posY += 0.025f;
         if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Equiper(R)</b></color>" + "</size>"))
         {
             stuff.equipmentEmplacement = e_equipmentEmplacement.Right_Hand;
             this.itemMgr.Equip(stuff);
         }
         posY += 0.025f;
     }
     else
     {
         if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Equiper</b></color>" + "</size>"))
         {
             this.itemMgr.Equip(stuff);
         }
         posY += 0.025f;
     }
 }
Exemplo n.º 3
0
    public static string GetStuffTitle(AStuff <TModuleType> stuff, Inventory <TModuleType> inventory, byte itemSelectedIndex)
    {
        string result = GetItemColor(stuff) + "<b>" + MultiResolutions.Font(13);

        if (stuff.Filtre == ItemExtension.FiltreWeapon)
        {
            result += StringExtension.FirstLetterMaj(inventory.Weapons[itemSelectedIndex].Name);
        }
        else if (stuff.Filtre == ItemExtension.FiltreClothe)
        {
            result += StringExtension.FirstLetterMaj(inventory.Clothes[itemSelectedIndex].Name);
        }

        result += "\n</size>" + MultiResolutions.Font(12);

        if (stuff.Filtre == ItemExtension.FiltreWeapon)
        {
            result += GetWeaponCategory(inventory.Weapons[itemSelectedIndex]);
        }
        else if (stuff.Filtre == ItemExtension.FiltreClothe)
        {
            result += GetClotheCategory(inventory.Clothes[itemSelectedIndex]);
        }

        result += "</size></b></color>\n" + MultiResolutions.Font(12);

        return(result);
    }
Exemplo n.º 4
0
    public List <ObjectAttribute> GetStuffComparatorThatItemDontHave(AStuff <TModuleType> equippedStuff, bool itemEquipped)
    {
        //string result = "";
        List <ObjectAttribute> objectAttri = new List <ObjectAttribute>();

        for (int stuffIndex = 0; stuffIndex < this.blueAttributes.Count; stuffIndex++)
        {
            bool finded             = false;
            int  equippedStuffIndex = 0;

            for (; equippedStuffIndex < equippedStuff.blueAttributes.Count && !finded; equippedStuffIndex++)
            {
                if (this.blueAttributes[stuffIndex].WhichAttribute == equippedStuff.blueAttributes[equippedStuffIndex].WhichAttribute)
                {
                    finded = true;
                }
            }

            if (!finded)
            {
                objectAttri.Add(new ObjectAttribute(this.blueAttributes[stuffIndex].WhichAttribute.ToString(), ((itemEquipped) ? this.blueAttributes[stuffIndex].Value : -this.blueAttributes[stuffIndex].Value)));
            }
        }
        return(objectAttri);
        //return result;
    }
Exemplo n.º 5
0
 public static string GetAttributeString(int x, string color, string colorOfPlus, AStuff <TModuleType> stuff)
 {
     return(color + MultiResolutions.Font(12) + "<b>" +
            stuff.GetDisplayEquipmentAttribute(stuff.blueAttributes[x].WhichAttribute) + "</b>: " +
            (!(stuff.IsFloatEquipmentAttribute(stuff.blueAttributes[x].WhichAttribute)) ? (colorOfPlus + "+</color>") : "") +
            stuff.GetCorrectEquipmentAttributeValue(stuff.blueAttributes[x]) +
            stuff.GetFinalSignEquipmentAttribute(stuff.blueAttributes[x].WhichAttribute) + "</size></color>");
 }
Exemplo n.º 6
0
 void UnEquipInteraction(ref float posX, ref float posY, AStuff <TModuleType> stuff)
 {
     if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Déséquiper</b></color>" + "</size>"))
     {
         this.itemMgr.Unequip(stuff);
     }
     posY += 0.025f;
 }
Exemplo n.º 7
0
    private AStuff <TModuleType> GenerateStuff(e_stuffInstantiate whichPartOfStuff)
    {
        AStuff <TModuleType> itemGenerated = null;

        switch (whichPartOfStuff)
        {
        case e_stuffInstantiate.ARMOR: itemGenerated = this.GenerateClothe(); break;

        case e_stuffInstantiate.WEAPON: itemGenerated = this.GenerateWeapon(); break;

        case e_stuffInstantiate.Axe_One_Handed: itemGenerated = new WeaponOneHandedAxe <TModuleType>(); break;

        case e_stuffInstantiate.Sword_One_Handed: itemGenerated = new WeaponOneHandedSword <TModuleType>(); break;

        case e_stuffInstantiate.Mass_One_Handed: itemGenerated = new WeaponOneHandedMass <TModuleType>(); break;

        case e_stuffInstantiate.Scepter_One_Handed: itemGenerated = new WeaponOneHandedScepter <TModuleType>(); break;

        case e_stuffInstantiate.Axe_Both_Handed: itemGenerated = new WeaponTwoHandedAxe <TModuleType>(); break;

        case e_stuffInstantiate.Sword_Both_Handed: itemGenerated = new WeaponTwoHandedSword <TModuleType>(); break;

        case e_stuffInstantiate.Mass_Both_Handed: itemGenerated = new WeaponTwoHandedMass <TModuleType>(); break;

        case e_stuffInstantiate.Scepter_Both_Handed: itemGenerated = new WeaponTwoHandedScepter <TModuleType>(); break;

        case e_stuffInstantiate.Lance: itemGenerated = new WeaponTwoHandedLance <TModuleType>(); break;

        case e_stuffInstantiate.Spear: itemGenerated = new WeaponTwoHandedSpear <TModuleType>(); break;

        case e_stuffInstantiate.Staff: itemGenerated = new WeaponTwoHandedStaff <TModuleType>(); break;

        case e_stuffInstantiate.Wand: itemGenerated = new WeaponOneHandedWand <TModuleType>(); break;

        case e_stuffInstantiate.Bow: itemGenerated = new WeaponTwoHandedBow <TModuleType>(); break;

        case e_stuffInstantiate.Crossbow: itemGenerated = new WeaponTwoHandedCrossbow <TModuleType>(); break;

        case e_stuffInstantiate.Armor: itemGenerated = new ClotheArmor <TModuleType>(); break;

        case e_stuffInstantiate.Helmet: itemGenerated = new ClotheHelmet <TModuleType>(); break;

        case e_stuffInstantiate.Belt: itemGenerated = new ClotheBelt <TModuleType>(); break;

        case e_stuffInstantiate.Trousers: itemGenerated = new ClotheTrousers <TModuleType>(); break;

        case e_stuffInstantiate.Glove: itemGenerated = new ClotheGlove <TModuleType>(); break;

        case e_stuffInstantiate.Shoes: itemGenerated = new ClotheShoes <TModuleType>(); break;

        case e_stuffInstantiate.Shield: itemGenerated = new ClotheShield <TModuleType>(); break;

        default: break;
        }

        return(itemGenerated);
    }
Exemplo n.º 8
0
    public string GetTheBlueAttributesCompared(AStuff <TModuleType> stuff, AStuff <TModuleType> equippedStuff)
    {
        string result = MultiResolutions.Font(12);

        result += ComparedToString(stuff.GetStuffComparatorThatItemHave(equippedStuff), 0, false);
        result += DefinedToString(stuff, stuff.GetStuffComparatorThatItemDontHave(equippedStuff, true), 0, true);
        result += DefinedToString(equippedStuff, equippedStuff.GetStuffComparatorThatItemDontHave(stuff, false), 0, true);

        return(result + "</size>");
    }
Exemplo n.º 9
0
    public static string GetTheBlueAttributes(AStuff <TModuleType> stuff)
    {
        string result = "";

        for (int x = 0; x < stuff.blueAttributes.Count; x++)
        {
            result += GetBlueAttribute(x, stuff) + "\n";
        }

        return(result);
    }
Exemplo n.º 10
0
    //ca serait plus generique si equipe renvoyer un boolean pour dire si l'action a fonctionne ou pas, si elle na pas fonctionne ne pas supprimer lobjet par exemple
    public void Equip(AStuff <TModuleType> stuff)
    {
        //this.itemManagerGUI.ResetItemSelected();
        //envoyer lindex au lieu de stuff comme un gros degueulasse
        if (this.attribute.Level >= stuff.levelRequiered)
        {
            e_equipmentEmplacement emplacement = stuff.equipmentEmplacement;
            bool worked  = true;
            bool unequip = false;

            if (this.equipment.GetEquipmentSlot(emplacement).Equipped)
            {
                unequip = true;
            }

            if (emplacement == e_equipmentEmplacement.Both_Hand)
            {
                this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Left_Hand).UnequipInSlot(equipment.GetEquipmentSlot(e_equipmentEmplacement.Left_Hand).Item, this.equipment, this);
                this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Right_Hand).UnequipInSlot(equipment.GetEquipmentSlot(e_equipmentEmplacement.Right_Hand).Item, this.equipment, this);
            }
            else if (emplacement == e_equipmentEmplacement.Left_Hand || emplacement == e_equipmentEmplacement.Right_Hand)
            {
                this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Both_Hand).UnequipInSlot(equipment.GetEquipmentSlot(e_equipmentEmplacement.Both_Hand).Item, equipment, this);
            }

            if (unequip)
            {
                AStuff <TModuleType> equippedStuff = equipment.EquipmentSlots[((int)emplacement)].Item;

                if (equippedStuff != null && inventory.CanAddItem(equippedStuff))
                {
                    this.equipment.EquipmentSlots[((int)emplacement)].UnequipInSlot(equippedStuff, this.equipment, this);
                }
                else
                {
                    base.ModuleManager.ServiceLocator.ErrorDisplayStack.Add("You are too heavy to wear this item", e_errorDisplay.Warning);
                    worked = false;
                }
            }

            if (worked)
            {
                this.equipment.AddItemWeight(stuff);
                this.equipment.EquipmentSlots[((int)emplacement)].EquipInSlot(stuff);

                this.inventory.UnselectAll();
                this.attributeInitializer.ModifyPlayerAttributesWithEquipment(stuff, 1);
            }
        }
        else
        {
            base.ModuleManager.ServiceLocator.ErrorDisplayStack.Errors.Add(new ErrorDisplay("You can't wear this item because you don't have the level requiered to use it", e_errorDisplay.Warning));
        }
    }
Exemplo n.º 11
0
 public void UnequipInSlot(AStuff <TModuleType> newItem, Equipment <TModuleType> equipment, ItemManager <TModuleType> itemMgr)
 {
     equipped = false;
     item     = null;
     if (newItem != null)
     {
         newItem.equipped = e_equipmentEquipped.NOT_EQUIPPED;
         equipment.RemoveItemWeight(newItem);
         itemMgr.AttributeInitializer.ModifyPlayerAttributesWithEquipment(newItem, -1);
     }
 }
Exemplo n.º 12
0
    public void ModifyPlayerAttributesWithEquipment(AStuff <TModuleType> stuff, int negativeOrPositiveOne)
    {
        for (short i = 0; i < stuff.blueAttributes.Count; i++)
        {
            ModifyPlayerAttribute(stuff.GetAttributeValue(stuff.blueAttributes[i]) * negativeOrPositiveOne, stuff.blueAttributes[i].WhichAttribute);
        }

        for (short i = 0; i < stuff.whiteAttributes.Count; i++)
        {
            ModifyPlayerAttribute(stuff.GetAttributeValue(stuff.whiteAttributes[i]) * negativeOrPositiveOne, stuff.whiteAttributes[i].WhichAttribute);
        }
    }
Exemplo n.º 13
0
    public string GetStuffContent(AStuff <TModuleType> stuff)
    {
        AStuff <TModuleType> equippedStuff = this.equipment.EquipmentSlots[((int)stuff.equipmentEmplacement)].Item;
        string text = "";

        text = StuffGUI <TModuleType> .GetStuffTitle(stuff, this.inventory, this.itemSelectedIndex);

        //if (stuff.equipmentEmplacement == e_equipmentEmplacement.Both_Hand &&
        //	(null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item || null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item))
        //{
        //	//if (null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item && null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item)
        //	//	text += objectAttributeToString.ComparedDefinedToString(stuff,
        //	//	objectAttributeToString.AdditionListOfObjectAttributeCompared(
        //	//	stuff.GetTheWhiteAttributesCompared(equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item, player),
        //	//	stuff.GetTheWhiteAttributesCompared(equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item, player))) + "</size>";
        //	//if (null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item)
        //	//	text += objectAttributeToString.GetTheWhiteAttributesCompared(stuff, equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item, player);
        //	//else if (null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item)
        //	//	text += objectAttributeToString.GetTheWhiteAttributesCompared(stuff, equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item, player);
        //}
        if (equippedStuff != null && stuff.equipmentCategory == equippedStuff.equipmentCategory)
        {
            text += this.objectAttributeToString.GetTheWhiteAttributesCompared(stuff, equippedStuff, player);
        }
        else
        {
            text += this.objectAttributeToString.SimpleDefinedToString(stuff, stuff.GetTheWhiteAttributes()) + "</size>";
        }

        //if (stuff.equipmentEmplacement == e_equipmentEmplacement.Both_Hand &&
        //	(null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item || null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item))
        //{
        //	//if (null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item && null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item)
        //	//	text += objectAttributeToString.ComparedRandomToString(stuff,
        //	//	objectAttributeToString.AdditionListOfObjectAttributeCompared(
        //	//	stuff.GetTheBlueAttributesCompared(equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item.GetheBlueAttributes()),
        //	//	stuff.GetTheBlueAttributesCompared(equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item.GetheBlueAttributes()))) + "</size>";
        //	//if (null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item)
        //	//	text += objectAttributeToString.ComparedRandomToString(stuff, stuff.GetTheWhiteAttributesCompared(equipment.equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item, player));
        //	//else if (null != equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item)
        //	//	text += objectAttributeToString.ComparedRandomToString(stuff, stuff.GetTheWhiteAttributesCompared(equipment.equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item, player));
        //}
        if (equippedStuff != null && stuff.equipmentEmplacement == equippedStuff.equipmentEmplacement && stuff != equippedStuff && equippedStuff.equipped != e_equipmentEquipped.NOT_EQUIPPED)
        {
            text += this.objectAttributeToString.GetTheBlueAttributesCompared(stuff, equippedStuff);
        }
        else
        {
            text += StuffGUI <TModuleType> .GetTheBlueAttributes(stuff);
        }

        return(text);
    }
Exemplo n.º 14
0
    void ItemInteraction(string text, AStuff <TModuleType> stuff)
    {
        Rect rect = StuffGUI <TModuleType> .GetRectOfMyGUIContent(text, 0.41f, 0.85f);

        float posX = rect.x + rect.width;
        float posY = rect.y;

        StuffGUI <TModuleType> .DisplayItemContent(MultiResolutions.Rectangle(rect), text);

        StuffGUI <TModuleType> .DisplayItemInteractionBorder(posX, posY, stuff);

        this.ItemInteractionBehaviour(ref posX, ref posY, stuff);
    }
Exemplo n.º 15
0
 public static void DisplayItemInteractionBorder(float posX, float posY, AStuff <TModuleType> stuff)
 {
     for (byte i = 0; i < 3; i++)
     {
         GUI.Box(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f *
                                            (((stuff.Filtre == ItemExtension.FiltreClothe ||
                                               stuff.Filtre == ItemExtension.FiltreWeapon)
                              ? 1 : 0) + ((stuff.equipped == e_equipmentEquipped.NOT_EQUIPPED) ? 3 : 1) +
                                             (((stuff.equipped == e_equipmentEquipped.NOT_EQUIPPED) &&
                                               (stuff.equipmentEmplacement == e_equipmentEmplacement.Left_Hand ||
                                                stuff.equipmentEmplacement == e_equipmentEmplacement.Right_Hand)) ? 1 : 0))), "");
     }
 }
Exemplo n.º 16
0
    public string SimpleDefinedToString(AStuff <TModuleType> stuff, List <ObjectAttribute> objectAttri)
    {
        string result = "";
        int    i      = 0;

        if (stuff is AWeapon <TModuleType> )
        {
            result = "<b>Damage</b>: " + objectAttri[0].value + "-" + objectAttri[1].value + "\n";

            i = 2;
        }

        return(result += DefinedToString(stuff, objectAttri, i));
    }
Exemplo n.º 17
0
    public void Destruct(int itemSelectedIndex, byte itemFiltre)
    {
        //this.itemManagerGUI.ResetItemSelected();
        if (this.DoesItemExistInInventory(itemSelectedIndex, itemFiltre, "destruct"))
        {
            AItem <TModuleType>  item  = this.GetItemWithFiltre(itemSelectedIndex, itemFiltre);
            AStuff <TModuleType> stuff = item as AStuff <TModuleType>;

            if (null != stuff)
            {
                this.Unequip(stuff);
            }
            this.inventory.RemoveItem(item);
        }
    }
Exemplo n.º 18
0
    //public string ComparedRandomToString(AStuff stuff, List<ObjectAttributeCompared> objectAttri)
    //{
    //	return
    //}

    public string ComparedDefinedToString(AStuff <TModuleType> stuff, List <ObjectAttributeCompared> objectAttri)
    {
        string result = "";
        int    i      = 0;

        if (stuff is AWeapon <TModuleType> )
        {
            result = "<b>Damage</b>: " + objectAttri[0].value + "-" + objectAttri[1].value +
                     "(" + GUIExtension.IfNegativeReturnRedIfPositiveReturnGreen(objectAttri[0].difference) + "-" +
                     GUIExtension.IfNegativeReturnRedIfPositiveReturnGreen(objectAttri[1].difference) + ")\n";

            i = 2;
        }

        return(result + ComparedToString(objectAttri, i));
    }
Exemplo n.º 19
0
    public void EquipInSlot(AStuff <TModuleType> newItem)
    {
        equipped = true;
        switch (newItem.equipmentEmplacement)
        {
        case e_equipmentEmplacement.Left_Hand: newItem.equipped = e_equipmentEquipped.LEFT_HAND; break;

        case e_equipmentEmplacement.Right_Hand: newItem.equipped = e_equipmentEquipped.RIGHT_HAND; break;

        case e_equipmentEmplacement.Both_Hand: newItem.equipped = e_equipmentEquipped.BOTH_HAND; break;

        default: newItem.equipped = e_equipmentEquipped.EQUIPPED; break;
        }
        //item = new WeaponOneHandedSword()

        item = newItem;
    }
Exemplo n.º 20
0
    void ShowItemAttributes(int itemSelectedIndex)
    {
        if (this.itemSelectedFiltre == ItemExtension.FiltreWeapon)
        {
            AStuff <TModuleType> stuff = this.inventory.Weapons[itemSelectedIndex];
            string text = this.GetStuffContent(stuff);

            this.ItemInteraction(text, stuff);
        }
        else if (this.itemSelectedFiltre == ItemExtension.FiltreClothe)
        {
            AStuff <TModuleType> stuff = this.inventory.Clothes[itemSelectedIndex];
            string text = GetStuffContent(stuff);

            this.ItemInteraction(text, stuff);
        }
    }
Exemplo n.º 21
0
    public List <ObjectAttributeCompared> GetStuffComparatorThatItemHave(AStuff <TModuleType> equippedStuff)
    {
        List <ObjectAttributeCompared> objectAttri = new List <ObjectAttributeCompared>();

        for (int stuffIndex = 0; stuffIndex < this.blueAttributes.Count; stuffIndex++)
        {
            for (int equippedStuffIndex = 0; equippedStuffIndex < equippedStuff.blueAttributes.Count; equippedStuffIndex++)
            {
                if (this.blueAttributes[stuffIndex].WhichAttribute == equippedStuff.blueAttributes[equippedStuffIndex].WhichAttribute)
                {
                    float difference = this.GetAttributeValue(this.blueAttributes[stuffIndex]) - equippedStuff.GetAttributeValue(equippedStuff.blueAttributes[equippedStuffIndex]);

                    objectAttri.Add(new ObjectAttributeCompared(this.blueAttributes[stuffIndex].WhichAttribute.ToString(), difference, this.GetAttributeValue(this.blueAttributes[stuffIndex])));
                }
            }
        }
        return(objectAttri);
    }
Exemplo n.º 22
0
    public static string GetEquippedString(AStuff <TModuleType> stuff)
    {
        string equippedString = "";

        switch (stuff.equipped)
        {
        case e_equipmentEquipped.EQUIPPED: equippedString = "< "; break;

        case e_equipmentEquipped.LEFT_HAND: equippedString = "(L) "; break;

        case e_equipmentEquipped.RIGHT_HAND: equippedString = "(R) "; break;

        case e_equipmentEquipped.BOTH_HAND: equippedString = "(B) "; break;

        default: break;
        }

        return(equippedString);
    }
Exemplo n.º 23
0
    public void Unequip(AStuff <TModuleType> stuff)
    {
        //this.itemManagerGUI.ResetItemSelected();
        e_equipmentEmplacement emplacement = stuff.equipmentEmplacement;
        bool worked = false;

        if (stuff != this.equipment.GetEquipmentSlot(emplacement).Item)
        {
            base.ModuleManager.ServiceLocator.ErrorDisplayStack.Add("You try to unequip an item that you didnt equipped", e_errorDisplay.Error);
        }
        else
        {
            if (emplacement == e_equipmentEmplacement.Both_Hand)
            {
                if (this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Right_Hand).Equipped&& this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Left_Hand).Equipped)                 // &&
                //inventory.CanAddItem(equipmentSlots[((int)e_equipmentEmplacement.Right_Hand)].item, equipmentSlots[((int)e_equipmentEmplacement.Left_Hand)].item))
                {
                    if (this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Left_Hand).Equipped)
                    {
                        this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Left_Hand).UnequipInSlot(stuff, this.equipment, this);
                    }
                    if (this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Right_Hand).Equipped)
                    {
                        this.equipment.GetEquipmentSlot(e_equipmentEmplacement.Right_Hand).UnequipInSlot(stuff, this.equipment, this);
                    }
                }
            }
            if (this.equipment.GetEquipmentSlot(emplacement).Equipped)
            {
                worked = true;
            }

            if (worked)
            {
                this.equipment.GetEquipmentSlot(emplacement).UnequipInSlot(stuff, this.equipment, this);
                this.inventory.UnselectAll();
            }
        }
    }
Exemplo n.º 24
0
    public void GenerateRandomItems(AItemContainer <TModuleType> itemContainer)
    {
        int number = MathExtension.GenerateRandomIntBetweenFloat(NumberOfItemGenerated);

        for (byte i = 0; i < number; i++)
        {
            if (this.probabilities.Length > 0)
            {
                e_stuffInstantiate   whichPartOfStuff = (e_stuffInstantiate)ServiceLocator.Instance.ProbabilityManager.GetProbabilityIndex(this.probabilities);
                AStuff <TModuleType> itemGenerated    = GenerateStuff(whichPartOfStuff);

                if (null != itemGenerated)
                {
                    itemGenerated.levelRequiered   = this.levelRequired.RandomBetweenValues();
                    itemGenerated.equipmentQuality = this.GenerateStuffQuality();

                    this.GenerateStuffName(itemGenerated);
                    itemContainer.AddItem(itemGenerated);
                }
            }
        }
    }
Exemplo n.º 25
0
    public static string GetItemColor(AStuff <TModuleType> stuff)
    {
        string color = "<color=white>";

        switch (stuff.equipmentQuality)
        {
        case e_equipmentQuality.Commun: color = "<color=#00FF00FF>"; break;

        case e_equipmentQuality.Magic: color = "<color=#1100FFFF>"; break;

        case e_equipmentQuality.Rare: color = "<color=yellow>"; break;

        case e_equipmentQuality.Epic: color = "<color=#AA33FFFF>"; break;

        case e_equipmentQuality.Legendary: color = "<color=#EE7300FF>"; break;

        case e_equipmentQuality.God: color = "<color=red>"; break;

        default: break;
        }

        return(color);
    }
Exemplo n.º 26
0
    private void GenerateStuffName(AStuff <TModuleType> stuff)
    {
        if (stuff.equipmentEmplacement == e_equipmentEmplacement.Both_Hand)
        {
            stuff.Name = "Épée à 2 mains";
        }
        else
        {
            stuff.Name = "Épée à 1 main";
        }

        if (stuff is AClothe <TModuleType> )
        {
            stuff.Name = stuff.equipmentEmplacement.ToString().Replace("_", " ");
        }

        if (MathExtension.IsBetween(stuff.levelRequiered, 0, 9))
        {
            stuff.Name += " d'aventurier";
        }
        else if (MathExtension.IsBetween(stuff.levelRequiered, 10, 19))
        {
            stuff.Name += " de carton";
        }
        else if (MathExtension.IsBetween(stuff.levelRequiered, 20, 29))
        {
            stuff.Name += " de papier maché";
        }
        else if (MathExtension.IsBetween(stuff.levelRequiered, 30, 39))
        {
            stuff.Name += " de bronze";
        }
        else
        {
            stuff.Name += " de caca";
        }
    }
Exemplo n.º 27
0
    public List <ObjectAttributeCompared> GetTheWhiteAttributesCompared(AStuff <TModuleType> equippedStuff, AEntityAttribute <APlayer> player)
    {
        List <ObjectAttributeCompared> objectAttri = new List <ObjectAttributeCompared>();
        int whiteAttributeIndex = 0;

        if (this is AWeapon <TModuleType> )
        {
            float damageX = this.whiteAttributes[0].Value - equippedStuff.whiteAttributes[0].Value;
            float damageY = this.whiteAttributes[1].Value - equippedStuff.whiteAttributes[1].Value;

            objectAttri.Add(new ObjectAttributeCompared("Damage Minimal", damageX, this.whiteAttributes[0].Value));
            objectAttri.Add(new ObjectAttributeCompared("Damage Maximal", damageY, this.whiteAttributes[1].Value));
            whiteAttributeIndex = 2;
        }
        else
        {
            var cast = this as ACast <TModuleType>;
            if (cast != null)
            {
                var   equippedCast = this as ACast <TModuleType>;
                float manaCost     = cast.ManaCost - equippedCast.ManaCost;

                objectAttri.Add(new ObjectAttributeCompared("Mana Cost", manaCost, cast.ManaCost));
            }
        }

        for (; whiteAttributeIndex < this.whiteAttributes.Count; whiteAttributeIndex++)
        {
            float difference = this.GetAttributeValue(this.whiteAttributes[whiteAttributeIndex]) - equippedStuff.GetAttributeValue(equippedStuff.whiteAttributes[whiteAttributeIndex]);

            objectAttri.Add(new ObjectAttributeCompared(this.whiteAttributes[whiteAttributeIndex].WhichAttribute.ToString(), difference, this.GetAttributeValue(this.whiteAttributes[whiteAttributeIndex])));
        }

        objectAttri.Add(new ObjectAttributeCompared("Level Requiered", player.Level - this.levelRequiered, this.levelRequiered));

        return(objectAttri);
    }
Exemplo n.º 28
0
    void ItemInteractionBehaviour(ref float posX, ref float posY, AStuff <TModuleType> stuff)
    {
        AItem <TModuleType> item = this.inventory.Items[itemSelectedIndex];

        if (item.Filtre == ItemExtension.FiltreClothe || item.Filtre == ItemExtension.FiltreWeapon)
        {
            if (stuff.equipped == e_equipmentEquipped.NOT_EQUIPPED)
            {
                this.EquipInteraction(ref posX, ref posY, stuff);
            }
            else
            {
                this.UnEquipInteraction(ref posX, ref posY, stuff);
            }
        }

        this.ThrowInteraction(ref posX, ref posY, stuff);

        if (stuff.equipped == e_equipmentEquipped.NOT_EQUIPPED)
        {
            this.SellInteraction(ref posX, ref posY, stuff);
            this.DestroyInteraction(ref posX, ref posY, stuff);
        }
    }
Exemplo n.º 29
0
    private void SelectAndMaybeEquipItem(AStuff <TModuleType> stuff, byte itemIndexDefinedByFiltre)
    {
        if (this.itemSelectedFiltre == ItemExtension.FiltreWeapon)
        {
            if (stuff.Selected && stuff.equipped == e_equipmentEquipped.NOT_EQUIPPED)
            {
                if (stuff.equipmentEmplacement != e_equipmentEmplacement.Both_Hand)
                {
                    if (this.rightClick)
                    {
                        stuff.equipmentEmplacement = e_equipmentEmplacement.Left_Hand;
                    }
                    else
                    {
                        stuff.equipmentEmplacement = e_equipmentEmplacement.Right_Hand;
                    }
                }

                this.itemMgr.Equip(stuff);
                stuff.Selected = false;
            }
        }
        else if (itemSelectedFiltre == ItemExtension.FiltreClothe)
        {
            if (stuff.Selected && stuff.equipped == e_equipmentEquipped.NOT_EQUIPPED)
            {
                this.itemMgr.Equip(stuff);
                stuff.Selected = false;
            }
        }

        this.inventory.Select(itemIndexDefinedByFiltre, ref this.itemSelectedFiltre, stuff);

        // A REVOIR 5.0if (null != this.meshToDisplay)
        // A REVOIR 5.0	Destroy(this.meshToDisplay);
    }
Exemplo n.º 30
0
 public static string GetEquippedStuffName(AStuff <TModuleType> stuff)
 {
     return(MultiResolutions.Font(16) + GetItemColor(stuff) + GetEquippedString(stuff) + stuff.Name + "</color></size>");
 }