mirror of https://github.com/bra1n/townsquare.git
2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
(function(e){function t(t){for(var a,o,n=t[0],l=t[1],d=t[2],c=0,m=[];c<n.length;c++)o=n[c],Object.prototype.hasOwnProperty.call(i,o)&&i[o]&&m.push(i[o][0]),i[o]=0;for(a in l)Object.prototype.hasOwnProperty.call(l,a)&&(e[a]=l[a]);u&&u(t);while(m.length)m.shift()();return r.push.apply(r,d||[]),s()}function s(){for(var e,t=0;t<r.length;t++){for(var s=r[t],a=!0,n=1;n<s.length;n++){var l=s[n];0!==i[l]&&(a=!1)}a&&(r.splice(t--,1),e=o(o.s=s[0]))}return e}var a={},i={app:0},r=[];function o(t){if(a[t])return a[t].exports;var s=a[t]={i:t,l:!1,exports:{}};return e[t].call(s.exports,s,s.exports,o),s.l=!0,s.exports}o.m=e,o.c=a,o.d=function(e,t,s){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(o.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)o.d(s,a,function(t){return e[t]}.bind(null,a));return s},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/townsquare/";var n=window["webpackJsonp"]=window["webpackJsonp"]||[],l=n.push.bind(n);n.push=t,n=n.slice();for(var d=0;d<n.length;d++)t(n[d]);var u=l;r.push(["56d7","chunk-vendors"]),s()})({"0025":function(e,t,s){},"30db":function(e,t,s){"use strict";var a=s("0025"),i=s.n(a);i.a},3636:function(e,t,s){"use strict";var a=s("d4b2"),i=s.n(a);i.a},"56d7":function(e,t,s){"use strict";s.r(t);var a=s("2b0e"),i=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"app"}},[s("TownInfo",{attrs:{players:e.players}}),s("TownSquare",{attrs:{"is-public":e.isPublic,players:e.players,roles:e.roles}}),s("div",{staticClass:"controls"},[s("font-awesome-icon",{attrs:{icon:"cogs"},on:{click:function(t){e.isControlOpen=!e.isControlOpen}}}),e.isControlOpen?s("ul",[s("li",{on:{click:e.togglePublic}},[e._v(" Toggle Grimoire ")]),e.players.length<20?s("li",{on:{click:e.addPlayer}},[e._v(" Add Player ")]):e._e(),e.players.length>4?s("li",{on:{click:e.togglePublic}},[e._v(" Select Roles ")]):e._e(),e.players.length>2?s("li",{on:{click:e.randomizeSeatings}},[e._v(" Randomize Seatings ")]):e._e()]):e._e()],1)],1)},r=[],o=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"square",class:{public:e.isPublic},attrs:{id:"townsquare"}},[s("ul",{staticClass:"circle",class:["size-"+e.players.length]},e._l(e.players,(function(t,a){return s("Player",{key:a,attrs:{player:t,roles:e.roles,"is-public":e.isPublic},on:{"add-reminder":e.openReminderModal,"set-role":e.openRoleModal,"remove-player":e.removePlayer}})})),1),s("Modal",{directives:[{name:"show",rawName:"v-show",value:e.availableReminders.length,expression:"availableReminders.length"}],on:{close:e.closeModal}},[s("h2",[e._v("Choose a reminder token:")]),s("ul",{staticClass:"reminders"},e._l(e.availableReminders,(function(t){return s("li",{key:t.role+" "+t.name,staticClass:"reminder",class:[t.role],on:{click:function(s){return e.addReminder(t)}}},[e._v(" "+e._s(t.name)+" ")])})),0)]),s("Modal",{directives:[{name:"show",rawName:"v-show",value:e.availableRoles.length,expression:"availableRoles.length"}],on:{close:e.closeModal}},[s("h2",[e._v("Choose a new role:")]),s("ul",{staticClass:"tokens"},e._l(e.availableRoles,(function(t){return s("li",{key:t.id,staticClass:"token",class:[t.id,t.team],on:{click:function(s){return e.setRole(t)}}},[e._v(" "+e._s(t.name)+" ")])})),0)])],1)},n=[],l=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("li",[s("div",{staticClass:"player",class:{dead:e.player.hasDied,"no-vote":e.player.hasVoted,traveller:"traveller"===e.player.role.team}},[s("div",{staticClass:"shroud",on:{click:function(t){return e.toggleStatus()}}}),s("div",{staticClass:"token",class:[e.player.role.id],on:{click:function(t){return e.changeRole()}}},[e.player.role.firstNight?s("span",{staticClass:"leaf-left"}):e._e(),e.player.role.otherNight?s("span",{staticClass:"leaf-right"}):e._e(),e.player.role.reminders&&e.player.role.reminders.length?s("span",{class:["leaf-top"+e.player.role.reminders.length]}):e._e(),e.player.role.setup?s("span",{staticClass:"leaf-orange"}):e._e(),s("div",[e._v(e._s(e.player.role.name))])]),e.player.role.ability?s("div",{staticClass:"ability"},[e._v(" "+e._s(e.player.role.ability)+" ")]):e._e(),s("div",{staticClass:"name",on:{click:e.changeName}},[e._v(" "+e._s(e.player.name)+" "),s("span",{staticClass:"remove",on:{click:function(t){return t.stopPropagation(),e.$emit("remove-player",e.player)}}},[s("font-awesome-icon",{attrs:{icon:"times-circle"}})],1)])]),e.player.reminders?e._l(e.player.reminders,(function(t){return s("div",{key:t.role+" "+t.name,staticClass:"reminder",class:[t.role],on:{click:function(s){return e.removeReminder(t)}}},[e._v(" "+e._s(t.name)+" ")])})):e._e(),s("div",{staticClass:"reminder add",on:{click:function(t){return e.$emit("add-reminder",e.player)}}})],2)},d=[],u={props:{player:{type:Object,required:!0},roles:{type:Map,required:!0},isPublic:{type:Boolean,required:!0}},data(){return{}},methods:{toggleStatus(){this.isPublic&&this.player.hasDied?this.$set(this.player,"hasVoted",!this.player.hasVoted):(this.$set(this.player,"hasDied",!this.player.hasDied),this.player.hasDied||this.$set(this.player,"hasVoted",!1))},changeRole(){this.isPublic?this.toggleStatus():this.$emit("set-role",this.player)},changeName(){const e=prompt("Player name",this.player.name);this.player.name=e||this.player.name},removeReminder(e){this.player.reminders.splice(this.player.reminders.indexOf(e),1)}}},c=u,m=(s("74c9"),s("2877")),h=Object(m["a"])(c,l,d,!1,null,null,null),f=h.exports,p=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("transition",{attrs:{name:"modal-fade"}},[s("div",{staticClass:"modal-backdrop",on:{click:e.close}},[s("div",{staticClass:"modal",attrs:{role:"dialog","aria-labelledby":"modalTitle","aria-describedby":"modalDescription"},on:{click:function(e){e.stopPropagation()}}},[e._t("default")],2)])])},y=[],g={methods:{close(){this.$emit("close")}}},v=g,b=(s("30db"),Object(m["a"])(v,p,y,!1,null,null,null)),w=b.exports,k={components:{Modal:w,Player:f},props:{isPublic:{type:Boolean,required:!0},players:{type:Array,required:!0},roles:{type:Map,required:!0}},data(){return{selectedPlayer:!1,availableReminders:[],availableRoles:[]}},methods:{openReminderModal(e){this.selectedPlayer=e,this.availableReminders=[],this.roles.forEach(e=>{this.players.some(t=>t.role.id===e.id)&&(this.availableReminders=[...this.availableReminders,...e.reminders.map(t=>({role:e.id,name:t}))])}),this.availableReminders.push({role:"good",name:"Good"}),this.availableReminders.push({role:"evil",name:"Evil"})},openRoleModal(e){this.selectedPlayer=e,this.availableRoles=[],this.roles.forEach(t=>{t.id!==e.role&&this.availableRoles.push(t)}),this.availableRoles.push({})},addReminder(e){this.selectedPlayer.reminders.push(e),this.closeModal()},setRole(e){this.selectedPlayer.role=e,this.closeModal()},closeModal(){this.selectedPlayer=!1,this.availableReminders=[],this.availableRoles=[]},removePlayer(e){confirm(`Do you really want to remove ${e.name}?`)&&this.players.splice(this.players.indexOf(e),1)}}},_=k,N=(s("3636"),Object(m["a"])(_,o,n,!1,null,null,null)),T=N.exports,P=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("ul",{staticClass:"info"},[e.players.length<5?s("li",[e._v("Please add more players!")]):e._e(),s("li",[e._v(" "+e._s(e.players.length)+" "),s("font-awesome-icon",{staticClass:"players",attrs:{icon:"users"}}),e._v(" "+e._s(e.teams.alive)+" "),s("font-awesome-icon",{staticClass:"alive",attrs:{icon:"heartbeat"}}),e._v(" "+e._s(e.teams.votes)+" "),s("font-awesome-icon",{staticClass:"votes",attrs:{icon:"vote-yea"}})],1),e.players.length>=5?s("li",[e._v(" "+e._s(e.teams.townsfolk)+" "),s("font-awesome-icon",{staticClass:"townsfolk",attrs:{icon:"user-friends"}}),e._v(" "+e._s(e.teams.outsiders)+" "),s("font-awesome-icon",{staticClass:"outsider",attrs:{icon:e.teams.outsiders>1?"user-friends":"user"}}),e._v(" "+e._s(e.teams.minions)+" "),s("font-awesome-icon",{staticClass:"minion",attrs:{icon:e.teams.minions>1?"user-friends":"user"}}),e._v(" "+e._s(e.teams.demons)+" "),s("font-awesome-icon",{staticClass:"demon",attrs:{icon:e.teams.demons>1?"user-friends":"user"}}),e.teams.travellers?[e._v(" "+e._s(e.teams.travellers)+" "),s("font-awesome-icon",{staticClass:"traveller",attrs:{icon:e.teams.travellers>1?"user-friends":"user"}})]:e._e()],2):e._e()])},C=[],R=s("634a"),O={props:{players:{type:Array,required:!0}},computed:{teams:function(){const e=this.players.filter(e=>"traveller"!==e.role.team).length,t=this.players.filter(e=>!0!==e.hasDied).length;return{...R[e-5],travellers:this.players.length-e,alive:t,votes:t+this.players.filter(e=>!0===e.hasDied&&!0!==e.hasVoted).length}}}},B=O,M=(s("8d43"),Object(m["a"])(B,P,C,!1,null,null,null)),D=M.exports,x=s("b1d9");const S=new Map(x.sort((e,t)=>t.team.localeCompare(e.team)).map(e=>[e.id,e]));var E={components:{TownSquare:T,TownInfo:D},data:()=>({isPublic:!0,isControlOpen:!1,players:[],roles:S,set:"TB"}),methods:{togglePublic(){this.isPublic=!this.isPublic,this.isControlOpen=!1},addPlayer(){const e=prompt("Player name");e&&this.players.push({name:e,role:{},reminders:[]})},randomizeSeatings(){confirm("Are you sure you want to randomize seatings?")&&(this.players=this.players.map(e=>[Math.random(),e]).sort((e,t)=>e[0]-t[0]).map(e=>e[1]))}}},j=E,$=(s("5c0b"),Object(m["a"])(j,i,r,!1,null,null,null)),q=$.exports,I=s("ecee"),Y=s("c074"),V=s("ad3d");I["c"].add(Y["f"],Y["b"],Y["g"],Y["e"],Y["d"],Y["c"],Y["a"]),a["a"].component("font-awesome-icon",V["a"]),a["a"].config.productionTip=!1,new a["a"]({render:e=>e(q)}).$mount("#app")},"5c0b":function(e,t,s){"use strict";var a=s("9c0c"),i=s.n(a);i.a},"634a":function(e){e.exports=JSON.parse('[{"townsfolk":3,"outsiders":0,"minions":1,"demons":1},{"townsfolk":3,"outsiders":1,"minions":1,"demons":1},{"townsfolk":5,"outsiders":0,"minions":1,"demons":1},{"townsfolk":5,"outsiders":1,"minions":1,"demons":1},{"townsfolk":5,"outsiders":2,"minions":1,"demons":1},{"townsfolk":7,"outsiders":0,"minions":2,"demons":1},{"townsfolk":7,"outsiders":1,"minions":2,"demons":1},{"townsfolk":7,"outsiders":2,"minions":2,"demons":1},{"townsfolk":9,"outsiders":0,"minions":3,"demons":1},{"townsfolk":9,"outsiders":1,"minions":3,"demons":1},{"townsfolk":9,"outsiders":2,"minions":3,"demons":1}]')},"74c9":function(e,t,s){"use strict";var a=s("9fd8"),i=s.n(a);i.a},"7a65":function(e,t,s){},"8d43":function(e,t,s){"use strict";var a=s("7a65"),i=s.n(a);i.a},"9c0c":function(e,t,s){},"9fd8":function(e,t,s){},b1d9:function(e){e.exports=JSON.parse('[{"id":"washerwoman","name":"Washerwoman","set":"TB","team":"townsfolk","firstNight":true,"otherNight":false,"reminders":["Townsfolk","Decoy"],"setup":false,"ability":"You start knowing 1 of 2 players is a particular Townsfolk."},{"id":"librarian","name":"Librarian","set":"TB","team":"townsfolk","firstNight":true,"otherNight":false,"reminders":["Outsider","Decoy"],"setup":false,"ability":"You start knowing that 1 of 2 players is a particular Outsider. (Or that zero are in play)"},{"id":"investigator","name":"Investigator","set":"TB","team":"townsfolk","firstNight":true,"otherNight":false,"reminders":["Minion","Decoy"],"setup":false,"ability":"You start knowing 1 of 2 players is a particular Minion."},{"id":"chef","name":"Chef","set":"TB","team":"townsfolk","firstNight":true,"otherNight":false,"reminders":[],"setup":false,"ability":"You start knowing how many pairs of evil players there are."},{"id":"empath","name":"Empath","set":"TB","team":"townsfolk","firstNight":true,"otherNight":true,"reminders":[],"setup":false,"ability":"Each night, you learn how many of your 2 alive neighbours are evil."},{"id":"fortuneteller","name":"Fortune Teller","set":"TB","team":"townsfolk","firstNight":true,"otherNight":true,"reminders":["Decoy"],"setup":false,"ability":"Each night, choose 2 players: you learn if either is a Demon. There is 1 good player that registers falsely to you."},{"id":"undertaker","name":"Undertaker","set":"TB","team":"townsfolk","firstNight":false,"otherNight":true,"reminders":["Executed"],"setup":false,"ability":"Each night*, you learn which character died by execution today."},{"id":"monk","name":"Monk","set":"TB","team":"townsfolk","firstNight":false,"otherNight":true,"reminders":["Protected"],"setup":false,"ability":"Each night*, choose a player (not yourself): they are safe from the Demon tonight."},{"id":"ravenkeeper","name":"Ravenkeeper","set":"TB","team":"townsfolk","firstNight":false,"otherNight":true,"reminders":[],"setup":false,"ability":"If you die at night, you are woken to choose a player: you learn their character."},{"id":"mayor","name":"Mayor","set":"TB","team":"townsfolk","firstNight":false,"otherNight":false,"reminders":[],"setup":false,"ability":"If only 3 players live & no execution occurs, your team wins. If you die at night, another player might die instead."},{"id":"slayer","name":"Slayer","set":"TB","team":"townsfolk","firstNight":false,"otherNight":false,"reminders":["Used"],"setup":false,"ability":"Once per game, during the day, publicly choose a player: if they are the Demon, they die."},{"id":"soldier","name":"Soldier","set":"TB","team":"townsfolk","firstNight":false,"otherNight":false,"reminders":[],"setup":false,"ability":"You are safe from the Demon."},{"id":"virgin","name":"Virgin","set":"TB","team":"townsfolk","firstNight":false,"otherNight":false,"reminders":["Used"],"setup":false,"ability":"The first time you are nominated, if the nominator is a Townsfolk, they are executed immediately."},{"id":"butler","name":"Butler","set":"TB","team":"outsider","firstNight":true,"otherNight":true,"reminders":["Master"],"setup":false,"ability":"Each night, choose a player (not yourself): tomorrow, you may only vote if they are voting too."},{"id":"drunk","name":"Drunk","set":"TB","team":"outsider","firstNight":false,"otherNight":false,"reminders":["Drunk"],"setup":true,"ability":"You do not know you are the Drunk. You think you are a Townsfolk, but your ability malfunctions."},{"id":"recluse","name":"Recluse","set":"TB","team":"outsider","firstNight":false,"otherNight":false,"reminders":[],"setup":false,"ability":"You might register as evil and as a Minion or Demon, even if dead."},{"id":"saint","name":"Saint","set":"TB","team":"outsider","firstNight":false,"otherNight":false,"reminders":[],"setup":false,"ability":"If you die by execution, your team loses."},{"id":"baron","name":"Baron","set":"TB","team":"minion","firstNight":false,"otherNight":false,"reminders":[],"setup":true,"ability":"There are extra Outsiders in play. [+2 Outsiders]"},{"id":"poisoner","name":"Poisoner","set":"TB","team":"minion","firstNight":true,"otherNight":true,"reminders":["Poisoned"],"setup":false,"ability":"Each night, choose a player: their ability malfunctions tonight and tomorrow day."},{"id":"spy","name":"Spy","set":"TB","team":"minion","firstNight":true,"otherNight":true,"reminders":[],"setup":false,"ability":"Each night, you see the Grimoire. You might register as good and as a Townsfolk or Outsider, even if dead."},{"id":"scarletwoman","name":"Scarlet Woman","set":"TB","team":"minion","firstNight":false,"otherNight":true,"reminders":["Demon"],"setup":false,"ability":"If there are 5 or more players alive (Travellers don\'t count) and the Demon dies, you become the Demon."},{"id":"imp","name":"Imp","set":"TB","team":"demon","firstNight":false,"otherNight":true,"reminders":["Die"],"setup":false,"ability":"Each night*, choose a player: they die. If you kill yourself this way, a Minion becomes the Imp."},{"id":"harlot","name":"Harlot","set":"SNV","team":"traveller","firstNight":false,"otherNight":true,"reminders":["Die"],"setup":false,"ability":"Each night*, choose a living player: if they agree, you learn their character, but you both might die."}]')},d4b2:function(e,t,s){}});
|
|
//# sourceMappingURL=app.f5edb09b.js.map
|