Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gimuserver/gme/GmeController_Handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "handlers/BadgeInfoHandler.hpp"
#include "handlers/ControlCenterEnterHandler.hpp"
#include "handlers/UpdateInfoLightHandler.hpp"
#include "handlers/GatchaActionHandler.hpp"
#include "handlers/GatchaListHandler.hpp"
#include "handlers/DeckEditHandler.hpp"
#include "handlers/MissionStartHandler.hpp"
Expand All @@ -21,6 +22,7 @@ void GmeController::InitializeHandlers()
REGISTER(BadgeInfo);
REGISTER(ControlCenterEnter);
REGISTER(UpdateInfoLight);
REGISTER(GatchaAction);
REGISTER(GatchaList);
REGISTER(DeckEdit);
REGISTER(MissionStart);
Expand Down
72 changes: 72 additions & 0 deletions gimuserver/gme/handlers/GatchaActionHandler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#include "GatchaActionHandler.hpp"
#include "gme/response/SignalKey.hpp"
#include "gme/response/UserUnitInfo.hpp"
#include "core/System.hpp"

void Handler::GatchaActionHandler::Handle(UserInfo& user, DrogonCallback cb, const Json::Value& req) const
{
Json::Value res;

/*
req = {
"1IR86sAv" : [
{
"324b023k" : "1", if we used summoning ticket ?
"7Ffmi96v" : "17160", gatcha id
"a329kbl8" : "1" idx of gatcha request ?
}
],
...
}
*/

// For now, hard-code the response to return unit
Response::UserUnitInfo unitInfo;

// Only add to user unit collection
unitInfo.overwrite = false;
if (unitInfo.Mst.empty()) {
Response::UserUnitInfo::Data d;
d.userID = user.info.userID;
d.userUnitID = 9999; // ensure that this is unique
d.unitID = 50256;
d.unitTypeID = 1;
d.element = "light";
d.unitLv = 1;
d.newFlg = 1;
d.receiveDate = 100;
d.FeBP = 100;
d.FeMaxUsableBP = 200;
d.baseHp = 5000;
d.baseAtk = 1000;
d.baseDef = 1000;
d.baseHeal = 1000;
d.addHp = 100;
d.addAtk = 100;
d.addDef = 100;
d.addHeal = 100;
d.extHp = 100;
d.extAtk = 100;
d.extDef = 100;
d.extHeal = 100;
d.limitOverHP = 200;
d.limitOverAtk = 200;
d.limitOverDef = 200;
d.limitOverHeal = 200;
d.exp = 1;
d.totalExp = 100;
unitInfo.Mst.emplace_back(d);
}
unitInfo.Serialize(res);

// Hard-coded response for OpeUserUnitResponse
{
Json::Value d;
d["edy7fq3L"] = "9999"; // userUnitID to open -> should match the one that was just added
d["u0vkt9yH"] = 13762; // Which summon gate picture to use
//d["g30VnzQh"] = ?; // In IDA this is parsed as GatchaChangeRateInfo, so maybe its for specific banners?
res["Km35HAXv"] = d;
}

cb(newGmeOkResponse(GetGroupId(), GetAesKey(), res));
}
13 changes: 13 additions & 0 deletions gimuserver/gme/handlers/GatchaActionHandler.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include "../GmeHandler.hpp"

HANDLER_NS_BEGIN
class GatchaActionHandler : public HandlerBase
{
public:
const char* GetGroupId() const override { return "F7JvPk5H"; }
const char* GetAesKey() const override { return "bL9fipzaSy7xN2w1"; }
void Handle(UserInfo& user, DrogonCallback cb, const Json::Value& req) const override;
};
HANDLER_NS_END
7 changes: 6 additions & 1 deletion gimuserver/gme/response/UserUnitInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,15 @@ struct UserUnitInfo : public IResponse
}
};

const char* getGroupName() const override { return "4ceMWH6k"; }
const char* getGroupName() const override {
if (overwrite) return "4ceMWH6k"; // Overwrite all units ?
return "qC2tJs4E"; // Add to existing units ?
}

std::vector<Data> Mst;

bool overwrite = true;

protected:
size_t getRespCount() const override { return Mst.size(); }

Expand Down