· 5 years ago · Mar 30, 2020, 09:34 PM
1/*
2
3 .___ ___. __ __ ___
4 | \/ | | | | |/ /
5 | \ / | | | | ' /
6 | |\/| | | | | <
7 | | | | | | | . \
8 |__| |__| |__| |__|\__\
9
10 = Hourly Points
11 = GorthexTiger modified by Mikéias
12 = brAthena/eAthena
13 = O jogador ganha pontos enquanto online. A cada 1 minuto, se conta online adiciona +1 a variável #Check que ao chegar no valor 60
14 adiciona a quantidade de pontos definida nas configurações. O jogador só receberá o acréscimo na variável se estiver online, caso deslogue
15 a variável permanece com a mesma quantidade e ao retornar, continua até completar o valor 60.
16
17TABELA PARA O FUNCIONAMENTO DO SCRIPT --
18-- OBS.: A tabela é inserida automáticamente.
19
20CREATE TABLE IF NOT EXISTS `hourly_points` (
21`account_hourly` int( 11 ) unsigned NOT NULL auto_increment,
22`online` tinyint(2) NOT NULL default '0',
23`points` int(11) unsigned NOT NULL default '0',
24`minute` int(11) NOT NULL DEFAULT '0' ,
25PRIMARY KEY ( `account_hourly` )
26) ENGINE=MyISAM AUTO_INCREMENT=1;
27
28*/
29// ===================================================================
30
31- script hourlypoints -1,{
32
33 OnInit:
34 deletearray $@PROIBIR_MAP$;
35 initnpctimer;
36 // =========================================================================================
37 // = Informe o level dos jogadores VIP do seu servidor:
38 set $@LevelVIP, 1; // -> Level VIP.
39
40 // = Se seu servidor tiver jogadores VIP's, defina a quantidade de pontos que eles receberão:
41 set $@PointVIP, 2; // -> Jogadores VIP.
42
43 // = Defina a quantidade de pontos que os jogadores normais receberão:
44 set $@PointN, 1; // -> Jogadores Normais.
45
46 // = Sobre o Sistema de Comércio dos Mercadores:
47 set $@MerchantAT, 0; // -> Mercadores em @at/@autotrade entrarão na premiação? 0=Não / 1=Sim
48
49 // Sala de Chat (Alt+C)
50 set $@Chatting, 1; // -> Jogadores em chats receberam pontos? 0=Não / 1=Sim
51
52 // = Mostrar mensagem do recebimento dos pontos hourly? 0=Não / 1=Sim
53 set .Message, 0;
54
55 // = RESTRIÇÃO DO SISTEMA EM ALGUNS MAPAS
56 // - - - - - - - - - - - - - - - - - - - - - - - - - -
57 setarray $@PROIBIR_MAP$[0], ""; // DEFINA OS MAPAS EM QUE OS JOGADORES NÃO SERÃO PREMIADOS.
58 // - - - - - - - - - - - - - - - - - - - - - - - - - -
59
60 // --- Não mexa ---
61 // = Cria a tabela 'hourly_points' se não existir.
62 query_sql ("CREATE TABLE IF NOT EXISTS `hourly_points` ( `account_hourly` int( 11 ) unsigned NOT NULL,`online` tinyint(2) NOT NULL default '0',`points` int(11) unsigned NOT NULL default '0',`minute` int(11) NOT NULL DEFAULT '0', PRIMARY KEY ( `account_hourly` )) ENGINE=MyISAM;");
63 end;
64
65
66 // A CADA 1 MINUTO ELE FAZ A CHECAGEM
67 OnTimer60000: // 1 minuto
68 stopnpctimer;
69 query_sql ("SELECT `account_hourly` FROM `hourly_points` WHERE `online`='1'",.@HERE_ACCOUNT_HOURLYONLINE);
70
71 // ACCOUNT ONLINE - CHECK
72 for( set .@m,0; .@m <(getarraysize(.@HERE_ACCOUNT_HOURLYONLINE)); set .@m, .@m+1 ){
73 if (isloggedin(.@HERE_ACCOUNT_HOURLYONLINE[.@m])){
74 attachrid(.@HERE_ACCOUNT_HOURLYONLINE[.@m]);
75
76 // === Checagem de Chat e Loja ===============================
77
78 if( checkchatting() && !$@Chatting || checkvending() && !$@MerchantAT) { goto ReStart; end; }
79
80 // ===========================================================
81
82 // === Checagem de Mapas =====================================
83 for( set .@n,0; .@n < (getarraysize($@PROIBIR_MAP$)); set .@n, .@n+1 ){
84 getmapxy(.@mapa$,@x,@y,0);
85 if(.@mapa$ == $@PROIBIR_MAP$[.@n]){ goto ReStart; end; }
86 }
87
88 query_sql "UPDATE `hourly_points` SET `minute` = `minute` + '1' WHERE `account_hourly` = '"+getcharid(3)+"'";
89 set #Check, #Check+1;
90
91 if(#Check >= 60){
92 set #Check, 0;
93 query_sql "UPDATE `hourly_points` SET `points`=`points`+'"+(getgmlevel() >= $@LevelVIP ? $@PointVIP:$@PointN)+"' WHERE `account_hourly`='"+getcharid(3)+"'";
94 if ( .Message ){ message strcharinfo(0), "[Pontos p/H Adicionado]"; }
95 }
96
97 ReStart:
98 detachrid;
99 }
100 }
101 initnpctimer;
102}
103
104- script EventsOnPC -1,{
105
106 // -> Account Online.
107 OnPCLoginEvent:
108 query_sql "SELECT `account_hourly` FROM hourly_points WHERE `account_hourly`='"+getcharid(3)+"'",@HERE_CONFERE_ID_HOURLY;
109
110 // -> ACCOUNT_ID INEXISTENTE NA TABELA 'hourly_points'
111 if (!@HERE_CONFERE_ID_HOURLY)
112 {
113 query_sql "INSERT INTO `hourly_points` (`account_hourly`, `online`) VALUES ( '"+getcharid(3)+"' , '1')";
114 end;
115 }
116 query_sql "UPDATE `hourly_points` SET `online`='1' WHERE `account_hourly`='"+getcharid(3)+"'";
117 end;
118
119 // -> Account Offline.
120 OnPCLogoutEvent:
121 query_sql "UPDATE `hourly_points` SET `online`='0' WHERE `account_hourly`='"+getcharid(3)+"'";
122 end;
123}
124
125// --> OBS.: CUIDADO COM A HABILIDADE DESCONTO
126prontera,164,164,3 script [ Pontos por Hora ] 960,{
127
128 function showtimeonline { set .@r$, ( getarg(0) < 1? "" : "^db4b1e"+getarg(0)+"^000000 hora"+( getarg(0) > 1? "s" : "")+" e " )+"^db4b1e"+(getarg(1)%60)+"^000000 minuto"+(getarg(1)%60 < 2? "" : "s");
129 return .@r$;
130 }
131
132 function updatePoints {
133 query_sql "UPDATE hourly_points SET points = points-"+getarg(0)+" WHERE account_hourly = '"+getcharid(3)+"'";
134 }
135
136 query_sql "SELECT `points` FROM `hourly_points` WHERE `account_hourly` = '"+getcharid(3)+"'", @points;
137 query_sql "SELECT `minute` FROM `hourly_points` WHERE `account_hourly` = '"+getcharid(3)+"'", .@minuto;
138 query_sql "SELECT `minute`/60 FROM `hourly_points` WHERE `account_hourly` = '"+getcharid(3)+"'", .@hora;
139
140 mes "^1E90FF"+strnpcinfo(1)+"^000000";
141 mes "Olá, "+strcharinfo(0);
142 mes "Você ganha pontos enquanto se diverte em nosso servidor!";
143 mes " ";
144 mes "Pontos: ^db4b1e"+ @points + "^000000";
145 mes "Tempo online: "+showtimeonline(.@hora, .@minuto);
146 next;
147 switch(select("Trocar pontos","Cancelar")){
148
149 case 1:
150 if(BaseClass==Job_Merchant){dispbottom "Use outro Personagem!"; close; end;}
151 close2;
152 callshop "shop_hourly",1;
153 end;
154
155 case 2:
156 close;
157 }
158
159 OnInit:
160 npcshopattach "shop_hourly",1;
161 end;
162
163 // AO COMPRAR
164 OnBuyItem:
165 for (set .@i,0; .@i < getarraysize(@bought_nameid); set .@i,.@i+1) {
166 set @cost, callfunc("hourly_for",@bought_nameid[.@i]);
167 if ( @points < @cost*@bought_quantity[.@i]){ message strcharinfo(0),"Você não tem ["+@cost*@bought_quantity[.@i]+"] pontos."; end; }
168 mes "^1E90FF"+strnpcinfo(1)+"^000000";
169 mes "Você selecionou "+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid)+" com o valor de ^1E90FF["+@cost*@bought_quantity[.@i]+"]^000000 pontos. Efetuar compra?";
170 if (select ( "Não, obrigado.","Efetuar compra.") == 1 ){ close; }
171 updatePoints(@cost*@bought_quantity[.@i]);
172 getitem @bought_nameid[.@i],@bought_quantity[.@i];
173 message strcharinfo(0),"Compra efetuada com êxito.";
174 close;
175 }
176 deletearray @bought_nameid[0],getarraysize(@bought_nameid);
177 deletearray @bought_quantity[0],getarraysize(@bought_quantity);
178 close;
179 }
180
181
182function script hourly_for {
183 for(set .@i,0; .@i < getarraysize( $@hourlyitens); set .@i,.@i+1) {
184 if( $@hourlyitens[.@i] == getarg(0)) {
185 return $@hourlyprice[.@i];
186 }
187 }
188return;
189}
190
191
192- script hourly_shop -1,{
193
194OnInit:
195 deletearray $@hourlyitens;
196 deletearray $@hourlyprice;
197 // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
198
199 // ITENS
200 setarray $@hourlyitens[0],12210,12103,12214,12221,7619,7620,20082;
201
202 // PRICE
203 setarray $@hourlyprice[0],12,5,3,2,12,12,1;
204
205 npcshopdelitem "shop_hourly",512;
206 if(getarraysize( $@hourlyitens) >= 1) {
207 npcshopitem "shop_hourly", $@hourlyitens[0],$@hourlyprice[0];
208 for (set .@i,1; .@i < getarraysize( $@hourlyitens); set .@i,.@i+1) {
209 npcshopadditem "shop_hourly", $@hourlyitens[.@i],$@hourlyprice[.@i];
210 }
211 }
212 end;
213}
214
215- shop shop_hourly -1,512:-1 // Não altere