From 8b996e9a790e180af79a11ca17408e8d379d3e39 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 13 May 2012 00:35:34 +0000
Subject: [PATCH] Right-click on beneficial buffs allows you to remove them
 (like removing a weak regen to cat a better one) Object tier is written in
 objects tooltips

git-svn-id: http://svn.net-core.org/repos/t-engine4@5124 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/engines/default/engine/PlayerProfile.lua |  3 +-
 .../engine/interface/PlayerDumpJSON.lua       |  1 +
 game/modules/tome/class/Game.lua              | 19 +++++++++++--
 game/modules/tome/class/Object.lua            |  4 ++-
 game/modules/tome/class/uiset/Minimalist.lua  | 14 ++++++++--
 .../data/general/objects/world-artifacts.lua  | 28 +++++++++++++++++++
 ideas/lost-land-poosh.lua                     |  4 +--
 ideas/todo                                    |  3 +-
 8 files changed, 65 insertions(+), 11 deletions(-)

diff --git a/game/engines/default/engine/PlayerProfile.lua b/game/engines/default/engine/PlayerProfile.lua
index b0a811f343..555bf074ae 100644
--- a/game/engines/default/engine/PlayerProfile.lua
+++ b/game/engines/default/engine/PlayerProfile.lua
@@ -457,7 +457,8 @@ function _M:eventPushCode(e)
 	if not f then
 --		core.profile.pushOrder("o='GetNews'")
 	else
-		pcall(f)
+		local ok, err = pcall(f)
+		if config.settings.cheat then print(ok, err) end
 	end
 end
 
diff --git a/game/engines/default/engine/interface/PlayerDumpJSON.lua b/game/engines/default/engine/interface/PlayerDumpJSON.lua
index 712b84dfd8..54576c01c6 100644
--- a/game/engines/default/engine/interface/PlayerDumpJSON.lua
+++ b/game/engines/default/engine/interface/PlayerDumpJSON.lua
@@ -36,6 +36,7 @@ end
 
 --- Call this when a character is saved to upload data to te4.org
 function _M:saveUUID(do_charball)
+	if game:isTainted() then return end
 	if not self.__te4_uuid then
 		-- Try to grab an UUID even after char reg
 		if self.allow_late_uuid and not game:isTainted() then self:getUUID() end
diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua
index af61c96b81..5282599487 100644
--- a/game/modules/tome/class/Game.lua
+++ b/game/modules/tome/class/Game.lua
@@ -1115,9 +1115,22 @@ function _M:setupCommands()
 			end end
 		end end,
 		[{"_g","ctrl"}] = function() if config.settings.cheat then
---			for id, _ in pairs(game.party.__ingredients_def) do game.party:collectIngredient(id, rng.range(1, 3)) end
-			local m = game.zone:makeEntity(game.level, "actor", {random_elite=true}, nil, true)
-			game.zone:addEntity(game.level, m, "actor", game.player.x,game.player.y-1)
+			savefile_pipe:ignoreSaveToken(true)
+			local ep = savefile_pipe:doLoad("reaver", "entity", "engine.CharacterBallSave", "reaver")
+			savefile_pipe:ignoreSaveToken(false)
+			for a, _ in pairs(ep.members) do
+				if a.__CLASSNAME == "mod.class.Player" then
+					mod.class.NPC.castAs(a)
+					engine.interface.ActorAI.init(a, a)
+					a.ai = "tactical"
+					a.ai_state = {talent_in=1}
+					a.no_drops = true
+					a.energy.value = 0
+					a.player = nil
+					a.faction = "enemies"
+					game.zone:addEntity(game.level, a, "actor", game.player.x, game.player.y-1)
+				end
+			end
 		end end,
 		[{"_f","ctrl"}] = function() if config.settings.cheat then
 			self.player.quests["love-melinda"] = nil
diff --git a/game/modules/tome/class/Object.lua b/game/modules/tome/class/Object.lua
index 586e977e56..df1932a8a3 100644
--- a/game/modules/tome/class/Object.lua
+++ b/game/modules/tome/class/Object.lua
@@ -292,7 +292,9 @@ function _M:getTextualDesc(compare_with)
 
 	if self.quest then desc:add({"color", "VIOLET"},"[Plot Item]", {"color", "LAST"}, true) end
 
-	desc:add(("Type: %s / %s"):format(rawget(self, 'type') or "unknown", rawget(self, 'subtype') or "unknown"), true)
+	desc:add(("Type: %s / %s"):format(rawget(self, 'type') or "unknown", rawget(self, 'subtype') or "unknown"))
+	if self.material_level then desc:add(" ; tier ", tostring(self.material_level)) end
+	desc:add(true)
 	if self.slot_forbid == "OFFHAND" then desc:add("It must be held with both hands.", true) end
 	desc:add(true)
 
diff --git a/game/modules/tome/class/uiset/Minimalist.lua b/game/modules/tome/class/uiset/Minimalist.lua
index 72a8030fef..2e7ec9d874 100644
--- a/game/modules/tome/class/uiset/Minimalist.lua
+++ b/game/modules/tome/class/uiset/Minimalist.lua
@@ -1065,7 +1065,7 @@ function _M:buffOrientStep(orient, bx, by, scale, x, y, w, h)
 	return x, y
 end
 
-function _M:handleEffect(player, eff_id, e, p, x, y, hs, bx, by, is_first, scale)
+function _M:handleEffect(player, eff_id, e, p, x, y, hs, bx, by, is_first, scale, allow_remove)
 	local dur = p.dur + 1
 
 	if not self.tbuff[eff_id..":"..dur] then
@@ -1078,6 +1078,7 @@ function _M:handleEffect(player, eff_id, e, p, x, y, hs, bx, by, is_first, scale
 		else
 			desc = ("#{bold}##GOLD#%s\n(%s: %s)#WHITE##{normal}#\n"):format(name, e.type, eff_subtype)..e.long_desc(player, p)
 		end
+		if allow_remove then desc = desc.."\n---\nRight click to cancel early." end
 
 		local txt = nil
 		if e.decrease > 0 then
@@ -1095,6 +1096,13 @@ function _M:handleEffect(player, eff_id, e, p, x, y, hs, bx, by, is_first, scale
 				-- Move handle
 				if not self.locked and bx >= self.mhandle_pos.buffs.x and bx <= self.mhandle_pos.buffs.x + move_handle[6] and by >= self.mhandle_pos.buffs.y and by <= self.mhandle_pos.buffs.y + move_handle[7] then self:uiMoveResize("buffs", button, mx, my, xrel, yrel, bx, by, event) end
 			end
+			if allow_remove and event == "button" and button == "right" then
+				Dialog:yesnoPopup(name, "Really cancel "..name.."?", function(ret)
+					if ret then
+						player:removeEffect(eff_id)
+					end
+				end)
+			end
 			game.tooltip_x, game.tooltip_y = 1, 1; game:tooltipDisplayAtMap(game.w, game.h, desc)
 		end
 
@@ -1176,13 +1184,13 @@ function _M:displayBuffs(scale, bx, by)
 
 		for eff_id, p in pairs(good_e) do
 			local e = player.tempeffect_def[eff_id]
-			self:handleEffect(player, eff_id, e, p, x, y, hs, bx, by, is_first, scale)
+			self:handleEffect(player, eff_id, e, p, x, y, hs, bx, by, is_first, scale, true)
 			is_first = false
 			x, y = self:buffOrientStep(orient, bx, by, scale, x, y, hs, hs)
 		end
 		for eff_id, p in pairs(bad_e) do
 			local e = player.tempeffect_def[eff_id]
-			self:handleEffect(player, eff_id, e, p, x, y, hs, bx, by, is_first, scale)
+			self:handleEffect(player, eff_id, e, p, x, y, hs, bx, by, is_first, scale, false)
 			is_first = false
 			x, y = self:buffOrientStep(orient, bx, by, scale, x, y, hs, hs)
 		end
diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua
index b209db671f..446261e349 100644
--- a/game/modules/tome/data/general/objects/world-artifacts.lua
+++ b/game/modules/tome/data/general/objects/world-artifacts.lua
@@ -1767,6 +1767,34 @@ newEntity{ base = "BASE_LEATHER_BELT",
 	},
 }
 
+newEntity{ base = "BASE_LEATHER_BELT",
+	power_source = {arcane=true},
+	unique = true,
+	name = "Nienna's Memory", image = "object/artifact/belt_girdle_of_preservation.png",
+	unided_name = "crackling belt",
+	desc = [[Ages ago this belt was worn by Linaniil herself in her youth, using its power she shielded herself from the Spellblaze rain of fire, but naught could she do for your sister Nienna.]],
+	color = colors.GOLD,
+	level_range = {20, 30},
+	rarity = 200,
+	cost = 450,
+	material_level = 3,
+	wielder = {
+		inc_stats = { [Stats.STAT_CUN] = 2, [Stats.STAT_WIL] = 5, },
+		confusion_immune = 0.3,
+		stun_immune = 0.3,
+		mana_on_crit = 3,
+	},
+	max_power = 20, power_regen = 1,
+	use_power = { name = "generate a personnal shield", power = 20,
+		use = function(self, who)
+			who:setEffect(who.EFF_DAMAGE_SHIELD, 10, {power=100 + self:getMag(250)})
+			game:playSoundNear(who, "talents/arcane")
+			game.logSeen(who, "%s invokes the memory of Nienna!", who.name:capitalize())
+			return {id=true, used=true}
+		end
+	},
+}
+
 newEntity{ base = "BASE_LEATHER_BELT",
 	power_source = {nature=true},
 	unique = true,
diff --git a/ideas/lost-land-poosh.lua b/ideas/lost-land-poosh.lua
index 2cda50e006..f122e78390 100644
--- a/ideas/lost-land-poosh.lua
+++ b/ideas/lost-land-poosh.lua
@@ -166,6 +166,6 @@ game:onLevelLoad("wilderness-1", function(wzone, level)
 	game.zone:addEntity(game.level, g, "terrain", x, y)
 	print("Poosh portal added")
 end)
-local msg = "Message from #GOLD#DarkGod#WHITE#: Today we celebrate the 10000 days of total ToME4 playtime! This is over 27 years and a half.\nTo celebrate this you should find on your worldmap a new portal to the lost land of Poosh where you will see some new creatures and might find a useful item too!\nThank you all and have great fun!\n\nPS: Oh and do not forget to vote for ToME4 on http://te4.org/vote ! :)\n\nPS2: If you liked this special event, please say so in the forums I may do more later!"
+local msg = "Message from #GOLD#DarkGod#WHITE#: Today we celebrate hum .. something. Well I just wanted to give an other round of the fabled .... LOST LAND OF POOSH! Enjoy!"
 game.log(msg)
-require("engine.ui.Dialog"):simpleLongPopup("10000 days played!", msg, 500)
+require("engine.ui.Dialog"):simpleLongPopup("Poosh?!", msg, 500)
diff --git a/ideas/todo b/ideas/todo
index 4d48d3abf9..25c8cdb397 100644
--- a/ideas/todo
+++ b/ideas/todo
@@ -2,5 +2,6 @@
 * PIC TALENTS AT LVL 45 FOR HIGH STAT, CLASS DEPENDANT
 * redo shops
 * make low level more fun
-* "automatic" storage of various ingredients, replace alch quest
 * auto-leveling for beginners/lazy
+* md5sum saves & save it online to check local tempering
+* donator's fight club
-- 
GitLab