Skip to content

Commit 6561a48

Browse files
committed
Prerelease
0 parents  commit 6561a48

File tree

162 files changed

+54288
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+54288
-0
lines changed

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Dance Contest+
2+
A mod to increase the functionality of Dance Contest

cleanup.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
$fileName = $_GET["file"];
3+
array_map('unlink', glob('./tmp/' . substr($fileName, 0, -4) . "/*.*"));
4+
rmdir('./tmp/' . substr($fileName, 0, -4));
5+
unlink('./tmp/' . $fileName);
6+
?>

com/clubpenguin/games/dancing/AnimationEngine.as

Lines changed: 914 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
class com.clubpenguin.games.dancing.DanceNetClient extends com.clubpenguin.games.generic.NetClient
2+
{
3+
var currentState, timeToNextSong, songName, gameEngine, AIRTOWER, netSendTimeMillis, keyPressIDs, sendPlayerActionMessage, songData, millisPerBar, roomID;
4+
function DanceNetClient()
5+
{
6+
super();
7+
currentState = com.clubpenguin.games.dancing.DanceNetClient.STATE_DISCONNECTED;
8+
timeToNextSong = 0;
9+
songName = "undefined";
10+
} // End of the function
11+
function init($gameEngine)
12+
{
13+
super.init();
14+
gameEngine = $gameEngine;
15+
AIRTOWER.addListener(com.clubpenguin.games.dancing.DanceNetClient.MESSAGE_FINISH_GAME, handleEndGameMessage, this);
16+
} // End of the function
17+
function destroy()
18+
{
19+
super.destroy();
20+
currentState = com.clubpenguin.games.dancing.DanceNetClient.STATE_DISCONNECTED;
21+
AIRTOWER.removeListener(com.clubpenguin.games.dancing.DanceNetClient.MESSAGE_FINISH_GAME, handleEndGameMessage, this);
22+
} // End of the function
23+
function updateKeyPresses($keyPresses)
24+
{
25+
var _loc8 = gameEngine.elapsedTimeMillis;
26+
if (_loc8 > netSendTimeMillis + com.clubpenguin.games.dancing.DanceNetClient.NET_SEND_INTERVAL)
27+
{
28+
netSendTimeMillis = netSendTimeMillis + com.clubpenguin.games.dancing.DanceNetClient.NET_SEND_INTERVAL;
29+
var _loc5 = new Array();
30+
var _loc4 = new Array();
31+
_loc4.push(gameEngine.currentScore);
32+
for (var _loc7 in keyPressIDs)
33+
{
34+
var _loc2 = $keyPresses[keyPressIDs[_loc7]];
35+
if (_loc2.noteDuration == 0 || _loc2.releaseTime != com.clubpenguin.games.dancing.Note.RESULT_NOT_PRESSED)
36+
{
37+
var _loc3 = _loc2.noteType + "," + _loc2.pressTime + "," + _loc2.releaseTime + "," + _loc2.getNotePressResult();
38+
_loc4.push(_loc3);
39+
continue;
40+
} // end if
41+
_loc5.push(keyPressIDs[_loc7]);
42+
} // end of for...in
43+
keyPressIDs = _loc5;
44+
this.sendPlayerActionMessage(_loc4);
45+
} // end if
46+
} // End of the function
47+
function handleGetGameMessage(resObj)
48+
{
49+
com.clubpenguin.games.generic.NetClient.debugTrace("(DanceNetClient) handleGetGameMessage called", com.clubpenguin.util.Reporting.DEBUGLEVEL_MESSAGE);
50+
com.clubpenguin.games.generic.NetClient.debugTrace("smartRoomID: " + resObj[0]);
51+
com.clubpenguin.games.generic.NetClient.debugTrace("estimatedTime: " + resObj[1]);
52+
com.clubpenguin.games.generic.NetClient.debugTrace("nextSong: " + com.clubpenguin.util.LocaleText.getText("menu_song_item_" + resObj[2]));
53+
com.clubpenguin.games.generic.NetClient.debugTrace("timeToNextSong: " + resObj[3]);
54+
timeToNextSong = parseInt(resObj[1]) + parseInt(resObj[3]);
55+
songName = com.clubpenguin.util.LocaleText.getText("menu_song_item_" + resObj[2]);
56+
currentState = com.clubpenguin.games.dancing.DanceNetClient.STATE_ATTEMPT_TO_JOIN;
57+
gameEngine.setSong(parseInt(resObj[3]));
58+
gameEngine.startTimer();
59+
gameEngine.loadMenu(com.clubpenguin.games.dancing.MenuSystem.MENU_MULTIPLAYER_PRE_QUEUE);
60+
} // End of the function
61+
function handleJoinGameMessage(resObj)
62+
{
63+
com.clubpenguin.games.generic.NetClient.debugTrace("(DanceNetClient) handleJoinGameMessage called", com.clubpenguin.util.Reporting.DEBUGLEVEL_MESSAGE);
64+
com.clubpenguin.games.generic.NetClient.debugTrace("smartRoomID: " + resObj[0]);
65+
com.clubpenguin.games.generic.NetClient.debugTrace("success: " + resObj[1]);
66+
com.clubpenguin.games.generic.NetClient.debugTrace("songName: " + com.clubpenguin.util.LocaleText.getText("menu_song_item_" + resObj[2]));
67+
com.clubpenguin.games.generic.NetClient.debugTrace("timeToNextSong: " + resObj[3]);
68+
var _loc3 = resObj[1] == "true";
69+
songName = com.clubpenguin.util.LocaleText.getText("menu_song_item_" + resObj[2]);
70+
timeToNextSong = parseInt(resObj[3]);
71+
if (_loc3)
72+
{
73+
currentState = com.clubpenguin.games.dancing.DanceNetClient.STATE_QUEUEING;
74+
gameEngine.setSong(parseInt(resObj[2]));
75+
gameEngine.startTimer();
76+
gameEngine.loadMenu(com.clubpenguin.games.dancing.MenuSystem.MENU_MULTIPLAYER_JOIN_GAME);
77+
}
78+
else
79+
{
80+
currentState = com.clubpenguin.games.dancing.DanceNetClient.STATE_DISCONNECTED;
81+
gameEngine.loadMenu(com.clubpenguin.games.dancing.MenuSystem.MENU_MULTIPLAYER_SERVERFULL);
82+
} // end else if
83+
} // End of the function
84+
function handleStartGameMessage(resObj)
85+
{
86+
com.clubpenguin.games.generic.NetClient.debugTrace("(DanceNetClient) handleStartGameMessage called", com.clubpenguin.util.Reporting.DEBUGLEVEL_MESSAGE);
87+
com.clubpenguin.games.generic.NetClient.debugTrace("smartRoomID: " + resObj[0]);
88+
com.clubpenguin.games.generic.NetClient.debugTrace("noteTimes: " + resObj[1]);
89+
com.clubpenguin.games.generic.NetClient.debugTrace("noteTypes: " + resObj[2]);
90+
com.clubpenguin.games.generic.NetClient.debugTrace("noteLengths: " + resObj[3]);
91+
com.clubpenguin.games.generic.NetClient.debugTrace("millisPerBar: " + resObj[4]);
92+
var _loc4 = resObj[1].split(",");
93+
var _loc2 = resObj[2].split(",");
94+
var _loc5 = resObj[3].split(",");
95+
songData = [[], [], []];
96+
for (var _loc6 in _loc2)
97+
{
98+
songData[0][_loc6] = parseInt(_loc2[_loc6]);
99+
songData[1][_loc6] = parseInt(_loc4[_loc6]);
100+
songData[2][_loc6] = parseInt(_loc5[_loc6]);
101+
} // end of for...in
102+
millisPerBar = parseInt(resObj[4]);
103+
netSendTimeMillis = 0;
104+
currentState = com.clubpenguin.games.dancing.DanceNetClient.STATE_IN_GAME;
105+
gameEngine.loadMenu(com.clubpenguin.games.dancing.MenuSystem.MENU_START_MULTIPLAYER_SONG);
106+
gameEngine.startSong();
107+
} // End of the function
108+
function handleEndGameMessage(resObj)
109+
{
110+
com.clubpenguin.games.generic.NetClient.debugTrace("(DanceNetClient) handleEndGameMessage called", com.clubpenguin.util.Reporting.DEBUGLEVEL_MESSAGE);
111+
this.handlePlayerActionMessage(resObj);
112+
gameEngine.loadMenu(com.clubpenguin.games.dancing.MenuSystem.MENU_START_MULTIPLAYER_SONG);
113+
gameEngine.endSong();
114+
} // End of the function
115+
function handleUpdateGameMessage(resObj)
116+
{
117+
com.clubpenguin.games.generic.NetClient.debugTrace("handleUpdateGameMessage - not implemented!", com.clubpenguin.util.Reporting.DEBUGLEVEL_WARNING);
118+
} // End of the function
119+
function handlePlayerActionMessage(resObj)
120+
{
121+
com.clubpenguin.games.generic.NetClient.debugTrace("(DanceNetClient) handlePlayerActionMessage called", com.clubpenguin.util.Reporting.DEBUGLEVEL_MESSAGE);
122+
com.clubpenguin.games.generic.NetClient.debugTrace("smartRoomID: " + resObj[0]);
123+
com.clubpenguin.games.generic.NetClient.debugTrace("playerScores: " + resObj[1]);
124+
var _loc4 = resObj[1].split(",");
125+
var _loc5 = new Array();
126+
for (var _loc6 in _loc4)
127+
{
128+
var _loc2 = _loc4[_loc6].split("|");
129+
com.clubpenguin.games.generic.NetClient.debugTrace("smartID[" + _loc6 + "]: " + _loc2[0]);
130+
com.clubpenguin.games.generic.NetClient.debugTrace("name[" + _loc6 + "]: " + _loc2[1]);
131+
com.clubpenguin.games.generic.NetClient.debugTrace("score[" + _loc6 + "]: " + _loc2[2]);
132+
com.clubpenguin.games.generic.NetClient.debugTrace("rating[" + _loc6 + "]: " + _loc2[3]);
133+
com.clubpenguin.games.generic.NetClient.debugTrace("noteStreak[" + _loc6 + "]: " + _loc2[4]);
134+
var _loc3 = new Object();
135+
_loc3.smartID = parseInt(_loc2[0]);
136+
_loc3.name = _loc2[1];
137+
_loc3.score = parseInt(_loc2[2]);
138+
_loc3.rating = parseInt(_loc2[3]);
139+
_loc3.streak = parseInt(_loc2[4]);
140+
if (_loc3.name != undefined && _loc3.name != "undefined")
141+
{
142+
_loc5.push(_loc3);
143+
} // end if
144+
} // end of for...in
145+
_loc5.sortOn("score", Array.DESCENDING | Array.NUMERIC);
146+
if (_loc5.length > 0)
147+
{
148+
gameEngine.updateMultiplayerScores(_loc5);
149+
} // end if
150+
} // End of the function
151+
function handleErrorMessage(resObj)
152+
{
153+
com.clubpenguin.games.generic.NetClient.debugTrace("(DanceNetClient) handleErrorMessage called", com.clubpenguin.util.Reporting.DEBUGLEVEL_MESSAGE);
154+
com.clubpenguin.games.generic.NetClient.debugTrace("smartRoomID: " + resObj[0]);
155+
com.clubpenguin.games.generic.NetClient.debugTrace("errorCode: " + resObj[1]);
156+
var _loc2 = parseInt(resObj[1]);
157+
if (_loc2 == com.clubpenguin.games.dancing.GameEngine.ERROR_CODE_ROOM_FULL)
158+
{
159+
gameEngine.loadMenu(com.clubpenguin.games.dancing.MenuSystem.ERROR_CODE_ROOM_FULL);
160+
}
161+
else if (_loc2 == com.clubpenguin.games.dancing.GameEngine.ERROR_CODE_MULTIPLE_CONNECTIONS)
162+
{
163+
gameEngine.loadMenu(com.clubpenguin.games.dancing.MenuSystem.ERROR_CODE_MULTIPLE_CONNECTIONS);
164+
} // end else if
165+
} // End of the function
166+
function handleCloseGameMessage(resObj)
167+
{
168+
com.clubpenguin.games.generic.NetClient.debugTrace("handleCloseGameMessage - not implemented!", com.clubpenguin.util.Reporting.DEBUGLEVEL_WARNING);
169+
} // End of the function
170+
function handleAbortGameMessage(resObj)
171+
{
172+
com.clubpenguin.games.generic.NetClient.debugTrace("handleAbortGameMessage - not implemented!", com.clubpenguin.util.Reporting.DEBUGLEVEL_WARNING);
173+
} // End of the function
174+
function sendDifficultyLevelMessage($difficulty)
175+
{
176+
com.clubpenguin.games.generic.NetClient.debugTrace("sendDifficultyLevelMessage - difficulty is " + $difficulty);
177+
AIRTOWER.send(com.clubpenguin.games.generic.NetClient.SERVER_SIDE_EXTENSION_NAME, com.clubpenguin.games.dancing.DanceNetClient.MESSAGE_CHANGE_DIFFICULTY, [$difficulty], com.clubpenguin.games.generic.NetClient.SERVER_SIDE_MESSAGE_TYPE, roomID);
178+
} // End of the function
179+
function sendGetGameAgainMessage()
180+
{
181+
com.clubpenguin.games.generic.NetClient.debugTrace("sendGetGameAgainMessage");
182+
AIRTOWER.send(com.clubpenguin.games.generic.NetClient.SERVER_SIDE_EXTENSION_NAME, com.clubpenguin.games.dancing.DanceNetClient.MESSAGE_GET_GAME_AGAIN, "", com.clubpenguin.games.generic.NetClient.SERVER_SIDE_MESSAGE_TYPE, roomID);
183+
} // End of the function
184+
static var MESSAGE_CHANGE_DIFFICULTY = "zd";
185+
static var MESSAGE_FINISH_GAME = "zf";
186+
static var MESSAGE_GET_GAME_AGAIN = "zr";
187+
static var NET_SEND_INTERVAL = 3000;
188+
static var STATE_DISCONNECTED = 0;
189+
static var STATE_ATTEMPT_TO_JOIN = 1;
190+
static var STATE_QUEUEING = 2;
191+
static var STATE_IN_GAME = 3;
192+
} // End of Class

0 commit comments

Comments
 (0)