public ReqBtlComReq(string iname, string fuid, Network.ResponseCallback response, bool multi, int partyIndex, bool isHost = false, int plid = 0, int seat = 0) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); this.name = !multi ? "btl/com/req" : "btl/multi/req"; stringBuilder.Append("\"iname\":\""); stringBuilder.Append(iname); stringBuilder.Append("\","); if (partyIndex >= 0) { stringBuilder.Append("\"partyid\":"); stringBuilder.Append(partyIndex); stringBuilder.Append(","); } if (multi) { stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"host\":\""); stringBuilder.Append(!isHost ? "0" : "1"); stringBuilder.Append("\","); stringBuilder.Append("\"plid\":\""); stringBuilder.Append(plid); stringBuilder.Append("\","); stringBuilder.Append("\"seat\":\""); stringBuilder.Append(seat); stringBuilder.Append("\","); } stringBuilder.Append("\"btlparam\":{\"help\":{\"fuid\":\""); stringBuilder.Append(fuid); stringBuilder.Append("\"}}"); this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public ReqVersusCpuList(VersusStatusData param, int num, string quest_iname, Network.ResponseCallback response) { this.name = "vs/com"; StringBuilder stringBuilder = WebAPI.GetStringBuilder(); stringBuilder.Append("\"status\":{"); stringBuilder.Append("\"hp\":" + (object)param.Hp + ","); stringBuilder.Append("\"atk\":" + (object)param.Atk + ","); stringBuilder.Append("\"def\":" + (object)param.Def + ","); stringBuilder.Append("\"matk\":" + (object)param.Matk + ","); stringBuilder.Append("\"mdef\":" + (object)param.Mdef + ","); stringBuilder.Append("\"dex\":" + (object)param.Dex + ","); stringBuilder.Append("\"spd\":" + (object)param.Spd + ","); stringBuilder.Append("\"cri\":" + (object)param.Cri + ","); stringBuilder.Append("\"luck\":" + (object)param.Luck + ","); stringBuilder.Append("\"cmb\":" + (object)param.Cmb + ","); stringBuilder.Append("\"move\":" + (object)param.Move + ","); stringBuilder.Append("\"jmp\":" + (object)param.Jmp); stringBuilder.Append("}"); stringBuilder.Append(",\"member_count\":" + (object)num); stringBuilder.Append(",\"iname\":\""); stringBuilder.Append(JsonEscape.Escape(quest_iname)); stringBuilder.Append("\""); this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public ReqMultiTwStatus(string tower_id, Network.ResponseCallback response) { this.name = "btl/multi/tower/status"; this.body = string.Empty; ReqMultiTwStatus reqMultiTwStatus = this; reqMultiTwStatus.body = reqMultiTwStatus.body + "\"tower_id\":\"" + JsonEscape.Escape(tower_id) + "\""; this.body = WebAPI.GetRequestString(this.body); this.callback = response; }
public string Serialize() { string str = "{" + "\"creatorName\":\"" + JsonEscape.Escape(this.creatorName) + "\"" + ",\"creatorLV\":" + (object)this.creatorLV + ",\"creatorFUID\":\"" + JsonEscape.Escape(this.creatorFUID) + "\"" + ",\"comment\":\"" + JsonEscape.Escape(this.comment) + "\"" + ",\"passCode\":\"" + JsonEscape.Escape(this.passCode) + "\"" + ",\"iname\":\"" + JsonEscape.Escape(this.iname) + "\"" + ",\"type\":" + (object)this.type + ",\"isLINE\":" + (object)this.isLINE + ",\"started\":" + (object)this.started + ",\"roomid\":" + (object)this.roomid + ",\"players\":["; if (this.players != null) { for (int index = 0; index < this.players.Length; ++index) { str = str + (index > 0 ? "," : string.Empty) + this.players[index].Serialize(); } } return(str + "]" + "}"); }
public ReqVersusCpu(string iname, int deck_id, Network.ResponseCallback response) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); this.name = "vs/com/req"; stringBuilder.Append("\"iname\":\""); stringBuilder.Append(JsonEscape.Escape(iname)); stringBuilder.Append("\","); stringBuilder.Append("\"deck_id\":"); stringBuilder.Append(deck_id); this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public string Serialize() { string str = "{" + "\"creatorName\":\"" + JsonEscape.Escape(this.creatorName) + "\"" + ",\"creatorLV\":" + (object)this.creatorLV + ",\"creatorFUID\":\"" + JsonEscape.Escape(this.creatorFUID) + "\"" + ",\"comment\":\"" + JsonEscape.Escape(this.comment) + "\"" + ",\"passCode\":\"" + JsonEscape.Escape(this.passCode) + "\"" + ",\"iname\":\"" + JsonEscape.Escape(this.iname) + "\"" + ",\"type\":" + (object)this.type + ",\"isLINE\":" + (object)this.isLINE + ",\"started\":" + (object)this.started + ",\"roomid\":" + (object)this.roomid + ",\"audience\":" + (object)this.audience + ",\"audienceNum\":" + (object)this.audienceNum + ",\"unitlv\":" + (object)this.unitlv + ",\"challegedMTFloor\":" + (object)GlobalVars.SelectedMultiTowerFloor + ",\"vsmode\":" + (object)this.vsmode + ",\"draft_type\":" + (object)this.draft_type + ",\"players\":["; if (this.players != null) { for (int index = 0; index < this.players.Length; ++index) { str = str + (index > 0 ? "," : string.Empty) + this.players[index].Serialize(); } } return(str + "]" + "}"); }
public ReqVersusAudience(string appid, string version, string roomid, Network.ResponseCallback response, DownloadHandler handler) { this.name = "photon/watching/view"; this.body = string.Empty; ReqVersusAudience reqVersusAudience1 = this; reqVersusAudience1.body = reqVersusAudience1.body + "\"appid\":\"" + JsonEscape.Escape(appid) + "\","; ReqVersusAudience reqVersusAudience2 = this; reqVersusAudience2.body = reqVersusAudience2.body + "\"appversion\":\"" + JsonEscape.Escape(version) + "\","; ReqVersusAudience reqVersusAudience3 = this; reqVersusAudience3.body = reqVersusAudience3.body + "\"roomname\":\"" + JsonEscape.Escape(roomid) + "\""; this.body = WebAPI.GetRequestString(this.body); this.callback = response; this.dlHandler = handler; this.reqtype = WebAPI.ReqeustType.REQ_STREAM; }
public ReqVersus(string iname, int plid, int seat, string uid, VersusStatusData param, int num, Network.ResponseCallback response, VERSUS_TYPE type, int draft_id = 0, int enemy_draft_id = 0) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); this.name = "vs/" + type.ToString().ToLower() + "match/req"; stringBuilder.Append("\"iname\":\""); stringBuilder.Append(JsonEscape.Escape(iname)); stringBuilder.Append("\","); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"plid\":\""); stringBuilder.Append(plid); stringBuilder.Append("\","); stringBuilder.Append("\"seat\":\""); stringBuilder.Append(seat); stringBuilder.Append("\","); stringBuilder.Append("\"uid\":\""); stringBuilder.Append(uid); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"status\":{"); stringBuilder.Append("\"hp\":" + (object)param.Hp + ","); stringBuilder.Append("\"atk\":" + (object)param.Atk + ","); stringBuilder.Append("\"def\":" + (object)param.Def + ","); stringBuilder.Append("\"matk\":" + (object)param.Matk + ","); stringBuilder.Append("\"mdef\":" + (object)param.Mdef + ","); stringBuilder.Append("\"dex\":" + (object)param.Dex + ","); stringBuilder.Append("\"spd\":" + (object)param.Spd + ","); stringBuilder.Append("\"cri\":" + (object)param.Cri + ","); stringBuilder.Append("\"luck\":" + (object)param.Luck + ","); stringBuilder.Append("\"cmb\":" + (object)param.Cmb + ","); stringBuilder.Append("\"move\":" + (object)param.Move + ","); stringBuilder.Append("\"jmp\":" + (object)param.Jmp); stringBuilder.Append("}"); stringBuilder.Append(",\"member_count\":" + (object)num); if (draft_id > 0) { stringBuilder.Append(",\"draft_id\":" + (object)draft_id); stringBuilder.Append(",\"enemy_draft_id\":" + (object)enemy_draft_id); } this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public ReqMultiAreaRoom(string fuid, string[] iname, Vector2 location, Network.ResponseCallback response) { this.name = "btl/room/areaquest"; this.body = string.Empty; if (!string.IsNullOrEmpty(fuid)) { ReqMultiAreaRoom reqMultiAreaRoom = this; reqMultiAreaRoom.body = reqMultiAreaRoom.body + "\"fuid\":\"" + JsonEscape.Escape(fuid) + "\""; } if (iname != null && iname.Length > 0) { if (!string.IsNullOrEmpty(this.body)) { this.body += ","; } this.body += "\"iname\":["; for (int index = 0; index < iname.Length; ++index) { if (index != 0) { this.body += ","; } ReqMultiAreaRoom reqMultiAreaRoom = this; reqMultiAreaRoom.body = reqMultiAreaRoom.body + "\"" + JsonEscape.Escape(iname[index]) + "\""; } this.body += "]"; } if (!string.IsNullOrEmpty(this.body)) { this.body += ","; } this.body += "\"location\":{"; ReqMultiAreaRoom reqMultiAreaRoom1 = this; reqMultiAreaRoom1.body = reqMultiAreaRoom1.body + "\"lat\":" + (object)(float)location.x + ","; ReqMultiAreaRoom reqMultiAreaRoom2 = this; reqMultiAreaRoom2.body = reqMultiAreaRoom2.body + "\"lng\":" + (object)(float)location.y + "}"; this.body = WebAPI.GetRequestString(this.body); this.callback = response; }
public ReqMultiAreaRoomMake(string iname, string comment, string passCode, bool isPrivate, bool limit, int unitlv, bool clear, Vector2 location, Network.ResponseCallback response) { this.name = "btl/room/areaquest/make"; this.body = string.Empty; ReqMultiAreaRoomMake multiAreaRoomMake1 = this; multiAreaRoomMake1.body = multiAreaRoomMake1.body + "\"iname\":\"" + JsonEscape.Escape(iname) + "\""; ReqMultiAreaRoomMake multiAreaRoomMake2 = this; multiAreaRoomMake2.body = multiAreaRoomMake2.body + ",\"comment\":\"" + JsonEscape.Escape(comment) + "\""; ReqMultiAreaRoomMake multiAreaRoomMake3 = this; multiAreaRoomMake3.body = multiAreaRoomMake3.body + ",\"pwd\":\"" + JsonEscape.Escape(passCode) + "\""; ReqMultiAreaRoomMake multiAreaRoomMake4 = this; multiAreaRoomMake4.body = multiAreaRoomMake4.body + ",\"private\":" + (object)(!isPrivate ? 0 : 1); ReqMultiAreaRoomMake multiAreaRoomMake5 = this; multiAreaRoomMake5.body = multiAreaRoomMake5.body + ",\"req_at\":" + (object)Network.GetServerTime(); ReqMultiAreaRoomMake multiAreaRoomMake6 = this; multiAreaRoomMake6.body = multiAreaRoomMake6.body + ",\"limit\":" + (object)(!limit ? 0 : 1); ReqMultiAreaRoomMake multiAreaRoomMake7 = this; multiAreaRoomMake7.body = multiAreaRoomMake7.body + ",\"unitlv\":" + (object)unitlv; ReqMultiAreaRoomMake multiAreaRoomMake8 = this; multiAreaRoomMake8.body = multiAreaRoomMake8.body + ",\"clear\":" + (object)(!clear ? 0 : 1); this.body += ",\"location\":{"; ReqMultiAreaRoomMake multiAreaRoomMake9 = this; multiAreaRoomMake9.body = multiAreaRoomMake9.body + "\"lat\":" + (object)(float)location.x + ","; ReqMultiAreaRoomMake multiAreaRoomMake10 = this; multiAreaRoomMake10.body = multiAreaRoomMake10.body + "\"lng\":" + (object)(float)location.y + "}"; this.body = WebAPI.GetRequestString(this.body); this.callback = response; }
public ReqVersus(string iname, int plid, int seat, string uid, Network.ResponseCallback response, VERSUS_TYPE type) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); this.name = "vs/" + type.ToString().ToLower() + "match/req"; stringBuilder.Append("\"iname\":\""); stringBuilder.Append("QE_VS_TEST_00"); stringBuilder.Append("\","); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"plid\":\""); stringBuilder.Append(plid); stringBuilder.Append("\","); stringBuilder.Append("\"seat\":\""); stringBuilder.Append(seat); stringBuilder.Append("\","); stringBuilder.Append("\"uid\":\""); stringBuilder.Append(uid); stringBuilder.Append("\""); this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public ReqRanking(string[] inames, Network.ResponseCallback response) { this.name = "btl/usedunit/multiple"; StringBuilder stringBuilder = WebAPI.GetStringBuilder(); stringBuilder.Append("\"inames\":["); for (int index = 0; index < inames.Length; ++index) { stringBuilder.Append("\""); stringBuilder.Append(JsonEscape.Escape(inames[index])); if (index == inames.Length - 1) { stringBuilder.Append("\"]"); } else { stringBuilder.Append("\","); } } this.body = stringBuilder.ToString(); this.body = WebAPI.GetRequestString(this.body); this.callback = response; }
public ReqBtlMultiTwReq(string iname, int partyIndex, int plid, int seat, string[] uid, Network.ResponseCallback response) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); this.name = "btl/multi/tower/req"; stringBuilder.Append("\"iname\":\""); stringBuilder.Append(iname); stringBuilder.Append("\","); if (partyIndex >= 0) { stringBuilder.Append("\"partyid\":"); stringBuilder.Append(partyIndex); stringBuilder.Append(","); } stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"plid\":\""); stringBuilder.Append(plid); stringBuilder.Append("\","); stringBuilder.Append("\"seat\":\""); stringBuilder.Append(seat); stringBuilder.Append("\","); stringBuilder.Append("\"uids\":["); for (int index = 0; index < uid.Length; ++index) { stringBuilder.Append("\"" + uid[index] + "\""); if (index != uid.Length - 1) { stringBuilder.Append(","); } } stringBuilder.Append("]"); this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
protected static string GetBtlEndParamString(BattleCore.Record record, bool multi = false) { string str1 = (string)null; if (record != null) { int num = 0; string str2 = "win"; if (multi && record.result == BattleCore.QuestResult.Pending) { str2 = "retire"; } else if (record.result != BattleCore.QuestResult.Win) { str2 = "lose"; } int[] numArray1 = new int[record.drops.Length]; for (int index = 0; index < record.drops.Length; ++index) { numArray1[index] = (int)record.drops[index]; } int[] numArray2 = new int[record.item_steals.Length]; for (int index = 0; index < record.item_steals.Length; ++index) { numArray2[index] = (int)record.item_steals[index]; } int[] numArray3 = new int[record.gold_steals.Length]; for (int index = 0; index < record.gold_steals.Length; ++index) { numArray3[index] = (int)record.gold_steals[index]; } int[] numArray4 = new int[record.bonusCount]; for (int index = 0; index < numArray4.Length; ++index) { numArray4[index] = (record.bonusFlags & 1 << index) == 0 ? 0 : 1; } string str3 = str1 + "\"btlendparam\":{" + "\"time\":" + (object)num + "," + "\"result\":\"" + str2 + "\"," + "\"beats\":["; for (int index = 0; index < numArray1.Length; ++index) { str3 += numArray1[index].ToString(); if (index != numArray1.Length - 1) { str3 += ","; } } string str4 = str3 + "]," + "\"steals\":{" + "\"items\":["; for (int index = 0; index < numArray2.Length; ++index) { str4 += numArray2[index].ToString(); if (index != numArray1.Length - 1) { str4 += ","; } } string str5 = str4 + "]," + "\"golds\":["; for (int index = 0; index < numArray3.Length; ++index) { str5 += numArray3[index].ToString(); if (index != numArray1.Length - 1) { str5 += ","; } } string str6 = str5 + "]" + "}," + "\"missions\":["; for (int index = 0; index < numArray4.Length; ++index) { str6 += numArray4[index].ToString(); if (index != numArray4.Length - 1) { str6 += ","; } } string str7 = str6 + "]"; if (multi) { str7 = str7 + ",\"token\":\"" + JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName) + "\""; } str1 = str7 + "}"; } return(str1); }
public ReqBtlMultiTwEnd(long btlid, int time, BtlResultTypes result, int[] myhp, string[] myUnit, string[] fuid, Network.ResponseCallback response, string trophyprog = null, string bingoprog = null) { this.name = "btl/multi/tower/end"; StringBuilder stringBuilder = WebAPI.GetStringBuilder(); stringBuilder.Length = 0; stringBuilder.Append("\"btlid\":"); stringBuilder.Append(btlid); stringBuilder.Append(','); stringBuilder.Append("\"btlendparam\":{"); stringBuilder.Append("\"time\":"); stringBuilder.Append(time); stringBuilder.Append(','); stringBuilder.Append("\"result\":\""); switch (result) { case BtlResultTypes.Win: stringBuilder.Append("win"); break; case BtlResultTypes.Lose: stringBuilder.Append("lose"); break; case BtlResultTypes.Retire: stringBuilder.Append("retire"); break; case BtlResultTypes.Cancel: stringBuilder.Append("cancel"); break; case BtlResultTypes.Draw: stringBuilder.Append("draw"); break; } stringBuilder.Append("\","); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\""); if (myhp != null) { stringBuilder.Append(','); stringBuilder.Append("\"myhp\":["); for (int index = 0; index < myhp.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(myhp[index].ToString()); } stringBuilder.Append("]"); } if (myUnit != null) { stringBuilder.Append(','); stringBuilder.Append("\"myUnit\":["); for (int index = 0; index < myhp.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append("\"" + myUnit[index] + "\""); } stringBuilder.Append("]"); } stringBuilder.Append("}"); if (fuid != null) { stringBuilder.Append(",\"fuids\":["); for (int index = 0; index < fuid.Length; ++index) { if (fuid[index] != null) { if (index != 0) { stringBuilder.Append(", "); } stringBuilder.Append("\""); stringBuilder.Append(fuid[index]); stringBuilder.Append("\""); } } stringBuilder.Append("]"); } if (!string.IsNullOrEmpty(trophyprog)) { stringBuilder.Append(","); stringBuilder.Append(trophyprog); } if (!string.IsNullOrEmpty(bingoprog)) { stringBuilder.Append(","); stringBuilder.Append(bingoprog); } this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public ReqBtlComReq(string iname, string fuid, SupportData support, Network.ResponseCallback response, bool multi, int partyIndex, bool isHost = false, int plid = 0, int seat = 0, [Optional] Vector2 location, RankingQuestParam rankingQuestParam = null) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); this.name = !multi ? "btl/com/req" : "btl/multi/req"; stringBuilder.Append("\"iname\":\""); stringBuilder.Append(iname); stringBuilder.Append("\","); if (partyIndex >= 0) { stringBuilder.Append("\"partyid\":"); stringBuilder.Append(partyIndex); stringBuilder.Append(","); } if (multi) { stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"host\":\""); stringBuilder.Append(!isHost ? "0" : "1"); stringBuilder.Append("\","); stringBuilder.Append("\"plid\":\""); stringBuilder.Append(plid); stringBuilder.Append("\","); stringBuilder.Append("\"seat\":\""); stringBuilder.Append(seat); stringBuilder.Append("\","); } else { stringBuilder.Append("\"req_at\":"); stringBuilder.Append(Network.GetServerTime()); stringBuilder.Append(","); } stringBuilder.Append("\"btlparam\":{\"help\":{\"fuid\":"); stringBuilder.Append("\"" + fuid + "\""); if (support != null && support.Unit != null) { stringBuilder.Append(",\"elem\":" + (object)support.Unit.SupportElement); stringBuilder.Append(",\"iname\":\"" + support.Unit.UnitID + "\""); } stringBuilder.Append("}"); if (!multi && rankingQuestParam != null) { stringBuilder.Append(",\"quest_ranking\":{"); stringBuilder.Append("\"schedule_id\":"); stringBuilder.Append(rankingQuestParam.schedule_id); stringBuilder.Append(","); stringBuilder.Append("\"type\":"); stringBuilder.Append((int)rankingQuestParam.type); stringBuilder.Append("}"); } stringBuilder.Append("},"); stringBuilder.Append("\"location\":{"); stringBuilder.Append("\"lat\":" + (object)(float)location.x + ","); stringBuilder.Append("\"lng\":" + (object)(float)location.y); stringBuilder.Append("}"); DebugMenu.Log("APIReq", stringBuilder.ToString()); this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public string Serialize() { string str = "{" + "\"playerID\":" + (object)this.playerID + ",\"playerIndex\":" + (object)this.playerIndex + ",\"playerName\":\"" + JsonEscape.Escape(this.playerName) + "\"" + ",\"playerLevel\":" + (object)this.playerLevel + ",\"FUID\":\"" + JsonEscape.Escape(this.FUID) + "\"" + ",\"UID\":\"" + JsonEscape.Escape(this.UID) + "\"" + ",\"state\":" + (object)this.state + ",\"leaderID\":" + (object)this.leaderID + ",\"totalAtk\":" + (object)this.totalAtk + ",\"rankpoint\":" + (object)this.rankpoint + ",\"mtChallengeFloor\":" + (object)this.mtChallengeFloor + ",\"mtClearedFloor\":" + (object)this.mtClearedFloor + ",\"award\":\"" + JsonEscape.Escape(this.award) + "\"" + ",\"units\":["; if (this.units != null) { for (int index = 0; index < this.units.Length; ++index) { str = str + (index != 0 ? "," : string.Empty) + this.units[index].Serialize(); } } return(str + "]" + "}"); }
public string Serialize() { return("{" + "\"version\":" + (object)this.version + ",\"playerListJson\":\"" + JsonEscape.Escape(this.playerListJson) + "\"" + "}"); }
public ReqVersusEnd(long btlid, int time, BtlResultTypes result, int[] beats, string uid, string fuid, Network.ResponseCallback response, VERSUS_TYPE type, string trophyprog = null, string bingoprog = null, string maxdata = null) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); stringBuilder.Append("vs/"); stringBuilder.Append(type.ToString().ToLower()); stringBuilder.Append("match/end"); this.name = stringBuilder.ToString(); stringBuilder.Length = 0; stringBuilder.Append("\"btlid\":"); stringBuilder.Append(btlid); stringBuilder.Append(','); stringBuilder.Append("\"btlendparam\":{"); stringBuilder.Append("\"time\":"); stringBuilder.Append(time); stringBuilder.Append(','); stringBuilder.Append("\"result\":\""); switch (result) { case BtlResultTypes.Win: stringBuilder.Append("win"); break; case BtlResultTypes.Lose: stringBuilder.Append("lose"); break; case BtlResultTypes.Retire: stringBuilder.Append("retire"); break; case BtlResultTypes.Cancel: stringBuilder.Append("cancel"); break; case BtlResultTypes.Draw: stringBuilder.Append("draw"); break; } if (result == BtlResultTypes.Win && beats == null) { beats = new int[0]; } stringBuilder.Append("\","); if (beats != null) { stringBuilder.Append("\"beats\":["); for (int index = 0; index < beats.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(beats[index].ToString()); } stringBuilder.Append("],"); } stringBuilder.Append("\"steals\":["); stringBuilder.Append("],"); stringBuilder.Append("\"missions\":["); stringBuilder.Append("],"); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); if ((int)stringBuilder[stringBuilder.Length - 1] == 44) { --stringBuilder.Length; } stringBuilder.Append("},"); stringBuilder.Append("\"uid\":\""); stringBuilder.Append(uid); stringBuilder.Append("\","); stringBuilder.Append("\"fuid\":\""); stringBuilder.Append(fuid); stringBuilder.Append("\""); if (!string.IsNullOrEmpty(trophyprog)) { stringBuilder.Append(","); stringBuilder.Append(trophyprog); } if (!string.IsNullOrEmpty(bingoprog)) { stringBuilder.Append(","); stringBuilder.Append(bingoprog); } if (!string.IsNullOrEmpty(maxdata)) { stringBuilder.Append(","); stringBuilder.Append(maxdata); } this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public ReqVersusEnd(long btlid, BtlResultTypes result, string uid, string fuid, uint turn, int[] myhp, int[] enhp, int atk, int dmg, int heal, int beat, Network.ResponseCallback response, VERSUS_TYPE type, string trophyprog = null, string bingoprog = null) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); stringBuilder.Append("vs/"); stringBuilder.Append(type.ToString().ToLower()); stringBuilder.Append("match/end"); this.name = stringBuilder.ToString(); stringBuilder.Length = 0; stringBuilder.Append("\"btlid\":"); stringBuilder.Append(btlid); stringBuilder.Append(','); stringBuilder.Append("\"btlendparam\":{"); stringBuilder.Append("\"result\":\""); switch (result) { case BtlResultTypes.Win: stringBuilder.Append("win"); break; case BtlResultTypes.Lose: stringBuilder.Append("lose"); break; case BtlResultTypes.Retire: stringBuilder.Append("retire"); break; case BtlResultTypes.Cancel: stringBuilder.Append("cancel"); break; case BtlResultTypes.Draw: stringBuilder.Append("draw"); break; } stringBuilder.Append("\","); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"turn\":\""); stringBuilder.Append(turn); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"atk\":\""); stringBuilder.Append(atk); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"dmg\":\""); stringBuilder.Append(dmg); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"heal\":\""); stringBuilder.Append(heal); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"beatcnt\":"); stringBuilder.Append(beat); if (myhp != null) { stringBuilder.Append(','); stringBuilder.Append("\"myhp\":["); for (int index = 0; index < myhp.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(myhp[index].ToString()); } stringBuilder.Append("]"); } if (enhp != null) { stringBuilder.Append(','); stringBuilder.Append("\"enhp\":["); for (int index = 0; index < enhp.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(enhp[index].ToString()); } stringBuilder.Append("]"); } if ((int)stringBuilder[stringBuilder.Length - 1] == 44) { --stringBuilder.Length; } stringBuilder.Append("},"); stringBuilder.Append("\"uid\":\""); stringBuilder.Append(uid); stringBuilder.Append("\","); stringBuilder.Append("\"fuid\":\""); stringBuilder.Append(fuid); stringBuilder.Append("\""); if (!string.IsNullOrEmpty(trophyprog)) { stringBuilder.Append(","); stringBuilder.Append(trophyprog); } if (!string.IsNullOrEmpty(bingoprog)) { stringBuilder.Append(","); stringBuilder.Append(bingoprog); } this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
private string makeBody(bool is_arena, long btlid, int time, BtlResultTypes result, int[] beats, int[] itemSteals, int[] goldSteals, int[] missions, string[] fuid, Dictionary <OString, OInt> usedItems, Network.ResponseCallback response, BtlEndTypes apiType, string trophyprog, string bingoprog, int elem = 0, string rankingQuestEndParam = null) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); stringBuilder.Length = 0; if (!is_arena) { stringBuilder.Append("\"btlid\":"); stringBuilder.Append(btlid); stringBuilder.Append(','); } stringBuilder.Append("\"btlendparam\":{"); stringBuilder.Append("\"time\":"); stringBuilder.Append(time); stringBuilder.Append(','); stringBuilder.Append("\"result\":\""); switch (result) { case BtlResultTypes.Win: stringBuilder.Append("win"); break; case BtlResultTypes.Lose: stringBuilder.Append("lose"); break; case BtlResultTypes.Retire: stringBuilder.Append("retire"); break; case BtlResultTypes.Cancel: stringBuilder.Append("cancel"); break; } if (result == BtlResultTypes.Win) { if (beats == null) { beats = new int[0]; } if (itemSteals == null) { itemSteals = new int[0]; } if (goldSteals == null) { goldSteals = new int[0]; } if (missions == null) { missions = new int[3]; } } if (result != BtlResultTypes.Cancel && usedItems == null) { usedItems = new Dictionary <OString, OInt>(); } stringBuilder.Append("\","); if (beats != null) { stringBuilder.Append("\"beats\":["); for (int index = 0; index < beats.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(beats[index].ToString()); } stringBuilder.Append("],"); } if (itemSteals != null || goldSteals != null) { stringBuilder.Append("\"steals\":{"); if (itemSteals != null) { stringBuilder.Append("\"items\":["); for (int index = 0; index < itemSteals.Length; ++index) { stringBuilder.Append(itemSteals[index].ToString()); if (index != beats.Length - 1) { stringBuilder.Append(','); } } stringBuilder.Append("]"); } if (goldSteals != null) { if (itemSteals != null) { stringBuilder.Append(','); } stringBuilder.Append("\"golds\":["); for (int index = 0; index < goldSteals.Length; ++index) { stringBuilder.Append(goldSteals[index].ToString()); if (index != beats.Length - 1) { stringBuilder.Append(","); } } stringBuilder.Append("]"); } stringBuilder.Append("},"); } if (missions != null) { stringBuilder.Append("\"missions\":["); for (int index = 0; index < missions.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(missions[index].ToString()); } stringBuilder.Append("],"); } if (usedItems != null) { stringBuilder.Append("\"inputs\":["); int num = 0; using (Dictionary <OString, OInt> .Enumerator enumerator = usedItems.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <OString, OInt> current = enumerator.Current; if (num > 0) { stringBuilder.Append(','); } stringBuilder.Append("{"); stringBuilder.Append("\"use\":\""); stringBuilder.Append((string)current.Key); stringBuilder.Append("\","); stringBuilder.Append("\"n\":"); stringBuilder.Append((int)current.Value); stringBuilder.Append("}"); ++num; } } stringBuilder.Append("],"); } if (apiType == BtlEndTypes.multi) { stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); } if (!string.IsNullOrEmpty(rankingQuestEndParam)) { stringBuilder.Append(rankingQuestEndParam); stringBuilder.Append(","); } if ((int)stringBuilder[stringBuilder.Length - 1] == 44) { --stringBuilder.Length; } stringBuilder.Append('}'); if (apiType == BtlEndTypes.multi && fuid != null) { stringBuilder.Append(",\"fuids\":["); for (int index = 0; index < fuid.Length; ++index) { if (fuid[index] != null) { if (index != 0) { stringBuilder.Append(", "); } stringBuilder.Append("\""); stringBuilder.Append(fuid[index]); stringBuilder.Append("\""); } } stringBuilder.Append("]"); } if (!string.IsNullOrEmpty(trophyprog)) { stringBuilder.Append(","); stringBuilder.Append(trophyprog); } if (!string.IsNullOrEmpty(bingoprog)) { stringBuilder.Append(","); stringBuilder.Append(bingoprog); } if (elem != 0) { stringBuilder.Append(","); stringBuilder.Append("\"support_elem\":\""); stringBuilder.Append(elem); stringBuilder.Append("\""); } return(stringBuilder.ToString()); }