WeaponBuilder class
Features
What is it?
A class that makes it easier for plugin developers to create highly customizable weapons.
NO, IT'S NOT A FUCKING PLUGIN
How to use?
Just add a class to your project and paste the source code (below) in there.
Change 'YourNameSpace' to your namespace.
Example:
Result: (Notice the silencer, Heartbeat & Scope)
![[Image: 3f9cf798.png]](http://speedcap.net/img/ccac0846e7802506b1c61ffc445a554a/3f9cf798.png)
![[Image: b818695e.png]](http://speedcap.net/img/ccac0846e7802506b1c61ffc445a554a/b818695e.png)
Sourcecode:
Credits
- @Yamato - Attachment list
- @Nukem - Some Intelz over how to do camo
Features
- Supports up to 3 attachments each weapon
- Camo
- Reticle's
- Choose from over 30 different attachments
- Choose from 14 different camo's (Including Marine and Winter, the hidden camo's)
- Sniper support (MW3 handles sniper attachments really weirdly)
What is it?
A class that makes it easier for plugin developers to create highly customizable weapons.
NO, IT'S NOT A FUCKING PLUGIN
How to use?
Just add a class to your project and paste the source code (below) in there.
Change 'YourNameSpace' to your namespace.
Example:
Code:
cl.Other.PrimaryWeapon = GetWeapon(WeaponBuilder.CreateWeapon("iw5_scar_mp", WeaponBuilder.Attachment.reflex, WeaponBuilder.Attachment.silencer, WeaponBuilder.Camo.Gold, WeaponBuilder.Reticle.Delta, WeaponBuilder.Attachment.heartbeat));Result: (Notice the silencer, Heartbeat & Scope)
![[Image: 3f9cf798.png]](http://speedcap.net/img/ccac0846e7802506b1c61ffc445a554a/3f9cf798.png)
![[Image: b818695e.png]](http://speedcap.net/img/ccac0846e7802506b1c61ffc445a554a/b818695e.png)
Sourcecode:
Code:
using System;
using System.Collections.Generic;
using System.Text;
//Modded WeaponBuilder class from RTD (rollthedice.googlecode.com)
//By JariZ
namespace YourNameSpace
{
class WeaponBuilder
{
public enum Camo {
None = 00,
Classic = 01,
Snow = 02,
Multicam = 03,
DigitalUrban = 04,
Hex = 05,
Choco = 06,
Snake = 07,
Blue = 08,
Red = 09,
Autumn = 10,
Gold = 11,
Marine = 12,
Winter = 13
};
public enum Reticle { None = 0, TargetDot = 1, Delta = 2, UDot = 3, MilDot = 4, Omega = 5, Lambda = 6 };
public enum Attachment
{
none,
acog,
acogsmg,
reflex,
reflexsmg,
reflexlmg,
silencer,
silencer02,
silencer03,
grip,
gl,
gp25,
m320,
akimbo,
thermal,
thermalsmg,
shotgun,
heartbeat,
fmj,
rof,
xmags,
eotech,
eotechsmg,
eotechlmg,
tactical,
hamrhybrid,
hybrid,
zoomscope,
scope,
scopevz
};
static string[] snipers = { "barrett", "rsass", "dragunov", "msr", "l96a1", "as50" };
static string remove(string source, string needle)
{
return source.Replace(needle, "");
}
public static string CreateWeapon(string name, Attachment Attachment1)
{
return CreateWeapon(name, Attachment1, Attachment.none, Camo.None, Reticle.None, Attachment.none);
}
public static string CreateWeapon(string name)
{
return CreateWeapon(name, Attachment.none, Attachment.none, Camo.None, Reticle.None, Attachment.none);
}
public static string CreateWeapon(string name, Attachment Attachment1, Attachment Attachment2)
{
return CreateWeapon(name, Attachment1, Attachment2, Camo.None, Reticle.None, Attachment.none);
}
public static string CreateWeapon(string name, Attachment Attachment1, Attachment Attachment2, Camo Camo)
{
return CreateWeapon(name, Attachment1, Attachment2, Camo, Reticle.None, Attachment.none);
}
public static string CreateWeapon(string name, Attachment Attachment1, Attachment Attachment2, Camo Camo, Reticle Reticle)
{
return CreateWeapon(name, Attachment1, Attachment2, Camo, Reticle, Attachment.none);
}
public static string CreateWeapon(string name, Attachment Attachment1, Attachment Attachment2, Camo Camo, Reticle Reticle, Attachment Attachment3)
{
if (name.Substring(0, 4) != "iw5_" && name.EndsWith("_mp"))
return name;
else if (name.Substring(0, 4) != "iw5_" && !name.EndsWith("_mp"))
return name + "_mp";
string basename = remove(remove(name, "iw5_"), "_mp"); // remove iw5 & mp
bool sniper = false;
foreach (string s in snipers)
{
if (s == basename)
{
sniper = true;
break;
}
}
string a1 = Attachment1.ToString();
if (sniper)
a1 = basename + a1;
string a2;
if (Attachment2 != Attachment.none)
{
a2 = Attachment2.ToString();
if (sniper)
a2 = basename + a2;
a2 += "_";
}
else a2 = "";
string a3;
if (Attachment3 != Attachment.none)
{
a3 = Attachment3.ToString();
if (sniper)
a3 = basename + a3;
a3 += "_";
}
else a3 = "";
string fCamo = ((int)Camo).ToString();
if (((int)Camo).ToString().Length == 1) fCamo = "0" + fCamo;
string x = string.Format("iw5_{0}_mp_{1}_{2}{3}camo{4}_scope{5}", basename, a1, a2, a3, fCamo, (int)Reticle);
return x;
}
}
}Credits
- @Yamato - Attachment list
- @Nukem - Some Intelz over how to do camo


![[Image: 30xhrep.png]](http://i48.tinypic.com/30xhrep.png)
