[committed]Weight fix for craftet Poisons

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

[committed]Weight fix for craftet Poisons

Postby elcotek » Mon May 03, 2010 10:09 am

Hello all crafted Poisons have to high Weights.

Here my fix.

Change: AbstractCraftingSkill.cs

Old:
Code: Select all
newItem.Weight *= -countToAdd;


Change here: from mul to add Weights:
Code: Select all
newItem.Weight += -countToAdd;



Code: Select all
InventoryItem newItem = null;

            player.Inventory.BeginChanges();
            foreach (DictionaryEntry de in changedSlots)
            {
               int countToAdd = (int)de.Value;
               if (countToAdd > 0)   // Add to exiting item
               {
                  newItem = player.Inventory.GetItem((eInventorySlot)de.Key);
                  player.Inventory.AddCountToStack(newItem, countToAdd);
               }
               else
               {
                  
                  ItemUnique unique = new ItemUnique(craftItemData.ItemTemplate);
                  GameServer.Database.AddObject(unique);
                  newItem = new InventoryItem(unique);
                  newItem.IsCrafted = true;
                  newItem.Creator = player.Name;
                  newItem.Quality = GetQuality(player, craftItemData);
                  newItem.Count = -countToAdd;
                  newItem.Weight += -countToAdd;  //newItem.Weight *= -countToAdd; change here: from mul to add

                  if ((int)de.Key > 0)      // Create new item in the backpack
                  {
                     player.Inventory.AddItem((eInventorySlot)de.Key, newItem);
                  }
                  else               // Create new item on the ground






I have tested it and it works. :)
Brotherland Final RvR/PvE/ToA http://brotherland.phpbb8.de/
User avatar
elcotek
Server Representative
 
Posts: 177
Joined: Mon May 12, 2008 9:28 pm
Website: http://brotherland-2.de
Location: Germany

Re: Weight fix for craftet Poisons

Postby Graveen » Mon May 03, 2010 10:12 am

Thank you very much !

This is certainly a bug, as i don't see why count could be multiplicative.
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest