protected override void Execute() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WO_GetDataGameRewards"; if (!CallWOApi(sqcmd)) return; StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<rewards>"); while (reader.Read()) { // strip name of RWD_ string name = reader["RewardName"].ToString(); name = name.Substring(4); xml.Append("<rwd "); xml.Append(xml_attr("ID", reader["RewardID"])); xml.Append(xml_attr("Name", name)); xml.Append(xml_attr("GD_CQ", reader["GD_CQ"])); xml.Append(xml_attr("HP_CQ", reader["HP_CQ"])); xml.Append(xml_attr("GD_DM", reader["GD_DM"])); xml.Append(xml_attr("HP_DM", reader["HP_DM"])); xml.Append(xml_attr("GD_SB", reader["GD_SB"])); xml.Append(xml_attr("HP_SB", reader["HP_SB"])); xml.Append("/>\n"); } xml.Append("</rewards>"); GResponse.Write(xml.ToString()); }
protected override void Execute() { string username = web.Param("username"); string password = web.Param("password"); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_ACCOUNT_LOGIN"; sqcmd.Parameters.AddWithValue("@in_IP", LastIP); sqcmd.Parameters.AddWithValue("@in_EMail", username); sqcmd.Parameters.AddWithValue("@in_Password", password); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int CustomerID = getInt("CustomerID");; int AccountStatus = getInt("AccountStatus"); int SessionID = 0; int IsDeveloper = 0; if (CustomerID > 0) { SessionID = getInt("SessionID"); IsDeveloper = getInt("IsDeveloper"); } GResponse.Write("WO_0"); GResponse.Write(string.Format("{0} {1} {2}", CustomerID, SessionID, AccountStatus)); }
protected override void Execute() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_GetShopInfo1"; if (!CallWOApi(sqcmd)) { return; } // "SHO1" byte[] itemHdr = new byte[4] { 83, 72, 79, 49 }; MemoryStream ms = new MemoryStream(); ms.Write(itemHdr, 0, 4); // all items while (reader.Read()) { OutShopItem(ms); } ms.Write(itemHdr, 0, 4); GResponse.Write("WO_0"); GResponse.BinaryWrite(ms.ToArray()); }
void GetLeaderboardNew() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_ClanGetList"; sqcmd.Parameters.AddWithValue("@in_SortType", web.Param("t")); sqcmd.Parameters.AddWithValue("@in_Start", web.Param("pos")); sqcmd.Parameters.AddWithValue("@in_Size", web.Param("s")); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int Size = getInt("Size"); StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append(string.Format("<clans size=\"{0}\">", Size)); reader.NextResult(); while (reader.Read()) { OutClanInfo(xml, reader); } xml.Append("</clans>"); GResponse.Write(xml.ToString()); }
void SRV_ServerGetFullList() { string skey1 = web.Param("skey1"); if (skey1 != SERVER_API_KEY) { throw new ApiExitException("bad key"); } SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_ServerGetList"; sqcmd.Parameters.AddWithValue("@in_CustomerID", 0); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); OutputXmlServerInfo(xml, reader, true); GResponse.Write(xml.ToString()); }
void GetBoxInfo() { string LootID = web.Param("LootID"); ReadLootInfo(LootID); // can get content only for storecat_MysteryBox //if (category_ != 3) // throw new ApiExitException("can't get content for loot"); StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<box>"); foreach (LootEntry le in loots_) { xml.Append("<e "); xml.Append(xml_attr("ID", le.ItemID.ToString())); if (le.ItemID == 0) { xml.Append(xml_attr("v1", le.GDMin.ToString())); xml.Append(xml_attr("v2", le.GDMax.ToString())); } else { xml.Append(xml_attr("v1", le.ExpDaysMin.ToString())); xml.Append(xml_attr("v2", le.ExpDaysMax.ToString())); } xml.Append("/>\n"); } xml.Append("</box>"); GResponse.Write(xml.ToString()); }
protected override void Execute() { string CustomerID = web.CustomerID(); string SessionID = web.SessionKey(); string GameSessionID = web.Param("GSID"); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WO_UpdateLoginSession2"; sqcmd.Parameters.AddWithValue("@in_IP", LastIP); sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID); sqcmd.Parameters.AddWithValue("@in_SessionID", SessionID); sqcmd.Parameters.AddWithValue("@in_GameSessionID", GameSessionID); if (!CallWOApi(sqcmd)) { return; } GResponse.Write("WO_0"); if (GameSessionID == "0") { ReportFriendStatus(); } else { // skip friends - we're in game GResponse.Write("<?xml version=\"1.0\"?>\n"); } }
protected override void Execute() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_GetDataGameRewards"; if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<rewards>"); while (reader.Read()) { string name = reader["Name"].ToString(); xml.Append("<rwd "); xml.Append(xml_attr("ID", reader["ID"])); xml.Append(xml_attr("Name", name)); xml.Append(xml_attr("GD_SOFT", reader["GD_SOFT"])); xml.Append(xml_attr("XP_SOFT", reader["XP_SOFT"])); xml.Append(xml_attr("GD_HARD", reader["GD_HARD"])); xml.Append(xml_attr("XP_HARD", reader["XP_HARD"])); xml.Append("/>\n"); } xml.Append("</rewards>"); GResponse.Write(xml.ToString()); }
void GetLeaderboard() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_ClanGetInfo"; sqcmd.Parameters.AddWithValue("@in_ClanID", 0); sqcmd.Parameters.AddWithValue("@in_GetMembers", 0); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<clans>"); while (reader.Read()) { OutClanInfo(xml, reader); } xml.Append("</clans>"); GResponse.Write(xml.ToString()); }
void GetInfo() { string ClanID = web.Param("ClanID"); string GetMembers = web.Param("GetMembers"); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_ClanGetInfo"; sqcmd.Parameters.AddWithValue("@in_ClanID", ClanID); sqcmd.Parameters.AddWithValue("@in_GetMembers", GetMembers); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<clan_info>"); // out clan info reader.Read(); OutClanInfo(xml, reader); // out clan members if (GetMembers != "0") { reader.NextResult(); xml.Append("<members>"); while (reader.Read()) { xml.Append("<m "); xml.Append(xml_attr("id", reader["CharID"])); xml.Append(xml_attr("cr", reader["ClanRank"])); xml.Append(xml_attr("gt", reader["Gamertag"])); xml.Append(xml_attr("cgp", reader["ClanContributedGP"])); xml.Append(xml_attr("cxp", reader["ClanContributedXP"])); xml.Append(xml_attr("xp", reader["XP"])); xml.Append(xml_attr("tp", reader["TimePlayed"])); xml.Append(xml_attr("r", reader["Reputation"])); xml.Append(xml_attr("ts00", reader["Stat00"])); xml.Append(xml_attr("ts01", reader["Stat01"])); xml.Append(xml_attr("ts02", reader["Stat02"])); xml.Append(xml_attr("ts03", reader["Stat03"])); xml.Append("/>"); } xml.Append("</members>"); } xml.Append("</clan_info>"); GResponse.Write(xml.ToString()); }
protected override void Execute() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WO_GetItemsData"; if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<items>"); // gears xml.Append("<gears>"); while (reader.Read()) { OutGearData(xml); } xml.Append("</gears>"); // weapons reader.NextResult(); xml.Append("<weapons>"); while (reader.Read()) { OutWeaponData(xml); } xml.Append("</weapons>"); // generics. right now - mystery crates/loot boxes reader.NextResult(); xml.Append("<generics>"); while (reader.Read()) { OutGenericsData(xml); } xml.Append("</generics>"); // packages reader.NextResult(); xml.Append("<packages>"); while (reader.Read()) { OutPackageData(xml); } xml.Append("</packages>"); xml.Append("</items>"); GResponse.Write(xml.ToString()); }
protected override void Execute() { //this API is public //if (!WoCheckLoginSession()) // return; string CustomerID = web.CustomerID(); string StartPos = web.Param("pos"); string TableID = web.Param("t"); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WO_LeaderboardGet"; sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID); sqcmd.Parameters.AddWithValue("@in_TableID", TableID); sqcmd.Parameters.AddWithValue("@in_StartPos", StartPos); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int CurPos = getInt("StartPos"); int Size = getInt("Size"); // report page of leaderboard StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append(string.Format("<leaderboard pos=\"{0}\" size=\"{1}\">", CurPos, Size)); reader.NextResult(); while (reader.Read()) { xml.Append("<f "); xml.Append(xml_attr("GT", reader["Gamertag"])); xml.Append(xml_attr("XP", reader["HonorPoints"])); xml.Append(xml_attr("k", reader["Kills"])); xml.Append(xml_attr("d", reader["Deaths"])); xml.Append(xml_attr("w", reader["Wins"])); xml.Append(xml_attr("l", reader["Losses"])); xml.Append(xml_attr("f", reader["ShotsFired"])); xml.Append(xml_attr("h", reader["ShotsHit"])); xml.Append(xml_attr("t", reader["TimePlayed"])); xml.Append(xml_attr("p", reader["HavePremium"])); xml.Append("/>"); } xml.Append("</leaderboard>"); GResponse.Write(xml.ToString()); }
protected override void Execute() { if (!WoCheckLoginSession()) { return; } SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_LeaderboardGet"; sqcmd.Parameters.AddWithValue("@in_CharID", web.Param("CharID")); sqcmd.Parameters.AddWithValue("@in_TableID", web.Param("t")); sqcmd.Parameters.AddWithValue("@in_StartPos", web.Param("pos")); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int CurPos = getInt("StartPos"); int Size = getInt("Size"); // report page of leaderboard StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append(string.Format("<leaderboard pos=\"{0}\" size=\"{1}\">", CurPos, Size)); reader.NextResult(); while (reader.Read()) { xml.Append("<l "); xml.Append(xml_attr("GT", reader["Gamertag"])); xml.Append(xml_attr("a", reader["Alive"])); xml.Append(xml_attr("XP", reader["XP"])); xml.Append(xml_attr("tp", reader["TimePlayed"])); xml.Append(xml_attr("r", reader["Reputation"])); xml.Append(xml_attr("ts00", reader["Stat00"])); xml.Append(xml_attr("ts01", reader["Stat01"])); xml.Append(xml_attr("ts02", reader["Stat02"])); xml.Append(xml_attr("ts03", reader["Stat03"])); xml.Append(xml_attr("gs", reader["GameServerId"])); xml.Append(xml_attr("ci", reader["ClanID"])); xml.Append(xml_attr("ct", reader["ClanTag"])); xml.Append(xml_attr("cc", reader["ClanTagColor"])); xml.Append("/>"); } xml.Append("</leaderboard>"); GResponse.Write(xml.ToString()); }
protected override void Execute() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_GetSafelocksInfo"; if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); while (reader.Read()) { string Password = reader["Password"].ToString(); string GamePos = reader["GamePos"].ToString(); string GameRot = reader["GameRot"].ToString(); string SafeLockID = reader["SafeLockID"].ToString(); string ItemID = reader["ItemID"].ToString(); string ExpireTime = reader["ExpireTime"].ToString(); string MapID = reader["MapID"].ToString(); string Quantity = reader["Quantity"].ToString(); string Var1 = reader["Var1"].ToString(); string Var2 = reader["Var2"].ToString(); string GameServerID = reader["GameServerID"].ToString(); string CustomerID = reader["CustomerID"].ToString(); // string Durability = reader["Durability"].ToString(); xml.Append("<SafeLock_items "); xml.Append(xml_attr("SafeLockID", SafeLockID)); xml.Append(xml_attr("Password", Password)); xml.Append(xml_attr("ItemID", ItemID)); xml.Append(xml_attr("ExpireTime", ExpireTime)); xml.Append(xml_attr("GamePos", GamePos)); xml.Append(xml_attr("GameRot", GameRot)); xml.Append(xml_attr("MapID", MapID)); xml.Append(xml_attr("Quantity", Quantity)); xml.Append(xml_attr("Var1", Var1)); xml.Append(xml_attr("Var2", Var2)); xml.Append(xml_attr("GameServerID", GameServerID)); xml.Append(xml_attr("CustomerID", CustomerID)); // xml.Append(xml_attr("Durability", Durability)); xml.Append("/>\n"); } GResponse.Write(xml.ToString()); }
protected override void Execute() { string username = web.Param("userfuckingshit"); string password = web.Param("passwordfuckyou"); string serverkey = web.Param("serverkey"); string computerid = web.Param("computerid"); string miniacrc = web.Param("miniacrc"); string warguardcrc = web.Param("warguardcrc"); string mac = web.Param("mac"); // GResponse.Write("WO_0"); // return; //SaveApiLog("api_Login.aspx"); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_ACCOUNT_LOGIN"; sqcmd.Parameters.AddWithValue("@in_IP", LastIP); sqcmd.Parameters.AddWithValue("@in_EMail", username); sqcmd.Parameters.AddWithValue("@in_Password", password); sqcmd.Parameters.AddWithValue("@in_HardwareID", computerid); sqcmd.Parameters.AddWithValue("@in_MiniACRC", miniacrc); sqcmd.Parameters.AddWithValue("@in_WarGuardCRC", warguardcrc); sqcmd.Parameters.AddWithValue("@in_Mac", mac); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int CustomerID = getInt("CustomerID");; int AccountStatus = getInt("AccountStatus"); int SessionID = 0; int IsDeveloper = 0; if (CustomerID > 0) { SessionID = getInt("SessionID"); IsDeveloper = getInt("IsDeveloper"); } GResponse.Write("WO_0"); GResponse.Write(string.Format("{0} {1} {2}", CustomerID, SessionID, AccountStatus)); }
protected override void Execute() { if (!WoCheckLoginSession()) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); ReportClanStatus(ref xml); GResponse.Write(xml.ToString()); }
protected override void Execute() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WO_GetShopInfo5"; if (!CallWOApi(sqcmd)) { return; } // "SHO3" byte[] itemHdr = new byte[4] { 83, 72, 79, 51 }; MemoryStream ms = new MemoryStream(); ms.Write(itemHdr, 0, 4); OutSkillPrices2(ms); ms.Write(itemHdr, 0, 4); // common items reader.NextResult(); while (reader.Read()) { OutShopItem(ms); } // packages - must be SAME as item for now reader.NextResult(); while (reader.Read()) { // package can be disabled if (getInt("IsEnabled") == 0) { continue; } OutShopItem(ms); } ms.Write(itemHdr, 0, 4); GResponse.Write("WO_0"); GResponse.BinaryWrite(ms.ToArray()); }
void ReportFriendStatus() { string CustomerID = web.CustomerID(); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WO_FriendGetStatus"; sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<frstatus>"); xml.Append("<friends>"); while (reader.Read()) { xml.Append("<f "); xml.Append(xml_attr("ID", reader["FriendID"])); xml.Append(xml_attr("GT", reader["Gamertag"])); xml.Append(xml_attr("on", reader["Online"])); xml.Append(xml_attr("gsid", reader["GameSessionID"])); xml.Append("/>"); } xml.Append("</friends>"); reader.NextResult(); xml.Append("<pending>"); while (reader.Read()) { xml.Append("<f "); xml.Append(xml_attr("ID", reader["CustomerID"])); xml.Append(xml_attr("GT", reader["Gamertag"])); xml.Append(xml_attr("XP", reader["HonorPoints"])); xml.Append("/>"); } xml.Append("</pending>"); xml.Append("</frstatus>"); GResponse.Write(xml.ToString()); }
protected override void Execute() { //this API is public //if (!WoCheckLoginSession()) // return; string Hardcore = web.Param("Hardcore"); string Type = web.Param("Type"); string Page = web.Param("Page"); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_LeaderboardGet"; //sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID); sqcmd.Parameters.AddWithValue("@in_Hardcore", Hardcore); sqcmd.Parameters.AddWithValue("@in_Type", Type); sqcmd.Parameters.AddWithValue("@in_Page", Page); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int StartPos = getInt("StartPos"); int PageCount = getInt("PageCount"); // report page of leaderboard StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append(string.Format("<leaderboard pos=\"{0}\" pc=\"{1}\">", StartPos, PageCount)); reader.NextResult(); while (reader.Read()) { xml.Append("<f "); xml.Append(xml_attr("gt", reader["Gamertag"])); xml.Append(xml_attr("a", reader["Alive"])); xml.Append(xml_attr("d", reader["Data"])); xml.Append(xml_attr("cid", reader["ClanId"])); xml.Append("/>"); } xml.Append("</leaderboard>"); GResponse.Write(xml.ToString()); }
void GPGetConvertRates() { bool fromSteam = false; if (web.OptionalParam("steam", false) != null) { fromSteam = true; } SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_GPGetConversionRates"; sqcmd.Parameters.AddWithValue("@in_CustomerID", web.CustomerID()); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<rates>\n"); while (reader.Read()) { xml.Append("<r "); xml.Append(xml_attr("GP", reader["GamePoints"])); xml.Append(xml_attr("Rate", reader["ConversionRate"])); xml.Append("/>"); } xml.Append("</rates>\n"); xml.Append("<gc>\n"); xml.Append("<r "); int[] prices = fromSteam ? SteamGCPriceTable : GCPriceTable; for (int i = 0; i < prices.Length; i++) { xml.Append(xml_attr(String.Format("r{0}", i), prices[i].ToString())); } xml.Append("/>"); xml.Append("</gc>\n"); GResponse.Write(xml.ToString()); }
void ServerGetList() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_ServerGetList"; sqcmd.Parameters.AddWithValue("@in_CustomerID", web.CustomerID()); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); OutputXmlServerInfo(xml, reader, false); GResponse.Write(xml.ToString()); }
void GetObjects() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_SRV_ObjectsGetAll"; sqcmd.Parameters.AddWithValue("@in_GameServerID", web.Param("GameSID")); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<sobjects>\n"); while (reader.Read()) { xml.Append("<obj "); xml.Append(xml_attr("ServerObjectID", reader["ServerObjectID"])); xml.Append(xml_attr("CreateDate", ToUnixTime(Convert.ToDateTime(reader["CreateUtcDate"])))); xml.Append(xml_attr("ExpireMins", reader["ExpireMins"])); xml.Append(xml_attr("ObjType", reader["ObjType"])); xml.Append(xml_attr("ObjClassName", reader["ObjClassName"])); xml.Append(xml_attr("ItemID", reader["ItemID"])); xml.Append(xml_attr("px", reader["px"])); xml.Append(xml_attr("py", reader["py"])); xml.Append(xml_attr("pz", reader["pz"])); xml.Append(xml_attr("rx", reader["rx"])); xml.Append(xml_attr("ry", reader["ry"])); xml.Append(xml_attr("rz", reader["rz"])); xml.Append(xml_attr("CustomerID", reader["CustomerID"])); xml.Append(xml_attr("CharID", reader["CharID"])); xml.Append(xml_attr("Var1", reader["Var1"])); xml.Append(xml_attr("Var2", reader["Var2"])); xml.Append(xml_attr("Var3", reader["Var3"])); xml.Append("/>"); } xml.Append("</sobjects>\n"); GResponse.Write(xml.ToString()); }
protected override void Execute() { if (!WoCheckLoginSession()) { return; } SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_GetGPTransactions"; sqcmd.Parameters.AddWithValue("@in_CustomerID", web.CustomerID()); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int GamePoints = getInt("GamePoints"); // report page of leaderboard StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append(string.Format("<gplog balance=\"{0}\">", GamePoints)); reader.NextResult(); while (reader.Read()) { xml.Append("<l "); xml.Append(xml_attr("i", reader["TransactionID"])); xml.Append(xml_attr("t", ToUnixTime(Convert.ToDateTime(reader["TransactionTime"])))); xml.Append(xml_attr("a", reader["Amount"])); xml.Append(xml_attr("p", reader["Previous"])); xml.Append(xml_attr("d", reader["TransactionDesc"])); xml.Append("/>"); } xml.Append("</gplog>"); GResponse.Write(xml.ToString()); }
void ServerGetPrices() { ReadPricesFromDB(true); StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append(string.Format("<srent>")); xml.Append("<g "); PriceOptionsToXML(ref xml, ref OptGameServer); xml.Append("/>"); xml.Append("<s "); PriceOptionsToXML(ref xml, ref OptStronghold); xml.Append("/>"); xml.Append("</srent>"); GResponse.Write(xml.ToString()); }
void GetInfo() { string CustomerID = web.CustomerID(); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WO_RetBonusGetInfo"; sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); // current number of days reader.Read(); xml.Append("<retbonus "); xml.Append(xml_attr("d", reader["RetDays"])); xml.Append(xml_attr("m", reader["MinsToNextDay"])); xml.Append(">"); // report bonuses by day xml.Append("<days>"); reader.NextResult(); while (reader.Read()) { xml.Append("<d "); xml.Append(xml_attr("b", reader["Bonus"])); xml.Append("/>"); } xml.Append("</days>"); xml.Append("</retbonus>"); GResponse.Write(xml.ToString()); }
void GetNotes() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_SRV_NoteGetAll"; sqcmd.Parameters.AddWithValue("@in_GameServerID", web.Param("GameSID")); if (!CallWOApi(sqcmd)) { return; } reader.Read(); DateTime CurUtcDate = Convert.ToDateTime(reader["CurUtcDate"]); reader.NextResult(); StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<notes>\n"); while (reader.Read()) { DateTime ExpireUtcDate = Convert.ToDateTime(reader["ExpireUtcDate"]); Int64 ExpireMins = Convert.ToInt32((ExpireUtcDate - CurUtcDate).TotalMinutes); xml.Append("<note "); xml.Append(xml_attr("NoteID", reader["NoteID"])); xml.Append(xml_attr("CreateDate", ToUnixTime(Convert.ToDateTime(reader["CreateUtcDate"])))); xml.Append(xml_attr("ExpireMins", ExpireMins.ToString())); xml.Append(xml_attr("TextFrom", reader["TextFrom"])); xml.Append(xml_attr("TextSubj", reader["TextSubj"])); xml.Append(xml_attr("GamePos", reader["GamePos"])); xml.Append("/>"); } xml.Append("</notes>\n"); GResponse.Write(xml.ToString()); }
void GetSavedState() { SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_SRV_SavedStateGet"; sqcmd.Parameters.AddWithValue("@in_GameServerID", web.Param("GameSID")); if (!CallWOApi(sqcmd)) { return; } reader.Read(); GResponse.Write("WO_0"); if (getInt("HaveData") == 0) { // return empty xml GResponse.Write("<?xml version=\"1.0\"?>"); return; } GResponse.Write(GetString(reader["SavedState"] as byte[])); }
void FriendGetInfo() { string CustomerID = web.CustomerID(); string FriendID = web.Param("FriendID"); SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_FriendGetStats"; sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID); sqcmd.Parameters.AddWithValue("@in_FriendID", FriendID); if (!CallWOApi(sqcmd)) { return; } StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<friends>"); while (reader.Read()) { xml.Append("<f "); xml.Append(xml_attr("ID", reader["FriendID"])); xml.Append(xml_attr("XP", reader["HonorPoints"])); xml.Append(xml_attr("k", reader["Kills"])); xml.Append(xml_attr("d", reader["Deaths"])); xml.Append(xml_attr("w", reader["Wins"])); xml.Append(xml_attr("l", reader["Losses"])); xml.Append(xml_attr("t", reader["TimePlayed"])); xml.Append("/>"); } xml.Append("</friends>"); GResponse.Write(xml.ToString()); }
protected override void Execute() { string username = web.Param("username"); string password = web.Param("password"); string ip = web.Param("ip"); string rexEmailValidate = @"\A(?:[a-z0-9!#$%&*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z"; string rexPasswordValidate = @"^[a-zA-Z0-9]+$"; if (!Regex.IsMatch(username, rexEmailValidate)) { // Email is not Valid Response.Write("WO_3"); Response.Write("Email is not Valid"); return; } else if (username.Length < 4) { Response.Write("WO_3"); Response.Write("Email is not Valid"); return; } else if (password.Length < 4) { Response.Write("WO_4"); Response.Write("Password is not Valid"); return; } else if (!Regex.IsMatch(password, rexPasswordValidate)) { Response.Write("WO_4"); Response.Write("Password is not Valid"); return; } SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WEB_Account_Login"; sqcmd.Parameters.AddWithValue("@in_IP", ip); sqcmd.Parameters.AddWithValue("@in_EMail", username); sqcmd.Parameters.AddWithValue("@in_Password", password); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int CustomerID = getInt("CustomerID");; int AccountStatus = getInt("AccountStatus"); int SessionID = 0; int IsDeveloper = 0; if (CustomerID > 0) { SessionID = getInt("SessionID"); IsDeveloper = getInt("IsDeveloper"); } GResponse.Write("WO_0"); GResponse.Write(string.Format("{0} {1} {2}", CustomerID, SessionID, AccountStatus)); }
protected override void Execute() { bool needLoginCheck = true; // to be able to test IIS response time in Nagios string nagios_server_key = web.OptionalParam("NagiosKey", true); if (nagios_server_key != null && nagios_server_key == "AS&Dasjkhd738rKSAHD7we5iuhfdzjscn") needLoginCheck = false; if(needLoginCheck) if (!WoCheckLoginSession()) return; string CustomerID = web.CustomerID(); // if we have "CharID" parameter, it means GetProfile call was called from server int CharID = 0; try { CharID = Convert.ToInt32(web.Param("CharID")); } catch { } SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WZ_GetAccountInfo2"; sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID); sqcmd.Parameters.AddWithValue("@in_CharID", CharID); if (!CallWOApi(sqcmd)) return; reader.Read(); string curTime = string.Format("{0} {1} {2} {3} {4}", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute); StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\"?>\n"); xml.Append("<account "); xml.Append(xml_attr("CustomerID", reader["CustomerID"])); xml.Append(xml_attr("AccountStatus", reader["AccountStatus"])); xml.Append(xml_attr("AccountType", reader["AccountType"])); xml.Append(xml_attr("GamePoints", reader["GamePoints"])); xml.Append(xml_attr("GameDollars", reader["GameDollars"])); xml.Append(xml_attr("ResWood", reader["ResWood"])); xml.Append(xml_attr("ResStone", reader["ResStone"])); xml.Append(xml_attr("ResMetal", reader["ResMetal"])); xml.Append(xml_attr("time", curTime)); string IsDeveloper = reader["IsDeveloper"].ToString(); if(IsDeveloper != "0") xml.Append(xml_attr("IsDeveloper", IsDeveloper)); xml.Append(xml_attr("TimePlayed", reader["TimePlayed"])); int PremiumLeft = Convert.ToInt32(reader["PremiumLeft"]); if (PremiumLeft > 0) xml.Append(xml_attr("PremiumLeft", PremiumLeft)); // special code to check if server wasn't closed successfully and account info is dirty string GameServerId = reader["GameServerId"].ToString(); if (GameServerId != "" && GameServerId != "0") { // seconds while game wasn't closed successfully Int64 SecFromLastGame = Convert.ToInt64(reader["SecFromLastGame"]); // we allow 40 sec for server to finish updating things if(SecFromLastGame < 40) xml.Append(xml_attr("DataDirty", SecFromLastGame)); } xml.Append(">\n"); // all chars AddChars(ref xml, CharID > 0); // inventory AddInventory(ref xml); // all backpacks AddBackpacks(ref xml); xml.Append("</account>"); GResponse.Write(xml.ToString()); }