mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
More on Market (far from done), Minor Fixes, Edited Outfits Module, Some Cosmetics.
* Started building the market UI. * More work on the market functionality. * Fixes to the market protocol. (Known issue: if I use safeSend method from Market (like so: MarketProtocol.send~) is thinks it is a bot). * Fixes to the market offer class. * Outfit window will no longer display the mount box if you are using protocol < 870. * Added getFeature to playermount module. * Added isMarketable and getMarketData to the lua binding. * Added lua casts for MarketData. * Fixed typo in the module manager. * Added new 'light flat panel' for more variation (can change later) will require some graphics for market. * Added new functions to table lib. * Fixed some styling issues from previous commits.
This commit is contained in:
@@ -1074,7 +1074,7 @@ bool Game::checkBotProtection()
|
||||
// accepts calls comming from a stacktrace containing only C++ functions,
|
||||
// if the stacktrace contains a lua function, then only accept if the engine is processing an input event
|
||||
if(m_denyBotCall && g_lua.isInCppCallback() && !g_app.isOnInputEvent()) {
|
||||
g_logger.error(g_lua.traceback("caught a lua call to a bot protected game function, the call was canceled"));
|
||||
g_logger.error(g_lua.traceback("caught a lua call to a bot protected game function, the call was cancelled"));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@@ -274,7 +274,9 @@ void OTClient::registerLuaFunctions()
|
||||
g_lua.bindClassMemberFunction<Thing>("isHookSouth", &Thing::isHookSouth);
|
||||
g_lua.bindClassMemberFunction<Thing>("isTranslucent", &Thing::isTranslucent);
|
||||
g_lua.bindClassMemberFunction<Thing>("isFullGround", &Thing::isFullGround);
|
||||
g_lua.bindClassMemberFunction<Thing>("isMarketable", &Thing::isMarketable);
|
||||
g_lua.bindClassMemberFunction<Thing>("getParentContainer", &Thing::getParentContainer);
|
||||
g_lua.bindClassMemberFunction<Thing>("getMarketData", &Thing::getMarketData);
|
||||
|
||||
g_lua.registerClass<House>();
|
||||
g_lua.bindClassStaticFunction<House>("create", []{ return HousePtr(new House); });
|
||||
@@ -334,6 +336,8 @@ void OTClient::registerLuaFunctions()
|
||||
g_lua.bindClassMemberFunction<Item>("getCount", &Item::getCount);
|
||||
g_lua.bindClassMemberFunction<Item>("getId", &Item::getId);
|
||||
g_lua.bindClassMemberFunction<Item>("isStackable", &Item::isStackable);
|
||||
g_lua.bindClassMemberFunction<Item>("isMarketable", &Item::isMarketable);
|
||||
g_lua.bindClassMemberFunction<Item>("getMarketData", &Item::isMarketable);
|
||||
|
||||
g_lua.registerClass<Effect, Thing>();
|
||||
g_lua.registerClass<Missile, Thing>();
|
||||
|
@@ -97,3 +97,41 @@ bool luavalue_cast(int index, Position& pos)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int push_luavalue(const MarketData& data)
|
||||
{
|
||||
g_lua.newTable();
|
||||
g_lua.pushInteger(data.category);
|
||||
g_lua.setField("category");
|
||||
g_lua.pushString(data.name);
|
||||
g_lua.setField("name");
|
||||
g_lua.pushInteger(data.requiredLevel);
|
||||
g_lua.setField("requiredLevel");
|
||||
g_lua.pushInteger(data.restrictProfession);
|
||||
g_lua.setField("restrictProfession");
|
||||
g_lua.pushInteger(data.showAs);
|
||||
g_lua.setField("showAs");
|
||||
g_lua.pushInteger(data.tradeAs);
|
||||
g_lua.setField("tradeAs");
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool luavalue_cast(int index, MarketData& data)
|
||||
{
|
||||
if(g_lua.isTable(index)) {
|
||||
g_lua.getField("category", index);
|
||||
data.category = g_lua.popInteger();
|
||||
g_lua.getField("name", index);
|
||||
data.name = g_lua.popString();
|
||||
g_lua.getField("requiredLevel", index);
|
||||
data.requiredLevel = g_lua.popInteger();
|
||||
g_lua.getField("restrictProfession", index);
|
||||
data.restrictProfession = g_lua.popInteger();
|
||||
g_lua.getField("showAs", index);
|
||||
data.showAs = g_lua.popInteger();
|
||||
g_lua.getField("tradeAs", index);
|
||||
data.tradeAs = g_lua.popInteger();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -36,4 +36,8 @@ bool luavalue_cast(int index, Outfit& outfit);
|
||||
int push_luavalue(const Position& pos);
|
||||
bool luavalue_cast(int index, Position& pos);
|
||||
|
||||
// market
|
||||
int push_luavalue(const MarketData& data);
|
||||
bool luavalue_cast(int index, MarketData& data);
|
||||
|
||||
#endif
|
||||
|
@@ -128,8 +128,10 @@ public:
|
||||
bool isFullGround() { return rawGetDatType()->isFullGround(); }
|
||||
bool isIgnoreLook() { return rawGetDatType()->isIgnoreLook(); }
|
||||
bool isCloth() { return rawGetDatType()->isCloth(); }
|
||||
bool isMarketable() { return rawGetDatType()->isMarketable(); }
|
||||
MarketData getMarketData() { return rawGetDatType()->getMarketData(); }
|
||||
|
||||
|
||||
protected:
|
||||
Position m_position;
|
||||
uint16 m_datId;
|
||||
|
@@ -172,6 +172,7 @@ public:
|
||||
bool isFullGround() { return m_attribs.has(DatAttribFullGround); }
|
||||
bool isIgnoreLook() { return m_attribs.has(DatAttribIgnoreLook); }
|
||||
bool isCloth() { return m_attribs.has(DatAttribCloth); }
|
||||
bool isMarketable() { return m_attribs.has(DatAttribMarket); }
|
||||
|
||||
private:
|
||||
const TexturePtr& getTexture(int animationPhase);
|
||||
|
@@ -48,8 +48,8 @@ public:
|
||||
|
||||
const ThingTypeDatPtr& getDatType(uint16 id, DatCategory category);
|
||||
const ThingTypeOtbPtr& getOtbType(uint16 id);
|
||||
ThingTypeDat *rawGetDatType(uint16 id, DatCategory category) { return m_datTypes[category][id].get(); }
|
||||
ThingTypeOtb *rawGetOtbType(uint16 id) { return m_otbTypes[id].get(); }
|
||||
ThingTypeDat* rawGetDatType(uint16 id, DatCategory category) { return m_datTypes[category][id].get(); }
|
||||
ThingTypeOtb* rawGetOtbType(uint16 id) { return m_otbTypes[id].get(); }
|
||||
|
||||
uint32 getDatSignature() { return m_datSignature; }
|
||||
uint32 getOtbMajorVersion() { return m_otbMajorVersion; }
|
||||
|
Reference in New Issue
Block a user