Advertisement
Guest User

MapEdit for mw3

a guest
Feb 25th, 2013
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 21.12 KB | None | 0 0
  1. using Addon;
  2. using ns0;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.CompilerServices;
  7. using System.Timers;
  8. namespace MapEdit
  9. {
  10.     public class MapEdit : CPlugin
  11.     {
  12.         public enum DoorDirection
  13.         {
  14.             Up,
  15.             Left,
  16.             Right,
  17.             Down
  18.         }
  19.         [CompilerGenerated]
  20.         private sealed class Class4
  21.         {
  22.             public List<Entity> list_0;
  23.             public Class2 class2_0;
  24.         }
  25.         [CompilerGenerated]
  26.         private sealed class Class5
  27.         {
  28.             public HudElem hudElem_0;
  29.         }
  30.         [CompilerGenerated]
  31.         private sealed class Class6
  32.         {
  33.             public Entity entity_0;
  34.         }
  35.         [CompilerGenerated]
  36.         private sealed class Class7
  37.         {
  38.             public MapEdit.Class6 class6_0;
  39.             public MapEdit.Class5 class5_0;
  40.             public MapEdit.Class4 class4_0;
  41.             public Timer timer_0;
  42.             public Timer timer_1;
  43.             public MapEdit mapEdit_0;
  44.             public void method_0(object sender, ElapsedEventArgs e)
  45.             {
  46.                 if (this.class4_0.class2_0.open && this.class6_0.entity_0.get_OriginZ() - 100f >= this.class4_0.class2_0.Bottom.Z)
  47.                 {
  48.                     Entity expr_4F = this.class6_0.entity_0;
  49.                     expr_4F.set_OriginZ(expr_4F.get_OriginZ() - 100f);
  50.                     Class10.smethod_14(this.class6_0.entity_0, Class10.smethod_12());
  51.                 }
  52.                 this.timer_0.Enabled = false;
  53.             }
  54.             public void method_1(object sender, ElapsedEventArgs e)
  55.             {
  56.                 if (this.class4_0.class2_0.open)
  57.                 {
  58.                     this.class4_0.class2_0.open = false;
  59.                     this.class4_0.class2_0.openTime.Stop();
  60.                     this.class4_0.class2_0.Openingclient = null;
  61.                     this.mapEdit_0.dictionary_0[this.class4_0.list_0] = this.class4_0.class2_0;
  62.                     this.class5_0.hudElem_0.SetString("");
  63.                     this.class4_0.class2_0.closeTime.Reset();
  64.                     this.class4_0.class2_0.closeTime.Start();
  65.                 }
  66.                 this.timer_1.Enabled = false;
  67.             }
  68.         }
  69.         [CompilerGenerated]
  70.         private sealed class Class8
  71.         {
  72.             public MapEdit mapEdit_0;
  73.             public ServerClient serverClient_0;
  74.         }
  75.         [CompilerGenerated]
  76.         private sealed class Class9
  77.         {
  78.             public MapEdit.Class8 class8_0;
  79.             public Timer timer_0;
  80.             public void method_0(object sender, ElapsedEventArgs e)
  81.             {
  82.                 int weapon = this.class8_0.mapEdit_0.GetWeapon("defaultweapon_mp");
  83.                 this.class8_0.serverClient_0.Other.set_WeaponSlot3(weapon);
  84.                 this.class8_0.mapEdit_0.iPrintLnBold("^2Your default weapon is to repair^6 doors", this.class8_0.serverClient_0);
  85.                 this.timer_0.Enabled = false;
  86.             }
  87.         }
  88.         private int int_0;
  89.         private List<Entity> list_0 = new List<Entity>();
  90.         private Dictionary<List<Entity>, Class2> dictionary_0 = new Dictionary<List<Entity>, Class2>();
  91.         private Dictionary<int, Stopwatch> dictionary_1 = new Dictionary<int, Stopwatch>();
  92.         private Dictionary<int, int> dictionary_2 = new Dictionary<int, int>();
  93.         public override void OnPrecache()
  94.         {
  95.             if (base.GetDvar("mapname") == "mp_underground")
  96.             {
  97.                 this.int_0 = Class10.smethod_9("explosions/spark_fall_runner_mp");
  98.             }
  99.             base.OnPrecache();
  100.         }
  101.         public static Vector subract(Vector left, Vector right)
  102.         {
  103.             return new Vector(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
  104.         }
  105.         public static Vector multi(Vector vector, float factor)
  106.         {
  107.             return new Vector(vector.X * factor, vector.Y * factor, vector.Z * factor);
  108.         }
  109.         public static Vector plus(Vector left, Vector right)
  110.         {
  111.             return new Vector(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
  112.         }
  113.         public Entity spawnCrate(Vector test)
  114.         {
  115.             Entity entity = base.SpawnModel("script_model", "com_plasticcase_friendly", test);
  116.             Class10.smethod_14(entity, Class10.smethod_12());
  117.             return entity;
  118.         }
  119.         public Entity spawnCrate(Vector test, Vector angles)
  120.         {
  121.             Entity entity = base.SpawnModel("script_model", "com_plasticcase_friendly", test);
  122.             Class10.smethod_14(entity, Class10.smethod_12());
  123.             if (!(base.GetServerCFG("MapEdit", "angles", "false") == "true"))
  124.             {
  125.             }
  126.             Class10.smethod_7(entity, angles);
  127.             return entity;
  128.         }
  129.         public static double Distance(Vector vec1, Vector vec2)
  130.         {
  131.             return Math.Sqrt(Math.Pow((double)(vec1.X - vec2.X), 2.0) + Math.Pow((double)(vec1.Y - vec2.Y), 2.0) + Math.Pow((double)(vec1.Z - vec2.Z), 2.0));
  132.         }
  133.         public static double Distance(Vector vec1, List<Entity> entities)
  134.         {
  135.             List<double> list = new List<double>();
  136.             foreach (Entity current in entities)
  137.             {
  138.                 list.Add(Math.Sqrt(Math.Pow((double)(vec1.X - current.get_OriginX()), 2.0) + Math.Pow((double)(vec1.Y - current.get_OriginY()), 2.0) + Math.Pow((double)(vec1.Z - current.get_OriginZ()), 2.0)));
  139.             }
  140.             list.Sort();
  141.             return list.ToArray()[0];
  142.         }
  143.         public static Vector VectorToAngles(Vector vec1, Vector vec2)
  144.         {
  145.             float num = vec1.X - vec2.X;
  146.             float num2 = vec1.Z - vec2.Z;
  147.             float num3 = (float)Math.Pow((double)num, 2.0);
  148.             float num4 = (float)Math.Pow((double)num2, 2.0);
  149.             float num5 = num3 + num4;
  150.             float arg_62_0 = (float)Math.Acos((double)(num3 + num4 - num5) / 2.0 * (double)num * (double)num2);
  151.             float num6 = vec1.Y - vec2.Y;
  152.             float num7 = (float)Math.Pow((double)num6, 2.0);
  153.             float num8 = num7 + num4;
  154.             float arg_AB_0 = (float)Math.Acos((double)(num7 + num4 - num8) / 2.0 * (double)num6 * (double)num2);
  155.             return null;
  156.         }
  157.         public void CreateRandomWeaponBox(Vector SpawnPoint)
  158.         {
  159.             this.spawnCrate(SpawnPoint);
  160.         }
  161.         public void createfloor(Vector corner1, Vector corner2)
  162.         {
  163.             float num = corner1.X - corner2.X;
  164.             if (num < 0f)
  165.             {
  166.                 num *= -1f;
  167.             }
  168.             float num2 = corner1.Y - corner2.Y;
  169.             if (num2 < 0f)
  170.             {
  171.                 num2 *= -1f;
  172.             }
  173.             int num3 = (int)Math.Round((double)(num / 50f), 0);
  174.             int num4 = (int)Math.Round((double)(num2 / 30f), 0);
  175.             Vector vector = MapEdit.subract(corner2, corner1);
  176.             Vector vector2 = new Vector(vector.X / (float)num3, vector.Y / (float)num4, 0f);
  177.             for (int i = 0; i < num3; i++)
  178.             {
  179.                 for (int j = 0; j < num4; j++)
  180.                 {
  181.                     this.spawnCrate(MapEdit.plus(MapEdit.plus(corner1, MapEdit.multi(new Vector(vector2.X, 0f, 0f), (float)i)), MapEdit.multi(new Vector(0f, vector2.Y, 0f), (float)j)));
  182.                 }
  183.             }
  184.         }
  185.         public override void OnPlayerDisconnect(ServerClient Client)
  186.         {
  187.             this.dictionary_2.Remove(Client.get_ClientNum());
  188.             base.OnPlayerDisconnect(Client);
  189.         }
  190.         public static Vector minus(Vector left, Vector right)
  191.         {
  192.             return new Vector(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
  193.         }
  194.         public float DistanceTo(Vector other, Vector first)
  195.         {
  196.             Vector vec = MapEdit.minus(other, first);
  197.             return this.Length(vec);
  198.         }
  199.         public float Length(Vector vec)
  200.         {
  201.             return (float)Math.Sqrt((double)(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z));
  202.         }
  203.         public void CreateRamp(Vector top, Vector bottom)
  204.         {
  205.             float num = this.DistanceTo(bottom, top);
  206.             int num2 = (int)Math.Ceiling((double)(num / 30f));
  207.             Vector vector = new Vector((top.X - bottom.X) / (float)num2, (top.Y - bottom.Y) / (float)num2, (top.Z - bottom.Z) / (float)num2);
  208.             Vector vector2 = MapEdit.VectorToAngles(MapEdit.minus(top, bottom));
  209.             Vector angles = new Vector(vector2.Z, vector2.Y + 90f, vector2.X);
  210.             for (int i = 0; i <= num2; i++)
  211.             {
  212.                 this.spawnCrate(MapEdit.plus(bottom, new Vector(vector.X * (float)i, vector.Y * (float)i, vector.Z * (float)i)), angles);
  213.             }
  214.         }
  215.         public void CreateWall(Vector top, Vector bottom)
  216.         {
  217.             int arg_1A_0 = (int)Math.Round((double)(MapEdit.minus(top, bottom).Z / 30f), 0);
  218.             float num = this.DistanceTo(bottom, top);
  219.             int num2 = (int)Math.Ceiling((double)(num / 30f));
  220.             Vector vector = MapEdit.VectorToAngles(MapEdit.minus(top, bottom));
  221.             vector = new Vector(vector.X, vector.Y, 90f);
  222.             Vector vector2 = new Vector((top.X - bottom.X) / (float)num2, (top.Y - bottom.Y) / (float)num2, (top.Z - bottom.Z) / (float)num2);
  223.             for (int i = (int)top.Z; i <= (int)bottom.Z; i += 30)
  224.             {
  225.                 for (int j = 0; j <= num2; j++)
  226.                 {
  227.                     Vector vector3 = MapEdit.plus(bottom, new Vector(vector2.X * (float)j, vector2.Y * (float)j, 0f));
  228.                     vector3.Z = (float)i;
  229.                     this.spawnCrate(vector3, vector);
  230.                 }
  231.             }
  232.         }
  233.         public void CreateDoor(Vector top, Vector bottom)
  234.         {
  235.             int arg_1A_0 = (int)Math.Round((double)(MapEdit.minus(top, bottom).Z / 30f), 0);
  236.             float num = this.DistanceTo(bottom, top);
  237.             int num2 = (int)Math.Ceiling((double)(num / 30f));
  238.             List<Entity> list = new List<Entity>();
  239.             Vector vector = MapEdit.VectorToAngles(MapEdit.minus(top, bottom));
  240.             vector = new Vector(vector.X, vector.Y, 90f);
  241.             Vector vector2 = new Vector((top.X - bottom.X) / (float)num2, (top.Y - bottom.Y) / (float)num2, (top.Z - bottom.Z) / (float)num2);
  242.             for (int i = (int)top.Z; i <= (int)bottom.Z; i += 30)
  243.             {
  244.                 for (int j = 0; j <= num2; j++)
  245.                 {
  246.                     Vector vector3 = MapEdit.plus(bottom, new Vector(vector2.X * (float)j, vector2.Y * (float)j, 0f));
  247.                     vector3.Z = (float)i;
  248.                     list.Add(this.spawnCrate(vector3, vector));
  249.                 }
  250.             }
  251.             Class2 @class = new Class2();
  252.             @class.open = false;
  253.             if (bottom.Z > top.Z)
  254.             {
  255.                 @class.Bottom = top;
  256.                 @class.Top = bottom;
  257.             }
  258.             else
  259.             {
  260.                 @class.Bottom = bottom;
  261.                 @class.Top = top;
  262.             }
  263.             @class.Openingclient = null;
  264.             @class.openTime = new Stopwatch();
  265.             @class.closeTime = new Stopwatch();
  266.             @class.closeTime.Start();
  267.             @class.Health = 100.0;
  268.             this.dictionary_0.Add(list, @class);
  269.         }
  270.         public override void OnPlayerConnect(ServerClient Client)
  271.         {
  272.             this.CreateHudForDoor(Client);
  273.             base.OnPlayerConnect(Client);
  274.         }
  275.         public override void OnPreMapChange()
  276.         {
  277.             this.dictionary_2.Clear();
  278.             this.dictionary_0.Clear();
  279.             base.OnPreMapChange();
  280.         }
  281.         public override void OnMapChange()
  282.         {
  283.             if (base.GetClients() != null)
  284.             {
  285.                 foreach (ServerClient current in base.GetClients())
  286.                 {
  287.                     this.CreateHudForDoor(current);
  288.                 }
  289.             }
  290.             base.OnMapChange();
  291.         }
  292.         public void CreateHudForDoor(ServerClient Client)
  293.         {
  294.             HudElem hudElem = base.CreateNewHudElem();
  295.             hudElem.set_Type(1);
  296.             hudElem.set_ShowToEnt(Client.get_ClientNum());
  297.             hudElem.set_HideInMenu(true);
  298.             hudElem.set_Font(0);
  299.             hudElem.set_FontScale(1.5f);
  300.             hudElem.set_PointType(120);
  301.             hudElem.set_OriginY(180f);
  302.             hudElem.set_OriginX(-100f);
  303.             hudElem.SetString("");
  304.             this.dictionary_2.Add(Client.get_ClientNum(), hudElem.get_HudElementNum());
  305.         }
  306.         private KeyValuePair<List<Entity>, Class2> method_0(Dictionary<List<Entity>, Class2> dictionary_3, int int_1)
  307.         {
  308.             int num = 0;
  309.             foreach (KeyValuePair<List<Entity>, Class2> current in dictionary_3)
  310.             {
  311.                 if (num == int_1)
  312.                 {
  313.                     return current;
  314.                 }
  315.                 num++;
  316.             }
  317.             throw new Exception("Nothing found with key");
  318.         }
  319.         private Vector method_1(Vector vector_0, float float_0)
  320.         {
  321.             return new Vector(vector_0.X / float_0, vector_0.Y / float_0, vector_0.Z / float_0);
  322.         }
  323.         public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
  324.         {
  325.             if (Message == "!house")
  326.             {
  327.                 float num = Client.get_OriginX() + 200f;
  328.                 float num2 = Client.get_OriginX() - 200f;
  329.                 float num3 = Client.get_OriginY() + 200f;
  330.                 float num4 = Client.get_OriginY() - 200f;
  331.                 float num5 = Client.get_OriginZ() + 200f;
  332.                 this.createfloor(new Vector(num, num3, Client.get_OriginZ()), new Vector(num2, num4, Client.get_OriginZ()));
  333.                 this.CreateWall(new Vector(num, num3, Client.get_OriginZ()), new Vector(num2, num3, num5));
  334.                 this.CreateWall(new Vector(num, num3, Client.get_OriginZ()), new Vector(num, num4, num5));
  335.                 this.CreateWall(new Vector(num2, num4, Client.get_OriginZ()), new Vector(num2, num3, num5));
  336.                 this.CreateWall(new Vector(num2, num4, Client.get_OriginZ()), new Vector(num, num4, num5));
  337.                 this.createfloor(new Vector(num, num3, num5), new Vector(num2, num4, num5));
  338.             }
  339.             return base.OnSay(Message, Client, Teamchat);
  340.         }
  341.         public override void OnAddonFrame()
  342.         {
  343.             for (int i = 0; i < this.dictionary_0.Count; i++)
  344.             {
  345.                 MapEdit.Class4 @class = new MapEdit.Class4();
  346.                 @class.list_0 = this.method_0(this.dictionary_0, i).Key;
  347.                 @class.class2_0 = this.dictionary_0[@class.list_0];
  348.                 if (base.GetClients() != null)
  349.                 {
  350.                     foreach (ServerClient current in base.GetClients())
  351.                     {
  352.                         MapEdit.Class5 class2 = new MapEdit.Class5();
  353.                         class2.hudElem_0 = base.GetHudElement(this.dictionary_2[current.get_ClientNum()]);
  354.                         if (@class.class2_0.Health <= 0.0)
  355.                         {
  356.                             foreach (Entity current2 in @class.list_0)
  357.                             {
  358.                                 Class10.smethod_14(current2, 0);
  359.                                 current2.Delete();
  360.                                 i--;
  361.                                 this.dictionary_0.Remove(@class.list_0);
  362.                             }
  363.                             foreach (ServerClient current3 in base.GetClients())
  364.                             {
  365.                                 HudElem hudElement = base.GetHudElement(this.dictionary_2[current3.get_ClientNum()]);
  366.                                 hudElement.SetString("");
  367.                             }
  368.                             break;
  369.                         }
  370.                         float num = (float)MapEdit.Distance(new Vector(current.get_OriginX(), current.get_OriginY(), current.get_OriginZ()), @class.list_0);
  371.                         if (current.get_Team() == 2)
  372.                         {
  373.                             if (current.Other.get_CurrentWeapon() != base.GetWeapon("defaultweapon_mp"))
  374.                             {
  375.                                 if (num <= 250f && !@class.class2_0.open && @class.class2_0.closeTime.Elapsed.Seconds > 2)
  376.                                 {
  377.                                     try
  378.                                     {
  379.                                         class2.hudElem_0.SetString("Press ^3Activate^7 to ^1open Door");
  380.                                         if (current.Other.ButtonPressed(Buttons.Activate) && !@class.class2_0.open)
  381.                                         {
  382.                                             class2.hudElem_0.SetString("Press ^3Activate^7 to ^1close Door");
  383.                                             @class.class2_0.open = true;
  384.                                             @class.class2_0.Openingclient = new int?(current.get_ClientNum());
  385.                                             @class.class2_0.closeTime.Reset();
  386.                                             @class.class2_0.closeTime.Stop();
  387.                                             using (List<Entity>.Enumerator enumerator2 = @class.list_0.GetEnumerator())
  388.                                             {
  389.                                                 while (enumerator2.MoveNext())
  390.                                                 {
  391.                                                     MapEdit.Class6 class3 = new MapEdit.Class6();
  392.                                                     class3.entity_0 = enumerator2.Current;
  393.                                                     MapEdit.Class7 class4 = new MapEdit.Class7();
  394.                                                     class4.class6_0 = class3;
  395.                                                     class4.class5_0 = class2;
  396.                                                     class4.class4_0 = @class;
  397.                                                     class4.mapEdit_0 = this;
  398.                                                     Entity expr_225 = class3.entity_0;
  399.                                                     expr_225.set_OriginZ(expr_225.get_OriginZ() + 100f);
  400.                                                     Class10.smethod_14(class3.entity_0, 0);
  401.                                                     @class.class2_0.openTime.Reset();
  402.                                                     @class.class2_0.openTime.Start();
  403.                                                     class4.timer_0 = new Timer(5000.0);
  404.                                                     class4.timer_0.Elapsed += new ElapsedEventHandler(class4.method_0);
  405.                                                     class4.timer_0.Start();
  406.                                                     class4.timer_1 = new Timer(6000.0);
  407.                                                     class4.timer_1.Elapsed += new ElapsedEventHandler(class4.method_1);
  408.                                                     class4.timer_1.Start();
  409.                                                 }
  410.                                             }
  411.                                         }
  412.                                         goto IL_353;
  413.                                     }
  414.                                     catch (Exception ex)
  415.                                     {
  416.                                         base.ServerPrint(ex.ToString());
  417.                                         goto IL_353;
  418.                                     }
  419.                                     goto IL_306;
  420.                                 }
  421.                                 goto IL_306;
  422.                                 IL_353:
  423.                                 if (num <= 250f && current.Other.ButtonPressed(Buttons.Activate) && @class.class2_0.open && @class.class2_0.Openingclient == current.get_ClientNum() && @class.class2_0.openTime.Elapsed.Seconds > 2)
  424.                                 {
  425.                                     @class.class2_0.open = false;
  426.                                     @class.class2_0.openTime.Reset();
  427.                                     @class.class2_0.Openingclient = null;
  428.                                     @class.class2_0.closeTime.Reset();
  429.                                     @class.class2_0.closeTime.Start();
  430.                                     foreach (Entity current2 in @class.list_0)
  431.                                     {
  432.                                         if (current2.get_OriginZ() - 100f >= @class.class2_0.Bottom.Z)
  433.                                         {
  434.                                             Entity expr_459 = current2;
  435.                                             expr_459.set_OriginZ(expr_459.get_OriginZ() - 100f);
  436.                                             Class10.smethod_14(current2, Class10.smethod_12());
  437.                                         }
  438.                                     }
  439.                                     class2.hudElem_0.SetString("");
  440.                                     goto IL_8B5;
  441.                                 }
  442.                                 goto IL_8B5;
  443.                                 IL_306:
  444.                                 if (num > 250f || !(@class.class2_0.Openingclient == current.get_ClientNum()))
  445.                                 {
  446.                                     class2.hudElem_0.SetString("");
  447.                                     goto IL_353;
  448.                                 }
  449.                                 goto IL_353;
  450.                             }
  451.                             else
  452.                             {
  453.                                 if (num <= 100f && !@class.class2_0.open)
  454.                                 {
  455.                                     try
  456.                                     {
  457.                                         class2.hudElem_0.SetString("Press ^3Activate^7 to ^1repair Door.Current health: " + @class.class2_0.Health);
  458.                                         if (current.Other.ButtonPressed(Buttons.Activate))
  459.                                         {
  460.                                             if (base.GetDvar("mapname") == "mp_underground")
  461.                                             {
  462.                                                 Class10.smethod_10(this.int_0, this.method_1(MapEdit.plus(@class.class2_0.Bottom, @class.class2_0.Top), 2f), null, null);
  463.                                                 Class10.smethod_10(this.int_0, @class.class2_0.Top, null, null);
  464.                                                 Class10.smethod_10(this.int_0, @class.class2_0.Bottom, null, null);
  465.                                                 Class10.smethod_10(this.int_0, new Vector(@class.class2_0.Top.X, @class.class2_0.Top.Y, @class.class2_0.Bottom.Z), null, null);
  466.                                                 Class10.smethod_10(this.int_0, new Vector(@class.class2_0.Bottom.X, @class.class2_0.Bottom.Y, @class.class2_0.Top.Z), null, null);
  467.                                             }
  468.                                             @class.class2_0.Health += 1.0;
  469.                                         }
  470.                                         goto IL_8B5;
  471.                                     }
  472.                                     catch
  473.                                     {
  474.                                         goto IL_8B5;
  475.                                     }
  476.                                 }
  477.                                 class2.hudElem_0.SetString("");
  478.                             }
  479.                         }
  480.                         else
  481.                         {
  482.                             if (num <= 100f && !@class.class2_0.open && @class.class2_0.Health > 0.0)
  483.                             {
  484.                                 try
  485.                                 {
  486.                                     class2.hudElem_0.SetString("Press ^3Melee^7 to ^1break open Door");
  487.                                     if (current.Other.ButtonPressed(Buttons.Knife))
  488.                                     {
  489.                                         if (!this.dictionary_1.ContainsKey(current.get_ClientNum()))
  490.                                         {
  491.                                             Stopwatch stopwatch = new Stopwatch();
  492.                                             stopwatch.Start();
  493.                                             this.dictionary_1.Add(current.get_ClientNum(), stopwatch);
  494.                                         }
  495.                                         if (this.dictionary_1[current.get_ClientNum()].ElapsedMilliseconds > 1500L)
  496.                                         {
  497.                                             int num2 = 90;
  498.                                             int num3 = 50;
  499.                                             int num4 = 30;
  500.                                             Random random = new Random();
  501.                                             if (current.get_Stance() == 0)
  502.                                             {
  503.                                                 if (random.Next(100) < num2)
  504.                                                 {
  505.                                                     @class.class2_0.Health -= 20.0;
  506.                                                     base.iPrintLnBold("Health remaining " + @class.class2_0.Health.ToString(), current);
  507.                                                 }
  508.                                                 else
  509.                                                 {
  510.                                                     base.iPrintLnBold("Missed, try again!", current);
  511.                                                 }
  512.                                             }
  513.                                             if (current.get_Stance() == 2)
  514.                                             {
  515.                                                 if (random.Next(100) < num3)
  516.                                                 {
  517.                                                     @class.class2_0.Health -= 10.0;
  518.                                                     base.iPrintLnBold("Health remaining " + @class.class2_0.Health.ToString(), current);
  519.                                                 }
  520.                                                 else
  521.                                                 {
  522.                                                     base.iPrintLnBold("Missed, try again!", current);
  523.                                                 }
  524.                                             }
  525.                                             if (current.get_Stance() == 1)
  526.                                             {
  527.                                                 if (random.Next(100) < num4)
  528.                                                 {
  529.                                                     @class.class2_0.Health -= 10.0;
  530.                                                     base.iPrintLnBold("Health remaining " + @class.class2_0.Health.ToString(), current);
  531.                                                 }
  532.                                                 else
  533.                                                 {
  534.                                                     base.iPrintLnBold("Missed, try again!", current);
  535.                                                 }
  536.                                             }
  537.                                             this.dictionary_1[current.get_ClientNum()].Reset();
  538.                                             this.dictionary_1[current.get_ClientNum()].Start();
  539.                                         }
  540.                                         else
  541.                                         {
  542.                                             base.iPrintLnBold("You must wait before knifing again", current);
  543.                                         }
  544.                                     }
  545.                                     goto IL_8B5;
  546.                                 }
  547.                                 catch
  548.                                 {
  549.                                     goto IL_8B5;
  550.                                 }
  551.                             }
  552.                             class2.hudElem_0.SetString("");
  553.                         }
  554.                         IL_8B5:
  555.                         this.dictionary_0[@class.list_0] = @class.class2_0;
  556.                     }
  557.                 }
  558.             }
  559.         }
  560.         public static Vector VectorToAngles(Vector value1)
  561.         {
  562.             float num;
  563.             float num2;
  564.             if (value1.Y == 0f && value1.X == 0f)
  565.             {
  566.                 num = 0f;
  567.                 if (value1.Z > 0f)
  568.                 {
  569.                     num2 = 90f;
  570.                 }
  571.                 else
  572.                 {
  573.                     num2 = 270f;
  574.                 }
  575.             }
  576.             else
  577.             {
  578.                 if (value1.X == 1f)
  579.                 {
  580.                     num = (float)(Math.Atan2((double)value1.Y, (double)value1.X) * 180.0 / 3.1415926535897931);
  581.                 }
  582.                 else
  583.                 {
  584.                     if (value1.Y > 0f)
  585.                     {
  586.                         num = 90f;
  587.                     }
  588.                     else
  589.                     {
  590.                         num = 270f;
  591.                     }
  592.                 }
  593.                 if (num < 0f)
  594.                 {
  595.                     num += 360f;
  596.                 }
  597.                 float num3 = (float)Math.Sqrt((double)(value1.X * value1.X + value1.Y * value1.Y));
  598.                 num2 = (float)(Math.Atan2((double)value1.Z, (double)num3) * 180.0 / 3.1415926535897931);
  599.                 if (num2 < 0f)
  600.                 {
  601.                     num2 += 360f;
  602.                 }
  603.             }
  604.             return new Vector(-num2, num, 0f);
  605.         }
  606.         public Vector Normalize(Vector vec)
  607.         {
  608.             float num = this.Length(vec);
  609.             if (num > 0f)
  610.             {
  611.                 float num2 = 1f / num;
  612.                 vec.X *= num2;
  613.                 vec.Y *= num2;
  614.                 vec.Z *= num2;
  615.             }
  616.             return vec;
  617.         }
  618.         public override void OnPlayerSpawned(ServerClient Client)
  619.         {
  620.             MapEdit.Class8 @class = new MapEdit.Class8();
  621.             @class.serverClient_0 = Client;
  622.             @class.mapEdit_0 = this;
  623.             if (@class.serverClient_0.get_Team() == 2)
  624.             {
  625.                 MapEdit.Class9 class2 = new MapEdit.Class9();
  626.                 class2.class8_0 = @class;
  627.                 class2.timer_0 = new Timer(100.0);
  628.                 class2.timer_0.Elapsed += new ElapsedEventHandler(class2.method_0);
  629.                 class2.timer_0.Start();
  630.             }
  631.         }
  632.     }
  633. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement