You repatched thr assembly right? Ok well if so, that means that There is something wrong in the IPM calls.
Sent From My Samsung Galaxy S4
Sent From My Samsung Galaxy S4
Well the plugins I have all work, Just not the hook ResourceSpawned()You repatched thr assembly right? Ok well if so, that means that There is something wrong in the IPM calls.
Sent From My Samsung Galaxy S4
Yeah. I mean that ironpython doesnt call the hook.Well the plugins I have all work, Just not the hook ResourceSpawned()
@Jakkee
def On_ResourceSpawn(self, ResourceTarget):
ResourceTarget is a rust class, you might need to look in the Assembly.
Jakkee Why u do dis =(Debug works but the code doesn't :/
CONSOLE: http://prntscr.com/81swes
Python:def On_ResourceSpawned(self, ResourceTarget): Util.Log("RESOURCE SPAWNED")
WutJakkee Why u do dis =(
It's ResourceSpawn =( xdddddd
Hahah that's just the void's name.Wut
Why is it ResourceSpawned in Fougerite hooks?
Works? xdI originally tried On_ResourceSpawn then it was failing to callback, So I looked in the .dll and it said it was ResourcedSpawned
Had to do a fresh reinstall. Works nowWorks? xd
__title__ = 'GatherPlus'
__author__ = 'Jakkee'
__version__ = '4.2'
import clr
clr.AddReferenceByPartialName("Fougerite")
import Fougerite
class GatherPlus:
def On_PluginInit(self):
Util.ConsoleLog(__title__ + " by " + __author__ + " Version: " + __version__ + " loaded.", False)
if not Plugin.IniExists("Settings"):
Plugin.CreateIni("Settings")
ini = Plugin.GetIni("Settings")
ini.AddSetting("GatherRate", "Wood", "2")
ini.AddSetting("GatherRate", "Sulfur Ore", "2")
ini.AddSetting("GatherRate", "Metal Ore", "2")
ini.AddSetting("GatherRate", "Stones", "2")
ini.AddSetting("GatherRate", "Leather", "2")
ini.AddSetting("GatherRate", "Cloth", "2")
ini.AddSetting("GatherRate", "RawChickenBreast", "2")
ini.AddSetting("GatherRate", "AnimalFat", "2")
ini.AddSetting("GatherRate", "Blood", "2")
ini.AddSetting("TotalResources", "MutantBear", "5")
ini.AddSetting("TotalResources", "MutantWolf", "3")
ini.AddSetting("TotalResources", "Bear", "5")
ini.AddSetting("TotalResources", "Wolf", "3")
ini.AddSetting("TotalResources", "Chicken", "2")
ini.AddSetting("TotalResources", "Rabbit", "2")
ini.AddSetting("TotalResources", "Boar", "4")
ini.AddSetting("TotalResources", "Stag", "5")
ini.AddSetting("TotalResources", "WoodPile", "100")
ini.AddSetting("TotalResources", "SulfurOre", "20")
ini.AddSetting("TotalResources", "MetalOre", "20")
ini.AddSetting("TotalResources", "StoneOre", "20")
ini.Save()
DataStore.Flush("GatherRate")
ini = Plugin.GetIni("Settings")
for key in ini.EnumSection("GatherRate"):
number = self.check(ini.GetSetting("GatherRate", key))
if number is not None:
DataStore.Add("GatherRate", key, number)
continue
else:
Util.Log("GatherPlus: ERROR setting GatherRate for: " + key + ". Setting is not a number!")
continue
for key in ini.EnumSection("TotalResources"):
number = self.check(ini.GetSetting("TotalResources", key))
if number is not None:
DataStore.Add("GatherRate", key, number)
continue
else:
Util.Log("GatherPlus: ERROR setting TotalResource for: " + key + ". Setting is not a number!")
continue
def check(self, arg):
try:
i = int(arg)
if i is not None:
return i
else:
return None
except:
return None
def On_Command(self, Player, cmd, args):
if cmd == "woodrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "Wood", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Wood")
DataStore.Add("GatherRate", "Wood", int(ini.GetSetting("Config", "Wood")))
Player.Message(str(name) + " is the new gather rate for Wood!")
else:
Player.Message("usage: /woodrate [Number]")
else:
Player.Message("usage: /woodrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "sulfurrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "Sulfur Ore", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Sulfur")
DataStore.Add("GatherRate", "Sulfur", int(ini.GetSetting("Config", "Sulfur Ore")))
Player.Message(str(name) + " is the new gather rate for Sulfur Ore!")
else:
Player.Message("usage: /sulfurrate [Number]")
else:
Player.Message("usage: /sulfurrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "metalrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "Metal Ore", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Metal")
DataStore.Add("GatherRate", "Metal", int(ini.GetSetting("Config", "Metal Ore")))
Player.Message(str(name) + " is the new gather rate for Metal Ore!")
else:
Player.Message("usage: /metalrate [Number]")
else:
Player.Message("usage: /metalrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "stonesrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "Stones", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Stones")
DataStore.Add("GatherRate", "Stones", int(ini.GetSetting("Config", "Stones")))
Player.Message(str(name) + " is the new gather rate for Stones!")
else:
Player.Message("usage: /stonesrate [Number]")
else:
Player.Message("usage: /stonesrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "leatherrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "Leather", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Leather")
DataStore.Add("GatherRate", "Leather", int(ini.GetSetting("Config", "Leather")))
Player.Message(str(name) + " is the new gather rate for Leather!")
else:
Player.Message("usage: /leatherrate [Number]")
else:
Player.Message("usage: /leatherrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "clothrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "Cloth", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Cloth")
DataStore.Add("GatherRate", "Cloth", int(ini.GetSetting("Config", "Cloth")))
Player.Message(str(name) + " is the new gather rate for Cloth!")
else:
Player.Message("usage: /clothrate [Number]")
else:
Player.Message("usage: /clothrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "chickenrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "RawChickenBreast", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Chicken")
DataStore.Add("GatherRate", "Chicken", int(ini.GetSetting("Config", "RawChickenBreast")))
Player.Message(str(name) + " is the new gather rate for Raw Chicken Breast!")
else:
Player.Message("usage: /chickenrate [Number]")
else:
Player.Message("usage: /chickenrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "fatrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "AnimalFat", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Fat")
DataStore.Add("GatherRate", "Fat", int(ini.GetSetting("Config", "AnimalFat")))
Player.Message(str(name) + " is the new gather rate for Animal Fat!")
else:
Player.Message("usage: /fatrate [Number]")
else:
Player.Message("usage: /fatrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "bloodrate":
if Player.Admin:
if len(args) == 1:
name = self.check(args[0])
if name is not None:
ini = Plugin.GetIni("Settings")
ini.AddSetting("Config", "Blood", str(name))
ini.Save()
DataStore.Remove("GatherRate", "Blood")
DataStore.Add("GatherRate", "Blood", int(ini.GetSetting("Config", "Blood")))
Player.Message(str(name) + " is the new gather rate for Blood Bags!")
else:
Player.Message("usage: /bloodrate [Number]")
else:
Player.Message("usage: /bloodrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
elif cmd == "gatherhelp":
if Player.Admin:
Player.Message("/woodrate [Number]")
Player.Message("/sulfurrate [Number]")
Player.Message("/metalrate [Number]")
Player.Message("/stonesrate [Number]")
Player.Message("/leatherrate [Number]")
Player.Message("/clothrate [Number]")
Player.Message("/chickenrate [Number]")
Player.Message("/bloodrate [Number]")
Player.Message("/fatrate [Number]")
else:
Player.MessageFrom("GatherPlus", "You're not allowed to use this command!")
def On_ResourceSpawn(self, ResourceTarget):
if str(ResourceTarget) == "MutantBear(Clone) (ResourceTarget)":
#DEBUG
amount = DataStore.Get("GatherRate", "MutantBear")
Util.Log("MutantBear")
Util.Log(str(amount))
ResourceTarget.startingTotal = amount
elif str(ResourceTarget) == "MutantWolf(Clone) (ResourceTarget)":
Util.Log("MutantWolf")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "MutantWolf")
elif str(ResourceTarget) == "Chicken_A(Clone) (ResourceTarget)":
Util.Log("Chicken")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "Chicken")
elif str(ResourceTarget) == "Rabbit_A(Clone) (ResourceTarget)":
Util.Log("Rabbit")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "Rabbit")
elif str(ResourceTarget) == "Boar_A(Clone) (ResourceTarget)":
Util.Log("Boar")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "Boar")
elif str(ResourceTarget) == "Stag_A(Clone) (ResourceTarget)":
Util.Log("Stag")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "Stag")
elif str(ResourceTarget) == "Wolf(Clone) (ResourceTarget)":
Util.Log("Wolf")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "Wolf")
elif str(ResourceTarget) == "Bear(Clone) (ResourceTarget)":
Util.Log("Bear")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "Bear")
elif str(ResourceTarget) == "WoodPile(Clone) (ResourceTarget)":
Util.Log("MWoodPile")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "WoodPile")
elif str(ResourceTarget) == "Ore1(Clone) (ResourceTarget)":
Util.Log("SulfurOre")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "SulfurOre")
elif str(ResourceTarget) == "Ore2(Clone) (ResourceTarget)":
Util.Log("MetalOre")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "MetalOre")
elif str(ResourceTarget) == "Ore3(Clone) (ResourceTarget)":
Util.Log("StoneOre")
ResourceTarget.startingTotal = DataStore.Get("GatherRate", "StoneOre")
else:
Util.Log("GatherPlus Debug: Unknown ResourceTarget [" + str(ResourceTarget) + "]")
Util.Log("Ignore this message if you have spawned in something yourself!")
def On_PlayerGathering(self, Player, GatherEvent):
if GatherEvent.Item == "Wood":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Wood")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
elif GatherEvent.Item == "Sulfur Ore":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Sulfur")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
elif GatherEvent.Item == "Metal Ore":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Metal")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
elif GatherEvent.Item == "Stones":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Stones")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
elif GatherEvent.Item == "Leather":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Leather")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
elif GatherEvent.Item == "Cloth":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Cloth")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
elif GatherEvent.Item == "Raw Chicken Breast":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Chicken")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
elif GatherEvent.Item == "Animal Fat":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Fat")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
elif GatherEvent.Item == "Blood":
if Player.Inventory.FreeSlots > 0:
rate = DataStore.Get("GatherRate", "Blood")
gathered = GatherEvent.Quantity * (rate-1)
Player.Inventory.AddItem(GatherEvent.Item, gathered)
Player.InventoryNotice(str(gathered) + " x " + GatherEvent.Item)
elif Player.Inventory.FreeSlots == 0:
GatherEvent.Quantity = 0
Player.Notice("Inventory full, can't gather")
def check(self, arg):
try:
i = int(arg)
if i is not None:
return i
else:
return None
except:
return None
Error in plugin GatherPlus:
Traceback (most recent call last):
File "<string>", line 59, in check
TypeError: Multiple targets could match: int(type, IList[Byte]), int(type, object), int(type, Extensible[float])
Try logging the argAnswer lies here:
Error:Python:def check(self, arg): try: i = int(arg) if i is not None: return i else: return None except: return None
doing float() just throws Object reference errorsCode:Error in plugin GatherPlus: Traceback (most recent call last): File "<string>", line 59, in check TypeError: Multiple targets could match: int(type, IList[Byte]), int(type, object), int(type, Extensible[float])
Well I guess da work is meinI think that will never happen![]()
What do you mean? Did you print the value?ResourceTarget.startingTotal doesn't seem to effect the total resources
I think I know why. I might forgot to update thr patcher code because the last time I sent you the debug thing I was on my laptop.Plugin.Log("startingTotals", str(ResourceTarget) + " = " + str(ResourceTarget.startingTotal))