Beispiel #1
0
        private static void DestroyItemForGold(PlaceableEvents.OnDisturbed obj)
        {
            NwPlayer pc = (NwPlayer)obj.Disturber;

            if (obj.DisturbedItem.BaseItemType == BaseItemType.Gold)
            {
                GiveGoldEqually(pc, obj.DisturbedItem.StackSize);
                CloneDestroy(obj, pc);
            }
            else if (obj.DisturbedItem.HasInventory)
            {
                pc.FloatingTextString($"{pc.Name} cannot sell inventory items {pc.Name.ColorString(Color.WHITE)}!".ColorString(Color.ORANGE));
                CloneDestroy(obj, pc);
            }
            else if (obj.DisturbedItem.PlotFlag)
            {
                pc.FloatingTextString($"{pc.Name} cannot sell plot items {pc.Name.ColorString(Color.WHITE)}!".ColorString(Color.ORANGE));
                CloneDestroy(obj, pc);
            }
            else
            {
                int itemValue = obj.DisturbedItem.GoldValue / 10 > 0 ? obj.DisturbedItem.GoldValue / 10 : 1;
                pc.FloatingTextString($"{pc.Name} sold {pc.Name.ColorString(Color.WHITE)} for {itemValue}!".ColorString(Color.GREEN));
                GiveGoldEqually(pc, itemValue);
            }
        }
Beispiel #2
0
 private static void CloneDestroy(PlaceableEvents.OnDisturbed obj, NwPlayer pc) => obj.DisturbedItem.Clone(pc).Destroy();