summaryrefslogtreecommitdiff
path: root/src/scripting
AgeCommit message (Collapse)AuthorFilesLines
2023-05-15General code cleanupsThorbjørn Lindeijer4-5/+9
* Overall includes cleanup * Use std::make_pair * Make some functions const
2022-08-19Apply C++11 fixitsThorbjørn Lindeijer3-20/+16
modernize-loop-convert modernize-deprecated-headers
2022-08-19Apply C++11 fixitsThorbjørn Lindeijer8-56/+56
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2022-05-25Fixed compile against Lua 5.4Thorbjørn Lindeijer1-4/+9
Now lua_resume takes 4 arguments, and the number of result values is set on the 4th one.
2015-06-07Fixed compile when using Lua 5.3Thorbjørn Lindeijer2-5/+3
It seems like properly upgrading to Lua 5.3 would affect quite a few small function calls, but fortunately compatibility can be achieved with just a define for now.
2013-12-29Small cleanupErik Schilling1-5/+2
- Deleted empty constructor rather than throwing, resulting in compiletime errors rather than runtime errors. - Removed some remainings of currentMana - Fixed some compiler warnings regarding structs getting forward declared as classes.
2013-11-01Fixed typo in docsErik Schilling1-2/+2
2013-09-29Fixed parameters of setting global cooldownErik Schilling1-1/+1
2013-09-26Store questlog values in the databaseErik Schilling1-41/+16
2013-09-21Fixed implementation of entity_inv_countThorbjørn Lindeijer1-12/+5
Was still checking for booleans and using the wrong stack indexes.
2013-09-21Removed invalid boolean check in set_questlog_description()Przemysław Grzywacz1-1/+0
2013-09-21Removed outdated documentationThorbjørn Lindeijer1-3/+0
2013-09-19Have Lua use entity IDs instead of direct pointersThorbjørn Lindeijer3-39/+125
Allows to report access to removed entities instead of crashing.
2013-09-14Allow to set the kill count againErik Schilling1-0/+20
We later need to check wether we still need this logic or whether we rather want to remove it in favor of the quest system. But we need this for sourceoftales for now.
2013-09-13Added basic questlog supportErik Schilling3-1/+132
I did this patch quite a while ago. Big thx to Stefan Beller for "rebasing" it.
2013-09-08Renamed character.cpp to charactercomponent.cppErik Schilling4-4/+4
Now we do not have two character.cpp files in the repository.
2013-09-08Cleaned up the inventory handlingErik Schilling1-25/+21
Things done: - Removed the equips table and added another column which keeps track about whether the item is equipped or not - Added a message to notify the client about failing equips instead of hardcoding to chat notification - Removed the move possibillity. It was a quite long function and our future idea of the inventory does not need any moves - Removed the inInventory and inEquipment parameters from chr_inv_count, but added a equipped key to the table that chr_get_inventory returns This change makes equipped items still being in the inventory. This means in-inventory triggers are still active! However it makes no sense to disable this triggers during equipping since it will appear as still in the inventory to the client.
2013-08-26Moved AttributeInfo into a seperate fileErik Schilling5-8/+8
2013-08-26Allowed to push attributeinfos for the attribute recalculationErik Schilling6-30/+101
While on it I replaced the id usage in the server with the usage of the AttributeInfo directly. Next steps: - Dehardcode the core attribute ids and store their attributeinfos somewhere in AttributeManager (for now i simply wrapped the ids with getAttributeInfo(). - Move AttributeInfo out of AttributeManager to shorten the usage + to allow using a pointer in ModifierLocation without forward declaring it.
2013-08-26Allow abilities name for use_ability()Erik Schilling1-3/+5
2013-08-26Removed ability categoriesErik Schilling1-17/+0
2013-08-26Use '/' as seperator for ability categories rather than '_'Erik Schilling1-3/+3
I find this a lot more readable.
2013-08-26Made cooldowns of abilities scriptableErik Schilling1-69/+34
- Removed hardcoded using of attributes - Simply introduced lua functions to set global and ability cooldowns - Requires database update - Bumps the protocol
2013-08-26Readded level handlingErik Schilling1-0/+66
Things done: Wrote a entity:give_experience function (lua side only). Renamed characterpoints to attributepoints (no db update. Did not want to do one for a simple rename). Temponary introduced a ATTR_LEVEL constant. TODO: dehardcode this. Script binds for settings the correction and attribute points.
2013-08-26Removed skillsErik Schilling3-105/+0
This removes support for skills. The plan is to allow to implement the skills as they were implemented before via attributes. This adds a lot more flexibility to the server creators while also removing the confusion about skills and attributes. So this change does: - Remove the skillmanager with all its calls, the skill xml file, etc - Move exp giving to the script engine: --> Allows to implement the old behaviour (and more) in the scripts - Remove the exp tag from the monster definition: + Since the server itself does not require it anymore it feels wrong to require it for EVERY monster. TODO: Add a system to add properties to the monsters/items.xml which allow defining things like the exp and allows to read the value from the script engine. + Small drawback, but it should not be hard to implement this property system. - Drop the level networking and calculation. + level calculation will happen via the attribute system later but i would prefer to do this in a seperate patch since this patch already got longer than expected especially since this requires to make setting correction points and available status points scriptable. + The level would be simply set as a attribute, the int number of it will be the level, the remaining digits will be the % number till the next levelup. - NOT remove any existing skill tables in the database update scripts. + There is no way to move them into the attribute table in a unified way (there are too many different way they could have been used). So server admins have to care about moving theirs skills to attributes themselves. + Keeping the old tables does not hurt for existing databases. So removing does not give any advantage/is required anyway. The now obsolote info about the EXP transaction is not removed for updated databases either. (The update script basically only bumps the version number without doing anything else. - bump the network protocol version --> old clients won't be able to connect. - bump the database version --> serveradmins need to update their db.
2013-08-26Allow names instead of ids for attributes + cleanupErik Schilling3-17/+31
I did not adapt the scripts yet since we need some special handling for the attributes which are required by the server directly. So you still have to use the ids for those. I will change that later. In the future I want to use the AttributeInfo class instead of the int id everywhere possible. So I did a small start on that too.
2013-08-26Added look_at bindErik Schilling1-0/+33
2013-08-26Added entity:destination() bindErik Schilling1-0/+18
2013-08-26Added function to check for length of a possible pathErik Schilling3-9/+54
2013-08-26Added get_monster_classes() bindErik Schilling2-0/+19
It returns all monster classes in a id->monsterclass table.
2013-08-26[Abilities] Added abilities to monstersErik Schilling1-10/+45
Monsters can now either receive abilities at lifetime via scripts, or via the <ability> node in the monsters node.
2013-08-26[Abilities] Removed the old autoattack systemErik Schilling2-509/+3
As a side effect i had to remove the monster attack AI for now. I will readd this as next thing.
2013-08-26[Abilities] Added a add_hit_taken bindErik Schilling1-0/+15
This allows to display hit messages in the client for abilities
2013-08-26[Abilities] Added support for a global cooldownErik Schilling3-36/+59
Each ability can now define a cooldown that prevents the player from using other abilities for a while. The time of this cooldown can be set to any attribute. The modified value of the attribute is the value of the cooldown in game ticks. The cooldown will be automatically started if the ability has `autoconsume` set to true. Otherwise a script has to call entity:cooldown_ability(ability).
2013-08-26[Abilities] Moved the ability code into a own componentErik Schilling1-9/+9
This later allows monsters and characters to use this component.
2013-08-26[Abilities] Made the rechargespeed depending on attributesErik Schilling1-57/+0
This allows a lot more flexibility and makes stuff like magical items a lot easier to implement. We will also use this for the attack system in the future. So a attack (abilitiy) would simply depend on some value like Agility (or a derived attribute from it). Which sets the recharge speed. The recharge speed is the modified value of the attribute per game tick.
2013-08-26[Abilities] Renamed set to categoryErik Schilling1-1/+1
On the one hand setSetName and setName could sound misleading in the qt client patch i plan. On the otherhand i never really liked the name "set". I think category is more general and obvious.
2013-08-26[Abilities] Renamed specials to abilitiesErik Schilling4-144/+145
2013-07-19Adapted the inline documentation for markdown docsErik Schilling1-163/+226
2013-05-03Made member function tables available as a globalsThorbjørn Lindeijer1-0/+5
This way the scripts can add or replace existing member functions, which can be useful. As demonstration chr_money and chr_money_change are now added as Entity.money and Entity.change_money. Also fixed the banker to use ask_number instead of ask_integer (I had decided to rename this and apparently forgot the banker). Mantis-issue: 503 Reviewed-by: Ablu
2013-05-02Fixed a bunch of cppcheck warningsErik Schilling2-8/+6
2013-04-27Use nullptr instead of NULL everywhereErik Schilling4-14/+14
2013-04-27Fixed typo in script docsErik Schilling1-1/+1
2013-04-15Forgot to rename npc_message in some docsThorbjørn Lindeijer1-11/+11
2013-04-15Fixed small script documentation errorThorbjørn Lindeijer1-1/+1
2013-04-15Fixed error messageThorbjørn Lindeijer1-1/+1
Thanks to Ablu for noticing.
2013-04-15Dropped the & from the Lua function tablesThorbjørn Lindeijer1-149/+149
It's not actually necessary.
2013-04-15Moved functions to entity members where appropriateThorbjørn Lindeijer1-465/+575
Some functions were skipped for now because they may need a new name or change of behavior. Changes: chr_warp entity:warp chr_get_inventory entity:inventory chr_inv_change entity:inv_change chr_inv_count entity:inv_count chr_get_equipment entity:equipment chr_equip_slot entity:equip_slot chr_equip_item entity:equip_item chr_unequip_slot entity:unequip_slot chr_unequip_item entity:unequip_item chr_get_level entity:level chr_get_exp entity:xp chr_give_exp entity:give_xp chr_get_rights entity:rights chr_set_hair_style entity:set_hair_style chr_get_hair_style entity:hair_style chr_set_hair_color entity:set_hair_color chr_get_hair_color entity:hair_color chr_get_kill_count entity:kill_count chr_give_special entity:give_special chr_has_special entity:has_special chr_take_special entity:take_special chr_set_special_recharge_speed entity:set_special_recharge_speed chr_get_special_recharge_speed entity:special_recharge_speed chr_set_special_mana entity:set_special_mana chr_get_special_mana entity:special_mana chr_kick entity:kick exp_for_level xp_for_level monster_get_id entity:monster_id monster_change_anger entity:change_anger monster_drop_anger entity:drop_anger monster_get_angerlist entity:angerlist being_apply_status entity:apply_status being_remove_status entity:remove_status being_has_status entity:has_status being_set_status_time entity:set_status_time being_get_status_time entity:status_time being_get_gender entity:gender being_set_gender entity:set_gender being_type entity:type being_walk entity:walk being_say entity:say being_damage entity:damage being_heal entity:heal being_get_name entity:name being_get_action entity:action being_set_action entity:set_action being_get_direction entity:direction being_set_direction entity:set_direction being_apply_attribute_modifier entity:apply_attribute_modifier being_remove_attribute_modifier entity:remove_attribute_modifier being_set_base_attribute entity:set_base_attribute being_get_modified_attribute entity:modified_attribute being_get_base_attribute entity:base_attribute being_set_walkmask entity:set_walkmask being_get_walkmask entity:walkmask being_get_mapid entity:mapid chat_message entity:message being_register entity:register chr_shake_screen entity:shake_screen chr_create_text_particle entity:show_text_particle - entity:position posX entity:x posY entity:y monster_get_name monsterclass:name item_get_name itemclass:name
2013-04-14Simplified some script function namesThorbjørn Lindeijer1-39/+38
npc_message -> say npc_choice -> ask npc_ask_integer -> ask_number npc_ask_string -> ask_string npc_trade -> trade
2013-04-14Removed NPC and character parameters from NPC functionsThorbjørn Lindeijer2-64/+69
These functions can only be used in the context of a character talking to an NPC, so these parameters can be deduced from that context rather than passing them explicitly all the time. Simplifies NPC scripting.