CORE CHANGES

Created and maintained by Fhiz – for both personal and commercial projects, not for sharing or re-sale
For uMMORPG3d only – not supported on uMMORPG2d or uSurvival unless noted otherwise!

Patching

You can patch your core files using the provided patches in this AddOns patch directory. This requires a patch program that supportsĀ BSDiff, free examples:

Requirements

LIST OF CORE CHANGES

UIItemMall.cs (ca. line 93 – required for PayPal AddOn)

Exchange the following code line…
buyButton.onClick.SetListener(()  => { Application.OpenURL(buyUrl); });
…completely with this line:

//buyButton.onClick.SetListener(() => { Application.OpenURL(buyUrl); }); // Fhiz Core Change

Player.cs (ca. line 1888 – required for Quests AddOn)

Exchange this code block:
    [Server]
    public void QuestsOnKilled(Entity victim)
    {
        // call OnKilled in all active (not completed) quests
        for (int i = 0; i < quests.Count; ++i)
            if (!quests[i].completed)
                quests[i].OnKilled(this, i, victim);
    }
  …with the code block below:
[Server]
public void QuestsOnKilled(Entity victim)
{
#if _FHIZQUESTS
	UCE_IncreaseQuestKillCounterFor(victim);									// Fhiz Core Change
#else
	// call OnKilled in all active (not completed) quests
    for (int i = 0; i < quests.Count; ++i) {
    	if (!quests[i].completed)
        	quests[i].OnKilled(this, i, victim);
	}
#endif
}
  Exchange this code block:
[Server]
    public void OnDamageDealtToPlayer(Player player)
    {
        // was he innocent?
        if (!player.IsOffender() && !player.IsMurderer())
        {
            // did we kill him? then start/reset murder status
            // did we just attack him? then start/reset offender status
            // (unless we are already a murderer)
            if (player.health == 0) StartMurderer();
            else if (!IsMurderer()) StartOffender();
        }
    }
  …with the code block below:
[Server]
    public void OnDamageDealtToPlayer(Player player)
    {
        // was he innocent?
        if (!player.IsOffender() && !player.IsMurderer())
        {
            // did we kill him? then start/reset murder status
            // did we just attack him? then start/reset offender status
            // (unless we are already a murderer)
            if (player.health == 0) {
            	StartMurderer();
#if _FHIZQUESTS
            	QuestsOnKilled(player);											// Fhiz Core Change
#endif
            } else if (!IsMurderer()) StartOffender();
        }
    }
 

NPC.cs (ca. line 58 – required for Quests AddOn)

in the codeblock:

//overlays //////////////////////////////////////////////////
protected override void UpdateOverlays()
{
   base.UpdateOverlays();
   
   if (questOverlay != null)
   {
     find local player (null while in character selection)
     Player player = Utils.ClientLocalPlayer();
     if (player != null)
     {
        if(quests.Any(q => player.CanCompleteQuest(q.name)))
           questOverlay.text = "!";
        else if (quests.Any(player.CanAcceptQuest))
           questOverlay.text = "?";
        else 
            questOverlay.text = "";
     }
   }
}

  comment out the following lines

//overlays //////////////////////////////////////////////////
protected override void UpdateOverlays()
{
   base.UpdateOverlays();
   
   /*if (questOverlay != null)
   {
     find local player (null while in character selection)
     Player player = Utils.ClientLocalPlayer();
     if (player != null)
     {
        if(quests.Any(q => player.CanCompleteQuest(q.name)))
           questOverlay.text = "!";
        else if (quests.Any(player.CanAcceptQuest))
           questOverlay.text = "?";
        else 
            questOverlay.text = "";
     }
   }*/
}
 

Player.cs (ca. line 1479 – required for EquipmentStances and other AddOns)

Exchange this code block:
void OnEquipmentChanged(SyncListItemSlot.Operation op, int index)
{
	// update the model
	RefreshLocation(index);
}
…with the code block below:
void OnEquipmentChanged(SyncListItemSlot.Operation op, int index)
{
	// update the model
	RefreshLocation(index);
	
	// addon system hooks
	Utils.InvokeMany(typeof(Player), this, "OnEquipmentChanged_"); // Fhiz Core Change
}

Player.cs (ca. line 1561 – required for PvP Zone AddOn)

Exchange this code block:
// CanAttack check
// we use 'is' instead of 'GetType' so that it works for inherited types too
public override bool CanAttack(Entity entity)
{
	return base.CanAttack(entity) &&
		   (entity is Monster ||
			entity is Player ||
			(entity is Pet && entity != activePet));
}
…with the code block below:
// CanAttack check
// we use 'is' instead of 'GetType' so that it works for inherited types too
public override bool CanAttack(Entity entity)
{
	return base.CanAttack(entity) &&
		   (entity is Monster ||
			entity is Player ||
			(entity is Pet && entity != activePet))
			&& UCE_CanAttack(entity)					// Fhiz Core Change
			;
}

Monster.cs (ca. line 547 – required for PvP Zone AddOn

Exchange this code block:
// CanAttack check
// we use 'is' instead of 'GetType' so that it works for inherited types too
public override bool CanAttack(Entity entity)
{
	return base.CanAttack(entity) &&
		   (entity is Player ||
			entity is Pet);
}
…with the code block below:
// CanAttack check
// we use 'is' instead of 'GetType' so that it works for inherited types too
public override bool CanAttack(Entity entity)
{
	return base.CanAttack(entity) &&
		   (entity is Player ||
		   	entity is Monster ||
			entity is Pet) &&
			UCE_CanAttack(entity)						// Fhiz Core Change
			;
}

Player.cs (ca. line 2893 – required for NpcRestrictions AddOn)

Exchange the following line…
else if (entity is Npc && entity.health > 0)
…completely with this line:
else if (UCE_SelectionHandling_Npc(entity)) // Fhiz Core Change

Player.cs (ca. line 2900 – required for LootRules AddOn)

Exchange the following line…
else if (entity is Monster && entity.health == 0)
…completely with this line:
else if (UCE_SelectionHandling_DeadMonster(entity)) // Fhiz Core Change

UCE_AttributesLib.cs (inside the Attributes AddOn Scripts folder – required for Attributes AddOn)

Remove this comment by completely deleting it:
/*
and this one:
*/

Player.cs (starts ca. line 81 – required for Attributes AddOn)

Exchange this code block:
	// health
    public override int healthMax
    {
        get
        {
            // calculate equipment bonus
            int equipmentBonus = (from slot in equipment
                                  where slot.amount > 0
                                  select ((EquipmentItem)slot.item.data).healthBonus).Sum();

            // calculate strength bonus (1 strength means 1% of hpMax bonus)
            int attributeBonus = Convert.ToInt32(_healthMax.Get(level) * (strength * 0.01f));

            // base (health + buff) + equip + attributes
            return base.healthMax + equipmentBonus + attributeBonus;
        }
    }
…with the code block below:

	// health
    public override int healthMax
    {
        get
        {
            // calculate equipment bonus
            int equipmentBonus = (from slot in equipment
                                  where slot.amount > 0
                                  select ((EquipmentItem)slot.item.data).healthBonus).Sum();
#if _FHIZATTRIBUTES
            MutableWrapper attrBonus <int> = new MutableWrapper<int>(0);;
            Utils.InvokeMany(typeof(Player), this, "OnHealthMax_", attrBonus);
            return base.healthMax + equipmentBonus + attrBonus.Value;
#else
			 // calculate strength bonus (1 strength means 1% of hpMax bonus)
            int attributeBonus = Convert.ToInt32(_healthMax.Get(level) * (strength * 0.01f));
            // base (health + buff) + equip + attributes
            return base.healthMax + equipmentBonus + attributeBonus;
#endif
        }
    }

Player.cs (starts ca. line 81)

Exchange this code block:
  	// mana
    public override int manaMax
    {
        get
        {
            // calculate equipment bonus
            int equipmentBonus = (from slot in equipment
                                  where slot.amount > 0
                                  select ((EquipmentItem)slot.item.data).manaBonus).Sum();

            // calculate intelligence bonus (1 intelligence means 1% of hpMax bonus)
            int attributeBonus = Convert.ToInt32(_manaMax.Get(level) * (intelligence * 0.01f));

            // base (mana + buff) + equip + attributes
            return base.manaMax + equipmentBonus + attributeBonus;
        }
    }
…with the code block below:
	// mana
    public override int manaMax
    {
        get
        {
            // calculate equipment bonus
            int equipmentBonus = (from slot in equipment
                                  where slot.amount > 0
                                  select ((EquipmentItem)slot.item.data).manaBonus).Sum();
#if _FHIZATTRIBUTES
            MutableWrapper attrBonus<int> = new MutableWrapper<int>(0);
            Utils.InvokeMany(typeof(Player), this, "OnManaMax_", attrBonus);
            return base.manaMax + equipmentBonus + attrBonus.Value;
#else
			// calculate intelligence bonus (1 intelligence means 1% of hpMax bonus)
            int attributeBonus = Convert.ToInt32(_manaMax.Get(level) * (intelligence * 0.01f));
            // base (health + buff) + equip + attributes
            return base.manaMax + equipmentBonus + attributeBonus;
#endif
        }
    }

Player.cs (starts ca. line 81)

Exchange this code block:
	// damage
    public override int damage
    {
        get
        {
            // calculate equipment bonus
            int equipmentBonus = (from slot in equipment
                                  where slot.amount > 0
                                  select ((EquipmentItem)slot.item.data).damageBonus).Sum();

            // return base (damage + buff) + equip
            return base.damage + equipmentBonus;
        }
    }
…with the code block below:
// damage
    public override int damage
    {
        get
        {
            // calculate equipment bonus
            int equipmentBonus = (from slot in equipment
                                  where slot.amount > 0
                                  select ((EquipmentItem)slot.item.data).damageBonus).Sum();
#if _FHIZATTRIBUTES
            MutableWrapper attrBonus<int> = new MutableWrapper<int>(0);
            Utils.InvokeMany(typeof(Player), this, "OnCalcDamage_", attrBonus);
            return base.damage + equipmentBonus + attrBonus.Value;
#else
            // return base (damage + buff) + equip
            return base.damage + equipmentBonus;
#endif
        }
    }

Player.cs (starts ca. line 81)

Exchange this code block:
	// defense
    public override int defense
    {
        get
        {
            // calculate equipment bonus
            int equipmentBonus = (from slot in equipment
                                  where slot.amount > 0
                                  select ((EquipmentItem)slot.item.data).defenseBonus).Sum();

            // return base (defense + buff) + equip
            return base.defense + equipmentBonus;
        }
    }
…with the code block below:
	// defense
    public override int defense
    {
        get
        {
            // calculate equipment bonus
            int equipmentBonus = (from slot in equipment
                                  where slot.amount > 0
                                  select ((EquipmentItem)slot.item.data).defenseBonus).Sum();
#if _FHIZATTRIBUTES
            MutableWrapper attrBonus<int> = new MutableWrapper<int>(0);
            Utils.InvokeMany(typeof(Player), this, "OnCalcDefense_", attrBonus);
            return base.damage + equipmentBonus + attrBonus.Value;
#else
            // return base (defense + buff) + equip
            return base.defense + equipmentBonus;
#endif
        }
    }

Player.cs (starts ca. line 81)

Exchange this code block:
	// block
    public override float blockChance
    {
        get
        {
            // calculate equipment bonus
            float equipmentBonus = (from slot in equipment
                                    where slot.amount > 0
                                    select ((EquipmentItem)slot.item.data).blockChanceBonus).Sum();

            // return base (blockChance + buff) + equip
            return base.blockChance + equipmentBonus;
        }
    }
…with the code block below:
	// block
    public override float blockChance
    {
        get
        {
            // calculate equipment bonus
            float equipmentBonus = (from slot in equipment
                                    where slot.amount > 0
                                    select ((EquipmentItem)slot.item.data).blockChanceBonus).Sum();
#if _FHIZATTRIBUTES
            MutableWrapper attrBonus <float>= new MutableWrapper<float>(0);
            Utils.InvokeMany(typeof(Player), this, "OnCalcBlock_", attrBonus);
            return base.blockChance + equipmentBonus + attrBonus.Value;
#else
            // return base (blockChance + buff) + equip
            return base.blockChance + equipmentBonus;
#endif
        }
    }

Player.cs (starts ca. line 81)

Exchange this code block:
	// crit
    public override float criticalChance
    {
        get
        {
            // calculate equipment bonus
            float equipmentBonus = (from slot in equipment
                                    where slot.amount > 0
                                    select ((EquipmentItem)slot.item.data).criticalChanceBonus).Sum();

            // return base (criticalChance + buff) + equip
            return base.criticalChance + equipmentBonus;
        }
    }
…with the code block below:
	// crit
    public override float criticalChance
    {
        get
        {
            // calculate equipment bonus
            float equipmentBonus = (from slot in equipment
                                    where slot.amount > 0
                                    select ((EquipmentItem)slot.item.data).criticalChanceBonus).Sum();
#if _FHIZATTRIBUTES
            MutableWrapper attrBonus<float> = new MutableWrapper<float>(0);
            Utils.InvokeMany(typeof(Player), this, "OnCalcCritical_", attrBonus);
            return base.criticalChance + equipmentBonus + attrBonus.Value;
#else
            // return base (criticalChance + buff) + equip
            return base.criticalChance + equipmentBonus;
#endif 
        }
    }

EquipmentItem.cs (ca. line 5 – required for Attributes AddOn)

Exchange this code block:
public class EquipmentItem : UsableItem
…with the code block below (adds the partial keyword):
public partial class EquipmentItem : UsableItem

BonusSkill.cs (ca. line 18 – required for Attributes AddOn)

Just below this line:
public LevelBasedFloat bonusSpeed; // can be negative too
…insert this new line (add it, do not delete/replace anything):
public UCE_AttributeModifier[] UCE_AttributeModifiers = {  };

(c) Fhizban

All "Latest" AddOns are compatible with uMMORPG3d 1.146 Dismiss