Advertisement
Drizer

WeaponEditor.cs

Aug 10th, 2012
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.46 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Magic;
  6. namespace PBTrainer
  7. {
  8.     class WeaponEditor
  9.     {
  10.         /*
  11.          * Editor de armas do PointBlank
  12.          * Criado por Drizer
  13.          * (c) 2012
  14.          */
  15.         static uint ReadPointer(BlackMagic bmagic, uint pointerAddr, uint[] offsets, uint nOffset = 0)
  16.         {
  17.             // ler um pointer estático.
  18.             uint currAddr = pointerAddr;
  19.             foreach (uint offset in offsets)
  20.             {
  21.                 try
  22.                 {
  23.                     currAddr = (bmagic.ReadUInt(currAddr)) + offset;
  24.                 }
  25.                 catch (Exception)
  26.                 {
  27.                 };
  28.             };
  29.             return (currAddr) + nOffset;
  30.         }
  31.         public WeaponEditor(BlackMagic magic, uint weapAddr, uint[] offsets)
  32.         {
  33.             // instancia o blackmagic, e o address.
  34.             uint weapPt = ReadPointer(magic, weapAddr, offsets);
  35.             WeaponAddress = weapPt - 8;
  36.             mMagic = magic;
  37.         }
  38.         public uint WeaponAddress;
  39.         private BlackMagic mMagic;
  40.         private int mDamage = -23981;
  41.         private int mWeight = -23981;
  42.         private int mReload = -23981;
  43.         private int mBullets = -23981;
  44.         private int mRecoilV = -23981;
  45.         private int mRecoilH = -23981;
  46.         private int mNoSpread = -23981;
  47.         private int mAcr = -23981;
  48.         public void Update()
  49.         {
  50.             /*
  51.              * Valores exatos (offsets) para a structs das armas.
  52.              * +[8,50,2555,2569,2635,2643,2651,2667]
  53.              */
  54.             if (mDamage != -23981)
  55.             {
  56.                 mMagic.WriteByte(WeaponAddress + 8, (byte)mDamage); // Dano
  57.             };
  58.             if (mWeight != -23981)
  59.             {
  60.                 mMagic.WriteByte(WeaponAddress + 50, (byte)mWeight); // Peso
  61.             }
  62.             if (mReload != -23981)
  63.             {
  64.                 mMagic.WriteByte(WeaponAddress + 2555, (byte)mReload); // Velocidade de recarga
  65.             }
  66.             if (mBullets != -23981)
  67.             {
  68.                 mMagic.WriteByte(WeaponAddress + 2569, (byte)mBullets); // Munição
  69.             }
  70.             if (mRecoilV != -23981)
  71.             {
  72.                 mMagic.WriteByte(WeaponAddress + 2643, (byte)mRecoilV); // Recuo v
  73.             }
  74.             if (mRecoilH != -23981)
  75.             {
  76.                 mMagic.WriteByte(WeaponAddress + 2651, (byte)mRecoilH); // Recuo h
  77.             }
  78.             if (mNoSpread != -23981)
  79.             {
  80.                 mMagic.WriteByte(WeaponAddress + 2635, (byte)mNoSpread); // No Spread
  81.             };
  82.             if (mAcr != -23981)
  83.             {
  84.                 mMagic.WriteByte(WeaponAddress + 2667, (byte)mAcr); // Precisao
  85.             }
  86.         }
  87.         public void SetDamage(int val)
  88.         {
  89.             mDamage = val;
  90.         }
  91.         public void SetWeight(int val)
  92.         {
  93.             mWeight = val;
  94.         }
  95.         public void SetAcr(int val)
  96.         {
  97.             mAcr = val;
  98.         }
  99.         public void SetReloadTime(int val)
  100.         {
  101.             mReload = val;
  102.         }
  103.         public void InfBullets()
  104.         {
  105.             mBullets = 100;
  106.         }
  107.         public void NoRecoil()
  108.         {
  109.             mRecoilH = 0;
  110.             mRecoilV = 0;
  111.         }
  112.         public void NoSpread()
  113.         {
  114.             mNoSpread = 0;
  115.         }
  116.     }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement