//Stolen Inventory Functions void AddToStolenInventory(CharacterBody body, GameObject obj, ItemIndex item, int count) { if (body.master) { body.AddBuff(Thief.BuffDef.buffIndex); StolenInventory inventory = obj.GetComponent <StolenInventory>(); if (!inventory) { obj.AddComponent <StolenInventory>().amount[(int)item] += count; } else { inventory.amount[(int)item] += count; } } }
void DropStolenInventory(CharacterBody body) { if (body.master) { GameObject obj = body.master.gameObject; StolenInventory inventory = obj.GetComponent <StolenInventory>(); if (inventory) { for (int i = 0; i < inventory.amount.Length; i++) { if (inventory.amount[i] > 0) { DropItem(body.master, (ItemIndex)i, inventory.amount[i], new Vector3(0f, 0f, 0f), false); obj.AddComponent <StolenInventory>().amount[i] = 0; } } } body.RemoveBuff(Thief.BuffDef.buffIndex); } }
void UpdateThiefBuff(CharacterBody body) { if (body.master) { int buffcount = 0; GameObject obj = body.master.gameObject; StolenInventory inventory = obj.GetComponent <StolenInventory>(); if (inventory) { for (int i = 0; i < inventory.amount.Length; i++) { if (inventory.amount[i] > 0) { buffcount += inventory.amount[i]; } } body.RemoveBuff(Thief.BuffDef.buffIndex); for (; body.GetBuffCount(Thief.BuffDef.buffIndex) != buffcount;) { body.AddBuff(Thief.BuffDef.buffIndex); } } } }