public static void TradeSkillBuildPressed(Client client, int quality) { int src = TradeSkillInfos.Where(m => m.Cli == client && m.Location == 0).Select(m => m).ElementAt(0).Placement; int tgt = TradeSkillInfos.Where(m => m.Cli == client && m.Location == 1).Select(m => m).ElementAt(0).Placement; Tradeskill ts = new Tradeskill(client, src, tgt); if (ts.IsTradeSkill) { ts.Quality = quality; ts.WindowBuild(); } else { client.SendChatText("It is not possible to assemble those two items. Maybe the order was wrong?"); client.SendChatText("No combination found!"); } TradeSkillInfos.RemoveAll(m => m.Cli == client); }
public void Execute(Client cli, Statel parent, int Eventnumber) { bool reqs_met = true; int childop = -1; Character ftarget = null; bool reqresult = true; Character chartarget = (Character)FindDynel.FindDynelById(cli.Character.Target.Type, cli.Character.Target.Instance); for (int r = 0; r < this.Requirements.Count; r++) { switch (this.Requirements[r].Target) { case itemtarget_user: ftarget = cli.Character; break; case itemtarget_wearer: ftarget = cli.Character; break; case itemtarget_target: ftarget = chartarget; break; case itemtarget_fightingtarget: // Fighting target break; case itemtarget_self: ftarget = cli.Character; break; case itemtarget_selectedtarget: ftarget = chartarget; break; } if (ftarget == null) { reqs_met = false; return; } int statval = ftarget.Stats.StatValueByName(this.Requirements[r].AttributeNumber); switch (this.Requirements[r].Operator) { case operator_and: reqresult = ((statval & this.Requirements[r].AttributeValue) != 0); break; case operator_or: reqresult = ((statval | this.Requirements[r].AttributeValue) != 0); break; case operator_equalto: reqresult = (statval == this.Requirements[r].AttributeValue); break; case operator_lessthan: reqresult = (statval < this.Requirements[r].AttributeValue); break; case operator_greaterthan: reqresult = (statval > this.Requirements[r].AttributeValue); break; case operator_unequal: reqresult = (statval != this.Requirements[r].AttributeValue); break; case operator_true: reqresult = (statval != 0); break; case operator_false: reqresult = (statval == 0); break; case operator_bitand: reqresult = ((statval & this.Requirements[r].AttributeValue) != 0); break; case operator_bitor: reqresult = ((statval | this.Requirements[r].AttributeValue) != 0); break; default: reqresult = true; break; } switch (childop) { case operator_and: reqs_met &= reqresult; break; case operator_or: reqs_met |= reqresult; break; case -1: reqs_met = reqresult; break; default: break; } childop = this.Requirements[r].ChildOperator; } if (!reqs_met) { cli.SendChatText("Requirements not met. (better errormessage not coded yet)"); return; } if ( !Program.FunctionC.CallFunction( this.FunctionNumber, cli.Character, cli.Character, parent, this.Arguments.ToArray())) { #if DEBUG cli.SendChatText( "Statel " + parent.Type.ToString() + ":" + parent.Instance.ToString() + " handling " + Eventnumber.ToString() + " Function " + this.FunctionNumber.ToString() + " " + cli.Character.Coordinates); foreach (string arg in this.Arguments) { cli.SendChatText("Argument: " + arg); } #endif } }
public static void TradeSkillBuildPressed(Client client, int quality) { int src = TradeSkillInfos.Where(m => m.Cli == client && m.Location == 0).Select(m => m).ElementAt(0).Placement; int tgt = TradeSkillInfos.Where(m => m.Cli == client && m.Location == 1).Select(m => m).ElementAt(0).Placement; Tradeskill ts = new Tradeskill(client, src, tgt); if (ts.IsTradeSkill) { ts.Quality = quality; ts.WindowBuild(); } else { client.SendChatText("It is not possible to assemble those two items. Maybe the order was wrong?"); client.SendChatText("No combination found!"); } TradeSkillInfos.RemoveAll(m => m.Cli == client); }
public void Execute(Client cli, Statel parent, int Eventnumber) { switch (FunctionNumber) { // Hit case 53002: { int statnum = Int32.Parse(Arguments.ElementAt(0)); int min = Int32.Parse(Arguments.ElementAt(1)); int max = Int32.Parse(Arguments.ElementAt(2)); if (min > max) { min = max; max = Int32.Parse(Arguments.ElementAt(1)); } Random rnd = new Random(); cli.Character.Stats.Set(statnum, (uint)(cli.Character.Stats.Get(statnum) + rnd.Next(min, max))); break; } // Lineteleport // case 53059: { #if DEBUG Console.WriteLine("Function 53059 (LineTeleport)"); Console.WriteLine("Object: " + parent.Type + ":" + parent.Instance); #endif uint arg2 = UInt32.Parse(Arguments.ElementAt(1)); // Linesegment and playfield (lower word) arg2 = arg2 >> 16; int to_pf = Int32.Parse(Arguments.ElementAt(2)); coordheading a = FindEntry(to_pf, (Int32)arg2); if (a.Coordinates.x != -1) { cli.Teleport(a.Coordinates, a.Heading, to_pf); break; } break; } case 53082: // Teleport Proxy { Identity pfinstance = new Identity(); pfinstance.Type = Int32.Parse(Arguments.ElementAt(0)); pfinstance.Instance = Int32.Parse(Arguments.ElementAt(1)); Identity id2 = new Identity(); id2.Type = Int32.Parse(Arguments.ElementAt(2)); id2.Instance = Int32.Parse(Arguments.ElementAt(3)); Identity id3 = new Identity(); id3.Type = Int32.Parse(Arguments.ElementAt(4)); id3.Instance = Int32.Parse(Arguments.ElementAt(5)); SqlWrapper ms = new SqlWrapper(); DataTable dt = ms.ReadDT("SELECT * from proxydestinations WHERE playfield=" + pfinstance.Instance); if (dt.Rows.Count == 0) { #if DEBUG cli.SendChatText("No Destination found for playfield " + pfinstance.Instance); cli.SendChatText("Statel " + parent.Type.ToString() + ":" + parent.Instance.ToString() + " handling " + Eventnumber.ToString() + " Function " + FunctionNumber.ToString() + " " + cli.Character.Coordinates.ToString()); foreach (string arg in Arguments) { cli.SendChatText("Argument: " + arg); } #endif } else { AOCoord a = new AOCoord(); a.x = (Single)dt.Rows[0][1]; a.y = (Single)dt.Rows[0][2]; a.z = (Single)dt.Rows[0][3]; Quaternion q = new Quaternion(0, 0, 0, 0); q.x = (Single)dt.Rows[0][4]; q.y = (Single)dt.Rows[0][5]; q.z = (Single)dt.Rows[0][6]; q.w = (Single)dt.Rows[0][7]; cli.TeleportProxy(a, q, pfinstance.Instance, pfinstance, 1, (Int32)parent.Instance, id2, id3); } break; } case 53092: // Bank { Packets.BankOpen.Send(cli); break; } case 53083: // Teleport Proxy 2 { Identity pfinstance = new Identity(); pfinstance.Type = Int32.Parse(Arguments.ElementAt(0)); pfinstance.Instance = Int32.Parse(Arguments.ElementAt(1)); int gs = 1; int sg = 0; Identity R = new Identity(); R.Type = Int32.Parse(Arguments.ElementAt(2)); R.Instance = Int32.Parse(Arguments.ElementAt(3)); Identity dest = new Identity(); dest.Type = Int32.Parse(Arguments.ElementAt(4)); dest.Instance = Int32.Parse(Arguments.ElementAt(5)); int to_pf = (Int32)((UInt32)(dest.Instance & 0xffff)); int arg2 = (Int32)((UInt32)(dest.Instance >> 16)); coordheading a = FindEntry(to_pf, arg2); if (a.Coordinates.x != -1) { cli.TeleportProxy(a.Coordinates, a.Heading, to_pf, pfinstance, gs, sg, R, dest); break; } break; } // Teleport case 53016: { Quaternion q = new Quaternion(0, 1, 0, 0); AOCoord a = new AOCoord(); a.x = Int32.Parse(Arguments.ElementAt(0)); a.y = Int32.Parse(Arguments.ElementAt(1)); a.z = Int32.Parse(Arguments.ElementAt(2)); cli.Teleport(a, q, Int32.Parse(Arguments.ElementAt(3))); break; } case 53044: { string text = Arguments.ElementAt(0); Packets.SystemText.Send(cli, text, 0); break; } default: { #if DEBUG cli.SendChatText("Statel " + parent.Type.ToString() + ":" + parent.Instance.ToString() + " handling " + Eventnumber.ToString() + " Function " + FunctionNumber.ToString() + " " + cli.Character.Coordinates.ToString()); foreach (string arg in Arguments) { cli.SendChatText("Argument: " + arg); } #endif break; } } }
public void Execute(Client cli, Statel parent, int Eventnumber) { switch (FunctionNumber) { // Hit case 53002: { int statnum = Int32.Parse(Arguments.ElementAt(0)); int min = Int32.Parse(Arguments.ElementAt(1)); int max = Int32.Parse(Arguments.ElementAt(2)); if (min > max) { min = max; max = Int32.Parse(Arguments.ElementAt(1)); } Random rnd = new Random(); cli.Character.Stats.Set(statnum, (uint)(cli.Character.Stats.Get(statnum) + rnd.Next(min, max))); break; } // Lineteleport // case 53059: { #if DEBUG Console.WriteLine("Function 53059 (LineTeleport)"); Console.WriteLine("Object: " + parent.Type + ":" + parent.Instance); #endif uint arg2 = UInt32.Parse(Arguments.ElementAt(1)); // Linesegment and playfield (lower word) arg2 = arg2 >> 16; int to_pf = Int32.Parse(Arguments.ElementAt(2)); coordheading a = FindEntry(to_pf, (Int32)arg2); if (a.Coordinates.x != -1) { cli.Teleport(a.Coordinates, a.Heading, to_pf); break; } break; } case 53082: // Teleport Proxy { Identity pfinstance = new Identity(); pfinstance.Type = Int32.Parse(Arguments.ElementAt(0)); pfinstance.Instance = Int32.Parse(Arguments.ElementAt(1)); Identity id2 = new Identity(); id2.Type = Int32.Parse(Arguments.ElementAt(2)); id2.Instance = Int32.Parse(Arguments.ElementAt(3)); Identity id3 = new Identity(); id3.Type = Int32.Parse(Arguments.ElementAt(4)); id3.Instance = Int32.Parse(Arguments.ElementAt(5)); SqlWrapper ms = new SqlWrapper(); DataTable dt = ms.ReadDT("SELECT * from proxydestinations WHERE playfield=" + pfinstance.Instance); if (dt.Rows.Count == 0) { #if DEBUG cli.SendChatText("No Destination found for playfield " + pfinstance.Instance); cli.SendChatText("Statel " + parent.Type.ToString() + ":" + parent.Instance.ToString() + " handling " + Eventnumber.ToString() + " Function " + FunctionNumber.ToString() + " " + cli.Character.Coordinates.ToString()); foreach (string arg in Arguments) { cli.SendChatText("Argument: " + arg); } #endif } else { AOCoord a = new AOCoord(); a.x= (Single)dt.Rows[0][1]; a.y= (Single)dt.Rows[0][2]; a.z = (Single)dt.Rows[0][3]; Quaternion q = new Quaternion(0, 0, 0, 0); q.x = (Single)dt.Rows[0][4]; q.y = (Single)dt.Rows[0][5]; q.z = (Single)dt.Rows[0][6]; q.w = (Single)dt.Rows[0][7]; cli.TeleportProxy(a, q, pfinstance.Instance, pfinstance, 1, (Int32)parent.Instance, id2, id3); } break; } case 53092: // Bank { Packets.BankOpen.Send(cli); break; } case 53083: // Teleport Proxy 2 { Identity pfinstance = new Identity(); pfinstance.Type = Int32.Parse(Arguments.ElementAt(0)); pfinstance.Instance = Int32.Parse(Arguments.ElementAt(1)); int gs = 1; int sg = 0; Identity R = new Identity(); R.Type = Int32.Parse(Arguments.ElementAt(2)); R.Instance = Int32.Parse(Arguments.ElementAt(3)); Identity dest = new Identity(); dest.Type = Int32.Parse(Arguments.ElementAt(4)); dest.Instance = Int32.Parse(Arguments.ElementAt(5)); int to_pf = (Int32)((UInt32)(dest.Instance & 0xffff)); int arg2 = (Int32)((UInt32)(dest.Instance >> 16)); coordheading a = FindEntry(to_pf, arg2); if (a.Coordinates.x != -1) { cli.TeleportProxy(a.Coordinates, a.Heading, to_pf, pfinstance, gs, sg, R, dest); break; } break; } // Teleport case 53016: { Quaternion q = new Quaternion(0, 1, 0, 0); AOCoord a = new AOCoord(); a.x = Int32.Parse(Arguments.ElementAt(0)); a.y = Int32.Parse(Arguments.ElementAt(1)); a.z = Int32.Parse(Arguments.ElementAt(2)); cli.Teleport(a, q, Int32.Parse(Arguments.ElementAt(3))); break; } case 53044: { string text = Arguments.ElementAt(0); Packets.SystemText.Send(cli, text, 0); break; } default: { #if DEBUG cli.SendChatText("Statel " + parent.Type.ToString() + ":" + parent.Instance.ToString() + " handling " + Eventnumber.ToString() + " Function " + FunctionNumber.ToString() + " " + cli.Character.Coordinates.ToString()); foreach (string arg in Arguments) { cli.SendChatText("Argument: " + arg); } #endif break; } } }
public void Execute(Client cli, Statel parent, int Eventnumber) { bool reqs_met = true; int childop = -1; Character ftarget = null; bool reqresult = true; Character chartarget = (Character)FindDynel.FindDynelById(cli.Character.Target.Type, cli.Character.Target.Instance); for (int r = 0; r < this.Requirements.Count; r++) { switch (this.Requirements[r].Target) { case itemtarget_user: ftarget = cli.Character; break; case itemtarget_wearer: ftarget = cli.Character; break; case itemtarget_target: ftarget = chartarget; break; case itemtarget_fightingtarget: // Fighting target break; case itemtarget_self: ftarget = cli.Character; break; case itemtarget_selectedtarget: ftarget = chartarget; break; } if (ftarget == null) { reqs_met = false; return; } int statval = ftarget.Stats.StatValueByName(this.Requirements[r].AttributeNumber); switch (this.Requirements[r].Operator) { case operator_and: reqresult = ((statval & this.Requirements[r].AttributeValue) != 0); break; case operator_or: reqresult = ((statval | this.Requirements[r].AttributeValue) != 0); break; case operator_equalto: reqresult = (statval == this.Requirements[r].AttributeValue); break; case operator_lessthan: reqresult = (statval < this.Requirements[r].AttributeValue); break; case operator_greaterthan: reqresult = (statval > this.Requirements[r].AttributeValue); break; case operator_unequal: reqresult = (statval != this.Requirements[r].AttributeValue); break; case operator_true: reqresult = (statval != 0); break; case operator_false: reqresult = (statval == 0); break; case operator_bitand: reqresult = ((statval & this.Requirements[r].AttributeValue) != 0); break; case operator_bitor: reqresult = ((statval | this.Requirements[r].AttributeValue) != 0); break; default: reqresult = true; break; } switch (childop) { case operator_and: reqs_met &= reqresult; break; case operator_or: reqs_met |= reqresult; break; case -1: reqs_met = reqresult; break; default: break; } childop = this.Requirements[r].ChildOperator; } if (!reqs_met) { cli.SendChatText("Requirements not met. (better errormessage not coded yet)"); return; } if ( !Program.FunctionC.CallFunction( this.FunctionNumber, cli.Character, cli.Character, parent, this.Arguments.ToArray())) { #if DEBUG cli.SendChatText( "Statel " + parent.Type.ToString() + ":" + parent.Instance.ToString() + " handling " + Eventnumber.ToString() + " Function " + this.FunctionNumber.ToString() + " " + cli.Character.Coordinates); foreach (string arg in this.Arguments) { cli.SendChatText("Argument: " + arg); } #endif } }