1
This commit is contained in:
parent
4cd54c4e0c
commit
e4bd8249c2
@ -156,6 +156,7 @@ void BoxDrop::RequestReturnBoxNum()
|
|||||||
url_params->SetVal("a", "requestReturnBoxNum");
|
url_params->SetVal("a", "requestReturnBoxNum");
|
||||||
url_params->SetVal("account_id", account_id);
|
url_params->SetVal("account_id", account_id);
|
||||||
url_params->SetVal("session_id", session_id);
|
url_params->SetVal("session_id", session_id);
|
||||||
|
url_params->SetVal("room_uuid", room_->GetRoomUuid());
|
||||||
url_params->SetVal("used_num", GetUsedBoxNum());
|
url_params->SetVal("used_num", GetUsedBoxNum());
|
||||||
url_params->SetVal("alloc_box_num", alloc_box_num_);
|
url_params->SetVal("alloc_box_num", alloc_box_num_);
|
||||||
HttpProxy::Instance()->HttpGet
|
HttpProxy::Instance()->HttpGet
|
||||||
@ -188,7 +189,7 @@ void BoxDrop::RequestReturnBoxNum()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BoxDrop::FillAccountIdSessionId(std::string account_id, std::string session_id)
|
bool BoxDrop::FillAccountIdSessionId(std::string& account_id, std::string& session_id)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
room_->TraversePlayerList
|
room_->TraversePlayerList
|
||||||
@ -298,3 +299,17 @@ int BoxDrop::GetUsedBoxNum()
|
|||||||
});
|
});
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BoxDrop::GetNextBoxPos(glm::vec3& pos)
|
||||||
|
{
|
||||||
|
for (auto& pair : drop_hash_) {
|
||||||
|
if (pair.second > 0) {
|
||||||
|
Entity* e = room_->GetEntityByUniId(pair.first);
|
||||||
|
if (e) {
|
||||||
|
pos = e->GetPos().ToGlmVec3();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -15,12 +15,13 @@ class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
|||||||
void OnHeroDeadDrop(Hero* hero);
|
void OnHeroDeadDrop(Hero* hero);
|
||||||
void OnObstacleDeadDrop(Obstacle* ob);
|
void OnObstacleDeadDrop(Obstacle* ob);
|
||||||
void RequestReturnBoxNum();
|
void RequestReturnBoxNum();
|
||||||
|
bool GetNextBoxPos(glm::vec3& pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void Drop(int num, const glm::vec3& center);
|
void Drop(int num, const glm::vec3& center);
|
||||||
void RequestAllocBoxNum();
|
void RequestAllocBoxNum();
|
||||||
bool FillAccountIdSessionId(std::string account_id, std::string session_id);
|
bool FillAccountIdSessionId(std::string& account_id, std::string& session_id);
|
||||||
void OnAllocOk(int box_num);
|
void OnAllocOk(int box_num);
|
||||||
void OnAllocFail();
|
void OnAllocFail();
|
||||||
void AllocBoxToRoom();
|
void AllocBoxToRoom();
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "loot.h"
|
#include "loot.h"
|
||||||
#include "ability.h"
|
#include "ability.h"
|
||||||
#include "trigger.h"
|
#include "trigger.h"
|
||||||
|
#include "boxdrop.h"
|
||||||
|
|
||||||
#include "cs_proto.pb.h"
|
#include "cs_proto.pb.h"
|
||||||
|
|
||||||
@ -69,6 +70,12 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
|||||||
room->grid_service->MoveCreature(this);
|
room->grid_service->MoveCreature(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (cmd == "goto_box") {
|
||||||
|
glm::vec3 pos;
|
||||||
|
if (room->GetBoxDrop()->GetNextBoxPos(pos)) {
|
||||||
|
GetMutablePos().FromGlmVec3(pos);
|
||||||
|
room->grid_service->MoveCreature(this);
|
||||||
|
}
|
||||||
} else if (cmd == "additem" && cmds.size() >= 3) {
|
} else if (cmd == "additem" && cmds.size() >= 3) {
|
||||||
int item_id = a8::XValue(cmds[1]);
|
int item_id = a8::XValue(cmds[1]);
|
||||||
int item_num = a8::XValue(cmds[2]);
|
int item_num = a8::XValue(cmds[2]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user