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 'thing'
|
||||
require 'creature'
|
||||
require 'player'
|
||||
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
|
||||
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
|
||||
local localPlayer = Game.getLocalPlayer()
|
||||
if localPlayer then
|
||||
|
@ -108,16 +120,37 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
|||
else
|
||||
menu:addOption('Stop Follow', function() Game.cancelFollow() end)
|
||||
end
|
||||
end
|
||||
|
||||
if creatureThing:asPlayer() then
|
||||
menu:addSeparator()
|
||||
menu:addOption('Message to ' .. creatureThing:getName(), function() print('message') end)
|
||||
menu:addOption('Add to VIP list', function() Game.addVip(creatureThing:getName()) end)
|
||||
menu:addOption('Ignore ' .. creatureThing:getName(), function() print('ignore') end)
|
||||
menu:addOption('Invite to Party', function() Game.inviteToParty(creatureThing:getId()) end)
|
||||
end
|
||||
if creatureThing:asPlayer() then
|
||||
menu:addSeparator()
|
||||
menu:addOption('Message to ' .. creatureThing:getName(), function() print('message') end)
|
||||
menu:addOption('Add to VIP list', function() Game.addVip(creatureThing:getName()) end)
|
||||
menu:addOption('Ignore ' .. creatureThing:getName(), function() print('ignore') 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
|
||||
|
||||
menu:addSeparator()
|
||||
|
|
|
@ -174,16 +174,16 @@ namespace Otc
|
|||
|
||||
enum PlayerShields {
|
||||
ShieldNone = 0,
|
||||
ShieldWhiteYellow,
|
||||
ShieldWhiteBlue,
|
||||
ShieldBlue,
|
||||
ShieldYellow,
|
||||
ShieldBlueSharedExp,
|
||||
ShieldYellowSharedExp,
|
||||
ShieldBlueNoSharedExpBlink,
|
||||
ShieldYellowNoSharedExpBlink,
|
||||
ShieldBlueNoSharedExp,
|
||||
ShieldYellowNoSharedExp
|
||||
ShieldWhiteYellow, // 1 party leader
|
||||
ShieldWhiteBlue, // 2 party member
|
||||
ShieldBlue, // 3 party member sexp off
|
||||
ShieldYellow, // 4 party leader sexp off
|
||||
ShieldBlueSharedExp, // 5 party member sexp on
|
||||
ShieldYellowSharedExp, // 6 // party leader sexp on
|
||||
ShieldBlueNoSharedExpBlink, // 7 party member sexp inactive guilty
|
||||
ShieldYellowNoSharedExpBlink, // 8 // party leader sexp inactive guilty
|
||||
ShieldBlueNoSharedExp, // 9 party member sexp inactive innocent
|
||||
ShieldYellowNoSharedExp // 10 party leader sexp inactive innocent
|
||||
};
|
||||
|
||||
enum PlayerEmblems {
|
||||
|
|
|
@ -333,7 +333,7 @@ void Game::talkPrivate(int channelType, const std::string& receiver, const std::
|
|||
m_protocolGame->sendTalk(channelType, 0, receiver, message);
|
||||
}
|
||||
|
||||
void Game::inviteToParty(int creatureId)
|
||||
void Game::partyInvite(int creatureId)
|
||||
{
|
||||
if(!m_online || !checkBotProtection())
|
||||
return;
|
||||
|
@ -341,6 +341,47 @@ void Game::inviteToParty(int 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()
|
||||
{
|
||||
if(!m_online || !checkBotProtection())
|
||||
|
|
|
@ -65,7 +65,12 @@ public:
|
|||
void talk(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 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 setOutfit(const Outfit& outfit);
|
||||
void addVip(const std::string& name);
|
||||
|
|
|
@ -122,6 +122,7 @@ void OTClient::registerLuaFunctions()
|
|||
|
||||
g_lua.registerClass<Creature, Thing>();
|
||||
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>("getOutfit", &Creature::getOutfit);
|
||||
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>("cancelFollow", std::bind(&Game::cancelFollow, &g_game));
|
||||
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>("removeVip", std::bind(&Game::removeVip, &g_game, _1));
|
||||
g_lua.bindClassStaticFunction<Game>("talk", std::bind(&Game::talk, &g_game, _1));
|
||||
|
|
Loading…
Reference in New Issue