party improvements, still need to fix shared exp

This commit is contained in:
Henrique Santiago
2012-01-10 21:38:32 -02:00
parent 8ad88c4070
commit e714f9e149
7 changed files with 141 additions and 22 deletions

View File

@@ -17,4 +17,5 @@ Module
require 'game'
require 'thing'
require 'creature'
require 'player'
require 'map'

31
modules/game/player.lua Normal file
View File

@@ -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

View File

@@ -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
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
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
end
menu:addSeparator()