Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- estack={}
- estack.hwpage=initArray2(32,0)
- estack.shpage=initArray2(32,0)
- function inZoneComm(x,y)
- for z in ipairs(zones) do
- if (zones[z]~=nil and zones[z].comm~=nil and x>=zones[z].comm.x1 and x<=zones[z].comm.x2 and y>=zones[z].comm.y1 and y<=zones[z].comm.y2) then
- return z
- end
- end
- end
- function maintmenu(id)
- menu(id,"BASE MENU,Trade Commodities,Buy Equipment,Buy Ships")
- end
- function getweapon(b,n)
- if (basedata[b].hardware[n]~=nil) then
- return equipment[basedata[b].hardware[n].type].name.."|"..equipment[basedata[b].hardware[n].type].price
- end
- end
- function getship(b,n)
- if (basedata[b].aships[n]~=nil) then
- return ships[basedata[b].aships[n].type].name.."|"..ships[basedata[b].aships[n].type].price
- end
- end
- function hasnext(p,z,m)
- if (m==1) then
- if (#basedata[z].hardware>=1+(8*(p-1))) then
- return "Next"
- end
- end
- if (m==2) then
- if (#basedata[z].aships>=1+(8*(p-1))) then
- return "Next"
- end
- end
- return ""
- end
- function hwmenu(id,p)
- print(p)
- print(1+(8*(p-1)))
- print(inZoneComm(player(id,"tilex"),player(id,"tiley")),1+(8*(p-1)))
- print(getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),1+(8*(p-1))))
- hasnext(p,inZoneComm(player(id,"tilex"),player(id,"tiley")),1)
- menu(id,"EQUIPMENT PURCHASE,"..getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),1+(8*(p-1)))..","..getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),2+(8*(p-1)))..","..getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),3+(8*(p-1)))..","..getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),4+(8*(p-1)))..","..getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),5+(8*(p-1)))..","..getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),6+(8*(p-1)))..","..getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),7+(8*(p-1)))..","..getweapon(inZoneComm(player(id,"tilex"),player(id,"tiley")),8+(8*(p-1)))..","..hasnext(p,inZoneComm(player(id,"tilex"),player(id,"tiley")),1))
- estack.hwpage[id]=p
- end
- function shmenu(id,p)
- menu(id,"SHIP PURCHASE,"..getship(inZoneComm(player(id,"tilex"),player(id,"tiley")),1+(8*(p-1)))..","..getship(inZoneComm(player(id,"tilex"),player(id,"tiley")),2+(8*(p-1)))..","..getship(inZoneComm(player(id,"tilex"),player(id,"tiley")),3+(8*(p-1)))..","..getship(inZoneComm(player(id,"tilex"),player(id,"tiley")),4+(8*(p-1)))..","..getship(inZoneComm(player(id,"tilex"),player(id,"tiley")),5+(8*(p-1)))..","..getship(inZoneComm(player(id,"tilex"),player(id,"tiley")),6+(8*(p-1)))..","..getship(inZoneComm(player(id,"tilex"),player(id,"tiley")),7+(8*(p-1)))..","..getship(inZoneComm(player(id,"tilex"),player(id,"tiley")),8+(8*(p-1)))..","..hasnext(p,inZoneComm(player(id,"tilex"),player(id,"tiley")),1))
- estack.shpage[id]=p
- end
- function hwdets(id)
- menu(id,"HARDWARE DETAILS,Purchase,Info")
- end
- function shdets(id)
- menu(id,"SHIP DETAILS,Purchase,Info")
- end
- addhook("menu","eqsel")
- function eqsel(id,menu,sel)
- if (menu=="BASE MENU") then
- if (sel==1) then
- trademenu(id,inZoneComm(player(id,"tilex"),player(id,"tiley")))
- end
- if (sel==2) then
- hwmenu(id,1)
- end
- if (sel==3) then
- shmenu(id,1)
- end
- end
- if (menu=="EQUIPMENT PURCHASE") then
- if (sel>=1 and sel<=8) then
- hwdets(id)
- estack.hwbuy[id]=sel+(8*(estack.hwpage-1))
- end
- if (sel==9) then
- hwmenu(id,sel+(8*(estack.hwpage-1)))
- end
- end
- if (menu=="SHIP PURCHASE") then
- if (sel>=1 and sel<=8) then
- shdets(id)
- estack.shbuy[id]=sel+(8*(estack.shpage-1))
- end
- if (sel==9) then
- shmenu(id,sel+(8*(estack.shpage-1)))
- end
- end
- if (menu=="HARDWARE DETAILS") then
- if (sel==1) then
- insertInInventory(id,basedata[inZoneComm(player(id,"tilex"),player(id,"tiley"))].hardware[estack.hwbuy[id]].type)
- credits[id]=credits[id]-equipment[basedata[inZoneComm(player(id,"tilex"),player(id,"tiley"))].hardware[estack.hwbuy[id]].type].price
- end
- if (sel==2) then
- msg2(id,equipment[basedata[inZoneComm(player(id,"tilex"),player(id,"tiley"))].hardware[estack.hwbuy[id]].type].desc)
- end
- end
- if (menu=="SHIP DETAILS") then
- if (sel==1) then
- shipt[id]=estack.shbuy[id]
- end
- if (sel==2) then
- msg2(id,ships[basedata[inZoneComm(player(id,"tilex"),player(id,"tiley"))].aships[estack.shbuy[id]].type].desc)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement