OnBuildingBlockUpgrade does not seem to be valid anymore and I cannot find it or an equivalent in the assembly.
Solved OnBuildingBlockUpgrade changed?
Discussion in 'Rust Discussion' started by Juicifer, Aug 7, 2015.
-
Wulf Community Admin
The hook hasn't changed in the past week or so, it was only deprecated with OnStructureUpgrade being the replacement with the same args.
https://github.com/OxideMod/Oxide/blob/master/Oxide.Game.Rust/RustCore.cs#L1110
Both will still work exactly as before though.
What issue are you having? -
I have been working on trying to keep HuntRPG bug free since the guy stopped working on it quite a while ago. The problem is that upgrading does not give experience anymore to the player.
Code:[HookMethod("OnBuildingBlockDoUpgradeToGrade")] object OnBuildingBlockUpgrade(BuildingBlock buildingBlock, BaseEntity.RPCMessage message, BuildingGrade.Enum grade) { HuntRPGInstance.OnBuildingBlockUpgrade(message.player, buildingBlock, grade); return null; } public void OnBuildingBlockUpgrade(BasePlayer player, BuildingBlock buildingBlock, BuildingGrade.Enum grade) { var items = buildingBlock.blockDefinition.grades[(int) grade].costToBuild; int total = items.Sum(item => (int) item.amount); int experience = (int) Math.Ceiling(UpgradeBuildingTable[grade]*total); ExpGain(RPGInfo(player), experience, player); }
[DOUBLEPOST=1438919014][/DOUBLEPOST]WOOO !! nvm I fixed it.
Code:[HookMethod("OnStructureUpgrade")] object OnStructureUpgrade(BuildingBlock buildingBlock, BasePlayer player, BuildingGrade.Enum grade) { HuntRPGInstance.OnStructureUpgrade(buildingBlock, player, grade); return null; } public void OnStructureUpgrade(BuildingBlock buildingBlock, BasePlayer player, BuildingGrade.Enum grade) { var items = buildingBlock.blockDefinition.grades[(int) grade].costToBuild; int total = items.Sum(item => (int) item.amount); int experience = (int) Math.Ceiling(UpgradeBuildingTable[grade]*total); ExpGain(RPGInfo(player), experience, player); }
Last edited by a moderator: Aug 7, 2015 -
Wulf Community Admin
There is no OnBuildingBlockDoUpgradeToGrade hook, if there was, it was only intended as an internal hook that shouldn't be used by plugins.
Check out the HuntRPG thread for a working, fixed version with improvements by Nogrod though. -
His version does not have this fixed unfortunatly, but it's fine the post above that I made works fine now I managed to get it working.