party improvements, still need to fix shared exp
This commit is contained in:
parent
8ad88c4070
commit
e714f9e149
|
@ -17,4 +17,5 @@ Module
|
||||||
require 'game'
|
require 'game'
|
||||||
require 'thing'
|
require 'thing'
|
||||||
require 'creature'
|
require 'creature'
|
||||||
|
require 'player'
|
||||||
require 'map'
|
require 'map'
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
function Player:isPartyLeader()
|
||||||
|
local shield = self:getShield()
|
||||||
|
return (shield == ShieldWhiteYellow or
|
||||||
|
shield == ShieldYellow or
|
||||||
|
shield == ShieldYellowSharedExp or
|
||||||
|
shield == ShieldYellowNoSharedExpBlink or
|
||||||
|
shield == ShieldYellowNoSharedExp)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Player:isPartyMember()
|
||||||
|
local shield = self:getShield()
|
||||||
|
return (shield == ShieldWhiteYellow or
|
||||||
|
shield == ShieldYellow or
|
||||||
|
shield == ShieldYellowSharedExp or
|
||||||
|
shield == ShieldYellowNoSharedExpBlink or
|
||||||
|
shield == ShieldYellowNoSharedExp or
|
||||||
|
shield == ShieldBlueSharedExp or
|
||||||
|
shield == ShieldBlueNoSharedExpBlink or
|
||||||
|
shield == ShieldBlueNoSharedExp or
|
||||||
|
shield == ShieldBlue)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Player:isPartySharedExperienceActive()
|
||||||
|
local shield = self:getShield()
|
||||||
|
return (shield == ShieldYellowSharedExp or
|
||||||
|
shield == ShieldYellowNoSharedExpBlink or
|
||||||
|
shield == ShieldYellowNoSharedExp or
|
||||||
|
shield == ShieldBlueSharedExp or
|
||||||
|
shield == ShieldBlueNoSharedExpBlink or
|
||||||
|
shield == ShieldBlueNoSharedExp)
|
||||||
|
end
|
|
@ -94,6 +94,18 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
||||||
|
|
||||||
if creatureThing:asLocalPlayer() then
|
if creatureThing:asLocalPlayer() then
|
||||||
menu:addOption('Set Outfit', function() Game.openOutfitWindow() end)
|
menu:addOption('Set Outfit', function() Game.openOutfitWindow() end)
|
||||||
|
|
||||||
|
if creatureThing:asPlayer():isPartyMember() --[[and not fighting]] then
|
||||||
|
if creatureThing:asPlayer():isPartyLeader() then
|
||||||
|
if creatureThing:asPlayer():isPartySharedExperienceActive() then
|
||||||
|
menu:addOption('Disable Shared Experience', function() Game.partyShareExperience(false) end)
|
||||||
|
else
|
||||||
|
menu:addOption('Enable Shared Experience', function() Game.partyShareExperience(true) end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
menu:addOption('Leave Party', function() Game.partyLeave() end)
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
local localPlayer = Game.getLocalPlayer()
|
local localPlayer = Game.getLocalPlayer()
|
||||||
if localPlayer then
|
if localPlayer then
|
||||||
|
@ -108,16 +120,37 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
||||||
else
|
else
|
||||||
menu:addOption('Stop Follow', function() Game.cancelFollow() end)
|
menu:addOption('Stop Follow', function() Game.cancelFollow() end)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if creatureThing:asPlayer() then
|
if creatureThing:asPlayer() then
|
||||||
menu:addSeparator()
|
menu:addSeparator()
|
||||||
menu:addOption('Message to ' .. creatureThing:getName(), function() print('message') end)
|
menu:addOption('Message to ' .. creatureThing:getName(), function() print('message') end)
|
||||||
menu:addOption('Add to VIP list', function() Game.addVip(creatureThing:getName()) end)
|
menu:addOption('Add to VIP list', function() Game.addVip(creatureThing:getName()) end)
|
||||||
menu:addOption('Ignore ' .. creatureThing:getName(), function() print('ignore') end)
|
menu:addOption('Ignore ' .. creatureThing:getName(), function() print('ignore') end)
|
||||||
menu:addOption('Invite to Party', function() Game.inviteToParty(creatureThing:getId()) end)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
local localPlayerShield = localPlayer:asCreature():getShield()
|
||||||
|
local creatureShield = creatureThing:getShield()
|
||||||
|
|
||||||
|
if localPlayerShield == ShieldNone or localPlayerShield == ShieldWhiteBlue then
|
||||||
|
if creatureShield == ShieldWhiteYellow then
|
||||||
|
menu:addOption('Join ' .. creatureThing:getName() .. '\'s Party', function() Game.partyJoin(creatureThing:getId()) end)
|
||||||
|
else
|
||||||
|
menu:addOption('Invite to Party', function() Game.partyInvite(creatureThing:getId()) end)
|
||||||
|
end
|
||||||
|
elseif localPlayerShield == ShieldWhiteYellow then
|
||||||
|
if creatureShield == ShieldWhiteBlue then
|
||||||
|
menu:addOption('Revoke ' .. creatureThing:getName() .. '\'s Invitation', function() Game.partyRevokeInvitation(creatureThing:getId()) end)
|
||||||
|
end
|
||||||
|
elseif localPlayerShield == ShieldYellow or localPlayerShield == ShieldYellowSharedExp or localPlayerShield == ShieldYellowNoSharedExpBlink or localPlayerShield == ShieldYellowNoSharedExp then
|
||||||
|
if creatureShield == ShieldWhiteBlue then
|
||||||
|
menu:addOption('Revoke ' .. creatureThing:getName() .. '\'s Invitation', function() Game.partyRevokeInvitation(creatureThing:getId()) end)
|
||||||
|
elseif creatureShield == ShieldBlue or creatureShield == ShieldBlueSharedExp or creatureShield == ShieldBlueNoSharedExpBlink or creatureShield == ShieldBlueNoSharedExp then
|
||||||
|
menu:addOption('Pass Leadership to ' .. creatureThing:getName(), function() Game.partyPassLeadership(creatureThing:getId()) end)
|
||||||
|
else
|
||||||
|
menu:addOption('Invite to Party', function() Game.partyInvite(creatureThing:getId()) end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
menu:addSeparator()
|
menu:addSeparator()
|
||||||
|
|
|
@ -174,16 +174,16 @@ namespace Otc
|
||||||
|
|
||||||
enum PlayerShields {
|
enum PlayerShields {
|
||||||
ShieldNone = 0,
|
ShieldNone = 0,
|
||||||
ShieldWhiteYellow,
|
ShieldWhiteYellow, // 1 party leader
|
||||||
ShieldWhiteBlue,
|
ShieldWhiteBlue, // 2 party member
|
||||||
ShieldBlue,
|
ShieldBlue, // 3 party member sexp off
|
||||||
ShieldYellow,
|
ShieldYellow, // 4 party leader sexp off
|
||||||
ShieldBlueSharedExp,
|
ShieldBlueSharedExp, // 5 party member sexp on
|
||||||
ShieldYellowSharedExp,
|
ShieldYellowSharedExp, // 6 // party leader sexp on
|
||||||
ShieldBlueNoSharedExpBlink,
|
ShieldBlueNoSharedExpBlink, // 7 party member sexp inactive guilty
|
||||||
ShieldYellowNoSharedExpBlink,
|
ShieldYellowNoSharedExpBlink, // 8 // party leader sexp inactive guilty
|
||||||
ShieldBlueNoSharedExp,
|
ShieldBlueNoSharedExp, // 9 party member sexp inactive innocent
|
||||||
ShieldYellowNoSharedExp
|
ShieldYellowNoSharedExp // 10 party leader sexp inactive innocent
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PlayerEmblems {
|
enum PlayerEmblems {
|
||||||
|
|
|
@ -333,7 +333,7 @@ void Game::talkPrivate(int channelType, const std::string& receiver, const std::
|
||||||
m_protocolGame->sendTalk(channelType, 0, receiver, message);
|
m_protocolGame->sendTalk(channelType, 0, receiver, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::inviteToParty(int creatureId)
|
void Game::partyInvite(int creatureId)
|
||||||
{
|
{
|
||||||
if(!m_online || !checkBotProtection())
|
if(!m_online || !checkBotProtection())
|
||||||
return;
|
return;
|
||||||
|
@ -341,6 +341,47 @@ void Game::inviteToParty(int creatureId)
|
||||||
m_protocolGame->sendInviteToParty(creatureId);
|
m_protocolGame->sendInviteToParty(creatureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::partyJoin(int creatureId)
|
||||||
|
{
|
||||||
|
if(!m_online || !checkBotProtection())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_protocolGame->sendJoinParty(creatureId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::partyRevokeInvitation(int creatureId)
|
||||||
|
{
|
||||||
|
if(!m_online || !checkBotProtection())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_protocolGame->sendRevokeInvitation(creatureId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Game::partyPassLeadership(int creatureId)
|
||||||
|
{
|
||||||
|
if(!m_online || !checkBotProtection())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_protocolGame->sendPassLeadership(creatureId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::partyLeave()
|
||||||
|
{
|
||||||
|
if(!m_online || !checkBotProtection())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_protocolGame->sendLeaveParty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::partyShareExperience(bool active)
|
||||||
|
{
|
||||||
|
if(!m_online || !checkBotProtection())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_protocolGame->sendShareExperience(active, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void Game::openOutfitWindow()
|
void Game::openOutfitWindow()
|
||||||
{
|
{
|
||||||
if(!m_online || !checkBotProtection())
|
if(!m_online || !checkBotProtection())
|
||||||
|
|
|
@ -65,7 +65,12 @@ public:
|
||||||
void talk(const std::string& message);
|
void talk(const std::string& message);
|
||||||
void talkChannel(int channelType, int channelId, const std::string& message);
|
void talkChannel(int channelType, int channelId, const std::string& message);
|
||||||
void talkPrivate(int channelType, const std::string& receiver, const std::string& message);
|
void talkPrivate(int channelType, const std::string& receiver, const std::string& message);
|
||||||
void inviteToParty(int creatureId);
|
void partyInvite(int creatureId);
|
||||||
|
void partyJoin(int creatureId);
|
||||||
|
void partyRevokeInvitation(int creatureId);
|
||||||
|
void partyPassLeadership(int creatureId);
|
||||||
|
void partyLeave();
|
||||||
|
void partyShareExperience(bool active);
|
||||||
void openOutfitWindow();
|
void openOutfitWindow();
|
||||||
void setOutfit(const Outfit& outfit);
|
void setOutfit(const Outfit& outfit);
|
||||||
void addVip(const std::string& name);
|
void addVip(const std::string& name);
|
||||||
|
|
|
@ -122,6 +122,7 @@ void OTClient::registerLuaFunctions()
|
||||||
|
|
||||||
g_lua.registerClass<Creature, Thing>();
|
g_lua.registerClass<Creature, Thing>();
|
||||||
g_lua.bindClassMemberFunction<Creature>("getName", &Creature::getName);
|
g_lua.bindClassMemberFunction<Creature>("getName", &Creature::getName);
|
||||||
|
g_lua.bindClassMemberFunction<Creature>("getShield", &Creature::getShield);
|
||||||
g_lua.bindClassMemberFunction<Creature>("setOutfit", &Creature::setOutfit);
|
g_lua.bindClassMemberFunction<Creature>("setOutfit", &Creature::setOutfit);
|
||||||
g_lua.bindClassMemberFunction<Creature>("getOutfit", &Creature::getOutfit);
|
g_lua.bindClassMemberFunction<Creature>("getOutfit", &Creature::getOutfit);
|
||||||
g_lua.bindClassMemberFunction<Creature>("setSkullTexture", &Creature::setSkullTexture);
|
g_lua.bindClassMemberFunction<Creature>("setSkullTexture", &Creature::setSkullTexture);
|
||||||
|
@ -183,7 +184,14 @@ void OTClient::registerLuaFunctions()
|
||||||
g_lua.bindClassStaticFunction<Game>("follow", std::bind(&Game::follow, &g_game, _1));
|
g_lua.bindClassStaticFunction<Game>("follow", std::bind(&Game::follow, &g_game, _1));
|
||||||
g_lua.bindClassStaticFunction<Game>("cancelFollow", std::bind(&Game::cancelFollow, &g_game));
|
g_lua.bindClassStaticFunction<Game>("cancelFollow", std::bind(&Game::cancelFollow, &g_game));
|
||||||
g_lua.bindClassStaticFunction<Game>("rotate", std::bind(&Game::rotate, &g_game, _1));
|
g_lua.bindClassStaticFunction<Game>("rotate", std::bind(&Game::rotate, &g_game, _1));
|
||||||
g_lua.bindClassStaticFunction<Game>("inviteToParty", std::bind(&Game::inviteToParty, &g_game, _1));
|
|
||||||
|
g_lua.bindClassStaticFunction<Game>("partyInvite", std::bind(&Game::partyInvite, &g_game, _1));
|
||||||
|
g_lua.bindClassStaticFunction<Game>("partyJoin", std::bind(&Game::partyJoin, &g_game, _1));
|
||||||
|
g_lua.bindClassStaticFunction<Game>("partyRevokeInvitation", std::bind(&Game::partyRevokeInvitation, &g_game, _1));
|
||||||
|
g_lua.bindClassStaticFunction<Game>("partyPassLeadership", std::bind(&Game::partyPassLeadership, &g_game, _1));
|
||||||
|
g_lua.bindClassStaticFunction<Game>("partyLeave", std::bind(&Game::partyLeave, &g_game));
|
||||||
|
g_lua.bindClassStaticFunction<Game>("partyShareExperience", std::bind(&Game::partyShareExperience, &g_game, _1));
|
||||||
|
|
||||||
g_lua.bindClassStaticFunction<Game>("addVip", std::bind(&Game::addVip, &g_game, _1));
|
g_lua.bindClassStaticFunction<Game>("addVip", std::bind(&Game::addVip, &g_game, _1));
|
||||||
g_lua.bindClassStaticFunction<Game>("removeVip", std::bind(&Game::removeVip, &g_game, _1));
|
g_lua.bindClassStaticFunction<Game>("removeVip", std::bind(&Game::removeVip, &g_game, _1));
|
||||||
g_lua.bindClassStaticFunction<Game>("talk", std::bind(&Game::talk, &g_game, _1));
|
g_lua.bindClassStaticFunction<Game>("talk", std::bind(&Game::talk, &g_game, _1));
|
||||||
|
|
Loading…
Reference in New Issue