Beispiel #1
0
        public void WeaponImageReloadAmmoClip(coItemData thisobj, coShapeBase obj, int slot)
        {
            string ammoname = ((coItemData)thisobj["ammo"]).getName();

            if (thisobj != obj.getMountedImage(slot))
            {
                return;
            }

            if (!thisobj.isField("clip"))
            {
                return;
            }
            if (ShapeBaseShapeBaseGetInventory(obj, thisobj["clip"]) > 0)
            {
                ShapeBaseShapeBaseDecInventory(obj, thisobj["clip"], 1);

                ShapeBaseShapeBaseSetInventory(obj, thisobj["ammo"], thisobj["ammo.maxInventory"].AsInt());

                obj.setImageAmmo(slot, true);
            }
            else
            {
                int amountInPocket = obj["remaining" + ((coItem)thisobj["ammo"]).getName()].AsInt();
                if (amountInPocket > 0)
                {
                    obj["remaining" + ((coItem)thisobj["ammo"]).getName()] = "0";

                    ShapeBaseShapeBaseSetInventory(obj, thisobj["ammo"], amountInPocket);
                    obj.setImageAmmo(slot, true);
                }
            }
        }
Beispiel #2
0
        public int ShapeBaseShapeBaseMaxInventory(coShapeBase thisobj, coItemData data)
        {
            if (data.isField("clip"))
            {
                return(data["maxInventory"].AsInt());
            }

            return((( coSimDataBlock)thisobj.getDataBlock())["maxInv[" + data.getName() + "]"].AsInt());
        }