private static void btnSpawnToolSpawnTenX_Hit(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); try { if (txtSpawnToolCommand.Text.ToString().Length == 0) { PluginCore.MyHost.Actions.AddChatText("You must enter a command.", 1); return; } if (txtSpawnToolValue.Text.ToString().Length == 0) { PluginCore.MyHost.Actions.AddChatText("You must enter a value.", 1); return; } PluginCore.ChatCommand(txtSpawnToolCommand.Text, txtSpawnToolValue.Text, "10"); } catch (Exception ex) { PluginCore.LogError(ex); } }
static void txtSpawnModelSearchText_Change(object sender, MVTextBoxChangeEventArgs e) { var searchText = txtSpawnModelSearchText.Text; if (searchText.Length == 0) { addAll(); return; } try { lstSpawnModelSearchList.Clear(); foreach (KeyValuePair <int, string> model in PluginCore.models) { if (!(model.Value.ToLowerInvariant().Contains(searchText.ToLowerInvariant()))) { continue; } IListRow row = lstSpawnModelSearchList.Add(); row[0][0] = model.Key.ToString("X4"); row[1][0] = model.Value.ToString(); } } catch (Exception ex) { PluginCore.LogError(ex); } }
static void txtTeleTownSearchText_Change(object sender, MVTextBoxChangeEventArgs e) { var searchText = txtTeleTownSearchText.Text; if (searchText.Length == 0) { addAll(); return; } try { lstTeleTownSearchList.Clear(); foreach (string name in PluginCore.towns) { if (!(name.ToLowerInvariant().Contains(searchText.ToLowerInvariant()))) { continue; } IListRow row = lstTeleTownSearchList.Add(); row[0][0] = name; } } catch (Exception ex) { PluginCore.LogError(ex); } }
static void addAll() { try { // Models lstSpawnModelSearchList.Clear(); foreach (KeyValuePair <int, string> model in PluginCore.models) { IListRow row = lstSpawnModelSearchList.Add(); row[0][0] = model.Key.ToString("X4"); row[1][0] = model.Value.ToString(); } // Towns lstTeleTownSearchList.Clear(); foreach (string town in PluginCore.towns) { IListRow row = lstTeleTownSearchList.Add(); row[0][0] = town; } } catch (Exception ex) { PluginCore.LogError(ex); } }
private static void btnSpawnToolClearSpawns_Hit(object sender, EventArgs e) { try { PluginCore.ChatCommand("clearspawns"); } catch (Exception ex) { PluginCore.LogError(ex); } }
private static void btnSpawnToolSpawnMinus_Hit(object sender, EventArgs e) { try { int value = int.Parse(txtSpawnToolValue.Text, System.Globalization.NumberStyles.HexNumber); value -= 1; txtSpawnToolValue.Text = value.ToString("X4"); } catch (Exception ex) { PluginCore.LogError(ex); } }
private static void btnSpawnToolSpawnTenX_Hit(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); try { ChatCommand(txtSpawnToolCommand.Text, txtSpawnToolValue.Text, "10"); } catch (Exception ex) { PluginCore.LogError(ex); } }
static void lstTeleTownSearchList_Selected(object sender, MVListSelectEventArgs e) { try { String name = (String)lstTeleTownSearchList[e.Row][0][0]; PluginCore.ChatCommand("teletown", name); } catch (Exception ex) { PluginCore.LogError(ex); } }
static void lstSpawnModelSearchList_Selected(object sender, MVListSelectEventArgs e) { try { String id = (String)lstSpawnModelSearchList[e.Row][0][0]; String val = (String)lstSpawnModelSearchList[e.Row][1][0]; PluginCore.ChatCommand("spawnmodel", id); } catch (Exception ex) { PluginCore.LogError(ex); } }
// Syntax: @b_spawnobj 0xID or Name, Scale - Spawns an object for building things!--> private static void btnObjectSpawn_Hit(object sender, EventArgs e) { string id = ""; int scale = 1; try { id = txtObjectIDName.Text.ToString(); scale = int.Parse(txtObjectScale.Text.ToString()); } catch (Exception ex) { PluginCore.LogError(ex); } PluginCore.ChatCommand("b_spawnobj", id, scale.ToString()); }
private static void btnObjectSpinWZPlus_Hit(object sender, EventArgs e) { double amount = 0.1; try { amount = double.Parse(txtObjectSpinAmount.Text.ToString()); } catch (Exception ex) { PluginCore.LogError(ex); } try { PluginCore.ChatCommand("b_spinWZ", amount.ToString()); } catch (Exception ex) { PluginCore.LogError(ex); } }
private static void btnObjectNudgeZPlus_Hit(object sender, EventArgs e) { double amount = 1; try { amount = double.Parse(txtObjectNudgeAmount.Text.ToString()); } catch (Exception ex) { PluginCore.LogError(ex); } // Override the user input if it's nonsense if (amount < 0) { PluginCore.MyHost.Actions.AddChatText("Overriding user input of " + amount + " and using a value of 1 instead.", 1); amount = 1; } PluginCore.ChatCommand("b_nudgeZ", Math.Round((amount / 10), 2).ToString()); }
static void ChatCommand(string command, params string[] tokens) { StringBuilder sb = new StringBuilder(); sb.Append("@"); sb.Append(command); sb.Append(" "); foreach (string token in tokens) { sb.Append(token.Trim()); sb.Append(' '); } try { PluginCore.MyHost.Actions.InvokeChatParser(sb.ToString()); } catch (Exception ex) { PluginCore.LogError(ex); } }
private static void btnObjectSpin_Hit(object sender, EventArgs e) { PluginCore.ChatCommand("b_spin"); }
private static void btnObjectEditableDisabled_Hit(object sender, EventArgs e) { PluginCore.ChatCommand("b_enableEditing", "0"); }
private static void btnObjectSolidFalse_Hit(object sender, EventArgs e) { PluginCore.ChatCommand("b_setsolid", "0"); }
private static void btnSpawnToolClearLastAssessed_Hit(object sender, EventArgs e) { PluginCore.ChatCommand("removethis"); }