Browse Source

playtime rank offer changed

mloeschenkohl 3 năm trước cách đây
mục cha
commit
c2ceb34bf8
2 tập tin đã thay đổi với 34 bổ sung18 xóa
  1. 11 0
      survival/survival.txt
  2. 23 18
      system/chat.txt

+ 11 - 0
survival/survival.txt

@@ -93,6 +93,7 @@ sound_stray_cat = sound.get("entity.cat.stray_ambient");
 sound_purreow = sound.get("entity.cat.purreow");
 sound_drink_milk = sound.get("entity.wandering_trader.drink_milk");
 sound_slime_place = sound.get("block.slime_block.place");
+sound_eating = sound.get("entity.generic.eat");
 
 gambler_inv = inv.new("020202020");
 gambler_inv_id = inv.getId(gambler_inv);
@@ -375,6 +376,16 @@ if(entity.getType(entity) == "human") {
 		}
 		goto("wait");
 	}
+	if(entity_name == "Moderator\n§9Mareeeen") {
+		rand_number = math.roundup(math.random(0,5));
+		if(rand_number > 1){
+			msg.prefix(player, "§9Mareeeen", "Wo ist die Schokolade versteckt!?");
+		}else{
+			msg.prefix(player, "§9Mareeeen", "Ich esse deine Schokolade!");
+			sound.spawnForPlayer(player, $sound_eating, $sound_category_master, 1, 1);
+		}
+		goto("wait");
+	}
 	
 	if(entity_name == "Info-Point") {
 		msg(player, getSpacer());

+ 23 - 18
system/chat.txt

@@ -27,6 +27,7 @@ colorcodedeath = "§9";
 death_prefix = "§0§lx §r";
 headlist = list.new();
 headlist2 = list.new();
+rank_playtime_list = list.new();
 
 defaultdeaths = list.new();
 list.add(defaultdeaths, concat(colorcodedeath, " bled out."));
@@ -74,12 +75,13 @@ map.add(causetolist, "lava", firedeaths);
 map.add(causetolist, "flyIntoWall", flydeaths);
 map.add(causetolist, "player", list.new());
 
-setScriptVar("rank_playtime_list", list.new());
 online_list = players.toList();
 iter = list.iterator(online_list);
 while(hasNext(iter)) {
 	rank.offerTimeScheduled(next(iter));
 }
+
+sgoto(1200, "minute_loop");
 	
 msg("dev", "§bChat §rloaded");
 @wait
@@ -264,7 +266,7 @@ goto("wait");
 
 function rank.removeTimeOffert(player) {
 	player_uuid = player.getUuid(player);
-	list = getScriptVar("rank_playtime_list");
+	list = $rank_playtime_list;
 	for(i = 0; i < list.getSize(list); i++) {
 		a = list.getIndex(list, i);
 		if(player_uuid == a[0]) {
@@ -275,8 +277,7 @@ function rank.removeTimeOffert(player) {
 }
 
 function rank.offerTimeScheduled(player) {
-	list = getScriptVar("rank_playtime_list");
-	a = array.new(2);
+	a = array.new(3);
 	a[0] = player.getUuid(player);
 	playtime = playtime.getPlayerTotal(player);
 	if(playtime < 1200) {
@@ -294,21 +295,25 @@ function rank.offerTimeScheduled(player) {
 	if(diff > 1440) {
 		return;
 	}
-	list.add(list, a);
-	sgoto(diff * 60 * 20, "offerTimeRank");
+	a[2] = time.getMillis() * diff * 60 * 1000;
+	list.add($rank_playtime_list, a);
 }
 
-@offerTimeRank
-list = getScriptVar("rank_playtime_list");
-if(list.getSize(list) == 0) {
-	goto("wait");
-}
-a = list.getIndex(list, 0);
-list.removeIndex(list, 0);
-player_uuid = a[0];
-tech_name = a[1];
-player = player.get(player_uuid);
-if(player != null) {
-	offerRank(player, tech_name);
+@minute_loop
+now_time = time.getMillis();
+iter = list.iterator($rank_playtime_list);
+while(hasNext(iter)) {
+	a = next(iter);
+	player_uuid = a[0];
+	tech_name = a[1];
+	time = a[2];
+	if(time < now_time) {
+		player = player.get(player_uuid);
+		if(player != null) {
+			offerRank(player, tech_name);
+		}
+		remove(iter);
+	}
 }
+sgoto(1200, "minute_loop");
 goto("wait");