WoWEmu Developpement

Createur Xeon
 
AccueilAccueil  FAQFAQ  RechercherRechercher  S'enregistrerS'enregistrer  MembresMembres  GroupesGroupes  Connexion  

Partagez | 
 

 [Addon Serveur]Lotterie

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Xeon
Admin CR


Nombre de messages : 17
Date d'inscription : 13/05/2006

MessageSujet: [Addon Serveur]Lotterie   Sam 13 Mai à 10:08

Commencez par créer un dossier lotterie a la racine de votre serveur.

Ouvrez le fichier startup.tcl dedans cherchez
Citation:


proc OnPlayerDeath { player killer } {


endessous rajouter ceci :
Citation:


[lotsystem::winnumber $player]


Ouvrez le fichier creatures.scp
dedans copier ceci :
Citation:


[creature 900101]
attack=2000 2000
name=Homme de Lotterie
model=7311
faction=12
guild=National Lottery
type=7
family=7
questscript=lotterynpc
npcflags=07
faction=12
elite=3
level=60
maxhealth=10370
damage=1037 1659
maxmana=0
sell=30033


Maintenant ouvrer le fichiers items.scp
dedans copier ceci :
Citation:


[item 30033]
name=Tickets de Lotterie
buyprice=10000
startquest=123002
questscript=lottery
stackable=1
class=12
classes=07FFF
flags=0800
material=-1
maxcount=1
model=31744
quality=1
races=01FF
sellprice=0
subclass=0


Pour finis avec les fichiers .scp ouvrer le fichier quest.scp
dedans copier ceci :
Citation:


[quest 123002]
name=Lottery Tickets
objectives=Activate to get your lottery number.
desc=Ready to test your luck?
deliver=30033 1
src_item=30033


Ensuite Créer un fichier lotsysteme.tcl
dedans copier ceci :
Citation:


namespace eval lotsystem {


proc lotterynum { player } {

set pname [GetName $player]
set n1_list "1 2 3 4 5 6 7 8 9 0"
set n2_list "1 2 3 4 5 6 7 8 9 0"
set n3_list "1 2 3 4 5 6 7 8 9 0"
set num1 [lindex $n1_list [expr {int(rand()*[llength $n1_list])}]]
set num2 [lindex $n2_list [expr {int(rand()*[llength $n2_list])}]]
set num3 [lindex $n3_list [expr {int(rand()*[llength $n3_list])}]]
set number "$num1$num2$num3"
set file "lottery/$number"
if { [file exists "lottery/$number"] != 1} {
set id [open $file a+]
puts $id "$pname"
close $id
return "Your number is $number"
}
set id [open $file a+]
puts $id "$pname"
close $id
return "Your number is $number"

}
# You should change the hours and day to check if is time to run lotto and to delete the folder
proc winnumber { player } {

set hourtime [clock format [clock seconds] -format {%H}]
set daytime [clock format [clock seconds] -format {%u}]
set checkfile "lottery/checkfile"
if { [file exists "lottery/checkfile"] != 1 } {
if { ($hourtime == 16) && ($daytime == 1) } {
set n1_list "1 2 3 4 5 6 7 8 9 0"
set n2_list "1 2 3 4 5 6 7 8 9 0"
set n3_list "1 2 3 4 5 6 7 8 9 0"
set num1 [lindex $n1_list [expr {int(rand()*[llength $n1_list])}]]
set num2 [lindex $n2_list [expr {int(rand()*[llength $n2_list])}]]
set num3 [lindex $n3_list [expr {int(rand()*[llength $n3_list])}]]
set number "$num1$num2$num3"
set file "lottery/winnernumber"
if { [file exists "lottery/winnernumber"] != 1 } {
set id [open $file w+]
puts $id "$number"
close $id
set cf [open $checkfile w+]
puts $cf ""
close $cf

}
set id [open $file w+]
puts $id "$number"
close $id
set cf [open $checkfile w+]
puts $cf ""
close $cf

}
}
if { ($daytime == 7) && ($hourtime == 23) } {
file delete -force "lottery"
file mkdir "lottery"

}
return
}

proc readwinner { player } {
set pname [GetName $player]
set yes "lottery/$pname"
set thewinneris "winnernumber"
set file "lottery/$thewinneris"
if { [file exists "lottery/$thewinneris"] != 1 } { return "The Lottery
have not taken place yet" }
set id [open $file r]
gets $id data
close $id
set secondfile "lottery/$data"
if { [file exists "lottery/$data"] != 1 } { return "There are no winners." }
set secondid [open $secondfile r]
gets $secondid seconddata
close $secondid
set lines [split $seconddata \n]
set youwin [lsearch $seconddata $pname]
if { $youwin != -1 } {
if { [file exists "lottery/$pname"] != 1 } {
#Here you put the reward, use Item id.
AddItem $player 7
set cut [open $yes w+]
puts $cut "1"
close $cut
Say $player 0 "I have won!!"
}
}
return "The winner number is $data and winners are:$lines"
}
}


Créer un fichier lottery.tcl
dedans copier ceci :
Citation:

namespace eval lottery {
proc QueryQuest { obj player questid } {
if { [GetQuestStatus $player $questid] != 4 } {
SendQuestReward $player $obj $questid "Best Regards!" "Do you really want make a bet?"
SendGossipComplete $player
#SendQuestRequestItems $player $obj $questid "" "Activate your bet."
} else {
SendQuestDetails $player $obj $questid
}
}

proc QuestAccept { obj player questid } {
SendQuestReward $player $obj $questid "Best Regards!" "Do you really want make a bet?"
SendGossipComplete $player
}

proc RequestReward { npc player questid } {
}
proc QuestChooseReward { obj player questid choose } {
lotsystem::lotterynum $player
}

proc OnOpen { obj player lootid } {
}
}


Et pour finir créer un fichiers lotterynpc.tcl
dedans copier ceci :
Citation:

namespace eval lotterynpc {

}
#--------------------------------------------------------
proc lotterynpc::GossipHello { npc player } {

SendGossip $player $npc { text 0 "I want to buy a Lottery Ticket" }\
{ text 0 "Did I won?" }\
{ text 1 "Give me some info" }




}

#--------------------------------------------------------
# the lotsystem::winnumber $player is not very good here, so its better to put it in startup tcl in for example on playerdeath proc.
proc lotterynpc::GossipSelect { npc player option } {
switch $option {
0 { VendorList $player $npc }
1 { SendGossipComplete $player
lotsystem::winnumber $player
set win [lotsystem::readwinner $player ]
set resp "$win"
set news "text 0 \"$resp \n\n\n\""
set footer "text 2 \"Visit http://orangevirus.de for more
Informations\""
SendGossip $player $npc $news \
$footer }
2 { SendGossip $player $npc { text 0 "You need to buy a Lottery Ticket (I sell them),
and
activate it, then, when the lottery take place, the winning number will be announced and
posted here, If you are a winner you will automatically recieve the prize. Day
Lottery: Sunday 16:00 Good luck!!"} }
}

}
#--------------------------------------------------------
proc lotterynpc::QueryQuest { npc player questid } {

}

#--------------------------------------------------------
proc lotterynpc::QuestStatus { npc player } {

}
#--------------------------------------------------------
proc lotterynpc::QuestHello { npc player } {

}
#--------------------------------------------------------
proc lotterynpc::QuestSelect { npc player questid } {

}

#--------------------------------------------------------
proc lotterynpc::QuestAccept { npc player questid } {

}

#--------------------------------------------------------
proc lotterynpc::QuestChooseReward { npc player questid choose } {


}
#--------------------------------------------------------
proc lotterynpc::RequestReward { npc player questid } {

}



Et voila le systeme de loterie est finis

_________________
Admin Du forum
Revenir en haut Aller en bas
Voir le profil de l'utilisateur
 
[Addon Serveur]Lotterie
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» WOW Census
» [Pseudo:Nohlo][Serveur:Crocoburio][Element:Eau][LVL:60]
» Panda eau/feu sur futur serveur
» Serveur Ventrilo
» [Event PvP Serveur] Retour a Hautebrande.

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
WoWEmu Developpement :: Scripts :: Addons Clients et Serveur-
Sauter vers: