View difference between Paste ID: x7NF3m8v and BaTzyApv
SHOW: | | - or go back to the newest paste.
1
--------------------------------
2
--[[ HardSham' room. ]]--
3-
--[[ Version 1.9 Beta. ]]--
3+
--[[ Version 1.9.1 Beta. ]]--
4
--[[ Developped by TheLeetCoder. ]]--
5
--------------------------------
6
7
--// by TheLeetCoder \\--
8
mapXML1 = '<C><P F="1" /><Z><S><S L="200" H="50" X="100" Y="380" T="6" P="1,-1,0.3,0.2,0,0,0,0" /><S L="200" X="400" H="50" Y="250" T="6" P="1,-1,0.3,0.2,0,0,0,0" /><S L="200" H="50" X="700" Y="100" T="6" P="1,-1,0.3,0.2,0,0,0,0" /></S><D><P P="0,0" Y="356" T="1" X="173" /><P P="0,0" Y="360" T="5" X="168" /><P P="0,0" Y="244" T="5" X="311" /><P P="0,0" Y="240" T="5" X="485" /><P P="0,0" Y="239" T="5" X="437" /><P P="0,0" Y="227" T="4" X="460" /><P P="0,0" Y="225" T="3" X="338" /><P P="0,0" Y="76" T="0" X="761" /><P P="0,0" Y="91" T="5" X="611" /><P P="0,0" Y="74" T="11" X="731" /><P P="0,0" Y="356" T="12" X="38" /><P P="0,0" Y="356" T="4" X="40" /><DS Y="341" X="98" /><DC Y="59" X="692" /><T Y="356" X="99" /><F Y="73" X="705" /></D><O /></Z></C>'
9
mapXML2 = '<C><P F="2" /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" L="440" X="218" c="2" Y="93" T="8" H="150" /><S L="160" X="80" H="53" Y="379" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="290" X="305" H="30" Y="369" T="9" P="0,0,,,,0,0,0" /><S L="190" H="53" X="545" Y="381" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="160" X="720" H="53" Y="196" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="160" H="53" X="357" Y="97" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="24" X="289" H="47" Y="47" T="1" P="0,0,0,0.2,0,0,0,0" /><S L="160" X="720" H="206" Y="325" T="8" P="0,0,0.3,0.2,0,0,0,0" /></S><D><F Y="348" X="82" /><DS Y="353" X="82" /><P X="143" Y="369" T="5" P="0,0" /><P X="11" Y="374" T="5" P="0,0" /><P X="139" Y="353" T="4" P="0,0" /><P X="26" Y="354" T="1" P="0,0" /><P X="477" Y="355" T="4" P="0,0" /><P X="482" Y="356" T="0" P="1,0" /><T Y="71" D="" X="349" /><P X="652" Y="184" T="5" P="0,0" /><P X="782" Y="183" T="5" P="0,0" /><P X="683" Y="177" T="5" P="0,0" /><P X="744" Y="173" T="0" P="0,0" /><P X="743" Y="170" T="1" P="0,0" /><P X="508" Y="354" T="3" P="0,0" /><P X="711" Y="172" T="11" P="0,0" /><P X="606" Y="354" T="12" P="0,0" /><P C="57703e,e7c3d6" Y="377" T="18" X="611" P="0,0" /></D><O /></Z></C>'
10
mapXML4 = '<C><P F="1" /><Z><S><S L="40" H="200" X="780" Y="290" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="40" X="20" H="200" Y="290" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S c="3" L="150" H="25" X="590" Y="339" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S c="1" L="320" H="99" X="640" Y="400" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="240" X="120" c="1" Y="400" T="6" H="99" /></S><D><P P="0,0" Y="351" T="1" X="712" /><P P="0,0" Y="349" T="3" X="727" /><T Y="351" X="128" /><F Y="323" D="" X="590" /><DS Y="336" X="97" /><P P="0,0" Y="351" T="12" X="194" /><P P="1,0" Y="351" T="0" X="510" /><P P="0,1" Y="190" T="6" X="20" /><DC Y="90" X="49" /></D><O /></Z></C>'
11
12
--// by Toonney \\--
13
mapXML3 = '<C><P F="1" /><Z><S><S L="160" X="80" H="35" Y="382" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="160" H="35" X="240" v="20000" Y="347" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="160" H="35" X="400" Y="382" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="160" X="560" H="35" v="20000" Y="347" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="160" X="720" H="35" Y="382" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="53" o="ffffffffff" X="26" Y="84" T="12" H="58" /><S L="53" o="ffffffffff" X="776" H="58" Y="85" T="12" P="0,0,0.3,0.2,0,0,0,0" /></S><D><T Y="400" X="185" /><F Y="396" X="617" /><T Y="95" X="20" /><F Y="95" X="780" /><DS Y="361" X="399" /><DC Y="364" X="400" /><P P="1,0" Y="367" T="0" X="351" /><P P="0,0" Y="362" T="5" X="496" /><P P="0,0" Y="386" T="5" X="653" /><P P="0,0" Y="381" T="5" X="783" /><P P="0,0" Y="364" T="1" X="718" /><P P="0,0" Y="367" T="0" X="717" /><P P="0,0" Y="366" T="4" X="460" /><P P="0,0" Y="391" T="5" X="145" /><P P="0,0" Y="379" T="5" X="14" /><P P="0,0" Y="376" T="5" X="42" /><P P="0,0" Y="365" T="11" X="58" /><P P="0,0" Y="363" T="3" X="453" /><P P="0,0" Y="366" T="1" X="99" /><P P="1,0" Y="367" T="12" X="133" /><P P="0,0" Y="407" T="13" X="615" /><P P="0,0" Y="411" T="13" X="180" /><P X="226" Y="412" T="13" P="0,0" /><P P="0,0" Y="411" T="13" X="273" /><P X="316" Y="412" T="13" P="0,0" /><P X="501" Y="412" T="13" P="0,0" /><P P="0,0" Y="411" T="13" X="548" /><P X="586" Y="411" T="13" P="0,0" /><P P="0,0" Y="367" T="83" X="400" /></D><O /></Z></C>'
14
15
maps =     { mapXML1, mapXML2, mapXML3, mapXML4 }
16
17
difficultLevel = {}
18
itemUsages = {}
19
20
currentSham = ""
21
currentMap = ""
22
lastSham = ""
23
maxSummon = 5
24
25
roundNumber = 0
26
freeRound = false
27
28
tfm.exec.newGame(maps[math.random(#maps)])
29
tfm.exec.disableAllShamanSkills(true)
30
tfm.exec.disableAutoNewGame(true)
31
32
for playerName in pairs(tfm.get.room.playerList) do
33
    difficultLevel[playerName] = 0
34
    itemUsages[playerName] = 0
35
    ui.addTextArea(100, "<p align='center'>« Bienvenue dans le salon #hardcham. »<br>Tapez !diff [level] afin de régler la difficulté.</p>", playerName, 250, 21, 300)
36
37
    if tfm.get.room.playerList[playerName].isShaman then
38
        currentSham = playerName
39
    end
40
end
41
42
function eventNewPlayer(playerName) -- Nouveau joueur entre.
43
    ui.addTextArea(100, "<p align='center'>« Bienvenue dans le salon #hardcham. »<br>Tapez !diff [level] afin de régler la difficulté.</p>", playerName, 250, 21, 300)
44
end
45
46
function eventNewGame() -- Démarrage d'une nouvelle partie.
47
    if roundNumber == 5 then
48
			ui.removeTextArea(100, nil)
49
        ui.addTextArea(115, "Le chamane à le droit à une partie sans limites !", nil, 250, 21, 320)
50
		freeRound = true
51
		roundNumber = 0
52
    elseif roundNumber ~= 5 then
53
		roundNumber = roundNumber + 1
54
		freeRound = false
55
        for playerName in pairs(tfm.get.room.playerList) do
56
            ui.addTextArea(100, "<p align='center'>Une nouvelle partie va commencer.<br>Tapez !diff [level] afin de régler la difficulté.</p>", playerName, 250, 21, 300)
57
            itemUsages[playerName] = 0
58
            lastSham = currentSham
59
            ui.removeTextArea(103, playerName)
60
            ui.removeTextArea(104, playerName)
61
            ui.removeTextArea(115, playerName)
62
    
63
            if tfm.get.room.playerList[playerName].isShaman then
64
                currentSham = playerName
65
                if difficultLevel[currentSham] > 3 then
66
                    itemUsages[currentSham] = (maxSummon - 1)
67
                elseif difficultLevel[currentSham] > 6 then
68
                    itemUsages[currentSham] = (maxSummon - 2)
69
                elseif difficultLevel[currentSham] > 9 then
70
                    itemUsages[currentSham] = (maxSummon - 3)
71
                end
72
            end
73
        end
74
    end
75
    ui.removeTextArea(102, lastSham)
76
end
77
78
function eventLoop(timer, remaining)
79
    if freeRound == true then
80
        ui.addTextArea(101, "FEEL FREE *-* !!!", playerName, 5, 21, 150)
81
	else
82
		ui.addTextArea(101, "Invocations restantes: "..(maxSummon - itemUsages[currentSham]), playerName, 5, 21, 150)
83
	end
84
	
85
	if remaining<=0 then
86
		nextMap = maps[math.random(#maps)]
87
		if nextMap ~= currentMap then
88
			tfm.exec.newGame(nextMap)
89
			currentMap = nextMap
90
		else
91
			nextMap = maps[math.random(#maps)]
92
			tfm.exec.newGame(nextMap)
93
			currentMap = nextMap
94
		end
95
	end
96
end
97
98
function eventChatCommand(playerName, command) -- Commandes.
99
    if command:sub(0, 4) == "diff" then
100
        if tonumber(command:sub(6)) < 0 or tonumber(command:sub(6)) > 10 then
101
            ui.addTextArea(104, "<p align='center'>« Format invalide. Format : !diff [level] (entre 0 et 10). »</p>", playerName, 250, 21, 300)
102
        else
103
            difficultLevel[playerName] = tonumber(command:sub(6))
104
        end
105
	elseif command == "mort" or command == "kill" or command == "die" then
106
		tfm.exec.killPlayer(playerName)
107
    end
108
end
109
110
function eventSummoningEnd(playerName, type, x, y, angle, xspeed, yspeed, object)
111
    if freeRound == true then
112
        ui.addTextArea(101, "FEEL FREE *-* !!!", playerName, 5, 21, 150)
113
    else
114
        if maxSummon - itemUsages[playerName] == 0 then
115
            for playerName in pairs(tfm.get.room.playerList) do
116
                if tfm.get.room.playerList[playerName].isShaman then
117
                    ui.removeTextArea(100, playerName)
118
                    ui.addTextArea(102, "<p align='center'>« Vous-avez utilisé tout vos objets. Dommage. »</p>", playerName, 250, 21, 300)
119
                else
120
                    ui.removeTextArea(100, nil)
121
                    ui.addTextArea(103, "<p align='center'>« Votre chamane a utilisé tout ses objets. Il ne peut plus invoquer. »</p>", nil, 250, 21, 350)
122
                end
123
            end
124
            tfm.exec.removeObject(object.id)
125
        elseif object.id == 0 then
126
            -- Nothing.
127
        else
128
            itemUsages[playerName] = itemUsages[playerName] + 1
129
        end
130
    end
131
end
132
133
function eventPlayerWon(playerName)
134
	if tfm.get.room.playerList[playerName].isShaman then
135
		nextMap = maps[math.random(#maps)]
136
		if nextMap ~= currentMap then
137
			tfm.exec.newGame(nextMap)
138
			currentMap = nextMap
139
		else
140
			nextMap = maps[math.random(#maps)]
141
			tfm.exec.newGame(nextMap)
142
			currentMap = nextMap
143
		end
144
	end
145
end
146
147
function eventPlayerDied()
148
	local i=0
149
	for n,player in pairs(tfm.get.room.playerList) do
150
		if not player.isDead then
151
			i=i+1
152
		end
153
	end
154
	if i==0 then
155
		tfm.exec.newGame(maps[math.random(#maps)])
156
	end
157
end