/// <summary> /// 执行GM命令 /// </summary> /// <param name="playerId">玩家编号</param> /// <param name="commandText">命令文本</param> /// <param name="operateText">操作文本</param> /// <param name="needReturn">是否需要返回</param> /// <param name="reportProcess">报告处理</param> /// <returns>是否成功</returns> protected override bool ExecuteGmCommand(string playerId, string commandText, string operateText, bool needReturn, Action <string> reportProcess) { if (this.selectListBox.Items.Count == 0) { this.errorLabel.Text = TableManager.GetGMTText(740); return(false); } bool success = true; string account = Session["user"] as string; foreach (var item in this.selectListBox.Items) { gmt.Server server = gmt.Server.GetServer(item.ToString()); if (server != null) { success &= AGmPage.ExecuteGmCommand(account, server, playerId, commandText, operateText, needReturn, reportProcess); } } return(success); }
protected void rechargeButton_Click(object sender, EventArgs e) { try { HttpWebRequest request = WebRequest.Create("http://192.168.1.26:8081/bill") as HttpWebRequest; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; byte[] byteArray = Encoding.UTF8.GetBytes("pushInfo=order:测试orderPushInfo&receipt=eyJhcmVhTmFtZSI6IiAiLCJjaGFubmVsSWQiOiIzMDUwIiwiZ29vZHNOdW1iZXIiOiI2MCIsInVzZXJpZCI6IjcxMzA1MDM5Mjg2OCIsImdvb2RzUHJpY2UiOjYsInJvbGVOYW1lIjoiICIsImdvb2RzUmVnaXN0ZXJJZCI6Ijg1Njc4MDAyIiwiYXBwRGF0ZSI6IjIwMTUwNDEzMDE1NzA2Iiwib3JkZXJJZCI6IjE1MDQxMzAxNTYzNzM0MjEyNyIsImFyZWFJZCI6IjUtMS02LTEiLCJyb2xlSWQiOiI0MzM2NiJ9&sign=31153d9089c07d739c6afe3900c93376"); request.ContentLength = byteArray.Length; Stream newStream = request.GetRequestStream(); newStream.Write(byteArray, 0, byteArray.Length);//写入参数 newStream.Close(); HttpWebResponse respone = request.GetResponse() as HttpWebResponse; using (StreamReader reader = new StreamReader(respone.GetResponseStream())) { string text = reader.ReadToEnd(); if (text != null && text != "") { this.errorLabel.Text += text; } else { this.errorLabel.Text += TableManager.GetGMTText(391); } } } catch (Exception exception) { DatabaseAssistant.ReportException(exception); this.errorLabel.Text += exception.ToString(); } }
/// <summary> /// 玩家添加按钮点击响应 /// </summary> protected void playerAddButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.playerTextBox.Text)) { this.reportLabel.Text = TableManager.GetGMTText(660); return; } string uidListText = this.playerTextBox.Text; Regex rg = new Regex("[\\r\\n,]"); uidListText = rg.Replace(uidListText, "\n"); string[] idSet = uidListText.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (var id in idSet) { if (!string.IsNullOrEmpty(id)) { this.playerListBox.Items.Add(id); } } this.playerTextBox.Text = ""; }
/// <summary> /// 上传按钮点击响应 /// </summary> protected void uploadButton_Click(object sender, EventArgs e) { if (this.noticeFileUpload.HasFile) { NoticeEditData.NoticeList = TableManager.Unserialize <mw.SysNtfConfig>(this.noticeFileUpload.FileBytes); NoticeEditData.DoLoad(); this.noticeListBox.Items.Clear(); foreach (var config in NoticeEditData.NoticeList) { if (config.id < NoticeEditData.CommonIdStart) { this.noticeListBox.Items.Add(new ListItem(this.GetNoticeText(config), config.title_id.ToString())); } } this.errorLabel.Text = TableManager.GMTDescTable[655].desc; TableManager.Save(NoticeEditData.NoticeList); } else { this.errorLabel.Text = TableManager.GMTDescTable[656].desc; } }
private static string GetQuestTypeName(int id) { return(string.Format("{0}({1})", TableManager.GetGMTText(30501 + id), id)); }
public static string GetItemName(int rwdType) { List <STSelectOption> list = new List <STSelectOption>(); switch (rwdType) { // 0 经济类型 case 0: foreach (var pair in playerHistroy.economicName) { STSelectOption stOption = new STSelectOption(); if (pair.Key == 0) { continue; } string text = string.Format("{0}({1})", TableManager.GetGMTText(21000 + (pair.Key)), pair.Key); stOption.value = pair.Key.ToString(); stOption.text = text; list.Add(stOption); } break; // 1 物品 case 1: foreach (var pair in TableManager.ItemTable) { STSelectOption stOption = new STSelectOption(); if (pair.Key == 0) { continue; } string text = string.Format("{0}({1})", TextManager.GetText(pair.Value.name), pair.Value.id); stOption.value = pair.Value.id.ToString(); stOption.text = text; list.Add(stOption); } break; // 2 武魂 case 2: case 3: foreach (var pair in TableManager.HeroTable) { STSelectOption stOption = new STSelectOption(); if (pair.Key == 0) { continue; } string text = string.Format("{0}({1})", TextManager.GetText(pair.Value.name), pair.Value.id); stOption.value = pair.Value.id.ToString(); stOption.text = text; list.Add(stOption); } break; // 3 饰品 case 4: foreach (var pair in TableManager.StoneTable) { if (pair.Key == 0) { continue; } string[] color = { "0", "1", "blue", "purple", "orange", "red" }; STSelectOption stOption = new STSelectOption(); string text = TextManager.GetText(pair.Value.name) + "[" + color[pair.Value.color] + "]" + "(" + pair.Value.id + ")"; stOption.value = pair.Value.id.ToString(); stOption.text = text; list.Add(stOption); } break; case 5: { foreach (var pair in TableManager.PetTable) { STSelectOption stOption = new STSelectOption(); string text = TextManager.GetText(pair.Value.name) + "[" + pair.Value.petstar + " STAR]" + "(" + pair.Value.idx + ")"; stOption.value = pair.Value.idx.ToString(); stOption.text = text; list.Add(stOption); } } break; // 8 晶石 case 8: foreach (var pair in TableManager.PetStoneTable) { STSelectOption stOption = new STSelectOption(); if (pair.Key == 0) { continue; } string text = TextManager.GetText(pair.Value.name) + "(" + pair.Value.id + ")"; stOption.value = pair.Value.id.ToString(); stOption.text = text; list.Add(stOption); } break; // 9 10 坐骑碎片 case 9: case 10: Regex r = new Regex("\\[.*?\\]"); foreach (var pair in TableManager.MountTable) { STSelectOption stOption = new STSelectOption(); if (pair.Key == 0) { continue; } string text = TextManager.GetText(pair.Value.name) + "(" + pair.Value.id + ")"; text = r.Replace(text, ""); stOption.value = pair.Value.id.ToString(); stOption.text = text; list.Add(stOption); } break; } string res = JsonConvert.SerializeObject(list); return(res); }
//最低版本号 protected void MinVersionTextBox_TextChanged(object sender, EventArgs e) { this.reportLabel.Text = TableManager.GetGMTText(872) + ":" + this.MinVersionTextBox.Text; }
/// <summary> /// 发送表格 /// </summary> /// <param name="version">版本号</param> /// <returns>是否成功</returns> public static bool SendTable(string version) { byte[] buffer = null; errorText = ""; foreach (var data in ServerListConfig.DataList) { string md5Path = version + "/updateex/" + data.Name + "/"; string tablePath = md5Path + TableManager.Directory; FTPManager.MakeDirectory(version + "/"); FTPManager.MakeDirectory(version + "/updateex/"); FTPManager.MakeDirectory(version + "/updateex/" + data.Name); FTPManager.MakeDirectory(tablePath); TableManager.ClearMD5Record(); // 活动 List <mw.ActivityConfig> Updateactivitytable = GMTActivityMananger.GetTableActivity().Values.ToList(); buffer = TableManager.Serialize(Updateactivitytable); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.ActivityConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.ActivityConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } List <mw.AchieveConfig> Updateachievetable = GMTActivityMananger.GetTableAchieve().Values.ToList(); buffer = TableManager.Serialize(Updateachievetable); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.AchieveConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.AchieveConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } List <mw.RewardConfig> Updaterewardtable = GMTActivityMananger.GetTableReward().Values.ToList(); buffer = TableManager.Serialize(Updaterewardtable); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.RewardConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.RewardConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } //编辑礼包 List <mw.GiftConfig> UpdatereGiftTable = new List <mw.GiftConfig>(); UpdatereGiftTable = GiftManager.addgiftconfig; buffer = TableManager.Serialize(UpdatereGiftTable); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.GiftConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.GiftConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } // 文本 buffer = TableManager.Serialize(TextManager.GetConfigList()); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.UIDescConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.UIDescConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } buffer = Encoding.UTF8.GetBytes(TableManager.GetMD5Text()); if (!FTPManager.Upload(md5Path + "md5.txt", buffer)) { errorText += FTPManager.GetLastError(); } } if (string.IsNullOrEmpty(errorText)) { return(true); } return(false); }
/// <summary> /// 发送 /// </summary> /// <typeparam name="T">配置类型</typeparam> /// <param name="list">配置列表</param> /// <param name="sendType">发送类型</param> /// <param name="initializedServer">初始化服务器</param> /// <returns>发送信息</returns> public static string Send <T>(List <T> list, int sendType = -1, gmt.Server initializedServer = null) where T : class, global::ProtoBuf.IExtensible { Type type = typeof(T); string[] name; if (!TableManager.tableNameDictionary.TryGetValue(type, out name)) { Log.AddLog(string.Format("错误表格的类型:", type.FullName)); return(TableManager.GetGMTText(901)); } string output = ""; if (sendType < 0) { if (!string.IsNullOrEmpty(name[2])) { sendType = int.Parse(name[2]); } } if (sendType >= 0) { byte[] versions = { (byte)DateTime.Now.Month, (byte)DateTime.Now.Day, (byte)DateTime.Now.Hour, (byte)DateTime.Now.Minute }; mw.AUTH_GMT_SETTINT_Ntf Ntf = new mw.AUTH_GMT_SETTINT_Ntf(); Ntf.type = (mw.EGMTSettintType)sendType; Ntf.verson = BitConverter.ToInt32(versions, 0); mw_serializer0 serializer = new mw_serializer0(); for (int i = 0; i < list.Count; ++i) { using (MemoryStream stream = new MemoryStream()) { serializer.Serialize(stream, list[i]); byte[] buffer = new byte[stream.Length]; stream.Position = 0; stream.Read(buffer, 0, buffer.Length); mw.AUTH_GMT_SETTINT_NODE node = new mw.AUTH_GMT_SETTINT_NODE(); node.len = buffer.Length; node.data = buffer; Ntf.info.Add(node); } } MemoryStream memoryStream = new MemoryStream(); ProtoSerializer.Instance.Serialize(memoryStream, Ntf); byte[] sendBuffer = new byte[memoryStream.Length]; memoryStream.Position = 0; memoryStream.Read(sendBuffer, 0, sendBuffer.Length); if (initializedServer != null) { output = TableManager.Send2Server(output, initializedServer, sendBuffer); } else { for (int i = 0; i < gmt.Server.Count; ++i) { output = TableManager.Send2Server(output, gmt.Server.GetServerAt(i), sendBuffer); } } } return(output); }
/// <summary> /// 生成按钮点击响应 /// </summary> protected void createButton_Click(object sender, EventArgs e) { if (this.channelList.SelectedIndex < 0) { return; } DateTime expiryDate = (DateTime)ViewState["expiryDate"]; if (expiryDate <= DateTime.Today) { return; } int count = 0; if (!int.TryParse(this.countTextBox.Text, out count) || count <= 0) { return; } Channel channel = CreateKey.ChannelSet[this.channelList.SelectedIndex]; gmt.Server keyServer = gmt.Server.GetServerAt(this.serverList.SelectedIndex); if (keyServer != null) { DatabaseAssistant.Execute ( keyServer.CodeDatabaseAddress, keyServer.CodeDatabasePort, keyServer.CodeDatabaseCharSet, keyServer.CodeDatabase, keyServer.CodeDatabaseUserId, keyServer.CodeDatabasePassword, "CALL xp_active_gen({0}, '{1}', {2}, {3}, {4}, {5});", count, channel.Prefix, channel.NumberCount > 0, channel.CharCount, channel.Id, (int)(expiryDate.Date - DateTime.Today).TotalDays ); StringBuilder builder = new StringBuilder(TableManager.GetGMTText(695) + ":"); DatabaseAssistant.Execute ( reader => { while (reader.Read()) { builder.Append("<br>").Append(reader.GetString(0)); } }, keyServer.CodeDatabaseAddress, keyServer.CodeDatabasePort, keyServer.CodeDatabaseCharSet, keyServer.CodeDatabase, keyServer.CodeDatabaseUserId, keyServer.CodeDatabasePassword, "SELECT `key_code` FROM `active` ORDER BY `gen_time` DESC LIMIT {0};", count ); this.resultLabel.Text = builder.ToString(); } }
/// <summary> /// 修改物品按钮点击响应 /// </summary> protected void modifyItemButton_Click(object sender, EventArgs e) { //道具数量不能为空 if (string.IsNullOrEmpty(this.countTextBox.Text)) { this.outputLabel.Text = TableManager.GetGMTText(702) + "!"; return; } if (int.Parse(this.countTextBox.Text) == 0) { this.outputLabel.Text = TableManager.GetGMTText(703) + "!"; return; } if (this.itemListBox.SelectedIndex < 0) { return; } if (giftListBox.SelectedIndex < 0) { outputLabel.Text = TableManager.GetGMTText(704) + "!"; return; } var config_in_all = GiftTable.GiftListEx[this.giftListBox.SelectedIndex]; mw.GiftConfig config = null; foreach (var cf in GiftTable.GiftListEx) { if (cf.id == config_in_all.id) { config = cf; } } if (null == config) { outputLabel.Text = TableManager.GetGMTText(705) + "!"; return; } switch (this.itemListBox.SelectedIndex) { case 0: config.reward_idx_0 = (mw.Enums.RewardType) this.typeDropDownList.SelectedIndex; config.reward_type_0 = int.Parse(this.idDropDownList.SelectedValue); config.reward_count_0 = int.Parse(this.countTextBox.Text); this.UpdateItem(0, config.reward_idx_0, config.reward_type_0, config.reward_count_0); break; case 1: config.reward_idx_1 = (mw.Enums.RewardType) this.typeDropDownList.SelectedIndex; config.reward_type_1 = int.Parse(this.idDropDownList.SelectedValue); config.reward_count_1 = int.Parse(this.countTextBox.Text); this.UpdateItem(1, config.reward_idx_1, config.reward_type_1, config.reward_count_1); break; case 2: config.reward_idx_2 = (mw.Enums.RewardType) this.typeDropDownList.SelectedIndex; config.reward_type_2 = int.Parse(this.idDropDownList.SelectedValue); config.reward_count_2 = int.Parse(this.countTextBox.Text); this.UpdateItem(2, config.reward_idx_2, config.reward_type_2, config.reward_count_2); break; case 3: config.reward_idx_3 = (mw.Enums.RewardType) this.typeDropDownList.SelectedIndex; config.reward_type_3 = int.Parse(this.idDropDownList.SelectedValue); config.reward_count_3 = int.Parse(this.countTextBox.Text); this.UpdateItem(3, config.reward_idx_3, config.reward_type_3, config.reward_count_3); break; } TableManager.Save(GiftTable.GiftListEx); }
/// <summary> /// 保存 /// </summary> public static void Save() { TableManager.Save(NoticeEditData.NoticeList); }
/// <summary> /// 载入 /// </summary> public static void Load() { NoticeEditData.NoticeList = TableManager.Load <mw.SysNtfConfig>(); NoticeEditData.DoLoad(); }
/// <summary> /// 发送按钮点击响应 /// </summary> protected void sendButton_Click(object sender, EventArgs e) { this.errorLabel.Text = TableManager.Send(NoticeEditData.NoticeList); }
private void addFTP(int idx, FTP ftp) { TableRow tRow = new TableRow(); TableCell tCell1 = new TableCell(); Label cellName1 = new Label(); cellName1.Text = string.Format(" FTP Site: "); tCell1.Controls.Add(cellName1); TextBox textBoxSite = new TextBox(); textBoxSite.Width = 350; textBoxSite.ID = "tbFTP_" + idx; if (null != ftp) { textBoxSite.Text = ftp.ftpSite; } tCell1.Controls.Add(textBoxSite); tRow.Cells.Add(tCell1); TableCell tCell2 = new TableCell(); Label cellName2 = new Label(); cellName2.Text = " " + TableManager.GetGMTText(230) + ": "; tCell2.Controls.Add(cellName2); TextBox textBoxUser = new TextBox(); textBoxUser.ID = "tbUser_" + idx; if (null != ftp) { textBoxUser.Text = ftp.ftpUser; } tCell2.Controls.Add(textBoxUser); tRow.Cells.Add(tCell2); TableCell tCell3 = new TableCell(); Label cellName3 = new Label(); cellName3.Text = " " + TableManager.GetGMTText(231) + ": "; tCell3.Controls.Add(cellName3); TextBox textBoxPwd = new TextBox(); textBoxPwd.TextMode = TextBoxMode.Password; textBoxPwd.ID = "tbPWD_" + idx; if (null != ftp) { textBoxPwd.Attributes.Add("value", ftp.ftpPassword); } tCell3.Controls.Add(textBoxPwd); tRow.Cells.Add(tCell3); TableCell tCell4 = new TableCell(); Button button = new Button(); button.Text = "-"; button.Click += new EventHandler(removeButton_Click); button.ID = "tbRemove_" + idx; tCell4.Controls.Add(button); tRow.Cells.Add(tCell4); ftpTable.Rows.Add(tRow); }
//查看服务器某一个server按钮 protected void SeeServerState_Click(object sender, EventArgs e) { this.reportLabel.Text = TableManager.GetGMTText(861); }
//新包下载地址 protected void URLOfNewPackageTextBox_TextChanged(object sender, EventArgs e) { this.reportLabel.Text = TableManager.GetGMTText(873) + ":" + this.URLOfNewPackageTextBox.Text; }
private static string GetRewardTypeName(int id) { return(string.Format("{0}({1})", TableManager.GetGMTText(20000 + id), id)); }
private static string GetItemName(int rwdType, int id) { switch (rwdType) { // 0 经济类型 case 0: return(string.Format("{0}({1})", TableManager.GetGMTText(21000 + (id)), id)); break; // 1 物品 case 1: { mw.ItemConfig config = null; TableManager.ItemTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}({1})", TextManager.GetText(config.name), id)); } } break; // 2 武魂 case 2: case 3: { mw.HeroBaseConfig config = null; TableManager.HeroTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}({1})", TextManager.GetText(config.name), id)); } } break; // 3 饰品 case 4: { mw.StoneConfig config = null; TableManager.StoneTable.TryGetValue(id, out config); if (null != config) { string[] color = { "0", "1", "blue", "purple", "orange", "red" }; return(string.Format("{0}[{1}]({2})", TextManager.GetText(config.name), color[config.color], id)); } } break; case 5: { mw.PetConfig config = null; TableManager.PetTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}[{1} STAR]({2})", TextManager.GetText(config.name), config.petstar, id)); } } break; // 8 晶石 case 8: { mw.ItemConfig config = null; TableManager.PetStoneTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}({1})", TextManager.GetText(config.name), id)); } } break; // 9 10 坐骑碎片 case 9: case 10: { Regex r = new Regex("\\[.*?\\]"); mw.MountConfig config = null; TableManager.MountTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}({1})", TextManager.GetText(config.name), id)); } } break; } return("Unknown Id: " + id); }
/// <summary> /// 页面载入响应 /// </summary> protected override void OnGmPageLoad() { if (!this.IsPostBack) { int idx = 0; #region 读取事件名称 causeNameList.Clear(); idx = 10000; while (idx < 20000) { if (TableManager.GMTDescTable.ContainsKey(idx)) { causeNameList.Add(TableManager.GetGMTText(idx)); } else { break; } idx++; } #endregion #region 读取奖励类型名称 { int[] keyArr = typeNameDic.Keys.ToArray(); for (int i = 0; i < keyArr.Length; ++i) { if (TableManager.GMTDescTable.ContainsKey(20000 + keyArr[i])) { typeNameDic[keyArr[i]] = TableManager.GetGMTText(20000 + keyArr[i]); } } } #endregion #region 读取经济类型名称 { int[] keyArr = economicName.Keys.ToArray(); for (int i = 0; i < keyArr.Length; ++i) { if (TableManager.GMTDescTable.ContainsKey(21000 + keyArr[i])) { economicName[keyArr[i]] = TableManager.GetGMTText(21000 + keyArr[i]); } } } //economicName.Clear(); //idx = 21000; //while (idx < 22000) //{ // if (TableManager.GMTDescTable.ContainsKey(idx)) // { // economicName.Add(idx - 21000, TableManager.GetGMTText(idx)); // } // idx++; //} #endregion #region 读取buff名称 buffNameList.Clear(); idx = 22000; while (idx < 23000) { if (TableManager.GMTDescTable.ContainsKey(idx)) { buffNameList.Add(TableManager.GetGMTText(idx)); } else { break; } idx++; } #endregion #region 物品名称 if (itemNameDic == null) { itemNameDic = new Dictionary <int, string>(); // 英雄 try { List <mw.HeroBaseConfig> hbc = TableManager.Load <mw.HeroBaseConfig>(); for (int i = 0; i < hbc.Count; i++) { itemNameDic.Add(hbc[i].id, TextManager.GetText(hbc[i].name)); } //物品 List <mw.ItemConfig> ic = TableManager.Load <mw.ItemConfig>(); for (int i = 0; i < ic.Count; i++) { if (itemNameDic.ContainsKey(ic[i].id)) { itemNameDic[ic[i].id] = TextManager.GetText(ic[i].name); } else { itemNameDic.Add(ic[i].id, TextManager.GetText(ic[i].name)); } } } catch (Exception ec) { } } #endregion } }
/// <summary> /// 更新物品 /// </summary> /// <param name="index">索引</param> /// <param name="type">奖励类型</param> /// <param name="id">物品编号</param> /// <param name="count">数量</param> private void UpdateItem(int index, mw.Enums.RewardType type, int id, int count) { StringBuilder builder = new StringBuilder(); builder.Append(this.typeDropDownList.Items[(int)type].Text); builder.Append(" | "); switch ((int)type) { // 0 经济类型 case 0: { if (id == 0 || !playerHistroy.economicName.ContainsKey(id)) { goto cannotFindID; } builder.Append(playerHistroy.economicName[id] + "(" + id + ")"); } break; // 1 物品 case 1: { if (!TableManager.ItemTable.ContainsKey(id)) { goto cannotFindID; } mw.ItemConfig itemInfo = TableManager.ItemTable[id]; builder.Append(TextManager.GetText(itemInfo.name) + "(" + id + ")"); } break; // 2 武魂 case 2: { if (!TableManager.HeroTable.ContainsKey(id)) { goto cannotFindID; } mw.HeroBaseConfig heroInfo = TableManager.HeroTable[id]; builder.Append(TextManager.GetText(heroInfo.name) + "(" + id + ")"); } break; // 3 饰品 case 3: { if (!TableManager.StoneTable.ContainsKey(id)) { goto cannotFindID; } mw.StoneConfig stoneInfo = TableManager.StoneTable[id]; builder.Append(TextManager.GetText(stoneInfo.name) + "(" + id + ")"); } break; // 4 晶石 case 4: { if (!TableManager.PetStoneTable.ContainsKey(id)) { goto cannotFindID; } mw.ItemConfig psInfo = TableManager.PetStoneTable[id]; builder.Append(TextManager.GetText(psInfo.name) + "(" + id + ")"); } break; // 5 坐骑碎片 case 5: { if (!TableManager.MountTable.ContainsKey(id)) { goto cannotFindID; } mw.MountConfig mountInfo = TableManager.MountTable[id]; builder.Append(TableManager.MountTable[id].name + "(" + id + ")"); } break; // 6 武将 case 6: { if (!TableManager.HeroTable.ContainsKey(id)) { goto cannotFindID; } builder.Append(TableManager.HeroTable[id].name + "(" + id + ")"); } break; // 7 经验 case 7: { if (id == 0) { builder.Append(TableManager.GetGMTText(338)); } else { builder.Append(TableManager.GetGMTText(339)); } } break; // 8 宠物 case 8: { if (!TableManager.PetTable.ContainsKey(id)) { goto cannotFindID; } mw.PetConfig petInfo = TableManager.PetTable[id]; builder.Append(TextManager.GetText(petInfo.name) + "[" + petInfo.petstar + " STAR]" + "(" + id + ")"); } break; // 9 坐骑 case 9: { if (!TableManager.MountTable.ContainsKey(id)) { goto cannotFindID; } mw.MountConfig mountInfo = TableManager.MountTable[id]; builder.Append(TextManager.GetText(mountInfo.name) + "(" + id + ")"); } break; } goto count; cannotFindID: builder.Append("Unknown(" + id + ")"); count: builder.Append(" | ").Append(count); if (index < this.itemListBox.Items.Count) { this.itemListBox.Items[index].Text = builder.ToString(); } else { this.itemListBox.Items.Add(new ListItem(builder.ToString(), index.ToString())); } }
/// <summary> /// 查询ID按钮点击响应 /// </summary> protected void findIdButton_Click(object sender, EventArgs e) { this.idLabel.Text = ""; if (this.selectListBox.Items.Count == 0) { this.errorLabel.Text = TableManager.GetGMTText(740); return; } if (string.IsNullOrEmpty(this.playerNameTextBox.Text) && string.IsNullOrEmpty(this.uidTextBox.Text) && string.IsNullOrEmpty(this.cyidTextBox.Text)) { this.errorLabel.Text = TableManager.GetGMTText(721); return; } StringBuilder builder = new StringBuilder(); for (int i = 0; i < this.selectListBox.Items.Count; ++i) { gmt.Server server = gmt.Server.GetServer(this.selectListBox.Items[i].Text); builder.Append("<b style='color:orange'>").Append(server.Name).Append("</b><br>"); string sql; if (!string.IsNullOrEmpty(this.playerNameTextBox.Text)) { sql = string.Format("SELECT `uname`,`uid`,`cyuid` FROM `user` WHERE `uname` LIKE '%{0}%';", DatabaseAssistant.DetectionSql(this.playerNameTextBox.Text)); } else if (!string.IsNullOrEmpty(this.uidTextBox.Text)) { sql = string.Format("SELECT `uname`,`uid`,`cyuid` FROM `user` WHERE `uid`='{0}';", DatabaseAssistant.DetectionSql(this.uidTextBox.Text)); } else { sql = string.Format("SELECT `uname`,`uid`,`cyuid` FROM `user` WHERE `cyuid`='{0}';", DatabaseAssistant.DetectionSql(this.cyidTextBox.Text)); } DatabaseAssistant.Execute(reader => { bool finded = false; while (reader.Read()) { finded = true; builder.Append(TableManager.GetGMTText(46) + ":").Append(reader.GetString(0)); builder.Append("	" + TableManager.GetGMTText(722) + ":").Append(reader.GetUInt32(1)); builder.Append("	" + TableManager.GetGMTText(48) + ":").Append(reader.GetString(2)); builder.Append("	" + TableManager.GetGMTText(59) + ":").Append(GetPlayerStatus(reader.GetUInt32(1))); builder.Append("<br>"); } if (!finded) { builder.Append(TableManager.GetGMTText(674) + "<br>"); } }, server.DatabaseAddress, server.DatabasePort, server.DatabaseCharSet, server.GameDatabase, server.DatabaseUserId, server.DatabasePassword, sql); } this.idLabel.Text = builder.ToString(); }
/// <summary> /// 生成按钮点击响应 /// </summary> protected void createButton_Click(object sender, EventArgs e) { this.errorLabel.Text = ""; if (this.channelList.SelectedIndex < 0) { return; } if (this.typeTextBox.Text == null || this.typeTextBox.Text == "") { return; } if (this.giftDropDownList.Items == null) { return; } int count = 0; if (!int.TryParse(this.countTextBox.Text, out count) || count <= 0) { return; } //如果使用次数不填,则默认为1 if (string.IsNullOrEmpty(this.UseTimes.Text)) { this.UseTimes.Text = "1"; } Channel channel = CreateKey.ChannelSet[this.channelList.SelectedIndex]; gmt.Server keyServer = gmt.Server.GetServerAt(this.serverList.SelectedIndex); int selectvalue = 0; if (!int.TryParse(this.Mutitimes.SelectedValue, out selectvalue)) { return; } if (keyServer != null) { bool error = DatabaseAssistant.Execute ( keyServer.CodeDatabaseAddress, keyServer.CodeDatabasePort, keyServer.CodeDatabaseCharSet, keyServer.CodeDatabase, keyServer.CodeDatabaseUserId, keyServer.CodeDatabasePassword, "CALL xp_gift_gen({0}, {1}, {2}, '{3}', {4}, '{5}','{6}','{7}','{8}');", count, 10, channel.Id, DatabaseAssistant.DetectionSql(this.typeTextBox.Text), this.giftDropDownList.SelectedValue, channel.GiftChar, ((DateTime)ViewState["expiryDate"]).ToString("yyyy-MM-dd"), int.Parse(this.UseTimes.Text), selectvalue ); if (!error) { this.resultLabel.Text = TableManager.GetGMTText(691); return; } StringBuilder builder = new StringBuilder(TableManager.GetGMTText(692) + ":"); DatabaseAssistant.Execute ( reader => { while (reader.Read()) { builder.Append("<br>").Append(reader.GetString(0)); } }, keyServer.CodeDatabaseAddress, keyServer.CodeDatabasePort, keyServer.CodeDatabaseCharSet, keyServer.CodeDatabase, keyServer.CodeDatabaseUserId, keyServer.CodeDatabasePassword, "SELECT `gift_code` FROM `gift` ORDER BY `gen_time` DESC LIMIT {0};", count ); this.resultLabel.Text = builder.ToString(); } }
/// <summary> /// 显示信息按钮点击响应 /// </summary> protected void informationButton_Click(object sender, EventArgs e) { this.idLabel.Text = ""; uint playerId = this.GetPlayerId(); if (playerId != 0) { gmt.Server server = gmt.Server.GetServer(this.selectListBox.Items[0].ToString()); StringBuilder builder = new StringBuilder(); if (string.IsNullOrEmpty(server.GameDatabase)) { return; } //记录各项信息的字符串 string vipLevel = "" , teamLevel = "" , yuanbao_all = "" , yuanbao = "" , money = "" , energy = "" , lingyu = "" , registerTime = "" , heroCount = "" , fuben = "" , guildName = "" , onlinetime = "" , smallMonth = "" , bigMonth = "" , lastSaveTime = ""; #region VIP等级、金钱、元宝、体力、在线时长、充值元宝总数、灵玉、最后登录时间 DatabaseAssistant.Execute( reader => { if (reader.Read()) { vipLevel = reader.GetInt32(0).ToString(); money = reader.GetInt32(1).ToString(); yuanbao = reader.GetInt32(2).ToString(); energy = reader.GetInt32(3).ToString(); onlinetime = reader.GetInt32(4) / 3600 + TableManager.GetGMTText(741); onlinetime += (reader.GetInt32(4) % 3600) / 60 + TableManager.GetGMTText(742); onlinetime += reader.GetInt32(4) % 60 + TableManager.GetGMTText(94); yuanbao_all = reader.GetInt32(5).ToString(); lingyu = reader.GetInt32(6).ToString(); lastSaveTime = reader.GetDateTime(7).ToString(); } }, server.DatabaseAddress, server.DatabasePort, server.DatabaseCharSet, server.GameDatabase, server.DatabaseUserId, server.DatabasePassword, "SELECT `vip_level`,`money`,`yuanbao`,`energy`,`online_time`,`yuanbao_all`,`hero_soul_ex`,`last_save_time` FROM `user_info` WHERE `uid`={0};", playerId); #endregion #region 副本进度、帮派名称 DatabaseAssistant.Execute( reader => { if (reader.Read()) { byte[] buffer = new byte[reader.GetBytes(0, 0, null, 0, int.MaxValue)]; reader.GetBytes(0, 0, buffer, 0, buffer.Length); using (MemoryStream stream = new MemoryStream(buffer)) { mw.OtherInfo othern = ProtoSerializer.Instance.Deserialize(stream, null, typeof(mw.OtherInfo)) as mw.OtherInfo; fuben = othern.instanceInfo.comm_instance.ToString(); guildName = othern.guildInfo.name; if (string.IsNullOrEmpty(guildName)) { guildName = TableManager.GetGMTText(743); } } } }, server.DatabaseAddress, server.DatabasePort, server.DatabaseCharSet, server.GameDatabase, server.DatabaseUserId, server.DatabasePassword, "SELECT `other_data` FROM `other_info` WHERE `uid`={0};", playerId); #endregion #region 创建时间 int dayidx = 0; //记录创建时间是一年中的第几天 DateTime registertime = DateTime.Now; //角色创建时间 DatabaseAssistant.Execute(reader => { registerTime = TableManager.GetGMTText(719); if (reader.Read()) { DateTime datetime = reader.GetDateTime(0); registerTime = datetime.ToString(); dayidx = reader.GetDateTime(0).DayOfYear; registertime = reader.GetDateTime(0); } }, server.DatabaseAddress, server.DatabasePort, server.DatabaseCharSet, server.GameDatabase, server.DatabaseUserId, server.DatabasePassword, "SELECT `register_time` FROM `user` WHERE `uid`={0};", playerId); #endregion #region 团队等级、武将数量 DatabaseAssistant.Execute( reader => { if (reader.Read()) { byte[] buffer = new byte[reader.GetBytes(0, 0, null, 0, int.MaxValue)]; reader.GetBytes(0, 0, buffer, 0, buffer.Length); using (MemoryStream stream = new MemoryStream(buffer)) { mw.HeroPackage heroPackage = ProtoSerializer.Instance.Deserialize(stream, null, typeof(mw.HeroPackage)) as mw.HeroPackage; teamLevel = heroPackage.level.ToString(); heroCount = heroPackage.heroInfos.Count.ToString(); } } }, server.DatabaseAddress, server.DatabasePort, server.DatabaseCharSet, server.GameDatabase, server.DatabaseUserId, server.DatabasePassword, "SELECT `card_data` FROM `card_package` WHERE `uid`={0};", playerId); #endregion #region 月卡 //小月卡=超值月卡 DatabaseAssistant.Execute( reader => { smallMonth = TableManager.GetGMTText(743); if (reader.Read()) { DateTime datetime = reader.GetDateTime(0); smallMonth = datetime.ToString(); } }, server.DatabaseAddress, server.DatabasePort, server.DatabaseCharSet, server.GameDatabase, server.DatabaseUserId, server.DatabasePassword, "SELECT `s_month_time` FROM `user_info` WHERE `uid`={0};", playerId); //大月卡=至尊卡 DatabaseAssistant.Execute( reader => { bigMonth = TableManager.GetGMTText(744); if (reader.Read()) { if (reader.GetInt32(0) == 1) { bigMonth = TableManager.GetGMTText(745); } } }, server.DatabaseAddress, server.DatabasePort, server.DatabaseCharSet, server.GameDatabase, server.DatabaseUserId, server.DatabasePassword, "SELECT `ex_month_time` FROM `user_info` WHERE `uid`={0};", playerId); #endregion #region 显示 if (vipLevel == "") { vipLevel = "0"; } if (teamLevel == "") { teamLevel = "0"; } if (yuanbao_all == "") { yuanbao_all = "0"; } if (yuanbao == "") { yuanbao = "0"; } if (money == "") { money = "0"; } if (energy == "") { energy = "0"; } if (lingyu == "") { lingyu = "0"; } if (heroCount == "") { heroCount = "0"; } if (fuben == "") { fuben = TableManager.GetGMTText(743); } if (guildName == "") { guildName = TableManager.GetGMTText(743); } if (onlinetime == "") { onlinetime = "0"; } builder.Append("<table><tr><td colspan='8'>" + TableManager.GetGMTText(57) + "</td></tr>"); builder.Append("<tr><td colspan='2'>" + TableManager.GetGMTText(58) + ":").Append(playerId); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(59) + ":").Append(GetPlayerStatus(playerId)); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(60) + ":").Append(vipLevel); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(61) + ":").Append(teamLevel); builder.Append("</td></tr><tr><td colspan='2'>" + TableManager.GetGMTText(62) + ":").Append(yuanbao_all); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(63) + ":").Append(yuanbao); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(64) + ":").Append(money); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(65) + ":").Append(energy); builder.Append("</td></tr><tr><td colspan='2'>" + TableManager.GetGMTText(66) + ":").Append(lingyu); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(67) + ":").Append(heroCount); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(68) + ":").Append(fuben); builder.Append("</td><td colspan='2'>" + TableManager.GetGMTText(69) + ":").Append(guildName); builder.Append("</td></tr><tr><td colspan='4'>" + TableManager.GetGMTText(70) + ":").Append(registerTime); builder.Append("</td><td colspan='4'>" + TableManager.GetGMTText(71) + ":").Append(lastSaveTime); builder.Append("</td></tr><tr><td colspan='2'>" + TableManager.GetGMTText(72) + ":").Append(onlinetime); builder.Append("</td><td colspan='4'>" + TableManager.GetGMTText(746) + ":").Append(smallMonth); builder.Append("</td></tr><tr><td colspan='2'>" + TableManager.GetGMTText(74) + ":").Append(bigMonth); builder.Append("</td></tr></table>"); this.idLabel.Text = builder.ToString(); #endregion } }
/// <summary> /// 开始 /// </summary> public static void Start() { List <mw.ActivityConfig> listActivity = TableManager.Load <mw.ActivityConfig>("protodatas/ActivityConfig.protodata.bytes"); if (null != listActivity) { foreach (var config in listActivity) { ActivityTable.Add(config.id, config); } } List <mw.ItemConfig> itemList = TableManager.Load <mw.ItemConfig>(); if (itemList != null) { foreach (var item in itemList) { if (item.type != mw.Enums.ItemType.ITEM_TYPE_PET_STONE) { if (!TableManager.ItemTable.ContainsKey(item.id)) { TableManager.ItemTable.Add(item.id, item); } } else { if (!TableManager.PetStoneTable.ContainsKey(item.id)) { TableManager.PetStoneTable.Add(item.id, item); } } } } List <mw.HeroBaseConfig> heroList = TableManager.Load <mw.HeroBaseConfig>(); if (heroList != null) { foreach (var card in heroList) { TableManager.HeroTable.Add(card.id, card); } } List <mw.PetConfig> petList = TableManager.Load <mw.PetConfig>(); if (petList != null) { foreach (var pet in petList) { TableManager.PetTable.Add(pet.idx, pet); } } List <mw.GMTDescConfig> gmtDescList = TableManager.Load <mw.GMTDescConfig>(); if (gmtDescList != null) { foreach (var gmtDesc in gmtDescList) { TableManager.GMTDescTable.Add(gmtDesc.id, gmtDesc); } } List <mw.RmbShopConfig> rmbShopList = TableManager.Load <mw.RmbShopConfig>(); if (null != rmbShopList) { for (int i = 0; i < rmbShopList.Count; i++) { string index = string.Format("{0}-{1}", rmbShopList[i].channel, rmbShopList[i].goods_RegisterId); TableManager.RmbShopTable.Add(index, rmbShopList[i]); } } List <mw.MountConfig> mountList = TableManager.Load <mw.MountConfig>(); if (null != mountList) { for (int i = 0; i < mountList.Count; ++i) { if (!TableManager.MountTable.ContainsKey(mountList[i].id)) { TableManager.MountTable.Add(mountList[i].id, mountList[i]); } } } List <mw.StoneConfig> stoneList = TableManager.Load <mw.StoneConfig>(); if (null != stoneList) { for (int i = 0; i < stoneList.Count; ++i) { TableManager.StoneTable.Add(stoneList[i].id, stoneList[i]); } } }
//最大同时在线人数 protected void MaxOnlineTextBox_TextChanged(object sender, EventArgs e) { this.reportLabel.Text = TableManager.GetGMTText(870) + ":" + this.MaxOnlineTextBox.Text; }
/// <summary> /// 打包表格 /// </summary> /// <param name="version">版本</param> /// <returns>Zip包缓冲区</returns> public static byte[] PackTable(string version) { using (MemoryStream memory = new MemoryStream()) { using (ZipOutputStream stream = new ZipOutputStream(memory)) { byte[] buffer = null; // 服务器列表 if (!string.IsNullOrEmpty(version) && version[version.Length - 1] != '/') { version = version + '/'; } foreach (var data in ServerListConfig.DataList) { string md5Path = version + "updateex/" + data.Name + "/"; string tablePath = md5Path + TableManager.Directory; TableManager.ClearMD5Record(); // 活动 List <mw.ActivityConfig> Updateactivitytable = GMTActivityMananger.GetTableActivity().Values.ToList(); if (null != Updateactivitytable) { buffer = TableManager.Serialize(Updateactivitytable); TableManager.UpdateMD5(buffer, TableManager.Directory + "ActivityExConfig.protodata.bytes"); stream.PutNextEntry(new ZipEntry(tablePath + "ActivityExConfig.protodata.bytes")); stream.Write(buffer, 0, buffer.Length); } List <mw.AchieveConfig> Updateachievetable = GMTActivityMananger.GetTableAchieve().Values.ToList(); if (null != Updateachievetable) { buffer = TableManager.Serialize(Updateachievetable); TableManager.UpdateMD5(buffer, TableManager.Directory + "AchieveExConfig.protodata.bytes"); stream.PutNextEntry(new ZipEntry(tablePath + "AchieveExConfig.protodata.bytes")); stream.Write(buffer, 0, buffer.Length); } List <mw.RewardConfig> Updaterewardtable = GMTActivityMananger.GetTableReward().Values.ToList(); if (null != Updaterewardtable) { buffer = TableManager.Serialize(Updaterewardtable); TableManager.UpdateMD5(buffer, TableManager.Directory + "RewardExConfig.protodata.bytes"); stream.PutNextEntry(new ZipEntry(tablePath + "RewardExConfig.protodata.bytes")); stream.Write(buffer, 0, buffer.Length); } // 文本 buffer = TableManager.Serialize(TextManager.GetConfigList()); TableManager.UpdateMD5(buffer, TableManager.Directory + "UIDescExConfig.protodata.bytes"); stream.PutNextEntry(new ZipEntry(tablePath + "UIDescExConfig.protodata.bytes")); stream.Write(buffer, 0, buffer.Length); buffer = Encoding.UTF8.GetBytes(TableManager.GetMD5Text()); stream.PutNextEntry(new ZipEntry(md5Path + "md5.txt")); stream.Write(buffer, 0, buffer.Length); } stream.CloseEntry(); stream.Finish(); byte[] zipBuffer = new byte[memory.Length]; Array.Copy(memory.GetBuffer(), zipBuffer, zipBuffer.Length); return(zipBuffer); } } }
//客户端资源文件下载地址 protected void URLOfClientResourceTextBox_TextChanged(object sender, EventArgs e) { this.reportLabel.Text = TableManager.GetGMTText(871) + ":" + this.URLOfClientResourceTextBox.Text; }
/// <summary> /// 保存 /// </summary> public static void Save() { TableManager.Save(TextManager.GetConfigList()); }
/// <summary> /// 获取玩家编号 /// </summary> /// <param name="needReport">是否需要报告</param> /// <returns>玩家编号</returns> private uint GetPlayerId(bool needReport = true) { if (this.selectListBox.Items.Count == 0) { if (needReport) { this.errorLabel.Text = TableManager.GetGMTText(740); } return(0); } if (this.selectListBox.Items.Count != 1) { if (needReport) { this.errorLabel.Text = TableManager.GetGMTText(748); } return(0); } gmt.Server server = gmt.Server.GetServer(this.selectListBox.Items[0].ToString()); if (server == null) { if (needReport) { this.errorLabel.Text = TableManager.GetGMTText(749); } return(0); } uint playerId = 0; string sql; if (!string.IsNullOrEmpty(this.playerNameTextBox.Text)) { sql = string.Format("SELECT `uid` FROM `user` WHERE `uname`='{0}';", DatabaseAssistant.DetectionSql(this.playerNameTextBox.Text)); } else if (!string.IsNullOrEmpty(this.uidTextBox.Text)) { sql = string.Format("SELECT `uid` FROM `user` WHERE `uid`='{0}';", DatabaseAssistant.DetectionSql(this.uidTextBox.Text)); } else if (!string.IsNullOrEmpty(this.cyidTextBox.Text)) { sql = string.Format("SELECT `uid` FROM `user` WHERE `cyuid`='{0}';", DatabaseAssistant.DetectionSql(this.cyidTextBox.Text)); } else { this.errorLabel.Text = TableManager.GetGMTText(721); return(0); } DatabaseAssistant.Execute(reader => { if (reader.Read()) { playerId = reader.GetUInt32(0); } }, server.DatabaseAddress, server.DatabasePort, server.DatabaseCharSet, server.GameDatabase, server.DatabaseUserId, server.DatabasePassword, sql); //else if (this.playerChannelIdTextBox.Text != null && this.playerChannelIdTextBox.Text != "") //{ // DatabaseAssistant.Execute(reader => // { // if (reader.Read()) { playerId = reader.GetUInt32(0); } // }, // server.DatabaseAddress, // server.DatabasePort, // server.DatabaseCharSet, // server.GmAddress, // server.DatabaseUserId, // server.DatabasePassword, // "SELECT `uid` FROM `user` WHERE `cyuid`='{0}';", DatabaseAssistant.DetectionSql(this.playerChannelIdTextBox.Text)); //} if (playerId == 0 && needReport) { this.errorLabel.Text += TableManager.GetGMTText(737) + "\r\n"; } return(playerId); }