Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Merge branch 'feature/trust' into canary
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/map/navmesh.cpp
  • Loading branch information
zach2good committed Nov 1, 2020
2 parents e009425 + e4b7474 commit 6a03301
Show file tree
Hide file tree
Showing 31 changed files with 412 additions and 128 deletions.
24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,30 @@ local quests = tpz.quest.id.sandoria
```
insert into table_name
```
#### Commenting in SQL
Our SQL tables are big and confusing, and they are also modified by hand. It can be very helpful to leave _short_ comments on your additions and modifications to highlight what they are.

**Example**

Without a comment, this entry is not easily human-readable:

```sql
INSERT INTO `mob_droplist` VALUES (504,0,0,1000,888,340);
```

So we instead store it as:

```sql
INSERT INTO `mob_droplist` VALUES (504,0,0,1000,888,340); -- (Colossal Calamari) seashell
```

Conversely, `Combo` weaponskill doesn't need any additional comments because it has a name field:

```sql
INSERT INTO `weapon_skills` VALUES (1,'combo',0x02020000000200000000000002000000000202000000,1,5,0,16,2000,5,1,8,0,0,0,0);
```

The format of the comment isn't massively important, but it is preferred not to use ';' as a seperator in the middle of your comment. This is a little confusing, as it's the statement-terminator in SQL.

## SQL Migrations for Schema changes

Expand Down
7 changes: 6 additions & 1 deletion scripts/globals/abilities/assassins_charge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ end

function onUseAbility(player, target, ability)
local merits = player:getMerit(tpz.merit.ASSASSINS_CHARGE)
player:addStatusEffect(tpz.effect.ASSASSINS_CHARGE, merits - 5, 0, 60, player:getMod(tpz.mod.AUGMENTS_ASSASSINS_CHARGE), merits / 5)
local crit = 0
if player:getMod(tpz.mod.AUGMENTS_ASSASSINS_CHARGE) > 0 then
crit = merits / 5
end

player:addStatusEffect(tpz.effect.ASSASSINS_CHARGE, merits - 5, 0, 60, 0, crit)
end
2 changes: 1 addition & 1 deletion scripts/globals/abilities/devotion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function onUseAbility(player, target, ability)
-- printf("Devotion MP Healed: %d", healMP)

damageHP = utils.stoneskin(player, damageHP)
player:takeDamage(damageHP)
player:delHP(damageHP)
target:addMP(healMP)

return healMP
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/abilities/martyr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function onUseAbility(player, target, ability)
-- printf("Martyr Healed HP: %d", healHP)

damageHP = utils.stoneskin(player, damageHP)
player:takeDamage(damageHP)
player:delHP(damageHP)
target:addHP(healHP)

return healHP
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/effects/assassins_charge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require("scripts/globals/status")
function onEffectGain(target, effect)
target:addMod(tpz.mod.QUAD_ATTACK, effect:getPower())
target:addMod(tpz.mod.TRIPLE_ATTACK, 100)
if (effect:getSubType() > 0) then
if (effect:getSubPower() > 0) then
target:addMod(tpz.mod.CRITHITRATE, effect:getSubPower())
end
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/keyitems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ tpz.keyItem =
MARBLE_BRIDGE_COASTER = 705,
LAMP_LIGHTERS_MEMBERSHIP_CARD = 706,
SHAFT_GATE_OPERATING_DIAL = 707,
MYSTERIOUS_AMULET = 708,
MYSTERIOUS_AMULET_PRISHE = 708,
MIRE_INCENSE = 709,
BRAND_OF_DAWN = 710,
BRAND_OF_TWILIGHT = 711,
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/weaponskills.lua
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ function souleaterBonus(attacker, numhits)
end
hitscounted = hitscounted + 1
end
attacker:takeDamage(numhits*0.10*attacker:getHP())
attacker:delHP(numhits*0.10*attacker:getHP())
return damage
else
return 0
Expand Down
3 changes: 3 additions & 0 deletions scripts/zones/AlTaieu/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ zones[tpz.zone.ALTAIEU] =
QUASILUMIN_01 = 7365, -- This is Al'Taieu. The celestial capital overflowing with the blessings of Altana.
NOTHING_OF_INTEREST = 7475, -- There is nothing of interest here.
OMINOUS_SHADOW = 7476, -- An ominous shadow falls over you...
AMULET_SHATTERED = 7497, -- The mysterious amulet held by <player> has shattered...
LIGHT_STOLEN = 7498, -- The light of <mea/holla/dem> was stolen by Nag'molada...
RETURN_AMULET_TO_PRISHE = 7523, -- You return the mysterious amulet to Prishe.
HOMEPOINT_SET = 7564, -- Home point set!
},
mob =
Expand Down
10 changes: 10 additions & 0 deletions scripts/zones/AlTaieu/Zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,21 @@ end

function onEventFinish(player, csid, option)
if (csid == 1) then
local copCraigLights = -- Nag'molada steals one random light
{
tpz.ki.LIGHT_OF_HOLLA,
tpz.ki.LIGHT_OF_DEM,
tpz.ki.LIGHT_OF_MEA
}
player:setCharVar("PromathiaStatus", 1)
player:addKeyItem(tpz.ki.LIGHT_OF_ALTAIEU)
player:messageSpecial(ID.text.AMULET_SHATTERED, tpz.ki.MYSTERIOUS_AMULET)
player:messageSpecial(ID.text.LIGHT_STOLEN, copCraigLights[math.random(#copCraigLights)])
player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.LIGHT_OF_ALTAIEU)
player:addTitle(tpz.title.SEEKER_OF_THE_LIGHT)
elseif (csid == 167) then
player:setCharVar("PromathiaStatus", 1)
player:delKeyItem(tpz.ki.MYSTERIOUS_AMULET_PRISHE)
player:messageSpecial(ID.text.RETURN_AMULET_TO_PRISHE, tpz.ki.MYSTERIOUS_AMULET)
end
end
31 changes: 30 additions & 1 deletion scripts/zones/Carpenters_Landing/npcs/Anguenet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,45 @@
-- Type: Adventurer's Assistant
-- !pos 214.672 -3.013 -527.561 2
-----------------------------------
local ID = require("scripts/zones/Carpenters_Landing/IDs")
require("scripts/globals/npc_util")

function onTrade(player, npc, trade)
if
player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.TEA_WITH_A_TONBERRY) == QUEST_ACCEPTED and
player:getCharVar('TEA_WITH_A_TONBERRY_PROG') == 1 and
npcUtil.tradeHas(trade, 1683)
then
player:startEvent(29)
end
end

function onTrigger(player, npc)
player:startEvent(21)
local teaGinseng = player:getCharVar('TEA_WITH_A_TONBERRY_PROG')

if player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.TEA_WITH_A_TONBERRY) == QUEST_ACCEPTED then
if teaGinseng == 0 then
player:startEvent(27, 0, 1683)
elseif teaGinseng == 1 then
player:startEvent(28, 0, 1683)
else
player:startEvent(21)
end
else
player:startEvent(21)
end
end

function onEventUpdate(player, csid, option)
end

function onEventFinish(player, csid, option)
if csid == 27 then
player:setCharVar('TEA_WITH_A_TONBERRY_PROG', 1)
elseif csid == 29 then
player:tradeComplete()
player:addKeyItem(tpz.keyItem.TONBERRY_BLACKBOARD)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.keyItem.TONBERRY_BLACKBOARD)
player:setCharVar('TEA_WITH_A_TONBERRY_PROG', 2)
end
end
3 changes: 3 additions & 0 deletions scripts/zones/Davoi/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ zones[tpz.zone.DAVOI] =
AN_ORCISH_STORAGE_HOLE = 7450, -- An Orcish storage hole. There is something inside, but you cannot open it without a key.
A_WELL = 7452, -- A well, presumably dug by Orcs.
CHEST_UNLOCKED = 7471, -- You unlock the chest!
NOTHING_TO_DO = 7921, -- You have nothing left to do here.
UNDER_ATTACK = 7923, -- You are under attack!
COMMON_SENSE_SURVIVAL = 7972, -- It appears that you have arrived at a new survival guide provided by the Adventurers' Mutual Aid Network. Common sense dictates that you should now be able to teleport here from similar tomes throughout the world.
},
mob =
Expand Down Expand Up @@ -69,6 +71,7 @@ zones[tpz.zone.DAVOI] =
PURPLEFLASH_BRUKDOK = 17387969,
ONE_EYED_GWAJBOJ = 17387970,
THREE_EYED_PROZPUZ = 17387971,
HEMATIC_CYST = 17387972,
},
npc =
{
Expand Down
9 changes: 9 additions & 0 deletions scripts/zones/Davoi/mobs/Hematic_Cyst.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-----------------------------------
-- Area: Davoi
-- NM: Hematic Cyst
-- Involved in Quest: Tea with a Tonberry?
-----------------------------------

function onMobDeath(mob, player, isKiller)
player:setCharVar("TEA_WITH_A_TONBERRY_PROG", 4)
end
43 changes: 43 additions & 0 deletions scripts/zones/Davoi/npcs/qm2.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-----------------------------------
-- Area: Davoi
-- NPC: ??? (qm2)
-- Involved in Quest: Tea with a Tonberry
-- !pos 189.201 1.2553 -383.921 149
-----------------------------------
require("scripts/globals/npc_util")
local ID = require("scripts/zones/Davoi/IDs")
-----------------------------------

function onTrade(player, npc, trade)
if player:getCharVar('TEA_WITH_A_TONBERRY_PROG') == 3 then
if npcUtil.tradeHas(trade, 1682) and not GetMobByID(ID.mob.HEMATIC_CYST):isSpawned() then
-- Treasury Gold spawns Hematic Cyst
SpawnMob(ID.mob.HEMATIC_CYST):updateClaim(player)
player:confirmTrade()
player:messageText(npc, ID.text.UNDER_ATTACK, false)
end
end
end

function onTrigger(player, npc)
local teaProg = player:getCharVar('TEA_WITH_A_TONBERRY_PROG')

if teaProg == 3 then
player:messageSpecial(7920, 0, 1682)
elseif teaProg == 4 then
player:startEvent(126, 149, 1682)
elseif teaProg == 5 then
player:messageText(npc, ID.text.NOTHING_TO_DO, false)
else
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
end
end

function onEventUpdate(player, csid, option)
end

function onEventFinish(player, csid, option)
if csid == 126 then
player:setCharVar('TEA_WITH_A_TONBERRY_PROG', 5)
end
end
8 changes: 7 additions & 1 deletion scripts/zones/Phanauet_Channel/npcs/Riche.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ function onTrade(player, npc, trade)
end

function onTrigger(player, npc)
player:startEvent(5)
if player:hasKeyItem(tpz.keyItem.TONBERRY_BLACKBOARD) then
player:startEvent(5, 1, 627, 1682, 63, 3, 30, 30, 0)
end
end

function onEventUpdate(player, csid, option)
end

function onEventFinish(player, csid, option)
if csid == 5 then
player:delKeyItem(tpz.keyItem.TONBERRY_BLACKBOARD) -- No message as the cutscene ends with the NPC taking it
player:setCharVar('TEA_WITH_A_TONBERRY_PROG', 3)
end
end
40 changes: 30 additions & 10 deletions scripts/zones/Southern_San_dOria/npcs/Sobane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
-- Involved in quest: Sharpening the Sword, Riding on the Clouds
-- !pos -190 -3 97 230
-- csid: 52 732 733 734 735 736 737 738 739 740 741
-------------------------------------
------------------------------------
local ID = require("scripts/zones/Southern_San_dOria/IDs")
require("scripts/globals/keyitems")
require("scripts/globals/npc_util")
require("scripts/globals/quests")
Expand All @@ -25,22 +26,35 @@ function onTrade(player, npc, trade)
end

function onTrigger(player, npc)
local blood = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.SIGNED_IN_BLOOD)
local signedInBlood = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.SIGNED_IN_BLOOD)
local bloodProg = player:getCharVar("SIGNED_IN_BLOOD_Prog")
local teaWithATonberry = player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.TEA_WITH_A_TONBERRY)

-- SHARPENING THE SWORD
if player:getCharVar("sharpeningTheSwordCS") >= 2 then
player:startEvent(52)

-- SIGNED IN BLOOD
elseif blood == QUEST_AVAILABLE and player:getFameLevel(SANDORIA) >= 3 then
player:startEvent(732, 0, 1662) -- Start Quest
elseif blood == QUEST_ACCEPTED and bloodProg < 1 then
player:startEvent(733, 0, 1662)
elseif blood == QUEST_ACCEPTED and bloodProg == 3 then
player:startEvent(736) -- complete
elseif blood == QUEST_ACCEPTED and bloodProg >= 1 then
player:startEvent(735)
elseif signedInBlood == QUEST_AVAILABLE and player:getFameLevel(SANDORIA) >= 3 then
player:startEvent(732, 0, 1662)
elseif signedInBlood == QUEST_ACCEPTED then
if bloodProg < 1 then
player:startEvent(733, 0, 1662)
elseif bloodProg == 3 then
player:startEvent(736)
elseif bloodProg >= 1 then
player:startEvent(735)
end
elseif signedInBlood == QUEST_COMPLETED and player:needToZone() then
player:startEvent(737)
elseif signedInBlood == QUEST_COMPLETED and teaWithATonberry == QUEST_AVAILABLE then
player:startEvent(738)
elseif teaWithATonberry == QUEST_ACCEPTED then
if player:getCharVar("TEA_WITH_A_TONBERRY_PROG") == 5 then
player:startEvent(740)
else
player:startEvent(739)
end
end
end

Expand All @@ -60,5 +74,11 @@ function onEventFinish(player, csid, option)
elseif csid == 736 and npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.SIGNED_IN_BLOOD, {item = 14760, gil = 3500, var = "SIGNED_IN_BLOOD_Prog"}) then
player:delKeyItem(tpz.ki.TORN_OUT_PAGES)
player:confirmTrade()
elseif csid == 735 then
player:needToZone(true)
elseif csid == 738 then
player:addQuest(SANDORIA, tpz.quest.id.sandoria.TEA_WITH_A_TONBERRY)
elseif csid == 740 and npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.TEA_WITH_A_TONBERRY, {item = 13174}) then
player:setCharVar("TEA_WITH_A_TONBERRY_PROG", 0)
end
end
7 changes: 6 additions & 1 deletion scripts/zones/Tavnazian_Safehold/npcs/_0qa.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
-- Involved in mission 2-4
-- !pos 111 -41 41 26
-----------------------------------
local ID = require("scripts/zones/Tavnazian_Safehold/IDs")
require("scripts/globals/keyitems")
require("scripts/globals/missions")
-----------------------------------
Expand All @@ -30,7 +31,11 @@ end

function onEventFinish(player, csid, option)

if (csid == 104 or csid == 111) then
if csid == 104 then
player:setCharVar("PromathiaStatus", 1)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.MYSTERIOUS_AMULET_DRAINED)
player:addKeyItem(tpz.ki.MYSTERIOUS_AMULET_DRAINED)
elseif csid == 111 then
player:setCharVar("PromathiaStatus", 1)
elseif (csid == 115) then
player:setCharVar("PromathiaStatus", 0)
Expand Down
2 changes: 2 additions & 0 deletions scripts/zones/The_Garden_of_RuHmet/Zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ function onEventFinish(player, csid, option)
player:setCharVar("Ru-Hmet-TP", 0)
elseif (csid == 201) then
player:setCharVar("PromathiaStatus", 1)
player:addKeyItem(tpz.ki.MYSTERIOUS_AMULET_PRISHE)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.MYSTERIOUS_AMULET)
elseif (csid == 32000 and option==1) then
player:setPos(420, 0, 398, 68)
end
Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Upper_Jeuno/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ zones[tpz.zone.UPPER_JEUNO] =
KIRISOMANRISO_DIALOG = 8071, -- Delivering goods to residences everywhere!
ITEM_DELIVERY_DIALOG = 8071, -- Delivering goods to residences everywhere!
DECIMATION_LEARNED = 8194, -- You have learned the weapon skill Decimation!
LEND_PRISHE_AMULET = 8331, -- You lend the mysterious amulet to Prishe.
UNLOCK_DANCER = 11825, -- You can now become a dancer!
},
mob =
Expand Down
2 changes: 2 additions & 0 deletions scripts/zones/Upper_Jeuno/npcs/Monberaux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ function onEventFinish(player, csid, option)
player:startEvent(207) --207
elseif (csid == 82) then
player:setCharVar("PromathiaStatus", 1)
player:delKeyItem(tpz.ki.MYSTERIOUS_AMULET_DRAINED)
player:messageSpecial(ID.text.LEND_PRISHE_AMULET, tpz.ki.MYSTERIOUS_AMULET_PRISHE)
elseif (csid == 75) then
player:setCharVar("PromathiaStatus", 0)
player:completeMission(COP, tpz.mission.id.cop.DARKNESS_NAMED)
Expand Down
2 changes: 1 addition & 1 deletion sql/augments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ INSERT INTO `augments` VALUES (1357, 0, 0, 0, 0, 0); -- Enhances "Paralyze II" e
INSERT INTO `augments` VALUES (1358, 0, 0, 0, 0, 0); -- Enhances "Aura Steal" effect
INSERT INTO `augments` VALUES (1359, 0, 0, 0, 0, 0); -- Enhances "Ambush" effect
INSERT INTO `augments` VALUES (1360, 0, 0, 0, 0, 0); -- Enhances "Feint" effect
INSERT INTO `augments` VALUES (1361, 0, 0, 0, 0, 0); -- Enh. "Assassins Charge" effect
INSERT INTO `augments` VALUES (1361, 0, 886, 1, 0, 0); -- Enh. "Assassins Charge" effect
INSERT INTO `augments` VALUES (1362, 0, 0, 0, 0, 0); -- 1362 currently unused. Leave at zero. Edit+move or remove this note as new augments get discovered.
INSERT INTO `augments` VALUES (1363, 0, 0, 0, 0, 0); -- 1363 currently unused. Leave at zero. Edit+move or remove this note as new augments get discovered.
INSERT INTO `augments` VALUES (1364, 0, 0, 0, 0, 0); -- Enhances "Iron Will" effect
Expand Down
Loading

0 comments on commit 6a03301

Please sign in to comment.