Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(){
- Array.prototype.removeValue = function(name, value){
- var array = $.map(this, function(v,i){
- return v[name] === value ? null : v;
- });
- this.length = 0; //clear original array
- this.push.apply(this, array); //push all elements except the one we want to delete
- }
- var DLC_PRICE = {"dlc1": 3, "dlc2": 5, "dlc3": 10};
- var askDLC = {
- id: "0B90BBED-1999-4CEA-8EE7-A1F39D31B304",
- isRandomEvent: false,
- maxTriggers: 99999999999,
- trigger: function (company) {
- var Asked_Game = GDT.getDataStore("DLC_NEW").data.Asked_Game;
- if (company.currentGame == undefined)
- return false;
- var gid = company.currentGame.id;
- if (Asked_Game != gid && company.isGameProgressBetween(.9, 1)) return true;
- },
- getNotification: function (company) {
- GDT.getDataStore("DLC_NEW").data.Asked_Game = company.currentGame.id;
- return new Notification({
- sourceId: "0B90BBED-1999-4CEA-8EE7-A1F39D31B304",
- header: "A propos du DLC",
- text: "Votre jeu va bientôt sortir ! Voulez-vous sortir un DLC ? Ça sera une belle approche pour se faire un peu d'argent, par contre sa pourrait avoir un effet négatif sur vos fans si votre jeu n'a pas eu de bonnes notes".localize(),
- options: ["Oui !", "Non"],
- weeksUntilFired: 0
- })
- },
- complete: function (decision) {
- if (decision === 0) {
- gid = GameManager.company.currentGame.id;
- var GameList = GDT.getDataStore("DLC_NEW").data.GameList;
- if (GameList == undefined)
- GameList = {};
- Sound.click();
- GameManager.resume(false);
- var div = $("#DLCwindow");
- div.scrollTop()
- div.gdDialog({
- popout: !0,
- close: !0,
- onClose: function () {
- GameList[gid] = {"id": gid, "dlc_unitprice": GDT.getDataStore("DLC_NEW").data.new_unitprice, "lastCheckWeek": 0,"checkCooldown": 0};
- GDT.getDataStore("DLC_NEW").data.GameList = GameList;
- GDT.getDataStore("DLC_NEW").data.new_unitprice = 0;
- GameManager.resume(true);
- return;
- }
- })
- return;
- }
- if (decision === 1) {
- return;
- }
- }
- };
- var getCash = {
- id: "8B358EFD-4245-4A5C-98DF-6B7A7A0A42D2",
- isRandomEvent: false,
- maxTriggers: 99999999999,
- trigger: function (company) {
- var GameList = GDT.getDataStore("DLC_NEW").data.GameList;
- if (GameList == undefined || GameList.length < 1)
- return false;
- for (var gid in GameList) {
- var game = GameList[gid];
- var TheGame = company.getGameById(gid);
- if (TheGame != null && TheGame.releaseWeek > 0){
- var gameReleaseWeek = TheGame.releaseWeek;
- var currentWeek = company.currentWeek;
- if (currentWeek >= gameReleaseWeek + 48) {
- GDT.getDataStore("DLC_NEW").data.Deploying_gid = gid;
- GDT.getDataStore("DLC_NEW").data.Deploying_unitprice = game["dlc_unitprice"];
- delete GameList[gid];
- GDT.getDataStore("DLC_NEW").data.GameList = GameList;
- return true;
- }
- if (game["lastCheckWeek"] === 0) {
- checkWeek = Math.ceil(gameReleaseWeek + 0.75) + 4;
- }
- else {
- checkWeek = Math.ceil(game["lastCheckWeek"] + game["checkCooldown"]);
- }
- if (currentWeek >= checkWeek) {
- Dice = company.getRandom();
- if (Dice > 0.5) {
- GDT.getDataStore("DLC_NEW").data.Deploying_gid = gid;
- GDT.getDataStore("DLC_NEW").data.Deploying_unitprice = game["dlc_unitprice"];
- delete GameList[gid];
- GDT.getDataStore("DLC_NEW").data.GameList = GameList;
- return true;
- }
- else {
- GameList[gid]["lastCheckWeek"] = currentWeek;
- GameList[gid]["checkCooldown"] = 8 * Dice;
- }
- }
- }
- }
- GDT.getDataStore("DLC_NEW").data.GameList = GameList;
- },
- getNotification: function (company) {
- var gid = GDT.getDataStore("DLC_NEW").data.Deploying_gid;
- var unit_price = GDT.getDataStore("DLC_NEW").data.x;
- var TheGame = GameManager.company.getGameById(gid);
- var gName = TheGame.title;
- var gScore = TheGame.score;
- var uSold = TheGame.unitsSold;
- var unit_price = GDT.getDataStore("DLC_NEW").data.Deploying_unitprice;
- var moneyMade = unit_price * uSold;
- GDT.getDataStore("DLC_NEW").data.Deploying_unitprice = 0;
- GDT.getDataStore("DLC_NEW").data.Deploying_gid = "none";
- GameManager.company.adjustCash(moneyMade, "DLC Sales");
- var msg = "Votre DLC vient de sortir ! ";
- if (gScore > 7) {
- msg = msg + gName + " a eu des notes plutôt positives, et vous avez vendu " + UI.getShortNumberString(uSold) + " exemplaires, et vous vous êtes fait " + moneyMade + "!";
- } else {
- var currFans = GameManager.company.fans;
- var adjFans = Math.round(currFans / unit_price);
- GameManager.company.adjustFans(-adjFans);
- msg = msg + "Votre jeu n'a pas été si bon que ça, donc, la sortie du DLC a eu un effet négatif sur vos fans. Vous avez vendu " + moneyMade + " exemplaires, mais vous vous êtes fait "+ UI.getShortNumberString(adjFans) + " fans0";
- }
- return new Notification({
- header: "A propos du DLC",
- text: msg,
- buttonText: ":-)",
- weeksUntilFired: 0
- })
- }
- };
- GDT.addEvent(askDLC);
- GDT.addEvent(getCash);
- //=============================================================================================================================================================
- //=============================================================================================================================================================
- //=============================================================================================================================================================
- //=============================================================================================================================================================
- UI.SellShares = function (a) {
- GDT.getDataStore("DLC_NEW").data.new_unitprice = DLC_PRICE[a.id];
- div.dialog("close");
- };
- var div = $("body");
- div.append('<div id="DLCwindow" class="windowBorder wideWindow" style="overflow:auto;display:none;"> <div id="toDLC" class="windowTitle smallerWindowTitle">Un DLC ?</div>');
- div = $("#DLCwindow");
- div.append('<div style="text-align:center;margin-left:50px;width: 675px">Quel type/genre de DLC voulez-vous sortir? Après que votre jeu a été sorti, si il y a eu beaucoup de ventes du jeu, il y aura beaucoup de ventes du DLC. Par contre, si votre jeu n'a pas été si bon ou que vous avez sorti trop de DLCs, sa pourrait avoir un effect négatif à votre popularité.</div>');
- div.append('<div id="dlc1" class="selectorButton whiteButton" onclick="UI.SellShares(this)" style="margin-left:50px;width: 675px">Nouvelles textures pour un personnage ou deux | Prix de vente: $3 | Taux de Risque: Faible </div>');
- div.append('<div id="dlc2" class="selectorButton whiteButton" onclick="UI.SellShares(this)" style="margin-left:50px;width: 675px">Nouveaux objets, équipement, etc... | Prix de vente: $5 | Taux de Risque: Moyen </div>');
- div.append('<div id="dlc3" class="selectorButton whiteButton" onclick="UI.SellShares(this)" style="margin-left:50px;width: 675px">Nouvelles maps, nouveaux niveaux | Prix de vente: $10 | Taux de Risque: Élevée </div>');
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement