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
-- NOTE: set mapName WITHOUT .otbm at the end
mapName = "map"
mapName = "mymap"
mapAuthor = "CipSoft"
-- MySQL

View File

@ -135,6 +135,7 @@
<action itemid="4852" script="misc/ectoplasm_container.lua" />
<action itemid="3217" script="misc/letter_bag.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="3278" toid="3286" 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
Name = "lemonade"
TypeID = 13
Name = "rum"
TypeID = 14
Name = "coconut milk"
# --- end of server specific object types ---
TypeID = 100
@ -24702,7 +24708,7 @@ Name = "a fire bug"
Description = "This strange creature has the tendency to set certain things on fire"
Flags = {UseEvent,MultiUse,Take}
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
Name = "a distilling machine"
Flags = {Bottom,Unpass,Unmove,Unlay}
@ -24892,13 +24898,13 @@ Flags = {Unpass,Unmove,Unlay}
TypeID = 5512
Name = "a distilling machine"
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
Name = "a distilling machine"
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
Name = "a closed door"
Flags = {Door,Unpass,Unmove,Unthrow,Unlay}

View File

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

View File

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

View File

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