fix fluid colors and add few more items functionality from 781

This commit is contained in:
ErikasKontenis 2019-11-23 20:01:13 +02:00
parent c96b7af52b
commit c6c83bccea
7 changed files with 68 additions and 33 deletions

View File

@ -52,7 +52,7 @@ timeBetweenExActions = 1000
-- Map -- Map
-- NOTE: set mapName WITHOUT .otbm at the end -- NOTE: set mapName WITHOUT .otbm at the end
mapName = "map" mapName = "mymap"
mapAuthor = "CipSoft" mapAuthor = "CipSoft"
-- MySQL -- MySQL

View File

@ -135,6 +135,7 @@
<action itemid="4852" script="misc/ectoplasm_container.lua" /> <action itemid="4852" script="misc/ectoplasm_container.lua" />
<action itemid="3217" script="misc/letter_bag.lua" /> <action itemid="3217" script="misc/letter_bag.lua" />
<action fromid="3603" toid="3605" script="misc/baking.lua" /> <action fromid="3603" toid="3605" script="misc/baking.lua" />
<action itemid="5466" script="misc/distilling_rum.lua" />
<action fromid="3264" toid="3276" script="misc/weapons.lua" /> <action fromid="3264" toid="3276" script="misc/weapons.lua" />
<action fromid="3278" toid="3286" script="misc/weapons.lua" /> <action fromid="3278" toid="3286" script="misc/weapons.lua" />
<action fromid="3288" toid="3297" script="misc/weapons.lua" /> <action fromid="3288" toid="3297" script="misc/weapons.lua" />

View File

@ -0,0 +1,20 @@
local distillingMachines = {
[5468] = 5512,
[5469] = 5513
}
function onUse(player, item, fromPosition, target, toPosition)
if not target:isItem() then
return false
end
local machine = distillingMachines[target:getId()]
if machine then
target:transform(machine, 1)
target:decay()
item:remove(1)
return true
end
return false
end

View File

@ -37,6 +37,12 @@ Name = "lifefluid"
TypeID = 12 TypeID = 12
Name = "lemonade" Name = "lemonade"
TypeID = 13
Name = "rum"
TypeID = 14
Name = "coconut milk"
# --- end of server specific object types --- # --- end of server specific object types ---
TypeID = 100 TypeID = 100
@ -24702,7 +24708,7 @@ Name = "a fire bug"
Description = "This strange creature has the tendency to set certain things on fire" Description = "This strange creature has the tendency to set certain things on fire"
Flags = {UseEvent,MultiUse,Take} Flags = {UseEvent,MultiUse,Take}
Attributes = {Weight=3050,Brightness=3,LightColor=206} Attributes = {Weight=3050,Brightness=3,LightColor=206}
# pradeti nuo cia jau padariau, kad iseitu harvestinti sugar cane ir nepamirsti pridedineti naujus daiktus prie npc ir monstru, kurie jau egzistuoja
TypeID = 5468 TypeID = 5468
Name = "a distilling machine" Name = "a distilling machine"
Flags = {Bottom,Unpass,Unmove,Unlay} Flags = {Bottom,Unpass,Unmove,Unlay}
@ -24892,13 +24898,13 @@ Flags = {Unpass,Unmove,Unlay}
TypeID = 5512 TypeID = 5512
Name = "a distilling machine" Name = "a distilling machine"
Flags = {Bottom,Unpass,Unmove,Unlay,Expire} Flags = {Bottom,Unpass,Unmove,Unlay,Expire}
Attributes = {FluidSource=WINE,ExpireTarget=5468,TotalExpireTime=15} # TODO: FluidSource should be RUM Attributes = {FluidSource=RUM,ExpireTarget=5468,TotalExpireTime=10}
TypeID = 5513 TypeID = 5513
Name = "a distilling machine" Name = "a distilling machine"
Flags = {Bottom,Unpass,Unmove,Unlay,Expire} Flags = {Bottom,Unpass,Unmove,Unlay,Expire}
Attributes = {FluidSource=WINE,ExpireTarget=5469,TotalExpireTime=15} # TODO: FluidSource should be RUM Attributes = {FluidSource=RUM,ExpireTarget=5469,TotalExpireTime=10}
# pradeti nuo cia
TypeID = 5514 TypeID = 5514
Name = "a closed door" Name = "a closed door"
Flags = {Door,Unpass,Unmove,Unthrow,Unlay} Flags = {Door,Unpass,Unmove,Unthrow,Unlay}

View File

@ -122,6 +122,8 @@ enum FluidTypes_t : uint8_t
FLUID_MANAFLUID, FLUID_MANAFLUID,
FLUID_LIFEFLUID, FLUID_LIFEFLUID,
FLUID_LEMONADE, FLUID_LEMONADE,
FLUID_RUM,
FLUID_COCONUTMILK,
}; };
enum FluidColor_t : uint8_t enum FluidColor_t : uint8_t
@ -130,10 +132,12 @@ enum FluidColor_t : uint8_t
FLUID_COLOR_BLUE = 1, FLUID_COLOR_BLUE = 1,
FLUID_COLOR_PURPLE = 2, FLUID_COLOR_PURPLE = 2,
FLUID_COLOR_BROWN = 3, FLUID_COLOR_BROWN = 3,
FLUID_COLOR_RED = 4, FLUID_COLOR_BROWN1 = 4,
FLUID_COLOR_GREEN = 5, FLUID_COLOR_RED = 5,
FLUID_COLOR_YELLOW = 6, FLUID_COLOR_GREEN = 6,
FLUID_COLOR_WHITE = 7, FLUID_COLOR_BROWN2 = 7,
FLUID_COLOR_YELLOW = 8,
FLUID_COLOR_WHITE = 9,
}; };
enum SquareColor_t : uint8_t { enum SquareColor_t : uint8_t {

View File

@ -1407,6 +1407,7 @@ void LuaScriptInterface::registerFunctions()
registerEnum(FLUID_MANAFLUID) registerEnum(FLUID_MANAFLUID)
registerEnum(FLUID_LIFEFLUID) registerEnum(FLUID_LIFEFLUID)
registerEnum(FLUID_LEMONADE) registerEnum(FLUID_LEMONADE)
registerEnum(FLUID_RUM)
registerEnum(TALKTYPE_SAY) registerEnum(TALKTYPE_SAY)
registerEnum(TALKTYPE_WHISPER) registerEnum(TALKTYPE_WHISPER)

View File

@ -188,40 +188,42 @@ std::string transformToSHA1(const std::string& input)
uint8_t getLiquidColor(uint8_t type) uint8_t getLiquidColor(uint8_t type)
{ {
uint8_t result = 0; uint8_t result = FLUID_COLOR_NONE;
switch (type) switch (type)
{ {
case 1: case FLUID_WATER:
result = 1; result = FLUID_COLOR_BLUE;
break; break;
case 0: case FLUID_NONE:
result = 0; result = FLUID_COLOR_NONE;
break; break;
case 6: case FLUID_SLIME:
result = 4; result = FLUID_COLOR_GREEN;
break; break;
case 3: case FLUID_BEER:
case 4: case FLUID_MUD:
case 7: case FLUID_OIL:
result = 3; case FLUID_RUM:
result = FLUID_COLOR_BROWN;
break; break;
case 9: case FLUID_MILK:
result = 6; case FLUID_COCONUTMILK:
result = FLUID_COLOR_WHITE;
break; break;
case 2: case FLUID_WINE:
case 10: case FLUID_MANAFLUID:
result = 7; result = FLUID_COLOR_PURPLE;
break; break;
case 5: case FLUID_BLOOD:
case 11: case FLUID_LIFEFLUID:
result = 2; result = FLUID_COLOR_RED;
break; break;
case 8: case FLUID_URINE:
case 12: case FLUID_LEMONADE:
result = 5; result = FLUID_COLOR_YELLOW;
break; break;
default: default:
result = 0; result = FLUID_COLOR_NONE;
break; break;
} }
return result; return result;
@ -717,7 +719,8 @@ FluidNames fluidNames[] = {
{"milk", FLUID_MILK}, {"milk", FLUID_MILK},
{"manafluid", FLUID_MANAFLUID}, {"manafluid", FLUID_MANAFLUID},
{"lifefluid", FLUID_LIFEFLUID}, {"lifefluid", FLUID_LIFEFLUID},
{"lemonade", FLUID_LEMONADE} {"lemonade", FLUID_LEMONADE},
{"rum", FLUID_RUM}
}; };
MagicEffectClasses getMagicEffect(const std::string& strValue) MagicEffectClasses getMagicEffect(const std::string& strValue)