internal void AddClass(CWClass x) { Query("INSERT INTO Classes (Name, Category, Description, Buffs, Itemgen, Auras, Inventory, MaxHealth, MaxMana, ExtraSlot, Locations, Statblob) " + "VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11)", x.name, x.category, Blob.Description(x.description), Blob.Buff(x.buffs), Blob.ItemRestock(x.items), Blob.Aura(x.auras) /*@5*/, Blob.Inventory(x.inventory), x.maxHealth, x.maxMana, x.extraSlot, Blob.LocationLinks(x.locations), Blob.Stat(x.stats)); }
internal void AddClass(TSPlayer player, string name) { CWClass newClass = new CWClass(name, "none", new List <string>(), new List <Buff>(), new List <ItemRestock>(), new List <Aura>(), player.PlayerData.inventory, player.PlayerData.maxHealth, player.PlayerData.maxMana, ExtraSlotUnNull(player.PlayerData.extraSlot), new List <LocationLink>(), new List <Stat>()); class_db.AddClass(newClass); }
private void ClassMod(CommandArgs args) { TSPlayer player = args.Player; #region help if (args.Parameters.Count == 0 || args.Parameters[0] == "help") { player.SendErrorMessage("Aliases: /cwmod, /cwm"); player.SendErrorMessage("/cwm select [class name]"); player.SendErrorMessage("/cwm add [class name]"); player.SendErrorMessage("/cwm del"); player.SendErrorMessage("/cwm set {inv | stats}"); player.SendErrorMessage("/cwm buff {add | del | clear} [buff name/id] [duration] <itemHeld>"); player.SendErrorMessage("/cwm itemgen {add | del | clear} [refresh] [maxQuantity]"); player.SendErrorMessage("/cwm link {set | clear}"); player.SendErrorMessage("/cwm desc {get | set} [line] [description text]"); player.SendErrorMessage("/cwm category {get | set | list} [category]"); return; } #endregion /*wheeee, first command is done, on to the other three. But first, have some command syntax before i forget to write this down anywhere outside of the source code.*/ #region select if (args.Parameters[0] == "select") { if (args.Parameters.Count == 1) { player.SendErrorMessage("Usage: /cwm select [class name]"); player.SendErrorMessage("This selects a class for other class modifying commands to reference"); return; } int resultType = 0; args.Parameters.RemoveAt(0); string search = string.Join(" ", args.Parameters); string results = CUtil.ClassExists(search, ref resultType); switch (resultType) { case -1: player.SendErrorMessage(results); break; case 0: case 1: PInfo.SelectClass(player.Name, results); player.SendSuccessMessage("Class " + results + " selected."); break; case 2: player.SendErrorMessage("Multiple classes found: "); player.SendErrorMessage(results); break; } return; } #endregion #region add if (args.Parameters[0] == "add") { if (args.Parameters.Count == 0) { player.SendErrorMessage("Usage: /cwm add [class name]"); player.SendErrorMessage("This adds a new class with the given name, using your current inventory and stats"); return; } int resultType = 0; args.Parameters.RemoveAt(0); string name = string.Join(" ", args.Parameters); string results = CUtil.ClassExists(name, ref resultType); if (resultType == 0) { player.SendErrorMessage("There is already a class named " + name); return; } CUtil.AddClass(player, name); player.SendSuccessMessage("Class " + name + " successfully added."); PInfo.SelectClass(player.Name, name); player.SendSuccessMessage("Class " + name + " has been automatically selected."); return; } #endregion #region checkSelected string selectedClass = PInfo.GetClassEdit(player.Name); if (selectedClass == "none") { player.SendErrorMessage("Please select a class using \"/cwm select\"before using this command."); return; } CWClass c = CUtil.GetClass(selectedClass); #endregion #region del if (args.Parameters[0].ToLower() == "del") { if (CUtil.DelClass(c.name)) { player.SendSuccessMessage("Class " + c.name + " successfully deleted."); } else { player.SendErrorMessage("Warning: Unknown class selected: " + c.name); player.SendErrorMessage("Deselecting unknown class."); } PInfo.SelectClass(player.Name, "none"); return; } #endregion #region set if (args.Parameters[0].ToLower() == "set") { if (args.Parameters.Count == 1 || (args.Parameters[1].ToLower() != "inv" && args.Parameters[1].ToLower() != "stats" && args.Parameters[1].ToLower() != "stat")) { player.SendErrorMessage("Usage: /cwm set {inv | stats}"); player.SendErrorMessage("This sets the inventory or health/mana of a class to that of your current player."); return; } if (args.Parameters[1].ToLower() == "inv") { c.inventory = player.PlayerData.inventory; } if (args.Parameters[1].ToLower() == "stat" || args.Parameters[1].ToLower() == "stats") { c.maxHealth = player.PlayerData.maxHealth; c.maxMana = player.PlayerData.maxMana; c.extraSlot = player.PlayerData.extraSlot; } CUtil.UpdateClass(c); player.SendSuccessMessage("Successfully updated " + c.name); return; } #endregion #region buff if (args.Parameters[0].ToLower() == "buff") { if (args.Parameters.Count == 1 || (args.Parameters[1].ToLower() != "del" && args.Parameters[1].ToLower() != "add" && args.Parameters[1].ToLower() != "clear")) { player.SendErrorMessage("Usage: /cwm buff {add | del | clear} [buff name/id] [duration] <itemHeld>"); player.SendErrorMessage("This allows modifications of a class's buffs and itembuffs."); player.SendErrorMessage("<itemHeld> should be 0 or empty for permanent buffs, 1 for buffs while holding an item, and 2 for buffs while not holding an item."); player.SendErrorMessage("if <itemheld> is not 0, the currently item you are currently holding is used."); return; } if (args.Parameters[1].ToLower() == "clear") { c.buffs = new List <Buff>(); CUtil.UpdateClass(c); player.SendSuccessMessage("All buffs cleared from class " + c.name); return; } if (args.Parameters[1].ToLower() == "add") { if (args.Parameters.Count < 4) { player.SendErrorMessage("Usage: /cwm buff add [buff name/id] [duration] <itemHeld>"); player.SendErrorMessage("<itemHeld> should be 0 or empty for permanent buffs, 1 for buffs while holding an item, and 2 for buffs while not holding an item."); player.SendErrorMessage("if <itemheld> is not 0, the currently item you are currently holding is used."); return; } int buffID; if (!int.TryParse(args.Parameters[2].ToLower(), out buffID)) { List <int> t = TShock.Utils.GetBuffByName(args.Parameters[2].ToLower()); if (t.Count > 1) { player.SendErrorMessage("Multiple buff IDs found: " + string.Join(", ", t)); return; } else if (t.Count == 1) { buffID = t[0]; } else if (t.Count == 0) { player.SendErrorMessage("Buff " + args.Parameters[2] + " not found."); return; } } float duration; if (!float.TryParse(args.Parameters[3].ToLower(), out duration)) { player.SendErrorMessage("Please only use numerical durations."); return; } if (args.Parameters.Count == 5 && args.Parameters[4].ToLower() != "0" && args.Parameters[4].ToLower() != "no") { Item tempItem = player.TPlayer.HeldItem; switch (args.Parameters[4].ToLower()) { case "1": c.buffs.Add(new Buff(buffID, (int)duration * 10, tempItem.netID, 1)); CUtil.UpdateClass(c); player.SendSuccessMessage("Buff " + TShock.Utils.GetBuffName(buffID) + " has been added to " + c.name + " with a duration of " + duration + " seconds, while holding " + tempItem.Name); return; case "2": c.buffs.Add(new Buff(buffID, (int)duration * 10, tempItem.netID, 0)); CUtil.UpdateClass(c); player.SendSuccessMessage("Buff " + TShock.Utils.GetBuffName(buffID) + " has been added to " + c.name + " with a duration of " + duration + " seconds, while not holding " + tempItem.Name); return; } } c.buffs.Add(new Buff(buffID, (int)duration * 10)); CUtil.UpdateClass(c); player.SendSuccessMessage("Buff " + TShock.Utils.GetBuffName(buffID) + " has been added to " + c.name + " with a duration of " + duration + " seconds."); return; } if (args.Parameters[1].ToLower() == "del") { int buffID; if (!int.TryParse(args.Parameters[2].ToLower(), out buffID)) { List <int> t = TShock.Utils.GetBuffByName(args.Parameters[2].ToLower()); if (t.Count > 1) { player.SendErrorMessage("Multiple buff IDs found: " + string.Join(", ", t)); return; } else if (t.Count == 1) { buffID = t[0]; } else if (t.Count == 0) { player.SendErrorMessage("Buff " + args.Parameters[2] + " not found."); return; } } c.buffs.RemoveAll(b => b.id == buffID); CUtil.UpdateClass(c); player.SendSuccessMessage("All instances of " + TShock.Utils.GetBuffName(buffID) + " have been removed from " + c.name + "."); return; } return; } #endregion #region itemgen if (args.Parameters[0].ToLower() == "itemGen") { if (args.Parameters.Count == 1 || (args.Parameters[1].ToLower() != "del" && args.Parameters[1].ToLower() != "add" && args.Parameters[1].ToLower() != "clear")) { player.SendErrorMessage("Usage: /cwm itemgen {add | del | clear} [refresh] [maxQuantity]"); player.SendErrorMessage("This allows modification of a class's regenerating items."); player.SendErrorMessage("'/cwm itemgen add' utilizes the prefix, quantity, and item id of the player's currently selected item."); player.SendErrorMessage("The stack size of the currently held item determines the number of items given at one time."); return; } if (args.Parameters[1].ToLower() == "clear") { c.items = new List <ItemRestock>(); CUtil.UpdateClass(c); player.SendSuccessMessage("Class " + c.name + " has been cleared of itemgens."); return; } if (args.Parameters[1].ToLower() == "add") { if (args.Parameters.Count < 4) { player.SendErrorMessage("Usage: /cwm itemgen add [refresh] [maxQuantity]"); return; } float refresh; if (!float.TryParse(args.Parameters[2], out refresh)) { player.SendErrorMessage("Please use numerals for the refresh time."); return; } int maxCount; if (!int.TryParse(args.Parameters[3], out maxCount)) { player.SendErrorMessage("Please use numerals for the maximum item count."); return; } Item tempItem = player.TPlayer.HeldItem; c.items.Add(new ItemRestock((int)refresh * 10, tempItem.netID, tempItem.stack, maxCount, tempItem.prefix)); CUtil.UpdateClass(c); if (tempItem.prefix == 0) { player.SendSuccessMessage(c.name + " will now receive " + tempItem.stack + " " + tempItem.Name + " every " + (float)refresh / 10 + " seconds."); } else { player.SendSuccessMessage(c.name + " will now receive " + tempItem.stack + " " + TShock.Utils.GetPrefixById(tempItem.prefix) + " " + tempItem.Name + " every " + (float)refresh / 10 + " seconds."); } return; } if (args.Parameters[1].ToLower() == "del") { Item tempItem = player.TPlayer.HeldItem; player.SendSuccessMessage(c.items.RemoveAll(i => i.item == tempItem.netID) + " itemgen(s) removed from " + c.name + "."); CUtil.UpdateClass(c); return; } return; } #endregion #region link if (args.Parameters[0].ToLower() == "link") { if (args.Parameters.Count == 1 || (args.Parameters[1].ToLower() != "set" && args.Parameters[1].ToLower() != "clear")) { player.SendErrorMessage("Usage: /cwm link {set | clear}"); player.SendErrorMessage("This command allows you set and remove locations that will cause a player to automatically preview a class."); return; } if (args.Parameters[1].ToLower() == "clear") { c.locations = new List <LocationLink>(); CUtil.UpdateClass(c); player.SendSuccessMessage("All location links removed from " + c.name); return; } if (args.Parameters[1].ToLower() == "set") { c.locations.Add(new LocationLink(player.TileX, player.TileY)); player.SendSuccessMessage("New location link set at your current location for " + c.name); CUtil.UpdateClass(c); return; } } #endregion #region description if (args.Parameters[0].ToLower() == "desc" || args.Parameters[0].ToLower() == "description") { if (args.Parameters.Count == 1 || (args.Parameters[1].ToLower() != "get" && args.Parameters[1].ToLower() != "set")) { player.SendErrorMessage("Usage: /cwm desc {get | set} [line] [description text]"); player.SendErrorMessage("This command allows you to check and set the description of a class, one line at a time."); return; } if (args.Parameters[1].ToLower() == "get") { if (c.description.Count == 0) { player.SendErrorMessage(c.name + " does not have a description."); return; } foreach (string s in c.description) { player.SendSuccessMessage(s); } return; } if (args.Parameters[1].ToLower() == "set") { if (args.Parameters.Count < 4) { player.SendErrorMessage("Usage: /cwm desc set [line] [description text]"); return; } int line; if (!int.TryParse(args.Parameters[2], out line)) { player.SendErrorMessage("Unable to parse line number."); return; } args.Parameters.RemoveAt(0); args.Parameters.RemoveAt(0); args.Parameters.RemoveAt(0); c.description[line - 1] = string.Join(" ", args.Parameters); player.SendSuccessMessage("Description line " + line + " of " + c.name + " set."); player.SendSuccessMessage("Current description for " + c.name + " is now:"); foreach (string s in c.description) { player.SendSuccessMessage(s); } return; } } #endregion #region category if (args.Parameters[0] == "cat" || args.Parameters[0] == "category") { if (args.Parameters.Count == 1 || (args.Parameters[1].ToLower() != "get" && args.Parameters[1].ToLower() != "set" && args.Parameters[1].ToLower() != "list")) { player.SendErrorMessage("Usage: /cwm category {get | set | list} [category]"); player.SendErrorMessage("This command allows you to retrieve or specify the category of a class."); player.SendErrorMessage("Categories should be a single word, and cannot consist entirely of numbers."); return; } if (args.Parameters[1].ToLower() == "get") { if (c.category == "none") { player.SendErrorMessage(c.name + " does not have a category yet."); } else { player.SendSuccessMessage(c.name + " is in the \"" + c.category + "\" category."); } return; } if (args.Parameters[1].ToLower() == "set") { if (args.Parameters.Count == 2) { player.SendErrorMessage("Usage: /cwm category set [category]"); player.SendErrorMessage("This specifies the category of the currently selected class."); return; } float YouMotherFucker; if (float.TryParse(args.Parameters[2], out YouMotherFucker)) { player.SendErrorMessage("Didn't you read the help text? What kind of category is " + args.Parameters[2] + " anyways?"); TShockAPI.Commands.HandleCommand(TSPlayer.Server, "/slap " + player.Name + " 5"); return; } TextInfo TI = new CultureInfo("en-US", false).TextInfo; c.category = TI.ToTitleCase(args.Parameters[2]); CUtil.UpdateClass(c); player.SendSuccessMessage(c.name + " is now categorized under \"" + c.category + "\""); return; } if (args.Parameters[1].ToLower() == "list") { List <string> categories = new List <string>(); foreach (CWClass x in CUtil.classes) { categories.Add(x.category); } categories = categories.Distinct().ToList(); player.SendSuccessMessage("Categories: "); player.SendSuccessMessage(string.Join(", ", categories)); return; } } #endregion }
internal void SetClass(TSPlayer player, string className, ref PlayerInfo PInfo) { if (PInfo.GetClassPlaying(player.Name) == "none") { PInfo.SetBackup(player); } PInfo.SetPlaying(player.Name, className); CWClass c = GetClass(className); player.IgnoreSSCPackets = true; player.PlayerData.health = c.maxHealth; player.PlayerData.maxHealth = c.maxHealth; player.TPlayer.statLifeMax2 = c.maxHealth; player.TPlayer.statLifeMax = c.maxHealth; player.TPlayer.statLife = c.maxHealth; player.TPlayer.statManaMax = c.maxMana; player.TPlayer.statMana = c.maxMana; if (c.extraSlot > 0) { player.TPlayer.extraAccessory = c.extraSlot.Value == 1 ? true : false; } //F**k this shit down here, this is copied from tshock's playerdata.restore() #region invCopy for (int i = 0; i < NetItem.MaxInventory; i++) { if (i < NetItem.InventoryIndex.Item2) { //0-58 player.TPlayer.inventory[i].netDefaults(c.inventory[i].NetId); if (player.TPlayer.inventory[i].netID != 0) { player.TPlayer.inventory[i].stack = c.inventory[i].Stack; player.TPlayer.inventory[i].prefix = c.inventory[i].PrefixId; } } else if (i < NetItem.ArmorIndex.Item2) { //59-78 var index = i - NetItem.ArmorIndex.Item1; player.TPlayer.armor[index].netDefaults(c.inventory[i].NetId); if (player.TPlayer.armor[index].netID != 0) { player.TPlayer.armor[index].stack = c.inventory[i].Stack; player.TPlayer.armor[index].prefix = (byte)c.inventory[i].PrefixId; } } else if (i < NetItem.DyeIndex.Item2) { //79-88 var index = i - NetItem.DyeIndex.Item1; player.TPlayer.dye[index].netDefaults(c.inventory[i].NetId); if (player.TPlayer.dye[index].netID != 0) { player.TPlayer.dye[index].stack = c.inventory[i].Stack; player.TPlayer.dye[index].prefix = (byte)c.inventory[i].PrefixId; } } else if (i < NetItem.MiscEquipIndex.Item2) { //89-93 var index = i - NetItem.MiscEquipIndex.Item1; player.TPlayer.miscEquips[index].netDefaults(c.inventory[i].NetId); if (player.TPlayer.miscEquips[index].netID != 0) { player.TPlayer.miscEquips[index].stack = c.inventory[i].Stack; player.TPlayer.miscEquips[index].prefix = (byte)c.inventory[i].PrefixId; } } else if (i < NetItem.MiscDyeIndex.Item2) { //93-98 var index = i - NetItem.MiscDyeIndex.Item1; player.TPlayer.miscDyes[index].netDefaults(c.inventory[i].NetId); if (player.TPlayer.miscDyes[index].netID != 0) { player.TPlayer.miscDyes[index].stack = c.inventory[i].Stack; player.TPlayer.miscDyes[index].prefix = (byte)c.inventory[i].PrefixId; } } else if (i < NetItem.PiggyIndex.Item2) { //98-138 var index = i - NetItem.PiggyIndex.Item1; player.TPlayer.bank.item[index].netDefaults(c.inventory[i].NetId); if (player.TPlayer.bank.item[index].netID != 0) { player.TPlayer.bank.item[index].stack = c.inventory[i].Stack; player.TPlayer.bank.item[index].prefix = (byte)c.inventory[i].PrefixId; } } else if (i < NetItem.SafeIndex.Item2) { //138-178 var index = i - NetItem.SafeIndex.Item1; player.TPlayer.bank2.item[index].netDefaults(c.inventory[i].NetId); if (player.TPlayer.bank2.item[index].netID != 0) { player.TPlayer.bank2.item[index].stack = c.inventory[i].Stack; player.TPlayer.bank2.item[index].prefix = (byte)c.inventory[i].PrefixId; } } else if (i < NetItem.TrashIndex.Item2) { //179-219 var index = i - NetItem.TrashIndex.Item1; player.TPlayer.trashItem.netDefaults(c.inventory[i].NetId); if (player.TPlayer.trashItem.netID != 0) { player.TPlayer.trashItem.stack = c.inventory[i].Stack; player.TPlayer.trashItem.prefix = (byte)c.inventory[i].PrefixId; } } else if (i < NetItem.ForgeIndex.Item2) { //220 var index = i - NetItem.ForgeIndex.Item1; player.TPlayer.bank3.item[index].netDefaults(c.inventory[i].NetId); if (player.TPlayer.bank3.item[index].netID != 0) { player.TPlayer.bank3.item[index].stack = c.inventory[i].Stack; player.TPlayer.bank3.item[index].Prefix((byte)c.inventory[i].PrefixId); } } else { //260 var index = i - NetItem.VoidIndex.Item1; player.TPlayer.bank4.item[index].netDefaults(c.inventory[i].NetId); if (player.TPlayer.bank4.item[index].netID != 0) { player.TPlayer.bank4.item[index].stack = c.inventory[i].Stack; player.TPlayer.bank4.item[index].Prefix((byte)c.inventory[i].PrefixId); } } } float slot = 0f; for (int k = 0; k < NetItem.InventorySlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].inventory[k].Name), player.Index, slot, (float)Main.player[player.Index].inventory[k].prefix); slot++; } for (int k = 0; k < NetItem.ArmorSlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].armor[k].Name), player.Index, slot, (float)Main.player[player.Index].armor[k].prefix); slot++; } for (int k = 0; k < NetItem.DyeSlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].dye[k].Name), player.Index, slot, (float)Main.player[player.Index].dye[k].prefix); slot++; } for (int k = 0; k < NetItem.MiscEquipSlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].miscEquips[k].Name), player.Index, slot, (float)Main.player[player.Index].miscEquips[k].prefix); slot++; } for (int k = 0; k < NetItem.MiscDyeSlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].miscDyes[k].Name), player.Index, slot, (float)Main.player[player.Index].miscDyes[k].prefix); slot++; } for (int k = 0; k < NetItem.PiggySlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank.item[k].prefix); slot++; } for (int k = 0; k < NetItem.SafeSlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank2.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank2.item[k].prefix); slot++; } NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].trashItem.Name), player.Index, slot++, (float)Main.player[player.Index].trashItem.prefix); for (int k = 0; k < NetItem.ForgeSlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank3.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank3.item[k].prefix); slot++; } for (int k = 0; k < NetItem.VoidSlots; k++) { NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank4.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank4.item[k].prefix); slot++; } NetMessage.SendData(4, -1, -1, NetworkText.FromLiteral(player.Name), player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(42, -1, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(16, -1, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0); slot = 0f; for (int k = 0; k < NetItem.InventorySlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].inventory[k].Name), player.Index, slot, (float)Main.player[player.Index].inventory[k].prefix); slot++; } for (int k = 0; k < NetItem.ArmorSlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].armor[k].Name), player.Index, slot, (float)Main.player[player.Index].armor[k].prefix); slot++; } for (int k = 0; k < NetItem.DyeSlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].dye[k].Name), player.Index, slot, (float)Main.player[player.Index].dye[k].prefix); slot++; } for (int k = 0; k < NetItem.MiscEquipSlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].miscEquips[k].Name), player.Index, slot, (float)Main.player[player.Index].miscEquips[k].prefix); slot++; } for (int k = 0; k < NetItem.MiscDyeSlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].miscDyes[k].Name), player.Index, slot, (float)Main.player[player.Index].miscDyes[k].prefix); slot++; } for (int k = 0; k < NetItem.PiggySlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank.item[k].prefix); slot++; } for (int k = 0; k < NetItem.SafeSlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank2.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank2.item[k].prefix); slot++; } NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].trashItem.Name), player.Index, slot++, (float)Main.player[player.Index].trashItem.prefix); for (int k = 0; k < NetItem.ForgeSlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank3.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank3.item[k].prefix); slot++; } for (int k = 0; k < NetItem.VoidSlots; k++) { NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank4.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank4.item[k].prefix); slot++; } NetMessage.SendData(4, player.Index, -1, NetworkText.FromLiteral(player.Name), player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(42, player.Index, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(16, player.Index, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0); for (int k = 0; k < 22; k++) { player.TPlayer.buffType[k] = 0; } #endregion }
internal void UpdateClass(CWClass newClass) { classes[classes.FindIndex(c => c.name == newClass.name)] = newClass; class_db.UpdateClass(newClass); }
internal void UpdateClass(CWClass x) { Query("UPDATE Classes SET Category = @0, Description = @1, Buffs = @2, Itemgen = @3, Auras = @4, Inventory = @5, MaxHealth = @6, MaxMana = @7, ExtraSlot = @8, Locations = @9, Statblob = @10 WHERE Name = @11", x.category, Blob.Description(x.description), Blob.Buff(x.buffs), Blob.ItemRestock(x.items), Blob.Aura(x.auras) /*@4*/, Blob.Inventory(x.inventory), x.maxHealth, x.maxMana, x.extraSlot, Blob.LocationLinks(x.locations), Blob.Stat(x.stats), x.name); }